@githolon/dsl 0.100.4 → 0.100.6

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.
@@ -123,6 +123,10 @@ function aggFieldReadKind(f: Field): string {
123
123
  * stable-id surface. Without stable ids (pre-#58) aggregate fields key by NAME and the
124
124
  * kind comes from the field declaration — a graceful, rename-unaware fallback. */
125
125
  export function domainInterface(mod: DomainModule, stableIds?: StableIds): DomainInterface {
126
+ const isInternal = (value: unknown): boolean =>
127
+ !!value &&
128
+ typeof value === "object" &&
129
+ (value as { businessBirthInternal?: unknown }).businessBirthInternal === true;
126
130
  const enumTypes = new Map<string, string>();
127
131
  // DETERMINISTIC KEY ORDER — directive ids, aggregate sids, and field keys are SORTED, so the
128
132
  // emitted interface is byte-stable and the layered-USD fold (which merges + sorts) reproduces it
@@ -134,21 +138,27 @@ export function domainInterface(mod: DomainModule, stableIds?: StableIds): Domai
134
138
  };
135
139
  const directives: Record<string, DirectivePayloadShape> = {};
136
140
  const dirEntries: Array<[string, DirectivePayloadShape]> = [];
137
- for (const d of (mod.directives ?? []) as Array<{ id?: unknown; payloadSchema?: unknown }>) {
141
+ for (const d of (mod.directives ?? []) as Array<{
142
+ id?: unknown;
143
+ payloadSchema?: unknown;
144
+ businessBirth?: { publicPayloadSchema?: unknown };
145
+ }>) {
138
146
  if (!d || typeof d.id !== "string") continue;
147
+ if (isInternal(d)) continue;
139
148
  const fieldEntries: Array<[string, PayloadFieldShape]> = [];
140
- const schema = d.payloadSchema;
149
+ const schema = d.businessBirth?.publicPayloadSchema ?? d.payloadSchema;
141
150
  if (schema && typeof schema === "object") {
142
151
  for (const spec of introspectPayload(schema as z.ZodTypeAny, enumTypes)) {
143
152
  fieldEntries.push([spec.name, { kind: payloadFieldKind(spec), optional: !!spec.optional }]);
144
153
  }
145
154
  }
146
- dirEntries.push([d.id, { fields: sortedRec(fieldEntries) }]);
155
+ dirEntries.push([d.businessBirth === undefined ? d.id : "birth", { fields: sortedRec(fieldEntries) }]);
147
156
  }
148
157
  Object.assign(directives, sortedRec(dirEntries));
149
158
  const aggregates: Record<string, AggregateReadShape> = {};
150
159
  const aggEntries: Array<[string, AggregateReadShape]> = [];
151
160
  for (const agg of (mod.aggregates ?? []) as Array<{ id: string; fields: Record<string, Field> }>) {
161
+ if (isInternal(agg)) continue;
152
162
  const label = agg.id;
153
163
  const sa = stableIds?.aggregates?.[label];
154
164
  const aggSid = sa?.sid ?? label;
@@ -168,6 +178,7 @@ export function domainInterface(mod: DomainModule, stableIds?: StableIds): Domai
168
178
  const foreignReadEntries: Array<[string, ForeignEdge[]]> = [];
169
179
  for (const d of (mod.directives ?? []) as Array<{ id?: unknown; declaredForeignReads?: ForeignEdge[] }>) {
170
180
  if (!d || typeof d.id !== "string") continue;
181
+ if (isInternal(d)) continue;
171
182
  if (d.declaredForeignReads !== undefined && d.declaredForeignReads.length > 0) {
172
183
  foreignReadEntries.push([d.id, d.declaredForeignReads.map((e) => ({ ...e }))]);
173
184
  }