@loomcore/common 0.0.32 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/models/entity.model.d.ts +6 -7
- package/dist/models/entity.model.js +11 -4
- package/package.json +51 -51
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { TSchema, TString, TNumber } from '@sinclair/typebox';
|
|
2
|
+
export interface IEntity<TId extends string | number = string> {
|
|
3
|
+
_id: TId;
|
|
4
|
+
_orgId?: TId;
|
|
4
5
|
}
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
_orgId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
-
}>;
|
|
6
|
+
export declare let EntitySchema: TSchema;
|
|
7
|
+
export declare const createEntitySchema: (idType: TString | TNumber) => TSchema;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Type } from '@sinclair/typebox';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
2
|
+
export let EntitySchema;
|
|
3
|
+
export const createEntitySchema = (idType) => {
|
|
4
|
+
const orgIdType = idType.kind === 'String'
|
|
5
|
+
? Type.String({ ...idType, title: 'Organization ID' })
|
|
6
|
+
: Type.Number({ ...idType, title: 'Organization ID' });
|
|
7
|
+
EntitySchema = Type.Object({
|
|
8
|
+
_id: idType,
|
|
9
|
+
_orgId: Type.Optional(orgIdType)
|
|
10
|
+
});
|
|
11
|
+
return EntitySchema;
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@loomcore/common",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "Loom Core Models- common models, interfaces, types, and utils for Loom Core. All things common to both api and client apps.",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"clean": "rm -rf dist",
|
|
8
|
-
"tsc": "tsc --project tsconfig.prod.json",
|
|
9
|
-
"build": "npm-run-all -s clean tsc",
|
|
10
|
-
"add": "git add .",
|
|
11
|
-
"commit": "git commit -m \"Updates\"",
|
|
12
|
-
"patch": "npm version patch",
|
|
13
|
-
"push": "git push",
|
|
14
|
-
"gar-login": "npx --yes google-artifactregistry-auth",
|
|
15
|
-
"publishMe": "npm publish --access public",
|
|
16
|
-
"pub": "npm-run-all -s add commit patch build push publishMe",
|
|
17
|
-
"auth-and-pub": "npm-run-all -s add commit patch build push gar-login publishMe",
|
|
18
|
-
"test": "cross-env NODE_ENV=test vitest run",
|
|
19
|
-
"test:ci": "cross-env NODE_ENV=test vitest run --reporter=json --outputFile=test-results.json",
|
|
20
|
-
"test:watch": "cross-env NODE_ENV=test vitest"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [],
|
|
23
|
-
"author": "Tim Hardy",
|
|
24
|
-
"license": "Apache-2.0",
|
|
25
|
-
"main": "dist/index.js",
|
|
26
|
-
"type": "module",
|
|
27
|
-
"types": "dist/index.d.ts",
|
|
28
|
-
"files": [
|
|
29
|
-
"dist/**/*"
|
|
30
|
-
],
|
|
31
|
-
"exports": {
|
|
32
|
-
"./errors": "./dist/errors/index.js",
|
|
33
|
-
"./models": "./dist/models/index.js",
|
|
34
|
-
"./types": "./dist/types/index.js",
|
|
35
|
-
"./utils": "./dist/utils/index.js",
|
|
36
|
-
"./validation": "./dist/validation/index.js"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"decimal.js": "^10.5.0"
|
|
40
|
-
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"@types/node": "^24.10.2",
|
|
43
|
-
"@sinclair/typebox": "0.34.33"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"cross-env": "^7.0.3",
|
|
47
|
-
"npm-run-all": "^4.1.5",
|
|
48
|
-
"typescript": "^5.8.3",
|
|
49
|
-
"vitest": "^3.0.9"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@loomcore/common",
|
|
3
|
+
"version": "0.0.34",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Loom Core Models- common models, interfaces, types, and utils for Loom Core. All things common to both api and client apps.",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "rm -rf dist",
|
|
8
|
+
"tsc": "tsc --project tsconfig.prod.json",
|
|
9
|
+
"build": "npm-run-all -s clean tsc",
|
|
10
|
+
"add": "git add .",
|
|
11
|
+
"commit": "git commit -m \"Updates\"",
|
|
12
|
+
"patch": "npm version patch",
|
|
13
|
+
"push": "git push",
|
|
14
|
+
"gar-login": "npx --yes google-artifactregistry-auth",
|
|
15
|
+
"publishMe": "npm publish --access public",
|
|
16
|
+
"pub": "npm-run-all -s add commit patch build push publishMe",
|
|
17
|
+
"auth-and-pub": "npm-run-all -s add commit patch build push gar-login publishMe",
|
|
18
|
+
"test": "cross-env NODE_ENV=test vitest run",
|
|
19
|
+
"test:ci": "cross-env NODE_ENV=test vitest run --reporter=json --outputFile=test-results.json",
|
|
20
|
+
"test:watch": "cross-env NODE_ENV=test vitest"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [],
|
|
23
|
+
"author": "Tim Hardy",
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/**/*"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
"./errors": "./dist/errors/index.js",
|
|
33
|
+
"./models": "./dist/models/index.js",
|
|
34
|
+
"./types": "./dist/types/index.js",
|
|
35
|
+
"./utils": "./dist/utils/index.js",
|
|
36
|
+
"./validation": "./dist/validation/index.js"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"decimal.js": "^10.5.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@types/node": "^24.10.2",
|
|
43
|
+
"@sinclair/typebox": "0.34.33"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"npm-run-all": "^4.1.5",
|
|
48
|
+
"typescript": "^5.8.3",
|
|
49
|
+
"vitest": "^3.0.9"
|
|
50
|
+
}
|
|
51
|
+
}
|