{"_id":"@azerothian/sandwich","_rev":"5-eff7cea8b47495f02fd15fae3bca3128","name":"@azerothian/sandwich","dist-tags":{"latest":"1.1.2"},"versions":{"0.3.2":{"name":"@azerothian/sandwich","version":"0.3.2","_id":"@azerothian/sandwich@0.3.2","maintainers":[{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"}],"dist":{"shasum":"bf7774ed83d7c23c9430f92585fcaec76f1f7751","tarball":"https://registry.npmjs.org/@azerothian/sandwich/-/sandwich-0.3.2.tgz","fileCount":66,"integrity":"sha512-WckiCFOxgeB/cyaJ2xgCJ3kOH5JwOfUS+A0j9Yj2+xVl6/2fnII28EdG1TnPDSSMlCOzjdCyIzzLkXM4DdzgQg==","signatures":[{"sig":"MEYCIQDTUfkvKOnMywr8Ut10Y53wOR+s4W0KFhDal2r0WWCm3wIhAJNh31WHK317D1K8zt8GdMGj/YCHGJHXytNCmuweKR03","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":134053},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"7222292961a34e36b3031da64e0f7e03668afcf3","scripts":{"test":"jest","build":"rm -Rf ./lib || true; run-p build:*","build:main":"swc src --out-dir lib --strip-leading-paths -s","build:types":"tsc -p tsconfig.types.json","postpublish":"yalc restore --all && pnpm install","build:copy-dts":"copyfiles -u 1 \"src/**/*.d.ts\" lib","prepublishOnly":"pnpm run build; echo next; yalc retreat --all"},"_npmUser":{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"},"_npmVersion":"10.9.0","description":"```                     _.---._                 _.-~       ~-._             _.-~               ~-._         _.-~                       ~---._     _.-~                                 ~\\  .-~                                    _.;  :-._                    ","directories":{},"_nodeVersion":"22.12.0","dependencies":{"uuid":"^9.0.1","debug":"^4.3.4","deepmerge":"^4.3.1","is-plain-object":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","@swc/cli":"^0.4.0","@swc/core":"^1.7.18","copyfiles":"^2.4.1","typescript":"^5.2.2","@types/node":"^20.10.5","@types/debug":"^4.1.10","npm-run-all2":"^6.2.2","@jest/globals":"^29.7.0"},"peerDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sandwich_0.3.2_1739279434793_0.7601830661071678","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@azerothian/sandwich","version":"1.0.0","_id":"@azerothian/sandwich@1.0.0","maintainers":[{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"}],"dist":{"shasum":"cdf6b5c703ddce1ce0024fef45520e9b70c3319d","tarball":"https://registry.npmjs.org/@azerothian/sandwich/-/sandwich-1.0.0.tgz","fileCount":66,"integrity":"sha512-cZ7qzsPT64suk5IpV0OnYKDlOE7XBjkBIzknyezIrQmGxOd/nXOhXmd44fTj1te7ztJErtxvjBqQ7BtqopqQUQ==","signatures":[{"sig":"MEYCIQDLqWGYnAGtyo58A96ISJWwCdZL1TGaqJJ+JGcszirJQQIhALgRjvZo5FXwzxZUgmz9cxdHLGmY6U9FrXU6To+rdsYh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":136316},"main":"lib/index.js","types":"lib/index.d.ts","gitHead":"210fbad6f836b044f5df2262bc8b5a3c4c82f1cc","scripts":{"test":"jest","build":"rm -Rf ./lib || true; run-p build:*","build:main":"swc src --out-dir lib --strip-leading-paths -s","build:types":"tsc -p tsconfig.types.json","postpublish":"yalc restore --all && pnpm install","build:copy-dts":"copyfiles -u 1 \"src/**/*.d.ts\" lib","prepublishOnly":"pnpm run build; echo next; yalc retreat --all"},"_npmUser":{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"},"_npmVersion":"10.8.2","description":"```                     _.---._                 _.-~       ~-._             _.-~               ~-._         _.-~                       ~---._     _.-~                                 ~\\  .-~                                    _.;  :-._                    ","directories":{},"_nodeVersion":"22.6.0","dependencies":{"uuid":"^9.0.1","debug":"^4.3.4","deepmerge":"^4.3.1","is-plain-object":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","@swc/cli":"^0.4.0","@swc/core":"^1.7.18","copyfiles":"^2.4.1","typescript":"^5.2.2","@types/node":"^20.10.5","@types/debug":"^4.1.10","npm-run-all2":"^6.2.2","@jest/globals":"^29.7.0"},"peerDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sandwich_1.0.0_1744700956865_0.9854747957225647","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@azerothian/sandwich","version":"1.1.0","_id":"@azerothian/sandwich@1.1.0","maintainers":[{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"}],"dist":{"shasum":"f3b73ee6080aea17a209a9e9dff057e91d31c0b6","tarball":"https://registry.npmjs.org/@azerothian/sandwich/-/sandwich-1.1.0.tgz","fileCount":133,"integrity":"sha512-W/Q0QTBobk/hn5sRR7PRDiOPbgZALidUeyr6k+sqpHvtWeNALD/jSl5jj2l5V5z/3tdrM2qrtXDdLiXhBK8uiA==","signatures":[{"sig":"MEUCIGVt67eoxOMY0Dc+XadmW+yF1/mdqirFsGe75y5Gr8sOAiEAinTdWci6EzkoGTn//ff5D0Jt05ZX4s8/IOwQ4bbnsHc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":293852},"main":"cjs/index.js","pnpm":{"onlyBuiltDependencies":["@swc/core","esbuild"]},"type":"module","types":"lib/index.d.ts","module":"lib/index.js","gitHead":"b52b933619a130a2f687d68a6436c0686071d777","scripts":{"build":"rm -Rf ./publish || true; mkdir ./publish && run-s build:*","build:cjs":"swc src --out-dir publish/cjs --config-file=.swcrc-cjs --strip-leading-paths -s","build:src":"copyfiles -u 1 \"src/**/*\" publish/src","build:main":"swc src --out-dir publish/lib --strip-leading-paths -s","build:types":"tsc -p tsconfig.types.json --outDir publish/types","yalc:update":"yalc update; pnpm install","build:readme":"cp ./README.md ./publish/README.md","package:yalc":"pnpm run build; cd publish; yalc publish","build:package":"yalc retreat --all; tsx ./scripts/prepare-package.ts; yalc restore --all; pnpm install","build:copy-dts":"copyfiles -u 1 \"src/**/*.d.ts\" publish/lib"},"_npmUser":{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"},"_npmVersion":"10.9.0","description":"```                     _.---._                 _.-~       ~-._             _.-~               ~-._         _.-~                       ~---._     _.-~                                 ~\\  .-~                                    _.;  :-._                    ","directories":{},"_nodeVersion":"22.12.0","dependencies":{"uuid":"^9.0.1","debug":"^4.4.0","deepmerge":"^4.3.1","is-plain-object":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","jest":"^29.7.0","globby":"^14.1.0","@swc/cli":"^0.4.0","@swc/core":"^1.11.21","@swc/jest":"^0.2.37","copyfiles":"^2.4.1","typescript":"^5.8.3","@types/node":"^20.17.30","@types/debug":"^4.1.12","npm-run-all2":"^6.2.6","@jest/globals":"^29.7.0"},"_npmOperationalInternal":{"tmp":"tmp/sandwich_1.1.0_1747396646242_0.12738737878995976","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@azerothian/sandwich","version":"1.1.1","_id":"@azerothian/sandwich@1.1.1","maintainers":[{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"}],"dist":{"shasum":"0347060c27e0e12a9c9a241979a63cd88fd31647","tarball":"https://registry.npmjs.org/@azerothian/sandwich/-/sandwich-1.1.1.tgz","fileCount":98,"integrity":"sha512-gxCwwIf+8eLbMuQmIChsOkZsiGLReUMpj3C4e6crr7jbnJi+JpEqgJPf3SIyXCMG90aVeZW/0ZZ01IK7v9Iy2w==","signatures":[{"sig":"MEQCH0OTwZGGHuICRTN2CwIX6F/scDEffEmGukAF8x3bsb4CIQDPfLu3KXqbJuBK+GFclHIrZvMbjwt/0gv6Z9DkrxU1kg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":227881},"main":"cjs/index.js","pnpm":{"onlyBuiltDependencies":["@swc/core","esbuild"]},"type":"module","types":"lib/index.d.ts","module":"lib/index.js","exports":{".":{"types":"./types/index.d.ts","import":"./lib/index.mjs","require":"./cjs/index.js"},"./loaf":{"types":"./types/loaf.d.ts","import":"./lib/loaf.mjs","require":"./cjs/loaf.js"},"./index":{"types":"./types/index.d.ts","import":"./lib/index.mjs","require":"./cjs/index.js"},"./slice":{"types":"./types/slice.d.ts","import":"./lib/slice.mjs","require":"./cjs/slice.js"},"./kitchen":{"types":"./types/kitchen.d.ts","import":"./lib/kitchen.mjs","require":"./cjs/kitchen.js"},"./types/loaf":{"types":"./types/types/loaf.d.ts","import":"./lib/types/loaf.mjs","require":"./cjs/types/loaf.js"},"./types/utils":{"types":"./types/types/utils.d.ts"},"./utils/chains":{"types":"./types/utils/chains.d.ts","import":"./lib/utils/chains.mjs","require":"./cjs/utils/chains.js"},"./utils/logger":{"types":"./types/utils/logger.d.ts","import":"./lib/utils/logger.mjs","require":"./cjs/utils/logger.js"},"./utils/waterfall":{"types":"./types/utils/waterfall.d.ts","import":"./lib/utils/waterfall.mjs","require":"./cjs/utils/waterfall.js"},"./utils/topo-graph":{"types":"./types/utils/topo-graph.d.ts","import":"./lib/utils/topo-graph.mjs","require":"./cjs/utils/topo-graph.js"},"./examples/basic/index":{"types":"./types/examples/basic/index.d.ts","import":"./lib/examples/basic/index.mjs","require":"./cjs/examples/basic/index.js"},"./examples/basic/module1":{"types":"./types/examples/basic/module1.d.ts","import":"./lib/examples/basic/module1.mjs","require":"./cjs/examples/basic/module1.js"},"./examples/complex/index":{"types":"./types/examples/complex/index.d.ts","import":"./lib/examples/complex/index.mjs","require":"./cjs/examples/complex/index.js"},"./examples/complex/module1":{"types":"./types/examples/complex/module1.d.ts","import":"./lib/examples/complex/module1.mjs","require":"./cjs/examples/complex/module1.js"},"./examples/complex/module2":{"types":"./types/examples/complex/module2.d.ts","import":"./lib/examples/complex/module2.mjs","require":"./cjs/examples/complex/module2.js"},"./examples/complex/module3":{"types":"./types/examples/complex/module3.d.ts","import":"./lib/examples/complex/module3.mjs","require":"./cjs/examples/complex/module3.js"}},"gitHead":"fc4dd4593b9bb9fd65930615eec8932159fc97ef","_npmUser":{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"},"_npmVersion":"10.9.0","description":"```                     _.---._                 _.-~       ~-._             _.-~               ~-._         _.-~                       ~---._     _.-~                                 ~\\  .-~                                    _.;  :-._                    ","directories":{},"_nodeVersion":"22.12.0","dependencies":{"uuid":"^9.0.1","debug":"^4.4.0","deepmerge":"^4.3.1","is-plain-object":"^5.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sandwich_1.1.1_1747397028456_0.7592751996125966","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@azerothian/sandwich","version":"1.1.2","main":"cjs/index.js","types":"lib/index.d.ts","module":"lib/index.js","type":"module","dependencies":{"debug":"^4.4.0","deepmerge":"^4.3.1","is-plain-object":"^5.0.0","uuid":"^9.0.1"},"pnpm":{"onlyBuiltDependencies":["@swc/core","esbuild"]},"exports":{".":{"import":"./lib/index.js","require":"./cjs/index.js","types":"./types/index.d.ts"},"./index":{"import":"./lib/index.js","require":"./cjs/index.js","types":"./types/index.d.ts"},"./kitchen":{"import":"./lib/kitchen.js","require":"./cjs/kitchen.js","types":"./types/kitchen.d.ts"},"./loaf":{"import":"./lib/loaf.js","require":"./cjs/loaf.js","types":"./types/loaf.d.ts"},"./slice":{"import":"./lib/slice.js","require":"./cjs/slice.js","types":"./types/slice.d.ts"},"./types/loaf":{"import":"./lib/types/loaf.js","require":"./cjs/types/loaf.js","types":"./types/types/loaf.d.ts"},"./types/utils":{"types":"./types/types/utils.d.ts"},"./utils/chains":{"import":"./lib/utils/chains.js","require":"./cjs/utils/chains.js","types":"./types/utils/chains.d.ts"},"./utils/logger":{"import":"./lib/utils/logger.js","require":"./cjs/utils/logger.js","types":"./types/utils/logger.d.ts"},"./utils/topo-graph":{"import":"./lib/utils/topo-graph.js","require":"./cjs/utils/topo-graph.js","types":"./types/utils/topo-graph.d.ts"},"./utils/waterfall":{"import":"./lib/utils/waterfall.js","require":"./cjs/utils/waterfall.js","types":"./types/utils/waterfall.d.ts"},"./examples/basic/index":{"import":"./lib/examples/basic/index.js","require":"./cjs/examples/basic/index.js","types":"./types/examples/basic/index.d.ts"},"./examples/basic/module1":{"import":"./lib/examples/basic/module1.js","require":"./cjs/examples/basic/module1.js","types":"./types/examples/basic/module1.d.ts"},"./examples/complex/index":{"import":"./lib/examples/complex/index.js","require":"./cjs/examples/complex/index.js","types":"./types/examples/complex/index.d.ts"},"./examples/complex/module1":{"import":"./lib/examples/complex/module1.js","require":"./cjs/examples/complex/module1.js","types":"./types/examples/complex/module1.d.ts"},"./examples/complex/module2":{"import":"./lib/examples/complex/module2.js","require":"./cjs/examples/complex/module2.js","types":"./types/examples/complex/module2.d.ts"},"./examples/complex/module3":{"import":"./lib/examples/complex/module3.js","require":"./cjs/examples/complex/module3.js","types":"./types/examples/complex/module3.d.ts"}},"_id":"@azerothian/sandwich@1.1.2","gitHead":"fc4dd4593b9bb9fd65930615eec8932159fc97ef","description":"```                     _.---._                 _.-~       ~-._             _.-~               ~-._         _.-~                       ~---._     _.-~                                 ~\\  .-~                                    _.;  :-._                    ","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-kWv3k9/TpEyFxAX/K0z/7mC9y1Lha6K4tliHeU+6f33wFcL/LhF7yq3jcW05QL0FGFj8jhAODmHmK5bSjwFJNg==","shasum":"651d19f69b8192458e06f28e1eaedea694f57c1a","tarball":"https://registry.npmjs.org/@azerothian/sandwich/-/sandwich-1.1.2.tgz","fileCount":98,"unpackedSize":227865,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCYzQnHuVW0O3rT0N/+OIHaQJsVOGEps9G5Q+UkWY01hQIgRnpKH3t5uIW3XtWUC+cHRYCZ8PQhh8HKS3iOh/F1m2o="}]},"_npmUser":{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"},"directories":{},"maintainers":[{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sandwich_1.1.2_1761135721288_0.6266136369807993"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-11T13:10:34.688Z","modified":"2025-10-22T12:22:01.868Z","0.3.2":"2025-02-11T13:10:34.980Z","1.0.0":"2025-04-15T07:09:17.051Z","1.1.0":"2025-05-16T11:57:26.443Z","1.1.1":"2025-05-16T12:03:48.658Z","1.1.2":"2025-10-22T12:22:01.562Z"},"description":"```                     _.---._                 _.-~       ~-._             _.-~               ~-._         _.-~                       ~---._     _.-~                                 ~\\  .-~                                    _.;  :-._                    ","maintainers":[{"name":"matthew.m.mckenzie","email":"matthew.m.mckenzie@gmail.com"}],"readme":"# Sandwich\n```\n                    _.---._\n                _.-~       ~-._\n            _.-~               ~-._\n        _.-~                       ~---._\n    _.-~                                 ~\\\n .-~                                    _.;\n :-._                               _.-~ ./\n }-._~-._                   _..__.-~ _.-~)\n `-._~-._~-._              / .__..--~_.-~\n     ~-._~-._\\.        _.-~_/ _..--~~\n         ~-. \\`--...--~_.-~/~~\n            \\.`--...--~_.-~\n              ~-..----~\n```\n## Description\n\nSandwich is an execution framework for TypeScript/JavaScript based environments. \n\n### A basic example\n```typescript\n\n// module1.ts\nimport Loaf from \"../../loaf\";\nimport { ISlice } from \"../../types/loaf\";\n\nconst module1: ISlice = {\n  name: \"module1\",\n  [Loaf.Initialize]: async (loaf: Loaf) => {\n    console.log(\"Initialize\");\n    return loaf;\n  },\n  [Loaf.Ready]: async (loaf: Loaf) => {\n    console.log(\"Ready\");\n    return loaf;\n  },\n  [Loaf.Shutdown]: async (loaf: Loaf) => {\n    console.log(\"Shutdown\");\n    return loaf;\n  }\n}\nexport default module1;\n```\n\n```typescript\n// index.ts - Loader\n\nimport Loaf from \"../../loaf\";\n\nconst instance = new Loaf({\n  name: \"projectName\",\n  modules: [\"./module1.ts\"],\n});\n\nawait instance.start();\nawait instance.shutdown();\n\n```\n\nConsole Output\n```\nInitialize\nReady\nShutdown\n```\n\n\n### A Complex example\n\nUsing multiple slices with a dependency system you can assemble dynamic and complex application using asynchronous  \n\n```typescript\n// module1.ts\nimport Loaf from \"../../loaf\";\nimport { ISlice } from \"../../types/loaf\";\n\nexport enum NewEvents { \n  Initialize = \"module1:initialize\", // the text needs to be unique\n  RandomFunction = \"module1:random-func\",\n}\nexport type Module1Events = {\n  readonly [NewEvents.Initialize]?: (loaf: Loaf) => Promise<void>;\n  readonly [NewEvents.RandomFunction]?: (arg1: string, loaf: Loaf) => Promise<string>;\n}\nexport interface IModule1 extends ISlice, Module1Events {\n\n}\n\nconst module1: IModule1 = {\n  name: \"module1\",\n  [Loaf.Initialize]: async (loaf: Loaf) => {\n    loaf.setOptions(NewEvents.Initialize, {\n      ignoreReturn: true, // setting this means the that the first argument is ignored on return\n    });\n    await loaf.execute(NewEvents.Initialize, loaf);\n    return loaf;\n  },\n  [NewEvents.Initialize]: async (loaf: Loaf) => {\n    console.log(\"[module1](NewEvents.Initialize) - start\");\n    const result = await loaf.execute(NewEvents.RandomFunction, \"start\", loaf);\n    console.log(\"[module1](NewEvents.Initialize) - execute(NewEvents.RandomFunction) - result\", result);\n  },\n  [NewEvents.RandomFunction]: async (arg1: any, loaf: Loaf) => {\n    console.log(\"  [module1](NewEvents.RandomFunction) - prevResult\", arg1);\n    return \"module1\";\n  }\n}\nexport default module1;\n\n```\n\n```typescript\n// module2.ts\nimport Loaf from \"../../loaf\";\nimport { NewEvents } from \"./module1\";\n\nexport default {\n  name: \"module2\",\n  dependencies: [{\n    event: NewEvents.RandomFunction, // \n    required: {\n      before: [\"module1\"]\n    }\n  }, \"module3\"],\n  [NewEvents.Initialize]: async (loaf: Loaf) => {\n    console.log(\"[module2](NewEvents.Initialize)\");\n  },\n  [NewEvents.RandomFunction]: async (arg1: any, loaf: Loaf) => {\n    console.log(\"  [module2](NewEvents.RandomFunction) - prevResult\", arg1);\n    return \"module2\";\n  }\n\n}\n```\n\n```typescript\n// module3.ts\nimport Loaf from \"../../loaf\";\nimport { NewEvents } from \"./module1\";\n\nexport default {\n  name: \"module3\",\n  [NewEvents.Initialize]: async (loaf: Loaf) => {\n    console.log(\"[module3](NewEvents.Initialize)\");\n  },\n  [NewEvents.RandomFunction]: async (arg1: any, loaf: Loaf) => {\n    console.log(\"  [module3](NewEvents.RandomFunction) - prevResult\", arg1);\n    return \"module3\";\n  }\n}\n\n```\n\n```typescript\n\n// index.ts - Loader\nimport Loaf from \"../../loaf\";\nimport { URL } from 'url'; // in Browser, the URL in native accessible on window\n\nconst __dirname = new URL('.', import.meta.url).pathname;\n// console.log(__dirname);\nconst instance = new Loaf({\n  name: \"projectName\",\n  slices: [\"./module3.ts\", \"./module1.ts\", \"./module2.ts\"],\n  cwd: __dirname,\n});\n\nawait instance.start();\nawait instance.shutdown();\n```\nConsole Output\n```\n[module3](NewEvents.Initialize)\n[module2](NewEvents.Initialize)\n[module1](NewEvents.Initialize) - start\n  [module3](NewEvents.RandomFunction) - prevResult start\n  [module1](NewEvents.RandomFunction) - prevResult module3\n  [module2](NewEvents.RandomFunction) - prevResult module1\n[module1](NewEvents.Initialize) - execute(NewEvents.RandomFunction) - result module2\n```\n\n## Terms\n\nLoaf - the execution engine\nSlice - a module\nJam - the config\n","readmeFilename":"README.md"}