apps 0.0.1-beta.34 → 0.0.1-beta.35
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.
- package/framework-reference.json +1 -1
- package/js/{chunk-PUBNIORL.js → chunk-5CQMUXW7.js} +2 -2
- package/js/{chunk-DSUKW6KJ.js → chunk-5KNA2Z5I.js} +13 -11
- package/js/{chunk-UMCMZFXW.js → chunk-73AV3JVU.js} +1 -1
- package/js/{chunk-6ZJ2H6P4.js → chunk-A4O72Z3A.js} +298 -190
- package/js/{chunk-FBBXFFFJ.js → chunk-BI45HZWM.js} +2 -2
- package/js/{chunk-DXGWKNTQ.js → chunk-BI6R577B.js} +2 -2
- package/js/{chunk-IU6OK5G2.js → chunk-ENJCQWVF.js} +3 -3
- package/js/{chunk-OX233L7N.js → chunk-FFTALB6S.js} +2 -2
- package/js/{chunk-DASNNAP4.js → chunk-HDAQBRT5.js} +391 -14
- package/js/{chunk-HW3DPBZR.js → chunk-I7CNZ4CM.js} +1 -1
- package/js/{chunk-QKVZGWGZ.js → chunk-IA3VSGR4.js} +7 -7
- package/js/{chunk-EXGKN554.js → chunk-IJQ5LE74.js} +9805 -9254
- package/js/{chunk-5JVNM3CQ.js → chunk-IU7CCCUC.js} +12 -12
- package/js/{chunk-Q7Q5JTRW.js → chunk-JU7F4PRK.js} +2 -2
- package/js/{chunk-QZD2RZ4S.js → chunk-KBXQOJYW.js} +8 -8
- package/js/{chunk-CJY5X26R.js → chunk-KOOJUMLR.js} +86 -50
- package/js/{chunk-ETLILMHY.js → chunk-KZFV3WCJ.js} +21 -19
- package/js/{chunk-MYH3QZ4L.js → chunk-LUROQKFP.js} +9 -9
- package/js/{chunk-ZOY7PDMI.js → chunk-NHCFIWN5.js} +1 -1
- package/js/chunk-NHUHTWAF.js +0 -0
- package/js/{chunk-QYM4STZW.js → chunk-PHO7HXTC.js} +149 -353
- package/js/{chunk-O3OAFU7Q.js → chunk-POOIHRPF.js} +2 -2
- package/js/{chunk-AUFVX4KM.js → chunk-RSNZDT4L.js} +2 -2
- package/js/{chunk-EPUWF4ZG.js → chunk-SRB2WDU7.js} +3 -3
- package/js/{chunk-MFHUR5SB.js → chunk-TADLIUEU.js} +4 -4
- package/js/{chunk-5OM6HBNU.js → chunk-UWOIEJ56.js} +18 -18
- package/js/chunk-V5DWGYRK.js +268 -0
- package/js/{chunk-QUEPZ67T.js → chunk-VBVOPW4U.js} +3 -3
- package/js/{chunk-GZ4UHXRT.js → chunk-WDBUOIWV.js} +3 -3
- package/js/{chunk-6KG4DZD7.js → chunk-Y3XN4X4Q.js} +1 -1
- package/js/{chunk-UKMIHP2G.js → chunk-YW333DH3.js} +4 -4
- package/js/{chunk-O4QOPXQT.js → chunk-YYK6GEMC.js} +11 -11
- package/js/client.js +12 -11
- package/js/contracts.js +10 -9
- package/js/effect.js +23 -21
- package/js/graphql.js +25 -23
- package/js/host.js +23 -21
- package/js/index.js +16 -14
- package/js/mcp/effect.js +25 -23
- package/js/mcp/stdio.js +25 -23
- package/js/mcp.js +27 -25
- package/js/openapi.js +22 -21
- package/js/react.js +3 -3
- package/js/skills/effect.js +6 -5
- package/js/skills.js +18 -16
- package/js/storage/facet.js +19 -345
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +6 -5
- package/js/ui/serving.js +10 -9
- package/package.json +3 -3
- package/runtime.json +1 -1
- package/types/app-data/src/implementation/sqlite.d.ts +1 -1
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/protocols/1.d.ts +4 -4
- package/types/apps/src/contracts/protocols/2.d.ts +4 -4
- package/types/apps/src/contracts/protocols/3.d.ts +4 -4
- package/types/apps/src/contracts/protocols/4.d.ts +4 -4
- package/types/apps/src/contracts/protocols/5.d.ts +4 -4
- package/types/apps/src/contracts/protocols/6.d.ts +4 -4
- package/types/apps/src/contracts/protocols/7.d.ts +4 -4
- package/types/apps/src/contracts/protocols/8.d.ts +4 -4
- package/types/apps/src/contracts/ui.d.ts +1 -1
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/network.d.ts +1 -1
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/telemetry/src/browser-operations.d.ts +1 -1
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +1 -1
- package/types/utils/src/api-error.d.ts +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EventEncoded,
|
|
3
|
+
decodeSchema
|
|
4
|
+
} from "./chunk-V5DWGYRK.js";
|
|
1
5
|
import {
|
|
2
6
|
DecodeError,
|
|
3
7
|
HttpClient,
|
|
@@ -19,7 +23,7 @@ import {
|
|
|
19
23
|
text,
|
|
20
24
|
uint8Array,
|
|
21
25
|
urlParams
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KOOJUMLR.js";
|
|
23
27
|
import {
|
|
24
28
|
Cause,
|
|
25
29
|
Defect,
|
|
@@ -31,16 +35,14 @@ import {
|
|
|
31
35
|
Service,
|
|
32
36
|
String as String2,
|
|
33
37
|
Struct,
|
|
34
|
-
TaggedClass,
|
|
35
|
-
TaggedError,
|
|
36
38
|
Uint8Array as Uint8Array2,
|
|
37
39
|
Undefined,
|
|
38
|
-
UndefinedOr,
|
|
39
40
|
Union,
|
|
40
41
|
Unknown,
|
|
41
42
|
UnknownFromJsonString,
|
|
42
43
|
Void,
|
|
43
44
|
add,
|
|
45
|
+
all,
|
|
44
46
|
as,
|
|
45
47
|
assignProperty,
|
|
46
48
|
brand,
|
|
@@ -49,25 +51,21 @@ import {
|
|
|
49
51
|
constVoid,
|
|
50
52
|
context,
|
|
51
53
|
declare,
|
|
52
|
-
decode2 as decode,
|
|
53
|
-
decodeEffect,
|
|
54
54
|
decodeText,
|
|
55
55
|
decodeTo,
|
|
56
56
|
decodeUnknownEffect2 as decodeUnknownEffect,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
empty,
|
|
58
|
+
empty5 as empty2,
|
|
59
59
|
encodeSync,
|
|
60
60
|
encodeUnknownEffect2 as encodeUnknownEffect,
|
|
61
61
|
ensure,
|
|
62
|
-
fail,
|
|
63
|
-
fail2,
|
|
64
|
-
fail4 as fail3,
|
|
62
|
+
fail2 as fail,
|
|
63
|
+
fail4 as fail2,
|
|
65
64
|
failCause2 as failCause,
|
|
66
65
|
flatMap2 as flatMap,
|
|
67
66
|
fnUntraced,
|
|
68
67
|
fromInput3 as fromInput,
|
|
69
68
|
fromJsonString,
|
|
70
|
-
fromTransform,
|
|
71
69
|
gen,
|
|
72
70
|
getLastEncoding,
|
|
73
71
|
getOrUndefined2 as getOrUndefined,
|
|
@@ -85,41 +83,36 @@ import {
|
|
|
85
83
|
isSuspend,
|
|
86
84
|
isUnion,
|
|
87
85
|
isVoid,
|
|
88
|
-
|
|
86
|
+
make4 as make,
|
|
89
87
|
map2 as map,
|
|
90
88
|
map3 as map2,
|
|
91
89
|
map4 as map3,
|
|
92
90
|
map6 as map4,
|
|
91
|
+
mapError,
|
|
93
92
|
memoize,
|
|
94
93
|
merge,
|
|
95
|
-
millis,
|
|
96
94
|
optional,
|
|
97
95
|
pipeArguments,
|
|
98
96
|
pipeThroughChannel,
|
|
99
|
-
pipeTo,
|
|
100
97
|
provideContext2 as provideContext,
|
|
101
98
|
resolveAt,
|
|
102
|
-
succeed,
|
|
103
|
-
succeed4 as succeed2,
|
|
99
|
+
succeed4 as succeed,
|
|
104
100
|
suspend,
|
|
105
101
|
sync2 as sync,
|
|
106
|
-
tag,
|
|
107
102
|
toCodecJson,
|
|
108
103
|
toCodecStringTree,
|
|
109
104
|
toEncoded,
|
|
110
|
-
toEncoded2,
|
|
111
105
|
toString,
|
|
112
106
|
toType,
|
|
113
107
|
transform,
|
|
114
108
|
transformEffect,
|
|
115
|
-
transformPull
|
|
116
|
-
|
|
117
|
-
} from "./chunk-EXGKN554.js";
|
|
109
|
+
transformPull
|
|
110
|
+
} from "./chunk-IJQ5LE74.js";
|
|
118
111
|
import {
|
|
119
112
|
__export
|
|
120
113
|
} from "./chunk-CZ7CSFO4.js";
|
|
121
114
|
|
|
122
|
-
// ../../node_modules/.bun/effect@
|
|
115
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/HttpApiSchema.js
|
|
123
116
|
var HttpApiSchema_exports = {};
|
|
124
117
|
__export(HttpApiSchema_exports, {
|
|
125
118
|
Accepted: () => Accepted,
|
|
@@ -159,242 +152,7 @@ __export(HttpApiSchema_exports, {
|
|
|
159
152
|
status: () => status,
|
|
160
153
|
withHeaders: () => withHeaders
|
|
161
154
|
});
|
|
162
|
-
|
|
163
|
-
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/encoding/Sse.js
|
|
164
|
-
var SseErrorTypeId = "~effect/encoding/Sse/SseError";
|
|
165
|
-
var EventTooLarge = class extends (/* @__PURE__ */ TaggedError("EventTooLarge")) {
|
|
166
|
-
get message() {
|
|
167
|
-
return `Pending SSE event exceeded the maximum size of ${this.maxEventSize}`;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
var SseError = class extends (/* @__PURE__ */ TaggedError("SseError")) {
|
|
171
|
-
/**
|
|
172
|
-
* Marks this value as an SSE decoding error.
|
|
173
|
-
*
|
|
174
|
-
* @since 4.0.0
|
|
175
|
-
*/
|
|
176
|
-
[SseErrorTypeId] = SseErrorTypeId;
|
|
177
|
-
/**
|
|
178
|
-
* Delegates the public message to the underlying SSE error reason.
|
|
179
|
-
*
|
|
180
|
-
* @since 4.0.0
|
|
181
|
-
*/
|
|
182
|
-
get message() {
|
|
183
|
-
return this.reason.message;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
var defaultMaxEventSize = 10 * 1024 * 1024;
|
|
187
|
-
var decode2 = (options2) => fromTransform((upstream, _scope) => sync(() => {
|
|
188
|
-
let buffer = [];
|
|
189
|
-
let retry;
|
|
190
|
-
const parser = makeParser((event) => {
|
|
191
|
-
if (event._tag === "Retry") {
|
|
192
|
-
retry = event;
|
|
193
|
-
} else {
|
|
194
|
-
buffer.push(event);
|
|
195
|
-
}
|
|
196
|
-
}, options2);
|
|
197
|
-
const pump = flatMap(upstream, (arr) => {
|
|
198
|
-
for (let i = 0; i < arr.length; i++) {
|
|
199
|
-
const error = parser.feed(arr[i]);
|
|
200
|
-
if (error !== void 0) {
|
|
201
|
-
return fail3(error);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return void_;
|
|
205
|
-
});
|
|
206
|
-
return suspend(function loop() {
|
|
207
|
-
if (isArrayNonEmpty(buffer)) {
|
|
208
|
-
const out = buffer;
|
|
209
|
-
buffer = [];
|
|
210
|
-
return succeed2(out);
|
|
211
|
-
} else if (retry) {
|
|
212
|
-
return fail3(retry);
|
|
213
|
-
}
|
|
214
|
-
return flatMap(pump, loop);
|
|
215
|
-
});
|
|
216
|
-
}));
|
|
217
|
-
var decodeSchema = (schema, options2, parseOptions) => pipeTo(decode2(options2), decode(Event.pipe(decodeTo(schema, transformEvent)), parseOptions)());
|
|
218
|
-
function makeParser(onParse, options2) {
|
|
219
|
-
const maxEventSize = options2?.maxEventSize ?? defaultMaxEventSize;
|
|
220
|
-
let isFirstChunk;
|
|
221
|
-
let buffer;
|
|
222
|
-
let startingPosition;
|
|
223
|
-
let startingFieldLength;
|
|
224
|
-
let discardTrailingNewline;
|
|
225
|
-
let lastEventId;
|
|
226
|
-
let eventName;
|
|
227
|
-
let data;
|
|
228
|
-
reset();
|
|
229
|
-
return {
|
|
230
|
-
feed,
|
|
231
|
-
reset
|
|
232
|
-
};
|
|
233
|
-
function reset() {
|
|
234
|
-
isFirstChunk = true;
|
|
235
|
-
buffer = "";
|
|
236
|
-
startingPosition = 0;
|
|
237
|
-
startingFieldLength = -1;
|
|
238
|
-
discardTrailingNewline = false;
|
|
239
|
-
lastEventId = void 0;
|
|
240
|
-
eventName = void 0;
|
|
241
|
-
data = "";
|
|
242
|
-
}
|
|
243
|
-
function feed(chunk) {
|
|
244
|
-
buffer = buffer ? buffer + chunk : chunk;
|
|
245
|
-
if (isFirstChunk && buffer.startsWith(BOM)) {
|
|
246
|
-
buffer = buffer.slice(BOM.length);
|
|
247
|
-
}
|
|
248
|
-
isFirstChunk = false;
|
|
249
|
-
const length = buffer.length;
|
|
250
|
-
let position = 0;
|
|
251
|
-
while (position < length) {
|
|
252
|
-
if (discardTrailingNewline) {
|
|
253
|
-
if (buffer[position] === "\n") {
|
|
254
|
-
++position;
|
|
255
|
-
}
|
|
256
|
-
discardTrailingNewline = false;
|
|
257
|
-
}
|
|
258
|
-
let lineLength = -1;
|
|
259
|
-
let fieldLength = startingFieldLength;
|
|
260
|
-
let character;
|
|
261
|
-
for (let index = position + startingPosition; lineLength < 0 && index < length; ++index) {
|
|
262
|
-
character = buffer[index];
|
|
263
|
-
if (character === ":" && fieldLength < 0) {
|
|
264
|
-
fieldLength = index - position;
|
|
265
|
-
} else if (character === "\r") {
|
|
266
|
-
discardTrailingNewline = true;
|
|
267
|
-
lineLength = index - position;
|
|
268
|
-
} else if (character === "\n") {
|
|
269
|
-
lineLength = index - position;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
if (lineLength < 0) {
|
|
273
|
-
startingPosition = length - position;
|
|
274
|
-
startingFieldLength = fieldLength;
|
|
275
|
-
break;
|
|
276
|
-
} else {
|
|
277
|
-
startingPosition = 0;
|
|
278
|
-
startingFieldLength = -1;
|
|
279
|
-
}
|
|
280
|
-
parseEventStreamLine(buffer, position, fieldLength, lineLength);
|
|
281
|
-
position += lineLength + 1;
|
|
282
|
-
}
|
|
283
|
-
if (position === length) {
|
|
284
|
-
buffer = "";
|
|
285
|
-
} else if (position > 0) {
|
|
286
|
-
buffer = buffer.slice(position);
|
|
287
|
-
}
|
|
288
|
-
if (buffer.length + data.length > maxEventSize) {
|
|
289
|
-
const error = new SseError({
|
|
290
|
-
reason: new EventTooLarge({
|
|
291
|
-
maxEventSize
|
|
292
|
-
})
|
|
293
|
-
});
|
|
294
|
-
reset();
|
|
295
|
-
return error;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
function parseEventStreamLine(lineBuffer, index, fieldLength, lineLength) {
|
|
299
|
-
if (lineLength === 0) {
|
|
300
|
-
if (data.length > 0) {
|
|
301
|
-
onParse({
|
|
302
|
-
_tag: "Event",
|
|
303
|
-
id: lastEventId,
|
|
304
|
-
event: eventName || "message",
|
|
305
|
-
data: data.slice(0, -1)
|
|
306
|
-
// remove trailing newline
|
|
307
|
-
});
|
|
308
|
-
data = "";
|
|
309
|
-
}
|
|
310
|
-
eventName = void 0;
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
const noValue = fieldLength < 0;
|
|
314
|
-
const field = lineBuffer.slice(index, index + (noValue ? lineLength : fieldLength));
|
|
315
|
-
let step = 0;
|
|
316
|
-
if (noValue) {
|
|
317
|
-
step = lineLength;
|
|
318
|
-
} else if (lineBuffer[index + fieldLength + 1] === " ") {
|
|
319
|
-
step = fieldLength + 2;
|
|
320
|
-
} else {
|
|
321
|
-
step = fieldLength + 1;
|
|
322
|
-
}
|
|
323
|
-
const position = index + step;
|
|
324
|
-
const valueLength = lineLength - step;
|
|
325
|
-
const value = lineBuffer.slice(position, position + valueLength).toString();
|
|
326
|
-
if (field === "data") {
|
|
327
|
-
data += value ? `${value}
|
|
328
|
-
` : "\n";
|
|
329
|
-
} else if (field === "event") {
|
|
330
|
-
eventName = value;
|
|
331
|
-
} else if (field === "id" && !value.includes("\0")) {
|
|
332
|
-
lastEventId = value;
|
|
333
|
-
} else if (field === "retry" && /^\d+$/.test(value)) {
|
|
334
|
-
const retry = parseInt(value, 10);
|
|
335
|
-
onParse(new Retry({
|
|
336
|
-
duration: millis(retry),
|
|
337
|
-
lastEventId
|
|
338
|
-
}));
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
var BOM = "\uFEFF";
|
|
343
|
-
var EventEncoded = /* @__PURE__ */ Struct({
|
|
344
|
-
id: /* @__PURE__ */ optional(String2),
|
|
345
|
-
event: String2,
|
|
346
|
-
data: String2
|
|
347
|
-
});
|
|
348
|
-
var Event = /* @__PURE__ */ Struct({
|
|
349
|
-
_tag: /* @__PURE__ */ tag("Event"),
|
|
350
|
-
id: /* @__PURE__ */ UndefinedOr(String2),
|
|
351
|
-
event: String2,
|
|
352
|
-
data: String2
|
|
353
|
-
});
|
|
354
|
-
var transformEvent = /* @__PURE__ */ transform({
|
|
355
|
-
decode: (event) => event.id === void 0 ? {
|
|
356
|
-
event: event.event,
|
|
357
|
-
data: event.data
|
|
358
|
-
} : {
|
|
359
|
-
id: event.id,
|
|
360
|
-
event: event.event,
|
|
361
|
-
data: event.data
|
|
362
|
-
},
|
|
363
|
-
encode: (event) => ({
|
|
364
|
-
_tag: "Event",
|
|
365
|
-
id: event.id,
|
|
366
|
-
event: event.event ?? "message",
|
|
367
|
-
data: event.data
|
|
368
|
-
})
|
|
369
|
-
});
|
|
370
|
-
var RetryTypeId = "~effect/encoding/Sse/Retry";
|
|
371
|
-
var Retry = class _Retry extends (/* @__PURE__ */ TaggedClass("Retry")) {
|
|
372
|
-
/**
|
|
373
|
-
* Marks this value as an SSE retry directive for runtime guards.
|
|
374
|
-
*
|
|
375
|
-
* @since 4.0.0
|
|
376
|
-
*/
|
|
377
|
-
[RetryTypeId] = RetryTypeId;
|
|
378
|
-
/**
|
|
379
|
-
* Returns `true` when the value is an SSE retry directive.
|
|
380
|
-
*
|
|
381
|
-
* @since 4.0.0
|
|
382
|
-
*/
|
|
383
|
-
static is(u) {
|
|
384
|
-
return hasProperty(u, RetryTypeId);
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Separates SSE retry directives from regular event values.
|
|
388
|
-
*
|
|
389
|
-
* @since 4.0.0
|
|
390
|
-
*/
|
|
391
|
-
static filter(u) {
|
|
392
|
-
return _Retry.is(u) ? succeed(u) : fail(u);
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
// ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/httpapi/HttpApiSchema.js
|
|
397
|
-
var StreamSchemaTypeId = "~effect/httpapi/HttpApiSchema/Stream";
|
|
155
|
+
var StreamSchemaTypeId = "~effect/http-api/HttpApiSchema/Stream";
|
|
398
156
|
function status(code) {
|
|
399
157
|
const statusCode = typeof code === "string" ? fromLiteral(code) : code;
|
|
400
158
|
return (self) => self.annotate({
|
|
@@ -449,8 +207,8 @@ function defaultStreamContentType(mode) {
|
|
|
449
207
|
return "application/octet-stream";
|
|
450
208
|
}
|
|
451
209
|
}
|
|
452
|
-
var WithHeadersTypeId = "~effect/
|
|
453
|
-
var WithHeadersValueTypeId = "~effect/
|
|
210
|
+
var WithHeadersTypeId = "~effect/http-api/HttpApiSchema/WithHeaders";
|
|
211
|
+
var WithHeadersValueTypeId = "~effect/http-api/HttpApiSchema/WithHeadersValue";
|
|
454
212
|
var isWithHeadersValue = (u) => hasProperty(u, WithHeadersValueTypeId);
|
|
455
213
|
var withHeadersValueSchema = /* @__PURE__ */ declare(isWithHeadersValue);
|
|
456
214
|
function WithHeaders(schema, headers) {
|
|
@@ -489,14 +247,16 @@ function encodeToWithHeaders(options2, transformation) {
|
|
|
489
247
|
"~httpApiWithHeaders": {
|
|
490
248
|
body,
|
|
491
249
|
headers,
|
|
492
|
-
|
|
250
|
+
bodyCodec: body,
|
|
251
|
+
headersCodec: headers,
|
|
252
|
+
transformation
|
|
493
253
|
},
|
|
494
254
|
httpApiStatus: status2,
|
|
495
255
|
"~httpApiEncoding": encoding
|
|
496
256
|
});
|
|
497
257
|
};
|
|
498
258
|
}
|
|
499
|
-
var MultipartTypeId = "~effect/
|
|
259
|
+
var MultipartTypeId = "~effect/http-api/HttpApiSchema/Multipart";
|
|
500
260
|
function asMultipart(options2) {
|
|
501
261
|
return (self) => self.pipe(brand(MultipartTypeId)).annotate({
|
|
502
262
|
"~httpApiEncoding": {
|
|
@@ -507,7 +267,7 @@ function asMultipart(options2) {
|
|
|
507
267
|
}
|
|
508
268
|
});
|
|
509
269
|
}
|
|
510
|
-
var MultipartStreamTypeId = "~effect/
|
|
270
|
+
var MultipartStreamTypeId = "~effect/http-api/HttpApiSchema/MultipartStream";
|
|
511
271
|
function asMultipartStream(options2) {
|
|
512
272
|
return (self) => self.pipe(brand(MultipartStreamTypeId)).annotate({
|
|
513
273
|
"~httpApiEncoding": {
|
|
@@ -623,7 +383,7 @@ function getStatusErrorSchema(schema) {
|
|
|
623
383
|
return getStatusError(schema.ast);
|
|
624
384
|
}
|
|
625
385
|
|
|
626
|
-
// ../../node_modules/.bun/effect@
|
|
386
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/HttpApiEndpoint.js
|
|
627
387
|
var HttpApiEndpoint_exports = {};
|
|
628
388
|
__export(HttpApiEndpoint_exports, {
|
|
629
389
|
delete: () => del,
|
|
@@ -641,15 +401,15 @@ __export(HttpApiEndpoint_exports, {
|
|
|
641
401
|
query: () => query
|
|
642
402
|
});
|
|
643
403
|
|
|
644
|
-
// ../../node_modules/.bun/effect@
|
|
404
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/internal/mediaType.js
|
|
645
405
|
function normalize(contentType) {
|
|
646
406
|
const normalized = contentType.toLowerCase().trim();
|
|
647
407
|
const index = normalized.indexOf(";");
|
|
648
408
|
return index === -1 ? normalized : normalized.slice(0, index).trim();
|
|
649
409
|
}
|
|
650
410
|
|
|
651
|
-
// ../../node_modules/.bun/effect@
|
|
652
|
-
var TypeId = "~effect/
|
|
411
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/HttpApiEndpoint.js
|
|
412
|
+
var TypeId = "~effect/http-api/HttpApiEndpoint";
|
|
653
413
|
var isHttpApiEndpoint = (u) => hasProperty(u, TypeId);
|
|
654
414
|
function getPayloadSchemas(endpoint2) {
|
|
655
415
|
const result = [];
|
|
@@ -774,7 +534,7 @@ function getPayload(payload, method, disableCodecs) {
|
|
|
774
534
|
}
|
|
775
535
|
return result;
|
|
776
536
|
}
|
|
777
|
-
var reservedStreamFailureEvent = "effect/
|
|
537
|
+
var reservedStreamFailureEvent = "effect/http-api/stream/failure";
|
|
778
538
|
function getSuccessResponse(success, method, disableCodecs) {
|
|
779
539
|
if (success === void 0) return /* @__PURE__ */ new Set();
|
|
780
540
|
const schemas = ensure(success);
|
|
@@ -931,14 +691,11 @@ function transformResponse(schema) {
|
|
|
931
691
|
if (withHeaders2 === void 0) {
|
|
932
692
|
return applyResponseEncoding(schema, encoding);
|
|
933
693
|
}
|
|
934
|
-
|
|
935
|
-
return Struct({
|
|
936
|
-
body: applyResponseEncoding(toEncoded2(withHeaders2.body), encoding),
|
|
937
|
-
headers
|
|
938
|
-
}).pipe(decodeTo(schema)).annotate({
|
|
694
|
+
return schema.annotate({
|
|
939
695
|
"~httpApiWithHeaders": {
|
|
940
696
|
...withHeaders2,
|
|
941
|
-
|
|
697
|
+
bodyCodec: applyResponseEncoding(withHeaders2.body, encoding),
|
|
698
|
+
headersCodec: toCodecStringTree(withHeaders2.headers)
|
|
942
699
|
}
|
|
943
700
|
});
|
|
944
701
|
}
|
|
@@ -975,16 +732,23 @@ var del = /* @__PURE__ */ make3("DELETE");
|
|
|
975
732
|
var head = /* @__PURE__ */ make3("HEAD");
|
|
976
733
|
var options = /* @__PURE__ */ make3("OPTIONS");
|
|
977
734
|
|
|
978
|
-
// ../../node_modules/.bun/effect@
|
|
735
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/HttpApi.js
|
|
979
736
|
var HttpApi_exports = {};
|
|
980
737
|
__export(HttpApi_exports, {
|
|
981
738
|
AdditionalSchemas: () => AdditionalSchemas,
|
|
739
|
+
ErrorParseOptions: () => ErrorParseOptions,
|
|
740
|
+
HeadersParseOptions: () => HeadersParseOptions,
|
|
741
|
+
ParamsParseOptions: () => ParamsParseOptions,
|
|
982
742
|
ParseOptions: () => ParseOptions,
|
|
743
|
+
PayloadParseOptions: () => PayloadParseOptions,
|
|
744
|
+
QueryParseOptions: () => QueryParseOptions,
|
|
745
|
+
SuccessParseOptions: () => SuccessParseOptions,
|
|
746
|
+
getSlotParseOptions: () => getSlotParseOptions,
|
|
983
747
|
isHttpApi: () => isHttpApi,
|
|
984
748
|
make: () => make4,
|
|
985
749
|
reflect: () => reflect
|
|
986
750
|
});
|
|
987
|
-
var TypeId2 = "~effect/
|
|
751
|
+
var TypeId2 = "~effect/http-api/HttpApi";
|
|
988
752
|
var isHttpApi = (u) => hasProperty(u, TypeId2);
|
|
989
753
|
var Proto2 = {
|
|
990
754
|
[TypeId2]: TypeId2,
|
|
@@ -1022,10 +786,10 @@ var Proto2 = {
|
|
|
1022
786
|
groups: map(this.groups, (group2) => group2.prefix(prefix))
|
|
1023
787
|
});
|
|
1024
788
|
},
|
|
1025
|
-
middleware(
|
|
789
|
+
middleware(tag) {
|
|
1026
790
|
return makeProto2({
|
|
1027
791
|
...optionsFromApi(this),
|
|
1028
|
-
groups: map(this.groups, (group2) => group2.middleware(
|
|
792
|
+
groups: map(this.groups, (group2) => group2.middleware(tag))
|
|
1029
793
|
});
|
|
1030
794
|
},
|
|
1031
795
|
annotate(key, value) {
|
|
@@ -1083,33 +847,56 @@ var reflect = (self, options2) => {
|
|
|
1083
847
|
}
|
|
1084
848
|
};
|
|
1085
849
|
var extractResponseContent = (schemas, getStatus) => {
|
|
1086
|
-
const
|
|
850
|
+
const map5 = /* @__PURE__ */ new Map();
|
|
1087
851
|
schemas.forEach(add2);
|
|
1088
|
-
return
|
|
852
|
+
return map5;
|
|
1089
853
|
function add2(schema) {
|
|
1090
854
|
const body = isWithHeaders(schema) ? schema.schema : schema;
|
|
1091
855
|
if (isStreamSchema(body)) return;
|
|
1092
856
|
const status2 = getStatus(schema);
|
|
1093
|
-
const schemas2 =
|
|
857
|
+
const schemas2 = map5.get(status2);
|
|
1094
858
|
if (schemas2 === void 0) {
|
|
1095
|
-
|
|
859
|
+
map5.set(status2, [schema]);
|
|
1096
860
|
} else {
|
|
1097
861
|
schemas2.push(schema);
|
|
1098
862
|
}
|
|
1099
863
|
}
|
|
1100
864
|
};
|
|
1101
|
-
var AdditionalSchemas = class extends (/* @__PURE__ */ Service()("effect/
|
|
865
|
+
var AdditionalSchemas = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/AdditionalSchemas")) {
|
|
1102
866
|
};
|
|
1103
|
-
var ParseOptions = class extends (/* @__PURE__ */ Service()("effect/
|
|
867
|
+
var ParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/ParseOptions")) {
|
|
868
|
+
};
|
|
869
|
+
var ParamsParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/ParamsParseOptions")) {
|
|
870
|
+
};
|
|
871
|
+
var QueryParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/QueryParseOptions")) {
|
|
872
|
+
};
|
|
873
|
+
var HeadersParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/HeadersParseOptions")) {
|
|
874
|
+
};
|
|
875
|
+
var PayloadParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/PayloadParseOptions")) {
|
|
876
|
+
};
|
|
877
|
+
var SuccessParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/SuccessParseOptions")) {
|
|
878
|
+
};
|
|
879
|
+
var ErrorParseOptions = class extends (/* @__PURE__ */ Service()("effect/http-api/HttpApi/ErrorParseOptions")) {
|
|
880
|
+
};
|
|
881
|
+
var getSlotParseOptions = (annotations) => {
|
|
882
|
+
const fallback = getOrUndefined(annotations, ParseOptions);
|
|
883
|
+
return {
|
|
884
|
+
params: getOrUndefined(annotations, ParamsParseOptions) ?? fallback,
|
|
885
|
+
query: getOrUndefined(annotations, QueryParseOptions) ?? fallback,
|
|
886
|
+
headers: getOrUndefined(annotations, HeadersParseOptions) ?? fallback,
|
|
887
|
+
payload: getOrUndefined(annotations, PayloadParseOptions) ?? fallback,
|
|
888
|
+
success: getOrUndefined(annotations, SuccessParseOptions) ?? fallback,
|
|
889
|
+
error: getOrUndefined(annotations, ErrorParseOptions) ?? fallback
|
|
890
|
+
};
|
|
1104
891
|
};
|
|
1105
892
|
|
|
1106
|
-
// ../../node_modules/.bun/effect@
|
|
893
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/HttpApiGroup.js
|
|
1107
894
|
var HttpApiGroup_exports = {};
|
|
1108
895
|
__export(HttpApiGroup_exports, {
|
|
1109
896
|
isHttpApiGroup: () => isHttpApiGroup,
|
|
1110
897
|
make: () => make5
|
|
1111
898
|
});
|
|
1112
|
-
var TypeId3 = "~effect/
|
|
899
|
+
var TypeId3 = "~effect/http-api/HttpApiGroup";
|
|
1113
900
|
var isHttpApiGroup = (u) => hasProperty(u, TypeId3);
|
|
1114
901
|
var Proto3 = {
|
|
1115
902
|
[TypeId3]: TypeId3,
|
|
@@ -1175,7 +962,7 @@ var makeProto3 = (options2) => {
|
|
|
1175
962
|
function HttpApiGroup() {
|
|
1176
963
|
}
|
|
1177
964
|
Object.setPrototypeOf(HttpApiGroup, Proto3);
|
|
1178
|
-
HttpApiGroup.key = `effect/
|
|
965
|
+
HttpApiGroup.key = `effect/http-api/HttpApiGroup/${options2.identifier}`;
|
|
1179
966
|
return Object.assign(HttpApiGroup, options2);
|
|
1180
967
|
};
|
|
1181
968
|
var make5 = (identifier, options2) => makeProto3({
|
|
@@ -1185,7 +972,7 @@ var make5 = (identifier, options2) => makeProto3({
|
|
|
1185
972
|
annotations: empty()
|
|
1186
973
|
});
|
|
1187
974
|
|
|
1188
|
-
// ../../node_modules/.bun/effect@
|
|
975
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/internal/path.js
|
|
1189
976
|
var emptyParamNames = /* @__PURE__ */ new Set();
|
|
1190
977
|
function getParamNames(schema) {
|
|
1191
978
|
if (schema === void 0) return emptyParamNames;
|
|
@@ -1193,7 +980,7 @@ function getParamNames(schema) {
|
|
|
1193
980
|
return isObjects(ast) && ast.indexSignatures.length === 0 ? new Set(ast.propertySignatures.map((ps) => String(ps.name))) : void 0;
|
|
1194
981
|
}
|
|
1195
982
|
|
|
1196
|
-
// ../../node_modules/.bun/effect@
|
|
983
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http-api/HttpApiClient.js
|
|
1197
984
|
var HttpApiClient_exports = {};
|
|
1198
985
|
__export(HttpApiClient_exports, {
|
|
1199
986
|
endpoint: () => endpoint,
|
|
@@ -1236,7 +1023,7 @@ var makeClient = (api, options2) => gen(function* () {
|
|
|
1236
1023
|
successes,
|
|
1237
1024
|
mergedAnnotations
|
|
1238
1025
|
} = onEndpointOptions;
|
|
1239
|
-
const parseOptions =
|
|
1026
|
+
const parseOptions = getSlotParseOptions(mergedAnnotations);
|
|
1240
1027
|
const makeUrl = compilePath(endpoint2.path, endpoint2.params);
|
|
1241
1028
|
const decodeMap = {
|
|
1242
1029
|
orElse: statusOrElse
|
|
@@ -1245,39 +1032,38 @@ var makeClient = (api, options2) => gen(function* () {
|
|
|
1245
1032
|
for (const [status2, schemas] of errors.entries()) {
|
|
1246
1033
|
const grouped = groupSchemasByContentType(schemas);
|
|
1247
1034
|
for (const [contentType, schemas2] of grouped.entries()) {
|
|
1248
|
-
addResponseAlternative(errorAlternatives, status2, contentType, schemasToResponse(schemas2, parseOptions));
|
|
1035
|
+
addResponseAlternative(errorAlternatives, status2, contentType, schemasToResponse(schemas2, parseOptions.error, parseOptions.headers));
|
|
1249
1036
|
}
|
|
1250
1037
|
}
|
|
1251
1038
|
for (const [status2, alternatives] of errorAlternatives.entries()) {
|
|
1252
|
-
const
|
|
1253
|
-
decodeMap[status2] = (response) => flatMap(catchCause(
|
|
1039
|
+
const decode = makeResponseDecoder(alternatives);
|
|
1040
|
+
decodeMap[status2] = (response) => flatMap(catchCause(decode(response), (cause) => failCause(combine(fail(new HttpClientError({
|
|
1254
1041
|
reason: new StatusCodeError({
|
|
1255
1042
|
request: response.request,
|
|
1256
1043
|
response
|
|
1257
1044
|
})
|
|
1258
|
-
})), cause))),
|
|
1045
|
+
})), cause))), fail2);
|
|
1259
1046
|
}
|
|
1260
1047
|
const successAlternatives = /* @__PURE__ */ new Map();
|
|
1261
1048
|
for (const [status2, schemas] of successes.entries()) {
|
|
1262
1049
|
const grouped = groupSchemasByContentType(schemas);
|
|
1263
1050
|
for (const [contentType, schemas2] of grouped.entries()) {
|
|
1264
|
-
addResponseAlternative(successAlternatives, status2, contentType, schemasToResponse(schemas2, parseOptions));
|
|
1051
|
+
addResponseAlternative(successAlternatives, status2, contentType, schemasToResponse(schemas2, parseOptions.success, parseOptions.headers));
|
|
1265
1052
|
}
|
|
1266
1053
|
}
|
|
1267
1054
|
for (const streamSuccess of getStreamSuccessSchemas(endpoint2)) {
|
|
1268
1055
|
const streamSchema2 = isWithHeadersStreamSuccess(streamSuccess) ? streamSuccess.schema : streamSuccess;
|
|
1269
|
-
addResponseAlternative(successAlternatives, getStatusSuccessSchema(streamSuccess), streamSchema2.contentType, streamToResponse(streamSuccess, parseOptions));
|
|
1056
|
+
addResponseAlternative(successAlternatives, getStatusSuccessSchema(streamSuccess), streamSchema2.contentType, streamToResponse(streamSuccess, parseOptions.success, parseOptions.headers));
|
|
1270
1057
|
}
|
|
1271
1058
|
for (const [status2, alternatives] of successAlternatives.entries()) {
|
|
1272
1059
|
decodeMap[status2] = makeResponseDecoder(alternatives);
|
|
1273
1060
|
}
|
|
1274
|
-
const
|
|
1275
|
-
const encodeParams = map4(endpoint2.params, encodeUnknownEffect2);
|
|
1061
|
+
const encodeParams = map4(endpoint2.params, (schema) => encodeUnknownEffect(schema, parseOptions.params));
|
|
1276
1062
|
const payloadSchemas = getPayloadSchemas(endpoint2);
|
|
1277
|
-
const encodePayload = isArrayNonEmpty(payloadSchemas) ? hasBody(endpoint2.method) ?
|
|
1278
|
-
const encodeHeaders = map4(endpoint2.headers,
|
|
1279
|
-
const encodeQuery = map4(endpoint2.query,
|
|
1280
|
-
const middlewareKeys = Array.from(onEndpointOptions.middleware, (
|
|
1063
|
+
const encodePayload = isArrayNonEmpty(payloadSchemas) ? encodeUnknownEffect(hasBody(endpoint2.method) ? getEncodePayloadSchema(payloadSchemas, endpoint2.method) : Union(payloadSchemas), parseOptions.payload) : void 0;
|
|
1064
|
+
const encodeHeaders = map4(endpoint2.headers, (schema) => encodeUnknownEffect(schema, parseOptions.headers));
|
|
1065
|
+
const encodeQuery = map4(endpoint2.query, (schema) => encodeUnknownEffect(schema, parseOptions.query));
|
|
1066
|
+
const middlewareKeys = Array.from(onEndpointOptions.middleware, (tag) => `${tag.key}/Client`);
|
|
1281
1067
|
const endpointFn = fnUntraced(function* (request) {
|
|
1282
1068
|
let httpRequest = make2(endpoint2.method)(endpoint2.path);
|
|
1283
1069
|
if (request !== void 0) {
|
|
@@ -1390,10 +1176,10 @@ var urlBuilder = (api, options2) => {
|
|
|
1390
1176
|
endpoint: endpoint2,
|
|
1391
1177
|
mergedAnnotations
|
|
1392
1178
|
}) {
|
|
1393
|
-
const parseOptions =
|
|
1179
|
+
const parseOptions = getSlotParseOptions(mergedAnnotations);
|
|
1394
1180
|
const makeUrl = compilePath(endpoint2.path, endpoint2.params);
|
|
1395
|
-
const encodeParams = endpoint2.params === void 0 ? void 0 : encodeSync(endpoint2.params, parseOptions);
|
|
1396
|
-
const encodeQuery = endpoint2.query === void 0 ? void 0 : encodeSync(endpoint2.query, parseOptions);
|
|
1181
|
+
const encodeParams = endpoint2.params === void 0 ? void 0 : encodeSync(endpoint2.params, parseOptions.params);
|
|
1182
|
+
const encodeQuery = endpoint2.query === void 0 ? void 0 : encodeSync(endpoint2.query, parseOptions.query);
|
|
1397
1183
|
const endpointBuilder = (request) => {
|
|
1398
1184
|
const params = request?.params;
|
|
1399
1185
|
const path = params === void 0 ? endpoint2.path : makeUrl(encodeParams === void 0 ? params : encodeParams(params));
|
|
@@ -1438,48 +1224,58 @@ var compilePath = (path, schema) => {
|
|
|
1438
1224
|
});
|
|
1439
1225
|
};
|
|
1440
1226
|
};
|
|
1441
|
-
function schemasToResponse(schemas, options2) {
|
|
1227
|
+
function schemasToResponse(schemas, options2, headersOptions) {
|
|
1442
1228
|
const hasWithHeaders = schemas.some((schema) => isWithHeaders(schema) || getWithHeadersAnnotation(schema.ast) !== void 0);
|
|
1443
|
-
const codec = hasWithHeaders ? Union(schemas.map(toCodecArrayBufferWithHeaders)) : toCodecArrayBuffer(schemas);
|
|
1444
|
-
const
|
|
1445
|
-
return (response) => flatMap(response.arrayBuffer, hasWithHeaders ? (body) =>
|
|
1229
|
+
const codec = hasWithHeaders ? Union(schemas.map((schema) => toCodecArrayBufferWithHeaders(schema, options2, headersOptions))) : toCodecArrayBuffer(schemas);
|
|
1230
|
+
const decode = decodeUnknownEffect(codec, options2);
|
|
1231
|
+
return (response) => flatMap(response.arrayBuffer, hasWithHeaders ? (body) => decode({
|
|
1446
1232
|
body,
|
|
1447
1233
|
headers: response.headers
|
|
1448
|
-
}) :
|
|
1234
|
+
}) : decode);
|
|
1449
1235
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1236
|
+
var ResponsePair = /* @__PURE__ */ Struct({
|
|
1237
|
+
body: Unknown,
|
|
1238
|
+
headers: Unknown
|
|
1239
|
+
});
|
|
1240
|
+
function toCodecArrayBufferWithHeaders(schema, options2, headersOptions) {
|
|
1452
1241
|
const annotation = getWithHeadersAnnotation(schema.ast);
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1242
|
+
const parts = annotation !== void 0 ? {
|
|
1243
|
+
body: annotation.bodyCodec,
|
|
1244
|
+
headers: annotation.headersCodec,
|
|
1245
|
+
toValue: annotation.transformation.decode
|
|
1246
|
+
} : isWithHeaders(schema) ? {
|
|
1247
|
+
body: schema.schema,
|
|
1248
|
+
headers: schema.headers,
|
|
1249
|
+
toValue: withHeaders
|
|
1250
|
+
} : {
|
|
1251
|
+
body: schema,
|
|
1252
|
+
headers: Unknown,
|
|
1253
|
+
toValue: (pair) => pair.body
|
|
1254
|
+
};
|
|
1255
|
+
const decodeBody = decodeUnknownEffect(fromArrayBuffer(parts.body).pipe(decodeTo(parts.body)), options2);
|
|
1256
|
+
const decodeHeaders = decodeUnknownEffect(parts.headers, headersOptions);
|
|
1257
|
+
return ResponsePair.pipe(decodeTo(isWithHeaders(schema) ? schema : toType(schema), transformEffect({
|
|
1258
|
+
decode: (pair) => all({
|
|
1259
|
+
body: decodeBody(pair.body),
|
|
1260
|
+
headers: decodeHeaders(pair.headers)
|
|
1261
|
+
}).pipe(map2(parts.toValue), mapError((error) => error.issue)),
|
|
1262
|
+
encode: (input, options3) => fail2(new Forbidden({
|
|
1263
|
+
message: "Decode only schema"
|
|
1264
|
+
}, input, options3))
|
|
1469
1265
|
})));
|
|
1470
1266
|
}
|
|
1471
|
-
function addResponseAlternative(
|
|
1267
|
+
function addResponseAlternative(map5, status2, contentType, decode) {
|
|
1472
1268
|
const normalizedContentType = normalize(contentType);
|
|
1473
|
-
const alternatives =
|
|
1269
|
+
const alternatives = map5.get(status2);
|
|
1474
1270
|
if (alternatives === void 0) {
|
|
1475
|
-
|
|
1271
|
+
map5.set(status2, [{
|
|
1476
1272
|
contentType: normalizedContentType,
|
|
1477
|
-
decode
|
|
1273
|
+
decode
|
|
1478
1274
|
}]);
|
|
1479
1275
|
} else {
|
|
1480
1276
|
alternatives.push({
|
|
1481
1277
|
contentType: normalizedContentType,
|
|
1482
|
-
decode
|
|
1278
|
+
decode
|
|
1483
1279
|
});
|
|
1484
1280
|
}
|
|
1485
1281
|
}
|
|
@@ -1510,7 +1306,7 @@ function groupSchemasByContentType(schemas) {
|
|
|
1510
1306
|
}
|
|
1511
1307
|
function failUnsupportedContentType(response, contentType, alternatives) {
|
|
1512
1308
|
const expected = Array.from(new Set(alternatives.map((alternative) => alternative.contentType))).join(", ");
|
|
1513
|
-
return
|
|
1309
|
+
return fail2(new HttpClientError({
|
|
1514
1310
|
reason: new DecodeError({
|
|
1515
1311
|
request: response.request,
|
|
1516
1312
|
response,
|
|
@@ -1518,7 +1314,7 @@ function failUnsupportedContentType(response, contentType, alternatives) {
|
|
|
1518
1314
|
})
|
|
1519
1315
|
}));
|
|
1520
1316
|
}
|
|
1521
|
-
var reservedStreamFailureEvent2 = "effect/
|
|
1317
|
+
var reservedStreamFailureEvent2 = "effect/http-api/stream/failure";
|
|
1522
1318
|
var isWithHeadersStreamSuccess = (schema) => isWithHeaders(schema);
|
|
1523
1319
|
function getStreamSuccessSchemas(endpoint2) {
|
|
1524
1320
|
const schemas = [];
|
|
@@ -1530,7 +1326,7 @@ function getStreamSuccessSchemas(endpoint2) {
|
|
|
1530
1326
|
}
|
|
1531
1327
|
return schemas;
|
|
1532
1328
|
}
|
|
1533
|
-
function streamToResponse(successSchema, options2) {
|
|
1329
|
+
function streamToResponse(successSchema, options2, headersOptions) {
|
|
1534
1330
|
const isWithHeaders2 = isWithHeadersStreamSuccess(successSchema);
|
|
1535
1331
|
const streamSchema2 = isWithHeaders2 ? successSchema.schema : successSchema;
|
|
1536
1332
|
const sse = isStreamUint8Array(streamSchema2) ? void 0 : {
|
|
@@ -1539,20 +1335,20 @@ function streamToResponse(successSchema, options2) {
|
|
|
1539
1335
|
};
|
|
1540
1336
|
const toStream = (response, sseOptions) => map2(context(), (context2) => provideContext(sse === void 0 ? response.stream : decodeSseStream(response.stream, sse.declaration, sse.decoder(sseOptions)), context2));
|
|
1541
1337
|
if (!isWithHeaders2) return toStream;
|
|
1542
|
-
const decodeHeaders = decodeUnknownEffect(successSchema.headers,
|
|
1338
|
+
const decodeHeaders = decodeUnknownEffect(successSchema.headers, headersOptions);
|
|
1543
1339
|
return (response, sseOptions) => flatMap(decodeHeaders(response.headers), (headers) => map2(toStream(response, sseOptions), (body) => withHeaders({
|
|
1544
1340
|
body,
|
|
1545
1341
|
headers
|
|
1546
1342
|
})));
|
|
1547
1343
|
}
|
|
1548
1344
|
function makeSseDecoder(declaration, parseOptions) {
|
|
1549
|
-
const
|
|
1345
|
+
const Event = Union([Struct({
|
|
1550
1346
|
id: optional(String2),
|
|
1551
1347
|
event: Literal(reservedStreamFailureEvent2),
|
|
1552
1348
|
data: fromJsonString(toCodecJson(Cause(declaration.error, Defect())))
|
|
1553
1349
|
}), declaration.events]);
|
|
1554
|
-
const defaultDecoder = decodeSchema(
|
|
1555
|
-
return (options2) => options2 === void 0 ? defaultDecoder : decodeSchema(
|
|
1350
|
+
const defaultDecoder = decodeSchema(Event, void 0, parseOptions);
|
|
1351
|
+
return (options2) => options2 === void 0 ? defaultDecoder : decodeSchema(Event, options2, parseOptions);
|
|
1556
1352
|
}
|
|
1557
1353
|
function decodeSseStream(stream, declaration, decoder) {
|
|
1558
1354
|
const events = transformPull(stream.pipe(decodeText, pipeThroughChannel(decoder)), (pull) => sync(() => {
|
|
@@ -1573,7 +1369,7 @@ function decodeSseStream(stream, declaration, decoder) {
|
|
|
1573
1369
|
break;
|
|
1574
1370
|
}
|
|
1575
1371
|
}
|
|
1576
|
-
return
|
|
1372
|
+
return succeed(events2);
|
|
1577
1373
|
});
|
|
1578
1374
|
});
|
|
1579
1375
|
}));
|
|
@@ -1637,7 +1433,7 @@ function fromArrayBuffer(schema) {
|
|
|
1637
1433
|
return StringFromArrayBuffer;
|
|
1638
1434
|
}
|
|
1639
1435
|
}
|
|
1640
|
-
var statusOrElse = (response) =>
|
|
1436
|
+
var statusOrElse = (response) => fail2(new HttpClientError({
|
|
1641
1437
|
reason: new DecodeError({
|
|
1642
1438
|
request: response.request,
|
|
1643
1439
|
response
|
|
@@ -1657,49 +1453,49 @@ function getEncodePayloadSchemaFromBody(schema, method) {
|
|
|
1657
1453
|
const encoding = getPayloadEncoding(ast, method);
|
|
1658
1454
|
const out = $HttpBody.pipe(decodeTo(schema, transformEffect({
|
|
1659
1455
|
decode(input, options2) {
|
|
1660
|
-
return
|
|
1456
|
+
return fail2(new Forbidden({
|
|
1661
1457
|
message: "Encode only schema"
|
|
1662
1458
|
}, input, options2));
|
|
1663
1459
|
},
|
|
1664
1460
|
encode(t, options2) {
|
|
1665
1461
|
switch (encoding._tag) {
|
|
1666
1462
|
case "Multipart":
|
|
1667
|
-
return
|
|
1463
|
+
return fail2(new Forbidden({
|
|
1668
1464
|
message: "Payload must be a FormData"
|
|
1669
1465
|
}, t, options2));
|
|
1670
1466
|
case "Json": {
|
|
1671
1467
|
try {
|
|
1672
1468
|
const body = JSON.stringify(t);
|
|
1673
|
-
return
|
|
1469
|
+
return succeed(text(body, encoding.contentType));
|
|
1674
1470
|
} catch {
|
|
1675
|
-
return
|
|
1471
|
+
return fail2(new InvalidValue({
|
|
1676
1472
|
expected: "a JSON-serializable request body"
|
|
1677
1473
|
}, t, options2));
|
|
1678
1474
|
}
|
|
1679
1475
|
}
|
|
1680
1476
|
case "Text": {
|
|
1681
1477
|
if (typeof t !== "string") {
|
|
1682
|
-
return
|
|
1478
|
+
return fail2(new InvalidValue({
|
|
1683
1479
|
message: "Expected a string"
|
|
1684
1480
|
}, t, options2));
|
|
1685
1481
|
}
|
|
1686
|
-
return
|
|
1482
|
+
return succeed(text(t, encoding.contentType));
|
|
1687
1483
|
}
|
|
1688
1484
|
case "FormUrlEncoded": {
|
|
1689
1485
|
if (!isObject(t)) {
|
|
1690
|
-
return
|
|
1486
|
+
return fail2(new InvalidValue({
|
|
1691
1487
|
message: "Expected a record"
|
|
1692
1488
|
}, t, options2));
|
|
1693
1489
|
}
|
|
1694
|
-
return
|
|
1490
|
+
return succeed(urlParams(fromInput(t), encoding.contentType));
|
|
1695
1491
|
}
|
|
1696
1492
|
case "Uint8Array": {
|
|
1697
1493
|
if (!(t instanceof Uint8Array)) {
|
|
1698
|
-
return
|
|
1494
|
+
return fail2(new InvalidValue({
|
|
1699
1495
|
message: "Expected a Uint8Array"
|
|
1700
1496
|
}, t, options2));
|
|
1701
1497
|
}
|
|
1702
|
-
return
|
|
1498
|
+
return succeed(uint8Array(t, encoding.contentType));
|
|
1703
1499
|
}
|
|
1704
1500
|
}
|
|
1705
1501
|
}
|