@ontrails/core 1.0.0-beta.15 → 1.0.0-beta.16
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 +63 -0
- package/README.md +61 -16
- 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
package/dist/resilience.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resilience utilities for @ontrails/core
|
|
3
|
-
*
|
|
4
|
-
* Retry with exponential backoff and timeout wrappers,
|
|
5
|
-
* all returning Result types.
|
|
6
|
-
*/
|
|
7
|
-
import { CancelledError, TimeoutError, isRetryable } from './errors.js';
|
|
8
|
-
import { Result } from './result.js';
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Helpers (defined before usage)
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
const sleep = (ms, signal) =>
|
|
13
|
-
// oxlint-disable-next-line avoid-new -- Promise constructor needed for setTimeout-based sleep
|
|
14
|
-
new Promise((resolve) => {
|
|
15
|
-
if (signal?.aborted) {
|
|
16
|
-
resolve();
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
let settled = false;
|
|
20
|
-
const done = () => {
|
|
21
|
-
if (!settled) {
|
|
22
|
-
settled = true;
|
|
23
|
-
resolve();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const timer = setTimeout(done, ms);
|
|
27
|
-
const onAbort = () => {
|
|
28
|
-
clearTimeout(timer);
|
|
29
|
-
done();
|
|
30
|
-
};
|
|
31
|
-
signal?.addEventListener('abort', onAbort, { once: true });
|
|
32
|
-
});
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
// shouldRetry (default)
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
/** Default retry predicate using the error taxonomy. */
|
|
37
|
-
export const shouldRetry = (error) => isRetryable(error);
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// deriveBackoffDelay
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
/** Compute exponential backoff delay with full jitter. */
|
|
42
|
-
export const deriveBackoffDelay = (attempt, options) => {
|
|
43
|
-
const base = options?.baseDelay ?? 1000;
|
|
44
|
-
const max = options?.maxDelay ?? 30_000;
|
|
45
|
-
const factor = options?.backoffFactor ?? 2;
|
|
46
|
-
const exponential = base * factor ** attempt;
|
|
47
|
-
const capped = Math.min(exponential, max);
|
|
48
|
-
// Full jitter: random value in [0, capped]
|
|
49
|
-
return Math.floor(Math.random() * capped);
|
|
50
|
-
};
|
|
51
|
-
// ---------------------------------------------------------------------------
|
|
52
|
-
// retry
|
|
53
|
-
// ---------------------------------------------------------------------------
|
|
54
|
-
/**
|
|
55
|
-
* Retry an async function that returns a Result.
|
|
56
|
-
*
|
|
57
|
-
* On each failure, checks whether the error is retryable and whether the
|
|
58
|
-
* attempt budget remains. Applies exponential backoff with jitter between
|
|
59
|
-
* retries.
|
|
60
|
-
*/
|
|
61
|
-
/** Attempt a single retry iteration. Returns the result to stop, or undefined to continue. */
|
|
62
|
-
const tryAttempt = async (fn, attempt, maxAttempts, retryPredicate, options) => {
|
|
63
|
-
const result = await fn();
|
|
64
|
-
if (result.isOk()) {
|
|
65
|
-
return { done: true, result };
|
|
66
|
-
}
|
|
67
|
-
const isLast = attempt === maxAttempts - 1;
|
|
68
|
-
if (isLast || !retryPredicate(result.error)) {
|
|
69
|
-
return { done: true, result };
|
|
70
|
-
}
|
|
71
|
-
const delay = deriveBackoffDelay(attempt, options);
|
|
72
|
-
if (delay > 0) {
|
|
73
|
-
await sleep(delay, options?.signal);
|
|
74
|
-
}
|
|
75
|
-
return { done: false, result };
|
|
76
|
-
};
|
|
77
|
-
/** Resolve retry options to concrete values. */
|
|
78
|
-
const resolveRetryOptions = (options) => ({
|
|
79
|
-
maxAttempts: options?.maxAttempts ?? 3,
|
|
80
|
-
retryPredicate: options?.shouldRetry ?? shouldRetry,
|
|
81
|
-
signal: options?.signal,
|
|
82
|
-
});
|
|
83
|
-
export const retry = async (fn, options) => {
|
|
84
|
-
const { maxAttempts, retryPredicate, signal } = resolveRetryOptions(options);
|
|
85
|
-
let lastResult;
|
|
86
|
-
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
87
|
-
if (signal?.aborted) {
|
|
88
|
-
return Result.err(new CancelledError('Retry cancelled'));
|
|
89
|
-
}
|
|
90
|
-
const outcome = await tryAttempt(fn, attempt, maxAttempts, retryPredicate, options);
|
|
91
|
-
lastResult = outcome.result;
|
|
92
|
-
if (outcome.done) {
|
|
93
|
-
return outcome.result;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return lastResult ?? Result.err(new CancelledError('Retry exhausted'));
|
|
97
|
-
};
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
// withTimeout
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
/**
|
|
102
|
-
* Run an async Result-returning function with a timeout.
|
|
103
|
-
*
|
|
104
|
-
* If the timeout fires first, returns a TimeoutError result.
|
|
105
|
-
* Also respects an external AbortSignal.
|
|
106
|
-
*/
|
|
107
|
-
export const withTimeout = (fn, ms, signal) => {
|
|
108
|
-
if (signal?.aborted) {
|
|
109
|
-
return Promise.resolve(Result.err(new CancelledError('Already cancelled')));
|
|
110
|
-
}
|
|
111
|
-
// oxlint-disable-next-line avoid-new, promise/no-multiple-resolved -- Promise constructor needed for timeout race; settled guard ensures single resolution
|
|
112
|
-
return new Promise((resolve) => {
|
|
113
|
-
let settled = false;
|
|
114
|
-
// oxlint-disable-next-line prefer-const -- assigned after declaration
|
|
115
|
-
let timer;
|
|
116
|
-
const onAbort = () => {
|
|
117
|
-
if (settled) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
settled = true;
|
|
121
|
-
clearTimeout(timer);
|
|
122
|
-
signal?.removeEventListener('abort', onAbort);
|
|
123
|
-
// oxlint-disable-next-line promise/no-multiple-resolved -- settled guard ensures single resolution
|
|
124
|
-
resolve(Result.err(new CancelledError('Operation cancelled')));
|
|
125
|
-
};
|
|
126
|
-
signal?.addEventListener('abort', onAbort, { once: true });
|
|
127
|
-
timer = setTimeout(() => {
|
|
128
|
-
if (settled) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
settled = true;
|
|
132
|
-
signal?.removeEventListener('abort', onAbort);
|
|
133
|
-
// oxlint-disable-next-line promise/no-multiple-resolved -- settled guard ensures single resolution
|
|
134
|
-
resolve(Result.err(new TimeoutError(`Operation timed out after ${ms}ms`, {
|
|
135
|
-
context: { timeoutMs: ms },
|
|
136
|
-
})));
|
|
137
|
-
}, ms);
|
|
138
|
-
// oxlint-disable-next-line prefer-await-to-then, no-void -- .then() needed inside Promise constructor; void discards unhandled rejection
|
|
139
|
-
void fn().then(
|
|
140
|
-
// oxlint-disable-next-line prefer-await-to-callbacks -- callback required inside .then()
|
|
141
|
-
(result) => {
|
|
142
|
-
if (settled) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
settled = true;
|
|
146
|
-
clearTimeout(timer);
|
|
147
|
-
signal?.removeEventListener('abort', onAbort);
|
|
148
|
-
// oxlint-disable-next-line promise/no-multiple-resolved -- settled guard ensures single resolution
|
|
149
|
-
resolve(result);
|
|
150
|
-
},
|
|
151
|
-
// oxlint-disable-next-line prefer-await-to-callbacks -- rejection handler required inside .then()
|
|
152
|
-
(error) => {
|
|
153
|
-
if (settled) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
settled = true;
|
|
157
|
-
clearTimeout(timer);
|
|
158
|
-
signal?.removeEventListener('abort', onAbort);
|
|
159
|
-
// oxlint-disable-next-line promise/no-multiple-resolved -- settled guard ensures single resolution
|
|
160
|
-
resolve(Result.err(error instanceof Error ? error : new Error(String(error))));
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
//# sourceMappingURL=resilience.js.map
|
package/dist/resilience.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resilience.js","sourceRoot":"","sources":["../src/resilience.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAqBrC,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,MAAoB,EAAiB,EAAE;AAChE,8FAA8F;AAC9F,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,OAAO;IACT,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;IACF,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;IACF,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEL,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,wDAAwD;AACxD,MAAM,CAAC,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AO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;aAC3B,CAAC,CACH,CACF,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,yIAAyI;QACzI,KAAK,EAAE,EAAE,CAAC,IAAI;QACZ,yFAAyF;QACzF,CAAC,MAAM,EAAE,EAAE;YACT,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,mGAAmG;YACnG,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC;QACD,kGAAkG;QAClG,CAAC,KAAc,EAAE,EAAE;YACjB,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,mGAAmG;YACnG,OAAO,CACL,MAAM,CAAC,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CACtE,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resource resolution pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from execute.ts to keep both modules under the 400 LOC ceiling.
|
|
5
|
-
* Handles config validation, singleton caching, concurrent-creation dedup,
|
|
6
|
-
* and the full resolve-or-create flow for declared resources.
|
|
7
|
-
*/
|
|
8
|
-
import type { ResourceOverrideMap } from './resource.js';
|
|
9
|
-
import type { AnyTrail } from './trail.js';
|
|
10
|
-
import type { TrailContext } from './types.js';
|
|
11
|
-
import { Result } from './result.js';
|
|
12
|
-
type ConfigValues = Readonly<Record<string, Record<string, unknown>>>;
|
|
13
|
-
/**
|
|
14
|
-
* Resolve all declared resources for a trail.
|
|
15
|
-
*
|
|
16
|
-
* Validates per-resource config, checks overrides and caches, and creates
|
|
17
|
-
* new instances as needed. Returns an enriched context with all resource
|
|
18
|
-
* instances injected into extensions.
|
|
19
|
-
*/
|
|
20
|
-
export declare const createResources: (trail: AnyTrail, ctx: TrailContext, overrides?: ResourceOverrideMap, configValues?: ConfigValues) => Promise<Result<TrailContext, Error>>;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=resource-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource-config.d.ts","sourceRoot":"","sources":["../src/resource-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAGV,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,KAAK,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AA4StE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,QAAQ,EACf,KAAK,YAAY,EACjB,YAAY,mBAAmB,EAC/B,eAAe,YAAY,KAC1B,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAsBrC,CAAC"}
|
package/dist/resource-config.js
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resource resolution pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from execute.ts to keep both modules under the 400 LOC ceiling.
|
|
5
|
-
* Handles config validation, singleton caching, concurrent-creation dedup,
|
|
6
|
-
* and the full resolve-or-create flow for declared resources.
|
|
7
|
-
*/
|
|
8
|
-
import { InternalError, ValidationError } from './errors.js';
|
|
9
|
-
import { Result } from './result.js';
|
|
10
|
-
import { createResourceLookup } from './resource.js';
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// Singleton caches
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
const singletonResources = new WeakMap();
|
|
15
|
-
/** In-flight resource creation promises, keyed by resource x context. */
|
|
16
|
-
const pendingCreations = new WeakMap();
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Context helpers
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
const toResourceContext = (ctx, config) => ({
|
|
21
|
-
config,
|
|
22
|
-
cwd: ctx.cwd,
|
|
23
|
-
env: ctx.env,
|
|
24
|
-
workspaceRoot: ctx.workspaceRoot,
|
|
25
|
-
});
|
|
26
|
-
const toResourceContextKey = (ctx) => JSON.stringify({
|
|
27
|
-
config: ctx.config,
|
|
28
|
-
cwd: ctx.cwd,
|
|
29
|
-
env: Object.entries(ctx.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)),
|
|
30
|
-
workspaceRoot: ctx.workspaceRoot,
|
|
31
|
-
});
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
// Config validation
|
|
34
|
-
// ---------------------------------------------------------------------------
|
|
35
|
-
/** Validate and resolve a resource's config from the provided configValues map. */
|
|
36
|
-
const resolveResourceConfig = (declaredResource, configValues) => {
|
|
37
|
-
if (declaredResource.config === undefined) {
|
|
38
|
-
return Result.ok();
|
|
39
|
-
}
|
|
40
|
-
const raw = configValues?.[declaredResource.id];
|
|
41
|
-
if (raw === undefined) {
|
|
42
|
-
return Result.err(new ValidationError(`Resource "${declaredResource.id}" declares a config schema but no config was provided`));
|
|
43
|
-
}
|
|
44
|
-
const parsed = declaredResource.config.safeParse(raw);
|
|
45
|
-
if (!parsed.success) {
|
|
46
|
-
return Result.err(new ValidationError(`Resource "${declaredResource.id}" config validation failed: ${parsed.error.message}`));
|
|
47
|
-
}
|
|
48
|
-
return Result.ok(parsed.data);
|
|
49
|
-
};
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// Override / cache lookups
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
const hasOwnResourceOverride = (overrides, id) => overrides !== undefined && Object.hasOwn(overrides, id);
|
|
54
|
-
const getCachedSingletonResource = (declaredResource, resourceContext) => {
|
|
55
|
-
const scopedCache = singletonResources.get(declaredResource);
|
|
56
|
-
if (scopedCache === undefined) {
|
|
57
|
-
return { found: false, value: undefined };
|
|
58
|
-
}
|
|
59
|
-
const key = toResourceContextKey(resourceContext);
|
|
60
|
-
if (!scopedCache.has(key)) {
|
|
61
|
-
return { found: false, value: undefined };
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
found: true,
|
|
65
|
-
value: scopedCache.get(key),
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
const getProvidedResource = (ctx, overrides, declaredResource, resourceContext) => {
|
|
69
|
-
const { id } = declaredResource;
|
|
70
|
-
if (hasOwnResourceOverride(overrides, id)) {
|
|
71
|
-
return Result.ok(overrides[id]);
|
|
72
|
-
}
|
|
73
|
-
if (Object.hasOwn(ctx.extensions ?? {}, id)) {
|
|
74
|
-
return Result.ok(ctx.extensions?.[id]);
|
|
75
|
-
}
|
|
76
|
-
const cached = getCachedSingletonResource(declaredResource, resourceContext);
|
|
77
|
-
if (cached.found) {
|
|
78
|
-
return Result.ok(cached.value);
|
|
79
|
-
}
|
|
80
|
-
return undefined;
|
|
81
|
-
};
|
|
82
|
-
const getOverrideOrExtension = (ctx, overrides, declaredResource) => getProvidedResource(ctx, overrides, declaredResource, toResourceContext(ctx));
|
|
83
|
-
const resolveConfigAwareProvidedResource = (ctx, declaredResource, configValues) => {
|
|
84
|
-
const configResult = resolveResourceConfig(declaredResource, configValues);
|
|
85
|
-
if (configResult.isErr()) {
|
|
86
|
-
return configResult;
|
|
87
|
-
}
|
|
88
|
-
const resourceContext = toResourceContext(ctx, configResult.value);
|
|
89
|
-
const provided = getProvidedResource(ctx, undefined, declaredResource, resourceContext);
|
|
90
|
-
return provided
|
|
91
|
-
? Result.ok({ kind: 'provided', value: provided.unwrap() })
|
|
92
|
-
: Result.ok({ kind: 'context', resourceContext });
|
|
93
|
-
};
|
|
94
|
-
// ---------------------------------------------------------------------------
|
|
95
|
-
// Instance creation
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
const toInternalResourceError = (id, error) => {
|
|
98
|
-
const cause = error instanceof Error ? error : undefined;
|
|
99
|
-
const message = cause?.message ?? String(error);
|
|
100
|
-
return new InternalError(`Resource "${id}" failed to resolve: ${message}`, {
|
|
101
|
-
...(cause ? { cause } : {}),
|
|
102
|
-
context: { resourceId: id },
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
const getSingletonResourceCache = (declaredResource) => {
|
|
106
|
-
const existing = singletonResources.get(declaredResource);
|
|
107
|
-
if (existing !== undefined) {
|
|
108
|
-
return existing;
|
|
109
|
-
}
|
|
110
|
-
const created = new Map();
|
|
111
|
-
singletonResources.set(declaredResource, created);
|
|
112
|
-
return created;
|
|
113
|
-
};
|
|
114
|
-
const doCreateResourceInstance = async (declaredResource, resourceContext) => {
|
|
115
|
-
try {
|
|
116
|
-
const created = await declaredResource.create(resourceContext);
|
|
117
|
-
if (created.isErr()) {
|
|
118
|
-
return Result.err(created.error);
|
|
119
|
-
}
|
|
120
|
-
const instance = created.unwrap();
|
|
121
|
-
getSingletonResourceCache(declaredResource).set(toResourceContextKey(resourceContext), instance);
|
|
122
|
-
return Result.ok(instance);
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
return Result.err(toInternalResourceError(declaredResource.id, error));
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
const trackPendingCreation = (declaredResource, key, promise) => {
|
|
129
|
-
const pending = pendingCreations.get(declaredResource);
|
|
130
|
-
if (pending) {
|
|
131
|
-
pending.set(key, promise);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
pendingCreations.set(declaredResource, new Map([[key, promise]]));
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Deduplicates concurrent creation of the same resource singleton.
|
|
139
|
-
* If a creation is already in flight for this resource x context key,
|
|
140
|
-
* returns the existing promise instead of spawning a second factory call.
|
|
141
|
-
*/
|
|
142
|
-
const createResourceInstance = async (declaredResource, resourceContext) => {
|
|
143
|
-
const key = toResourceContextKey(resourceContext);
|
|
144
|
-
const inflight = pendingCreations.get(declaredResource)?.get(key);
|
|
145
|
-
if (inflight) {
|
|
146
|
-
return inflight;
|
|
147
|
-
}
|
|
148
|
-
const promise = doCreateResourceInstance(declaredResource, resourceContext);
|
|
149
|
-
trackPendingCreation(declaredResource, key, promise);
|
|
150
|
-
try {
|
|
151
|
-
return await promise;
|
|
152
|
-
}
|
|
153
|
-
finally {
|
|
154
|
-
pendingCreations.get(declaredResource)?.delete(key);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
/** Validate config and resolve a single declared resource. */
|
|
158
|
-
const resolveDeclaredResource = async (declaredResource, ctx, overrides, configValues) => {
|
|
159
|
-
// Check overrides/extensions first — skip config validation entirely when
|
|
160
|
-
// a resource instance is already provided.
|
|
161
|
-
const overrideOrExtension = getOverrideOrExtension(ctx, overrides, declaredResource);
|
|
162
|
-
if (overrideOrExtension !== undefined) {
|
|
163
|
-
return overrideOrExtension;
|
|
164
|
-
}
|
|
165
|
-
// Resolve config before consulting the singleton cache so config-aware
|
|
166
|
-
// resources use the same canonical context for cache reads and writes.
|
|
167
|
-
const configAwareResource = resolveConfigAwareProvidedResource(ctx, declaredResource, configValues);
|
|
168
|
-
if (configAwareResource.isErr()) {
|
|
169
|
-
return configAwareResource;
|
|
170
|
-
}
|
|
171
|
-
// No provided instance — create via factory.
|
|
172
|
-
const resolved = configAwareResource.unwrap();
|
|
173
|
-
if (resolved.kind === 'provided') {
|
|
174
|
-
return Result.ok(resolved.value);
|
|
175
|
-
}
|
|
176
|
-
return await createResourceInstance(declaredResource, resolved.resourceContext);
|
|
177
|
-
};
|
|
178
|
-
// ---------------------------------------------------------------------------
|
|
179
|
-
// Full trail resource resolution
|
|
180
|
-
// ---------------------------------------------------------------------------
|
|
181
|
-
const withResolvedResources = (ctx, resolvedResources) => {
|
|
182
|
-
const extensions = { ...ctx.extensions, ...resolvedResources };
|
|
183
|
-
const resolvedCtx = { ...ctx, extensions };
|
|
184
|
-
const lookup = createResourceLookup(() => resolvedCtx);
|
|
185
|
-
resolvedCtx.resource = lookup;
|
|
186
|
-
return resolvedCtx;
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Resolve all declared resources for a trail.
|
|
190
|
-
*
|
|
191
|
-
* Validates per-resource config, checks overrides and caches, and creates
|
|
192
|
-
* new instances as needed. Returns an enriched context with all resource
|
|
193
|
-
* instances injected into extensions.
|
|
194
|
-
*/
|
|
195
|
-
export const createResources = async (trail, ctx, overrides, configValues) => {
|
|
196
|
-
const { resources } = trail;
|
|
197
|
-
if (resources.length === 0) {
|
|
198
|
-
return Result.ok(ctx);
|
|
199
|
-
}
|
|
200
|
-
const resolvedResources = {};
|
|
201
|
-
for (const declaredResource of resources) {
|
|
202
|
-
const resolved = await resolveDeclaredResource(declaredResource, ctx, overrides, configValues);
|
|
203
|
-
if (resolved.isErr()) {
|
|
204
|
-
return resolved;
|
|
205
|
-
}
|
|
206
|
-
resolvedResources[declaredResource.id] = resolved.unwrap();
|
|
207
|
-
}
|
|
208
|
-
return Result.ok(withResolvedResources(ctx, resolvedResources));
|
|
209
|
-
};
|
|
210
|
-
//# sourceMappingURL=resource-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource-config.js","sourceRoot":"","sources":["../src/resource-config.ts"],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YACrB,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC"}
|
package/dist/resource.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { Result } from './result.js';
|
|
2
|
-
import type { AnySignal } from './signal.js';
|
|
3
|
-
import type { ResourceLookup, TrailContext } from './types.js';
|
|
4
|
-
import type { z } from 'zod';
|
|
5
|
-
/**
|
|
6
|
-
* Stable process-scoped fields available when constructing a resource.
|
|
7
|
-
*
|
|
8
|
-
* Resources are app-level singletons, so they intentionally do not receive
|
|
9
|
-
* the full per-request TrailContext. When a resource declares a `config` schema,
|
|
10
|
-
* the validated config is passed as `svc.config`.
|
|
11
|
-
*/
|
|
12
|
-
export type ResourceContext<C = unknown> = Pick<TrailContext, 'cwd' | 'env' | 'workspaceRoot'> & {
|
|
13
|
-
readonly config: C;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Everything needed to describe a resource before a factory is introduced.
|
|
17
|
-
*
|
|
18
|
-
* When `config` is a Zod schema, the `create` callback receives
|
|
19
|
-
* `ResourceContext<C>` with the validated config value.
|
|
20
|
-
*/
|
|
21
|
-
export interface ResourceSpec<T, C = unknown> {
|
|
22
|
-
/** Create the resource instance from stable process-scoped context. */
|
|
23
|
-
readonly create: (svc: ResourceContext<C>) => Result<T, Error> | Promise<Result<T, Error>>;
|
|
24
|
-
/** Config schema — when present, config is validated and passed to `create`. */
|
|
25
|
-
readonly config?: z.ZodType<C> | undefined;
|
|
26
|
-
/** Optional cleanup performed when the hosting trailhead shuts down. */
|
|
27
|
-
readonly dispose?: ((resource: T) => void | Promise<void>) | undefined;
|
|
28
|
-
/** Optional operational readiness probe for introspection tooling. */
|
|
29
|
-
readonly health?: ((resource: T) => Result<unknown, Error> | Promise<Result<unknown, Error>>) | undefined;
|
|
30
|
-
/** Optional test factory used by higher-level helpers. */
|
|
31
|
-
readonly mock?: (() => T | Promise<T>) | undefined;
|
|
32
|
-
/** Human-readable description. */
|
|
33
|
-
readonly description?: string | undefined;
|
|
34
|
-
/** Arbitrary meta for tooling and filtering. */
|
|
35
|
-
readonly meta?: Readonly<Record<string, unknown>> | undefined;
|
|
36
|
-
/** Signals projected or owned by this resource. */
|
|
37
|
-
readonly signals?: readonly AnySignal[] | undefined;
|
|
38
|
-
}
|
|
39
|
-
/** A typed resource definition. */
|
|
40
|
-
export interface Resource<T> extends ResourceSpec<T> {
|
|
41
|
-
readonly kind: 'resource';
|
|
42
|
-
readonly id: string;
|
|
43
|
-
/** Read the resolved resource instance from a trail context. */
|
|
44
|
-
from(ctx: TrailContext): T;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Existential type for heterogeneous resource collections.
|
|
48
|
-
*
|
|
49
|
-
* `Resource<T>` includes function parameters in `dispose`/`health`, so
|
|
50
|
-
* `unknown` is too narrow for mixed resource arrays. `any` is the correct
|
|
51
|
-
* existential here.
|
|
52
|
-
*/
|
|
53
|
-
export type AnyResource = Resource<any>;
|
|
54
|
-
/** Explicit runtime overrides keyed by resource ID. */
|
|
55
|
-
export type ResourceOverrideMap = Readonly<Record<string, unknown>>;
|
|
56
|
-
/** Create a `ctx.resource(...)` accessor bound to a concrete context snapshot. */
|
|
57
|
-
export declare const createResourceLookup: (getContext: () => Pick<TrailContext, "extensions">) => ResourceLookup;
|
|
58
|
-
/**
|
|
59
|
-
* Create a typed resource definition.
|
|
60
|
-
*
|
|
61
|
-
* The resource object is inert until a later execution branch resolves concrete
|
|
62
|
-
* instances into TrailContext extensions.
|
|
63
|
-
*/
|
|
64
|
-
export declare const resource: <T>(id: string, spec: ResourceSpec<T>) => Resource<T>;
|
|
65
|
-
/** Narrow unknown values to resource definitions during topo discovery. */
|
|
66
|
-
export declare const isResource: (value: unknown) => value is AnyResource;
|
|
67
|
-
/**
|
|
68
|
-
* Return the first duplicate resource ID in a collection, if any.
|
|
69
|
-
*
|
|
70
|
-
* This supports later topo registration without each caller duplicating the
|
|
71
|
-
* same scan logic.
|
|
72
|
-
*/
|
|
73
|
-
export declare const findDuplicateResourceId: (resources: readonly Pick<AnyResource, "id">[]) => string | undefined;
|
|
74
|
-
//# sourceMappingURL=resource.d.ts.map
|
package/dist/resource.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI,IAAI,CAC7C,YAAY,EACZ,KAAK,GAAG,KAAK,GAAG,eAAe,CAChC,GAAG;IACF,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO;IAC1C,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,CACf,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC,KACpB,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAClD,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3C,wEAAwE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MAAM,oBAAoB,GAC/B,YAAY,MAAM,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,KACjD,cAQmB,CAAC;AAEvB;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC,CAAC,CAAC,KAAG,QAAQ,CAAC,CAAC,CAiBpE,CAAC;AAEP,2EAA2E;AAC3E,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAMpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,SAAS,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,KAC5C,MAAM,GAAG,SASX,CAAC"}
|
package/dist/resource.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { InternalError } from './errors.js';
|
|
2
|
-
const getResourceId = (resourceOrId) => typeof resourceOrId === 'string' ? resourceOrId : resourceOrId.id;
|
|
3
|
-
const getResourceInstance = (ctx, resourceOrId) => {
|
|
4
|
-
const id = getResourceId(resourceOrId);
|
|
5
|
-
return ctx.extensions?.[id];
|
|
6
|
-
};
|
|
7
|
-
const hasResourceInstance = (ctx, resourceOrId) => Object.hasOwn(ctx.extensions ?? {}, getResourceId(resourceOrId));
|
|
8
|
-
/** Create a `ctx.resource(...)` accessor bound to a concrete context snapshot. */
|
|
9
|
-
export const createResourceLookup = (getContext) => ((resourceOrId) => {
|
|
10
|
-
const id = getResourceId(resourceOrId);
|
|
11
|
-
const ctx = getContext();
|
|
12
|
-
if (!hasResourceInstance(ctx, id)) {
|
|
13
|
-
throw new InternalError(`Resource "${id}" not provisioned in context`);
|
|
14
|
-
}
|
|
15
|
-
return getResourceInstance(ctx, id);
|
|
16
|
-
});
|
|
17
|
-
/**
|
|
18
|
-
* Create a typed resource definition.
|
|
19
|
-
*
|
|
20
|
-
* The resource object is inert until a later execution branch resolves concrete
|
|
21
|
-
* instances into TrailContext extensions.
|
|
22
|
-
*/
|
|
23
|
-
export const resource = (id, spec) => (() => {
|
|
24
|
-
if (id.includes(':')) {
|
|
25
|
-
throw new InternalError(`Resource "${id}" is invalid because resource ids may not contain ":"`);
|
|
26
|
-
}
|
|
27
|
-
return Object.freeze({
|
|
28
|
-
...spec,
|
|
29
|
-
from(ctx) {
|
|
30
|
-
const lookup = ctx.resource ?? createResourceLookup(() => ctx);
|
|
31
|
-
return lookup(this);
|
|
32
|
-
},
|
|
33
|
-
id,
|
|
34
|
-
kind: 'resource',
|
|
35
|
-
});
|
|
36
|
-
})();
|
|
37
|
-
/** Narrow unknown values to resource definitions during topo discovery. */
|
|
38
|
-
export const isResource = (value) => {
|
|
39
|
-
if (typeof value !== 'object' || value === null) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const v = value;
|
|
43
|
-
return v.kind === 'resource' && typeof v.id === 'string';
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Return the first duplicate resource ID in a collection, if any.
|
|
47
|
-
*
|
|
48
|
-
* This supports later topo registration without each caller duplicating the
|
|
49
|
-
* same scan logic.
|
|
50
|
-
*/
|
|
51
|
-
export const findDuplicateResourceId = (resources) => {
|
|
52
|
-
const seen = new Set();
|
|
53
|
-
for (const candidate of resources) {
|
|
54
|
-
if (seen.has(candidate.id)) {
|
|
55
|
-
return candidate.id;
|
|
56
|
-
}
|
|
57
|
-
seen.add(candidate.id);
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=resource.js.map
|
package/dist/resource.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAwE5C,MAAM,aAAa,GAAG,CACpB,YAA8C,EACtC,EAAE,CACV,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAA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AoB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;YAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QACD,EAAE;QACF,IAAI,EAAE,UAAmB;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC,EAAE,CAAC;AAEP,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAwB,EAAE;IACjE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,CAAC,GAAG,KAAyC,CAAC;IACpD,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC;AAC3D,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,SAA6C,EACzB,EAAE;IACtB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,SAAS,IAAI,SAAS,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC;YAC3B,OAAO,SAAS,CAAC,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
package/dist/result.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A type-safe Result monad for representing success/failure without exceptions.
|
|
3
|
-
*/
|
|
4
|
-
import { InternalError, ValidationError } from './errors.js';
|
|
5
|
-
declare class Ok<T, E> {
|
|
6
|
-
readonly value: T;
|
|
7
|
-
constructor(value: T);
|
|
8
|
-
isOk(): this is Ok<T, E>;
|
|
9
|
-
isErr(): this is Err<E>;
|
|
10
|
-
map<U>(fn: (value: T) => U): Result<U, E>;
|
|
11
|
-
flatMap<U, F = E>(fn: (value: T) => Result<U, F>): Result<U, E | F>;
|
|
12
|
-
mapErr<F>(_fn: (error: E) => F): Result<T, F>;
|
|
13
|
-
match<U>(handlers: {
|
|
14
|
-
ok: (value: T) => U;
|
|
15
|
-
err: (error: E) => U;
|
|
16
|
-
}): U;
|
|
17
|
-
unwrap(): T;
|
|
18
|
-
unwrapOr(_fallback: T): T;
|
|
19
|
-
}
|
|
20
|
-
declare class Err<E> {
|
|
21
|
-
readonly error: E;
|
|
22
|
-
constructor(error: E);
|
|
23
|
-
isOk(): this is Ok<never, E>;
|
|
24
|
-
isErr(): this is Err<E>;
|
|
25
|
-
map<U>(_fn: (value: never) => U): Result<U, E>;
|
|
26
|
-
flatMap<U, F = E>(_fn: (value: never) => Result<U, F>): Result<U, E | F>;
|
|
27
|
-
mapErr<F>(fn: (error: E) => F): Result<never, F>;
|
|
28
|
-
match<U>(handlers: {
|
|
29
|
-
ok: (value: never) => U;
|
|
30
|
-
err: (error: E) => U;
|
|
31
|
-
}): U;
|
|
32
|
-
unwrap(): never;
|
|
33
|
-
unwrapOr<T>(fallback: T): T;
|
|
34
|
-
}
|
|
35
|
-
export type Result<T, E = Error> = Ok<T, E> | Err<E>;
|
|
36
|
-
export declare const Result: {
|
|
37
|
-
readonly combine: <T, E>(results: readonly Result<T, E>[]) => Result<T[], E>;
|
|
38
|
-
readonly err: <E>(error: E) => Err<E>;
|
|
39
|
-
/**
|
|
40
|
-
* Wrap a fetch call in a Result, mapping failures to TrailsError subclasses.
|
|
41
|
-
*
|
|
42
|
-
* Network errors become NetworkError. Abort signals become CancelledError.
|
|
43
|
-
* HTTP error status codes map to the appropriate error category.
|
|
44
|
-
*/
|
|
45
|
-
readonly fromFetch: (input: string | URL | Request, init?: RequestInit) => Promise<Result<Response, Error>>;
|
|
46
|
-
/**
|
|
47
|
-
* Parse a JSON string, returning a Result instead of throwing.
|
|
48
|
-
*/
|
|
49
|
-
readonly fromJson: (json: string) => Result<unknown, ValidationError>;
|
|
50
|
-
readonly ok: <T = void>(value?: T) => Result<T, never>;
|
|
51
|
-
/**
|
|
52
|
-
* Stringify a value to JSON, returning a Result. Handles circular references.
|
|
53
|
-
*/
|
|
54
|
-
readonly toJson: (value: unknown) => Result<string, InternalError>;
|
|
55
|
-
};
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=result.d.ts.map
|
package/dist/result.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE7D,cAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IACX,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;gBAEN,KAAK,EAAE,CAAC;IAKpB,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAKxB,KAAK,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IAIvB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAIzC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAInE,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAI7C,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE;QAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC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