@directive-run/core 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-utils.cjs.map +1 -1
- package/dist/adapter-utils.d.cts +1 -1
- package/dist/adapter-utils.d.ts +1 -1
- package/dist/adapter-utils.js.map +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +832 -186
- package/dist/index.d.ts +832 -186
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/migration.cjs.map +1 -1
- package/dist/migration.js.map +1 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.cts +86 -19
- package/dist/plugins/index.d.ts +86 -19
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/{plugins-DZljh9NJ.d.cts → plugins-cDWoL7A7.d.cts} +23 -46
- package/dist/{plugins-DZljh9NJ.d.ts → plugins-cDWoL7A7.d.ts} +23 -46
- package/dist/testing.cjs +3 -3
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +143 -27
- package/dist/testing.d.ts +143 -27
- package/dist/testing.js +3 -3
- package/dist/testing.js.map +1 -1
- package/dist/worker.cjs +3 -3
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +3 -3
- package/dist/worker.js.map +1 -1
- package/package.json +3 -2
|
@@ -250,7 +250,7 @@ interface ConstraintDef<S extends Schema, R extends Requirement = Requirement> {
|
|
|
250
250
|
* Constraint IDs whose resolvers must complete before this constraint is evaluated.
|
|
251
251
|
* If a dependency's `when()` returns false (no requirements), this constraint proceeds.
|
|
252
252
|
* If a dependency's resolver fails, this constraint remains blocked.
|
|
253
|
-
* Cross-module: use "moduleName
|
|
253
|
+
* Cross-module: use "moduleName::constraintName" format (after references are not auto-prefixed).
|
|
254
254
|
*/
|
|
255
255
|
after?: string[];
|
|
256
256
|
/**
|
|
@@ -395,7 +395,7 @@ type EventsDef<S extends Schema> = Record<string, FlexibleEventHandler<S>>;
|
|
|
395
395
|
*/
|
|
396
396
|
|
|
397
397
|
/** Retry policy configuration */
|
|
398
|
-
interface RetryPolicy
|
|
398
|
+
interface RetryPolicy {
|
|
399
399
|
/** Maximum number of attempts */
|
|
400
400
|
attempts: number;
|
|
401
401
|
/** Backoff strategy */
|
|
@@ -420,16 +420,10 @@ interface BatchConfig {
|
|
|
420
420
|
enabled: boolean;
|
|
421
421
|
/** Time window to collect requirements (ms) */
|
|
422
422
|
windowMs: number;
|
|
423
|
-
/** Maximum batch size (default: unlimited) */
|
|
423
|
+
/** Maximum batch size. When reached, the batch flushes immediately instead of waiting for the timer. (default: unlimited) */
|
|
424
424
|
maxSize?: number;
|
|
425
425
|
/** Per-batch timeout in ms (overrides resolver timeout for batches) */
|
|
426
426
|
timeoutMs?: number;
|
|
427
|
-
/**
|
|
428
|
-
* Failure strategy for partial batch failures:
|
|
429
|
-
* - "all-or-nothing" (default): If resolveBatch throws, all requirements fail
|
|
430
|
-
* - "per-item": Use resolveBatchWithResults to get per-item results
|
|
431
|
-
*/
|
|
432
|
-
failureStrategy?: "all-or-nothing" | "per-item";
|
|
433
427
|
}
|
|
434
428
|
/**
|
|
435
429
|
* Result for a single item in a batch resolution.
|
|
@@ -451,6 +445,7 @@ type BatchResolveResults<T = unknown> = Array<BatchItemResult<T>>;
|
|
|
451
445
|
interface ResolverContext<S extends Schema = Schema> {
|
|
452
446
|
readonly facts: Facts<S>;
|
|
453
447
|
readonly signal: AbortSignal;
|
|
448
|
+
/** Returns a read-only snapshot of the current facts state, useful for before/after comparisons inside resolvers. */
|
|
454
449
|
readonly snapshot: () => FactsSnapshot<S>;
|
|
455
450
|
}
|
|
456
451
|
/** Single resolver definition (untyped - use TypedResolversDef for type safety) */
|
|
@@ -464,10 +459,10 @@ interface ResolverDef<S extends Schema, R extends Requirement = Requirement> {
|
|
|
464
459
|
/** Custom key function for deduplication */
|
|
465
460
|
key?: RequirementKeyFn<R>;
|
|
466
461
|
/** Retry policy */
|
|
467
|
-
retry?: RetryPolicy
|
|
462
|
+
retry?: RetryPolicy;
|
|
468
463
|
/** Timeout for resolver execution (ms) */
|
|
469
464
|
timeout?: number;
|
|
470
|
-
/** Batch configuration (
|
|
465
|
+
/** Batch configuration. Works with resolve() (individual fallback), resolveBatch(), or resolveBatchWithResults(). */
|
|
471
466
|
batch?: BatchConfig;
|
|
472
467
|
/** Resolve function for single requirement */
|
|
473
468
|
resolve?: (req: R, ctx: ResolverContext<S>) => Promise<void>;
|
|
@@ -583,32 +578,15 @@ interface RetryLaterConfig {
|
|
|
583
578
|
/** Maximum delay in milliseconds (default: 30000) */
|
|
584
579
|
maxDelayMs?: number;
|
|
585
580
|
}
|
|
586
|
-
/**
|
|
587
|
-
* Circuit breaker configuration for automatic failure protection.
|
|
588
|
-
* After `failureThreshold` consecutive failures, the circuit opens
|
|
589
|
-
* and all requests fail fast for `resetTimeoutMs`.
|
|
590
|
-
*/
|
|
591
|
-
interface CircuitBreakerConfig {
|
|
592
|
-
/** Number of consecutive failures before opening the circuit (default: 5) */
|
|
593
|
-
failureThreshold?: number;
|
|
594
|
-
/** Time in milliseconds before attempting to close the circuit (default: 60000) */
|
|
595
|
-
resetTimeoutMs?: number;
|
|
596
|
-
/** Number of successful requests needed to close a half-open circuit (default: 1) */
|
|
597
|
-
successThreshold?: number;
|
|
598
|
-
}
|
|
599
|
-
/** Circuit breaker state */
|
|
600
|
-
type CircuitBreakerState = "closed" | "open" | "half-open";
|
|
601
581
|
/** Error boundary configuration */
|
|
602
582
|
interface ErrorBoundaryConfig {
|
|
603
|
-
onConstraintError?: RecoveryStrategy | ((error: Error, constraint: string) => void);
|
|
604
|
-
onResolverError?: RecoveryStrategy | ((error: Error, resolver: string) => void);
|
|
605
|
-
onEffectError?: RecoveryStrategy | ((error: Error, effect: string) => void);
|
|
606
|
-
onDerivationError?: RecoveryStrategy | ((error: Error, derivation: string) => void);
|
|
583
|
+
onConstraintError?: RecoveryStrategy | ((error: Error, constraint: string) => RecoveryStrategy | void);
|
|
584
|
+
onResolverError?: RecoveryStrategy | ((error: Error, resolver: string) => RecoveryStrategy | void);
|
|
585
|
+
onEffectError?: RecoveryStrategy | ((error: Error, effect: string) => RecoveryStrategy | void);
|
|
586
|
+
onDerivationError?: RecoveryStrategy | ((error: Error, derivation: string) => RecoveryStrategy | void);
|
|
607
587
|
onError?: (error: DirectiveError) => void;
|
|
608
588
|
/** Configuration for retry-later strategy */
|
|
609
589
|
retryLater?: RetryLaterConfig;
|
|
610
|
-
/** Circuit breaker configuration (applies to resolvers only) */
|
|
611
|
-
circuitBreaker?: CircuitBreakerConfig;
|
|
612
590
|
}
|
|
613
591
|
|
|
614
592
|
/**
|
|
@@ -1231,7 +1209,7 @@ interface TypedConstraintDef<M extends ModuleSchema> {
|
|
|
1231
1209
|
* Constraint IDs whose resolvers must complete before this constraint is evaluated.
|
|
1232
1210
|
* If a dependency's `when()` returns false (no requirements), this constraint proceeds.
|
|
1233
1211
|
* If a dependency's resolver fails, this constraint remains blocked.
|
|
1234
|
-
* Cross-module: use "moduleName
|
|
1212
|
+
* Cross-module: use "moduleName::constraintName" format (after references are not auto-prefixed).
|
|
1235
1213
|
*/
|
|
1236
1214
|
after?: string[];
|
|
1237
1215
|
/**
|
|
@@ -1269,7 +1247,7 @@ interface CrossModuleConstraintDef<M extends ModuleSchema, Deps extends CrossMod
|
|
|
1269
1247
|
* Constraint IDs whose resolvers must complete before this constraint is evaluated.
|
|
1270
1248
|
* If a dependency's `when()` returns false (no requirements), this constraint proceeds.
|
|
1271
1249
|
* If a dependency's resolver fails, this constraint remains blocked.
|
|
1272
|
-
* Cross-module: use "moduleName
|
|
1250
|
+
* Cross-module: use "moduleName::constraintName" format (after references are not auto-prefixed).
|
|
1273
1251
|
*/
|
|
1274
1252
|
after?: string[];
|
|
1275
1253
|
/**
|
|
@@ -1315,21 +1293,14 @@ type CrossModuleDerivationFn<M extends ModuleSchema, Deps extends CrossModuleDep
|
|
|
1315
1293
|
type CrossModuleDerivationsDef<M extends ModuleSchema, Deps extends CrossModuleDeps> = {
|
|
1316
1294
|
[K in keyof GetDerivationsSchema<M>]: CrossModuleDerivationFn<M, Deps, K>;
|
|
1317
1295
|
};
|
|
1318
|
-
/**
|
|
1319
|
-
* Retry policy configuration.
|
|
1320
|
-
*/
|
|
1321
|
-
interface RetryPolicy {
|
|
1322
|
-
attempts: number;
|
|
1323
|
-
backoff: "none" | "linear" | "exponential";
|
|
1324
|
-
initialDelay?: number;
|
|
1325
|
-
maxDelay?: number;
|
|
1326
|
-
}
|
|
1327
1296
|
/**
|
|
1328
1297
|
* Resolver context with typed facts.
|
|
1329
1298
|
*/
|
|
1330
1299
|
interface TypedResolverContext<M extends ModuleSchema> {
|
|
1331
1300
|
readonly facts: Facts<M["facts"]>;
|
|
1332
1301
|
readonly signal: AbortSignal;
|
|
1302
|
+
/** Returns a read-only snapshot of the current facts state, useful for before/after comparisons inside resolvers. */
|
|
1303
|
+
readonly snapshot: () => FactsSnapshot<M["facts"]>;
|
|
1333
1304
|
}
|
|
1334
1305
|
/**
|
|
1335
1306
|
* Helper to extract a specific requirement type from the schema.
|
|
@@ -1349,8 +1320,14 @@ interface TypedResolverDef<M extends ModuleSchema, T extends keyof GetRequiremen
|
|
|
1349
1320
|
retry?: RetryPolicy;
|
|
1350
1321
|
/** Timeout for resolver execution (ms) */
|
|
1351
1322
|
timeout?: number;
|
|
1352
|
-
/**
|
|
1353
|
-
|
|
1323
|
+
/** Batch configuration */
|
|
1324
|
+
batch?: BatchConfig;
|
|
1325
|
+
/** Resolve function for single requirement */
|
|
1326
|
+
resolve?: (req: ExtractRequirement<M, T>, ctx: TypedResolverContext<M>) => Promise<void>;
|
|
1327
|
+
/** Resolve batched requirements as a group (all-or-nothing). Receives the full array collected during the batch window. If this throws, all items in the batch are considered failed. */
|
|
1328
|
+
resolveBatch?: (reqs: ExtractRequirement<M, T>[], ctx: TypedResolverContext<M>) => Promise<void>;
|
|
1329
|
+
/** Resolve batched requirements with per-item success/failure results. Return a `BatchResolveResults` array in the same order as the input. Failed items can be individually retried. */
|
|
1330
|
+
resolveBatchWithResults?: (reqs: ExtractRequirement<M, T>[], ctx: TypedResolverContext<M>) => Promise<BatchResolveResults>;
|
|
1354
1331
|
}
|
|
1355
1332
|
/**
|
|
1356
1333
|
* Union of all typed resolver definitions for all requirement types.
|
|
@@ -2005,4 +1982,4 @@ interface Plugin<M extends ModuleSchema = ModuleSchema> {
|
|
|
2005
1982
|
onRunComplete?: (run: RunChangelogEntry) => void;
|
|
2006
1983
|
}
|
|
2007
1984
|
|
|
2008
|
-
export { type AnySystem as $, type ConstraintState as A, type BatchConfig as B, type CrossModuleDeps as C, type DerivationsSchema as D, type EffectsDef as E, type Facts as F, type ResolversDef as G, type ResolverStatus as H, type InferRequirements as I, type System as J, type FactChange as K, type FactsSnapshot as L, type ModuleSchema as M, type NamespacedSystem as N, type ReconcileResult as O, type Plugin as P, type Snapshot as Q, type Requirement as R, type Schema as S, type TypedDerivationsDef as T, DirectiveError as U, type RecoveryStrategy as V, type RunChangelogEntry as W, type ErrorSource as X, type RetryLaterConfig as Y, type TimeTravelAPI as Z, type SystemConfig as _, type RequirementOutput$1 as a, type BatchItemResult as a0, type BatchResolveResults as a1, type
|
|
1985
|
+
export { type AnySystem as $, type ConstraintState as A, type BatchConfig as B, type CrossModuleDeps as C, type DerivationsSchema as D, type EffectsDef as E, type Facts as F, type ResolversDef as G, type ResolverStatus as H, type InferRequirements as I, type System as J, type FactChange as K, type FactsSnapshot as L, type ModuleSchema as M, type NamespacedSystem as N, type ReconcileResult as O, type Plugin as P, type Snapshot as Q, type Requirement as R, type Schema as S, type TypedDerivationsDef as T, DirectiveError as U, type RecoveryStrategy as V, type RunChangelogEntry as W, type ErrorSource as X, type RetryLaterConfig as Y, type TimeTravelAPI as Z, type SystemConfig as _, type RequirementOutput$1 as a, type BatchItemResult as a0, type BatchResolveResults as a1, type CrossModuleConstraintDef as a2, type CrossModuleDerivationFn as a3, type CrossModuleEffectDef as a4, type CrossModuleFactsWithSelf as a5, type DerivationKeys as a6, type DerivationReturnType as a7, type DeriveAccessor as a8, type DispatchEventsFromSchema as a9, type RequirementsSchema as aA, type SnapshotMeta as aB, type SystemEvent as aC, type SystemInspection as aD, type SystemMode as aE, type SystemSnapshot as aF, type TimeTravelState as aG, type TypedResolverContext as aH, type TypedResolverDef as aI, type UnionEvents as aJ, isNamespacedSystem as aK, isSingleModuleSystem as aL, type DistributableSnapshot as aa, type DistributableSnapshotOptions as ab, type EffectCleanup as ac, type EventPayloadSchema as ad, type EventsAccessor as ae, type EventsAccessorFromSchema as af, type EventsDef as ag, type EventsSchema as ah, type FactKeys as ai, type FactReturnType as aj, type FlexibleEventHandler as ak, type InferDerivations as al, type InferEventPayloadFromSchema as am, type InferEvents as an, type InferRequirementPayloadFromSchema as ao, type InferRequirementTypes as ap, type InferSchema as aq, type InferSchemaType as ar, type InferSelectorState as as, type MutableNamespacedFacts as at, type NamespacedDerivations as au, type NamespacedEventsAccessor as av, type NamespacedFacts as aw, type ObservableKeys as ax, type RequirementExplanation as ay, type RequirementPayloadSchema$1 as az, type RetryPolicy as b, type ResolverContext as c, type SchemaType as d, type FactsStore as e, type TypedEventsDef as f, type TypedConstraintsDef as g, type TypedResolversDef as h, type ModuleHooks as i, type CrossModuleDerivationsDef as j, type CrossModuleEffectsDef as k, type CrossModuleConstraintsDef as l, type ModuleDef as m, type CreateSystemOptionsSingle as n, type SingleModuleSystem as o, type ModulesMap as p, type CreateSystemOptionsNamed as q, type TypedConstraintDef as r, type RequirementOutput as s, type DebugConfig as t, type ErrorBoundaryConfig as u, type InferFacts as v, type ExtractSchema as w, type RequirementWithId as x, type RequirementKeyFn as y, type ConstraintsDef as z };
|
|
@@ -250,7 +250,7 @@ interface ConstraintDef<S extends Schema, R extends Requirement = Requirement> {
|
|
|
250
250
|
* Constraint IDs whose resolvers must complete before this constraint is evaluated.
|
|
251
251
|
* If a dependency's `when()` returns false (no requirements), this constraint proceeds.
|
|
252
252
|
* If a dependency's resolver fails, this constraint remains blocked.
|
|
253
|
-
* Cross-module: use "moduleName
|
|
253
|
+
* Cross-module: use "moduleName::constraintName" format (after references are not auto-prefixed).
|
|
254
254
|
*/
|
|
255
255
|
after?: string[];
|
|
256
256
|
/**
|
|
@@ -395,7 +395,7 @@ type EventsDef<S extends Schema> = Record<string, FlexibleEventHandler<S>>;
|
|
|
395
395
|
*/
|
|
396
396
|
|
|
397
397
|
/** Retry policy configuration */
|
|
398
|
-
interface RetryPolicy
|
|
398
|
+
interface RetryPolicy {
|
|
399
399
|
/** Maximum number of attempts */
|
|
400
400
|
attempts: number;
|
|
401
401
|
/** Backoff strategy */
|
|
@@ -420,16 +420,10 @@ interface BatchConfig {
|
|
|
420
420
|
enabled: boolean;
|
|
421
421
|
/** Time window to collect requirements (ms) */
|
|
422
422
|
windowMs: number;
|
|
423
|
-
/** Maximum batch size (default: unlimited) */
|
|
423
|
+
/** Maximum batch size. When reached, the batch flushes immediately instead of waiting for the timer. (default: unlimited) */
|
|
424
424
|
maxSize?: number;
|
|
425
425
|
/** Per-batch timeout in ms (overrides resolver timeout for batches) */
|
|
426
426
|
timeoutMs?: number;
|
|
427
|
-
/**
|
|
428
|
-
* Failure strategy for partial batch failures:
|
|
429
|
-
* - "all-or-nothing" (default): If resolveBatch throws, all requirements fail
|
|
430
|
-
* - "per-item": Use resolveBatchWithResults to get per-item results
|
|
431
|
-
*/
|
|
432
|
-
failureStrategy?: "all-or-nothing" | "per-item";
|
|
433
427
|
}
|
|
434
428
|
/**
|
|
435
429
|
* Result for a single item in a batch resolution.
|
|
@@ -451,6 +445,7 @@ type BatchResolveResults<T = unknown> = Array<BatchItemResult<T>>;
|
|
|
451
445
|
interface ResolverContext<S extends Schema = Schema> {
|
|
452
446
|
readonly facts: Facts<S>;
|
|
453
447
|
readonly signal: AbortSignal;
|
|
448
|
+
/** Returns a read-only snapshot of the current facts state, useful for before/after comparisons inside resolvers. */
|
|
454
449
|
readonly snapshot: () => FactsSnapshot<S>;
|
|
455
450
|
}
|
|
456
451
|
/** Single resolver definition (untyped - use TypedResolversDef for type safety) */
|
|
@@ -464,10 +459,10 @@ interface ResolverDef<S extends Schema, R extends Requirement = Requirement> {
|
|
|
464
459
|
/** Custom key function for deduplication */
|
|
465
460
|
key?: RequirementKeyFn<R>;
|
|
466
461
|
/** Retry policy */
|
|
467
|
-
retry?: RetryPolicy
|
|
462
|
+
retry?: RetryPolicy;
|
|
468
463
|
/** Timeout for resolver execution (ms) */
|
|
469
464
|
timeout?: number;
|
|
470
|
-
/** Batch configuration (
|
|
465
|
+
/** Batch configuration. Works with resolve() (individual fallback), resolveBatch(), or resolveBatchWithResults(). */
|
|
471
466
|
batch?: BatchConfig;
|
|
472
467
|
/** Resolve function for single requirement */
|
|
473
468
|
resolve?: (req: R, ctx: ResolverContext<S>) => Promise<void>;
|
|
@@ -583,32 +578,15 @@ interface RetryLaterConfig {
|
|
|
583
578
|
/** Maximum delay in milliseconds (default: 30000) */
|
|
584
579
|
maxDelayMs?: number;
|
|
585
580
|
}
|
|
586
|
-
/**
|
|
587
|
-
* Circuit breaker configuration for automatic failure protection.
|
|
588
|
-
* After `failureThreshold` consecutive failures, the circuit opens
|
|
589
|
-
* and all requests fail fast for `resetTimeoutMs`.
|
|
590
|
-
*/
|
|
591
|
-
interface CircuitBreakerConfig {
|
|
592
|
-
/** Number of consecutive failures before opening the circuit (default: 5) */
|
|
593
|
-
failureThreshold?: number;
|
|
594
|
-
/** Time in milliseconds before attempting to close the circuit (default: 60000) */
|
|
595
|
-
resetTimeoutMs?: number;
|
|
596
|
-
/** Number of successful requests needed to close a half-open circuit (default: 1) */
|
|
597
|
-
successThreshold?: number;
|
|
598
|
-
}
|
|
599
|
-
/** Circuit breaker state */
|
|
600
|
-
type CircuitBreakerState = "closed" | "open" | "half-open";
|
|
601
581
|
/** Error boundary configuration */
|
|
602
582
|
interface ErrorBoundaryConfig {
|
|
603
|
-
onConstraintError?: RecoveryStrategy | ((error: Error, constraint: string) => void);
|
|
604
|
-
onResolverError?: RecoveryStrategy | ((error: Error, resolver: string) => void);
|
|
605
|
-
onEffectError?: RecoveryStrategy | ((error: Error, effect: string) => void);
|
|
606
|
-
onDerivationError?: RecoveryStrategy | ((error: Error, derivation: string) => void);
|
|
583
|
+
onConstraintError?: RecoveryStrategy | ((error: Error, constraint: string) => RecoveryStrategy | void);
|
|
584
|
+
onResolverError?: RecoveryStrategy | ((error: Error, resolver: string) => RecoveryStrategy | void);
|
|
585
|
+
onEffectError?: RecoveryStrategy | ((error: Error, effect: string) => RecoveryStrategy | void);
|
|
586
|
+
onDerivationError?: RecoveryStrategy | ((error: Error, derivation: string) => RecoveryStrategy | void);
|
|
607
587
|
onError?: (error: DirectiveError) => void;
|
|
608
588
|
/** Configuration for retry-later strategy */
|
|
609
589
|
retryLater?: RetryLaterConfig;
|
|
610
|
-
/** Circuit breaker configuration (applies to resolvers only) */
|
|
611
|
-
circuitBreaker?: CircuitBreakerConfig;
|
|
612
590
|
}
|
|
613
591
|
|
|
614
592
|
/**
|
|
@@ -1231,7 +1209,7 @@ interface TypedConstraintDef<M extends ModuleSchema> {
|
|
|
1231
1209
|
* Constraint IDs whose resolvers must complete before this constraint is evaluated.
|
|
1232
1210
|
* If a dependency's `when()` returns false (no requirements), this constraint proceeds.
|
|
1233
1211
|
* If a dependency's resolver fails, this constraint remains blocked.
|
|
1234
|
-
* Cross-module: use "moduleName
|
|
1212
|
+
* Cross-module: use "moduleName::constraintName" format (after references are not auto-prefixed).
|
|
1235
1213
|
*/
|
|
1236
1214
|
after?: string[];
|
|
1237
1215
|
/**
|
|
@@ -1269,7 +1247,7 @@ interface CrossModuleConstraintDef<M extends ModuleSchema, Deps extends CrossMod
|
|
|
1269
1247
|
* Constraint IDs whose resolvers must complete before this constraint is evaluated.
|
|
1270
1248
|
* If a dependency's `when()` returns false (no requirements), this constraint proceeds.
|
|
1271
1249
|
* If a dependency's resolver fails, this constraint remains blocked.
|
|
1272
|
-
* Cross-module: use "moduleName
|
|
1250
|
+
* Cross-module: use "moduleName::constraintName" format (after references are not auto-prefixed).
|
|
1273
1251
|
*/
|
|
1274
1252
|
after?: string[];
|
|
1275
1253
|
/**
|
|
@@ -1315,21 +1293,14 @@ type CrossModuleDerivationFn<M extends ModuleSchema, Deps extends CrossModuleDep
|
|
|
1315
1293
|
type CrossModuleDerivationsDef<M extends ModuleSchema, Deps extends CrossModuleDeps> = {
|
|
1316
1294
|
[K in keyof GetDerivationsSchema<M>]: CrossModuleDerivationFn<M, Deps, K>;
|
|
1317
1295
|
};
|
|
1318
|
-
/**
|
|
1319
|
-
* Retry policy configuration.
|
|
1320
|
-
*/
|
|
1321
|
-
interface RetryPolicy {
|
|
1322
|
-
attempts: number;
|
|
1323
|
-
backoff: "none" | "linear" | "exponential";
|
|
1324
|
-
initialDelay?: number;
|
|
1325
|
-
maxDelay?: number;
|
|
1326
|
-
}
|
|
1327
1296
|
/**
|
|
1328
1297
|
* Resolver context with typed facts.
|
|
1329
1298
|
*/
|
|
1330
1299
|
interface TypedResolverContext<M extends ModuleSchema> {
|
|
1331
1300
|
readonly facts: Facts<M["facts"]>;
|
|
1332
1301
|
readonly signal: AbortSignal;
|
|
1302
|
+
/** Returns a read-only snapshot of the current facts state, useful for before/after comparisons inside resolvers. */
|
|
1303
|
+
readonly snapshot: () => FactsSnapshot<M["facts"]>;
|
|
1333
1304
|
}
|
|
1334
1305
|
/**
|
|
1335
1306
|
* Helper to extract a specific requirement type from the schema.
|
|
@@ -1349,8 +1320,14 @@ interface TypedResolverDef<M extends ModuleSchema, T extends keyof GetRequiremen
|
|
|
1349
1320
|
retry?: RetryPolicy;
|
|
1350
1321
|
/** Timeout for resolver execution (ms) */
|
|
1351
1322
|
timeout?: number;
|
|
1352
|
-
/**
|
|
1353
|
-
|
|
1323
|
+
/** Batch configuration */
|
|
1324
|
+
batch?: BatchConfig;
|
|
1325
|
+
/** Resolve function for single requirement */
|
|
1326
|
+
resolve?: (req: ExtractRequirement<M, T>, ctx: TypedResolverContext<M>) => Promise<void>;
|
|
1327
|
+
/** Resolve batched requirements as a group (all-or-nothing). Receives the full array collected during the batch window. If this throws, all items in the batch are considered failed. */
|
|
1328
|
+
resolveBatch?: (reqs: ExtractRequirement<M, T>[], ctx: TypedResolverContext<M>) => Promise<void>;
|
|
1329
|
+
/** Resolve batched requirements with per-item success/failure results. Return a `BatchResolveResults` array in the same order as the input. Failed items can be individually retried. */
|
|
1330
|
+
resolveBatchWithResults?: (reqs: ExtractRequirement<M, T>[], ctx: TypedResolverContext<M>) => Promise<BatchResolveResults>;
|
|
1354
1331
|
}
|
|
1355
1332
|
/**
|
|
1356
1333
|
* Union of all typed resolver definitions for all requirement types.
|
|
@@ -2005,4 +1982,4 @@ interface Plugin<M extends ModuleSchema = ModuleSchema> {
|
|
|
2005
1982
|
onRunComplete?: (run: RunChangelogEntry) => void;
|
|
2006
1983
|
}
|
|
2007
1984
|
|
|
2008
|
-
export { type AnySystem as $, type ConstraintState as A, type BatchConfig as B, type CrossModuleDeps as C, type DerivationsSchema as D, type EffectsDef as E, type Facts as F, type ResolversDef as G, type ResolverStatus as H, type InferRequirements as I, type System as J, type FactChange as K, type FactsSnapshot as L, type ModuleSchema as M, type NamespacedSystem as N, type ReconcileResult as O, type Plugin as P, type Snapshot as Q, type Requirement as R, type Schema as S, type TypedDerivationsDef as T, DirectiveError as U, type RecoveryStrategy as V, type RunChangelogEntry as W, type ErrorSource as X, type RetryLaterConfig as Y, type TimeTravelAPI as Z, type SystemConfig as _, type RequirementOutput$1 as a, type BatchItemResult as a0, type BatchResolveResults as a1, type
|
|
1985
|
+
export { type AnySystem as $, type ConstraintState as A, type BatchConfig as B, type CrossModuleDeps as C, type DerivationsSchema as D, type EffectsDef as E, type Facts as F, type ResolversDef as G, type ResolverStatus as H, type InferRequirements as I, type System as J, type FactChange as K, type FactsSnapshot as L, type ModuleSchema as M, type NamespacedSystem as N, type ReconcileResult as O, type Plugin as P, type Snapshot as Q, type Requirement as R, type Schema as S, type TypedDerivationsDef as T, DirectiveError as U, type RecoveryStrategy as V, type RunChangelogEntry as W, type ErrorSource as X, type RetryLaterConfig as Y, type TimeTravelAPI as Z, type SystemConfig as _, type RequirementOutput$1 as a, type BatchItemResult as a0, type BatchResolveResults as a1, type CrossModuleConstraintDef as a2, type CrossModuleDerivationFn as a3, type CrossModuleEffectDef as a4, type CrossModuleFactsWithSelf as a5, type DerivationKeys as a6, type DerivationReturnType as a7, type DeriveAccessor as a8, type DispatchEventsFromSchema as a9, type RequirementsSchema as aA, type SnapshotMeta as aB, type SystemEvent as aC, type SystemInspection as aD, type SystemMode as aE, type SystemSnapshot as aF, type TimeTravelState as aG, type TypedResolverContext as aH, type TypedResolverDef as aI, type UnionEvents as aJ, isNamespacedSystem as aK, isSingleModuleSystem as aL, type DistributableSnapshot as aa, type DistributableSnapshotOptions as ab, type EffectCleanup as ac, type EventPayloadSchema as ad, type EventsAccessor as ae, type EventsAccessorFromSchema as af, type EventsDef as ag, type EventsSchema as ah, type FactKeys as ai, type FactReturnType as aj, type FlexibleEventHandler as ak, type InferDerivations as al, type InferEventPayloadFromSchema as am, type InferEvents as an, type InferRequirementPayloadFromSchema as ao, type InferRequirementTypes as ap, type InferSchema as aq, type InferSchemaType as ar, type InferSelectorState as as, type MutableNamespacedFacts as at, type NamespacedDerivations as au, type NamespacedEventsAccessor as av, type NamespacedFacts as aw, type ObservableKeys as ax, type RequirementExplanation as ay, type RequirementPayloadSchema$1 as az, type RetryPolicy as b, type ResolverContext as c, type SchemaType as d, type FactsStore as e, type TypedEventsDef as f, type TypedConstraintsDef as g, type TypedResolversDef as h, type ModuleHooks as i, type CrossModuleDerivationsDef as j, type CrossModuleEffectsDef as k, type CrossModuleConstraintsDef as l, type ModuleDef as m, type CreateSystemOptionsSingle as n, type SingleModuleSystem as o, type ModulesMap as p, type CreateSystemOptionsNamed as q, type TypedConstraintDef as r, type RequirementOutput as s, type DebugConfig as t, type ErrorBoundaryConfig as u, type InferFacts as v, type ExtractSchema as w, type RequirementWithId as x, type RequirementKeyFn as y, type ConstraintsDef as z };
|