@dads-framework/client 0.0.0-stage → 0.4.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 (152) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +83 -2
  3. package/dist/client.tsbuildinfo +1 -0
  4. package/dist/index.d.ts +16 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +15 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/lib/access-refusal.d.ts +8 -0
  9. package/dist/lib/access-refusal.d.ts.map +1 -0
  10. package/dist/lib/access-refusal.js +11 -0
  11. package/dist/lib/access-refusal.js.map +1 -0
  12. package/dist/lib/api-error.d.ts +86 -0
  13. package/dist/lib/api-error.d.ts.map +1 -0
  14. package/dist/lib/api-error.js +124 -0
  15. package/dist/lib/api-error.js.map +1 -0
  16. package/dist/lib/api-exchange-channel.d.ts +47 -0
  17. package/dist/lib/api-exchange-channel.d.ts.map +1 -0
  18. package/dist/lib/api-exchange-channel.js +43 -0
  19. package/dist/lib/api-exchange-channel.js.map +1 -0
  20. package/dist/lib/api-verbs.d.ts +115 -0
  21. package/dist/lib/api-verbs.d.ts.map +1 -0
  22. package/dist/lib/api-verbs.js +148 -0
  23. package/dist/lib/api-verbs.js.map +1 -0
  24. package/dist/lib/build-client-context.d.ts +44 -0
  25. package/dist/lib/build-client-context.d.ts.map +1 -0
  26. package/dist/lib/build-client-context.js +74 -0
  27. package/dist/lib/build-client-context.js.map +1 -0
  28. package/dist/lib/call-api.d.ts +77 -0
  29. package/dist/lib/call-api.d.ts.map +1 -0
  30. package/dist/lib/call-api.js +149 -0
  31. package/dist/lib/call-api.js.map +1 -0
  32. package/dist/lib/client-context.d.ts +32 -0
  33. package/dist/lib/client-context.d.ts.map +1 -0
  34. package/dist/lib/client-context.js +33 -0
  35. package/dist/lib/client-context.js.map +1 -0
  36. package/dist/lib/create-request-id.d.ts +14 -0
  37. package/dist/lib/create-request-id.d.ts.map +1 -0
  38. package/dist/lib/create-request-id.js +25 -0
  39. package/dist/lib/create-request-id.js.map +1 -0
  40. package/dist/lib/failure-presentation.d.ts +21 -0
  41. package/dist/lib/failure-presentation.d.ts.map +1 -0
  42. package/dist/lib/failure-presentation.js +9 -0
  43. package/dist/lib/failure-presentation.js.map +1 -0
  44. package/dist/lib/optimistic-cache.d.ts +84 -0
  45. package/dist/lib/optimistic-cache.d.ts.map +1 -0
  46. package/dist/lib/optimistic-cache.js +117 -0
  47. package/dist/lib/optimistic-cache.js.map +1 -0
  48. package/dist/lib/read-client-environment.d.ts +67 -0
  49. package/dist/lib/read-client-environment.d.ts.map +1 -0
  50. package/dist/lib/read-client-environment.js +85 -0
  51. package/dist/lib/read-client-environment.js.map +1 -0
  52. package/dist/lib/request-locale.d.ts +6 -0
  53. package/dist/lib/request-locale.d.ts.map +1 -0
  54. package/dist/lib/request-locale.js +31 -0
  55. package/dist/lib/request-locale.js.map +1 -0
  56. package/dist/lib/request-metadata.d.ts +22 -0
  57. package/dist/lib/request-metadata.d.ts.map +1 -0
  58. package/dist/lib/request-metadata.js +26 -0
  59. package/dist/lib/request-metadata.js.map +1 -0
  60. package/dist/lib/save-with-refresh.d.ts +13 -0
  61. package/dist/lib/save-with-refresh.d.ts.map +1 -0
  62. package/dist/lib/save-with-refresh.js +16 -0
  63. package/dist/lib/save-with-refresh.js.map +1 -0
  64. package/dist/lib/search-params.d.ts +11 -0
  65. package/dist/lib/search-params.d.ts.map +1 -0
  66. package/dist/lib/search-params.js +41 -0
  67. package/dist/lib/search-params.js.map +1 -0
  68. package/dist/lib/send-api-request.d.ts +24 -0
  69. package/dist/lib/send-api-request.d.ts.map +1 -0
  70. package/dist/lib/send-api-request.js +98 -0
  71. package/dist/lib/send-api-request.js.map +1 -0
  72. package/dist/lib/signed-url-upload.d.ts +18 -0
  73. package/dist/lib/signed-url-upload.d.ts.map +1 -0
  74. package/dist/lib/signed-url-upload.js +26 -0
  75. package/dist/lib/signed-url-upload.js.map +1 -0
  76. package/dist/lib/unauthorized-response-channel.d.ts +30 -0
  77. package/dist/lib/unauthorized-response-channel.d.ts.map +1 -0
  78. package/dist/lib/unauthorized-response-channel.js +38 -0
  79. package/dist/lib/unauthorized-response-channel.js.map +1 -0
  80. package/dist/telemetry/core/index.d.ts +3 -0
  81. package/dist/telemetry/core/index.d.ts.map +1 -0
  82. package/dist/telemetry/core/index.js +3 -0
  83. package/dist/telemetry/core/index.js.map +1 -0
  84. package/dist/telemetry/core/lib/client-telemetry-conformance.d.ts +13 -0
  85. package/dist/telemetry/core/lib/client-telemetry-conformance.d.ts.map +1 -0
  86. package/dist/telemetry/core/lib/client-telemetry-conformance.js +38 -0
  87. package/dist/telemetry/core/lib/client-telemetry-conformance.js.map +1 -0
  88. package/dist/telemetry/core/lib/client-telemetry.d.ts +48 -0
  89. package/dist/telemetry/core/lib/client-telemetry.d.ts.map +1 -0
  90. package/dist/telemetry/core/lib/client-telemetry.js +26 -0
  91. package/dist/telemetry/core/lib/client-telemetry.js.map +1 -0
  92. package/dist/telemetry/core/lib/in-memory-client-telemetry.d.ts +20 -0
  93. package/dist/telemetry/core/lib/in-memory-client-telemetry.d.ts.map +1 -0
  94. package/dist/telemetry/core/lib/in-memory-client-telemetry.js +23 -0
  95. package/dist/telemetry/core/lib/in-memory-client-telemetry.js.map +1 -0
  96. package/dist/telemetry/core/lib/none-client-telemetry.d.ts +16 -0
  97. package/dist/telemetry/core/lib/none-client-telemetry.d.ts.map +1 -0
  98. package/dist/telemetry/core/lib/none-client-telemetry.js +22 -0
  99. package/dist/telemetry/core/lib/none-client-telemetry.js.map +1 -0
  100. package/dist/telemetry/index.d.ts +19 -0
  101. package/dist/telemetry/index.d.ts.map +1 -0
  102. package/dist/telemetry/index.js +19 -0
  103. package/dist/telemetry/index.js.map +1 -0
  104. package/dist/telemetry/lib/create-client-telemetry.d.ts +38 -0
  105. package/dist/telemetry/lib/create-client-telemetry.d.ts.map +1 -0
  106. package/dist/telemetry/lib/create-client-telemetry.js +65 -0
  107. package/dist/telemetry/lib/create-client-telemetry.js.map +1 -0
  108. package/dist/telemetry/lib/fan-out-client-telemetry.d.ts +24 -0
  109. package/dist/telemetry/lib/fan-out-client-telemetry.d.ts.map +1 -0
  110. package/dist/telemetry/lib/fan-out-client-telemetry.js +56 -0
  111. package/dist/telemetry/lib/fan-out-client-telemetry.js.map +1 -0
  112. package/dist/telemetry/lib/install-global-error-reporting.d.ts +27 -0
  113. package/dist/telemetry/lib/install-global-error-reporting.d.ts.map +1 -0
  114. package/dist/telemetry/lib/install-global-error-reporting.js +43 -0
  115. package/dist/telemetry/lib/install-global-error-reporting.js.map +1 -0
  116. package/dist/telemetry/lib/local-client-telemetry.d.ts +44 -0
  117. package/dist/telemetry/lib/local-client-telemetry.d.ts.map +1 -0
  118. package/dist/telemetry/lib/local-client-telemetry.js +120 -0
  119. package/dist/telemetry/lib/local-client-telemetry.js.map +1 -0
  120. package/dist/telemetry/lib/logic/describe-client-error.d.ts +24 -0
  121. package/dist/telemetry/lib/logic/describe-client-error.d.ts.map +1 -0
  122. package/dist/telemetry/lib/logic/describe-client-error.js +124 -0
  123. package/dist/telemetry/lib/logic/describe-client-error.js.map +1 -0
  124. package/dist/telemetry/lib/logic/is-chunk-load-failure.d.ts +16 -0
  125. package/dist/telemetry/lib/logic/is-chunk-load-failure.d.ts.map +1 -0
  126. package/dist/telemetry/lib/logic/is-chunk-load-failure.js +34 -0
  127. package/dist/telemetry/lib/logic/is-chunk-load-failure.js.map +1 -0
  128. package/dist/telemetry/lib/logic/refused-read.d.ts +24 -0
  129. package/dist/telemetry/lib/logic/refused-read.d.ts.map +1 -0
  130. package/dist/telemetry/lib/logic/refused-read.js +33 -0
  131. package/dist/telemetry/lib/logic/refused-read.js.map +1 -0
  132. package/dist/telemetry/lib/logic/sentry-configuration.d.ts +67 -0
  133. package/dist/telemetry/lib/logic/sentry-configuration.d.ts.map +1 -0
  134. package/dist/telemetry/lib/logic/sentry-configuration.js +74 -0
  135. package/dist/telemetry/lib/logic/sentry-configuration.js.map +1 -0
  136. package/dist/telemetry/lib/logic/should-report-failure.d.ts +19 -0
  137. package/dist/telemetry/lib/logic/should-report-failure.d.ts.map +1 -0
  138. package/dist/telemetry/lib/logic/should-report-failure.js +41 -0
  139. package/dist/telemetry/lib/logic/should-report-failure.js.map +1 -0
  140. package/dist/telemetry/lib/optional-peer.d.ts +12 -0
  141. package/dist/telemetry/lib/optional-peer.d.ts.map +1 -0
  142. package/dist/telemetry/lib/optional-peer.js +37 -0
  143. package/dist/telemetry/lib/optional-peer.js.map +1 -0
  144. package/dist/telemetry/lib/sentry-client-telemetry.d.ts +74 -0
  145. package/dist/telemetry/lib/sentry-client-telemetry.d.ts.map +1 -0
  146. package/dist/telemetry/lib/sentry-client-telemetry.js +189 -0
  147. package/dist/telemetry/lib/sentry-client-telemetry.js.map +1 -0
  148. package/dist/telemetry/testing.d.ts +3 -0
  149. package/dist/telemetry/testing.d.ts.map +1 -0
  150. package/dist/telemetry/testing.js +3 -0
  151. package/dist/telemetry/testing.js.map +1 -0
  152. package/package.json +58 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-refusal.js","sourceRoot":"","sources":["../../src/lib/access-refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,aAA4B;IAC1E,OAAO,MAAM,KAAK,GAAG,IAAI,aAAa,KAAK,oBAAoB,CAAC;AAClE,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The typed failure every transport verb throws.
3
+ *
4
+ * Callers branch on `code` (the stable SCREAMING_SNAKE identifier the error
5
+ * envelope carries) or on `status` — never on `message`, whose wording the
6
+ * API is free to change (docs/architecture/api-conventions.md).
7
+ */
8
+ export declare class ApiError extends Error {
9
+ readonly status: number;
10
+ readonly code: string;
11
+ readonly details?: Record<string, unknown> | undefined;
12
+ readonly requestId?: string | undefined;
13
+ constructor(status: number, code: string, message: string, details?: Record<string, unknown> | undefined, requestId?: string | undefined);
14
+ }
15
+ /**
16
+ * A 401, given its own class.
17
+ *
18
+ * An expired or missing session is the one failure the whole app reacts to the
19
+ * same way, so it gets a type an `instanceof` can test instead of a status
20
+ * number every caller has to remember.
21
+ */
22
+ export declare class UnauthorizedError extends ApiError {
23
+ constructor(code: string, message: string, details?: Record<string, unknown>, requestId?: string);
24
+ }
25
+ /** A request that never received an HTTP response from the API. */
26
+ export declare class NetworkError extends Error {
27
+ constructor(cause: unknown);
28
+ }
29
+ /** One thing a response said it could not be. Paths and codes, never text. */
30
+ export type ContractDriftIssue = {
31
+ /** Where in the response the shape was wrong, e.g. `data.lines.0.quantity`. */
32
+ readonly path: string;
33
+ /** Zod's machine code for the mismatch, e.g. `invalid_type`. */
34
+ readonly code: string;
35
+ };
36
+ /**
37
+ * Message-free failure data safe to hand to a localized renderer.
38
+ *
39
+ * The server and JavaScript messages remain on their original errors for logs
40
+ * and debugging. They deliberately do not cross this seam into presentation.
41
+ *
42
+ * `cause` is the exception to that rule and the reason it is spelled out
43
+ * below: it carries the ORIGINAL thrown value for telemetry, which previously
44
+ * had nowhere to go — `readClientFailure` classified a `TypeError` from a
45
+ * render, a chunk-load failure, and a contract mismatch identically as
46
+ * `unexpected` and dropped every one of them on the floor. It is for reporting
47
+ * and logging only and is never rendered; the message-free posture of the
48
+ * presentation path is unchanged.
49
+ */
50
+ export type ClientFailure = {
51
+ readonly kind: "session-expired";
52
+ } | {
53
+ readonly kind: "network";
54
+ readonly cause?: unknown;
55
+ } | {
56
+ readonly kind: "api";
57
+ readonly status: number;
58
+ readonly code: string;
59
+ readonly details?: Readonly<Record<string, unknown>>;
60
+ }
61
+ /**
62
+ * The response did not match the contract the client compiled against —
63
+ * the two ends have drifted. Distinguished from `unexpected` because it is
64
+ * the one client-side failure that always means a deployment problem rather
65
+ * than a bug in either end's logic, and because it is actionable: the paths
66
+ * name exactly which fields disagree.
67
+ */
68
+ | {
69
+ readonly kind: "contract-drift";
70
+ readonly issues: readonly ContractDriftIssue[];
71
+ } | {
72
+ readonly kind: "unexpected";
73
+ readonly cause?: unknown;
74
+ };
75
+ /** Classify a thrown value without making its raw message renderable. */
76
+ export declare function readClientFailure(error: unknown): ClientFailure;
77
+ /**
78
+ * Turn a failed response into the typed error for its status.
79
+ *
80
+ * The body is parsed with the shared error-envelope contract when it matches
81
+ * and ignored when it does not — a proxy, a gateway, or a crash can answer
82
+ * with HTML, and the caller still deserves a typed failure rather than a
83
+ * parse error from the transport.
84
+ */
85
+ export declare function toApiError(status: number, body: unknown, fallbackRequestId: string): ApiError;
86
+ //# sourceMappingURL=api-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../src/lib/api-error.ts"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM;IAL7B,YACW,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA,EACjC,SAAS,CAAC,EAAE,MAAM,YAAA,EAK5B;CACF;AAED;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,EAG/F;CACF;AAED,mEAAmE;AACnE,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,KAAK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 * Every "is this an expected refusal?" decision in the app is an `instanceof`
7
+ * check on these classes. A script on the page (a browser extension, a link
8
+ * scanner) can replace the global `Error` with a constructor that returns an
9
+ * object of its own; `super()` then hands back that object, whose prototype is
10
+ * plain `Error`, and a 409 or a 401 stops being recognisable as one — it gets
11
+ * reported as a fault and shown as an unknown failure. Setting the prototype after `super()` keeps the class no
12
+ * matter what `Error` was when this module loaded.
13
+ */
14
+ function keepOwnPrototype(error, ownClass) {
15
+ if (Object.getPrototypeOf(error) !== ownClass.prototype) {
16
+ Object.setPrototypeOf(error, ownClass.prototype);
17
+ }
18
+ }
19
+ /**
20
+ * The typed failure every transport verb throws.
21
+ *
22
+ * Callers branch on `code` (the stable SCREAMING_SNAKE identifier the error
23
+ * envelope carries) or on `status` — never on `message`, whose wording the
24
+ * API is free to change (docs/architecture/api-conventions.md).
25
+ */
26
+ export class ApiError extends Error {
27
+ status;
28
+ code;
29
+ details;
30
+ requestId;
31
+ constructor(status, code, message, details, requestId) {
32
+ super(message);
33
+ this.status = status;
34
+ this.code = code;
35
+ this.details = details;
36
+ this.requestId = requestId;
37
+ keepOwnPrototype(this, new.target);
38
+ this.name = "ApiError";
39
+ }
40
+ }
41
+ /**
42
+ * A 401, given its own class.
43
+ *
44
+ * An expired or missing session is the one failure the whole app reacts to the
45
+ * same way, so it gets a type an `instanceof` can test instead of a status
46
+ * number every caller has to remember.
47
+ */
48
+ export class UnauthorizedError extends ApiError {
49
+ constructor(code, message, details, requestId) {
50
+ super(401, code, message, details, requestId);
51
+ this.name = "UnauthorizedError";
52
+ }
53
+ }
54
+ /** A request that never received an HTTP response from the API. */
55
+ export class NetworkError extends Error {
56
+ constructor(cause) {
57
+ super("The API request did not receive a response", { cause });
58
+ keepOwnPrototype(this, new.target);
59
+ this.name = "NetworkError";
60
+ }
61
+ }
62
+ /** Classify a thrown value without making its raw message renderable. */
63
+ export function readClientFailure(error) {
64
+ if (error instanceof UnauthorizedError) {
65
+ return { kind: "session-expired" };
66
+ }
67
+ if (error instanceof NetworkError) {
68
+ return { kind: "network", cause: error.cause };
69
+ }
70
+ if (error instanceof ApiError) {
71
+ return error.details === undefined
72
+ ? { kind: "api", status: error.status, code: error.code }
73
+ : {
74
+ kind: "api",
75
+ status: error.status,
76
+ code: error.code,
77
+ details: error.details,
78
+ };
79
+ }
80
+ if (error instanceof z.ZodError) {
81
+ return { kind: "contract-drift", issues: driftIssues(error) };
82
+ }
83
+ return { kind: "unexpected", cause: error };
84
+ }
85
+ /**
86
+ * Zod's issues, reduced to what is safe to send anywhere.
87
+ *
88
+ * Paths and codes only. `issue.message` is prose, and a custom refinement is
89
+ * free to compose it from the value it rejected — so a message can quote a
90
+ * customer's data, which must not ride a telemetry event out of the browser.
91
+ * A path names which field disagreed, which is the actionable half anyway.
92
+ */
93
+ function driftIssues(error) {
94
+ return error.issues.map((issue) => ({
95
+ path: issue.path.join("."),
96
+ code: issue.code,
97
+ }));
98
+ }
99
+ const UNAUTHORIZED_STATUS = 401;
100
+ /**
101
+ * Turn a failed response into the typed error for its status.
102
+ *
103
+ * The body is parsed with the shared error-envelope contract when it matches
104
+ * and ignored when it does not — a proxy, a gateway, or a crash can answer
105
+ * with HTML, and the caller still deserves a typed failure rather than a
106
+ * parse error from the transport.
107
+ */
108
+ export function toApiError(status, body, fallbackRequestId) {
109
+ const envelope = apiErrorSchema.safeParse(body);
110
+ const failure = envelope.success
111
+ ? envelope.data.error
112
+ : {
113
+ code: "HTTP_ERROR",
114
+ message: `Request failed with ${String(status)}`,
115
+ details: undefined,
116
+ requestId: undefined,
117
+ };
118
+ const requestId = failure.requestId ?? fallbackRequestId;
119
+ if (status === UNAUTHORIZED_STATUS) {
120
+ return new UnauthorizedError(failure.code, failure.message, failure.details, requestId);
121
+ }
122
+ return new ApiError(status, failure.code, failure.message, failure.details, requestId);
123
+ }
124
+ //# sourceMappingURL=api-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.js","sourceRoot":"","sources":["../../src/lib/api-error.ts"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,GAAG,CAAC;AAEhC;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,IAAa,EAAE,iBAAyB;IACjF,MAAM,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO;QAC9B,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;QACrB,CAAC,CAAC;YACE,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,uBAAuB,MAAM,CAAC,MAAM,CAAC,EAAE;YAChD,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;SACrB,CAAC;IACN,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC;IAEzD,IAAI,MAAM,KAAK,mBAAmB,EAAE,CAAC;QACnC,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACzF,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Every API call, announced to whoever is listening.
3
+ *
4
+ * Telemetry's problem is correlation: a browser fault is only half a story
5
+ * until you can reach the request it was about, and through that request's id
6
+ * the `request_log` row and the `audit_log` rows it produced. The transport
7
+ * mints that id, so the transport is the only place that can say it.
8
+ *
9
+ * A LIST of listeners, not a slot. `registerRequestMetadata` next door is
10
+ * deliberately singular — one owner may add headers and steer requests — and
11
+ * the feature-flag runtime holds it. Observation is a different kind of thing:
12
+ * several things may legitimately watch, and none of them may evict another.
13
+ * Modelled on `unauthorized-response-channel.ts` beside it for exactly that
14
+ * reason.
15
+ *
16
+ * Announcing is best-effort: a listener that throws is isolated, because a
17
+ * broken observer must not break the request it was observing.
18
+ */
19
+ import type { HttpMethod } from "./send-api-request.js";
20
+ /** One completed API call, as an observer needs to see it. */
21
+ export type ApiExchange = {
22
+ readonly method: HttpMethod;
23
+ /** The request path, without its query string. */
24
+ readonly path: string;
25
+ /** The status the API answered, or null when no response arrived. */
26
+ readonly status: number | null;
27
+ /** The id this call carried, which is `request_log`'s primary key. */
28
+ readonly requestId: string;
29
+ readonly durationMs: number;
30
+ /**
31
+ * True when the API refused the call for access: a 403, or a 404 its
32
+ * access edge marked (`ACCESS_REFUSAL_HEADER`) rather than a record that
33
+ * is not there. A 401 is a signed-out session, not this.
34
+ */
35
+ readonly refusedForAccess: boolean;
36
+ };
37
+ export type ApiExchangeListener = (exchange: ApiExchange) => void;
38
+ /** Watch every API call. Returns the function that stops watching. */
39
+ export declare function onApiExchange(listener: ApiExchangeListener): () => void;
40
+ /**
41
+ * Tell every listener about one call.
42
+ *
43
+ * Not exported from the barrel: announcing is the transport's own business,
44
+ * and a caller that could announce could forge correlation.
45
+ */
46
+ export declare function announceApiExchange(exchange: ApiExchange): void;
47
+ //# sourceMappingURL=api-exchange-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-exchange-channel.d.ts","sourceRoot":"","sources":["../../src/lib/api-exchange-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;AAIlE,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI,CAKvE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAQ/D"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Every API call, announced to whoever is listening.
3
+ *
4
+ * Telemetry's problem is correlation: a browser fault is only half a story
5
+ * until you can reach the request it was about, and through that request's id
6
+ * the `request_log` row and the `audit_log` rows it produced. The transport
7
+ * mints that id, so the transport is the only place that can say it.
8
+ *
9
+ * A LIST of listeners, not a slot. `registerRequestMetadata` next door is
10
+ * deliberately singular — one owner may add headers and steer requests — and
11
+ * the feature-flag runtime holds it. Observation is a different kind of thing:
12
+ * several things may legitimately watch, and none of them may evict another.
13
+ * Modelled on `unauthorized-response-channel.ts` beside it for exactly that
14
+ * reason.
15
+ *
16
+ * Announcing is best-effort: a listener that throws is isolated, because a
17
+ * broken observer must not break the request it was observing.
18
+ */
19
+ const listeners = new Set();
20
+ /** Watch every API call. Returns the function that stops watching. */
21
+ export function onApiExchange(listener) {
22
+ listeners.add(listener);
23
+ return () => {
24
+ listeners.delete(listener);
25
+ };
26
+ }
27
+ /**
28
+ * Tell every listener about one call.
29
+ *
30
+ * Not exported from the barrel: announcing is the transport's own business,
31
+ * and a caller that could announce could forge correlation.
32
+ */
33
+ export function announceApiExchange(exchange) {
34
+ for (const listener of listeners) {
35
+ try {
36
+ listener(exchange);
37
+ }
38
+ catch {
39
+ // A broken observer must not break the request it was observing.
40
+ }
41
+ }
42
+ }
43
+ //# sourceMappingURL=api-exchange-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-exchange-channel.js","sourceRoot":"","sources":["../../src/lib/api-exchange-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwBH,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEjD,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,QAA6B;IACzD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAqB;IACvD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;QACnE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { z } from "zod";
2
+ import { type BoundRoute, type HttpMethod, type PaginationMeta } from "@dads-framework/core/contract";
3
+ import { type ApiRequestHeaders } from "./send-api-request.js";
4
+ /**
5
+ * The three verbs every `web` API client calls.
6
+ *
7
+ * Each one takes the contract schema for what it sends and the contract schema
8
+ * for what it expects back, so both sides of a call are validated at the same
9
+ * seam and a caller never names a type by hand. That is the whole reason the
10
+ * schemas sit in the signature: a generic parameter the caller supplies (or an
11
+ * `as` on the result) would let the client's idea of a payload drift from the
12
+ * server's silently, which is the failure mode this lib exists to prevent.
13
+ */
14
+ /** A value paired with the contract schema that proves it is well formed. */
15
+ export type ApiArgument<TSchema extends z.ZodType> = {
16
+ readonly schema: TSchema;
17
+ readonly value: z.input<TSchema>;
18
+ };
19
+ /**
20
+ * A query object paired with its schema.
21
+ *
22
+ * Narrower than {@link ApiArgument} because a query string can only be built
23
+ * from a record of named values.
24
+ */
25
+ export type ApiQueryArgument<TQuery extends z.ZodType<Record<string, unknown>>> = {
26
+ readonly schema: TQuery;
27
+ readonly value: z.input<TQuery>;
28
+ };
29
+ /** One page of a collection endpoint, already unwrapped from its envelope. */
30
+ export type ApiPage<TItem> = {
31
+ readonly items: readonly TItem[];
32
+ readonly meta: PaginationMeta;
33
+ };
34
+ /** A page whose endpoint declares its own meta, extending the pagination meta. */
35
+ export type ApiPageWithMeta<TItem, TMeta extends PaginationMeta> = {
36
+ readonly items: readonly TItem[];
37
+ readonly meta: TMeta;
38
+ };
39
+ export type BinaryRequest<TBody extends z.ZodType, TQuery extends z.ZodType<Record<string, unknown>>> = {
40
+ readonly route: BoundRoute;
41
+ readonly body?: ApiArgument<TBody>;
42
+ readonly query?: ApiQueryArgument<TQuery>;
43
+ readonly signal?: AbortSignal;
44
+ readonly headers?: ApiRequestHeaders;
45
+ readonly accept?: string;
46
+ };
47
+ type GetRequest<TQuery extends z.ZodType<Record<string, unknown>>, TData extends z.ZodType> = {
48
+ readonly route: BoundRoute<"GET">;
49
+ readonly returns: TData;
50
+ readonly query?: ApiQueryArgument<TQuery>;
51
+ readonly signal?: AbortSignal;
52
+ readonly headers?: ApiRequestHeaders;
53
+ };
54
+ type SendRequest<TBody extends z.ZodType, TData extends z.ZodType, TQuery extends z.ZodType<Record<string, unknown>>> = {
55
+ readonly query?: ApiQueryArgument<TQuery>;
56
+ readonly returns: TData;
57
+ readonly body?: ApiArgument<TBody>;
58
+ readonly signal?: AbortSignal;
59
+ readonly headers?: ApiRequestHeaders;
60
+ } & MutationRequestLocation;
61
+ type NoContentRequest<TBody extends z.ZodType> = {
62
+ readonly body?: ApiArgument<TBody>;
63
+ readonly signal?: AbortSignal;
64
+ readonly headers?: ApiRequestHeaders;
65
+ } & MutationRequestLocation;
66
+ type MutationMethod = Exclude<HttpMethod, "GET">;
67
+ type MutationRequestLocation = {
68
+ readonly route: BoundRoute<MutationMethod>;
69
+ };
70
+ /**
71
+ * Read one resource: `GET path` unwrapped from its `{ data }` envelope.
72
+ */
73
+ export declare function getFromApi<TQuery extends z.ZodType<Record<string, unknown>>, TData extends z.ZodType>(request: GetRequest<TQuery, TData>): Promise<z.output<TData>>;
74
+ /**
75
+ * Read one page of a collection: `GET path` unwrapped to `{ items, meta }`.
76
+ *
77
+ * Separate from {@link getFromApi} because a paginated endpoint's `meta` is
78
+ * part of the answer, not decoration — a caller that dropped it could not
79
+ * render the next page.
80
+ */
81
+ export declare function getPageFromApi<TQuery extends z.ZodType<Record<string, unknown>>, TItem extends z.ZodType>(request: GetRequest<TQuery, TItem>): Promise<ApiPage<z.output<TItem>>>;
82
+ /**
83
+ * Read one page of a collection whose endpoint declares its own meta (a
84
+ * schema extending `paginationMetaSchema`), such as counts the page shows
85
+ * beside the rows: `GET path` unwrapped to `{ items, meta }`, the meta
86
+ * parsed by the endpoint's own meta schema.
87
+ */
88
+ export declare function getPageWithMetaFromApi<TQuery extends z.ZodType<Record<string, unknown>>, TItem extends z.ZodType, TMeta extends z.ZodType<PaginationMeta>>(request: GetRequest<TQuery, TItem> & {
89
+ readonly meta: TMeta;
90
+ }): Promise<ApiPageWithMeta<z.output<TItem>, z.output<TMeta>>>;
91
+ /**
92
+ * Change something: any non-GET verb, with the body validated before it is
93
+ * sent and the response unwrapped from its `{ data }` envelope.
94
+ *
95
+ * Validating the request body here rather than at the call site means a
96
+ * malformed payload fails in the caller's own stack trace, against the
97
+ * server's own contract, instead of coming back as a 400 the UI has to
98
+ * interpret.
99
+ */
100
+ export declare function sendToApi<TBody extends z.ZodType, TData extends z.ZodType, TQuery extends z.ZodType<Record<string, unknown>> = z.ZodType<Record<string, unknown>>>(request: SendRequest<TBody, TData, TQuery>): Promise<z.output<TData>>;
101
+ /**
102
+ * Change something whose answer is "done": a verb the API replies to with
103
+ * `204 No Content`.
104
+ *
105
+ * Separate from {@link sendToApi} because a 204 has no body at all, and
106
+ * reading one is not a degenerate case of reading a `{ data }` envelope — it
107
+ * throws. Every `deleteRoute` in this repo answers this way, and each still
108
+ * declares a request body (an audit reason), which is why the body argument
109
+ * survives while the response schema does not.
110
+ */
111
+ export declare function sendToApiWithoutResponse<TBody extends z.ZodType>(request: NoContentRequest<TBody>): Promise<void>;
112
+ /** Binary endpoints keep the transport's credentials, metadata, and error mapping. */
113
+ export declare function requestBinary<TBody extends z.ZodType, TQuery extends z.ZodType<Record<string, unknown>>>(request: BinaryRequest<TBody, TQuery>): Promise<Uint8Array>;
114
+ export {};
115
+ //# sourceMappingURL=api-verbs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-verbs.d.ts","sourceRoot":"","sources":["../../src/lib/api-verbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,cAAc,EAEpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,KAAK,iBAAiB,EAAkB,MAAM,uBAAuB,CAAC;AAE/E;;;;;;;;;GASG;AAEH,6EAA6E;AAC7E,MAAM,MAAM,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,IAAI;IACnD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B,CAAC;AAEF,kFAAkF;AACl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AS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5G,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,GACpC,OAAO,CAAC,UAAU,CAAC,CAWrB"}
@@ -0,0 +1,148 @@
1
+ import { z } from "zod";
2
+ import { apiPath, paginationMetaSchema, } from "@dads-framework/core/contract";
3
+ import { toSearchParams } from "./search-params.js";
4
+ import { sendApiRequest } from "./send-api-request.js";
5
+ /**
6
+ * Read one resource: `GET path` unwrapped from its `{ data }` envelope.
7
+ */
8
+ export async function getFromApi(request) {
9
+ const location = getRequestLocation(request);
10
+ const response = await sendApiRequest({
11
+ path: location.path,
12
+ method: location.method,
13
+ body: undefined,
14
+ search: toValidatedSearch(request.query),
15
+ signal: request.signal,
16
+ headers: request.headers,
17
+ });
18
+ return unwrapData(await response.json(), request.returns);
19
+ }
20
+ /**
21
+ * Read one page of a collection: `GET path` unwrapped to `{ items, meta }`.
22
+ *
23
+ * Separate from {@link getFromApi} because a paginated endpoint's `meta` is
24
+ * part of the answer, not decoration — a caller that dropped it could not
25
+ * render the next page.
26
+ */
27
+ export async function getPageFromApi(request) {
28
+ const location = getRequestLocation(request);
29
+ const response = await sendApiRequest({
30
+ path: location.path,
31
+ method: location.method,
32
+ body: undefined,
33
+ search: toValidatedSearch(request.query),
34
+ signal: request.signal,
35
+ headers: request.headers,
36
+ });
37
+ const envelope = paginatedEnvelopeSchema.parse(await response.json());
38
+ return {
39
+ items: envelope.data.map((item) => request.returns.parse(item)),
40
+ meta: envelope.meta,
41
+ };
42
+ }
43
+ /**
44
+ * Read one page of a collection whose endpoint declares its own meta (a
45
+ * schema extending `paginationMetaSchema`), such as counts the page shows
46
+ * beside the rows: `GET path` unwrapped to `{ items, meta }`, the meta
47
+ * parsed by the endpoint's own meta schema.
48
+ */
49
+ export async function getPageWithMetaFromApi(request) {
50
+ const location = getRequestLocation(request);
51
+ const response = await sendApiRequest({
52
+ path: location.path,
53
+ method: location.method,
54
+ body: undefined,
55
+ search: toValidatedSearch(request.query),
56
+ signal: request.signal,
57
+ headers: request.headers,
58
+ });
59
+ const envelope = z.object({ data: z.array(z.unknown()), meta: z.unknown() }).parse(await response.json());
60
+ return {
61
+ items: envelope.data.map((item) => request.returns.parse(item)),
62
+ meta: request.meta.parse(envelope.meta),
63
+ };
64
+ }
65
+ /**
66
+ * Change something: any non-GET verb, with the body validated before it is
67
+ * sent and the response unwrapped from its `{ data }` envelope.
68
+ *
69
+ * Validating the request body here rather than at the call site means a
70
+ * malformed payload fails in the caller's own stack trace, against the
71
+ * server's own contract, instead of coming back as a 400 the UI has to
72
+ * interpret.
73
+ */
74
+ export async function sendToApi(request) {
75
+ const location = mutationRequestLocation(request);
76
+ const response = await sendApiRequest({
77
+ path: location.path,
78
+ method: location.method,
79
+ body: request.body?.schema.parse(request.body.value),
80
+ search: toValidatedSearch(request.query),
81
+ signal: request.signal,
82
+ headers: request.headers,
83
+ });
84
+ return unwrapData(await response.json(), request.returns);
85
+ }
86
+ /**
87
+ * Change something whose answer is "done": a verb the API replies to with
88
+ * `204 No Content`.
89
+ *
90
+ * Separate from {@link sendToApi} because a 204 has no body at all, and
91
+ * reading one is not a degenerate case of reading a `{ data }` envelope — it
92
+ * throws. Every `deleteRoute` in this repo answers this way, and each still
93
+ * declares a request body (an audit reason), which is why the body argument
94
+ * survives while the response schema does not.
95
+ */
96
+ export async function sendToApiWithoutResponse(request) {
97
+ const location = mutationRequestLocation(request);
98
+ await sendApiRequest({
99
+ path: location.path,
100
+ method: location.method,
101
+ body: request.body?.schema.parse(request.body.value),
102
+ search: undefined,
103
+ signal: request.signal,
104
+ headers: request.headers,
105
+ });
106
+ }
107
+ /** Binary endpoints keep the transport's credentials, metadata, and error mapping. */
108
+ export async function requestBinary(request) {
109
+ const response = await sendApiRequest({
110
+ path: apiPath(request.route.path),
111
+ method: request.route.method,
112
+ body: request.body?.schema.parse(request.body.value),
113
+ search: toValidatedSearch(request.query),
114
+ signal: request.signal,
115
+ headers: request.headers,
116
+ accept: request.accept ?? "application/octet-stream",
117
+ });
118
+ return new Uint8Array(await response.arrayBuffer());
119
+ }
120
+ function getRequestLocation(request) {
121
+ return { path: apiPath(request.route.path), method: request.route.method };
122
+ }
123
+ function mutationRequestLocation(request) {
124
+ return { path: apiPath(request.route.path), method: request.route.method };
125
+ }
126
+ /**
127
+ * The envelope shape, checked before the payload it carries.
128
+ *
129
+ * `data` is left `unknown` here on purpose: the endpoint's own contract parses
130
+ * it in a second step, which keeps the envelope check independent of the
131
+ * caller's schema and gives a schema mismatch an error message that names the
132
+ * resource rather than the envelope.
133
+ */
134
+ const successEnvelopeSchema = z.object({ data: z.unknown() });
135
+ const paginatedEnvelopeSchema = z.object({
136
+ data: z.array(z.unknown()),
137
+ meta: paginationMetaSchema,
138
+ });
139
+ function unwrapData(payload, returns) {
140
+ return returns.parse(successEnvelopeSchema.parse(payload).data);
141
+ }
142
+ function toValidatedSearch(query) {
143
+ if (query === undefined) {
144
+ return undefined;
145
+ }
146
+ return toSearchParams(query.schema.parse(query.value));
147
+ }
148
+ //# sourceMappingURL=api-verbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-verbs.js","sourceRoot":"","sources":["../../src/lib/api-verbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,OAAO,EAIP,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA0B,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAwF/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAkC;IAElC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC;QACpC,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,M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C,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AAC7E,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAuD;IACtF,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAE9D,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC1B,IAAI,EAAE,oBAAoB;CAC3B,CAAC,CAAC;AAEH,SAAS,UAAU,CAA0B,OAAgB,EAAE,OAAc;IAC3E,OAAO,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,iBAAiB,CACxB,KAA2C;IAE3C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { ClientContext } from "@dads-framework/core/contract";
2
+ /**
3
+ * What one browser tab can say about itself, before any of it is shaped for
4
+ * the wire. Every field is optional because every read behind it can be
5
+ * missing: an older browser, a headless runtime, a `navigator` without the
6
+ * non-standard extras.
7
+ *
8
+ * Reading the values is `read-client-environment.ts`'s job; turning them into
9
+ * a valid {@link ClientContext} is this module's, which is why this type is a
10
+ * plain snapshot with no globals in it.
11
+ */
12
+ export type ClientEnvironmentSnapshot = {
13
+ readonly build: string | undefined;
14
+ readonly timeZone: string | undefined;
15
+ readonly locale: string | undefined;
16
+ readonly routeId: string | undefined;
17
+ readonly viewport: {
18
+ readonly w: number;
19
+ readonly h: number;
20
+ readonly dpr: number;
21
+ } | undefined;
22
+ readonly screen: {
23
+ readonly w: number;
24
+ readonly h: number;
25
+ } | undefined;
26
+ readonly touch: boolean | undefined;
27
+ readonly online: boolean | undefined;
28
+ readonly connection: string | undefined;
29
+ readonly deviceMemory: number | undefined;
30
+ readonly hardwareConcurrency: number | undefined;
31
+ readonly tabAgeMs: number | undefined;
32
+ };
33
+ /**
34
+ * Shape one browser snapshot into the `x-client-context` payload.
35
+ *
36
+ * Pure, and deliberately forgiving: it clamps every string to the contract's
37
+ * length and rounds every count to a whole number so the server's strict
38
+ * schema accepts the result. The server drops the whole context on the first
39
+ * violation (`decodeClientContext` returns `null`), so one absurd `routeId`
40
+ * must not take the build stamp down with it. Absent fields stay `undefined`
41
+ * and disappear when the context is serialized for the header.
42
+ */
43
+ export declare function buildClientContext(environment: ClientEnvironmentSnapshot): ClientContext;
44
+ //# sourceMappingURL=build-client-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-client-context.d.ts","sourceRoot":"","sources":["../../src/lib/build-client-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,Q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