@ontrails/core 1.0.0-beta.15 → 1.0.0-beta.17
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 +69 -0
- package/README.md +64 -19
- package/package.json +9 -8
- package/src/activation-provenance.ts +111 -0
- package/src/activation-source-compatibility.ts +430 -0
- package/src/activation-source-projection.ts +221 -0
- package/src/activation-source.ts +91 -0
- package/src/blob-ref.ts +51 -0
- package/src/context.ts +4 -0
- package/src/{internal/cross-batch.ts → cross-batch.ts} +3 -11
- package/src/detours.ts +8 -0
- package/src/draft.ts +4 -0
- package/src/error-projection.ts +51 -0
- package/src/errors.ts +192 -39
- package/src/execute.ts +443 -44
- package/src/fire.ts +965 -91
- package/src/index.ts +285 -38
- package/src/layer-projection.ts +192 -0
- package/src/layer.ts +32 -1
- package/src/observe.ts +361 -0
- package/src/permits.ts +12 -0
- package/src/redaction/patterns.ts +6 -3
- package/src/resilience.ts +8 -8
- package/src/resource-config.ts +477 -44
- package/src/resource.ts +21 -1
- package/src/result.ts +18 -0
- package/src/run.ts +2 -2
- package/src/schedule-runtime.ts +689 -0
- package/src/schedule.ts +324 -0
- package/src/serialization.ts +90 -57
- package/src/signal-diagnostics.ts +633 -0
- package/src/{internal/signal-ref.ts → signal-ref.ts} +1 -1
- package/src/signal.ts +37 -0
- package/src/store/accessor-protocol.ts +5 -5
- package/src/structured-examples.ts +245 -0
- package/src/surface-derivation.ts +91 -0
- package/src/surface-filter.ts +7 -13
- package/src/topo.ts +386 -6
- package/src/tracing.ts +345 -0
- package/src/trail.ts +168 -22
- package/src/trails/derive-trail.ts +1 -1
- package/src/trails/ingest.ts +7 -15
- package/src/{internal/trails-db.ts → trails-db.ts} +42 -21
- package/src/transport-error-map.ts +146 -28
- package/src/types.ts +82 -28
- package/src/validate-established-topo.ts +6 -0
- package/src/validate-topo.ts +212 -5
- package/src/validation.ts +58 -1
- package/src/webhook.ts +276 -0
- package/src/{internal/zod-wrappers.ts → zod-wrappers.ts} +0 -6
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/blob-ref.d.ts +0 -20
- package/dist/blob-ref.d.ts.map +0 -1
- package/dist/blob-ref.js +0 -22
- package/dist/blob-ref.js.map +0 -1
- package/dist/branded.d.ts +0 -36
- package/dist/branded.d.ts.map +0 -1
- package/dist/branded.js +0 -89
- package/dist/branded.js.map +0 -1
- package/dist/collections.d.ts +0 -31
- package/dist/collections.d.ts.map +0 -1
- package/dist/collections.js +0 -60
- package/dist/collections.js.map +0 -1
- package/dist/context.d.ts +0 -22
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -37
- package/dist/context.js.map +0 -1
- package/dist/contour.d.ts +0 -81
- package/dist/contour.d.ts.map +0 -1
- package/dist/contour.js +0 -176
- package/dist/contour.js.map +0 -1
- package/dist/cross-schema.d.ts +0 -18
- package/dist/cross-schema.d.ts.map +0 -1
- package/dist/cross-schema.js +0 -29
- package/dist/cross-schema.js.map +0 -1
- package/dist/derive.d.ts +0 -44
- package/dist/derive.d.ts.map +0 -1
- package/dist/derive.js +0 -149
- package/dist/derive.js.map +0 -1
- package/dist/draft.d.ts +0 -28
- package/dist/draft.d.ts.map +0 -1
- package/dist/draft.js +0 -157
- package/dist/draft.js.map +0 -1
- package/dist/errors.d.ts +0 -141
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -185
- package/dist/errors.js.map +0 -1
- package/dist/execute.d.ts +0 -52
- package/dist/execute.d.ts.map +0 -1
- package/dist/execute.js +0 -511
- package/dist/execute.js.map +0 -1
- package/dist/fetch.d.ts +0 -15
- package/dist/fetch.d.ts.map +0 -1
- package/dist/fetch.js +0 -102
- package/dist/fetch.js.map +0 -1
- package/dist/fire.d.ts +0 -43
- package/dist/fire.d.ts.map +0 -1
- package/dist/fire.js +0 -185
- package/dist/fire.js.map +0 -1
- package/dist/guards.d.ts +0 -17
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -25
- package/dist/guards.js.map +0 -1
- package/dist/index.d.ts +0 -59
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -61
- package/dist/index.js.map +0 -1
- package/dist/internal/cross-batch.d.ts +0 -44
- package/dist/internal/cross-batch.d.ts.map +0 -1
- package/dist/internal/cross-batch.js +0 -58
- package/dist/internal/cross-batch.js.map +0 -1
- package/dist/internal/fork-ctx.d.ts +0 -41
- package/dist/internal/fork-ctx.d.ts.map +0 -1
- package/dist/internal/fork-ctx.js +0 -47
- package/dist/internal/fork-ctx.js.map +0 -1
- package/dist/internal/signal-ref.d.ts +0 -15
- package/dist/internal/signal-ref.d.ts.map +0 -1
- package/dist/internal/signal-ref.js +0 -41
- package/dist/internal/signal-ref.js.map +0 -1
- package/dist/internal/topo-saves.d.ts +0 -53
- package/dist/internal/topo-saves.d.ts.map +0 -1
- package/dist/internal/topo-saves.js +0 -449
- package/dist/internal/topo-saves.js.map +0 -1
- package/dist/internal/topo-snapshots.d.ts +0 -57
- package/dist/internal/topo-snapshots.d.ts.map +0 -1
- package/dist/internal/topo-snapshots.js +0 -372
- package/dist/internal/topo-snapshots.js.map +0 -1
- package/dist/internal/topo-store-read.d.ts +0 -70
- package/dist/internal/topo-store-read.d.ts.map +0 -1
- package/dist/internal/topo-store-read.js +0 -221
- package/dist/internal/topo-store-read.js.map +0 -1
- package/dist/internal/topo-store.d.ts +0 -26
- package/dist/internal/topo-store.d.ts.map +0 -1
- package/dist/internal/topo-store.js +0 -621
- package/dist/internal/topo-store.js.map +0 -1
- package/dist/internal/tracing.d.ts +0 -98
- package/dist/internal/tracing.d.ts.map +0 -1
- package/dist/internal/tracing.js +0 -102
- package/dist/internal/tracing.js.map +0 -1
- package/dist/internal/trails-db.d.ts +0 -16
- package/dist/internal/trails-db.d.ts.map +0 -1
- package/dist/internal/trails-db.js +0 -118
- package/dist/internal/trails-db.js.map +0 -1
- package/dist/internal/zod-wrappers.d.ts +0 -40
- package/dist/internal/zod-wrappers.d.ts.map +0 -1
- package/dist/internal/zod-wrappers.js +0 -59
- package/dist/internal/zod-wrappers.js.map +0 -1
- package/dist/layer.d.ts +0 -23
- package/dist/layer.d.ts.map +0 -1
- package/dist/layer.js +0 -21
- package/dist/layer.js.map +0 -1
- package/dist/path-security.d.ts +0 -28
- package/dist/path-security.d.ts.map +0 -1
- package/dist/path-security.js +0 -63
- package/dist/path-security.js.map +0 -1
- package/dist/patterns/bulk.d.ts +0 -15
- package/dist/patterns/bulk.d.ts.map +0 -1
- package/dist/patterns/bulk.js +0 -14
- package/dist/patterns/bulk.js.map +0 -1
- package/dist/patterns/change.d.ts +0 -10
- package/dist/patterns/change.d.ts.map +0 -1
- package/dist/patterns/change.js +0 -10
- package/dist/patterns/change.js.map +0 -1
- package/dist/patterns/date-range.d.ts +0 -10
- package/dist/patterns/date-range.d.ts.map +0 -1
- package/dist/patterns/date-range.js +0 -10
- package/dist/patterns/date-range.js.map +0 -1
- package/dist/patterns/index.d.ts +0 -9
- package/dist/patterns/index.d.ts.map +0 -1
- package/dist/patterns/index.js +0 -9
- package/dist/patterns/index.js.map +0 -1
- package/dist/patterns/pagination.d.ts +0 -18
- package/dist/patterns/pagination.d.ts.map +0 -1
- package/dist/patterns/pagination.js +0 -18
- package/dist/patterns/pagination.js.map +0 -1
- package/dist/patterns/progress.d.ts +0 -11
- package/dist/patterns/progress.d.ts.map +0 -1
- package/dist/patterns/progress.js +0 -11
- package/dist/patterns/progress.js.map +0 -1
- package/dist/patterns/sorting.d.ts +0 -13
- package/dist/patterns/sorting.d.ts.map +0 -1
- package/dist/patterns/sorting.js +0 -10
- package/dist/patterns/sorting.js.map +0 -1
- package/dist/patterns/status.d.ts +0 -15
- package/dist/patterns/status.d.ts.map +0 -1
- package/dist/patterns/status.js +0 -9
- package/dist/patterns/status.js.map +0 -1
- package/dist/patterns/timestamps.d.ts +0 -10
- package/dist/patterns/timestamps.d.ts.map +0 -1
- package/dist/patterns/timestamps.js +0 -10
- package/dist/patterns/timestamps.js.map +0 -1
- package/dist/redaction/index.d.ts +0 -4
- package/dist/redaction/index.d.ts.map +0 -1
- package/dist/redaction/index.js +0 -3
- package/dist/redaction/index.js.map +0 -1
- package/dist/redaction/patterns.d.ts +0 -9
- package/dist/redaction/patterns.d.ts.map +0 -1
- package/dist/redaction/patterns.js +0 -39
- package/dist/redaction/patterns.js.map +0 -1
- package/dist/redaction/redactor.d.ts +0 -27
- package/dist/redaction/redactor.d.ts.map +0 -1
- package/dist/redaction/redactor.js +0 -89
- package/dist/redaction/redactor.js.map +0 -1
- package/dist/resilience.d.ts +0 -34
- package/dist/resilience.d.ts.map +0 -1
- package/dist/resilience.js +0 -164
- package/dist/resilience.js.map +0 -1
- package/dist/resource-config.d.ts +0 -22
- package/dist/resource-config.d.ts.map +0 -1
- package/dist/resource-config.js +0 -210
- package/dist/resource-config.js.map +0 -1
- package/dist/resource.d.ts +0 -74
- package/dist/resource.d.ts.map +0 -1
- package/dist/resource.js +0 -61
- package/dist/resource.js.map +0 -1
- package/dist/result.d.ts +0 -57
- package/dist/result.d.ts.map +0 -1
- package/dist/result.js +0 -156
- package/dist/result.js.map +0 -1
- package/dist/run.d.ts +0 -28
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -35
- package/dist/run.js.map +0 -1
- package/dist/serialization.d.ts +0 -27
- package/dist/serialization.d.ts.map +0 -1
- package/dist/serialization.js +0 -154
- package/dist/serialization.js.map +0 -1
- package/dist/signal.d.ts +0 -33
- package/dist/signal.d.ts.map +0 -1
- package/dist/signal.js +0 -17
- package/dist/signal.js.map +0 -1
- package/dist/store/accessor-protocol.d.ts +0 -51
- package/dist/store/accessor-protocol.d.ts.map +0 -1
- package/dist/store/accessor-protocol.js +0 -2
- package/dist/store/accessor-protocol.js.map +0 -1
- package/dist/store/index.d.ts +0 -2
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js +0 -2
- package/dist/store/index.js.map +0 -1
- package/dist/surface-filter.d.ts +0 -13
- package/dist/surface-filter.d.ts.map +0 -1
- package/dist/surface-filter.js +0 -76
- package/dist/surface-filter.js.map +0 -1
- package/dist/topo-store.d.ts +0 -62
- package/dist/topo-store.d.ts.map +0 -1
- package/dist/topo-store.js +0 -319
- package/dist/topo-store.js.map +0 -1
- package/dist/topo.d.ts +0 -39
- package/dist/topo.d.ts.map +0 -1
- package/dist/topo.js +0 -241
- package/dist/topo.js.map +0 -1
- package/dist/trail.d.ts +0 -163
- package/dist/trail.d.ts.map +0 -1
- package/dist/trail.js +0 -75
- package/dist/trail.js.map +0 -1
- package/dist/trails/derive-trail.d.ts +0 -66
- package/dist/trails/derive-trail.d.ts.map +0 -1
- package/dist/trails/derive-trail.js +0 -378
- package/dist/trails/derive-trail.js.map +0 -1
- package/dist/trails/index.d.ts +0 -5
- package/dist/trails/index.d.ts.map +0 -1
- package/dist/trails/index.js +0 -3
- package/dist/trails/index.js.map +0 -1
- package/dist/trails/ingest.d.ts +0 -24
- package/dist/trails/ingest.d.ts.map +0 -1
- package/dist/trails/ingest.js +0 -63
- package/dist/trails/ingest.js.map +0 -1
- package/dist/transport-error-map.d.ts +0 -106
- package/dist/transport-error-map.d.ts.map +0 -1
- package/dist/transport-error-map.js +0 -24
- package/dist/transport-error-map.js.map +0 -1
- package/dist/type-checks.test-d.d.ts +0 -71
- package/dist/type-checks.test-d.d.ts.map +0 -1
- package/dist/type-checks.test-d.js +0 -12
- package/dist/type-checks.test-d.js.map +0 -1
- package/dist/type-utils.d.ts +0 -33
- package/dist/type-utils.d.ts.map +0 -1
- package/dist/type-utils.js +0 -12
- package/dist/type-utils.js.map +0 -1
- package/dist/types.d.ts +0 -177
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/validate-established-topo.d.ts +0 -76
- package/dist/validate-established-topo.d.ts.map +0 -1
- package/dist/validate-established-topo.js +0 -43
- package/dist/validate-established-topo.js.map +0 -1
- package/dist/validate-topo.d.ts +0 -24
- package/dist/validate-topo.d.ts.map +0 -1
- package/dist/validate-topo.js +0 -193
- package/dist/validate-topo.js.map +0 -1
- package/dist/validation.d.ts +0 -27
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -165
- package/dist/validation.js.map +0 -1
- package/dist/workspace.d.ts +0 -25
- package/dist/workspace.d.ts.map +0 -1
- package/dist/workspace.js +0 -57
- package/dist/workspace.js.map +0 -1
- package/src/__tests__/blob-ref.test.ts +0 -103
- package/src/__tests__/branded.test.ts +0 -148
- package/src/__tests__/collections.test.ts +0 -126
- package/src/__tests__/context.test.ts +0 -77
- package/src/__tests__/contour.test.ts +0 -263
- package/src/__tests__/derive-trail.test.ts +0 -668
- package/src/__tests__/derive.test.ts +0 -260
- package/src/__tests__/errors.test.ts +0 -427
- package/src/__tests__/execute.test.ts +0 -1563
- package/src/__tests__/fetch.test.ts +0 -217
- package/src/__tests__/fire.test.ts +0 -1056
- package/src/__tests__/fork-ctx.test.ts +0 -83
- package/src/__tests__/guards.test.ts +0 -102
- package/src/__tests__/ingest.test.ts +0 -191
- package/src/__tests__/layer.test.ts +0 -125
- package/src/__tests__/path-security.test.ts +0 -114
- package/src/__tests__/patterns.test.ts +0 -273
- package/src/__tests__/redaction.test.ts +0 -244
- package/src/__tests__/resilience.test.ts +0 -246
- package/src/__tests__/resource.test.ts +0 -204
- package/src/__tests__/result.test.ts +0 -155
- package/src/__tests__/run.test.ts +0 -181
- package/src/__tests__/serialization.test.ts +0 -401
- package/src/__tests__/service-config.test.ts +0 -224
- package/src/__tests__/signal.test.ts +0 -82
- package/src/__tests__/surface-filter.test.ts +0 -196
- package/src/__tests__/topo-store-read.test.ts +0 -256
- package/src/__tests__/topo-store.test.ts +0 -869
- package/src/__tests__/topo.test.ts +0 -573
- package/src/__tests__/trail-permit.test.ts +0 -60
- package/src/__tests__/trail.test.ts +0 -426
- package/src/__tests__/trails-db.test.ts +0 -198
- package/src/__tests__/transport-error-map.test.ts +0 -82
- package/src/__tests__/type-utils.test.ts +0 -118
- package/src/__tests__/validate-topo.test.ts +0 -611
- package/src/__tests__/validation.test.ts +0 -336
- package/src/__tests__/workspace.test.ts +0 -183
- package/src/__tests__/zod-wrappers.test.ts +0 -62
- package/src/internal/topo-snapshots.ts +0 -517
- package/src/internal/topo-store-read.ts +0 -481
- package/src/internal/topo-store.ts +0 -1192
- package/src/internal/tracing.ts +0 -187
- package/src/topo-store.ts +0 -510
- package/src/type-checks.test-d.ts +0 -106
- package/tsconfig.json +0 -9
- package/tsconfig.tests.json +0 -10
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { DerivationError, InternalError, isTrailsError, NotFoundError, } from '../errors.js';
|
|
3
|
-
import { stripDefaultsFromShape } from '../internal/zod-wrappers.js';
|
|
4
|
-
import { Result } from '../result.js';
|
|
5
|
-
import { trail } from '../trail.js';
|
|
6
|
-
const operationIntent = {
|
|
7
|
-
create: 'write',
|
|
8
|
-
delete: 'destroy',
|
|
9
|
-
list: 'read',
|
|
10
|
-
read: 'read',
|
|
11
|
-
update: 'write',
|
|
12
|
-
};
|
|
13
|
-
const describeDeriveTrailResourceDeclaration = (resourceCount) => resourceCount === 0
|
|
14
|
-
? 'no resources are declared'
|
|
15
|
-
: 'multiple resources are declared';
|
|
16
|
-
const titleCase = (value) => value.length === 0 ? value : value.slice(0, 1).toUpperCase() + value.slice(1);
|
|
17
|
-
const uniqueStrings = (values) => Object.freeze([...(values === undefined ? [] : new Set(values))]);
|
|
18
|
-
const buildFieldMask = (fields) => Object.fromEntries(fields.map((field) => [field, true]));
|
|
19
|
-
const asObjectSchema = (schema) => schema;
|
|
20
|
-
const unsupportedOperation = (operation) => {
|
|
21
|
-
throw new DerivationError(`Unsupported deriveTrail() operation: ${String(operation)}`);
|
|
22
|
-
};
|
|
23
|
-
const omitFields = (schema, fields) => {
|
|
24
|
-
const objectSchema = asObjectSchema(schema);
|
|
25
|
-
return fields.length === 0
|
|
26
|
-
? objectSchema
|
|
27
|
-
: objectSchema.omit(buildFieldMask(fields));
|
|
28
|
-
};
|
|
29
|
-
const pickFields = (schema, fields) => asObjectSchema(schema).pick(buildFieldMask(fields));
|
|
30
|
-
const toPartialSchema = (schema) => asObjectSchema(schema)
|
|
31
|
-
.extend(stripDefaultsFromShape(schema))
|
|
32
|
-
.partial();
|
|
33
|
-
const normalizeResources = (resource) => Object.freeze(Array.isArray(resource) ? [...resource] : [resource]);
|
|
34
|
-
const identityInputSchema = (contour) => pickFields(contour, [contour.identity]);
|
|
35
|
-
const createInputSchema = (contour, generated) => omitFields(contour, generated);
|
|
36
|
-
const updateInputSchema = (contour, generated) => {
|
|
37
|
-
const mutableSchema = omitFields(contour, [...generated, contour.identity]);
|
|
38
|
-
const identitySchema = asObjectSchema(identityInputSchema(contour));
|
|
39
|
-
return identitySchema.extend(toPartialSchema(mutableSchema).shape);
|
|
40
|
-
};
|
|
41
|
-
const listInputSchema = (contour) => toPartialSchema(contour);
|
|
42
|
-
const deriveInputSchema = (contour, operation, generated) => {
|
|
43
|
-
switch (operation) {
|
|
44
|
-
case 'create': {
|
|
45
|
-
return createInputSchema(contour, generated);
|
|
46
|
-
}
|
|
47
|
-
case 'read':
|
|
48
|
-
case 'delete': {
|
|
49
|
-
return identityInputSchema(contour);
|
|
50
|
-
}
|
|
51
|
-
case 'update': {
|
|
52
|
-
return updateInputSchema(contour, generated);
|
|
53
|
-
}
|
|
54
|
-
case 'list': {
|
|
55
|
-
return listInputSchema(contour);
|
|
56
|
-
}
|
|
57
|
-
default: {
|
|
58
|
-
return unsupportedOperation(operation);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const deriveOutputSchema = (contour, operation) => {
|
|
63
|
-
switch (operation) {
|
|
64
|
-
case 'delete': {
|
|
65
|
-
return z.void();
|
|
66
|
-
}
|
|
67
|
-
case 'list': {
|
|
68
|
-
return contour.array();
|
|
69
|
-
}
|
|
70
|
-
case 'create':
|
|
71
|
-
case 'read':
|
|
72
|
-
case 'update': {
|
|
73
|
-
return contour;
|
|
74
|
-
}
|
|
75
|
-
default: {
|
|
76
|
-
return unsupportedOperation(operation);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const pickValueFields = (example, fields) => Object.fromEntries(fields.flatMap((field) => Object.hasOwn(example, field) ? [[field, example[field]]] : []));
|
|
81
|
-
const omitValueFields = (example, fields) => {
|
|
82
|
-
const omitted = new Set(fields);
|
|
83
|
-
return Object.fromEntries(Object.entries(example).filter(([field]) => !omitted.has(field)));
|
|
84
|
-
};
|
|
85
|
-
const formatExampleName = (contour, operation, example, index) => {
|
|
86
|
-
const identifier = example[contour.identity];
|
|
87
|
-
const suffix = identifier === undefined ? String(index + 1) : String(identifier);
|
|
88
|
-
return `${titleCase(operation)} ${contour.name} ${suffix}`;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Derive a single trail example from a contour fixture.
|
|
92
|
-
*
|
|
93
|
-
* @remarks
|
|
94
|
-
* For `list` operations, each derived example wraps a single fixture in an
|
|
95
|
-
* array (`expected: [example]`) and uses the fixture's identity as input
|
|
96
|
-
* filters. This means the expected output is always a one-element array,
|
|
97
|
-
* which may not match the real accessor behavior when multiple fixtures
|
|
98
|
-
* share the same filter. A custom `blaze` with hand-authored examples is
|
|
99
|
-
* required for multi-result list assertions.
|
|
100
|
-
*/
|
|
101
|
-
const deriveExample = (contour, operation, example, index, generated) => {
|
|
102
|
-
const name = formatExampleName(contour, operation, example, index);
|
|
103
|
-
const identity = pickValueFields(example, [contour.identity]);
|
|
104
|
-
switch (operation) {
|
|
105
|
-
case 'create': {
|
|
106
|
-
return {
|
|
107
|
-
expected: example,
|
|
108
|
-
input: omitValueFields(example, generated),
|
|
109
|
-
name,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
case 'read': {
|
|
113
|
-
return {
|
|
114
|
-
expected: example,
|
|
115
|
-
input: identity,
|
|
116
|
-
name,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
case 'update': {
|
|
120
|
-
return {
|
|
121
|
-
expected: example,
|
|
122
|
-
input: {
|
|
123
|
-
...omitValueFields(example, [...generated, contour.identity]),
|
|
124
|
-
...identity,
|
|
125
|
-
},
|
|
126
|
-
name,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
case 'delete': {
|
|
130
|
-
return {
|
|
131
|
-
input: identity,
|
|
132
|
-
name,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
case 'list': {
|
|
136
|
-
return {
|
|
137
|
-
expected: [example],
|
|
138
|
-
input: {},
|
|
139
|
-
name,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
default: {
|
|
143
|
-
return unsupportedOperation(operation);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const deriveExamples = (contour, operation, generated) => {
|
|
148
|
-
if (contour.examples === undefined || contour.examples.length === 0) {
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
// List examples use a single example with all fixtures in expected,
|
|
152
|
-
// since input: {} returns the full set from a seeded mock. Expected
|
|
153
|
-
// values keep generated fields (createdAt, etc.) because the mock
|
|
154
|
-
// populates them — stripping them would fail output schema validation.
|
|
155
|
-
if (operation === 'list') {
|
|
156
|
-
return Object.freeze([
|
|
157
|
-
{
|
|
158
|
-
expected: contour.examples,
|
|
159
|
-
input: {},
|
|
160
|
-
name: `${contour.name} list example`,
|
|
161
|
-
},
|
|
162
|
-
]);
|
|
163
|
-
}
|
|
164
|
-
return Object.freeze(contour.examples.map((example, index) => deriveExample(contour, operation, example, index, generated)));
|
|
165
|
-
};
|
|
166
|
-
const wrapUnexpected = (contourName, operation, error) => {
|
|
167
|
-
if (isTrailsError(error)) {
|
|
168
|
-
return error;
|
|
169
|
-
}
|
|
170
|
-
const cause = error instanceof Error ? error : new Error(String(error));
|
|
171
|
-
return new InternalError(`deriveTrail("${contourName}.${operation}") synthesized blaze failed: ${cause.message}`, { cause });
|
|
172
|
-
};
|
|
173
|
-
const notFoundError = (contourName, id) => new NotFoundError(`deriveTrail("${contourName}"): entity "${String(id)}" not found`);
|
|
174
|
-
const resolveAccessor = (contour, operation, resource, ctx) => {
|
|
175
|
-
try {
|
|
176
|
-
const connection = resource.from(ctx);
|
|
177
|
-
if (connection === undefined || connection === null) {
|
|
178
|
-
return new InternalError(`deriveTrail("${contour.name}.${operation}"): resource "${resource.id}" produced no connection`);
|
|
179
|
-
}
|
|
180
|
-
const accessor = connection[contour.name];
|
|
181
|
-
if (accessor === undefined) {
|
|
182
|
-
return new InternalError(`deriveTrail("${contour.name}.${operation}"): resource "${resource.id}" does not expose an accessor for "${contour.name}"`);
|
|
183
|
-
}
|
|
184
|
-
return accessor;
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
return wrapUnexpected(contour.name, operation, error);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
const extractIdentity = (contour, input) => {
|
|
191
|
-
const record = input;
|
|
192
|
-
return record[contour.identity];
|
|
193
|
-
};
|
|
194
|
-
const callRead = async (contour, accessor, input) => {
|
|
195
|
-
if (typeof accessor.get !== 'function') {
|
|
196
|
-
return Result.err(new InternalError(`deriveTrail("${contour.name}.read"): accessor is missing a \`get\` method`));
|
|
197
|
-
}
|
|
198
|
-
try {
|
|
199
|
-
const id = extractIdentity(contour, input);
|
|
200
|
-
const entity = await accessor.get(id);
|
|
201
|
-
if (entity === null || entity === undefined) {
|
|
202
|
-
return Result.err(notFoundError(contour.name, id));
|
|
203
|
-
}
|
|
204
|
-
return Result.ok(entity);
|
|
205
|
-
}
|
|
206
|
-
catch (error) {
|
|
207
|
-
return Result.err(wrapUnexpected(contour.name, 'read', error));
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
const callCreate = async (contour, accessor, input, ctx) => {
|
|
211
|
-
try {
|
|
212
|
-
if (typeof accessor.insert === 'function') {
|
|
213
|
-
const created = await accessor.insert(input);
|
|
214
|
-
return Result.ok(created);
|
|
215
|
-
}
|
|
216
|
-
// Fallback: tabular contract allows `upsert` when `insert` is absent.
|
|
217
|
-
// The warden flags this at build time via a pattern rule (trl-251).
|
|
218
|
-
if (typeof accessor.upsert !== 'function') {
|
|
219
|
-
return Result.err(new InternalError(`deriveTrail("${contour.name}.create"): accessor is missing both \`insert\` and \`upsert\``));
|
|
220
|
-
}
|
|
221
|
-
ctx.logger?.debug(`deriveTrail("${contour.name}.create"): accessor has no \`insert\`; falling back to \`upsert\``);
|
|
222
|
-
const created = await accessor.upsert(input);
|
|
223
|
-
return Result.ok(created);
|
|
224
|
-
}
|
|
225
|
-
catch (error) {
|
|
226
|
-
return Result.err(wrapUnexpected(contour.name, 'create', error));
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* Strip framework-managed generated fields from a merged payload so that
|
|
231
|
-
* the update-via-upsert fallback doesn't carry stale managed values.
|
|
232
|
-
*
|
|
233
|
-
* Only strips fields that appear in the `generated` array — user-defined
|
|
234
|
-
* fields with the same name (e.g. an API `version` string) are preserved.
|
|
235
|
-
*/
|
|
236
|
-
const stripGeneratedFields = (payload, generated, identity) => {
|
|
237
|
-
if (generated.length === 0) {
|
|
238
|
-
return payload;
|
|
239
|
-
}
|
|
240
|
-
const managedKeys = new Set(generated);
|
|
241
|
-
return Object.fromEntries(Object.entries(payload).filter(([key]) => key === identity || !managedKeys.has(key)));
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* Fallback for accessors that lack a native `update`: read the current
|
|
245
|
-
* entity, merge the patch, strip any `version` field so versioned tables
|
|
246
|
-
* keep `update`'s "does not participate in optimistic concurrency" semantic,
|
|
247
|
-
* then `upsert`.
|
|
248
|
-
*/
|
|
249
|
-
const updateViaReadAndUpsert = async (contour, accessor, id, patch, generated) => {
|
|
250
|
-
if (typeof accessor.get !== 'function') {
|
|
251
|
-
return Result.err(new InternalError(`deriveTrail("${contour.name}.update"): accessor is missing both \`update\` and \`get\``));
|
|
252
|
-
}
|
|
253
|
-
if (typeof accessor.upsert !== 'function') {
|
|
254
|
-
return Result.err(new InternalError(`deriveTrail("${contour.name}.update"): accessor is missing both \`update\` and \`upsert\``));
|
|
255
|
-
}
|
|
256
|
-
const current = await accessor.get(id);
|
|
257
|
-
if (current === null || current === undefined) {
|
|
258
|
-
return Result.err(notFoundError(contour.name, id));
|
|
259
|
-
}
|
|
260
|
-
const merged = stripGeneratedFields({ ...current, ...patch }, generated, contour.identity);
|
|
261
|
-
const updated = await accessor.upsert(merged);
|
|
262
|
-
return Result.ok(updated);
|
|
263
|
-
};
|
|
264
|
-
const callUpdate = async (contour, accessor, input, generated) => {
|
|
265
|
-
const id = extractIdentity(contour, input);
|
|
266
|
-
const patch = Object.fromEntries(Object.entries(input).filter(([field]) => field !== contour.identity));
|
|
267
|
-
try {
|
|
268
|
-
if (typeof accessor.update === 'function') {
|
|
269
|
-
const updated = await accessor.update(id, patch);
|
|
270
|
-
if (updated === null || updated === undefined) {
|
|
271
|
-
return Result.err(notFoundError(contour.name, id));
|
|
272
|
-
}
|
|
273
|
-
return Result.ok(updated);
|
|
274
|
-
}
|
|
275
|
-
return await updateViaReadAndUpsert(contour, accessor, id, patch, generated);
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
return Result.err(wrapUnexpected(contour.name, 'update', error));
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
const callDelete = async (contour, accessor, input) => {
|
|
282
|
-
if (typeof accessor.remove !== 'function') {
|
|
283
|
-
return Result.err(new InternalError(`deriveTrail("${contour.name}.delete"): accessor is missing a \`remove\` method`));
|
|
284
|
-
}
|
|
285
|
-
try {
|
|
286
|
-
const id = extractIdentity(contour, input);
|
|
287
|
-
await accessor.remove(id);
|
|
288
|
-
// `{ deleted: false }` is a no-op on an absent row, not an error —
|
|
289
|
-
// matches the accessor's documented semantic.
|
|
290
|
-
return Result.ok();
|
|
291
|
-
}
|
|
292
|
-
catch (error) {
|
|
293
|
-
return Result.err(wrapUnexpected(contour.name, 'delete', error));
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* Default `list` synthesis passes the entire input as the filter bag. The
|
|
298
|
-
* derived input type is `Partial<ContourInput>` which matches the accessor's
|
|
299
|
-
* filter shape field-for-field. Pagination controls are not derived — callers
|
|
300
|
-
* that need pagination must provide an explicit blaze.
|
|
301
|
-
*/
|
|
302
|
-
const callList = async (contour, accessor, input) => {
|
|
303
|
-
if (typeof accessor.list !== 'function') {
|
|
304
|
-
return Result.err(new InternalError(`deriveTrail("${contour.name}.list"): accessor is missing a \`list\` method`));
|
|
305
|
-
}
|
|
306
|
-
try {
|
|
307
|
-
const listed = await accessor.list(input);
|
|
308
|
-
return Result.ok([...listed]);
|
|
309
|
-
}
|
|
310
|
-
catch (error) {
|
|
311
|
-
return Result.err(wrapUnexpected(contour.name, 'list', error));
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
const synthesizeDefaultBlaze = (contour, operation, resource, generated) => {
|
|
315
|
-
const impl = (input, ctx) => {
|
|
316
|
-
const accessor = resolveAccessor(contour, operation, resource, ctx);
|
|
317
|
-
if (accessor instanceof Error) {
|
|
318
|
-
return Promise.resolve(Result.err(accessor));
|
|
319
|
-
}
|
|
320
|
-
switch (operation) {
|
|
321
|
-
case 'create': {
|
|
322
|
-
return callCreate(contour, accessor, input, ctx);
|
|
323
|
-
}
|
|
324
|
-
case 'read': {
|
|
325
|
-
return callRead(contour, accessor, input);
|
|
326
|
-
}
|
|
327
|
-
case 'update': {
|
|
328
|
-
return callUpdate(contour, accessor, input, generated);
|
|
329
|
-
}
|
|
330
|
-
case 'delete': {
|
|
331
|
-
return callDelete(contour, accessor, input);
|
|
332
|
-
}
|
|
333
|
-
case 'list': {
|
|
334
|
-
return callList(contour, accessor, input);
|
|
335
|
-
}
|
|
336
|
-
default: {
|
|
337
|
-
return unsupportedOperation(operation);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
return impl;
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* Mechanically project one CRUD-shaped trail from a contour declaration.
|
|
345
|
-
*
|
|
346
|
-
* When `spec.blaze` is omitted and the call declares a single resource, the
|
|
347
|
-
* helper derives a default blaze that dispatches to the resource accessor
|
|
348
|
-
* through the structural {@link StoreAccessorProtocol}. Multi-resource calls
|
|
349
|
-
* must supply an explicit blaze and are rejected with {@link DerivationError}
|
|
350
|
-
* at construction time when they do not.
|
|
351
|
-
*/
|
|
352
|
-
export const deriveTrail = (contour, operation, spec) => {
|
|
353
|
-
const resources = normalizeResources(spec.resource);
|
|
354
|
-
const generated = uniqueStrings(spec.generated);
|
|
355
|
-
let blaze;
|
|
356
|
-
if (typeof spec.blaze === 'function') {
|
|
357
|
-
({ blaze } = spec);
|
|
358
|
-
}
|
|
359
|
-
else if (resources.length === 1) {
|
|
360
|
-
blaze = synthesizeDefaultBlaze(contour, operation, resources[0], generated);
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
throw new DerivationError(`deriveTrail("${contour.name}.${operation}") requires an explicit \`blaze\` when ${describeDeriveTrailResourceDeclaration(resources.length)} — default synthesis is single-resource only`);
|
|
364
|
-
}
|
|
365
|
-
const { blaze: _blaze, resource: _resource, generated: _generated, ...trailSpec } = spec;
|
|
366
|
-
const derivedSpec = {
|
|
367
|
-
...trailSpec,
|
|
368
|
-
blaze,
|
|
369
|
-
contours: [contour],
|
|
370
|
-
examples: deriveExamples(contour, operation, generated),
|
|
371
|
-
input: deriveInputSchema(contour, operation, generated),
|
|
372
|
-
intent: operationIntent[operation],
|
|
373
|
-
output: deriveOutputSchema(contour, operation),
|
|
374
|
-
resources,
|
|
375
|
-
};
|
|
376
|
-
return trail(`${contour.name}.${operation}`, derivedSpec);
|
|
377
|
-
};
|
|
378
|
-
//# sourceMappingURL=derive-trail.js.map
|
|
@@ -1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,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,eAAe,CACvB,gBAAgB,OAAO,CAAC,IAAI,IAAI,SAAS,0CAA0C,sCAAsC,CAAC,SAAS,CAAC,MAAM,CAAC,8CAA8C,CAC1L,CAAC;IACJ,CAAC;IACD,MAAM,EACJ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,SAAS,EACb,GAAG,IAAI,CAAC;IACT,MAAM,WAAW,GAAG;QAClB,GAAG,SAAS;QACZ,KAAK;QACL,QAAQ,EAAE,CAAC,OAAO,CAAC;QACnB,QAAQ,EAAE,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC;QACvD,KAAK,EAAE,iBAAiB,CACtB,OAAO,EACP,SAAS,EACT,SAAS,CACV;QACD,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC;QAClC,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC;QAC9C,SAAS;KAIV,CAAC;IAEF,OAAO,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,EAAE,EAAE,WAAW,CAGvD,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/trails/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { deriveTrail } from './derive-trail.js';
|
|
2
|
-
export type { DeriveTrailInput, DeriveTrailOperation, DeriveTrailOutput, DeriveTrailSpec, } from './derive-trail.js';
|
|
3
|
-
export { ingest } from './ingest.js';
|
|
4
|
-
export type { IngestOptions, IngestTransform } from './ingest.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trails/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/trails/index.js
DELETED
package/dist/trails/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trails/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/trails/ingest.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Layer } from '../layer.js';
|
|
3
|
-
import type { Signal } from '../signal.js';
|
|
4
|
-
import type { Trail, TrailSpec } from '../trail.js';
|
|
5
|
-
import type { TrailContext } from '../types.js';
|
|
6
|
-
type SchemaValue<TSchema extends z.ZodType> = z.output<TSchema>;
|
|
7
|
-
type SignalRef<TSignal> = string | Signal<TSignal>;
|
|
8
|
-
interface IngestBaseOptions<TSchema extends z.ZodType, TSignal> extends Omit<TrailSpec<SchemaValue<TSchema>, void>, 'blaze' | 'examples' | 'fires' | 'input' | 'intent' | 'output' | 'pattern'> {
|
|
9
|
-
/** Override the derived trail id. Defaults to `${signal}.ingest`. */
|
|
10
|
-
readonly id?: string | undefined;
|
|
11
|
-
/** Validated external payload shape. */
|
|
12
|
-
readonly schema: TSchema;
|
|
13
|
-
/** Signal to emit after verification and optional transformation. */
|
|
14
|
-
readonly signal: SignalRef<TSignal>;
|
|
15
|
-
/** Optional per-trail verification layer, e.g. HMAC signature checks. */
|
|
16
|
-
readonly verify?: Layer | undefined;
|
|
17
|
-
}
|
|
18
|
-
export type IngestTransform<TInput, TSignal> = (payload: TInput, ctx: TrailContext) => TSignal | Promise<TSignal>;
|
|
19
|
-
export interface IngestOptions<TSchema extends z.ZodType, TSignal> extends IngestBaseOptions<TSchema, TSignal> {
|
|
20
|
-
readonly transform?: IngestTransform<SchemaValue<TSchema>, TSignal> | undefined;
|
|
21
|
-
}
|
|
22
|
-
export declare const ingest: <TSchema extends z.ZodType, TSignal = SchemaValue<TSchema>>(options: IngestOptions<TSchema, TSignal>) => Trail<SchemaValue<TSchema>, void>;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=ingest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/trails/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,KAAK,EAAgB,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,KAAK,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChE,KAAK,SAAS,CAAC,OAAO,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAMnD,UAAU,iBAAiB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,CAAE,SAAQ,IAAI,CAC1E,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EACrC,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAC3E;IACC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACpC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,IAAI,CAC7C,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,YAAY,KACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,MAAM,WAAW,aAAa,CAC5B,OAAO,SAAS,CAAC,CAAC,OAAO,EACzB,OAAO,CACP,SAAQ,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,SAAS,CAAC,EACf,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAC9C,SAAS,CAAC;CACf;AAiED,eAAO,MAAM,MAAM,GACjB,OAAO,SAAS,CAAC,CAAC,OAAO,EACzB,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,EAE9B,SAAS,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,KACvC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CA+BlC,CAAC"}
|
package/dist/trails/ingest.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { InternalError } from '../errors.js';
|
|
3
|
-
import { composeLayers } from '../layer.js';
|
|
4
|
-
import { Result } from '../result.js';
|
|
5
|
-
import { trail } from '../trail.js';
|
|
6
|
-
const resolveSignalId = (signalRef) => typeof signalRef === 'string' ? signalRef : signalRef.id;
|
|
7
|
-
const deriveExampleName = (signalId, index) => `Ingest ${signalId} ${index + 1}`;
|
|
8
|
-
const deriveExamples = (schema, signalId) => {
|
|
9
|
-
const { examples } = schema;
|
|
10
|
-
if (examples === undefined || examples.length === 0) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
return Object.freeze(examples.map((example, index) => ({
|
|
14
|
-
input: example,
|
|
15
|
-
name: deriveExampleName(signalId, index),
|
|
16
|
-
})));
|
|
17
|
-
};
|
|
18
|
-
const createIngestBlaze = (signalRef, signalId, trailId, transform) => async (input, ctx) => {
|
|
19
|
-
if (ctx.fire === undefined) {
|
|
20
|
-
return Result.err(new InternalError(`ingest("${trailId}") requires topo-backed execution to emit "${signalId}"`));
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const payload = transform === undefined
|
|
24
|
-
? input
|
|
25
|
-
: await transform(input, ctx);
|
|
26
|
-
const fired = typeof signalRef === 'string'
|
|
27
|
-
? await ctx.fire(signalRef, payload)
|
|
28
|
-
: await ctx.fire(signalRef, payload);
|
|
29
|
-
return fired.isErr() ? Result.err(fired.error) : Result.ok();
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
const message = `ingest("${trailId}"): ${error instanceof Error ? error.message : String(error)}`;
|
|
33
|
-
return Result.err(error instanceof Error
|
|
34
|
-
? new InternalError(message, { cause: error })
|
|
35
|
-
: new InternalError(message));
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export const ingest = (options) => {
|
|
39
|
-
const signalId = resolveSignalId(options.signal);
|
|
40
|
-
const id = options.id ?? `${signalId}.ingest`;
|
|
41
|
-
const { id: _id, schema, signal, transform, verify, ...trailSpec } = options;
|
|
42
|
-
const baseBlaze = createIngestBlaze(signal, signalId, id, transform);
|
|
43
|
-
const baseTrail = trail(id, {
|
|
44
|
-
...trailSpec,
|
|
45
|
-
blaze: baseBlaze,
|
|
46
|
-
examples: deriveExamples(schema, signalId),
|
|
47
|
-
fires: [signal],
|
|
48
|
-
input: schema,
|
|
49
|
-
intent: 'write',
|
|
50
|
-
output: z.void(),
|
|
51
|
-
pattern: 'ingest',
|
|
52
|
-
});
|
|
53
|
-
if (verify === undefined) {
|
|
54
|
-
return baseTrail;
|
|
55
|
-
}
|
|
56
|
-
// Verification is a per-factory concern, so compose it locally instead of
|
|
57
|
-
// mutating runner-wide layer configuration.
|
|
58
|
-
return Object.freeze({
|
|
59
|
-
...baseTrail,
|
|
60
|
-
blaze: composeLayers([verify], baseTrail, baseTrail.blaze),
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=ingest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../src/trails/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAuCpC,MAAM,eAAe,GAAG,CAAU,SAA6B,EAAU,EAAE,CACzE,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;AAE3D,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAU,EAAE,CACpE,UAAU,QAAQ,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;AAEpC,MAAM,cAAc,GAAG,CACrB,MAAqC,EACrC,QAAgB,EACiD,EAAE;IACnE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAClB,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAChC,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE,KAA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AAC,OAAO,CAAC,CAC/B,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,MAAM,GAAG,CAIpB,OAAwC,EACL,EAAE;IACrC,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,GAAG,QAAQ,SAAS,CAAC;IAC9C,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC;IAC7E,MAAM,SAAS,GAAG,iBAAiB,CACjC,MAAM,EACN,QAAQ,EACR,EAAE,EACF,SAAS,CACV,CAAC;IACF,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,EAAE;QAC1B,GAAG,SAAS;QACZ,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,cAAc,CAAC,MAAuC,EAAE,QAAQ,CAAC;QAC3E,KAAK,EAAE,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,MAAyC;QAChD,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE;QAChB,OAAO,EAAE,QAAQ;KAClB,CAAsC,CAAC;IAExC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0EAA0E;IAC1E,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,SAAS;QACZ,KAAK,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC;KAC3D,CAAsC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { ErrorCategory, TrailsError } from './errors.js';
|
|
2
|
-
export declare const transportNames: readonly ["cli", "http", "mcp"];
|
|
3
|
-
export type TransportName = (typeof transportNames)[number];
|
|
4
|
-
export type TransportErrorMapper<T> = (error: TrailsError) => T;
|
|
5
|
-
export type TransportErrorMappings<T> = Record<ErrorCategory, T>;
|
|
6
|
-
/**
|
|
7
|
-
* Union of every transport-specific error code emitted by {@link transportErrorMap}.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Previously parameterised by transport (`TransportErrorCode<'cli'>` etc.), but
|
|
11
|
-
* the generic collapsed to `number` because the underlying maps were typed as
|
|
12
|
-
* `Record<ErrorCategory, number>`. With `as const satisfies` on the maps the
|
|
13
|
-
* per-transport literals are now observable, but TypeScript cannot narrow
|
|
14
|
-
* `transportErrorMap[transport][error.category]` through a generic
|
|
15
|
-
* `TTransport` without an unsound cast. The non-generic union honestly reflects
|
|
16
|
-
* what `mapTransportError` returns at the call site.
|
|
17
|
-
*/
|
|
18
|
-
export type TransportErrorCode = (typeof transportErrorMap)[TransportName][ErrorCategory];
|
|
19
|
-
export declare const createTransportErrorMapper: <T>(mappings: TransportErrorMappings<T>) => TransportErrorMapper<T>;
|
|
20
|
-
export declare const transportErrorMap: {
|
|
21
|
-
readonly cli: {
|
|
22
|
-
readonly auth: 9;
|
|
23
|
-
readonly cancelled: 130;
|
|
24
|
-
readonly conflict: 3;
|
|
25
|
-
readonly internal: 8;
|
|
26
|
-
readonly network: 7;
|
|
27
|
-
readonly not_found: 2;
|
|
28
|
-
readonly permission: 4;
|
|
29
|
-
readonly rate_limit: 6;
|
|
30
|
-
readonly timeout: 5;
|
|
31
|
-
readonly validation: 1;
|
|
32
|
-
};
|
|
33
|
-
readonly http: {
|
|
34
|
-
readonly auth: 401;
|
|
35
|
-
readonly cancelled: 499;
|
|
36
|
-
readonly conflict: 409;
|
|
37
|
-
readonly internal: 500;
|
|
38
|
-
readonly network: 502;
|
|
39
|
-
readonly not_found: 404;
|
|
40
|
-
readonly permission: 403;
|
|
41
|
-
readonly rate_limit: 429;
|
|
42
|
-
readonly timeout: 504;
|
|
43
|
-
readonly validation: 400;
|
|
44
|
-
};
|
|
45
|
-
readonly mcp: {
|
|
46
|
-
readonly auth: -32600;
|
|
47
|
-
readonly cancelled: -32603;
|
|
48
|
-
readonly conflict: -32603;
|
|
49
|
-
readonly internal: -32603;
|
|
50
|
-
readonly network: -32603;
|
|
51
|
-
readonly not_found: -32601;
|
|
52
|
-
readonly permission: -32600;
|
|
53
|
-
readonly rate_limit: -32603;
|
|
54
|
-
readonly timeout: -32603;
|
|
55
|
-
readonly validation: -32602;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export declare const transportErrorRegistry: {
|
|
59
|
-
readonly cli: {
|
|
60
|
-
readonly map: TransportErrorMapper<9 | 130 | 3 | 8 | 7 | 2 | 4 | 6 | 5 | 1>;
|
|
61
|
-
readonly values: {
|
|
62
|
-
readonly auth: 9;
|
|
63
|
-
readonly cancelled: 130;
|
|
64
|
-
readonly conflict: 3;
|
|
65
|
-
readonly internal: 8;
|
|
66
|
-
readonly network: 7;
|
|
67
|
-
readonly not_found: 2;
|
|
68
|
-
readonly permission: 4;
|
|
69
|
-
readonly rate_limit: 6;
|
|
70
|
-
readonly timeout: 5;
|
|
71
|
-
readonly validation: 1;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
readonly http: {
|
|
75
|
-
readonly map: TransportErrorMapper<401 | 499 | 409 | 500 | 502 | 404 | 403 | 429 | 504 | 400>;
|
|
76
|
-
readonly values: {
|
|
77
|
-
readonly auth: 401;
|
|
78
|
-
readonly cancelled: 499;
|
|
79
|
-
readonly conflict: 409;
|
|
80
|
-
readonly internal: 500;
|
|
81
|
-
readonly network: 502;
|
|
82
|
-
readonly not_found: 404;
|
|
83
|
-
readonly permission: 403;
|
|
84
|
-
readonly rate_limit: 429;
|
|
85
|
-
readonly timeout: 504;
|
|
86
|
-
readonly validation: 400;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
readonly mcp: {
|
|
90
|
-
readonly map: TransportErrorMapper<-32600 | -32603 | -32601 | -32602>;
|
|
91
|
-
readonly values: {
|
|
92
|
-
readonly auth: -32600;
|
|
93
|
-
readonly cancelled: -32603;
|
|
94
|
-
readonly conflict: -32603;
|
|
95
|
-
readonly internal: -32603;
|
|
96
|
-
readonly network: -32603;
|
|
97
|
-
readonly not_found: -32601;
|
|
98
|
-
readonly permission: -32600;
|
|
99
|
-
readonly rate_limit: -32603;
|
|
100
|
-
readonly timeout: -32603;
|
|
101
|
-
readonly validation: -32602;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
export declare const mapTransportError: (transport: TransportName, error: TrailsError) => TransportErrorCode;
|
|
106
|
-
//# sourceMappingURL=transport-error-map.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport-error-map.d.ts","sourceRoot":"","sources":["../src/transport-error-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9D,eAAO,MAAM,cAAc,iCAAkC,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,KAAK,CAAC,CAAC;AAEhE,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,iBAAiB,CAAC,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,CAAC;AAE3D,eAAO,MAAM,0BAA0B,GACpC,CAAC,EAAE,UAAU,sBAAsB,CAAC,CAAC,CAAC,KAAG,oBAAoB,CAAC,CAAC,CAEtC,CAAC;AAE7B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI4C,CAAC;AAE3E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAazB,CAAC;AAEX,eAAO,MAAM,iBAAiB,GAC5B,WAAW,aAAa,EACxB,OAAO,WAAW,KACjB,kBAAkE,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { exitCodeMap, jsonRpcCodeMap, statusCodeMap } from './errors.js';
|
|
2
|
-
export const transportNames = ['cli', 'http', 'mcp'];
|
|
3
|
-
export const createTransportErrorMapper = (mappings) => (error) => mappings[error.category];
|
|
4
|
-
export const transportErrorMap = {
|
|
5
|
-
cli: exitCodeMap,
|
|
6
|
-
http: statusCodeMap,
|
|
7
|
-
mcp: jsonRpcCodeMap,
|
|
8
|
-
};
|
|
9
|
-
export const transportErrorRegistry = {
|
|
10
|
-
cli: {
|
|
11
|
-
map: createTransportErrorMapper(transportErrorMap.cli),
|
|
12
|
-
values: transportErrorMap.cli,
|
|
13
|
-
},
|
|
14
|
-
http: {
|
|
15
|
-
map: createTransportErrorMapper(transportErrorMap.http),
|
|
16
|
-
values: transportErrorMap.http,
|
|
17
|
-
},
|
|
18
|
-
mcp: {
|
|
19
|
-
map: createTransportErrorMapper(transportErrorMap.mcp),
|
|
20
|
-
values: transportErrorMap.mcp,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
export const mapTransportError = (transport, error) => transportErrorMap[transport][error.category];
|
|
24
|
-
//# sourceMappingURL=transport-error-map.js.map
|