stitchkit 0.80.1 → 0.82.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 (184) hide show
  1. package/CHANGELOG.md +6552 -0
  2. package/README.md +4 -0
  3. package/dist/agent-runtime/provider-failure.d.ts.map +1 -1
  4. package/dist/agent-runtime-coding-tools.js +1 -1
  5. package/dist/agent-runtime-harness.js +7 -5
  6. package/dist/agent-runtime.js +15 -19
  7. package/dist/application/notification-outbox.d.ts +80 -0
  8. package/dist/application/notification-outbox.d.ts.map +1 -0
  9. package/dist/application/process-lifecycle.d.ts +166 -0
  10. package/dist/application/process-lifecycle.d.ts.map +1 -0
  11. package/dist/application/state-store.d.ts +18 -0
  12. package/dist/application/state-store.d.ts.map +1 -0
  13. package/dist/application.d.ts +3 -0
  14. package/dist/application.d.ts.map +1 -1
  15. package/dist/application.js +568 -11
  16. package/dist/browser/http.d.ts +14 -0
  17. package/dist/browser/http.d.ts.map +1 -1
  18. package/dist/browser/resumable.d.ts +6 -0
  19. package/dist/browser/resumable.d.ts.map +1 -1
  20. package/dist/cli.js +9 -7
  21. package/dist/contract/define.d.ts +27 -4
  22. package/dist/contract/define.d.ts.map +1 -1
  23. package/dist/contract/errors-factory.d.ts +22 -3
  24. package/dist/contract/errors-factory.d.ts.map +1 -1
  25. package/dist/contract/index.d.ts +2 -2
  26. package/dist/contract/index.d.ts.map +1 -1
  27. package/dist/contract/index.js +1 -1
  28. package/dist/geo/index.d.ts +4 -0
  29. package/dist/geo/index.d.ts.map +1 -0
  30. package/dist/geo/maxmind.d.ts +4 -0
  31. package/dist/geo/maxmind.d.ts.map +1 -0
  32. package/dist/geo/resolver.d.ts +9 -0
  33. package/dist/geo/resolver.d.ts.map +1 -0
  34. package/dist/geo/types.d.ts +59 -0
  35. package/dist/geo/types.d.ts.map +1 -0
  36. package/dist/geo.d.ts +3 -0
  37. package/dist/geo.d.ts.map +1 -0
  38. package/dist/geo.js +245 -0
  39. package/dist/{index-9s6z8vgf.js → index-1dd82z59.js} +1 -1
  40. package/dist/{index-vwp69871.js → index-27487ay5.js} +4 -4
  41. package/dist/{index-7ag81v2f.js → index-27gm3d6g.js} +10 -321
  42. package/dist/{index-y01f4223.js → index-2bxcmqkb.js} +127 -43
  43. package/dist/{index-dxesg10d.js → index-3ds42w1w.js} +3 -3
  44. package/dist/index-3xwxfj4z.js +334 -0
  45. package/dist/{index-egaabxkz.js → index-5z8tezpx.js} +2 -2
  46. package/dist/{index-fxz0v7vg.js → index-7evdsyez.js} +1 -83
  47. package/dist/{index-xcetq6j3.js → index-90d7h2cr.js} +32 -13
  48. package/dist/{index-t0z5p5w6.js → index-apn8repm.js} +1 -1
  49. package/dist/{index-758zx2ha.js → index-dggwnnjv.js} +2 -2
  50. package/dist/{index-dwf1f2ap.js → index-f9mb610r.js} +1 -62
  51. package/dist/{index-5mtc969c.js → index-fwbkp2jn.js} +1 -1
  52. package/dist/index-p13mwz16.js +16 -0
  53. package/dist/{index-m9kzax52.js → index-p18f59zy.js} +21 -5
  54. package/dist/{index-hb5pf3s4.js → index-qmgs7y68.js} +1 -1
  55. package/dist/{index-2rwwmr7v.js → index-s4ckmrac.js} +1 -1
  56. package/dist/{index-h4pj6fta.js → index-s8cnx02s.js} +8 -5
  57. package/dist/{index-k9ay6v6d.js → index-vchzar7e.js} +74 -23
  58. package/dist/index-vsbzgd7b.js +84 -0
  59. package/dist/{index-dxjjv399.js → index-xbppf54a.js} +95 -15
  60. package/dist/index-y91ry9h2.js +4 -0
  61. package/dist/index-zcgf3gqf.js +83 -0
  62. package/dist/index.js +17 -13
  63. package/dist/internal/error-message.d.ts +3 -0
  64. package/dist/internal/error-message.d.ts.map +1 -0
  65. package/dist/internal/media-type.d.ts +8 -0
  66. package/dist/internal/media-type.d.ts.map +1 -0
  67. package/dist/internal/route-pattern.d.ts +21 -0
  68. package/dist/internal/route-pattern.d.ts.map +1 -1
  69. package/dist/internal/upgrade-plan.d.ts +18 -0
  70. package/dist/internal/upgrade-plan.d.ts.map +1 -0
  71. package/dist/node.js +9 -6
  72. package/dist/observability/audit.d.ts +28 -1
  73. package/dist/observability/audit.d.ts.map +1 -1
  74. package/dist/observability/bounded-logger.d.ts +20 -0
  75. package/dist/observability/bounded-logger.d.ts.map +1 -0
  76. package/dist/observability/context.d.ts +12 -3
  77. package/dist/observability/context.d.ts.map +1 -1
  78. package/dist/observability/index.d.ts +3 -2
  79. package/dist/observability/index.d.ts.map +1 -1
  80. package/dist/observability/index.js +138 -8
  81. package/dist/observability/sanitize.d.ts +17 -0
  82. package/dist/observability/sanitize.d.ts.map +1 -1
  83. package/dist/primitives.js +1 -1
  84. package/dist/react/query-client.d.ts +33 -0
  85. package/dist/react/query-client.d.ts.map +1 -0
  86. package/dist/react.d.ts +1 -0
  87. package/dist/react.d.ts.map +1 -1
  88. package/dist/react.js +83 -1
  89. package/dist/realtime/registry.d.ts +93 -0
  90. package/dist/realtime/registry.d.ts.map +1 -0
  91. package/dist/release/header.d.ts +9 -0
  92. package/dist/release/header.d.ts.map +1 -0
  93. package/dist/release/marker.d.ts +39 -0
  94. package/dist/release/marker.d.ts.map +1 -0
  95. package/dist/release/socket.d.ts +57 -0
  96. package/dist/release/socket.d.ts.map +1 -0
  97. package/dist/release/watcher.d.ts +66 -0
  98. package/dist/release/watcher.d.ts.map +1 -0
  99. package/dist/release.d.ts +15 -0
  100. package/dist/release.d.ts.map +1 -0
  101. package/dist/release.js +196 -0
  102. package/dist/remote.js +12 -7
  103. package/dist/server/context.d.ts +2 -1
  104. package/dist/server/context.d.ts.map +1 -1
  105. package/dist/server/create.d.ts.map +1 -1
  106. package/dist/server/error-hook.d.ts +17 -16
  107. package/dist/server/error-hook.d.ts.map +1 -1
  108. package/dist/server/file-state-store.d.ts +23 -0
  109. package/dist/server/file-state-store.d.ts.map +1 -0
  110. package/dist/server/implement.d.ts.map +1 -1
  111. package/dist/server/index.d.ts +5 -2
  112. package/dist/server/index.d.ts.map +1 -1
  113. package/dist/server/index.js +469 -11
  114. package/dist/server/middleware/cookies.d.ts +33 -1
  115. package/dist/server/middleware/cookies.d.ts.map +1 -1
  116. package/dist/server/middleware/cors.d.ts +16 -1
  117. package/dist/server/middleware/cors.d.ts.map +1 -1
  118. package/dist/server/openapi.d.ts.map +1 -1
  119. package/dist/server/release-signal.d.ts +35 -0
  120. package/dist/server/release-signal.d.ts.map +1 -0
  121. package/dist/server/router.d.ts.map +1 -1
  122. package/dist/server/types.d.ts +26 -2
  123. package/dist/server/types.d.ts.map +1 -1
  124. package/dist/testing/surface-manifest.d.ts.map +1 -1
  125. package/dist/testing.js +7 -4
  126. package/dist/tool-invoker.js +8 -6
  127. package/dist/tools/download-core.d.ts.map +1 -1
  128. package/dist/tools/remote.d.ts.map +1 -1
  129. package/dist/tools/view-file.d.ts.map +1 -1
  130. package/dist/tools.js +20 -16
  131. package/dist/tracking/attribution.d.ts +51 -0
  132. package/dist/tracking/attribution.d.ts.map +1 -0
  133. package/dist/tracking/beacon.d.ts +14 -0
  134. package/dist/tracking/beacon.d.ts.map +1 -0
  135. package/dist/tracking/clicks.d.ts +46 -0
  136. package/dist/tracking/clicks.d.ts.map +1 -0
  137. package/dist/tracking/client.d.ts +121 -0
  138. package/dist/tracking/client.d.ts.map +1 -0
  139. package/dist/tracking/contract.d.ts +57 -0
  140. package/dist/tracking/contract.d.ts.map +1 -0
  141. package/dist/tracking/delivery.d.ts +24 -0
  142. package/dist/tracking/delivery.d.ts.map +1 -0
  143. package/dist/tracking/host.d.ts +43 -0
  144. package/dist/tracking/host.d.ts.map +1 -0
  145. package/dist/tracking/once-per-page.d.ts +17 -0
  146. package/dist/tracking/once-per-page.d.ts.map +1 -0
  147. package/dist/tracking/outbox-storage-indexeddb.d.ts +12 -0
  148. package/dist/tracking/outbox-storage-indexeddb.d.ts.map +1 -0
  149. package/dist/tracking/outbox-storage-memory.d.ts +12 -0
  150. package/dist/tracking/outbox-storage-memory.d.ts.map +1 -0
  151. package/dist/tracking/outbox.d.ts +98 -0
  152. package/dist/tracking/outbox.d.ts.map +1 -0
  153. package/dist/tracking/schemas.d.ts +183 -0
  154. package/dist/tracking/schemas.d.ts.map +1 -0
  155. package/dist/tracking/scroll.d.ts +22 -0
  156. package/dist/tracking/scroll.d.ts.map +1 -0
  157. package/dist/tracking/sequence-reserve.d.ts +34 -0
  158. package/dist/tracking/sequence-reserve.d.ts.map +1 -0
  159. package/dist/tracking/server/active-interval.d.ts +26 -0
  160. package/dist/tracking/server/active-interval.d.ts.map +1 -0
  161. package/dist/tracking/server/bot.d.ts +9 -0
  162. package/dist/tracking/server/bot.d.ts.map +1 -0
  163. package/dist/tracking/server/disposition.d.ts +55 -0
  164. package/dist/tracking/server/disposition.d.ts.map +1 -0
  165. package/dist/tracking/server/hash.d.ts +13 -0
  166. package/dist/tracking/server/hash.d.ts.map +1 -0
  167. package/dist/tracking/server/presence.d.ts +27 -0
  168. package/dist/tracking/server/presence.d.ts.map +1 -0
  169. package/dist/tracking/server/visit-lease.d.ts +92 -0
  170. package/dist/tracking/server/visit-lease.d.ts.map +1 -0
  171. package/dist/tracking/visible-time.d.ts +38 -0
  172. package/dist/tracking/visible-time.d.ts.map +1 -0
  173. package/dist/tracking-server.d.ts +15 -0
  174. package/dist/tracking-server.d.ts.map +1 -0
  175. package/dist/tracking-server.js +173 -0
  176. package/dist/tracking.d.ts +24 -0
  177. package/dist/tracking.d.ts.map +1 -0
  178. package/dist/tracking.js +1091 -0
  179. package/dist/upgrade-cli.d.ts +27 -0
  180. package/dist/upgrade-cli.d.ts.map +1 -0
  181. package/dist/upgrade-cli.js +177 -0
  182. package/llms-full.txt +1001 -29
  183. package/llms.txt +4 -0
  184. package/package.json +30 -5
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/observability/context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM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;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,IAAI,CAGP;AAED,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EACvD,OAAO,GAAE,yBAA8B,GACtC,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAiBhD"}
@@ -6,8 +6,9 @@
6
6
  * framework-owned HTTP completion plus canonical tool hooks into independent
7
7
  * sinks.
8
8
  */
9
- export { createObservability, type HttpRequestCompletion, type HttpRequestObserver, type Observability, type ObservabilityConfig, type RequestEventSinkConfig, type RequestObservabilityConfig, type SinkDrop, type SinkDropReason, type SinkError, } from './audit.js';
10
- export { getRequestContext, getTraceId, getUserId, type RequestContext, runWithRequestContext, setRequestDimensions, setRequestEndpoint, setRequestError, setRequestUser, type WrapRequestContextOptions, wrapInRequestContext, } from './context.js';
9
+ export { createDimensionsProjector, createObservability, type DimensionsProjector, type DimensionsProjectorConfig, type HttpRequestCompletion, type HttpRequestObserver, type Observability, type ObservabilityConfig, type ProjectedDimensions, type RequestEventSinkConfig, type RequestObservabilityConfig, type SinkDrop, type SinkDropReason, type SinkError, } from './audit.js';
10
+ export { type BoundedLoggerBounds, type BoundedLoggerOptions, createBoundedLogger, DEFAULT_REDACT_PATHS, } from './bounded-logger.js';
11
+ export { type DimensionCollision, getRequestContext, getTraceId, getUserId, type RequestContext, runWithRequestContext, type SetRequestDimensionsOptions, setRequestDimensions, setRequestEndpoint, setRequestError, setRequestUser, type WrapRequestContextOptions, wrapInRequestContext, } from './context.js';
11
12
  export type { RequestEvent } from './event.js';
12
13
  export { type JsonValue, measureSize, redact, type SanitizeOptions, type SizeMeasure, sanitizePayload, truncatePreview, } from './sanitize.js';
13
14
  export { type ObservabilityDrainReport, ObservabilityDrainReportSchema, type ObservabilitySinkStatus, ObservabilitySinkStatusSchema, type ObservabilityStatus, ObservabilityStatusSchema, } from './status.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,KAAK,cAAc,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,KAAK,yBAAyB,EAC9B,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,KAAK,SAAS,EACd,WAAW,EACX,MAAM,EACN,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,KAAK,yBAAyB,EAC9B,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,KAAK,SAAS,EACd,WAAW,EACX,MAAM,EACN,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC"}
@@ -10,7 +10,7 @@ import {
10
10
  redact,
11
11
  sanitizePayload,
12
12
  truncatePreview
13
- } from "../index-dxjjv399.js";
13
+ } from "../index-xbppf54a.js";
14
14
  import {
15
15
  getRequestContext,
16
16
  getTraceId,
@@ -21,25 +21,55 @@ import {
21
21
  setRequestError,
22
22
  setRequestUser,
23
23
  wrapInRequestContext
24
- } from "../index-dwf1f2ap.js";
24
+ } from "../index-vsbzgd7b.js";
25
+ import"../index-f9mb610r.js";
26
+ import {
27
+ recordedErrorMessage
28
+ } from "../index-7evdsyez.js";
29
+ import"../index-2bxcmqkb.js";
30
+ import"../index-6k1937bx.js";
31
+ import"../index-0w9abg87.js";
25
32
  import {
26
33
  childSpan,
27
34
  createTraceContext,
28
35
  formatTraceparent,
29
36
  parseTraceparent,
30
- recordedErrorMessage,
31
37
  resolvePropagationContext,
32
38
  resolveTraceContext
33
- } from "../index-fxz0v7vg.js";
34
- import"../index-y01f4223.js";
35
- import"../index-6k1937bx.js";
36
- import"../index-0w9abg87.js";
39
+ } from "../index-zcgf3gqf.js";
37
40
  import"../index-kzfs85xp.js";
38
41
  import {
39
42
  isRecord
40
43
  } from "../index-77fekveh.js";
41
44
 
42
45
  // src/observability/audit.ts
46
+ function writeProjectedDimensions(dimensions, collision) {
47
+ if (!dimensions)
48
+ return;
49
+ const materialized = {};
50
+ for (const [key, value] of Object.entries(dimensions)) {
51
+ if (value !== undefined)
52
+ materialized[key] = value;
53
+ }
54
+ if (Object.keys(materialized).length > 0) {
55
+ setRequestDimensions(materialized, { collision });
56
+ }
57
+ }
58
+ function createDimensionsProjector(config) {
59
+ const collision = config.collision ?? "overwrite";
60
+ return Object.freeze({
61
+ request(ctx, endpoint) {
62
+ writeProjectedDimensions(config.request?.(ctx, endpoint), collision);
63
+ },
64
+ result(ctx, result, endpoint) {
65
+ writeProjectedDimensions(config.result?.(ctx, result, endpoint), collision);
66
+ return result;
67
+ },
68
+ error(ctx, error, endpoint) {
69
+ writeProjectedDimensions(config.error?.(ctx, error, endpoint), collision);
70
+ }
71
+ });
72
+ }
43
73
  function toolErrorMessage(result) {
44
74
  const { details, hint } = result;
45
75
  if (isRecord(details) && typeof details.message === "string") {
@@ -222,6 +252,103 @@ function createObservability(config) {
222
252
  }
223
253
  };
224
254
  }
255
+ // src/observability/bounded-logger.ts
256
+ var DEFAULT_REDACT_PATHS = Object.freeze([
257
+ "*.password",
258
+ "*.token",
259
+ "*.cookie",
260
+ "*.authorization",
261
+ "*.secret",
262
+ "**.password",
263
+ "**.token",
264
+ "**.cookie",
265
+ "**.authorization",
266
+ "**.secret"
267
+ ]);
268
+ function asLogRecord(value) {
269
+ if (isRecord(value)) {
270
+ if (value._truncated === true) {
271
+ return {
272
+ message: "[truncated log entry]",
273
+ data: {
274
+ _truncated: true,
275
+ _originalBytes: value._originalBytes,
276
+ preview: value.preview
277
+ }
278
+ };
279
+ }
280
+ const message = typeof value.message === "string" ? value.message : "[sanitized log entry]";
281
+ const data = value.data;
282
+ return { message, ...isRecord(data) ? { data } : {} };
283
+ }
284
+ return { message: "[truncated log entry]", data: { entry: value } };
285
+ }
286
+ function byteLength(value) {
287
+ return measureSize(value).responseBytes;
288
+ }
289
+ function fitLogRecord(record, maxBytes) {
290
+ let message = record.message;
291
+ let data = record.data ? { ...record.data } : undefined;
292
+ while (byteLength({ message, data }) > maxBytes) {
293
+ if (typeof data?.preview === "string" && data.preview.length > 0) {
294
+ const points = Array.from(data.preview);
295
+ data.preview = points.length <= 1 ? "" : `${points.slice(0, points.length / 2).join("")}…`;
296
+ continue;
297
+ }
298
+ if (message.length > 16) {
299
+ const points = Array.from(message);
300
+ message = `${points.slice(0, points.length / 2).join("")}…`;
301
+ continue;
302
+ }
303
+ data = { _truncated: true };
304
+ message = "[truncated]";
305
+ break;
306
+ }
307
+ return { message, ...data && { data } };
308
+ }
309
+ function createBoundedLogger(options) {
310
+ const entryBytes = options.bounds?.entryBytes ?? 65536;
311
+ if (!Number.isSafeInteger(entryBytes) || entryBytes < 128) {
312
+ throw new TypeError("createBoundedLogger entryBytes must be an integer of at least 128");
313
+ }
314
+ const write = (level, message, data) => {
315
+ try {
316
+ const context = getRequestContext();
317
+ const enriched = {
318
+ ...data,
319
+ ...context?.trace.traceId !== undefined && { traceId: context.trace.traceId },
320
+ ...context?.trace.spanId !== undefined && { spanId: context.trace.spanId },
321
+ ...context?.userId !== undefined && { userId: context.userId },
322
+ ...context?.dimensions !== undefined && { dimensions: context.dimensions }
323
+ };
324
+ const value = sanitizePayload({ message, data: enriched }, {
325
+ sensitiveKeys: options.redact?.keys,
326
+ includeDefaultSensitiveKeys: true,
327
+ sensitivePaths: [
328
+ ...DEFAULT_REDACT_PATHS,
329
+ ...(options.redact?.paths ?? []).map((path) => `data.${path}`)
330
+ ],
331
+ sensitiveUrlPatterns: options.sensitiveUrlPatterns,
332
+ maxStringLength: options.bounds?.stringLength ?? 4000,
333
+ maxCollectionLength: options.bounds?.collectionLength ?? 100,
334
+ maxDepth: options.bounds?.depth ?? 6,
335
+ maxBytes: entryBytes
336
+ });
337
+ const sanitized = fitLogRecord(asLogRecord(value), entryBytes);
338
+ const result = options.sink[level](sanitized.message, sanitized.data);
339
+ if (result instanceof Promise)
340
+ result.catch(() => {
341
+ return;
342
+ });
343
+ } catch {}
344
+ };
345
+ return {
346
+ info: (message, data) => write("info", message, data),
347
+ warn: (message, data) => write("warn", message, data),
348
+ error: (message, data) => write("error", message, data),
349
+ debug: (message, data) => write("debug", message, data)
350
+ };
351
+ }
225
352
  export {
226
353
  wrapInRequestContext,
227
354
  truncatePreview,
@@ -242,8 +369,11 @@ export {
242
369
  formatTraceparent,
243
370
  createTraceContext,
244
371
  createObservability,
372
+ createDimensionsProjector,
373
+ createBoundedLogger,
245
374
  childSpan,
246
375
  ObservabilityStatusSchema,
247
376
  ObservabilitySinkStatusSchema,
248
- ObservabilityDrainReportSchema
377
+ ObservabilityDrainReportSchema,
378
+ DEFAULT_REDACT_PATHS
249
379
  };
@@ -11,10 +11,27 @@ export interface SanitizeOptions {
11
11
  * `X-Api-Key` are masked while `authorId` and `sessionCount` survive.
12
12
  */
13
13
  sensitiveKeys?: RegExp;
14
+ /** Augment, rather than replace, the built-in sensitive-key matcher. */
15
+ includeDefaultSensitiveKeys?: boolean;
16
+ /** Dot paths to mask. `*` matches one segment and `**` matches any suffix. */
17
+ sensitivePaths?: readonly string[];
18
+ /** Patterns whose matching portions are masked in every string, including messages. */
19
+ sensitiveUrlPatterns?: readonly RegExp[];
14
20
  /** Cap on the serialised payload — anything larger collapses to a preview. Default 16 KB. */
15
21
  maxBytes?: number;
16
22
  /** Recursion limit — deeper nesting collapses to a marker. Default 20. */
17
23
  maxDepth?: number;
24
+ /** Maximum UTF-16 string length before an explicit truncation marker. */
25
+ maxStringLength?: number;
26
+ /** Maximum members retained from an array, map, set, or object. */
27
+ maxCollectionLength?: number;
28
+ /**
29
+ * Maximum values visited in one walk. The ancestor check stops cycles, not
30
+ * a shared acyclic subtree reached from many parents — a diamond-shaped
31
+ * object of a few hundred keys can mean billions of visits — so past this
32
+ * budget the rest collapses to a marker. Default 20 000.
33
+ */
34
+ maxNodes?: number;
18
35
  }
19
36
  /** The result of `measureSize`. */
20
37
  export interface SizeMeasure {
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/observability/sanitize.ts"],"names":[],"mappings":"AAOA,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjC,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,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IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,mCAAmC;AACnC,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8BAA8B;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,cAAc,CAAC,EAAE,IAAI,CAAC;CACvB;AAyED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,eAAoB,GAAG,SAAS,CAiM/E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,SAAoB,GAAG,SAAS,CAgBzF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,eAAoB,GAC5B,SAAS,GAAG,IAAI,CAOlB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAqBvD"}
@@ -1,4 +1,4 @@
1
- import"./index-y01f4223.js";
1
+ import"./index-2bxcmqkb.js";
2
2
  import {
3
3
  ManagedFileRefSchema
4
4
  } from "./index-6k1937bx.js";
@@ -0,0 +1,33 @@
1
+ import { type MutationCacheConfig, QueryClient, type QueryClientConfig } from '@tanstack/react-query';
2
+ export interface ApiErrorRetryConfig {
3
+ /** Maximum retries after the initial query attempt. */
4
+ attempts?: number;
5
+ /** Application codes which are never retried. */
6
+ never?: readonly string[];
7
+ /** Inclusive HTTP status ranges which are retryable. */
8
+ statusRanges?: readonly (readonly [from: number, to: number])[];
9
+ /** Whether an unclassified non-API error is treated as a network failure. */
10
+ network?: boolean;
11
+ }
12
+ /** Build a React Query retry predicate from Stitchkit's cross-bundle API error model. */
13
+ export declare function apiErrorRetry(config?: ApiErrorRetryConfig): (failureCount: number, error: unknown) => boolean;
14
+ export type QueryClientServerCache = (factory: () => QueryClient) => () => QueryClient;
15
+ export type QueryRetryValue = NonNullable<NonNullable<QueryClientConfig['defaultOptions']>['queries']>['retry'];
16
+ export interface QueryClientFactoryConfig {
17
+ /** Full TanStack QueryClient config; defaults are merged by section. */
18
+ queryClient?: QueryClientConfig;
19
+ /** Query retry policy; mutations remain non-retryable unless explicitly overridden. */
20
+ retry?: ApiErrorRetryConfig | QueryRetryValue;
21
+ /** Optional shared mutation error observer. */
22
+ onMutationError?: MutationCacheConfig['onError'];
23
+ /** Request-local cache adapter, normally React's `cache`. */
24
+ serverCache?: QueryClientServerCache;
25
+ /** Deterministic environment seam; defaults to TanStack's environment manager. */
26
+ server?: () => boolean;
27
+ }
28
+ /**
29
+ * Create one request-local server QueryClient and one factory-local browser singleton.
30
+ * No server cache is invented: the host supplies React `cache` (or an equivalent adapter).
31
+ */
32
+ export declare function createQueryClientFactory(config?: QueryClientFactoryConfig): () => QueryClient;
33
+ //# sourceMappingURL=query-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-client.d.ts","sourceRoot":"","sources":["../../src/react/query-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,EACxB,WAAW,EACX,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,wDAAwD;IACxD,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;IAChE,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AASD,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,MAAM,GAAE,mBAAwB,kBAuBtC,MAAM,SAAS,OAAO,KAAG,OAAO,CAQvD;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,WAAW,KAAK,MAAM,WAAW,CAAC;AACvF,MAAM,MAAM,eAAe,GAAG,WAAW,CACvC,WAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,CAC5D,CAAC,OAAO,CAAC,CAAC;AAEX,MAAM,WAAW,wBAAwB;IACvC,wEAAwE;IACxE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,uFAAuF;IACvF,KAAK,CAAC,EAAE,mBAAmB,GAAG,eAAe,CAAC;IAC9C,+CAA+C;IAC/C,eAAe,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjD,6DAA6D;IAC7D,WAAW,CAAC,EAAE,sBAAsB,CAAC;IACrC,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,GAAE,wBAA6B,GACpC,MAAM,WAAW,CAgDnB"}
package/dist/react.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { type CacheBridge, type CacheBridgeConfig, type CacheBridgeContext, type CacheBridgeHandler, type CacheBridgeHandlers, type CacheBridgeSocket, createCacheBridge, createRealtimeCacheBridge, type RealtimeCacheBridgeConfig, } from './react/cache-bridge.js';
2
2
  export { type CursorQueryConfig, createCursorQuery } from './react/cursor-query.js';
3
3
  export { createEntityCacheHandlers, type DeletedPayload, type EntityCacheConfig, type EntityCacheEvent, type EntityCacheHandlers, type EntityCacheKey, type EntityCacheListConfig, type EntityCacheListShape, type EntityCacheMembership, type EntityCacheMembershipPolicy, type EntityCacheTotalDeltaInput, type EntityCacheTotalPolicy, } from './react/entity-cache.js';
4
+ export { type ApiErrorRetryConfig, apiErrorRetry, createQueryClientFactory, type QueryClientFactoryConfig, type QueryClientServerCache, type QueryRetryValue, } from './react/query-client.js';
4
5
  //# sourceMappingURL=react.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACL,yBAAyB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EACL,yBAAyB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,mBAAmB,EACxB,aAAa,EACb,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC"}
package/dist/react.js CHANGED
@@ -1,3 +1,8 @@
1
+ import {
2
+ ApiError,
3
+ isAbortLikeError
4
+ } from "./index-3xwxfj4z.js";
5
+ import"./index-zcgf3gqf.js";
1
6
  import {
2
7
  isRecord
3
8
  } from "./index-77fekveh.js";
@@ -313,9 +318,86 @@ function hasStringId(value) {
313
318
  function idOf(payload, getId) {
314
319
  return hasStringId(payload) ? payload.id : getId(payload);
315
320
  }
321
+ // src/react/query-client.ts
322
+ import {
323
+ defaultShouldDehydrateQuery,
324
+ environmentManager,
325
+ MutationCache,
326
+ QueryClient
327
+ } from "@tanstack/react-query";
328
+ var DEFAULT_NEVER_RETRY = [
329
+ "UNAUTHORIZED",
330
+ "FORBIDDEN",
331
+ "VALIDATION_ERROR",
332
+ "REQUEST_ABORTED"
333
+ ];
334
+ function apiErrorRetry(config = {}) {
335
+ const attempts = config.attempts ?? 1;
336
+ if (!Number.isSafeInteger(attempts) || attempts < 0) {
337
+ throw new Error(`apiErrorRetry attempts must be a non-negative safe integer, received ${attempts}`);
338
+ }
339
+ const never = new Set(config.never ?? DEFAULT_NEVER_RETRY);
340
+ const statusRanges = config.statusRanges ?? [[500, 599]];
341
+ for (const [from, to] of statusRanges) {
342
+ if (!Number.isSafeInteger(from) || !Number.isSafeInteger(to) || from < 100 || to > 599 || from > to) {
343
+ throw new Error(`apiErrorRetry status range must be an inclusive HTTP range, received ${from}..${to}`);
344
+ }
345
+ }
346
+ return (failureCount, error) => {
347
+ if (failureCount >= attempts)
348
+ return false;
349
+ if (isAbortLikeError(error))
350
+ return false;
351
+ if (!ApiError.is(error))
352
+ return config.network ?? true;
353
+ if (never.has(error.code))
354
+ return false;
355
+ if (error.status === 0)
356
+ return config.network ?? true;
357
+ return statusRanges.some(([from, to]) => error.status >= from && error.status <= to);
358
+ };
359
+ }
360
+ function createQueryClientFactory(config = {}) {
361
+ const supplied = config.queryClient ?? {};
362
+ if (config.onMutationError && supplied.mutationCache) {
363
+ throw new Error("createQueryClientFactory cannot combine onMutationError with queryClient.mutationCache");
364
+ }
365
+ const suppliedDefaults = supplied.defaultOptions ?? {};
366
+ const queryRetry = typeof config.retry === "object" || config.retry === undefined ? apiErrorRetry(config.retry) : config.retry;
367
+ const create = () => new QueryClient({
368
+ ...supplied,
369
+ ...config.onMutationError ? { mutationCache: new MutationCache({ onError: config.onMutationError }) } : {},
370
+ defaultOptions: {
371
+ ...suppliedDefaults,
372
+ queries: {
373
+ ...suppliedDefaults.queries,
374
+ retry: suppliedDefaults.queries?.retry ?? queryRetry
375
+ },
376
+ mutations: {
377
+ ...suppliedDefaults.mutations,
378
+ retry: suppliedDefaults.mutations?.retry ?? false
379
+ },
380
+ dehydrate: {
381
+ ...suppliedDefaults.dehydrate,
382
+ shouldDehydrateQuery: suppliedDefaults.dehydrate?.shouldDehydrateQuery ?? ((query) => defaultShouldDehydrateQuery(query) || query.state.status === "pending")
383
+ }
384
+ }
385
+ });
386
+ const getServer = config.serverCache ? config.serverCache(create) : create;
387
+ const isServer = config.server ?? (() => environmentManager.isServer());
388
+ let browserClient;
389
+ return () => {
390
+ if (isServer())
391
+ return getServer();
392
+ browserClient ??= create();
393
+ return browserClient;
394
+ };
395
+ }
316
396
  export {
317
397
  createRealtimeCacheBridge,
398
+ createQueryClientFactory,
318
399
  createEntityCacheHandlers,
319
400
  createCursorQuery,
320
- createCacheBridge
401
+ createCacheBridge,
402
+ apiErrorRetry
321
403
  };
@@ -0,0 +1,93 @@
1
+ import type { RealtimeServer } from '../server/realtime.js';
2
+ import type { RealtimeEmitArguments, RealtimeEventRegistry } from './contract.js';
3
+ declare const authorizedRoom: unique symbol;
4
+ /**
5
+ * A room reference minted by the registry. The token proves the name went
6
+ * through *this* registry — a string from elsewhere cannot be emitted to by
7
+ * accident. Whether a given socket may be in the room is decided per socket
8
+ * by `rooms(identity)` at connect time and checked again on `join`.
9
+ */
10
+ export interface AuthorizedSocketRoom {
11
+ readonly name: string;
12
+ readonly [authorizedRoom]: true;
13
+ }
14
+ export interface SocketRegistryConnection<TOutbound extends RealtimeEventRegistry, TIdentity> {
15
+ readonly raw: {
16
+ readonly id: string;
17
+ readonly data: TIdentity;
18
+ join(room: string): void | Promise<void>;
19
+ leave(room: string): void | Promise<void>;
20
+ on(event: 'disconnect', handler: () => void): unknown;
21
+ off?(event: 'disconnect', handler: () => void): unknown;
22
+ };
23
+ readonly events: {
24
+ emit<TEvent extends keyof TOutbound & string>(event: TEvent, ...args: RealtimeEmitArguments<TOutbound[TEvent]>): boolean;
25
+ };
26
+ }
27
+ export interface SocketRegistryServer<TOutbound extends RealtimeEventRegistry, TIdentity> {
28
+ onConnection(handler: (connection: SocketRegistryConnection<TOutbound, TIdentity>) => void | Promise<void>): () => void;
29
+ }
30
+ export type SocketReplayFrame<TOutbound extends RealtimeEventRegistry> = {
31
+ [TEvent in keyof TOutbound & string]: {
32
+ readonly event: TEvent;
33
+ readonly args: RealtimeEmitArguments<TOutbound[TEvent]>;
34
+ };
35
+ }[keyof TOutbound & string];
36
+ export interface SocketRegistrySnapshot<TIdentity> {
37
+ readonly revision: number;
38
+ readonly connections: readonly {
39
+ readonly socketId: string;
40
+ readonly identity: TIdentity;
41
+ readonly rooms: readonly string[];
42
+ readonly replaying: boolean;
43
+ }[];
44
+ readonly rooms: Readonly<Record<string, readonly string[]>>;
45
+ }
46
+ export interface SocketRegistryOptions<TOutbound extends RealtimeEventRegistry, TIdentity> {
47
+ /** Rooms this already-authenticated identity may join. */
48
+ rooms(identity: TIdentity): Iterable<string> | Promise<Iterable<string>>;
49
+ /**
50
+ * Produce a coherent replay generation. Frames are captured before any are
51
+ * emitted; live frames are buffered until the generation is complete.
52
+ */
53
+ replay?(context: {
54
+ readonly identity: TIdentity;
55
+ readonly rooms: readonly AuthorizedSocketRoom[];
56
+ readonly revision: unknown;
57
+ }): readonly SocketReplayFrame<TOutbound>[] | Promise<readonly SocketReplayFrame<TOutbound>[]>;
58
+ /** Stable application revision surrounding replay generation. */
59
+ revision?(): unknown | Promise<unknown>;
60
+ /**
61
+ * Called when a coherent replay could not be delivered: the revision kept
62
+ * moving for `replayAttempts` tries, or more than `maxBufferedFrames` live
63
+ * frames arrived while one snapshot was open. The socket is still a member
64
+ * of its rooms; the application decides what a resync means for it.
65
+ */
66
+ onResyncRequired?(socketId: string, identity: TIdentity): void | Promise<void>;
67
+ replayAttempts?: number;
68
+ /**
69
+ * Live frames held per socket while its replay snapshot is open. Beyond
70
+ * this the attempt is abandoned rather than delivering a history with a
71
+ * hole — the buffer never grows without bound. Default `1_000`.
72
+ */
73
+ maxBufferedFrames?: number;
74
+ }
75
+ export interface SocketRegistry<TOutbound extends RealtimeEventRegistry, TIdentity> {
76
+ /** The token for a room name; an empty room is a valid `emitTo` target (0 recipients). */
77
+ room(name: string): AuthorizedSocketRoom;
78
+ join(socketId: string, room: AuthorizedSocketRoom): Promise<void>;
79
+ leave(socketId: string, room: AuthorizedSocketRoom): Promise<void>;
80
+ emitTo<TEvent extends keyof TOutbound & string>(room: AuthorizedSocketRoom, event: TEvent, ...args: RealtimeEmitArguments<TOutbound[TEvent]>): number;
81
+ resync(socketId: string): Promise<boolean>;
82
+ snapshot(): SocketRegistrySnapshot<TIdentity>;
83
+ unbind(): Promise<void>;
84
+ }
85
+ /**
86
+ * Add authorized membership and coherent replay to an existing authenticated
87
+ * realtime server. Validation and transport emission stay owned by the
88
+ * connection supplied by `bindRealtimeServer`.
89
+ */
90
+ export declare function bindSocketRegistry<TOutbound extends RealtimeEventRegistry, TInbound extends RealtimeEventRegistry, TIdentity>(server: RealtimeServer<TOutbound, TInbound, TIdentity>, options: SocketRegistryOptions<TOutbound, TIdentity>): SocketRegistry<TOutbound, TIdentity>;
91
+ export declare function bindSocketRegistry<TOutbound extends RealtimeEventRegistry, TIdentity>(server: SocketRegistryServer<TOutbound, TIdentity>, options: SocketRegistryOptions<TOutbound, TIdentity>): SocketRegistry<TOutbound, TIdentity>;
92
+ export {};
93
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/realtime/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE/E,QAAA,MAAM,cAAc,eAAsC,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB,CAAC,SAAS,SAAS,qBAAqB,EAAE,SAAS;IAC1F,QAAQ,CAAC,GAAG,EAAE;QACZ,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;QACzB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1C,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;QACtD,GAAG,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;KACzD,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE;QACf,IAAI,CAAC,MAAM,SAAS,MAAM,SAAS,GAA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Q,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAmBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,SAAS,qBAAqB,EACvC,QAAQ,SAAS,qBAAqB,EACtC,SAAS,EAET,MAAM,EAAE,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,EACtD,OAAO,EAAE,qBAAqB,CAAC,SAAS,EAAE,SAAS,CAAC,GACnD,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACxC,wBAAgB,kBAAkB,CAAC,SAAS,SAAS,qBAAqB,EAAE,SAAS,EACnF,MAAM,EAAE,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,EAClD,OAAO,EAAE,qBAAqB,CAAC,SAAS,EAAE,SAAS,CAAC,GACnD,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The response header that names the frontend build the server considers
3
+ * current. Set on every response of a handler configured with a release
4
+ * marker — success, error, raw route — so a client learns about a release
5
+ * from whatever it was already asking, with no socket and no polling of its
6
+ * own. Exposed through CORS by default, like `X-Request-Id`.
7
+ */
8
+ export declare const RELEASE_HEADER = "X-Build-Id";
9
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/release/header.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,eAAe,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The server's knowledge of which frontend build is current.
3
+ *
4
+ * `read` is the application's: a file the release wrote (`.next/BUILD_ID` of
5
+ * the *active* release root, not the process's own cwd — a frontend-only
6
+ * release leaves the backend in an older immutable root), an environment
7
+ * variable, anything. It returns `null` where there is no release — a dev
8
+ * server under HMR — and then the marker stays silent: no header, no event.
9
+ *
10
+ * `refresh()` is the one operation with a side effect: it re-reads, and if
11
+ * the answer changed, tells every subscriber. A deploy signal calls it; so
12
+ * does every socket connection, so a broadcast the process missed while it
13
+ * was down is repaired by the next client that connects. → ADR 0167.
14
+ */
15
+ export interface ReleaseMarker {
16
+ /** The last build id read, or `null` when there is no release to name. */
17
+ current(): string | null;
18
+ /** Re-read; `changed` when the id differs from the last one seen. */
19
+ refresh(): ReleaseRefresh;
20
+ /** Hear every change; returns the unsubscribe. */
21
+ subscribe(listener: (buildId: string | null) => void): () => void;
22
+ }
23
+ export interface ReleaseRefresh {
24
+ changed: boolean;
25
+ buildId: string | null;
26
+ }
27
+ export interface ReleaseMarkerConfig {
28
+ /** The current build id, or `null` when there is none. A throw counts as `null`. */
29
+ read: () => string | null;
30
+ /**
31
+ * Hear a `read` that threw or returned something that is not a build id, and
32
+ * a subscriber that threw — the marker itself never does, because it is
33
+ * called from a signal handler and a socket's `connection` event, where an
34
+ * escaped exception ends the process or the connect.
35
+ */
36
+ onError?: (error: unknown) => void;
37
+ }
38
+ export declare function createReleaseMarker(config: ReleaseMarkerConfig): ReleaseMarker;
39
+ //# sourceMappingURL=marker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../src/release/marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC;IACzB,qEAAqE;IACrE,OAAO,IAAI,cAAc,CAAC;IAC1B,kDAAkD;IAClD,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACnE;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,oFAAoF;IACpF,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAUD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,aAAa,CAqD9E"}
@@ -0,0 +1,57 @@
1
+ import type { ReleaseMarker } from './marker.js';
2
+ import type { ReleaseWatcher } from './watcher.js';
3
+ /**
4
+ * The little of a Socket.IO server this binding uses — structural, no peer
5
+ * import.
6
+ *
7
+ * `emit` is declared over `string` because the event name is configurable. A
8
+ * **typed** `Server<ClientToServer, ServerToClient>` narrows its own `emit` to
9
+ * the names in its map, so it satisfies this only once that map declares the
10
+ * event — `release: (payload: { buildId: string | null }) => void`, or whatever
11
+ * `options.event` renames it to. Until then the compiler reports a structural
12
+ * mismatch between two large socket.io types, which reads like a defect in this
13
+ * binding and is a missing line in the application's event map. Adding it is
14
+ * step 3 of the guide's adoption list for exactly this reason: the same
15
+ * declaration is what lets the application's own `on` know the event.
16
+ */
17
+ export interface ReleaseSocketServer {
18
+ on(event: 'connection', handler: (socket: ReleaseSocketEmitter) => void): unknown;
19
+ emit(event: string, payload: {
20
+ buildId: string | null;
21
+ }): unknown;
22
+ }
23
+ export interface ReleaseSocketEmitter {
24
+ emit(event: string, payload: {
25
+ buildId: string | null;
26
+ }): unknown;
27
+ }
28
+ /**
29
+ * The little of a Socket.IO client this feed uses. Two dialects: a raw
30
+ * socket.io client subscribes with `on` and unsubscribes with `off`; the
31
+ * stitchkit client's `on` returns the unsubscribe itself. Both fit.
32
+ */
33
+ export interface ReleaseSocketListener {
34
+ on(event: string, handler: (payload: {
35
+ buildId: string | null;
36
+ }) => void): unknown;
37
+ off?(event: string, handler: (payload: {
38
+ buildId: string | null;
39
+ }) => void): unknown;
40
+ }
41
+ export interface ReleaseSocketOptions {
42
+ /** Event name on the wire. Default `release`. */
43
+ event?: string;
44
+ }
45
+ /**
46
+ * Tell every socket which build is current: each connection on arrival, and
47
+ * everyone when the marker changes. A connection first `refresh()`es the
48
+ * marker — the safety net: a deploy signal the process missed while it was
49
+ * down is repaired by the next client that connects, because that connect
50
+ * re-reads the file.
51
+ */
52
+ export declare function bindReleaseToSocketServer(io: ReleaseSocketServer, marker: ReleaseMarker, options?: ReleaseSocketOptions & {
53
+ refreshOnConnection?: boolean;
54
+ }): () => void;
55
+ /** Feed a watcher from the socket event the server binding emits. */
56
+ export declare function observeReleaseFromSocket(socket: ReleaseSocketListener, watcher: ReleaseWatcher, options?: ReleaseSocketOptions): () => void;
57
+ //# sourceMappingURL=socket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/release/socket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC;IAClF,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;CACnE;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;CACnE;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAA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