@webiny/db-dynamodb 6.2.0 → 6.3.0-beta.0

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.
@@ -1 +1,4 @@
1
- export declare const FilterUtilFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const FilterUtilFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const ValueFilterFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const ValueFilterFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/db-dynamodb",
3
- "version": "6.2.0",
3
+ "version": "6.3.0-beta.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -11,13 +11,13 @@
11
11
  "author": "Webiny Ltd",
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
- "@webiny/api": "6.2.0",
15
- "@webiny/aws-sdk": "6.2.0",
16
- "@webiny/db": "6.2.0",
17
- "@webiny/error": "6.2.0",
18
- "@webiny/feature": "6.2.0",
19
- "@webiny/plugins": "6.2.0",
20
- "@webiny/utils": "6.2.0",
14
+ "@webiny/api": "6.3.0-beta.0",
15
+ "@webiny/aws-sdk": "6.3.0-beta.0",
16
+ "@webiny/db": "6.3.0-beta.0",
17
+ "@webiny/error": "6.3.0-beta.0",
18
+ "@webiny/feature": "6.3.0-beta.0",
19
+ "@webiny/plugins": "6.3.0-beta.0",
20
+ "@webiny/utils": "6.3.0-beta.0",
21
21
  "date-fns": "4.1.0",
22
22
  "dot-prop": "10.1.0",
23
23
  "dynamodb-toolbox": "0.9.5",
@@ -26,18 +26,18 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/is-number": "7.0.5",
29
- "@webiny/build-tools": "6.2.0",
29
+ "@webiny/build-tools": "6.3.0-beta.0",
30
30
  "@webiny/di": "0.2.3",
31
- "@webiny/handler": "6.2.0",
32
- "@webiny/project-utils": "6.2.0",
31
+ "@webiny/handler": "6.3.0-beta.0",
32
+ "@webiny/project-utils": "6.3.0-beta.0",
33
33
  "jest-dynalite": "3.6.1",
34
34
  "rimraf": "6.1.3",
35
- "typescript": "5.9.3",
35
+ "typescript": "6.0.3",
36
36
  "vitest": "4.1.4"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public",
40
40
  "directory": "dist"
41
41
  },
42
- "gitHead": "3d3148358b6febbc857371930871743bec3b3939"
42
+ "gitHead": "94c21e58aebc9855bf1ae972423281faa0f5c135"
43
43
  }
package/toolbox.d.ts CHANGED
@@ -5,4 +5,56 @@ export type DynamoDBTypes = "string" | "boolean" | "number" | "bigint" | "list"
5
5
  type Key = string | number | symbol;
6
6
  export type TableDef = Table<string, Key, Key | null>;
7
7
  export type TableConstructor<A extends string, B extends Key, C extends Key> = ConstructorParameters<typeof Table<A, B, C>>[0];
8
- export type { EntityConstructor, Readonly, AttributeDefinition, EntityQueryOptions, AttributeDefinitions } from "dynamodb-toolbox/dist/cjs/classes/Entity/index.js";
8
+ export type Readonly<T> = T extends ((...args: any[]) => any) | undefined ? T : T extends object ? {
9
+ readonly [P in keyof T]: Readonly<T[P]>;
10
+ } : T;
11
+ export type AttributeDefinition = DynamoDBTypes | Partial<{
12
+ type: DynamoDBTypes;
13
+ coerce: boolean;
14
+ default: unknown;
15
+ dependsOn: string | string[];
16
+ required: boolean | "always";
17
+ hidden: boolean;
18
+ prefix: string;
19
+ suffix: string;
20
+ delimiter: string;
21
+ map: string;
22
+ alias: string;
23
+ onlyMap: boolean;
24
+ partitionKey: boolean;
25
+ sortKey: boolean;
26
+ [key: string]: unknown;
27
+ }> | [string, number] | [string, number, string] | [string, number, Record<string, unknown>];
28
+ export type AttributeDefinitions = Record<PropertyKey, AttributeDefinition>;
29
+ export interface EntityConstructor<T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>> {
30
+ name: string;
31
+ attributes: T;
32
+ table?: TableDef;
33
+ timestamps?: boolean;
34
+ createdAlias?: string;
35
+ modifiedAlias?: string;
36
+ typeAlias?: string;
37
+ typeHidden?: boolean;
38
+ autoExecute?: boolean;
39
+ autoParse?: boolean;
40
+ }
41
+ export interface EntityQueryOptions {
42
+ index?: string;
43
+ limit?: number;
44
+ reverse?: boolean;
45
+ consistent?: boolean;
46
+ capacity?: "indexes" | "total" | "none";
47
+ select?: "all_attributes" | "all_projected_attributes" | "count" | "specific_attributes";
48
+ eq?: string | number;
49
+ lt?: string | number;
50
+ lte?: string | number;
51
+ gt?: string | number;
52
+ gte?: string | number;
53
+ between?: [string, string] | [number, number] | [bigint, bigint];
54
+ beginsWith?: string;
55
+ startKey?: Record<string, unknown>;
56
+ filters?: Record<string, unknown>;
57
+ attributes?: string[];
58
+ execute?: boolean;
59
+ parse?: boolean;
60
+ }
package/toolbox.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Entity, Table } from "dynamodb-toolbox";
2
2
 
3
- // TODO: this needs to be replaced with either inferred types, or manual cherry picked types.
3
+ // Types previously imported from dynamodb-toolbox internals.
4
+ // Declared locally to avoid deep path imports blocked by moduleResolution: bundler.
4
5
 
5
6
  //# sourceMappingURL=toolbox.js.map
package/toolbox.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Entity","Table"],"sources":["toolbox.ts"],"sourcesContent":["export { Entity, Table } from \"dynamodb-toolbox\";\n\nimport { Entity, Table } from \"dynamodb-toolbox\";\n\nexport type ScanOptions = NonNullable<Parameters<Entity[\"scan\"]>[0]>;\nexport type DynamoDBTypes =\n | \"string\"\n | \"boolean\"\n | \"number\"\n | \"bigint\"\n | \"list\"\n | \"map\"\n | \"binary\"\n | \"set\";\n\ntype Key = string | number | symbol;\n\nexport type TableDef = Table<string, Key, Key | null>;\nexport type TableConstructor<\n A extends string,\n B extends Key,\n C extends Key\n> = ConstructorParameters<typeof Table<A, B, C>>[0];\n\n// TODO: this needs to be replaced with either inferred types, or manual cherry picked types.\nexport type {\n EntityConstructor,\n Readonly,\n AttributeDefinition,\n EntityQueryOptions,\n AttributeDefinitions\n} from \"dynamodb-toolbox/dist/cjs/classes/Entity/index.js\";\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,KAAK,QAAQ,kBAAkB;;AAwBhD","ignoreList":[]}
1
+ {"version":3,"names":["Entity","Table"],"sources":["toolbox.ts"],"sourcesContent":["export { Entity, Table } from \"dynamodb-toolbox\";\n\nimport { Entity, Table } from \"dynamodb-toolbox\";\n\nexport type ScanOptions = NonNullable<Parameters<Entity[\"scan\"]>[0]>;\nexport type DynamoDBTypes =\n | \"string\"\n | \"boolean\"\n | \"number\"\n | \"bigint\"\n | \"list\"\n | \"map\"\n | \"binary\"\n | \"set\";\n\ntype Key = string | number | symbol;\n\nexport type TableDef = Table<string, Key, Key | null>;\nexport type TableConstructor<\n A extends string,\n B extends Key,\n C extends Key\n> = ConstructorParameters<typeof Table<A, B, C>>[0];\n\n// Types previously imported from dynamodb-toolbox internals.\n// Declared locally to avoid deep path imports blocked by moduleResolution: bundler.\nexport type Readonly<T> = T extends ((...args: any[]) => any) | undefined\n ? T\n : T extends object\n ? { readonly [P in keyof T]: Readonly<T[P]> }\n : T;\n\nexport type AttributeDefinition =\n | DynamoDBTypes\n | Partial<{\n type: DynamoDBTypes;\n coerce: boolean;\n default: unknown;\n dependsOn: string | string[];\n required: boolean | \"always\";\n hidden: boolean;\n prefix: string;\n suffix: string;\n delimiter: string;\n map: string;\n alias: string;\n onlyMap: boolean;\n partitionKey: boolean;\n sortKey: boolean;\n [key: string]: unknown;\n }>\n | [string, number]\n | [string, number, string]\n | [string, number, Record<string, unknown>];\n\nexport type AttributeDefinitions = Record<PropertyKey, AttributeDefinition>;\n\nexport interface EntityConstructor<\n T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>\n> {\n name: string;\n attributes: T;\n table?: TableDef;\n timestamps?: boolean;\n createdAlias?: string;\n modifiedAlias?: string;\n typeAlias?: string;\n typeHidden?: boolean;\n autoExecute?: boolean;\n autoParse?: boolean;\n}\n\nexport interface EntityQueryOptions {\n index?: string;\n limit?: number;\n reverse?: boolean;\n consistent?: boolean;\n capacity?: \"indexes\" | \"total\" | \"none\";\n select?: \"all_attributes\" | \"all_projected_attributes\" | \"count\" | \"specific_attributes\";\n eq?: string | number;\n lt?: string | number;\n lte?: string | number;\n gt?: string | number;\n gte?: string | number;\n between?: [string, string] | [number, number] | [bigint, bigint];\n beginsWith?: string;\n startKey?: Record<string, unknown>;\n filters?: Record<string, unknown>;\n attributes?: string[];\n execute?: boolean;\n parse?: boolean;\n}\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,KAAK,QAAQ,kBAAkB;;AAwBhD;AACA","ignoreList":[]}
package/utils/count.js CHANGED
@@ -4,6 +4,7 @@ export const count = async params => {
4
4
  partitionKey,
5
5
  options = {}
6
6
  } = params;
7
+ // @ts-expect-error
7
8
  const {
8
9
  Count
9
10
  } = await entity.query(partitionKey, {
@@ -1 +1 @@
1
- {"version":3,"names":["count","params","entity","partitionKey","options","Count","query","select"],"sources":["count.ts"],"sourcesContent":["import type { QueryAllParams } from \"~/utils/query.js\";\n\nexport const count = async (params: QueryAllParams): Promise<number> => {\n const { entity, partitionKey, options = {} } = params;\n const { Count } = await entity.query(partitionKey, { ...options, select: \"count\" });\n return Count || 0;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,KAAK,GAAG,MAAOC,MAAsB,IAAsB;EACpE,MAAM;IAAEC,MAAM;IAAEC,YAAY;IAAEC,OAAO,GAAG,CAAC;EAAE,CAAC,GAAGH,MAAM;EACrD,MAAM;IAAEI;EAAM,CAAC,GAAG,MAAMH,MAAM,CAACI,KAAK,CAACH,YAAY,EAAE;IAAE,GAAGC,OAAO;IAAEG,MAAM,EAAE;EAAQ,CAAC,CAAC;EACnF,OAAOF,KAAK,IAAI,CAAC;AACrB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["count","params","entity","partitionKey","options","Count","query","select"],"sources":["count.ts"],"sourcesContent":["import type { QueryAllParams } from \"~/utils/query.js\";\n\nexport const count = async (params: QueryAllParams): Promise<number> => {\n const { entity, partitionKey, options = {} } = params;\n // @ts-expect-error\n const { Count } = await entity.query(partitionKey, { ...options, select: \"count\" });\n return Count || 0;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,KAAK,GAAG,MAAOC,MAAsB,IAAsB;EACpE,MAAM;IAAEC,MAAM;IAAEC,YAAY;IAAEC,OAAO,GAAG,CAAC;EAAE,CAAC,GAAGH,MAAM;EACrD;EACA,MAAM;IAAEI;EAAM,CAAC,GAAG,MAAMH,MAAM,CAACI,KAAK,CAACH,YAAY,EAAE;IAAE,GAAGC,OAAO;IAAEG,MAAM,EAAE;EAAQ,CAAC,CAAC;EACnF,OAAOF,KAAK,IAAI,CAAC;AACrB,CAAC","ignoreList":[]}
@@ -6,7 +6,7 @@ import type { IPutParamsItem } from "../put.js";
6
6
  import type { GetRecordParamsKeys } from "../get.js";
7
7
  import type { IDeleteItemKeys } from "../delete.js";
8
8
  import type { GenericRecord } from "@webiny/api/types.js";
9
- export type EntityConstructor<T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>> = BaseEntityConstructor<TableDef, string, true, true, true, "created", "modified", "entity", false, T>;
9
+ export type EntityConstructor<T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>> = BaseEntityConstructor<T>;
10
10
  export declare class Entity<T extends GenericRecord = GenericRecord> implements IEntity<T> {
11
11
  readonly entity: BaseEntity;
12
12
  get name(): string;
@@ -17,6 +17,7 @@ export class Entity {
17
17
  return this.entity.table;
18
18
  }
19
19
  constructor(params) {
20
+ // @ts-expect-error
20
21
  this.entity = new BaseEntity(params);
21
22
  }
22
23
  createEntityReader(params) {
@@ -1 +1 @@
1
- {"version":3,"names":["Entity","BaseEntity","put","get","getClean","deleteItem","createEntityReadBatch","createEntityWriteBatch","createTableWriteBatch","queryAll","queryAllClean","queryOne","queryOneClean","queryPerPage","name","entity","table","constructor","params","createEntityReader","read","createEntityWriter","delete","createTableWriter","item","keys","createEntity"],"sources":["Entity.ts"],"sourcesContent":["import type {\n AttributeDefinitions,\n EntityConstructor as BaseEntityConstructor,\n Readonly,\n TableDef\n} from \"~/toolbox.js\";\nimport { Entity as BaseEntity } from \"~/toolbox.js\";\nimport type { ITableWriteBatch } from \"../table/types.js\";\nimport type {\n IEntity,\n IEntityCreateEntityReaderParams,\n IEntityCreateEntityWriterParams,\n IEntityDeleteResult,\n IEntityGetCleanResult,\n IEntityGetResult,\n IEntityPutResult,\n IEntityQueryAllCleanResult,\n IEntityQueryAllParams,\n IEntityQueryAllResult,\n IEntityQueryOneCleanResult,\n IEntityQueryOneParams,\n IEntityQueryOneResult,\n IEntityQueryPerPageParams,\n IEntityReadBatch,\n IEntityWriteBatch\n} from \"./types.js\";\nimport type { IPutParamsItem } from \"../put.js\";\nimport { put } from \"../put.js\";\nimport type { GetRecordParamsKeys } from \"../get.js\";\nimport { get, getClean } from \"../get.js\";\nimport type { IDeleteItemKeys } from \"../delete.js\";\nimport { deleteItem } from \"../delete.js\";\nimport { createEntityReadBatch } from \"./EntityReadBatch.js\";\nimport { createEntityWriteBatch } from \"./EntityWriteBatch.js\";\nimport { createTableWriteBatch } from \"~/utils/table/TableWriteBatch.js\";\nimport { queryAll, queryAllClean, queryOne, queryOneClean, queryPerPage } from \"../query.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport type EntityConstructor<\n T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>\n> = BaseEntityConstructor<\n TableDef,\n string,\n true,\n true,\n true,\n \"created\",\n \"modified\",\n \"entity\",\n false,\n T\n>;\n\nexport class Entity<T extends GenericRecord = GenericRecord> implements IEntity<T> {\n public readonly entity: BaseEntity;\n\n public get name(): string {\n return this.entity.name;\n }\n\n public get table(): TableDef {\n /**\n * Not possible to be undefined.\n */\n return this.entity.table!;\n }\n\n public constructor(params: EntityConstructor) {\n this.entity = new BaseEntity(params);\n }\n\n public createEntityReader(params?: IEntityCreateEntityReaderParams): IEntityReadBatch<T> {\n return createEntityReadBatch({\n entity: this.entity,\n read: params?.read\n });\n }\n\n public createEntityWriter(params?: IEntityCreateEntityWriterParams): IEntityWriteBatch<T> {\n return createEntityWriteBatch({\n entity: this.entity,\n put: params?.put,\n delete: params?.delete\n });\n }\n\n public createTableWriter(): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.entity.table as TableDef\n });\n }\n\n public async put<T extends GenericRecord = GenericRecord>(\n item: IPutParamsItem<T>\n ): IEntityPutResult {\n return put({\n entity: this.entity,\n item\n });\n }\n\n public async get<T>(keys: GetRecordParamsKeys): IEntityGetResult<T> {\n return get<T>({\n entity: this.entity,\n keys\n });\n }\n\n public async getClean<T>(keys: GetRecordParamsKeys): IEntityGetCleanResult<T> {\n return getClean<T>({\n entity: this.entity,\n keys\n });\n }\n\n public async delete(keys: IDeleteItemKeys): IEntityDeleteResult {\n return deleteItem({\n entity: this.entity,\n keys\n });\n }\n\n public async queryOne<T>(params: IEntityQueryOneParams): IEntityQueryOneResult<T> {\n return queryOne<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryOneClean<T>(params: IEntityQueryOneParams): IEntityQueryOneCleanResult<T> {\n return queryOneClean<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryAll<T>(params: IEntityQueryAllParams): IEntityQueryAllResult<T> {\n return queryAll<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryAllClean<T>(params: IEntityQueryAllParams): IEntityQueryAllCleanResult<T> {\n return queryAllClean<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryPerPage<T>(params: IEntityQueryPerPageParams) {\n return queryPerPage<T>({\n ...params,\n entity: this.entity\n });\n }\n}\n\nexport const createEntity = <T extends GenericRecord = GenericRecord>(\n params: EntityConstructor\n): IEntity<T> => {\n return new Entity<T>(params);\n};\n"],"mappings":"AAMA,SAASA,MAA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AAI;MACVY,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBU;IACJ,CAAC,CAAC;EACN;EAEA,MAAarB,QAAQA,CAAIqB,IAAyB,EAA4B;IAC1E,OAAOrB,QAAQ,CAAI;MACfW,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBU;IACJ,CAAC,CAAC;EACN;EAEA,MAAaH,MAAMA,CAACG,IAAqB,EAAuB;IAC5D,OAAOpB,UAAU,CAAC;MACdU,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBU;IACJ,CAAC,CAAC;EACN;EAEA,MAAad,QAAQA,CAAIO,MAA6B,EAA4B;IAC9E,OAAOP,QAAQ,CAAI;MACf,GAAGO,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaH,aAAaA,CAAIM,MAA6B,EAAiC;IACxF,OAAON,aAAa,CAAI;MACpB,GAAGM,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaN,QAAQA,CAAIS,MAA6B,EAA4B;IAC9E,OAAOT,QAAQ,CAAI;MACf,GAAGS,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaL,aAAaA,CAAIQ,MAA6B,EAAiC;IACxF,OAAOR,aAAa,CAAI;MACpB,GAAGQ,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaF,YAAYA,CAAIK,MAAiC,EAAE;IAC5D,OAAOL,YAAY,CAAI;MACnB,GAAGK,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMW,YAAY,GACrBR,MAAyB,IACZ;EACb,OAAO,IAAIlB,MAAM,CAAIkB,MAAM,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Entity","BaseEntity","put","get","getClean","deleteItem","createEntityReadBatch","createEntityWriteBatch","createTableWriteBatch","queryAll","queryAllClean","queryOne","queryOneClean","queryPerPage","name","entity","table","constructor","params","createEntityReader","read","createEntityWriter","delete","createTableWriter","item","keys","createEntity"],"sources":["Entity.ts"],"sourcesContent":["import type {\n AttributeDefinitions,\n EntityConstructor as BaseEntityConstructor,\n Readonly,\n TableDef\n} from \"~/toolbox.js\";\nimport { Entity as BaseEntity } from \"~/toolbox.js\";\nimport type { ITableWriteBatch } from \"../table/types.js\";\nimport type {\n IEntity,\n IEntityCreateEntityReaderParams,\n IEntityCreateEntityWriterParams,\n IEntityDeleteResult,\n IEntityGetCleanResult,\n IEntityGetResult,\n IEntityPutResult,\n IEntityQueryAllCleanResult,\n IEntityQueryAllParams,\n IEntityQueryAllResult,\n IEntityQueryOneCleanResult,\n IEntityQueryOneParams,\n IEntityQueryOneResult,\n IEntityQueryPerPageParams,\n IEntityReadBatch,\n IEntityWriteBatch\n} from \"./types.js\";\nimport type { IPutParamsItem } from \"../put.js\";\nimport { put } from \"../put.js\";\nimport type { GetRecordParamsKeys } from \"../get.js\";\nimport { get, getClean } from \"../get.js\";\nimport type { IDeleteItemKeys } from \"../delete.js\";\nimport { deleteItem } from \"../delete.js\";\nimport { createEntityReadBatch } from \"./EntityReadBatch.js\";\nimport { createEntityWriteBatch } from \"./EntityWriteBatch.js\";\nimport { createTableWriteBatch } from \"~/utils/table/TableWriteBatch.js\";\nimport { queryAll, queryAllClean, queryOne, queryOneClean, queryPerPage } from \"../query.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport type EntityConstructor<\n T extends Readonly<AttributeDefinitions> = Readonly<AttributeDefinitions>\n> = BaseEntityConstructor<T>;\n\nexport class Entity<T extends GenericRecord = GenericRecord> implements IEntity<T> {\n public readonly entity: BaseEntity;\n\n public get name(): string {\n return this.entity.name;\n }\n\n public get table(): TableDef {\n /**\n * Not possible to be undefined.\n */\n return this.entity.table!;\n }\n\n public constructor(params: EntityConstructor) {\n // @ts-expect-error\n this.entity = new BaseEntity(params);\n }\n\n public createEntityReader(params?: IEntityCreateEntityReaderParams): IEntityReadBatch<T> {\n return createEntityReadBatch({\n entity: this.entity,\n read: params?.read\n });\n }\n\n public createEntityWriter(params?: IEntityCreateEntityWriterParams): IEntityWriteBatch<T> {\n return createEntityWriteBatch({\n entity: this.entity,\n put: params?.put,\n delete: params?.delete\n });\n }\n\n public createTableWriter(): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.entity.table as TableDef\n });\n }\n\n public async put<T extends GenericRecord = GenericRecord>(\n item: IPutParamsItem<T>\n ): IEntityPutResult {\n return put({\n entity: this.entity,\n item\n });\n }\n\n public async get<T>(keys: GetRecordParamsKeys): IEntityGetResult<T> {\n return get<T>({\n entity: this.entity,\n keys\n });\n }\n\n public async getClean<T>(keys: GetRecordParamsKeys): IEntityGetCleanResult<T> {\n return getClean<T>({\n entity: this.entity,\n keys\n });\n }\n\n public async delete(keys: IDeleteItemKeys): IEntityDeleteResult {\n return deleteItem({\n entity: this.entity,\n keys\n });\n }\n\n public async queryOne<T>(params: IEntityQueryOneParams): IEntityQueryOneResult<T> {\n return queryOne<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryOneClean<T>(params: IEntityQueryOneParams): IEntityQueryOneCleanResult<T> {\n return queryOneClean<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryAll<T>(params: IEntityQueryAllParams): IEntityQueryAllResult<T> {\n return queryAll<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryAllClean<T>(params: IEntityQueryAllParams): IEntityQueryAllCleanResult<T> {\n return queryAllClean<T>({\n ...params,\n entity: this.entity\n });\n }\n\n public async queryPerPage<T>(params: IEntityQueryPerPageParams) {\n return queryPerPage<T>({\n ...params,\n entity: this.entity\n });\n }\n}\n\nexport const createEntity = <T extends GenericRecord = GenericRecord>(\n params: EntityConstructor\n): IEntity<T> => {\n return new Entity<T>(params);\n};\n"],"mappings":"AAMA,SAASA,MAAM,IAAIC,UAAU;AAqB7B,SAAS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AAI,CAACA,MAAM;MACnBU;IACJ,CAAC,CAAC;EACN;EAEA,MAAarB,QAAQA,CAAIqB,IAAyB,EAA4B;IAC1E,OAAOrB,QAAQ,CAAI;MACfW,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBU;IACJ,CAAC,CAAC;EACN;EAEA,MAAaH,MAAMA,CAACG,IAAqB,EAAuB;IAC5D,OAAOpB,UAAU,CAAC;MACdU,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBU;IACJ,CAAC,CAAC;EACN;EAEA,MAAad,QAAQA,CAAIO,MAA6B,EAA4B;IAC9E,OAAOP,QAAQ,CAAI;MACf,GAAGO,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaH,aAAaA,CAAIM,MAA6B,EAAiC;IACxF,OAAON,aAAa,CAAI;MACpB,GAAGM,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaN,QAAQA,CAAIS,MAA6B,EAA4B;IAC9E,OAAOT,QAAQ,CAAI;MACf,GAAGS,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaL,aAAaA,CAAIQ,MAA6B,EAAiC;IACxF,OAAOR,aAAa,CAAI;MACpB,GAAGQ,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;EAEA,MAAaF,YAAYA,CAAIK,MAAiC,EAAE;IAC5D,OAAOL,YAAY,CAAI;MACnB,GAAGK,MAAM;MACTH,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMW,YAAY,GACrBR,MAAyB,IACZ;EACb,OAAO,IAAIlB,MAAM,CAAIkB,MAAM,CAAC;AAChC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["queryAll","queryAllClean","queryOne","queryOneClean","queryPerPage"],"sources":["types.ts"],"sourcesContent":["import type { Entity as BaseEntity } from \"dynamodb-toolbox\";\nimport type {\n BatchWriteItem,\n BatchWriteResult,\n IDeleteBatchItem,\n IPutBatchItem\n} from \"~/utils/batch/types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { TableDef } from \"~/toolbox.js\";\nimport type { ITableWriteBatch } from \"~/utils/table/types.js\";\nimport type { IPutParamsItem, put } from \"~/utils/put.js\";\nimport {\n queryAll,\n queryAllClean,\n type QueryAllParams,\n queryOne,\n queryOneClean,\n type QueryOneParams\n} from \"~/utils/query.js\";\nimport type { get, getClean, GetRecordParamsKeys } from \"~/utils/get.js\";\nimport type { deleteItem, IDeleteItemKeys } from \"~/utils/delete.js\";\nimport type { batchReadAll, BatchReadItem } from \"~/utils/batch/batchRead.js\";\nimport type { IEntityWriteBatchParams } from \"./EntityWriteBatch.js\";\nimport type { IEntityReadBatchParams } from \"./EntityReadBatch.js\";\nimport { queryPerPage } from \"~/utils/index.js\";\n\nexport type IEntityQueryOneParams = Omit<QueryOneParams, \"entity\">;\n\nexport type IEntityQueryAllParams = Omit<QueryAllParams, \"entity\">;\nexport type IEntityQueryPerPageParams = Omit<QueryAllParams, \"entity\">;\n\nexport interface IEntityCreateEntityWriterParams<T = GenericRecord>\n extends Omit<IEntityWriteBatchParams<T>, \"entity\"> {}\nexport interface IEntityCreateEntityReaderParams extends Omit<IEntityReadBatchParams, \"entity\"> {}\n\nexport type IEntityPutResult = ReturnType<typeof put>;\nexport type IEntityGetResult<T> = ReturnType<typeof get<T>>;\nexport type IEntityGetCleanResult<T> = ReturnType<typeof getClean<T>>;\nexport type IEntityDeleteResult = ReturnType<typeof deleteItem>;\nexport type IEntityQueryOneResult<T> = ReturnType<typeof queryOne<T>>;\nexport type IEntityQueryOneCleanResult<T> = ReturnType<typeof queryOneClean<T>>;\nexport type IEntityQueryAllResult<T> = ReturnType<typeof queryAll<T>>;\nexport type IEntityQueryAllCleanResult<T> = ReturnType<typeof queryAllClean<T>>;\nexport type IEntityQueryPerPageResult<T> = ReturnType<typeof queryPerPage<T>>;\n\nexport interface IEntity<T extends GenericRecord = GenericRecord> {\n readonly entity: BaseEntity;\n readonly name: string;\n readonly table: TableDef;\n createEntityReader(params?: IEntityCreateEntityReaderParams): IEntityReadBatch<T>;\n createEntityWriter(params?: IEntityCreateEntityWriterParams<T>): IEntityWriteBatch<T>;\n createTableWriter(): ITableWriteBatch;\n put(item: IPutParamsItem<T>): IEntityPutResult;\n get<R extends T = T>(keys: GetRecordParamsKeys): IEntityGetResult<R>;\n getClean<R extends T = T>(keys: GetRecordParamsKeys): IEntityGetCleanResult<R>;\n delete(keys: IDeleteItemKeys): IEntityDeleteResult;\n queryOne<R extends T = T>(params: IEntityQueryOneParams): IEntityQueryOneResult<R>;\n queryOneClean<R extends T = T>(params: IEntityQueryOneParams): IEntityQueryOneCleanResult<R>;\n queryAll<R extends T = T>(params: IEntityQueryAllParams): IEntityQueryAllResult<R>;\n queryAllClean<R extends T = T>(params: IEntityQueryAllParams): IEntityQueryAllCleanResult<R>;\n queryPerPage<R extends T = T>(params: IEntityQueryPerPageParams): IEntityQueryPerPageResult<R>;\n}\n\nexport interface IEntityWriteBatchBuilder {\n // readonly entity: Entity;\n put<T extends Record<string, any>>(item: IPutBatchItem<T>): BatchWriteItem;\n delete(item: IDeleteBatchItem): BatchWriteItem;\n}\n\nexport interface IEntityWriteBatch<T = GenericRecord> {\n readonly total: number;\n readonly items: BatchWriteItem[];\n\n put(item: IPutBatchItem<T>): void;\n delete(item: IDeleteBatchItem): void;\n execute(): Promise<BatchWriteResult>;\n combine(items: BatchWriteItem[]): ITableWriteBatch;\n}\n\nexport interface IEntityReadBatchKey {\n PK: string;\n SK: string;\n}\n\nexport interface IEntityReadBatch<T = GenericRecord> {\n readonly total: number;\n readonly items: BatchReadItem[];\n get(input: IEntityReadBatchKey | IEntityReadBatchKey[]): void;\n execute(): ReturnType<typeof batchReadAll<T>>;\n}\n\nexport interface IEntityReadBatchBuilderGetResponse {\n Table: TableDef;\n Key: IEntityReadBatchKey;\n}\n\nexport interface IEntityReadBatchBuilder {\n get(item: IEntityReadBatchKey): IEntityReadBatchBuilderGetResponse;\n}\n"],"mappings":"AAWA,SACIA,QAAQ,EACRC,aAAa,EAEbC,QAAQ,EACRC,aAAa;AAQjB,SAASC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["queryAll","queryAllClean","queryOne","queryOneClean","queryPerPage"],"sources":["types.ts"],"sourcesContent":["import type { Entity as BaseEntity } from \"dynamodb-toolbox\";\nimport type {\n BatchWriteItem,\n BatchWriteResult,\n IDeleteBatchItem,\n IPutBatchItem\n} from \"~/utils/batch/types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { TableDef } from \"~/toolbox.js\";\nimport type { ITableWriteBatch } from \"~/utils/table/types.js\";\nimport type { IPutParamsItem, put } from \"~/utils/put.js\";\nimport {\n queryAll,\n queryAllClean,\n type QueryAllParams,\n queryOne,\n queryOneClean,\n type QueryOneParams\n} from \"~/utils/query.js\";\nimport type { get, getClean, GetRecordParamsKeys } from \"~/utils/get.js\";\nimport type { deleteItem, IDeleteItemKeys } from \"~/utils/delete.js\";\nimport type { batchReadAll, BatchReadItem } from \"~/utils/batch/batchRead.js\";\nimport type { IEntityWriteBatchParams } from \"./EntityWriteBatch.js\";\nimport type { IEntityReadBatchParams } from \"./EntityReadBatch.js\";\nimport { queryPerPage } from \"~/utils/index.js\";\n\nexport type IEntityQueryOneParams = Omit<QueryOneParams, \"entity\">;\n\nexport type IEntityQueryAllParams = Omit<QueryAllParams, \"entity\">;\nexport type IEntityQueryPerPageParams = Omit<QueryAllParams, \"entity\">;\n\nexport interface IEntityCreateEntityWriterParams<T = GenericRecord> extends Omit<\n IEntityWriteBatchParams<T>,\n \"entity\"\n> {}\nexport interface IEntityCreateEntityReaderParams extends Omit<IEntityReadBatchParams, \"entity\"> {}\n\nexport type IEntityPutResult = ReturnType<typeof put>;\nexport type IEntityGetResult<T> = ReturnType<typeof get<T>>;\nexport type IEntityGetCleanResult<T> = ReturnType<typeof getClean<T>>;\nexport type IEntityDeleteResult = ReturnType<typeof deleteItem>;\nexport type IEntityQueryOneResult<T> = ReturnType<typeof queryOne<T>>;\nexport type IEntityQueryOneCleanResult<T> = ReturnType<typeof queryOneClean<T>>;\nexport type IEntityQueryAllResult<T> = ReturnType<typeof queryAll<T>>;\nexport type IEntityQueryAllCleanResult<T> = ReturnType<typeof queryAllClean<T>>;\nexport type IEntityQueryPerPageResult<T> = ReturnType<typeof queryPerPage<T>>;\n\nexport interface IEntity<T extends GenericRecord = GenericRecord> {\n readonly entity: BaseEntity;\n readonly name: string;\n readonly table: TableDef;\n createEntityReader(params?: IEntityCreateEntityReaderParams): IEntityReadBatch<T>;\n createEntityWriter(params?: IEntityCreateEntityWriterParams<T>): IEntityWriteBatch<T>;\n createTableWriter(): ITableWriteBatch;\n put(item: IPutParamsItem<T>): IEntityPutResult;\n get<R extends T = T>(keys: GetRecordParamsKeys): IEntityGetResult<R>;\n getClean<R extends T = T>(keys: GetRecordParamsKeys): IEntityGetCleanResult<R>;\n delete(keys: IDeleteItemKeys): IEntityDeleteResult;\n queryOne<R extends T = T>(params: IEntityQueryOneParams): IEntityQueryOneResult<R>;\n queryOneClean<R extends T = T>(params: IEntityQueryOneParams): IEntityQueryOneCleanResult<R>;\n queryAll<R extends T = T>(params: IEntityQueryAllParams): IEntityQueryAllResult<R>;\n queryAllClean<R extends T = T>(params: IEntityQueryAllParams): IEntityQueryAllCleanResult<R>;\n queryPerPage<R extends T = T>(params: IEntityQueryPerPageParams): IEntityQueryPerPageResult<R>;\n}\n\nexport interface IEntityWriteBatchBuilder {\n // readonly entity: Entity;\n put<T extends Record<string, any>>(item: IPutBatchItem<T>): BatchWriteItem;\n delete(item: IDeleteBatchItem): BatchWriteItem;\n}\n\nexport interface IEntityWriteBatch<T = GenericRecord> {\n readonly total: number;\n readonly items: BatchWriteItem[];\n\n put(item: IPutBatchItem<T>): void;\n delete(item: IDeleteBatchItem): void;\n execute(): Promise<BatchWriteResult>;\n combine(items: BatchWriteItem[]): ITableWriteBatch;\n}\n\nexport interface IEntityReadBatchKey {\n PK: string;\n SK: string;\n}\n\nexport interface IEntityReadBatch<T = GenericRecord> {\n readonly total: number;\n readonly items: BatchReadItem[];\n get(input: IEntityReadBatchKey | IEntityReadBatchKey[]): void;\n execute(): ReturnType<typeof batchReadAll<T>>;\n}\n\nexport interface IEntityReadBatchBuilderGetResponse {\n Table: TableDef;\n Key: IEntityReadBatchKey;\n}\n\nexport interface IEntityReadBatchBuilder {\n get(item: IEntityReadBatchKey): IEntityReadBatchBuilderGetResponse;\n}\n"],"mappings":"AAWA,SACIA,QAAQ,EACRC,aAAa,EAEbC,QAAQ,EACRC,aAAa;AAQjB,SAASC,YAAY","ignoreList":[]}
package/utils/query.js CHANGED
@@ -18,6 +18,7 @@ const query = async params => {
18
18
  * This is the first query on the given partition key.
19
19
  */
20
20
  if (!previous) {
21
+ // @ts-expect-error
21
22
  result = await entity.query(partitionKey, options);
22
23
  } else if (typeof previous.next === "function") {
23
24
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","cleanupItem","cleanupItems","query","params","entity","previous","partitionKey","options","result","next","items","Items","Array","isArray","queryOne","limit","item","shift","queryOneClean","queryAll","results","previousResult","undefined","push","queryAllClean","queryPerPage","lastEvaluatedKey","LastEvaluatedKey","queryPerPageClean","queryAllWithCallback","callback"],"sources":["query.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { Entity, EntityQueryOptions } from \"~/toolbox.js\";\nimport { cleanupItem, cleanupItems } from \"~/utils/cleanup.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface QueryAllParams {\n entity: Entity<any>;\n partitionKey: string;\n options?: EntityQueryOptions;\n}\n\nexport interface QueryOneParams extends QueryAllParams {\n options?: Omit<EntityQueryOptions, \"limit\">;\n}\n\nexport interface QueryParams extends QueryAllParams {\n previous?: any;\n}\n\nexport interface QueryResult<T> {\n result: any | null;\n items: T[];\n}\n\n/**\n * Will run query only once. Pass the previous to run the query again to fetch new data.\n * It returns the result and the items it found.\n * Result is required to fetch the items that were not fetched in the previous run.\n */\nconst query = async <T>(params: QueryParams): Promise<QueryResult<T>> => {\n const { entity, previous, partitionKey, options } = params;\n let result;\n /**\n * In case there is no previous result we must make a new query.\n * This is the first query on the given partition key.\n */\n if (!previous) {\n result = await entity.query(partitionKey, options);\n } else if (typeof previous.next === \"function\") {\n /**\n * In case we have a previous result and it has a next method, we run it.\n * In case result of the next method is false, it means it has nothing else to read\n * and we return a null to keep the query from repeating.\n */\n result = await previous.next();\n if (result === false) {\n return {\n result: null,\n items: []\n };\n }\n } else {\n /**\n * This could probably never happen but keep it here just in case to break the query loop.\n * Basically, either previous does not exist or it exists and it does not have the next method\n * and at that point a result returned will be null and loop should not start again.\n */\n return {\n result: null,\n items: []\n };\n }\n /**\n * We expect the result to contain an Items array and if not, something went wrong, very wrong.\n */\n if (!result || !result.Items || !Array.isArray(result.Items)) {\n throw new WebinyError(\n \"Error when querying for content entries - no result.\",\n \"QUERY_ERROR\",\n {\n partitionKey,\n options\n }\n );\n }\n return {\n result,\n items: result.Items\n };\n};\n/**\n * Will run the query to fetch the first possible item from the database.\n */\nexport const queryOne = async <T>(params: QueryOneParams): Promise<T | null> => {\n const { items } = await query<T>({\n ...params,\n options: {\n ...(params.options || {}),\n limit: 1\n }\n });\n const item = items.shift();\n return item ? item : null;\n};\n\nexport const queryOneClean = async <T>(params: QueryOneParams): Promise<T | null> => {\n const result = await queryOne<T>(params);\n if (!result) {\n return null;\n }\n return cleanupItem(params.entity, result);\n};\n/**\n * Will run the query to fetch the results no matter how many iterations it needs to go through.\n */\nexport const queryAll = async <T>(params: QueryAllParams): Promise<T[]> => {\n const items: T[] = [];\n let results: QueryResult<T>;\n let previousResult: any = undefined;\n while ((results = await query({ ...params, previous: previousResult }))) {\n items.push(...results.items);\n if (!results.result) {\n return items;\n }\n previousResult = results.result;\n }\n return items;\n};\n\nexport const queryAllClean = async <T>(params: QueryAllParams): Promise<T[]> => {\n const results = await queryAll<T>(params);\n return cleanupItems(params.entity, results);\n};\n\nexport interface IQueryPageResponse<T> {\n items: T[];\n lastEvaluatedKey: GenericRecord;\n}\n\nexport const queryPerPage = async <T>(params: QueryAllParams): Promise<IQueryPageResponse<T>> => {\n const result = await query<T>({\n ...params,\n options: {\n ...params.options,\n limit: params.options?.limit || 50\n }\n });\n\n return {\n items: result.items,\n lastEvaluatedKey: result.result?.LastEvaluatedKey\n };\n};\n\nexport const queryPerPageClean = async <T>(\n params: QueryAllParams\n): Promise<IQueryPageResponse<T>> => {\n const result = await queryPerPage<T>(params);\n return {\n items: cleanupItems<T>(params.entity, result.items),\n lastEvaluatedKey: result.lastEvaluatedKey\n };\n};\n\n/**\n * Will run the query to fetch the results no matter how many iterations it needs to go through.\n * Results of each iteration will be passed to the provided callback\n */\nexport const queryAllWithCallback = async <T>(\n params: QueryAllParams,\n callback: (items: T[]) => Promise<void>\n): Promise<void> => {\n let results: QueryResult<T>;\n let previousResult: any = undefined;\n while ((results = await query({ ...params, previous: previousResult }))) {\n if (!results.result) {\n break;\n }\n await callback(results.items);\n previousResult = results.result;\n }\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,WAAW,EAAEC,YAAY;AAsBlC;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,MAAUC,MAAmB,IAA8B;EACrE,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,YAAY;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAC1D,IAAIK,MAAM;EACV;AACJ;AACA;AACA;EACI,IAAI,CAACH,QAAQ,EAAE;IACXG,MAAM,GAAG,MAAMJ,MAAM,CAACF,KAAK,CAACI,YAAY,EAAEC,OAAO,CAAC;EACtD,CAAC,MAAM,IAAI,OAAOF,QAAQ,CAACI,IAAI,KAAK,UAAU,EAAE;IAC5C;AACR;AACA;AACA;AACA;IACQ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EAAElB,MAAM,CAACkB;EAC7B,CAAC;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMG,oBAAoB,GAAG,MAAAA,CAChC1B,MAAsB,EACtB2B,QAAuC,KACvB;EAChB,IAAIV,OAAuB;EAC3B,IAAIC,cAAmB,GAAGC,SAAS;EACnC,OAAQF,OAAO,GAAG,MAAMlB,KAAK,CAAC;IAAE,GAAGC,MAAM;IAAEE,QAAQ,EAAEgB;EAAe,CAAC,CAAC,EAAG;IACrE,IAAI,CAACD,OAAO,CAACZ,MAAM,EAAE;MACjB;IACJ;IACA,MAAMsB,QAAQ,CAACV,OAAO,CAACV,KAAK,CAAC;IAC7BW,cAAc,GAAGD,OAAO,CAACZ,MAAM;EACnC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","cleanupItem","cleanupItems","query","params","entity","previous","partitionKey","options","result","next","items","Items","Array","isArray","queryOne","limit","item","shift","queryOneClean","queryAll","results","previousResult","undefined","push","queryAllClean","queryPerPage","lastEvaluatedKey","LastEvaluatedKey","queryPerPageClean","queryAllWithCallback","callback"],"sources":["query.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { Entity, EntityQueryOptions } from \"~/toolbox.js\";\nimport { cleanupItem, cleanupItems } from \"~/utils/cleanup.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface QueryAllParams {\n entity: Entity<any>;\n partitionKey: string;\n options?: EntityQueryOptions;\n}\n\nexport interface QueryOneParams extends QueryAllParams {\n options?: Omit<EntityQueryOptions, \"limit\">;\n}\n\nexport interface QueryParams extends QueryAllParams {\n previous?: any;\n}\n\nexport interface QueryResult<T> {\n result: any | null;\n items: T[];\n}\n\n/**\n * Will run query only once. Pass the previous to run the query again to fetch new data.\n * It returns the result and the items it found.\n * Result is required to fetch the items that were not fetched in the previous run.\n */\nconst query = async <T>(params: QueryParams): Promise<QueryResult<T>> => {\n const { entity, previous, partitionKey, options } = params;\n let result;\n /**\n * In case there is no previous result we must make a new query.\n * This is the first query on the given partition key.\n */\n if (!previous) {\n // @ts-expect-error\n result = await entity.query(partitionKey, options);\n } else if (typeof previous.next === \"function\") {\n /**\n * In case we have a previous result and it has a next method, we run it.\n * In case result of the next method is false, it means it has nothing else to read\n * and we return a null to keep the query from repeating.\n */\n result = await previous.next();\n if (result === false) {\n return {\n result: null,\n items: []\n };\n }\n } else {\n /**\n * This could probably never happen but keep it here just in case to break the query loop.\n * Basically, either previous does not exist or it exists and it does not have the next method\n * and at that point a result returned will be null and loop should not start again.\n */\n return {\n result: null,\n items: []\n };\n }\n /**\n * We expect the result to contain an Items array and if not, something went wrong, very wrong.\n */\n if (!result || !result.Items || !Array.isArray(result.Items)) {\n throw new WebinyError(\n \"Error when querying for content entries - no result.\",\n \"QUERY_ERROR\",\n {\n partitionKey,\n options\n }\n );\n }\n return {\n result,\n items: result.Items\n };\n};\n/**\n * Will run the query to fetch the first possible item from the database.\n */\nexport const queryOne = async <T>(params: QueryOneParams): Promise<T | null> => {\n const { items } = await query<T>({\n ...params,\n options: {\n ...(params.options || {}),\n limit: 1\n }\n });\n const item = items.shift();\n return item ? item : null;\n};\n\nexport const queryOneClean = async <T>(params: QueryOneParams): Promise<T | null> => {\n const result = await queryOne<T>(params);\n if (!result) {\n return null;\n }\n return cleanupItem(params.entity, result);\n};\n/**\n * Will run the query to fetch the results no matter how many iterations it needs to go through.\n */\nexport const queryAll = async <T>(params: QueryAllParams): Promise<T[]> => {\n const items: T[] = [];\n let results: QueryResult<T>;\n let previousResult: any = undefined;\n while ((results = await query({ ...params, previous: previousResult }))) {\n items.push(...results.items);\n if (!results.result) {\n return items;\n }\n previousResult = results.result;\n }\n return items;\n};\n\nexport const queryAllClean = async <T>(params: QueryAllParams): Promise<T[]> => {\n const results = await queryAll<T>(params);\n return cleanupItems(params.entity, results);\n};\n\nexport interface IQueryPageResponse<T> {\n items: T[];\n lastEvaluatedKey: GenericRecord;\n}\n\nexport const queryPerPage = async <T>(params: QueryAllParams): Promise<IQueryPageResponse<T>> => {\n const result = await query<T>({\n ...params,\n options: {\n ...params.options,\n limit: params.options?.limit || 50\n }\n });\n\n return {\n items: result.items,\n lastEvaluatedKey: result.result?.LastEvaluatedKey\n };\n};\n\nexport const queryPerPageClean = async <T>(\n params: QueryAllParams\n): Promise<IQueryPageResponse<T>> => {\n const result = await queryPerPage<T>(params);\n return {\n items: cleanupItems<T>(params.entity, result.items),\n lastEvaluatedKey: result.lastEvaluatedKey\n };\n};\n\n/**\n * Will run the query to fetch the results no matter how many iterations it needs to go through.\n * Results of each iteration will be passed to the provided callback\n */\nexport const queryAllWithCallback = async <T>(\n params: QueryAllParams,\n callback: (items: T[]) => Promise<void>\n): Promise<void> => {\n let results: QueryResult<T>;\n let previousResult: any = undefined;\n while ((results = await query({ ...params, previous: previousResult }))) {\n if (!results.result) {\n break;\n }\n await callback(results.items);\n previousResult = results.result;\n }\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,WAAW,EAAEC,YAAY;AAsBlC;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,MAAUC,MAAmB,IAA8B;EACrE,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,YAAY;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAC1D,IAAIK,MAAM;EACV;AACJ;AACA;AACA;EACI,IAAI,CAACH,QAAQ,EAAE;IACX;IACAG,MAAM,GAAG,MAAMJ,MAAM,CAACF,KAAK,CAACI,YAAY,EAAEC,OAAO,CAAC;EACtD,CAAC,MAAM,IAAI,OAAOF,QAAQ,CAACI,IAAI,KAAK,UAAU,EAAE;IAC5C;AACR;AACA;AACA;AACA;IACQD,MAAM,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC9B,IAAID,MAAM,KAAK,KAAK,EAAE;MAClB,OAAO;QACHA,MAAM,EAAE,IAAI;QACZE,KAAK,EAAE;MACX,CAAC;IACL;EACJ,CAAC,MAAM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cAAmB,GAAGC,SAAS;EACnC,OAAQF,OAAO,GAAG,MAAMlB,KAAK,CAAC;IAAE,GAAGC,MAAM;IAAEE,QAAQ,EAAEgB;EAAe,CAAC,CAAC,EAAG;IACrE,IAAI,CAACD,OAAO,CAACZ,MAAM,EAAE;MACjB;IACJ;IACA,MAAMsB,QAAQ,CAACV,OAAO,CAACV,KAAK,CAAC;IAC7BW,cAAc,GAAGD,OAAO,CAACZ,MAAM;EACnC;AACJ,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Table","BaseTable","createTableWriteBatch","createTableReadBatch","scan","constructor","params","table","createWriter","createReader"],"sources":["Table.ts"],"sourcesContent":["import type { TableConstructor } from \"~/toolbox.js\";\nimport { Table as BaseTable } from \"~/toolbox.js\";\nimport type {\n ITable,\n ITableReadBatch,\n ITableScanParams,\n ITableScanResponse,\n ITableWriteBatch\n} from \"./types.js\";\nimport { createTableWriteBatch } from \"./TableWriteBatch.js\";\nimport { createTableReadBatch } from \"./TableReadBatch.js\";\nimport { scan } from \"../scan.js\";\n\nexport class Table<\n Name extends string = string,\n PartitionKey extends string = string,\n SortKey extends string = string\n> implements ITable<Name, PartitionKey, SortKey>\n{\n public readonly table: BaseTable<Name, PartitionKey, SortKey>;\n\n public constructor(params: TableConstructor<Name, PartitionKey, SortKey>) {\n this.table = new BaseTable(params);\n }\n\n public createWriter(): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.table\n });\n }\n\n public createReader(): ITableReadBatch {\n return createTableReadBatch({\n table: this.table\n });\n }\n\n public async scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>> {\n return scan<T>({\n ...params,\n table: this.table\n });\n }\n}\n"],"mappings":"AACA,SAASA,KAAK,IAAIC,SAAS;AAQ3B,SAASC,qBAAqB;AAC9B,SAASC,oBAAoB;AAC7B,SAASC,IAAI;AAEb,OAAO,MAAMJ,KAAK,CAKlB;EAGWK,WAAWA,CAACC,MAAqD,EAAE;IACtE,IAAI,CAACC,KAAK,GAAG,IAAIN,SAAS,CAACK,MAAM,CAAC;EACtC;EAEOE,YAAYA,CAAA,EAAqB;IACpC,OAAON,qBAAqB,CAAC;MACzBK,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEOE,YAAYA,CAAA,EAAoB;IACnC,OAAON,oBAAoB,CAAC;MACxBI,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEA,MAAaH,IAAIA,CAAIE,MAAwB,EAAkC;IAC3E,OAAOF,IAAI,CAAI;MACX,GAAGE,MAAM;MACTC,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["Table","BaseTable","createTableWriteBatch","createTableReadBatch","scan","constructor","params","table","createWriter","createReader"],"sources":["Table.ts"],"sourcesContent":["import type { TableConstructor } from \"~/toolbox.js\";\nimport { Table as BaseTable } from \"~/toolbox.js\";\nimport type {\n ITable,\n ITableReadBatch,\n ITableScanParams,\n ITableScanResponse,\n ITableWriteBatch\n} from \"./types.js\";\nimport { createTableWriteBatch } from \"./TableWriteBatch.js\";\nimport { createTableReadBatch } from \"./TableReadBatch.js\";\nimport { scan } from \"../scan.js\";\n\nexport class Table<\n Name extends string = string,\n PartitionKey extends string = string,\n SortKey extends string = string\n> implements ITable<Name, PartitionKey, SortKey> {\n public readonly table: BaseTable<Name, PartitionKey, SortKey>;\n\n public constructor(params: TableConstructor<Name, PartitionKey, SortKey>) {\n this.table = new BaseTable(params);\n }\n\n public createWriter(): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.table\n });\n }\n\n public createReader(): ITableReadBatch {\n return createTableReadBatch({\n table: this.table\n });\n }\n\n public async scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>> {\n return scan<T>({\n ...params,\n table: this.table\n });\n }\n}\n"],"mappings":"AACA,SAASA,KAAK,IAAIC,SAAS;AAQ3B,SAASC,qBAAqB;AAC9B,SAASC,oBAAoB;AAC7B,SAASC,IAAI;AAEb,OAAO,MAAMJ,KAAK,CAI+B;EAGtCK,WAAWA,CAACC,MAAqD,EAAE;IACtE,IAAI,CAACC,KAAK,GAAG,IAAIN,SAAS,CAACK,MAAM,CAAC;EACtC;EAEOE,YAAYA,CAAA,EAAqB;IACpC,OAAON,qBAAqB,CAAC;MACzBK,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEOE,YAAYA,CAAA,EAAoB;IACnC,OAAON,oBAAoB,CAAC;MACxBI,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEA,MAAaH,IAAIA,CAAIE,MAAwB,EAAkC;IAC3E,OAAOF,IAAI,CAAI;MACX,GAAGE,MAAM;MACTC,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;AACJ","ignoreList":[]}