@infra-blocks/aws-dynamodb 0.53.0 → 0.54.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/lib/cjs/client.d.ts +10 -6
- package/lib/cjs/client.js +14 -13
- package/lib/cjs/client.js.map +1 -1
- package/lib/cjs/commands/command/codecs/codec.d.ts +4 -0
- package/lib/cjs/commands/command/codecs/codec.js +3 -0
- package/lib/cjs/commands/command/codecs/codec.js.map +1 -0
- package/lib/cjs/commands/command/codecs/delete-item.d.ts +6 -0
- package/lib/cjs/commands/command/codecs/delete-item.js +10 -0
- package/lib/cjs/commands/command/codecs/delete-item.js.map +1 -0
- package/lib/cjs/commands/command/codecs/get-item.d.ts +5 -0
- package/lib/cjs/commands/command/codecs/get-item.js +10 -0
- package/lib/cjs/commands/command/codecs/get-item.js.map +1 -0
- package/lib/cjs/commands/command/command.d.ts +25 -0
- package/lib/cjs/commands/command/command.js +27 -0
- package/lib/cjs/commands/command/command.js.map +1 -0
- package/lib/cjs/commands/command/commands.d.ts +3 -0
- package/lib/cjs/commands/command/commands.js +4 -0
- package/lib/cjs/commands/command/commands.js.map +1 -0
- package/lib/cjs/commands/command/delete-item.d.ts +8 -0
- package/lib/cjs/commands/command/delete-item.js +17 -0
- package/lib/cjs/commands/command/delete-item.js.map +1 -0
- package/lib/cjs/commands/command/get-item.d.ts +8 -0
- package/lib/cjs/commands/command/get-item.js +17 -0
- package/lib/cjs/commands/command/get-item.js.map +1 -0
- package/lib/cjs/commands/command/inputs/create-table.d.ts +7 -0
- package/lib/cjs/commands/command/inputs/create-table.js +3 -0
- package/lib/cjs/commands/command/inputs/create-table.js.map +1 -0
- package/lib/cjs/commands/command/inputs/delete-item.d.ts +12 -0
- package/lib/cjs/commands/command/inputs/delete-item.js +39 -0
- package/lib/cjs/commands/command/inputs/delete-item.js.map +1 -0
- package/lib/cjs/commands/command/inputs/get-item.d.ts +19 -0
- package/lib/cjs/commands/command/inputs/get-item.js +11 -0
- package/lib/cjs/commands/command/inputs/get-item.js.map +1 -0
- package/lib/cjs/commands/command/inputs/index.d.ts +2 -0
- package/lib/cjs/commands/command/inputs/index.js +3 -0
- package/lib/cjs/commands/command/inputs/index.js.map +1 -0
- package/lib/cjs/commands/command/outputs/delete-item.d.ts +6 -0
- package/lib/cjs/commands/command/outputs/delete-item.js +12 -0
- package/lib/cjs/commands/command/outputs/delete-item.js.map +1 -0
- package/lib/cjs/commands/command/outputs/get-item.d.ts +6 -0
- package/lib/cjs/commands/command/outputs/get-item.js +7 -0
- package/lib/cjs/commands/command/outputs/get-item.js.map +1 -0
- package/lib/cjs/commands/command/outputs/index.d.ts +2 -0
- package/lib/cjs/commands/command/outputs/index.js +3 -0
- package/lib/cjs/commands/command/outputs/index.js.map +1 -0
- package/lib/cjs/commands/command/outputs/lib.d.ts +3 -0
- package/lib/cjs/commands/command/outputs/lib.js +12 -0
- package/lib/cjs/commands/command/outputs/lib.js.map +1 -0
- package/lib/cjs/commands/index.d.ts +3 -2
- package/lib/cjs/commands/index.js +2 -0
- package/lib/cjs/commands/index.js.map +1 -1
- package/lib/cjs/commands/write-transaction.d.ts +2 -2
- package/lib/cjs/commands/write-transaction.js +2 -2
- package/lib/cjs/commands/write-transaction.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/client.d.ts +10 -6
- package/lib/esm/client.js +14 -13
- package/lib/esm/client.js.map +1 -1
- package/lib/esm/commands/command/codecs/codec.d.ts +4 -0
- package/lib/esm/commands/command/codecs/codec.js +2 -0
- package/lib/esm/commands/command/codecs/codec.js.map +1 -0
- package/lib/esm/commands/command/codecs/delete-item.d.ts +6 -0
- package/lib/esm/commands/command/codecs/delete-item.js +7 -0
- package/lib/esm/commands/command/codecs/delete-item.js.map +1 -0
- package/lib/esm/commands/command/codecs/get-item.d.ts +5 -0
- package/lib/esm/commands/command/codecs/get-item.js +7 -0
- package/lib/esm/commands/command/codecs/get-item.js.map +1 -0
- package/lib/esm/commands/command/command.d.ts +25 -0
- package/lib/esm/commands/command/command.js +23 -0
- package/lib/esm/commands/command/command.js.map +1 -0
- package/lib/esm/commands/command/commands.d.ts +3 -0
- package/lib/esm/commands/command/commands.js +3 -0
- package/lib/esm/commands/command/commands.js.map +1 -0
- package/lib/esm/commands/command/delete-item.d.ts +8 -0
- package/lib/esm/commands/command/delete-item.js +13 -0
- package/lib/esm/commands/command/delete-item.js.map +1 -0
- package/lib/esm/commands/command/get-item.d.ts +8 -0
- package/lib/esm/commands/command/get-item.js +13 -0
- package/lib/esm/commands/command/get-item.js.map +1 -0
- package/lib/esm/commands/command/inputs/create-table.d.ts +7 -0
- package/lib/esm/commands/command/inputs/create-table.js +2 -0
- package/lib/esm/commands/command/inputs/create-table.js.map +1 -0
- package/lib/esm/commands/command/inputs/delete-item.d.ts +12 -0
- package/lib/esm/commands/command/inputs/delete-item.js +36 -0
- package/lib/esm/commands/command/inputs/delete-item.js.map +1 -0
- package/lib/esm/commands/command/inputs/get-item.d.ts +19 -0
- package/lib/esm/commands/command/inputs/get-item.js +8 -0
- package/lib/esm/commands/command/inputs/get-item.js.map +1 -0
- package/lib/esm/commands/command/inputs/index.d.ts +2 -0
- package/lib/esm/commands/command/inputs/index.js +2 -0
- package/lib/esm/commands/command/inputs/index.js.map +1 -0
- package/lib/esm/commands/command/outputs/delete-item.d.ts +6 -0
- package/lib/esm/commands/command/outputs/delete-item.js +9 -0
- package/lib/esm/commands/command/outputs/delete-item.js.map +1 -0
- package/lib/esm/commands/command/outputs/get-item.d.ts +6 -0
- package/lib/esm/commands/command/outputs/get-item.js +3 -0
- package/lib/esm/commands/command/outputs/get-item.js.map +1 -0
- package/lib/esm/commands/command/outputs/index.d.ts +2 -0
- package/lib/esm/commands/command/outputs/index.js +2 -0
- package/lib/esm/commands/command/outputs/index.js.map +1 -0
- package/lib/esm/commands/command/outputs/lib.d.ts +3 -0
- package/lib/esm/commands/command/outputs/lib.js +9 -0
- package/lib/esm/commands/command/outputs/lib.js.map +1 -0
- package/lib/esm/commands/index.d.ts +3 -2
- package/lib/esm/commands/index.js +2 -0
- package/lib/esm/commands/index.js.map +1 -1
- package/lib/esm/commands/write-transaction.d.ts +2 -2
- package/lib/esm/commands/write-transaction.js +2 -2
- package/lib/esm/commands/write-transaction.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/commands/delete-item.d.ts +0 -26
- package/lib/cjs/commands/delete-item.js +0 -62
- package/lib/cjs/commands/delete-item.js.map +0 -1
- package/lib/cjs/commands/get-item.d.ts +0 -26
- package/lib/cjs/commands/get-item.js +0 -25
- package/lib/cjs/commands/get-item.js.map +0 -1
- package/lib/esm/commands/delete-item.d.ts +0 -26
- package/lib/esm/commands/delete-item.js +0 -58
- package/lib/esm/commands/delete-item.js.map +0 -1
- package/lib/esm/commands/get-item.d.ts +0 -26
- package/lib/esm/commands/get-item.js +0 -21
- package/lib/esm/commands/get-item.js.map +0 -1
|
@@ -5,7 +5,7 @@ const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
|
5
5
|
const types_1 = require("@infra-blocks/types");
|
|
6
6
|
const names_js_1 = require("./attributes/names.js");
|
|
7
7
|
const values_js_1 = require("./attributes/values.js");
|
|
8
|
-
const delete_item_js_1 = require("./delete-item.js");
|
|
8
|
+
const delete_item_js_1 = require("./command/codecs/delete-item.js");
|
|
9
9
|
const expression_js_1 = require("./expressions/condition/expression.js");
|
|
10
10
|
const put_item_js_1 = require("./put-item.js");
|
|
11
11
|
const update_item_js_1 = require("./update-item.js");
|
|
@@ -42,7 +42,7 @@ const WriteTransactionAction = {
|
|
|
42
42
|
}
|
|
43
43
|
if ("delete" in write) {
|
|
44
44
|
return {
|
|
45
|
-
Delete: delete_item_js_1.
|
|
45
|
+
Delete: delete_item_js_1.DeleteItemCodec.encode(write.delete),
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
if ("conditionCheck" in write) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-transaction.js","sourceRoot":"","sources":["../../../src/commands/write-transaction.ts"],"names":[],"mappings":";;;AAAA,wDAG+B;AAC/B,+CAAsE;AAEtE,oDAAuD;AACvD,sDAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"write-transaction.js","sourceRoot":"","sources":["../../../src/commands/write-transaction.ts"],"names":[],"mappings":";;;AAAA,wDAG+B;AAC/B,+CAAsE;AAEtE,oDAAuD;AACvD,sDAAyD;AACzD,oEAAkE;AAElE,yEAA4E;AAE5E,+CAA4D;AAE5D,qDAAqE;AAIrE,MAAM,cAAc,GAAG;IACrB,iBAAiB,CAAC,MAA4B;QAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAEzC,MAAM,KAAK,GAAG,yBAAc,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,2BAAe,CAAC,MAAM,EAAE,CAAC;QACxC,gFAAgF;QAChF,MAAM,UAAU,GAAG,IAAA,mCAAmB,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC;YAC1D,KAAK;YACL,MAAM;SACP,CAAC,CAAC;QAEH,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,GAAG,EAAE,GAAG;YACR,mBAAmB,EAAE,UAAU;YAC/B,wBAAwB,EAAE,KAAK,CAAC,gBAAgB,EAAE;YAClD,yBAAyB,EAAE,MAAM,CAAC,gBAAgB,EAAE;SACrD,CAAC;IACJ,CAAC;CACF,CAAC;AAMF,MAAM,sBAAsB,GAAG;IAC7B,iBAAiB,CAAC,KAA6B;QAC7C,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACnB,OAAO;gBACL,GAAG,EAAE,qBAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE;aACjD,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,2BAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE;aAC1D,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,gCAAe,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;aAC7C,CAAC;QACJ,CAAC;QACD,IAAI,gBAAgB,IAAI,KAAK,EAAE,CAAC;YAC9B,OAAO;gBACL,cAAc,EAAE,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC;aACvE,CAAC;QACJ,CAAC;QACD,IAAA,mBAAW,EAAC,KAAK,CAAC,CAAC;IACrB,CAAC;CACF,CAAC;AAkBF,2HAA2H;AAC3H,MAAa,gBAAgB;IAGV,MAAM,CAA2B;IAElD,YAAoB,MAA8B;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,iBAAiB;QACf,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,iBAAiB,CAAC;SACzE,CAAC;IACJ,CAAC;IAED,YAAY;QACV,OAAO,IAAI,mCAAoB,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF;AAvBD,4CAuBC"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// TODO: export new style commands, input and output types.
|
|
17
18
|
__exportStar(require("./client.js"), exports);
|
|
18
19
|
__exportStar(require("./commands/index.js"), exports);
|
|
19
20
|
__exportStar(require("./error.js"), exports);
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,sDAAoC;AACpC,6CAA2B;AAC3B,4DAA0C;AAC1C,6CAA2B;AAC3B,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAA2D;AAC3D,8CAA4B;AAC5B,sDAAoC;AACpC,6CAA2B;AAC3B,4DAA0C;AAC1C,6CAA2B;AAC3B,6CAA2B"}
|
package/lib/esm/client.d.ts
CHANGED
|
@@ -3,10 +3,13 @@ import type { TranslateConfig } from "@aws-sdk/lib-dynamodb";
|
|
|
3
3
|
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
|
|
4
4
|
import type { Logger } from "@infra-blocks/logger-interface";
|
|
5
5
|
import { type Retry, type RetryConfig } from "@infra-blocks/retry";
|
|
6
|
+
import type { CommandOutput } from "./commands/command/command.js";
|
|
7
|
+
import type { DynamoDbClientCommand } from "./commands/command/commands.js";
|
|
8
|
+
import type { DeleteItemInput } from "./commands/command/inputs/delete-item.js";
|
|
9
|
+
import type { DeleteItemOutput } from "./commands/command/outputs/delete-item.js";
|
|
6
10
|
import { type CreateTableParams } from "./commands/create-table.js";
|
|
7
11
|
import { type DeleteTableParams } from "./commands/delete.table.js";
|
|
8
|
-
import {
|
|
9
|
-
import { type GetItemParams } from "./commands/get-item.js";
|
|
12
|
+
import type { GetItemInput, GetItemOutput } from "./commands/index.js";
|
|
10
13
|
import { type PutItemParams, type PutItemResult } from "./commands/put-item.js";
|
|
11
14
|
import { type QueryParams, type QueryResult } from "./commands/query.js";
|
|
12
15
|
import { type UpdateItemParams } from "./commands/update-item.js";
|
|
@@ -65,11 +68,11 @@ export declare class DynamoDbClient {
|
|
|
65
68
|
/**
|
|
66
69
|
* Deletes an item using the DeleteItem API.
|
|
67
70
|
*
|
|
68
|
-
* @param
|
|
71
|
+
* @param input
|
|
69
72
|
*
|
|
70
73
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html
|
|
71
74
|
*/
|
|
72
|
-
deleteItem<
|
|
75
|
+
deleteItem<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(input: DeleteItemInput<K>): Promise<DeleteItemOutput<T>>;
|
|
73
76
|
/**
|
|
74
77
|
* Deletes a table using the DeleteTable API.
|
|
75
78
|
*
|
|
@@ -81,14 +84,14 @@ export declare class DynamoDbClient {
|
|
|
81
84
|
/**
|
|
82
85
|
* Gets an item using the GetItem API.
|
|
83
86
|
*
|
|
84
|
-
* @param
|
|
87
|
+
* @param input - The parameters to use to get the item.
|
|
85
88
|
*
|
|
86
89
|
* @returns The item casted to the generic type provided, or undefined if not such item
|
|
87
90
|
* matches the primary key.
|
|
88
91
|
*
|
|
89
92
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html
|
|
90
93
|
*/
|
|
91
|
-
getItem<
|
|
94
|
+
getItem<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(input: GetItemInput<K>): Promise<GetItemOutput<T>>;
|
|
92
95
|
/**
|
|
93
96
|
* Puts an item using the PutItem API.
|
|
94
97
|
*
|
|
@@ -173,6 +176,7 @@ export declare class DynamoDbClient {
|
|
|
173
176
|
* @param options - Options to pass to the underlying retry mechanism.
|
|
174
177
|
*/
|
|
175
178
|
ready(options?: Omit<RetryConfig, "isRetryableError">): Retry<void>;
|
|
179
|
+
send<C extends DynamoDbClientCommand>(command: C): Promise<CommandOutput<C>>;
|
|
176
180
|
/**
|
|
177
181
|
* Updates an item using the UpdateItem API.
|
|
178
182
|
*
|
package/lib/esm/client.js
CHANGED
|
@@ -3,10 +3,10 @@ import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
|
|
|
3
3
|
import { NullLogger } from "@infra-blocks/null-logger";
|
|
4
4
|
import { retry } from "@infra-blocks/retry";
|
|
5
5
|
import { trusted } from "@infra-blocks/types";
|
|
6
|
+
import { DeleteItem } from "./commands/command/delete-item.js";
|
|
7
|
+
import { GetItem } from "./commands/command/get-item.js";
|
|
6
8
|
import { CreateTable, } from "./commands/create-table.js";
|
|
7
9
|
import { DeleteTable, } from "./commands/delete.table.js";
|
|
8
|
-
import { DeleteItem, } from "./commands/delete-item.js";
|
|
9
|
-
import { GetItem } from "./commands/get-item.js";
|
|
10
10
|
import { PutItem, } from "./commands/put-item.js";
|
|
11
11
|
import { Query } from "./commands/query.js";
|
|
12
12
|
import { UpdateItem } from "./commands/update-item.js";
|
|
@@ -42,17 +42,15 @@ export class DynamoDbClient {
|
|
|
42
42
|
/**
|
|
43
43
|
* Deletes an item using the DeleteItem API.
|
|
44
44
|
*
|
|
45
|
-
* @param
|
|
45
|
+
* @param input
|
|
46
46
|
*
|
|
47
47
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html
|
|
48
48
|
*/
|
|
49
|
-
deleteItem(
|
|
49
|
+
deleteItem(input) {
|
|
50
50
|
if (this.logger.isDebugEnabled()) {
|
|
51
|
-
this.logger.debug("deleteItem(%s)", JSON.stringify(
|
|
51
|
+
this.logger.debug("deleteItem(%s)", JSON.stringify(input));
|
|
52
52
|
}
|
|
53
|
-
return
|
|
54
|
-
client: this.client,
|
|
55
|
-
});
|
|
53
|
+
return this.send(new DeleteItem(input));
|
|
56
54
|
}
|
|
57
55
|
/**
|
|
58
56
|
* Deletes a table using the DeleteTable API.
|
|
@@ -71,19 +69,18 @@ export class DynamoDbClient {
|
|
|
71
69
|
/**
|
|
72
70
|
* Gets an item using the GetItem API.
|
|
73
71
|
*
|
|
74
|
-
* @param
|
|
72
|
+
* @param input - The parameters to use to get the item.
|
|
75
73
|
*
|
|
76
74
|
* @returns The item casted to the generic type provided, or undefined if not such item
|
|
77
75
|
* matches the primary key.
|
|
78
76
|
*
|
|
79
77
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html
|
|
80
78
|
*/
|
|
81
|
-
async getItem(
|
|
79
|
+
async getItem(input) {
|
|
82
80
|
if (this.logger.isDebugEnabled()) {
|
|
83
|
-
this.logger.debug("getItem(%s)", JSON.stringify(
|
|
81
|
+
this.logger.debug("getItem(%s)", JSON.stringify(input));
|
|
84
82
|
}
|
|
85
|
-
|
|
86
|
-
return trusted(response.Item);
|
|
83
|
+
return this.send(new GetItem(input));
|
|
87
84
|
}
|
|
88
85
|
/**
|
|
89
86
|
* Puts an item using the PutItem API.
|
|
@@ -225,6 +222,10 @@ export class DynamoDbClient {
|
|
|
225
222
|
},
|
|
226
223
|
});
|
|
227
224
|
}
|
|
225
|
+
// TODO: without branding, one type equals all types...
|
|
226
|
+
async send(command) {
|
|
227
|
+
return trusted(command.execute({ client: this.client }));
|
|
228
|
+
}
|
|
228
229
|
/**
|
|
229
230
|
* Updates an item using the UpdateItem API.
|
|
230
231
|
*
|
package/lib/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAgC,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names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,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;IAEtB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAI,CAAC,MAGX;QACC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC;QACxD,OAAO,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,MAAM,CAAC,MAAqB;QACjC,MAAM,CAAC,GAAG,MAAM,IAAI,EAAE,CAAC;QACvB,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;QACjE,OAAO,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/codec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/delete-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,MAAM;CACP,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { encode } from "../inputs/get-item.js";
|
|
2
|
+
export declare const GetItemCodec: {
|
|
3
|
+
encode: typeof encode;
|
|
4
|
+
decode: <T extends import("../../../types.js").Attributes = import("../../../types.js").Attributes>(output: import("@aws-sdk/lib-dynamodb").GetCommandOutput) => import("../outputs/get-item.js").GetItemOutput<T>;
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/get-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,MAAM;CACP,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: The lib-dynamodb's own types don't compile with their interface.
|
|
2
|
+
* For example, pick any command they offer. None of them are assignable to
|
|
3
|
+
* Parameters<DynamoDBDocumentClient["send"]>[0]. This issue is transitive and makes it very hard to express
|
|
4
|
+
* generic constraints based on their command types, or their client's interface, because they don't work with
|
|
5
|
+
* each other trolololol. Hence, we use any where necessary as an escape hatch to this typing nightmare.
|
|
6
|
+
*/
|
|
7
|
+
import type { DynamoDBDocumentClient, DynamoDBDocumentClientCommand, DynamoDBDocumentClientResolvedConfig } from "@aws-sdk/lib-dynamodb";
|
|
8
|
+
import type { Codec } from "./codecs/codec.js";
|
|
9
|
+
type DocumentClientCommandCtor<DCI extends object, DCO extends object> = new (input: DCI) => DynamoDBDocumentClientCommand<DCI, DCO, any, any, DynamoDBDocumentClientResolvedConfig>;
|
|
10
|
+
export type CommandOutput<C> = C extends Command<any, infer O, any, any> ? O : never;
|
|
11
|
+
export type CommandInput<C extends Command<any, any, any, any>> = C["input"];
|
|
12
|
+
export declare abstract class Command<I extends object, O extends object, DCI extends object, DCO extends object> {
|
|
13
|
+
readonly input: I;
|
|
14
|
+
protected readonly codec: Codec<I, O, DCI, DCO>;
|
|
15
|
+
protected readonly command: DocumentClientCommandCtor<DCI, DCO>;
|
|
16
|
+
protected constructor(params: {
|
|
17
|
+
input: I;
|
|
18
|
+
codec: Codec<I, O, DCI, DCO>;
|
|
19
|
+
command: DocumentClientCommandCtor<DCI, DCO>;
|
|
20
|
+
});
|
|
21
|
+
execute(params: {
|
|
22
|
+
client: DynamoDBDocumentClient;
|
|
23
|
+
}): Promise<O>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: The lib-dynamodb's own types don't compile with their interface.
|
|
2
|
+
* For example, pick any command they offer. None of them are assignable to
|
|
3
|
+
* Parameters<DynamoDBDocumentClient["send"]>[0]. This issue is transitive and makes it very hard to express
|
|
4
|
+
* generic constraints based on their command types, or their client's interface, because they don't work with
|
|
5
|
+
* each other trolololol. Hence, we use any where necessary as an escape hatch to this typing nightmare.
|
|
6
|
+
*/
|
|
7
|
+
// TODO: don't export outside.
|
|
8
|
+
export class Command {
|
|
9
|
+
input;
|
|
10
|
+
codec;
|
|
11
|
+
command;
|
|
12
|
+
constructor(params) {
|
|
13
|
+
const { input, codec, command } = params;
|
|
14
|
+
this.input = input;
|
|
15
|
+
this.codec = codec;
|
|
16
|
+
this.command = command;
|
|
17
|
+
}
|
|
18
|
+
async execute(params) {
|
|
19
|
+
const { client } = params;
|
|
20
|
+
return this.codec.decode(await client.send(new this.command(this.codec.encode(this.input))));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH,8BAA8B;AAC9B,MAAM,OAAgB,OAAO;IAMlB,KAAK,CAAI;IAEC,KAAK,CAAwB;IAC7B,OAAO,CAAsC;IAEhE,YAAsB,MAIrB;QACC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAA0C;QACtD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CACtB,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACnE,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";AAKA,8CAA8C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DeleteCommandInput, type DeleteCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { Attributes, KeyAttributes } from "../../types.js";
|
|
3
|
+
import { Command } from "./command.js";
|
|
4
|
+
import type { DeleteItemInput } from "./inputs/delete-item.js";
|
|
5
|
+
import type { DeleteItemOutput } from "./outputs/delete-item.js";
|
|
6
|
+
export declare class DeleteItem<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes> extends Command<DeleteItemInput<K>, DeleteItemOutput<T>, DeleteCommandInput, DeleteCommandOutput> {
|
|
7
|
+
constructor(input: DeleteItemInput<K>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DeleteCommand, } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { DeleteItemCodec } from "./codecs/delete-item.js";
|
|
3
|
+
import { Command } from "./command.js";
|
|
4
|
+
export class DeleteItem extends Command {
|
|
5
|
+
constructor(input) {
|
|
6
|
+
super({
|
|
7
|
+
input,
|
|
8
|
+
codec: DeleteItemCodec,
|
|
9
|
+
command: DeleteCommand,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=delete-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-item.js","sourceRoot":"","sources":["../../../../src/commands/command/delete-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAGd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,MAAM,OAAO,UAGX,SAAQ,OAKT;IACC,YAAY,KAAyB;QACnC,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,aAAa;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type GetCommandInput, type GetCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { Attributes, KeyAttributes } from "../../types.js";
|
|
3
|
+
import { Command } from "./command.js";
|
|
4
|
+
import type { GetItemInput } from "./inputs/get-item.js";
|
|
5
|
+
import type { GetItemOutput } from "./outputs/get-item.js";
|
|
6
|
+
export declare class GetItem<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes> extends Command<GetItemInput<K>, GetItemOutput<T>, GetCommandInput, GetCommandOutput> {
|
|
7
|
+
constructor(input: GetItemInput<K>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetCommand, } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { GetItemCodec } from "./codecs/get-item.js";
|
|
3
|
+
import { Command } from "./command.js";
|
|
4
|
+
export class GetItem extends Command {
|
|
5
|
+
constructor(input) {
|
|
6
|
+
super({
|
|
7
|
+
input,
|
|
8
|
+
codec: GetItemCodec,
|
|
9
|
+
command: GetCommand,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=get-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/command/get-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAGX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,MAAM,OAAO,OAGX,SAAQ,OAKT;IACC,YAAY,KAAsB;QAChC,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,UAAU;SACpB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-table.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/create-table.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DeleteCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { KeyAttributes } from "../../../types.js";
|
|
3
|
+
import type { ConditionParams } from "../../expressions/index.js";
|
|
4
|
+
export type DeleteItemReturnValue = "ALL_OLD" | "NONE";
|
|
5
|
+
export type DeleteItemInput<K extends KeyAttributes = KeyAttributes> = {
|
|
6
|
+
table: string;
|
|
7
|
+
key: K;
|
|
8
|
+
condition?: ConditionParams;
|
|
9
|
+
returnValues?: DeleteItemReturnValue;
|
|
10
|
+
returnValuesOnConditionCheckFailure?: DeleteItemReturnValue;
|
|
11
|
+
};
|
|
12
|
+
export declare function encode<K extends KeyAttributes>(input: DeleteItemInput<K>): DeleteCommandInput;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AttributeNames } from "../../attributes/names.js";
|
|
2
|
+
import { AttributeValues } from "../../attributes/values.js";
|
|
3
|
+
import { conditionExpression } from "../../expressions/condition/expression.js";
|
|
4
|
+
export function encode(input) {
|
|
5
|
+
const transformed = {
|
|
6
|
+
TableName: input.table,
|
|
7
|
+
Key: input.key,
|
|
8
|
+
};
|
|
9
|
+
if (input.returnValues != null) {
|
|
10
|
+
transformed.ReturnValues = input.returnValues;
|
|
11
|
+
}
|
|
12
|
+
if (input.returnValuesOnConditionCheckFailure != null) {
|
|
13
|
+
transformed.ReturnValuesOnConditionCheckFailure =
|
|
14
|
+
input.returnValuesOnConditionCheckFailure;
|
|
15
|
+
}
|
|
16
|
+
// Expression attribute names and values can only be specified when a condition is provided,
|
|
17
|
+
// which is optional.
|
|
18
|
+
if (input.condition == null) {
|
|
19
|
+
return transformed;
|
|
20
|
+
}
|
|
21
|
+
// TODO: this in a reusable function.
|
|
22
|
+
const names = AttributeNames.create();
|
|
23
|
+
const values = AttributeValues.create();
|
|
24
|
+
// Ask the expression to stringify itself, applying the substitutions by itself.
|
|
25
|
+
const expression = conditionExpression(input.condition).stringify({
|
|
26
|
+
names,
|
|
27
|
+
values,
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
...transformed,
|
|
31
|
+
ConditionExpression: expression,
|
|
32
|
+
ExpressionAttributeNames: names.getSubstitutions(),
|
|
33
|
+
ExpressionAttributeValues: values.getSubstitutions(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=delete-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/delete-item.ts"],"names":[],"mappings":"AAEA,OAAO,EA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* The input required to call the GetItem API.
|
|
5
|
+
*/
|
|
6
|
+
export interface GetItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the table to query.
|
|
9
|
+
*/
|
|
10
|
+
table: string;
|
|
11
|
+
/**
|
|
12
|
+
* The primary key values of the item to retrieve.
|
|
13
|
+
*
|
|
14
|
+
* This should always include at least the partition key, and the sort key if one
|
|
15
|
+
* is part of the table's primary key. No more than 2 fields are expected here.
|
|
16
|
+
*/
|
|
17
|
+
key: K;
|
|
18
|
+
}
|
|
19
|
+
export declare function encode<K extends KeyAttributes = KeyAttributes>(input: GetItemInput<K>): GetCommandInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/get-item.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,MAAM,CACpB,KAAsB;IAEtB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACtB,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,GAAG;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DeleteCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { Attributes } from "../../../types.js";
|
|
3
|
+
export type DeleteItemOutput<T extends Attributes = Attributes> = {
|
|
4
|
+
item?: T;
|
|
5
|
+
};
|
|
6
|
+
export declare function decode<T extends Attributes = Attributes>(output: DeleteCommandOutput): DeleteItemOutput<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/delete-item.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,MAAM,CACpB,MAA2B;IAE3B,qBAAqB;IACrB,MAAM,MAAM,GAAiC,EAAE,CAAC;IAChD,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,UAAe,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GetCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { Attributes } from "../../../types.js";
|
|
3
|
+
export type GetItemOutput<T extends Attributes = Attributes> = {
|
|
4
|
+
item?: T;
|
|
5
|
+
};
|
|
6
|
+
export declare const decode: <T extends Attributes = Attributes>(output: GetCommandOutput) => GetItemOutput<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/get-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAKpC,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,MAAwB,EACN,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
export function maybeSet(acc, accKey, source, sourceKey, transform) {
|
|
3
|
+
if (source[sourceKey] != null) {
|
|
4
|
+
const newValue = transform != null ? transform(source[sourceKey]) : source[sourceKey];
|
|
5
|
+
acc[accKey] = trusted(newValue);
|
|
6
|
+
}
|
|
7
|
+
return trusted(acc);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,UAAU,QAAQ,CAOtB,GAAM,EACN,MAAU,EACV,MAAS,EACT,SAAa,EACb,SAA+B;IAE/B,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,QAAQ,GACZ,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACvE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export type { DeleteItem } from "./command/delete-item.js";
|
|
2
|
+
export * from "./command/inputs/index.js";
|
|
3
|
+
export * from "./command/outputs/index.js";
|
|
1
4
|
export type { CreateTableParams } from "./create-table.js";
|
|
2
5
|
export type { DeleteTableParams } from "./delete.table.js";
|
|
3
|
-
export type { DeleteItemParams, DeleteItemResult, DeleteItemReturnValue, } from "./delete-item.js";
|
|
4
6
|
export * from "./expressions/index.js";
|
|
5
|
-
export type { GetItemParams } from "./get-item.js";
|
|
6
7
|
export type { PutItemParams, PutItemResult, PutItemReturnValue, } from "./put-item.js";
|
|
7
8
|
export type { QueryParams } from "./query.js";
|
|
8
9
|
export type { UpdateItemParams } from "./update-item.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAG3C,cAAc,wBAAwB,CAAC"}
|