@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/esm/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/esm/client.js
CHANGED
|
@@ -3,8 +3,7 @@ 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 { CreateTable, DeleteItem, DeleteTable, GetItem, PutItem, } from "./commands/index.js";
|
|
7
|
-
import { Query } from "./commands/query.js";
|
|
6
|
+
import { CreateTable, DeleteItem, DeleteTable, GetItem, PutItem, Query, } from "./commands/index.js";
|
|
8
7
|
import { UpdateItem } from "./commands/update-item.js";
|
|
9
8
|
import { UpdateTimeToLive, } from "./commands/update-time-to-live.js";
|
|
10
9
|
import { WriteTransaction, } from "./commands/write-transaction.js";
|
|
@@ -93,24 +92,25 @@ export class DynamoDbClient {
|
|
|
93
92
|
}
|
|
94
93
|
return this.send(new PutItem(params));
|
|
95
94
|
}
|
|
95
|
+
// TODO: make an IterateQuery command/ free floating function function?
|
|
96
96
|
/**
|
|
97
97
|
* Iterates the items produced querying a table, or an index, using the Query API.
|
|
98
98
|
*
|
|
99
99
|
* It uses {@link paginateQuery} to handle pagination automatically, and yields
|
|
100
100
|
* every item produced by every page.
|
|
101
101
|
*
|
|
102
|
-
* @param
|
|
102
|
+
* @param input - The parameters to use to query the table or index.
|
|
103
103
|
*
|
|
104
104
|
* @returns An async generator that yields items matching the query, one
|
|
105
105
|
* at a time, and that handles pagination automatically.
|
|
106
106
|
*
|
|
107
107
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
108
108
|
*/
|
|
109
|
-
async *iterateQuery(
|
|
109
|
+
async *iterateQuery(input) {
|
|
110
110
|
if (this.logger.isDebugEnabled()) {
|
|
111
|
-
this.logger.debug("iterateQuery(%s)", JSON.stringify(
|
|
111
|
+
this.logger.debug("iterateQuery(%s)", JSON.stringify(input));
|
|
112
112
|
}
|
|
113
|
-
for await (const page of this.paginateQuery(
|
|
113
|
+
for await (const page of this.paginateQuery(input)) {
|
|
114
114
|
for (const item of page.items) {
|
|
115
115
|
yield item;
|
|
116
116
|
}
|
|
@@ -122,22 +122,22 @@ export class DynamoDbClient {
|
|
|
122
122
|
* It uses {@link query} to produce pages, and yields them one after the other
|
|
123
123
|
* through the generator.
|
|
124
124
|
*
|
|
125
|
-
* @param
|
|
125
|
+
* @param input - The parameters to use to query the table or index.
|
|
126
126
|
*
|
|
127
127
|
* @returns An async generator that yields items matching the query, one
|
|
128
128
|
* at a time, and that handles pagination automatically.
|
|
129
129
|
*
|
|
130
130
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
131
131
|
*/
|
|
132
|
-
async *paginateQuery(
|
|
132
|
+
async *paginateQuery(input) {
|
|
133
133
|
if (this.logger.isDebugEnabled()) {
|
|
134
|
-
this.logger.debug("paginateQuery(%s)", JSON.stringify(
|
|
134
|
+
this.logger.debug("paginateQuery(%s)", JSON.stringify(input));
|
|
135
135
|
}
|
|
136
|
-
let page = await this.query(
|
|
136
|
+
let page = await this.query(input);
|
|
137
137
|
yield page;
|
|
138
138
|
while (page.lastEvaluatedKey != null) {
|
|
139
139
|
page = await this.query({
|
|
140
|
-
...
|
|
140
|
+
...input,
|
|
141
141
|
exclusiveStartKey: page.lastEvaluatedKey,
|
|
142
142
|
});
|
|
143
143
|
yield page;
|
|
@@ -147,21 +147,21 @@ export class DynamoDbClient {
|
|
|
147
147
|
* Queries a table, or an index, using the Query API.
|
|
148
148
|
*
|
|
149
149
|
* It produces a single page of results, which may or may not contain all the
|
|
150
|
-
* items of the query. If the result is incomplete, the {@link
|
|
151
|
-
* will be set, and should be used in a follow up query as the {@link
|
|
150
|
+
* items of the query. If the result is incomplete, the {@link QueryOutput.lastEvaluatedKey}
|
|
151
|
+
* will be set, and should be used in a follow up query as the {@link QueryOutput.exclusiveStartKey}.
|
|
152
152
|
*
|
|
153
|
-
* @param
|
|
153
|
+
* @param input - The parameters to use to query the table or index.
|
|
154
154
|
*
|
|
155
155
|
* @returns An async generator that yields items matching the query, one
|
|
156
156
|
* at a time, and that handles pagination automatically.
|
|
157
157
|
*
|
|
158
158
|
* @see https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
|
159
159
|
*/
|
|
160
|
-
query(
|
|
160
|
+
query(input) {
|
|
161
161
|
if (this.logger.isDebugEnabled()) {
|
|
162
|
-
this.logger.debug("query(%s)", JSON.stringify(
|
|
162
|
+
this.logger.debug("query(%s)", JSON.stringify(input));
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return this.send(new Query(input));
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* Convenience method over the {@link query} method enforcing that the query
|
|
@@ -176,16 +176,16 @@ export class DynamoDbClient {
|
|
|
176
176
|
* to be unique, unlike `getItem` for the table. It can also be useful in the case where
|
|
177
177
|
* the sort key of an item is unknown, expected to match a {@link KeyConditionExpression} uniquely.
|
|
178
178
|
*
|
|
179
|
-
* @param
|
|
179
|
+
* @param input - The parameters to use to query the table or index.
|
|
180
180
|
*
|
|
181
181
|
* @returns The only item matching the query, or `undefined` if no item matches.
|
|
182
182
|
*/
|
|
183
|
-
async queryOne(
|
|
183
|
+
async queryOne(input) {
|
|
184
184
|
let item;
|
|
185
185
|
// TODO: page of only 2 items, remove limit from parameters.
|
|
186
|
-
for await (const queryItem of this.iterateQuery(
|
|
186
|
+
for await (const queryItem of this.iterateQuery(input)) {
|
|
187
187
|
if (item != null) {
|
|
188
|
-
throw TooManyItemsException.queryingOne(
|
|
188
|
+
throw TooManyItemsException.queryingOne(input);
|
|
189
189
|
}
|
|
190
190
|
item = queryItem;
|
|
191
191
|
}
|
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;AAG9C,OAAO,EACL,WAAW,EAGX,UAAU,EAGV,WAAW,EAGX,OAAO,EAGP,OAAO,
|
|
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;AAG9C,OAAO,EACL,WAAW,EAGX,UAAU,EAGV,WAAW,EAGX,OAAO,EAGP,OAAO,EAGP,KAAK,GAGN,MAAM,qBAAqB,CAAC;AAC7B,OAA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AAC;QACjE,OAAO,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/command/codecs/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM;IACN,MAAM;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"];
|
|
@@ -2,7 +2,7 @@
|
|
|
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 { trusted } from "@infra-blocks/types";
|
|
8
8
|
// Not exported.
|
|
@@ -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,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA0B9C,gBAAgB;AAChB,MAAM,OAAgB,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,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,+GAA+G;AAC/G,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/command/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,+GAA+G;AAC/G,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AttributeValues } from "../../attributes/values.js";
|
|
3
|
-
import { conditionExpression } from "../../expressions/condition/expression.js";
|
|
1
|
+
import { intoExpressionComponents } from "./lib.js";
|
|
4
2
|
export function encode(input) {
|
|
5
3
|
const result = {
|
|
6
4
|
TableName: input.table,
|
|
@@ -18,19 +16,12 @@ export function encode(input) {
|
|
|
18
16
|
if (input.condition == null) {
|
|
19
17
|
return result;
|
|
20
18
|
}
|
|
21
|
-
|
|
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
|
-
});
|
|
19
|
+
const { expression, names, values } = intoExpressionComponents(input.condition);
|
|
29
20
|
return {
|
|
30
21
|
...result,
|
|
31
22
|
ConditionExpression: expression,
|
|
32
|
-
ExpressionAttributeNames: names
|
|
33
|
-
ExpressionAttributeValues: values
|
|
23
|
+
ExpressionAttributeNames: names,
|
|
24
|
+
ExpressionAttributeValues: values,
|
|
34
25
|
};
|
|
35
26
|
}
|
|
36
27
|
//# 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":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAcpD,MAAM,UAAU,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,wBAAwB,CAC5D,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,16 @@
|
|
|
1
|
+
import { AttributeNames, AttributeValues, } from "../../attributes/index.js";
|
|
2
|
+
import { conditionExpression } from "../../expressions/condition/expression.js";
|
|
3
|
+
export function intoExpressionComponents(condition) {
|
|
4
|
+
const names = AttributeNames.create();
|
|
5
|
+
const values = AttributeValues.create();
|
|
6
|
+
const expression = conditionExpression(condition).stringify({
|
|
7
|
+
names,
|
|
8
|
+
values,
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
expression,
|
|
12
|
+
names: names.getSubstitutions(),
|
|
13
|
+
values: values.getSubstitutions(),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/lib.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,GAGhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,MAAM,UAAU,wBAAwB,CAAC,SAA0B;IAKjE,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,mBAAmB,CAAC,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,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { conditionExpression } from "../../expressions/condition/expression.js";
|
|
1
|
+
import { intoExpressionComponents } from "./lib.js";
|
|
3
2
|
export function encode(input) {
|
|
4
3
|
const result = {
|
|
5
4
|
TableName: input.table,
|
|
@@ -17,18 +16,12 @@ export function encode(input) {
|
|
|
17
16
|
if (input.condition == null) {
|
|
18
17
|
return result;
|
|
19
18
|
}
|
|
20
|
-
const names =
|
|
21
|
-
const values = AttributeValues.create();
|
|
22
|
-
// Ask the expression to stringify itself, applying the substitutions by itself.
|
|
23
|
-
const expression = conditionExpression(input.condition).stringify({
|
|
24
|
-
names,
|
|
25
|
-
values,
|
|
26
|
-
});
|
|
19
|
+
const { expression, names, values } = intoExpressionComponents(input.condition);
|
|
27
20
|
return {
|
|
28
21
|
...result,
|
|
29
22
|
ConditionExpression: expression,
|
|
30
|
-
ExpressionAttributeNames: names
|
|
31
|
-
ExpressionAttributeValues: values
|
|
23
|
+
ExpressionAttributeNames: names,
|
|
24
|
+
ExpressionAttributeValues: values,
|
|
32
25
|
};
|
|
33
26
|
}
|
|
34
27
|
//# 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":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAgBpD,MAAM,UAAU,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,wBAAwB,CAC5D,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,17 @@
|
|
|
1
|
+
import { intoExpressionComponents } from "./lib.js";
|
|
2
|
+
export function encode(input) {
|
|
3
|
+
const { table, index, condition, consistentRead, exclusiveStartKey, limit, scanIndexForward, } = input;
|
|
4
|
+
const { expression, names, values } = intoExpressionComponents(condition);
|
|
5
|
+
return {
|
|
6
|
+
TableName: table,
|
|
7
|
+
IndexName: index,
|
|
8
|
+
ConsistentRead: consistentRead,
|
|
9
|
+
KeyConditionExpression: expression,
|
|
10
|
+
ExpressionAttributeNames: names,
|
|
11
|
+
ExpressionAttributeValues: values,
|
|
12
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
13
|
+
Limit: limit,
|
|
14
|
+
ScanIndexForward: scanIndexForward,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/command/inputs/query.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAYpD,MAAM,UAAU,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,wBAAwB,CAAC,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,11 @@
|
|
|
1
|
+
import { trusted } from "@infra-blocks/types";
|
|
2
|
+
export function decode(output) {
|
|
3
|
+
const items = (output.Items ?? []);
|
|
4
|
+
return trusted({
|
|
5
|
+
items,
|
|
6
|
+
lastEvaluatedKey: output.LastEvaluatedKey,
|
|
7
|
+
count: output.Count,
|
|
8
|
+
scannedCount: output.ScannedCount,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../../src/commands/command/outputs/query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAa9C,MAAM,UAAU,MAAM,CAGpB,MAA0B;IAC1B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAa,CAAC;IAC/C,OAAO,OAAO,CAAC;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,13 @@
|
|
|
1
|
+
import { QueryCommand } from "@aws-sdk/lib-dynamodb";
|
|
2
|
+
import { QueryCodec } from "./codecs/query.js";
|
|
3
|
+
import { AbstractCommand } from "./command.js";
|
|
4
|
+
export class Query extends AbstractCommand {
|
|
5
|
+
constructor(input) {
|
|
6
|
+
super({
|
|
7
|
+
input,
|
|
8
|
+
codec: QueryCodec,
|
|
9
|
+
command: QueryCommand,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/command/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,MAAM,OAAO,KAGX,SAAQ,eAA+D;IACvE,YAAY,KAAoB;QAC9B,KAAK,CAAC;YACJ,KAAK;YACL,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,YAAY;SACtB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -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/esm/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/esm/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,SAAS,CAAa;IACtB,IAAI,CAA0B;IAEvC,YAAoB,OAAe;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,SAAS,CAAa;IACtB,IAAI,CAA0B;IAEvC,YAAoB,OAAe;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAAkB;QACnC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAEhC,OAAO,IAAI,qBAAqB,CAC9B,8CAA8C,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CACjF,CAAC;IACJ,CAAC;CACF;AAWD,MAAM,CAAC,MAAM,sBAAsB,GAAoC;IACrE,OAAO,CAAC,KAAa;QACnB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;IACnD,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAAY,EACZ,MAAgC;IAEhC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC/B,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;IAC5E,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;AACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
2
|
-
import { QueryCommand, type QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
3
|
-
import type { Attributes, KeyAttributes } from "../types.js";
|
|
4
|
-
import type { KeyConditionExpression } from "./expressions/key-condition.js";
|
|
5
|
-
import type { Command } from "./types.js";
|
|
6
|
-
export type QueryParams<K extends KeyAttributes = KeyAttributes> = {
|
|
7
|
-
table: string;
|
|
8
|
-
index?: string;
|
|
9
|
-
condition: KeyConditionExpression;
|
|
10
|
-
consistentRead?: boolean;
|
|
11
|
-
exclusiveStartKey?: K;
|
|
12
|
-
limit?: number;
|
|
13
|
-
scanIndexForward?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export type QueryResult<K extends KeyAttributes, T extends Attributes> = {
|
|
16
|
-
count: number;
|
|
17
|
-
items: Array<T>;
|
|
18
|
-
scannedCount: number;
|
|
19
|
-
lastEvaluatedKey?: K;
|
|
20
|
-
};
|
|
21
|
-
export declare class Query<K extends KeyAttributes> implements Command<QueryCommandInput, QueryCommand> {
|
|
22
|
-
private readonly params;
|
|
23
|
-
private constructor();
|
|
24
|
-
toAwsCommandInput(): QueryCommandInput;
|
|
25
|
-
toAwsCommand(): QueryCommand;
|
|
26
|
-
private transformResult;
|
|
27
|
-
execute<T extends Attributes>(params: {
|
|
28
|
-
client: DynamoDBClient;
|
|
29
|
-
}): Promise<QueryResult<K, T>>;
|
|
30
|
-
static from<K extends KeyAttributes>(params: QueryParams<K>): Query<K>;
|
|
31
|
-
}
|