@webiny/db-dynamodb 5.41.4 → 5.42.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.
- package/DynamoDbDriver.d.ts +15 -1
- package/DynamoDbDriver.js +245 -0
- package/DynamoDbDriver.js.map +1 -1
- package/package.json +12 -14
- package/plugins/definitions/AttributePlugin.js.map +1 -1
- package/plugins/definitions/FieldPathPlugin.js.map +1 -1
- package/plugins/definitions/TimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/ValueFilterPlugin.js.map +1 -1
- package/plugins/definitions/ValueTransformPlugin.js.map +1 -1
- package/plugins/filters/andIn.js.map +1 -1
- package/plugins/filters/contains.js.map +1 -1
- package/plugins/filters/in.js.map +1 -1
- package/store/entity.d.ts +78 -0
- package/store/entity.js +41 -0
- package/store/entity.js.map +1 -0
- package/store/keys.d.ts +6 -0
- package/store/keys.js +22 -0
- package/store/keys.js.map +1 -0
- package/store/types.d.ts +7 -0
- package/store/types.js +7 -0
- package/store/types.js.map +1 -0
- package/utils/batch/batchRead.js.map +1 -1
- package/utils/batch/batchWrite.d.ts +1 -1
- package/utils/batch/batchWrite.js.map +1 -1
- package/utils/cleanup.d.ts +2 -2
- package/utils/cleanup.js +1 -1
- package/utils/cleanup.js.map +1 -1
- package/utils/createTable.d.ts +3 -2
- package/utils/createTable.js.map +1 -1
- package/utils/entity/Entity.d.ts +2 -1
- package/utils/entity/Entity.js.map +1 -1
- package/utils/entity/EntityReadBatchBuilder.js.map +1 -1
- package/utils/entity/getEntity.js.map +1 -1
- package/utils/entity/types.d.ts +1 -1
- package/utils/entity/types.js.map +1 -1
- package/utils/filter.js.map +1 -1
- package/utils/put.d.ts +6 -5
- package/utils/put.js.map +1 -1
- package/utils/query.d.ts +8 -2
- package/utils/query.js +24 -2
- package/utils/query.js.map +1 -1
- package/utils/scan.js.map +1 -1
- package/utils/sort.js.map +1 -1
- package/utils/table/Table.d.ts +2 -1
- package/utils/table/Table.js +7 -3
- package/utils/table/Table.js.map +1 -1
- package/utils/table/TableReadBatch.js.map +1 -1
package/utils/table/Table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","_TableWriteBatch","_TableReadBatch","_scan","
|
|
1
|
+
{"version":3,"names":["_toolbox","require","_TableWriteBatch","_TableReadBatch","_scan","TableDefinition","constructor","params","table","BaseTable","createWriter","createTableWriteBatch","createReader","createTableReadBatch","scan","exports","defineTable"],"sources":["Table.ts"],"sourcesContent":["import type { TableConstructor } from \"~/toolbox\";\nimport { Table as BaseTable } from \"~/toolbox\";\nimport type {\n ITable,\n ITableReadBatch,\n ITableScanParams,\n ITableScanResponse,\n ITableWriteBatch\n} from \"./types\";\nimport { createTableWriteBatch } from \"./TableWriteBatch\";\nimport { createTableReadBatch } from \"./TableReadBatch\";\nimport { scan } from \"../scan\";\n\nexport class TableDefinition<\n Name extends string = string,\n PartitionKey extends string = string,\n SortKey extends string = string\n> implements ITable\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\nexport const defineTable = <\n Name extends string = string,\n PartitionKey extends string = string,\n SortKey extends string = string\n>(\n params: TableConstructor<Name, PartitionKey, SortKey>\n) => {\n return new TableDefinition<Name, PartitionKey, SortKey>(params);\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEO,MAAMI,eAAe,CAK5B;EAGWC,WAAWA,CAACC,MAAqD,EAAE;IACtE,IAAI,CAACC,KAAK,GAAG,IAAIC,cAAS,CAACF,MAAM,CAAC;EACtC;EAEOG,YAAYA,CAAA,EAAqB;IACpC,OAAO,IAAAC,sCAAqB,EAAC;MACzBH,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEOI,YAAYA,CAAA,EAAoB;IACnC,OAAO,IAAAC,oCAAoB,EAAC;MACxBL,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEA,MAAaM,IAAIA,CAAIP,MAAwB,EAAkC;IAC3E,OAAO,IAAAO,UAAI,EAAI;MACX,GAAGP,MAAM;MACTC,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;AACJ;AAACO,OAAA,CAAAV,eAAA,GAAAA,eAAA;AAEM,MAAMW,WAAW,GAKpBT,MAAqD,IACpD;EACD,OAAO,IAAIF,eAAe,CAA8BE,MAAM,CAAC;AACnE,CAAC;AAACQ,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_batchRead","require","_EntityReadBatchBuilder","_error","TableReadBatch","_items","builders","Map","constructor","params","table","total","length","items","Array","from","get","entity","input","builder","getBuilder","isArray","item","name","WebinyError","push","execute","batchReadAll","newBuilder","createEntityReadBatchBuilder","set","exports","createTableReadBatch"],"sources":["TableReadBatch.ts"],"sourcesContent":["import type { Entity, TableDef } from \"~/toolbox\";\nimport type {\n IEntityReadBatchBuilder,\n IEntityReadBatchBuilderGetResponse\n} from \"~/utils/entity/types\";\nimport { batchReadAll } from \"~/utils/batch/batchRead\";\nimport { createEntityReadBatchBuilder } from \"~/utils/entity/EntityReadBatchBuilder\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { ITableReadBatch, ITableReadBatchKey } from \"./types\";\n\nexport interface ITableReadBatchParams {\n table: TableDef;\n}\n\nexport class TableReadBatch implements ITableReadBatch {\n private readonly table: TableDef;\n\n private readonly _items: IEntityReadBatchBuilderGetResponse[] = [];\n private readonly builders: Map<string, IEntityReadBatchBuilder> = new Map();\n\n public constructor(params: ITableReadBatchParams) {\n this.table = params.table;\n }\n\n public get total(): number {\n return this._items.length;\n }\n\n public get items(): IEntityReadBatchBuilderGetResponse[] {\n return Array.from(this._items);\n }\n\n public get(entity: Entity, input: ITableReadBatchKey): void {\n const builder = this.getBuilder(entity);\n\n const items = Array.isArray(input) ? input : [input];\n for (const item of items) {\n /**\n * We cannot read from two tables at the same time, so check for that.\n */\n if (this.table.name !== entity.table!.name) {\n throw new WebinyError(`Cannot read from two different tables at the same time.`);\n }\n\n this._items.push(builder.get(item));\n }\n }\n\n public async execute<T = GenericRecord>(): Promise<T[]> {\n if (this._items.length === 0) {\n return [];\n }\n const items = Array.from(this._items);\n this._items.length = 0;\n return await batchReadAll<T>({\n items,\n table: this.table\n });\n }\n\n private getBuilder(entity: Entity): IEntityReadBatchBuilder {\n const builder = this.builders.get(entity.name);\n if (builder) {\n return builder;\n }\n const newBuilder = createEntityReadBatchBuilder(entity);\n this.builders.set(entity.name, newBuilder);\n return newBuilder;\n }\n}\n\nexport const createTableReadBatch = (params: ITableReadBatchParams): ITableReadBatch => {\n return new TableReadBatch(params);\n};\n"],"mappings":";;;;;;AAKA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAOO,MAAMG,cAAc,CAA4B;EAGlCC,MAAM,GAAyC,EAAE;EACjDC,QAAQ,GAAyC,IAAIC,GAAG,CAAC,CAAC;EAEpEC,WAAWA,CAACC,MAA6B,EAAE;IAC9C,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;EAC7B;EAEA,IAAWC,KAAKA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACN,MAAM,CAACO,MAAM;EAC7B;EAEA,IAAWC,KAAKA,CAAA,EAAyC;IACrD,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACV,MAAM,CAAC;EAClC;EAEOW,GAAGA,CAACC,MAAc,EAAEC,KAAyB,EAAQ;IACxD,MAAMC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACH,MAAM,CAAC;IAEvC,MAAMJ,KAAK,GAAGC,KAAK,CAACO,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAG,CAACA,KAAK,CAAC;IACpD,KAAK,MAAMI,IAAI,IAAIT,KAAK,EAAE;MACtB;AACZ;AACA;MACY,IAAI,IAAI,CAACH,KAAK,CAACa,IAAI,KAAKN,MAAM,CAACP,KAAK,CAAEa,IAAI,EAAE;QACxC,MAAM,IAAIC,kBAAW,
|
|
1
|
+
{"version":3,"names":["_batchRead","require","_EntityReadBatchBuilder","_error","TableReadBatch","_items","builders","Map","constructor","params","table","total","length","items","Array","from","get","entity","input","builder","getBuilder","isArray","item","name","WebinyError","push","execute","batchReadAll","newBuilder","createEntityReadBatchBuilder","set","exports","createTableReadBatch"],"sources":["TableReadBatch.ts"],"sourcesContent":["import type { Entity, TableDef } from \"~/toolbox\";\nimport type {\n IEntityReadBatchBuilder,\n IEntityReadBatchBuilderGetResponse\n} from \"~/utils/entity/types\";\nimport { batchReadAll } from \"~/utils/batch/batchRead\";\nimport { createEntityReadBatchBuilder } from \"~/utils/entity/EntityReadBatchBuilder\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport { WebinyError } from \"@webiny/error\";\nimport type { ITableReadBatch, ITableReadBatchKey } from \"./types\";\n\nexport interface ITableReadBatchParams {\n table: TableDef;\n}\n\nexport class TableReadBatch implements ITableReadBatch {\n private readonly table: TableDef;\n\n private readonly _items: IEntityReadBatchBuilderGetResponse[] = [];\n private readonly builders: Map<string, IEntityReadBatchBuilder> = new Map();\n\n public constructor(params: ITableReadBatchParams) {\n this.table = params.table;\n }\n\n public get total(): number {\n return this._items.length;\n }\n\n public get items(): IEntityReadBatchBuilderGetResponse[] {\n return Array.from(this._items);\n }\n\n public get(entity: Entity, input: ITableReadBatchKey): void {\n const builder = this.getBuilder(entity);\n\n const items = Array.isArray(input) ? input : [input];\n for (const item of items) {\n /**\n * We cannot read from two tables at the same time, so check for that.\n */\n if (this.table.name !== entity.table!.name) {\n throw new WebinyError(`Cannot read from two different tables at the same time.`);\n }\n\n this._items.push(builder.get(item));\n }\n }\n\n public async execute<T = GenericRecord>(): Promise<T[]> {\n if (this._items.length === 0) {\n return [];\n }\n const items = Array.from(this._items);\n this._items.length = 0;\n return await batchReadAll<T>({\n items,\n table: this.table\n });\n }\n\n private getBuilder(entity: Entity): IEntityReadBatchBuilder {\n const builder = this.builders.get(entity.name);\n if (builder) {\n return builder;\n }\n const newBuilder = createEntityReadBatchBuilder(entity);\n this.builders.set(entity.name, newBuilder);\n return newBuilder;\n }\n}\n\nexport const createTableReadBatch = (params: ITableReadBatchParams): ITableReadBatch => {\n return new TableReadBatch(params);\n};\n"],"mappings":";;;;;;AAKA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAOO,MAAMG,cAAc,CAA4B;EAGlCC,MAAM,GAAyC,EAAE;EACjDC,QAAQ,GAAyC,IAAIC,GAAG,CAAC,CAAC;EAEpEC,WAAWA,CAACC,MAA6B,EAAE;IAC9C,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;EAC7B;EAEA,IAAWC,KAAKA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACN,MAAM,CAACO,MAAM;EAC7B;EAEA,IAAWC,KAAKA,CAAA,EAAyC;IACrD,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACV,MAAM,CAAC;EAClC;EAEOW,GAAGA,CAACC,MAAc,EAAEC,KAAyB,EAAQ;IACxD,MAAMC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACH,MAAM,CAAC;IAEvC,MAAMJ,KAAK,GAAGC,KAA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