Add Domain Template
This commit is contained in:
parent
dca326d0c5
commit
8aaf4c73e8
1
packages/templates/domain/README.md
Normal file
1
packages/templates/domain/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# template-domain
|
||||||
22
packages/templates/domain/package.json
Normal file
22
packages/templates/domain/package.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "@ulthar/template-domain",
|
||||||
|
"type": "module",
|
||||||
|
"module": "dist/index.js",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"private": true,
|
||||||
|
"packageManager": "yarn@4.1.1",
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.5.4",
|
||||||
|
"vitest": "^2.0.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@ulthar/fabric-core": "workspace:^"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "vitest",
|
||||||
|
"build": "tsc -p tsconfig.build.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
packages/templates/domain/src/events/index.ts
Normal file
0
packages/templates/domain/src/events/index.ts
Normal file
5
packages/templates/domain/src/index.ts
Normal file
5
packages/templates/domain/src/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export * from "./events/index.js";
|
||||||
|
export * from "./models/index.js";
|
||||||
|
export * from "./security/index.js";
|
||||||
|
export * from "./services/index.js";
|
||||||
|
export * from "./use-cases/index.js";
|
||||||
0
packages/templates/domain/src/models/index.ts
Normal file
0
packages/templates/domain/src/models/index.ts
Normal file
3
packages/templates/domain/src/security/index.ts
Normal file
3
packages/templates/domain/src/security/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export * from "./permission.js";
|
||||||
|
export * from "./policy.js";
|
||||||
|
export * from "./users.js";
|
||||||
10
packages/templates/domain/src/security/permission.ts
Normal file
10
packages/templates/domain/src/security/permission.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { EnumToValues } from "@ulthar/fabric-core";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A permission is a string that represents a something that a user is allowed to do in the system. It should be in the form of: `ACTION_ENTITY`.
|
||||||
|
* - `ACTION`: The domain action that the user can perform on the domain object. This is a domain verb in the imperative mood. i.e. "CREATE", "EDIT", "VIEW", "FIX", "RELEASE", etc.
|
||||||
|
* - `ENTITY`: The domain object that the user can perform the action on. This is a domain noun in the singular form.
|
||||||
|
*/
|
||||||
|
export const Permission = {} as const;
|
||||||
|
|
||||||
|
export type Permission = EnumToValues<typeof Permission>;
|
||||||
5
packages/templates/domain/src/security/policy.ts
Normal file
5
packages/templates/domain/src/security/policy.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { Policy } from "@ulthar/fabric-core";
|
||||||
|
import { Permission } from "./permission.js";
|
||||||
|
import { UserType } from "./users.js";
|
||||||
|
|
||||||
|
export const policy = {} as const satisfies Policy<UserType, Permission>;
|
||||||
11
packages/templates/domain/src/security/users.ts
Normal file
11
packages/templates/domain/src/security/users.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { EnumToValues } from "@ulthar/fabric-core";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A User Type is a string that represents a user type.
|
||||||
|
* It should be in uppercase and singular form.
|
||||||
|
*/
|
||||||
|
export const UserType = {
|
||||||
|
// ADMIN: "ADMIN",
|
||||||
|
// SPECIAL_USER: "SPECIAL_USER",
|
||||||
|
};
|
||||||
|
export type UserType = EnumToValues<typeof UserType>;
|
||||||
0
packages/templates/domain/src/services/index.ts
Normal file
0
packages/templates/domain/src/services/index.ts
Normal file
5
packages/templates/domain/src/use-cases.ts
Normal file
5
packages/templates/domain/src/use-cases.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { UseCaseDefinition } from "@ulthar/fabric-core";
|
||||||
|
|
||||||
|
export const UseCases = [] as const satisfies UseCaseDefinition[];
|
||||||
|
|
||||||
|
export type UseCases = typeof UseCases;
|
||||||
0
packages/templates/domain/src/use-cases/index.ts
Normal file
0
packages/templates/domain/src/use-cases/index.ts
Normal file
15
packages/templates/domain/tsconfig.build.json
Normal file
15
packages/templates/domain/tsconfig.build.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": false,
|
||||||
|
"allowImportingTsExtensions": false,
|
||||||
|
"outDir": "dist"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"dist",
|
||||||
|
"node_modules",
|
||||||
|
"coverage",
|
||||||
|
"vitest.config.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
4
packages/templates/domain/tsconfig.json
Normal file
4
packages/templates/domain/tsconfig.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../../tsconfig.json",
|
||||||
|
"exclude": ["dist", "node_modules"]
|
||||||
|
}
|
||||||
10
packages/templates/domain/vitest.config.ts
Normal file
10
packages/templates/domain/vitest.config.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
coverage: {
|
||||||
|
exclude: ["**/index.ts"],
|
||||||
|
},
|
||||||
|
passWithNoTests: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
59
yarn.lock
59
yarn.lock
@ -390,10 +390,10 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@eslint/js@npm:9.9.1, @eslint/js@npm:^9.9.1":
|
"@eslint/js@npm:9.10.0, @eslint/js@npm:^9.9.1":
|
||||||
version: 9.9.1
|
version: 9.10.0
|
||||||
resolution: "@eslint/js@npm:9.9.1"
|
resolution: "@eslint/js@npm:9.10.0"
|
||||||
checksum: 10c0/a3a91de2ce78469f7c4eee78c1eba77360706e1d0fa0ace2e19102079bcf237b851217c85ea501dc92c4c3719d60d9df966977abc8554d4c38e3638c1f53dcb2
|
checksum: 10c0/2ac45a002dc1ccf25be46ea61001ada8d77248d1313ab4e53f3735e5ae00738a757874e41f62ad6fbd49df7dffeece66e5f53ff0d7b78a99ce4c68e8fea66753
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -404,6 +404,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@eslint/plugin-kit@npm:^0.1.0":
|
||||||
|
version: 0.1.0
|
||||||
|
resolution: "@eslint/plugin-kit@npm:0.1.0"
|
||||||
|
dependencies:
|
||||||
|
levn: "npm:^0.4.1"
|
||||||
|
checksum: 10c0/fae97cd4efc1c32501c286abba1b5409848ce8c989e1ca6a5bb057a304a2cd721e6e957f6bc35ce95cfd0871e822ed42df3c759fecdad72c30e70802e26f83c7
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@humanwhocodes/module-importer@npm:^1.0.1":
|
"@humanwhocodes/module-importer@npm:^1.0.1":
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
resolution: "@humanwhocodes/module-importer@npm:1.0.1"
|
resolution: "@humanwhocodes/module-importer@npm:1.0.1"
|
||||||
@ -695,11 +704,11 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:*, @types/node@npm:>=20":
|
"@types/node@npm:*, @types/node@npm:>=20":
|
||||||
version: 22.5.3
|
version: 22.5.4
|
||||||
resolution: "@types/node@npm:22.5.3"
|
resolution: "@types/node@npm:22.5.4"
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: "npm:~6.19.2"
|
undici-types: "npm:~6.19.2"
|
||||||
checksum: 10c0/a068e31dd424a0eadfba7d9a5c5b415b76cfd729f3caa299674ad257f59df85c5fe77f1d0a343e811864c790baefb9003d7627618ee3cf85400af338481ba29f
|
checksum: 10c0/b445daa7eecd761ad4d778b882d6ff7bcc3b4baad2086ea9804db7c5d4a4ab0298b00d7f5315fc640a73b5a1d52bbf9628e09c9fec0cf44dbf9b4df674a8717d
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -847,6 +856,16 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"@ulthar/template-domain@workspace:packages/templates/domain":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "@ulthar/template-domain@workspace:packages/templates/domain"
|
||||||
|
dependencies:
|
||||||
|
"@ulthar/fabric-core": "workspace:^"
|
||||||
|
typescript: "npm:^5.5.4"
|
||||||
|
vitest: "npm:^2.0.5"
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"@vitest/expect@npm:2.0.5":
|
"@vitest/expect@npm:2.0.5":
|
||||||
version: 2.0.5
|
version: 2.0.5
|
||||||
resolution: "@vitest/expect@npm:2.0.5"
|
resolution: "@vitest/expect@npm:2.0.5"
|
||||||
@ -1219,14 +1238,14 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"debug@npm:4, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:~4.3.6":
|
"debug@npm:4, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:~4.3.6":
|
||||||
version: 4.3.6
|
version: 4.3.7
|
||||||
resolution: "debug@npm:4.3.6"
|
resolution: "debug@npm:4.3.7"
|
||||||
dependencies:
|
dependencies:
|
||||||
ms: "npm:2.1.2"
|
ms: "npm:^2.1.3"
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
supports-color:
|
supports-color:
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 10c0/3293416bff072389c101697d4611c402a6bacd1900ac20c0492f61a9cdd6b3b29750fc7f5e299f8058469ef60ff8fb79b86395a30374fbd2490113c1c7112285
|
checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -1497,14 +1516,15 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"eslint@npm:^9.9.1":
|
"eslint@npm:^9.9.1":
|
||||||
version: 9.9.1
|
version: 9.10.0
|
||||||
resolution: "eslint@npm:9.9.1"
|
resolution: "eslint@npm:9.10.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/eslint-utils": "npm:^4.2.0"
|
"@eslint-community/eslint-utils": "npm:^4.2.0"
|
||||||
"@eslint-community/regexpp": "npm:^4.11.0"
|
"@eslint-community/regexpp": "npm:^4.11.0"
|
||||||
"@eslint/config-array": "npm:^0.18.0"
|
"@eslint/config-array": "npm:^0.18.0"
|
||||||
"@eslint/eslintrc": "npm:^3.1.0"
|
"@eslint/eslintrc": "npm:^3.1.0"
|
||||||
"@eslint/js": "npm:9.9.1"
|
"@eslint/js": "npm:9.10.0"
|
||||||
|
"@eslint/plugin-kit": "npm:^0.1.0"
|
||||||
"@humanwhocodes/module-importer": "npm:^1.0.1"
|
"@humanwhocodes/module-importer": "npm:^1.0.1"
|
||||||
"@humanwhocodes/retry": "npm:^0.3.0"
|
"@humanwhocodes/retry": "npm:^0.3.0"
|
||||||
"@nodelib/fs.walk": "npm:^1.2.8"
|
"@nodelib/fs.walk": "npm:^1.2.8"
|
||||||
@ -1527,7 +1547,6 @@ __metadata:
|
|||||||
is-glob: "npm:^4.0.0"
|
is-glob: "npm:^4.0.0"
|
||||||
is-path-inside: "npm:^3.0.3"
|
is-path-inside: "npm:^3.0.3"
|
||||||
json-stable-stringify-without-jsonify: "npm:^1.0.1"
|
json-stable-stringify-without-jsonify: "npm:^1.0.1"
|
||||||
levn: "npm:^0.4.1"
|
|
||||||
lodash.merge: "npm:^4.6.2"
|
lodash.merge: "npm:^4.6.2"
|
||||||
minimatch: "npm:^3.1.2"
|
minimatch: "npm:^3.1.2"
|
||||||
natural-compare: "npm:^1.4.0"
|
natural-compare: "npm:^1.4.0"
|
||||||
@ -1541,7 +1560,7 @@ __metadata:
|
|||||||
optional: true
|
optional: true
|
||||||
bin:
|
bin:
|
||||||
eslint: bin/eslint.js
|
eslint: bin/eslint.js
|
||||||
checksum: 10c0/5e71efda7c0a14ee95436d5cdfed04ee61dfb1d89d7a32b50a424de2e680af82849628ea6581950c2e0726491f786a3cfd0032ce013c1c5093786e475cfdfb33
|
checksum: 10c0/7357f3995b15043eea83c8c0ab16c385ce3f28925c1b11cfcd6b2ede8faab3d91ede84a68173dd5f6e3e176e177984e6218de58b7b8388e53e2881f1ec07c836
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -2364,10 +2383,10 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"ms@npm:2.1.2":
|
"ms@npm:^2.1.3":
|
||||||
version: 2.1.2
|
version: 2.1.3
|
||||||
resolution: "ms@npm:2.1.2"
|
resolution: "ms@npm:2.1.3"
|
||||||
checksum: 10c0/a437714e2f90dbf881b5191d35a6db792efbca5badf112f87b9e1c712aace4b4b9b742dd6537f3edf90fd6f684de897cec230abde57e87883766712ddda297cc
|
checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user