graphddb 0.8.0 → 0.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.
- package/dist/behaviors-DDltNivc.d.ts +217 -0
- package/dist/cdc/index.d.ts +5 -4
- package/dist/cdc/index.js +3 -3
- package/dist/{chunk-HNY2EJPV.js → chunk-KOIJ4SNO.js} +1 -1
- package/dist/{chunk-LGHSZIEE.js → chunk-NWTEUWJD.js} +7 -5
- package/dist/{chunk-N4NWYNGZ.js → chunk-SSVG6NQK.js} +657 -18
- package/dist/{chunk-L4QRCHRQ.js → chunk-WOFRHRXY.js} +6 -25
- package/dist/{chunk-I4LEJ4TF.js → chunk-XZTA4VJH.js} +44 -9
- package/dist/{chunk-GS4C5VGO.js → chunk-YGQ2NO6J.js} +2 -2
- package/dist/{chunk-L2NEDS7U.js → chunk-ZNU7OI5I.js} +241 -8
- package/dist/cli.js +366 -80
- package/dist/index.d.ts +131 -5
- package/dist/index.js +121 -5
- package/dist/internal/index.d.ts +6 -5
- package/dist/internal/index.js +7 -7
- package/dist/{key-DR7_lpyk.d.ts → key-Dne-a20Q.d.ts} +204 -7
- package/dist/linter/index.d.ts +6 -5
- package/dist/{linter-C-vypgut.d.ts → linter-Cr1Hnw7n.d.ts} +1 -1
- package/dist/{prepared-artifact-BpPgkXEo.d.ts → prepared-artifact-BXkARxwO.d.ts} +4 -4
- package/dist/spec/index.d.ts +225 -24
- package/dist/spec/index.js +17 -9
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +3 -3
- package/dist/transform/index.d.ts +2 -1
- package/dist/transform/index.js +2 -2
- package/dist/{types-BXLzIcQD.d.ts → types-BnFsTZwl.d.ts} +1 -1
- package/dist/{types-2PMXEn5x.d.ts → types-CfxzTEFL.d.ts} +262 -20
- package/docs/cqrs-contract.md +55 -4
- package/docs/python-bridge.md +33 -49
- package/package.json +11 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { ak as SelectableOf, al as PrimaryKeyOf, e as ProjectionTransform, f as MaintainEvent, j as MembershipPredicate, h as MaintainConsistency, i as MaintainUpdateMode, am as MembershipPredicateOp, an as publishQuery, ao as publishCommand, D as DDBModel, ap as RetryPolicy, aq as Middleware } from './key-
|
|
2
|
-
export { ar as CdcModelRegistry, as as CdcSubscribeHandlers, at as Change, au as Column, av as ColumnMap, aw as CondSlot, ax as CtxBase, ay as CtxModel, az as FilterInput, aA as GsiDefinitionMarker, aB as GsiOptions, aC as InlineSnapshotSpec, aD as Item, aE as KeyDefinitionMarker, aF as KeySegment, aG as KeySlot, aH as KeyStructure, M as ModelStatic, aI as MutateAuthoringOptions, aJ as ParamDescriptor, aK as ParamStructure, aL as PartialQueryKeyOf, aM as PersistCtx, aN as PersistOrigin, aO as QueryKeyOf, aP as QueryResult, aQ as RawCondition, aR as ReadOpCtx, aS as ReadOpKind, aT as ReadParams, aU as ReadRequestCtx, aV as ReadRequestKind, aW as RelationBuilder, aX as RelationSelect, aY as RelationSpec, aZ as RequestContext, a_ as SegmentSpec, d as SegmentedKey, a$ as SelectBuilder, b0 as SelectOf, b1 as UniqueQueryKeyOf, b2 as Updatable, b3 as WriteCtx, b4 as WriteInput, b5 as WriteKind, b6 as WriteMiddleware, b7 as cond, b8 as entityWrites, b9 as getEntityWrites, ba as gsi, bb as identity, bc as k, bd as key, be as mutate, bf as preview, bg as when } from './key-
|
|
1
|
+
import { ak as SelectableOf, al as PrimaryKeyOf, e as ProjectionTransform, f as MaintainEvent, j as MembershipPredicate, h as MaintainConsistency, i as MaintainUpdateMode, am as MembershipPredicateOp, an as publishQuery, ao as publishCommand, D as DDBModel, ap as RetryPolicy, aq as Middleware } from './key-Dne-a20Q.js';
|
|
2
|
+
export { ar as CdcModelRegistry, as as CdcSubscribeHandlers, at as Change, au as Column, av as ColumnMap, aw as CondSlot, ax as CtxBase, ay as CtxModel, az as FilterInput, aA as GsiDefinitionMarker, aB as GsiOptions, aC as InlineSnapshotSpec, aD as Item, aE as KeyDefinitionMarker, aF as KeySegment, aG as KeySlot, aH as KeyStructure, M as ModelStatic, aI as MutateAuthoringOptions, aJ as ParamDescriptor, aK as ParamStructure, aL as PartialQueryKeyOf, aM as PersistCtx, aN as PersistOrigin, aO as QueryKeyOf, aP as QueryResult, aQ as RawCondition, aR as ReadOpCtx, aS as ReadOpKind, aT as ReadParams, aU as ReadRequestCtx, aV as ReadRequestKind, aW as RelationBuilder, aX as RelationSelect, aY as RelationSpec, aZ as RequestContext, a_ as SegmentSpec, d as SegmentedKey, a$ as SelectBuilder, b0 as SelectOf, b1 as UniqueQueryKeyOf, b2 as Updatable, b3 as WriteCtx, b4 as WriteInput, b5 as WriteKind, b6 as WriteMiddleware, b7 as cond, b8 as entityWrites, b9 as getEntityWrites, ba as gsi, bb as identity, bc as k, bd as key, be as mutate, bf as preview, bg as when } from './key-Dne-a20Q.js';
|
|
3
3
|
import * as _aws_sdk_client_dynamodb from '@aws-sdk/client-dynamodb';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { p as publishBehaviors } from './behaviors-DDltNivc.js';
|
|
5
|
+
export { b as BehaviorComponentFns, a as BehaviorMethodSpec, B as BehaviorModelContract, P as PublishBehaviorsOptions, c as behaviorComponents, i as isBehaviorModelContract } from './behaviors-DDltNivc.js';
|
|
6
|
+
import { M as ModelKind, F as FieldOptions, D as DynamoType, R as RelationOptions, A as AggregateOptions, a as AggregateValue } from './types-BnFsTZwl.js';
|
|
7
|
+
export { a0 as LiteralParam, a1 as MapParam, a2 as NumberParam, a3 as Param, a4 as ParamKind, a5 as StringParam, a6 as param } from './types-CfxzTEFL.js';
|
|
8
|
+
import 'behavior-contracts';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Query options with conditional `consistentRead` availability.
|
|
@@ -196,6 +199,128 @@ declare const map: FieldDecorator<Record<string, unknown>>;
|
|
|
196
199
|
|
|
197
200
|
declare function embedded(modelFactory: () => new (...args: unknown[]) => unknown): (_value: undefined, context: ClassFieldDecoratorContext) => void;
|
|
198
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Field groups — reusable, composable field sets for models (issue #295, part B).
|
|
204
|
+
*
|
|
205
|
+
* ## Why composition, not inheritance
|
|
206
|
+
*
|
|
207
|
+
* The metadata pipeline is drain-based: TC39 field decorators push
|
|
208
|
+
* {@link FieldMetadata} into a module-level pending collector, and the topmost
|
|
209
|
+
* `@model` class decorator drains it (`collector.ts`). A **decorated shared base
|
|
210
|
+
* class** breaks that contract — the base's field decorators fire ONCE (at base
|
|
211
|
+
* class definition) and sit pending until the NEXT `@model` drains them, so the
|
|
212
|
+
* first subclass absorbs the base's fields and every later subclass silently
|
|
213
|
+
* loses them (drain-order dependence; the issue-#295 report). Real inheritance
|
|
214
|
+
* support would require re-architecting the collector around prototype-chain
|
|
215
|
+
* walks. A **field group** achieves the reuse the issue wants ("generic meta
|
|
216
|
+
* columns shared by every domain model") with the SAME mechanism the codebase
|
|
217
|
+
* already uses for stacked class-level declarations (`@maintainedFrom`,
|
|
218
|
+
* `@cdcProjected`): a class decorator that pushes into the pending collector
|
|
219
|
+
* BEFORE `@model` drains — per-class, so no drain-order hazard exists.
|
|
220
|
+
*
|
|
221
|
+
* ## Usage
|
|
222
|
+
*
|
|
223
|
+
* ```ts
|
|
224
|
+
* // Shared, generic meta columns — defined ONCE, reused by every domain model.
|
|
225
|
+
* export const TreeMeta = defineFieldGroup(($) => ({
|
|
226
|
+
* part: $.string(),
|
|
227
|
+
* child: $.string(),
|
|
228
|
+
* scope: $.string(),
|
|
229
|
+
* computeVersion: $.number(),
|
|
230
|
+
* computedAt: $.number(),
|
|
231
|
+
* minPendingAt: $.number(),
|
|
232
|
+
* }));
|
|
233
|
+
*
|
|
234
|
+
* // A domain model composes the group with its own typed map value (issue #295):
|
|
235
|
+
* @model({ table: TABLE })
|
|
236
|
+
* @withFields(TreeMeta)
|
|
237
|
+
* export class AvgTreeNodeModel extends DDBModel {
|
|
238
|
+
* static readonly keys = key<{ part: string; child: string }>((c) => ({
|
|
239
|
+
* pk: k`TREE#${c.part}`,
|
|
240
|
+
* sk: k`${c.child}`,
|
|
241
|
+
* }));
|
|
242
|
+
* @map value!: AvgValue; // the domain-specific value class, one M attribute
|
|
243
|
+
* }
|
|
244
|
+
* // TypeScript-side property typing via declaration merging (one line):
|
|
245
|
+
* export interface AvgTreeNodeModel extends FieldsOf<typeof TreeMeta> {}
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* Group fields are ordinary {@link FieldMetadata}: they participate in keys
|
|
249
|
+
* (`key<{part, child}>` references them by name), GSIs, params-kind recovery
|
|
250
|
+
* (a `param` bound into a group `$.number()` field serializes as `'number'`),
|
|
251
|
+
* hydration, and codegen exactly as body-declared fields do.
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
/** Brand tag carrying the TS value type a group field represents. */
|
|
255
|
+
declare const GROUP_FIELD_BRAND: unique symbol;
|
|
256
|
+
/**
|
|
257
|
+
* One field definition inside a {@link FieldGroup}: the same storage facts a
|
|
258
|
+
* semantic field decorator records (`dynamoType` + optional `options` /
|
|
259
|
+
* `literals`), plus — purely at the type level — the represented value type `T`
|
|
260
|
+
* (surfaced through {@link FieldsOf}).
|
|
261
|
+
*/
|
|
262
|
+
interface GroupFieldDef<out T> {
|
|
263
|
+
/** @internal Type brand carrying the represented value type. */
|
|
264
|
+
readonly [GROUP_FIELD_BRAND]: T;
|
|
265
|
+
readonly dynamoType: DynamoType;
|
|
266
|
+
readonly options?: FieldOptions;
|
|
267
|
+
readonly literals?: readonly string[];
|
|
268
|
+
}
|
|
269
|
+
/** The field-shape record a {@link defineFieldGroup} builder returns. */
|
|
270
|
+
type FieldGroupShape = Record<string, GroupFieldDef<unknown>>;
|
|
271
|
+
/** A reusable, named set of field definitions (issue #295 part B). */
|
|
272
|
+
interface FieldGroup<S extends FieldGroupShape = FieldGroupShape> {
|
|
273
|
+
readonly __isFieldGroup: true;
|
|
274
|
+
readonly fields: S;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The TypeScript property types a {@link FieldGroup} contributes — merge them
|
|
278
|
+
* into the model class with one declaration-merging line:
|
|
279
|
+
* `export interface MyModel extends FieldsOf<typeof MyGroup> {}`.
|
|
280
|
+
*/
|
|
281
|
+
type FieldsOf<G extends FieldGroup> = {
|
|
282
|
+
[K in keyof G['fields']]: G['fields'][K] extends GroupFieldDef<infer T> ? T : never;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* The field factories a {@link defineFieldGroup} builder receives — one per
|
|
286
|
+
* semantic field decorator, recording the same storage facts (`@string` → `'S'`,
|
|
287
|
+
* `@datetime` → `'S'` + `format`, `@literal` → `'S'` + the literal set, …).
|
|
288
|
+
*/
|
|
289
|
+
interface GroupFieldFactories {
|
|
290
|
+
string(options?: FieldOptions): GroupFieldDef<string>;
|
|
291
|
+
number(options?: FieldOptions): GroupFieldDef<number>;
|
|
292
|
+
boolean(options?: FieldOptions): GroupFieldDef<boolean>;
|
|
293
|
+
datetime(options?: FieldOptions): GroupFieldDef<Date>;
|
|
294
|
+
binary(options?: FieldOptions): GroupFieldDef<Uint8Array>;
|
|
295
|
+
stringSet(options?: FieldOptions): GroupFieldDef<Set<string>>;
|
|
296
|
+
numberSet(options?: FieldOptions): GroupFieldDef<Set<number>>;
|
|
297
|
+
list(options?: FieldOptions): GroupFieldDef<unknown[]>;
|
|
298
|
+
/** A free-form map field (one DynamoDB `M` attribute). `T` types the TS surface. */
|
|
299
|
+
map<T extends Record<string, unknown> = Record<string, unknown>>(options?: FieldOptions): GroupFieldDef<T>;
|
|
300
|
+
/** A closed string-literal-union field (the `@literal(...)` counterpart). */
|
|
301
|
+
literal<const L extends string>(...values: readonly [L, ...L[]]): GroupFieldDef<L>;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Define a reusable field group. The builder receives the field factories and
|
|
305
|
+
* returns the `{ fieldName: $.<type>() }` shape; the group is a plain immutable
|
|
306
|
+
* value (no collector interaction happens here — fields are contributed to a
|
|
307
|
+
* model only when `@withFields(group)` runs on that class).
|
|
308
|
+
*/
|
|
309
|
+
declare function defineFieldGroup<const S extends FieldGroupShape>(build: (f: GroupFieldFactories) => S): FieldGroup<S>;
|
|
310
|
+
/**
|
|
311
|
+
* `@withFields(...groups)` — contribute each group's fields to the decorated
|
|
312
|
+
* model class. Stacked BELOW `@model` (which must stay topmost): TC39 class
|
|
313
|
+
* decorators apply bottom-up, so `@withFields` pushes into the pending collector
|
|
314
|
+
* and the `@model` drain picks the group fields up together with the class's own
|
|
315
|
+
* decorated fields — the exact `@maintainedFrom` / `@cdcProjected` mechanism.
|
|
316
|
+
*
|
|
317
|
+
* Duplicate field names are rejected LOUDLY: a group field colliding with a
|
|
318
|
+
* body-declared field (already pending at this point — field decorators run
|
|
319
|
+
* before any class decorator) or with an earlier group would register two
|
|
320
|
+
* metadata entries for one property and silently shadow one of them.
|
|
321
|
+
*/
|
|
322
|
+
declare function withFields(...groups: readonly FieldGroup[]): (_target: Function, context: ClassDecoratorContext) => void;
|
|
323
|
+
|
|
199
324
|
/**
|
|
200
325
|
* Symbolic `(self, source) =>` evaluation for the `@maintainedFrom` view authoring
|
|
201
326
|
* and the versioned relation `pattern` union (issue #152).
|
|
@@ -668,6 +793,7 @@ declare function cdcProjected(): (_target: Function, _context: ClassDecoratorCon
|
|
|
668
793
|
declare const graphddb: {
|
|
669
794
|
readonly publishQuery: typeof publishQuery;
|
|
670
795
|
readonly publishCommand: typeof publishCommand;
|
|
796
|
+
readonly publishBehaviors: typeof publishBehaviors;
|
|
671
797
|
readonly query: typeof DDBModel.query;
|
|
672
798
|
readonly mutate: typeof DDBModel.mutate;
|
|
673
799
|
readonly prepare: typeof DDBModel.prepare;
|
|
@@ -682,4 +808,4 @@ declare const graphddb: {
|
|
|
682
808
|
};
|
|
683
809
|
};
|
|
684
810
|
|
|
685
|
-
export { DDBModel, type HasManyVersionedCallback, type HasManyVersionedOptions, type HasOneVersionedCallback, type HasOneVersionedOptions, type ListOptions, type MaintainedFromCallback, type MaintainedFromOptions, Middleware, type ModelOptions, PrimaryKeyOf, type ProjectionValue, type QueryOptions, type RefsOptions, SelectableOf, type SelfProxy, type SelfRef, type SourceProxy, type SourceRef, type VersionedHistoryOptions, type VersionedLatestOptions, aggregate, belongsTo, binary, boolean, cdcProjected, count, datetime, embedded, field, graphddb, hasMany, hasOne, list, literal, maintainedFrom, map, max, model, number, numberSet, refs, string, stringSet, ttl, whenMember };
|
|
811
|
+
export { DDBModel, type FieldGroup, type FieldGroupShape, type FieldsOf, type GroupFieldDef, type GroupFieldFactories, type HasManyVersionedCallback, type HasManyVersionedOptions, type HasOneVersionedCallback, type HasOneVersionedOptions, type ListOptions, type MaintainedFromCallback, type MaintainedFromOptions, Middleware, type ModelOptions, PrimaryKeyOf, type ProjectionValue, type QueryOptions, type RefsOptions, SelectableOf, type SelfProxy, type SelfRef, type SourceProxy, type SourceRef, type VersionedHistoryOptions, type VersionedLatestOptions, aggregate, belongsTo, binary, boolean, cdcProjected, count, datetime, defineFieldGroup, embedded, field, graphddb, hasMany, hasOne, list, literal, maintainedFrom, map, max, model, number, numberSet, refs, string, stringSet, ttl, whenMember, withFields };
|
package/dist/index.js
CHANGED
|
@@ -3,29 +3,70 @@ import {
|
|
|
3
3
|
mutate,
|
|
4
4
|
publishCommand,
|
|
5
5
|
publishQuery
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XZTA4VJH.js";
|
|
7
7
|
import {
|
|
8
8
|
entityWrites,
|
|
9
9
|
getEntityWrites,
|
|
10
10
|
identity,
|
|
11
11
|
preview
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KOIJ4SNO.js";
|
|
13
13
|
import {
|
|
14
14
|
when
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WOFRHRXY.js";
|
|
16
16
|
import {
|
|
17
17
|
ClientManager,
|
|
18
|
+
GRAPHDDB_CATALOG,
|
|
18
19
|
MetadataRegistry,
|
|
20
|
+
assertComponentsInCatalog,
|
|
19
21
|
cond,
|
|
22
|
+
deriveContractEffect,
|
|
20
23
|
gsi,
|
|
21
24
|
param
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZNU7OI5I.js";
|
|
23
26
|
import {
|
|
24
27
|
TableMapping,
|
|
25
28
|
k,
|
|
26
29
|
key
|
|
27
30
|
} from "./chunk-XTWXMOHD.js";
|
|
28
31
|
|
|
32
|
+
// src/define/behaviors.ts
|
|
33
|
+
import {
|
|
34
|
+
catalogComponents,
|
|
35
|
+
compileBehaviors
|
|
36
|
+
} from "behavior-contracts";
|
|
37
|
+
var boundComponents;
|
|
38
|
+
function behaviorComponents() {
|
|
39
|
+
if (boundComponents === void 0) {
|
|
40
|
+
boundComponents = catalogComponents(GRAPHDDB_CATALOG);
|
|
41
|
+
}
|
|
42
|
+
return boundComponents;
|
|
43
|
+
}
|
|
44
|
+
function publishBehaviors(cls, options = {}) {
|
|
45
|
+
const ir = compileBehaviors(cls, {
|
|
46
|
+
...options.inputPorts !== void 0 ? { inputPorts: options.inputPorts } : {},
|
|
47
|
+
...options.concurrency !== void 0 ? { concurrency: options.concurrency } : {}
|
|
48
|
+
});
|
|
49
|
+
assertComponentsInCatalog(ir.components);
|
|
50
|
+
const methods = {};
|
|
51
|
+
for (const component of ir.components) {
|
|
52
|
+
methods[component.name] = {
|
|
53
|
+
name: component.name,
|
|
54
|
+
effect: deriveContractEffect(component),
|
|
55
|
+
component
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return Object.freeze({
|
|
59
|
+
kind: "behaviors",
|
|
60
|
+
className: cls.name ?? "<anonymous>",
|
|
61
|
+
ir,
|
|
62
|
+
components: ir.components,
|
|
63
|
+
methods: Object.freeze(methods)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function isBehaviorModelContract(value) {
|
|
67
|
+
return typeof value === "object" && value !== null && value.kind === "behaviors" && Array.isArray(value.components);
|
|
68
|
+
}
|
|
69
|
+
|
|
29
70
|
// src/config/index.ts
|
|
30
71
|
var config = {
|
|
31
72
|
/**
|
|
@@ -123,6 +164,9 @@ function drainFields() {
|
|
|
123
164
|
pendingFields = [];
|
|
124
165
|
return result;
|
|
125
166
|
}
|
|
167
|
+
function peekPendingFieldNames() {
|
|
168
|
+
return pendingFields.map((f) => f.propertyName);
|
|
169
|
+
}
|
|
126
170
|
function drainEmbedded() {
|
|
127
171
|
const result = pendingEmbedded;
|
|
128
172
|
pendingEmbedded = [];
|
|
@@ -267,6 +311,71 @@ function embedded(modelFactory) {
|
|
|
267
311
|
};
|
|
268
312
|
}
|
|
269
313
|
|
|
314
|
+
// src/decorators/field-group.ts
|
|
315
|
+
function def(dynamoType, options, literals) {
|
|
316
|
+
const d = { dynamoType };
|
|
317
|
+
if (options !== void 0 && Object.keys(options).length > 0) d.options = options;
|
|
318
|
+
if (literals !== void 0) d.literals = literals;
|
|
319
|
+
return d;
|
|
320
|
+
}
|
|
321
|
+
var factories = {
|
|
322
|
+
string: (options) => def("S", options),
|
|
323
|
+
number: (options) => def("N", options),
|
|
324
|
+
boolean: (options) => def("BOOL", options),
|
|
325
|
+
datetime: (options) => def("S", { format: "datetime", ...options }),
|
|
326
|
+
binary: (options) => def("B", options),
|
|
327
|
+
stringSet: (options) => def("SS", options),
|
|
328
|
+
numberSet: (options) => def("NS", options),
|
|
329
|
+
list: (options) => def("L", options),
|
|
330
|
+
map: (options) => def("M", options),
|
|
331
|
+
literal: (...values) => {
|
|
332
|
+
if (values.length === 0) {
|
|
333
|
+
throw new Error(
|
|
334
|
+
"defineFieldGroup: $.literal(...) requires at least one allowed value."
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
return def("S", void 0, [...values]);
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
function defineFieldGroup(build) {
|
|
341
|
+
const fields = build(factories);
|
|
342
|
+
if (Object.keys(fields).length === 0) {
|
|
343
|
+
throw new Error("defineFieldGroup: a field group must declare at least one field.");
|
|
344
|
+
}
|
|
345
|
+
return { __isFieldGroup: true, fields };
|
|
346
|
+
}
|
|
347
|
+
function withFields(...groups) {
|
|
348
|
+
if (groups.length === 0) {
|
|
349
|
+
throw new Error("@withFields requires at least one field group.");
|
|
350
|
+
}
|
|
351
|
+
for (const g of groups) {
|
|
352
|
+
if (g === null || typeof g !== "object" || g.__isFieldGroup !== true) {
|
|
353
|
+
throw new Error(
|
|
354
|
+
"@withFields: every argument must be a `defineFieldGroup(...)` result."
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return function(_target, context) {
|
|
359
|
+
const seen = new Set(peekPendingFieldNames());
|
|
360
|
+
for (const group of groups) {
|
|
361
|
+
for (const [propertyName, d] of Object.entries(group.fields)) {
|
|
362
|
+
if (seen.has(propertyName)) {
|
|
363
|
+
throw new Error(
|
|
364
|
+
`@withFields on '${String(context.name)}': field '${propertyName}' is declared more than once (a group field collides with a body-declared field or another group). Each property may be declared exactly once.`
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
seen.add(propertyName);
|
|
368
|
+
collectField({
|
|
369
|
+
propertyName,
|
|
370
|
+
dynamoType: d.dynamoType,
|
|
371
|
+
...d.options !== void 0 ? { options: d.options } : {},
|
|
372
|
+
...d.literals !== void 0 ? { literals: d.literals } : {}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
270
379
|
// src/decorators/maintained-symbolic.ts
|
|
271
380
|
var SOURCE_REF = /* @__PURE__ */ Symbol("graphddb:maintainedSourceRef");
|
|
272
381
|
var SELF_REF = /* @__PURE__ */ Symbol("graphddb:maintainedSelfRef");
|
|
@@ -620,6 +729,9 @@ function cdcProjected() {
|
|
|
620
729
|
var graphddb = {
|
|
621
730
|
publishQuery,
|
|
622
731
|
publishCommand,
|
|
732
|
+
// #297 SP3: the shared-authoring verb (SemanticBehavior class → behavior
|
|
733
|
+
// contract; effect derived from the graph, components registered additively).
|
|
734
|
+
publishBehaviors,
|
|
623
735
|
get query() {
|
|
624
736
|
return DDBModel.query;
|
|
625
737
|
},
|
|
@@ -647,6 +759,7 @@ var graphddb = {
|
|
|
647
759
|
export {
|
|
648
760
|
DDBModel,
|
|
649
761
|
aggregate,
|
|
762
|
+
behaviorComponents,
|
|
650
763
|
belongsTo,
|
|
651
764
|
binary,
|
|
652
765
|
boolean,
|
|
@@ -654,6 +767,7 @@ export {
|
|
|
654
767
|
cond,
|
|
655
768
|
count,
|
|
656
769
|
datetime,
|
|
770
|
+
defineFieldGroup,
|
|
657
771
|
embedded,
|
|
658
772
|
entityWrites,
|
|
659
773
|
field,
|
|
@@ -663,6 +777,7 @@ export {
|
|
|
663
777
|
hasMany,
|
|
664
778
|
hasOne,
|
|
665
779
|
identity,
|
|
780
|
+
isBehaviorModelContract,
|
|
666
781
|
k,
|
|
667
782
|
key,
|
|
668
783
|
list,
|
|
@@ -681,5 +796,6 @@ export {
|
|
|
681
796
|
stringSet,
|
|
682
797
|
ttl,
|
|
683
798
|
when,
|
|
684
|
-
whenMember
|
|
799
|
+
whenMember,
|
|
800
|
+
withFields
|
|
685
801
|
};
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { P as PreparedWriteOpSpec, a as PreparedPlanDocument } from '../prepared-artifact-
|
|
2
|
-
export { b as PreparedBindSpec, c as PreparedPlanSpec, d as PreparedReadRouteSpec } from '../prepared-artifact-
|
|
3
|
-
import { M as Manifest } from '../types-
|
|
4
|
-
import { M as ModelStatic, D as DDBModel, S as Slot, P as PreparedWriteExecOptions, C as CommandReturn, a as ParallelOpResult, b as PreparedBody, c as PreparedStatement } from '../key-
|
|
5
|
-
import '../types-
|
|
1
|
+
import { P as PreparedWriteOpSpec, a as PreparedPlanDocument } from '../prepared-artifact-BXkARxwO.js';
|
|
2
|
+
export { b as PreparedBindSpec, c as PreparedPlanSpec, d as PreparedReadRouteSpec } from '../prepared-artifact-BXkARxwO.js';
|
|
3
|
+
import { M as Manifest } from '../types-CfxzTEFL.js';
|
|
4
|
+
import { M as ModelStatic, D as DDBModel, S as Slot, P as PreparedWriteExecOptions, C as CommandReturn, a as ParallelOpResult, b as PreparedBody, c as PreparedStatement } from '../key-Dne-a20Q.js';
|
|
5
|
+
import '../types-BnFsTZwl.js';
|
|
6
|
+
import 'behavior-contracts';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Static prepared-plan LOADER (issue #208) — the runtime half of the AOT
|
package/dist/internal/index.js
CHANGED
|
@@ -2,26 +2,26 @@ import {
|
|
|
2
2
|
PREPARED_FORMAT_VERSION,
|
|
3
3
|
buildManifestEntity,
|
|
4
4
|
entityFingerprint
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-NWTEUWJD.js";
|
|
6
6
|
import {
|
|
7
7
|
LOGICAL_EFFECT_CATEGORIES,
|
|
8
8
|
PreparedReadStatement,
|
|
9
9
|
executeLogicalParallelWrites,
|
|
10
10
|
executeLogicalWriteOps,
|
|
11
11
|
serializeEffectParams
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-XZTA4VJH.js";
|
|
13
|
+
import "../chunk-KOIJ4SNO.js";
|
|
14
14
|
import {
|
|
15
15
|
MARKER_ROW_ENTITY,
|
|
16
|
-
|
|
16
|
+
SPEC_VERSION_KEY_EXPR,
|
|
17
17
|
SPEC_VERSION_SUPPORTED
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-WOFRHRXY.js";
|
|
19
19
|
import {
|
|
20
20
|
MetadataRegistry,
|
|
21
21
|
buildConditionExpression,
|
|
22
22
|
execItemKeySignature,
|
|
23
23
|
resolveConditionTree
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-ZNU7OI5I.js";
|
|
25
25
|
import {
|
|
26
26
|
TableMapping
|
|
27
27
|
} from "../chunk-XTWXMOHD.js";
|
|
@@ -489,7 +489,7 @@ function bindEntities(plan, planId) {
|
|
|
489
489
|
entities[name] = entity;
|
|
490
490
|
tables[metadata.tableName] = { physicalName: TableMapping.resolve(metadata.tableName) };
|
|
491
491
|
}
|
|
492
|
-
return { classes, manifest: { version:
|
|
492
|
+
return { classes, manifest: { version: SPEC_VERSION_KEY_EXPR, tables, entities } };
|
|
493
493
|
}
|
|
494
494
|
function renderSpecItem(transaction, index, manifest, params) {
|
|
495
495
|
const single = {
|