@tstdl/base 0.82.4 → 0.82.5

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.
Files changed (146) hide show
  1. package/api/types.d.ts +2 -1
  2. package/api/types.js.map +1 -1
  3. package/authentication/authentication-credentials.repository.d.ts +5 -0
  4. package/authentication/{authentication-credentials.service.js → authentication-credentials.repository.js} +6 -6
  5. package/authentication/authentication-credentials.repository.js.map +1 -0
  6. package/authentication/authentication-session.repository.d.ts +13 -4
  7. package/authentication/authentication-session.repository.js +2 -13
  8. package/authentication/authentication-session.repository.js.map +1 -1
  9. package/authentication/authentication.api.d.ts +28 -0
  10. package/authentication/authentication.api.js +53 -0
  11. package/authentication/authentication.api.js.map +1 -0
  12. package/authentication/authentication.service.d.ts +13 -13
  13. package/authentication/authentication.service.js +50 -25
  14. package/authentication/authentication.service.js.map +1 -1
  15. package/authentication/models/authentication-credentials.model.d.ts +7 -5
  16. package/authentication/models/authentication-credentials.model.js +28 -7
  17. package/authentication/models/authentication-credentials.model.js.map +1 -1
  18. package/authentication/models/authentication-session.model.d.ts +13 -6
  19. package/authentication/models/authentication-session.model.js +47 -9
  20. package/authentication/models/authentication-session.model.js.map +1 -1
  21. package/authentication/models/index.d.ts +1 -0
  22. package/authentication/models/index.js +1 -0
  23. package/authentication/models/index.js.map +1 -1
  24. package/authentication/models/token-payload-base.model.d.ts +5 -0
  25. package/{orm/test.js → authentication/models/token-payload-base.model.js} +19 -10
  26. package/authentication/models/token-payload-base.model.js.map +1 -0
  27. package/authentication/mongo/mongo-authentication-credentials.repository.d.ts +25 -0
  28. package/authentication/mongo/mongo-authentication-credentials.repository.js +65 -0
  29. package/authentication/mongo/mongo-authentication-credentials.repository.js.map +1 -0
  30. package/authentication/mongo/mongo-authentication-session.repository.d.ts +26 -0
  31. package/authentication/mongo/mongo-authentication-session.repository.js +64 -0
  32. package/authentication/mongo/mongo-authentication-session.repository.js.map +1 -0
  33. package/database/mongo/model/document.d.ts +0 -1
  34. package/database/mongo/model/document.js +1 -10
  35. package/database/mongo/model/document.js.map +1 -1
  36. package/database/mongo/module.js +0 -3
  37. package/database/mongo/module.js.map +1 -1
  38. package/database/mongo/query-converter.js.map +1 -1
  39. package/database/query.d.ts +1 -1
  40. package/examples/mail/basic.js +3 -3
  41. package/examples/mail/templates/hello-name.js +6 -1
  42. package/examples/mail/templates/hello-name.js.map +1 -1
  43. package/examples/pdf/basic.js +3 -3
  44. package/examples/template/basic.js +13 -7
  45. package/examples/template/basic.js.map +1 -1
  46. package/examples/template/templates/hello-jsx.d.ts +2 -0
  47. package/examples/template/templates/hello-jsx.js +15 -0
  48. package/examples/template/templates/hello-jsx.js.map +1 -0
  49. package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
  50. package/http/types.d.ts +3 -3
  51. package/notification/models/notification.model.d.ts +23 -5
  52. package/notification/models/notification.model.js +47 -3
  53. package/notification/models/notification.model.js.map +1 -1
  54. package/notification/notification.repository.d.ts +5 -0
  55. package/notification/notification.repository.js +7 -0
  56. package/notification/notification.repository.js.map +1 -0
  57. package/notification/notification.service.d.ts +2 -2
  58. package/notification/notification.service.js +4 -4
  59. package/notification/notification.service.js.map +1 -1
  60. package/package.json +5 -3
  61. package/schema/schemas/assign.d.ts +3 -3
  62. package/schema/utils/schema.js.map +1 -1
  63. package/templates/providers/{file.provider-template.d.ts → file.template-provider.d.ts} +0 -0
  64. package/templates/providers/{file.provider-template.js → file.template-provider.js} +1 -1
  65. package/templates/providers/{file.provider-template.js.map → file.template-provider.js.map} +1 -1
  66. package/templates/renderers/handlebars.template-renderer.js.map +1 -1
  67. package/templates/renderers/jsx.template-renderer.d.ts +16 -0
  68. package/templates/renderers/jsx.template-renderer.js +40 -0
  69. package/templates/renderers/jsx.template-renderer.js.map +1 -0
  70. package/templates/renderers/mjml.template-renderer.d.ts +1 -1
  71. package/templates/renderers/string.template-renderer.d.ts +2 -2
  72. package/templates/renderers/string.template-renderer.js +1 -1
  73. package/templates/renderers/string.template-renderer.js.map +1 -1
  74. package/templates/resolvers/file.template-resolver.d.ts +2 -2
  75. package/templates/resolvers/jsx.template-resolver.d.ts +15 -0
  76. package/templates/resolvers/jsx.template-resolver.js +45 -0
  77. package/templates/resolvers/jsx.template-resolver.js.map +1 -0
  78. package/templates/resolvers/string.template-resolver.d.ts +1 -1
  79. package/templates/resolvers/string.template-resolver.js +1 -1
  80. package/templates/resolvers/string.template-resolver.js.map +1 -1
  81. package/templates/template.renderer.d.ts +4 -2
  82. package/templates/template.renderer.js +6 -1
  83. package/templates/template.renderer.js.map +1 -1
  84. package/templates/template.resolver.d.ts +2 -2
  85. package/templates/tokens.d.ts +1 -1
  86. package/text/localization.service.js +1 -1
  87. package/text/localization.service.js.map +1 -1
  88. package/tsconfig.json +5 -0
  89. package/types.d.ts +6 -32
  90. package/utils/jwt.js +2 -2
  91. package/utils/jwt.js.map +1 -1
  92. package/utils/object/object.d.ts +1 -1
  93. package/utils/object/object.js +6 -5
  94. package/utils/object/object.js.map +1 -1
  95. package/authentication/authentication-credentials.service.d.ts +0 -6
  96. package/authentication/authentication-credentials.service.js.map +0 -1
  97. package/orm/decorators.d.ts +0 -26
  98. package/orm/decorators.js +0 -172
  99. package/orm/decorators.js.map +0 -1
  100. package/orm/entity-definition.model.d.ts +0 -51
  101. package/orm/entity-definition.model.js +0 -27
  102. package/orm/entity-definition.model.js.map +0 -1
  103. package/orm/index.d.ts +0 -1
  104. package/orm/index.js +0 -18
  105. package/orm/index.js.map +0 -1
  106. package/orm/models/entity.d.ts +0 -22
  107. package/orm/models/entity.js +0 -87
  108. package/orm/models/entity.js.map +0 -1
  109. package/orm/models/index.d.ts +0 -1
  110. package/orm/models/index.js +0 -18
  111. package/orm/models/index.js.map +0 -1
  112. package/orm/repository/mongo/classes.d.ts +0 -25
  113. package/orm/repository/mongo/classes.js +0 -33
  114. package/orm/repository/mongo/classes.js.map +0 -1
  115. package/orm/repository/mongo/module.d.ts +0 -8
  116. package/orm/repository/mongo/module.js +0 -88
  117. package/orm/repository/mongo/module.js.map +0 -1
  118. package/orm/repository/mongo/mongo-repository.d.ts +0 -11
  119. package/orm/repository/mongo/mongo-repository.js +0 -55
  120. package/orm/repository/mongo/mongo-repository.js.map +0 -1
  121. package/orm/repository/mongo/mongo-transaction.d.ts +0 -10
  122. package/orm/repository/mongo/mongo-transaction.js +0 -28
  123. package/orm/repository/mongo/mongo-transaction.js.map +0 -1
  124. package/orm/repository/repository.d.ts +0 -75
  125. package/orm/repository/repository.js +0 -182
  126. package/orm/repository/repository.js.map +0 -1
  127. package/orm/repository/transaction.d.ts +0 -26
  128. package/orm/repository/transaction.js +0 -65
  129. package/orm/repository/transaction.js.map +0 -1
  130. package/orm/sql/sql-repository.d.ts +0 -6
  131. package/orm/sql/sql-repository.js +0 -15
  132. package/orm/sql/sql-repository.js.map +0 -1
  133. package/orm/test.d.ts +0 -1
  134. package/orm/test.js.map +0 -1
  135. package/orm/types/definition.d.ts +0 -19
  136. package/orm/types/definition.js +0 -55
  137. package/orm/types/definition.js.map +0 -1
  138. package/orm/types/index.d.ts +0 -3
  139. package/orm/types/index.js +0 -20
  140. package/orm/types/index.js.map +0 -1
  141. package/orm/types/options.d.ts +0 -36
  142. package/orm/types/options.js +0 -5
  143. package/orm/types/options.js.map +0 -1
  144. package/orm/types/query.d.ts +0 -110
  145. package/orm/types/query.js +0 -10
  146. package/orm/types/query.js.map +0 -1
package/types.d.ts CHANGED
@@ -164,36 +164,10 @@ export type DeepPartialObject<T> = {
164
164
  export type DeepPartialArray<T> = DeepPartial<T>[];
165
165
  export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
166
166
  export type BinaryData = ArrayBuffer | ArrayBufferView;
167
- type JoinPaths<K, P> = K extends string | number ? P extends string | number ? `${K}${'' extends P ? '' : '.'}${P}` : never : never;
168
- type Prev = [
169
- never,
170
- 0,
171
- 1,
172
- 2,
173
- 3,
174
- 4,
175
- 5,
176
- 6,
177
- 7,
178
- 8,
179
- 9,
180
- 10,
181
- 11,
182
- 12,
183
- 13,
184
- 14,
185
- 15,
186
- 16,
187
- 17,
188
- 18,
189
- 19,
190
- 20,
191
- ...0[]
192
- ];
193
- export type Paths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
194
- [K in keyof T]-?: K extends string | number ? `${K}` | (Paths<T[K], Prev[D]> extends infer R ? JoinPaths<K, R> : never) : never;
195
- }[keyof T] : '';
196
- export type LeavePaths<T, D extends number = 10> = [D] extends [never] ? never : T extends object ? {
197
- [K in keyof T]-?: JoinPaths<K, LeavePaths<T[K], Prev[D]>>;
198
- }[keyof T] : '';
167
+ export type Paths<T extends Record> = T extends object ? {
168
+ [K in keyof T]-?: K extends string | number ? K | `${K}.${Paths<T[K]>}` : never;
169
+ }[keyof T] : never;
170
+ export type TypeFromPath<T extends Record, Path extends Paths<T> | string> = {
171
+ [K in Path]: K extends keyof T ? T[K] : K extends `${infer P}.${infer S}` ? T[P] extends Record ? TypeFromPath<T[P], S> : never : never;
172
+ }[Path];
199
173
  export {};
package/utils/jwt.js CHANGED
@@ -77,9 +77,9 @@ async function parseAndValidateJwtTokenString(tokenString, allowedAlgorithms, ke
77
77
  }
78
78
  }
79
79
  exports.parseAndValidateJwtTokenString = parseAndValidateJwtTokenString;
80
- async function getSignature(data, algorithm, key) {
80
+ async function getSignature(data, algorithm, secret) {
81
81
  const hashAlgorithm = getHmacHashAlgorithm(algorithm);
82
- const hmacKey = await (0, cryptography_1.importHmacKey)(hashAlgorithm, key, false);
82
+ const hmacKey = await (0, cryptography_1.importHmacKey)(hashAlgorithm, secret, false);
83
83
  const hmacSignature = (0, cryptography_1.sign)('HMAC', hmacKey, data);
84
84
  return hmacSignature.toBuffer();
85
85
  }
package/utils/jwt.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../source/utils/jwt.ts"],"names":[],"mappings":";;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AAO,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC1H,MAAM,cAAc,GAAG,IAAA,qBAAY,EAAC,mBAAmB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAE1E,IAAI,CAAC,cAAc,EAAE;YACnB,MAAM,IAAI,yBAAiB,CAAC,0BAA0B,CAAC,CAAC;SACzD;QAED,OAAO,KAAK,CAAC;KACd;IACD,OAAO,KAAc,EAAE;QACrB,IAAI,KAAK,YAAY,yBAAiB,EAAE;YACtC,MAAM,KAAK,CAAC;SACb;QAED,MAAM,IAAI,yBAAiB,CAAC,gBAAgB,CAAC,CAAC;KAC/C;AACH,CAAC;AAxBD,wEAwBC;AAED,KAAK,UAAU,YAAY,CAAC,IAAgB,EAAE,SAA4B,EAAE,MAAoB;IAC9F,MAAM,aAAa,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAa,EAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAClE,MAAM,aAAa,GAAG,IAAA,mBAAI,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAElD,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,oBAAoB,CAAC,SAA4B;IACxD,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAkB,CAAC;AAC1D,CAAC"}
@@ -18,4 +18,4 @@ export declare function filterObject<T extends ObjectLiteral>(object: T, predica
18
18
  export declare function filterObjectAsync<T extends ObjectLiteral>(object: T, predicate: (value: T[keyof T], key: keyof T) => Promise<boolean>): Promise<Partial<T>>;
19
19
  export declare function copyObjectProperties<T extends ObjectLiteral, U extends T>(source: T, target: U): void;
20
20
  export declare function getGetter<T extends ObjectLiteral, U extends keyof T>(obj: T, property: keyof T, bind: boolean): () => T[U];
21
- export declare function deepEntries(object: ObjectLiteral, keepInnerObjects?: boolean, prefix?: string): [string, any][];
21
+ export declare function deepObjectEntries(object: ObjectLiteral, keepInnerObjects?: boolean, prefix?: string): [string, any][];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deepEntries = exports.getGetter = exports.copyObjectProperties = exports.filterObjectAsync = exports.filterObject = exports.mapObjectValuesAsync = exports.mapObjectValues = exports.mapObjectAsync = exports.mapObject = exports.objectValues = exports.objectKeys = exports.objectEntries = exports.hasOwnProperty = void 0;
3
+ exports.deepObjectEntries = exports.getGetter = exports.copyObjectProperties = exports.filterObjectAsync = exports.filterObject = exports.mapObjectValuesAsync = exports.mapObjectValues = exports.mapObjectAsync = exports.mapObject = exports.objectValues = exports.objectKeys = exports.objectEntries = exports.hasOwnProperty = void 0;
4
4
  const filter_1 = require("../async-iterable-helpers/filter");
5
5
  const map_1 = require("../async-iterable-helpers/map");
6
6
  const to_array_1 = require("../async-iterable-helpers/to-array");
@@ -84,7 +84,7 @@ function getGetter(obj, property, bind) {
84
84
  return getter;
85
85
  }
86
86
  exports.getGetter = getGetter;
87
- function deepEntries(object, keepInnerObjects = false, prefix) {
87
+ function deepObjectEntries(object, keepInnerObjects = false, prefix) {
88
88
  const allEntries = objectEntries(object);
89
89
  for (const entry of allEntries) {
90
90
  if ((0, type_guards_1.isSymbol)(entry[0])) {
@@ -94,13 +94,14 @@ function deepEntries(object, keepInnerObjects = false, prefix) {
94
94
  const rawEntries = (0, type_guards_1.isUndefined)(prefix)
95
95
  ? allEntries
96
96
  : allEntries.map(([key, value]) => [`${prefix}${key}`, value]);
97
- let entries = [];
97
+ const entries = [];
98
98
  for (const [key, value] of rawEntries) {
99
99
  if ((0, type_guards_1.isObject)(value) || (0, type_guards_1.isArray)(value)) {
100
100
  if (keepInnerObjects) {
101
101
  entries.push([key, value]);
102
102
  }
103
- entries = [...entries, ...deepEntries(value, keepInnerObjects, `${key}.`)];
103
+ const innerEntries = deepObjectEntries(value, keepInnerObjects, `${key}.`);
104
+ entries.push(...innerEntries);
104
105
  }
105
106
  else {
106
107
  entries.push([key, value]);
@@ -108,5 +109,5 @@ function deepEntries(object, keepInnerObjects = false, prefix) {
108
109
  }
109
110
  return entries;
110
111
  }
111
- exports.deepEntries = deepEntries;
112
+ exports.deepObjectEntries = deepObjectEntries;
112
113
  //# sourceMappingURL=object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../source/utils/object/object.ts"],"names":[],"mappings":";;;AACA,6DAA+D;AAC/D,uDAAyD;AACzD,iEAAkE;AAClE,gDAA0E;AAE1E,SAAgB,cAAc,CAAmB,GAAM,EAAE,GAAY;IACnE,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAFD,wCAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAA0B,MAAS;IAC9D,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAHD,sCAGC;AAED;;GAEG;AACH,SAAgB,UAAU,CAA0B,MAAS;IAC3D,OAAQ,OAAO,CAAC,OAAO,CAAC,MAAM,CAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC;AACtF,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAA0B,MAAS;IAC7D,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,oCAEC;AAED,SAAgB,SAAS,CAAiE,MAAS,EAAE,MAA+D;IAClK,MAAM,aAAa,GAA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SAC/B;aACI;YACH,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SAC5B;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AA9BD,8CA8BC"}
@@ -1,6 +0,0 @@
1
- import type { AuthenticationCredentials, NewAuthenticationCredentials } from './models';
2
- export declare abstract class AuthenticationCredentialsService {
3
- abstract has(subject: string): Promise<boolean>;
4
- abstract tryGet(subject: string): Promise<AuthenticationCredentials | undefined>;
5
- abstract save(credentials: NewAuthenticationCredentials | AuthenticationCredentials): Promise<void>;
6
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"authentication-credentials.service.js","sourceRoot":"","sources":["../../source/authentication/authentication-credentials.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAI9B,IAAe,gCAAgC,GAA/C,MAAe,gCAAgC;CAIrD,CAAA;AAJqB,gCAAgC;IADrD,IAAA,kBAAK,GAAE;GACc,gCAAgC,CAIrD;AAJqB,4EAAgC"}
@@ -1,26 +0,0 @@
1
- import { JsonPath } from "../json-path";
2
- import type { ObjectSchema } from "../schema/types";
3
- import type { AbstractConstructor, TypedOmit } from "../types";
4
- import type { EntityDefinition, FieldDefinition, IndexOptions } from './entity-definition.model';
5
- export type EntityOptions = Partial<Pick<EntityDefinition, 'name' | 'indexes'>>;
6
- export type FieldOptions = Partial<FieldDefinition>;
7
- export declare function createEntityDecorator(options: EntityOptions): ClassDecorator;
8
- export declare function createFieldDecorator(options: FieldOptions): PropertyDecorator;
9
- export declare function Entity(options?: EntityOptions): ClassDecorator;
10
- export declare function Field(options?: FieldOptions): PropertyDecorator;
11
- export declare function NullableField(options?: TypedOmit<FieldOptions, 'nullable'>): PropertyDecorator;
12
- export declare function PrimaryField(options?: FieldOptions): PropertyDecorator;
13
- export declare function PrimaryGeneratedField(options?: FieldOptions): PropertyDecorator;
14
- export declare function CreatedField(options?: TypedOmit<FieldOptions, 'type'>): PropertyDecorator;
15
- export declare function UpdatedField(options?: TypedOmit<FieldOptions, 'type'>): PropertyDecorator;
16
- export declare function DeletedField(options?: TypedOmit<FieldOptions, 'type'>): PropertyDecorator;
17
- export declare function RevisionField(options?: TypedOmit<FieldOptions, 'type'>): PropertyDecorator;
18
- export declare function Index(fields: string[], options?: IndexOptions): ClassDecorator;
19
- export declare function Index(options?: IndexOptions): PropertyDecorator;
20
- type GetEntityDefinitionData = {
21
- entityOptions?: EntityOptions;
22
- objectSchema?: ObjectSchema;
23
- };
24
- export declare function getEntityDefinition(typeOrData: AbstractConstructor | GetEntityDefinitionData): EntityDefinition;
25
- export declare function getEntityDefinition(typeOrData: AbstractConstructor | GetEntityDefinitionData, path: JsonPath): EntityDefinition;
26
- export {};
package/orm/decorators.js DELETED
@@ -1,172 +0,0 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/naming-convention */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getEntityDefinition = exports.Index = exports.RevisionField = exports.DeletedField = exports.UpdatedField = exports.CreatedField = exports.PrimaryGeneratedField = exports.PrimaryField = exports.NullableField = exports.Field = exports.Entity = exports.createFieldDecorator = exports.createEntityDecorator = void 0;
5
- const error_1 = require("../error");
6
- const json_path_1 = require("../json-path");
7
- const reflection_1 = require("../reflection");
8
- const enumeration_1 = require("../schema/constraints/enumeration");
9
- const integer_1 = require("../schema/constraints/integer");
10
- const types_1 = require("../schema/types");
11
- const utils_1 = require("../schema/utils");
12
- const array_1 = require("../utils/array/array");
13
- const distinct_1 = require("../utils/iterable-helpers/distinct");
14
- const map_1 = require("../utils/iterable-helpers/map");
15
- const object_1 = require("../utils/object");
16
- const type_guards_1 = require("../utils/type-guards");
17
- function getEntityOptions(typeOrMetadata) {
18
- const metadata = (0, type_guards_1.isFunction)(typeOrMetadata) ? reflection_1.reflectionRegistry.getMetadata(typeOrMetadata) : typeOrMetadata;
19
- (0, type_guards_1.assert)(metadata?.metadataType == 'type', 'EntityOptions is only available for classes.');
20
- return metadata.data.tryGet('orm') ?? {};
21
- }
22
- function getFieldOptions(typeOrMetadata, property) {
23
- const metadata = (0, type_guards_1.isFunction)(typeOrMetadata) ? reflection_1.reflectionRegistry.getMetadata(typeOrMetadata)?.properties.get((0, type_guards_1.assertDefinedPass)(property, 'Missing property parameter.')) : typeOrMetadata;
24
- (0, type_guards_1.assert)(metadata?.metadataType == 'property', 'FieldOptions is only available for properties.');
25
- return metadata.data.tryGet('orm') ?? {};
26
- }
27
- function createEntityDecorator(options) {
28
- return (0, reflection_1.createClassDecorator)({ data: { orm: options }, mergeData: true });
29
- }
30
- exports.createEntityDecorator = createEntityDecorator;
31
- function createFieldDecorator(options) {
32
- return (0, reflection_1.createPropertyDecorator)({ data: { orm: options }, mergeData: true });
33
- }
34
- exports.createFieldDecorator = createFieldDecorator;
35
- function Entity(options = {}) {
36
- return createEntityDecorator(options);
37
- }
38
- exports.Entity = Entity;
39
- function Field(options = {}) {
40
- return createFieldDecorator(options);
41
- }
42
- exports.Field = Field;
43
- function NullableField(options = {}) {
44
- return Field({ ...options, nullable: true });
45
- }
46
- exports.NullableField = NullableField;
47
- function PrimaryField(options) {
48
- return Field({ ...options, primary: true });
49
- }
50
- exports.PrimaryField = PrimaryField;
51
- function PrimaryGeneratedField(options) {
52
- return PrimaryField({ ...options, generated: true });
53
- }
54
- exports.PrimaryGeneratedField = PrimaryGeneratedField;
55
- function CreatedField(options) {
56
- return Field({ ...options, type: 'created' });
57
- }
58
- exports.CreatedField = CreatedField;
59
- function UpdatedField(options) {
60
- return Field({ ...options, type: 'updated', nullable: true });
61
- }
62
- exports.UpdatedField = UpdatedField;
63
- function DeletedField(options) {
64
- return Field({ ...options, type: 'deleted', nullable: true });
65
- }
66
- exports.DeletedField = DeletedField;
67
- function RevisionField(options) {
68
- return Field({ ...options, type: 'revision' });
69
- }
70
- exports.RevisionField = RevisionField;
71
- function Index(fieldsOrOptions, optionsOrNothing) {
72
- const fields = (0, type_guards_1.isArray)(fieldsOrOptions) ? fieldsOrOptions : undefined;
73
- const options = ((0, type_guards_1.isArray)(fieldsOrOptions) ? optionsOrNothing : fieldsOrOptions) ?? {};
74
- return (0, reflection_1.createDecorator)({ class: true, property: true }, (data, metadata) => {
75
- switch (data.type) {
76
- case 'class':
77
- const entityOptions = getEntityOptions(metadata);
78
- (0, type_guards_1.assertArray)(fields, 'Fields can only be specified on class index decorator.');
79
- Entity({ indexes: [...(entityOptions.indexes ?? []), { fields, ...options }] })(data.constructor);
80
- break;
81
- case 'property':
82
- const fieldOptions = getFieldOptions(metadata);
83
- Field({ indexes: [...(fieldOptions.indexes ?? []), options] })(data.prototype, data.propertyKey);
84
- break;
85
- default:
86
- throw new error_1.NotSupportedError('Only works for classes and properties.');
87
- }
88
- });
89
- }
90
- exports.Index = Index;
91
- function getEntityDefinition(typeOrData, path = json_path_1.JsonPath.ROOT) {
92
- const type = (0, type_guards_1.isFunction)(typeOrData) ? typeOrData : undefined;
93
- const typeMetadata = (0, type_guards_1.isDefined)(type) ? reflection_1.reflectionRegistry.getMetadata(type) : undefined;
94
- if ((0, type_guards_1.isUndefined)(typeMetadata)) {
95
- throw new Error(`Type not found in reflection. Missing decorators? (${path.path})`);
96
- }
97
- const entityOptions = (0, type_guards_1.isDefined)(typeMetadata) ? getEntityOptions(typeMetadata) : typeOrData.entityOptions;
98
- const objectSchema = (0, type_guards_1.isFunction)(typeOrData) ? (0, utils_1.tryGetObjectSchemaFromReflection)(typeOrData) : typeOrData.objectSchema;
99
- const properties = [...(0, distinct_1.distinct)([...typeMetadata.properties.keys(), ...(0, object_1.objectKeys)(objectSchema?.properties ?? {})])];
100
- const fieldEntries = (0, map_1.map)(properties, (property) => {
101
- const propertyName = property.toString();
102
- const propertyMetadata = typeMetadata.properties.get(propertyName);
103
- const fieldOptions = (0, type_guards_1.isDefined)(propertyMetadata) ? getFieldOptions(propertyMetadata) : undefined;
104
- const propertySchema = objectSchema?.properties[propertyName];
105
- const fieldType = fieldOptions?.type
106
- ?? getFieldTypeFromSchema((0, type_guards_1.assertNotArrayPass)((0, type_guards_1.assertDefinedPass)(propertySchema, 'Could not get field type from schema.'), 'Only a single type is allowed as field type.'), path.add(propertyName));
107
- return [propertyName, (0, object_1.filterObject)({
108
- name: fieldOptions?.name,
109
- type: fieldType,
110
- primary: fieldOptions?.primary,
111
- generated: fieldOptions?.generated,
112
- nullable: fieldOptions?.nullable ?? ((0, types_1.isValueSchema)(propertySchema) ? (((propertySchema.nullable ?? false) || (propertySchema.optional ?? false)) ? true : undefined) : undefined),
113
- indexes: fieldOptions?.indexes
114
- }, type_guards_1.isDefined)];
115
- });
116
- return {
117
- name: (0, type_guards_1.assertDefinedPass)(entityOptions?.name ?? type?.name, 'Entity name not defined.'),
118
- indexes: entityOptions?.indexes,
119
- fields: Object.fromEntries(fieldEntries)
120
- };
121
- }
122
- exports.getEntityDefinition = getEntityDefinition;
123
- function getFieldTypeFromSchema(schema, path) {
124
- if ((0, types_1.isObjectSchema)(schema)) {
125
- return { nested: getEntityDefinition({ objectSchema: schema }) };
126
- }
127
- if ((0, type_guards_1.isFunction)(schema)) {
128
- return getFieldTypeFromType(schema, path);
129
- }
130
- if ((0, type_guards_1.isString)(schema)) {
131
- throw new error_1.NotSupportedError(`Schema type "${schema}" is not supported as field type.`);
132
- }
133
- if ((0, types_1.isDeferredValueType)(schema)) {
134
- return getFieldTypeFromSchema((0, types_1.resolveValueType)(schema), path);
135
- }
136
- if ((0, types_1.isTypeSchema)(schema)) {
137
- return getFieldTypeFromSchema((0, types_1.resolveValueType)(schema.type), path);
138
- }
139
- return getFieldTypeFromValueSchema(schema, path);
140
- }
141
- function getFieldTypeFromValueSchema(schema, path) {
142
- if ((0, type_guards_1.isDefined)(schema.valueConstraints)) {
143
- const constraints = (0, array_1.toArray)(schema.valueConstraints ?? []);
144
- const enumerationConstraint = constraints.find((constraint) => constraint instanceof enumeration_1.EnumerationConstraint);
145
- const integerConstraint = constraints.find((constraint) => constraint instanceof integer_1.IntegerConstraint);
146
- if ((0, type_guards_1.isDefined)(enumerationConstraint)) {
147
- return { enumeration: enumerationConstraint.enumeration };
148
- }
149
- if ((0, type_guards_1.isDefined)(integerConstraint)) {
150
- return 'integer';
151
- }
152
- }
153
- const innerSchemas = (0, array_1.toArray)(schema.schema);
154
- (0, type_guards_1.assert)(innerSchemas.length == 1, `Could not get field type from schema type as exactly 1 schema is required, but ${innerSchemas.length} were given.`);
155
- const innerSchema = innerSchemas[0];
156
- return getFieldTypeFromSchema(innerSchema, path);
157
- }
158
- function getFieldTypeFromType(type, path) {
159
- switch (type) {
160
- case String:
161
- return 'string';
162
- case Number:
163
- return 'float';
164
- case Boolean:
165
- return 'boolean';
166
- case Date:
167
- return 'date-time';
168
- default:
169
- return { nested: getEntityDefinition(type, path) };
170
- }
171
- }
172
- //# sourceMappingURL=decorators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../source/orm/decorators.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAEzD,oCAA4C;AAC5C,4CAAuC;AAEvC,8CAAkH;AAClH,mEAAyE;AACzE,2DAAiE;AAGjE,2CAAoH;AACpH,2CAAkE;AAElE,gDAA8C;AAC9C,iEAA6D;AAC7D,uDAAmD;AACnD,4CAA0D;AAC1D,sDAAwJ;AAMxJ,SAAS,gBAAgB,CAAC,cAAwD;IAChF,MAAM,QAAQ,GAAG,IAAA,wBAAU,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,+BAAkB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IAE9G,IAAA,oBAAM,EAAC,QAAQ,EAAE,YAAY,IAAI,MAAM,EAAE,8CAA8C,CAAC,CAAC;IACzF,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAgB,KAAK,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC;AAID,SAAS,eAAe,CAAC,cAAwD,EAAE,QAA0B;IAC3G,MAAM,QAAQ,GAAG,IAAA,wBAAU,EAAC,cAAc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ElB,KAAK,MAAM;YACT,OAAO,OAAO,CAAC;QAEjB,KAAK,OAAO;YACV,OAAO,SAAS,CAAC;QAEnB,KAAK,IAAI;YACP,OAAO,WAAW,CAAC;QAErB;YACE,OAAO,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;KACtD;AACH,CAAC"}
@@ -1,51 +0,0 @@
1
- import type { AbstractConstructor, Enumeration, Paths, Record } from "../types";
2
- export type FieldType = SpecialFieldType | 'string' | 'integer' | 'float' | 'boolean' | 'date-time' | 'date' | 'time' | 'json' | {
3
- nested: EntityDefinition;
4
- } | {
5
- enumeration: Enumeration;
6
- };
7
- export type SpecialFieldType = 'created' | 'updated' | 'deleted' | 'revision';
8
- export type IndexOptions = {
9
- unique?: boolean;
10
- };
11
- export type IndexDirection = 1 | -1 | 'asc' | 'desc';
12
- export type EntityIndexDefinition<T = any> = IndexOptions & {
13
- fields: (Paths<T> | [Paths<T>, IndexDirection])[] | {
14
- [P in Paths<T>]?: IndexDirection;
15
- };
16
- };
17
- export type FieldIndexDefinition = IndexOptions;
18
- export type FieldDefinition = {
19
- /** type of field in database */
20
- type: FieldType;
21
- /** type of property in object (used for conversion) */
22
- propertyType?: AbstractConstructor | 'numeric-date';
23
- /** field name in database */
24
- name?: string;
25
- primary?: boolean;
26
- generated?: boolean;
27
- nullable?: boolean;
28
- indexes?: FieldIndexDefinition[];
29
- };
30
- export type EntityDefinition = {
31
- name: string;
32
- fields: Record<string, FieldDefinition>;
33
- indexes?: EntityIndexDefinition[];
34
- };
35
- export type NormalizedEntityDefinition = {
36
- name: string;
37
- fields: Record<string, NormalizedFieldDefinition>;
38
- fieldsEntries: (readonly [string, NormalizedFieldDefinition])[];
39
- indexes: EntityIndexDefinition[];
40
- };
41
- export type NormalizedFieldDefinition = {
42
- type: FieldType;
43
- propertyType?: AbstractConstructor | 'numeric-date' | 'numeric-time';
44
- name: string;
45
- primary: boolean;
46
- generated: boolean;
47
- nullable: boolean;
48
- indexes: FieldIndexDefinition[];
49
- };
50
- export declare function normalizeEntityDefinition(definition: EntityDefinition): NormalizedEntityDefinition;
51
- export declare function normalizeFieldDefinition(field: string, definition: FieldDefinition): NormalizedFieldDefinition;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeFieldDefinition = exports.normalizeEntityDefinition = void 0;
4
- const object_1 = require("../utils/object");
5
- function normalizeEntityDefinition(definition) {
6
- const fieldsEntries = (0, object_1.objectEntries)(definition.fields).map(([field, fieldDefinition]) => [field, normalizeFieldDefinition(field, fieldDefinition)]);
7
- return {
8
- name: definition.name,
9
- fields: Object.fromEntries(fieldsEntries),
10
- fieldsEntries,
11
- indexes: definition.indexes ?? []
12
- };
13
- }
14
- exports.normalizeEntityDefinition = normalizeEntityDefinition;
15
- function normalizeFieldDefinition(field, definition) {
16
- return {
17
- type: definition.type,
18
- propertyType: definition.propertyType,
19
- name: definition.name ?? field,
20
- primary: definition.primary ?? false,
21
- generated: definition.generated ?? false,
22
- nullable: definition.nullable ?? false,
23
- indexes: definition.indexes ?? []
24
- };
25
- }
26
- exports.normalizeFieldDefinition = normalizeFieldDefinition;
27
- //# sourceMappingURL=entity-definition.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-definition.model.js","sourceRoot":"","sources":["../../source/orm/entity-definition.model.ts"],"names":[],"mappings":";;;AACA,4CAA+C;AAyD/C,SAAgB,yBAAyB,CAAC,UAA4B;IACpE,MAAM,aAAa,GAAG,IAAA,sBAAa,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,wBAAwB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAU,CAAC,CAAC;IAE7J,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC;QACzC,aAAa;QACb,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,EAAE;KAClC,CAAC;AACJ,CAAC;AATD,8DASC;AAED,SAAgB,wBAAwB,CAAC,KAAa,EAAE,UAA2B;IACjF,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,YAAY,EAAE,UAAU,CAAC,YAAY;QACrC,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,KAAK;QAC9B,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,KAAK;QACpC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,KAAK;QACxC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,KAAK;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,EAAE;KAClC,CAAC;AACJ,CAAC;AAVD,4DAUC"}
package/orm/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './models';
package/orm/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./models"), exports);
18
- //# sourceMappingURL=index.js.map
package/orm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/orm/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
@@ -1,22 +0,0 @@
1
- import type { ObjectLiteral, PartialProperty, Type } from "../../types";
2
- export type Id = string | number;
3
- export declare abstract class EntityMetadata {
4
- revision: number;
5
- created: Date;
6
- updated?: Date;
7
- deleted?: Date;
8
- }
9
- export declare abstract class Entity {
10
- id: string;
11
- }
12
- export declare abstract class EntityWithMetadata extends Entity {
13
- metadata: EntityMetadata;
14
- }
15
- export declare abstract class NewEntityBase {
16
- id?: string;
17
- }
18
- export type NewEntity<T> = T extends Entity ? PartialProperty<T, 'id'> : T;
19
- export type MaybeNewEntity<T> = T | NewEntity<T>;
20
- export declare function newEntity<T extends ObjectLiteral>(type: Type<T>): Type<NewEntity<T>>;
21
- export declare function toEntity<T extends Entity>(entity: T | NewEntity<T>): T;
22
- export declare function isId(value: any): value is Id;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.isId = exports.toEntity = exports.newEntity = exports.NewEntityBase = exports.EntityWithMetadata = exports.Entity = exports.EntityMetadata = void 0;
13
- const database_1 = require("../../database");
14
- const schema_1 = require("../../schema");
15
- const type_guards_1 = require("../../utils/type-guards");
16
- const decorators_1 = require("../decorators");
17
- class EntityMetadata {
18
- revision;
19
- created;
20
- updated;
21
- deleted;
22
- }
23
- __decorate([
24
- (0, decorators_1.RevisionField)(),
25
- __metadata("design:type", Number)
26
- ], EntityMetadata.prototype, "revision", void 0);
27
- __decorate([
28
- (0, decorators_1.CreatedField)(),
29
- __metadata("design:type", Date)
30
- ], EntityMetadata.prototype, "created", void 0);
31
- __decorate([
32
- (0, decorators_1.UpdatedField)(),
33
- __metadata("design:type", Date)
34
- ], EntityMetadata.prototype, "updated", void 0);
35
- __decorate([
36
- (0, decorators_1.DeletedField)(),
37
- __metadata("design:type", Date)
38
- ], EntityMetadata.prototype, "deleted", void 0);
39
- exports.EntityMetadata = EntityMetadata;
40
- class Entity {
41
- id;
42
- }
43
- __decorate([
44
- (0, schema_1.Property)(),
45
- __metadata("design:type", String)
46
- ], Entity.prototype, "id", void 0);
47
- exports.Entity = Entity;
48
- class EntityWithMetadata extends Entity {
49
- metadata;
50
- }
51
- __decorate([
52
- (0, schema_1.Property)(),
53
- __metadata("design:type", EntityMetadata)
54
- ], EntityWithMetadata.prototype, "metadata", void 0);
55
- exports.EntityWithMetadata = EntityWithMetadata;
56
- class NewEntityBase {
57
- id;
58
- }
59
- __decorate([
60
- (0, schema_1.Optional)(String),
61
- __metadata("design:type", String)
62
- ], NewEntityBase.prototype, "id", void 0);
63
- exports.NewEntityBase = NewEntityBase;
64
- function newEntity(type) {
65
- const newName = `New${type.name}Base`;
66
- const newClass = {
67
- [newName]: class extends NewEntityBase {
68
- }
69
- }[newName];
70
- Reflect.decorate([(0, schema_1.Class)({ schema: (0, schema_1.assign)(NewEntityBase, (0, schema_1.partial)(type, 'id')) })], newClass);
71
- return newClass;
72
- }
73
- exports.newEntity = newEntity;
74
- function toEntity(entity) {
75
- const { id, ...entityRest } = entity;
76
- const entityWithId = {
77
- id: id ?? (0, database_1.getNewId)(),
78
- ...entityRest
79
- };
80
- return entityWithId;
81
- }
82
- exports.toEntity = toEntity;
83
- function isId(value) {
84
- return (0, type_guards_1.isString)(value) || (0, type_guards_1.isNumber)(value);
85
- }
86
- exports.isId = isId;
87
- //# sourceMappingURL=ent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AAC;AACxC,CAAC;AAVD,8BAUC;AAED,SAAgB,QAAQ,CAAmB,MAAwB;IACjE,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC;IAErC,MAAM,YAAY,GAAG;QACnB,EAAE,EAAE,EAAE,IAAI,IAAA,mBAAQ,GAAE;QACpB,GAAG,UAAU;KACT,CAAC;IAEP,OAAO,YAAY,CAAC;AACtB,CAAC;AATD,4BASC;AAED,SAAgB,IAAI,CAAC,KAAU;IAC7B,OAAO,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAFD,oBAEC"}
@@ -1 +0,0 @@
1
- export * from './entity';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./entity"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/orm/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}