effect-dynamodb 1.8.1 → 1.9.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 (107) hide show
  1. package/dist/Aggregate.d.ts +9 -9
  2. package/dist/Aggregate.d.ts.map +1 -1
  3. package/dist/Aggregate.js +9 -9
  4. package/dist/Aggregate.js.map +1 -1
  5. package/dist/Batch.d.ts +1 -1
  6. package/dist/Batch.d.ts.map +1 -1
  7. package/dist/Batch.js +1 -1
  8. package/dist/Batch.js.map +1 -1
  9. package/dist/Collection.d.ts +3 -3
  10. package/dist/Collection.d.ts.map +1 -1
  11. package/dist/Collection.js +3 -3
  12. package/dist/Collection.js.map +1 -1
  13. package/dist/Collections.d.ts +1 -1
  14. package/dist/Collections.d.ts.map +1 -1
  15. package/dist/Collections.js +1 -1
  16. package/dist/Collections.js.map +1 -1
  17. package/dist/DynamoClient.d.ts +12 -8
  18. package/dist/DynamoClient.d.ts.map +1 -1
  19. package/dist/DynamoClient.js +23 -7
  20. package/dist/DynamoClient.js.map +1 -1
  21. package/dist/Entity.d.ts +41 -19
  22. package/dist/Entity.d.ts.map +1 -1
  23. package/dist/Entity.js +185 -58
  24. package/dist/Entity.js.map +1 -1
  25. package/dist/EventStore.d.ts +1 -1
  26. package/dist/EventStore.d.ts.map +1 -1
  27. package/dist/EventStore.js +6 -5
  28. package/dist/EventStore.js.map +1 -1
  29. package/dist/Marshaller.d.ts +1 -1
  30. package/dist/Marshaller.d.ts.map +1 -1
  31. package/dist/Query.d.ts +1 -1
  32. package/dist/Query.d.ts.map +1 -1
  33. package/dist/Query.js +1 -1
  34. package/dist/Query.js.map +1 -1
  35. package/dist/Table.d.ts +2 -2
  36. package/dist/Table.d.ts.map +1 -1
  37. package/dist/Table.js.map +1 -1
  38. package/dist/Transaction.d.ts +1 -1
  39. package/dist/Transaction.d.ts.map +1 -1
  40. package/dist/Transaction.js +1 -1
  41. package/dist/Transaction.js.map +1 -1
  42. package/dist/index.d.ts +9 -9
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +5 -5
  45. package/dist/index.js.map +1 -1
  46. package/dist/internal/BoundQuery.d.ts +1 -1
  47. package/dist/internal/BoundQuery.d.ts.map +1 -1
  48. package/dist/internal/BoundQuery.js.map +1 -1
  49. package/dist/internal/EntityCombinators.d.ts +1 -1
  50. package/dist/internal/EntityCombinators.d.ts.map +1 -1
  51. package/dist/internal/EntityCombinators.js.map +1 -1
  52. package/dist/internal/EntityOps.d.ts +2 -2
  53. package/dist/internal/EntityOps.d.ts.map +1 -1
  54. package/dist/internal/EntityOps.js.map +1 -1
  55. package/dist/internal/TransactableOps.d.ts +16 -4
  56. package/dist/internal/TransactableOps.d.ts.map +1 -1
  57. package/dist/internal/TransactableOps.js +24 -13
  58. package/dist/internal/TransactableOps.js.map +1 -1
  59. package/package.json +7 -6
  60. package/dist/DynamoModel.d.ts +0 -370
  61. package/dist/DynamoModel.d.ts.map +0 -1
  62. package/dist/DynamoModel.js +0 -562
  63. package/dist/DynamoModel.js.map +0 -1
  64. package/dist/DynamoSchema.d.ts +0 -137
  65. package/dist/DynamoSchema.d.ts.map +0 -1
  66. package/dist/DynamoSchema.js +0 -188
  67. package/dist/DynamoSchema.js.map +0 -1
  68. package/dist/Errors.d.ts +0 -387
  69. package/dist/Errors.d.ts.map +0 -1
  70. package/dist/Errors.js +0 -218
  71. package/dist/Errors.js.map +0 -1
  72. package/dist/KeyComposer.d.ts +0 -264
  73. package/dist/KeyComposer.d.ts.map +0 -1
  74. package/dist/KeyComposer.js +0 -516
  75. package/dist/KeyComposer.js.map +0 -1
  76. package/dist/Projection.d.ts +0 -28
  77. package/dist/Projection.d.ts.map +0 -1
  78. package/dist/Projection.js +0 -39
  79. package/dist/Projection.js.map +0 -1
  80. package/dist/internal/AggregateCursor.d.ts +0 -44
  81. package/dist/internal/AggregateCursor.d.ts.map +0 -1
  82. package/dist/internal/AggregateCursor.js +0 -18
  83. package/dist/internal/AggregateCursor.js.map +0 -1
  84. package/dist/internal/AggregateEdges.d.ts +0 -77
  85. package/dist/internal/AggregateEdges.d.ts.map +0 -1
  86. package/dist/internal/AggregateEdges.js +0 -41
  87. package/dist/internal/AggregateEdges.js.map +0 -1
  88. package/dist/internal/AggregateSchemas.d.ts +0 -60
  89. package/dist/internal/AggregateSchemas.d.ts.map +0 -1
  90. package/dist/internal/AggregateSchemas.js +0 -201
  91. package/dist/internal/AggregateSchemas.js.map +0 -1
  92. package/dist/internal/AggregateTypes.d.ts +0 -94
  93. package/dist/internal/AggregateTypes.d.ts.map +0 -1
  94. package/dist/internal/AggregateTypes.js +0 -7
  95. package/dist/internal/AggregateTypes.js.map +0 -1
  96. package/dist/internal/EntityConfig.d.ts +0 -134
  97. package/dist/internal/EntityConfig.d.ts.map +0 -1
  98. package/dist/internal/EntityConfig.js +0 -7
  99. package/dist/internal/EntityConfig.js.map +0 -1
  100. package/dist/internal/EntitySchemas.d.ts +0 -190
  101. package/dist/internal/EntitySchemas.d.ts.map +0 -1
  102. package/dist/internal/EntitySchemas.js +0 -794
  103. package/dist/internal/EntitySchemas.js.map +0 -1
  104. package/dist/internal/EntityTypes.d.ts +0 -208
  105. package/dist/internal/EntityTypes.d.ts.map +0 -1
  106. package/dist/internal/EntityTypes.js +0 -7
  107. package/dist/internal/EntityTypes.js.map +0 -1
@@ -1,134 +0,0 @@
1
- /**
2
- * @internal Entity configuration types — system field and constraint config.
3
- *
4
- * Extracted from Entity.ts for decomposition. Not part of the public API.
5
- */
6
- import type { Duration, Schema } from "effect";
7
- /**
8
- * Per-timestamp field configuration.
9
- *
10
- * - `string` — override field name only (default DateString schema)
11
- * - `Schema.Top` — override schema only (default field name)
12
- * - `{ field?, schema? }` — override both field name and schema
13
- */
14
- export type TimestampFieldConfig = string | Schema.Top | {
15
- readonly field?: string | undefined;
16
- readonly schema?: Schema.Top | undefined;
17
- };
18
- /**
19
- * Timestamp configuration for automatic `createdAt` / `updatedAt` fields.
20
- *
21
- * - `true` — add `createdAt` and `updatedAt` with default names and ISO string storage
22
- * - `{ created?, updated? }` — per-field configuration (string, schema, or object)
23
- * - `false` / `undefined` — no timestamps
24
- */
25
- export type TimestampsConfig = boolean | {
26
- readonly created?: TimestampFieldConfig | undefined;
27
- readonly updated?: TimestampFieldConfig | undefined;
28
- };
29
- /**
30
- * Optimistic locking configuration via an auto-incrementing version field.
31
- *
32
- * - `true` — add a `version` field with default name
33
- * - `{ field?, retain?, ttl? }` — override field name and retention behavior
34
- * - `false` / `undefined` — no versioning
35
- */
36
- export type VersionedConfig = boolean | {
37
- readonly field?: string | undefined;
38
- readonly retain?: boolean | undefined;
39
- readonly ttl?: Duration.Duration | undefined;
40
- };
41
- /**
42
- * Soft-delete configuration. When enabled, deletes mark items rather than removing them.
43
- *
44
- * - `true` — enable soft delete with defaults
45
- * - `{ ttl?, preserveUnique? }` — configure TTL cleanup and unique constraint behavior
46
- * - `false` / `undefined` — hard deletes
47
- */
48
- export type SoftDeleteConfig = boolean | {
49
- readonly ttl?: Duration.Duration | undefined;
50
- readonly preserveUnique?: boolean | undefined;
51
- };
52
- /**
53
- * Time-series configuration. When set, the entity stores one "current" item
54
- * per partition and many immutable "event" items. See guides/timeseries.mdx.
55
- *
56
- * Current-item SK matches the primary index SK. Event-item SK is
57
- * `<currentSk>#e#<orderBy-value>`, GSI keys stripped, TTL attribute set
58
- * (attribute name comes from `TableConfig.ttlAttributeName`, default `"_ttl"`).
59
- *
60
- * `.append(input)` is a `TransactWriteItems` (UpdateItem current + Put event)
61
- * with CAS `attribute_not_exists(pk) OR #orderBy < :newOb`. Returns
62
- * `{ applied: true | false, current }` — stale is a value, not an error.
63
- *
64
- * Mutually exclusive with `versioned` (EDD-9012) and `softDelete` (EDD-9015).
65
- */
66
- export type TimeSeriesConfig<TAppendInput extends Schema.Top = Schema.Top> = {
67
- /** Model attribute used as the monotonic clock for CAS and event SK decoration. Required. */
68
- readonly orderBy: string;
69
- /** TTL applied to event items (not current). Omit for retention-forever. */
70
- readonly ttl?: Duration.Duration | undefined;
71
- /**
72
- * REQUIRED schema restricting which model fields are allowed in `.append()`
73
- * input AND which fields are written into the current-item SET clause.
74
- * The schema MUST include `orderBy` plus all PK/SK composite fields.
75
- *
76
- * Fields in the model but NOT in this schema are never referenced by
77
- * `.append()`'s UpdateExpression and therefore cannot be overwritten — this
78
- * is the enrichment-preservation contract.
79
- *
80
- * Omitting `appendInput` is a hard error at `make()` time (EDD-9016).
81
- * Users who genuinely want every append to overwrite every model field
82
- * must pass the full model schema explicitly.
83
- */
84
- readonly appendInput: TAppendInput;
85
- };
86
- /** An array of model field names that together form a unique constraint. */
87
- export type UniqueFieldsDef = ReadonlyArray<string>;
88
- /**
89
- * A unique constraint definition — either a simple field list or an object
90
- * with additional options like TTL for sentinel items.
91
- */
92
- export type UniqueConstraintDef = UniqueFieldsDef | {
93
- readonly fields: UniqueFieldsDef;
94
- readonly ttl?: Duration.Duration | undefined;
95
- };
96
- /**
97
- * Map of named unique constraints. Each key is the constraint name,
98
- * each value defines which fields must be globally unique together.
99
- *
100
- * Enforced via DynamoDB transaction sentinel items.
101
- */
102
- export type UniqueConfig = globalThis.Record<string, UniqueConstraintDef>;
103
- /**
104
- * Per-ref cascade index configuration. Tells Entity.make() which physical GSI
105
- * to use for auto-generated cascade indexes.
106
- *
107
- * The library fills in the PK/SK composites automatically from the resolved ref
108
- * and primary key — the consumer only specifies physical GSI details.
109
- */
110
- export interface CascadeIndexConfig {
111
- /** Physical GSI name (e.g., "gsi3") */
112
- readonly index: string;
113
- /** PK field descriptor */
114
- readonly pk: {
115
- readonly field: string;
116
- };
117
- /** SK field descriptor */
118
- readonly sk: {
119
- readonly field: string;
120
- };
121
- }
122
- /**
123
- * A ref value in the `refs` config — an object with the entity and optional cascade index config.
124
- *
125
- * Simple: `refs: { player: { entity: Players } }`
126
- * Cascade: `refs: { player: { entity: Players, cascade: { index: "gsi3", pk: { field: "gsi3pk" }, sk: { field: "gsi3sk" } } } }`
127
- */
128
- export interface RefValue {
129
- readonly entity: {
130
- readonly _tag: "Entity";
131
- };
132
- readonly cascade?: CascadeIndexConfig;
133
- }
134
- //# sourceMappingURL=EntityConfig.d.ts.map
@@ -1 +0,0 @@
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;;;;;;GAMG;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,GAAG,SAAS,CAAA;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAA;CACpD,CAAA;AAEL;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,GACP;IACE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAA;CAC7C,CAAA;AAEL;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP;IACE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9C,CAAA;AAEL;;;;;;;;;;;;;GAaG;AACH,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— system field and constraint config.
3
- *
4
- * Extracted from Entity.ts for decomposition. Not part of the public API.
5
- */
6
- export {};
7
- //# sourceMappingURL=EntityConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntityConfig.js","sourceRoot":"","sources":["../../src/internal/EntityConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,190 +0,0 @@
1
- /**
2
- * @internal Entity schema building — derived schemas and system field resolution.
3
- *
4
- * Extracted from Entity.ts for decomposition. Not part of the public API.
5
- */
6
- import { Schema } from "effect";
7
- import { type DynamoEncoding } from "../DynamoModel.js";
8
- import type { IndexDefinition } from "../KeyComposer.js";
9
- import type { TimeSeriesConfig, TimestampsConfig, UniqueConstraintDef, VersionedConfig } from "./EntityConfig.js";
10
- export interface ResolvedSystemFields {
11
- readonly createdAt: string | null;
12
- readonly createdAtEncoding: DynamoEncoding | null;
13
- /** True when the model declares a field whose name matches `createdAt`. */
14
- readonly createdAtCollision: boolean;
15
- readonly updatedAt: string | null;
16
- readonly updatedAtEncoding: DynamoEncoding | null;
17
- /** True when the model declares a field whose name matches `updatedAt`. */
18
- readonly updatedAtCollision: boolean;
19
- readonly version: string | null;
20
- /** True when the model declares a field whose name matches `version`. */
21
- readonly versionCollision: boolean;
22
- }
23
- /**
24
- * Minimal shape of the `attributes` record on a ConfiguredModel — we only need
25
- * `encoding` here. Declared locally to avoid importing ConfiguredModel types.
26
- */
27
- export type ConfiguredAttributeEncodings = globalThis.Record<string, {
28
- readonly encoding?: DynamoEncoding;
29
- }>;
30
- /**
31
- * Resolve the effective DynamoEncoding for a model-declared field, applying
32
- * ConfiguredModel storage overrides on top of schema-level annotations.
33
- *
34
- * Precedence: schema annotation (getEncoding) > inferred default (Effect date
35
- * schemas) > none. ConfiguredModel `storedAs` then overrides storage only,
36
- * preserving the domain from the schema side when present.
37
- *
38
- * Returns `null` if the field is not a date-compatible schema.
39
- */
40
- export declare const resolveFieldEncoding: (fieldSchema: Schema.Top, override: DynamoEncoding | undefined) => DynamoEncoding | null;
41
- /**
42
- * Build the field → DynamoEncoding map for a set of model fields, merging
43
- * ConfiguredModel storage overrides. Used at `Entity.make()` time.
44
- */
45
- export declare const buildFieldEncodings: (modelFields: SchemaFields, configuredAttributes: ConfiguredAttributeEncodings) => globalThis.Record<string, DynamoEncoding>;
46
- export declare const resolveSystemFields: (timestamps?: TimestampsConfig | undefined, versioned?: VersionedConfig | undefined, timeSeries?: TimeSeriesConfig<any> | undefined, modelFields?: SchemaFields, configuredAttributes?: ConfiguredAttributeEncodings) => ResolvedSystemFields;
47
- export declare const primaryKeyComposites: (indexes: globalThis.Record<string, IndexDefinition>) => ReadonlyArray<string>;
48
- export declare const allKeyFieldNames: (indexes: globalThis.Record<string, IndexDefinition>) => ReadonlyArray<string>;
49
- export declare const allCompositeAttributes: (indexes: globalThis.Record<string, IndexDefinition>) => ReadonlyArray<string>;
50
- export type SchemaFields = globalThis.Record<string, Schema.Top>;
51
- export declare const getFields: (model: Schema.Top) => SchemaFields;
52
- /**
53
- * Infer a default DynamoEncoding for standard Effect date schemas that lack
54
- * an explicit DynamoEncoding annotation. This enables Pattern B (pure model
55
- * with Schema.DateTimeUtcFromString etc.) to work without explicit storedAs.
56
- *
57
- * Detection uses the typeConstructor annotation from Effect's schema AST.
58
- */
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;
149
- export interface DerivedSchemas {
150
- /** Pure model fields schema (substituted — used for both validation and decode) */
151
- readonly modelSchema: Schema.Codec<any>;
152
- /** Model + system fields schema */
153
- readonly recordSchema: Schema.Codec<any>;
154
- /**
155
- * Typed input schema — the public payload type users see. Ref-aware (ref
156
- * fields swapped for ID fields). System-colliding `createdAt`/`updatedAt`
157
- * are marked optional; `version` (if colliding) is stripped.
158
- *
159
- * Used both as the public type and as the runtime encode/decode schema.
160
- */
161
- readonly inputSchema: Schema.Codec<any>;
162
- /** Input fields minus primary key composites — the common "create" payload */
163
- readonly createSchema: Schema.Codec<any>;
164
- /** Optional model fields minus keys and immutable */
165
- readonly updateSchema: Schema.Codec<any>;
166
- /** Primary key composites only */
167
- readonly keySchema: Schema.Codec<any>;
168
- /** Record + key attrs + __edd_e__ */
169
- readonly itemSchema: Schema.Codec<any>;
170
- /** Record fields + deletedAt for soft-deleted items */
171
- readonly deletedRecordSchema: Schema.Codec<any>;
172
- /**
173
- * `appendInput` schema for `.append()` on time-series entities.
174
- * `null` when the entity is not configured with `timeSeries`.
175
- */
176
- readonly appendInputSchema: Schema.Codec<any> | null;
177
- /**
178
- * Record schema for history/event items. Same shape as `recordSchema` minus
179
- * `updatedAt` (time-series auto-suppresses it). `null` when the entity is
180
- * not configured with `timeSeries`.
181
- */
182
- readonly historyRecordSchema: Schema.Codec<any> | null;
183
- }
184
- export declare const buildDerivedSchemas: (modelFields: SchemaFields, indexes: globalThis.Record<string, IndexDefinition>, systemFields: ResolvedSystemFields, resolvedRefs?: ReadonlyArray<{
185
- readonly fieldName: string;
186
- readonly idFieldName: string;
187
- readonly identifierSchema: Schema.Top;
188
- }>, immutableFields?: ReadonlySet<string>, identifierField?: string | undefined, timeSeries?: TimeSeriesConfig<any> | undefined, fieldEncodings?: globalThis.Record<string, DynamoEncoding>) => DerivedSchemas;
189
- export declare const resolveUniqueFields: (def: UniqueConstraintDef) => ReadonlyArray<string>;
190
- //# sourceMappingURL=EntitySchemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntitySchemas.d.ts","sourceRoot":"","sources":["../../src/internal/EntitySchemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKL,MAAM,EAIP,MAAM,QAAQ,CAAA;AACf,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,C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