@ronaldroe/micro-flow 1.3.5 → 1.3.8
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
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Micro-Flow
|
|
2
2
|
|
|
3
|
-
Micro-Flow
|
|
3
|
+
[Click Here](https://survey.alchemer.com/s3/8882776/Micro-Flow-User-Survey) to complete the Micro-Flow user survey. It will take less than 5 minutes of your time.
|
|
4
|
+
|
|
5
|
+
Micro-Flow is a simple, lightweight, cross platform (browser and runtime) logic orchestration library. Micro-Flow makes async logic flows first-class objects — named, observable, pauseable, and composable — so a multi-step process is something you can reason about, monitor, and control, not just a wall of awaits.
|
|
4
6
|
|
|
5
7
|
## Why Micro-Flow?
|
|
6
8
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var h=Object.defineProperty;var s=(t,e)=>h(t,"name",{value:e,configurable:!0});class a{static{s(this,"CallableRegistry")}#e;constructor(){this.#e={}}clear(){this.#e={}}deregister(e){if(!this.has(e))throw new Error(`No callable registered under the name "${e}".`);delete this.#e[e]}get(e){if(!this.has(e))throw new Error(`No callable registered under the name "${e}".`);return this.#e[e]}has(e){return Object.hasOwn(this.#e,e)}register(e,r){if(typeof r!="function")throw new Error("Only functions can be registered as callables.");this.#e[e]=r}registerMany(e){for(const[r,i]of Object.entries(e))this.register(r,i)}}export{a as default};
|
|
2
|
+
//# sourceMappingURL=callable_registry.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/classes/callable_registry.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Provides a registry for callable functions to be used with persistence mode.\n * This class allows you to register, retrieve, check for, and deregister callable functions by name.\n */\nexport default class CallableRegistry {\n #registry;\n\n /**\n * Registry for callable functions to be used with persistence mode.\n */\n constructor() {\n this.#registry = {};\n }\n\n /**\n * Clears all callable entries from the registry.\n */\n clear() {\n this.#registry = {};\n }\n\n /**\n * Removes a callable from the registry.\n * @param {string} name - The name of the callable to remove.\n * @throws Will throw an error if no callable is registered under the given name.\n */\n deregister(name) {\n if (!this.has(name)) {\n throw new Error(`No callable registered under the name \"${name}\".`);\n }\n\n delete this.#registry[name];\n }\n\n /**\n * Retrieves a callable from the registry.\n * @param {string} name - The name of the callable to retrieve.\n * @returns {Function} The callable function registered under the given name.\n * @throws Will throw an error if no callable is registered under the given name.\n */\n get(name) {\n if (!this.has(name)) {\n throw new Error(`No callable registered under the name \"${name}\".`);\n }\n\n return this.#registry[name];\n }\n\n /**\n * Checks if a callable is registered under the given name.\n * @param {string} name - The name of the callable to check.\n * @returns {boolean} True if a callable is registered under the given name, false otherwise.\n */\n has(name) {\n return Object.hasOwn(this.#registry, name);\n }\n\n /**\n * Registers a callable function under a given name.\n * @param {string} name - The name to register the callable under.\n * @param {Function} callable - The function to register as a callable.\n * @throws Will throw an error if the provided callable is not a function.\n */\n register(name, callable) {\n if (typeof callable !== 'function') {\n throw new Error('Only functions can be registered as callables.');\n }\n\n this.#registry[name] = callable;\n }\n\n /**\n * Registers multiple callables from an object mapping names to functions.\n * @param {Object} callables - An object where keys are names and values are functions to register.\n * @throws Will throw an error if any of the provided callables is not a function.\n */\n registerMany(callables) {\n for (const [name, callable] of Object.entries(callables)) {\n this.register(name, callable);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAIA,MAAOA,CAA+B,CAJtC,MAIsC,CAAAC,EAAA,yBACpCC,GAKA,aAAc,CACZ,KAAKA,GAAY,CAAC,CACpB,CAKA,OAAQ,CACN,KAAKA,GAAY,CAAC,CACpB,CAOA,WAAWC,EAAM,CACf,GAAI,CAAC,KAAK,IAAIA,CAAI,EAChB,MAAM,IAAI,MAAM,0CAA0CA,CAAI,IAAI,EAGpE,OAAO,KAAKD,GAAUC,CAAI,CAC5B,CAQA,IAAIA,EAAM,CACR,GAAI,CAAC,KAAK,IAAIA,CAAI,EAChB,MAAM,IAAI,MAAM,0CAA0CA,CAAI,IAAI,EAGpE,OAAO,KAAKD,GAAUC,CAAI,CAC5B,CAOA,IAAIA,EAAM,CACR,OAAO,OAAO,OAAO,KAAKD,GAAWC,CAAI,CAC3C,CAQA,SAASA,EAAMC,EAAU,CACvB,GAAI,OAAOA,GAAa,WACtB,MAAM,IAAI,MAAM,gDAAgD,EAGlE,KAAKF,GAAUC,CAAI,EAAIC,CACzB,CAOA,aAAaC,EAAW,CACtB,SAAW,CAACF,EAAMC,CAAQ,IAAK,OAAO,QAAQC,CAAS,EACrD,KAAK,SAASF,EAAMC,CAAQ,CAEhC,CACF",
|
|
6
|
+
"names": ["CallableRegistry", "__name", "#registry", "name", "callable", "callables"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ronaldroe/micro-flow",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "A lightweight, flexible workflow orchestration library for Node.js and browser environments. Build complex, sequential processes with ease using an intuitive API that supports conditional logic, flow control, event handling, and state management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
package/src/classes/registry.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Steps from './steps/index.js';
|
|
2
|
-
|
|
3
|
-
const _REGISTRY_KEY = Symbol.for('@ronaldroe/micro-flow/registry');
|
|
4
|
-
|
|
5
|
-
if (!globalThis[_REGISTRY_KEY]) {
|
|
6
|
-
globalThis[_REGISTRY_KEY] = new Map();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default class Registry {
|
|
10
|
-
static get registry() {
|
|
11
|
-
return globalThis[_REGISTRY_KEY];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static register(name, stepClass) {
|
|
15
|
-
this.registry.set(name, stepClass);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static get(name) {
|
|
19
|
-
return this.registry.get(name);
|
|
20
|
-
}
|
|
21
|
-
}
|