apps 0.0.1-beta.33 → 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-TEV5IMOM.js → chunk-5CQMUXW7.js} +2 -2
- package/js/{chunk-N72RKJ5E.js → chunk-5KNA2Z5I.js} +13 -102
- 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-5DLG2FVN.js → chunk-BI6R577B.js} +93 -2
- package/js/{chunk-4OKYLVU4.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-GMMS4BY3.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-AYM2FUI5.js → chunk-JU7F4PRK.js} +2 -2
- package/js/{chunk-E6C2DUIA.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-AKKJDDOT.js → chunk-LUROQKFP.js} +10 -10
- 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-SRB2WDU7.js +49 -0
- package/js/{chunk-MFHUR5SB.js → chunk-TADLIUEU.js} +4 -4
- package/js/{chunk-3BHBWZLD.js → chunk-UWOIEJ56.js} +20 -18
- package/js/chunk-V5DWGYRK.js +268 -0
- package/js/{chunk-75JKK3ZE.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-WWSRAE5Y.js → chunk-YW333DH3.js} +11 -8
- package/js/{chunk-2SRLJHPM.js → chunk-YYK6GEMC.js} +14 -53
- package/js/client.js +12 -11
- package/js/contracts.js +17 -16
- package/js/effect.js +23 -20
- package/js/graphql.js +27 -25
- package/js/host.js +23 -20
- package/js/index.js +18 -16
- package/js/mcp/effect.js +25 -22
- package/js/mcp/stdio.js +25 -22
- package/js/mcp.js +28 -25
- package/js/openapi.js +25 -22
- package/js/react.js +3 -3
- package/js/skills/effect.js +6 -5
- package/js/skills.js +119 -49
- 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/cache.d.ts +14 -0
- 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/skills.d.ts +16 -4
- package/types/apps/src/contracts/ui.d.ts +1 -1
- package/types/apps/src/implementation/catalog-cache.d.ts +14 -17
- 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/skills.d.ts +13 -19
- 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/apps/src/skills.d.ts +4 -3
- 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,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JsonObject,
|
|
3
3
|
ValidationError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BI45HZWM.js";
|
|
5
5
|
import {
|
|
6
6
|
Cause_exports,
|
|
7
7
|
Effect_exports,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
SchemaIssue_exports,
|
|
11
11
|
SchemaParser_exports,
|
|
12
12
|
Schema_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IJQ5LE74.js";
|
|
14
14
|
|
|
15
15
|
// ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
16
16
|
function deepCompareStrict(a, b) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appSignInCallbackPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NHCFIWN5.js";
|
|
4
4
|
import {
|
|
5
5
|
HttpServerResponse_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KOOJUMLR.js";
|
|
7
7
|
|
|
8
8
|
// src/implementation/ui-auth.ts
|
|
9
9
|
var appPrivateHeaders = {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FetchOptionUnsupported,
|
|
3
|
+
NetworkRefusedHeader,
|
|
4
|
+
RestrictedFetchOption,
|
|
5
|
+
networkRefusalHeader,
|
|
6
|
+
networkRefusalStatus,
|
|
7
|
+
supportedFetchOptions
|
|
8
|
+
} from "./chunk-BI6R577B.js";
|
|
9
|
+
import {
|
|
10
|
+
invocationFetch
|
|
11
|
+
} from "./chunk-KZFV3WCJ.js";
|
|
12
|
+
import {
|
|
13
|
+
Effect_exports,
|
|
14
|
+
Schema_exports
|
|
15
|
+
} from "./chunk-IJQ5LE74.js";
|
|
16
|
+
|
|
17
|
+
// src/implementation/network.ts
|
|
18
|
+
var refusalHeader = (status, header) => status === networkRefusalStatus && header !== null && header !== void 0 ? header : void 0;
|
|
19
|
+
var failOnNetworkRefusal = (response) => {
|
|
20
|
+
const header = refusalHeader(response.status, response.headers[networkRefusalHeader]);
|
|
21
|
+
return header === void 0 ? Effect_exports.void : Schema_exports.decodeUnknownEffect(NetworkRefusedHeader)(header).pipe(
|
|
22
|
+
Effect_exports.orDie,
|
|
23
|
+
Effect_exports.flatMap(Effect_exports.fail)
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
var unsupportedOption = (init) => {
|
|
27
|
+
for (const option of RestrictedFetchOption.literals) {
|
|
28
|
+
const value = init?.[option];
|
|
29
|
+
const supported = supportedFetchOptions[option];
|
|
30
|
+
if (value !== void 0 && !supported.includes(value))
|
|
31
|
+
return new FetchOptionUnsupported({ option, value: String(value), supported });
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
};
|
|
35
|
+
var appFetch = (fetch) => async (input, init) => {
|
|
36
|
+
const unsupported = unsupportedOption(init);
|
|
37
|
+
if (unsupported !== void 0) throw unsupported;
|
|
38
|
+
const response = await fetch(input, init);
|
|
39
|
+
const header = refusalHeader(response.status, response.headers.get(networkRefusalHeader));
|
|
40
|
+
if (header === void 0) return response;
|
|
41
|
+
await response.body?.cancel();
|
|
42
|
+
throw Schema_exports.decodeUnknownSync(NetworkRefusedHeader)(header);
|
|
43
|
+
};
|
|
44
|
+
var appInvocationFetch = (signal) => invocationFetch(signal).pipe(Effect_exports.map(appFetch));
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
failOnNetworkRefusal,
|
|
48
|
+
appInvocationFetch
|
|
49
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
fromWeb,
|
|
5
5
|
layerMergedContext,
|
|
6
6
|
make2 as make
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KOOJUMLR.js";
|
|
8
8
|
import {
|
|
9
9
|
Reference,
|
|
10
10
|
Service,
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
getOrUndefined2 as getOrUndefined,
|
|
14
14
|
map3 as map,
|
|
15
15
|
merge3 as merge,
|
|
16
|
-
|
|
16
|
+
remove2 as remove,
|
|
17
17
|
succeed4 as succeed,
|
|
18
18
|
toReadableStreamEffect,
|
|
19
19
|
tryPromise
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IJQ5LE74.js";
|
|
21
21
|
import {
|
|
22
22
|
__export
|
|
23
23
|
} from "./chunk-CZ7CSFO4.js";
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/.bun/effect@
|
|
25
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/http/FetchHttpClient.js
|
|
26
26
|
var FetchHttpClient_exports = {};
|
|
27
27
|
__export(FetchHttpClient_exports, {
|
|
28
28
|
Fetch: () => Fetch,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JU7F4PRK.js";
|
|
4
4
|
import {
|
|
5
5
|
accountSecrets,
|
|
6
|
-
appInvocationFetch,
|
|
7
6
|
boundFailureMessage,
|
|
8
7
|
describeFailure,
|
|
9
8
|
failureDetail,
|
|
@@ -11,32 +10,35 @@ import {
|
|
|
11
10
|
parseMcpError,
|
|
12
11
|
readCatalog,
|
|
13
12
|
routerSkills
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YYK6GEMC.js";
|
|
14
|
+
import {
|
|
15
|
+
appInvocationFetch
|
|
16
|
+
} from "./chunk-SRB2WDU7.js";
|
|
15
17
|
import {
|
|
16
18
|
folderSkillsEffect
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FFTALB6S.js";
|
|
18
20
|
import {
|
|
19
21
|
ResponseStatusError,
|
|
20
22
|
authorDatabase,
|
|
21
23
|
isApp,
|
|
22
24
|
toEffectApp,
|
|
23
25
|
unavailableStorage
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KBXQOJYW.js";
|
|
25
27
|
import {
|
|
26
28
|
parseDatabaseSchema
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-IU7CCCUC.js";
|
|
28
30
|
import {
|
|
29
31
|
declaredOperations,
|
|
30
32
|
fromPromise,
|
|
31
33
|
locate,
|
|
32
34
|
nativeOperation,
|
|
33
35
|
toPromise
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-VBVOPW4U.js";
|
|
35
37
|
import {
|
|
36
38
|
accountProviderError,
|
|
37
39
|
httpProviderError,
|
|
38
40
|
parseProviderError
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ENJCQWVF.js";
|
|
40
42
|
import {
|
|
41
43
|
AccountCheckResult,
|
|
42
44
|
DeclaredProvider,
|
|
@@ -83,18 +85,18 @@ import {
|
|
|
83
85
|
defaultWebhookTransportLimits,
|
|
84
86
|
maxInputProblems,
|
|
85
87
|
workflowDurationMillis
|
|
86
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-5KNA2Z5I.js";
|
|
87
89
|
import {
|
|
88
90
|
CacheError
|
|
89
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-BI6R577B.js";
|
|
90
92
|
import {
|
|
91
93
|
AppSkills,
|
|
92
94
|
SkillFile,
|
|
93
95
|
SkillLoadFailed
|
|
94
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-I7CNZ4CM.js";
|
|
95
97
|
import {
|
|
96
98
|
captureTelemetry
|
|
97
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-KZFV3WCJ.js";
|
|
98
100
|
import {
|
|
99
101
|
allowedValues,
|
|
100
102
|
decoderOf,
|
|
@@ -105,16 +107,16 @@ import {
|
|
|
105
107
|
maxAlternativeKeys,
|
|
106
108
|
objectShape,
|
|
107
109
|
unionShape
|
|
108
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-POOIHRPF.js";
|
|
109
111
|
import {
|
|
110
112
|
JsonObject,
|
|
111
113
|
JsonValue
|
|
112
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-BI45HZWM.js";
|
|
113
115
|
import {
|
|
116
|
+
Base64_exports,
|
|
114
117
|
Cause_exports,
|
|
115
118
|
Clock_exports,
|
|
116
119
|
Effect_exports,
|
|
117
|
-
Encoding_exports,
|
|
118
120
|
Match_exports,
|
|
119
121
|
Option_exports,
|
|
120
122
|
Redacted_exports,
|
|
@@ -122,7 +124,7 @@ import {
|
|
|
122
124
|
SchemaIssue_exports,
|
|
123
125
|
Schema_exports,
|
|
124
126
|
Stream_exports
|
|
125
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-IJQ5LE74.js";
|
|
126
128
|
|
|
127
129
|
// src/implementation/elicitation.ts
|
|
128
130
|
var prepareElicitation = (input) => Effect_exports.gen(function* () {
|
|
@@ -518,7 +520,7 @@ var dispatchWebhook = (definition, command, context, accounts) => Effect_exports
|
|
|
518
520
|
yield* invoke(hook.unregister, { ...input, state });
|
|
519
521
|
return null;
|
|
520
522
|
}
|
|
521
|
-
const body = yield* Effect_exports.fromResult(
|
|
523
|
+
const body = yield* Effect_exports.fromResult(Base64_exports.decode(command.request.body)).pipe(
|
|
522
524
|
Effect_exports.mapError(() => new HostInputInvalid())
|
|
523
525
|
);
|
|
524
526
|
if (body.byteLength > defaultWebhookTransportLimits.maxBodyBytes)
|
|
@@ -567,7 +569,7 @@ var dispatchWebhook = (definition, command, context, accounts) => Effect_exports
|
|
|
567
569
|
() => Schema_exports.decodeUnknownEffect(WebhookResponseData)({
|
|
568
570
|
status: response.status,
|
|
569
571
|
headers,
|
|
570
|
-
body:
|
|
572
|
+
body: Base64_exports.encode(new Uint8Array(bytes))
|
|
571
573
|
}),
|
|
572
574
|
new HostOutputInvalid()
|
|
573
575
|
);
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import {
|
|
2
|
+
String,
|
|
3
|
+
Struct,
|
|
4
|
+
TaggedClass,
|
|
5
|
+
TaggedError,
|
|
6
|
+
UndefinedOr,
|
|
7
|
+
decode2 as decode,
|
|
8
|
+
decodeTo,
|
|
9
|
+
fail,
|
|
10
|
+
fail4 as fail2,
|
|
11
|
+
flatMap2 as flatMap,
|
|
12
|
+
fromTransform,
|
|
13
|
+
hasProperty,
|
|
14
|
+
isArrayNonEmpty,
|
|
15
|
+
millis,
|
|
16
|
+
optional,
|
|
17
|
+
pipeTo,
|
|
18
|
+
succeed,
|
|
19
|
+
succeed4 as succeed2,
|
|
20
|
+
suspend,
|
|
21
|
+
sync2 as sync,
|
|
22
|
+
tag,
|
|
23
|
+
transform,
|
|
24
|
+
void_2 as void_
|
|
25
|
+
} from "./chunk-IJQ5LE74.js";
|
|
26
|
+
|
|
27
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/encoding/Sse.js
|
|
28
|
+
var SseErrorTypeId = "~effect/encoding/Sse/SseError";
|
|
29
|
+
var EventTooLarge = class extends (/* @__PURE__ */ TaggedError("EventTooLarge")) {
|
|
30
|
+
get message() {
|
|
31
|
+
return `Pending SSE event exceeded the maximum size of ${this.maxEventSize}`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var SseError = class extends (/* @__PURE__ */ TaggedError("SseError")) {
|
|
35
|
+
/**
|
|
36
|
+
* Marks this value as an SSE decoding error.
|
|
37
|
+
*
|
|
38
|
+
* @stability unstable
|
|
39
|
+
* @since 4.0.0
|
|
40
|
+
*/
|
|
41
|
+
[SseErrorTypeId] = SseErrorTypeId;
|
|
42
|
+
/**
|
|
43
|
+
* Delegates the public message to the underlying SSE error reason.
|
|
44
|
+
*
|
|
45
|
+
* @stability unstable
|
|
46
|
+
* @since 4.0.0
|
|
47
|
+
*/
|
|
48
|
+
get message() {
|
|
49
|
+
return this.reason.message;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var defaultMaxEventSize = 10 * 1024 * 1024;
|
|
53
|
+
var decode2 = (options) => fromTransform((upstream, _scope) => sync(() => {
|
|
54
|
+
let buffer = [];
|
|
55
|
+
let retry;
|
|
56
|
+
const parser = makeParser((event) => {
|
|
57
|
+
if (event._tag === "Retry") {
|
|
58
|
+
retry = event;
|
|
59
|
+
} else {
|
|
60
|
+
buffer.push(event);
|
|
61
|
+
}
|
|
62
|
+
}, options);
|
|
63
|
+
const pump = flatMap(upstream, (arr) => {
|
|
64
|
+
for (let i = 0; i < arr.length; i++) {
|
|
65
|
+
const error = parser.feed(arr[i]);
|
|
66
|
+
if (error !== void 0) {
|
|
67
|
+
return fail2(error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return void_;
|
|
71
|
+
});
|
|
72
|
+
return suspend(function loop() {
|
|
73
|
+
if (isArrayNonEmpty(buffer)) {
|
|
74
|
+
const out = buffer;
|
|
75
|
+
buffer = [];
|
|
76
|
+
return succeed2(out);
|
|
77
|
+
} else if (retry) {
|
|
78
|
+
return fail2(retry);
|
|
79
|
+
}
|
|
80
|
+
return flatMap(pump, loop);
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
83
|
+
var decodeSchema = (schema, options, parseOptions) => pipeTo(decode2(options), decode(Event.pipe(decodeTo(schema, transformEvent)), parseOptions)());
|
|
84
|
+
function makeParser(onParse, options) {
|
|
85
|
+
const maxEventSize = options?.maxEventSize ?? defaultMaxEventSize;
|
|
86
|
+
let isFirstChunk;
|
|
87
|
+
let buffer;
|
|
88
|
+
let startingPosition;
|
|
89
|
+
let startingFieldLength;
|
|
90
|
+
let discardTrailingNewline;
|
|
91
|
+
let lastEventId;
|
|
92
|
+
let eventName;
|
|
93
|
+
let data;
|
|
94
|
+
reset();
|
|
95
|
+
return {
|
|
96
|
+
feed,
|
|
97
|
+
reset
|
|
98
|
+
};
|
|
99
|
+
function reset() {
|
|
100
|
+
isFirstChunk = true;
|
|
101
|
+
buffer = "";
|
|
102
|
+
startingPosition = 0;
|
|
103
|
+
startingFieldLength = -1;
|
|
104
|
+
discardTrailingNewline = false;
|
|
105
|
+
lastEventId = void 0;
|
|
106
|
+
eventName = void 0;
|
|
107
|
+
data = "";
|
|
108
|
+
}
|
|
109
|
+
function feed(chunk) {
|
|
110
|
+
buffer = buffer ? buffer + chunk : chunk;
|
|
111
|
+
if (isFirstChunk && buffer.startsWith(BOM)) {
|
|
112
|
+
buffer = buffer.slice(BOM.length);
|
|
113
|
+
}
|
|
114
|
+
isFirstChunk = false;
|
|
115
|
+
const length = buffer.length;
|
|
116
|
+
let position = 0;
|
|
117
|
+
while (position < length) {
|
|
118
|
+
if (discardTrailingNewline) {
|
|
119
|
+
if (buffer[position] === "\n") {
|
|
120
|
+
++position;
|
|
121
|
+
}
|
|
122
|
+
discardTrailingNewline = false;
|
|
123
|
+
}
|
|
124
|
+
let lineLength = -1;
|
|
125
|
+
let fieldLength = startingFieldLength;
|
|
126
|
+
let character;
|
|
127
|
+
for (let index = position + startingPosition; lineLength < 0 && index < length; ++index) {
|
|
128
|
+
character = buffer[index];
|
|
129
|
+
if (character === ":" && fieldLength < 0) {
|
|
130
|
+
fieldLength = index - position;
|
|
131
|
+
} else if (character === "\r") {
|
|
132
|
+
discardTrailingNewline = true;
|
|
133
|
+
lineLength = index - position;
|
|
134
|
+
} else if (character === "\n") {
|
|
135
|
+
lineLength = index - position;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (lineLength < 0) {
|
|
139
|
+
startingPosition = length - position;
|
|
140
|
+
startingFieldLength = fieldLength;
|
|
141
|
+
break;
|
|
142
|
+
} else {
|
|
143
|
+
startingPosition = 0;
|
|
144
|
+
startingFieldLength = -1;
|
|
145
|
+
}
|
|
146
|
+
parseEventStreamLine(buffer, position, fieldLength, lineLength);
|
|
147
|
+
position += lineLength + 1;
|
|
148
|
+
}
|
|
149
|
+
if (position === length) {
|
|
150
|
+
buffer = "";
|
|
151
|
+
} else if (position > 0) {
|
|
152
|
+
buffer = buffer.slice(position);
|
|
153
|
+
}
|
|
154
|
+
if (buffer.length + data.length > maxEventSize) {
|
|
155
|
+
const error = new SseError({
|
|
156
|
+
reason: new EventTooLarge({
|
|
157
|
+
maxEventSize
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
reset();
|
|
161
|
+
return error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function parseEventStreamLine(lineBuffer, index, fieldLength, lineLength) {
|
|
165
|
+
if (lineLength === 0) {
|
|
166
|
+
if (data.length > 0) {
|
|
167
|
+
onParse({
|
|
168
|
+
_tag: "Event",
|
|
169
|
+
id: lastEventId,
|
|
170
|
+
event: eventName || "message",
|
|
171
|
+
data: data.slice(0, -1)
|
|
172
|
+
// remove trailing newline
|
|
173
|
+
});
|
|
174
|
+
data = "";
|
|
175
|
+
}
|
|
176
|
+
eventName = void 0;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const noValue = fieldLength < 0;
|
|
180
|
+
const field = lineBuffer.slice(index, index + (noValue ? lineLength : fieldLength));
|
|
181
|
+
let step = 0;
|
|
182
|
+
if (noValue) {
|
|
183
|
+
step = lineLength;
|
|
184
|
+
} else if (lineBuffer[index + fieldLength + 1] === " ") {
|
|
185
|
+
step = fieldLength + 2;
|
|
186
|
+
} else {
|
|
187
|
+
step = fieldLength + 1;
|
|
188
|
+
}
|
|
189
|
+
const position = index + step;
|
|
190
|
+
const valueLength = lineLength - step;
|
|
191
|
+
const value = lineBuffer.slice(position, position + valueLength).toString();
|
|
192
|
+
if (field === "data") {
|
|
193
|
+
data += value ? `${value}
|
|
194
|
+
` : "\n";
|
|
195
|
+
} else if (field === "event") {
|
|
196
|
+
eventName = value;
|
|
197
|
+
} else if (field === "id" && !value.includes("\0")) {
|
|
198
|
+
lastEventId = value;
|
|
199
|
+
} else if (field === "retry" && /^\d+$/.test(value)) {
|
|
200
|
+
const retry = parseInt(value, 10);
|
|
201
|
+
onParse(new Retry({
|
|
202
|
+
duration: millis(retry),
|
|
203
|
+
lastEventId
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
var BOM = "\uFEFF";
|
|
209
|
+
var EventEncoded = /* @__PURE__ */ Struct({
|
|
210
|
+
id: /* @__PURE__ */ optional(String),
|
|
211
|
+
event: String,
|
|
212
|
+
data: String
|
|
213
|
+
});
|
|
214
|
+
var Event = /* @__PURE__ */ Struct({
|
|
215
|
+
_tag: /* @__PURE__ */ tag("Event"),
|
|
216
|
+
id: /* @__PURE__ */ UndefinedOr(String),
|
|
217
|
+
event: String,
|
|
218
|
+
data: String
|
|
219
|
+
});
|
|
220
|
+
var transformEvent = /* @__PURE__ */ transform({
|
|
221
|
+
decode: (event) => event.id === void 0 ? {
|
|
222
|
+
event: event.event,
|
|
223
|
+
data: event.data
|
|
224
|
+
} : {
|
|
225
|
+
id: event.id,
|
|
226
|
+
event: event.event,
|
|
227
|
+
data: event.data
|
|
228
|
+
},
|
|
229
|
+
encode: (event) => ({
|
|
230
|
+
_tag: "Event",
|
|
231
|
+
id: event.id,
|
|
232
|
+
event: event.event ?? "message",
|
|
233
|
+
data: event.data
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
var RetryTypeId = "~effect/encoding/Sse/Retry";
|
|
237
|
+
var Retry = class _Retry extends (/* @__PURE__ */ TaggedClass("Retry")) {
|
|
238
|
+
/**
|
|
239
|
+
* Marks this value as an SSE retry directive for runtime guards.
|
|
240
|
+
*
|
|
241
|
+
* @stability unstable
|
|
242
|
+
* @since 4.0.0
|
|
243
|
+
*/
|
|
244
|
+
[RetryTypeId] = RetryTypeId;
|
|
245
|
+
/**
|
|
246
|
+
* Returns `true` when the value is an SSE retry directive.
|
|
247
|
+
*
|
|
248
|
+
* @stability unstable
|
|
249
|
+
* @since 4.0.0
|
|
250
|
+
*/
|
|
251
|
+
static is(u) {
|
|
252
|
+
return hasProperty(u, RetryTypeId);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Separates SSE retry directives from regular event values.
|
|
256
|
+
*
|
|
257
|
+
* @stability unstable
|
|
258
|
+
* @since 4.0.0
|
|
259
|
+
*/
|
|
260
|
+
static filter(u) {
|
|
261
|
+
return _Retry.is(u) ? succeed(u) : fail(u);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
decodeSchema,
|
|
267
|
+
EventEncoded
|
|
268
|
+
};
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
RouterKey,
|
|
4
4
|
RouterMeta,
|
|
5
5
|
reservedRouterKeys
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5KNA2Z5I.js";
|
|
7
7
|
import {
|
|
8
8
|
decoderOf,
|
|
9
9
|
schemaArgument
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-POOIHRPF.js";
|
|
11
11
|
import {
|
|
12
12
|
Effect_exports,
|
|
13
13
|
Schema_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IJQ5LE74.js";
|
|
15
15
|
|
|
16
16
|
// src/implementation/authoring.ts
|
|
17
17
|
var NativeCallback = /* @__PURE__ */ Symbol("apps.NativeCallback");
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JsonValue
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BI45HZWM.js";
|
|
4
4
|
import {
|
|
5
5
|
HttpApiEndpoint_exports,
|
|
6
6
|
HttpApiGroup_exports,
|
|
7
7
|
HttpApiSchema_exports,
|
|
8
8
|
HttpApi_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PHO7HXTC.js";
|
|
10
10
|
import {
|
|
11
11
|
Schema_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IJQ5LE74.js";
|
|
13
13
|
|
|
14
14
|
// src/contracts/ui.ts
|
|
15
15
|
var UiContext = Schema_exports.Struct({
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BI6R577B.js";
|
|
4
4
|
import {
|
|
5
5
|
wrap
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-POOIHRPF.js";
|
|
7
7
|
import {
|
|
8
8
|
JsonObject
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BI45HZWM.js";
|
|
10
10
|
import {
|
|
11
11
|
Duration_exports,
|
|
12
12
|
Effect_exports,
|
|
13
13
|
Schema_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IJQ5LE74.js";
|
|
15
15
|
|
|
16
16
|
// src/implementation/catalog-cache.ts
|
|
17
|
-
var catalogScope = (options, invalid) => {
|
|
18
|
-
const { account, cache
|
|
17
|
+
var catalogScope = (options, credential, invalid) => {
|
|
18
|
+
const { account, cache } = options;
|
|
19
19
|
if (account === void 0)
|
|
20
|
-
return
|
|
20
|
+
return credential === void 0 ? Effect_exports.succeed(cache) : Effect_exports.fail(invalid("missing-account"));
|
|
21
21
|
if (cache === void 0) return Effect_exports.succeed(void 0);
|
|
22
|
-
return Effect_exports.try({
|
|
22
|
+
return Effect_exports.try({
|
|
23
|
+
try: () => cache.forAccount(account),
|
|
24
|
+
catch: () => invalid("unselected-account")
|
|
25
|
+
});
|
|
23
26
|
};
|
|
24
27
|
var schema = (decoder) => wrap(decoder, false);
|
|
25
28
|
var Manifest = Schema_exports.Struct({
|