@infra-blocks/aws-dynamodb 0.63.0 → 0.64.0-alpha.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/expressions/index.d.ts +1 -0
- package/lib/cjs/commands/expressions/index.js +1 -0
- package/lib/cjs/commands/expressions/index.js.map +1 -1
- package/lib/cjs/commands/expressions/projection.d.ts +11 -0
- package/lib/cjs/commands/expressions/projection.js +19 -0
- package/lib/cjs/commands/expressions/projection.js.map +1 -0
- package/lib/cjs/commands/inputs/get-item.d.ts +5 -0
- package/lib/cjs/commands/inputs/get-item.js +14 -3
- package/lib/cjs/commands/inputs/get-item.js.map +1 -1
- package/lib/esm/commands/expressions/index.d.ts +1 -0
- package/lib/esm/commands/expressions/index.js +1 -0
- package/lib/esm/commands/expressions/index.js.map +1 -1
- package/lib/esm/commands/expressions/projection.d.ts +11 -0
- package/lib/esm/commands/expressions/projection.js +16 -0
- package/lib/esm/commands/expressions/projection.js.map +1 -0
- package/lib/esm/commands/inputs/get-item.d.ts +5 -0
- package/lib/esm/commands/inputs/get-item.js +14 -3
- package/lib/esm/commands/inputs/get-item.js.map +1 -1
- package/package.json +2 -1
|
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./condition/index.js"), exports);
|
|
18
18
|
__exportStar(require("./key-condition.js"), exports);
|
|
19
19
|
__exportStar(require("./operands/index.js"), exports);
|
|
20
|
+
__exportStar(require("./projection.js"), exports);
|
|
20
21
|
__exportStar(require("./update/index.js"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,oDAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AttributeNames } from "../attributes/names.js";
|
|
2
|
+
import { type RawPath } from "./operands/index.js";
|
|
3
|
+
export type ProjectionExpressionParams = ReadonlyArray<RawPath>;
|
|
4
|
+
export type ProjectionExpression = {
|
|
5
|
+
stringify(params: {
|
|
6
|
+
names: AttributeNames;
|
|
7
|
+
}): string;
|
|
8
|
+
};
|
|
9
|
+
export declare const ProjectionExpression: {
|
|
10
|
+
from(expressionParams: ProjectionExpressionParams): ProjectionExpression;
|
|
11
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectionExpression = void 0;
|
|
4
|
+
const index_js_1 = require("./operands/index.js");
|
|
5
|
+
exports.ProjectionExpression = {
|
|
6
|
+
from(expressionParams) {
|
|
7
|
+
return {
|
|
8
|
+
stringify(stringifyParams) {
|
|
9
|
+
const { names } = stringifyParams;
|
|
10
|
+
const substitutions = [];
|
|
11
|
+
for (const path of expressionParams) {
|
|
12
|
+
substitutions.push(index_js_1.Path.normalize(path).substitute({ names }));
|
|
13
|
+
}
|
|
14
|
+
return substitutions.join(",");
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../../src/commands/expressions/projection.ts"],"names":[],"mappings":";;;AACA,kDAAyD;AAQ5C,QAAA,oBAAoB,GAAG;IAClC,IAAI,CAAC,gBAA4C;QAC/C,OAAO;YACL,SAAS,CAAC,eAAe;gBACvB,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;gBAClC,MAAM,aAAa,GAAG,EAAE,CAAC;gBACzB,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;oBACpC,aAAa,CAAC,IAAI,CAAC,eAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACjE,CAAC;gBACD,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GetCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { KeyAttributes } from "../../types.js";
|
|
3
|
+
import { type ProjectionExpressionParams } from "../expressions/projection.js";
|
|
3
4
|
/**
|
|
4
5
|
* The input required to call the GetItem API.
|
|
5
6
|
*/
|
|
@@ -15,6 +16,10 @@ export interface GetItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
|
15
16
|
* is part of the table's primary key. No more than 2 fields are expected here.
|
|
16
17
|
*/
|
|
17
18
|
key: K;
|
|
19
|
+
/**
|
|
20
|
+
* The projection applied to the return item, if any.
|
|
21
|
+
*/
|
|
22
|
+
projection?: ProjectionExpressionParams;
|
|
18
23
|
}
|
|
19
24
|
export declare const GetItemInput: {
|
|
20
25
|
encode: typeof encode;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetItemInput = void 0;
|
|
4
|
+
const names_js_1 = require("../attributes/names.js");
|
|
5
|
+
const projection_js_1 = require("../expressions/projection.js");
|
|
4
6
|
exports.GetItemInput = {
|
|
5
7
|
encode,
|
|
6
8
|
};
|
|
7
9
|
function encode(input) {
|
|
8
|
-
const
|
|
9
|
-
return {
|
|
10
|
+
const result = {
|
|
10
11
|
TableName: input.table,
|
|
11
|
-
Key: key,
|
|
12
|
+
Key: input.key,
|
|
12
13
|
};
|
|
14
|
+
if (input.projection != null) {
|
|
15
|
+
// There should be no values.
|
|
16
|
+
const names = names_js_1.AttributeNames.create();
|
|
17
|
+
const expression = projection_js_1.ProjectionExpression.from(input.projection).stringify({
|
|
18
|
+
names,
|
|
19
|
+
});
|
|
20
|
+
result.ProjectionExpression = expression;
|
|
21
|
+
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
13
24
|
}
|
|
14
25
|
//# sourceMappingURL=get-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":";;;AAEA,qDAAwD;AACxD,gEAGsC;AAuBzB,QAAA,YAAY,GAAG;IAC1B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAsB;IAEtB,MAAM,MAAM,GAAoB;QAC9B,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC;IAEF,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC7B,6BAA6B;QAC7B,MAAM,KAAK,GAAG,yBAAc,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,oCAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC;YACvE,KAAK;SACN,CAAC,CAAC;QACH,MAAM,CAAC,oBAAoB,GAAG,UAAU,CAAC;QACzC,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/expressions/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AttributeNames } from "../attributes/names.js";
|
|
2
|
+
import { type RawPath } from "./operands/index.js";
|
|
3
|
+
export type ProjectionExpressionParams = ReadonlyArray<RawPath>;
|
|
4
|
+
export type ProjectionExpression = {
|
|
5
|
+
stringify(params: {
|
|
6
|
+
names: AttributeNames;
|
|
7
|
+
}): string;
|
|
8
|
+
};
|
|
9
|
+
export declare const ProjectionExpression: {
|
|
10
|
+
from(expressionParams: ProjectionExpressionParams): ProjectionExpression;
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Path } from "./operands/index.js";
|
|
2
|
+
export const ProjectionExpression = {
|
|
3
|
+
from(expressionParams) {
|
|
4
|
+
return {
|
|
5
|
+
stringify(stringifyParams) {
|
|
6
|
+
const { names } = stringifyParams;
|
|
7
|
+
const substitutions = [];
|
|
8
|
+
for (const path of expressionParams) {
|
|
9
|
+
substitutions.push(Path.normalize(path).substitute({ names }));
|
|
10
|
+
}
|
|
11
|
+
return substitutions.join(",");
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../../src/commands/expressions/projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAgB,MAAM,qBAAqB,CAAC;AAQzD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,CAAC,gBAA4C;QAC/C,OAAO;YACL,SAAS,CAAC,eAAe;gBACvB,MAAM,EAAE,KAAK,EAAE,GAAG,eAAe,CAAC;gBAClC,MAAM,aAAa,GAAG,EAAE,CAAC;gBACzB,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;oBACpC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBACjE,CAAC;gBACD,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjC,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GetCommandInput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
import type { KeyAttributes } from "../../types.js";
|
|
3
|
+
import { type ProjectionExpressionParams } from "../expressions/projection.js";
|
|
3
4
|
/**
|
|
4
5
|
* The input required to call the GetItem API.
|
|
5
6
|
*/
|
|
@@ -15,6 +16,10 @@ export interface GetItemInput<K extends KeyAttributes = KeyAttributes> {
|
|
|
15
16
|
* is part of the table's primary key. No more than 2 fields are expected here.
|
|
16
17
|
*/
|
|
17
18
|
key: K;
|
|
19
|
+
/**
|
|
20
|
+
* The projection applied to the return item, if any.
|
|
21
|
+
*/
|
|
22
|
+
projection?: ProjectionExpressionParams;
|
|
18
23
|
}
|
|
19
24
|
export declare const GetItemInput: {
|
|
20
25
|
encode: typeof encode;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
import { AttributeNames } from "../attributes/names.js";
|
|
2
|
+
import { ProjectionExpression, } from "../expressions/projection.js";
|
|
1
3
|
export const GetItemInput = {
|
|
2
4
|
encode,
|
|
3
5
|
};
|
|
4
6
|
function encode(input) {
|
|
5
|
-
const
|
|
6
|
-
return {
|
|
7
|
+
const result = {
|
|
7
8
|
TableName: input.table,
|
|
8
|
-
Key: key,
|
|
9
|
+
Key: input.key,
|
|
9
10
|
};
|
|
11
|
+
if (input.projection != null) {
|
|
12
|
+
// There should be no values.
|
|
13
|
+
const names = AttributeNames.create();
|
|
14
|
+
const expression = ProjectionExpression.from(input.projection).stringify({
|
|
15
|
+
names,
|
|
16
|
+
});
|
|
17
|
+
result.ProjectionExpression = expression;
|
|
18
|
+
result.ExpressionAttributeNames = names.getSubstitutions();
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
10
21
|
}
|
|
11
22
|
//# sourceMappingURL=get-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-item.js","sourceRoot":"","sources":["../../../../src/commands/inputs/get-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,oBAAoB,GAErB,MAAM,8BAA8B,CAAC;AAuBtC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;CACP,CAAC;AAEF,SAAS,MAAM,CACb,KAAsB;IAEtB,MAAM,MAAM,GAAoB;QAC9B,SAAS,EAAE,KAAK,CAAC,KAAK;QACtB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC;IAEF,IAAI,KAAK,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC7B,6BAA6B;QAC7B,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC;YACvE,KAAK;SACN,CAAC,CAAC;QACH,MAAM,CAAC,oBAAoB,GAAG,UAAU,CAAC;QACzC,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/aws-dynamodb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0-alpha.0",
|
|
4
4
|
"description": "A convenience wrapper over @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"test:unit": "mocha --config test/unit/.mocharc.cjs 'test/unit/**/*.spec.ts'"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
+
"@aws-sdk/util-dynamodb": "^3.995.0",
|
|
44
45
|
"@biomejs/biome": "^2.1.2",
|
|
45
46
|
"@infra-blocks/iter": "^0.2.7",
|
|
46
47
|
"@infra-blocks/node-console-logger": "^0.3.1",
|