@effect-dynamodb/schema 1.39.0 → 1.41.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 +11 -4
- package/dist/Aggregate.d.ts.map +1 -1
- package/dist/Aggregate.js +12 -2
- package/dist/Aggregate.js.map +1 -1
- package/dist/DynamoModel.d.ts +48 -7
- package/dist/DynamoModel.d.ts.map +1 -1
- package/dist/DynamoModel.js +34 -16
- package/dist/DynamoModel.js.map +1 -1
- package/dist/DynamoSchema.d.ts +25 -0
- package/dist/DynamoSchema.d.ts.map +1 -1
- package/dist/DynamoSchema.js.map +1 -1
- package/dist/Entity.d.ts +66 -11
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +261 -34
- package/dist/Entity.js.map +1 -1
- package/dist/Errors.d.ts +61 -4
- package/dist/Errors.d.ts.map +1 -1
- package/dist/Errors.js +83 -6
- package/dist/Errors.js.map +1 -1
- package/dist/KeyComposer.d.ts +196 -5
- package/dist/KeyComposer.d.ts.map +1 -1
- package/dist/KeyComposer.js +490 -54
- package/dist/KeyComposer.js.map +1 -1
- package/dist/VectorIndex.d.ts.map +1 -1
- package/dist/VectorIndex.js +5 -4
- package/dist/VectorIndex.js.map +1 -1
- package/dist/index.d.ts +1 -1
- 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 +3 -3
- package/dist/internal/AggregateSchemas.d.ts +306 -14
- package/dist/internal/AggregateSchemas.d.ts.map +1 -1
- package/dist/internal/AggregateSchemas.js +733 -54
- package/dist/internal/AggregateSchemas.js.map +1 -1
- package/dist/internal/AggregateTypes.d.ts +396 -36
- package/dist/internal/AggregateTypes.d.ts.map +1 -1
- package/dist/internal/CompositeCodec.d.ts +298 -8
- package/dist/internal/CompositeCodec.d.ts.map +1 -1
- package/dist/internal/CompositeCodec.js +940 -34
- package/dist/internal/CompositeCodec.js.map +1 -1
- package/dist/internal/EffectInstances.d.ts +87 -0
- package/dist/internal/EffectInstances.d.ts.map +1 -0
- package/dist/internal/EffectInstances.js +662 -0
- package/dist/internal/EffectInstances.js.map +1 -0
- package/dist/internal/EntityPacked.d.ts.map +1 -1
- package/dist/internal/EntityPacked.js +5 -4
- package/dist/internal/EntityPacked.js.map +1 -1
- package/dist/internal/EntitySchemas.d.ts +239 -30
- package/dist/internal/EntitySchemas.d.ts.map +1 -1
- package/dist/internal/EntitySchemas.js +1600 -197
- package/dist/internal/EntitySchemas.js.map +1 -1
- package/dist/internal/EntityTypes.d.ts +114 -25
- package/dist/internal/EntityTypes.d.ts.map +1 -1
- package/dist/internal/FailingAsBefore.d.ts +25 -0
- package/dist/internal/FailingAsBefore.d.ts.map +1 -0
- package/dist/internal/FailingAsBefore.js +42 -0
- package/dist/internal/FailingAsBefore.js.map +1 -0
- package/dist/internal/InstanceReads.d.ts +40 -0
- package/dist/internal/InstanceReads.d.ts.map +1 -0
- package/dist/internal/InstanceReads.js +183 -0
- package/dist/internal/InstanceReads.js.map +1 -0
- package/dist/internal/KeyReadings.d.ts +30 -0
- package/dist/internal/KeyReadings.d.ts.map +1 -0
- package/dist/internal/KeyReadings.js +99 -0
- package/dist/internal/KeyReadings.js.map +1 -0
- package/dist/internal/KeyText136.d.ts +4 -2
- package/dist/internal/KeyText136.d.ts.map +1 -1
- package/dist/internal/KeyText136.js +46 -13
- package/dist/internal/KeyText136.js.map +1 -1
- package/dist/internal/LostValues.d.ts +50 -0
- package/dist/internal/LostValues.d.ts.map +1 -0
- package/dist/internal/LostValues.js +465 -0
- package/dist/internal/LostValues.js.map +1 -0
- package/dist/internal/NumericKey.d.ts +21 -2
- package/dist/internal/NumericKey.d.ts.map +1 -1
- package/dist/internal/NumericKey.js +19 -1
- package/dist/internal/NumericKey.js.map +1 -1
- package/dist/internal/ObjectKeyText.d.ts +29 -0
- package/dist/internal/ObjectKeyText.d.ts.map +1 -0
- package/dist/internal/ObjectKeyText.js +50 -0
- package/dist/internal/ObjectKeyText.js.map +1 -0
- package/dist/internal/OwnNames.d.ts +205 -0
- package/dist/internal/OwnNames.d.ts.map +1 -0
- package/dist/internal/OwnNames.js +415 -0
- package/dist/internal/OwnNames.js.map +1 -0
- package/dist/internal/PackedCodec.d.ts +7 -1
- package/dist/internal/PackedCodec.d.ts.map +1 -1
- package/dist/internal/PackedCodec.js +83 -21
- package/dist/internal/PackedCodec.js.map +1 -1
- package/dist/internal/RestoredKeyText.d.ts +10 -0
- package/dist/internal/RestoredKeyText.d.ts.map +1 -0
- package/dist/internal/RestoredKeyText.js +50 -0
- package/dist/internal/RestoredKeyText.js.map +1 -0
- package/dist/internal/SchemaAccessors.d.ts +280 -1
- package/dist/internal/SchemaAccessors.d.ts.map +1 -1
- package/dist/internal/SchemaAccessors.js +1717 -1
- package/dist/internal/SchemaAccessors.js.map +1 -1
- package/dist/internal/SchemaIssue.d.ts +21 -0
- package/dist/internal/SchemaIssue.d.ts.map +1 -0
- package/dist/internal/SchemaIssue.js +34 -0
- package/dist/internal/SchemaIssue.js.map +1 -0
- package/dist/internal/SharedKeyAttribute.d.ts +60 -6
- package/dist/internal/SharedKeyAttribute.d.ts.map +1 -1
- package/dist/internal/SharedKeyAttribute.js +129 -13
- package/dist/internal/SharedKeyAttribute.js.map +1 -1
- package/dist/internal/SparseKey.d.ts +46 -0
- package/dist/internal/SparseKey.d.ts.map +1 -0
- package/dist/internal/SparseKey.js +69 -0
- package/dist/internal/SparseKey.js.map +1 -0
- package/dist/internal/StoredForm.d.ts +139 -0
- package/dist/internal/StoredForm.d.ts.map +1 -0
- package/dist/internal/StoredForm.js +503 -0
- package/dist/internal/StoredForm.js.map +1 -0
- package/dist/internal/ZOrderCurve.d.ts.map +1 -1
- package/dist/internal/ZOrderCurve.js +2 -1
- package/dist/internal/ZOrderCurve.js.map +1 -1
- package/dist/internal/ZoneKeyText.d.ts +55 -0
- package/dist/internal/ZoneKeyText.d.ts.map +1 -0
- package/dist/internal/ZoneKeyText.js +264 -0
- package/dist/internal/ZoneKeyText.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal An object composed into a key (#242, `EDD-9162`): every object nothing gives other text
|
|
3
|
+
* to composes `[object Object]`, so rows written with different values would share one key.
|
|
4
|
+
*
|
|
5
|
+
* Not part of the public API.
|
|
6
|
+
*/
|
|
7
|
+
import { KeyValueError } from "./NumericKey.js";
|
|
8
|
+
/**
|
|
9
|
+
* The key text a composite's key-form value composes when it's an object nothing gives other text
|
|
10
|
+
* to, `[object Object]` (or another `[object …]` tag), which every such value composes alike, so rows
|
|
11
|
+
* written with different values would share one key (#242, `EDD-9162`). `undefined` for any other
|
|
12
|
+
* value: text, a number, a date, a look-alike the key form makes an instance of, a class with a
|
|
13
|
+
* `toString` of its own. `text` is the text the value composed.
|
|
14
|
+
*/
|
|
15
|
+
export const defaultObjectText = (value, text) => typeof value === "object" && value !== null && text === Object.prototype.toString.call(value)
|
|
16
|
+
? text
|
|
17
|
+
: undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The refusal of an object composed into a key for a write (`EDD-9162`): `what` names the field and
|
|
20
|
+
* what composes it, and `text` is the text it composed.
|
|
21
|
+
*/
|
|
22
|
+
export const objectKeyRefusal = (what, text) => `${what}, and the value given composes the key text "${text}", which every such object ` +
|
|
23
|
+
"composes alike: items written with different values would share one key. Nothing was written. " +
|
|
24
|
+
"Compose the key from a field holding text, a number or a date, or give the value a toString of " +
|
|
25
|
+
"its own. A get, a delete or a query given such a value still composes that text, to reach a row " +
|
|
26
|
+
"an earlier release wrote. [EDD-9162]";
|
|
27
|
+
/**
|
|
28
|
+
* The one decision, made where a key composer composes `value`'s `text` (`site` says where): under a
|
|
29
|
+
* write's own schema (`objectKeys`), a value composing default object text there throws the refusal,
|
|
30
|
+
* a value key composition can't place (`KeyValueError`), which every write path turns into a
|
|
31
|
+
* `ValidationError` with nothing sent. A key the write doesn't compose never reaches this, so it
|
|
32
|
+
* refuses nothing.
|
|
33
|
+
*/
|
|
34
|
+
export const judgeObjectKeyText = (schema, value, text, site) => {
|
|
35
|
+
const own = schema.objectKeys;
|
|
36
|
+
if (own === undefined)
|
|
37
|
+
return;
|
|
38
|
+
const refused = defaultObjectText(value, text);
|
|
39
|
+
if (refused === undefined)
|
|
40
|
+
return;
|
|
41
|
+
const what = own(site());
|
|
42
|
+
if (what === undefined)
|
|
43
|
+
return;
|
|
44
|
+
throw new KeyValueError({
|
|
45
|
+
value,
|
|
46
|
+
reason: `it composes the key text "${refused}"`,
|
|
47
|
+
message: objectKeyRefusal(what, refused),
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=ObjectKeyText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectKeyText.js","sourceRoot":"","sources":["../../src/internal/ObjectKeyText.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAE,IAAY,EAAsB,EAAE,CACpF,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,KAAK,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;IAC3F,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,SAAS,CAAA;AAEf;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,IAAY,EAAU,EAAE,CACrE,GAAG,IAAI,gDAAgD,IAAI,6BAA6B;IACxF,gGAAgG;IAChG,iGAAiG;IACjG,kGAAkG;IAClG,sCAAsC,CAAA;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAiC,EACjC,KAAc,EACd,IAAY,EACZ,IAAsC,EAChC,EAAE;IACR,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAA;IAC7B,IAAI,GAAG,KAAK,SAAS;QAAE,OAAM;IAC7B,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC9C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAM;IACjC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IACxB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAM;IAC9B,MAAM,IAAI,aAAa,CAAC;QACtB,KAAK;QACL,MAAM,EAAE,6BAA6B,OAAO,GAAG;QAC/C,OAAO,EAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;KACzC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Looking a name up on an object the library builds or reads a definition from (#239).
|
|
3
|
+
*
|
|
4
|
+
* A name a definition or a payload supplies (a field, a path segment, an edge, a timestamp, the
|
|
5
|
+
* version) can be one every object inherits: `constructor`, `toString`, `valueOf`,
|
|
6
|
+
* `hasOwnProperty`, `__proto__`. On a plain object, `record[name]` and `name in record` then find
|
|
7
|
+
* `Object.prototype`'s member, and `record[name] = value` under `__proto__` replaces the object's
|
|
8
|
+
* prototype instead of holding the value. So the library's own maps (definition maps, encoded
|
|
9
|
+
* payloads, unmarshalled rows, a schema's fields) are read with {@link ownValue} /
|
|
10
|
+
* {@link hasOwnName} and written with {@link setOwn}.
|
|
11
|
+
*
|
|
12
|
+
* A caller's object is not read this way. Where the library reads it itself (a key's composites, a
|
|
13
|
+
* condition's or an update operand's record, `.within()` bounds, an aggregate's ids) it is read as
|
|
14
|
+
* 1.40.0 read it, `value[name]`: a getter, a class property, a prototype or a proxy answers, and a
|
|
15
|
+
* function there is given as 1.40.0 read it, but for a member every object inherits under a name
|
|
16
|
+
* `Object.prototype` holds (`constructor`, `toString`), which is never a value given (see
|
|
17
|
+
* {@link given}). A read that throws for a name the object doesn't hold is no value. A payload a
|
|
18
|
+
* schema decodes goes to Effect's parser as given, or as 1.40.0 copied it where the library adds to
|
|
19
|
+
* it first (a decoding default, a stamp, a fetched ref, a geo index's cells), and what the parser
|
|
20
|
+
* reads of it is the parser's to decide: under Effect 4.1.3, a declared name `Object.prototype`
|
|
21
|
+
* holds too only as the payload's own property.
|
|
22
|
+
*/
|
|
23
|
+
import { type Schema, SchemaAST } from "effect";
|
|
24
|
+
/** Whether `record` holds `name` itself, not by inheritance. */
|
|
25
|
+
export declare const hasOwnName: (record: object | undefined, name: PropertyKey) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* What `record` holds under `name` itself, `undefined` where it holds nothing there. Never a member
|
|
28
|
+
* every object inherits: a field named `constructor` that a map doesn't hold is not one.
|
|
29
|
+
*/
|
|
30
|
+
export declare const ownValue: <A>(record: Readonly<Record<string, A>> | undefined, name: PropertyKey) => A | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Why an attribute or a map entry named `__proto__` is refused (`EDD-9165`). The AWS SDK's
|
|
33
|
+
* marshaller assigns each attribute and entry to a plain object, and an assignment to `__proto__`
|
|
34
|
+
* sets that object's prototype instead, so it was never sent; stored by an update, every read drops
|
|
35
|
+
* it the same way, as its unmarshaller assigns too.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PROTO_ENTRY: string;
|
|
38
|
+
/**
|
|
39
|
+
* Stores `value` under `name` as `record`'s own property. Assignment does that for every name but
|
|
40
|
+
* `__proto__`, where it would replace the prototype instead (or do nothing, for a value that isn't
|
|
41
|
+
* an object), so that one name is defined.
|
|
42
|
+
*/
|
|
43
|
+
export declare const setOwn: <A>(record: Record<string, A>, name: string, value: A) => void;
|
|
44
|
+
declare const UnreadableName_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
45
|
+
readonly _tag: "UnreadableName";
|
|
46
|
+
} & Readonly<A>;
|
|
47
|
+
/**
|
|
48
|
+
* A caller's object threw when `field` was read from it, a name it doesn't hold itself but holds
|
|
49
|
+
* by inheritance (a getter of its class, say), read because the entity, aggregate or stream it was
|
|
50
|
+
* given to declares that name. Thrown where the read is, and failed with a `ValidationError` naming
|
|
51
|
+
* the field by the operation it was given to, never a defect (`Capacity.isRefusedValue`). Where the
|
|
52
|
+
* read is made for a key handed on (a geo search's filter), the error stands in the copy for the
|
|
53
|
+
* value, and the search fails with it when it reads it ({@link lackedByName}'s `keep`).
|
|
54
|
+
*
|
|
55
|
+
* Recognised by identity alone ({@link isUnreadableName}): only an error this module made is one.
|
|
56
|
+
* A caller's value carrying the same tag and fields (a stored map compared in a condition) is a
|
|
57
|
+
* value like any other.
|
|
58
|
+
*/
|
|
59
|
+
export declare class UnreadableName extends UnreadableName_base<{
|
|
60
|
+
readonly field: string;
|
|
61
|
+
readonly thrown: unknown;
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}> {
|
|
64
|
+
}
|
|
65
|
+
/** Is `u` an {@link UnreadableName} this module made? By identity, never by its tag or fields. */
|
|
66
|
+
export declare const isUnreadableName: (u: unknown) => u is UnreadableName;
|
|
67
|
+
/**
|
|
68
|
+
* What a caller's payload gives under `name`, where the library reads it itself (a key's
|
|
69
|
+
* composites, an aggregate's ids and edges, `.within()` bounds' operators), read as 1.40.0 read it
|
|
70
|
+
* (`payload[name]`, one read, one `get` of a proxy): its own property, one its class gives it (a
|
|
71
|
+
* getter, a property of a prototype, a method), or one a proxy answers for, a function as much as
|
|
72
|
+
* anything else. Reading its own property is as it always was (a throw from its own getter
|
|
73
|
+
* propagates). A throw for a name it doesn't hold at all (a strict proxy) is no value; a throw from
|
|
74
|
+
* a getter it inherits is an {@link UnreadableName}. The one value not given is what every plain
|
|
75
|
+
* object inherits under the name ({@link isObjectPrototypeMember}: `Object.prototype.toString`
|
|
76
|
+
* under `toString`, `Object.prototype` under `__proto__`), which 1.40.0 took for a value of a field
|
|
77
|
+
* so named: such a name reads as absent. Only where the value read is that member is the payload
|
|
78
|
+
* asked anything more, whether it holds the name itself (`Object.hasOwn`): where it does, the value
|
|
79
|
+
* is given.
|
|
80
|
+
*/
|
|
81
|
+
export declare const given: (payload: object, name: PropertyKey) => unknown;
|
|
82
|
+
/**
|
|
83
|
+
* {@link given}, but never a function: where 1.40.0 took no function for a value (an aggregate's
|
|
84
|
+
* ids, `many` lists and sub-aggregates), and where the library reads a name 1.40.0 didn't read at
|
|
85
|
+
* all (a key composite its own entries lack, {@link keyEntries}), so a method of the payload's
|
|
86
|
+
* class is no value there.
|
|
87
|
+
*/
|
|
88
|
+
export declare const givenData: (payload: object, name: PropertyKey) => unknown;
|
|
89
|
+
/**
|
|
90
|
+
* What a caller's payload gives under `name`, where 1.40.0 asked `name in payload` and then read
|
|
91
|
+
* `payload[name]`: `{ value }` where it holds the name (as it asked, but never what every plain
|
|
92
|
+
* object inherits under it, {@link given}), `undefined` where it doesn't. Asked and read as 1.40.0
|
|
93
|
+
* asked and read it, once each.
|
|
94
|
+
*/
|
|
95
|
+
export declare const givenEntry: (payload: object, name: PropertyKey) => {
|
|
96
|
+
readonly value: unknown;
|
|
97
|
+
} | undefined;
|
|
98
|
+
/** Whether a caller's payload gives `name` ({@link givenEntry}), reading it once. */
|
|
99
|
+
export declare const givesName: (payload: object, name: PropertyKey) => boolean;
|
|
100
|
+
/** Whether `u` is an object a caller gives as a record of names: an object, not an array. */
|
|
101
|
+
export declare const isRecordObject: (u: unknown) => u is object;
|
|
102
|
+
/**
|
|
103
|
+
* A caller's key as a plain object, read as 1.40.0 read it (`Object.entries`): its own enumerable
|
|
104
|
+
* properties, and nothing else of it, wherever they hold every one of `required` (the composites
|
|
105
|
+
* the key can't be composed without). Only where they don't, where 1.40.0 failed ("Missing
|
|
106
|
+
* composite attribute"), is each of `required` and `optional` they lack read by name
|
|
107
|
+
* ({@link lackedByName}), so a key given by `Object.create`, a class with getters or a proxy is
|
|
108
|
+
* read for its composites. `map` makes each value read the value held (a composite's key form).
|
|
109
|
+
*/
|
|
110
|
+
export declare const keyEntries: (payload: object, required: ReadonlyArray<string>, optional?: ReadonlyArray<string>, map?: (name: string, value: unknown) => unknown) => Record<string, unknown>;
|
|
111
|
+
/** Whether `copy` lacks any of `names` as its own property. */
|
|
112
|
+
export declare const lacksAny: (copy: object, names: ReadonlyArray<string>) => boolean;
|
|
113
|
+
/**
|
|
114
|
+
* `copy` (a copy of a caller's `payload`'s own properties), given each of `names` it lacks that the
|
|
115
|
+
* payload gives otherwise, read by name ({@link givenData}: from a prototype, a class's getter or a
|
|
116
|
+
* proxy, never a function there), `map`ped. Read only where 1.40.0 failed for the lack.
|
|
117
|
+
*
|
|
118
|
+
* With `keep`, a name whose read throws ({@link UnreadableName}) doesn't throw here: the copy holds a
|
|
119
|
+
* property of that name that throws it again when it's read (a key handed on to a search, whose read
|
|
120
|
+
* of it fails the search).
|
|
121
|
+
*/
|
|
122
|
+
export declare const lackedByName: (payload: object, copy: Record<string, unknown>, names: ReadonlyArray<string>, map?: (name: string, value: unknown) => unknown, keep?: "getter") => Record<string, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* A plain object holding what a value the library decoded gives (an aggregate's node, as Effect's
|
|
125
|
+
* parser built it): its own enumerable properties, and each of `names` (the fields its schema
|
|
126
|
+
* declares) it gives otherwise ({@link givenData}). Never a caller's object: the parser built it.
|
|
127
|
+
*/
|
|
128
|
+
export declare const declaredCopy: (value: object, names: Iterable<string>) => Record<string, unknown>;
|
|
129
|
+
/**
|
|
130
|
+
* The class `value` is an instance of: the nearest of its prototypes holding a function as its own
|
|
131
|
+
* `constructor` value, as `value.constructor` reads it for an instance. Never `value`'s own property
|
|
132
|
+
* of that name, nor a prototype's that is no function or is a getter: either is a field of a payload
|
|
133
|
+
* given by `Object.create` or by a class with getters, not the class, and is never read. `undefined`
|
|
134
|
+
* for an object without a prototype.
|
|
135
|
+
*/
|
|
136
|
+
export declare const classOf: (value: object) => {
|
|
137
|
+
readonly name?: string;
|
|
138
|
+
} | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Whether every value of `ast` is certain to store something under its name: it is required, and
|
|
141
|
+
* its stored (encoded) form is one this code models exactly with no value that stores nothing
|
|
142
|
+
* ({@link storesAlways}). One that may be left out, may be `undefined` (`UndefinedOr`,
|
|
143
|
+
* `NullishOr`, a decoding default), or isn't modelled exactly (`Schema.declare`, `Option`, a
|
|
144
|
+
* union with such a member) lets a write store nothing there, as 1.40.0 stored it: a definition
|
|
145
|
+
* naming `__proto__` there loads, and a write giving it a value is refused when it's sent.
|
|
146
|
+
*/
|
|
147
|
+
export declare const isRequiredStored: (ast: SchemaAST.AST) => boolean;
|
|
148
|
+
/**
|
|
149
|
+
* The stored form of `ast` where every value stored there is certain to be a map: `ast` is
|
|
150
|
+
* required, and its stored (encoded) form is a struct, a suspended one followed. `undefined` where
|
|
151
|
+
* a value stored there may be no map, or may be no value at all: an optional or an `optionalKey`
|
|
152
|
+
* position, a nullable one, a union (one alternative may be the struct, another not), a list or a
|
|
153
|
+
* tuple (an empty one holds none), a record, text (`Schema.fromJsonString`), a declaration with no
|
|
154
|
+
* encoding (`Schema.Option`).
|
|
155
|
+
*/
|
|
156
|
+
export declare const certainStruct: (ast: SchemaAST.AST, seen?: Set<SchemaAST.AST>) => SchemaAST.Objects | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Where, below `path`, every stored value of `ast` holds a property named `__proto__` in a map: a
|
|
159
|
+
* required property of a struct, with no value that stores nothing ({@link isRequiredStored}),
|
|
160
|
+
* reached from `ast` through containers each certain to hold a map ({@link certainStruct}): `ast`
|
|
161
|
+
* itself required, and each property on the way a required struct.
|
|
162
|
+
* The walk is of the stored (encoded) form. Wherever a container on the way may hold no map, or
|
|
163
|
+
* nothing (an optional or `optionalKey` one, a nullable one, a union, a list or a tuple, a record,
|
|
164
|
+
* text, a declaration with no encoding), a value may or may not hold the name: the definition
|
|
165
|
+
* loads, and a write that gives the name is refused when it's sent (`EDD-9165`). `packed` names the
|
|
166
|
+
* properties of `ast`'s own struct that are stored as JSON text (`DynamoModel.Packed`), which hold
|
|
167
|
+
* any name: the walk doesn't enter them.
|
|
168
|
+
*/
|
|
169
|
+
export declare const requiredProtoPropertyIn: (ast: SchemaAST.AST, path: string, packed?: ReadonlySet<string>, seen?: Set<SchemaAST.AST>) => string | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* `[EDD-9152]`: an entity names `__proto__` where every item it writes would hold it, as an
|
|
172
|
+
* attribute or as a property of a stored map. A JavaScript object can't take that name by
|
|
173
|
+
* assignment (it replaces the prototype), and the AWS SDK's marshaller drops an attribute or a map
|
|
174
|
+
* entry so named, while its reader sets a prototype from one: no write could store the item whole.
|
|
175
|
+
* So: an attribute the library writes on every item ({@link names}: the created and updated
|
|
176
|
+
* timestamps, the version, the table's key attributes, an index's key attributes where every
|
|
177
|
+
* composite of both its halves always stores something, the attribute a field that always stores
|
|
178
|
+
* something is stored under), a required model field stored under its own name whose every value
|
|
179
|
+
* stores something ({@link isRequiredStored}), and such a property of one reached through required
|
|
180
|
+
* struct properties ({@link requiredProtoPropertyIn}). Anything else of that name loads (an
|
|
181
|
+
* optional field or property, one whose stored form admits `undefined` or isn't modelled exactly,
|
|
182
|
+
* an index's key attribute that some item may be without): a write that doesn't give it does what
|
|
183
|
+
* it did, and one that does is refused when it's sent (`EDD-9165`). Nothing stored as JSON text is
|
|
184
|
+
* looked into. Thrown at `make`, before anything else is derived.
|
|
185
|
+
*
|
|
186
|
+
* `fields` are the model's fields; `storage` says which are stored under another attribute and
|
|
187
|
+
* which are packed.
|
|
188
|
+
*/
|
|
189
|
+
export declare const refuseProtoName: (entityType: string, fields: Readonly<Record<string, Schema.Top>>, storage: {
|
|
190
|
+
readonly renamed: ReadonlySet<string>;
|
|
191
|
+
readonly packed: ReadonlySet<string>;
|
|
192
|
+
}, names: ReadonlyArray<{
|
|
193
|
+
readonly name: string | null | undefined;
|
|
194
|
+
readonly what: string;
|
|
195
|
+
/** Whether every item written holds the attribute (`true` when not said). */
|
|
196
|
+
readonly always?: boolean;
|
|
197
|
+
}>) => void;
|
|
198
|
+
/**
|
|
199
|
+
* The refusal of a definition naming `__proto__` where every row it writes would hold it:
|
|
200
|
+
* `[EDD-9152]` for an entity ({@link refuseProtoName}), `[EDD-9153]` for an aggregate
|
|
201
|
+
* (`refuseAggregateProtoName`). `what` says where the name is.
|
|
202
|
+
*/
|
|
203
|
+
export declare const protoRefusal: (code: "EDD-9152" | "EDD-9153", owner: string, what: string) => Error;
|
|
204
|
+
export {};
|
|
205
|
+
//# sourceMappingURL=OwnNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnNames.d.ts","sourceRoot":"","sources":["../../src/internal/OwnNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAErD,gEAAgE;AAChE,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,GAAG,SAAS,EAAE,MAAM,WAAW,KAAG,OACtB,CAAA;AAErD;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EACxB,QAAQ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,EAC/C,MAAM,WAAW,KAChB,CAAC,GAAG,SACmF,CAAA;AAE1F;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAIV,CAAA;AAEd;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,MAAM,EAAE,OAAO,CAAC,KAAG,IAS7E,CAAA;;;;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,cAAe,SAAQ,oBAAmC;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MA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