@strapi/database 5.0.0-beta.1 → 5.0.0-beta.3

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 (38) hide show
  1. package/dist/entity-manager/index.d.ts.map +1 -1
  2. package/dist/entity-manager/relations-orderer.d.ts.map +1 -1
  3. package/dist/index.d.ts +3 -6
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +829 -324
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +827 -322
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/lifecycles/types.d.ts +1 -0
  10. package/dist/lifecycles/types.d.ts.map +1 -1
  11. package/dist/metadata/index.d.ts +1 -1
  12. package/dist/metadata/index.d.ts.map +1 -1
  13. package/dist/metadata/metadata.d.ts +2 -1
  14. package/dist/metadata/metadata.d.ts.map +1 -1
  15. package/dist/metadata/relations.d.ts.map +1 -1
  16. package/dist/migrations/internal-migrations/5.0.0-01-convert-identifiers-long-than-max-length.d.ts +3 -0
  17. package/dist/migrations/internal-migrations/5.0.0-01-convert-identifiers-long-than-max-length.d.ts.map +1 -0
  18. package/dist/migrations/internal-migrations/5.0.0-02-document-id.d.ts +3 -0
  19. package/dist/migrations/internal-migrations/5.0.0-02-document-id.d.ts.map +1 -0
  20. package/dist/migrations/internal-migrations/index.d.ts.map +1 -1
  21. package/dist/query/helpers/join.d.ts.map +1 -1
  22. package/dist/query/helpers/populate/apply.d.ts.map +1 -1
  23. package/dist/query/helpers/where.d.ts +1 -0
  24. package/dist/query/helpers/where.d.ts.map +1 -1
  25. package/dist/schema/index.d.ts +0 -3
  26. package/dist/schema/index.d.ts.map +1 -1
  27. package/dist/types/index.d.ts +3 -0
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/utils/identifiers/hash.d.ts +31 -0
  30. package/dist/utils/identifiers/hash.d.ts.map +1 -0
  31. package/dist/utils/identifiers/index.d.ts +107 -47
  32. package/dist/utils/identifiers/index.d.ts.map +1 -1
  33. package/dist/utils/identifiers/types.d.ts +27 -0
  34. package/dist/utils/identifiers/types.d.ts.map +1 -0
  35. package/dist/validations/relations/bidirectional.d.ts.map +1 -1
  36. package/package.json +7 -6
  37. package/dist/utils/identifiers/shortener.d.ts +0 -73
  38. package/dist/utils/identifiers/shortener.d.ts.map +0 -1
@@ -16,6 +16,7 @@ export interface Event {
16
16
  model: Meta;
17
17
  params: Params;
18
18
  state: Record<string, unknown>;
19
+ result?: any;
19
20
  }
20
21
  export type SubscriberFn = (event: Event) => Promise<void> | void;
21
22
  export type SubscriberMap = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lifecycles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,MAAM,GACd,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAA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AO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC"}
@@ -6,5 +6,5 @@ export { isPolymorphic, isBidirectional, isAnyToOne, isOneToAny, hasOrderColumn,
6
6
  /**
7
7
  * Create Metadata from models configurations
8
8
  */
9
- export declare const createMetadata: (models?: Model[]) => Metadata;
9
+ export declare const createMetadata: (models: Model[]) => Metadata;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,WAAW,GACZ,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,cAAc,YAAY,KAAK,EAAE,KAAQ,QAQrD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,WAAW,GACZ,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,cAAc,WAAY,KAAK,EAAE,KAAG,QAQhD,CAAC"}
@@ -8,12 +8,13 @@ export interface Meta extends Model {
8
8
  lifecycles: Partial<Record<Action, SubscriberFn>>;
9
9
  }
10
10
  export declare class Metadata extends Map<string, Meta> {
11
+ get identifiers(): import("../utils/identifiers").Identifiers;
11
12
  get(key: string): Meta;
12
13
  add(meta: Meta): this;
13
14
  /**
14
15
  * Validate the DB metadata, throwing an error if a duplicate DB table name is detected
15
16
  */
16
17
  validate(): void;
17
- loadModels(models?: Model[]): void;
18
+ loadModels(models: Model[]): void;
18
19
  }
19
20
  //# sourceMappingURL=metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata/metadata.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,WAAW,IAAK,SAAQ,KAAK;IACjC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACnD;AAED,qBAAa,QAAS,SAAQ,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQtB,GAAG,CAAC,IAAI,EAAE,IAAI;IAId;;OAEG;IACH,QAAQ;IAYR,UAAU,CAAC,MAAM,GAAE,KAAK,EAAO;CAkDhC"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata/metadata.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,WAAW,IAAK,SAAQ,KAAK;IACjC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACnD;AAED,qBAAa,QAAS,SAAQ,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;IAI7C,IAAI,WAAW,+CAEd;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQtB,GAAG,CAAC,IAAI,EAAE,IAAI;IAId;;OAEG;IACH,QAAQ;IAYR,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE;CAoD3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/metadata/relations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACj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AA8hBvD;;GAEG;AACH,eAAO,MAAM,cAAc,kBACV,MAAM,aACV,mBAAmB,QACxB,IAAI,YACA,QAAQ,SAuBnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Migration } from '../common';
2
+ export declare const renameIdentifiersLongerThanMaxLength: Migration;
3
+ //# sourceMappingURL=5.0.0-01-convert-identifiers-long-than-max-length.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"5.0.0-01-convert-identifiers-long-than-max-length.d.ts","sourceRoot":"","sources":["../../../src/migrations/internal-migrations/5.0.0-01-convert-identifiers-long-than-max-length.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAqB3C,eAAO,MAAM,oCAAoC,EAAE,SA4ClD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Migration } from '../common';
2
+ export declare const createdDocumentId: Migration;
3
+ //# sourceMappingURL=5.0.0-02-document-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"5.0.0-02-document-id.d.ts","sourceRoot":"","sources":["../../../src/migrations/internal-migrations/5.0.0-02-document-id.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA8I3C,eAAO,MAAM,iBAAiB,EAAE,SAgC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/internal-migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,EAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/internal-migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,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C"}
@@ -1 +1 @@
1
- {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../../src/query/helpers/populate/apply.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,KAAK,OAAO,GAAG;IACb,EAAE,EAAE,QAAQ,CAAC;IACb,EAAE,EAAE,YAAY,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAoBF,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAqmBnC,QAAA,MAAM,aAAa,YAAmB,GAAG,EAAE,YAAY,OAAO,MAAM,EAAE,GAAG,CAAC,OAAO,OAAO,+BAgEvF,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../../src/query/helpers/populate/apply.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,KAAK,OAAO,GAAG;IACb,EAAE,EAAE,QAAQ,CAAC;IACb,EAAE,EAAE,YAAY,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAoBF,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA8mBnC,QAAA,MAAM,aAAa,YAAmB,GAAG,EAAE,YAAY,OAAO,MAAM,EAAE,GAAG,CAAC,OAAO,OAAO,+BAgEvF,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -2,6 +2,7 @@ import type { Knex } from 'knex';
2
2
  import type { Ctx } from '../types';
3
3
  type WhereCtx = Ctx & {
4
4
  alias?: string;
5
+ isGroupRoot?: boolean;
5
6
  };
6
7
  /**
7
8
  * Process where parameter
@@ -1 +1 @@
1
- {"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../../src/query/helpers/where.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AASjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AA+DpC,KAAK,QAAQ,GAAG,GAAG,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC;;GAEG;AACH,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9F,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAkSlG,KAAK,KAAK,GACN;IACE,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GACD,KAAK,CAAC,KAAK,CAAC,CAAC;AAEjB,QAAA,MAAM,UAAU,OAAQ,KAAK,YAAY,SAAS,KAAK,4CAoCtD,CAAC;AAWF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../../src/query/helpers/where.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AASjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGpC,KAAK,QAAQ,GAAG,GAAG,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA2FhE;;GAEG;AACH,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9F,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAkSlG,KAAK,KAAK,GACN;IACE,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GACD,KAAK,CAAC,KAAK,CAAC,CAAC;AAEjB,QAAA,MAAM,UAAU,OAAQ,KAAK,YAAY,SAAS,KAAK,4CAoCtD,CAAC;AAWF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC"}
@@ -15,8 +15,5 @@ export interface SchemaProvider {
15
15
  drop(): Promise<void>;
16
16
  schema: Schema;
17
17
  }
18
- /**
19
- * @type {import('.').default}
20
- */
21
18
  export declare const createSchemaProvider: (db: Database) => SchemaProvider;
22
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAEA,OAAO,mBAAmB,MAAM,WAAW,CAAC;AAC5C,OAAO,gBAAgB,MAAM,QAAQ,CAAC;AACtC,OAAO,mBAAmB,MAAM,WAAW,CAAC;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAEnC,mBAAmB,SAAS,CAAC;AAI7B,MAAM,WAAW,cAAc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AC,CAAC;IACxB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,eAAO,MAAM,oBAAoB,OAAQ,QAAQ,KAAG,cAuFnD,CAAC"}
@@ -170,4 +170,7 @@ export interface Model {
170
170
  foreignKeys?: ForeignKey[];
171
171
  lifecycles?: Partial<Record<Action, SubscriberFn>>;
172
172
  }
173
+ export type MetadataOptions = {
174
+ maxLength: number;
175
+ };
173
176
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAE9D,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,CAAC,QAAQ,GACjB,QAAQ,CAAC,SAAS,GAClB,QAAQ,CAAC,SAAS,GAClB,QAAQ,CAAC,UAAU,GACnB,QAAQ,CAAC,SAAS,GAClB,QAAQ,CAAC,QAAQ,GACjB,QAAQ,CAAC,UAAU,GACnB,QAAQ,CAAC,WAAW,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,GAA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AAO,CAAC,CAAC;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACvE,QAAQ,EAAE,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;IAClE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,cAAc,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @fileoverview This file contains utility functions for shortening identifiers for use in a database schema.
3
+ * The functions in this file are used to generate shorter names for database tables and columns
4
+ * to avoid breaking the constraints of databases.
5
+ *
6
+ * IMPORTANT
7
+ * Any changes here that result in a different output string from any of the naming methods will
8
+ * cause the schema creation to delete data it doesn't recognize because the name
9
+ * is different.
10
+ *
11
+ * If there are any test failures after updating this code, it means there is a breaking change that
12
+ * will cause data loss, so beware; do not update the test to match your changes
13
+ *
14
+ * @internal
15
+ */
16
+ /**
17
+ * Creates a hash of the given data with the specified string length as a string of hex characters
18
+ *
19
+ * @example
20
+ * createHash("myData", 5); // "03f85"
21
+ * createHash("myData", 2); // "03"
22
+ * createHash("myData", 1); // "0"
23
+ *
24
+ * @param data - The data to be hashed
25
+ * @param len - The length of the hash
26
+ * @returns The generated hash
27
+ * @throws Error if the length is not a positive integer
28
+ * @internal
29
+ */
30
+ export declare function createHash(data: string, len: number): string;
31
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/utils/identifiers/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAO5D"}
@@ -1,48 +1,108 @@
1
- export declare const ID_COLUMN = "id";
2
- export declare const ORDER_COLUMN = "order";
3
- export declare const FIELD_COLUMN = "field";
4
- type NameInput = string | string[];
5
- type NameOptions = {
6
- suffix?: string;
7
- prefix?: string;
8
- maxLength?: number;
9
- };
10
- /**
11
- * TODO: we should be requiring snake_case inputs for all names here, but we
12
- * aren't and it will require some refactoring to make it work. Currently if
13
- * we get names 'myModel' and 'my_model' they would be converted to the same
14
- * final string my_model which generally works but is not entirely safe
15
- * */
16
- export declare const getName: (names: NameInput, options?: NameOptions) => string;
17
- /**
18
- * TABLES
19
- */
20
- export declare const getTableName: (name: string, options?: NameOptions) => string;
21
- export declare const getJoinTableName: (collectionName: string, attributeName: string, options?: NameOptions) => string;
22
- export declare const getMorphTableName: (collectionName: string, attributeName: string, options?: NameOptions) => string;
23
- /**
24
- * COLUMNS
25
- */
26
- export declare const getColumnName: (attributeName: string, options?: NameOptions) => string;
27
- export declare const getJoinColumnAttributeIdName: (attributeName: string, options?: NameOptions) => string;
28
- export declare const getInverseJoinColumnAttributeIdName: (attributeName: string, options?: NameOptions) => string;
29
- export declare const getOrderColumnName: (singularName: string, options?: NameOptions) => string;
30
- export declare const getInverseOrderColumnName: (singularName: string, options?: NameOptions) => string;
31
- /**
32
- * Morph Join Tables
33
- */
34
- export declare const getMorphColumnJoinTableIdName: (singularName: string, options?: NameOptions) => string;
35
- export declare const getMorphColumnAttributeIdName: (attributeName: string, options?: NameOptions) => string;
36
- export declare const getMorphColumnTypeName: (attributeName: string, options?: NameOptions) => string;
37
- /**
38
- * INDEXES
39
- */
40
- export declare const getIndexName: (names: NameInput, options?: NameOptions) => string;
41
- export declare const getFkIndexName: (names: NameInput, options?: NameOptions) => string;
42
- export declare const getInverseFkIndexName: (names: NameInput, options?: NameOptions) => string;
43
- export declare const getOrderFkIndexName: (names: NameInput, options?: NameOptions) => string;
44
- export declare const getOrderInverseFkIndexName: (names: NameInput, options?: NameOptions) => string;
45
- export declare const getUniqueIndexName: (names: NameInput, options?: NameOptions) => string;
46
- export declare const getPrimaryIndexName: (names: NameInput) => string;
47
- export {};
1
+ import { IdentifiersOptions, NameInput, NameOptions, NameToken } from './types';
2
+ export declare class Identifiers {
3
+ #private;
4
+ ID_COLUMN: "id";
5
+ ORDER_COLUMN: "order";
6
+ FIELD_COLUMN: "field";
7
+ HASH_LENGTH: 5;
8
+ HASH_SEPARATOR: "";
9
+ IDENTIFIER_SEPARATOR: "_";
10
+ MIN_TOKEN_LENGTH: 3;
11
+ constructor(options: {
12
+ maxLength: number;
13
+ });
14
+ get replacementMap(): {
15
+ links: string;
16
+ order_inv_fk: string;
17
+ order: string;
18
+ morphs: string;
19
+ index: string;
20
+ inv_fk: string;
21
+ order_fk: string;
22
+ id_column_index: string;
23
+ order_index: string;
24
+ unique: string;
25
+ primary: string;
26
+ };
27
+ get options(): IdentifiersOptions;
28
+ mapshortNames: (name: string) => string | undefined;
29
+ /**
30
+ * TODO: we should be requiring snake_case inputs for all names here, but we
31
+ * aren't and it will require some refactoring to make it work. Currently if
32
+ * we get names 'myModel' and 'my_model' they would be converted to the same
33
+ * final string my_model which generally works but is not entirely safe
34
+ * */
35
+ getName: (names: NameInput, options?: NameOptions) => string;
36
+ /**
37
+ * TABLES
38
+ */
39
+ getTableName: (name: string, options?: NameOptions) => string;
40
+ getJoinTableName: (collectionName: string, attributeName: string, options?: NameOptions) => string;
41
+ getMorphTableName: (collectionName: string, attributeName: string, options?: NameOptions) => string;
42
+ /**
43
+ * COLUMNS
44
+ */
45
+ getColumnName: (attributeName: string, options?: NameOptions) => string;
46
+ getJoinColumnAttributeIdName: (attributeName: string, options?: NameOptions) => string;
47
+ getInverseJoinColumnAttributeIdName: (attributeName: string, options?: NameOptions) => string;
48
+ getOrderColumnName: (singularName: string, options?: NameOptions) => string;
49
+ getInverseOrderColumnName: (singularName: string, options?: NameOptions) => string;
50
+ /**
51
+ * Morph Join Tables
52
+ */
53
+ getMorphColumnJoinTableIdName: (singularName: string, options?: NameOptions) => string;
54
+ getMorphColumnAttributeIdName: (attributeName: string, options?: NameOptions) => string;
55
+ getMorphColumnTypeName: (attributeName: string, options?: NameOptions) => string;
56
+ /**
57
+ * INDEXES
58
+ * Note that these methods are generally used to reference full table names + attribute(s), which
59
+ * may already be shortened strings rather than individual parts.
60
+ * That is fine and expected to compress the previously incompressible parts of those strings,
61
+ * because in these cases the relevant information is the table name and we can't really do
62
+ * any better; shortening the individual parts again might make it even more confusing.
63
+ *
64
+ * So for example, the fk for the table `mytable_myattr4567d_localizations` will become
65
+ * mytable_myattr4567d_loc63bf2_fk
66
+ */
67
+ getIndexName: (names: NameInput, options?: NameOptions) => string;
68
+ getFkIndexName: (names: NameInput, options?: NameOptions) => string;
69
+ getUniqueIndexName: (names: NameInput, options?: NameOptions) => string;
70
+ getPrimaryIndexName: (names: NameInput, options?: NameOptions) => string;
71
+ getInverseFkIndexName: (names: NameInput, options?: NameOptions) => string;
72
+ getOrderFkIndexName: (names: NameInput, options?: NameOptions) => string;
73
+ getOrderInverseFkIndexName: (names: NameInput, options?: NameOptions) => string;
74
+ getIdColumnIndexName: (names: NameInput, options?: NameOptions) => string;
75
+ getOrderIndexName: (names: NameInput, options?: NameOptions) => string;
76
+ /**
77
+ * Generates a string with a max length, appending a hash at the end if necessary to keep it unique
78
+ *
79
+ * @example
80
+ * // if we have strings such as "longstring1" and "longstring2" with a max length of 9,
81
+ * // we don't want to end up with "longstrin" and "longstrin"
82
+ * // we want something such as "longs0b23" and "longs953f"
83
+ * const token1 = generateToken("longstring1", 9); // "longs0b23"
84
+ * const token2 = generateToken("longstring2", 9); // "longs953f"
85
+ *
86
+ * @param name - The base name
87
+ * @param len - The desired length of the token.
88
+ * @returns The generated token with hash.
89
+ * @throws Error if the length is not a positive integer, or if the length is too short for the token.
90
+ * @internal
91
+ */
92
+ getShortenedName: (name: string, len: number) => string;
93
+ /**
94
+ * Constructs a name from an array of name tokens within a specified maximum length. It ensures the final name does not exceed
95
+ * this limit by selectively compressing tokens marked as compressible. If the name exceeds the maximum length and cannot be
96
+ * compressed sufficiently, an error is thrown. This function supports dynamic adjustment of token lengths to fit within the
97
+ * maxLength constraint (that is, it will always make use of all available space), while also ensuring the preservation of
98
+ * incompressible tokens.
99
+ * @internal
100
+ */
101
+ getNameFromTokens: (nameTokens: NameToken[]) => string;
102
+ nameMap: Map<string, string>;
103
+ getUnshortenedName: (shortName: string) => string;
104
+ setUnshortenedName: (shortName: string, fullName: string) => void;
105
+ serializeKey: (shortName: string) => string;
106
+ }
107
+ export declare const identifiers: Identifiers;
48
108
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/identifiers/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM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M,YAAY,WAAW,YAEjF;IAEF,kBAAkB,iBAAkB,MAAM,YAAY,WAAW,YAE/D;IAEF,yBAAyB,iBAAkB,MAAM,YAAY,WAAW,YAMtE;IAEF;;OAEG;IACH,6BAA6B,iBAAkB,MAAM,YAAY,WAAW,YAE1E;IAEF,6BAA6B,kBAAmB,MAAM,YAAY,WAAW,YAE3E;IAEF,sBAAsB,kBAAmB,MAAM,YAAY,WAAW,YAEpE;IAEF;;;;;;;;;;OAUG;IAGH,YAAY,UAAW,SAAS,YAAY,WAAW,YAErD;IAEF,cAAc,UAAW,SAAS,YAAY,WAAW,YAEvD;IAEF,kBAAkB,UAAW,SAAS,YAAY,WAAW,YAE3D;IAEF,mBAAmB,UAAW,SAAS,YAAY,WAAW,YAE5D;IAGF,qBAAqB,UAAW,SAAS,YAAY,WAAW,YAE9D;IAEF,mBAAmB,UAAW,SAAS,YAAY,WAAW,YAE5D;IAEF,0BAA0B,UAAW,SAAS,YAAY,WAAW,YAEnE;IAEF,oBAAoB,UAAW,SAAS,YAAY,WAAW,YAE7D;IAEF,iBAAiB,UAAW,SAAS,YAAY,WAAW,YAE1D;IAEF;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,SAAU,MAAM,OAAO,MAAM,YAwB3C;IAEF;;;;;;;OAOG;IACH,iBAAiB,eAAgB,SAAS,EAAE,KAAG,MAAM,CAqJnD;IAIF,OAAO,sBAA6B;IAEpC,kBAAkB,cAAe,MAAM,YAErC;IAEF,kBAAkB,cAAe,MAAM,YAAY,MAAM,UAUvD;IAEF,YAAY,cAAe,MAAM,YAE/B;CACH;AAID,eAAO,MAAM,WAAW,aAAwD,CAAC"}
@@ -0,0 +1,27 @@
1
+ export type NameInput = string | string[];
2
+ export type CompressibleNameToken = {
3
+ compressible: true;
4
+ name: string;
5
+ allocatedLength?: number;
6
+ };
7
+ export type IncompressibleNameToken = {
8
+ compressible: false;
9
+ name: string;
10
+ allocatedLength?: number;
11
+ shortName?: string;
12
+ };
13
+ export type NameToken = CompressibleNameToken | IncompressibleNameToken;
14
+ export type NameFromTokenOptions = {
15
+ maxLength: number;
16
+ };
17
+ export type IdentifiersOptions = {
18
+ maxLength: number;
19
+ };
20
+ export type NameOptions = {
21
+ suffix?: string;
22
+ prefix?: string;
23
+ };
24
+ export type NameTokenWithAllocation = NameToken & {
25
+ allocatedLength: number;
26
+ };
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/identifiers/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAE1C,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE,KAAK,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAExE,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"bidirectional.d.ts","sourceRoot":"","sources":["../../../src/validations/relations/bidirectional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA+CtC;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,OAAc,QAAQ,kBA+BhE,CAAC"}
1
+ {"version":3,"file":"bidirectional.d.ts","sourceRoot":"","sources":["../../../src/validations/relations/bidirectional.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA+CtC;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,OAAc,QAAQ,kBAqChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/database",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "Strapi's database layer",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -39,7 +39,8 @@
39
39
  "watch": "pack-up watch"
40
40
  },
41
41
  "dependencies": {
42
- "@strapi/utils": "5.0.0-beta.1",
42
+ "@paralleldrive/cuid2": "2.2.2",
43
+ "@strapi/utils": "5.0.0-beta.3",
43
44
  "date-fns": "2.30.0",
44
45
  "debug": "4.3.4",
45
46
  "fs-extra": "10.1.0",
@@ -49,13 +50,13 @@
49
50
  "umzug": "3.2.1"
50
51
  },
51
52
  "devDependencies": {
52
- "@strapi/pack-up": "5.0.0-beta.1",
53
- "eslint-config-custom": "5.0.0-beta.1",
54
- "tsconfig": "5.0.0-beta.1"
53
+ "@strapi/pack-up": "5.0.0-beta.3",
54
+ "eslint-config-custom": "5.0.0-beta.3",
55
+ "tsconfig": "5.0.0-beta.3"
55
56
  },
56
57
  "engines": {
57
58
  "node": ">=18.0.0 <=20.x.x",
58
59
  "npm": ">=6.0.0"
59
60
  },
60
- "gitHead": "ae773621dfcbc67c49dc6fa52ac41ea5de676ecb"
61
+ "gitHead": "cff608ed925db31db7f6cb84aac4a0576f54e90c"
61
62
  }
@@ -1,73 +0,0 @@
1
- /**
2
- * @fileoverview This file contains utility functions for shortening identifiers for use in a database schema.
3
- * The functions in this file are used to generate shorter names for database tables and columns
4
- * to avoid breaking the constraints of databases.
5
- *
6
- * IMPORTANT
7
- * Any changes here that result in a different output string from any of the naming methods will
8
- * cause the schema creation to delete data it doesn't recognize because the name
9
- * is different.
10
- *
11
- * If there are any test failures after updating this code, it means there is a breaking change that
12
- * will cause data loss, so beware; do not update the test to match your changes
13
- *
14
- * @internal
15
- */
16
- export declare const MAX_DB_IDENTIFIER_LENGTH = 0;
17
- export declare const HASH_LENGTH = 5;
18
- export declare const HASH_SEPARATOR = "";
19
- export declare const IDENTIFIER_SEPARATOR = "_";
20
- export declare const MIN_TOKEN_LENGTH = 3;
21
- type NameToken = {
22
- allocatedLength?: number;
23
- name: string;
24
- compressible: boolean;
25
- };
26
- /**
27
- * Creates a hash of the given data with the specified string length as a string of hex characters
28
- *
29
- * @example
30
- * createHash("myData", 5); // "03f85"
31
- * createHash("myData", 2); // "03"
32
- * createHash("myData", 1); // "0"
33
- *
34
- * @param data - The data to be hashed
35
- * @param len - The length of the hash
36
- * @returns The generated hash
37
- * @throws Error if the length is not a positive integer
38
- * @internal
39
- */
40
- export declare function createHash(data: string, len: number): string;
41
- /**
42
- * Generates a string with a max length, appending a hash at the end if necessary to keep it unique
43
- *
44
- * @example
45
- * // if we have strings such as "longstring1" and "longstring2" with a max length of 9,
46
- * // we don't want to end up with "longstrin" and "longstrin"
47
- * // we want something such as "longs0b23" and "longs953f"
48
- * const token1 = generateToken("longstring1", 9); // "longs0b23"
49
- * const token2 = generateToken("longstring2", 9); // "longs953f"
50
- *
51
- * @param name - The base name
52
- * @param len - The desired length of the token.
53
- * @returns The generated token with hash.
54
- * @throws Error if the length is not a positive integer, or if the length is too short for the token.
55
- * @internal
56
- */
57
- export declare function getShortenedName(name: string, len: number): string;
58
- /**
59
- * Constructs a name from an array of name tokens within a specified maximum length. It ensures the final name does not exceed
60
- * this limit by selectively compressing tokens marked as compressible. If the name exceeds the maximum length and cannot be
61
- * compressed sufficiently, an error is thrown. This function supports dynamic adjustment of token lengths to fit within the
62
- * maxLength constraint (that is, it will always make use of all available space), while also ensuring the preservation of
63
- * incompressible tokens.
64
- *
65
- * @param {NameToken[]} nameTokens - Array of name tokens
66
- * @param {number} [maxLength=MAX_DB_IDENTIFIER_LENGTH] - Maximum length for the final name string.
67
- * @returns {string} The generated name string within maxLength.
68
- * @throws {Error} If the name cannot be shortened to meet maxLength.
69
- * @internal
70
- */
71
- export declare function getNameFromTokens(nameTokens: NameToken[], maxLength?: number): string;
72
- export {};
73
- //# sourceMappingURL=shortener.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shortener.d.ts","sourceRoot":"","sources":["../../../src/utils/identifiers/shortener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAM1C,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,KAAK,SAAS,GAAG;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAIF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAS5D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAqBzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,SAAS,SAA2B,UA2G9F"}