effect-dynamodb 1.3.3 → 1.4.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.
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * Marshaller — Thin wrapper around @aws-sdk/util-dynamodb for converting
3
- * between JS objects and DynamoDB attribute maps, plus date-aware serialization
4
- * for DynamoEncoding-annotated fields.
3
+ * between JS objects and DynamoDB attribute maps.
4
+ *
5
+ * Date-aware (de)serialization is no longer handled here — both Entity and
6
+ * Aggregate now route date conversion through substituted bidirectional
7
+ * Schema transforms (`buildDateTransform` in `internal/EntitySchemas.ts`)
8
+ * and the standard `Schema.encode` / `Schema.decode` pipelines.
5
9
  */
6
10
  import { marshall, unmarshall } from "@aws-sdk/util-dynamodb";
7
- import { DateTime } from "effect";
8
11
  /** Marshall a JS object to a DynamoDB attribute map */
9
12
  export const toAttributeMap = (item) => marshall(item, { removeUndefinedValues: true, convertClassInstanceToMap: true });
10
13
  /** Unmarshall a DynamoDB attribute map to a JS object */
@@ -13,103 +16,4 @@ export const fromAttributeMap = (item) => unmarshall(item);
13
16
  export const toAttributeValue = (value) => marshall({ v: value }, { removeUndefinedValues: true, convertClassInstanceToMap: true }).v;
14
17
  /** Unmarshall a single DynamoDB attribute value */
15
18
  export const fromAttributeValue = (value) => unmarshall({ v: value }).v;
16
- // ---------------------------------------------------------------------------
17
- // Date-aware serialization for DynamoEncoding-annotated fields
18
- // ---------------------------------------------------------------------------
19
- /**
20
- * Convert a domain date value to the storage primitive based on DynamoEncoding.
21
- *
22
- * Domain types supported:
23
- * - `DateTime.Utc` → ISO string, epoch ms, or epoch seconds
24
- * - `DateTime.Zoned` → extended ISO string (only "string" storage)
25
- * - `Date` → ISO string, epoch ms, or epoch seconds
26
- */
27
- export const serializeDateForDynamo = (value, encoding) => {
28
- let epochMs;
29
- if (DateTime.isDateTime(value)) {
30
- epochMs = DateTime.toEpochMillis(value);
31
- }
32
- else if (value instanceof Date) {
33
- epochMs = value.getTime();
34
- }
35
- else {
36
- throw new Error(`serializeDateForDynamo: unsupported value type: ${typeof value}`);
37
- }
38
- switch (encoding.storage) {
39
- case "string":
40
- if (encoding.domain === "DateTime.Zoned" &&
41
- DateTime.isDateTime(value) &&
42
- DateTime.isZoned(value)) {
43
- return DateTime.formatIsoZoned(value);
44
- }
45
- return new Date(epochMs).toISOString();
46
- case "epochMs":
47
- return epochMs;
48
- case "epochSeconds":
49
- return Math.floor(epochMs / 1000);
50
- }
51
- };
52
- /**
53
- * Convert a DynamoDB storage primitive back to the domain value based on DynamoEncoding.
54
- */
55
- export const deserializeDateFromDynamo = (stored, encoding) => {
56
- const label = `${encoding.domain}/${encoding.storage}`;
57
- switch (encoding.domain) {
58
- case "DateTime.Zoned": {
59
- if (typeof stored !== "string") {
60
- throw new Error(`deserializeDateFromDynamo: expected string for ${label}, got ${typeof stored}`);
61
- }
62
- try {
63
- const match = stored.match(/^(.+)\[(.+)\]$/);
64
- if (match) {
65
- const utc = DateTime.makeUnsafe(match[1]);
66
- return DateTime.makeZonedUnsafe(utc, { timeZone: match[2] });
67
- }
68
- // Offset-only or plain ISO → treat as UTC-zoned
69
- const utc = DateTime.makeUnsafe(stored);
70
- return DateTime.makeZonedUnsafe(utc, { timeZone: "UTC" });
71
- }
72
- catch (e) {
73
- throw new Error(`deserializeDateFromDynamo: invalid DateTime.Zoned value "${stored}": ${e instanceof Error ? e.message : e}`);
74
- }
75
- }
76
- case "DateTime.Utc": {
77
- if (encoding.storage === "string") {
78
- if (typeof stored !== "string") {
79
- throw new Error(`deserializeDateFromDynamo: expected string for ${label}, got ${typeof stored}`);
80
- }
81
- try {
82
- return DateTime.makeUnsafe(stored);
83
- }
84
- catch (e) {
85
- throw new Error(`deserializeDateFromDynamo: invalid DateTime.Utc value "${stored}": ${e instanceof Error ? e.message : e}`);
86
- }
87
- }
88
- if (typeof stored !== "number" || !Number.isFinite(stored)) {
89
- throw new Error(`deserializeDateFromDynamo: expected finite number for ${label}, got ${typeof stored === "number" ? stored : typeof stored}`);
90
- }
91
- if (encoding.storage === "epochMs")
92
- return DateTime.makeUnsafe(stored);
93
- return DateTime.makeUnsafe(stored * 1000);
94
- }
95
- case "Date": {
96
- if (encoding.storage === "string") {
97
- if (typeof stored !== "string") {
98
- throw new Error(`deserializeDateFromDynamo: expected string for ${label}, got ${typeof stored}`);
99
- }
100
- const d = new Date(stored);
101
- if (Number.isNaN(d.getTime())) {
102
- throw new Error(`deserializeDateFromDynamo: invalid Date value "${stored}"`);
103
- }
104
- return d;
105
- }
106
- if (typeof stored !== "number" || !Number.isFinite(stored)) {
107
- throw new Error(`deserializeDateFromDynamo: expected finite number for ${label}, got ${typeof stored === "number" ? stored : typeof stored}`);
108
- }
109
- if (encoding.storage === "epochMs")
110
- return new Date(stored);
111
- return new Date(stored * 1000);
112
- }
113
- }
114
- };
115
19
  //# sourceMappingURL=Marshaller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Marshaller.js","sourceRoot":"","sources":["../src/Marshaller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGjC,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAA6B,EAAkC,EAAE,CAC9F,QAAQ,CAAC,IAAI,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAA;AAElF,yDAAyD;AACzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAoC,EAA2B,EAAE,CAChG,UAAU,CAAC,IAAI,CAAC,CAAA;AAElB,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAkB,EAAE,CACjE,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,qBAAqB,EAAE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AC,MAAM,kBAAkB,GAAG,CAAC,KAAqB,EAAW,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA"}
@@ -57,35 +57,112 @@ export declare const getFields: (model: Schema.Top) => SchemaFields;
57
57
  * Detection uses the typeConstructor annotation from Effect's schema AST.
58
58
  */
59
59
  export declare const inferDefaultEncoding: (schema: Schema.Top) => DynamoEncoding | undefined;
60
+ /**
61
+ * Returns true when the schema is a "self" schema — i.e. it carries no
62
+ * encoding transformation. Self schemas have `ast.encoding === undefined`.
63
+ *
64
+ * - `Schema.DateTimeUtc` — self
65
+ * - `Schema.DateTimeUtcFromString` — transform (encodes to string)
66
+ * - `Schema.RedactedFromValue(...)` — transform
67
+ * - any `.pipe(Schema.decodeTo(...))` chain — transform
68
+ */
69
+ export declare const isSelfSchema: (schema: Schema.Top) => boolean;
70
+ /**
71
+ * True if the schema is a self DateTime/Date schema that can have its storage
72
+ * configured via a DynamoEncoding annotation. Distinguished from a transform
73
+ * by `ast.encoding === undefined`.
74
+ */
75
+ export declare const isSelfDateSchema: (schema: Schema.Top) => boolean;
76
+ /**
77
+ * Returns true when the schema is a transform schema with a date typeConstructor
78
+ * (e.g. `Schema.DateTimeUtcFromString`, `DynamoModel.DateEpochSeconds`).
79
+ * Used to enforce the "transform owns the wire format" policy at Entity.make().
80
+ */
81
+ export declare const isDateTransform: (schema: Schema.Top) => boolean;
82
+ /**
83
+ * Build a bidirectional Schema for a given DynamoEncoding.
84
+ *
85
+ * The encoded side is `Schema.Any` so `decode` tolerates either:
86
+ * - the wire primitive (string / number) — the storage-shape input, OR
87
+ * - a domain value (`DateTime.Utc`, `Date`, etc.) — what users typically pass
88
+ * into `entity.put({...})` and `.set({...})`.
89
+ *
90
+ * The `decode` direction always lifts to the domain type (DateTime.Utc /
91
+ * DateTime.Zoned / Date). The `encode` direction always produces the wire
92
+ * primitive. This makes both `Schema.encode(substituted)` and
93
+ * `Schema.decode(substituted)` work end-to-end regardless of whether the
94
+ * caller passed wire-form or domain-form.
95
+ *
96
+ * @internal
97
+ */
98
+ export declare const buildDateTransform: (encoding: DynamoEncoding) => Schema.Top;
99
+ /**
100
+ * Substitute model fields with bidirectional transforms where needed:
101
+ *
102
+ * - Self date schemas with an effective encoding (annotation or override)
103
+ * → tolerant date transform that accepts either wire form (string/number)
104
+ * or domain form (DateTime / Date) on decode, and always produces the
105
+ * configured wire primitive on encode.
106
+ * - `Schema.RedactedFromValue(inner)` fields → tolerant Redacted transform
107
+ * that accepts either form on decode and unwraps to wire primitive on
108
+ * encode (Effect v4's `RedactedFromValue` forbids encoding by default;
109
+ * our substitution makes the round-trip work for storage).
110
+ *
111
+ * Existing transform schemas (other than `RedactedFromValue`) are passed
112
+ * through unchanged — the user-declared transform IS the wire format.
113
+ *
114
+ * Schema.Class fields (and Schema.Class fields nested inside Schema.Array,
115
+ * Schema.optional, etc.) are NOT substituted here. Instead, callers run
116
+ * `decode → encode` against the substituted schema: `Schema.decode` is
117
+ * forgiving for Schema.Class (lifts plain objects to instances), and the
118
+ * tolerant date / Redacted substitutes make the decode pass accept both
119
+ * wire and domain values. The subsequent `Schema.encode` produces the
120
+ * canonical wire shape.
121
+ *
122
+ * @internal
123
+ */
124
+ export declare const substituteSchemas: (modelFields: SchemaFields, fieldEncodings: globalThis.Record<string, DynamoEncoding>) => SchemaFields;
125
+ /**
126
+ * Validate that no model field combines a transform schema with a storage
127
+ * override. The two configuration paths are mutually exclusive: either declare
128
+ * a self schema (`Schema.DateTimeUtc`) and let the annotation drive storage,
129
+ * OR declare a transform and own the wire format yourself — not both.
130
+ *
131
+ * Two override sources are checked:
132
+ *
133
+ * 1. `ConfiguredModel.storedAs` (configured attributes) — surfaces the
134
+ * override via `configuredAttributes[name].encoding`.
135
+ *
136
+ * 2. `DynamoModel.storedAs(...)` modifier piped onto the field schema —
137
+ * adds a `DynamoEncoding` annotation directly to the AST. We detect this
138
+ * by checking whether the field-level annotation disagrees with the
139
+ * transform's actual wire format (the `inferDefaultEncoding` of the
140
+ * transform). For an unmodified transform (e.g. `DynamoModel.DateString`
141
+ * with a matching ISO-string annotation), the two agree and the field is
142
+ * accepted.
143
+ *
144
+ * Throws at `Entity.make()` time if the conflict is detected.
145
+ *
146
+ * @internal
147
+ */
148
+ export declare const validateNoTransformOverride: (modelFields: SchemaFields, configuredAttributes: ConfiguredAttributeEncodings) => void;
60
149
  export interface DerivedSchemas {
61
- /** Pure model fields schema (wire format — for input validation) */
150
+ /** Pure model fields schema (substituted — used for both validation and decode) */
62
151
  readonly modelSchema: Schema.Codec<any>;
63
- /** Model fields with fromSelf for date-annotated fields (for decode after deserialization) */
64
- readonly modelDecodeSchema: Schema.Codec<any>;
65
152
  /** Model + system fields schema */
66
153
  readonly recordSchema: Schema.Codec<any>;
67
154
  /**
68
155
  * Typed input schema — the public payload type users see. Ref-aware (ref
69
156
  * fields swapped for ID fields). System-colliding `createdAt`/`updatedAt`
70
157
  * are marked optional; `version` (if colliding) is stripped.
158
+ *
159
+ * Used both as the public type and as the runtime encode/decode schema.
71
160
  */
72
161
  readonly inputSchema: Schema.Codec<any>;
73
- /**
74
- * Runtime input decode schema. Same shape as `inputSchema` but with fromSelf
75
- * variants for date fields so decode accepts domain values (matches the TS
76
- * contract). Used by put/create/upsert at runtime.
77
- */
78
- readonly inputDecodeSchema: Schema.Codec<any>;
79
162
  /** Input fields minus primary key composites — the common "create" payload */
80
163
  readonly createSchema: Schema.Codec<any>;
81
164
  /** Optional model fields minus keys and immutable */
82
165
  readonly updateSchema: Schema.Codec<any>;
83
- /**
84
- * Runtime update decode schema. Same shape as `updateSchema` but with
85
- * fromSelf variants for date fields so decode accepts domain values. Used
86
- * by update at runtime.
87
- */
88
- readonly updateDecodeSchema: Schema.Codec<any>;
89
166
  /** Primary key composites only */
90
167
  readonly keySchema: Schema.Codec<any>;
91
168
  /** Record + key attrs + __edd_e__ */
@@ -108,6 +185,6 @@ export declare const buildDerivedSchemas: (modelFields: SchemaFields, indexes: g
108
185
  readonly fieldName: string;
109
186
  readonly idFieldName: string;
110
187
  readonly identifierSchema: Schema.Top;
111
- }>, immutableFields?: ReadonlySet<string>, identifierField?: string | undefined, timeSeries?: TimeSeriesConfig<any> | undefined) => DerivedSchemas;
188
+ }>, immutableFields?: ReadonlySet<string>, identifierField?: string | undefined, timeSeries?: TimeSeriesConfig<any> | undefined, fieldEncodings?: globalThis.Record<string, DynamoEncoding>) => DerivedSchemas;
112
189
  export declare const resolveUniqueFields: (def: UniqueConstraintDef) => ReadonlyArray<string>;
113
190
  //# sourceMappingURL=EntitySchemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntitySchemas.d.ts","sourceRoot":"","sources":["../../src/internal/EntitySchemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,mBAAmB,EAEnB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAM1B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAA;IACjD,2EAA2E;IAC3E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAA;IACjD,2EAA2E;IAC3E,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,gBAA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