@infra-blocks/aws-dynamodb 0.57.0 → 0.58.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 +11 -12
- package/lib/cjs/client.js +20 -20
- package/lib/cjs/client.js.map +1 -1
- package/lib/cjs/commands/command/codecs/query.d.ts +6 -0
- package/lib/cjs/commands/command/codecs/query.js +10 -0
- package/lib/cjs/commands/command/codecs/query.js.map +1 -0
- package/lib/cjs/commands/command/command.d.ts +3 -3
- package/lib/cjs/commands/command/command.js +1 -1
- package/lib/cjs/commands/command/command.js.map +1 -1
- package/lib/cjs/commands/command/commands.d.ts +2 -1
- package/lib/cjs/commands/command/commands.js.map +1 -1
- package/lib/cjs/commands/command/index.d.ts +1 -0
- package/lib/cjs/commands/command/index.js +3 -1
- package/lib/cjs/commands/command/index.js.map +1 -1
- package/lib/cjs/commands/command/inputs/delete-item.js +4 -13
- package/lib/cjs/commands/command/inputs/delete-item.js.map +1 -1
- package/lib/cjs/commands/command/inputs/index.d.ts +1 -0
- package/lib/cjs/commands/command/inputs/lib.d.ts +8 -0
- package/lib/cjs/commands/command/inputs/lib.js +19 -0
- package/lib/cjs/commands/command/inputs/lib.js.map +1 -0
- package/lib/cjs/commands/command/inputs/put-item.js +4 -11
- package/lib/cjs/commands/command/inputs/put-item.js.map +1 -1
- package/lib/cjs/commands/command/inputs/query.d.ts +13 -0
- package/lib/cjs/commands/command/inputs/query.js +20 -0
- package/lib/cjs/commands/command/inputs/query.js.map +1 -0
- package/lib/cjs/commands/command/outputs/index.d.ts +1 -0
- package/lib/cjs/commands/command/outputs/query.d.ts +9 -0
- package/lib/cjs/commands/command/outputs/query.js +14 -0
- package/lib/cjs/commands/command/outputs/query.js.map +1 -0
- package/lib/cjs/commands/command/query.d.ts +8 -0
- package/lib/cjs/commands/command/query.js +17 -0
- package/lib/cjs/commands/command/query.js.map +1 -0
- package/lib/cjs/commands/index.d.ts +0 -1
- package/lib/cjs/error.d.ts +2 -2
- package/lib/cjs/error.js.map +1 -1
- package/lib/esm/client.d.ts +11 -12
- package/lib/esm/client.js +21 -21
- package/lib/esm/client.js.map +1 -1
- package/lib/esm/commands/command/codecs/query.d.ts +6 -0
- package/lib/esm/commands/command/codecs/query.js +7 -0
- package/lib/esm/commands/command/codecs/query.js.map +1 -0
- package/lib/esm/commands/command/command.d.ts +3 -3
- package/lib/esm/commands/command/command.js +1 -1
- package/lib/esm/commands/command/command.js.map +1 -1
- package/lib/esm/commands/command/commands.d.ts +2 -1
- package/lib/esm/commands/command/commands.js.map +1 -1
- package/lib/esm/commands/command/index.d.ts +1 -0
- package/lib/esm/commands/command/index.js +1 -0
- package/lib/esm/commands/command/index.js.map +1 -1
- package/lib/esm/commands/command/inputs/delete-item.js +4 -13
- package/lib/esm/commands/command/inputs/delete-item.js.map +1 -1
- package/lib/esm/commands/command/inputs/index.d.ts +1 -0
- package/lib/esm/commands/command/inputs/lib.d.ts +8 -0
- package/lib/esm/commands/command/inputs/lib.js +16 -0
- package/lib/esm/commands/command/inputs/lib.js.map +1 -0
- package/lib/esm/commands/command/inputs/put-item.js +4 -11
- package/lib/esm/commands/command/inputs/put-item.js.map +1 -1
- package/lib/esm/commands/command/inputs/query.d.ts +13 -0
- package/lib/esm/commands/command/inputs/query.js +17 -0
- package/lib/esm/commands/command/inputs/query.js.map +1 -0
- package/lib/esm/commands/command/outputs/index.d.ts +1 -0
- package/lib/esm/commands/command/outputs/query.d.ts +9 -0
- package/lib/esm/commands/command/outputs/query.js +11 -0
- package/lib/esm/commands/command/outputs/query.js.map +1 -0
- package/lib/esm/commands/command/query.d.ts +8 -0
- package/lib/esm/commands/command/query.js +13 -0
- package/lib/esm/commands/command/query.js.map +1 -0
- package/lib/esm/commands/index.d.ts +0 -1
- package/lib/esm/error.d.ts +2 -2
- package/lib/esm/error.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/commands/query.d.ts +0 -31
- package/lib/cjs/commands/query.js +0 -57
- package/lib/cjs/commands/query.js.map +0 -1
- package/lib/esm/commands/query.d.ts +0 -31
- package/lib/esm/commands/query.js +0 -53
- package/lib/esm/commands/query.js.map +0 -1
package/lib/cjs/client.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ import type { Logger } from "@infra-blocks/logger-interface";
|
|
|
5
5
|
import { type Retry, type RetryConfig } from "@infra-blocks/retry";
|
|
6
6
|
import type { CommandOutput } from "./commands/command/command.js";
|
|
7
7
|
import type { DynamoDbClientCommand } from "./commands/command/commands.js";
|
|
8
|
-
import { type CreateTableInput, type CreateTableOutput, type DeleteItemInput, type DeleteItemOutput, type DeleteTableInput, type DeleteTableOutput, type GetItemInput, type GetItemOutput, type PutItemInput, type PutItemOutput } from "./commands/index.js";
|
|
9
|
-
import { type QueryParams, type QueryResult } from "./commands/query.js";
|
|
8
|
+
import { type CreateTableInput, type CreateTableOutput, type DeleteItemInput, type DeleteItemOutput, type DeleteTableInput, type DeleteTableOutput, type GetItemInput, type GetItemOutput, type PutItemInput, type PutItemOutput, type QueryInput, type QueryOutput } from "./commands/index.js";
|
|
10
9
|
import { type UpdateItemParams } from "./commands/update-item.js";
|
|
11
10
|
import { type UpdateTimeToLiveParams } from "./commands/update-time-to-live.js";
|
|
12
11
|
import { type WriteTransactionParams } from "./commands/write-transaction.js";
|
|
@@ -105,43 +104,43 @@ export declare class DynamoDbClient {
|
|
|
105
104
|
* It uses {@link paginateQuery} to handle pagination automatically, and yields
|
|
106
105
|
* every item produced by every page.
|
|
107
106
|
*
|
|
108
|
-
* @param
|
|
107
|
+
* @param input - The parameters to use to query the table or index.
|
|
109
108
|
*
|
|
110
109
|
* @returns An async generator that yields items matching the query, one
|
|
111
110
|
* at a time, and that handles pagination automatically.
|
|
112
111
|
*
|
|
113
112
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
114
113
|
*/
|
|
115
|
-
iterateQuery<
|
|
114
|
+
iterateQuery<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(input: QueryInput<K>): AsyncGenerator<T>;
|
|
116
115
|
/**
|
|
117
116
|
* Paginates the result of querying a table, or an index, using the Query API.
|
|
118
117
|
*
|
|
119
118
|
* It uses {@link query} to produce pages, and yields them one after the other
|
|
120
119
|
* through the generator.
|
|
121
120
|
*
|
|
122
|
-
* @param
|
|
121
|
+
* @param input - The parameters to use to query the table or index.
|
|
123
122
|
*
|
|
124
123
|
* @returns An async generator that yields items matching the query, one
|
|
125
124
|
* at a time, and that handles pagination automatically.
|
|
126
125
|
*
|
|
127
126
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
128
127
|
*/
|
|
129
|
-
paginateQuery<
|
|
128
|
+
paginateQuery<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(input: QueryInput<K>): AsyncGenerator<QueryOutput<T, K>>;
|
|
130
129
|
/**
|
|
131
130
|
* Queries a table, or an index, using the Query API.
|
|
132
131
|
*
|
|
133
132
|
* It produces a single page of results, which may or may not contain all the
|
|
134
|
-
* items of the query. If the result is incomplete, the {@link
|
|
135
|
-
* will be set, and should be used in a follow up query as the {@link
|
|
133
|
+
* items of the query. If the result is incomplete, the {@link QueryOutput.lastEvaluatedKey}
|
|
134
|
+
* will be set, and should be used in a follow up query as the {@link QueryOutput.exclusiveStartKey}.
|
|
136
135
|
*
|
|
137
|
-
* @param
|
|
136
|
+
* @param input - The parameters to use to query the table or index.
|
|
138
137
|
*
|
|
139
138
|
* @returns An async generator that yields items matching the query, one
|
|
140
139
|
* at a time, and that handles pagination automatically.
|
|
141
140
|
*
|
|
142
141
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
143
142
|
*/
|
|
144
|
-
query<
|
|
143
|
+
query<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(input: QueryInput<K>): Promise<QueryOutput<T, K>>;
|
|
145
144
|
/**
|
|
146
145
|
* Convenience method over the {@link query} method enforcing that the query
|
|
147
146
|
* matches at most one item.
|
|
@@ -155,11 +154,11 @@ export declare class DynamoDbClient {
|
|
|
155
154
|
* to be unique, unlike `getItem` for the table. It can also be useful in the case where
|
|
156
155
|
* the sort key of an item is unknown, expected to match a {@link KeyConditionExpression} uniquely.
|
|
157
156
|
*
|
|
158
|
-
* @param
|
|
157
|
+
* @param input - The parameters to use to query the table or index.
|
|
159
158
|
*
|
|
160
159
|
* @returns The only item matching the query, or `undefined` if no item matches.
|
|
161
160
|
*/
|
|
162
|
-
queryOne<
|
|
161
|
+
queryOne<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(input: QueryInput<K>): Promise<T | undefined>;
|
|
163
162
|
/**
|
|
164
163
|
* Awaits until the DynamoDB service is ready to accept requests.
|
|
165
164
|
*
|
package/lib/cjs/client.js
CHANGED
|
@@ -7,7 +7,6 @@ const null_logger_1 = require("@infra-blocks/null-logger");
|
|
|
7
7
|
const retry_1 = require("@infra-blocks/retry");
|
|
8
8
|
const types_1 = require("@infra-blocks/types");
|
|
9
9
|
const index_js_1 = require("./commands/index.js");
|
|
10
|
-
const query_js_1 = require("./commands/query.js");
|
|
11
10
|
const update_item_js_1 = require("./commands/update-item.js");
|
|
12
11
|
const update_time_to_live_js_1 = require("./commands/update-time-to-live.js");
|
|
13
12
|
const write_transaction_js_1 = require("./commands/write-transaction.js");
|
|
@@ -96,24 +95,25 @@ class DynamoDbClient {
|
|
|
96
95
|
}
|
|
97
96
|
return this.send(new index_js_1.PutItem(params));
|
|
98
97
|
}
|
|
98
|
+
// TODO: make an IterateQuery command/ free floating function function?
|
|
99
99
|
/**
|
|
100
100
|
* Iterates the items produced querying a table, or an index, using the Query API.
|
|
101
101
|
*
|
|
102
102
|
* It uses {@link paginateQuery} to handle pagination automatically, and yields
|
|
103
103
|
* every item produced by every page.
|
|
104
104
|
*
|
|
105
|
-
* @param
|
|
105
|
+
* @param input - The parameters to use to query the table or index.
|
|
106
106
|
*
|
|
107
107
|
* @returns An async generator that yields items matching the query, one
|
|
108
108
|
* at a time, and that handles pagination automatically.
|
|
109
109
|
*
|
|
110
110
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
111
111
|
*/
|
|
112
|
-
async *iterateQuery(
|
|
112
|
+
async *iterateQuery(input) {
|
|
113
113
|
if (this.logger.isDebugEnabled()) {
|
|
114
|
-
this.logger.debug("iterateQuery(%s)", JSON.stringify(
|
|
114
|
+
this.logger.debug("iterateQuery(%s)", JSON.stringify(input));
|
|
115
115
|
}
|
|
116
|
-
for await (const page of this.paginateQuery(
|
|
116
|
+
for await (const page of this.paginateQuery(input)) {
|
|
117
117
|
for (const item of page.items) {
|
|
118
118
|
yield item;
|
|
119
119
|
}
|
|
@@ -125,22 +125,22 @@ class DynamoDbClient {
|
|
|
125
125
|
* It uses {@link query} to produce pages, and yields them one after the other
|
|
126
126
|
* through the generator.
|
|
127
127
|
*
|
|
128
|
-
* @param
|
|
128
|
+
* @param input - The parameters to use to query the table or index.
|
|
129
129
|
*
|
|
130
130
|
* @returns An async generator that yields items matching the query, one
|
|
131
131
|
* at a time, and that handles pagination automatically.
|
|
132
132
|
*
|
|
133
133
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
134
134
|
*/
|
|
135
|
-
async *paginateQuery(
|
|
135
|
+
async *paginateQuery(input) {
|
|
136
136
|
if (this.logger.isDebugEnabled()) {
|
|
137
|
-
this.logger.debug("paginateQuery(%s)", JSON.stringify(
|
|
137
|
+
this.logger.debug("paginateQuery(%s)", JSON.stringify(input));
|
|
138
138
|
}
|
|
139
|
-
let page = await this.query(
|
|
139
|
+
let page = await this.query(input);
|
|
140
140
|
yield page;
|
|
141
141
|
while (page.lastEvaluatedKey != null) {
|
|
142
142
|
page = await this.query({
|
|
143
|
-
...
|
|
143
|
+
...input,
|
|
144
144
|
exclusiveStartKey: page.lastEvaluatedKey,
|
|
145
145
|
});
|
|
146
146
|
yield page;
|
|
@@ -150,21 +150,21 @@ class DynamoDbClient {
|
|
|
150
150
|
* Queries a table, or an index, using the Query API.
|
|
151
151
|
*
|
|
152
152
|
* It produces a single page of results, which may or may not contain all the
|
|
153
|
-
* items of the query. If the result is incomplete, the {@link
|
|
154
|
-
* will be set, and should be used in a follow up query as the {@link
|
|
153
|
+
* items of the query. If the result is incomplete, the {@link QueryOutput.lastEvaluatedKey}
|
|
154
|
+
* will be set, and should be used in a follow up query as the {@link QueryOutput.exclusiveStartKey}.
|
|
155
155
|
*
|
|
156
|
-
* @param
|
|
156
|
+
* @param input - The parameters to use to query the table or index.
|
|
157
157
|
*
|
|
158
158
|
* @returns An async generator that yields items matching the query, one
|
|
159
159
|
* at a time, and that handles pagination automatically.
|
|
160
160
|
*
|
|
161
161
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
162
162
|
*/
|
|
163
|
-
query(
|
|
163
|
+
query(input) {
|
|
164
164
|
if (this.logger.isDebugEnabled()) {
|
|
165
|
-
this.logger.debug("query(%s)", JSON.stringify(
|
|
165
|
+
this.logger.debug("query(%s)", JSON.stringify(input));
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return this.send(new index_js_1.Query(input));
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Convenience method over the {@link query} method enforcing that the query
|
|
@@ -179,16 +179,16 @@ class DynamoDbClient {
|
|
|
179
179
|
* to be unique, unlike `getItem` for the table. It can also be useful in the case where
|
|
180
180
|
* the sort key of an item is unknown, expected to match a {@link KeyConditionExpression} uniquely.
|
|
181
181
|
*
|
|
182
|
-
* @param
|
|
182
|
+
* @param input - The parameters to use to query the table or index.
|
|
183
183
|
*
|
|
184
184
|
* @returns The only item matching the query, or `undefined` if no item matches.
|
|
185
185
|
*/
|
|
186
|
-
async queryOne(
|
|
186
|
+
async queryOne(input) {
|
|
187
187
|
let item;
|
|
188
188
|
// TODO: page of only 2 items, remove limit from parameters.
|
|
189
|
-
for await (const queryItem of this.iterateQuery(
|
|
189
|
+
for await (const queryItem of this.iterateQuery(input)) {
|
|
190
190
|
if (item != null) {
|
|
191
|
-
throw error_js_1.TooManyItemsException.queryingOne(
|
|
191
|
+
throw error_js_1.TooManyItemsException.queryingOne(input);
|
|
192
192
|
}
|
|
193
193
|
item = queryItem;
|
|
194
194
|
}
|
package/lib/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AACA,8DAA6E;AAE7E,wDAA+D;AAE/D,2DAAuD;AACvD,+CAA0E;AAC1E,+CAA8C;AAG9C,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AACA,8DAA6E;AAE7E,wDAA+D;AAE/D,2DAAuD;AACvD,+CAA0E;AAC1E,+CAA8C;AAG9C,kDAmB6B;AAC7B,8DAA8E;AAC9E,8EAG2C;AAC3C,0EAGyC;AACzC,yCAAmD;AAuCnD;;;GAGG;AACH,MAAa,cAAc;IACR,MAAM,CAAyB;IAC/B,MAAM,CAAS;IAEhC,YAAoB,MAGnB;QACC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,KAA2B;QAE3B,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,sBAAW,CAAK,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAGR,KAAyB;QACzB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ACxD,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,gCAAc,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,qCAAsB,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;AApXD,wCAoXC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryCodec = void 0;
|
|
4
|
+
const query_js_1 = require("../inputs/query.js");
|
|
5
|
+
const query_js_2 = require("../outputs/query.js");
|
|
6
|
+
exports.QueryCodec = {
|
|
7
|
+
encode: query_js_1.encode,
|
|
8
|
+
decode: query_js_2.decode,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/query.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAC5C,kDAA6C;AAEhC,QAAA,UAAU,GAAG;IACxB,MAAM,EAAN,iBAAM;IACN,MAAM,EAAN,iBAAM;CACP,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* For example, pick any command they offer. None of them are assignable to
|
|
3
3
|
* Parameters<DynamoDBDocumentClient["send"]>[0]. This issue is transitive and makes it very hard to express
|
|
4
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.
|
|
5
|
+
* each other trolololol. Hence, we use `any` where necessary as an escape hatch to this typing nightmare.
|
|
6
6
|
*/
|
|
7
7
|
import type { CreateTableCommand, DeleteTableCommand } from "@aws-sdk/client-dynamodb";
|
|
8
|
-
import type { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand } from "@aws-sdk/lib-dynamodb";
|
|
8
|
+
import type { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand, QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
9
9
|
import type { GetOutputType } from "@smithy/types";
|
|
10
10
|
import type { Codec } from "./codecs/codec.js";
|
|
11
|
-
type NativeCommand = DeleteCommand | GetCommand | CreateTableCommand | DeleteTableCommand | PutCommand;
|
|
11
|
+
type NativeCommand = DeleteCommand | GetCommand | CreateTableCommand | DeleteTableCommand | PutCommand | QueryCommand;
|
|
12
12
|
type NativeCommandCtor<C extends NativeCommand> = new (input: C["input"]) => C;
|
|
13
13
|
export type CommandOutput<C extends Command<unknown, unknown>> = Awaited<ReturnType<C["execute"]>>;
|
|
14
14
|
export type CommandInput<C extends Command<unknown, unknown>> = C["input"];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For example, pick any command they offer. None of them are assignable to
|
|
4
4
|
* Parameters<DynamoDBDocumentClient["send"]>[0]. This issue is transitive and makes it very hard to express
|
|
5
5
|
* generic constraints based on their command types, or their client's interface, because they don't work with
|
|
6
|
-
* each other trolololol. Hence, we use any where necessary as an escape hatch to this typing nightmare.
|
|
6
|
+
* each other trolololol. Hence, we use `any` where necessary as an escape hatch to this typing nightmare.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AbstractCommand = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/commands/command/command.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAaH,+CAA8C;AA0B9C,gBAAgB;AAChB,MAAsB,eAAe;IAM1B,KAAK,CAAI;IAEC,KAAK,CAA4C;IACjD,OAAO,CAAuB;IAEjD,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,MAAM,YAAY,GAAe,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAc,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,CAAC;IACnD,CAAC;CACF;AA7BD,0CA6BC"}
|
|
@@ -3,4 +3,5 @@ import type { DeleteItem } from "./delete-item.js";
|
|
|
3
3
|
import type { DeleteTable } from "./delete-table.js";
|
|
4
4
|
import type { GetItem } from "./get-item.js";
|
|
5
5
|
import type { PutItem } from "./put-item.js";
|
|
6
|
-
|
|
6
|
+
import type { Query } from "./query.js";
|
|
7
|
+
export type DynamoDbClientCommand = DeleteItem | GetItem | CreateTable | DeleteTable | PutItem | Query;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/commands/command/commands.ts"],"names":[],"mappings":";;AAeA,8CAA8C"}
|
|
@@ -14,7 +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
|
-
exports.PutItem = exports.GetItem = exports.DeleteTable = exports.DeleteItem = exports.CreateTable = void 0;
|
|
17
|
+
exports.Query = exports.PutItem = exports.GetItem = exports.DeleteTable = exports.DeleteItem = exports.CreateTable = void 0;
|
|
18
18
|
var create_table_js_1 = require("./create-table.js");
|
|
19
19
|
Object.defineProperty(exports, "CreateTable", { enumerable: true, get: function () { return create_table_js_1.CreateTable; } });
|
|
20
20
|
var delete_item_js_1 = require("./delete-item.js");
|
|
@@ -28,4 +28,6 @@ __exportStar(require("./inputs/index.js"), exports);
|
|
|
28
28
|
__exportStar(require("./outputs/index.js"), exports);
|
|
29
29
|
var put_item_js_1 = require("./put-item.js");
|
|
30
30
|
Object.defineProperty(exports, "PutItem", { enumerable: true, get: function () { return put_item_js_1.PutItem; } });
|
|
31
|
+
var query_js_1 = require("./query.js");
|
|
32
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return query_js_1.Query; } });
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,+GAA+G;AAC/G,oDAAkC;AAClC,qDAAmC;AACnC,6CAAwC;AAA/B,sGAAA,OAAO,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,+GAA+G;AAC/G,oDAAkC;AAClC,qDAAmC;AACnC,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAChB,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.encode = encode;
|
|
4
|
-
const
|
|
5
|
-
const values_js_1 = require("../../attributes/values.js");
|
|
6
|
-
const expression_js_1 = require("../../expressions/condition/expression.js");
|
|
4
|
+
const lib_js_1 = require("./lib.js");
|
|
7
5
|
function encode(input) {
|
|
8
6
|
const result = {
|
|
9
7
|
TableName: input.table,
|
|
@@ -21,19 +19,12 @@ function encode(input) {
|
|
|
21
19
|
if (input.condition == null) {
|
|
22
20
|
return result;
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
const names = names_js_1.AttributeNames.create();
|
|
26
|
-
const values = values_js_1.AttributeValues.create();
|
|
27
|
-
// Ask the expression to stringify itself, applying the substitutions by itself.
|
|
28
|
-
const expression = (0, expression_js_1.conditionExpression)(input.condition).stringify({
|
|
29
|
-
names,
|
|
30
|
-
values,
|
|
31
|
-
});
|
|
22
|
+
const { expression, names, values } = (0, lib_js_1.intoExpressionComponents)(input.condition);
|
|
32
23
|
return {
|
|
33
24
|
...result,
|
|
34
25
|
ConditionExpression: expression,
|
|
35
|
-
ExpressionAttributeNames: names
|
|
36
|
-
ExpressionAttributeValues: values
|
|
26
|
+
ExpressionAttributeNames: names,
|
|
27
|
+
ExpressionAttributeValues: values,
|
|
37
28
|
};
|
|
38
29
|
}
|
|
39
30
|
//# sourceMappingURL=delete-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/delete-item.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"delete-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/delete-item.ts"],"names":[],"mappings":";;AAiBA,wBAgCC;AA9CD,qCAAoD;AAcpD,SAAgB,MAAM,CACpB,KAAyB;IAEzB,MAAM,MAAM,GAAuB;QACjC,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC;IAEF,IAAI,KAAK,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,EAAE,CAAC;QACtD,MAAM,CAAC,mCAAmC;YACxC,KAAK,CAAC,mCAAmC,CAAC;IAC9C,CAAC;IAED,4FAA4F;IAC5F,qBAAqB;IACrB,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAA,iCAAwB,EAC5D,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,OAAO;QACL,GAAG,MAAM;QACT,mBAAmB,EAAE,UAAU;QAC/B,wBAAwB,EAAE,KAAK;QAC/B,yBAAyB,EAAE,MAAM;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -3,3 +3,4 @@ export type { DeleteItemInput, DeleteItemReturnValue } from "./delete-item.js";
|
|
|
3
3
|
export type { DeleteTableInput } from "./delete-table.js";
|
|
4
4
|
export type { GetItemInput } from "./get-item.js";
|
|
5
5
|
export type { PutItemInput } from "./put-item.js";
|
|
6
|
+
export type { QueryInput } from "./query.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttributePath, AttributeValue } from "../../../index.js";
|
|
2
|
+
import { type PathSubstitution, type ValueSubstitution } from "../../attributes/index.js";
|
|
3
|
+
import type { ConditionParams } from "../../expressions/index.js";
|
|
4
|
+
export declare function intoExpressionComponents(condition: ConditionParams): {
|
|
5
|
+
expression: string;
|
|
6
|
+
names?: Record<PathSubstitution, AttributePath>;
|
|
7
|
+
values?: Record<ValueSubstitution, AttributeValue>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.intoExpressionComponents = intoExpressionComponents;
|
|
4
|
+
const index_js_1 = require("../../attributes/index.js");
|
|
5
|
+
const expression_js_1 = require("../../expressions/condition/expression.js");
|
|
6
|
+
function intoExpressionComponents(condition) {
|
|
7
|
+
const names = index_js_1.AttributeNames.create();
|
|
8
|
+
const values = index_js_1.AttributeValues.create();
|
|
9
|
+
const expression = (0, expression_js_1.conditionExpression)(condition).stringify({
|
|
10
|
+
names,
|
|
11
|
+
values,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
expression,
|
|
15
|
+
names: names.getSubstitutions(),
|
|
16
|
+
values: values.getSubstitutions(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/lib.ts"],"names":[],"mappings":";;AAUA,4DAgBC;AAzBD,wDAKmC;AACnC,6EAAgF;AAGhF,SAAgB,wBAAwB,CAAC,SAA0B;IAKjE,MAAM,KAAK,GAAG,yBAAc,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,0BAAe,CAAC,MAAM,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,IAAA,mCAAmB,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC;QAC1D,KAAK;QACL,MAAM;KACP,CAAC,CAAC;IACH,OAAO;QACL,UAAU;QACV,KAAK,EAAE,KAAK,CAAC,gBAAgB,EAAE;QAC/B,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.encode = encode;
|
|
4
|
-
const
|
|
5
|
-
const expression_js_1 = require("../../expressions/condition/expression.js");
|
|
4
|
+
const lib_js_1 = require("./lib.js");
|
|
6
5
|
function encode(input) {
|
|
7
6
|
const result = {
|
|
8
7
|
TableName: input.table,
|
|
@@ -20,18 +19,12 @@ function encode(input) {
|
|
|
20
19
|
if (input.condition == null) {
|
|
21
20
|
return result;
|
|
22
21
|
}
|
|
23
|
-
const names =
|
|
24
|
-
const values = index_js_1.AttributeValues.create();
|
|
25
|
-
// Ask the expression to stringify itself, applying the substitutions by itself.
|
|
26
|
-
const expression = (0, expression_js_1.conditionExpression)(input.condition).stringify({
|
|
27
|
-
names,
|
|
28
|
-
values,
|
|
29
|
-
});
|
|
22
|
+
const { expression, names, values } = (0, lib_js_1.intoExpressionComponents)(input.condition);
|
|
30
23
|
return {
|
|
31
24
|
...result,
|
|
32
25
|
ConditionExpression: expression,
|
|
33
|
-
ExpressionAttributeNames: names
|
|
34
|
-
ExpressionAttributeValues: values
|
|
26
|
+
ExpressionAttributeNames: names,
|
|
27
|
+
ExpressionAttributeValues: values,
|
|
35
28
|
};
|
|
36
29
|
}
|
|
37
30
|
//# sourceMappingURL=put-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/put-item.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"put-item.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/put-item.ts"],"names":[],"mappings":";;AAmBA,wBAiCC;AAjDD,qCAAoD;AAgBpD,SAAgB,MAAM,CACpB,KAAsB;IAEtB,MAAM,MAAM,GAAoB;QAC9B,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;IAEF,IAAI,KAAK,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,EAAE,CAAC;QACtD,MAAM,CAAC,mCAAmC;YACxC,KAAK,CAAC,mCAAmC,CAAC;IAC9C,CAAC;IAED,4FAA4F;IAC5F,qBAAqB;IACrB,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAA,iCAAwB,EAC5D,KAAK,CAAC,SAAS,CAChB,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,mBAAmB,EAAE,UAAU;QAC/B,wBAAwB,EAAE,KAAK;QAC/B,yBAAyB,EAAE,MAAM;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { KeyAttributes } from "../../../index.js";
|
|
3
|
+
import type { KeyConditionExpression } from "../../expressions/index.js";
|
|
4
|
+
export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
5
|
+
table: string;
|
|
6
|
+
index?: string;
|
|
7
|
+
condition: KeyConditionExpression;
|
|
8
|
+
consistentRead?: boolean;
|
|
9
|
+
exclusiveStartKey?: K;
|
|
10
|
+
limit?: number;
|
|
11
|
+
scanIndexForward?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function encode<K extends KeyAttributes = KeyAttributes>(input: QueryInput<K>): QueryCommandInput;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encode = encode;
|
|
4
|
+
const lib_js_1 = require("./lib.js");
|
|
5
|
+
function encode(input) {
|
|
6
|
+
const { table, index, condition, consistentRead, exclusiveStartKey, limit, scanIndexForward, } = input;
|
|
7
|
+
const { expression, names, values } = (0, lib_js_1.intoExpressionComponents)(condition);
|
|
8
|
+
return {
|
|
9
|
+
TableName: table,
|
|
10
|
+
IndexName: index,
|
|
11
|
+
ConsistentRead: consistentRead,
|
|
12
|
+
KeyConditionExpression: expression,
|
|
13
|
+
ExpressionAttributeNames: names,
|
|
14
|
+
ExpressionAttributeValues: values,
|
|
15
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
16
|
+
Limit: limit,
|
|
17
|
+
ScanIndexForward: scanIndexForward,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/query.ts"],"names":[],"mappings":";;AAeA,wBAyBC;AArCD,qCAAoD;AAYpD,SAAgB,MAAM,CACpB,KAAoB;IAEpB,MAAM,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,gBAAgB,GACjB,GAAG,KAAK,CAAC;IAEV,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAA,iCAAwB,EAAC,SAAS,CAAC,CAAC;IAC1E,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,cAAc;QAC9B,sBAAsB,EAAE,UAAU;QAClC,wBAAwB,EAAE,KAAK;QAC/B,yBAAyB,EAAE,MAAM;QACjC,iBAAiB,EAAE,iBAAiB;QACpC,KAAK,EAAE,KAAK;QACZ,gBAAgB,EAAE,gBAAgB;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -3,3 +3,4 @@ export type { DeleteItemOutput } from "./delete-item.js";
|
|
|
3
3
|
export type { DeleteTableOutput } from "./delete-table.js";
|
|
4
4
|
export type { GetItemOutput } from "./get-item.js";
|
|
5
5
|
export type { PutItemOutput } from "./put-item.js";
|
|
6
|
+
export type { QueryOutput } from "./query.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { QueryCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { Attributes, KeyAttributes } from "../../../index.js";
|
|
3
|
+
export type QueryOutput<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes> = {
|
|
4
|
+
count: number;
|
|
5
|
+
items: Array<T>;
|
|
6
|
+
scannedCount: number;
|
|
7
|
+
lastEvaluatedKey?: K;
|
|
8
|
+
};
|
|
9
|
+
export declare function decode<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes>(output: QueryCommandOutput): QueryOutput<T, K>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decode = decode;
|
|
4
|
+
const types_1 = require("@infra-blocks/types");
|
|
5
|
+
function decode(output) {
|
|
6
|
+
const items = (output.Items ?? []);
|
|
7
|
+
return (0, types_1.trusted)({
|
|
8
|
+
items,
|
|
9
|
+
lastEvaluatedKey: output.LastEvaluatedKey,
|
|
10
|
+
count: output.Count,
|
|
11
|
+
scannedCount: output.ScannedCount,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/query.ts"],"names":[],"mappings":";;AAcA,wBAWC;AAxBD,+CAA8C;AAa9C,SAAgB,MAAM,CAGpB,MAA0B;IAC1B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAa,CAAC;IAC/C,OAAO,IAAA,eAAO,EAAC;QACb,KAAK;QACL,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,YAAY,EAAE,MAAM,CAAC,YAAY;KAClC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import type { Attributes, KeyAttributes } from "../../types.js";
|
|
3
|
+
import { AbstractCommand } from "./command.js";
|
|
4
|
+
import type { QueryInput } from "./inputs/query.js";
|
|
5
|
+
import type { QueryOutput } from "./outputs/query.js";
|
|
6
|
+
export declare class Query<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes> extends AbstractCommand<QueryInput<K>, QueryOutput<T, K>, QueryCommand> {
|
|
7
|
+
constructor(input: QueryInput<K>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Query = void 0;
|
|
4
|
+
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
5
|
+
const query_js_1 = require("./codecs/query.js");
|
|
6
|
+
const command_js_1 = require("./command.js");
|
|
7
|
+
class Query extends command_js_1.AbstractCommand {
|
|
8
|
+
constructor(input) {
|
|
9
|
+
super({
|
|
10
|
+
input,
|
|
11
|
+
codec: query_js_1.QueryCodec,
|
|
12
|
+
command: lib_dynamodb_1.QueryCommand,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.Query = Query;
|
|
17
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/command/query.ts"],"names":[],"mappings":";;;AAAA,wDAAqD;AAErD,gDAA+C;AAC/C,6CAA+C;AAI/C,MAAa,KAGX,SAAQ,4BAA+D;IACvE,YAAY,KAAoB;QAC9B,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,qBAAU;YACjB,OAAO,EAAE,2BAAY;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AAXD,sBAWC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./command/index.js";
|
|
2
2
|
export * from "./expressions/index.js";
|
|
3
|
-
export type { QueryParams } from "./query.js";
|
|
4
3
|
export type { UpdateItemParams } from "./update-item.js";
|
|
5
4
|
export type { UpdateTimeToLiveParams } from "./update-time-to-live.js";
|
|
6
5
|
export type { ConditionCheckParams, WriteTransactionParams, } from "./write-transaction.js";
|
package/lib/cjs/error.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { QueryInput } from "./commands/index.js";
|
|
2
2
|
export declare class TooManyItemsException extends Error {
|
|
3
3
|
readonly operation: "queryOne";
|
|
4
4
|
readonly name: "TooManyItemsException";
|
|
5
5
|
private constructor();
|
|
6
|
-
static queryingOne(params:
|
|
6
|
+
static queryingOne(params: QueryInput): TooManyItemsException;
|
|
7
7
|
}
|
|
8
8
|
export type TransactionCanceledCheck = {
|
|
9
9
|
index: number;
|
package/lib/cjs/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";;;AAsDA,0DAUC;AAhED,8DAAwE;AACxE,+CAAsD;AAGtD,MAAa,qBAAsB,SAAQ,KAAK;IACrC,SAAS,CAAa;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