@effect-dynamodb/schema 1.36.1 → 1.38.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/dist/Aggregate.d.ts +19 -11
- package/dist/Aggregate.d.ts.map +1 -1
- package/dist/Aggregate.js.map +1 -1
- package/dist/DynamoModel.d.ts +9 -1
- package/dist/DynamoModel.d.ts.map +1 -1
- package/dist/DynamoModel.js.map +1 -1
- package/dist/DynamoSchema.d.ts +20 -0
- package/dist/DynamoSchema.d.ts.map +1 -1
- package/dist/DynamoSchema.js +14 -0
- package/dist/DynamoSchema.js.map +1 -1
- package/dist/Entity.d.ts +153 -21
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +102 -2
- package/dist/Entity.js.map +1 -1
- package/dist/Errors.d.ts +27 -0
- package/dist/Errors.d.ts.map +1 -1
- package/dist/Errors.js +24 -0
- package/dist/Errors.js.map +1 -1
- package/dist/KeyComposer.d.ts +165 -27
- package/dist/KeyComposer.d.ts.map +1 -1
- package/dist/KeyComposer.js +251 -22
- package/dist/KeyComposer.js.map +1 -1
- package/dist/ZOrder.d.ts +173 -0
- package/dist/ZOrder.d.ts.map +1 -0
- package/dist/ZOrder.js +39 -0
- package/dist/ZOrder.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/AggregateEdges.d.ts +81 -12
- package/dist/internal/AggregateEdges.d.ts.map +1 -1
- package/dist/internal/AggregateEdges.js +17 -21
- package/dist/internal/AggregateEdges.js.map +1 -1
- package/dist/internal/AggregateTypes.d.ts +51 -2
- package/dist/internal/AggregateTypes.d.ts.map +1 -1
- package/dist/internal/CompositeCodec.d.ts +27 -12
- package/dist/internal/CompositeCodec.d.ts.map +1 -1
- package/dist/internal/CompositeCodec.js +93 -23
- package/dist/internal/CompositeCodec.js.map +1 -1
- package/dist/internal/DefaultCrypto.d.ts +12 -13
- package/dist/internal/DefaultCrypto.d.ts.map +1 -1
- package/dist/internal/DefaultCrypto.js +13 -24
- package/dist/internal/DefaultCrypto.js.map +1 -1
- package/dist/internal/EntityConfig.d.ts +13 -10
- package/dist/internal/EntityConfig.d.ts.map +1 -1
- package/dist/internal/EntitySchemas.js +1 -1
- package/dist/internal/EntitySchemas.js.map +1 -1
- package/dist/internal/EntityTypes.d.ts +77 -2
- package/dist/internal/EntityTypes.d.ts.map +1 -1
- package/dist/internal/KeyText136.d.ts +153 -0
- package/dist/internal/KeyText136.d.ts.map +1 -0
- package/dist/internal/KeyText136.js +357 -0
- package/dist/internal/KeyText136.js.map +1 -0
- package/dist/internal/NumericKey.d.ts +71 -0
- package/dist/internal/NumericKey.d.ts.map +1 -0
- package/dist/internal/NumericKey.js +128 -0
- package/dist/internal/NumericKey.js.map +1 -0
- package/dist/internal/SchemaAccessors.d.ts +6 -5
- package/dist/internal/SchemaAccessors.d.ts.map +1 -1
- package/dist/internal/SchemaAccessors.js +6 -5
- package/dist/internal/SchemaAccessors.js.map +1 -1
- package/dist/internal/ZOrderCurve.d.ts +256 -0
- package/dist/internal/ZOrderCurve.d.ts.map +1 -0
- package/dist/internal/ZOrderCurve.js +630 -0
- package/dist/internal/ZOrderCurve.js.map +1 -0
- package/dist/internal/ZOrderDimension.d.ts +70 -0
- package/dist/internal/ZOrderDimension.d.ts.map +1 -0
- package/dist/internal/ZOrderDimension.js +283 -0
- package/dist/internal/ZOrderDimension.js.map +1 -0
- package/package.json +4 -4
|
@@ -10,24 +10,25 @@
|
|
|
10
10
|
*
|
|
11
11
|
* **The rule.** Compose from the **Encoded** form, EXCEPT when the domain type
|
|
12
12
|
* is numeric (`number` / `bigint`) and the encoded form is a **string** — then
|
|
13
|
-
* compose from the numeric **Type** form so `KeyComposer.serializeValue`
|
|
14
|
-
* it.
|
|
13
|
+
* compose from the numeric **Type** form so `KeyComposer.serializeValue`
|
|
14
|
+
* encodes it in numeric order.
|
|
15
15
|
*
|
|
16
16
|
* | composite | Type | Encoded | key uses |
|
|
17
17
|
* |---|---|---|---|
|
|
18
|
-
* | `Schema.Number` | number | number | encoded (already
|
|
19
|
-
* | `Schema.BigInt` | bigint | bigint | encoded (already
|
|
20
|
-
* | `Schema.BigIntFromString` | bigint | string | **Type** — a string would
|
|
18
|
+
* | `Schema.Number` | number | number | encoded (already numeric) |
|
|
19
|
+
* | `Schema.BigInt` | bigint | bigint | encoded (already numeric) |
|
|
20
|
+
* | `Schema.BigIntFromString` | bigint | string | **Type** — a string would sort as text |
|
|
21
21
|
* | `Schema.NumberFromString` | number | string | **Type** — same shape |
|
|
22
|
-
* | `DynamoModel.DateEpochMs` | DateTime | number | encoded — epoch,
|
|
22
|
+
* | `DynamoModel.DateEpochMs` | DateTime | number | encoded — epoch, numeric |
|
|
23
23
|
* | `Schema.Date` / `DateTimeUtc` | Date | ISO string | encoded — ISO sorts correctly |
|
|
24
24
|
* | untransformed string | string | string | encoded (identical) |
|
|
25
25
|
*
|
|
26
|
-
* The exception exists because `serializeValue`
|
|
27
|
-
*
|
|
28
|
-
* nothing to a string. Composing the
|
|
29
|
-
*
|
|
30
|
-
* 100 < 42 < 5 — so `gte(42n)` returned 42
|
|
26
|
+
* The exception exists because `serializeValue` encodes numbers and bigints so
|
|
27
|
+
* their key text sorts in numeric order (a non-negative integer zero-padded to
|
|
28
|
+
* 16 digits, 38 for a bigint), and does nothing to a string. Composing the
|
|
29
|
+
* encoded `"42"` of a `BigIntFromString` stored `txn_42` alongside `txn_100`
|
|
30
|
+
* and `txn_5`, which DynamoDB orders 100 < 42 < 5 — so `gte(42n)` returned 42
|
|
31
|
+
* and 5 instead of 42 and 100.
|
|
31
32
|
*
|
|
32
33
|
* Not part of the public API.
|
|
33
34
|
*/
|
|
@@ -49,7 +50,8 @@ export type CompositeKeyForm = (attr: string, value: unknown) => unknown;
|
|
|
49
50
|
* numeric Type value: keep a `number` / `bigint` as-is, otherwise `decode`
|
|
50
51
|
* to reach it.
|
|
51
52
|
* 3. **Anything else** — target is the Encoded value. A field with no encoding
|
|
52
|
-
* transformation is identity by construction (
|
|
53
|
+
* transformation is identity by construction (a numeric one still coerced
|
|
54
|
+
* to its declared kind, as in case 2) (`SchemaAST` documents
|
|
53
55
|
* `encoding === undefined` as "type and encoded forms are identical"), and
|
|
54
56
|
* is passed through WITHOUT attempting an encode — an open sort key bound
|
|
55
57
|
* like `gte(t.status, "d")` on a `Schema.Literals` composite is deliberately
|
|
@@ -80,4 +82,17 @@ export declare const toCompositeKeyRecord: (keyForm: CompositeKeyForm, record: R
|
|
|
80
82
|
export type CompositeKeyFormKind = "absent" | "identity" | "type-numeric" | "encoded";
|
|
81
83
|
/** Classify one composite attribute of a model/derived schema. */
|
|
82
84
|
export declare const compositeKeyFormKind: (source: Schema.Top, attr: string) => CompositeKeyFormKind;
|
|
85
|
+
/** The JavaScript type a composite's key form takes, when its schema says. */
|
|
86
|
+
export type KeyFormValueKind = "string" | "number" | "bigint" | "boolean";
|
|
87
|
+
/**
|
|
88
|
+
* The kind of value a field's key form is — the numeric Type for a numeric
|
|
89
|
+
* field encoded as a string (case 2), else its Encoded side — or `undefined`
|
|
90
|
+
* when the schema doesn't pin one (a union of kinds, an object, …).
|
|
91
|
+
*/
|
|
92
|
+
export declare const keyFormValueKind: (field: Schema.Top) => KeyFormValueKind | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The literal members a field's key form is limited to (a literal, a union of
|
|
95
|
+
* literals or an enum), or `undefined` when it isn't limited to literals.
|
|
96
|
+
*/
|
|
97
|
+
export declare const keyFormLiterals: (field: Schema.Top) => ReadonlyArray<string | number | boolean> | undefined;
|
|
83
98
|
//# sourceMappingURL=CompositeCodec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeCodec.d.ts","sourceRoot":"","sources":["../../src/internal/CompositeCodec.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CompositeCodec.d.ts","sourceRoot":"","sources":["../../src/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ded** form, EXCEPT when the domain type
|
|
12
12
|
* is numeric (`number` / `bigint`) and the encoded form is a **string** — then
|
|
13
|
-
* compose from the numeric **Type** form so `KeyComposer.serializeValue`
|
|
14
|
-
* it.
|
|
13
|
+
* compose from the numeric **Type** form so `KeyComposer.serializeValue`
|
|
14
|
+
* encodes it in numeric order.
|
|
15
15
|
*
|
|
16
16
|
* | composite | Type | Encoded | key uses |
|
|
17
17
|
* |---|---|---|---|
|
|
18
|
-
* | `Schema.Number` | number | number | encoded (already
|
|
19
|
-
* | `Schema.BigInt` | bigint | bigint | encoded (already
|
|
20
|
-
* | `Schema.BigIntFromString` | bigint | string | **Type** — a string would
|
|
18
|
+
* | `Schema.Number` | number | number | encoded (already numeric) |
|
|
19
|
+
* | `Schema.BigInt` | bigint | bigint | encoded (already numeric) |
|
|
20
|
+
* | `Schema.BigIntFromString` | bigint | string | **Type** — a string would sort as text |
|
|
21
21
|
* | `Schema.NumberFromString` | number | string | **Type** — same shape |
|
|
22
|
-
* | `DynamoModel.DateEpochMs` | DateTime | number | encoded — epoch,
|
|
22
|
+
* | `DynamoModel.DateEpochMs` | DateTime | number | encoded — epoch, numeric |
|
|
23
23
|
* | `Schema.Date` / `DateTimeUtc` | Date | ISO string | encoded — ISO sorts correctly |
|
|
24
24
|
* | untransformed string | string | string | encoded (identical) |
|
|
25
25
|
*
|
|
26
|
-
* The exception exists because `serializeValue`
|
|
27
|
-
*
|
|
28
|
-
* nothing to a string. Composing the
|
|
29
|
-
*
|
|
30
|
-
* 100 < 42 < 5 — so `gte(42n)` returned 42
|
|
26
|
+
* The exception exists because `serializeValue` encodes numbers and bigints so
|
|
27
|
+
* their key text sorts in numeric order (a non-negative integer zero-padded to
|
|
28
|
+
* 16 digits, 38 for a bigint), and does nothing to a string. Composing the
|
|
29
|
+
* encoded `"42"` of a `BigIntFromString` stored `txn_42` alongside `txn_100`
|
|
30
|
+
* and `txn_5`, which DynamoDB orders 100 < 42 < 5 — so `gte(42n)` returned 42
|
|
31
|
+
* and 5 instead of 42 and 100.
|
|
31
32
|
*
|
|
32
33
|
* Not part of the public API.
|
|
33
34
|
*/
|
|
@@ -44,7 +45,8 @@ import { getSchemaFields, hasEncodingTransformation, numericTypeWithStringEncodi
|
|
|
44
45
|
* numeric Type value: keep a `number` / `bigint` as-is, otherwise `decode`
|
|
45
46
|
* to reach it.
|
|
46
47
|
* 3. **Anything else** — target is the Encoded value. A field with no encoding
|
|
47
|
-
* transformation is identity by construction (
|
|
48
|
+
* transformation is identity by construction (a numeric one still coerced
|
|
49
|
+
* to its declared kind, as in case 2) (`SchemaAST` documents
|
|
48
50
|
* `encoding === undefined` as "type and encoded forms are identical"), and
|
|
49
51
|
* is passed through WITHOUT attempting an encode — an open sort key bound
|
|
50
52
|
* like `gte(t.status, "d")` on a `Schema.Literals` composite is deliberately
|
|
@@ -72,14 +74,14 @@ export const makeCompositeKeyForm = (source, onError) => {
|
|
|
72
74
|
// Case 2 — the numeric exception. Target is the Type side, and it must be
|
|
73
75
|
// the DECLARED numeric kind, not merely "some number".
|
|
74
76
|
//
|
|
75
|
-
// `KeyComposer.serializeValue`
|
|
76
|
-
//
|
|
77
|
-
// 16-wide key where the write composed 38. That is not
|
|
78
|
-
// stored `bigint` attribute marshalls to `{ N: "420" }` and
|
|
79
|
-
// back as a **number**, so any path that re-derives a key from
|
|
80
|
-
// (`Aggregate.list`) lands here with the wrong kind and
|
|
81
|
-
// nothing. Coercing to the declared kind is the same rule,
|
|
82
|
-
// exactly; a value already of the right kind is unaffected.
|
|
77
|
+
// `KeyComposer.serializeValue` encodes by JS type — a number zero-padded to
|
|
78
|
+
// 16 digits, a bigint to 38 — so a `bigint` composite handed a `number`
|
|
79
|
+
// composes a 16-wide key where the write composed 38. That is not
|
|
80
|
+
// hypothetical: a stored `bigint` attribute marshalls to `{ N: "420" }` and
|
|
81
|
+
// unmarshalls back as a **number**, so any path that re-derives a key from
|
|
82
|
+
// a stored row (`Aggregate.list`) lands here with the wrong kind and
|
|
83
|
+
// silently finds nothing. Coercing to the declared kind is the same rule,
|
|
84
|
+
// applied exactly; a value already of the right kind is unaffected.
|
|
83
85
|
if (numericTypeWithStringEncoding(field)) {
|
|
84
86
|
const wantsBigInt = SchemaAST.isBigInt(SchemaAST.toType(field.ast));
|
|
85
87
|
const decode = Schema.decodeUnknownOption(codec);
|
|
@@ -99,10 +101,20 @@ export const makeCompositeKeyForm = (source, onError) => {
|
|
|
99
101
|
cache.set(attr, fn);
|
|
100
102
|
return fn;
|
|
101
103
|
}
|
|
102
|
-
// Case 3a — identity by construction.
|
|
104
|
+
// Case 3a — identity by construction. A numeric field still takes its
|
|
105
|
+
// declared kind, for the reason case 2 does: a stored `Schema.BigInt`
|
|
106
|
+
// value unmarshalls as a number (and a `Schema.Number` past 2^53 as a
|
|
107
|
+
// bigint), so a key re-derived from a stored row would compose at the
|
|
108
|
+
// other kind's width.
|
|
103
109
|
if (!hasEncodingTransformation(field)) {
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
const kind = keyFormValueKind(field);
|
|
111
|
+
const fn = kind === "bigint"
|
|
112
|
+
? (value) => typeof value === "number" && Number.isInteger(value) ? BigInt(value) : value
|
|
113
|
+
: kind === "number"
|
|
114
|
+
? (value) => (typeof value === "bigint" ? Number(value) : value)
|
|
115
|
+
: null;
|
|
116
|
+
cache.set(attr, fn);
|
|
117
|
+
return fn;
|
|
106
118
|
}
|
|
107
119
|
// Case 3b — target is the Encoded side.
|
|
108
120
|
const encode = Schema.encodeUnknownOption(codec);
|
|
@@ -151,4 +163,62 @@ export const compositeKeyFormKind = (source, attr) => {
|
|
|
151
163
|
return "identity";
|
|
152
164
|
return "encoded";
|
|
153
165
|
};
|
|
166
|
+
const astKeyFormValueKind = (ast) => {
|
|
167
|
+
if (SchemaAST.isString(ast) || SchemaAST.isTemplateLiteral(ast))
|
|
168
|
+
return "string";
|
|
169
|
+
if (SchemaAST.isNumber(ast))
|
|
170
|
+
return "number";
|
|
171
|
+
if (SchemaAST.isBigInt(ast))
|
|
172
|
+
return "bigint";
|
|
173
|
+
if (SchemaAST.isBoolean(ast))
|
|
174
|
+
return "boolean";
|
|
175
|
+
if (SchemaAST.isLiteral(ast))
|
|
176
|
+
return typeof ast.literal;
|
|
177
|
+
const kinds = SchemaAST.isEnum(ast)
|
|
178
|
+
? ast.enums.map(([, value]) => typeof value)
|
|
179
|
+
: SchemaAST.isUnion(ast)
|
|
180
|
+
? ast.types
|
|
181
|
+
.filter((member) => !SchemaAST.isUndefined(member) && !SchemaAST.isNull(member))
|
|
182
|
+
.map((member) => astKeyFormValueKind(member))
|
|
183
|
+
: [undefined];
|
|
184
|
+
const [first] = kinds;
|
|
185
|
+
return first !== undefined && kinds.every((kind) => kind === first) ? first : undefined;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* The kind of value a field's key form is — the numeric Type for a numeric
|
|
189
|
+
* field encoded as a string (case 2), else its Encoded side — or `undefined`
|
|
190
|
+
* when the schema doesn't pin one (a union of kinds, an object, …).
|
|
191
|
+
*/
|
|
192
|
+
export const keyFormValueKind = (field) => {
|
|
193
|
+
if (numericTypeWithStringEncoding(field)) {
|
|
194
|
+
return SchemaAST.isBigInt(SchemaAST.toType(field.ast)) ? "bigint" : "number";
|
|
195
|
+
}
|
|
196
|
+
return astKeyFormValueKind(SchemaAST.toEncoded(field.ast));
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* The literal members a field's key form is limited to (a literal, a union of
|
|
200
|
+
* literals or an enum), or `undefined` when it isn't limited to literals.
|
|
201
|
+
*/
|
|
202
|
+
export const keyFormLiterals = (field) => {
|
|
203
|
+
const members = (ast) => {
|
|
204
|
+
if (SchemaAST.isLiteral(ast))
|
|
205
|
+
return [ast.literal];
|
|
206
|
+
if (SchemaAST.isEnum(ast))
|
|
207
|
+
return ast.enums.map(([, value]) => value);
|
|
208
|
+
if (SchemaAST.isUnion(ast)) {
|
|
209
|
+
const found = [];
|
|
210
|
+
for (const member of ast.types) {
|
|
211
|
+
if (SchemaAST.isUndefined(member) || SchemaAST.isNull(member))
|
|
212
|
+
continue;
|
|
213
|
+
const inner = members(member);
|
|
214
|
+
if (inner === undefined)
|
|
215
|
+
return undefined;
|
|
216
|
+
found.push(...inner);
|
|
217
|
+
}
|
|
218
|
+
return found;
|
|
219
|
+
}
|
|
220
|
+
return undefined;
|
|
221
|
+
};
|
|
222
|
+
return members(SchemaAST.toEncoded(field.ast));
|
|
223
|
+
};
|
|
154
224
|
//# sourceMappingURL=CompositeCodec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeCodec.js","sourceRoot":"","sources":["../../src/internal/CompositeCodec.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CompositeCodec.js","sourceRoot":"","sources":["../../src/internal/CompositeCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClD,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAA;AAS7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAAkB,EAClB,OAAgD,EAC9B,EAAE;IACpB,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IACtC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAgD,CAAA;IAErE,MAAM,OAAO,GAAG,CAAC,IAAY,EAAwC,EAAE;QACrE,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,MAAM,CAAA;QAEvC,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;QAC5B,UAAU;QACV,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;Y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C,MAAM,CAAC;oBAAE,SAAQ;gBACvE,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;gBAC7B,IAAI,KAAK,KAAK,SAAS;oBAAE,OAAO,SAAS,CAAA;gBACzC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;YACtB,CAAC;YACD,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC,CAAA;IACD,OAAO,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAEhC,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @internal Default `
|
|
2
|
+
* @internal Default `SecureRandom` service for the typed client.
|
|
3
3
|
*
|
|
4
|
-
* `DynamoClient.make()` bundles a default {@link
|
|
5
|
-
* captured context so that bound entity operations (e.g.
|
|
6
|
-
* primary keys via `generatedId`) can resolve a
|
|
7
|
-
* WITHOUT widening the public `R` of bound
|
|
8
|
-
* `R = never` — the service is provided from the
|
|
9
|
-
* surfaced as a requirement.
|
|
4
|
+
* `DynamoClient.make()` bundles a default {@link SecureRandom.SecureRandom}
|
|
5
|
+
* service into the captured context so that bound entity operations (e.g.
|
|
6
|
+
* auto-generated UUID primary keys via `generatedId`) can resolve a
|
|
7
|
+
* cryptographically-secure source WITHOUT widening the public `R` of bound
|
|
8
|
+
* methods. Bound `put` stays `R = never` — the service is provided from the
|
|
9
|
+
* bundled context, never surfaced as a requirement.
|
|
10
10
|
*
|
|
11
11
|
* The implementation is a thin wrapper over the global Web Crypto API
|
|
12
12
|
* (`globalThis.crypto`), available on Node 19+ (Node 18 only with
|
|
@@ -14,13 +14,12 @@
|
|
|
14
14
|
* NO new dependency. Consumers needing a platform-specific source (e.g.
|
|
15
15
|
* `@effect/platform-node`) may override it via `DynamoClient.make({ crypto })`.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { SecureRandom } from "effect/crypto";
|
|
18
18
|
/**
|
|
19
|
-
* Build the default `
|
|
19
|
+
* Build the default `SecureRandom` service backed by `globalThis.crypto`.
|
|
20
20
|
*
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
* `Crypto.make`'s constructor contract.
|
|
21
|
+
* `crypto.getRandomValues` is synchronous and a CSPRNG. Each service orders its
|
|
22
|
+
* own UUIDv7s and ULIDs, so a client gets its own ordering.
|
|
24
23
|
*/
|
|
25
|
-
export declare const makeDefaultCrypto: () =>
|
|
24
|
+
export declare const makeDefaultCrypto: () => SecureRandom.SecureRandom["Service"];
|
|
26
25
|
//# sourceMappingURL=DefaultCrypto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCrypto.d.ts","sourceRoot":"","sources":["../../src/internal/DefaultCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultCrypto.d.ts","sourceRoot":"","sources":["../../src/internal/DefaultCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAO,YAAY,CAAC,YAAY,CAAC,SAAS,CAIvE,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @internal Default `
|
|
2
|
+
* @internal Default `SecureRandom` service for the typed client.
|
|
3
3
|
*
|
|
4
|
-
* `DynamoClient.make()` bundles a default {@link
|
|
5
|
-
* captured context so that bound entity operations (e.g.
|
|
6
|
-
* primary keys via `generatedId`) can resolve a
|
|
7
|
-
* WITHOUT widening the public `R` of bound
|
|
8
|
-
* `R = never` — the service is provided from the
|
|
9
|
-
* surfaced as a requirement.
|
|
4
|
+
* `DynamoClient.make()` bundles a default {@link SecureRandom.SecureRandom}
|
|
5
|
+
* service into the captured context so that bound entity operations (e.g.
|
|
6
|
+
* auto-generated UUID primary keys via `generatedId`) can resolve a
|
|
7
|
+
* cryptographically-secure source WITHOUT widening the public `R` of bound
|
|
8
|
+
* methods. Bound `put` stays `R = never` — the service is provided from the
|
|
9
|
+
* bundled context, never surfaced as a requirement.
|
|
10
10
|
*
|
|
11
11
|
* The implementation is a thin wrapper over the global Web Crypto API
|
|
12
12
|
* (`globalThis.crypto`), available on Node 19+ (Node 18 only with
|
|
@@ -14,27 +14,16 @@
|
|
|
14
14
|
* NO new dependency. Consumers needing a platform-specific source (e.g.
|
|
15
15
|
* `@effect/platform-node`) may override it via `DynamoClient.make({ crypto })`.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { SecureRandom } from "effect/crypto";
|
|
18
18
|
/**
|
|
19
|
-
* Build the default `
|
|
19
|
+
* Build the default `SecureRandom` service backed by `globalThis.crypto`.
|
|
20
20
|
*
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
* `Crypto.make`'s constructor contract.
|
|
21
|
+
* `crypto.getRandomValues` is synchronous and a CSPRNG. Each service orders its
|
|
22
|
+
* own UUIDv7s and ULIDs, so a client gets its own ordering.
|
|
24
23
|
*/
|
|
25
24
|
export const makeDefaultCrypto = () => {
|
|
26
25
|
const webCrypto = globalThis.crypto;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
randomBytes: (size) => webCrypto.getRandomValues(new Uint8Array(size)),
|
|
30
|
-
digest: (algorithm, data) => Effect.tryPromise({
|
|
31
|
-
try: () => webCrypto.subtle.digest(algorithm, data),
|
|
32
|
-
catch: (cause) => PlatformError.badArgument({
|
|
33
|
-
module: "Crypto",
|
|
34
|
-
method: "digest",
|
|
35
|
-
description: `digest failed: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
36
|
-
}),
|
|
37
|
-
}).pipe(Effect.map((buf) => new Uint8Array(buf))),
|
|
38
|
-
});
|
|
26
|
+
// SecureRandom.make requires a fresh array per call (it mutates UUID bytes).
|
|
27
|
+
return SecureRandom.make((size) => webCrypto.getRandomValues(new Uint8Array(size)));
|
|
39
28
|
};
|
|
40
29
|
//# sourceMappingURL=DefaultCrypto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCrypto.js","sourceRoot":"","sources":["../../src/internal/DefaultCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultCrypto.js","sourceRoot":"","sources":["../../src/internal/DefaultCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAyC,EAAE;IAC1E,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAA;IACnC,6EAA6E;IAC7E,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACrF,CAAC,CAAA"}
|
|
@@ -73,9 +73,9 @@ export type SoftDeleteConfig = boolean | {
|
|
|
73
73
|
*
|
|
74
74
|
* Mutually exclusive with `versioned` (EDD-9012) and `softDelete` (EDD-9015).
|
|
75
75
|
*/
|
|
76
|
-
export type TimeSeriesConfig<TAppendInput extends Schema.Top = Schema.Top> = {
|
|
76
|
+
export type TimeSeriesConfig<TAppendInput extends Schema.Top = Schema.Top, F extends string = string> = {
|
|
77
77
|
/** Model attribute used as the monotonic clock for CAS and event SK decoration. Required. */
|
|
78
|
-
readonly orderBy:
|
|
78
|
+
readonly orderBy: F;
|
|
79
79
|
/** TTL applied to event items (not current). Omit for retention-forever. */
|
|
80
80
|
readonly ttl?: Duration.Duration | string;
|
|
81
81
|
/**
|
|
@@ -98,7 +98,7 @@ export type TimeSeriesConfig<TAppendInput extends Schema.Top = Schema.Top> = {
|
|
|
98
98
|
*
|
|
99
99
|
* When set, `put` / `create` / `upsert` fill the named field with a freshly
|
|
100
100
|
* generated UUID at write time **when the caller omits it** — a caller-supplied
|
|
101
|
-
* value is always respected. The id is sourced from the bundled `
|
|
101
|
+
* value is always respected. The id is sourced from the bundled `SecureRandom`
|
|
102
102
|
* service (`DynamoClient.make` provides a default; override via
|
|
103
103
|
* `DynamoClient.make({ crypto })`), so bound operations keep `R = never`.
|
|
104
104
|
*
|
|
@@ -107,18 +107,21 @@ export type TimeSeriesConfig<TAppendInput extends Schema.Top = Schema.Top> = {
|
|
|
107
107
|
*
|
|
108
108
|
* - `version` — `"v4"` (default, random) or `"v7"` (time-ordered).
|
|
109
109
|
*/
|
|
110
|
-
export type GeneratedIdConfig = {
|
|
111
|
-
readonly field:
|
|
110
|
+
export type GeneratedIdConfig<F extends string = string> = {
|
|
111
|
+
readonly field: F;
|
|
112
112
|
readonly version?: "v4" | "v7";
|
|
113
113
|
};
|
|
114
|
-
/**
|
|
115
|
-
|
|
114
|
+
/**
|
|
115
|
+
* An array of model field names that together form a unique constraint. `F`
|
|
116
|
+
* is the model's field names on `Entity.make`.
|
|
117
|
+
*/
|
|
118
|
+
export type UniqueFieldsDef<F extends string = string> = ReadonlyArray<F>;
|
|
116
119
|
/**
|
|
117
120
|
* A unique constraint definition — either a simple field list or an object
|
|
118
121
|
* with additional options like TTL for sentinel items.
|
|
119
122
|
*/
|
|
120
|
-
export type UniqueConstraintDef = UniqueFieldsDef | {
|
|
121
|
-
readonly fields: UniqueFieldsDef
|
|
123
|
+
export type UniqueConstraintDef<F extends string = string> = UniqueFieldsDef<F> | {
|
|
124
|
+
readonly fields: UniqueFieldsDef<F>;
|
|
122
125
|
readonly ttl?: Duration.Duration | string | undefined;
|
|
123
126
|
};
|
|
124
127
|
/**
|
|
@@ -127,7 +130,7 @@ export type UniqueConstraintDef = UniqueFieldsDef | {
|
|
|
127
130
|
*
|
|
128
131
|
* Enforced via DynamoDB transaction sentinel items.
|
|
129
132
|
*/
|
|
130
|
-
export type UniqueConfig = globalThis.Record<string, UniqueConstraintDef
|
|
133
|
+
export type UniqueConfig<F extends string = string> = globalThis.Record<string, UniqueConstraintDef<F>>;
|
|
131
134
|
/**
|
|
132
135
|
* Per-ref cascade index configuration. Tells Entity.make() which physical GSI
|
|
133
136
|
* to use for auto-generated cascade indexes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityConfig.d.ts","sourceRoot":"","sources":["../../src/internal/EntityConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,MAAM,CAAC,GAAG,GACV;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,GAAG,SAAS,CAAA;CAAE,CAAA;AAErF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP;IACE,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAA;CACxC,CAAA;AAEL;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,GACP;IACE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAA;CAC1C,CAAA;AAEL;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP;IACE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,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,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IACvC,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAA;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAA;CACtC"}
|
|
@@ -1658,7 +1658,7 @@ export const buildDerivedSchemas = (modelFields, indexes, systemFields, resolved
|
|
|
1658
1658
|
if (systemFields.updatedAtCollision && systemFields.updatedAt)
|
|
1659
1659
|
optionalOnCollide.add(systemFields.updatedAt);
|
|
1660
1660
|
// Auto-generated id: optional in input (caller may omit and let the library
|
|
1661
|
-
// fill it from the
|
|
1661
|
+
// fill it from the SecureRandom service) but required in recordSchema (a decoded
|
|
1662
1662
|
// record always carries it). Reuses the system-collision optionality path.
|
|
1663
1663
|
if (generatedIdField)
|
|
1664
1664
|
optionalOnCollide.add(generatedIdField);
|