lanka 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +1 -1
  2. package/dist/{ILankaScenario-DQd9ZfUw.d.ts → ILankaScenario-7J3MoKiY.d.ts} +9 -0
  3. package/dist/{ILankaScenarioMetadata-BsDp0Bzm.d.ts → ILankaScenarioMetadata-DgOxvpwx.d.ts} +1 -1
  4. package/dist/LankaScenarioVMRegistry-CFzCpIFd.d.ts +46 -0
  5. package/dist/{LankaScenarioVMRegistry-DySAOaj2.d.ts → LankaScenariosRegistry-DiLN9xwy.d.ts} +3 -46
  6. package/dist/_extend/index.d.ts +27 -6
  7. package/dist/_extend/index.js +45 -39
  8. package/dist/_extend/index.js.map +1 -1
  9. package/dist/_internal/index.d.ts +5 -4
  10. package/dist/_internal/index.js +3 -1
  11. package/dist/_internal/index.js.map +1 -1
  12. package/dist/{activeRuntime-ByucLPhj.d.ts → activeRuntime-DxB62KN4.d.ts} +8 -4
  13. package/dist/bootstrap/index.d.ts +8 -7
  14. package/dist/bootstrap/index.js +11 -11
  15. package/dist/chunk-2ICKGQXS.js +21 -0
  16. package/dist/chunk-2ICKGQXS.js.map +1 -0
  17. package/dist/{chunk-MKKMTLOY.js → chunk-4VFVACSL.js} +38 -5
  18. package/dist/{chunk-MKKMTLOY.js.map → chunk-4VFVACSL.js.map} +1 -1
  19. package/dist/{chunk-SO7D5E7O.js → chunk-532WVMAF.js} +16 -16
  20. package/dist/chunk-532WVMAF.js.map +1 -0
  21. package/dist/{chunk-FII3PW2G.js → chunk-AMLUKB6A.js} +2 -2
  22. package/dist/{chunk-O5EUTNR6.js → chunk-DKLOCKS4.js} +2 -2
  23. package/dist/{chunk-42CWYVZJ.js → chunk-EH5WZSRJ.js} +5 -5
  24. package/dist/{chunk-RUMUFHSL.js → chunk-JGJBFELR.js} +2 -2
  25. package/dist/{chunk-NWEHOMTS.js → chunk-L27FF2IH.js} +3 -3
  26. package/dist/chunk-M4BK6GBV.js +90 -0
  27. package/dist/chunk-M4BK6GBV.js.map +1 -0
  28. package/dist/{chunk-BHQ2SQ7P.js → chunk-NMFNEVNE.js} +2 -2
  29. package/dist/{chunk-7DQUF2QR.js → chunk-SP5OUTWF.js} +2 -2
  30. package/dist/chunk-XTVEHYIZ.js +89 -0
  31. package/dist/chunk-XTVEHYIZ.js.map +1 -0
  32. package/dist/config/index.js +3 -3
  33. package/dist/{createLanka-DvUGu9Hl.d.ts → createLanka-AuiMfPL9.d.ts} +4 -4
  34. package/dist/{createLankaScope-CVoV0EwO.d.ts → createLankaScope-DeElRH-E.d.ts} +7 -1
  35. package/dist/errors/index.js +3 -3
  36. package/dist/gateway/index.js +6 -6
  37. package/dist/index.d.ts +8 -7
  38. package/dist/index.js +14 -14
  39. package/dist/locator/index.d.ts +111 -109
  40. package/dist/locator/index.js +35 -9
  41. package/dist/locator/index.js.map +1 -1
  42. package/dist/locator/scenario/lanka-scenario-locator/LankaScenarioLocator.d.ts +1 -1
  43. package/dist/locator/scenario/lanka-scenario-locator/LankaScenarioLocator.js +5 -5
  44. package/dist/logger/index.js +3 -3
  45. package/dist/mock/index.js +3 -3
  46. package/dist/scenario/index.d.ts +18 -4
  47. package/dist/scenario/index.js +5 -5
  48. package/dist/stream/index.d.ts +8 -7
  49. package/dist/viewmodel/index.d.ts +1 -1
  50. package/dist/viewmodel/index.js +7 -6
  51. package/dist/viewmodel/index.js.map +1 -1
  52. package/package.json +2 -2
  53. package/skills/lanka-core/SKILL.md +3 -1
  54. package/skills/lanka-core/reference.md +21 -1
  55. package/skills/lanka-packages/SKILL.md +1 -1
  56. package/dist/chunk-H5TIUKRK.js +0 -59
  57. package/dist/chunk-H5TIUKRK.js.map +0 -1
  58. package/dist/chunk-SBITVBF7.js +0 -49
  59. package/dist/chunk-SBITVBF7.js.map +0 -1
  60. package/dist/chunk-SO7D5E7O.js.map +0 -1
  61. package/dist/chunk-XGMXT4XZ.js +0 -46
  62. package/dist/chunk-XGMXT4XZ.js.map +0 -1
  63. /package/dist/{chunk-FII3PW2G.js.map → chunk-AMLUKB6A.js.map} +0 -0
  64. /package/dist/{chunk-O5EUTNR6.js.map → chunk-DKLOCKS4.js.map} +0 -0
  65. /package/dist/{chunk-42CWYVZJ.js.map → chunk-EH5WZSRJ.js.map} +0 -0
  66. /package/dist/{chunk-RUMUFHSL.js.map → chunk-JGJBFELR.js.map} +0 -0
  67. /package/dist/{chunk-NWEHOMTS.js.map → chunk-L27FF2IH.js.map} +0 -0
  68. /package/dist/{chunk-BHQ2SQ7P.js.map → chunk-NMFNEVNE.js.map} +0 -0
  69. /package/dist/{chunk-7DQUF2QR.js.map → chunk-SP5OUTWF.js.map} +0 -0
@@ -1,15 +1,9 @@
1
1
  import {
2
- createLankaLocatorProxy,
3
- lankaSharedStores,
4
- lankaSingletons
5
- } from "../chunk-H5TIUKRK.js";
6
- import "../chunk-3R2NO47A.js";
7
- import "../chunk-24MUFFHF.js";
8
- import "../chunk-JZJ6GXX3.js";
9
- import "../chunk-N3275IPH.js";
2
+ createLankaLocatorProxy
3
+ } from "../chunk-2ICKGQXS.js";
10
4
  import {
11
5
  requireActiveRuntime
12
- } from "../chunk-XGMXT4XZ.js";
6
+ } from "../chunk-XTVEHYIZ.js";
13
7
 
14
8
  // src/locator/gateway/_facades/lanka-gateways/lankaGateways.ts
15
9
  var gatewayLocator = {
@@ -59,6 +53,38 @@ var createLankaSingleton = (build) => {
59
53
  }
60
54
  return FunctionalSingleton;
61
55
  };
56
+
57
+ // src/locator/singleton/_facades/lanka-singletons/lankaSingletons.ts
58
+ var singletonLocator = {
59
+ get: (propertyName) => requireActiveRuntime().locators.singletons.get(propertyName)
60
+ };
61
+ var lankaSingletons = createLankaLocatorProxy({
62
+ locator: singletonLocator,
63
+ protectedProperties: [
64
+ "clearCache",
65
+ "register",
66
+ "registerInstance",
67
+ "unregister",
68
+ "isRegistered"
69
+ ],
70
+ errorPrefix: "Cannot access singleton"
71
+ });
72
+
73
+ // src/locator/shared-store/_facades/lanka-shared-stores/lankaSharedStores.ts
74
+ var sharedStoreLocator = {
75
+ get: (propertyName) => requireActiveRuntime().locators.sharedStores.get(propertyName)
76
+ };
77
+ var lankaSharedStores = createLankaLocatorProxy({
78
+ locator: sharedStoreLocator,
79
+ protectedProperties: [
80
+ "clearCache",
81
+ "register",
82
+ "registerInstance",
83
+ "unregister",
84
+ "isRegistered"
85
+ ],
86
+ errorPrefix: "Cannot access shared store"
87
+ });
62
88
  export {
63
89
  ALankaSingleton,
64
90
  createLankaSingleton,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/locator/gateway/_facades/lanka-gateways/lankaGateways.ts","../../src/locator/scenario/_facades/lanka-scenarios/lankaScenarios.ts","../../src/locator/singleton/_abstractions/lanka-singleton/ALankaSingleton.ts","../../src/locator/singleton/_factories/create-lanka-singleton/createLankaSingleton.ts"],"sourcesContent":["import { requireActiveRuntime } from \"../../../../_internal/active-runtime/activeRuntime\";\nimport type { ILankaLocator } from \"../../../_interfaces/ILankaLocator\";\nimport type { TLankaGateways } from \"../../_types/TLankaGateways\";\nimport { createLankaLocatorProxy } from \"../../../_factories/create-lanka-locator-proxy/createLankaLocatorProxy\";\nimport type { ALankaGateway } from \"../../../../gateway/_abstractions/lanka-gateway/ALankaGateway\";\n\n/**\n * The locator comes from the active instance rather than being created here.\n *\n * The cache of resolved objects is state, and module-level state would let two\n * frameworks in one process resolve the same gateway. The proxy stays at module\n * level because it has hundreds of call sites; only the cache moved.\n */\nconst gatewayLocator: ILankaLocator<ALankaGateway<unknown>> = {\n\tget: (propertyName: string) => requireActiveRuntime().locators.gateways.get(propertyName),\n};\n\n/**\n * Access to every gateway at once.\n *\n * An `ALankaGateway` subclass appears here by itself. The property is camelCase,\n * the gateway name is PascalCase.\n *\n * ```ts\n * import { lankaGateways } from \"lanka\";\n *\n * const user = await lankaGateways.userGateway.getById(1);\n * const list = await lankaGateways.companyGateway.getList({ page: 1 });\n * ```\n */\nexport const lankaGateways = createLankaLocatorProxy<ALankaGateway<unknown>, TLankaGateways>({\n\tlocator: gatewayLocator,\n\tprotectedProperties: [\"clearCache\"],\n\terrorPrefix: \"Cannot access gateway\",\n});\n","import { requireActiveRuntime } from \"../../../../_internal/active-runtime/activeRuntime\";\nimport type { ILankaLocator } from \"../../../_interfaces/ILankaLocator\";\nimport { createLankaLocatorProxy } from \"../../../_factories/create-lanka-locator-proxy/createLankaLocatorProxy\";\nimport type { ILankaScenario } from \"../../../../scenario/_interfaces/ILankaScenario\";\nimport { TLankaScenarios } from \"../../_types/TLankaScenarios\";\n\n/**\n * The locator comes from the active instance rather than being created here.\n *\n * The cache of resolved objects is state, and module-level state would let two\n * frameworks in one process resolve the same scenario. The proxy stays at module\n * level because it has hundreds of call sites; only the cache moved.\n */\nconst scenarioLocator: ILankaLocator<ILankaScenario<unknown>> = {\n\tget: (propertyName: string) => requireActiveRuntime().locators.scenarios.get(propertyName),\n};\n\n/**\n * Access to every scenario at once.\n *\n * An `ALankaScenario` subclass appears here by itself. The property is camelCase,\n * the scenario name is PascalCase.\n *\n * ```ts\n * import { lankaScenarios } from \"lanka\";\n *\n * lankaScenarios.sessionUpdated.trigger({ user });\n * lankaScenarios.usersListRefresh.trigger({ reason: \"create\" });\n *\n * lankaScenarios.usersListRefresh.subscribe((data) => { ... });\n * ```\n */\nexport const lankaScenarios = createLankaLocatorProxy<ILankaScenario<unknown>, TLankaScenarios>({\n\tlocator: scenarioLocator,\n\terrorPrefix: \"Cannot access scenario\",\n});\n","/**\n * The singleton marker: \"this class is published by the application in\n * `lankaSingletons`\".\n *\n * ## Why a marker when the class is exported anyway\n *\n * The other three locators have one: a gateway extends `ALankaGateway`, a\n * scenario has a `name`, a store extends `ALankaSharedStore`. Without a marker\n * the selection is \"anything that is a function with a prototype\", so a stray\n * export in the barrel — a helper, a companion class, an accidental re-export —\n * becomes part of the public `lankaSingletons.*`, and a typo in a name is caught\n * at runtime on first use, far from where it was made.\n *\n * ## A base class rather than a field\n *\n * A marker field can be put on anything, an object included, and the type would\n * again stop telling a class from a non-class. Inheritance also gives TypeScript\n * something it can select on in a mapped type.\n *\n * The class is empty deliberately: all it carries is the statement \"I am meant\n * for the locator\".\n */\nexport abstract class ALankaSingleton {\n\t/**\n\t * A runtime check, for the locator, which cannot see types.\n\t *\n\t * Looks at the prototype chain rather than the name: names are lost to\n\t * minification, and a name check would work only until the build.\n\t */\n\tstatic is(candidate: unknown): boolean {\n\t\tif (typeof candidate !== \"function\") return false;\n\n\t\tlet proto: unknown = Object.getPrototypeOf(candidate) as unknown;\n\t\twhile (typeof proto === \"function\") {\n\t\t\tif (proto === ALankaSingleton) return true;\n\t\t\tproto = Object.getPrototypeOf(proto) as unknown;\n\t\t}\n\t\treturn false;\n\t}\n}\n","import { ALankaSingleton } from \"../../_abstractions/lanka-singleton/ALankaSingleton\";\n\n/**\n * The functional style of `ALankaSingleton`: a singleton declared by a function.\n *\n * A singleton is a role — an application writes many — and this is the same role\n * the class style declares by extending the marker. What comes back IS a subclass\n * of `ALankaSingleton`, so the locator discovers it in the consumer's barrel,\n * builds it on first use and caches it, exactly as it does a hand-written class.\n *\n * ```ts\n * export const PlaygroundClock = createLankaSingleton(() => ({\n * \tnow: () => Date.now(),\n * }));\n * ```\n *\n * The result is exported under a PascalCase name because it is a class: the\n * locator resolves `lankaSingletons.playgroundClock` by that export name, and a\n * camelCase one would read as the instance while being the constructor.\n *\n * The builder runs at first resolution, not here — a singleton declared in a\n * module body must not touch a runtime that does not exist yet. Canon:\n * `skills/parity/SKILL.md`.\n */\nexport const createLankaSingleton = <TInstance extends object>(\n\tbuild: () => TInstance,\n): new () => TInstance => {\n\tclass FunctionalSingleton extends ALankaSingleton {\n\t\tpublic constructor() {\n\t\t\tsuper();\n\n\t\t\t// A constructor answering an object is what makes the two styles one\n\t\t\t// implementation: the locator constructs a marked class either way, and\n\t\t\t// what it gets back is what the builder returned.\n\t\t\treturn build();\n\t\t}\n\t}\n\n\treturn FunctionalSingleton as unknown as new () => TInstance;\n};\n"],"mappings":";;;;;;;;;;;;;;AAaA,IAAM,iBAAwD;AAAA,EAC7D,KAAK,CAAC,iBAAyB,qBAAqB,EAAE,SAAS,SAAS,IAAI,YAAY;AACzF;AAeO,IAAM,gBAAgB,wBAAgE;AAAA,EAC5F,SAAS;AAAA,EACT,qBAAqB,CAAC,YAAY;AAAA,EAClC,aAAa;AACd,CAAC;;;ACrBD,IAAM,kBAA0D;AAAA,EAC/D,KAAK,CAAC,iBAAyB,qBAAqB,EAAE,SAAS,UAAU,IAAI,YAAY;AAC1F;AAiBO,IAAM,iBAAiB,wBAAkE;AAAA,EAC/F,SAAS;AAAA,EACT,aAAa;AACd,CAAC;;;ACbM,IAAe,kBAAf,MAAe,iBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrC,OAAO,GAAG,WAA6B;AACtC,QAAI,OAAO,cAAc,WAAY,QAAO;AAE5C,QAAI,QAAiB,OAAO,eAAe,SAAS;AACpD,WAAO,OAAO,UAAU,YAAY;AACnC,UAAI,UAAU,iBAAiB,QAAO;AACtC,cAAQ,OAAO,eAAe,KAAK;AAAA,IACpC;AACA,WAAO;AAAA,EACR;AACD;;;ACfO,IAAM,uBAAuB,CACnC,UACyB;AAAA,EACzB,MAAM,4BAA4B,gBAAgB;AAAA,IAC1C,cAAc;AACpB,YAAM;AAKN,aAAO,MAAM;AAAA,IACd;AAAA,EACD;AAEA,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../../src/locator/gateway/_facades/lanka-gateways/lankaGateways.ts","../../src/locator/scenario/_facades/lanka-scenarios/lankaScenarios.ts","../../src/locator/singleton/_abstractions/lanka-singleton/ALankaSingleton.ts","../../src/locator/singleton/_factories/create-lanka-singleton/createLankaSingleton.ts","../../src/locator/singleton/_facades/lanka-singletons/lankaSingletons.ts","../../src/locator/shared-store/_facades/lanka-shared-stores/lankaSharedStores.ts"],"sourcesContent":["import { requireActiveRuntime } from \"../../../../_internal/active-runtime/activeRuntime\";\nimport type { ILankaLocator } from \"../../../_interfaces/ILankaLocator\";\nimport type { TLankaGateways } from \"../../_types/TLankaGateways\";\nimport { createLankaLocatorProxy } from \"../../../_factories/create-lanka-locator-proxy/createLankaLocatorProxy\";\nimport type { ALankaGateway } from \"../../../../gateway/_abstractions/lanka-gateway/ALankaGateway\";\n\n/**\n * The locator comes from the active instance rather than being created here.\n *\n * The cache of resolved objects is state, and module-level state would let two\n * frameworks in one process resolve the same gateway. The proxy stays at module\n * level because it has hundreds of call sites; only the cache moved.\n */\nconst gatewayLocator: ILankaLocator<ALankaGateway<unknown>> = {\n\tget: (propertyName: string) => requireActiveRuntime().locators.gateways.get(propertyName),\n};\n\n/**\n * Access to every gateway at once.\n *\n * An `ALankaGateway` subclass appears here by itself. The property is camelCase,\n * the gateway name is PascalCase.\n *\n * ```ts\n * import { lankaGateways } from \"lanka\";\n *\n * const user = await lankaGateways.userGateway.getById(1);\n * const list = await lankaGateways.companyGateway.getList({ page: 1 });\n * ```\n */\nexport const lankaGateways = createLankaLocatorProxy<ALankaGateway<unknown>, TLankaGateways>({\n\tlocator: gatewayLocator,\n\tprotectedProperties: [\"clearCache\"],\n\terrorPrefix: \"Cannot access gateway\",\n});\n","import { requireActiveRuntime } from \"../../../../_internal/active-runtime/activeRuntime\";\nimport type { ILankaLocator } from \"../../../_interfaces/ILankaLocator\";\nimport { createLankaLocatorProxy } from \"../../../_factories/create-lanka-locator-proxy/createLankaLocatorProxy\";\nimport type { ILankaScenario } from \"../../../../scenario/_interfaces/ILankaScenario\";\nimport { TLankaScenarios } from \"../../_types/TLankaScenarios\";\n\n/**\n * The locator comes from the active instance rather than being created here.\n *\n * The cache of resolved objects is state, and module-level state would let two\n * frameworks in one process resolve the same scenario. The proxy stays at module\n * level because it has hundreds of call sites; only the cache moved.\n */\nconst scenarioLocator: ILankaLocator<ILankaScenario<unknown>> = {\n\tget: (propertyName: string) => requireActiveRuntime().locators.scenarios.get(propertyName),\n};\n\n/**\n * Access to every scenario at once.\n *\n * An `ALankaScenario` subclass appears here by itself. The property is camelCase,\n * the scenario name is PascalCase.\n *\n * ```ts\n * import { lankaScenarios } from \"lanka\";\n *\n * lankaScenarios.sessionUpdated.trigger({ user });\n * lankaScenarios.usersListRefresh.trigger({ reason: \"create\" });\n *\n * lankaScenarios.usersListRefresh.subscribe((data) => { ... });\n * ```\n */\nexport const lankaScenarios = createLankaLocatorProxy<ILankaScenario<unknown>, TLankaScenarios>({\n\tlocator: scenarioLocator,\n\terrorPrefix: \"Cannot access scenario\",\n});\n","/**\n * The singleton marker: \"this class is published by the application in\n * `lankaSingletons`\".\n *\n * ## Why a marker when the class is exported anyway\n *\n * The other three locators have one: a gateway extends `ALankaGateway`, a\n * scenario has a `name`, a store extends `ALankaSharedStore`. Without a marker\n * the selection is \"anything that is a function with a prototype\", so a stray\n * export in the barrel — a helper, a companion class, an accidental re-export —\n * becomes part of the public `lankaSingletons.*`, and a typo in a name is caught\n * at runtime on first use, far from where it was made.\n *\n * ## A base class rather than a field\n *\n * A marker field can be put on anything, an object included, and the type would\n * again stop telling a class from a non-class. Inheritance also gives TypeScript\n * something it can select on in a mapped type.\n *\n * The class is empty deliberately: all it carries is the statement \"I am meant\n * for the locator\".\n */\nexport abstract class ALankaSingleton {\n\t/**\n\t * A runtime check, for the locator, which cannot see types.\n\t *\n\t * Looks at the prototype chain rather than the name: names are lost to\n\t * minification, and a name check would work only until the build.\n\t */\n\tstatic is(candidate: unknown): boolean {\n\t\tif (typeof candidate !== \"function\") return false;\n\n\t\tlet proto: unknown = Object.getPrototypeOf(candidate) as unknown;\n\t\twhile (typeof proto === \"function\") {\n\t\t\tif (proto === ALankaSingleton) return true;\n\t\t\tproto = Object.getPrototypeOf(proto) as unknown;\n\t\t}\n\t\treturn false;\n\t}\n}\n","import { ALankaSingleton } from \"../../_abstractions/lanka-singleton/ALankaSingleton\";\n\n/**\n * The functional style of `ALankaSingleton`: a singleton declared by a function.\n *\n * A singleton is a role — an application writes many — and this is the same role\n * the class style declares by extending the marker. What comes back IS a subclass\n * of `ALankaSingleton`, so the locator discovers it in the consumer's barrel,\n * builds it on first use and caches it, exactly as it does a hand-written class.\n *\n * ```ts\n * export const PlaygroundClock = createLankaSingleton(() => ({\n * \tnow: () => Date.now(),\n * }));\n * ```\n *\n * The result is exported under a PascalCase name because it is a class: the\n * locator resolves `lankaSingletons.playgroundClock` by that export name, and a\n * camelCase one would read as the instance while being the constructor.\n *\n * The builder runs at first resolution, not here — a singleton declared in a\n * module body must not touch a runtime that does not exist yet. Canon:\n * `skills/parity/SKILL.md`.\n */\nexport const createLankaSingleton = <TInstance extends object>(\n\tbuild: () => TInstance,\n): new () => TInstance => {\n\tclass FunctionalSingleton extends ALankaSingleton {\n\t\tpublic constructor() {\n\t\t\tsuper();\n\n\t\t\t// A constructor answering an object is what makes the two styles one\n\t\t\t// implementation: the locator constructs a marked class either way, and\n\t\t\t// what it gets back is what the builder returned.\n\t\t\treturn build();\n\t\t}\n\t}\n\n\treturn FunctionalSingleton as unknown as new () => TInstance;\n};\n","import { requireActiveRuntime } from \"../../../../_internal/active-runtime/activeRuntime\";\nimport type { ILankaLocator } from \"../../../_interfaces/ILankaLocator\";\nimport type { TLankaSingletons } from \"../../../_types/TLankaSingletons\";\nimport { createLankaLocatorProxy } from \"../../../_factories/create-lanka-locator-proxy/createLankaLocatorProxy\";\n\n/**\n * Access to every singleton at once.\n *\n * A class appears here by itself as soon as the consumer's barrel exports it.\n * The property is camelCase, the class name PascalCase.\n *\n * ```ts\n * import { lankaSingletons } from \"lanka\";\n *\n * const profile = lankaSingletons.userProfile;\n * ```\n *\n * `LankaSingletonLocator` itself registers a class or a ready object by hand —\n * for tests and for objects that arrive already built. Those methods are NOT\n * called through this proxy: `registerSingleton`,\n * `registerSingletonInstance`, `unregisterSingleton`, `isRegistered` and\n * `clearCache` are closed here deliberately, or reaching for them would read as\n * a request for a singleton by that name and the failure would come from the\n * wrong place.\n */\n/**\n * The locator comes from the active instance rather than being created here.\n *\n * The cache of resolved objects is state, and module-level state means two\n * frameworks in one process resolve the same gateway. The proxy stays in\n * place; what moved is the cache.\n */\nconst singletonLocator: ILankaLocator<unknown> = {\n\tget: (propertyName: string) => requireActiveRuntime().locators.singletons.get(propertyName),\n};\n\nexport const lankaSingletons = createLankaLocatorProxy<unknown, TLankaSingletons>({\n\tlocator: singletonLocator,\n\tprotectedProperties: [\n\t\t\"clearCache\",\n\t\t\"register\",\n\t\t\"registerInstance\",\n\t\t\"unregister\",\n\t\t\"isRegistered\",\n\t],\n\terrorPrefix: \"Cannot access singleton\",\n});\n","import { requireActiveRuntime } from \"../../../../_internal/active-runtime/activeRuntime\";\nimport type { ILankaLocator } from \"../../../_interfaces/ILankaLocator\";\nimport { createLankaLocatorProxy } from \"../../../_factories/create-lanka-locator-proxy/createLankaLocatorProxy\";\nimport { ALankaSharedStore } from \"../../../../viewmodel/_abstractions/lanka-shared-store/ALankaSharedStore\";\nimport type { TLankaSharedStores } from \"../../_types/TLankaSharedStores\";\n\n/**\n * The locator comes from the active instance rather than being created here.\n *\n * The cache of resolved objects is state, and module-level state would let two\n * frameworks in one process resolve the same store. The proxy stays at module\n * level because it has hundreds of call sites; only the cache moved.\n */\nconst sharedStoreLocator: ILankaLocator<ALankaSharedStore<object>> = {\n\tget: (propertyName: string) => requireActiveRuntime().locators.sharedStores.get(propertyName),\n};\n\n/**\n * Access to every shared store at once.\n *\n * An `ALankaSharedStore` subclass appears here by itself once it is exported from\n * `@lanka_di/SharedStores`. The property is camelCase, the class name PascalCase.\n */\nexport const lankaSharedStores = createLankaLocatorProxy<\n\tALankaSharedStore<object>,\n\tTLankaSharedStores\n>({\n\tlocator: sharedStoreLocator,\n\tprotectedProperties: [\n\t\t\"clearCache\",\n\t\t\"register\",\n\t\t\"registerInstance\",\n\t\t\"unregister\",\n\t\t\"isRegistered\",\n\t],\n\terrorPrefix: \"Cannot access shared store\",\n});\n"],"mappings":";;;;;;;;AAaA,IAAM,iBAAwD;AAAA,EAC7D,KAAK,CAAC,iBAAyB,qBAAqB,EAAE,SAAS,SAAS,IAAI,YAAY;AACzF;AAeO,IAAM,gBAAgB,wBAAgE;AAAA,EAC5F,SAAS;AAAA,EACT,qBAAqB,CAAC,YAAY;AAAA,EAClC,aAAa;AACd,CAAC;;;ACrBD,IAAM,kBAA0D;AAAA,EAC/D,KAAK,CAAC,iBAAyB,qBAAqB,EAAE,SAAS,UAAU,IAAI,YAAY;AAC1F;AAiBO,IAAM,iBAAiB,wBAAkE;AAAA,EAC/F,SAAS;AAAA,EACT,aAAa;AACd,CAAC;;;ACbM,IAAe,kBAAf,MAAe,iBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrC,OAAO,GAAG,WAA6B;AACtC,QAAI,OAAO,cAAc,WAAY,QAAO;AAE5C,QAAI,QAAiB,OAAO,eAAe,SAAS;AACpD,WAAO,OAAO,UAAU,YAAY;AACnC,UAAI,UAAU,iBAAiB,QAAO;AACtC,cAAQ,OAAO,eAAe,KAAK;AAAA,IACpC;AACA,WAAO;AAAA,EACR;AACD;;;ACfO,IAAM,uBAAuB,CACnC,UACyB;AAAA,EACzB,MAAM,4BAA4B,gBAAgB;AAAA,IAC1C,cAAc;AACpB,YAAM;AAKN,aAAO,MAAM;AAAA,IACd;AAAA,EACD;AAEA,SAAO;AACR;;;ACPA,IAAM,mBAA2C;AAAA,EAChD,KAAK,CAAC,iBAAyB,qBAAqB,EAAE,SAAS,WAAW,IAAI,YAAY;AAC3F;AAEO,IAAM,kBAAkB,wBAAmD;AAAA,EACjF,SAAS;AAAA,EACT,qBAAqB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,aAAa;AACd,CAAC;;;ACjCD,IAAM,qBAA+D;AAAA,EACpE,KAAK,CAAC,iBAAyB,qBAAqB,EAAE,SAAS,aAAa,IAAI,YAAY;AAC7F;AAQO,IAAM,oBAAoB,wBAG/B;AAAA,EACD,SAAS;AAAA,EACT,qBAAqB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,aAAa;AACd,CAAC;","names":[]}
@@ -1,4 +1,4 @@
1
- import { I as ILankaScenario } from '../../../ILankaScenario-DQd9ZfUw.js';
1
+ import { I as ILankaScenario } from '../../../ILankaScenario-7J3MoKiY.js';
2
2
  import { A as ALankaLocator } from '../../../ALankaLocator-BUCCz0Q5.js';
3
3
 
4
4
  /**
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  LankaScenarioLocator
3
- } from "../../../chunk-42CWYVZJ.js";
4
- import "../../../chunk-NWEHOMTS.js";
3
+ } from "../../../chunk-EH5WZSRJ.js";
5
4
  import "../../../chunk-N3275IPH.js";
6
- import "../../../chunk-FII3PW2G.js";
7
- import "../../../chunk-7DQUF2QR.js";
8
- import "../../../chunk-XGMXT4XZ.js";
5
+ import "../../../chunk-L27FF2IH.js";
6
+ import "../../../chunk-AMLUKB6A.js";
7
+ import "../../../chunk-SP5OUTWF.js";
8
+ import "../../../chunk-XTVEHYIZ.js";
9
9
  export {
10
10
  LankaScenarioLocator
11
11
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  LankaLogger,
3
3
  lankaLogger
4
- } from "../chunk-FII3PW2G.js";
5
- import "../chunk-7DQUF2QR.js";
6
- import "../chunk-XGMXT4XZ.js";
4
+ } from "../chunk-AMLUKB6A.js";
5
+ import "../chunk-SP5OUTWF.js";
6
+ import "../chunk-XTVEHYIZ.js";
7
7
  export {
8
8
  LankaLogger,
9
9
  lankaLogger
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  lankaLogger
3
- } from "../chunk-FII3PW2G.js";
3
+ } from "../chunk-AMLUKB6A.js";
4
4
  import {
5
5
  getLankaFlags
6
- } from "../chunk-7DQUF2QR.js";
7
- import "../chunk-XGMXT4XZ.js";
6
+ } from "../chunk-SP5OUTWF.js";
7
+ import "../chunk-XTVEHYIZ.js";
8
8
 
9
9
  // src/_internal/sleep.ts
10
10
  var sleep = (ms = 300) => {
@@ -1,7 +1,7 @@
1
- import { I as ILankaScenario, T as TLankaReplayRequest, a as ILankaEventMetadata, b as TLankaEventBusMiddleware, c as TLankaEventBusObserver, d as ILankaEventLog } from '../ILankaScenario-DQd9ZfUw.js';
2
- export { e as ILankaEventBusOutcome, f as TLankaEventBusDecision } from '../ILankaScenario-DQd9ZfUw.js';
1
+ import { I as ILankaScenario, T as TLankaReplayRequest, a as ILankaEventMetadata, b as TLankaEventBusMiddleware, c as TLankaEventBusObserver, d as ILankaEventLog } from '../ILankaScenario-7J3MoKiY.js';
2
+ export { e as ILankaEventBusOutcome, f as TLankaEventBusDecision } from '../ILankaScenario-7J3MoKiY.js';
3
3
  import { I as ILankaScenarioVM } from '../ILankaScenarioVM-DKwjbIRq.js';
4
- export { I as ILankaScenarioMetadata } from '../ILankaScenarioMetadata-BsDp0Bzm.js';
4
+ export { I as ILankaScenarioMetadata } from '../ILankaScenarioMetadata-DgOxvpwx.js';
5
5
 
6
6
  /**
7
7
  * The base of a scenario — a named unit of coordination over the event bus.
@@ -240,6 +240,8 @@ declare class LankaScenarioBootstrap {
240
240
  * suite stays green and the leak is one user seeing another's board.
241
241
  */
242
242
  private isBuildingScoped;
243
+ /** Who is told about each scoped registration while `buildScoped` runs. */
244
+ private scopedRegistrations;
243
245
  /**
244
246
  * Runs `build` with its declarations kept OUT of the process-wide list.
245
247
  *
@@ -248,7 +250,19 @@ declare class LankaScenarioBootstrap {
248
250
  * have to carry a flag through to `registerViewModel`, and eight of them have
249
251
  * no business knowing what a scope is.
250
252
  */
251
- buildScoped<TBuilt>(build: () => TBuilt): TBuilt;
253
+ buildScoped<TBuilt>(build: () => TBuilt, onRegistered?: (viewModel: ILankaScenarioVM) => void): TBuilt;
254
+ /**
255
+ * The scoped state as it is NOW, as a runner that re-enters it later.
256
+ *
257
+ * For a build that is deferred past the window `buildScoped` opened — a lazy
258
+ * ViewModel builds on its first read, after `resolveLankaVM` has returned.
259
+ * Without it that build would run under whatever state is current at the
260
+ * read: outside every scope, so a scoped ViewModel would join the
261
+ * process-wide list every later instance adopts; or inside SOMEBODY ELSE'S,
262
+ * so a module-level one first read during another scope's build would die
263
+ * with that scope. Captured at creation, it belongs where it was declared.
264
+ */
265
+ captureScoped(): <TBuilt>(build: () => TBuilt) => TBuilt;
252
266
  registerViewModel(viewModel: ILankaScenarioVM, name?: string): void;
253
267
  private attachViewModel;
254
268
  /**
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  lankaScenarioBootstrap
3
- } from "../chunk-MKKMTLOY.js";
3
+ } from "../chunk-4VFVACSL.js";
4
4
  import {
5
5
  ALankaScenario,
6
6
  lankaEventBus
7
- } from "../chunk-NWEHOMTS.js";
8
- import "../chunk-FII3PW2G.js";
9
- import "../chunk-7DQUF2QR.js";
10
- import "../chunk-XGMXT4XZ.js";
7
+ } from "../chunk-L27FF2IH.js";
8
+ import "../chunk-AMLUKB6A.js";
9
+ import "../chunk-SP5OUTWF.js";
10
+ import "../chunk-XTVEHYIZ.js";
11
11
 
12
12
  // src/scenario/_factories/create-lanka-scenario/createLankaScenario.ts
13
13
  var createLankaScenario = (config) => {
@@ -1,12 +1,13 @@
1
- import { c as ILankaPlugin } from '../createLanka-DvUGu9Hl.js';
2
- import '../createLankaScope-CVoV0EwO.js';
1
+ import { c as ILankaPlugin } from '../createLanka-AuiMfPL9.js';
2
+ import '../createLankaScope-DeElRH-E.js';
3
+ import '../LankaScenarioVMRegistry-CFzCpIFd.js';
4
+ import '../ILankaScenarioVM-DKwjbIRq.js';
3
5
  import '../locator/singleton/lanka-singleton-locator/LankaSingletonLocator.js';
4
6
  import '../ALankaLocator-BUCCz0Q5.js';
5
- import '../activeRuntime-ByucLPhj.js';
6
- import '../ILankaScenario-DQd9ZfUw.js';
7
- import '../LankaScenarioVMRegistry-DySAOaj2.js';
8
- import '../ILankaScenarioVM-DKwjbIRq.js';
9
- import '../ILankaScenarioMetadata-BsDp0Bzm.js';
7
+ import '../activeRuntime-DxB62KN4.js';
8
+ import '../ILankaScenario-7J3MoKiY.js';
9
+ import '../LankaScenariosRegistry-DiLN9xwy.js';
10
+ import '../ILankaScenarioMetadata-DgOxvpwx.js';
10
11
  import '../ILankaRuntimeConfig-Vl436GWK.js';
11
12
  import '../lankaHttpInFlight-Bk1eIuSx.js';
12
13
  import '../lankaRequestMiddleware-DAC5kCb7.js';
@@ -1,7 +1,7 @@
1
1
  import { I as ILankaReadableVM } from '../ILankaReadableVM-BoPzHEPV.js';
2
2
  import { I as ILankaScenarioVM } from '../ILankaScenarioVM-DKwjbIRq.js';
3
3
  import { StoreApi, StateCreator } from 'zustand';
4
- import { I as ILankaScenario, T as TLankaReplayRequest } from '../ILankaScenario-DQd9ZfUw.js';
4
+ import { I as ILankaScenario, T as TLankaReplayRequest } from '../ILankaScenario-7J3MoKiY.js';
5
5
  import { A as ALankaSharedStore } from '../ALankaSharedStore-B7uepuuk.js';
6
6
  import { StoreApi as StoreApi$1 } from 'zustand/vanilla';
7
7
 
@@ -3,15 +3,15 @@ import {
3
3
  } from "../chunk-UDP6IXDS.js";
4
4
  import {
5
5
  lankaScenarioBootstrap
6
- } from "../chunk-MKKMTLOY.js";
7
- import "../chunk-NWEHOMTS.js";
6
+ } from "../chunk-4VFVACSL.js";
7
+ import "../chunk-L27FF2IH.js";
8
8
  import {
9
9
  lankaLogger
10
- } from "../chunk-FII3PW2G.js";
10
+ } from "../chunk-AMLUKB6A.js";
11
11
  import {
12
12
  getLankaFlags
13
- } from "../chunk-7DQUF2QR.js";
14
- import "../chunk-XGMXT4XZ.js";
13
+ } from "../chunk-SP5OUTWF.js";
14
+ import "../chunk-XTVEHYIZ.js";
15
15
 
16
16
  // src/viewmodel/_abstractions/lanka-vm-environment/ALankaVMEnvironment.ts
17
17
  var ALankaVMEnvironment = class _ALankaVMEnvironment {
@@ -330,6 +330,7 @@ function createLankaVM(config) {
330
330
  // src/viewmodel/_internal/create-lazy-lanka-vm-proxy/createLazyLankaVMProxy.ts
331
331
  var lazySlot = (config) => {
332
332
  let store = null;
333
+ const buildWhereDeclared = lankaScenarioBootstrap.captureScoped();
333
334
  return {
334
335
  get: () => {
335
336
  if (!store) {
@@ -337,7 +338,7 @@ var lazySlot = (config) => {
337
338
  `LAZY: Creating ${config.kind} on first access`,
338
339
  config.name
339
340
  );
340
- store = config.create();
341
+ store = buildWhereDeclared(config.create);
341
342
  }
342
343
  return store;
343
344
  },