@webiny/db-dynamodb 6.0.0-alpha.5 → 6.0.0-rc.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 +4 -8
- package/DynamoDbDriver.js +71 -102
- package/DynamoDbDriver.js.map +1 -1
- package/README.md +6 -142
- package/index.d.ts +4 -3
- package/index.js +4 -28
- package/index.js.map +1 -1
- package/package.json +18 -20
- package/plugins/definitions/AttributePlugin.d.ts +1 -1
- package/plugins/definitions/AttributePlugin.js +4 -12
- package/plugins/definitions/AttributePlugin.js.map +1 -1
- package/plugins/definitions/DateTimeTransformPlugin.d.ts +2 -2
- package/plugins/definitions/DateTimeTransformPlugin.js +6 -14
- package/plugins/definitions/DateTimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/FieldPathPlugin.js +6 -14
- package/plugins/definitions/FieldPathPlugin.js.map +1 -1
- package/plugins/definitions/FieldPlugin.d.ts +1 -1
- package/plugins/definitions/FieldPlugin.js +2 -9
- package/plugins/definitions/FieldPlugin.js.map +1 -1
- package/plugins/definitions/TimeTransformPlugin.d.ts +2 -2
- package/plugins/definitions/TimeTransformPlugin.js +7 -15
- package/plugins/definitions/TimeTransformPlugin.js.map +1 -1
- package/plugins/definitions/ValueFilterPlugin.js +5 -13
- package/plugins/definitions/ValueFilterPlugin.js.map +1 -1
- package/plugins/definitions/ValueTransformPlugin.js +6 -14
- package/plugins/definitions/ValueTransformPlugin.js.map +1 -1
- package/plugins/definitions/assignFields.js +4 -12
- package/plugins/definitions/assignFields.js.map +1 -1
- package/plugins/filters/andIn.d.ts +1 -1
- package/plugins/filters/andIn.js +5 -12
- package/plugins/filters/andIn.js.map +1 -1
- package/plugins/filters/between.d.ts +1 -1
- package/plugins/filters/between.js +5 -12
- package/plugins/filters/between.js.map +1 -1
- package/plugins/filters/contains.d.ts +1 -1
- package/plugins/filters/contains.js +3 -9
- package/plugins/filters/contains.js.map +1 -1
- package/plugins/filters/eq.d.ts +1 -1
- package/plugins/filters/eq.js +3 -9
- package/plugins/filters/eq.js.map +1 -1
- package/plugins/filters/fuzzy.d.ts +1 -1
- package/plugins/filters/fuzzy.js +5 -12
- package/plugins/filters/fuzzy.js.map +1 -1
- package/plugins/filters/gt.d.ts +1 -1
- package/plugins/filters/gt.js +3 -9
- package/plugins/filters/gt.js.map +1 -1
- package/plugins/filters/gte.d.ts +1 -1
- package/plugins/filters/gte.js +3 -9
- package/plugins/filters/gte.js.map +1 -1
- package/plugins/filters/in.d.ts +1 -1
- package/plugins/filters/in.js +5 -12
- package/plugins/filters/in.js.map +1 -1
- package/plugins/filters/index.d.ts +1 -1
- package/plugins/filters/index.js +12 -20
- package/plugins/filters/index.js.map +1 -1
- package/plugins/filters/lt.d.ts +1 -1
- package/plugins/filters/lt.js +3 -9
- package/plugins/filters/lt.js.map +1 -1
- package/plugins/filters/lte.d.ts +1 -1
- package/plugins/filters/lte.js +3 -9
- package/plugins/filters/lte.js.map +1 -1
- package/plugins/filters/startsWith.d.ts +1 -1
- package/plugins/filters/startsWith.js +3 -9
- package/plugins/filters/startsWith.js.map +1 -1
- package/plugins/index.d.ts +9 -1
- package/plugins/index.js +11 -11
- package/plugins/index.js.map +1 -1
- package/store/entity.d.ts +4 -76
- package/store/entity.js +5 -35
- package/store/entity.js.map +1 -1
- package/store/keys.d.ts +1 -1
- package/store/keys.js +7 -13
- package/store/keys.js.map +1 -1
- package/store/types.d.ts +3 -4
- package/store/types.js +1 -5
- package/store/types.js.map +1 -1
- package/toolbox.d.ts +7 -2
- package/toolbox.js +2 -17
- package/toolbox.js.map +1 -1
- package/types.js +1 -5
- package/utils/attributes.d.ts +2 -2
- package/utils/attributes.js +4 -12
- package/utils/attributes.js.map +1 -1
- package/utils/batch/batchRead.d.ts +2 -2
- package/utils/batch/batchRead.js +5 -13
- package/utils/batch/batchRead.js.map +1 -1
- package/utils/batch/batchWrite.d.ts +2 -2
- package/utils/batch/batchWrite.js +3 -11
- package/utils/batch/batchWrite.js.map +1 -1
- package/utils/batch/index.d.ts +3 -3
- package/utils/batch/index.js +3 -38
- package/utils/batch/index.js.map +1 -1
- package/utils/batch/types.d.ts +7 -2
- package/utils/batch/types.js +1 -5
- package/utils/batch/types.js.map +1 -1
- package/utils/cleanup.d.ts +1 -1
- package/utils/cleanup.js +3 -10
- package/utils/cleanup.js.map +1 -1
- package/utils/count.d.ts +1 -1
- package/utils/count.js +1 -8
- package/utils/count.js.map +1 -1
- package/utils/createEntity.d.ts +36 -54
- package/utils/createEntity.js +75 -51
- package/utils/createEntity.js.map +1 -1
- package/utils/createTable.d.ts +10 -7
- package/utils/createTable.js +25 -15
- package/utils/createTable.js.map +1 -1
- package/utils/cursor.js +2 -10
- package/utils/cursor.js.map +1 -1
- package/utils/delete.d.ts +1 -1
- package/utils/delete.js +1 -8
- package/utils/delete.js.map +1 -1
- package/utils/entity/Entity.d.ts +23 -21
- package/utils/entity/Entity.js +56 -34
- package/utils/entity/Entity.js.map +1 -1
- package/utils/entity/EntityReadBatch.d.ts +9 -8
- package/utils/entity/EntityReadBatch.js +14 -16
- package/utils/entity/EntityReadBatch.js.map +1 -1
- package/utils/entity/EntityReadBatchBuilder.d.ts +4 -4
- package/utils/entity/EntityReadBatchBuilder.js +7 -15
- package/utils/entity/EntityReadBatchBuilder.js.map +1 -1
- package/utils/entity/EntityWriteBatch.d.ts +9 -8
- package/utils/entity/EntityWriteBatch.js +10 -18
- package/utils/entity/EntityWriteBatch.js.map +1 -1
- package/utils/entity/EntityWriteBatchBuilder.d.ts +4 -4
- package/utils/entity/EntityWriteBatchBuilder.js +4 -12
- package/utils/entity/EntityWriteBatchBuilder.js.map +1 -1
- package/utils/entity/getEntity.d.ts +2 -2
- package/utils/entity/getEntity.js +3 -10
- package/utils/entity/getEntity.js.map +1 -1
- package/utils/entity/index.d.ts +7 -7
- package/utils/entity/index.js +7 -82
- package/utils/entity/index.js.map +1 -1
- package/utils/entity/types.d.ts +46 -22
- package/utils/entity/types.js +2 -5
- package/utils/entity/types.js.map +1 -1
- package/utils/filter.d.ts +1 -1
- package/utils/filter.js +7 -14
- package/utils/filter.js.map +1 -1
- package/utils/get.d.ts +1 -1
- package/utils/get.js +4 -12
- package/utils/get.js.map +1 -1
- package/utils/index.d.ts +17 -17
- package/utils/index.js +17 -192
- package/utils/index.js.map +1 -1
- package/utils/listResponse.js +4 -10
- package/utils/listResponse.js.map +1 -1
- package/utils/put.d.ts +2 -2
- package/utils/put.js +1 -8
- package/utils/put.js.map +1 -1
- package/utils/query.d.ts +5 -12
- package/utils/query.js +13 -27
- package/utils/query.js.map +1 -1
- package/utils/scan.d.ts +2 -2
- package/utils/scan.js +5 -13
- package/utils/scan.js.map +1 -1
- package/utils/sort.d.ts +1 -1
- package/utils/sort.js +7 -14
- package/utils/sort.js.map +1 -1
- package/utils/table/Table.d.ts +4 -5
- package/utils/table/Table.js +9 -20
- package/utils/table/Table.js.map +1 -1
- package/utils/table/TableReadBatch.d.ts +4 -4
- package/utils/table/TableReadBatch.js +8 -16
- package/utils/table/TableReadBatch.js.map +1 -1
- package/utils/table/TableWriteBatch.d.ts +3 -3
- package/utils/table/TableWriteBatch.js +6 -14
- package/utils/table/TableWriteBatch.js.map +1 -1
- package/utils/table/index.d.ts +4 -4
- package/utils/table/index.js +4 -49
- package/utils/table/index.js.map +1 -1
- package/utils/table/types.d.ts +8 -8
- package/utils/table/types.js +1 -5
- package/utils/table/types.js.map +1 -1
- package/utils/update.d.ts +1 -1
- package/utils/update.js +1 -8
- package/utils/update.js.map +1 -1
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createTableWriteBatch = exports.TableWriteBatch = void 0;
|
|
7
|
-
var _batchWrite = require("../batch/batchWrite");
|
|
8
|
-
var _EntityWriteBatchBuilder = require("../entity/EntityWriteBatchBuilder");
|
|
9
|
-
class TableWriteBatch {
|
|
1
|
+
import { batchWriteAll } from "../batch/batchWrite.js";
|
|
2
|
+
import { createEntityWriteBatchBuilder } from "../entity/EntityWriteBatchBuilder.js";
|
|
3
|
+
export class TableWriteBatch {
|
|
10
4
|
_items = [];
|
|
11
5
|
builders = new Map();
|
|
12
6
|
get total() {
|
|
@@ -42,7 +36,7 @@ class TableWriteBatch {
|
|
|
42
36
|
}
|
|
43
37
|
const items = Array.from(this._items);
|
|
44
38
|
this._items.length = 0;
|
|
45
|
-
return await
|
|
39
|
+
return await batchWriteAll({
|
|
46
40
|
items,
|
|
47
41
|
table: this.table
|
|
48
42
|
});
|
|
@@ -55,15 +49,13 @@ class TableWriteBatch {
|
|
|
55
49
|
if (builder) {
|
|
56
50
|
return builder;
|
|
57
51
|
}
|
|
58
|
-
const newBuilder =
|
|
52
|
+
const newBuilder = createEntityWriteBatchBuilder(entity);
|
|
59
53
|
this.builders.set(entity.name, newBuilder);
|
|
60
54
|
return newBuilder;
|
|
61
55
|
}
|
|
62
56
|
}
|
|
63
|
-
|
|
64
|
-
const createTableWriteBatch = params => {
|
|
57
|
+
export const createTableWriteBatch = params => {
|
|
65
58
|
return new TableWriteBatch(params);
|
|
66
59
|
};
|
|
67
|
-
exports.createTableWriteBatch = createTableWriteBatch;
|
|
68
60
|
|
|
69
61
|
//# sourceMappingURL=TableWriteBatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["batchWriteAll","createEntityWriteBatchBuilder","TableWriteBatch","_items","builders","Map","total","length","items","Array","from","constructor","params","table","push","put","entity","item","builder","getBuilder","delete","combine","createTableWriteBatch","concat","execute","name","Error","get","newBuilder","set"],"sources":["TableWriteBatch.ts"],"sourcesContent":["import type { Entity, TableDef } from \"~/toolbox.js\";\nimport type {\n BatchWriteItem,\n BatchWriteResult,\n IDeleteBatchItem,\n IPutBatchItem\n} from \"~/utils/batch/types.js\";\nimport type { IEntityWriteBatchBuilder } from \"~/utils/entity/types.js\";\nimport { batchWriteAll } from \"~/utils/batch/batchWrite.js\";\nimport { createEntityWriteBatchBuilder } from \"~/utils/entity/EntityWriteBatchBuilder.js\";\nimport type { ITableWriteBatch } from \"./types.js\";\n\nexport interface ITableWriteBatchParams {\n table: TableDef;\n items?: BatchWriteItem[];\n}\n\nexport class TableWriteBatch implements ITableWriteBatch {\n private readonly table: TableDef;\n private readonly _items: BatchWriteItem[] = [];\n private readonly builders: Map<string, IEntityWriteBatchBuilder> = new Map();\n\n public get total(): number {\n return this._items.length;\n }\n\n public get items(): BatchWriteItem[] {\n return Array.from(this._items);\n }\n\n public constructor(params: ITableWriteBatchParams) {\n this.table = params.table;\n if (!params.items?.length) {\n return;\n }\n this._items.push(...params.items);\n }\n\n public put(entity: Entity, item: IPutBatchItem): void {\n const builder = this.getBuilder(entity);\n this._items.push(builder.put(item));\n }\n\n public delete(entity: Entity, item: IDeleteBatchItem): void {\n const builder = this.getBuilder(entity);\n this._items.push(builder.delete(item));\n }\n\n public combine(items: BatchWriteItem[]): ITableWriteBatch {\n return createTableWriteBatch({\n table: this.table,\n items: this._items.concat(items)\n });\n }\n\n public async execute(): Promise<BatchWriteResult> {\n if (this._items.length === 0) {\n return [];\n }\n const items = Array.from(this._items);\n this._items.length = 0;\n return await batchWriteAll({\n items,\n table: this.table\n });\n }\n\n private getBuilder(entity: Entity): IEntityWriteBatchBuilder {\n if (!entity.name) {\n throw new Error(\"Entity must have a name.\");\n }\n const builder = this.builders.get(entity.name);\n if (builder) {\n return builder;\n }\n const newBuilder = createEntityWriteBatchBuilder(entity);\n this.builders.set(entity.name, newBuilder);\n return newBuilder;\n }\n}\n\nexport const createTableWriteBatch = (params: ITableWriteBatchParams): ITableWriteBatch => {\n return new TableWriteBatch(params);\n};\n"],"mappings":"AAQA,SAASA,aAAa;AACtB,SAASC,6BAA6B;AAQtC,OAAO,MAAMC,eAAe,CAA6B;EAEpCC,MAAM,GAAqB,EAAE;EAC7BC,QAAQ,GAA0C,IAAIC,GAAG,CAAC,CAAC;EAE5E,IAAWC,KAAKA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACH,MAAM,CAACI,MAAM;EAC7B;EAEA,IAAWC,KAAKA,CAAA,EAAqB;IACjC,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACP,MAAM,CAAC;EAClC;EAEOQ,WAAWA,CAACC,MAA8B,EAAE;IAC/C,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;IACzB,IAAI,CAACD,MAAM,CAACJ,KAAK,EAAED,MAAM,EAAE;MACvB;IACJ;IACA,IAAI,CAACJ,MAAM,CAACW,IAAI,CAAC,GAAGF,MAAM,CAACJ,KAAK,CAAC;EACrC;EAEOO,GAAGA,CAACC,MAAc,EAAEC,IAAmB,EAAQ;IAClD,MAAMC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACH,MAAM,CAAC;IACvC,IAAI,CAACb,MAAM,CAACW,IAAI,CAACI,OAAO,CAACH,GAAG,CAACE,IAAI,CAAC,CAAC;EACvC;EAEOG,MAAMA,CAACJ,MAAc,EAAEC,IAAsB,EAAQ;IACxD,MAAMC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACH,MAAM,CAAC;IACvC,IAAI,CAACb,MAAM,CAACW,IAAI,CAACI,OAAO,CAACE,MAAM,CAACH,IAAI,CAAC,CAAC;EAC1C;EAEOI,OAAOA,CAACb,KAAuB,EAAoB;IACtD,OAAOc,qBAAqB,CAAC;MACzBT,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBL,KAAK,EAAE,IAAI,CAACL,MAAM,CAACoB,MAAM,CAACf,KAAK;IACnC,CAAC,CAAC;EACN;EAEA,MAAagB,OAAOA,CAAA,EAA8B;IAC9C,IAAI,IAAI,CAACrB,MAAM,CAACI,MAAM,KAAK,CAAC,EAAE;MAC1B,OAAO,EAAE;IACb;IACA,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACP,MAAM,CAAC;IACrC,IAAI,CAACA,MAAM,CAACI,MAAM,GAAG,CAAC;IACtB,OAAO,MAAMP,aAAa,CAAC;MACvBQ,KAAK;MACLK,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC,CAAC;EACN;EAEQM,UAAUA,CAACH,MAAc,EAA4B;IACzD,IAAI,CAACA,MAAM,CAACS,IAAI,EAAE;MACd,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;IAC/C;IACA,MAAMR,OAAO,GAAG,IAAI,CAACd,QAAQ,CAACuB,GAAG,CAACX,MAAM,CAACS,IAAI,CAAC;IAC9C,IAAIP,OAAO,EAAE;MACT,OAAOA,OAAO;IAClB;IACA,MAAMU,UAAU,GAAG3B,6BAA6B,CAACe,MAAM,CAAC;IACxD,IAAI,CAACZ,QAAQ,CAACyB,GAAG,CAACb,MAAM,CAACS,IAAI,EAAEG,UAAU,CAAC;IAC1C,OAAOA,UAAU;EACrB;AACJ;AAEA,OAAO,MAAMN,qBAAqB,GAAIV,MAA8B,IAAuB;EACvF,OAAO,IAAIV,eAAe,CAACU,MAAM,CAAC;AACtC,CAAC","ignoreList":[]}
|
package/utils/table/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./Table";
|
|
2
|
-
export * from "./TableReadBatch";
|
|
3
|
-
export * from "./TableWriteBatch";
|
|
4
|
-
export * from "./types";
|
|
1
|
+
export * from "./Table.js";
|
|
2
|
+
export * from "./TableReadBatch.js";
|
|
3
|
+
export * from "./TableWriteBatch.js";
|
|
4
|
+
export * from "./types.js";
|
package/utils/table/index.js
CHANGED
|
@@ -1,51 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
var _Table = require("./Table");
|
|
7
|
-
Object.keys(_Table).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _Table[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _Table[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _TableReadBatch = require("./TableReadBatch");
|
|
18
|
-
Object.keys(_TableReadBatch).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _TableReadBatch[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _TableReadBatch[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _TableWriteBatch = require("./TableWriteBatch");
|
|
29
|
-
Object.keys(_TableWriteBatch).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _TableWriteBatch[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _TableWriteBatch[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _types = require("./types");
|
|
40
|
-
Object.keys(_types).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _types[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
1
|
+
export * from "./Table.js";
|
|
2
|
+
export * from "./TableReadBatch.js";
|
|
3
|
+
export * from "./TableWriteBatch.js";
|
|
4
|
+
export * from "./types.js";
|
|
50
5
|
|
|
51
6
|
//# sourceMappingURL=index.js.map
|
package/utils/table/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Table.js\";\nexport * from \"./TableReadBatch.js\";\nexport * from \"./TableWriteBatch.js\";\nexport * from \"./types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA","ignoreList":[]}
|
package/utils/table/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
1
|
+
import type { BatchWriteItem, BatchWriteResult, IDeleteBatchItem, IPutBatchItem } from "../../utils/batch/types.js";
|
|
2
|
+
import type { BaseScanParams, ScanResponse } from "../scan.js";
|
|
3
|
+
import type { Entity } from "../../toolbox.js";
|
|
4
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
5
|
+
import { Table } from "../../toolbox.js";
|
|
6
6
|
export type ITableScanParams = BaseScanParams;
|
|
7
7
|
export type ITableScanResponse<T> = ScanResponse<T>;
|
|
8
|
-
export interface ITable {
|
|
9
|
-
table:
|
|
8
|
+
export interface ITable<Name extends string = string, PK extends string = string, SK extends string = string> {
|
|
9
|
+
table: Table<Name, PK, SK>;
|
|
10
10
|
createWriter(): ITableWriteBatch;
|
|
11
11
|
createReader(): ITableReadBatch;
|
|
12
12
|
scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>>;
|
|
@@ -24,7 +24,7 @@ export interface ITableReadBatchKey {
|
|
|
24
24
|
SK: string;
|
|
25
25
|
}
|
|
26
26
|
export interface ITableReadBatchBuilderGetResponse {
|
|
27
|
-
Table:
|
|
27
|
+
Table: Table<string, string, string>;
|
|
28
28
|
Key: ITableReadBatchKey;
|
|
29
29
|
}
|
|
30
30
|
export interface ITableReadBatchKey {
|
package/utils/table/types.js
CHANGED
package/utils/table/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n BatchWriteItem,\n BatchWriteResult,\n IDeleteBatchItem,\n IPutBatchItem\n} from \"~/utils/batch/types.js\";\nimport type { BaseScanParams, ScanResponse } from \"../scan.js\";\nimport type { Entity } from \"~/toolbox.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { Table } from \"~/toolbox.js\";\n\nexport type ITableScanParams = BaseScanParams;\n\nexport type ITableScanResponse<T> = ScanResponse<T>;\n\nexport interface ITable<\n Name extends string = string,\n PK extends string = string,\n SK extends string = string\n> {\n table: Table<Name, PK, SK>;\n createWriter(): ITableWriteBatch;\n createReader(): ITableReadBatch;\n scan<T>(params: ITableScanParams): Promise<ITableScanResponse<T>>;\n}\n\nexport interface ITableWriteBatch {\n readonly total: number;\n readonly items: BatchWriteItem[];\n put(entity: Entity, item: IPutBatchItem): void;\n delete(entity: Entity, item: IDeleteBatchItem): void;\n execute(): Promise<BatchWriteResult>;\n combine(items: BatchWriteItem[]): ITableWriteBatch;\n}\n\nexport interface ITableReadBatchKey {\n PK: string;\n SK: string;\n}\n\nexport interface ITableReadBatchBuilderGetResponse {\n Table: Table<string, string, string>;\n Key: ITableReadBatchKey;\n}\n\nexport interface ITableReadBatchKey {\n PK: string;\n SK: string;\n}\n\nexport interface ITableReadBatch {\n readonly total: number;\n readonly items: ITableReadBatchBuilderGetResponse[];\n get(entity: Entity, input: ITableReadBatchKey | ITableReadBatchKey[]): void;\n execute<T = GenericRecord>(): Promise<T[]>;\n}\n"],"mappings":"","ignoreList":[]}
|
package/utils/update.d.ts
CHANGED
package/utils/update.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.update = void 0;
|
|
7
|
-
const update = async params => {
|
|
1
|
+
export const update = async params => {
|
|
8
2
|
const {
|
|
9
3
|
entity,
|
|
10
4
|
item
|
|
@@ -14,6 +8,5 @@ const update = async params => {
|
|
|
14
8
|
strictSchemaCheck: false
|
|
15
9
|
});
|
|
16
10
|
};
|
|
17
|
-
exports.update = update;
|
|
18
11
|
|
|
19
12
|
//# sourceMappingURL=update.js.map
|
package/utils/update.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["update","params","entity","item","execute","strictSchemaCheck"
|
|
1
|
+
{"version":3,"names":["update","params","entity","item","execute","strictSchemaCheck"],"sources":["update.ts"],"sourcesContent":["import type { Entity } from \"~/toolbox.js\";\n\ninterface Params {\n entity: Entity;\n item: {\n PK: string;\n SK: string;\n TYPE?: string;\n [key: string]: any;\n };\n}\n\nexport const update = async (params: Params) => {\n const { entity, item } = params;\n\n return await entity.update(item, {\n execute: true,\n strictSchemaCheck: false\n });\n};\n"],"mappings":"AAYA,OAAO,MAAMA,MAAM,GAAG,MAAOC,MAAc,IAAK;EAC5C,MAAM;IAAEC,MAAM;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAE/B,OAAO,MAAMC,MAAM,CAACF,MAAM,CAACG,IAAI,EAAE;IAC7BC,OAAO,EAAE,IAAI;IACbC,iBAAiB,EAAE;EACvB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|