@puq/type 0.0.27 → 0.0.30
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/common/object-literal.d.ts +4 -0
- package/dist/lib/common/object-literal.d.ts.map +1 -0
- package/dist/lib/common/object-literal.js +3 -0
- package/dist/lib/common/object-literal.js.map +1 -0
- package/dist/lib/property/relation-options.d.ts +33 -1
- package/dist/lib/property/relation-options.d.ts.map +1 -1
- package/dist/lib/property/relation-options.js.map +1 -1
- package/dist/lib/utils/key-of.d.ts +3 -0
- package/dist/lib/utils/key-of.d.ts.map +1 -1
- package/dist/lib/utils/key-of.js +3 -1
- package/dist/lib/utils/key-of.js.map +1 -1
- package/dist/lib/utils/keys.d.ts +5 -0
- package/dist/lib/utils/keys.d.ts.map +1 -1
- package/dist/lib/utils/keys.js +5 -1
- package/dist/lib/utils/keys.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACv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Ac,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index('./**/*.ts', f => `export * from '${f.path}.js'`)\nexport * from './lib/common/package-json.js';\nexport * from './lib/common/puq-options.js';\nexport * from './lib/dto/count-result.js';\nexport * from './lib/dto/delete-result.js';\nexport * from './lib/dto/relation-param.js';\nexport * from './lib/dto/update-result.js';\nexport * from './lib/model/base.js';\nexport * from './lib/model/id.js';\nexport * from './lib/model/timestamp.js';\nexport * from './lib/property/array.js';\nexport * from './lib/property/big-integer.js';\nexport * from './lib/property/boolean.js';\nexport * from './lib/property/common-number.js';\nexport * from './lib/property/common.js';\nexport * from './lib/property/database-type.js';\nexport * from './lib/property/date.js';\nexport * from './lib/property/integer-format.js';\nexport * from './lib/property/integer.js';\nexport * from './lib/property/model.js';\nexport * from './lib/property/number-format.js';\nexport * from './lib/property/number.js';\nexport * from './lib/property/object.js';\nexport * from './lib/property/property-type.js';\nexport * from './lib/property/property.js';\nexport * from './lib/property/relation-options.js';\nexport * from './lib/property/string-format.js';\nexport * from './lib/property/string.js';\nexport * from './lib/ui/icon.js';\nexport * from './lib/ui/input-type.js';\nexport * from './lib/utils/key-of.js';\nexport * from './lib/utils/keys.js';\nexport * from './lib/utils/pick-optional.js';\nexport * from './lib/utils/pick-required.js';\nexport * from './lib/utils/type.js';\n"],"names":[],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index('./**/*.ts', f => `export * from '${f.path}.js'`)\nexport * from './lib/common/object-literal.js';\nexport * from './lib/common/package-json.js';\nexport * from './lib/common/puq-options.js';\nexport * from './lib/dto/count-result.js';\nexport * from './lib/dto/delete-result.js';\nexport * from './lib/dto/relation-param.js';\nexport * from './lib/dto/update-result.js';\nexport * from './lib/model/base.js';\nexport * from './lib/model/id.js';\nexport * from './lib/model/timestamp.js';\nexport * from './lib/property/array.js';\nexport * from './lib/property/big-integer.js';\nexport * from './lib/property/boolean.js';\nexport * from './lib/property/common-number.js';\nexport * from './lib/property/common.js';\nexport * from './lib/property/database-type.js';\nexport * from './lib/property/date.js';\nexport * from './lib/property/integer-format.js';\nexport * from './lib/property/integer.js';\nexport * from './lib/property/model.js';\nexport * from './lib/property/number-format.js';\nexport * from './lib/property/number.js';\nexport * from './lib/property/object.js';\nexport * from './lib/property/property-type.js';\nexport * from './lib/property/property.js';\nexport * from './lib/property/relation-options.js';\nexport * from './lib/property/string-format.js';\nexport * from './lib/property/string.js';\nexport * from './lib/ui/icon.js';\nexport * from './lib/ui/input-type.js';\nexport * from './lib/utils/key-of.js';\nexport * from './lib/utils/keys.js';\nexport * from './lib/utils/pick-optional.js';\nexport * from './lib/utils/pick-required.js';\nexport * from './lib/utils/type.js';\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,2DAA2D;AAC3D,cAAc,iCAAiC;AAC/C,cAAc,+BAA+B;AAC7C,cAAc,8BAA8B;AAC5C,cAAc,4BAA4B;AAC1C,cAAc,6BAA6B;AAC3C,cAAc,8BAA8B;AAC5C,cAAc,6BAA6B;AAC3C,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,2BAA2B;AACzC,cAAc,0BAA0B;AACxC,cAAc,gCAAgC;AAC9C,cAAc,4BAA4B;AAC1C,cAAc,kCAAkC;AAChD,cAAc,2BAA2B;AACzC,cAAc,kCAAkC;AAChD,cAAc,yBAAyB;AACvC,cAAc,mCAAmC;AACjD,cAAc,4BAA4B;AAC1C,cAAc,0BAA0B;AACxC,cAAc,kCAAkC;AAChD,cAAc,2BAA2B;AACzC,cAAc,2BAA2B;AACzC,cAAc,kCAAkC;AAChD,cAAc,6BAA6B;AAC3C,cAAc,qCAAqC;AACnD,cAAc,kCAAkC;AAChD,cAAc,2BAA2B;AACzC,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,+BAA+B;AAC7C,cAAc,+BAA+B;AAC7C,cAAc,sBAAsB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"object-literal.d.ts","sourceRoot":"","sources":["../../../src/lib/common/object-literal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;CACpC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/common/object-literal.ts"],"sourcesContent":["export type ObjectLiteral<V = unknown> = {\r\n [key: string | number | symbol]: V;\r\n};\r\n"],"names":[],"rangeMappings":"","mappings":"AAAA,WAEE"}
|
@@ -1,16 +1,48 @@
|
|
1
|
+
import { Type } from '../utils/type.js';
|
1
2
|
export type RelationType = 'many-to-many' | 'many-to-one' | 'one-to-one' | 'one-to-many';
|
2
3
|
export type OnDelete = 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'DEFAULT' | 'NO ACTION';
|
3
4
|
export type OnUpdate = OnDelete;
|
4
5
|
export type Cascade = boolean | ('insert' | 'update' | 'remove' | 'soft-remove' | 'recover')[];
|
5
6
|
export type RelationOptions = {
|
7
|
+
/**
|
8
|
+
* Relation type
|
9
|
+
*/
|
6
10
|
type: RelationType;
|
11
|
+
/**
|
12
|
+
* Relation description
|
13
|
+
*/
|
7
14
|
description?: string;
|
8
|
-
|
15
|
+
/**
|
16
|
+
* Relation target entity name or function that return the {@link Type}
|
17
|
+
*/
|
18
|
+
target: string | (() => Type);
|
19
|
+
/**
|
20
|
+
* Relation target column name, by default `id` column is used.
|
21
|
+
*/
|
22
|
+
refColumn?: string;
|
23
|
+
/**
|
24
|
+
* Relation is required or nullable
|
25
|
+
*/
|
9
26
|
nullable?: boolean;
|
27
|
+
/**
|
28
|
+
* Relation data is loaded by default or on request
|
29
|
+
*/
|
10
30
|
eager?: boolean;
|
31
|
+
/**
|
32
|
+
* When true, for `one` relations, the id column is created, for `many` relations relation map table is created.
|
33
|
+
*/
|
11
34
|
join?: boolean;
|
35
|
+
/**
|
36
|
+
* Define how should the relation data is treated upon certain operations.
|
37
|
+
*/
|
12
38
|
cascade?: Cascade;
|
39
|
+
/**
|
40
|
+
* Define what happens to the target entity when the relation is deleted
|
41
|
+
*/
|
13
42
|
onDelete?: OnDelete;
|
43
|
+
/**
|
44
|
+
* Define what happens to the target entity when the relation is updated
|
45
|
+
*/
|
14
46
|
onUpdate?: OnUpdate;
|
15
47
|
};
|
16
48
|
//# sourceMappingURL=relation-options.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"relation-options.d.ts","sourceRoot":"","sources":["../../../src/lib/property/relation-options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,aAAa,CAAC;AAElB,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,WAAW,CAAC;AAChB,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAEhC,MAAM,MAAM,OAAO,GACf,OAAO,GACP,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"relation-options.d.ts","sourceRoot":"","sources":["../../../src/lib/property/relation-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,aAAa,CAAC;AAElB,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,WAAW,CAAC;AAChB,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAEhC,MAAM,MAAM,OAAO,GACf,OAAO,GACP,CAAC,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAE9B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/property/relation-options.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"sources":["../../../src/lib/property/relation-options.ts"],"sourcesContent":["import { Type } from '../utils/type.js';\r\n\r\nexport type RelationType =\r\n | 'many-to-many'\r\n | 'many-to-one'\r\n | 'one-to-one'\r\n | 'one-to-many';\r\n\r\nexport type OnDelete =\r\n | 'RESTRICT'\r\n | 'CASCADE'\r\n | 'SET NULL'\r\n | 'DEFAULT'\r\n | 'NO ACTION';\r\nexport type OnUpdate = OnDelete;\r\n\r\nexport type Cascade =\r\n | boolean\r\n | ('insert' | 'update' | 'remove' | 'soft-remove' | 'recover')[];\r\n\r\nexport type RelationOptions = {\r\n /**\r\n * Relation type\r\n */\r\n type: RelationType;\r\n\r\n /**\r\n * Relation description\r\n */\r\n description?: string;\r\n\r\n /**\r\n * Relation target entity name or function that return the {@link Type}\r\n */\r\n target: string | (() => Type);\r\n\r\n /**\r\n * Relation target column name, by default `id` column is used.\r\n */\r\n refColumn?: string;\r\n\r\n /**\r\n * Relation is required or nullable\r\n */\r\n nullable?: boolean;\r\n\r\n /**\r\n * Relation data is loaded by default or on request\r\n */\r\n eager?: boolean;\r\n\r\n /**\r\n * When true, for `one` relations, the id column is created, for `many` relations relation map table is created.\r\n */\r\n join?: boolean;\r\n\r\n /**\r\n * Define how should the relation data is treated upon certain operations.\r\n */\r\n cascade?: Cascade;\r\n\r\n /**\r\n * Define what happens to the target entity when the relation is deleted\r\n */\r\n onDelete?: OnDelete;\r\n\r\n /**\r\n * Define what happens to the target entity when the relation is updated\r\n */\r\n onUpdate?: OnUpdate;\r\n};\r\n"],"names":[],"rangeMappings":"","mappings":"AAoBA,WAkDE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"key-of.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/key-of.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"key-of.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/key-of.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC"}
|
package/dist/lib/utils/key-of.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/key-of.ts"],"sourcesContent":["
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/key-of.ts"],"sourcesContent":["/**\r\n * keyof T\r\n */\r\nexport type KeyOf<T> = keyof T;\r\n"],"names":[],"rangeMappings":";;","mappings":"AAAA;;CAEC,GACD,WAA+B"}
|
package/dist/lib/utils/keys.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/keys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAEvC,wBAAgB,IAAI,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAE3E"}
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/keys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAE3E"}
|
package/dist/lib/utils/keys.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/keys.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { KeyOf } from './key-of.js';\r\n\r\nexport type Keys<T = any> = KeyOf<T>[];\r\n\r\nexport function keys<T extends { [key: string]: any }>(instance: T): Keys<T> {\r\n return Object.keys(instance) as Keys<T>;\r\n}\r\n"],"names":["keys","instance","Object"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/keys.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { KeyOf } from './key-of.js';\r\n\r\nexport type Keys<T = any> = KeyOf<T>[];\r\n\r\n/**\r\n *\r\n * @param instance\r\n * @returns\r\n */\r\nexport function keys<T extends { [key: string]: any }>(instance: T): Keys<T> {\r\n return Object.keys(instance) as Keys<T>;\r\n}\r\n"],"names":["keys","instance","Object"],"rangeMappings":";;;;;;","mappings":"AAAA,qDAAqD,GAKrD;;;;CAIC,GACD,OAAO,SAASA,KAAuCC,QAAW;IAChE,OAAOC,OAAOF,IAAI,CAACC;AACrB"}
|