better-effect 0.13.0 → 0.14.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 (109) hide show
  1. package/README.md +337 -88
  2. package/dist/adapters/iti.d.mts +2 -3
  3. package/dist/adapters/iti.d.mts.map +1 -1
  4. package/dist/adapters/iti.mjs +2 -2
  5. package/dist/bun.d.mts +75 -23
  6. package/dist/bun.d.mts.map +1 -1
  7. package/dist/bun.mjs +170 -33
  8. package/dist/bun.mjs.map +1 -1
  9. package/dist/{context-BphfFUMO.mjs → context-DSGSqcJj.mjs} +12 -3
  10. package/dist/context-DSGSqcJj.mjs.map +1 -0
  11. package/dist/{current-request-DDKNyymv.mjs → current-request-Bc1YHL0w.mjs} +3 -2
  12. package/dist/{current-request-DDKNyymv.mjs.map → current-request-Bc1YHL0w.mjs.map} +1 -1
  13. package/dist/{current-request-CIU7AHhF.d.mts → current-request-Dm-QQ3Xr.d.mts} +4 -4
  14. package/dist/current-request-Dm-QQ3Xr.d.mts.map +1 -0
  15. package/dist/{effect-CPdV7Yv8.mjs → effect-W0IQXY8P.mjs} +21 -2
  16. package/dist/effect-W0IQXY8P.mjs.map +1 -0
  17. package/dist/{errors-BKcsQ0ip.d.mts → errors-CpHMzPiP.d.mts} +6 -2
  18. package/dist/errors-CpHMzPiP.d.mts.map +1 -0
  19. package/dist/hono.d.mts +63 -27
  20. package/dist/hono.d.mts.map +1 -1
  21. package/dist/hono.mjs +111 -45
  22. package/dist/hono.mjs.map +1 -1
  23. package/dist/{index-CCi07kUw.d.mts → index-3Bkl-sxS.d.mts} +7 -2
  24. package/dist/{index-CCi07kUw.d.mts.map → index-3Bkl-sxS.d.mts.map} +1 -1
  25. package/dist/{index-cXgyMa0v.d.mts → index-C2ed9Ilq.d.mts} +32 -7
  26. package/dist/index-C2ed9Ilq.d.mts.map +1 -0
  27. package/dist/{index-BodMy6rO.d.mts → index-ClNndn2-.d.mts} +93 -63
  28. package/dist/index-ClNndn2-.d.mts.map +1 -0
  29. package/dist/{index-DAKn0qHk.d.mts → index-Cy1VsU-u.d.mts} +2 -4
  30. package/dist/index-Cy1VsU-u.d.mts.map +1 -0
  31. package/dist/index.d.mts +6 -8
  32. package/dist/index.mjs +8 -9
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/{internal-identity-CbXoZIfw.mjs → internal-identity-BuHBtP0k.mjs} +2 -2
  35. package/dist/{internal-identity-CbXoZIfw.mjs.map → internal-identity-BuHBtP0k.mjs.map} +1 -1
  36. package/dist/layer-2kjHVv4N.mjs +343 -0
  37. package/dist/layer-2kjHVv4N.mjs.map +1 -0
  38. package/dist/layer-C2OaqTmB.d.mts +987 -0
  39. package/dist/layer-C2OaqTmB.d.mts.map +1 -0
  40. package/dist/next.d.mts +102 -26
  41. package/dist/next.d.mts.map +1 -1
  42. package/dist/next.mjs +157 -40
  43. package/dist/next.mjs.map +1 -1
  44. package/dist/{node-context-DczjAcrX.d.mts → node-context-1YEjrU9g.d.mts} +2 -2
  45. package/dist/{node-context-DczjAcrX.d.mts.map → node-context-1YEjrU9g.d.mts.map} +1 -1
  46. package/dist/{node-context-Ca18oNSg.mjs → node-context-g3bCcY9t.mjs} +2 -2
  47. package/dist/{node-context-Ca18oNSg.mjs.map → node-context-g3bCcY9t.mjs.map} +1 -1
  48. package/dist/node.d.mts +11 -6
  49. package/dist/node.d.mts.map +1 -1
  50. package/dist/node.mjs +156 -10
  51. package/dist/node.mjs.map +1 -1
  52. package/dist/opentelemetry.d.mts +20 -2
  53. package/dist/opentelemetry.d.mts.map +1 -1
  54. package/dist/opentelemetry.mjs +423 -5
  55. package/dist/opentelemetry.mjs.map +1 -1
  56. package/dist/{registration-drnZk0SY.mjs → registration-Bwe2GbVu.mjs} +8 -2
  57. package/dist/registration-Bwe2GbVu.mjs.map +1 -0
  58. package/dist/runtime/explicit.d.mts +2 -2
  59. package/dist/runtime/explicit.mjs +1 -1
  60. package/dist/runtime/node.d.mts +3 -3
  61. package/dist/runtime/node.mjs +2 -2
  62. package/dist/runtime-qpcVwaz_.mjs +1680 -0
  63. package/dist/runtime-qpcVwaz_.mjs.map +1 -0
  64. package/dist/service-CO9VJQYa.mjs +74 -0
  65. package/dist/service-CO9VJQYa.mjs.map +1 -0
  66. package/dist/{signal-nfgFyNCk.mjs → signal-5Rg9bUUe.mjs} +2 -2
  67. package/dist/{signal-nfgFyNCk.mjs.map → signal-5Rg9bUUe.mjs.map} +1 -1
  68. package/dist/{standard-services-vnGIafkS.mjs → standard-services-B-iMM_W7.mjs} +38 -4
  69. package/dist/standard-services-B-iMM_W7.mjs.map +1 -0
  70. package/dist/standard-services.d.mts +4 -4
  71. package/dist/standard-services.mjs +3 -3
  72. package/dist/testing.d.mts +25 -7
  73. package/dist/testing.d.mts.map +1 -1
  74. package/dist/testing.mjs +51 -7
  75. package/dist/testing.mjs.map +1 -1
  76. package/dist/{types-oihI-ESv.d.mts → types-BFTqCCcw.d.mts} +32 -5
  77. package/dist/types-BFTqCCcw.d.mts.map +1 -0
  78. package/dist/web-effect-B9hp9jIe.mjs +380 -0
  79. package/dist/web-effect-B9hp9jIe.mjs.map +1 -0
  80. package/dist/web.d.mts +22 -13
  81. package/dist/web.d.mts.map +1 -1
  82. package/dist/web.mjs +1 -1
  83. package/package.json +10 -16
  84. package/dist/context-BphfFUMO.mjs.map +0 -1
  85. package/dist/current-request-CIU7AHhF.d.mts.map +0 -1
  86. package/dist/disposable-CP-Q2H3l.mjs +0 -57
  87. package/dist/disposable-CP-Q2H3l.mjs.map +0 -1
  88. package/dist/effect-CPdV7Yv8.mjs.map +0 -1
  89. package/dist/errors-BKcsQ0ip.d.mts.map +0 -1
  90. package/dist/index-AiKM71-u.d.mts +0 -376
  91. package/dist/index-AiKM71-u.d.mts.map +0 -1
  92. package/dist/index-BodMy6rO.d.mts.map +0 -1
  93. package/dist/index-DAKn0qHk.d.mts.map +0 -1
  94. package/dist/index-cXgyMa0v.d.mts.map +0 -1
  95. package/dist/layer-D16GKxuX.mjs +0 -269
  96. package/dist/layer-D16GKxuX.mjs.map +0 -1
  97. package/dist/observer-9nhbL7Pr.d.mts +0 -68
  98. package/dist/observer-9nhbL7Pr.d.mts.map +0 -1
  99. package/dist/outcome-DI8LPIQ4.d.mts +0 -387
  100. package/dist/outcome-DI8LPIQ4.d.mts.map +0 -1
  101. package/dist/program-metadata-BxjGkT17.mjs +0 -260
  102. package/dist/program-metadata-BxjGkT17.mjs.map +0 -1
  103. package/dist/registration-drnZk0SY.mjs.map +0 -1
  104. package/dist/runtime-C_55ofnL.mjs +0 -791
  105. package/dist/runtime-C_55ofnL.mjs.map +0 -1
  106. package/dist/standard-services-vnGIafkS.mjs.map +0 -1
  107. package/dist/types-oihI-ESv.d.mts.map +0 -1
  108. package/dist/web-Bq3MfMrj.mjs +0 -147
  109. package/dist/web-Bq3MfMrj.mjs.map +0 -1
@@ -1,6 +1,5 @@
1
- import { C as EffectError, M as AnyService, V as ServiceTagOf, k as Program } from "./index-AiKM71-u.mjs";
2
- import { D as ValidateOneOverride, E as ValidateLayerInput, S as MissingServices, T as RequiredEnvironment, j as MissingDependencies, p as Layer, v as ExecutionMissing, w as ProvidedEnvironment, y as LayerInput } from "./outcome-DI8LPIQ4.mjs";
3
- import { t as CurrentRequest } from "./current-request-CIU7AHhF.mjs";
1
+ import { Gt as ServiceTagOf, Lt as AnyService, Ot as EffectError, Pt as Program, ct as ValidateLayerInput, et as ExecutionMissing, it as MissingServices, jt as EffectSuccess, lt as ValidateOneOverride, ot as ProvidedEnvironment, pt as MissingDependencies, st as RequiredEnvironment, t as Layer, tt as LayerInput } from "./layer-C2OaqTmB.mjs";
2
+ import { t as CurrentRequest } from "./current-request-Dm-QQ3Xr.mjs";
4
3
  //#region src/web/types.d.ts
5
4
  /** A Web Response returned synchronously or asynchronously by a boundary policy. */
6
5
  type ResponseLike = Response | PromiseLike<Response>;
@@ -14,6 +13,19 @@ type WebEffectSuccess<A = unknown> = {
14
13
  };
15
14
  /** A lazy Program type accepted by the WebEffect boundary. */
16
15
  type WebEffectProgram<A = unknown, E = unknown, R extends AnyService = never> = Program<A, E, R>;
16
+ /** The lazy source accepted by an opt-in managed Web response. */
17
+ type WebEffectStreamSource = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
18
+ /** Context passed to a managed Web response producer. */
19
+ type WebEffectStreamContext = {
20
+ readonly signal: AbortSignal;
21
+ };
22
+ /** An explicit response descriptor whose producer owns the response body lifetime. */
23
+ type WebEffectStream = {
24
+ readonly status?: number;
25
+ readonly statusText?: string;
26
+ readonly headers?: HeadersInit;
27
+ readonly producer: (context: WebEffectStreamContext) => WebEffectStreamSource | PromiseLike<WebEffectStreamSource>;
28
+ };
17
29
  /** @internal */
18
30
  type AnyProgram = WebEffectProgram<any, any, AnyService>;
19
31
  type IsAny<Type> = 0 extends 1 & Type ? true : false;
@@ -31,6 +43,12 @@ type InvalidFailure<Actual, Expected> = {
31
43
  };
32
44
  };
33
45
  type FailureCheck<Failure, Actual> = [Actual] extends [Failure] ? unknown : InvalidFailure<Actual, Failure>;
46
+ type StreamValueCheck<Program extends AnyProgram> = [EffectSuccess<Program>] extends [WebEffectStream] ? unknown : {
47
+ readonly __betterEffectInvalidWebStream: {
48
+ readonly actual: EffectSuccess<Program>;
49
+ readonly expected: WebEffectStream;
50
+ };
51
+ };
34
52
  type RequestLayerMissing<Provided extends AnyService, RequestLayer extends LayerInput> = MissingServices<Extract<RequiredEnvironment<RequestLayer>, AnyService>, Extract<Provided | InstanceType<typeof CurrentRequest>, AnyService>>;
35
53
  /** @internal Validate a custom request Layer against the Runtime and CurrentRequest. */
36
54
  type WebRequestLayerChecks<Provided extends AnyService, RequestLayer extends LayerInput> = ValidateLayerInput<RequestLayer> & (IsWidenedEnvironment<Provided> extends true ? unknown : ValidateOneOverride<Layer<Provided, never>, RequestLayer>) & ValidateOneOverride<DefaultRequestLayer, RequestLayer> & ([RequestLayerMissing<Provided, RequestLayer>] extends [never] ? unknown : MissingDependencies<RequestLayerMissing<Provided, RequestLayer>>);
@@ -38,6 +56,10 @@ type WebRequestLayerChecks<Provided extends AnyService, RequestLayer extends Lay
38
56
  type WebProgramMissing<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram> = ExecutionMissing<AvailableServices<Provided, RequestLayer>, Program>;
39
57
  /** @internal Validate a WebEffect Program's Services and typed failure channel. */
40
58
  type CompleteWebProgram<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram, Failure = unknown> = Program & WebProgramChecks<Provided, RequestLayer, Program, Failure>;
59
+ /** @internal Validate the explicit stream descriptor returned by a Program. */
60
+ type CompleteWebStreamProgram<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram, Failure = unknown> = Program & WebProgramChecks<Provided, RequestLayer, Program, Failure> & StreamValueCheck<Program>;
61
+ /** @internal Checks applied to a streaming Program after the request Layer is inferred. */
62
+ type WebStreamProgramChecks<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram, Failure = unknown> = WebProgramChecks<Provided, RequestLayer, Program, Failure> & StreamValueCheck<Program>;
41
63
  /** @internal Checks applied to a Program after the request Layer has been inferred. */
42
64
  type WebProgramChecks<Provided extends AnyService, RequestLayer extends LayerInput, Program extends AnyProgram, Failure = unknown> = (WebProgramMissing<Provided, RequestLayer, Program> extends never ? unknown : MissingDependencies<WebProgramMissing<Provided, RequestLayer, Program>>) & FailureCheck<NoInfer<Failure>, EffectError<Program>>;
43
65
  /** Options for converting a WebEffect Result into a standard Response. */
@@ -49,6 +71,11 @@ type WebEffectOptions<Failure = unknown, RequestLayer extends LayerInput = Defau
49
71
  /** Convert a typed Program failure into a Response. */
50
72
  readonly onFailure?: (error: Failure) => ResponseLike;
51
73
  };
74
+ /** Options for the opt-in managed Web streaming boundary. */
75
+ type WebEffectStreamOptions<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer> = Pick<WebEffectOptions<Failure, RequestLayer, WebEffectStream>, 'requestLayer' | 'onFailure'> & {
76
+ /** Cancel an unconsumed or abandoned body after this idle period. */
77
+ readonly unconsumedTimeoutMs?: number;
78
+ };
52
79
  //#endregion
53
- export { WebEffectOptions as a, WebJsonValue as c, ResponseLike as i, WebProgramChecks as l, CompleteWebProgram as n, WebEffectProgram as o, DefaultRequestLayer as r, WebEffectSuccess as s, AnyProgram as t, WebRequestLayerChecks as u };
54
- //# sourceMappingURL=types-oihI-ESv.d.mts.map
80
+ export { ResponseLike as a, WebEffectStream as c, WebEffectStreamSource as d, WebEffectSuccess as f, WebStreamProgramChecks as g, WebRequestLayerChecks as h, DefaultRequestLayer as i, WebEffectStreamContext as l, WebProgramChecks as m, CompleteWebProgram as n, WebEffectOptions as o, WebJsonValue as p, CompleteWebStreamProgram as r, WebEffectProgram as s, AnyProgram as t, WebEffectStreamOptions as u };
81
+ //# sourceMappingURL=types-BFTqCCcw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BFTqCCcw.d.mts","names":[],"sources":["../src/web/types.ts"],"mappings":";;;;KAiBY,eAAe,WAAW,YAAY;;KAGtC,2DAKC;YACG,cAAc;;;KAGlB,iBAAiB;WAClB,OAAO;;;KAIN,iBAAiB,aAAa,aAAa,UAAU,sBAAsB,QACrF,GACA,GACA;;KAIU,wBAAwB,eAAe,cAAc,cAAc;;KAGnE;WACD,QAAQ;;;KAIP;WACD;WACA;WACA,UAAU;WACV,WACP,SAAS,2BACN,wBAAwB,YAAY;;;KAI/B,aAAa,2BAA2B;KAE/C,MAAM,sBAAsB;KAE5B,qBAAqB,iBAAiB,cACzC,MAAM,+CAA+C,aAAa;;KAGxD,sBAAsB,kBAAkB,eAAe;;KAGvD,gBAAgB,qBAAqB,cAAc,oBAAoB;;KAGvE,kBAAkB,iBAAiB,YAAY,qBAAqB,cAC5E,WACA,oBAAoB,kBACpB,gBAAgB;KAEf,eAAe,QAAQ;WACjB;aACE,QAAQ;aACR,UAAU;;;KAIlB,aAAa,SAAS,WAAW,iBAAiB,qBAEnD,eAAe,QAAQ;KAEtB,iBAAiB,gBAAgB,eAAe,cAAc,mBACjE;WAIa;aACE,QAAQ,cAAc;aACtB,UAAU;;;KAItB,oBACH,iBAAiB,YACjB,qBAAqB,cACnB,gBACF,QAAQ,oBAAoB,eAAe,aAC3C,QAAQ,WAAW,oBAAoB,iBAAiB;;KAI9C,sBACV,iBAAiB,YACjB,qBAAqB,cACnB,mBAAmB,iBACpB,qBAAqB,mCAElB,oBAAoB,MAAM,kBAAkB,iBAChD,oBAAoB,qBAAqB,kBACvC,oBAAoB,UAAU,2CAE5B,oBAAoB,oBAAoB,UAAU;;KAG5C,kBACV,iBAAiB,YACjB,qBAAqB,YACrB,gBAAgB,cACd,iBAAiB,kBAAkB,UAAU,eAAe;;KAGpD,mBACV,iBAAiB,YACjB,qBAAqB,YACrB,gBAAgB,YAChB,qBACE,UAAU,iBAAiB,UAAU,cAAc,SAAS;;KAGpD,yBACV,iBAAiB,YACjB,qBAAqB,YACrB,gBAAgB,YAChB,qBACE,UAAU,iBAAiB,UAAU,cAAc,SAAS,WAAW,iBAAiB;;KAGhF,uBACV,iBAAiB,YACjB,qBAAqB,YACrB,gBAAgB,YAChB,qBACE,iBAAiB,UAAU,cAAc,SAAS,WAAW,iBAAiB;;KAGtE,iBACV,iBAAiB,YACjB,qBAAqB,YACrB,gBAAgB,YAChB,sBACG,kBAAkB,UAAU,cAAc,mCAE3C,oBAAoB,kBAAkB,UAAU,cAAc,aAChE,aAAa,QAAQ,UAAU,YAAY;;KAGjC,iBACV,mBACA,qBAAqB,aAAa,qBAClC;;WAGS,gBAAgB,SAAS,YAAY;;WAErC,aAAa,QAAQ,iBAAiB,aAAa;;WAEnD,aAAa,OAAO,YAAY;;;KAI/B,uBACV,mBACA,qBAAqB,aAAa,uBAChC,KAAK,iBAAiB,SAAS,cAAc;;WAEtC"}
@@ -0,0 +1,380 @@
1
+ import { t as Layer } from "./layer-2kjHVv4N.mjs";
2
+ import { t as CurrentRequest } from "./current-request-Bc1YHL0w.mjs";
3
+ import { Result } from "better-result";
4
+ //#region src/web/responses.ts
5
+ const DEFAULT_FAILURE_MESSAGE = "Internal Server Error";
6
+ /** An unsupported value encountered by the default Web JSON policy. */
7
+ var WebEffectSerializationError = class extends TypeError {
8
+ constructor(detail) {
9
+ super(`WebEffect default success serialization ${detail}`);
10
+ this.name = "WebEffectSerializationError";
11
+ }
12
+ };
13
+ const isObject$1 = (value) => typeof value === "object" && value !== null;
14
+ const isCallable = (value) => typeof value === "function";
15
+ const isHeaders = (value) => {
16
+ if (!isObject$1(value)) return false;
17
+ const candidate = value;
18
+ return isCallable(candidate.append) && isCallable(candidate.delete) && isCallable(candidate.get) && isCallable(candidate.getSetCookie) && isCallable(candidate.has) && isCallable(candidate.set) && isCallable(candidate.forEach);
19
+ };
20
+ const isBody = (value) => {
21
+ if (value === null) return true;
22
+ if (!isObject$1(value)) return false;
23
+ const candidate = value;
24
+ return typeof candidate.locked === "boolean" && isCallable(candidate.cancel) && isCallable(candidate.getReader) && isCallable(candidate.pipeThrough) && isCallable(candidate.pipeTo) && isCallable(candidate.tee);
25
+ };
26
+ const isResponseStatus = (value) => typeof value === "number" && Number.isInteger(value) && (value === 0 || value >= 200 && value <= 599);
27
+ const isResponseType = (value) => value === "basic" || value === "cors" || value === "default" || value === "error" || value === "opaque" || value === "opaqueredirect";
28
+ /** Accept native, cross-realm, and standards-compatible Web Response values. */
29
+ const isWebResponse = (value) => {
30
+ if (!isObject$1(value)) return false;
31
+ try {
32
+ const candidate = value;
33
+ const status = candidate.status;
34
+ if (!isResponseStatus(status)) return false;
35
+ return isBody(candidate.body) && typeof candidate.bodyUsed === "boolean" && isHeaders(candidate.headers) && typeof candidate.ok === "boolean" && candidate.ok === (status >= 200 && status <= 299) && typeof candidate.redirected === "boolean" && typeof candidate.statusText === "string" && isResponseType(candidate.type) && typeof candidate.url === "string" && isCallable(candidate.arrayBuffer) && isCallable(candidate.blob) && isCallable(candidate.bytes) && isCallable(candidate.clone) && isCallable(candidate.formData) && isCallable(candidate.json) && isCallable(candidate.text);
36
+ } catch {
37
+ return false;
38
+ }
39
+ };
40
+ const propertyPath = (path, property) => `${path}.${property}`;
41
+ const unsupported = (path, kind) => {
42
+ throw new WebEffectSerializationError(`cannot encode ${kind} at ${path}`);
43
+ };
44
+ const ownDataProperties = (value, path) => {
45
+ if (Object.getOwnPropertySymbols(value).length > 0) unsupported(path, "symbol-keyed properties");
46
+ return Object.getOwnPropertyNames(value).map((property) => {
47
+ const descriptor = Object.getOwnPropertyDescriptor(value, property);
48
+ if (descriptor === void 0 || !("value" in descriptor) || descriptor.enumerable !== true) unsupported(propertyPath(path, property), "non-enumerable or accessor properties");
49
+ return [property, descriptor.value];
50
+ });
51
+ };
52
+ const arrayIndex = (property) => {
53
+ const index = Number(property);
54
+ return Number.isInteger(index) && index >= 0 && index < 2 ** 32 - 1 && String(index) === property ? index : void 0;
55
+ };
56
+ const sanitizeArray = (value, path, ancestors) => {
57
+ if (Object.getOwnPropertySymbols(value).length > 0) unsupported(path, "symbol-keyed properties");
58
+ const properties = Object.getOwnPropertyNames(value);
59
+ if (properties.length !== value.length + 1 || !properties.includes("length")) unsupported(path, "sparse or augmented arrays");
60
+ const output = [];
61
+ for (let index = 0; index < value.length; index += 1) {
62
+ const property = String(index);
63
+ const descriptor = Object.getOwnPropertyDescriptor(value, property);
64
+ if (descriptor === void 0 || !("value" in descriptor) || descriptor.enumerable !== true || arrayIndex(property) === void 0) unsupported(propertyPath(path, property), "sparse or accessor array elements");
65
+ const dataDescriptor = descriptor;
66
+ output.push(sanitizeJsonValue(dataDescriptor.value, propertyPath(path, property), ancestors));
67
+ }
68
+ return output;
69
+ };
70
+ const sanitizeObject = (value, path, ancestors) => {
71
+ const prototype = Object.getPrototypeOf(value);
72
+ if (prototype !== Object.prototype && prototype !== null) unsupported(path, "non-plain objects");
73
+ const output = Object.create(null);
74
+ for (const [property, child] of ownDataProperties(value, path)) output[property] = sanitizeJsonValue(child, propertyPath(path, property), ancestors);
75
+ return output;
76
+ };
77
+ const sanitizeJsonValue = (value, path, ancestors = /* @__PURE__ */ new Set()) => {
78
+ if (value === null || typeof value === "boolean" || typeof value === "string") return value;
79
+ if (typeof value === "number") return Number.isFinite(value) ? value : unsupported(path, "non-finite numbers");
80
+ if (typeof value === "undefined") return unsupported(path, "undefined values");
81
+ if (typeof value === "bigint" || typeof value === "function" || typeof value === "symbol") return unsupported(path, `${typeof value} values`);
82
+ if (!isObject$1(value)) return unsupported(path, "unsupported values");
83
+ if (ancestors.has(value)) return unsupported(path, "circular values");
84
+ ancestors.add(value);
85
+ try {
86
+ return Array.isArray(value) ? sanitizeArray(value, path, ancestors) : sanitizeObject(value, path, ancestors);
87
+ } finally {
88
+ ancestors.delete(value);
89
+ }
90
+ };
91
+ /** Convert a successful value using the boundary's constrained JSON policy. */
92
+ const defaultSuccess = ({ value }) => {
93
+ if (isWebResponse(value)) return value;
94
+ if (value === void 0) return new Response(null, { status: 204 });
95
+ return Response.json({ data: sanitizeJsonValue(value, "$") });
96
+ };
97
+ /** Redact typed failures unless the failure is an intentional Response. */
98
+ const defaultFailure = (error) => {
99
+ if (isWebResponse(error)) return error;
100
+ return Response.json({ error: DEFAULT_FAILURE_MESSAGE }, { status: 500 });
101
+ };
102
+ /** Validate policy output at the JavaScript boundary before returning it. */
103
+ const assertResponse = (response) => {
104
+ if (!isWebResponse(response)) throw new TypeError("WebEffect response policies must return a Response");
105
+ return response;
106
+ };
107
+ //#endregion
108
+ //#region src/web/web-effect.ts
109
+ const DEFAULT_UNCONSUMED_TIMEOUT_MS = 3e4;
110
+ const deferred = () => {
111
+ let resolve;
112
+ let reject;
113
+ return {
114
+ promise: new Promise((resolvePromise, rejectPromise) => {
115
+ resolve = resolvePromise;
116
+ reject = rejectPromise;
117
+ }),
118
+ resolve,
119
+ reject
120
+ };
121
+ };
122
+ const isObject = (value) => typeof value === "object" && value !== null;
123
+ const isReadableStream = (value) => isObject(value) && typeof value.getReader === "function";
124
+ const isAsyncIterable = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
125
+ const assertStreamDescriptor = (value) => {
126
+ if (!isObject(value) || typeof value.producer !== "function") throw new TypeError("WebEffect.streamWith Programs must return an explicit stream descriptor");
127
+ return value;
128
+ };
129
+ const assertStreamSource = (value) => {
130
+ if (!isReadableStream(value) && !isAsyncIterable(value)) throw new TypeError("WebEffect stream producers must return a ReadableStream or AsyncIterable");
131
+ return value;
132
+ };
133
+ const streamResponseInit = (descriptor) => {
134
+ const init = {};
135
+ if (descriptor.status !== void 0) init.status = descriptor.status;
136
+ if (descriptor.statusText !== void 0) init.statusText = descriptor.statusText;
137
+ if (descriptor.headers !== void 0) init.headers = descriptor.headers;
138
+ return init;
139
+ };
140
+ const makeManagedBody = (descriptor, managedPromise, timeoutMs) => {
141
+ const completionDeferred = deferred();
142
+ let controller;
143
+ let reader;
144
+ let iterator;
145
+ let sourceStarted = false;
146
+ let settled = false;
147
+ let pulling = false;
148
+ let timer;
149
+ const clearTimer = () => {
150
+ if (timer !== void 0) {
151
+ clearTimeout(timer);
152
+ timer = void 0;
153
+ }
154
+ };
155
+ const makeTimeout = () => {
156
+ const error = /* @__PURE__ */ new Error("WebEffect stream body consumption timed out");
157
+ error.name = "WebEffectStreamTimeoutError";
158
+ return error;
159
+ };
160
+ const fail = (cause, errorBody) => {
161
+ if (settled) return;
162
+ settled = true;
163
+ clearTimer();
164
+ completionDeferred.reject(cause);
165
+ if (errorBody) try {
166
+ controller.error(cause);
167
+ } catch {}
168
+ };
169
+ const succeed = () => {
170
+ if (settled) return;
171
+ settled = true;
172
+ clearTimer();
173
+ completionDeferred.resolve(void 0);
174
+ };
175
+ const closeSource = async (reason) => {
176
+ const managed = await managedPromise;
177
+ try {
178
+ await managed.run(async () => {
179
+ if (reader !== void 0) {
180
+ await reader.cancel(reason);
181
+ reader.releaseLock();
182
+ reader = void 0;
183
+ }
184
+ if (iterator !== void 0) {
185
+ await iterator.return?.();
186
+ iterator = void 0;
187
+ }
188
+ });
189
+ } catch {}
190
+ };
191
+ const cancel = async (reason) => {
192
+ if (settled) return;
193
+ const cause = reason === void 0 ? /* @__PURE__ */ new Error("WebEffect stream body cancelled") : reason;
194
+ await closeSource(cause);
195
+ fail(cause, false);
196
+ };
197
+ const pull = async () => {
198
+ if (settled || pulling) return;
199
+ pulling = true;
200
+ clearTimer();
201
+ try {
202
+ const managed = await managedPromise;
203
+ const result = await managed.run(async () => {
204
+ if (!sourceStarted) {
205
+ sourceStarted = true;
206
+ const source = assertStreamSource(await descriptor.producer({ signal: managed.signal }));
207
+ if (isReadableStream(source)) reader = source.getReader();
208
+ else iterator = source[Symbol.asyncIterator]();
209
+ }
210
+ if (reader !== void 0) return await reader.read();
211
+ if (iterator !== void 0) return await iterator.next();
212
+ throw new TypeError("WebEffect stream producer did not expose a readable source");
213
+ });
214
+ if (result.done) {
215
+ if (reader !== void 0) {
216
+ reader.releaseLock();
217
+ reader = void 0;
218
+ }
219
+ iterator = void 0;
220
+ succeed();
221
+ controller.close();
222
+ return;
223
+ }
224
+ if (!(result.value instanceof Uint8Array)) throw new TypeError("WebEffect stream producers must yield Uint8Array chunks");
225
+ controller.enqueue(new Uint8Array(result.value));
226
+ if (timeoutMs > 0) timer = setTimeout(() => {
227
+ cancel(makeTimeout());
228
+ }, timeoutMs);
229
+ } catch (cause) {
230
+ await closeSource(cause);
231
+ fail(cause, true);
232
+ } finally {
233
+ pulling = false;
234
+ }
235
+ };
236
+ return {
237
+ body: new ReadableStream({
238
+ start(nextController) {
239
+ controller = nextController;
240
+ },
241
+ pull,
242
+ cancel
243
+ }, {
244
+ highWaterMark: 0,
245
+ size: () => 1
246
+ }),
247
+ completion: completionDeferred.promise,
248
+ cancel,
249
+ start: () => {
250
+ if (timeoutMs > 0 && !settled) timer = setTimeout(() => {
251
+ cancel(makeTimeout());
252
+ }, timeoutMs);
253
+ }
254
+ };
255
+ };
256
+ /** @internal Build a response plan without admitting a second Runtime execution. */
257
+ const makeManagedResponse = (descriptor, managedPromise, timeoutMs = DEFAULT_UNCONSUMED_TIMEOUT_MS) => {
258
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) throw new RangeError("WebEffect stream unconsumedTimeoutMs must be a finite non-negative number");
259
+ const body = makeManagedBody(descriptor, managedPromise, timeoutMs);
260
+ const response = new Response(body.body, streamResponseInit(descriptor));
261
+ body.start();
262
+ return {
263
+ readiness: response,
264
+ completion: body.completion,
265
+ cancel: body.cancel,
266
+ retainCompletion: true
267
+ };
268
+ };
269
+ const combineRequestLayer = (request, customLayer) => {
270
+ const currentRequestLayer = CurrentRequest.layer(request);
271
+ if (customLayer === void 0) return currentRequestLayer;
272
+ return Layer.override(currentRequestLayer, customLayer);
273
+ };
274
+ /** @internal Adapt a managed Runtime execution for framework-owned boundaries. */
275
+ const runManagedWith = async (executor, request, program, options) => {
276
+ const managedDeferred = deferred();
277
+ let retainCompletion = false;
278
+ const managedProgram = async () => {
279
+ const result = await program();
280
+ if (Result.isError(result)) return {
281
+ readiness: assertResponse(await (options.onFailure ?? defaultFailure)(result.error)),
282
+ completion: Promise.reject(result.error),
283
+ cancel: async () => {}
284
+ };
285
+ const plan = await options.onSuccess({ value: result.value }, managedDeferred.promise);
286
+ retainCompletion = plan.retainCompletion === true;
287
+ return plan;
288
+ };
289
+ const requestLayer = combineRequestLayer(request, options.requestLayer?.(request));
290
+ let managed;
291
+ try {
292
+ managed = executor.runWithManaged(requestLayer, managedProgram, { signal: request.signal });
293
+ managedDeferred.resolve(managed);
294
+ const response = assertResponse(await managed.readiness);
295
+ if (retainCompletion) managed.completion.catch(() => void 0);
296
+ else await managed.completion.catch(() => void 0);
297
+ return response;
298
+ } catch (cause) {
299
+ managedDeferred.reject(cause);
300
+ if (managed !== void 0) {
301
+ managed.completion.catch(() => void 0);
302
+ await managed.cancel(cause).catch(() => void 0);
303
+ }
304
+ throw cause;
305
+ }
306
+ };
307
+ /** Execute one Result-valued Program inside a framework-neutral Web request boundary. */
308
+ var WebEffect = class {
309
+ constructor() {}
310
+ static async handleWith(executor, request, program, options) {
311
+ const boundaryOptions = options;
312
+ const onSuccess = boundaryOptions?.onSuccess ?? defaultSuccess;
313
+ const onFailure = boundaryOptions?.onFailure ?? defaultFailure;
314
+ const requestLayer = combineRequestLayer(request, boundaryOptions?.requestLayer?.(request));
315
+ let response;
316
+ let failurePolicyFailed = false;
317
+ let failurePolicyCause;
318
+ await executor.runWith(requestLayer, async () => {
319
+ const result = await program();
320
+ if (Result.isError(result)) {
321
+ try {
322
+ response = assertResponse(await onFailure(result.error));
323
+ } catch (cause) {
324
+ failurePolicyFailed = true;
325
+ failurePolicyCause = cause;
326
+ }
327
+ return Result.err(result.error);
328
+ }
329
+ response = assertResponse(await onSuccess({ value: result.value }));
330
+ return Result.ok(response);
331
+ }, { signal: request.signal });
332
+ if (failurePolicyFailed) throw failurePolicyCause;
333
+ if (response === void 0) throw new Error("WebEffect response policy did not produce a Response");
334
+ return response;
335
+ }
336
+ static async streamWith(executor, request, program, options) {
337
+ const timeoutMs = options?.unconsumedTimeoutMs ?? DEFAULT_UNCONSUMED_TIMEOUT_MS;
338
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) throw new RangeError("WebEffect stream unconsumedTimeoutMs must be a finite non-negative number");
339
+ const onFailure = options?.onFailure ?? defaultFailure;
340
+ const requestLayer = combineRequestLayer(request, options?.requestLayer?.(request));
341
+ const managedDeferred = deferred();
342
+ const managedProgram = async () => {
343
+ const result = await program();
344
+ if (Result.isError(result)) return {
345
+ readiness: assertResponse(await onFailure(result.error)),
346
+ completion: Promise.reject(result.error),
347
+ cancel: async () => {}
348
+ };
349
+ const descriptor = assertStreamDescriptor(result.value);
350
+ const body = makeManagedBody(descriptor, managedDeferred.promise, timeoutMs);
351
+ const response = new Response(body.body, streamResponseInit(descriptor));
352
+ body.start();
353
+ return {
354
+ readiness: response,
355
+ completion: body.completion,
356
+ cancel: body.cancel
357
+ };
358
+ };
359
+ let managed;
360
+ try {
361
+ const currentManaged = executor.runWithManaged(requestLayer, managedProgram, { signal: request.signal });
362
+ managed = currentManaged;
363
+ managedDeferred.resolve(currentManaged);
364
+ const response = assertResponse(await currentManaged.readiness);
365
+ currentManaged.completion.catch(() => void 0);
366
+ return response;
367
+ } catch (cause) {
368
+ managedDeferred.reject(cause);
369
+ if (managed !== void 0) {
370
+ managed.completion.catch(() => void 0);
371
+ await managed.cancel(cause).catch(() => void 0);
372
+ }
373
+ throw cause;
374
+ }
375
+ }
376
+ };
377
+ //#endregion
378
+ export { assertResponse as a, WebEffectSerializationError as i, makeManagedResponse as n, runManagedWith as r, WebEffect as t };
379
+
380
+ //# sourceMappingURL=web-effect-B9hp9jIe.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-effect-B9hp9jIe.mjs","names":["isObject","dataDescriptor"],"sources":["../src/web/responses.ts","../src/web/web-effect.ts"],"sourcesContent":["import type { WebEffectSuccess, WebJsonValue } from './types'\n\n/* oxlint-disable anti-slop/no-object-parameters -- Web Response values are validated structurally at this boundary. */\n/* oxlint-disable anti-slop/no-runtime-typeof -- Web Response and JSON values require runtime protocol validation. */\n/* oxlint-disable anti-slop/no-unknown-parameters -- Web Response and JSON policies accept opaque JavaScript values. */\n/* oxlint-disable anti-slop/no-unknown-returns -- Web Response and JSON policies narrow opaque JavaScript values locally. */\n\nconst DEFAULT_FAILURE_MESSAGE = 'Internal Server Error'\n\ntype BodyCandidate = {\n readonly cancel: unknown\n readonly getReader: unknown\n readonly locked: unknown\n readonly pipeThrough: unknown\n readonly pipeTo: unknown\n readonly tee: unknown\n}\n\ntype ResponseCandidate = {\n readonly body: unknown\n readonly bodyUsed: unknown\n readonly headers: unknown\n readonly ok: unknown\n readonly redirected: unknown\n readonly status: unknown\n readonly statusText: unknown\n readonly type: unknown\n readonly url: unknown\n readonly arrayBuffer: unknown\n readonly blob: unknown\n readonly bytes: unknown\n readonly clone: unknown\n readonly formData: unknown\n readonly json: unknown\n readonly text: unknown\n}\n\n/** An unsupported value encountered by the default Web JSON policy. */\nexport class WebEffectSerializationError extends TypeError {\n constructor(detail: string) {\n super(`WebEffect default success serialization ${detail}`)\n this.name = 'WebEffectSerializationError'\n }\n}\n\nconst isObject = (value: unknown): value is object => typeof value === 'object' && value !== null\n\nconst isCallable = (value: unknown): value is (...arguments_: never[]) => unknown =>\n typeof value === 'function'\n\ntype HeadersCandidate = {\n readonly append: unknown\n readonly delete: unknown\n readonly get: unknown\n readonly getSetCookie: unknown\n readonly has: unknown\n readonly set: unknown\n readonly forEach: unknown\n}\n\nconst isHeaders = (value: unknown): boolean => {\n if (!isObject(value)) {\n return false\n }\n\n // SAFETY: isObject above establishes the runtime object shape before structural field inspection.\n const candidate = value as HeadersCandidate\n\n return (\n isCallable(candidate.append) &&\n isCallable(candidate.delete) &&\n isCallable(candidate.get) &&\n isCallable(candidate.getSetCookie) &&\n isCallable(candidate.has) &&\n isCallable(candidate.set) &&\n isCallable(candidate.forEach)\n )\n}\n\nconst isBody = (value: unknown): boolean => {\n if (value === null) {\n return true\n }\n\n if (!isObject(value)) {\n return false\n }\n\n // SAFETY: isObject above establishes the runtime object shape before structural field inspection.\n const candidate = value as BodyCandidate\n\n return (\n typeof candidate.locked === 'boolean' &&\n isCallable(candidate.cancel) &&\n isCallable(candidate.getReader) &&\n isCallable(candidate.pipeThrough) &&\n isCallable(candidate.pipeTo) &&\n isCallable(candidate.tee)\n )\n}\n\nconst isResponseStatus = (value: unknown): value is number =>\n typeof value === 'number' &&\n Number.isInteger(value) &&\n (value === 0 || (value >= 200 && value <= 599))\n\nconst isResponseType = (value: unknown): value is Response['type'] =>\n value === 'basic' ||\n value === 'cors' ||\n value === 'default' ||\n value === 'error' ||\n value === 'opaque' ||\n value === 'opaqueredirect'\n\n/** Accept native, cross-realm, and standards-compatible Web Response values. */\nconst isWebResponse = (value: unknown): value is Response => {\n if (!isObject(value)) {\n return false\n }\n\n try {\n // SAFETY: isObject above establishes the runtime object shape before structural field inspection.\n const candidate = value as ResponseCandidate\n\n const status = candidate.status\n\n if (!isResponseStatus(status)) {\n return false\n }\n\n return (\n isBody(candidate.body) &&\n typeof candidate.bodyUsed === 'boolean' &&\n isHeaders(candidate.headers) &&\n typeof candidate.ok === 'boolean' &&\n candidate.ok === (status >= 200 && status <= 299) &&\n typeof candidate.redirected === 'boolean' &&\n typeof candidate.statusText === 'string' &&\n isResponseType(candidate.type) &&\n typeof candidate.url === 'string' &&\n isCallable(candidate.arrayBuffer) &&\n isCallable(candidate.blob) &&\n isCallable(candidate.bytes) &&\n isCallable(candidate.clone) &&\n isCallable(candidate.formData) &&\n isCallable(candidate.json) &&\n isCallable(candidate.text)\n )\n } catch {\n return false\n }\n}\n\nconst propertyPath = (path: string, property: string): string => `${path}.${property}`\n\nconst unsupported = (path: string, kind: string): never => {\n throw new WebEffectSerializationError(`cannot encode ${kind} at ${path}`)\n}\n\nconst ownDataProperties = (\n value: object,\n path: string\n): readonly (readonly [string, unknown])[] => {\n const symbols = Object.getOwnPropertySymbols(value)\n\n if (symbols.length > 0) {\n unsupported(path, 'symbol-keyed properties')\n }\n\n return Object.getOwnPropertyNames(value).map((property) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, property)\n\n if (descriptor === undefined || !('value' in descriptor) || descriptor.enumerable !== true) {\n unsupported(propertyPath(path, property), 'non-enumerable or accessor properties')\n }\n\n // SAFETY: the preceding descriptor guard establishes a data descriptor with an enumerable value.\n const dataDescriptor = descriptor as PropertyDescriptor & { readonly value: unknown }\n\n return [property, dataDescriptor.value] as const\n })\n}\n\nconst arrayIndex = (property: string): number | undefined => {\n const index = Number(property)\n\n return Number.isInteger(index) && index >= 0 && index < 2 ** 32 - 1 && String(index) === property\n ? index\n : undefined\n}\n\nconst sanitizeArray = (\n value: readonly unknown[],\n path: string,\n ancestors: Set<object>\n): readonly WebJsonValue[] => {\n const symbols = Object.getOwnPropertySymbols(value)\n\n if (symbols.length > 0) {\n unsupported(path, 'symbol-keyed properties')\n }\n\n const properties = Object.getOwnPropertyNames(value)\n\n if (properties.length !== value.length + 1 || !properties.includes('length')) {\n unsupported(path, 'sparse or augmented arrays')\n }\n\n const output: WebJsonValue[] = []\n\n for (let index = 0; index < value.length; index += 1) {\n const property = String(index)\n const descriptor = Object.getOwnPropertyDescriptor(value, property)\n\n if (\n descriptor === undefined ||\n !('value' in descriptor) ||\n descriptor.enumerable !== true ||\n arrayIndex(property) === undefined\n ) {\n unsupported(propertyPath(path, property), 'sparse or accessor array elements')\n }\n\n // SAFETY: the preceding descriptor guard establishes a data descriptor with an enumerable value.\n const dataDescriptor = descriptor as PropertyDescriptor & { readonly value: unknown }\n\n output.push(sanitizeJsonValue(dataDescriptor.value, propertyPath(path, property), ancestors))\n }\n\n return output\n}\n\nconst sanitizeObject = (\n value: object,\n path: string,\n ancestors: Set<object>\n): { readonly [key: string]: WebJsonValue } => {\n const prototype = Object.getPrototypeOf(value)\n\n if (prototype !== Object.prototype && prototype !== null) {\n unsupported(path, 'non-plain objects')\n }\n\n // SAFETY: Object.create(null) is an empty dictionary that is populated only with sanitized values.\n const output: { [key: string]: WebJsonValue } = Object.create(null) as {\n [key: string]: WebJsonValue\n }\n\n for (const [property, child] of ownDataProperties(value, path)) {\n output[property] = sanitizeJsonValue(child, propertyPath(path, property), ancestors)\n }\n\n return output\n}\n\nconst sanitizeJsonValue = (\n value: unknown,\n path: string,\n ancestors: Set<object> = new Set()\n): WebJsonValue => {\n if (value === null || typeof value === 'boolean' || typeof value === 'string') {\n return value\n }\n\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : unsupported(path, 'non-finite numbers')\n }\n\n if (typeof value === 'undefined') {\n return unsupported(path, 'undefined values')\n }\n\n if (typeof value === 'bigint' || typeof value === 'function' || typeof value === 'symbol') {\n return unsupported(path, `${typeof value} values`)\n }\n\n if (!isObject(value)) {\n return unsupported(path, 'unsupported values')\n }\n\n if (ancestors.has(value)) {\n return unsupported(path, 'circular values')\n }\n\n ancestors.add(value)\n\n try {\n return Array.isArray(value)\n ? sanitizeArray(value, path, ancestors)\n : sanitizeObject(value, path, ancestors)\n } finally {\n ancestors.delete(value)\n }\n}\n\n/** Convert a successful value using the boundary's constrained JSON policy. */\nexport const defaultSuccess = ({ value }: WebEffectSuccess): Response => {\n if (isWebResponse(value)) {\n return value\n }\n\n if (value === undefined) {\n return new Response(null, { status: 204 })\n }\n\n return Response.json({ data: sanitizeJsonValue(value, '$') })\n}\n\n/** Redact typed failures unless the failure is an intentional Response. */\n// oxlint-disable-next-line anti-slop/no-unknown-parameters -- Typed Result errors are intentionally opaque at this HTTP boundary.\nexport const defaultFailure = (error: unknown): Response => {\n if (isWebResponse(error)) {\n return error\n }\n\n return Response.json({ error: DEFAULT_FAILURE_MESSAGE }, { status: 500 })\n}\n\n/** Validate policy output at the JavaScript boundary before returning it. */\n// oxlint-disable-next-line anti-slop/no-unknown-parameters -- Policy callbacks are opaque JavaScript inputs at this boundary.\nexport const assertResponse = (response: unknown): Response => {\n if (!isWebResponse(response)) {\n throw new TypeError('WebEffect response policies must return a Response')\n }\n\n return response\n}\n","import { Result } from 'better-result'\n\nimport { Layer } from '../layer'\nimport type { LayerInput } from '../layer/inference'\nimport { CurrentRequest } from '../standard-services/current-request'\nimport type { RuntimeExecutor, RuntimeManagedExecution, RuntimeManagedPlan } from '../runtime'\nimport type { AnyService } from '../service'\nimport type { EffectError, EffectSuccess } from '../effect/types'\nimport { assertResponse, defaultFailure, defaultSuccess } from './responses'\nimport type {\n AnyProgram,\n CompleteWebProgram,\n CompleteWebStreamProgram,\n DefaultRequestLayer,\n WebEffectStream,\n WebEffectStreamContext,\n WebEffectStreamOptions,\n WebEffectOptions,\n WebEffectProgram,\n WebProgramChecks,\n WebStreamProgramChecks,\n WebRequestLayerChecks\n} from './types'\n\n/* oxlint-disable anti-slop/no-unknown-parameters, anti-slop/no-runtime-typeof, anti-slop/no-unsafe-dictionary-type, anti-slop/no-chained-type-assertions, anti-slop/require-safety-comment-for-type-assertion -- this boundary validates opaque Web stream protocols before execution. */\n\nconst DEFAULT_UNCONSUMED_TIMEOUT_MS = 30_000\n\ntype Deferred<A> = {\n readonly promise: Promise<A>\n readonly resolve: (value: A | PromiseLike<A>) => void\n readonly reject: (cause?: unknown) => void\n}\n\nconst deferred = <A>(): Deferred<A> => {\n let resolve!: (value: A | PromiseLike<A>) => void\n let reject!: (cause?: unknown) => void\n const promise = new Promise<A>((resolvePromise, rejectPromise) => {\n resolve = resolvePromise\n reject = rejectPromise\n })\n\n return { promise, resolve, reject }\n}\n\nconst isObject = (value: unknown): value is Record<PropertyKey, unknown> =>\n typeof value === 'object' && value !== null\n\nconst isReadableStream = (value: unknown): value is ReadableStream<Uint8Array> =>\n isObject(value) && typeof value.getReader === 'function'\n\nconst isAsyncIterable = (value: unknown): value is AsyncIterable<Uint8Array> =>\n isObject(value) && typeof value[Symbol.asyncIterator] === 'function'\n\nconst assertStreamDescriptor = (value: unknown): WebEffectStream => {\n if (!isObject(value) || typeof value.producer !== 'function') {\n throw new TypeError('WebEffect.streamWith Programs must return an explicit stream descriptor')\n }\n\n return value as WebEffectStream\n}\n\nconst assertStreamSource = (\n value: unknown\n): ReadableStream<Uint8Array> | AsyncIterable<Uint8Array> => {\n if (!isReadableStream(value) && !isAsyncIterable(value)) {\n throw new TypeError('WebEffect stream producers must return a ReadableStream or AsyncIterable')\n }\n\n return value\n}\n\nconst streamResponseInit = (descriptor: WebEffectStream): ResponseInit => {\n const init: ResponseInit = {}\n\n if (descriptor.status !== undefined) init.status = descriptor.status\n if (descriptor.statusText !== undefined) init.statusText = descriptor.statusText\n if (descriptor.headers !== undefined) init.headers = descriptor.headers\n\n return init\n}\n\ntype ManagedBody = {\n readonly body: ReadableStream<Uint8Array>\n readonly completion: Promise<void>\n readonly cancel: (reason?: unknown) => Promise<void>\n readonly start: () => void\n}\n\n/** @internal A managed Web response plan used by framework adapters. */\nexport type ManagedWebResponse = RuntimeManagedPlan<Response> & {\n /** @internal Keep the request execution alive after readiness is returned. */\n readonly retainCompletion?: boolean\n}\n\nconst makeManagedBody = (\n descriptor: WebEffectStream,\n managedPromise: Promise<RuntimeManagedExecution<unknown>>,\n timeoutMs: number\n): ManagedBody => {\n const completionDeferred = deferred<void>()\n let controller!: ReadableStreamDefaultController<Uint8Array>\n let reader: ReadableStreamDefaultReader<Uint8Array> | undefined\n let iterator: AsyncIterator<Uint8Array> | undefined\n let sourceStarted = false\n let settled = false\n let pulling = false\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const clearTimer = (): void => {\n if (timer !== undefined) {\n clearTimeout(timer)\n timer = undefined\n }\n }\n\n const makeTimeout = (): Error => {\n const error = new Error('WebEffect stream body consumption timed out')\n error.name = 'WebEffectStreamTimeoutError'\n return error\n }\n\n const fail = (cause: unknown, errorBody: boolean): void => {\n if (settled) return\n settled = true\n clearTimer()\n completionDeferred.reject(cause)\n if (errorBody) {\n try {\n controller.error(cause)\n } catch {\n // The body may already have been cancelled by its consumer.\n }\n }\n }\n\n const succeed = (): void => {\n if (settled) return\n settled = true\n clearTimer()\n completionDeferred.resolve(undefined)\n }\n\n const closeSource = async (reason?: unknown): Promise<void> => {\n const managed = await managedPromise\n\n try {\n await managed.run(async () => {\n if (reader !== undefined) {\n await reader.cancel(reason)\n reader.releaseLock()\n reader = undefined\n }\n\n if (iterator !== undefined) {\n await iterator.return?.()\n iterator = undefined\n }\n })\n } catch {\n // The managed execution remains the owner of the primary cancellation cause.\n }\n }\n\n const cancel = async (reason?: unknown): Promise<void> => {\n if (settled) return\n const cause = reason === undefined ? new Error('WebEffect stream body cancelled') : reason\n await closeSource(cause)\n fail(cause, false)\n }\n\n const pull = async (): Promise<void> => {\n if (settled || pulling) return\n pulling = true\n clearTimer()\n\n try {\n const managed = await managedPromise\n const result = await managed.run(async () => {\n if (!sourceStarted) {\n sourceStarted = true\n const source = assertStreamSource(await descriptor.producer({ signal: managed.signal }))\n\n if (isReadableStream(source)) {\n reader = source.getReader()\n } else {\n iterator = source[Symbol.asyncIterator]()\n }\n }\n\n if (reader !== undefined) return await reader.read()\n if (iterator !== undefined) return await iterator.next()\n throw new TypeError('WebEffect stream producer did not expose a readable source')\n })\n\n if (result.done) {\n if (reader !== undefined) {\n reader.releaseLock()\n reader = undefined\n }\n iterator = undefined\n succeed()\n controller.close()\n return\n }\n\n if (!(result.value instanceof Uint8Array)) {\n throw new TypeError('WebEffect stream producers must yield Uint8Array chunks')\n }\n\n controller.enqueue(new Uint8Array(result.value))\n if (timeoutMs > 0) {\n timer = setTimeout(() => {\n void cancel(makeTimeout())\n }, timeoutMs)\n }\n } catch (cause) {\n await closeSource(cause)\n fail(cause, true)\n } finally {\n pulling = false\n }\n }\n\n const body = new ReadableStream<Uint8Array>(\n {\n start(nextController) {\n controller = nextController\n },\n pull,\n cancel\n },\n { highWaterMark: 0, size: () => 1 }\n )\n\n return {\n body,\n completion: completionDeferred.promise,\n cancel,\n start: () => {\n if (timeoutMs > 0 && !settled) {\n timer = setTimeout(() => {\n void cancel(makeTimeout())\n }, timeoutMs)\n }\n }\n }\n}\n\n/** @internal Build a response plan without admitting a second Runtime execution. */\nexport const makeManagedResponse = (\n descriptor: WebEffectStream,\n managedPromise: Promise<RuntimeManagedExecution<unknown>>,\n timeoutMs = DEFAULT_UNCONSUMED_TIMEOUT_MS\n): ManagedWebResponse => {\n if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {\n throw new RangeError(\n 'WebEffect stream unconsumedTimeoutMs must be a finite non-negative number'\n )\n }\n\n const body = makeManagedBody(descriptor, managedPromise, timeoutMs)\n const response = new Response(body.body, streamResponseInit(descriptor))\n body.start()\n\n return {\n readiness: response,\n completion: body.completion,\n cancel: body.cancel,\n retainCompletion: true\n }\n}\n\nconst combineRequestLayer = <RequestLayer extends LayerInput>(\n request: Request,\n customLayer: RequestLayer | undefined\n): LayerInput => {\n const currentRequestLayer = CurrentRequest.layer(request)\n\n if (customLayer === undefined) {\n return currentRequestLayer\n }\n\n // SAFETY: WebEffect.handleWith validates the custom Layer's shape and override contract at its public boundary.\n return Layer.override(currentRequestLayer, customLayer as never)\n}\n\n/** @internal Run a framework boundary with a readiness/completion split. */\nexport type ManagedWebBoundaryOptions = {\n readonly requestLayer?: (request: Request) => LayerInput\n readonly onSuccess: (\n result: { readonly value: unknown },\n managed: Promise<RuntimeManagedExecution<unknown>>\n ) => ManagedWebResponse | PromiseLike<ManagedWebResponse>\n readonly onFailure?: (error: unknown) => Response | PromiseLike<Response>\n}\n\n/** @internal Adapt a managed Runtime execution for framework-owned boundaries. */\nexport const runManagedWith = async (\n executor: RuntimeExecutor<AnyService>,\n request: Request,\n program: AnyProgram,\n options: ManagedWebBoundaryOptions\n): Promise<Response> => {\n const managedDeferred = deferred<RuntimeManagedExecution<unknown>>()\n let retainCompletion = false\n const managedProgram = async (): Promise<ManagedWebResponse> => {\n const result = await program()\n\n if (Result.isError(result)) {\n const response = assertResponse(await (options.onFailure ?? defaultFailure)(result.error))\n return {\n readiness: response,\n completion: Promise.reject(result.error),\n cancel: async () => {}\n }\n }\n\n const plan = await options.onSuccess({ value: result.value }, managedDeferred.promise)\n retainCompletion = plan.retainCompletion === true\n return plan\n }\n\n const requestLayer = combineRequestLayer(request, options.requestLayer?.(request))\n let managed: RuntimeManagedExecution<unknown> | undefined\n\n try {\n managed = executor.runWithManaged(requestLayer as Layer.Any, managedProgram as never, {\n signal: request.signal\n })\n managedDeferred.resolve(managed)\n const response = assertResponse(await managed.readiness)\n if (retainCompletion) {\n void managed.completion.catch(() => undefined)\n } else {\n await managed.completion.catch(() => undefined)\n }\n return response\n } catch (cause) {\n managedDeferred.reject(cause)\n if (managed !== undefined) {\n void managed.completion.catch(() => undefined)\n await managed.cancel(cause).catch(() => undefined)\n }\n throw cause\n }\n}\n\n/** Execute one Result-valued Program inside a framework-neutral Web request boundary. */\nexport class WebEffect {\n private constructor() {}\n\n /**\n * Run one lazy Program and map its Result to a standard Web Response.\n *\n * The request Layer and execution Scope are owned by the Runtime behind the\n * supplied executor; request resources close before this Promise resolves,\n * while Runtime-root resources remain owned by that Runtime.\n */\n static handleWith<\n Provided extends AnyService,\n const Program extends AnyProgram,\n RequestLayer extends LayerInput,\n Failure = EffectError<Program>\n >(\n executor: RuntimeExecutor<Provided>,\n request: Request,\n program: Program,\n options: WebEffectOptions<NoInfer<Failure>, RequestLayer, EffectSuccess<Program>> & {\n readonly requestLayer: (request: Request) => RequestLayer\n } & WebRequestLayerChecks<Provided, RequestLayer> &\n WebProgramChecks<Provided, RequestLayer, Program, NoInfer<Failure>>\n ): Promise<Response>\n\n static handleWith<\n Provided extends AnyService,\n const Program extends AnyProgram,\n Failure = EffectError<Program>\n >(\n executor: RuntimeExecutor<Provided>,\n request: Request,\n program: Program & CompleteWebProgram<Provided, DefaultRequestLayer, Program, NoInfer<Failure>>,\n options: WebEffectOptions<NoInfer<Failure>, DefaultRequestLayer, EffectSuccess<Program>>\n ): Promise<Response>\n\n static handleWith<Provided extends AnyService, const Program extends AnyProgram>(\n executor: RuntimeExecutor<Provided>,\n request: Request,\n program: Program & CompleteWebProgram<Provided, DefaultRequestLayer, Program>,\n options?: undefined\n ): Promise<Response>\n\n static async handleWith(\n executor: RuntimeExecutor<AnyService>,\n request: Request,\n program: AnyProgram,\n options?: WebEffectOptions<unknown, LayerInput, unknown>\n ): Promise<Response> {\n const boundaryOptions = options\n const onSuccess = boundaryOptions?.onSuccess ?? defaultSuccess\n const onFailure = boundaryOptions?.onFailure ?? defaultFailure\n const requestLayer = combineRequestLayer(request, boundaryOptions?.requestLayer?.(request))\n let response: Response | undefined\n let failurePolicyFailed = false\n let failurePolicyCause: unknown\n\n // Return a Result from the execution even after mapping it so Runtime can\n // classify typed failures and give request finalizers the original cause.\n // A policy defect is rethrown after this Result settles so it cannot replace\n // the typed failure supplied to the request Scope.\n // SAFETY: Public overloads validate the request Layer before this erased Runtime boundary.\n await executor.runWith(\n requestLayer as Layer.Any,\n async () => {\n const result = await program()\n\n if (Result.isError(result)) {\n try {\n response = assertResponse(await onFailure(result.error))\n } catch (cause) {\n failurePolicyFailed = true\n failurePolicyCause = cause\n }\n\n return Result.err(result.error)\n }\n\n response = assertResponse(\n await onSuccess({\n value: result.value\n })\n )\n return Result.ok(response)\n },\n { signal: request.signal }\n )\n\n if (failurePolicyFailed) {\n throw failurePolicyCause\n }\n\n if (response === undefined) {\n throw new Error('WebEffect response policy did not produce a Response')\n }\n\n return response\n }\n\n static streamWith<\n Provided extends AnyService,\n const Program extends AnyProgram,\n RequestLayer extends LayerInput,\n Failure = EffectError<Program>\n >(\n executor: RuntimeExecutor<Provided>,\n request: Request,\n program: Program,\n options: WebEffectStreamOptions<NoInfer<Failure>, RequestLayer> & {\n readonly requestLayer: (request: Request) => RequestLayer\n } & WebRequestLayerChecks<Provided, RequestLayer> &\n WebStreamProgramChecks<Provided, RequestLayer, Program, NoInfer<Failure>>\n ): Promise<Response>\n\n static streamWith<\n Provided extends AnyService,\n const Program extends AnyProgram,\n Failure = EffectError<Program>\n >(\n executor: RuntimeExecutor<Provided>,\n request: Request,\n program: Program &\n CompleteWebStreamProgram<Provided, DefaultRequestLayer, Program, NoInfer<Failure>>,\n options?: WebEffectStreamOptions<NoInfer<Failure>, DefaultRequestLayer>\n ): Promise<Response>\n\n static async streamWith(\n executor: RuntimeExecutor<AnyService>,\n request: Request,\n program: AnyProgram,\n options?: WebEffectStreamOptions<unknown, LayerInput>\n ): Promise<Response> {\n const timeoutMs = options?.unconsumedTimeoutMs ?? DEFAULT_UNCONSUMED_TIMEOUT_MS\n\n if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {\n throw new RangeError(\n 'WebEffect stream unconsumedTimeoutMs must be a finite non-negative number'\n )\n }\n\n const onFailure = options?.onFailure ?? defaultFailure\n const requestLayer = combineRequestLayer(request, options?.requestLayer?.(request))\n const managedDeferred = deferred<RuntimeManagedExecution<unknown>>()\n\n const managedProgram = async (): Promise<RuntimeManagedPlan<Response>> => {\n const result = await program()\n\n if (Result.isError(result)) {\n const response = assertResponse(await onFailure(result.error))\n\n return {\n readiness: response,\n completion: Promise.reject(result.error),\n cancel: async () => {}\n }\n }\n\n const descriptor = assertStreamDescriptor(result.value)\n const body = makeManagedBody(descriptor, managedDeferred.promise, timeoutMs)\n const response = new Response(body.body, streamResponseInit(descriptor))\n\n body.start()\n\n return {\n readiness: response,\n completion: body.completion,\n cancel: body.cancel\n }\n }\n\n let managed: RuntimeManagedExecution<unknown> | undefined\n\n try {\n const currentManaged = executor.runWithManaged(\n requestLayer as Layer.Any,\n managedProgram as never,\n {\n signal: request.signal\n }\n )\n managed = currentManaged\n managedDeferred.resolve(currentManaged)\n const response = assertResponse(await currentManaged.readiness)\n void currentManaged.completion.catch(() => undefined)\n return response\n } catch (cause) {\n managedDeferred.reject(cause)\n if (managed !== undefined) {\n void managed.completion.catch(() => undefined)\n await managed.cancel(cause).catch(() => undefined)\n }\n throw cause\n }\n }\n}\n\n/** Type-level aliases for the framework-neutral Web boundary. */\nexport declare namespace WebEffect {\n /** Options used by `WebEffect.handleWith`. */\n export type Options<\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer,\n Success = unknown\n > = WebEffectOptions<Failure, RequestLayer, Success>\n\n /** The success value passed to `onSuccess`. */\n export type Success<A = unknown> = {\n readonly value: A\n }\n\n /** A standard Web response or an asynchronous response. */\n export type ResponseLike = Response | PromiseLike<Response>\n\n /** A lazy Result-valued Program accepted by `handleWith`. */\n export type Program<A = unknown, E = unknown, R extends AnyService = never> = WebEffectProgram<\n A,\n E,\n R\n >\n\n /** Extract a Program's success channel. */\n export type Value<Program extends WebEffectProgram<any, any, AnyService>> = EffectSuccess<Program>\n\n /** Extract a Program's typed failure channel. */\n export type Failure<Program extends WebEffectProgram<any, any, AnyService>> = EffectError<Program>\n\n /** Explicit response descriptor accepted by `streamWith`. */\n export type Stream = WebEffectStream\n\n /** Producer context accepted by a managed response descriptor. */\n export type StreamContext = WebEffectStreamContext\n\n /** Options used by `streamWith`. */\n export type StreamOptions<\n Failure = unknown,\n RequestLayer extends LayerInput = DefaultRequestLayer\n > = WebEffectStreamOptions<Failure, RequestLayer>\n}\n"],"mappings":";;;;A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/web.d.mts CHANGED
@@ -1,7 +1,6 @@
1
- import { C as EffectError, E as EffectSuccess, M as AnyService } from "./index-AiKM71-u.mjs";
2
- import { y as LayerInput } from "./outcome-DI8LPIQ4.mjs";
3
- import { l as Runtime } from "./index-BodMy6rO.mjs";
4
- import { a as WebEffectOptions, i as ResponseLike, l as WebProgramChecks, n as CompleteWebProgram, o as WebEffectProgram, r as DefaultRequestLayer, s as WebEffectSuccess, t as AnyProgram, u as WebRequestLayerChecks } from "./types-oihI-ESv.mjs";
1
+ import { Lt as AnyService, Ot as EffectError, jt as EffectSuccess, tt as LayerInput, u as RuntimeExecutor } from "./layer-C2OaqTmB.mjs";
2
+ import "./index-ClNndn2-.mjs";
3
+ import { a as ResponseLike, c as WebEffectStream, d as WebEffectStreamSource, f as WebEffectSuccess, g as WebStreamProgramChecks, h as WebRequestLayerChecks, i as DefaultRequestLayer, l as WebEffectStreamContext, m as WebProgramChecks, n as CompleteWebProgram, o as WebEffectOptions, r as CompleteWebStreamProgram, s as WebEffectProgram, t as AnyProgram, u as WebEffectStreamOptions } from "./types-BFTqCCcw.mjs";
5
4
  //#region src/web/web-effect.d.ts
6
5
  /** Execute one Result-valued Program inside a framework-neutral Web request boundary. */
7
6
  declare class WebEffect {
@@ -9,19 +8,23 @@ declare class WebEffect {
9
8
  /**
10
9
  * Run one lazy Program and map its Result to a standard Web Response.
11
10
  *
12
- * The request Layer and execution Scope are owned by the supplied Runtime;
13
- * request resources close before this Promise resolves, while Runtime-root
14
- * resources remain owned by the Runtime.
11
+ * The request Layer and execution Scope are owned by the Runtime behind the
12
+ * supplied executor; request resources close before this Promise resolves,
13
+ * while Runtime-root resources remain owned by that Runtime.
15
14
  */
16
- static handle<Provided extends AnyService, const Program extends AnyProgram, RequestLayer extends LayerInput, Failure = EffectError<Program>>(runtime: Runtime<Provided>, request: Request, program: Program, options: WebEffectOptions<NoInfer<Failure>, RequestLayer, EffectSuccess<Program>> & {
15
+ static handleWith<Provided extends AnyService, const Program extends AnyProgram, RequestLayer extends LayerInput, Failure = EffectError<Program>>(executor: RuntimeExecutor<Provided>, request: Request, program: Program, options: WebEffectOptions<NoInfer<Failure>, RequestLayer, EffectSuccess<Program>> & {
17
16
  readonly requestLayer: (request: Request) => RequestLayer;
18
17
  } & WebRequestLayerChecks<Provided, RequestLayer> & WebProgramChecks<Provided, RequestLayer, Program, NoInfer<Failure>>): Promise<Response>;
19
- static handle<Provided extends AnyService, const Program extends AnyProgram, Failure = EffectError<Program>>(runtime: Runtime<Provided>, request: Request, program: Program & CompleteWebProgram<Provided, DefaultRequestLayer, Program, NoInfer<Failure>>, options: WebEffectOptions<NoInfer<Failure>, DefaultRequestLayer, EffectSuccess<Program>>): Promise<Response>;
20
- static handle<Provided extends AnyService, const Program extends AnyProgram>(runtime: Runtime<Provided>, request: Request, program: Program & CompleteWebProgram<Provided, DefaultRequestLayer, Program>, options?: undefined): Promise<Response>;
18
+ static handleWith<Provided extends AnyService, const Program extends AnyProgram, Failure = EffectError<Program>>(executor: RuntimeExecutor<Provided>, request: Request, program: Program & CompleteWebProgram<Provided, DefaultRequestLayer, Program, NoInfer<Failure>>, options: WebEffectOptions<NoInfer<Failure>, DefaultRequestLayer, EffectSuccess<Program>>): Promise<Response>;
19
+ static handleWith<Provided extends AnyService, const Program extends AnyProgram>(executor: RuntimeExecutor<Provided>, request: Request, program: Program & CompleteWebProgram<Provided, DefaultRequestLayer, Program>, options?: undefined): Promise<Response>;
20
+ static streamWith<Provided extends AnyService, const Program extends AnyProgram, RequestLayer extends LayerInput, Failure = EffectError<Program>>(executor: RuntimeExecutor<Provided>, request: Request, program: Program, options: WebEffectStreamOptions<NoInfer<Failure>, RequestLayer> & {
21
+ readonly requestLayer: (request: Request) => RequestLayer;
22
+ } & WebRequestLayerChecks<Provided, RequestLayer> & WebStreamProgramChecks<Provided, RequestLayer, Program, NoInfer<Failure>>): Promise<Response>;
23
+ static streamWith<Provided extends AnyService, const Program extends AnyProgram, Failure = EffectError<Program>>(executor: RuntimeExecutor<Provided>, request: Request, program: Program & CompleteWebStreamProgram<Provided, DefaultRequestLayer, Program, NoInfer<Failure>>, options?: WebEffectStreamOptions<NoInfer<Failure>, DefaultRequestLayer>): Promise<Response>;
21
24
  }
22
25
  /** Type-level aliases for the framework-neutral Web boundary. */
23
26
  declare namespace WebEffect {
24
- /** Options used by `WebEffect.handle`. */
27
+ /** Options used by `WebEffect.handleWith`. */
25
28
  type Options<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer, Success = unknown> = WebEffectOptions<Failure, RequestLayer, Success>;
26
29
  /** The success value passed to `onSuccess`. */
27
30
  type Success<A = unknown> = {
@@ -29,12 +32,18 @@ declare namespace WebEffect {
29
32
  };
30
33
  /** A standard Web response or an asynchronous response. */
31
34
  type ResponseLike = Response | PromiseLike<Response>;
32
- /** A lazy Result-valued Program accepted by `handle`. */
35
+ /** A lazy Result-valued Program accepted by `handleWith`. */
33
36
  type Program<A = unknown, E = unknown, R extends AnyService = never> = WebEffectProgram<A, E, R>;
34
37
  /** Extract a Program's success channel. */
35
38
  type Value<Program extends WebEffectProgram<any, any, AnyService>> = EffectSuccess<Program>;
36
39
  /** Extract a Program's typed failure channel. */
37
40
  type Failure<Program extends WebEffectProgram<any, any, AnyService>> = EffectError<Program>;
41
+ /** Explicit response descriptor accepted by `streamWith`. */
42
+ type Stream = WebEffectStream;
43
+ /** Producer context accepted by a managed response descriptor. */
44
+ type StreamContext = WebEffectStreamContext;
45
+ /** Options used by `streamWith`. */
46
+ type StreamOptions<Failure = unknown, RequestLayer extends LayerInput = DefaultRequestLayer> = WebEffectStreamOptions<Failure, RequestLayer>;
38
47
  }
39
48
  //#endregion
40
49
  //#region src/web/responses.d.ts
@@ -43,5 +52,5 @@ declare class WebEffectSerializationError extends TypeError {
43
52
  constructor(detail: string);
44
53
  }
45
54
  //#endregion
46
- export { type ResponseLike, WebEffect, type WebEffectOptions, type WebEffectProgram, WebEffectSerializationError, type WebEffectSuccess };
55
+ export { type ResponseLike, WebEffect, type WebEffectOptions, type WebEffectProgram, WebEffectSerializationError, type WebEffectStream, type WebEffectStreamContext, type WebEffectStreamOptions, type WebEffectStreamSource, type WebEffectSuccess };
47
56
  //# sourceMappingURL=web.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.mts","names":[],"sources":["../src/web/web-effect.ts","../src/web/responses.ts"],"mappings":";;;;;;cAkCa;UACJ;;;;;;;;SASA,OACL,iBAAiB,kBACX,gBAAgB,YACtB,qBAAqB,YACrB,UAAU,YAAY,UAEtB,SAAS,QAAQ,WACjB,SAAS,SACT,SAAS,SACT,SAAS,iBAAiB,QAAQ,UAAU,cAAc,cAAc;aAC7D,eAAe,SAAS,YAAY;MAC3C,sBAAsB,UAAU,gBAClC,iBAAiB,UAAU,cAAc,SAAS,QAAQ,YAC3D,QAAQ;SAEJ,OACL,iBAAiB,kBACX,gBAAgB,YACtB,UAAU,YAAY,UAEtB,SAAS,QAAQ,WACjB,SAAS,SACT,SAAS,UAAU,mBAAmB,UAAU,qBAAqB,SAAS,QAAQ,WACtF,SAAS,iBAAiB,QAAQ,UAAU,qBAAqB,cAAc,YAC9E,QAAQ;SAEJ,OAAO,iBAAiB,kBAAkB,gBAAgB,YAC/D,SAAS,QAAQ,WACjB,SAAS,SACT,SAAS,UAAU,mBAAmB,UAAU,qBAAqB,UACrE,sBACC,QAAQ;;;kBA4DY;;OAEX,QACV,mBACA,qBAAqB,aAAa,qBAClC,qBACE,iBAAiB,SAAS,cAAc;;OAGhC,QAAQ;aACT,OAAO;;;OAIN,eAAe,WAAW,YAAY;;OAGtC,QAAQ,aAAa,aAAa,UAAU,sBAAsB,iBAC5E,GACA,GACA;;OAIU,MAAM,gBAAgB,2BAA2B,eAAe,cAAc;;OAG9E,QAAQ,gBAAgB,2BAA2B,eAAe,YAAY;;;;;cC5H/E,oCAAoC;EACnC,YAAA"}
1
+ {"version":3,"file":"web.d.mts","names":[],"sources":["../src/web/web-effect.ts","../src/web/responses.ts"],"mappings":";;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,GACA,GACA;;OAIU,MAAM,gBAAgB,2BAA2B,eAAe,cAAc;;OAG9E,QAAQ,gBAAgB,2BAA2B,eAAe,YAAY;;OAG9E,SAAS;;OAGT,gBAAgB;;OAGhB,cACV,mBACA,qBAAqB,aAAa,uBAChC,uBAAuB,SAAS;;;;;cCniBzB,oCAAoC;EAC/C,YAAY"}
package/dist/web.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as WebEffectSerializationError, t as WebEffect } from "./web-Bq3MfMrj.mjs";
1
+ import { i as WebEffectSerializationError, t as WebEffect } from "./web-effect-B9hp9jIe.mjs";
2
2
  export { WebEffect, WebEffectSerializationError };