@ontrails/core 1.0.0-beta.42 → 1.0.0-beta.45
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/CHANGELOG.md +36 -0
- package/README.md +3 -3
- package/package.json +6 -1
- package/src/{activation-source-projection.ts → activation-source-derivation.ts} +9 -9
- package/src/blob-ref.ts +3 -3
- package/src/derive.ts +27 -27
- package/src/detours.ts +1 -1
- package/src/{error-projection.ts → error-rendering.ts} +39 -3
- package/src/errors.ts +1 -1
- package/src/execute.ts +3 -3
- package/src/fire.ts +1 -1
- package/src/index.ts +27 -23
- package/src/{layer-projection.ts → layer-field-rendering.ts} +30 -30
- package/src/layer.ts +6 -6
- package/src/observe.ts +6 -6
- package/src/resource.ts +1 -1
- package/src/schedule-runtime.ts +1 -1
- package/src/serialization.ts +1 -1
- package/src/structured-examples.ts +27 -27
- package/src/surface-derivation.ts +1 -1
- package/src/surface-overlay.ts +5 -5
- package/src/surface-versioning.ts +3 -3
- package/src/tracing.ts +3 -3
- package/src/trail.ts +9 -9
- package/src/trails/derive-trail.ts +1 -1
- package/src/transport-error-map.ts +19 -30
- package/src/types.ts +2 -2
- package/src/validate-established-topo.ts +6 -6
- package/src/validate-topo.ts +1 -1
- package/src/validation.ts +2 -2
- package/src/version-marker.ts +17 -17
package/src/version-marker.ts
CHANGED
|
@@ -131,7 +131,7 @@ const wrappedMarkerSchemaTypes = new Set([
|
|
|
131
131
|
'readonly',
|
|
132
132
|
]);
|
|
133
133
|
|
|
134
|
-
// Schemas with a deterministic JSON-schema override (e.g. blobRefSchema)
|
|
134
|
+
// Schemas with a deterministic JSON-schema override (e.g. blobRefSchema) derive
|
|
135
135
|
// to a canonical descriptor, so the preflight accepts them without inspecting
|
|
136
136
|
// the underlying custom Zod internals once runtime-only checks have been ruled
|
|
137
137
|
// out.
|
|
@@ -176,7 +176,7 @@ const assertMarkerLiteralSupported = (
|
|
|
176
176
|
def: Readonly<Record<string, unknown>>,
|
|
177
177
|
path: readonly string[]
|
|
178
178
|
): void => {
|
|
179
|
-
// The JSON-schema
|
|
179
|
+
// The JSON-schema derivation only emits the first literal value, so a
|
|
180
180
|
// multi-value literal (z.literal(['a', 'b'])) would hash identically to a
|
|
181
181
|
// single-value literal and silently collide.
|
|
182
182
|
const { values } = def;
|
|
@@ -345,7 +345,7 @@ const assertMarkerContentSupported = (
|
|
|
345
345
|
const keys = Object.keys(record);
|
|
346
346
|
if (keys.length === 0 && path.at(-1) !== 'properties') {
|
|
347
347
|
throw new ValidationError(
|
|
348
|
-
`Trail version marker content at ${markerValuePath(path)} contains an unsupported empty schema
|
|
348
|
+
`Trail version marker content at ${markerValuePath(path)} contains an unsupported empty schema derivation`
|
|
349
349
|
);
|
|
350
350
|
}
|
|
351
351
|
|
|
@@ -428,14 +428,14 @@ export const deriveTrailVersionMarker = (content: unknown): string => {
|
|
|
428
428
|
return hasher.digest('hex').slice(0, TRAIL_VERSION_MARKER_LENGTH);
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
-
const
|
|
431
|
+
const deriveSchema = (schema: unknown, path: readonly string[]): unknown => {
|
|
432
432
|
assertMarkerSchemaSupported(schema, path);
|
|
433
433
|
return canonicalizeTrailVersionMarkerContent(
|
|
434
434
|
zodToJsonSchema(schema as never)
|
|
435
435
|
);
|
|
436
436
|
};
|
|
437
437
|
|
|
438
|
-
const
|
|
438
|
+
const deriveVersionDetours = (
|
|
439
439
|
entry: unknown
|
|
440
440
|
): readonly Record<string, unknown>[] | undefined => {
|
|
441
441
|
const raw = entry as unknown as Record<string, unknown>;
|
|
@@ -459,7 +459,7 @@ const projectVersionDetours = (
|
|
|
459
459
|
});
|
|
460
460
|
};
|
|
461
461
|
|
|
462
|
-
const
|
|
462
|
+
const deriveVersionRuntimeRefs = (
|
|
463
463
|
entry: unknown,
|
|
464
464
|
field: 'composes' | 'resources'
|
|
465
465
|
): readonly string[] | undefined => {
|
|
@@ -494,16 +494,16 @@ export const deriveCurrentTrailVersionMarkerContent = (
|
|
|
494
494
|
>
|
|
495
495
|
): Readonly<Record<string, unknown>> => {
|
|
496
496
|
const content: Record<string, unknown> = {
|
|
497
|
-
input:
|
|
497
|
+
input: deriveSchema(trail.input, ['input']),
|
|
498
498
|
kind: 'current',
|
|
499
499
|
...(trail.output === undefined
|
|
500
500
|
? {}
|
|
501
|
-
: { output:
|
|
501
|
+
: { output: deriveSchema(trail.output, ['output']) }),
|
|
502
502
|
};
|
|
503
503
|
|
|
504
|
-
const composes =
|
|
505
|
-
const resources =
|
|
506
|
-
const detours =
|
|
504
|
+
const composes = deriveVersionRuntimeRefs(trail, 'composes');
|
|
505
|
+
const resources = deriveVersionRuntimeRefs(trail, 'resources');
|
|
506
|
+
const detours = deriveVersionDetours(trail);
|
|
507
507
|
if (composes !== undefined) {
|
|
508
508
|
content['composes'] = composes;
|
|
509
509
|
}
|
|
@@ -522,9 +522,9 @@ export const deriveTrailVersionEntryMarkerContent = (
|
|
|
522
522
|
): Readonly<Record<string, unknown>> => {
|
|
523
523
|
const kind = getTrailVersionEntryKind(entry);
|
|
524
524
|
const content: Record<string, unknown> = {
|
|
525
|
-
input:
|
|
525
|
+
input: deriveSchema(entry.input, ['input']),
|
|
526
526
|
kind,
|
|
527
|
-
output:
|
|
527
|
+
output: deriveSchema(entry.output, ['output']),
|
|
528
528
|
};
|
|
529
529
|
|
|
530
530
|
if (kind === 'revision' && entry.transpose !== undefined) {
|
|
@@ -532,9 +532,9 @@ export const deriveTrailVersionEntryMarkerContent = (
|
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
if (kind === 'fork') {
|
|
535
|
-
const composes =
|
|
536
|
-
const resources =
|
|
537
|
-
const detours =
|
|
535
|
+
const composes = deriveVersionRuntimeRefs(entry, 'composes');
|
|
536
|
+
const resources = deriveVersionRuntimeRefs(entry, 'resources');
|
|
537
|
+
const detours = deriveVersionDetours(entry);
|
|
538
538
|
if (composes !== undefined) {
|
|
539
539
|
content['composes'] = composes;
|
|
540
540
|
}
|
|
@@ -599,7 +599,7 @@ export const assertUniqueTrailVersionMarkers = (
|
|
|
599
599
|
for (const [marker, versions] of byMarker) {
|
|
600
600
|
if (versions.length > 1) {
|
|
601
601
|
throw new ValidationError(
|
|
602
|
-
`Trail "${trailId}" versions ${versions.join(', ')}
|
|
602
|
+
`Trail "${trailId}" versions ${versions.join(', ')} derive the same marker ${marker}`
|
|
603
603
|
);
|
|
604
604
|
}
|
|
605
605
|
}
|