@doeixd/machine 0.0.7 → 0.0.9
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/README.md +130 -272
- package/dist/cjs/development/index.js +1121 -18
- package/dist/cjs/development/index.js.map +4 -4
- package/dist/cjs/production/index.js +5 -5
- package/dist/esm/development/index.js +1121 -18
- package/dist/esm/development/index.js.map +4 -4
- package/dist/esm/production/index.js +5 -5
- package/dist/types/extract.d.ts.map +1 -1
- package/dist/types/index.d.ts +64 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/middleware.d.ts +1048 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/primitives.d.ts +205 -3
- package/dist/types/primitives.d.ts.map +1 -1
- package/dist/types/runtime-extract.d.ts.map +1 -1
- package/dist/types/utils.d.ts +111 -6
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +10 -7
- package/scripts/extract-statechart.ts +351 -0
- package/src/adapters.ts +407 -0
- package/src/extract.ts +60 -20
- package/src/index.ts +201 -8
- package/src/middleware.ts +2325 -0
- package/src/primitives.ts +454 -3
- package/src/runtime-extract.ts +15 -0
- package/src/utils.ts +221 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
🔍 Analyzing machine: ${e.id}`),console.error(` Source: ${e.input}`));let
|
|
3
|
-
📊 Starting statechart extraction`),console.error(` Machines to extract: ${e.machines.length}`));let n=new
|
|
4
|
-
✅ Extraction complete: ${
|
|
5
|
-
`);let t=new O;t.addSourceFilesAtPaths("src/**/*.ts"),t.addSourceFilesAtPaths("examples/**/*.ts");try{let n=S(e,t,!0);console.log(JSON.stringify(n,null,2))}catch(n){console.error("❌ Error:",n),process.exit(1)}}N.main===module&&D();function $(e){return typeof e!="function"?null:e[h]||null}function A(e){let t={on:{}},n=[];for(let i in e){let r=e[i];if(typeof r!="function")continue;let o=$(r);if(o&&(o.invoke&&n.push({src:o.invoke.src,onDone:{target:o.invoke.onDone},onError:{target:o.invoke.onError},description:o.invoke.description}),o.target)){let a={target:o.target};o.description&&(a.description=o.description),o.guards&&o.guards.length>0&&(a.cond=o.guards.map(s=>s.name).join(" && ")),o.actions&&o.actions.length>0&&(a.actions=o.actions.map(s=>s.name)),t.on[i]=a}}return n.length>0&&(t.invoke=n),t}function oe(e,t){let n={id:t.id,initial:t.initial,states:{}};t.description&&(n.description=t.description);for(let[i,r]of Object.entries(e))n.states[i]=A(r);return n}function ae(e,t){let n=t.stateName||e.constructor.name||"State";return{id:t.id,initial:n,states:{[n]:A(e)}}}function se(e,t){let n=e,i=s=>{n=s,t==null||t(s)},{context:r,...o}=e,a=new Proxy({},{get(s,c){let u=n[c];if(typeof u=="function")return(...x)=>{let y=u.apply(n.context,x),d=Object.assign({context:y.context},o);return i(d),d}}});return{get state(){return n},get context(){return n.context},actions:a,setState:i}}function be(e,t,n){let i=()=>{let o=e.getContext(),a=n(o),s=t[a];if(!s)throw new Error(`[Ensemble] Invalid state: No factory found for state "${String(a)}".`);return s(o)},r=new Proxy({},{get(o,a){let s=i(),c=s[a];if(typeof c!="function")throw new Error(`[Ensemble] Transition "${a}" is not valid in the current state.`);return(...u)=>c.apply(s.context,u)}});return{get context(){return e.getContext()},get state(){return i()},actions:r}}function Se(e,t){let n=se(t),i=e(n),r=i.next();for(;!r.done;)r=i.next();return r.value}function Ae(e,t){let n=e(t),i=n.next();for(;!i.done;)i=n.next();return i.value}var L=class{constructor(t){this.store=t}get context(){return this.store.getContext()}setContext(t){this.store.setContext(t)}};function we(e,t){let n=new e(t);return new Proxy({},{get(i,r){let o=t.getContext();if(r in o)return o[r];let a=n[r];if(typeof a=="function")return(...s)=>a.apply(n,s)},set(i,r,o){let a=t.getContext();if(r in a){let s={...a,[r]:o};return t.setContext(s),!0}return!1},has(i,r){let o=t.getContext();return r in o||typeof n[r]=="function"},ownKeys(i){let r=t.getContext(),o=Object.keys(r),a=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(s=>s!=="constructor"&&typeof n[s]=="function");return Array.from(new Set([...o,...a]))},getOwnPropertyDescriptor(i,r){let o=t.getContext();if(r in o||typeof n[r]=="function")return{value:void 0,writable:!0,enumerable:!0,configurable:!0}}})}function ke(e,t,n){let i=()=>{let r=n(e),o=t[r];if(!o)throw new Error(`[MutableMachine] Invalid state: No factory for state "${String(r)}".`);return o(e)};return new Proxy(e,{get(r,o,a){if(o in r)return r[o];let s=i(),c=s[o];if(typeof c=="function")return(...u)=>{let x=c.apply(s.context,u);if(typeof x!="object"||x===null){console.warn(`[MutableMachine] Transition "${String(o)}" did not return a valid context object. State may be inconsistent.`);return}Object.keys(r).forEach(y=>delete r[y]),Object.assign(r,x)}},set(r,o,a,s){return r[o]=a,!0},has(r,o){let a=i();return o in r||typeof a[o]=="function"}})}function je(e){return function(...t){let n=this.context.child;if(typeof n[e]=="function"){let i=n[e](...t);return C(this,{...this.context,child:i})}return this}}function Oe(e){return function(){return typeof this.context[e]!="boolean"&&console.warn(`[toggle primitive] Property '${String(e)}' is not a boolean. Toggling may have unexpected results.`),C(this,{...this.context,[e]:!this.context[e]})}}var w=class extends M{constructor(n){super({status:"idle"});this.config=n;this.fetch=n=>new f(this.config,n!=null?n:this.config.initialParams,1)}},f=class extends M{constructor(n,i,r){super({status:"loading",abortController:new AbortController,attempts:r});this.config=n;this.params=i;this.succeed=n=>{var i,r;return(r=(i=this.config).onSuccess)==null||r.call(i,n),new F(this.config,{status:"success",data:n})};this.fail=n=>{var r,o,a;let i=(r=this.config.maxRetries)!=null?r:3;return this.context.attempts<i?new k(this.config,this.params,n,this.context.attempts):((a=(o=this.config).onError)==null||a.call(o,n),new P(this.config,{status:"error",error:n}))};this.cancel=()=>(this.context.abortController.abort(),new R(this.config));this.execute()}async execute(){}},k=class extends M{constructor(n,i,r,o){super({status:"retrying",error:r,attempts:o});this.config=n;this.params=i;this.retry=n=>new f(this.config,n!=null?n:this.params,this.context.attempts+1)}},F=class extends M{constructor(n,i){super(i);this.config=n;this.refetch=n=>new f(this.config,n!=null?n:this.config.initialParams,1)}},P=class extends M{constructor(n,i){super(i);this.config=n;this.retry=n=>new f(this.config,n!=null?n:this.config.initialParams,1)}},R=class extends M{constructor(n){super({status:"canceled"});this.config=n;this.refetch=n=>new f(this.config,n!=null?n:this.config.initialParams,1)}};function Ke(e){return new w(e)}function I(e,t){let n={...e.context,...t.context},i={...e},r={...t};delete i.context,delete r.context;let o={};for(let a in i){let s=i[a];o[a]=(...c)=>{let u=s.apply(e.context,c);return I(u,t)}}for(let a in r){let s=r[a];o[a]=(...c)=>{let u=s.apply(t.context,c);return I(e,u)}}return{context:n,...o}}function ce(e,t){return e instanceof t}function le(e,...t){return{type:e,args:t}}function ue(e,t){return C(e,n=>({...n,...t}))}async function xe(e,...t){let n=e;for(let i of t)n=await i(n);return n}function ye(e,t){return t?console.log(t,e.context):console.log(e.context),e}function de(e,t,...n){return e.apply(t,n)}function _(e){return new Proxy(e,{get(t,n){let i=t[n];return typeof i=="function"?function(...r){let o=i.apply(t.context,r);return o&&typeof o=="object"&&"context"in o?_(o):o}:i}})}var v=class e{constructor(t){return this.wrappedMachine=t,new Proxy(this,{get:(n,i)=>{if(i==="wrappedMachine"||i==="context")return Reflect.get(n,i);let r=this.wrappedMachine[i];return typeof r=="function"?(...o)=>{let a=r.apply(this.wrappedMachine.context,o);return a&&typeof a=="object"&&"context"in a?new e(a):a}:r}})}get context(){return this.wrappedMachine.context}};function g(e,t){return Object.assign({context:e},t)}function Ue(e,t){return Object.assign({context:e},t)}function qe(){return e=>{let t=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,function(...r){let o=i(this,...r);return g(o,t)}]));return n=>g(n,t)}}function C(e,t){let{context:n,...i}=e,r=typeof t=="function"?t(n):t;return g(r,i)}function Je(e,t){let{context:n,...i}=e,r={...i,...t};return g(n,r)}function Ye(e,t){let{context:n,...i}=e,r={...i,...t};return g(n,r)}function Xe(e){let{context:t,...n}=e;return i=>g(i,n)}function He(e,t,n){let i=e.context[t],r=n[i];if(!r)throw new Error(`No handler found for state: ${String(i)}`);return r(e.context)}function Qe(e,t,n){return e.context[t]===n}function Ze(e,t){let n=e;async function i(r){let o=n[r.type];if(typeof o!="function")throw new Error(`[Machine] Unknown event type '${String(r.type)}' on current state.`);return n=await o.apply(n.context,r.args),t==null||t(n),n}return{get state(){return n.context},dispatch:i}}var M=class{constructor(t){this.context=t}};function et(e,t){let{context:n,...i}=e;return g(t(n),i)}export{v as BoundMachine,J as META_KEY,M as MachineBase,L as MultiMachineBase,h as RUNTIME_META,Z as action,_ as bindTransitions,de as call,Ue as createAsyncMachine,be as createEnsemble,le as createEvent,Ke as createFetchMachine,V as createFlow,g as createMachine,Xe as createMachineBuilder,qe as createMachineFactory,we as createMultiMachine,ke as createMutableMachine,I as createParallelMachine,se as createRunner,je as delegateToChild,X as describe,Ye as extendTransitions,ae as extractFromInstance,$ as extractFunctionMetadata,S as extractMachine,ie as extractMachines,A as extractStateNode,D as generateChart,oe as generateStatechart,H as guarded,Qe as hasState,Q as invoke,ce as isState,ye as logState,He as matchMachine,ue as mergeContext,ee as metadata,et as next,Je as overrideTransitions,xe as pipeTransitions,j as run,U as runAsync,Ze as runMachine,B as runSequence,z as runWithDebug,Ae as runWithEnsemble,Se as runWithRunner,C as setContext,W as step,q as stepAsync,Oe as toggle,Y as transitionTo,G as yieldMachine};
|
|
1
|
+
var Q=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});function Z(e,t){let n=e(t),r=t;for(;;){let{value:o,done:i}=n.next(r);if(i)return o;r=o}}function Me(e){return function*(){return yield e}()}function xe(e){return e}function he(e,t){return t.reduce((n,r)=>Z(r,n),e)}function pe(e){return e}function ge(e,t,n=(r,o)=>{console.log(`Step ${r}:`,o.context)}){let r=e(t),o=t,i=0;for(n(i,o);;){let{value:a,done:s}=r.next(o);if(s)return console.log("Final:",a),a;o=a,i++,n(i,o)}}async function Ce(e,t){let n=e(t),r=t;for(;;){let{value:o,done:i}=await n.next(r);if(i)return o;r=o}}async function*me(e){return yield e}var we=Symbol("MachineMeta"),j=Symbol("__machine_runtime_meta__");function S(e,t){let n=e[j]||{},r={...n,...t};t.guards&&n.guards?r.guards=[...t.guards,...n.guards]:t.guards&&(r.guards=[...t.guards]),t.actions&&n.actions?r.actions=[...t.actions,...n.actions]:t.actions&&(r.actions=[...t.actions]),Object.defineProperty(e,j,{value:r,enumerable:!1,writable:!1,configurable:!0})}function be(e,t){return S(t,{target:e.name||e.toString()}),t}function Te(e,t){return S(t,{description:e}),t}function Ee(e,t){return S(t,{guards:[e]}),t}function Se(e,t){return S(t,{invoke:{src:e.src,onDone:e.onDone.name||e.onDone.toString(),onError:e.onError.name||e.onError.toString(),description:e.description}}),t}function Fe(e,t){return S(t,{actions:[e]}),t}function _(e,t,n={}){let{onFail:r="throw",errorMessage:o,description:i}=n,a={...n,onFail:r,errorMessage:o,description:i},s=function(...c){let l=typeof this=="object"&&"context"in this,u=l?this.context:this;if(e(u,...c)){let y=l?this.context:this;return t.apply(y,c)}else if(r==="throw"){let y=o||"Guard condition failed";throw new Error(y)}else if(r==="ignore"){if(l)return this;throw new Error('Cannot use "ignore" mode with context-only binding. Use full machine binding or provide fallback.')}else if(typeof r=="function"){if(l)return r.apply(this,c);throw new Error("Cannot use function fallback with context-only binding. Use full machine binding.")}else return r};return Object.defineProperty(s,"__guard",{value:!0,enumerable:!1}),Object.defineProperty(s,"condition",{value:e,enumerable:!1}),Object.defineProperty(s,"transition",{value:t,enumerable:!1}),Object.defineProperty(s,"options",{value:a,enumerable:!1}),S(s,{description:i||"Synchronous guarded transition",guards:[{name:"runtime_guard",description:i||"Synchronous condition check"}]}),s}function D(e,t,n={}){let{onFail:r="throw",errorMessage:o,description:i}=n,a={...n,onFail:r,errorMessage:o,description:i},s=async function(...c){let l=typeof this=="object"&&"context"in this,u=l?this.context:this;if(await Promise.resolve(e(u,...c))){let y=l?this.context:this;return t.apply(y,c)}else if(r==="throw"){let y=o||"Guard condition failed";throw new Error(y)}else if(r==="ignore"){if(l)return this;throw new Error('Cannot use "ignore" mode with context-only binding. Use full machine binding or provide fallback.')}else if(typeof r=="function"){if(l)return r.apply(this,c);throw new Error("Cannot use function fallback with context-only binding. Use full machine binding.")}else return r};return Object.defineProperty(s,"__guard",{value:!0,enumerable:!1}),Object.defineProperty(s,"condition",{value:e,enumerable:!1}),Object.defineProperty(s,"transition",{value:t,enumerable:!1}),Object.defineProperty(s,"options",{value:a,enumerable:!1}),S(s,{description:i||"Runtime guarded transition",guards:[{name:"runtime_guard",description:i||"Runtime condition check"}]}),s}function Pe(e){return{do(t){let n=_(e,t);return n.else=function(r){return _(e,t,{onFail:r})},n}}}function Re(e){return{do(t){let n=D(e,t);return n.else=function(r){return D(e,t,{onFail:r})},n}}}function ve(e,t){return t}import{Project as ee,Node as g}from"ts-morph";function te(e){return g.isIdentifier(e)?e.getText():g.isTypeOfExpression(e)?e.getExpression().getText():"unknown"}function v(e){if(!g.isObjectLiteralExpression(e))return{};let t={};for(let n of e.getProperties())if(g.isPropertyAssignment(n)){let r=n.getName(),o=n.getInitializer();o&&(g.isStringLiteral(o)||g.isNumericLiteral(o)?t[r]=o.getLiteralValue():o.getText()==="true"||o.getText()==="false"?t[r]=o.getText()==="true":g.isIdentifier(o)?t[r]=o.getText():g.isObjectLiteralExpression(o)?t[r]=v(o):g.isArrayLiteralExpression(o)&&(t[r]=o.getElements().map(i=>g.isObjectLiteralExpression(i)?v(i):i.getText())))}return t}function Ae(e){if(!g.isObjectLiteralExpression(e))return{};let t={};for(let n of e.getProperties())if(g.isPropertyAssignment(n)){let r=n.getName(),o=n.getInitializer();if(!o)continue;r==="onDone"||r==="onError"?t[r]=te(o):g.isStringLiteral(o)?t[r]=o.getLiteralValue():g.isIdentifier(o)&&(t[r]=o.getText())}return t}function R(e,t=!1){if(!g.isCallExpression(e))return null;let n=e.getExpression(),r=g.isIdentifier(n)?n.getText():null;if(!r)return null;let o={},i=e.getArguments();switch(r){case"transitionTo":i[0]&&(o.target=te(i[0]));break;case"describe":if(i[0]&&g.isStringLiteral(i[0])&&(o.description=i[0].getLiteralValue()),i[1]&&g.isCallExpression(i[1])){let a=R(i[1],t);a&&Object.assign(o,a)}break;case"guarded":if(i[0]){let a=v(i[0]);Object.keys(a).length>0&&(o.guards=[a])}if(i[1]&&g.isCallExpression(i[1])){let a=R(i[1],t);a&&Object.assign(o,a)}break;case"invoke":if(i[0]){let a=Ae(i[0]);Object.keys(a).length>0&&(o.invoke=a)}break;case"action":if(i[0]){let a=v(i[0]);Object.keys(a).length>0&&(o.actions=[a])}if(i[1]&&g.isCallExpression(i[1])){let a=R(i[1],t);a&&Object.assign(o,a)}break;case"guard":if(i[2]){let a=v(i[2]);a.description&&(o.description=a.description)}if(o.guards=[{name:"runtime_guard",description:o.description||"Synchronous condition check"}],i[1]&&g.isCallExpression(i[1])){let a=R(i[1],t);a&&Object.assign(o,a)}break;case"guardAsync":if(i[2]){let a=v(i[2]);a.description&&(o.description=a.description)}if(o.guards=[{name:"runtime_guard_async",description:o.description||"Asynchronous condition check"}],i[1]&&g.isCallExpression(i[1])){let a=R(i[1],t);a&&Object.assign(o,a)}break;default:return null}return Object.keys(o).length>0?o:null}function Oe(e,t=!1){if(!g.isPropertyDeclaration(e))return t&&console.error(" ⚠️ Not a property declaration"),null;let n=e.getInitializer();if(!n)return t&&console.error(" ⚠️ No initializer"),null;if(!g.isCallExpression(n))return t&&console.error(" ⚠️ Initializer is not a call expression"),null;let r=R(n,t);return r&&t&&console.error(" ✅ Extracted metadata:",JSON.stringify(r,null,2)),r}function K(e,t=!1){let n={on:{}},r=e.getDeclarations()[0];if(!r||!g.isClassDeclaration(r))return t&&console.error(`⚠️ Warning: Could not get class declaration for ${e.getName()}`),n;let o=e.getName();t&&console.error(` Analyzing state: ${o}`);for(let i of r.getInstanceMembers()){let a=i.getName();t&&console.error(` Checking member: ${a}`);let s=Oe(i,t);if(!s)continue;t&&console.error(` Found transition: ${a}`);let{invoke:c,actions:l,guards:u,...M}=s;if(c&&(n.invoke||(n.invoke=[]),n.invoke.push({src:c.src,onDone:{target:c.onDone},onError:{target:c.onError},description:c.description}),t&&console.error(` → Invoke: ${c.src}`)),M.target){let y={target:M.target};M.description&&(y.description=M.description),u&&(y.cond=u.map(x=>x.name).join(" && "),t&&console.error(` → Guard: ${y.cond}`)),l&&l.length>0&&(y.actions=l.map(x=>x.name),t&&console.error(` → Actions: ${y.actions.join(", ")}`)),n.on[a]=y,t&&console.error(` → Target: ${M.target}`)}}return n}function je(e,t,n,r,o=!1){let i=K(t,o);if(r){o&&console.error(` 👪 Analyzing children for state: ${e}`),i.initial=r.initialState,i.states={};for(let a of r.classes){let s=n.getClass(a);if(s){let c=s.getSymbolOrThrow();i.states[a]=K(c,o)}else console.warn(`⚠️ Warning: Child class '${a}' not found.`)}}return i}function W(e,t,n=!1){n&&(console.error(`
|
|
2
|
+
🔍 Analyzing machine: ${e.id}`),console.error(` Source: ${e.input}`));let r=t.getSourceFile(e.input);if(!r)throw new Error(`Source file not found: ${e.input}`);if(e.parallel){n&&console.error(" ⏹️ Parallel machine detected. Analyzing regions.");let i={id:e.id,type:"parallel",states:{}};e.description&&(i.description=e.description);for(let a of e.parallel.regions){n&&console.error(` 📍 Analyzing region: ${a.name}`);let s={};for(let c of a.classes){let l=r.getClass(c);if(l){let u=l.getSymbolOrThrow();s[c]=K(u,n)}else console.warn(`⚠️ Warning: Class '${c}' not found for region '${a.name}'.`)}i.states[a.name]={initial:a.initialState,states:s}}return n&&console.error(` ✅ Extracted ${e.parallel.regions.length} parallel regions`),i}if(!e.initialState||!e.classes)throw new Error(`Machine config for '${e.id}' must have either 'parallel' or 'initialState'/'classes'.`);let o={id:e.id,initial:e.initialState,states:{}};e.description&&(o.description=e.description);for(let i of e.classes){let a=r.getClass(i);if(!a){console.warn(`⚠️ Warning: Class '${i}' not found in '${e.input}'. Skipping.`);continue}let s=a.getSymbolOrThrow(),c=i===e.initialState&&e.children,l=je(i,s,r,c?e.children:void 0,n);o.states[i]=l}return n&&console.error(` ✅ Extracted ${e.classes.length} states`),o}function ke(e){var o;let t=(o=e.verbose)!=null?o:!1;t&&(console.error(`
|
|
3
|
+
📊 Starting statechart extraction`),console.error(` Machines to extract: ${e.machines.length}`));let n=new ee;n.addSourceFilesAtPaths("src/**/*.ts"),n.addSourceFilesAtPaths("examples/**/*.ts");let r=[];for(let i of e.machines)try{let a=W(i,n,t);r.push(a)}catch(a){console.error(`❌ Error extracting machine '${i.id}':`,a),t||console.error(" Run with --verbose for more details")}return t&&console.error(`
|
|
4
|
+
✅ Extraction complete: ${r.length}/${e.machines.length} machines extracted`),r}function ne(){let e={input:"examples/authMachine.ts",classes:["LoggedOutMachine","LoggingInMachine","LoggedInMachine","SessionExpiredMachine","ErrorMachine"],id:"auth",initialState:"LoggedOutMachine",description:"Authentication state machine"};console.error("🔍 Using legacy generateChart function"),console.error(`⚠️ Consider using extractMachines() with a config file instead
|
|
5
|
+
`);let t=new ee;t.addSourceFilesAtPaths("src/**/*.ts"),t.addSourceFilesAtPaths("examples/**/*.ts");try{let n=W(e,t,!0);console.log(JSON.stringify(n,null,2))}catch(n){console.error("❌ Error:",n),process.exit(1)}}var ft={hierarchical:{input:"examples/dashboardMachine.ts",id:"dashboard",classes:["DashboardMachine","LoggedOutMachine"],initialState:"DashboardMachine",children:{contextProperty:"child",initialState:"ViewingChildMachine",classes:["ViewingChildMachine","EditingChildMachine"]}},parallel:{input:"examples/editorMachine.ts",id:"editor",parallel:{regions:[{name:"fontWeight",initialState:"NormalWeight",classes:["NormalWeight","BoldWeight"]},{name:"textDecoration",initialState:"NoDecoration",classes:["NoDecoration","UnderlineState"]}]}}};Q.main===module&&ne();function re(e){return typeof e!="function"?null:e[j]||null}function G(e){let t={on:{}},n=[];for(let r in e){let o=e[r];if(typeof o!="function")continue;let i=re(o);if(i){if(i.invoke&&n.push({src:i.invoke.src,onDone:{target:i.invoke.onDone},onError:{target:i.invoke.onError},description:i.invoke.description}),i.target){let a={target:i.target};i.description&&(a.description=i.description),i.guards&&i.guards.length>0&&(a.cond=i.guards.map(s=>s.name).join(" && ")),i.actions&&i.actions.length>0&&(a.actions=i.actions.map(s=>s.name)),t.on[r]=a}else if(i.guards&&i.guards.length>0){let a={target:"GuardedTransition",cond:i.guards.map(s=>s.name).join(" && ")};i.description&&(a.description=i.description),t.on[r]=a}}}return n.length>0&&(t.invoke=n),t}function Ne(e,t){let n={id:t.id,initial:t.initial,states:{}};t.description&&(n.description=t.description);for(let[r,o]of Object.entries(e))n.states[r]=G(o);return n}function ze(e,t){let n=t.stateName||e.constructor.name||"State";return{id:t.id,initial:n,states:{[n]:G(e)}}}function Be(e,t){let n=e,r=s=>{n=s,t==null||t(s)},{context:o,...i}=e,a=new Proxy({},{get(s,c){let l=n[c];if(typeof l=="function")return(...u)=>{let M=l.apply(n.context,u),y=Object.assign({context:M.context},i);return r(y),y}}});return{get state(){return n},get context(){return n.context},actions:a,setState:r}}function gt(e,t,n){let r=()=>{let i=e.getContext(),a=n(i),s=t[a];if(!s)throw new Error(`[Ensemble] Invalid state: No factory found for state "${String(a)}".`);return s(i)},o=new Proxy({},{get(i,a){let s=r(),c=s[a];if(typeof c!="function")throw new Error(`[Ensemble] Transition "${a}" is not valid in the current state.`);return(...l)=>c.apply(s.context,l)}});return{get context(){return e.getContext()},get state(){return r()},actions:o}}function Ct(e,t){let n=Be(t),r=e(n),o=r.next();for(;!o.done;)o=r.next();return o.value}function mt(e,t){let n=e(t),r=n.next();for(;!r.done;)r=n.next();return r.value}var oe=class{constructor(t){this.store=t}get context(){return this.store.getContext()}setContext(t){this.store.setContext(t)}};function wt(e,t){let n=new e(t);return new Proxy({},{get(r,o){let i=t.getContext();if(o in i)return i[o];let a=n[o];if(typeof a=="function")return(...s)=>a.apply(n,s)},set(r,o,i){let a=t.getContext();if(o in a){let s={...a,[o]:i};return t.setContext(s),!0}return!1},has(r,o){let i=t.getContext();return o in i||typeof n[o]=="function"},ownKeys(r){let o=t.getContext(),i=Object.keys(o),a=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(s=>s!=="constructor"&&typeof n[s]=="function");return Array.from(new Set([...i,...a]))},getOwnPropertyDescriptor(r,o){let i=t.getContext();if(o in i||typeof n[o]=="function")return{value:void 0,writable:!0,enumerable:!0,configurable:!0}}})}function bt(e,t,n){let r=()=>{let o=n(e),i=t[o];if(!i)throw new Error(`[MutableMachine] Invalid state: No factory for state "${String(o)}".`);return i(e)};return new Proxy(e,{get(o,i,a){if(i in o)return o[i];let s=r(),c=s[i];if(typeof c=="function")return(...l)=>{let u=c.apply(s.context,l);if(typeof u!="object"||u===null){console.warn(`[MutableMachine] Transition "${String(i)}" did not return a valid context object. State may be inconsistent.`);return}Object.keys(o).forEach(M=>delete o[M]),Object.assign(o,u)}},set(o,i,a,s){return o[i]=a,!0},has(o,i){let a=r();return i in o||typeof a[i]=="function"}})}function Rt(e){return function(...t){let n=this.context.child;if(typeof n[e]=="function"){let r=n[e](...t);return k(this,{...this.context,child:r})}return this}}function vt(e){return function(){return typeof this.context[e]!="boolean"&&console.warn(`[toggle primitive] Property '${String(e)}' is not a boolean. Toggling may have unexpected results.`),k(this,{...this.context,[e]:!this.context[e]})}}var H=class extends T{constructor(n){super({status:"idle"});this.config=n;this.fetch=n=>new F(this.config,n!=null?n:this.config.initialParams,1)}},F=class extends T{constructor(n,r,o){super({status:"loading",abortController:new AbortController,attempts:o});this.config=n;this.params=r;this.succeed=n=>{var r,o;return(o=(r=this.config).onSuccess)==null||o.call(r,n),new L(this.config,{status:"success",data:n})};this.fail=n=>{var o,i,a;let r=(o=this.config.maxRetries)!=null?o:3;return this.context.attempts<r?new I(this.config,this.params,n,this.context.attempts):((a=(i=this.config).onError)==null||a.call(i,n),new V(this.config,{status:"error",error:n}))};this.cancel=()=>(this.context.abortController.abort(),new U(this.config));this.execute()}async execute(){}},I=class extends T{constructor(n,r,o,i){super({status:"retrying",error:o,attempts:i});this.config=n;this.params=r;this.retry=n=>new F(this.config,n!=null?n:this.params,this.context.attempts+1)}},L=class extends T{constructor(n,r){super(r);this.config=n;this.refetch=n=>new F(this.config,n!=null?n:this.config.initialParams,1)}},V=class extends T{constructor(n,r){super(r);this.config=n;this.retry=n=>new F(this.config,n!=null?n:this.config.initialParams,1)}},U=class extends T{constructor(n){super({status:"canceled"});this.config=n;this.refetch=n=>new F(this.config,n!=null?n:this.config.initialParams,1)}};function At(e){return new H(e)}function ie(e,t){let n={...e.context,...t.context},r={...e},o={...t};delete r.context,delete o.context;let i={};for(let a in r){let s=r[a];i[a]=(...c)=>{let l=s.apply(e.context,c);return ie(l,t)}}for(let a in o){let s=o[a];i[a]=(...c)=>{let l=s.apply(t.context,c);return ie(e,l)}}return{context:n,...i}}var ae=Symbol("CANCEL");function w(e,t,n={}){let{mode:r="auto",exclude:o=["context"]}=n,i={};for(let a in e){if(!Object.prototype.hasOwnProperty.call(e,a))continue;let s=e[a];if(a==="context"){i.context=s;continue}if(o.includes(a)){i[a]=s;continue}if(typeof s!="function"||a.startsWith("_")){i[a]=s;continue}i[a]=$e(a,s,e,t,r)}return i}function $e(e,t,n,r,o){return function(...a){let s=n.context,c={transitionName:e,context:s,args:a},l=()=>{try{if(r.before){let x=r.before(c);if(x===ae)return n;if(x instanceof Promise)throw new Error(`Middleware mode is 'sync' but before hook returned Promise for transition: ${e}`)}let y=t.call(this,...a);if(y instanceof Promise)return u(y,s);if(r.after){let x={transitionName:e,prevContext:s,nextContext:y.context,args:a};if(r.after(x)instanceof Promise)throw new Error(`Middleware mode is 'sync' but after hook returned Promise for transition: ${e}`)}return y}catch(y){if(r.error){let x={transitionName:e,context:s,args:a,error:y},d=r.error(x);if(d instanceof Promise)throw d.catch(()=>{}),y;if(d&&typeof d=="object"&&"context"in d)return d}throw y}},u=async(y,x)=>{try{let d=await y;if(r.after){let p={transitionName:e,prevContext:x,nextContext:d.context,args:a};await r.after(p)}return d}catch(d){if(r.error){let p={transitionName:e,context:x,args:a,error:d},f=await r.error(p);if(f&&typeof f=="object"&&"context"in f)return f}throw d}},M=async()=>{try{if(r.before&&await r.before(c)===ae)return n;let y=await t.call(this,...a);if(r.after){let x={transitionName:e,prevContext:s,nextContext:y.context,args:a};await r.after(x)}return y}catch(y){if(r.error){let x={transitionName:e,context:s,args:a,error:y},d=await r.error(x);if(d&&typeof d=="object"&&"context"in d)return d}throw y}};return o==="async"?M():l()}}function _e(e,t={}){let{logger:n=console.log,includeContext:r=!0,includeArgs:o=!0}=t;return w(e,{before:({transitionName:i,args:a})=>{let s=o&&a.length>0?` ${JSON.stringify(a)}`:"";n(`→ ${i}${s}`)},after:({transitionName:i,nextContext:a})=>{let s=r?` ${JSON.stringify(a)}`:"";n(`✓ ${i}${s}`)}})}function De(e,t,n={}){let{eventPrefix:r="state_transition",includePrevContext:o=!1,includeArgs:i=!0}=n;return w(e,{after:async({transitionName:a,prevContext:s,nextContext:c,args:l})=>{let u={transition:a,to:c};o&&(u.from=s),i&&l.length>0&&(u.args=l),await t(`${r}.${a}`,u)}},{mode:"async"})}function Ke(e,t,n){return w(e,{before:r=>{let o=t(r);if(o instanceof Promise)return o.then(i=>{if(i===!1)throw new Error(`Validation failed for transition: ${r.transitionName}`)});if(o===!1)throw new Error(`Validation failed for transition: ${r.transitionName}`)}},{mode:"auto",...n})}function We(e,t,n){return w(e,{before:r=>{let o=t(r);if(o instanceof Promise)return o.then(i=>{if(!i)throw new Error(`Unauthorized transition: ${r.transitionName}`)});if(!o)throw new Error(`Unauthorized transition: ${r.transitionName}`)}},{mode:"auto",...n})}function Ge(e,t,n={}){let{includeContext:r=!0,includeArgs:o=!0,mode:i}=n;return w(e,{error:async({transitionName:a,context:s,args:c,error:l})=>{let u={transition:a};r&&(u.context=s),o&&c.length>0&&(u.args=c),await Promise.resolve(t(l,u))}},{mode:i})}function He(e,t){let n=new Map;return w(e,{before:({transitionName:r})=>{n.set(r,performance.now())},after:({transitionName:r,nextContext:o})=>{let i=n.get(r);if(i){let a=performance.now()-i;n.delete(r);let s=t({transitionName:r,duration:a,context:o});if(s instanceof Promise)return s}}},{mode:"auto"})}function Ie(e,t={}){let{maxRetries:n=3,delay:r=1e3,backoffMultiplier:o=1,shouldRetry:i=()=>!0,onRetry:a}=t,s={};for(let c in e){if(!Object.prototype.hasOwnProperty.call(e,c))continue;let l=e[c];if(c==="context"||typeof l!="function"){s[c]=l;continue}s[c]=async function(...M){let y;for(let x=0;x<=n;x++)try{return await l.call(this,...M)}catch(d){if(y=d,x===n||!i(y))break;a==null||a(x+1,y);let p=r*Math.pow(o,x);await new Promise(f=>setTimeout(f,p))}throw y}}return s}function se(e,t={}){let{maxSize:n,serializer:r,filter:o,onEntry:i,_isRewrap:a=!1}=t,s=[],c=0,l=w(e,{before:({transitionName:u,args:M})=>{if(o&&!o(u,M))return;let y={id:`entry-${c++}`,transitionName:u,args:[...M],timestamp:Date.now()};if(r)try{y.serializedArgs=r.serialize(M)}catch(x){console.error("Failed to serialize history args:",x)}s.push(y),n&&s.length>n&&s.shift(),i==null||i(y)}},{exclude:["context","history","clearHistory"]});if(!a)for(let u in l){if(!Object.prototype.hasOwnProperty.call(l,u))continue;let M=l[u];if(typeof M=="function"&&!u.startsWith("_")&&u!=="context"&&!["history","clearHistory"].includes(u)){let y=M;l[u]=function(...x){let d=y.apply(this,x);if(d&&typeof d=="object"&&"context"in d&&!("history"in d)){let p=w(d,{before:({transitionName:f,args:C})=>{if(o&&!o(f,C))return;let h={id:`entry-${c++}`,transitionName:f,args:[...C],timestamp:Date.now()};if(r)try{h.serializedArgs=r.serialize(C)}catch(b){console.error("Failed to serialize history args:",b)}s.push(h),n&&s.length>n&&s.shift(),i==null||i(h)}},{exclude:["context","history","clearHistory"]});return Object.assign(p,{history:s,clearHistory:()=>{s.length=0,c=0}})}return d}}}return Object.assign(l,{history:s,clearHistory:()=>{s.length=0,c=0}})}function ce(e,t={}){let{maxSize:n,serializer:r,captureSnapshot:o,onlyIfChanged:i=!1,filter:a,onSnapshot:s,_extraExclusions:c=[],_isRewrap:l=!1}=t,u=[],M=0,y=w(e,{after:({transitionName:d,prevContext:p,nextContext:f})=>{if(a&&!a(d)||i&&!(JSON.stringify(p)!==JSON.stringify(f)))return;let C={id:`snapshot-${M++}`,transitionName:d,before:{...p},after:{...f},timestamp:Date.now()};if(r)try{C.serializedBefore=r.serialize(p),C.serializedAfter=r.serialize(f)}catch(h){console.error("Failed to serialize snapshot:",h)}if(o)try{C.diff=o(p,f)}catch(h){console.error("Failed to capture snapshot:",h)}u.push(C),n&&u.length>n&&u.shift(),s==null||s(C)}},{exclude:["context","snapshots","clearSnapshots","restoreSnapshot",...c]}),x=d=>{let{context:p,...f}=e;return{context:d,...f}};if(!l)for(let d in y){if(!Object.prototype.hasOwnProperty.call(y,d))continue;let p=y[d];if(typeof p=="function"&&!d.startsWith("_")&&d!=="context"&&!["snapshots","clearSnapshots","restoreSnapshot","history","clearHistory"].includes(d)){let f=p;y[d]=function(...C){let h=f.apply(this,C);if(h&&typeof h=="object"&&"context"in h&&!("snapshots"in h)){for(let m in h){if(!Object.prototype.hasOwnProperty.call(h,m))continue;let A=h[m];if(typeof A=="function"&&!m.startsWith("_")&&m!=="context"&&!["snapshots","clearSnapshots","restoreSnapshot","history","clearHistory"].includes(m)){let ye=A;h[m]=function(...fe){let N=h.context,O=ye.apply(this,fe);if(O&&typeof O=="object"&&"context"in O){let z=O.context;if(!(a&&!a(m))){let X=!0;if(i&&(X=JSON.stringify(N)!==JSON.stringify(z)),X){let P={id:`snapshot-${M++}`,transitionName:m,before:{...N},after:{...z},timestamp:Date.now()};if(r)try{P.serializedBefore=r.serialize(N),P.serializedAfter=r.serialize(z)}catch($){console.error("Failed to serialize snapshot:",$)}if(o)try{P.diff=o(N,z)}catch($){console.error("Failed to capture snapshot:",$)}u.push(P),n&&u.length>n&&u.shift(),s==null||s(P)}}}return O}}}let b=Object.assign(h,{snapshots:u,clearSnapshots:()=>{u.length=0,M=0},restoreSnapshot:x});return e.history&&(b.history=e.history,b.clearHistory=e.clearHistory),b}return h}}}return Object.assign(y,{snapshots:u,clearSnapshots:()=>{u.length=0,M=0},restoreSnapshot:x})}function le(e,t={}){let{maxSize:n,serializer:r,onRecord:o}=t,i=[],a=[],s=0,c=0,l=(d,p)=>{let f={id:`entry-${s++}`,transitionName:d,args:[...p],timestamp:Date.now()};if(r)try{f.serializedArgs=r.serialize(p)}catch(C){console.error("Failed to serialize history args:",C)}i.push(f),n&&i.length>n&&i.shift(),o==null||o("history",f)},u=(d,p,f)=>{let C={id:`snapshot-${c++}`,transitionName:d,before:{...p},after:{...f},timestamp:Date.now()};if(r)try{C.serializedBefore=r.serialize(p),C.serializedAfter=r.serialize(f)}catch(h){console.error("Failed to serialize snapshot:",h)}a.push(C),n&&a.length>n&&a.shift(),o==null||o("snapshot",C)},M=d=>{let{context:p,...f}=e;return Object.assign({context:d},d,f)},y=(d=0)=>{if(d<0||d>=a.length)throw new Error(`Invalid snapshot index: ${d}`);let p=M(a[d].before),f=a[d],C=i.findIndex(h=>h.transitionName===f.transitionName&&h.timestamp===f.timestamp);if(C===-1)throw new Error("Could not find matching history entry for snapshot");for(let h=C;h<i.length;h++){let b=i[h],m=p[b.transitionName];if(typeof m=="function")try{p=m.apply(p.context,b.args)}catch(A){throw console.error(`Replay failed at step ${h}:`,A),A}}return p},x=d=>{let p={...d};for(let f in d){if(!Object.prototype.hasOwnProperty.call(d,f))continue;let C=d[f];typeof C=="function"&&!f.startsWith("_")&&f!=="context"&&!["history","snapshots","clearHistory","clearSnapshots","clearTimeTravel","restoreSnapshot","replayFrom"].includes(f)&&(p[f]=function(...h){l(f,h);let b=p.context,m=C.apply(this,h);return m&&typeof m=="object"&&"context"in m&&u(f,b,m.context),m&&typeof m=="object"&&"context"in m?x(m):m})}return Object.assign(p,{history:i,snapshots:a,clearHistory:()=>{i.length=0,s=0},clearSnapshots:()=>{a.length=0,c=0},clearTimeTravel:()=>{i.length=0,a.length=0,s=0,c=0},restoreSnapshot:M,replayFrom:y})};return x(e)}function Le(e,...t){return t.reduce((n,r)=>r(n),e)}function Ve(e,t){return n=>w(n,e,t)}function B(e,...t){return t.reduce((n,r)=>r(n),e)}function Ue(e){return new J(e)}var J=class e{constructor(t){this.machine=t}with(t){let n=t(this.machine);return new e(n)}build(){return this.machine}};function Je(e){return le(ce(se(e)))}function qe(e={}){let{continueOnError:t=!1,logErrors:n=!0,onError:r}=e;return(o,...i)=>{let a=o,s=[];for(let c=0;c<i.length;c++){let l=i[c];try{if("middleware"in l&&"when"in l){if(!l.when(a))continue;a=l.middleware(a)}else a=l(a)}catch(u){let M=u instanceof Error?u:new Error(String(u));if(s.push({error:M,middlewareIndex:c}),n&&console.error(`Middleware pipeline error at index ${c}:`,M),r==null||r(M,`middleware-${c}`),!t)break}}return{machine:a,errors:s,success:s.length===0}}}function Ye(){let e=new Map;return{register(t,n,r,o){if(e.has(t))throw new Error(`Middleware '${t}' is already registered`);return e.set(t,{name:t,middleware:n,description:r,priority:o}),this},unregister(t){return e.delete(t)},has(t){return e.has(t)},get(t){return e.get(t)},list(){return Array.from(e.values()).sort((t,n)=>{var r,o;return((r=t.priority)!=null?r:0)-((o=n.priority)!=null?o:0)})},apply(t,n){let r=n.map(o=>{let i=e.get(o);if(!i)throw new Error(`Middleware '${o}' is not registered`);return i}).sort((o,i)=>{var a,s;return((a=o.priority)!=null?a:0)-((s=i.priority)!=null?s:0)});return B(t,...r.map(o=>o.middleware))},applyAll(t){let n=this.list();return B(t,...n.map(r=>r.middleware))}}}function q(e,t){let n=function(r){return t(r)?e(r):r};return n.middleware=e,n.when=t,n}function Xe(e){return q(e,()=>typeof process!="undefined"?!1:typeof window!="undefined"?!window.location.hostname.includes("production"):!1)}function Qe(e,t,n){return q(n,r=>r.context[e]===t)}function Ze(...e){return t=>B(t,...e)}function et(e,t){return n=>{for(let[r,o]of e)if(r(n))return o(n);return t?t(n):n}}function de(e){return typeof e=="function"&&e.length===1}function tt(e){return e!==null&&"middleware"in e&&"when"in e&&de(e.middleware)&&typeof e.when=="function"}function nt(e,t){return e instanceof t}function rt(e,...t){return{type:e,args:t}}function ot(e,t){return k(e,n=>({...n,...t}))}async function it(e,...t){let n=e;for(let r of t)n=await r(n);return n}function at(e,t){return t?console.log(t,e.context):console.log(e.context),e}function st(e,t,...n){return e.apply(t,n)}function ue(e){return new Proxy(e,{get(t,n){let r=t[n];return typeof r=="function"?function(...o){let i=r.apply(t.context,o);return i&&typeof i=="object"&&"context"in i?ue(i):i}:r}})}var Y=class e{constructor(t){return this.wrappedMachine=t,new Proxy(this,{get:(n,r)=>{if(r==="wrappedMachine")return Reflect.get(n,r);if(r==="context")return this.wrappedMachine.context;let o=this.wrappedMachine[r];return typeof o=="function"?(...i)=>{let a=o.apply(this.wrappedMachine.context,i);return a&&typeof a=="object"&&"context"in a?new e(a):a}:o}})}};function E(e,t){let n="context"in t?Object.fromEntries(Object.entries(t).filter(([o])=>o!=="context")):t;return Object.assign({context:e},n)}function Gt(e,t){return Object.assign({context:e},t)}function Ht(){return e=>{let t=Object.fromEntries(Object.entries(e).map(([n,r])=>[n,function(...o){let i=r(this,...o);return E(i,t)}]));return n=>E(n,t)}}function k(e,t){let{context:n,...r}=e,o=typeof t=="function"?t(n):t;return E(o,r)}function It(e,t){let{context:n,...r}=e,o={...r,...t};return E(n,o)}function Lt(e,t){let{context:n,...r}=e,o={...r,...t};return E(n,o)}function Vt(e,t){return(...n)=>{let r=e(...n),o=t(),i={...r.context,...o.context},{context:a,...s}=r,{context:c,...l}=o,u={...s,...l};return E(i,u)}}function Ut(e){let{context:t,...n}=e;return r=>E(r,n)}function Jt(e,t,n){let r=e.context[t],o=n[r];if(!o)throw new Error(`No handler found for state: ${String(r)}`);return o(e.context)}function qt(e,t,n){return e.context[t]===n}function Yt(e,t){let n=e,r=null;async function o(i){r&&(r.abort(),r=null);let a=n[i.type];if(typeof a!="function")throw new Error(`[Machine] Unknown event type '${String(i.type)}' on current state.`);let s=new AbortController;r=s;try{let l=await a.apply(n.context,[...i.args,{signal:s.signal}]);return s.signal.aborted||(n=l,t==null||t(n)),n}finally{r===s&&(r=null)}}return{get state(){return n.context},dispatch:o,stop:()=>{r&&(r.abort(),r=null)}}}var T=class{constructor(t){this.context=t}};function Xt(e,t){let{context:n,...r}=e;return E(t(n),r)}export{ft as ADVANCED_CONFIG_EXAMPLES,Y as BoundMachine,we as META_KEY,T as MachineBase,oe as MultiMachineBase,j as RUNTIME_META,Fe as action,ue as bindTransitions,et as branch,st as call,Ue as chain,Ze as combine,Vt as combineFactories,Le as compose,B as composeTyped,Gt as createAsyncMachine,Ve as createCustomMiddleware,gt as createEnsemble,rt as createEvent,At as createFetchMachine,pe as createFlow,E as createMachine,Ut as createMachineBuilder,Ht as createMachineFactory,w as createMiddleware,Ye as createMiddlewareRegistry,wt as createMultiMachine,bt as createMutableMachine,ie as createParallelMachine,qe as createPipeline,Be as createRunner,Rt as delegateToChild,Te as describe,Lt as extendTransitions,ze as extractFromInstance,re as extractFunctionMetadata,W as extractMachine,ke as extractMachines,G as extractStateNode,ne as generateChart,Ne as generateStatechart,_ as guard,D as guardAsync,Ee as guarded,qt as hasState,Xe as inDevelopment,Se as invoke,tt as isConditionalMiddleware,de as isMiddlewareFn,nt as isState,at as logState,Jt as matchMachine,ot as mergeContext,ve as metadata,Xt as next,It as overrideTransitions,it as pipeTransitions,Z as run,Ce as runAsync,Yt as runMachine,he as runSequence,ge as runWithDebug,mt as runWithEnsemble,Ct as runWithRunner,k as setContext,Me as step,me as stepAsync,vt as toggle,be as transitionTo,q as when,Qe as whenContext,Pe as whenGuard,Re as whenGuardAsync,De as withAnalytics,Je as withDebugging,Ge as withErrorReporting,se as withHistory,_e as withLogging,He as withPerformanceMonitoring,We as withPermissions,Ie as withRetry,ce as withSnapshot,le as withTimeTravel,Ke as withValidation,xe as yieldMachine};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ext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nB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACrC,mDAAmD;IACnD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAkdD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,OAAO,EAChB,OAAO,UAAQ,GACd,GAAG,CAiGL;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,GAAG,EAAE,CA+B/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,SAkC5B;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;kBAW9B,aAAa;cAmBb,aAAa;CACnB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,12 +18,25 @@ export type Machine<C extends object> = {
|
|
|
18
18
|
} & Record<string, (...args: any[]) => Machine<any>>;
|
|
19
19
|
/**
|
|
20
20
|
* The shape of an asynchronous machine, where transitions can return Promises.
|
|
21
|
-
*
|
|
21
|
+
* Async transitions receive an AbortSignal as the last parameter for cancellation support.
|
|
22
|
+
* @template C - The context object type.
|
|
22
23
|
*/
|
|
23
24
|
export type AsyncMachine<C extends object> = {
|
|
24
25
|
/** The readonly state of the machine. */
|
|
25
26
|
readonly context: C;
|
|
26
27
|
} & Record<string, (...args: any[]) => MaybePromise<AsyncMachine<any>>>;
|
|
28
|
+
/**
|
|
29
|
+
* Utility type to extract the parameters of an async transition function,
|
|
30
|
+
* which includes TransitionOptions as the last parameter.
|
|
31
|
+
*/
|
|
32
|
+
export type AsyncTransitionArgs<M extends AsyncMachine<any>, K extends keyof M & string> = M[K] extends (...args: infer A) => any ? A extends [...infer Rest, TransitionOptions] ? Rest : A : never;
|
|
33
|
+
/**
|
|
34
|
+
* Options passed to async transition functions, including cancellation support.
|
|
35
|
+
*/
|
|
36
|
+
export interface TransitionOptions {
|
|
37
|
+
/** AbortSignal for cancelling long-running async operations. */
|
|
38
|
+
signal: AbortSignal;
|
|
39
|
+
}
|
|
27
40
|
/**
|
|
28
41
|
* Extracts the context type `C` from a machine type `M`.
|
|
29
42
|
* @template M - The machine type.
|
|
@@ -165,6 +178,49 @@ export declare function overrideTransitions<M extends Machine<any>, T extends Re
|
|
|
165
178
|
export declare function extendTransitions<M extends Machine<any>, T extends Record<string, (this: Context<M>, ...args: any[]) => any> & {
|
|
166
179
|
[K in keyof T]: K extends keyof M ? never : T[K];
|
|
167
180
|
}>(machine: M, newTransitions: T): M & T;
|
|
181
|
+
/**
|
|
182
|
+
* Combines two machine factories into a single factory that creates machines with merged context and transitions.
|
|
183
|
+
* This allows you to compose independent state machines that operate on different parts of the same context.
|
|
184
|
+
*
|
|
185
|
+
* The resulting factory takes the parameters of the first factory, while the second factory is called with no arguments.
|
|
186
|
+
* Context properties are merged (second factory's context takes precedence on conflicts).
|
|
187
|
+
* Transition names must not conflict between the two machines.
|
|
188
|
+
*
|
|
189
|
+
* @template F1 - The first factory function type.
|
|
190
|
+
* @template F2 - The second factory function type.
|
|
191
|
+
* @param factory1 - The first machine factory (provides parameters and primary context).
|
|
192
|
+
* @param factory2 - The second machine factory (provides additional context and transitions).
|
|
193
|
+
* @returns A new factory function that creates combined machines.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* // Define two independent machines
|
|
198
|
+
* const createCounter = (initial: number) =>
|
|
199
|
+
* createMachine({ count: initial }, {
|
|
200
|
+
* increment: function() { return createMachine({ count: this.count + 1 }, this); },
|
|
201
|
+
* decrement: function() { return createMachine({ count: this.count - 1 }, this); }
|
|
202
|
+
* });
|
|
203
|
+
*
|
|
204
|
+
* const createLogger = () =>
|
|
205
|
+
* createMachine({ logs: [] as string[] }, {
|
|
206
|
+
* log: function(message: string) {
|
|
207
|
+
* return createMachine({ logs: [...this.logs, message] }, this);
|
|
208
|
+
* },
|
|
209
|
+
* clear: function() {
|
|
210
|
+
* return createMachine({ logs: [] }, this);
|
|
211
|
+
* }
|
|
212
|
+
* });
|
|
213
|
+
*
|
|
214
|
+
* // Combine them
|
|
215
|
+
* const createCounterWithLogging = combineFactories(createCounter, createLogger);
|
|
216
|
+
*
|
|
217
|
+
* // Use the combined factory
|
|
218
|
+
* const machine = createCounterWithLogging(5); // { count: 5, logs: [] }
|
|
219
|
+
* const incremented = machine.increment(); // { count: 6, logs: [] }
|
|
220
|
+
* const logged = incremented.log("Count incremented"); // { count: 6, logs: ["Count incremented"] }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare function combineFactories<F1 extends (...args: any[]) => Machine<any>, F2 extends () => Machine<any>>(factory1: F1, factory2: F2): (...args: Parameters<F1>) => Machine<Context<ReturnType<F1>> & Context<ReturnType<F2>>> & Omit<ReturnType<F1>, 'context'> & Omit<ReturnType<F2>, 'context'>;
|
|
168
224
|
/**
|
|
169
225
|
* Creates a builder function from a "template" machine instance.
|
|
170
226
|
* This captures the behavior of a machine and returns a factory that can stamp out
|
|
@@ -227,17 +283,20 @@ export declare function hasState<M extends Machine<any>, K extends keyof Context
|
|
|
227
283
|
/**
|
|
228
284
|
* Runs an asynchronous state machine with a managed lifecycle and event dispatch capability.
|
|
229
285
|
* This is the "interpreter" for async machines, handling state updates and side effects.
|
|
286
|
+
* Provides automatic AbortController management to prevent async race conditions.
|
|
230
287
|
*
|
|
231
288
|
* @template M - The initial machine type.
|
|
232
289
|
* @param initial - The initial machine state.
|
|
233
290
|
* @param onChange - Optional callback invoked with the new machine state after every transition.
|
|
234
|
-
* @returns An object with a `state` getter for the current context
|
|
291
|
+
* @returns An object with a `state` getter for the current context, an async `dispatch` function, and a `stop` method.
|
|
235
292
|
*/
|
|
236
293
|
export declare function runMachine<M extends AsyncMachine<any>>(initial: M, onChange?: (m: M) => void): {
|
|
237
294
|
/** Gets the context of the current state of the machine. */
|
|
238
295
|
readonly state: Context<M>;
|
|
239
296
|
/** Dispatches a type-safe event to the machine, triggering a transition. */
|
|
240
297
|
dispatch: <E extends Event<M>>(event: E) => Promise<M>;
|
|
298
|
+
/** Stops any pending async operation and cleans up resources. */
|
|
299
|
+
stop: () => void;
|
|
241
300
|
};
|
|
242
301
|
/**
|
|
243
302
|
* An optional base class for creating machines using an Object-Oriented style.
|
|
@@ -336,11 +395,13 @@ export type MachineLike<C extends object> = Machine<C> | Promise<Machine<C>>;
|
|
|
336
395
|
*/
|
|
337
396
|
export type MachineResult<C extends object> = Machine<C> | [Machine<C>, () => void | Promise<void>];
|
|
338
397
|
export { run, step, yieldMachine, runSequence, createFlow, runWithDebug, runAsync, stepAsync } from './generators';
|
|
339
|
-
export { transitionTo, describe, guarded, invoke, action, metadata, META_KEY, type TransitionMeta, type GuardMeta, type InvokeMeta, type ActionMeta, type ClassConstructor, type WithMeta } from './primitives';
|
|
398
|
+
export { transitionTo, describe, guarded, guard, guardAsync, whenGuard, whenGuardAsync, invoke, action, metadata, META_KEY, type TransitionMeta, type GuardMeta, type InvokeMeta, type ActionMeta, type ClassConstructor, type WithMeta, type GuardOptions, type GuardFallback, type GuardedTransition } from './primitives';
|
|
340
399
|
export { extractMachine, extractMachines, generateChart, type MachineConfig, type ExtractionConfig } from './extract';
|
|
341
400
|
export { extractFunctionMetadata, extractStateNode, generateStatechart, extractFromInstance } from './runtime-extract';
|
|
342
401
|
export { RUNTIME_META, type RuntimeTransitionMeta } from './primitives';
|
|
343
402
|
export * from './multi';
|
|
344
403
|
export * from './higher-order';
|
|
404
|
+
export * from './extract';
|
|
405
|
+
export { createMiddleware, withLogging, withAnalytics, withValidation, withPermissions, withErrorReporting, withPerformanceMonitoring, withRetry, withHistory, withSnapshot, withTimeTravel, compose, composeTyped, createPipeline, createMiddlewareRegistry, when, inDevelopment, whenContext, combine, branch, isMiddlewareFn, isConditionalMiddleware, createCustomMiddleware, type MiddlewareHooks, type MiddlewareOptions, type MiddlewareContext, type MiddlewareResult, type MiddlewareError, type HistoryEntry, type ContextSnapshot, type Serializer, type MiddlewareFn, type ConditionalMiddleware, type NamedMiddleware, type PipelineConfig, type PipelineResult, chain, withDebugging } from './middleware';
|
|
345
406
|
export { isState, createEvent, mergeContext, pipeTransitions, logState, call, bindTransitions, BoundMachine } from './utils';
|
|
346
407
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI;IACtC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CACrB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI;IACtC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CACrB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IAC3C,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CACrB,GAA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