lanka 2.2.0 → 2.2.2

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 (57) hide show
  1. package/README.md +3 -3
  2. package/dist/{ALankaGateway-BrVPaZN5.d.ts → ALankaGateway-CzBISB0L.d.ts} +0 -15
  3. package/dist/_extend/index.d.ts +1 -1
  4. package/dist/_extend/index.js +20 -20
  5. package/dist/_internal/index.d.ts +1 -1
  6. package/dist/_internal/index.js +1 -1
  7. package/dist/bootstrap/index.d.ts +3 -3
  8. package/dist/bootstrap/index.js +11 -11
  9. package/dist/chunk-2ICKGQXS.js +21 -0
  10. package/dist/chunk-2ICKGQXS.js.map +1 -0
  11. package/dist/{chunk-JX47U5DC.js → chunk-4VFVACSL.js} +4 -4
  12. package/dist/{chunk-6TNWBT6T.js → chunk-AMLUKB6A.js} +2 -2
  13. package/dist/{chunk-HYT5NSIB.js → chunk-DKLOCKS4.js} +2 -2
  14. package/dist/{chunk-IB2LRYDK.js → chunk-EH5WZSRJ.js} +5 -5
  15. package/dist/{chunk-BZNDUUTA.js → chunk-JGJBFELR.js} +2 -2
  16. package/dist/{chunk-UX4A7TBG.js → chunk-JLBSXJRX.js} +14 -14
  17. package/dist/chunk-JLBSXJRX.js.map +1 -0
  18. package/dist/{chunk-RZGBLXXL.js → chunk-L27FF2IH.js} +3 -3
  19. package/dist/{chunk-3OQ3JZGT.js → chunk-M4BK6GBV.js} +2 -2
  20. package/dist/{chunk-NPJSZLTB.js → chunk-NMFNEVNE.js} +2 -2
  21. package/dist/{chunk-FR2FRJME.js → chunk-SP5OUTWF.js} +2 -2
  22. package/dist/{chunk-MLKTN4OV.js → chunk-XTVEHYIZ.js} +20 -7
  23. package/dist/{chunk-MLKTN4OV.js.map → chunk-XTVEHYIZ.js.map} +1 -1
  24. package/dist/config/index.js +3 -3
  25. package/dist/{createLanka-DxKZkmWe.d.ts → createLanka-AuiMfPL9.d.ts} +2 -2
  26. package/dist/errors/index.js +3 -3
  27. package/dist/gateway/index.d.ts +2 -2
  28. package/dist/gateway/index.js +20 -28
  29. package/dist/gateway/index.js.map +1 -1
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +17 -17
  32. package/dist/locator/gateway/lanka-gateway-locator/LankaGatewayLocator.d.ts +1 -1
  33. package/dist/locator/index.d.ts +109 -109
  34. package/dist/locator/index.js +35 -9
  35. package/dist/locator/index.js.map +1 -1
  36. package/dist/locator/scenario/lanka-scenario-locator/LankaScenarioLocator.js +5 -5
  37. package/dist/logger/index.js +3 -3
  38. package/dist/mock/index.js +3 -3
  39. package/dist/scenario/index.js +5 -5
  40. package/dist/stream/index.d.ts +2 -2
  41. package/dist/viewmodel/index.js +5 -5
  42. package/package.json +2 -2
  43. package/skills/lanka-core/SKILL.md +3 -1
  44. package/skills/lanka-core/reference.md +8 -1
  45. package/skills/lanka-packages/SKILL.md +1 -1
  46. package/dist/chunk-R365QEN2.js +0 -59
  47. package/dist/chunk-R365QEN2.js.map +0 -1
  48. package/dist/chunk-UX4A7TBG.js.map +0 -1
  49. /package/dist/{chunk-JX47U5DC.js.map → chunk-4VFVACSL.js.map} +0 -0
  50. /package/dist/{chunk-6TNWBT6T.js.map → chunk-AMLUKB6A.js.map} +0 -0
  51. /package/dist/{chunk-HYT5NSIB.js.map → chunk-DKLOCKS4.js.map} +0 -0
  52. /package/dist/{chunk-IB2LRYDK.js.map → chunk-EH5WZSRJ.js.map} +0 -0
  53. /package/dist/{chunk-BZNDUUTA.js.map → chunk-JGJBFELR.js.map} +0 -0
  54. /package/dist/{chunk-RZGBLXXL.js.map → chunk-L27FF2IH.js.map} +0 -0
  55. /package/dist/{chunk-3OQ3JZGT.js.map → chunk-M4BK6GBV.js.map} +0 -0
  56. /package/dist/{chunk-NPJSZLTB.js.map → chunk-NMFNEVNE.js.map} +0 -0
  57. /package/dist/{chunk-FR2FRJME.js.map → chunk-SP5OUTWF.js.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  export { I as ILankaScope } from '../createLankaScope-DeElRH-E.js';
2
2
  export { a as ILankaLocator, I as ILankaLocatorConfig } from '../ALankaLocator-BUCCz0Q5.js';
3
3
  import * as GatewaysModule from '@lanka_di/Gateways';
4
- import { A as ALankaGateway } from '../ALankaGateway-BrVPaZN5.js';
4
+ import { A as ALankaGateway } from '../ALankaGateway-CzBISB0L.js';
5
5
  import * as ScenariosModule from '@lanka_di/Scenarios';
6
6
  import * as SingletonsModule from '@lanka_di/Singletons';
7
+ export { ILankaSingletonLocatorConfig } from './singleton/lanka-singleton-locator/LankaSingletonLocator.js';
7
8
  import * as SharedStoresModule from '@lanka_di/SharedStores';
8
9
  import { A as ALankaSharedStore } from '../ALankaSharedStore-B7uepuuk.js';
9
10
  export { ILankaSharedStoreLocatorConfig } from './shared-store/lanka-shared-store-locator/LankaSharedStoreLocator.js';
10
- export { ILankaSingletonLocatorConfig } from './singleton/lanka-singleton-locator/LankaSingletonLocator.js';
11
11
  import '../LankaScenarioVMRegistry-CFzCpIFd.js';
12
12
  import '../ILankaScenarioVM-DKwjbIRq.js';
13
13
  import '../lankaStandardValidator-BUFnysK0.js';
@@ -15,109 +15,6 @@ import '@standard-schema/spec';
15
15
  import '../ILankaFieldError-D5931-vT.js';
16
16
  import 'zustand/vanilla';
17
17
 
18
- /**
19
- * The singleton marker: "this class is published by the application in
20
- * `lankaSingletons`".
21
- *
22
- * ## Why a marker when the class is exported anyway
23
- *
24
- * The other three locators have one: a gateway extends `ALankaGateway`, a
25
- * scenario has a `name`, a store extends `ALankaSharedStore`. Without a marker
26
- * the selection is "anything that is a function with a prototype", so a stray
27
- * export in the barrel — a helper, a companion class, an accidental re-export —
28
- * becomes part of the public `lankaSingletons.*`, and a typo in a name is caught
29
- * at runtime on first use, far from where it was made.
30
- *
31
- * ## A base class rather than a field
32
- *
33
- * A marker field can be put on anything, an object included, and the type would
34
- * again stop telling a class from a non-class. Inheritance also gives TypeScript
35
- * something it can select on in a mapped type.
36
- *
37
- * The class is empty deliberately: all it carries is the statement "I am meant
38
- * for the locator".
39
- */
40
- declare abstract class ALankaSingleton {
41
- /**
42
- * A runtime check, for the locator, which cannot see types.
43
- *
44
- * Looks at the prototype chain rather than the name: names are lost to
45
- * minification, and a name check would work only until the build.
46
- */
47
- static is(candidate: unknown): boolean;
48
- }
49
-
50
- /**
51
- * Singleton classes, read from the consumer's barrel.
52
- *
53
- * Adding one takes two steps and no registration:
54
- *
55
- * 1. write the class;
56
- * 2. add ONE export line to `.lanka_di/lankaSingletons.ts` at the project root.
57
- *
58
- * The type below is derived from that module's exports, so the property name
59
- * and the instance type appear by themselves.
60
- */
61
-
62
- /**
63
- * Turns a PascalCase class name into a camelCase property name: `UserProfile` → `userProfile`.
64
- */
65
- type TPascalToCamelCase$3<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
66
- /** Whether a type is a class constructor. */
67
- /**
68
- * A class marked as a singleton.
69
- *
70
- * Selecting on "is a constructor" admits anything, so a stray barrel export
71
- * silently becomes part of the public `lankaSingletons.*` and a typo is caught at
72
- * runtime on first use.
73
- */
74
- type TIsSingletonClass<T> = T extends new () => infer Instance ? Instance extends ALankaSingleton ? true : false : false;
75
- /**
76
- * Builds the singletons type from the barrel's exports.
77
- *
78
- * Derived automatically; no list has to be maintained by hand.
79
- */
80
- type TLankaSingletons = {
81
- [K in keyof typeof SingletonsModule as TIsSingletonClass<(typeof SingletonsModule)[K]> extends true ? TPascalToCamelCase$3<K & string> : never]: (typeof SingletonsModule)[K] extends new () => infer Instance ? Instance : never;
82
- };
83
-
84
- declare const lankaSingletons: TLankaSingletons;
85
-
86
- /**
87
- * Shared-store classes read from the consumer's barrel.
88
- *
89
- * Adding one takes two steps and no registration:
90
- *
91
- * 1. write a class extending `ALankaSharedStore`;
92
- * 2. add ONE export line to `.lanka_di/lankaSharedStores.ts` at the project root.
93
- *
94
- * The type below is derived from that module's exports, so the property name
95
- * and the instance type appear by themselves.
96
- */
97
-
98
- /**
99
- * Turns a PascalCase class name into a camelCase property name: `RoleEditorStore` → `roleEditorStore`.
100
- */
101
- type TPascalToCamelCase$2<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
102
- /** Whether the type is a shared-store class. */
103
- type TIsSharedStoreClass<T> = T extends new () => infer Instance ? Instance extends ALankaSharedStore<object> ? true : false : false;
104
- /**
105
- * Builds the shared-store type from every export of the barrel.
106
- *
107
- * Derived automatically; no list has to be maintained by hand.
108
- */
109
- type TLankaSharedStores = {
110
- [K in keyof typeof SharedStoresModule as TIsSharedStoreClass<(typeof SharedStoresModule)[K]> extends true ? TPascalToCamelCase$2<K & string> : never]: (typeof SharedStoresModule)[K] extends new () => infer Instance ? Instance : never;
111
- };
112
-
113
- /**
114
- * Access to every shared store at once.
115
- *
116
- * An `ALankaSharedStore` subclass appears here by itself once it is exported from
117
- * `@lanka_di/SharedStores`. The property is camelCase, the class name PascalCase.
118
- */
119
- declare const lankaSharedStores: TLankaSharedStores;
120
-
121
18
  /**
122
19
  * Gateway classes read from the consumer's barrel.
123
20
  *
@@ -133,7 +30,7 @@ declare const lankaSharedStores: TLankaSharedStores;
133
30
  /**
134
31
  * Turns a PascalCase class name into a camelCase property name: `UserGateway` → `userGateway`.
135
32
  */
136
- type TPascalToCamelCase$1<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
33
+ type TPascalToCamelCase$3<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
137
34
  /** Whether the type is a gateway class — an `ALankaGateway` subclass. */
138
35
  type TIsGatewayClass<T> = T extends new () => infer Instance ? Instance extends ALankaGateway<unknown> ? true : false : false;
139
36
  /**
@@ -142,7 +39,7 @@ type TIsGatewayClass<T> = T extends new () => infer Instance ? Instance extends
142
39
  * Derived automatically; no list has to be maintained by hand.
143
40
  */
144
41
  type TLankaGateways = {
145
- [K in keyof typeof GatewaysModule as TIsGatewayClass<(typeof GatewaysModule)[K]> extends true ? TPascalToCamelCase$1<K & string> : never]: (typeof GatewaysModule)[K] extends new () => infer Instance ? Instance : never;
42
+ [K in keyof typeof GatewaysModule as TIsGatewayClass<(typeof GatewaysModule)[K]> extends true ? TPascalToCamelCase$3<K & string> : never]: (typeof GatewaysModule)[K] extends new () => infer Instance ? Instance : never;
146
43
  };
147
44
 
148
45
  /**
@@ -175,13 +72,13 @@ declare const lankaGateways: TLankaGateways;
175
72
  /**
176
73
  * Turns a PascalCase class name into a camelCase property name: `SessionUpdated` → `sessionUpdated`.
177
74
  */
178
- type TPascalToCamelCase<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
75
+ type TPascalToCamelCase$2<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
179
76
  /** Extracts the scenario name from the constructor. */
180
77
  type TExtractScenarioName<T> = T extends new () => infer Instance ? Instance extends {
181
78
  readonly name: infer N;
182
79
  } ? N extends string ? N : never : never : never;
183
80
  /** Derives the property name from a scenario constructor. */
184
- type TScenarioPropertyName<T> = TPascalToCamelCase<TExtractScenarioName<T>>;
81
+ type TScenarioPropertyName<T> = TPascalToCamelCase$2<TExtractScenarioName<T>>;
185
82
  /** Whether the type is a scenario class — a constructor yielding a named instance. */
186
83
  type TIsScenarioClass<T> = T extends new () => infer Instance ? Instance extends {
187
84
  readonly name: string;
@@ -212,6 +109,38 @@ type TLankaScenarios = {
212
109
  */
213
110
  declare const lankaScenarios: TLankaScenarios;
214
111
 
112
+ /**
113
+ * The singleton marker: "this class is published by the application in
114
+ * `lankaSingletons`".
115
+ *
116
+ * ## Why a marker when the class is exported anyway
117
+ *
118
+ * The other three locators have one: a gateway extends `ALankaGateway`, a
119
+ * scenario has a `name`, a store extends `ALankaSharedStore`. Without a marker
120
+ * the selection is "anything that is a function with a prototype", so a stray
121
+ * export in the barrel — a helper, a companion class, an accidental re-export —
122
+ * becomes part of the public `lankaSingletons.*`, and a typo in a name is caught
123
+ * at runtime on first use, far from where it was made.
124
+ *
125
+ * ## A base class rather than a field
126
+ *
127
+ * A marker field can be put on anything, an object included, and the type would
128
+ * again stop telling a class from a non-class. Inheritance also gives TypeScript
129
+ * something it can select on in a mapped type.
130
+ *
131
+ * The class is empty deliberately: all it carries is the statement "I am meant
132
+ * for the locator".
133
+ */
134
+ declare abstract class ALankaSingleton {
135
+ /**
136
+ * A runtime check, for the locator, which cannot see types.
137
+ *
138
+ * Looks at the prototype chain rather than the name: names are lost to
139
+ * minification, and a name check would work only until the build.
140
+ */
141
+ static is(candidate: unknown): boolean;
142
+ }
143
+
215
144
  /**
216
145
  * The functional style of `ALankaSingleton`: a singleton declared by a function.
217
146
  *
@@ -236,4 +165,75 @@ declare const lankaScenarios: TLankaScenarios;
236
165
  */
237
166
  declare const createLankaSingleton: <TInstance extends object>(build: () => TInstance) => new () => TInstance;
238
167
 
168
+ /**
169
+ * Singleton classes, read from the consumer's barrel.
170
+ *
171
+ * Adding one takes two steps and no registration:
172
+ *
173
+ * 1. write the class;
174
+ * 2. add ONE export line to `.lanka_di/lankaSingletons.ts` at the project root.
175
+ *
176
+ * The type below is derived from that module's exports, so the property name
177
+ * and the instance type appear by themselves.
178
+ */
179
+
180
+ /**
181
+ * Turns a PascalCase class name into a camelCase property name: `UserProfile` → `userProfile`.
182
+ */
183
+ type TPascalToCamelCase$1<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
184
+ /** Whether a type is a class constructor. */
185
+ /**
186
+ * A class marked as a singleton.
187
+ *
188
+ * Selecting on "is a constructor" admits anything, so a stray barrel export
189
+ * silently becomes part of the public `lankaSingletons.*` and a typo is caught at
190
+ * runtime on first use.
191
+ */
192
+ type TIsSingletonClass<T> = T extends new () => infer Instance ? Instance extends ALankaSingleton ? true : false : false;
193
+ /**
194
+ * Builds the singletons type from the barrel's exports.
195
+ *
196
+ * Derived automatically; no list has to be maintained by hand.
197
+ */
198
+ type TLankaSingletons = {
199
+ [K in keyof typeof SingletonsModule as TIsSingletonClass<(typeof SingletonsModule)[K]> extends true ? TPascalToCamelCase$1<K & string> : never]: (typeof SingletonsModule)[K] extends new () => infer Instance ? Instance : never;
200
+ };
201
+
202
+ declare const lankaSingletons: TLankaSingletons;
203
+
204
+ /**
205
+ * Shared-store classes read from the consumer's barrel.
206
+ *
207
+ * Adding one takes two steps and no registration:
208
+ *
209
+ * 1. write a class extending `ALankaSharedStore`;
210
+ * 2. add ONE export line to `.lanka_di/lankaSharedStores.ts` at the project root.
211
+ *
212
+ * The type below is derived from that module's exports, so the property name
213
+ * and the instance type appear by themselves.
214
+ */
215
+
216
+ /**
217
+ * Turns a PascalCase class name into a camelCase property name: `RoleEditorStore` → `roleEditorStore`.
218
+ */
219
+ type TPascalToCamelCase<S extends string> = S extends `${infer P1}${infer P2}` ? `${Lowercase<P1>}${P2}` : S;
220
+ /** Whether the type is a shared-store class. */
221
+ type TIsSharedStoreClass<T> = T extends new () => infer Instance ? Instance extends ALankaSharedStore<object> ? true : false : false;
222
+ /**
223
+ * Builds the shared-store type from every export of the barrel.
224
+ *
225
+ * Derived automatically; no list has to be maintained by hand.
226
+ */
227
+ type TLankaSharedStores = {
228
+ [K in keyof typeof SharedStoresModule as TIsSharedStoreClass<(typeof SharedStoresModule)[K]> extends true ? TPascalToCamelCase<K & string> : never]: (typeof SharedStoresModule)[K] extends new () => infer Instance ? Instance : never;
229
+ };
230
+
231
+ /**
232
+ * Access to every shared store at once.
233
+ *
234
+ * An `ALankaSharedStore` subclass appears here by itself once it is exported from
235
+ * `@lanka_di/SharedStores`. The property is camelCase, the class name PascalCase.
236
+ */
237
+ declare const lankaSharedStores: TLankaSharedStores;
238
+
239
239
  export { ALankaSingleton, type TLankaGateways, type TLankaScenarios, type TLankaSharedStores, type TLankaSingletons, createLankaSingleton, lankaGateways, lankaScenarios, lankaSharedStores, lankaSingletons };
@@ -1,15 +1,9 @@
1
1
  import {
2
- createLankaLocatorProxy,
3
- lankaSharedStores,
4
- lankaSingletons
5
- } from "../chunk-R365QEN2.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-MLKTN4OV.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,11 +1,11 @@
1
1
  import {
2
2
  LankaScenarioLocator
3
- } from "../../../chunk-IB2LRYDK.js";
4
- import "../../../chunk-RZGBLXXL.js";
3
+ } from "../../../chunk-EH5WZSRJ.js";
5
4
  import "../../../chunk-N3275IPH.js";
6
- import "../../../chunk-6TNWBT6T.js";
7
- import "../../../chunk-FR2FRJME.js";
8
- import "../../../chunk-MLKTN4OV.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-6TNWBT6T.js";
5
- import "../chunk-FR2FRJME.js";
6
- import "../chunk-MLKTN4OV.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-6TNWBT6T.js";
3
+ } from "../chunk-AMLUKB6A.js";
4
4
  import {
5
5
  getLankaFlags
6
- } from "../chunk-FR2FRJME.js";
7
- import "../chunk-MLKTN4OV.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,13 +1,13 @@
1
1
  import {
2
2
  lankaScenarioBootstrap
3
- } from "../chunk-JX47U5DC.js";
3
+ } from "../chunk-4VFVACSL.js";
4
4
  import {
5
5
  ALankaScenario,
6
6
  lankaEventBus
7
- } from "../chunk-RZGBLXXL.js";
8
- import "../chunk-6TNWBT6T.js";
9
- import "../chunk-FR2FRJME.js";
10
- import "../chunk-MLKTN4OV.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,4 +1,4 @@
1
- import { c as ILankaPlugin } from '../createLanka-DxKZkmWe.js';
1
+ import { c as ILankaPlugin } from '../createLanka-AuiMfPL9.js';
2
2
  import '../createLankaScope-DeElRH-E.js';
3
3
  import '../LankaScenarioVMRegistry-CFzCpIFd.js';
4
4
  import '../ILankaScenarioVM-DKwjbIRq.js';
@@ -12,7 +12,7 @@ import '../ILankaRuntimeConfig-Vl436GWK.js';
12
12
  import '../lankaHttpInFlight-Bk1eIuSx.js';
13
13
  import '../lankaRequestMiddleware-DAC5kCb7.js';
14
14
  import '../locator/gateway/lanka-gateway-locator/LankaGatewayLocator.js';
15
- import '../ALankaGateway-BrVPaZN5.js';
15
+ import '../ALankaGateway-CzBISB0L.js';
16
16
  import '../lankaStandardValidator-BUFnysK0.js';
17
17
  import '@standard-schema/spec';
18
18
  import '../ILankaFieldError-D5931-vT.js';
@@ -3,15 +3,15 @@ import {
3
3
  } from "../chunk-UDP6IXDS.js";
4
4
  import {
5
5
  lankaScenarioBootstrap
6
- } from "../chunk-JX47U5DC.js";
7
- import "../chunk-RZGBLXXL.js";
6
+ } from "../chunk-4VFVACSL.js";
7
+ import "../chunk-L27FF2IH.js";
8
8
  import {
9
9
  lankaLogger
10
- } from "../chunk-6TNWBT6T.js";
10
+ } from "../chunk-AMLUKB6A.js";
11
11
  import {
12
12
  getLankaFlags
13
- } from "../chunk-FR2FRJME.js";
14
- import "../chunk-MLKTN4OV.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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lanka",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "type": "module",
5
5
  "description": "core: Fourteen subsystems, one peer dependency, six extension points.",
6
6
  "license": "MIT",
@@ -93,7 +93,7 @@
93
93
  "@standard-schema/spec": "^1.0.0"
94
94
  },
95
95
  "devDependencies": {
96
- "@lankajs/tool-testing": "^2.1.0"
96
+ "@lankajs/tool-testing": "^2.2.0"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "zustand": "^5.0.10"
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: lankajs
7
7
  package: lanka
8
- version: "2.2.0"
8
+ version: "2.2.2"
9
9
  ---
10
10
 
11
11
  # lanka — core
@@ -300,6 +300,8 @@ decides. Resetting the form erases what they were typing.
300
300
  | "module not found" for `@lanka_di/…` | `@lankajs/tool-di` is not installed, or the alias is missing |
301
301
  | a test sees another test's events | the instance was replaced without `dispose()` — use `resetLanka()` |
302
302
  | "lanka used before an instance existed", only in a BUILT bundle | a ViewModel read the locator while its own module was evaluated, ahead of `createLanka` — declare `scenarioHandlers` as a factory (below) |
303
+ | "…ran in another evaluation of lanka", after upgrading lanka | the open page kept the old lanka and a module loaded since got the new files — reload the page; restart the dev server if it pre-bundles nothing of lanka |
304
+ | "one was active in this copy and has been cleared" | a timer, a subscription or a request outlived `dispose()` — or the next instance was never created and activated |
303
305
 
304
306
  Do **not** fix the frozen screen by destructuring a value "for the side effect":
305
307
  it reads as dead code and the next refactor deletes it.
@@ -1,6 +1,6 @@
1
1
  <!-- Generated from core/GUIDE.md by scripts/skills.mjs. Edit the guide. -->
2
2
 
3
- > **`lanka@2.2.0`** — this document describes that version.
3
+ > **`lanka@2.2.2`** — this document describes that version.
4
4
  >
5
5
  > Install: `npm install lanka zustand` (the peers are not optional; only npm adds a missing one for you).
6
6
  >
@@ -387,6 +387,13 @@ the framework reaches both at once.
387
387
  `endpoint(path)` prefixes `apiBaseUrl` and the gateway's `basePath`, normalising
388
388
  slashes. Pass an absolute URL and it is used as given.
389
389
 
390
+ `request(path)` resolves its path through `endpoint()` itself, so
391
+ `request("7")` and `request(endpoint("7"))` reach the same URL. That holds
392
+ because `endpoint()` is idempotent: a path already under `apiBaseUrl` is not
393
+ prefixed again, so a relative base such as `/api` gives `/api/todos`, not
394
+ `/api/api/todos`. The one reading this costs is that a path you write as
395
+ `/api/x` under a base of `/api` means `/api/x`.
396
+
390
397
  ### Requests and transports
391
398
 
392
399
  A **request kind** decides what a response _is_; the **transport** decides how
@@ -5,7 +5,7 @@ license: MIT
5
5
  metadata:
6
6
  author: lankajs
7
7
  package: lanka
8
- version: "2.2.0"
8
+ version: "2.2.2"
9
9
  ---
10
10
 
11
11
  # lanka — which package, and what it costs
@@ -1,59 +0,0 @@
1
- import {
2
- requireActiveRuntime
3
- } from "./chunk-MLKTN4OV.js";
4
-
5
- // src/locator/_factories/create-lanka-locator-proxy/createLankaLocatorProxy.ts
6
- function createLankaLocatorProxy(config) {
7
- const { locator, protectedProperties = [], errorPrefix = "Cannot access" } = config;
8
- return new Proxy(locator, {
9
- get(target, prop) {
10
- if (typeof prop !== "string") {
11
- throw new Error(`${errorPrefix} with symbol property: ${String(prop)}`);
12
- }
13
- const internalProps = ["_", "constructor", "prototype", ...protectedProperties];
14
- if (prop.startsWith("_") || internalProps.some((internalProp) => prop === internalProp)) {
15
- throw new Error(`${errorPrefix} with property: ${prop}`);
16
- }
17
- return target.get(prop);
18
- }
19
- });
20
- }
21
-
22
- // src/locator/singleton/_facades/lanka-singletons/lankaSingletons.ts
23
- var singletonLocator = {
24
- get: (propertyName) => requireActiveRuntime().locators.singletons.get(propertyName)
25
- };
26
- var lankaSingletons = createLankaLocatorProxy({
27
- locator: singletonLocator,
28
- protectedProperties: [
29
- "clearCache",
30
- "register",
31
- "registerInstance",
32
- "unregister",
33
- "isRegistered"
34
- ],
35
- errorPrefix: "Cannot access singleton"
36
- });
37
-
38
- // src/locator/shared-store/_facades/lanka-shared-stores/lankaSharedStores.ts
39
- var sharedStoreLocator = {
40
- get: (propertyName) => requireActiveRuntime().locators.sharedStores.get(propertyName)
41
- };
42
- var lankaSharedStores = createLankaLocatorProxy({
43
- locator: sharedStoreLocator,
44
- protectedProperties: [
45
- "clearCache",
46
- "register",
47
- "registerInstance",
48
- "unregister",
49
- "isRegistered"
50
- ],
51
- errorPrefix: "Cannot access shared store"
52
- });
53
-
54
- export {
55
- createLankaLocatorProxy,
56
- lankaSingletons,
57
- lankaSharedStores
58
- };
59
- //# sourceMappingURL=chunk-R365QEN2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/locator/_factories/create-lanka-locator-proxy/createLankaLocatorProxy.ts","../src/locator/singleton/_facades/lanka-singletons/lankaSingletons.ts","../src/locator/shared-store/_facades/lanka-shared-stores/lankaSharedStores.ts"],"sourcesContent":["import type { ILankaLocator } from \"../../_interfaces/ILankaLocator\";\n\n/**\n * Configuration of the global locator proxy.\n */\nexport interface ILankaLocatorProxyConfig<TInstance> {\n\t/** The locator that actually resolves instances. */\n\tlocator: ILankaLocator<TInstance>;\n\t/** Properties whose access must throw. */\n\tprotectedProperties?: string[];\n\t/** Prefix of the message thrown for an unknown property. */\n\terrorPrefix?: string;\n}\n\n/**\n * Creates a Proxy for dynamic access to instances with type safety.\n * Converts camelCase property access to PascalCase instance names.\n *\n * @param config Proxy configuration\n * @returns Proxy object typed as TType\n */\nexport function createLankaLocatorProxy<TInstance, TType extends Record<string, TInstance>>(\n\tconfig: ILankaLocatorProxyConfig<TInstance>,\n): TType {\n\tconst { locator, protectedProperties = [], errorPrefix = \"Cannot access\" } = config;\n\n\treturn new Proxy(locator, {\n\t\tget(target, prop: string | symbol): TInstance {\n\t\t\t// Symbols such as `Symbol.iterator` are not instance names.\n\t\t\tif (typeof prop !== \"string\") {\n\t\t\t\tthrow new Error(`${errorPrefix} with symbol property: ${String(prop)}`);\n\t\t\t}\n\n\t\t\t// Internal properties are rejected.\n\t\t\tconst internalProps = [\"_\", \"constructor\", \"prototype\", ...protectedProperties];\n\n\t\t\tif (\n\t\t\t\tprop.startsWith(\"_\") ||\n\t\t\t\tinternalProps.some((internalProp) => prop === internalProp)\n\t\t\t) {\n\t\t\t\tthrow new Error(`${errorPrefix} with property: ${prop}`);\n\t\t\t}\n\n\t\t\t// The instance for a camelCase property name.\n\t\t\treturn target.get(prop);\n\t\t},\n\t}) as unknown as TType;\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\";\nexport { LankaSingletonLocator } from \"../../lanka-singleton-locator/LankaSingletonLocator\";\nexport type { ILankaSingletonLocatorConfig } from \"../../lanka-singleton-locator/LankaSingletonLocator\";\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\nexport { LankaSharedStoreLocator } from \"../../lanka-shared-store-locator/LankaSharedStoreLocator\";\nexport type { ILankaSharedStoreLocatorConfig } from \"../../lanka-shared-store-locator/LankaSharedStoreLocator\";\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":";;;;;AAqBO,SAAS,wBACf,QACQ;AACR,QAAM,EAAE,SAAS,sBAAsB,CAAC,GAAG,cAAc,gBAAgB,IAAI;AAE7E,SAAO,IAAI,MAAM,SAAS;AAAA,IACzB,IAAI,QAAQ,MAAkC;AAE7C,UAAI,OAAO,SAAS,UAAU;AAC7B,cAAM,IAAI,MAAM,GAAG,WAAW,0BAA0B,OAAO,IAAI,CAAC,EAAE;AAAA,MACvE;AAGA,YAAM,gBAAgB,CAAC,KAAK,eAAe,aAAa,GAAG,mBAAmB;AAE9E,UACC,KAAK,WAAW,GAAG,KACnB,cAAc,KAAK,CAAC,iBAAiB,SAAS,YAAY,GACzD;AACD,cAAM,IAAI,MAAM,GAAG,WAAW,mBAAmB,IAAI,EAAE;AAAA,MACxD;AAGA,aAAO,OAAO,IAAI,IAAI;AAAA,IACvB;AAAA,EACD,CAAC;AACF;;;ACbA,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;;;AChCD,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":[]}