@directive-run/core 0.8.9 → 1.0.0
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.d.cts +1 -1
- package/dist/adapter-utils.d.ts +1 -1
- package/dist/chunk-3H24Z7WM.cjs +16 -0
- package/dist/chunk-3H24Z7WM.cjs.map +1 -0
- package/dist/chunk-AUSBUCOL.cjs +3 -0
- package/dist/chunk-AUSBUCOL.cjs.map +1 -0
- package/dist/chunk-MPOV2REO.js +16 -0
- package/dist/chunk-MPOV2REO.js.map +1 -0
- package/dist/chunk-YWKFNZQV.js +3 -0
- package/dist/chunk-YWKFNZQV.js.map +1 -0
- package/dist/{helpers-50q7yhA9.d.ts → helpers-Bd_P3ZTY.d.ts} +54 -2
- package/dist/{helpers-B6SkcKCD.d.cts → helpers-CU3Il0tz.d.cts} +54 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -13
- package/dist/index.d.ts +16 -13
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +1 -1
- package/dist/internals.d.cts +7 -38
- package/dist/internals.d.ts +7 -38
- package/dist/internals.js +1 -1
- package/dist/plugins/index.cjs +2 -2
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.cts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/{plugins-Bg_oq2sO.d.cts → plugins-O-3VHejK.d.cts} +148 -6
- package/dist/{plugins-Bg_oq2sO.d.ts → plugins-O-3VHejK.d.ts} +148 -6
- package/dist/system-AGVKMAYF.js +2 -0
- package/dist/{system-3H5V4HJZ.js.map → system-AGVKMAYF.js.map} +1 -1
- package/dist/system-QQYBNE7A.cjs +2 -0
- package/dist/{system-IJKVTF3C.cjs.map → system-QQYBNE7A.cjs.map} +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CFSW3RP5.cjs +0 -16
- package/dist/chunk-CFSW3RP5.cjs.map +0 -1
- package/dist/chunk-ISYFVEHR.js +0 -3
- package/dist/chunk-ISYFVEHR.js.map +0 -1
- package/dist/chunk-L3SUAAPM.cjs +0 -3
- package/dist/chunk-L3SUAAPM.cjs.map +0 -1
- package/dist/chunk-LB6PNML4.js +0 -16
- package/dist/chunk-LB6PNML4.js.map +0 -1
- package/dist/system-3H5V4HJZ.js +0 -2
- package/dist/system-IJKVTF3C.cjs +0 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import { S as SchemaType, M as ModuleSchema, F as Facts, T as TypedDerivationsDef, a as TypedEventsDef, E as EffectsDef, b as TypedConstraintsDef, c as TypedResolversDef, d as ModuleHooks, C as CrossModuleDeps, e as CrossModuleDerivationsDef, f as CrossModuleEffectsDef, g as CrossModuleConstraintsDef, h as ModuleDef, i as CreateSystemOptionsSingle, j as SingleModuleSystem, k as ModulesMap, l as CreateSystemOptionsNamed, N as NamespacedSystem, P as Plugin, m as TraceOption, n as ErrorBoundaryConfig, R as RequirementWithId, o as Requirement, p as RequirementKeyFn } from './plugins-
|
|
2
|
-
export { A as AnySystem, B as BatchConfig,
|
|
3
|
-
export { t as typedConstraint, a as typedResolver } from './helpers-
|
|
1
|
+
import { S as SchemaType, D as DefinitionMeta, M as ModuleSchema, F as Facts, T as TypedDerivationsDef, a as TypedEventsDef, E as EffectsDef, b as TypedConstraintsDef, c as TypedResolversDef, d as ModuleHooks, C as CrossModuleDeps, e as CrossModuleDerivationsDef, f as CrossModuleEffectsDef, g as CrossModuleConstraintsDef, h as ModuleDef, i as CreateSystemOptionsSingle, j as SingleModuleSystem, k as ModulesMap, l as CreateSystemOptionsNamed, N as NamespacedSystem, P as Plugin, m as TraceOption, n as ErrorBoundaryConfig, R as RequirementWithId, o as Requirement, p as RequirementKeyFn } from './plugins-O-3VHejK.cjs';
|
|
2
|
+
export { A as AnySystem, B as BatchConfig, q as DirectiveError, r as DistributableSnapshot, s as DistributableSnapshotOptions, t as DynamicConstraintDef, u as DynamicEffectDef, v as DynamicResolverDef, w as FactsSnapshot, H as HistoryAPI, x as HistoryOption, y as HistoryState, I as InferDerivations, z as InferEvents, G as InferFacts, J as InferRequirementTypes, K as InferRequirements, L as InferSchemaType, O as InferSelectorState, Q as MetaAccessor, U as MetaMatch, V as RetryPolicy, W as Schema, X as Snapshot, Y as System, Z as SystemConfig, _ as SystemInspection, $ as SystemMode, a0 as SystemSnapshot, a1 as TraceEntry, a2 as isNamespacedSystem, a3 as isSingleModuleSystem } from './plugins-O-3VHejK.cjs';
|
|
3
|
+
export { D as DerivationDefWithMeta, t as typedConstraint, a as typedResolver } from './helpers-CU3Il0tz.cjs';
|
|
4
4
|
export { D as DistributableSnapshotLike, S as SignedSnapshot, a as SnapshotDiff, b as SnapshotDiffEntry, d as diffSnapshots, i as isSignedSnapshot, c as isSnapshotExpired, s as shallowEqual, e as signSnapshot, v as validateSnapshot, f as verifySnapshotSignature } from './utils-BnQajqPu.cjs';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Schema Type Builders
|
|
8
|
-
*
|
|
9
|
-
* Provides type-safe schema definitions with optional runtime validation.
|
|
10
|
-
* Used to define fact types, derivation types, event payload types, etc.
|
|
11
|
-
*
|
|
12
|
-
* This module has no dependency on the facts store or tracking system.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
6
|
/** Brand symbol for branded types */
|
|
16
7
|
declare const Brand: unique symbol;
|
|
17
8
|
/** Branded type - adds a unique brand to a base type */
|
|
@@ -30,6 +21,8 @@ interface ExtendedSchemaType<T> extends SchemaType<T> {
|
|
|
30
21
|
}>;
|
|
31
22
|
/** Mutable - set by array validators to indicate which element failed */
|
|
32
23
|
_lastFailedIndex?: number;
|
|
24
|
+
/** Optional metadata for debugging and devtools (never read on hot path). */
|
|
25
|
+
readonly _meta?: DefinitionMeta;
|
|
33
26
|
}
|
|
34
27
|
/** Chainable schema type with all common methods */
|
|
35
28
|
interface ChainableSchemaType<T> extends ExtendedSchemaType<T> {
|
|
@@ -40,6 +33,8 @@ interface ChainableSchemaType<T> extends ExtendedSchemaType<T> {
|
|
|
40
33
|
refine(predicate: (value: T) => boolean, message: string): ChainableSchemaType<T>;
|
|
41
34
|
nullable(): ChainableSchemaType<T | null>;
|
|
42
35
|
optional(): ChainableSchemaType<T | undefined>;
|
|
36
|
+
/** Attach metadata for debugging and devtools. */
|
|
37
|
+
meta(meta: DefinitionMeta): ChainableSchemaType<T>;
|
|
43
38
|
}
|
|
44
39
|
/**
|
|
45
40
|
* Schema type builders for defining fact types.
|
|
@@ -90,6 +85,7 @@ declare const t: {
|
|
|
90
85
|
minLength(n: number): ChainableSchemaType<T> & /*elided*/ any;
|
|
91
86
|
maxLength(n: number): ChainableSchemaType<T> & /*elided*/ any;
|
|
92
87
|
pattern(regex: RegExp): ChainableSchemaType<T> & /*elided*/ any;
|
|
88
|
+
meta(m: DefinitionMeta): ChainableSchemaType<T> & /*elided*/ any;
|
|
93
89
|
};
|
|
94
90
|
/**
|
|
95
91
|
* Create a number schema type with optional min/max constraints.
|
|
@@ -115,6 +111,7 @@ declare const t: {
|
|
|
115
111
|
number(): ChainableSchemaType<number> & {
|
|
116
112
|
min(n: number): ChainableSchemaType<number> & /*elided*/ any;
|
|
117
113
|
max(n: number): ChainableSchemaType<number> & /*elided*/ any;
|
|
114
|
+
meta(m: DefinitionMeta): ChainableSchemaType<number> & /*elided*/ any;
|
|
118
115
|
};
|
|
119
116
|
/**
|
|
120
117
|
* Create a boolean schema type.
|
|
@@ -139,6 +136,7 @@ declare const t: {
|
|
|
139
136
|
nonEmpty(): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
140
137
|
maxLength(n: number): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
141
138
|
minLength(n: number): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
139
|
+
meta(m: DefinitionMeta): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
142
140
|
_lastFailedIndex?: number;
|
|
143
141
|
};
|
|
144
142
|
/**
|
|
@@ -153,6 +151,7 @@ declare const t: {
|
|
|
153
151
|
shape(schema: { [K in keyof T]?: SchemaType<T[K]>; }): ChainableSchemaType<T> & /*elided*/ any;
|
|
154
152
|
nonNull(): ChainableSchemaType<T> & /*elided*/ any;
|
|
155
153
|
hasKeys(...keys: string[]): ChainableSchemaType<T> & /*elided*/ any;
|
|
154
|
+
meta(m: DefinitionMeta): ChainableSchemaType<T> & /*elided*/ any;
|
|
156
155
|
};
|
|
157
156
|
/**
|
|
158
157
|
* Create an enum schema type for string literal unions.
|
|
@@ -333,6 +332,8 @@ interface ModuleConfig<M extends ModuleSchema> {
|
|
|
333
332
|
constraints?: TypedConstraintsDef<M>;
|
|
334
333
|
resolvers?: TypedResolversDef<M>;
|
|
335
334
|
hooks?: ModuleHooks<M>;
|
|
335
|
+
/** Optional metadata for debugging and devtools (never read on hot path). */
|
|
336
|
+
meta?: DefinitionMeta;
|
|
336
337
|
/** History configuration — controls which events create snapshots for undo/redo. */
|
|
337
338
|
history?: {
|
|
338
339
|
/** Events that create history snapshots. Omit to snapshot all events. */
|
|
@@ -407,6 +408,8 @@ interface ModuleConfigWithDeps<M extends ModuleSchema, Deps extends CrossModuleD
|
|
|
407
408
|
/** Resolvers. Uses flat access (`ctx.facts.myFact`) to keep async mutations scoped to own module. */
|
|
408
409
|
resolvers?: TypedResolversDef<M>;
|
|
409
410
|
hooks?: ModuleHooks<M>;
|
|
411
|
+
/** Optional metadata for debugging and devtools (never read on hot path). */
|
|
412
|
+
meta?: DefinitionMeta;
|
|
410
413
|
/** History configuration — controls which events create snapshots for undo/redo. */
|
|
411
414
|
history?: {
|
|
412
415
|
/** Events that create history snapshots. Omit to snapshot all events. */
|
|
@@ -954,4 +957,4 @@ declare const Backoff: {
|
|
|
954
957
|
readonly Exponential: "exponential";
|
|
955
958
|
};
|
|
956
959
|
|
|
957
|
-
export { Backoff, type Branded, type ChainableSchemaType, CreateSystemOptionsNamed, CreateSystemOptionsSingle, CrossModuleDeps, ErrorBoundaryConfig, type ExtendedSchemaType, Facts, type ModuleConfig, type ModuleConfigWithDeps, ModuleDef, ModuleHooks, ModuleSchema, ModulesMap, NamespacedSystem, Plugin, Requirement, RequirementSet, type RequirementTypeStatus, RequirementWithId, SchemaType, SingleModuleSystem, TraceOption, createModule, createModuleFactory, createRequirementStatusPlugin, createStatusHook, createSystem, createSystemWithStatus, forType, generateRequirementId, isRequirementType, req, t };
|
|
960
|
+
export { Backoff, type Branded, type ChainableSchemaType, CreateSystemOptionsNamed, CreateSystemOptionsSingle, CrossModuleDeps, DefinitionMeta, ErrorBoundaryConfig, type ExtendedSchemaType, Facts, type ModuleConfig, type ModuleConfigWithDeps, ModuleDef, ModuleHooks, ModuleSchema, ModulesMap, NamespacedSystem, Plugin, Requirement, RequirementSet, type RequirementTypeStatus, RequirementWithId, SchemaType, SingleModuleSystem, TraceOption, createModule, createModuleFactory, createRequirementStatusPlugin, createStatusHook, createSystem, createSystemWithStatus, forType, generateRequirementId, isRequirementType, req, t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import { S as SchemaType, M as ModuleSchema, F as Facts, T as TypedDerivationsDef, a as TypedEventsDef, E as EffectsDef, b as TypedConstraintsDef, c as TypedResolversDef, d as ModuleHooks, C as CrossModuleDeps, e as CrossModuleDerivationsDef, f as CrossModuleEffectsDef, g as CrossModuleConstraintsDef, h as ModuleDef, i as CreateSystemOptionsSingle, j as SingleModuleSystem, k as ModulesMap, l as CreateSystemOptionsNamed, N as NamespacedSystem, P as Plugin, m as TraceOption, n as ErrorBoundaryConfig, R as RequirementWithId, o as Requirement, p as RequirementKeyFn } from './plugins-
|
|
2
|
-
export { A as AnySystem, B as BatchConfig,
|
|
3
|
-
export { t as typedConstraint, a as typedResolver } from './helpers-
|
|
1
|
+
import { S as SchemaType, D as DefinitionMeta, M as ModuleSchema, F as Facts, T as TypedDerivationsDef, a as TypedEventsDef, E as EffectsDef, b as TypedConstraintsDef, c as TypedResolversDef, d as ModuleHooks, C as CrossModuleDeps, e as CrossModuleDerivationsDef, f as CrossModuleEffectsDef, g as CrossModuleConstraintsDef, h as ModuleDef, i as CreateSystemOptionsSingle, j as SingleModuleSystem, k as ModulesMap, l as CreateSystemOptionsNamed, N as NamespacedSystem, P as Plugin, m as TraceOption, n as ErrorBoundaryConfig, R as RequirementWithId, o as Requirement, p as RequirementKeyFn } from './plugins-O-3VHejK.js';
|
|
2
|
+
export { A as AnySystem, B as BatchConfig, q as DirectiveError, r as DistributableSnapshot, s as DistributableSnapshotOptions, t as DynamicConstraintDef, u as DynamicEffectDef, v as DynamicResolverDef, w as FactsSnapshot, H as HistoryAPI, x as HistoryOption, y as HistoryState, I as InferDerivations, z as InferEvents, G as InferFacts, J as InferRequirementTypes, K as InferRequirements, L as InferSchemaType, O as InferSelectorState, Q as MetaAccessor, U as MetaMatch, V as RetryPolicy, W as Schema, X as Snapshot, Y as System, Z as SystemConfig, _ as SystemInspection, $ as SystemMode, a0 as SystemSnapshot, a1 as TraceEntry, a2 as isNamespacedSystem, a3 as isSingleModuleSystem } from './plugins-O-3VHejK.js';
|
|
3
|
+
export { D as DerivationDefWithMeta, t as typedConstraint, a as typedResolver } from './helpers-Bd_P3ZTY.js';
|
|
4
4
|
export { D as DistributableSnapshotLike, S as SignedSnapshot, a as SnapshotDiff, b as SnapshotDiffEntry, d as diffSnapshots, i as isSignedSnapshot, c as isSnapshotExpired, s as shallowEqual, e as signSnapshot, v as validateSnapshot, f as verifySnapshotSignature } from './utils-BnQajqPu.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Schema Type Builders
|
|
8
|
-
*
|
|
9
|
-
* Provides type-safe schema definitions with optional runtime validation.
|
|
10
|
-
* Used to define fact types, derivation types, event payload types, etc.
|
|
11
|
-
*
|
|
12
|
-
* This module has no dependency on the facts store or tracking system.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
6
|
/** Brand symbol for branded types */
|
|
16
7
|
declare const Brand: unique symbol;
|
|
17
8
|
/** Branded type - adds a unique brand to a base type */
|
|
@@ -30,6 +21,8 @@ interface ExtendedSchemaType<T> extends SchemaType<T> {
|
|
|
30
21
|
}>;
|
|
31
22
|
/** Mutable - set by array validators to indicate which element failed */
|
|
32
23
|
_lastFailedIndex?: number;
|
|
24
|
+
/** Optional metadata for debugging and devtools (never read on hot path). */
|
|
25
|
+
readonly _meta?: DefinitionMeta;
|
|
33
26
|
}
|
|
34
27
|
/** Chainable schema type with all common methods */
|
|
35
28
|
interface ChainableSchemaType<T> extends ExtendedSchemaType<T> {
|
|
@@ -40,6 +33,8 @@ interface ChainableSchemaType<T> extends ExtendedSchemaType<T> {
|
|
|
40
33
|
refine(predicate: (value: T) => boolean, message: string): ChainableSchemaType<T>;
|
|
41
34
|
nullable(): ChainableSchemaType<T | null>;
|
|
42
35
|
optional(): ChainableSchemaType<T | undefined>;
|
|
36
|
+
/** Attach metadata for debugging and devtools. */
|
|
37
|
+
meta(meta: DefinitionMeta): ChainableSchemaType<T>;
|
|
43
38
|
}
|
|
44
39
|
/**
|
|
45
40
|
* Schema type builders for defining fact types.
|
|
@@ -90,6 +85,7 @@ declare const t: {
|
|
|
90
85
|
minLength(n: number): ChainableSchemaType<T> & /*elided*/ any;
|
|
91
86
|
maxLength(n: number): ChainableSchemaType<T> & /*elided*/ any;
|
|
92
87
|
pattern(regex: RegExp): ChainableSchemaType<T> & /*elided*/ any;
|
|
88
|
+
meta(m: DefinitionMeta): ChainableSchemaType<T> & /*elided*/ any;
|
|
93
89
|
};
|
|
94
90
|
/**
|
|
95
91
|
* Create a number schema type with optional min/max constraints.
|
|
@@ -115,6 +111,7 @@ declare const t: {
|
|
|
115
111
|
number(): ChainableSchemaType<number> & {
|
|
116
112
|
min(n: number): ChainableSchemaType<number> & /*elided*/ any;
|
|
117
113
|
max(n: number): ChainableSchemaType<number> & /*elided*/ any;
|
|
114
|
+
meta(m: DefinitionMeta): ChainableSchemaType<number> & /*elided*/ any;
|
|
118
115
|
};
|
|
119
116
|
/**
|
|
120
117
|
* Create a boolean schema type.
|
|
@@ -139,6 +136,7 @@ declare const t: {
|
|
|
139
136
|
nonEmpty(): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
140
137
|
maxLength(n: number): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
141
138
|
minLength(n: number): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
139
|
+
meta(m: DefinitionMeta): ChainableSchemaType<T[]> & /*elided*/ any;
|
|
142
140
|
_lastFailedIndex?: number;
|
|
143
141
|
};
|
|
144
142
|
/**
|
|
@@ -153,6 +151,7 @@ declare const t: {
|
|
|
153
151
|
shape(schema: { [K in keyof T]?: SchemaType<T[K]>; }): ChainableSchemaType<T> & /*elided*/ any;
|
|
154
152
|
nonNull(): ChainableSchemaType<T> & /*elided*/ any;
|
|
155
153
|
hasKeys(...keys: string[]): ChainableSchemaType<T> & /*elided*/ any;
|
|
154
|
+
meta(m: DefinitionMeta): ChainableSchemaType<T> & /*elided*/ any;
|
|
156
155
|
};
|
|
157
156
|
/**
|
|
158
157
|
* Create an enum schema type for string literal unions.
|
|
@@ -333,6 +332,8 @@ interface ModuleConfig<M extends ModuleSchema> {
|
|
|
333
332
|
constraints?: TypedConstraintsDef<M>;
|
|
334
333
|
resolvers?: TypedResolversDef<M>;
|
|
335
334
|
hooks?: ModuleHooks<M>;
|
|
335
|
+
/** Optional metadata for debugging and devtools (never read on hot path). */
|
|
336
|
+
meta?: DefinitionMeta;
|
|
336
337
|
/** History configuration — controls which events create snapshots for undo/redo. */
|
|
337
338
|
history?: {
|
|
338
339
|
/** Events that create history snapshots. Omit to snapshot all events. */
|
|
@@ -407,6 +408,8 @@ interface ModuleConfigWithDeps<M extends ModuleSchema, Deps extends CrossModuleD
|
|
|
407
408
|
/** Resolvers. Uses flat access (`ctx.facts.myFact`) to keep async mutations scoped to own module. */
|
|
408
409
|
resolvers?: TypedResolversDef<M>;
|
|
409
410
|
hooks?: ModuleHooks<M>;
|
|
411
|
+
/** Optional metadata for debugging and devtools (never read on hot path). */
|
|
412
|
+
meta?: DefinitionMeta;
|
|
410
413
|
/** History configuration — controls which events create snapshots for undo/redo. */
|
|
411
414
|
history?: {
|
|
412
415
|
/** Events that create history snapshots. Omit to snapshot all events. */
|
|
@@ -954,4 +957,4 @@ declare const Backoff: {
|
|
|
954
957
|
readonly Exponential: "exponential";
|
|
955
958
|
};
|
|
956
959
|
|
|
957
|
-
export { Backoff, type Branded, type ChainableSchemaType, CreateSystemOptionsNamed, CreateSystemOptionsSingle, CrossModuleDeps, ErrorBoundaryConfig, type ExtendedSchemaType, Facts, type ModuleConfig, type ModuleConfigWithDeps, ModuleDef, ModuleHooks, ModuleSchema, ModulesMap, NamespacedSystem, Plugin, Requirement, RequirementSet, type RequirementTypeStatus, RequirementWithId, SchemaType, SingleModuleSystem, TraceOption, createModule, createModuleFactory, createRequirementStatusPlugin, createStatusHook, createSystem, createSystemWithStatus, forType, generateRequirementId, isRequirementType, req, t };
|
|
960
|
+
export { Backoff, type Branded, type ChainableSchemaType, CreateSystemOptionsNamed, CreateSystemOptionsSingle, CrossModuleDeps, DefinitionMeta, ErrorBoundaryConfig, type ExtendedSchemaType, Facts, type ModuleConfig, type ModuleConfigWithDeps, ModuleDef, ModuleHooks, ModuleSchema, ModulesMap, NamespacedSystem, Plugin, Requirement, RequirementSet, type RequirementTypeStatus, RequirementWithId, SchemaType, SingleModuleSystem, TraceOption, createModule, createModuleFactory, createRequirementStatusPlugin, createStatusHook, createSystem, createSystemWithStatus, forType, generateRequirementId, isRequirementType, req, t };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-MPOV2REO.js';export{a as createSystem}from'./chunk-MPOV2REO.js';export{b as DirectiveError,o as RequirementSet,n as forType,k as generateRequirementId,h as isNamespacedSystem,m as isRequirementType,g as isSingleModuleSystem,l as req,e as typedConstraint,f as typedResolver}from'./chunk-YWKFNZQV.js';import'./chunk-EFBBEXDA.js';export{h as diffSnapshots,i as isSignedSnapshot,f as isSnapshotExpired,d as shallowEqual,j as signSnapshot,g as validateSnapshot,k as verifySnapshotSignature}from'./chunk-4CMO5OVZ.js';function g(e=[],n,r,s,i,l,u){return {_type:void 0,_validators:e,_typeName:n,_default:r,_transform:s,_description:i,_refinements:l,_meta:u,validate(p){return g([...e,p],n,r,s,i,l,u)}}}function c(e,n,r,s,i,l,u){return {...g(e,n,r,s,i,l,u),default(t){return c(e,n,t,s,i,l,u)},transform(t){return c([],n,void 0,o=>{let d=s?s(o):o;return t(d)},i,void 0,u)},brand(){return c(e,`Branded<${n}>`,r,s,i,l,u)},describe(t){return c(e,n,r,s,t,l,u)},refine(t,a){let o=[...l??[],{predicate:t,message:a}];return c([...e,t],n,r,s,i,o,u)},nullable(){return c([t=>t===null||e.every(a=>a(t))],`${n} | null`,r,s,i,void 0,u)},optional(){return c([t=>t===void 0||e.every(a=>a(t))],`${n} | undefined`,r,s,i,void 0,u)},meta(t){return c(e,n,r,s,i,l,t)}}}var $={string(){let e=(n,r,s,i,l,u)=>({...c(n,"string",r,s,i,l,u),minLength(t){return e([...n,a=>a.length>=t],r,s,i,l,u)},maxLength(t){return e([...n,a=>a.length<=t],r,s,i,l,u)},pattern(t){return e([...n,a=>t.test(a)],r,s,i,l,u)},default(t){return e(n,t,s,i,l,u)},describe(t){return e(n,r,s,t,l,u)},refine(t,a){let o=[...l??[],{predicate:t,message:a}];return e([...n,t],r,s,i,o,u)},meta(t){return e(n,r,s,i,l,t)}});return e([n=>typeof n=="string"])},number(){let e=(n,r,s,i,l,u)=>({...c(n,"number",r,s,i,l,u),min(t){return e([...n,a=>a>=t],r,s,i,l,u)},max(t){return e([...n,a=>a<=t],r,s,i,l,u)},default(t){return e(n,t,s,i,l,u)},describe(t){return e(n,r,s,t,l,u)},refine(t,a){let o=[...l??[],{predicate:t,message:a}];return e([...n,t],r,s,i,o,u)},meta(t){return e(n,r,s,i,l,t)}});return e([n=>typeof n=="number"])},boolean(){return c([e=>typeof e=="boolean"],"boolean")},array(){let e=(n,r,s,i,l,u)=>{let p=c(n,"array",s,void 0,i,void 0,u),t=l??{value:-1};return {...p,get _lastFailedIndex(){return t.value},set _lastFailedIndex(o){t.value=o;},of(o){let d={value:-1};return e([...n,y=>{for(let m=0;m<y.length;m++)if(!o._validators.every(S=>S(y[m])))return d.value=m,false;return true}],o,s,i,d,u)},nonEmpty(){return e([...n,o=>o.length>0],r,s,i,t,u)},maxLength(o){return e([...n,d=>d.length<=o],r,s,i,t,u)},minLength(o){return e([...n,d=>d.length>=o],r,s,i,t,u)},default(o){return e(n,r,o,i,t,u)},describe(o){return e(n,r,s,o,t,u)},meta(o){return e(n,r,s,i,t,o)}}};return e([n=>Array.isArray(n)])},object(){let e=(n,r,s,i)=>({...c(n,"object",r,void 0,s,void 0,i),shape(u){return e([...n,p=>{for(let[t,a]of Object.entries(u)){let o=p[t],d=a;if(d&&!d._validators.every(y=>y(o)))return false}return true}],r,s,i)},nonNull(){return e([...n,u=>u!=null],r,s,i)},hasKeys(...u){return e([...n,p=>u.every(t=>t in p)],r,s,i)},default(u){return e(n,u,s,i)},describe(u){return e(n,r,u,i)},meta(u){return e(n,r,s,u)}});return e([n=>typeof n=="object"&&n!==null&&!Array.isArray(n)])},enum(...e){process.env.NODE_ENV!=="production"&&e.length===0&&console.warn("[Directive] t.enum() called with no values - this will reject all strings");let n=new Set(e);return c([r=>typeof r=="string"&&n.has(r)],`enum(${e.join("|")})`)},literal(e){return c([n=>n===e],`literal(${String(e)})`)},nullable(e){let n=e._typeName??"unknown";return g([r=>r===null?true:e._validators.every(s=>s(r))],`${n} | null`)},optional(e){let n=e._typeName??"unknown";return g([r=>r===void 0?true:e._validators.every(s=>s(r))],`${n} | undefined`)},union(...e){process.env.NODE_ENV!=="production"&&e.length===0&&console.warn("[Directive] t.union() called with no types - this will reject all values");let n=e.map(r=>r._typeName??"unknown");return c([r=>e.some(s=>s._validators.every(i=>i(r)))],n.join(" | "))},record(e){let n=e._typeName??"unknown";return c([r=>typeof r!="object"||r===null||Array.isArray(r)?false:Object.values(r).every(s=>e._validators.every(i=>i(s)))],`Record<string, ${n}>`)},tuple(...e){process.env.NODE_ENV!=="production"&&e.length===0&&console.warn("[Directive] t.tuple() called with no types - this will only accept empty arrays");let n=e.map(r=>r._typeName??"unknown");return c([r=>!Array.isArray(r)||r.length!==e.length?false:e.every((s,i)=>s._validators.every(l=>l(r[i])))],`[${n.join(", ")}]`)},date(){return c([e=>e instanceof Date&&!Number.isNaN(e.getTime())],"Date")},uuid(){let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;return c([n=>typeof n=="string"&&e.test(n)],"uuid")},email(){let e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return c([n=>typeof n=="string"&&e.test(n)],"email")},url(){return c([e=>{if(typeof e!="string")return false;try{return new URL(e),!0}catch{return false}}],"url")},bigint(){return c([e=>typeof e=="bigint"],"bigint")},any(){return c([],"any")},unknown(){return c([],"unknown")}};function W(e){if(!e||typeof e!="string"){console.warn("[Directive] Module ID must be a non-empty string");return}/^(__[a-z][a-z0-9_-]*|[a-z][a-z0-9-]*)$/i.test(e)||console.warn(`[Directive] Module ID "${e}" should follow kebab-case convention (e.g., "my-module")`);}function f(e,n,r,s,i){for(let l of e)n.has(l)||console.warn(`[Directive] ${r} "${l}" not declared in ${s}`);for(let l of n)e.has(l)||console.warn(`[Directive] ${s}["${l}"] ${i}`);}function P(e,n){e.length===0&&console.warn("[Directive] history.snapshotEvents is an empty array \u2014 no events will create history snapshots. Omit history.snapshotEvents entirely to snapshot all events, or list specific events.");let r=new Set(Object.keys(n));for(let s of e)r.has(s)||console.warn(`[Directive] history.snapshotEvents entry "${s}" not declared in schema.events. Available events: ${[...r].join(", ")||"(none)"}`);}function F(e,n){let r=new Set(Object.keys(n));for(let[s,i]of Object.entries(e)){let l=i;typeof l.requirement=="string"&&!r.has(l.requirement)&&console.warn(`[Directive] Resolver "${s}" references unknown requirement type "${l.requirement}". Available types: ${[...r].join(", ")||"(none)"}`);}}function U(e,n){W(e),n.schema?n.schema.facts||console.warn("[Directive] Module schema.facts is required"):console.warn("[Directive] Module schema is required"),f(new Set(Object.keys(n.derive??{})),new Set(Object.keys(n.schema?.derivations??{})),"Derivation","schema.derivations","has no matching implementation in derive"),f(new Set(Object.keys(n.events??{})),new Set(Object.keys(n.schema?.events??{})),"Event","schema.events","has no matching handler in events"),n.history?.snapshotEvents&&P(n.history.snapshotEvents,n.schema?.events??{}),n.resolvers&&n.schema?.requirements&&F(n.resolvers,n.schema.requirements);}function M(e,n){process.env.NODE_ENV!=="production"&&U(e,n);let r="crossModuleDeps"in n?n.crossModuleDeps:void 0;return {id:e,schema:n.schema,init:n.init,derive:n.derive??{},events:n.events??{},effects:n.effects,constraints:n.constraints,resolvers:n.resolvers,hooks:n.hooks,meta:n.meta,history:n.history,crossModuleDeps:r}}function z(e){return n=>M(n,e)}function T(){let e={pending:new Map,inflight:new Map,failed:new Map,errors:new Map,listeners:new Set};function n(){for(let t of e.listeners)t();}function r(t,a){let o=t.get(a);return o||(o=new Set,t.set(a,o)),o}function s(t){let a=e.pending.get(t)??new Set,o=e.inflight.get(t)??new Set,d=e.failed.get(t)??new Set,y=e.errors.get(t)??null;return {pending:a.size,inflight:o.size,failed:d.size,isLoading:a.size>0||o.size>0,hasError:d.size>0,lastError:y}}function i(){let t=new Set([...e.pending.keys(),...e.inflight.keys(),...e.failed.keys()]),a=new Map;for(let o of t)a.set(o,s(o));return a}function l(t){return e.listeners.add(t),()=>e.listeners.delete(t)}function u(){e.pending.clear(),e.inflight.clear(),e.failed.clear(),e.errors.clear(),n();}return {plugin:{name:"requirement-status",onRequirementCreated(t){let a=t.requirement.type;r(e.pending,a).add(t.id),e.failed.get(a)?.delete(t.id),n();},onResolverStart(t,a){let o=a.requirement.type;e.pending.get(o)?.delete(a.id),r(e.inflight,o).add(a.id),n();},onResolverComplete(t,a){let o=a.requirement.type;e.inflight.get(o)?.delete(a.id),e.pending.get(o)?.delete(a.id),n();},onResolverError(t,a,o){let d=a.requirement.type;e.inflight.get(d)?.delete(a.id),r(e.failed,d).add(a.id),e.errors.set(d,o instanceof Error?o:new Error(String(o))),n();},onResolverCancel(t,a){let o=a.requirement.type;e.pending.get(o)?.delete(a.id),e.inflight.get(o)?.delete(a.id),n();},onRequirementMet(t){let a=t.requirement.type;e.pending.get(a)?.delete(t.id),e.inflight.get(a)?.delete(t.id),n();}},getStatus:s,getAllStatus:i,subscribe:l,reset:u}}function L(e){return n=>e.getStatus(n)}function H(e){let n=T(),s=[...e.plugins??[],n.plugin];return {system:a({module:e.module,plugins:s,trace:e.trace,errorBoundary:e.errorBoundary,tickMs:e.tickMs,zeroConfig:e.zeroConfig,initialFacts:e.initialFacts}),statusPlugin:n}}var Z={None:"none",Linear:"linear",Exponential:"exponential"};export{Z as Backoff,M as createModule,z as createModuleFactory,T as createRequirementStatusPlugin,L as createStatusHook,H as createSystemWithStatus,$ as t};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|