lanka 2.2.1 → 2.3.0

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 (42) hide show
  1. package/README.md +2 -2
  2. package/dist/{ALankaGateway-BrVPaZN5.d.ts → ALankaGateway-CQrEPUHM.d.ts} +1 -15
  3. package/dist/{LankaError-D6RWNyLM.d.ts → LankaError-CfDmuGKc.d.ts} +17 -0
  4. package/dist/_extend/index.d.ts +2 -2
  5. package/dist/_extend/index.js +10 -10
  6. package/dist/_internal/index.d.ts +3 -3
  7. package/dist/_internal/index.js +2 -2
  8. package/dist/{activeRuntime-DxB62KN4.d.ts → activeRuntime-1Zj2m1Sx.d.ts} +1 -1
  9. package/dist/bootstrap/index.d.ts +5 -5
  10. package/dist/bootstrap/index.js +3 -3
  11. package/dist/{chunk-DKLOCKS4.js → chunk-3GQGNG7S.js} +2 -2
  12. package/dist/{chunk-HVSQOMRE.js → chunk-BIJTUWUD.js} +2 -2
  13. package/dist/{chunk-G32H73QY.js → chunk-INHAKVSO.js} +17 -1
  14. package/dist/chunk-INHAKVSO.js.map +1 -0
  15. package/dist/{chunk-YR4MZXMU.js → chunk-USZ7CFCU.js} +1 -1
  16. package/dist/chunk-USZ7CFCU.js.map +1 -0
  17. package/dist/{chunk-CRIRTOLB.js → chunk-VI4DY5PN.js} +2 -2
  18. package/dist/{chunk-532WVMAF.js → chunk-YEP54YU5.js} +7 -7
  19. package/dist/{createLanka-AuiMfPL9.d.ts → createLanka-XbyOz9ld.d.ts} +2 -2
  20. package/dist/errors/index.d.ts +2 -2
  21. package/dist/errors/index.js +2 -2
  22. package/dist/gateway/index.d.ts +3 -3
  23. package/dist/gateway/index.js +127 -66
  24. package/dist/gateway/index.js.map +1 -1
  25. package/dist/index.d.ts +5 -5
  26. package/dist/index.js +7 -7
  27. package/dist/{lankaRequestMiddleware-DAC5kCb7.d.ts → lankaRequestMiddleware-CbXc1PAV.d.ts} +3 -1
  28. package/dist/locator/gateway/lanka-gateway-locator/LankaGatewayLocator.d.ts +1 -1
  29. package/dist/locator/index.d.ts +1 -1
  30. package/dist/stream/index.d.ts +4 -4
  31. package/dist/validation/index.d.ts +1 -1
  32. package/dist/validation/index.js +3 -3
  33. package/package.json +1 -1
  34. package/skills/lanka-core/SKILL.md +14 -10
  35. package/skills/lanka-core/reference.md +27 -1
  36. package/skills/lanka-packages/SKILL.md +1 -1
  37. package/dist/chunk-G32H73QY.js.map +0 -1
  38. package/dist/chunk-YR4MZXMU.js.map +0 -1
  39. /package/dist/{chunk-DKLOCKS4.js.map → chunk-3GQGNG7S.js.map} +0 -0
  40. /package/dist/{chunk-HVSQOMRE.js.map → chunk-BIJTUWUD.js.map} +0 -0
  41. /package/dist/{chunk-CRIRTOLB.js.map → chunk-VI4DY5PN.js.map} +0 -0
  42. /package/dist/{chunk-532WVMAF.js.map → chunk-YEP54YU5.js.map} +0 -0
package/README.md CHANGED
@@ -8,7 +8,7 @@ One, unscoped. Everything depends on it; it depends on nothing.
8
8
 
9
9
  **Runs in:** the browser, node and React Native — everywhere.
10
10
 
11
- **How to use it:** [GUIDE.md](./GUIDE.md) — the user guide, with examples. **How to change it:** [SKILL.md](./SKILL.md).
11
+ **How to use it:** [GUIDE.md](https://github.com/lankajs/lanka/blob/main/core/GUIDE.md) — the user guide, with examples. **How to change it:** [SKILL.md](https://github.com/lankajs/lanka/blob/main/core/SKILL.md).
12
12
 
13
13
  ## Extension points core declares
14
14
 
@@ -243,4 +243,4 @@ belong to the consumer and the folder already says whose they are.
243
243
 
244
244
  ---
245
245
 
246
- Repository map: [../README.md](../README.md)
246
+ Repository map: [the root README](https://github.com/lankajs/lanka/blob/main/README.md)
@@ -37,6 +37,7 @@ type TLankaRequestInit = Omit<RequestInit, "body"> & {
37
37
  */
38
38
  type TLankaExecuteOptions<TOptions> = TOptions & {
39
39
  signal?: AbortSignal;
40
+ /** The attempt's deadline. It stops while the page is seen hidden, and resumes when it shows. */
40
41
  timeoutMs?: number;
41
42
  };
42
43
 
@@ -140,21 +141,6 @@ declare abstract class ALankaGateway<TOptions = TLankaRequestInit> {
140
141
  * Joins `basePath` and the method path.
141
142
  */
142
143
  private resolvePath;
143
- /**
144
- * Prefixes the API base URL from the host contract.
145
- *
146
- * Here rather than in every consumer: otherwise each consumer knows the URL
147
- * and the framework does not, and a realtime plugin would have to know a
148
- * specific application's build.
149
- *
150
- * Declaring the field and not using it would be worse than not declaring it: a
151
- * declaration nothing is built from is a second truth, free to diverge from
152
- * the first.
153
- *
154
- * An absolute URL never reaches here — `endpoint()` filters it out before the
155
- * join.
156
- */
157
- private withApiBase;
158
144
  protected buildQueryParams<T extends object>(params: T): URLSearchParams;
159
145
  protected request<TReturn = unknown>(path: string, options?: TLankaExecuteOptions<TOptions>, mockHandler?: () => Promise<TReturn>): Promise<TReturn>;
160
146
  /**
@@ -60,6 +60,8 @@ interface ILankaErrorInit {
60
60
  * stream and get nothing. Core does not look into the body; it carries it.
61
61
  */
62
62
  body?: unknown;
63
+ /** The app went to the background during the attempt. See `LankaError.isFromBackground`. */
64
+ isFromBackground?: boolean;
63
65
  /** The original error, when this one wraps it. */
64
66
  cause?: unknown;
65
67
  }
@@ -92,6 +94,21 @@ declare class LankaError extends Error implements ILankaApiError {
92
94
  readonly fields?: readonly ILankaFieldError[];
93
95
  /** The parsed error response body; core carries it without reading it. */
94
96
  readonly body?: unknown;
97
+ /**
98
+ * The app went to the background while the attempt was on the wire: the page
99
+ * was seen to hide, or to unload. Set by the framework on the `network` and
100
+ * `aborted` failures it tags; `false` everywhere else.
101
+ *
102
+ * What it tells is WHEN, not why. On a mobile WebView it usually means the
103
+ * page was frozen and the platform cut the request; on a desktop tab that kept
104
+ * running, the server may just as well have failed. Segment telemetry by it —
105
+ * do not drop what it marks. Never on a `timeout`: the deadline stops while
106
+ * the page is hidden, so one that still ran out was slow in plain sight.
107
+ *
108
+ * Read it as truthy: a `LankaError` from an older copy of the framework in
109
+ * the same tree passes `LankaError.is` without it.
110
+ */
111
+ readonly isFromBackground: boolean;
95
112
  constructor(init: ILankaErrorInit);
96
113
  /** The `ILankaApiError` field. The details are the message list. */
97
114
  get errors(): string[] | undefined;
@@ -8,12 +8,12 @@ export { LankaGatewayLocator } from '../locator/gateway/lanka-gateway-locator/La
8
8
  export { LankaScenarioLocator } from '../locator/scenario/lanka-scenario-locator/LankaScenarioLocator.js';
9
9
  export { LankaSingletonLocator } from '../locator/singleton/lanka-singleton-locator/LankaSingletonLocator.js';
10
10
  export { LankaSharedStoreLocator } from '../locator/shared-store/lanka-shared-store-locator/LankaSharedStoreLocator.js';
11
- export { c as composeLankaRequestMiddleware } from '../lankaRequestMiddleware-DAC5kCb7.js';
11
+ export { c as composeLankaRequestMiddleware } from '../lankaRequestMiddleware-CbXc1PAV.js';
12
12
  import { I as ILankaReadableVM } from '../ILankaReadableVM-BoPzHEPV.js';
13
13
  import '../ILankaScenario-7J3MoKiY.js';
14
14
  import '../ILankaScenarioVM-DKwjbIRq.js';
15
15
  import '../ILankaScenarioMetadata-DgOxvpwx.js';
16
- import '../ALankaGateway-BrVPaZN5.js';
16
+ import '../ALankaGateway-CQrEPUHM.js';
17
17
  import '../lankaStandardValidator-BUFnysK0.js';
18
18
  import '@standard-schema/spec';
19
19
  import '../ILankaFieldError-D5931-vT.js';
@@ -1,23 +1,26 @@
1
1
  import {
2
2
  lankaBlindSpotRegistry
3
3
  } from "../chunk-UDP6IXDS.js";
4
+ import {
5
+ createLankaLocatorProxy
6
+ } from "../chunk-2ICKGQXS.js";
4
7
  import {
5
8
  createLankaScope,
6
9
  lankaVMRecipes
7
10
  } from "../chunk-M4BK6GBV.js";
8
- import {
9
- LankaGatewayLocator
10
- } from "../chunk-BMF4TM2Z.js";
11
- import {
12
- LankaScenarioLocator
13
- } from "../chunk-EH5WZSRJ.js";
14
11
  import {
15
12
  LankaSingletonLocator
16
13
  } from "../chunk-24MUFFHF.js";
17
14
  import {
18
15
  LankaSharedStoreLocator
19
16
  } from "../chunk-3R2NO47A.js";
17
+ import {
18
+ LankaGatewayLocator
19
+ } from "../chunk-BMF4TM2Z.js";
20
20
  import "../chunk-JZJ6GXX3.js";
21
+ import {
22
+ LankaScenarioLocator
23
+ } from "../chunk-EH5WZSRJ.js";
21
24
  import {
22
25
  ALankaLocator
23
26
  } from "../chunk-N3275IPH.js";
@@ -30,12 +33,9 @@ import {
30
33
  } from "../chunk-L27FF2IH.js";
31
34
  import {
32
35
  composeLankaRequestMiddleware
33
- } from "../chunk-YR4MZXMU.js";
36
+ } from "../chunk-USZ7CFCU.js";
34
37
  import "../chunk-AMLUKB6A.js";
35
38
  import "../chunk-SP5OUTWF.js";
36
- import {
37
- createLankaLocatorProxy
38
- } from "../chunk-2ICKGQXS.js";
39
39
  import {
40
40
  getActiveLankaScope,
41
41
  hasLankaScopeResolver,
@@ -1,4 +1,4 @@
1
- export { I as ILankaRuntime, T as TLankaRuntimeResolver, a as TLankaScopeResolver, g as getLankaProcessRuntime, h as hasLankaScopeResolver, s as setActiveLankaRuntime, b as setLankaRuntimeResolver, c as setLankaScopeResolver } from '../activeRuntime-DxB62KN4.js';
1
+ export { I as ILankaRuntime, T as TLankaRuntimeResolver, a as TLankaScopeResolver, g as getLankaProcessRuntime, h as hasLankaScopeResolver, s as setActiveLankaRuntime, b as setLankaRuntimeResolver, c as setLankaScopeResolver } from '../activeRuntime-1Zj2m1Sx.js';
2
2
  import { a as TLankaValidationResult } from '../lankaStandardValidator-BUFnysK0.js';
3
3
  import '../ILankaScenario-7J3MoKiY.js';
4
4
  import '../LankaScenariosRegistry-DiLN9xwy.js';
@@ -7,9 +7,9 @@ import '../ILankaScenarioMetadata-DgOxvpwx.js';
7
7
  import '../LankaScenarioVMRegistry-CFzCpIFd.js';
8
8
  import '../ILankaRuntimeConfig-Vl436GWK.js';
9
9
  import '../lankaHttpInFlight-Bk1eIuSx.js';
10
- import '../lankaRequestMiddleware-DAC5kCb7.js';
10
+ import '../lankaRequestMiddleware-CbXc1PAV.js';
11
11
  import '../locator/gateway/lanka-gateway-locator/LankaGatewayLocator.js';
12
- import '../ALankaGateway-BrVPaZN5.js';
12
+ import '../ALankaGateway-CQrEPUHM.js';
13
13
  import '../ALankaLocator-BUCCz0Q5.js';
14
14
  import '@standard-schema/spec';
15
15
  import '../ILankaFieldError-D5931-vT.js';
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  LankaValidationError
3
- } from "../chunk-CRIRTOLB.js";
3
+ } from "../chunk-VI4DY5PN.js";
4
4
  import {
5
5
  getStringField,
6
6
  isRecord
7
7
  } from "../chunk-J5LA3Q6D.js";
8
- import "../chunk-G32H73QY.js";
8
+ import "../chunk-INHAKVSO.js";
9
9
  import {
10
10
  getLankaProcessRuntime,
11
11
  hasLankaScopeResolver,
@@ -4,7 +4,7 @@ import { L as LankaScenarioVMRegistry } from './LankaScenarioVMRegistry-CFzCpIFd
4
4
  import { b as ILankaRuntimeConfig } from './ILankaRuntimeConfig-Vl436GWK.js';
5
5
  import { I as ILankaInFlightCounter } from './lankaHttpInFlight-Bk1eIuSx.js';
6
6
  import { I as ILankaScenarioVM } from './ILankaScenarioVM-DKwjbIRq.js';
7
- import { T as TLankaRequestMiddleware } from './lankaRequestMiddleware-DAC5kCb7.js';
7
+ import { T as TLankaRequestMiddleware } from './lankaRequestMiddleware-CbXc1PAV.js';
8
8
  import { LankaGatewayLocator } from './locator/gateway/lanka-gateway-locator/LankaGatewayLocator.js';
9
9
  import { LankaScenarioLocator } from './locator/scenario/lanka-scenario-locator/LankaScenarioLocator.js';
10
10
  import { LankaSingletonLocator } from './locator/singleton/lanka-singleton-locator/LankaSingletonLocator.js';
@@ -1,17 +1,17 @@
1
- import { c as ILankaPlugin, e as ILankaServiceConfig, I as ILankaBootstrapConfig, a as ILankaInstance } from '../createLanka-AuiMfPL9.js';
2
- export { b as ILankaInstanceConfig, d as ILankaScenarioBootstrapConfig, f as createLanka } from '../createLanka-AuiMfPL9.js';
1
+ import { c as ILankaPlugin, e as ILankaServiceConfig, I as ILankaBootstrapConfig, a as ILankaInstance } from '../createLanka-XbyOz9ld.js';
2
+ export { b as ILankaInstanceConfig, d as ILankaScenarioBootstrapConfig, f as createLanka } from '../createLanka-XbyOz9ld.js';
3
3
  import { I as ILankaFlags, a as ILankaHost } from '../ILankaRuntimeConfig-Vl436GWK.js';
4
4
  export { I as ILankaScope } from '../createLankaScope-DeElRH-E.js';
5
- import '../activeRuntime-DxB62KN4.js';
5
+ import '../activeRuntime-1Zj2m1Sx.js';
6
6
  import '../ILankaScenario-7J3MoKiY.js';
7
7
  import '../LankaScenariosRegistry-DiLN9xwy.js';
8
8
  import '../ILankaScenarioVM-DKwjbIRq.js';
9
9
  import '../ILankaScenarioMetadata-DgOxvpwx.js';
10
10
  import '../LankaScenarioVMRegistry-CFzCpIFd.js';
11
11
  import '../lankaHttpInFlight-Bk1eIuSx.js';
12
- import '../lankaRequestMiddleware-DAC5kCb7.js';
12
+ import '../lankaRequestMiddleware-CbXc1PAV.js';
13
13
  import '../locator/gateway/lanka-gateway-locator/LankaGatewayLocator.js';
14
- import '../ALankaGateway-BrVPaZN5.js';
14
+ import '../ALankaGateway-CQrEPUHM.js';
15
15
  import '../lankaStandardValidator-BUFnysK0.js';
16
16
  import '@standard-schema/spec';
17
17
  import '../ILankaFieldError-D5931-vT.js';
@@ -3,13 +3,13 @@ import {
3
3
  createLanka,
4
4
  resetActiveLanka,
5
5
  startLanka
6
- } from "../chunk-532WVMAF.js";
6
+ } from "../chunk-YEP54YU5.js";
7
7
  import "../chunk-M4BK6GBV.js";
8
- import "../chunk-BMF4TM2Z.js";
9
- import "../chunk-EH5WZSRJ.js";
10
8
  import "../chunk-24MUFFHF.js";
11
9
  import "../chunk-3R2NO47A.js";
10
+ import "../chunk-BMF4TM2Z.js";
12
11
  import "../chunk-JZJ6GXX3.js";
12
+ import "../chunk-EH5WZSRJ.js";
13
13
  import "../chunk-N3275IPH.js";
14
14
  import "../chunk-4VFVACSL.js";
15
15
  import "../chunk-L27FF2IH.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-J5LA3Q6D.js";
5
5
  import {
6
6
  LankaError
7
- } from "./chunk-G32H73QY.js";
7
+ } from "./chunk-INHAKVSO.js";
8
8
  import {
9
9
  getLankaHost
10
10
  } from "./chunk-JGJBFELR.js";
@@ -49,4 +49,4 @@ export {
49
49
  createLankaApiError,
50
50
  handleLankaApiError
51
51
  };
52
- //# sourceMappingURL=chunk-DKLOCKS4.js.map
52
+ //# sourceMappingURL=chunk-3GQGNG7S.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LankaValidationError
3
- } from "./chunk-CRIRTOLB.js";
3
+ } from "./chunk-VI4DY5PN.js";
4
4
 
5
5
  // src/validation/lanka-standard-validator/lankaStandardValidator.ts
6
6
  function readIssuePath(issue) {
@@ -66,4 +66,4 @@ var lankaStandardValidator = Object.freeze({
66
66
  export {
67
67
  lankaStandardValidator
68
68
  };
69
- //# sourceMappingURL=chunk-HVSQOMRE.js.map
69
+ //# sourceMappingURL=chunk-BIJTUWUD.js.map
@@ -14,6 +14,21 @@ var LankaError = class _LankaError extends Error {
14
14
  fields;
15
15
  /** The parsed error response body; core carries it without reading it. */
16
16
  body;
17
+ /**
18
+ * The app went to the background while the attempt was on the wire: the page
19
+ * was seen to hide, or to unload. Set by the framework on the `network` and
20
+ * `aborted` failures it tags; `false` everywhere else.
21
+ *
22
+ * What it tells is WHEN, not why. On a mobile WebView it usually means the
23
+ * page was frozen and the platform cut the request; on a desktop tab that kept
24
+ * running, the server may just as well have failed. Segment telemetry by it —
25
+ * do not drop what it marks. Never on a `timeout`: the deadline stops while
26
+ * the page is hidden, so one that still ran out was slow in plain sight.
27
+ *
28
+ * Read it as truthy: a `LankaError` from an older copy of the framework in
29
+ * the same tree passes `LankaError.is` without it.
30
+ */
31
+ isFromBackground;
17
32
  constructor(init) {
18
33
  super(init.message, init.cause === void 0 ? void 0 : { cause: init.cause });
19
34
  this.name = "LankaError";
@@ -23,6 +38,7 @@ var LankaError = class _LankaError extends Error {
23
38
  this.issues = init.issues;
24
39
  this.fields = init.fields;
25
40
  this.body = init.body;
41
+ this.isFromBackground = init.isFromBackground ?? false;
26
42
  Object.setPrototypeOf(this, _LankaError.prototype);
27
43
  }
28
44
  /** The `ILankaApiError` field. The details are the message list. */
@@ -55,4 +71,4 @@ var LankaError = class _LankaError extends Error {
55
71
  export {
56
72
  LankaError
57
73
  };
58
- //# sourceMappingURL=chunk-G32H73QY.js.map
74
+ //# sourceMappingURL=chunk-INHAKVSO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors/lanka-error/LankaError.ts"],"sourcesContent":["import type { ILankaApiError } from \"../_interfaces/ILankaApiError\";\nimport type { ILankaFieldError } from \"../_interfaces/ILankaFieldError\";\n\n/**\n * How a request ended.\n *\n * Six kinds rather than one, for one reason: each demands something DIFFERENT of\n * the interface. A distinction that implies no different behaviour is\n * superfluous, which is why there is no seventh.\n */\nexport type TLankaErrorKind =\n\t/** Never reached the server: dropped link, DNS failure, no network. Offer a retry. */\n\t| \"network\"\n\t/** Reached it; the response never came. Also a retry, but a different message. */\n\t| \"timeout\"\n\t/** Cancelled by the caller. Nothing to show: the user left. */\n\t| \"aborted\"\n\t/** The server answered with an error status; what to show depends on it. */\n\t| \"http\"\n\t/** A response arrived in the wrong shape. A break, not the user's fault. */\n\t| \"schema\"\n\t/** The server refused deliberately and named the reason. Show what it said. */\n\t| \"domain\";\n\nexport interface ILankaErrorInit {\n\tkind: TLankaErrorKind;\n\tmessage: string;\n\t/** HTTP status, when there was one. */\n\tstatus?: number;\n\t/** The domain failure code — what the application branches on. */\n\tcode?: string;\n\t/** Details: server messages, or paths to the fields that failed validation. */\n\tissues?: readonly string[];\n\t/**\n\t * The failures that have an input to be shown at, with the path in segments.\n\t *\n\t * Beside `issues` rather than instead of it: `issues` is the banner's list and\n\t * is promised; this is the form's, and a failure may have either, both or\n\t * neither. Absent means \"nothing here has an address\", not \"unknown\".\n\t */\n\tfields?: readonly ILankaFieldError[];\n\t/**\n\t * The parsed ERROR response body, when there was one and it was JSON.\n\t *\n\t * Travels with the error because a `Response` is read once: without this field\n\t * a plugin extracting the domain failure code would read an already-drained\n\t * stream and get nothing. Core does not look into the body; it carries it.\n\t */\n\tbody?: unknown;\n\t/** The app went to the background during the attempt. See `LankaError.isFromBackground`. */\n\tisFromBackground?: boolean;\n\t/** The original error, when this one wraps it. */\n\tcause?: unknown;\n}\n\n/**\n * One failure type for every layer of the framework.\n *\n * Without a tagged kind, an app cannot tell a network failure from a timeout,\n * from a broken schema, from a deliberate domain refusal — so it builds its own\n * error contract ON TOP of the framework, and builds it once per application.\n *\n * Implements `ILankaApiError`: `status` and `errors` are present, so code reading\n * them the old way keeps working.\n *\n * What is NOT here: parsing a particular response body format. Which JSON a\n * backend sends is policy, and policy lives in `@lankajs/plugin-http`. Core knows\n * only that it has a failure and must name its kind.\n */\nexport class LankaError extends Error implements ILankaApiError {\n\treadonly kind: TLankaErrorKind;\n\treadonly status?: number;\n\treadonly code?: string;\n\treadonly issues?: readonly string[];\n\t/**\n\t * The failures with an input to be shown at. See `ILankaErrorInit.fields`.\n\t *\n\t * The array given is the array kept — unlike `errors`, which copies `issues`\n\t * on every read. `readonly` carries the promise, and this is read on the way\n\t * to a form, once, where a copy would buy nothing.\n\t */\n\treadonly fields?: readonly ILankaFieldError[];\n\t/** The parsed error response body; core carries it without reading it. */\n\treadonly body?: unknown;\n\t/**\n\t * The app went to the background while the attempt was on the wire: the page\n\t * was seen to hide, or to unload. Set by the framework on the `network` and\n\t * `aborted` failures it tags; `false` everywhere else.\n\t *\n\t * What it tells is WHEN, not why. On a mobile WebView it usually means the\n\t * page was frozen and the platform cut the request; on a desktop tab that kept\n\t * running, the server may just as well have failed. Segment telemetry by it —\n\t * do not drop what it marks. Never on a `timeout`: the deadline stops while\n\t * the page is hidden, so one that still ran out was slow in plain sight.\n\t *\n\t * Read it as truthy: a `LankaError` from an older copy of the framework in\n\t * the same tree passes `LankaError.is` without it.\n\t */\n\treadonly isFromBackground: boolean;\n\n\tconstructor(init: ILankaErrorInit) {\n\t\tsuper(init.message, init.cause === undefined ? undefined : { cause: init.cause });\n\t\tthis.name = \"LankaError\";\n\t\tthis.kind = init.kind;\n\t\tthis.status = init.status;\n\t\tthis.code = init.code;\n\t\tthis.issues = init.issues;\n\t\tthis.fields = init.fields;\n\t\tthis.body = init.body;\n\t\tthis.isFromBackground = init.isFromBackground ?? false;\n\n\t\t// The prototype chain is pinned explicitly: without it `instanceof` breaks\n\t\t// for a consumer whose bundler downlevels to ES5, and breaks silently —\n\t\t// `catch` simply fails to recognise its own error.\n\t\tObject.setPrototypeOf(this, LankaError.prototype);\n\t}\n\n\t/** The `ILankaApiError` field. The details are the message list. */\n\tget errors(): string[] | undefined {\n\t\treturn this.issues ? [...this.issues] : undefined;\n\t}\n\n\t/**\n\t * Whether to show this to the user.\n\t *\n\t * A cancelled request is the one failure that must NOT be reported: its cause\n\t * is that the user left before the response, and a toast would catch them on\n\t * another screen.\n\t */\n\tget isSilent(): boolean {\n\t\treturn this.kind === \"aborted\";\n\t}\n\n\t/**\n\t * Recognises our error among others.\n\t *\n\t * Checks the name rather than `instanceof` alone: a consumer may end up with\n\t * two copies of the package — adjacent majors in the dependency tree — and\n\t * then `instanceof` answers `false` for an error that is ours by every other\n\t * sign.\n\t */\n\tstatic is(value: unknown): value is LankaError {\n\t\treturn (\n\t\t\tvalue instanceof LankaError || (value instanceof Error && value.name === \"LankaError\")\n\t\t);\n\t}\n}\n"],"mappings":";AAqEO,IAAM,aAAN,MAAM,oBAAmB,MAAgC;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA;AAAA,EAET,YAAY,MAAuB;AAClC,UAAM,KAAK,SAAS,KAAK,UAAU,SAAY,SAAY,EAAE,OAAO,KAAK,MAAM,CAAC;AAChF,SAAK,OAAO;AACZ,SAAK,OAAO,KAAK;AACjB,SAAK,SAAS,KAAK;AACnB,SAAK,OAAO,KAAK;AACjB,SAAK,SAAS,KAAK;AACnB,SAAK,SAAS,KAAK;AACnB,SAAK,OAAO,KAAK;AACjB,SAAK,mBAAmB,KAAK,oBAAoB;AAKjD,WAAO,eAAe,MAAM,YAAW,SAAS;AAAA,EACjD;AAAA;AAAA,EAGA,IAAI,SAA+B;AAClC,WAAO,KAAK,SAAS,CAAC,GAAG,KAAK,MAAM,IAAI;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAI,WAAoB;AACvB,WAAO,KAAK,SAAS;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAAO,GAAG,OAAqC;AAC9C,WACC,iBAAiB,eAAe,iBAAiB,SAAS,MAAM,SAAS;AAAA,EAE3E;AACD;","names":[]}
@@ -10,4 +10,4 @@ function composeLankaRequestMiddleware(middleware, perform) {
10
10
  export {
11
11
  composeLankaRequestMiddleware
12
12
  };
13
- //# sourceMappingURL=chunk-YR4MZXMU.js.map
13
+ //# sourceMappingURL=chunk-USZ7CFCU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/gateway/request/lankaRequestMiddleware.ts"],"sourcesContent":["/**\n * What middleware knows about the request it wraps.\n *\n * `options` is deliberately `unknown`: every transport has its own —\n * `RequestInit` for fetch, something else for the next one. Core does not read\n * them, it passes them along.\n */\nexport interface ILankaRequestContext {\n\treadonly endpoint: string;\n\treadonly options: unknown;\n\t/**\n\t * Which attempt this is, counting from one.\n\t *\n\t * In the context rather than in the middleware itself, because a retry may be\n\t * started by someone other than the one counting: an auth refresh restarts the\n\t * request, and the retrying middleware must not mistake that for its own\n\t * second attempt.\n\t */\n\treadonly attempt: number;\n\t/**\n\t * This attempt's deadline, when middleware assigned one. It stops while the\n\t * page is seen hidden — a frozen WebView runs no timers — and resumes when it\n\t * shows.\n\t *\n\t * Read by CORE before every call into the transport, which is what allows a\n\t * deadline per request class: a file upload and a list read cannot share one\n\t * value, and the policy knows that difference while the framework does not.\n\t */\n\treadonly timeoutMs?: number;\n}\n\n/**\n * A wrapper around a request.\n *\n * ## A wrapper rather than `onRequest` / `onResponse` / `onError`\n *\n * Three hooks cannot express RETRY. `onError` can replace an error but cannot\n * run the request again — and retry plus auth refresh are the two main abilities\n * a request-policy plugin exists for. A wrapper expresses those and everything\n * the hooks expressed.\n *\n * ## Why the objection to `next()` does not carry over\n *\n * On the event bus, middleware that skips `next` SILENCES the event: subscribers\n * do not run and nothing records it. Here, skipping `next` means returning a\n * value instead of a request — and the caller receives that value, so the\n * decision is visible.\n *\n * ## Order\n *\n * Registered first wraps all the rest: it sees the request before everyone and\n * the response after everyone — ordinary layer semantics, where \"outer\" means\n * outer.\n */\nexport type TLankaRequestMiddleware = (\n\tctx: ILankaRequestContext,\n\tnext: (ctx: ILankaRequestContext) => Promise<unknown>,\n) => Promise<unknown>;\n\n/**\n * Folds the chain into one function.\n *\n * An empty chain returns `perform` as-is, with no wrappers and no cost: an app\n * without a request-policy plugin has no middleware at all and must not pay for\n * their absence.\n */\nexport function composeLankaRequestMiddleware(\n\tmiddleware: readonly TLankaRequestMiddleware[],\n\tperform: (ctx: ILankaRequestContext) => Promise<unknown>,\n): (ctx: ILankaRequestContext) => Promise<unknown> {\n\tif (middleware.length === 0) return perform;\n\n\treturn middleware.reduceRight<(ctx: ILankaRequestContext) => Promise<unknown>>(\n\t\t(next, current) => (ctx) => current(ctx, next),\n\t\tperform,\n\t);\n}\n"],"mappings":";AAkEO,SAAS,8BACf,YACA,SACkD;AAClD,MAAI,WAAW,WAAW,EAAG,QAAO;AAEpC,SAAO,WAAW;AAAA,IACjB,CAAC,MAAM,YAAY,CAAC,QAAQ,QAAQ,KAAK,IAAI;AAAA,IAC7C;AAAA,EACD;AACD;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LankaError
3
- } from "./chunk-G32H73QY.js";
3
+ } from "./chunk-INHAKVSO.js";
4
4
 
5
5
  // src/validation/lanka-validation-error/LankaValidationError.ts
6
6
  var LankaValidationError = class _LankaValidationError extends LankaError {
@@ -24,4 +24,4 @@ var LankaValidationError = class _LankaValidationError extends LankaError {
24
24
  export {
25
25
  LankaValidationError
26
26
  };
27
- //# sourceMappingURL=chunk-CRIRTOLB.js.map
27
+ //# sourceMappingURL=chunk-VI4DY5PN.js.map
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  createLankaScope
3
3
  } from "./chunk-M4BK6GBV.js";
4
- import {
5
- LankaGatewayLocator
6
- } from "./chunk-BMF4TM2Z.js";
7
- import {
8
- LankaScenarioLocator
9
- } from "./chunk-EH5WZSRJ.js";
10
4
  import {
11
5
  LankaSingletonLocator
12
6
  } from "./chunk-24MUFFHF.js";
13
7
  import {
14
8
  LankaSharedStoreLocator
15
9
  } from "./chunk-3R2NO47A.js";
10
+ import {
11
+ LankaGatewayLocator
12
+ } from "./chunk-BMF4TM2Z.js";
13
+ import {
14
+ LankaScenarioLocator
15
+ } from "./chunk-EH5WZSRJ.js";
16
16
  import {
17
17
  lankaScenarioBootstrap
18
18
  } from "./chunk-4VFVACSL.js";
@@ -735,4 +735,4 @@ export {
735
735
  resetActiveLanka,
736
736
  ALankaPlugin
737
737
  };
738
- //# sourceMappingURL=chunk-532WVMAF.js.map
738
+ //# sourceMappingURL=chunk-YEP54YU5.js.map
@@ -1,7 +1,7 @@
1
1
  import { I as ILankaScope } from './createLankaScope-DeElRH-E.js';
2
- import { I as ILankaRuntime } from './activeRuntime-DxB62KN4.js';
2
+ import { I as ILankaRuntime } from './activeRuntime-1Zj2m1Sx.js';
3
3
  import { a as ILankaHost, I as ILankaFlags } from './ILankaRuntimeConfig-Vl436GWK.js';
4
- import { T as TLankaRequestMiddleware } from './lankaRequestMiddleware-DAC5kCb7.js';
4
+ import { T as TLankaRequestMiddleware } from './lankaRequestMiddleware-CbXc1PAV.js';
5
5
 
6
6
  /**
7
7
  * A plugin is an extension core knows by SHAPE rather than by name.
@@ -1,5 +1,5 @@
1
- import { L as LankaError } from '../LankaError-D6RWNyLM.js';
2
- export { a as ILankaApiError, I as ILankaErrorInit, T as TLankaErrorKind } from '../LankaError-D6RWNyLM.js';
1
+ import { L as LankaError } from '../LankaError-CfDmuGKc.js';
2
+ export { a as ILankaApiError, I as ILankaErrorInit, T as TLankaErrorKind } from '../LankaError-CfDmuGKc.js';
3
3
  import { I as ILankaFieldError } from '../ILankaFieldError-D5931-vT.js';
4
4
  export { T as TLankaErrorHandler } from '../TLankaErrorHandler-Yfqtdh1M.js';
5
5
 
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createLankaApiError,
3
3
  handleLankaApiError
4
- } from "../chunk-DKLOCKS4.js";
4
+ } from "../chunk-3GQGNG7S.js";
5
5
  import "../chunk-J5LA3Q6D.js";
6
6
  import {
7
7
  LankaError
8
- } from "../chunk-G32H73QY.js";
8
+ } from "../chunk-INHAKVSO.js";
9
9
  import "../chunk-JGJBFELR.js";
10
10
  import "../chunk-XTVEHYIZ.js";
11
11
 
@@ -1,9 +1,9 @@
1
- import { T as TLankaExecuteOptions, I as IALankaGatewayConfig, a as TLankaRequestInit, b as ILankaRequest, c as TLankaQueryBuilder } from '../ALankaGateway-BrVPaZN5.js';
2
- export { A as ALankaGateway, d as TLankaQueryParams } from '../ALankaGateway-BrVPaZN5.js';
1
+ import { T as TLankaExecuteOptions, I as IALankaGatewayConfig, a as TLankaRequestInit, b as ILankaRequest, c as TLankaQueryBuilder } from '../ALankaGateway-CQrEPUHM.js';
2
+ export { A as ALankaGateway, d as TLankaQueryParams } from '../ALankaGateway-CQrEPUHM.js';
3
3
  import { I as ILankaValidator } from '../lankaStandardValidator-BUFnysK0.js';
4
4
  import { T as TLankaErrorHandler } from '../TLankaErrorHandler-Yfqtdh1M.js';
5
5
  export { I as ILankaInFlightCounter, l as lankaHttpInFlight } from '../lankaHttpInFlight-Bk1eIuSx.js';
6
- export { I as ILankaRequestContext, T as TLankaRequestMiddleware } from '../lankaRequestMiddleware-DAC5kCb7.js';
6
+ export { I as ILankaRequestContext, T as TLankaRequestMiddleware } from '../lankaRequestMiddleware-CbXc1PAV.js';
7
7
  import '@standard-schema/spec';
8
8
  import '../ILankaFieldError-D5931-vT.js';
9
9