@loomcore/common 0.0.13 → 0.0.15
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.
|
@@ -3,10 +3,14 @@ export interface IAuditable {
|
|
|
3
3
|
_createdBy: string;
|
|
4
4
|
_updated: Date;
|
|
5
5
|
_updatedBy: string;
|
|
6
|
+
_deleted?: Date;
|
|
7
|
+
_deletedBy?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare const AuditableSchema: import("@sinclair/typebox").TObject<{
|
|
8
|
-
_created: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>;
|
|
10
|
+
_created: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>;
|
|
9
11
|
_createdBy: import("@sinclair/typebox").TString;
|
|
10
|
-
_updated: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>;
|
|
12
|
+
_updated: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>;
|
|
11
13
|
_updatedBy: import("@sinclair/typebox").TString;
|
|
14
|
+
_deleted: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>>;
|
|
15
|
+
_deletedBy: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
16
|
}>;
|
|
@@ -23,8 +23,8 @@ export declare const UserSchema: import("@sinclair/typebox").TObject<{
|
|
|
23
23
|
displayName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
24
24
|
password: import("@sinclair/typebox").TString;
|
|
25
25
|
roles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
26
|
-
_lastLoggedIn: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>>;
|
|
27
|
-
_lastPasswordChange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>>;
|
|
26
|
+
_lastLoggedIn: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>>;
|
|
27
|
+
_lastPasswordChange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>>;
|
|
28
28
|
}>;
|
|
29
29
|
export declare const UserSpec: import("./model-spec.interface.js").IModelSpec<import("@sinclair/typebox").TSchema>;
|
|
30
30
|
export declare const PublicUserSchema: import("@sinclair/typebox").TObject<{}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Kind, TSchema, NumberOptions } from '@sinclair/typebox';
|
|
2
|
-
export declare function TypeboxIsoDate(options?: object): import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>;
|
|
3
|
-
export declare function TypeboxDate(options?: object): import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>;
|
|
2
|
+
export declare function TypeboxIsoDate(options?: object): import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>;
|
|
3
|
+
export declare function TypeboxDate(options?: object): import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TString, Date>, import("@sinclair/typebox").TNull]>;
|
|
4
4
|
export declare function TypeboxObjectId(options?: object): import("@sinclair/typebox").TString;
|
|
5
5
|
export interface TDecimal extends TSchema, NumberOptions {
|
|
6
6
|
[Kind]: 'Decimal';
|
|
@@ -3,12 +3,13 @@ import { TypeRegistry } from '@sinclair/typebox';
|
|
|
3
3
|
import { Decimal as _Decimal } from 'decimal.js';
|
|
4
4
|
import { Value } from '@sinclair/typebox/value';
|
|
5
5
|
export function TypeboxIsoDate(options = {}) {
|
|
6
|
-
|
|
6
|
+
const dateTransform = Type.Transform(Type.String({ format: 'date-time', ...options }))
|
|
7
7
|
.Decode(value => new Date(value))
|
|
8
8
|
.Encode(value => value.toISOString());
|
|
9
|
+
return Type.Union([dateTransform, Type.Null()]);
|
|
9
10
|
}
|
|
10
11
|
export function TypeboxDate(options = {}) {
|
|
11
|
-
|
|
12
|
+
const dateTransform = Type.Transform(Type.String({ format: 'date', ...options }))
|
|
12
13
|
.Decode(value => {
|
|
13
14
|
const date = new Date(value);
|
|
14
15
|
date.setUTCHours(0, 0, 0, 0);
|
|
@@ -17,6 +18,7 @@ export function TypeboxDate(options = {}) {
|
|
|
17
18
|
.Encode(value => {
|
|
18
19
|
return value.toISOString().split('T')[0];
|
|
19
20
|
});
|
|
21
|
+
return Type.Union([dateTransform, Type.Null()]);
|
|
20
22
|
}
|
|
21
23
|
export function TypeboxObjectId(options = {}) {
|
|
22
24
|
return Type.String({
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
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
|
-
"@sinclair/typebox": "
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"cross-env": "^7.0.3",
|
|
46
|
-
"npm-run-all": "^4.1.5",
|
|
47
|
-
"typescript": "^5.8.3",
|
|
48
|
-
"vitest": "^3.0.9"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@loomcore/common",
|
|
3
|
+
"version": "0.0.15",
|
|
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
|
+
"@sinclair/typebox": "0.34.33"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"cross-env": "^7.0.3",
|
|
46
|
+
"npm-run-all": "^4.1.5",
|
|
47
|
+
"typescript": "^5.8.3",
|
|
48
|
+
"vitest": "^3.0.9"
|
|
49
|
+
}
|
|
50
|
+
}
|