@infra-blocks/aws-dynamodb 0.74.0 → 0.75.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/commands/inputs/query.d.ts +2 -0
- package/lib/cjs/commands/inputs/query.js +12 -14
- package/lib/cjs/commands/inputs/query.js.map +1 -1
- package/lib/cjs/commands/outputs/query.d.ts +2 -0
- package/lib/cjs/commands/outputs/query.js +2 -0
- package/lib/cjs/commands/outputs/query.js.map +1 -1
- package/lib/esm/commands/inputs/query.d.ts +2 -0
- package/lib/esm/commands/inputs/query.js +11 -13
- package/lib/esm/commands/inputs/query.js.map +1 -1
- package/lib/esm/commands/outputs/query.d.ts +2 -0
- package/lib/esm/commands/outputs/query.js +2 -0
- package/lib/esm/commands/outputs/query.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { KeyAttributes } from "../../types.js";
|
|
3
3
|
import { type FilterInput, type KeyConditionInput, type ProjectionInput } from "../expressions/index.js";
|
|
4
|
+
import { type ConsumedCapacityReturnValue } from "./lib.js";
|
|
4
5
|
export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
5
6
|
table: string;
|
|
6
7
|
keyCondition: KeyConditionInput;
|
|
@@ -10,6 +11,7 @@ export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
|
10
11
|
index?: string;
|
|
11
12
|
limit?: number;
|
|
12
13
|
projection?: ProjectionInput;
|
|
14
|
+
returnConsumedCapacity?: ConsumedCapacityReturnValue;
|
|
13
15
|
scanIndexForward?: boolean;
|
|
14
16
|
};
|
|
15
17
|
export declare const QueryInput: {
|
|
@@ -2,29 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryInput = void 0;
|
|
4
4
|
const index_js_1 = require("../expressions/index.js");
|
|
5
|
-
const lib_js_1 = require("
|
|
5
|
+
const lib_js_1 = require("../lib.js");
|
|
6
|
+
const lib_js_2 = require("./lib.js");
|
|
6
7
|
exports.QueryInput = {
|
|
7
8
|
encode,
|
|
8
9
|
};
|
|
9
10
|
function encode(input) {
|
|
10
|
-
const formatter =
|
|
11
|
-
|
|
11
|
+
const formatter = lib_js_2.ExpressionsFormatter.create();
|
|
12
|
+
return (0, lib_js_1.unsetUndefined)({
|
|
12
13
|
TableName: input.table,
|
|
13
14
|
IndexName: input.index,
|
|
14
|
-
KeyConditionExpression: formatter.format(index_js_1.KeyCondition.from(input.keyCondition)),
|
|
15
15
|
ConsistentRead: input.consistentRead,
|
|
16
16
|
ExclusiveStartKey: input.exclusiveStartKey,
|
|
17
17
|
Limit: input.limit,
|
|
18
|
+
ReturnConsumedCapacity: input.returnConsumedCapacity,
|
|
18
19
|
ScanIndexForward: input.scanIndexForward,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
result.ExpressionAttributeNames = formatter.getExpressionAttributeNames();
|
|
27
|
-
result.ExpressionAttributeValues = formatter.getExpressionAttributeValues();
|
|
28
|
-
return result;
|
|
20
|
+
// Expressions
|
|
21
|
+
KeyConditionExpression: formatter.format(index_js_1.KeyCondition.from(input.keyCondition)),
|
|
22
|
+
FilterExpression: (0, lib_js_1.ifDefined)(input.filter, (v) => formatter.format(index_js_1.Filter.from(v))),
|
|
23
|
+
ProjectionExpression: (0, lib_js_1.ifDefined)(input.projection, (v) => formatter.format(index_js_1.Projection.from(v))),
|
|
24
|
+
ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
|
|
25
|
+
ExpressionAttributeValues: formatter.getExpressionAttributeValues(),
|
|
26
|
+
});
|
|
29
27
|
}
|
|
30
28
|
//# sourceMappingURL=query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/inputs/query.ts"],"names":[],"mappings":";;;AAEA,sDAOiC;AACjC,
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/inputs/query.ts"],"names":[],"mappings":";;;AAEA,sDAOiC;AACjC,sCAAsD;AACtD,qCAGkB;AAeL,QAAA,UAAU,GAAG;IACxB,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAoB;IAEpB,MAAM,SAAS,GAAG,6BAAoB,CAAC,MAAM,EAAE,CAAC;IAChD,OAAO,IAAA,uBAAc,EAAC;QACpB,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;QACpD,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,cAAc;QACd,sBAAsB,EAAE,SAAS,CAAC,MAAM,CACtC,uBAAY,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CACtC;QACD,gBAAgB,EAAE,IAAA,kBAAS,EAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAC9C,SAAS,CAAC,MAAM,CAAC,iBAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACjC;QACD,oBAAoB,EAAE,IAAA,kBAAS,EAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CACtD,SAAS,CAAC,MAAM,CAAC,qBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACrC;QACD,wBAAwB,EAAE,SAAS,CAAC,2BAA2B,EAAE;QACjE,yBAAyB,EAAE,SAAS,CAAC,4BAA4B,EAAE;KACpE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { QueryCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes, KeyAttributes } from "../../index.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export type QueryOutput<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes> = {
|
|
4
5
|
count: number;
|
|
5
6
|
items: Array<T>;
|
|
6
7
|
scannedCount: number;
|
|
7
8
|
lastEvaluatedKey?: K;
|
|
9
|
+
consumedCapacity?: ConsumedCapacity;
|
|
8
10
|
};
|
|
9
11
|
export declare const QueryOutput: {
|
|
10
12
|
decode: typeof decode;
|
|
@@ -4,6 +4,7 @@ exports.QueryOutput = void 0;
|
|
|
4
4
|
const checks_1 = require("@infra-blocks/checks");
|
|
5
5
|
const types_1 = require("@infra-blocks/types");
|
|
6
6
|
const lib_js_1 = require("../lib.js");
|
|
7
|
+
const consumed_capacity_js_1 = require("./consumed-capacity.js");
|
|
7
8
|
exports.QueryOutput = {
|
|
8
9
|
decode,
|
|
9
10
|
};
|
|
@@ -12,6 +13,7 @@ function decode(output) {
|
|
|
12
13
|
count: (0, checks_1.checkNotNull)(output.Count),
|
|
13
14
|
items: (output.Items ?? []),
|
|
14
15
|
scannedCount: (0, checks_1.checkNotNull)(output.ScannedCount),
|
|
16
|
+
consumedCapacity: (0, lib_js_1.ifDefined)(output.ConsumedCapacity, consumed_capacity_js_1.ConsumedCapacity.decode),
|
|
15
17
|
lastEvaluatedKey: (0, lib_js_1.ifDefined)(output.LastEvaluatedKey, (types_1.trusted)),
|
|
16
18
|
});
|
|
17
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/outputs/query.ts"],"names":[],"mappings":";;;AACA,iDAAoD;AACpD,+CAA8C;AAE9C,sCAAsD;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/outputs/query.ts"],"names":[],"mappings":";;;AACA,iDAAoD;AACpD,+CAA8C;AAE9C,sCAAsD;AACtD,iEAA0D;AAa7C,QAAA,WAAW,GAAG;IACzB,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CAGb,MAA0B;IAC1B,OAAO,IAAA,uBAAc,EAAC;QACpB,KAAK,EAAE,IAAA,qBAAY,EAAC,MAAM,CAAC,KAAK,CAAC;QACjC,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAa;QACvC,YAAY,EAAE,IAAA,qBAAY,EAAC,MAAM,CAAC,YAAY,CAAC;QAC/C,gBAAgB,EAAE,IAAA,kBAAS,EACzB,MAAM,CAAC,gBAAgB,EACvB,uCAAgB,CAAC,MAAM,CACxB;QACD,gBAAgB,EAAE,IAAA,kBAAS,EAAC,MAAM,CAAC,gBAAgB,EAAE,CAAA,eAAU,CAAA,CAAC;KACjE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { QueryCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { KeyAttributes } from "../../types.js";
|
|
3
3
|
import { type FilterInput, type KeyConditionInput, type ProjectionInput } from "../expressions/index.js";
|
|
4
|
+
import { type ConsumedCapacityReturnValue } from "./lib.js";
|
|
4
5
|
export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
5
6
|
table: string;
|
|
6
7
|
keyCondition: KeyConditionInput;
|
|
@@ -10,6 +11,7 @@ export type QueryInput<K extends KeyAttributes = KeyAttributes> = {
|
|
|
10
11
|
index?: string;
|
|
11
12
|
limit?: number;
|
|
12
13
|
projection?: ProjectionInput;
|
|
14
|
+
returnConsumedCapacity?: ConsumedCapacityReturnValue;
|
|
13
15
|
scanIndexForward?: boolean;
|
|
14
16
|
};
|
|
15
17
|
export declare const QueryInput: {
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { Filter, KeyCondition, Projection, } from "../expressions/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ifDefined, unsetUndefined } from "../lib.js";
|
|
3
|
+
import { ExpressionsFormatter, } from "./lib.js";
|
|
3
4
|
export const QueryInput = {
|
|
4
5
|
encode,
|
|
5
6
|
};
|
|
6
7
|
function encode(input) {
|
|
7
8
|
const formatter = ExpressionsFormatter.create();
|
|
8
|
-
|
|
9
|
+
return unsetUndefined({
|
|
9
10
|
TableName: input.table,
|
|
10
11
|
IndexName: input.index,
|
|
11
|
-
KeyConditionExpression: formatter.format(KeyCondition.from(input.keyCondition)),
|
|
12
12
|
ConsistentRead: input.consistentRead,
|
|
13
13
|
ExclusiveStartKey: input.exclusiveStartKey,
|
|
14
14
|
Limit: input.limit,
|
|
15
|
+
ReturnConsumedCapacity: input.returnConsumedCapacity,
|
|
15
16
|
ScanIndexForward: input.scanIndexForward,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
result.ExpressionAttributeNames = formatter.getExpressionAttributeNames();
|
|
24
|
-
result.ExpressionAttributeValues = formatter.getExpressionAttributeValues();
|
|
25
|
-
return result;
|
|
17
|
+
// Expressions
|
|
18
|
+
KeyConditionExpression: formatter.format(KeyCondition.from(input.keyCondition)),
|
|
19
|
+
FilterExpression: ifDefined(input.filter, (v) => formatter.format(Filter.from(v))),
|
|
20
|
+
ProjectionExpression: ifDefined(input.projection, (v) => formatter.format(Projection.from(v))),
|
|
21
|
+
ExpressionAttributeNames: formatter.getExpressionAttributeNames(),
|
|
22
|
+
ExpressionAttributeValues: formatter.getExpressionAttributeValues(),
|
|
23
|
+
});
|
|
26
24
|
}
|
|
27
25
|
//# sourceMappingURL=query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/inputs/query.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EAEN,YAAY,EAEZ,UAAU,GAEX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,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"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { QueryCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { Attributes, KeyAttributes } from "../../index.js";
|
|
3
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
3
4
|
export type QueryOutput<T extends Attributes = Attributes, K extends KeyAttributes = KeyAttributes> = {
|
|
4
5
|
count: number;
|
|
5
6
|
items: Array<T>;
|
|
6
7
|
scannedCount: number;
|
|
7
8
|
lastEvaluatedKey?: K;
|
|
9
|
+
consumedCapacity?: ConsumedCapacity;
|
|
8
10
|
};
|
|
9
11
|
export declare const QueryOutput: {
|
|
10
12
|
decode: typeof decode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { checkNotNull } from "@infra-blocks/checks";
|
|
2
2
|
import { trusted } from "@infra-blocks/types";
|
|
3
3
|
import { ifDefined, unsetUndefined } from "../lib.js";
|
|
4
|
+
import { ConsumedCapacity } from "./consumed-capacity.js";
|
|
4
5
|
export const QueryOutput = {
|
|
5
6
|
decode,
|
|
6
7
|
};
|
|
@@ -9,6 +10,7 @@ function decode(output) {
|
|
|
9
10
|
count: checkNotNull(output.Count),
|
|
10
11
|
items: (output.Items ?? []),
|
|
11
12
|
scannedCount: checkNotNull(output.ScannedCount),
|
|
13
|
+
consumedCapacity: ifDefined(output.ConsumedCapacity, ConsumedCapacity.decode),
|
|
12
14
|
lastEvaluatedKey: ifDefined(output.LastEvaluatedKey, (trusted)),
|
|
13
15
|
});
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/outputs/query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/commands/outputs/query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAa1D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CAGb,MAA0B;IAC1B,OAAO,cAAc,CAAC;QACpB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC;QACjC,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAa;QACvC,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC;QAC/C,gBAAgB,EAAE,SAAS,CACzB,MAAM,CAAC,gBAAgB,EACvB,gBAAgB,CAAC,MAAM,CACxB;QACD,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAA,OAAU,CAAA,CAAC;KACjE,CAAC,CAAC;AACL,CAAC"}
|