@kensio/yulin 1.21.12 → 1.21.14
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/dist/service/dynamodb/command/authorize/sim-dynamodb-attributes.d.ts +27 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-attributes.js +35 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.d.ts +2 -1
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.js +10 -4
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-leading-keys.d.ts +33 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-leading-keys.js +45 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-reached.d.ts +17 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-reached.js +11 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-get-item.js +5 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-read-limit.d.ts +6 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-read-limit.js +16 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-reads.d.ts +2 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-reads.js +14 -22
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-tables.d.ts +10 -2
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-tables.js +1 -1
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-write-item.js +11 -1
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-write.d.ts +6 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-write.js +8 -8
- package/dist/service/dynamodb/command/item/sim-dynamodb-condition-check.d.ts +5 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-condition-check.js +9 -2
- package/dist/service/dynamodb/command/item/sim-dynamodb-delete-item.js +8 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-get-item.js +10 -2
- package/dist/service/dynamodb/command/item/sim-dynamodb-put-item.js +6 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-expressions.d.ts +2 -0
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-expressions.js +1 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-item.js +8 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-plan.d.ts +8 -6
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-plan.js +14 -13
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-touched.d.ts +10 -0
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-touched.js +16 -0
- package/dist/service/dynamodb/command/query/sim-dynamodb-query-expressions.d.ts +2 -0
- package/dist/service/dynamodb/command/query/sim-dynamodb-query-expressions.js +6 -1
- package/dist/service/dynamodb/command/query/sim-dynamodb-query.js +9 -1
- package/dist/service/dynamodb/command/scan/sim-dynamodb-scan-expressions.d.ts +2 -0
- package/dist/service/dynamodb/command/scan/sim-dynamodb-scan-expressions.js +2 -2
- package/dist/service/dynamodb/command/scan/sim-dynamodb-scan.js +1 -1
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-access.d.ts +16 -6
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-access.js +18 -8
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-reach.d.ts +25 -0
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-reach.js +27 -0
- package/dist/service/dynamodb/command/transact/sim-dynamodb-transact-gets.js +1 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-expression.d.ts +9 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-expression.js +2 -2
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-grammar.js +1 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-operand-parser.d.ts +3 -2
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-operand-parser.js +3 -3
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-parser.d.ts +2 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-parser.js +1 -1
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-expression.js +1 -1
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-operands.d.ts +3 -2
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-operands.js +8 -6
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-parser.d.ts +2 -1
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-parser.js +1 -1
- package/dist/service/dynamodb/expression/projection/sim-dynamodb-projection-expression.d.ts +9 -1
- package/dist/service/dynamodb/expression/projection/sim-dynamodb-projection-expression.js +5 -5
- package/dist/service/dynamodb/expression/sim-dynamodb-document-path-parser.d.ts +3 -3
- package/dist/service/dynamodb/expression/sim-dynamodb-document-path-parser.js +8 -4
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-attributes.d.ts +33 -0
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-attributes.js +40 -0
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-parameters.d.ts +6 -0
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-parameters.js +7 -0
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-clause.d.ts +3 -3
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-clause.js +3 -3
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-expression.js +1 -1
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-operand-parser.d.ts +3 -2
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-operand-parser.js +3 -3
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-parser.d.ts +2 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-all-values-string-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-all-values-string-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-any-value-string-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-any-value-string-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-scalar-string-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-scalar-string-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/null/sim-iam-null.d.ts +23 -0
- package/dist/service/iam/authorize/match/condition/null/sim-iam-null.js +59 -0
- package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.js +6 -1
- package/dist/service/iam/authorize/match/condition/sim-iam-condition-operator-parser.js +2 -0
- package/dist/service/iam/authorize/match/condition/sim-iam-condition-operator.d.ts +9 -2
- package/dist/service/iam/authorize/match/condition/sim-iam-policy-condition-matcher.js +1 -1
- package/dist/service/iam/authorize/match/condition/string/all-values/sim-iam-for-all-values-string-condition-operator.d.ts +8 -1
- package/dist/service/iam/authorize/match/condition/string/all-values/sim-iam-for-all-values-string-condition-operator.js +10 -1
- package/dist/service/iam/authorize/match/condition/string/any-value/sim-iam-for-any-value-string-condition-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/string/any-value/sim-iam-for-any-value-string-condition-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/string/sim-iam-scalar-string-condition-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/string/sim-iam-scalar-string-condition-operator.js +6 -1
- package/docs/services/dynamodb/README.md +127 -0
- package/docs/services/iam/README.md +23 -3
- package/package.json +2 -2
|
@@ -19,12 +19,12 @@ export function readSimDynamoDbProjection(request) {
|
|
|
19
19
|
const expression = request.ProjectionExpression;
|
|
20
20
|
if (expression === undefined) {
|
|
21
21
|
SimDynamoDbExpressionParameters.assertNoneWithout(request);
|
|
22
|
-
return undefined;
|
|
22
|
+
return { projection: undefined, attributes: [] };
|
|
23
23
|
}
|
|
24
24
|
const parameters = new SimDynamoDbExpressionParameters(request);
|
|
25
25
|
const projection = parseSimDynamoDbProjection(expression, parameters);
|
|
26
26
|
parameters.assertAllUsed();
|
|
27
|
-
return projection;
|
|
27
|
+
return { projection, attributes: parameters.attributes.topLevel };
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Read one ProjectionExpression against placeholders that have already been
|
|
@@ -35,16 +35,16 @@ export function readSimDynamoDbProjection(request) {
|
|
|
35
35
|
* placeholders are checked once every expression has been read.
|
|
36
36
|
*/
|
|
37
37
|
export function parseSimDynamoDbProjection(expression, parameters) {
|
|
38
|
-
const paths = projectedPaths(SimDynamoDbExpressionTokens.of(expressionName, expression, "the expression names no attributes, and an expression cannot be empty"), parameters.
|
|
38
|
+
const paths = projectedPaths(SimDynamoDbExpressionTokens.of(expressionName, expression, "the expression names no attributes, and an expression cannot be empty"), parameters.attributes);
|
|
39
39
|
return new SimDynamoDbProjection({ expressionName, paths });
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Read the comma-separated document paths a ProjectionExpression names.
|
|
43
43
|
*/
|
|
44
|
-
function projectedPaths(tokens,
|
|
44
|
+
function projectedPaths(tokens, attributes) {
|
|
45
45
|
const paths = [];
|
|
46
46
|
do {
|
|
47
|
-
paths.push(new SimDynamoDbDocumentPathParser({ tokens,
|
|
47
|
+
paths.push(new SimDynamoDbDocumentPathParser({ tokens, attributes }).parse());
|
|
48
48
|
} while (tokens.takeSymbol(","));
|
|
49
49
|
assertReadToEnd(tokens);
|
|
50
50
|
return paths;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SimDynamoDbDocumentPath } from "./sim-dynamodb-document-path.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SimDynamoDbExpressionAttributes } from "./sim-dynamodb-expression-attributes.js";
|
|
3
3
|
import type { SimDynamoDbExpressionTokens } from "./sim-dynamodb-expression-tokens.js";
|
|
4
4
|
interface SimDynamoDbDocumentPathParserProperties {
|
|
5
5
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
6
|
-
readonly
|
|
6
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Reads one document path out of an expression.
|
|
@@ -15,7 +15,7 @@ interface SimDynamoDbDocumentPathParserProperties {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class SimDynamoDbDocumentPathParser {
|
|
17
17
|
private readonly tokens;
|
|
18
|
-
private readonly
|
|
18
|
+
private readonly attributes;
|
|
19
19
|
private readonly segments;
|
|
20
20
|
constructor(properties: SimDynamoDbDocumentPathParserProperties);
|
|
21
21
|
/**
|
|
@@ -14,17 +14,21 @@ const greatestDepth = 32;
|
|
|
14
14
|
*/
|
|
15
15
|
export class SimDynamoDbDocumentPathParser {
|
|
16
16
|
tokens;
|
|
17
|
-
|
|
17
|
+
attributes;
|
|
18
18
|
segments = [];
|
|
19
19
|
constructor(properties) {
|
|
20
20
|
this.tokens = properties.tokens;
|
|
21
|
-
this.
|
|
21
|
+
this.attributes = properties.attributes;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Read a path, from its first attribute to the last thing it dereferences.
|
|
25
25
|
*/
|
|
26
26
|
parse() {
|
|
27
|
-
this.
|
|
27
|
+
const first = this.attribute();
|
|
28
|
+
// The path starts here, so this is the top-level attribute it reaches.
|
|
29
|
+
// Whatever it dereferences afterwards is inside this one.
|
|
30
|
+
this.attributes.reach(first.name);
|
|
31
|
+
this.segments.push(first);
|
|
28
32
|
while (this.continues()) {
|
|
29
33
|
this.assertWithinDepth();
|
|
30
34
|
}
|
|
@@ -54,7 +58,7 @@ export class SimDynamoDbDocumentPathParser {
|
|
|
54
58
|
return { kind: "attribute", name: token.text };
|
|
55
59
|
}
|
|
56
60
|
if (token.kind === "namePlaceholder") {
|
|
57
|
-
return { kind: "attribute", name: this.
|
|
61
|
+
return { kind: "attribute", name: this.attributes.required(token.text) };
|
|
58
62
|
}
|
|
59
63
|
throw this.tokens.error(`syntax error; an attribute name was expected${this.after()}, but ` +
|
|
60
64
|
`'${token.text}' was given`);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SimDynamoDbExpressionPlaceholders } from "./sim-dynamodb-expression-placeholders.js";
|
|
2
|
+
/**
|
|
3
|
+
* The attribute names one request's expressions reach.
|
|
4
|
+
*
|
|
5
|
+
* Every expression kind names attributes the same way, either outright or
|
|
6
|
+
* behind a `#` placeholder, and every one of them reads those names through
|
|
7
|
+
* here. Noting the names as they are read is what lets a request say which
|
|
8
|
+
* attributes it names, which is what `dynamodb:Attributes` asks about.
|
|
9
|
+
*
|
|
10
|
+
* Only the attribute a document path starts at is noted. AWS counts a
|
|
11
|
+
* top-level attribute as reached where the request names it or anything nested
|
|
12
|
+
* inside it, so `Address.City` reaches `Address`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SimDynamoDbExpressionAttributes {
|
|
15
|
+
private readonly placeholders;
|
|
16
|
+
private readonly reached;
|
|
17
|
+
constructor(placeholders: SimDynamoDbExpressionPlaceholders<string>);
|
|
18
|
+
/**
|
|
19
|
+
* What a placeholder stands for, refusing one the request never defined.
|
|
20
|
+
*
|
|
21
|
+
* Resolving a placeholder says nothing about where in a path it sits, so
|
|
22
|
+
* nothing is noted here.
|
|
23
|
+
*/
|
|
24
|
+
required(placeholder: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Note a top-level attribute an expression named.
|
|
27
|
+
*/
|
|
28
|
+
reach(name: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* The top-level attributes every expression of the request named.
|
|
31
|
+
*/
|
|
32
|
+
get topLevel(): readonly string[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attribute names one request's expressions reach.
|
|
3
|
+
*
|
|
4
|
+
* Every expression kind names attributes the same way, either outright or
|
|
5
|
+
* behind a `#` placeholder, and every one of them reads those names through
|
|
6
|
+
* here. Noting the names as they are read is what lets a request say which
|
|
7
|
+
* attributes it names, which is what `dynamodb:Attributes` asks about.
|
|
8
|
+
*
|
|
9
|
+
* Only the attribute a document path starts at is noted. AWS counts a
|
|
10
|
+
* top-level attribute as reached where the request names it or anything nested
|
|
11
|
+
* inside it, so `Address.City` reaches `Address`.
|
|
12
|
+
*/
|
|
13
|
+
export class SimDynamoDbExpressionAttributes {
|
|
14
|
+
placeholders;
|
|
15
|
+
reached = new Set();
|
|
16
|
+
constructor(placeholders) {
|
|
17
|
+
this.placeholders = placeholders;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What a placeholder stands for, refusing one the request never defined.
|
|
21
|
+
*
|
|
22
|
+
* Resolving a placeholder says nothing about where in a path it sits, so
|
|
23
|
+
* nothing is noted here.
|
|
24
|
+
*/
|
|
25
|
+
required(placeholder) {
|
|
26
|
+
return this.placeholders.required(placeholder);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Note a top-level attribute an expression named.
|
|
30
|
+
*/
|
|
31
|
+
reach(name) {
|
|
32
|
+
this.reached.add(name);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The top-level attributes every expression of the request named.
|
|
36
|
+
*/
|
|
37
|
+
get topLevel() {
|
|
38
|
+
return [...this.reached];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SimDynamoDbAttributeValue } from "../command/item/item.types.js";
|
|
2
2
|
import type { SimDynamoDbValue } from "../item/sim-dynamodb-value.js";
|
|
3
|
+
import { SimDynamoDbExpressionAttributes } from "./sim-dynamodb-expression-attributes.js";
|
|
3
4
|
import { SimDynamoDbExpressionPlaceholders } from "./sim-dynamodb-expression-placeholders.js";
|
|
4
5
|
/**
|
|
5
6
|
* The two placeholder parameters a request can carry for its expressions.
|
|
@@ -19,6 +20,11 @@ export interface SimDynamoDbExpressionParameterInput {
|
|
|
19
20
|
export declare class SimDynamoDbExpressionParameters {
|
|
20
21
|
readonly names: SimDynamoDbExpressionPlaceholders<string>;
|
|
21
22
|
readonly values: SimDynamoDbExpressionPlaceholders<SimDynamoDbValue>;
|
|
23
|
+
/**
|
|
24
|
+
* The attribute names the request's expressions reach, gathered as they are
|
|
25
|
+
* read. Authorization asks for these as `dynamodb:Attributes`.
|
|
26
|
+
*/
|
|
27
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
22
28
|
constructor(input: SimDynamoDbExpressionParameterInput);
|
|
23
29
|
/**
|
|
24
30
|
* Refuse placeholders defined for an expression the request does not carry.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SimDynamoDbValidationException } from "../error/dynamodb.error.js";
|
|
2
2
|
import { readSimDynamoDbValue } from "../item/sim-dynamodb-value-reader.js";
|
|
3
|
+
import { SimDynamoDbExpressionAttributes } from "./sim-dynamodb-expression-attributes.js";
|
|
3
4
|
import { SimDynamoDbExpressionPlaceholders } from "./sim-dynamodb-expression-placeholders.js";
|
|
4
5
|
/**
|
|
5
6
|
* The placeholders one request defines for its expressions.
|
|
@@ -12,12 +13,18 @@ import { SimDynamoDbExpressionPlaceholders } from "./sim-dynamodb-expression-pla
|
|
|
12
13
|
export class SimDynamoDbExpressionParameters {
|
|
13
14
|
names;
|
|
14
15
|
values;
|
|
16
|
+
/**
|
|
17
|
+
* The attribute names the request's expressions reach, gathered as they are
|
|
18
|
+
* read. Authorization asks for these as `dynamodb:Attributes`.
|
|
19
|
+
*/
|
|
20
|
+
attributes;
|
|
15
21
|
constructor(input) {
|
|
16
22
|
this.names = new SimDynamoDbExpressionPlaceholders({
|
|
17
23
|
parameterName: "ExpressionAttributeNames",
|
|
18
24
|
marker: "#",
|
|
19
25
|
entries: input.ExpressionAttributeNames,
|
|
20
26
|
});
|
|
27
|
+
this.attributes = new SimDynamoDbExpressionAttributes(this.names);
|
|
21
28
|
this.values = new SimDynamoDbExpressionPlaceholders({
|
|
22
29
|
parameterName: "ExpressionAttributeValues",
|
|
23
30
|
marker: ":",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SimDynamoDbExpressionAttributes } from "../sim-dynamodb-expression-attributes.js";
|
|
2
2
|
import type { SimDynamoDbExpressionTokens } from "../sim-dynamodb-expression-tokens.js";
|
|
3
3
|
import { SimDynamoDbUpdateTarget } from "./sim-dynamodb-update-target.js";
|
|
4
4
|
interface SimDynamoDbUpdateClausesProperties {
|
|
5
5
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
6
|
-
readonly
|
|
6
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* The clauses of an update expression, and the paths their actions write to.
|
|
@@ -14,7 +14,7 @@ interface SimDynamoDbUpdateClausesProperties {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class SimDynamoDbUpdateClauses {
|
|
16
16
|
private readonly tokens;
|
|
17
|
-
private readonly
|
|
17
|
+
private readonly attributes;
|
|
18
18
|
private readonly read;
|
|
19
19
|
constructor(properties: SimDynamoDbUpdateClausesProperties);
|
|
20
20
|
/**
|
|
@@ -19,11 +19,11 @@ const clauseWords = new Set([
|
|
|
19
19
|
*/
|
|
20
20
|
export class SimDynamoDbUpdateClauses {
|
|
21
21
|
tokens;
|
|
22
|
-
|
|
22
|
+
attributes;
|
|
23
23
|
read = new Set();
|
|
24
24
|
constructor(properties) {
|
|
25
25
|
this.tokens = properties.tokens;
|
|
26
|
-
this.
|
|
26
|
+
this.attributes = properties.attributes;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Read the keyword the next clause starts with, refusing one already used.
|
|
@@ -47,7 +47,7 @@ export class SimDynamoDbUpdateClauses {
|
|
|
47
47
|
target() {
|
|
48
48
|
return new SimDynamoDbUpdateTarget(new SimDynamoDbDocumentPathParser({
|
|
49
49
|
tokens: this.tokens,
|
|
50
|
-
|
|
50
|
+
attributes: this.attributes,
|
|
51
51
|
}).parse());
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -13,7 +13,7 @@ import { SimDynamoDbUpdateParser } from "./sim-dynamodb-update-parser.js";
|
|
|
13
13
|
export function parseSimDynamoDbUpdate(expression, parameters) {
|
|
14
14
|
return new SimDynamoDbUpdateParser({
|
|
15
15
|
tokens: SimDynamoDbExpressionTokens.of(updateExpressionName, expression, "the expression says nothing, and an expression cannot be empty"),
|
|
16
|
-
|
|
16
|
+
attributes: parameters.attributes,
|
|
17
17
|
values: parameters.values,
|
|
18
18
|
}).parse();
|
|
19
19
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SimDynamoDbValue } from "../../item/sim-dynamodb-value.js";
|
|
2
|
+
import type { SimDynamoDbExpressionAttributes } from "../sim-dynamodb-expression-attributes.js";
|
|
2
3
|
import type { SimDynamoDbExpressionPlaceholders } from "../sim-dynamodb-expression-placeholders.js";
|
|
3
4
|
import type { SimDynamoDbExpressionTokens } from "../sim-dynamodb-expression-tokens.js";
|
|
4
5
|
import { type SimDynamoDbUpdateOperand, SimDynamoDbUpdatePathOperand, SimDynamoDbUpdateValueOperand } from "./sim-dynamodb-update-operand.js";
|
|
5
6
|
interface SimDynamoDbUpdateOperandParserProperties {
|
|
6
7
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
7
|
-
readonly
|
|
8
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
8
9
|
readonly values: SimDynamoDbExpressionPlaceholders<SimDynamoDbValue>;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -20,7 +21,7 @@ interface SimDynamoDbUpdateOperandParserProperties {
|
|
|
20
21
|
*/
|
|
21
22
|
export declare class SimDynamoDbUpdateOperandParser {
|
|
22
23
|
private readonly tokens;
|
|
23
|
-
private readonly
|
|
24
|
+
private readonly attributes;
|
|
24
25
|
private readonly values;
|
|
25
26
|
private readonly functions;
|
|
26
27
|
constructor(properties: SimDynamoDbUpdateOperandParserProperties);
|
|
@@ -20,12 +20,12 @@ const operators = new Set(["+", "-"]);
|
|
|
20
20
|
*/
|
|
21
21
|
export class SimDynamoDbUpdateOperandParser {
|
|
22
22
|
tokens;
|
|
23
|
-
|
|
23
|
+
attributes;
|
|
24
24
|
values;
|
|
25
25
|
functions;
|
|
26
26
|
constructor(properties) {
|
|
27
27
|
this.tokens = properties.tokens;
|
|
28
|
-
this.
|
|
28
|
+
this.attributes = properties.attributes;
|
|
29
29
|
this.values = properties.values;
|
|
30
30
|
this.functions = new SimDynamoDbUpdateFunctionParser({
|
|
31
31
|
tokens: properties.tokens,
|
|
@@ -80,7 +80,7 @@ export class SimDynamoDbUpdateOperandParser {
|
|
|
80
80
|
path() {
|
|
81
81
|
return new SimDynamoDbUpdatePathOperand(new SimDynamoDbDocumentPathParser({
|
|
82
82
|
tokens: this.tokens,
|
|
83
|
-
|
|
83
|
+
attributes: this.attributes,
|
|
84
84
|
}).parse());
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SimDynamoDbValue } from "../../item/sim-dynamodb-value.js";
|
|
2
|
+
import type { SimDynamoDbExpressionAttributes } from "../sim-dynamodb-expression-attributes.js";
|
|
2
3
|
import type { SimDynamoDbExpressionPlaceholders } from "../sim-dynamodb-expression-placeholders.js";
|
|
3
4
|
import type { SimDynamoDbExpressionTokens } from "../sim-dynamodb-expression-tokens.js";
|
|
4
5
|
import { SimDynamoDbUpdate } from "./sim-dynamodb-update.js";
|
|
5
6
|
interface SimDynamoDbUpdateParserProperties {
|
|
6
7
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
7
|
-
readonly
|
|
8
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
8
9
|
readonly values: SimDynamoDbExpressionPlaceholders<SimDynamoDbValue>;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -11,8 +11,11 @@ import type { SimIamStringComparison } from "../sim-iam-string-comparison.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class SimIamNegatedForAllValuesStringOperator implements SimIamConditionOperator {
|
|
13
13
|
private readonly comparison;
|
|
14
|
-
readonly matchesAbsentKey = true;
|
|
15
14
|
constructor(comparison: SimIamStringComparison);
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey(): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* Check whether every request value differs from every policy value.
|
|
18
21
|
*/
|
|
@@ -9,10 +9,15 @@ import { simIamStringValues } from "../string/sim-iam-string-values.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export class SimIamNegatedForAllValuesStringOperator {
|
|
11
11
|
comparison;
|
|
12
|
-
matchesAbsentKey = true;
|
|
13
12
|
constructor(comparison) {
|
|
14
13
|
this.comparison = comparison;
|
|
15
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
16
21
|
/**
|
|
17
22
|
* Check whether every request value differs from every policy value.
|
|
18
23
|
*/
|
|
@@ -12,8 +12,11 @@ import type { SimIamStringComparison } from "../sim-iam-string-comparison.js";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class SimIamNegatedForAnyValueStringOperator implements SimIamConditionOperator {
|
|
14
14
|
private readonly comparison;
|
|
15
|
-
readonly matchesAbsentKey = false;
|
|
16
15
|
constructor(comparison: SimIamStringComparison);
|
|
16
|
+
/**
|
|
17
|
+
* Answer for a request carrying no value for the key.
|
|
18
|
+
*/
|
|
19
|
+
matchesAbsentKey(): boolean;
|
|
17
20
|
/**
|
|
18
21
|
* Check whether any request value differs from every policy value.
|
|
19
22
|
*/
|
|
@@ -10,10 +10,15 @@ import { simIamStringValues } from "../string/sim-iam-string-values.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export class SimIamNegatedForAnyValueStringOperator {
|
|
12
12
|
comparison;
|
|
13
|
-
matchesAbsentKey = false;
|
|
14
13
|
constructor(comparison) {
|
|
15
14
|
this.comparison = comparison;
|
|
16
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Answer for a request carrying no value for the key.
|
|
18
|
+
*/
|
|
19
|
+
matchesAbsentKey() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* Check whether any request value differs from every policy value.
|
|
19
24
|
*/
|
|
@@ -11,8 +11,11 @@ import type { SimIamStringComparison } from "../sim-iam-string-comparison.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class SimIamNegatedScalarStringOperator implements SimIamConditionOperator {
|
|
13
13
|
private readonly comparison;
|
|
14
|
-
readonly matchesAbsentKey = true;
|
|
15
14
|
constructor(comparison: SimIamStringComparison);
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey(): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* Check whether a request value differs from every policy value.
|
|
18
21
|
*/
|
package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-scalar-string-operator.js
CHANGED
|
@@ -9,10 +9,15 @@ import { simIamStringValues } from "../string/sim-iam-string-values.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export class SimIamNegatedScalarStringOperator {
|
|
11
11
|
comparison;
|
|
12
|
-
matchesAbsentKey = true;
|
|
13
12
|
constructor(comparison) {
|
|
14
13
|
this.comparison = comparison;
|
|
15
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
16
21
|
/**
|
|
17
22
|
* Check whether a request value differs from every policy value.
|
|
18
23
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SimIamConditionValue } from "../../../../policy/sim-iam-policy.js";
|
|
2
|
+
import type { SimIamConditionOperator } from "../sim-iam-condition-operator.js";
|
|
3
|
+
/**
|
|
4
|
+
* IAM `Null` condition operator.
|
|
5
|
+
*
|
|
6
|
+
* `Null` checks whether the request carries a value for a context key, rather
|
|
7
|
+
* than comparing one. `"true"` matches where the key is absent and `"false"`
|
|
8
|
+
* where it is present. AWS names it and the `...IfExists` suffix as the two
|
|
9
|
+
* exceptions to the rule that an absent key fails a condition.
|
|
10
|
+
*
|
|
11
|
+
* It is what guards a `ForAllValues` `Allow`, which matches an absent key on
|
|
12
|
+
* its own. See `SimIamForAllValuesStringConditionOperator`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SimIamNull implements SimIamConditionOperator {
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey(expected: SimIamConditionValue): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Answer for a request carrying a value for the key.
|
|
21
|
+
*/
|
|
22
|
+
matches(actual: SimIamConditionValue, expected: SimIamConditionValue): boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the policy value of a `Null` condition.
|
|
3
|
+
*
|
|
4
|
+
* AWS documents `"true"` and `"false"` as strings, which is the form a policy
|
|
5
|
+
* document and the CDK both write. The condition value type also admits a JSON
|
|
6
|
+
* boolean, and a policy written that way means the same thing. Anything else
|
|
7
|
+
* has no meaning here and leaves the condition matching nothing.
|
|
8
|
+
*/
|
|
9
|
+
function expectsAbsentKey(expected) {
|
|
10
|
+
if (typeof expected === "boolean") {
|
|
11
|
+
return expected;
|
|
12
|
+
}
|
|
13
|
+
if (expected === "true") {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return expected === "false" ? false : undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Whether a request value counts as present for a `Null` check.
|
|
20
|
+
*
|
|
21
|
+
* AWS asks whether the key exists and its value is not null. A multi-valued key
|
|
22
|
+
* carrying no values resolves to a null dataset, and an empty string is the
|
|
23
|
+
* example AWS gives of one.
|
|
24
|
+
*/
|
|
25
|
+
function isPresent(actual) {
|
|
26
|
+
if (Array.isArray(actual)) {
|
|
27
|
+
return actual.length > 0;
|
|
28
|
+
}
|
|
29
|
+
return actual !== "";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* IAM `Null` condition operator.
|
|
33
|
+
*
|
|
34
|
+
* `Null` checks whether the request carries a value for a context key, rather
|
|
35
|
+
* than comparing one. `"true"` matches where the key is absent and `"false"`
|
|
36
|
+
* where it is present. AWS names it and the `...IfExists` suffix as the two
|
|
37
|
+
* exceptions to the rule that an absent key fails a condition.
|
|
38
|
+
*
|
|
39
|
+
* It is what guards a `ForAllValues` `Allow`, which matches an absent key on
|
|
40
|
+
* its own. See `SimIamForAllValuesStringConditionOperator`.
|
|
41
|
+
*/
|
|
42
|
+
export class SimIamNull {
|
|
43
|
+
/**
|
|
44
|
+
* Answer for a request carrying no value for the key.
|
|
45
|
+
*/
|
|
46
|
+
matchesAbsentKey(expected) {
|
|
47
|
+
return expectsAbsentKey(expected) === true;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Answer for a request carrying a value for the key.
|
|
51
|
+
*/
|
|
52
|
+
matches(actual, expected) {
|
|
53
|
+
const absentExpected = expectsAbsentKey(expected);
|
|
54
|
+
if (absentExpected === undefined) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return absentExpected !== isPresent(actual);
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ import type { SimIamConditionOperator } from "../../sim-iam-condition-operator.j
|
|
|
15
15
|
* are rejected rather than being converted through JavaScript coercion rules.
|
|
16
16
|
*/
|
|
17
17
|
export declare class SimIamNumericLessThanEquals implements SimIamConditionOperator {
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Answer for a request carrying no value for the key.
|
|
20
|
+
*/
|
|
21
|
+
matchesAbsentKey(): boolean;
|
|
19
22
|
/**
|
|
20
23
|
* Compare one request value with one or more policy limits.
|
|
21
24
|
*/
|
package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.js
CHANGED
|
@@ -13,7 +13,12 @@
|
|
|
13
13
|
* are rejected rather than being converted through JavaScript coercion rules.
|
|
14
14
|
*/
|
|
15
15
|
export class SimIamNumericLessThanEquals {
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Answer for a request carrying no value for the key.
|
|
18
|
+
*/
|
|
19
|
+
matchesAbsentKey() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* Compare one request value with one or more policy limits.
|
|
19
24
|
*/
|
|
@@ -8,6 +8,7 @@ import { SimIamStringLike } from "./string/like/sim-iam-string-like.js";
|
|
|
8
8
|
import { SimIamNumericLessThanEquals } from "./numeric/less-than-equals/sim-iam-number-lte.js";
|
|
9
9
|
import { SimIamArnEquals } from "./arn/equals/sim-iam-arn-equals.js";
|
|
10
10
|
import { SimIamArnLike } from "./arn/like/sim-iam-arn-like.js";
|
|
11
|
+
import { SimIamNull } from "./null/sim-iam-null.js";
|
|
11
12
|
const operatorFactories = new Map([
|
|
12
13
|
["ArnEquals", () => new SimIamArnEquals()],
|
|
13
14
|
["ArnLike", () => new SimIamArnLike()],
|
|
@@ -17,6 +18,7 @@ const operatorFactories = new Map([
|
|
|
17
18
|
],
|
|
18
19
|
["StringEquals", () => new SimIamStringEquals()],
|
|
19
20
|
["StringLike", () => new SimIamStringLike()],
|
|
21
|
+
["Null", () => new SimIamNull()],
|
|
20
22
|
[
|
|
21
23
|
"ForAnyValue:StringEquals",
|
|
22
24
|
() => new SimIamForAnyValueStringEquals(),
|
|
@@ -15,9 +15,16 @@ export interface SimIamConditionOperator {
|
|
|
15
15
|
* there is none for the policy value to equal.
|
|
16
16
|
*
|
|
17
17
|
* A `ForAnyValue` operator answers false whatever it wraps, because no
|
|
18
|
-
* request value is there to satisfy it.
|
|
18
|
+
* request value is there to satisfy it. A `ForAllValues` operator answers
|
|
19
|
+
* true, because every value the request carries matches vacuously. AWS
|
|
20
|
+
* documents all three rules, and warns that the `ForAllValues` rule leaves
|
|
21
|
+
* an `Allow` overly permissive without a `Null` guard beside it.
|
|
22
|
+
*
|
|
23
|
+
* The policy value is passed because `Null` reads it. Every comparison
|
|
24
|
+
* operator answers the same way whatever the policy says, and takes no
|
|
25
|
+
* argument.
|
|
19
26
|
*/
|
|
20
|
-
|
|
27
|
+
matchesAbsentKey(expected: SimIamConditionValue): boolean;
|
|
21
28
|
/**
|
|
22
29
|
* Determine whether an actual request value satisfies the expected policy value.
|
|
23
30
|
*/
|
|
@@ -59,7 +59,7 @@ export class SimIamPolicyConditionMatcher {
|
|
|
59
59
|
entryMatches(operator, key, expected) {
|
|
60
60
|
const actual = this.conditionContext.get(this.normalizeContextKey(key));
|
|
61
61
|
if (actual === undefined) {
|
|
62
|
-
return operator.matchesAbsentKey;
|
|
62
|
+
return operator.matchesAbsentKey(expected);
|
|
63
63
|
}
|
|
64
64
|
return operator.matches(actual, expected);
|
|
65
65
|
}
|
|
@@ -2,9 +2,16 @@ import type { SimIamConditionValue } from "../../../../../policy/sim-iam-policy.
|
|
|
2
2
|
import type { SimIamConditionOperator } from "../../sim-iam-condition-operator.js";
|
|
3
3
|
/**
|
|
4
4
|
* Base for `ForAllValues` IAM string operators.
|
|
5
|
+
*
|
|
6
|
+
* An absent context key matches. AWS answers true where the request carries
|
|
7
|
+
* no value for the key. A `ForAllValues` `Allow` therefore needs a `Null`
|
|
8
|
+
* guard beside it to stay tight.
|
|
5
9
|
*/
|
|
6
10
|
export declare abstract class SimIamForAllValuesStringConditionOperator implements SimIamConditionOperator {
|
|
7
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Answer for a request carrying no value for the key.
|
|
13
|
+
*/
|
|
14
|
+
matchesAbsentKey(): boolean;
|
|
8
15
|
/**
|
|
9
16
|
* Check whether a given value matches the expected value.
|
|
10
17
|
*/
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { simIamStringValues } from "../sim-iam-string-values.js";
|
|
2
2
|
/**
|
|
3
3
|
* Base for `ForAllValues` IAM string operators.
|
|
4
|
+
*
|
|
5
|
+
* An absent context key matches. AWS answers true where the request carries
|
|
6
|
+
* no value for the key. A `ForAllValues` `Allow` therefore needs a `Null`
|
|
7
|
+
* guard beside it to stay tight.
|
|
4
8
|
*/
|
|
5
9
|
export class SimIamForAllValuesStringConditionOperator {
|
|
6
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Answer for a request carrying no value for the key.
|
|
12
|
+
*/
|
|
13
|
+
matchesAbsentKey() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
7
16
|
/**
|
|
8
17
|
* Check whether a given value matches the expected value.
|
|
9
18
|
*/
|
|
@@ -4,7 +4,10 @@ import type { SimIamConditionOperator } from "../../sim-iam-condition-operator.j
|
|
|
4
4
|
* Base for `ForAnyValue` IAM string operators.
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class SimIamForAnyValueStringConditionOperator implements SimIamConditionOperator {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Answer for a request carrying no value for the key.
|
|
9
|
+
*/
|
|
10
|
+
matchesAbsentKey(): boolean;
|
|
8
11
|
/**
|
|
9
12
|
* Check whether a given value matches the expected value.
|
|
10
13
|
*/
|
|
@@ -3,7 +3,12 @@ import { simIamStringValues } from "../sim-iam-string-values.js";
|
|
|
3
3
|
* Base for `ForAnyValue` IAM string operators.
|
|
4
4
|
*/
|
|
5
5
|
export class SimIamForAnyValueStringConditionOperator {
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Answer for a request carrying no value for the key.
|
|
8
|
+
*/
|
|
9
|
+
matchesAbsentKey() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* Check whether a given value matches the expected value.
|
|
9
14
|
*/
|