@effect-dynamodb/schema 1.38.0 → 1.40.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.
Files changed (85) hide show
  1. package/dist/Aggregate.d.ts +11 -4
  2. package/dist/Aggregate.d.ts.map +1 -1
  3. package/dist/Aggregate.js +21 -2
  4. package/dist/Aggregate.js.map +1 -1
  5. package/dist/DynamoModel.d.ts +13 -0
  6. package/dist/DynamoModel.d.ts.map +1 -1
  7. package/dist/DynamoModel.js.map +1 -1
  8. package/dist/DynamoSchema.d.ts +33 -17
  9. package/dist/DynamoSchema.d.ts.map +1 -1
  10. package/dist/DynamoSchema.js +19 -13
  11. package/dist/DynamoSchema.js.map +1 -1
  12. package/dist/Entity.d.ts +121 -18
  13. package/dist/Entity.d.ts.map +1 -1
  14. package/dist/Entity.js +238 -2
  15. package/dist/Entity.js.map +1 -1
  16. package/dist/Errors.d.ts +0 -27
  17. package/dist/Errors.d.ts.map +1 -1
  18. package/dist/Errors.js +0 -24
  19. package/dist/Errors.js.map +1 -1
  20. package/dist/KeyComposer.d.ts +368 -14
  21. package/dist/KeyComposer.d.ts.map +1 -1
  22. package/dist/KeyComposer.js +835 -87
  23. package/dist/KeyComposer.js.map +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/internal/AggregateEdges.d.ts +3 -3
  29. package/dist/internal/AggregateSchemas.d.ts +181 -14
  30. package/dist/internal/AggregateSchemas.d.ts.map +1 -1
  31. package/dist/internal/AggregateSchemas.js +505 -45
  32. package/dist/internal/AggregateSchemas.js.map +1 -1
  33. package/dist/internal/AggregateTypes.d.ts +396 -36
  34. package/dist/internal/AggregateTypes.d.ts.map +1 -1
  35. package/dist/internal/CompositeCodec.d.ts +274 -6
  36. package/dist/internal/CompositeCodec.d.ts.map +1 -1
  37. package/dist/internal/CompositeCodec.js +829 -25
  38. package/dist/internal/CompositeCodec.js.map +1 -1
  39. package/dist/internal/EffectInstances.d.ts +81 -0
  40. package/dist/internal/EffectInstances.d.ts.map +1 -0
  41. package/dist/internal/EffectInstances.js +656 -0
  42. package/dist/internal/EffectInstances.js.map +1 -0
  43. package/dist/internal/EntitySchemas.d.ts +103 -27
  44. package/dist/internal/EntitySchemas.d.ts.map +1 -1
  45. package/dist/internal/EntitySchemas.js +778 -131
  46. package/dist/internal/EntitySchemas.js.map +1 -1
  47. package/dist/internal/EntityTypes.d.ts +67 -11
  48. package/dist/internal/EntityTypes.d.ts.map +1 -1
  49. package/dist/internal/FailingAsBefore.d.ts +25 -0
  50. package/dist/internal/FailingAsBefore.d.ts.map +1 -0
  51. package/dist/internal/FailingAsBefore.js +42 -0
  52. package/dist/internal/FailingAsBefore.js.map +1 -0
  53. package/dist/internal/InstanceReads.d.ts +33 -0
  54. package/dist/internal/InstanceReads.d.ts.map +1 -0
  55. package/dist/internal/InstanceReads.js +165 -0
  56. package/dist/internal/InstanceReads.js.map +1 -0
  57. package/dist/internal/KeyText136.d.ts +58 -131
  58. package/dist/internal/KeyText136.d.ts.map +1 -1
  59. package/dist/internal/KeyText136.js +154 -264
  60. package/dist/internal/KeyText136.js.map +1 -1
  61. package/dist/internal/NumericKey.d.ts +29 -2
  62. package/dist/internal/NumericKey.d.ts.map +1 -1
  63. package/dist/internal/NumericKey.js +64 -1
  64. package/dist/internal/NumericKey.js.map +1 -1
  65. package/dist/internal/PackedCodec.d.ts +8 -1
  66. package/dist/internal/PackedCodec.d.ts.map +1 -1
  67. package/dist/internal/PackedCodec.js +49 -13
  68. package/dist/internal/PackedCodec.js.map +1 -1
  69. package/dist/internal/SchemaAccessors.d.ts +160 -1
  70. package/dist/internal/SchemaAccessors.d.ts.map +1 -1
  71. package/dist/internal/SchemaAccessors.js +994 -1
  72. package/dist/internal/SchemaAccessors.js.map +1 -1
  73. package/dist/internal/Shards.d.ts +47 -0
  74. package/dist/internal/Shards.d.ts.map +1 -0
  75. package/dist/internal/Shards.js +60 -0
  76. package/dist/internal/Shards.js.map +1 -0
  77. package/dist/internal/SharedKeyAttribute.d.ts +102 -0
  78. package/dist/internal/SharedKeyAttribute.d.ts.map +1 -0
  79. package/dist/internal/SharedKeyAttribute.js +288 -0
  80. package/dist/internal/SharedKeyAttribute.js.map +1 -0
  81. package/dist/internal/SparseKey.d.ts +46 -0
  82. package/dist/internal/SparseKey.d.ts.map +1 -0
  83. package/dist/internal/SparseKey.js +69 -0
  84. package/dist/internal/SparseKey.js.map +1 -0
  85. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FailingAsBefore.d.ts","sourceRoot":"","sources":["../../src/internal/FailingAsBefore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAS,MAAM,EAAgB,MAAM,EAAE,KAAK,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAE5F;;;;GAIG;AACH,eAAO,MAAM,eAAe,GACzB,CAAC,EAAE,QAAQ,MAAM,WAAW,CAAC,KAAK,GAAG,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,KAAK,CAAC,MACtF,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,CAWjE,CAAA;AAEN,8FAA8F;AAC9F,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,CAAC,GAAG,EAClB,OAAO,OAAO,KACb,WAAW,CAAC,KAAK,GAAG,SAGtB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,CAAC,GAAG,EAAE,UAAU,MAAM,CAAC,GAAG,MAE7D,OAAO,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAOnE,CAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @internal A read that dies where 1.39.0's failed fails as 1.39.0's did.
3
+ *
4
+ * A read schema reads an absent attribute as the value it stands for (`absentStored`), through the
5
+ * field's own steps, so a step that throws on that value kills a read that 1.39.0, reading no such
6
+ * value, failed on the missing key with a `ValidationError`. Every read of a stored row, item,
7
+ * event or effect goes through {@link failingAsBefore}: an entity's (`missingKeyOnDefect`), an
8
+ * aggregate's assembly, and a stream's events, metadata, snapshot state and outbox effects
9
+ * ({@link decodingAsBefore}).
10
+ */
11
+ import { Cause, Effect, Exit, Option, Schema, SchemaParser } from "effect";
12
+ /**
13
+ * A read that died fails with the issue 1.39.0's read of the same input gave (`before`), through
14
+ * `fail`; without one, it dies as it did. `before` is asked only once the read has died, so a read
15
+ * that doesn't die runs nothing more.
16
+ */
17
+ export const failingAsBefore = (before, fail) => (read) => Effect.catchDefect(read, (defect) => {
18
+ let issue;
19
+ try {
20
+ issue = before();
21
+ }
22
+ catch {
23
+ issue = undefined;
24
+ }
25
+ return issue === undefined
26
+ ? Effect.die(defect)
27
+ : Effect.fail(fail(new Schema.SchemaError(issue)));
28
+ });
29
+ /** The issue decoding `input` through `schema` fails with; none where it decodes, or dies. */
30
+ export const issueDecoding = (schema, input) => {
31
+ const read = SchemaParser.decodeUnknownExit(schema)(input);
32
+ return Exit.isFailure(read) ? Option.getOrUndefined(Cause.findErrorOption(read.cause)) : undefined;
33
+ };
34
+ /**
35
+ * Decode through `read`, a read schema built from `declared`; a decode that dies fails with the
36
+ * issue `declared` itself gives, as 1.39.0, which decoded through `declared`, did.
37
+ */
38
+ export const decodingAsBefore = (read, declared) => {
39
+ const decode = Schema.decodeUnknownEffect(read);
40
+ return (input) => decode(input).pipe(failingAsBefore(() => issueDecoding(declared, input), (cause) => cause));
41
+ };
42
+ //# sourceMappingURL=FailingAsBefore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FailingAsBefore.js","sourceRoot":"","sources":["../../src/internal/FailingA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C,CAAC,CAAA;IACnF,OAAO,CAAC,KAAc,EAA8C,EAAE,CACpE,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAChB,eAAe,CACb,GAAG,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,EACpC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CACjB,CACF,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @internal Reading Effect's own declarations back as real instances.
3
+ *
4
+ * DynamoDB hands back a `BigDecimal`, a `Duration`, a zone, a cookie, a version, an address, a DNS
5
+ * record, or a `DateTime` inside an `Option` or a `Result`, as the map the marshaller made of it,
6
+ * and the declaration's parser takes that map as it is. {@link readingInstances} gives a read schema
7
+ * each of these declarations as {@link readingDeclaration} builds it: its parser decides on what's
8
+ * stored exactly as it always did, and what it takes comes back as the instance it stands for.
9
+ *
10
+ * A row is decoded once. Nothing is decoded twice, and nothing a schema runs (a check, a
11
+ * transformation, a class's constructor, a declaration's parser, a default) runs more often than it
12
+ * did. What changes is what such code sees at one of these positions: the instance, where it saw a
13
+ * map that only looked like one.
14
+ *
15
+ * What a schema needs is decided once, when it's built: a schema holding none of these declarations
16
+ * is returned as it is, the same object, and costs nothing on a read.
17
+ */
18
+ import { Schema, SchemaAST } from "effect";
19
+ type AST = SchemaAST.AST;
20
+ /** The same node with its children, and its encoding's, through `f`; itself when none changed. */
21
+ export declare const rebuiltChildren: (ast: AST, f: (child: AST) => AST) => AST;
22
+ /**
23
+ * Whether anything reachable from a node satisfies `test`. A recursive schema reaches itself through a
24
+ * suspension: a node is only remembered as not satisfying when nothing it reached was still open.
25
+ */
26
+ export declare const reaching: (test: (ast: AST) => boolean) => (root: AST) => boolean;
27
+ /**
28
+ * A read schema with each of Effect's look-alike declarations in it read back as a real instance
29
+ * ({@link readingDeclaration}). The schema itself, the same object, when it holds none.
30
+ */
31
+ export declare const readingInstances: <S extends Schema.Top>(schema: S) => S;
32
+ export {};
33
+ //# sourceMappingURL=InstanceReads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstanceReads.d.ts","sourceRoot":"","sources":["../../src/internal/InstanceReads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAG1C,KAAK,GAAG,GAAG,SAAS,CAAC,GAAG,CAAA;AA4BxB,kGAAkG;AAClG,eAAO,MAAM,eAAe,GAAI,KAAK,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,KAAG,GAmDlE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,MAAM,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,MAE1C,MAAM,GAAG,KAAG,OA2BrB,CAAA;AA0BD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAG,CAOlE,CAAA"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * @internal Reading Effect's own declarations back as real instances.
3
+ *
4
+ * DynamoDB hands back a `BigDecimal`, a `Duration`, a zone, a cookie, a version, an address, a DNS
5
+ * record, or a `DateTime` inside an `Option` or a `Result`, as the map the marshaller made of it,
6
+ * and the declaration's parser takes that map as it is. {@link readingInstances} gives a read schema
7
+ * each of these declarations as {@link readingDeclaration} builds it: its parser decides on what's
8
+ * stored exactly as it always did, and what it takes comes back as the instance it stands for.
9
+ *
10
+ * A row is decoded once. Nothing is decoded twice, and nothing a schema runs (a check, a
11
+ * transformation, a class's constructor, a declaration's parser, a default) runs more often than it
12
+ * did. What changes is what such code sees at one of these positions: the instance, where it saw a
13
+ * map that only looked like one.
14
+ *
15
+ * What a schema needs is decided once, when it's built: a schema holding none of these declarations
16
+ * is returned as it is, the same object, and costs nothing on a read.
17
+ */
18
+ import { Schema, SchemaAST } from "effect";
19
+ import { isReadingDeclaration, readDeclarationOf, readingDeclaration } from "./EffectInstances.js";
20
+ const astWith = (ast, changes) => Object.assign(Object.create(Object.getPrototypeOf(ast)), ast, changes);
21
+ /** Every node a value of this node passes through: its children, and what its encoding reads. */
22
+ const childrenOf = (ast) => {
23
+ const encoded = ast.encoding?.map((link) => link.to) ?? [];
24
+ switch (ast._tag) {
25
+ case "Declaration":
26
+ return [...ast.typeParameters, ...encoded];
27
+ case "Arrays":
28
+ return [...ast.elements, ...ast.rest, ...encoded];
29
+ case "Objects":
30
+ return [
31
+ ...ast.propertySignatures.map((property) => property.type),
32
+ ...ast.indexSignatures.map((index) => index.type),
33
+ ...encoded,
34
+ ];
35
+ case "Union":
36
+ return [...ast.types, ...encoded];
37
+ case "Suspend":
38
+ return [ast.thunk(), ...encoded];
39
+ default:
40
+ return encoded;
41
+ }
42
+ };
43
+ /** The same node with its children, and its encoding's, through `f`; itself when none changed. */
44
+ export const rebuiltChildren = (ast, f) => {
45
+ let read;
46
+ switch (ast._tag) {
47
+ case "Declaration": {
48
+ const typeParameters = SchemaAST.mapOrSame(ast.typeParameters, f);
49
+ read = typeParameters === ast.typeParameters ? ast : astWith(ast, { typeParameters });
50
+ break;
51
+ }
52
+ case "Arrays": {
53
+ const elements = SchemaAST.mapOrSame(ast.elements, f);
54
+ const rest = SchemaAST.mapOrSame(ast.rest, f);
55
+ read = elements === ast.elements && rest === ast.rest ? ast : astWith(ast, { elements, rest });
56
+ break;
57
+ }
58
+ case "Objects": {
59
+ const propertySignatures = SchemaAST.mapOrSame(ast.propertySignatures, (property) => {
60
+ const type = f(property.type);
61
+ return type === property.type
62
+ ? property
63
+ : new SchemaAST.PropertySignature(property.name, type);
64
+ });
65
+ const indexSignatures = SchemaAST.mapOrSame(ast.indexSignatures, (index) => {
66
+ const type = f(index.type);
67
+ return type === index.type ? index : new SchemaAST.IndexSignature(index.parameter, type);
68
+ });
69
+ read =
70
+ propertySignatures === ast.propertySignatures && indexSignatures === ast.indexSignatures
71
+ ? ast
72
+ : astWith(ast, { propertySignatures, indexSignatures });
73
+ break;
74
+ }
75
+ case "Union": {
76
+ const types = SchemaAST.mapOrSame(ast.types, f);
77
+ read = types === ast.types ? ast : astWith(ast, { types });
78
+ break;
79
+ }
80
+ case "Suspend": {
81
+ const inner = ast.thunk();
82
+ read = astWith(ast, { thunk: () => f(inner) });
83
+ break;
84
+ }
85
+ default:
86
+ read = ast;
87
+ }
88
+ const encoding = ast.encoding &&
89
+ SchemaAST.mapOrSame(ast.encoding, (link) => {
90
+ const to = f(link.to);
91
+ return to === link.to ? link : new SchemaAST.Link(to, link.transformation);
92
+ });
93
+ return encoding === ast.encoding ? read : astWith(read, { encoding });
94
+ };
95
+ /**
96
+ * Whether anything reachable from a node satisfies `test`. A recursive schema reaches itself through a
97
+ * suspension: a node is only remembered as not satisfying when nothing it reached was still open.
98
+ */
99
+ export const reaching = (test) => {
100
+ const memo = new WeakMap();
101
+ return (root) => {
102
+ const open = new Set();
103
+ const visit = (ast) => {
104
+ const known = memo.get(ast);
105
+ if (known !== undefined)
106
+ return { found: known, cyclic: false };
107
+ if (open.has(ast))
108
+ return { found: false, cyclic: true };
109
+ if (test(ast)) {
110
+ memo.set(ast, true);
111
+ return { found: true, cyclic: false };
112
+ }
113
+ open.add(ast);
114
+ let cyclic = false;
115
+ for (const child of childrenOf(ast)) {
116
+ const reached = visit(child);
117
+ if (reached.found) {
118
+ open.delete(ast);
119
+ memo.set(ast, true);
120
+ return reached;
121
+ }
122
+ cyclic ||= reached.cyclic;
123
+ }
124
+ open.delete(ast);
125
+ if (!cyclic)
126
+ memo.set(ast, false);
127
+ return { found: false, cyclic };
128
+ };
129
+ return visit(root).found;
130
+ };
131
+ };
132
+ /** Whether a node holds one of Effect's look-alike declarations anywhere, not yet read. */
133
+ const holds = reaching((ast) => readDeclarationOf(ast) !== undefined && !isReadingDeclaration(ast));
134
+ const memo = new WeakMap();
135
+ /** A node with each of Effect's look-alike declarations in it read back as the instance. */
136
+ const reading = (ast) => {
137
+ const known = memo.get(ast);
138
+ if (known !== undefined)
139
+ return known;
140
+ const kind = readDeclarationOf(ast);
141
+ const built = kind !== undefined
142
+ ? isReadingDeclaration(ast)
143
+ ? ast
144
+ : rebuiltChildren(readingDeclaration(ast, kind), reading)
145
+ : holds(ast)
146
+ ? rebuiltChildren(ast, reading)
147
+ : ast;
148
+ memo.set(ast, built);
149
+ return built;
150
+ };
151
+ const schemas = new WeakMap();
152
+ /**
153
+ * A read schema with each of Effect's look-alike declarations in it read back as a real instance
154
+ * ({@link readingDeclaration}). The schema itself, the same object, when it holds none.
155
+ */
156
+ export const readingInstances = (schema) => {
157
+ const known = schemas.get(schema);
158
+ if (known !== undefined)
159
+ return known;
160
+ const ast = reading(schema.ast);
161
+ const read = ast === schema.ast ? schema : Schema.make(ast);
162
+ schemas.set(schema, read);
163
+ return read;
164
+ };
165
+ //# sourceMappingURL=InstanceReads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstanceReads.js","sourceRoot":"","sources":["../../src/internal/InstanceReads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAIlG,MAAM,OAAO,GAAG,CAAgB,GAAM,EAAE,OAAmB,EAAK,EAAE,CAChE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;AAExE,iGAAiG;AACjG,MAAM,UAAU,GAAG,CAAC,GAAQ,EAAsB,EAAE;IAClD,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;IAC1D,QAA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;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAuB,MAAS,EAAK,EAAE;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACjC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAU,CAAA;IAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC/B,MAAM,IAAI,GAAG,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAM,CAAC,IAAI,CAAa,GAAG,CAAkB,CAAA;IACzF,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACzB,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -1,153 +1,80 @@
1
1
  /**
2
- * KeyText136 — the key text effect-dynamodb 1.36 composed (#171).
2
+ * KeyText136 — the key texts rows can be stored under, for `rekey` (#171, #183).
3
3
  *
4
- * 1.37 composes some key text differently, so a row 1.36 wrote with such a
5
- * value sits under a key 1.37 does not compose:
4
+ * Every operation composes one key text, the one the schema's `escapeKeys` setting chooses, and
5
+ * reads and writes nothing else. A row stored under another text isn't found by any read until
6
+ * `db.tables.<Table>.rekey()` moves it. This module is what `rekey` recognises such a row by. The
7
+ * key texts differ in:
6
8
  *
7
- * - **Numbers** (`serializeValue`): 1.36 zero-padded `String(n)` to 16
8
- * characters (a bigint to 38), which kept non-negative integers below 1e16
9
- * in order and nothing else; 1.37 encodes every number in numeric order
10
- * (`NumericKey.ts`). The text of a non-negative integer below 1e16 (1e38 for
11
- * a bigint) is unchanged.
12
- * - **Sort key values** holding a code point U+0000–U+0025 — a control
13
- * character, space, `!`, `"`, `#`, `$` or `%` — are escaped in 1.37
14
- * (`KeyComposer.sortKeyText`) and were not in 1.36. Partition keys, unique
15
- * sentinels and the structural parts of a key are not escaped.
16
- * - **Time-series event keys** carried the orderBy attribute's ENCODED value
17
- * (a `NumberFromString` `"10"` as the string `10`); 1.37 composes its key
18
- * form (`0000000000000010`).
9
+ * - **Numbers.** Up to 1.36, and with `escapeKeys` off, `String(n)` zero-padded to 16 characters
10
+ * (a bigint to 38), which keeps non-negative integers below 1e16 in order and nothing else.
11
+ * 1.37.0, 1.38.0 and `escapeKeys: true` encode every number in numeric order (`NumericKey.ts`). The
12
+ * text of a non-negative integer below 1e16 (1e38 for a bigint) is the same.
13
+ * - **Strings.** With `escapeKeys: true` a key value holding a code point U+0000–U+0025 is escaped
14
+ * (`KeyComposer.escapeKeyText`) in every key. 1.37.0 and 1.38.0 escaped sort keys only. Off, and up to 1.36,
15
+ * none. The structural parts of a key are never escaped.
16
+ * - **Time-series event keys.** Up to 1.36, and off, they hold the orderBy attribute's ENCODED
17
+ * value (a `NumberFromString` `"10"` as the string `10`), and with numeric text its key form
18
+ * (`0000000000000010`): `KeyComposer.eventOrderByValue`.
19
19
  *
20
- * Everything else — the key layout, casing, the history, sentinel, aggregate
21
- * and EventStore key shapes — is unchanged, so these functions compose 1.36's
22
- * bytes through the same `DynamoSchema` composers, fed 1.36's serialization.
23
- * Z-order sort keys are new in 1.37 and have no 1.36 form: `composeAllKeys`
24
- * leaves a Z-order index out.
20
+ * So there are four places a row can be, {@link forms}: each a pair of schemas whose composers give
21
+ * its partition and sort key text. `test/KeyText136.test.ts` checks the composers against golden
22
+ * vectors the published 1.36.0 packages composed.
25
23
  *
26
- * Every function takes the same key-form record its `KeyComposer` counterpart
27
- * does. `test/KeyText136.test.ts` checks them against golden vectors the
28
- * published 1.36.0 packages composed.
29
- *
30
- * The 1.37.x operations read and move rows still under their 1.36 keys while
31
- * the fallback is {@link enabled}; the fallback and this module go in the next
32
- * major release. Not part of the public API.
24
+ * Not part of the public API.
33
25
  */
34
26
  import * as DynamoSchema from "../DynamoSchema.js";
35
27
  import { type IndexDefinition } from "../KeyComposer.js";
36
- /** Whether operations read and move rows under their 1.36 keys (`DynamoSchema.make`'s `legacyKeys`). */
37
- export declare const enabled: (schema: DynamoSchema.DynamoSchema) => boolean;
38
- /**
39
- * Does sort key value text `text` hold a code point 1.37 escapes (U+0000–
40
- * U+0025)? Then its key text differs from 1.36's — and holds an escape, which
41
- * 1.36's text of another value can spell: `foo%20bar` is `foo bar`'s key now.
42
- */
43
- export declare const holdsEscaped: (text: string) => boolean;
44
- /**
45
- * The first character of `text` below `%` (U+0000–U+0024), if any. Escaped
46
- * text never holds one, nor does any text whose casing is escaped text, so a
47
- * stored value holding it is not the 1.36 spelling of an escape.
48
- */
49
- export declare const firstBelowEscape: (text: string) => string | undefined;
50
- /**
51
- * 1.36's composite value text: a number zero-padded to 16 characters, a bigint
52
- * to 38 — `String(n)` padded, so `-3` is `00000000000000-3` and `2.5` is
53
- * `00000000000002.5` — a boolean as `true` / `false`, a date as its ISO
54
- * string. Never throws: 1.36 composed `NaN` as `0000000000000NaN`.
55
- */
56
- export declare const serializeValue: (value: unknown) => string;
57
- /** `KeyComposer.extractComposites` with 1.36's {@link serializeValue}. */
58
- export declare const extractComposites: (composite: ReadonlyArray<string>, record: Record<string, unknown>) => ReadonlyArray<string>;
59
- /** {@link extractComposites}, or `undefined` when a composite is missing. */
60
- export declare const tryExtractComposites: (composite: ReadonlyArray<string>, record: Record<string, unknown>) => ReadonlyArray<string> | undefined;
61
- /** 1.36's partition key of `index` (`KeyComposer.composePk`). */
62
- export declare const composePk: (schema: DynamoSchema.DynamoSchema, entityType: string, index: IndexDefinition, record: Record<string, unknown>) => string;
63
- /** 1.36's sort key of a string-keyed `index` (`KeyComposer.composeSk`), values unescaped. */
64
- export declare const composeSk: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => string;
65
- /** Both 1.36 keys of a string-keyed `index`. */
66
- export declare const composeIndexKeys: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => Record<string, string>;
67
- /** {@link composeIndexKeys}, or `undefined` when a composite is missing (a sparse index). */
68
- export declare const tryComposeIndexKeys: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => Record<string, string> | undefined;
69
- /**
70
- * Every index's 1.36 keys (`KeyComposer.composeAllKeys`): the primary index's
71
- * always, a GSI's when all its composites are present. A Z-order index is new
72
- * in 1.37, so it has none.
73
- */
74
- export declare const composeAllKeys: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, indexes: Record<string, IndexDefinition>, record: Record<string, unknown>) => Record<string, string>;
75
- /**
76
- * 1.36's sort key prefix from the leading sort key composites present in
77
- * `record` (`KeyComposer.composeSortKeyPrefix`).
78
- */
79
- export declare const composeSortKeyPrefix: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => string;
80
- /**
81
- * 1.36's `begins_with` operand: {@link composeSortKeyPrefix}, with the key
82
- * delimiter appended while composites remain unsupplied.
83
- */
84
- export declare const composeSortKeyBeginsWith: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => string;
28
+ /** The schema composing the key text 1.36 composed: what `escapeKeys` off composes. */
29
+ export declare const schema136: (schema: DynamoSchema.DynamoSchema) => DynamoSchema.DynamoSchema;
85
30
  /**
86
- * The condition that selects, under 1.36's key text, the rows a query
87
- * accessor's pins select (`KeyComposer.composeSortKeyCondition`): `eq` on the
88
- * complete key, else `beginsWith` on the prefix and the delimiter.
31
+ * The schema whose partition key text is what 1.37.0 and 1.38.0 stored: its numbers in numeric order, its
32
+ * strings unescaped.
89
33
  */
90
- export declare const composeSortKeyCondition: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => {
91
- readonly eq: string;
92
- } | {
93
- readonly beginsWith: string;
94
- };
34
+ export declare const schema137: (schema: DynamoSchema.DynamoSchema) => DynamoSchema.DynamoSchema;
35
+ /** The schema composing the key text of `escapeKeys: true`. */
36
+ export declare const schemaEscaped: (schema: DynamoSchema.DynamoSchema) => DynamoSchema.DynamoSchema;
37
+ /** One place a row can be stored: the schemas that compose its partition and sort key text. */
38
+ export interface KeyForm {
39
+ readonly pk: DynamoSchema.DynamoSchema;
40
+ readonly sk: DynamoSchema.DynamoSchema;
41
+ }
95
42
  /**
96
- * The condition that selects, under 1.36's key text, the rows an `eq` or
97
- * `beginsWith` bound on sort key composite `field` selects, every composite
98
- * before it pinned in `pinned` (`composeRangeUnder` in `DynamoClient.ts`):
99
- * `eq` on the last composite is its key, on any other the value's subtree (the
100
- * delimiter appended); a `beginsWith` is a prefix of the value's text, or `eq`
101
- * for a number, which has no text prefix.
43
+ * Every place a row can be stored, whatever the setting is now, the current one among them:
44
+ * up to 1.36 and off; 1.37.0 and 1.38.0; on.
102
45
  */
103
- export declare const composeBoundCondition: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, pinned: Record<string, unknown>, field: string, bound: {
104
- readonly eq: unknown;
105
- } | {
106
- readonly beginsWith: unknown;
107
- }) => {
108
- readonly eq: string;
109
- } | {
110
- readonly beginsWith: string;
111
- };
46
+ export declare const forms: (schema: DynamoSchema.DynamoSchema) => ReadonlyArray<KeyForm>;
112
47
  /**
113
- * 1.36's time-series event sort key: `currentSk` (the current item's 1.36 sort
114
- * key), the cased `e` infix and the orderBy attribute's ENCODED value — not
115
- * its key form — through 1.36's {@link serializeValue}, cased.
48
+ * The row 1.37.0 and 1.38.0 stored on an entity with an index half in a table key attribute (inverted): each half
49
+ * was overwritten with the index's, so its partition key attribute holds the sort half's text
50
+ * (escaped), and its sort key attribute the partition half's (not).
116
51
  */
117
- export declare const composeEventSk: (currentSk: string, encodedOrderBy: unknown, casing?: DynamoSchema.Casing) => string;
118
- /** 1.36's unique-constraint sentinel key over the constraint's field values, in order. */
119
- export declare const composeUniqueKey: (schema: DynamoSchema.DynamoSchema, entityType: string, constraintName: string, values: ReadonlyArray<unknown>) => {
120
- readonly pk: string;
121
- readonly sk: string;
122
- };
123
- /** 1.36's vector index partition value, or `undefined` when a composite is missing. */
124
- export declare const tryComposeVectorPartition: (schema: DynamoSchema.DynamoSchema, entityType: string, index: {
125
- readonly partition: ReadonlyArray<string>;
126
- readonly casing?: DynamoSchema.Casing;
127
- }, record: Record<string, unknown>) => string | undefined;
52
+ export declare const invertedForm137: (schema: DynamoSchema.DynamoSchema) => KeyForm;
128
53
  /**
129
- * The 1.36 primary key of the item at `record` when the fallback is
130
- * {@link enabled} and its text differs from `current` — the key 1.37
131
- * composes — else `undefined`: the item can only be at `current`.
54
+ * A row holding no values (a projection's row tombstone or outbox item) says which text its key is
55
+ * by its `__edd_kt__` attribute: none, off's (1.36's), whose text every setting reads the same when
56
+ * nothing in it changes; 1, that of 1.37.0 and 1.38.0; 2, the text of `escapeKeys: true`.
132
57
  */
133
- export declare const changedPrimaryKey: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, primary: IndexDefinition, record: Record<string, unknown>, current: Readonly<Record<string, unknown>>) => Record<string, string> | undefined;
58
+ export declare const formOfMark: (schema: DynamoSchema.DynamoSchema, mark: string | undefined) => KeyForm;
59
+ /** The `__edd_kt__` of a row holding no values, keyed for `record` under `schema` ({@link formOfMark}). */
60
+ export declare const markOf: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => 2 | undefined;
134
61
  /** The JavaScript type a composite's key form takes (`CompositeCodec.keyFormValueKind`). */
135
62
  export type ValueKind = "string" | "number" | "bigint" | "boolean" | undefined;
63
+ /** The partition and sort key of `index` under `form`. Throws when a composite is missing. */
64
+ export declare const composeAt: (form: KeyForm, entityType: string, entityVersion: number, index: IndexDefinition, record: Record<string, unknown>) => Record<string, string>;
136
65
  /**
137
- * The key-form values 1.36 composed `stored` — a primary key `index` stores
138
- * rows under — from, read back from its text, for a row that holds no values
139
- * of its own (a projection's row tombstone or outbox item, which carry only
140
- * the key they were written for). Each composite's text is what lies between
141
- * the key's fixed parts (the prefix, labels and delimiters {@link
142
- * composeIndexKeys} writes around it), turned back into a value by `kindOf`
143
- * ({@link valueOf136}); a reading counts only when {@link composeIndexKeys}
144
- * composes exactly `stored` from it. `undefined` unless exactly one reading
145
- * does: none, when `stored` is not 1.36 text of any values (1.37 text of a
146
- * changed number, say), and more than one when a string value holds the
147
- * delimiter and the next composite's label.
66
+ * The key-form values `form` composed `stored` — a primary key `index` stores rows under — from,
67
+ * read back from its text, for a row that holds no values of its own (a projection's row
68
+ * tombstone or outbox item, which carry only the key they were written for). Each composite's
69
+ * text is what lies between the key's fixed parts (the prefix, labels and delimiters {@link
70
+ * composeAt} writes around it), turned back into a value by `kindOf` ({@link valueOf}); a reading
71
+ * counts only when {@link composeAt} composes exactly `stored` from it. `undefined` unless exactly
72
+ * one reading does: none, when `stored` is not `form`'s text of any values, and more than one when
73
+ * a string value holds the delimiter and the next composite's label. Given several kinds, a
74
+ * composite takes the first whose value composes its own text again: a field that stored both
75
+ * numeric kinds is read one composite at a time, never by trying each combination.
148
76
  *
149
- * A string comes back cased, which composes the same key text, in 1.36 and
150
- * 1.37 alike, as the value it was cased from.
77
+ * A string comes back cased, which composes the same key text as the value it was cased from.
151
78
  */
152
- export declare const readIndexKeys: (schema: DynamoSchema.DynamoSchema, entityType: string, entityVersion: number, index: IndexDefinition, stored: Readonly<Record<string, unknown>>, kindOf: (attr: string) => ValueKind) => Record<string, unknown> | undefined;
79
+ export declare const readIndexKeys: (form: KeyForm, entityType: string, entityVersion: number, index: IndexDefinition, stored: Readonly<Record<string, unknown>>, kindOf: (attr: string) => ValueKind | ReadonlyArray<ValueKind>) => Record<string, unknown> | undefined;
153
80
  //# sourceMappingURL=KeyText136.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeyText136.d.ts","sourceRoot":"","sources":["../../src/internal/KeyText136.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,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