Skip to content

Commit

Permalink
Add @narval/transaction-request-intent package
Browse files Browse the repository at this point in the history
Co-author: Pierre <pierre@narval.xyz>
  • Loading branch information
wcalderipe committed Jan 10, 2024
1 parent d329bdc commit 8477ae2
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"error",
{
"enforceBuildableLibDependency": true,
"allow": ["@app/**"],
"allow": ["@app/**", "@narval/**"],
"depConstraints": [
{
"sourceTag": "*",
Expand Down
4 changes: 3 additions & 1 deletion apps/authz/src/app/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { transactionRequestIntent } from '@narval/transaction-request-intent'
import { Controller, Get, Logger } from '@nestjs/common'

import { AppService } from './app.service'
Expand All @@ -16,7 +17,8 @@ export class AppController {
@Get('/ping')
ping() {
this.logger.log({
message: 'Received ping'
message: 'Received ping',
test: transactionRequestIntent()
})

return 'pong'
Expand Down
3 changes: 3 additions & 0 deletions packages/transaction-request-intent/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@nrwl/js/babel", { "useBuiltIns": "usage" }]]
}
18 changes: 18 additions & 0 deletions packages/transaction-request-intent/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
11 changes: 11 additions & 0 deletions packages/transaction-request-intent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# transaction-request-intent

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test transaction-request-intent` to execute the unit tests via [Jest](https://jestjs.io).

## Running lint

Run `nx lint transaction-request-intent` to execute the lint via [ESLint](https://eslint.org/).
16 changes: 16 additions & 0 deletions packages/transaction-request-intent/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Config } from 'jest'

const config: Config = {
displayName: 'transaction-request-intent',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }]
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/packages/transaction-request-intent',
moduleNameMapper: {
'^@narval/transaction-request-intent/(.*)$': '<rootDir>/src/$1'
}
}

export default config
9 changes: 9 additions & 0 deletions packages/transaction-request-intent/jest.unit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Config } from 'jest'
import sharedConfig from './jest.config'

const config: Config = {
...sharedConfig,
testMatch: ['<rootDir>/**/__test__/unit/**/*.spec.ts']
}

export default config
24 changes: 24 additions & 0 deletions packages/transaction-request-intent/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "transaction-request-intent",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/transaction-request-intent/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/transaction-request-intent/**/*.ts"]
}
},
"test:unit": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/transaction-request-intent/jest.unit.ts",
"verbose": true
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions packages/transaction-request-intent/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/transaction-request-intent'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { transactionRequestIntent } from '@narval/transaction-request-intent'

describe('transactionRequestIntent', () => {
it('should work', () => {
expect(transactionRequestIntent()).toEqual('transaction-request-intent')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function transactionRequestIntent(): string {
return 'transaction-request-intent'
}
19 changes: 19 additions & 0 deletions packages/transaction-request-intent/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}
10 changes: 10 additions & 0 deletions packages/transaction-request-intent/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": []
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts"]
}
20 changes: 20 additions & 0 deletions packages/transaction-request-intent/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"paths": {
"@app/authz/*": ["apps/authz/src/*"],
"@app/orchestration/*": ["apps/orchestration/src/*"],
"@narval/transaction-engine-module": ["packages/transaction-engine-module/src/index.ts"]
"@narval/transaction-engine-module": ["packages/transaction-engine-module/src/index.ts"],
"@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down

0 comments on commit 8477ae2

Please sign in to comment.