apps 0.0.1-beta.44 → 0.0.1-beta.46
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-646JVUH4.js → chunk-3B2JAOSE.js} +23 -12
- package/js/{chunk-5SHUB37R.js → chunk-3UGDI2UI.js} +3 -3
- package/js/{chunk-7EBODVQJ.js → chunk-6QXPBJ5T.js} +14 -13
- package/js/{chunk-MGGMEGB2.js → chunk-7LGRK7TP.js} +2 -2
- package/js/{chunk-DZQYE626.js → chunk-7UUHJR2Q.js} +1 -1
- package/js/{chunk-4ZTVLEN6.js → chunk-CDXQDN7W.js} +1 -1
- package/js/{chunk-ELO5PRCO.js → chunk-CVAJ4F6O.js} +14 -1
- package/js/{chunk-CZGWW4NQ.js → chunk-JM7LOD2W.js} +187 -9
- package/js/{chunk-EJUK2NK5.js → chunk-KLYSEHUD.js} +1 -1
- package/js/{chunk-OTGUPKKK.js → chunk-LHCGND3R.js} +12 -46
- package/js/{chunk-EMHFXFTJ.js → chunk-LTDHQJ2Z.js} +53 -0
- package/js/{chunk-DRJRCHHO.js → chunk-OJ47HQVJ.js} +141 -63
- package/js/{chunk-MZH4J2PO.js → chunk-PD6I2SDG.js} +1 -1
- package/js/{chunk-KSGYJV46.js → chunk-TUMGL2OC.js} +1 -1
- package/js/{chunk-5GLC42LK.js → chunk-UM62MBJQ.js} +42 -24
- package/js/{chunk-V3RS2BK6.js → chunk-XK5I2XOI.js} +39 -29
- package/js/client.js +8 -8
- package/js/contracts.js +7 -3
- package/js/effect.js +11 -11
- package/js/graphql.js +20 -18
- package/js/host.js +76 -51
- package/js/index.js +21 -16
- package/js/mcp/effect.js +13 -13
- package/js/mcp/stdio.js +27 -22
- package/js/mcp.js +20 -18
- package/js/openapi.js +103 -77
- package/js/skills/effect.js +2 -2
- package/js/skills.js +50 -33
- package/js/ui/auth.js +3 -3
- package/js/ui/contracts.js +3 -3
- package/js/ui/serving.js +6 -6
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/host.d.ts +15 -0
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/cache.d.ts +4 -0
- package/types/apps/src/implementation/elicitation.d.ts +6 -3
- package/types/apps/src/implementation/invocation-timing.d.ts +16 -0
- package/types/apps/src/implementation/operations.d.ts +2 -2
- package/types/apps/src/implementation/router-catalog.d.ts +4 -4
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/telemetry/src/index.d.ts +1 -0
- package/types/telemetry/src/ownership.d.ts +56 -0
- package/js/{chunk-LNSVJS2Q.js → chunk-EOPQ727L.js} +2 -2
package/js/mcp/effect.js
CHANGED
|
@@ -2,27 +2,27 @@ import {
|
|
|
2
2
|
mcpClientEffect,
|
|
3
3
|
mcpHealthEffect,
|
|
4
4
|
mcpToolsEffect
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-6QXPBJ5T.js";
|
|
6
|
+
import "../chunk-XK5I2XOI.js";
|
|
7
7
|
import "../chunk-BCSNKUAC.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-OJ47HQVJ.js";
|
|
9
9
|
import "../chunk-AQU56EPI.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-3UGDI2UI.js";
|
|
11
|
+
import "../chunk-7UUHJR2Q.js";
|
|
12
12
|
import "../chunk-XBG7HHXC.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-3B2JAOSE.js";
|
|
14
|
+
import "../chunk-LHCGND3R.js";
|
|
15
|
+
import "../chunk-LTDHQJ2Z.js";
|
|
16
|
+
import "../chunk-CVAJ4F6O.js";
|
|
17
17
|
import "../chunk-MWKHKOTL.js";
|
|
18
18
|
import "../chunk-H72MEDMN.js";
|
|
19
|
-
import "../chunk-CZGWW4NQ.js";
|
|
20
|
-
import "../chunk-MZH4J2PO.js";
|
|
21
19
|
import "../chunk-KGCTYL2S.js";
|
|
20
|
+
import "../chunk-JM7LOD2W.js";
|
|
21
|
+
import "../chunk-PD6I2SDG.js";
|
|
22
22
|
import "../chunk-5FHWNLCI.js";
|
|
23
23
|
import "../chunk-H2CJWXA3.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-TUMGL2OC.js";
|
|
25
|
+
import "../chunk-EOPQ727L.js";
|
|
26
26
|
import "../chunk-IFJU5SYQ.js";
|
|
27
27
|
import "../chunk-CZ7CSFO4.js";
|
|
28
28
|
export {
|
package/js/mcp/stdio.js
CHANGED
|
@@ -3,32 +3,34 @@ import {
|
|
|
3
3
|
answeredError,
|
|
4
4
|
mcpClient,
|
|
5
5
|
mcpJsonSchemaValidator
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-XK5I2XOI.js";
|
|
7
7
|
import {
|
|
8
8
|
protocolRouter
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-7LGRK7TP.js";
|
|
10
10
|
import "../chunk-BCSNKUAC.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-OJ47HQVJ.js";
|
|
12
12
|
import "../chunk-AQU56EPI.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-3UGDI2UI.js";
|
|
14
|
+
import "../chunk-7UUHJR2Q.js";
|
|
15
15
|
import "../chunk-XBG7HHXC.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-3B2JAOSE.js";
|
|
17
|
+
import "../chunk-LHCGND3R.js";
|
|
18
|
+
import "../chunk-LTDHQJ2Z.js";
|
|
19
19
|
import {
|
|
20
20
|
McpError,
|
|
21
21
|
ProcessConfig
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-CVAJ4F6O.js";
|
|
23
23
|
import "../chunk-MWKHKOTL.js";
|
|
24
24
|
import "../chunk-H72MEDMN.js";
|
|
25
|
-
import "../chunk-CZGWW4NQ.js";
|
|
26
|
-
import "../chunk-MZH4J2PO.js";
|
|
27
25
|
import "../chunk-KGCTYL2S.js";
|
|
26
|
+
import {
|
|
27
|
+
owned
|
|
28
|
+
} from "../chunk-JM7LOD2W.js";
|
|
29
|
+
import "../chunk-PD6I2SDG.js";
|
|
28
30
|
import "../chunk-5FHWNLCI.js";
|
|
29
31
|
import "../chunk-H2CJWXA3.js";
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-TUMGL2OC.js";
|
|
33
|
+
import "../chunk-EOPQ727L.js";
|
|
32
34
|
import {
|
|
33
35
|
Effect_exports,
|
|
34
36
|
Schema_exports
|
|
@@ -88,22 +90,25 @@ function withClient(config, mode, use) {
|
|
|
88
90
|
stderr: "ignore"
|
|
89
91
|
})
|
|
90
92
|
})),
|
|
91
|
-
({ client: client2, transport: transport2 }) =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
({ client: client2, transport: transport2 }) => (
|
|
94
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- MCP SDK
|
|
95
|
+
Effect_exports.tryPromise(async () => {
|
|
96
|
+
try {
|
|
97
|
+
await client2.close();
|
|
98
|
+
} finally {
|
|
99
|
+
await transport2.close();
|
|
100
|
+
}
|
|
101
|
+
}).pipe(owned("upstream", "provider.mcp.close"), Effect_exports.orDie)
|
|
102
|
+
)
|
|
98
103
|
);
|
|
99
104
|
yield* Effect_exports.tryPromise({
|
|
100
105
|
try: (signal) => client.connect(transport, { signal, timeout: config.timeoutMs }),
|
|
101
106
|
catch: (error) => failure("connect", error)
|
|
102
|
-
}).pipe(Effect_exports.timeout(config.timeoutMs),
|
|
107
|
+
}).pipe(Effect_exports.timeout(config.timeoutMs), owned("upstream", "provider.mcp.connect"));
|
|
103
108
|
return yield* use(client);
|
|
104
109
|
})
|
|
105
110
|
).pipe(
|
|
106
|
-
|
|
111
|
+
owned("upstream", "provider.mcp.session", {
|
|
107
112
|
attributes: { "mcp.transport": "stdio", "mcp.operation": mode }
|
|
108
113
|
}),
|
|
109
114
|
(operation) => mode === "discover" ? operation.pipe(Effect_exports.timeout(config.timeoutMs)) : operation,
|
package/js/mcp.js
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpClientEffect,
|
|
3
3
|
mcpHealthEffect
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6QXPBJ5T.js";
|
|
5
5
|
import {
|
|
6
6
|
catalogCache,
|
|
7
7
|
catalogScope
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UM62MBJQ.js";
|
|
9
9
|
import {
|
|
10
10
|
adaptMcpTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XK5I2XOI.js";
|
|
12
12
|
import {
|
|
13
13
|
protocolOperations
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7LGRK7TP.js";
|
|
15
15
|
import "./chunk-BCSNKUAC.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-OJ47HQVJ.js";
|
|
17
17
|
import {
|
|
18
18
|
cacheKey
|
|
19
19
|
} from "./chunk-AQU56EPI.js";
|
|
20
20
|
import {
|
|
21
21
|
operationDescription
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-3UGDI2UI.js";
|
|
23
|
+
import "./chunk-7UUHJR2Q.js";
|
|
24
24
|
import "./chunk-XBG7HHXC.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-3B2JAOSE.js";
|
|
26
26
|
import {
|
|
27
27
|
nativeOperation,
|
|
28
28
|
routerDeclaration
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import
|
|
29
|
+
} from "./chunk-LHCGND3R.js";
|
|
30
|
+
import {
|
|
31
|
+
fromPromise,
|
|
32
|
+
method
|
|
33
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
31
34
|
import {
|
|
32
35
|
McpCredentialsUnverified,
|
|
33
36
|
McpError,
|
|
34
37
|
McpServerHeader,
|
|
35
38
|
McpToolMetadata,
|
|
36
39
|
McpToolsOptions
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-CVAJ4F6O.js";
|
|
38
41
|
import "./chunk-MWKHKOTL.js";
|
|
39
42
|
import "./chunk-H72MEDMN.js";
|
|
40
|
-
import "./chunk-CZGWW4NQ.js";
|
|
41
|
-
import "./chunk-MZH4J2PO.js";
|
|
42
43
|
import "./chunk-KGCTYL2S.js";
|
|
44
|
+
import "./chunk-JM7LOD2W.js";
|
|
45
|
+
import "./chunk-PD6I2SDG.js";
|
|
43
46
|
import "./chunk-5FHWNLCI.js";
|
|
44
47
|
import "./chunk-H2CJWXA3.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-TUMGL2OC.js";
|
|
49
|
+
import "./chunk-EOPQ727L.js";
|
|
47
50
|
import {
|
|
48
51
|
Effect_exports,
|
|
49
52
|
Schema_exports
|
|
@@ -54,7 +57,6 @@ import "./chunk-CZ7CSFO4.js";
|
|
|
54
57
|
var McpToolSummary = McpToolMetadata.mapFields(
|
|
55
58
|
({ inputSchema: _input, outputSchema: _output, _meta, ...fields }) => fields
|
|
56
59
|
);
|
|
57
|
-
var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
|
|
58
60
|
var serverMeta = (server) => {
|
|
59
61
|
const title = server.title ?? server.name;
|
|
60
62
|
return {
|
|
@@ -76,7 +78,7 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
76
78
|
const cache = yield* catalogScope(options, options.headers, invalid);
|
|
77
79
|
const id = yield* cacheKey({ url: parsed.url });
|
|
78
80
|
const key = ["mcp-catalog-v3", id, "current"];
|
|
79
|
-
const changed = cache === void 0 ? void 0 :
|
|
81
|
+
const changed = cache === void 0 ? void 0 : fromPromise(method(cache, "invalidate"), "cache")(key);
|
|
80
82
|
const client = yield* mcpClientEffect(parsed, changed);
|
|
81
83
|
const catalog = yield* catalogCache({
|
|
82
84
|
...options,
|
|
@@ -89,7 +91,7 @@ var mcpCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
89
91
|
},
|
|
90
92
|
load: (context) => (context === void 0 ? client.list : mcpClientEffect(
|
|
91
93
|
{ ...parsed, signal: context.signal },
|
|
92
|
-
|
|
94
|
+
fromPromise(method(context.cache, "invalidate"), "cache")(key)
|
|
93
95
|
).pipe(Effect_exports.flatMap((source) => source.list))).pipe(
|
|
94
96
|
Effect_exports.flatMap(
|
|
95
97
|
({ tools, server }) => Schema_exports.encodeEffect(McpServerHeader)(server).pipe(
|
package/js/openapi.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
protocolOperations,
|
|
10
10
|
protocolRouter
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7LGRK7TP.js";
|
|
12
12
|
import {
|
|
13
13
|
OpenapiCompileError,
|
|
14
14
|
OpenapiCompileErrorCode,
|
|
@@ -27,53 +27,56 @@ import {
|
|
|
27
27
|
isOpenapiTextMedia,
|
|
28
28
|
openapiBinaryResultSchema,
|
|
29
29
|
openapiMediaKind
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-3UGDI2UI.js";
|
|
31
31
|
import {
|
|
32
32
|
failOnNetworkRefusal
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-7UUHJR2Q.js";
|
|
34
34
|
import "./chunk-XBG7HHXC.js";
|
|
35
35
|
import {
|
|
36
|
-
fromPromise,
|
|
37
36
|
nativeOperation,
|
|
38
|
-
routerDeclaration
|
|
39
|
-
|
|
40
|
-
} from "./chunk-OTGUPKKK.js";
|
|
37
|
+
routerDeclaration
|
|
38
|
+
} from "./chunk-LHCGND3R.js";
|
|
41
39
|
import {
|
|
42
40
|
accountProviderError,
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
fromPromise,
|
|
42
|
+
httpProviderError,
|
|
43
|
+
method,
|
|
44
|
+
toPromise
|
|
45
|
+
} from "./chunk-LTDHQJ2Z.js";
|
|
45
46
|
import {
|
|
46
47
|
ApiErrorRecovery,
|
|
47
48
|
ApiErrorResponse,
|
|
48
49
|
OpenapiResponseError,
|
|
49
50
|
RouterMeta,
|
|
50
51
|
defaultOpenapiErrorLimits
|
|
51
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-CVAJ4F6O.js";
|
|
52
53
|
import {
|
|
53
54
|
NetworkRefused,
|
|
54
55
|
ProviderError,
|
|
55
56
|
cacheLimits
|
|
56
57
|
} from "./chunk-MWKHKOTL.js";
|
|
57
58
|
import "./chunk-H72MEDMN.js";
|
|
58
|
-
import "./chunk-CZGWW4NQ.js";
|
|
59
|
-
import {
|
|
60
|
-
FetchHttpClient_exports
|
|
61
|
-
} from "./chunk-MZH4J2PO.js";
|
|
62
59
|
import {
|
|
63
60
|
jsonSchema,
|
|
64
61
|
lazyJsonSchemaDecoder,
|
|
65
62
|
once,
|
|
66
63
|
wrap
|
|
67
64
|
} from "./chunk-KGCTYL2S.js";
|
|
65
|
+
import {
|
|
66
|
+
owned
|
|
67
|
+
} from "./chunk-JM7LOD2W.js";
|
|
68
|
+
import {
|
|
69
|
+
FetchHttpClient_exports
|
|
70
|
+
} from "./chunk-PD6I2SDG.js";
|
|
68
71
|
import "./chunk-5FHWNLCI.js";
|
|
69
72
|
import {
|
|
70
73
|
JsonObject
|
|
71
74
|
} from "./chunk-H2CJWXA3.js";
|
|
72
|
-
import "./chunk-
|
|
75
|
+
import "./chunk-TUMGL2OC.js";
|
|
73
76
|
import {
|
|
74
77
|
HttpClientRequest_exports,
|
|
75
78
|
HttpClient_exports
|
|
76
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-EOPQ727L.js";
|
|
77
80
|
import {
|
|
78
81
|
Base64_exports,
|
|
79
82
|
Deferred_exports,
|
|
@@ -384,7 +387,7 @@ function createRequest(config) {
|
|
|
384
387
|
duration: defaultOpenapiResponseLimits.readTimeoutMs,
|
|
385
388
|
orElse: () => Effect_exports.fail(unreadable)
|
|
386
389
|
}),
|
|
387
|
-
|
|
390
|
+
owned("upstream", "provider.http.response.read")
|
|
388
391
|
);
|
|
389
392
|
const data = new Uint8Array(chunks.reduce((size, chunk) => size + chunk.length, 0));
|
|
390
393
|
let offset = 0;
|
|
@@ -399,7 +402,7 @@ function createRequest(config) {
|
|
|
399
402
|
) : text;
|
|
400
403
|
})
|
|
401
404
|
).pipe(
|
|
402
|
-
|
|
405
|
+
owned("upstream", "provider.openapi.call", {
|
|
403
406
|
attributes: { "executor.tool.name": op.name, "http.request.method": op.method }
|
|
404
407
|
}),
|
|
405
408
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
@@ -4118,13 +4121,13 @@ function checkSwagger2(document) {
|
|
|
4118
4121
|
if (!path.startsWith("/")) continue;
|
|
4119
4122
|
const itemAt = `#/paths/${pointerToken(path)}`;
|
|
4120
4123
|
const item = decodeDefinition(Swagger2PathItem, value, itemAt, "path item");
|
|
4121
|
-
for (const
|
|
4122
|
-
for (const [status, response] of Object.entries(item[
|
|
4124
|
+
for (const method2 of swagger2Methods)
|
|
4125
|
+
for (const [status, response] of Object.entries(item[method2]?.responses ?? {}))
|
|
4123
4126
|
if (!status.startsWith("x-"))
|
|
4124
4127
|
decodeDefinition(
|
|
4125
4128
|
DocumentObject,
|
|
4126
4129
|
response,
|
|
4127
|
-
`${itemAt}/${
|
|
4130
|
+
`${itemAt}/${method2}/responses/${pointerToken(status)}`,
|
|
4128
4131
|
"response"
|
|
4129
4132
|
);
|
|
4130
4133
|
}
|
|
@@ -4446,8 +4449,8 @@ var binaryInput = {
|
|
|
4446
4449
|
var declaredAt = (document, value, inline) => document.origin(value) ?? inline;
|
|
4447
4450
|
var mediaSchemaAt = (document, at, type, media) => `${declaredAt(document, media, `${at}/content/${pointerToken(type)}`)}/schema`;
|
|
4448
4451
|
var responsesOf = (operation) => operation.responses === void 0 ? {} : record2(operation.responses);
|
|
4449
|
-
function responseSchema(document, operation, at,
|
|
4450
|
-
if (
|
|
4452
|
+
function responseSchema(document, operation, at, method2) {
|
|
4453
|
+
if (method2 === "HEAD") return { type: "null" };
|
|
4451
4454
|
const success = Object.entries(responsesOf(operation)).filter(
|
|
4452
4455
|
([status]) => /^2(?:[0-9]{2}|XX)$/i.test(status)
|
|
4453
4456
|
);
|
|
@@ -4577,10 +4580,10 @@ function prefixParameters(prefix) {
|
|
|
4577
4580
|
return names;
|
|
4578
4581
|
}
|
|
4579
4582
|
var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
4580
|
-
let
|
|
4583
|
+
let owned2 = inputDocument;
|
|
4581
4584
|
const take = () => {
|
|
4582
|
-
const input =
|
|
4583
|
-
|
|
4585
|
+
const input = owned2;
|
|
4586
|
+
owned2 = void 0;
|
|
4584
4587
|
if (input === void 0) fail2("invalid_document", "This API definition was already compiled.");
|
|
4585
4588
|
return input;
|
|
4586
4589
|
};
|
|
@@ -4674,15 +4677,15 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
4674
4677
|
const candidates = Object.entries(spec.paths).flatMap(([path, source]) => {
|
|
4675
4678
|
const item = document.resolve(source);
|
|
4676
4679
|
const itemAt = declaredAt(document, source, `#/paths/${pointerToken(path)}`);
|
|
4677
|
-
const additional = version32 && item.additionalOperations !== void 0 ? Object.entries(record2(item.additionalOperations)).map(([
|
|
4678
|
-
method,
|
|
4680
|
+
const additional = version32 && item.additionalOperations !== void 0 ? Object.entries(record2(item.additionalOperations)).map(([method2, value]) => ({
|
|
4681
|
+
method: method2,
|
|
4679
4682
|
value,
|
|
4680
|
-
at: `${itemAt}/additionalOperations/${pointerToken(
|
|
4683
|
+
at: `${itemAt}/additionalOperations/${pointerToken(method2)}`
|
|
4681
4684
|
})) : [];
|
|
4682
|
-
const fixed = (version32 ? fixedMethods32 : fixedMethods).filter((
|
|
4683
|
-
method,
|
|
4684
|
-
value: item[
|
|
4685
|
-
at: `${itemAt}/${
|
|
4685
|
+
const fixed = (version32 ? fixedMethods32 : fixedMethods).filter((method2) => item[method2.toLowerCase()] !== void 0).map((method2) => ({
|
|
4686
|
+
method: method2,
|
|
4687
|
+
value: item[method2.toLowerCase()],
|
|
4688
|
+
at: `${itemAt}/${method2.toLowerCase()}`
|
|
4686
4689
|
}));
|
|
4687
4690
|
return [...fixed, ...additional].map((operation) => ({ ...operation, path, item, itemAt }));
|
|
4688
4691
|
});
|
|
@@ -4701,15 +4704,15 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
4701
4704
|
);
|
|
4702
4705
|
const order = new Map(named.map(({ name }, index) => [name, index]));
|
|
4703
4706
|
const inDefinitionOrder = (operations2) => [...operations2].sort((a, b) => (order.get(a.name) ?? 0) - (order.get(b.name) ?? 0));
|
|
4704
|
-
for (const [index, { name, path, item, itemAt, method, value, at }] of named.entries()) {
|
|
4707
|
+
for (const [index, { name, path, item, itemAt, method: method2, value, at }] of named.entries()) {
|
|
4705
4708
|
if (index % 100 === 99) await yieldToRuntime();
|
|
4706
4709
|
try {
|
|
4707
4710
|
if (!path.startsWith("/") || path.includes("?") || path.includes("#"))
|
|
4708
4711
|
fail2("operation_path", "The path must start with / and contain no ? or #.");
|
|
4709
|
-
if (!isImportedMethod(
|
|
4712
|
+
if (!isImportedMethod(method2))
|
|
4710
4713
|
fail2(
|
|
4711
4714
|
"operation_method",
|
|
4712
|
-
`Executor does not send the HTTP method ${
|
|
4715
|
+
`Executor does not send the HTTP method ${method2}. It imports ${fixedMethods32.join(", ")} operations.`
|
|
4713
4716
|
);
|
|
4714
4717
|
const operationMethods = [];
|
|
4715
4718
|
const resolved2 = document.resolve(record2(value));
|
|
@@ -4904,21 +4907,21 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
4904
4907
|
} catch {
|
|
4905
4908
|
fail2("input_schema", "Its input schema is not valid JSON.");
|
|
4906
4909
|
}
|
|
4907
|
-
const outputSchema = responseSchema(document, resolved2, at,
|
|
4910
|
+
const outputSchema = responseSchema(document, resolved2, at, method2);
|
|
4908
4911
|
const streaming = Object.values(operation.responses ?? {}).some((response) => {
|
|
4909
4912
|
const content = errorContent(document, response);
|
|
4910
4913
|
return content !== void 0 && Object.hasOwn(record2(content), "text/event-stream");
|
|
4911
4914
|
});
|
|
4912
4915
|
built.push({
|
|
4913
4916
|
methods: operationMethods,
|
|
4914
|
-
declared: { name, method, path },
|
|
4917
|
+
declared: { name, method: method2, path },
|
|
4915
4918
|
operation: {
|
|
4916
4919
|
...streaming ? { streaming: true } : {},
|
|
4917
4920
|
...tags === void 0 || tags.length === 0 ? {} : { tags },
|
|
4918
4921
|
name,
|
|
4919
4922
|
...operation.operationId === void 0 ? {} : { operationId: operation.operationId },
|
|
4920
4923
|
description: operation.summary ?? operation.description ?? name,
|
|
4921
|
-
method,
|
|
4924
|
+
method: method2,
|
|
4922
4925
|
path: `${options.pathPrefix ?? ""}${path}`,
|
|
4923
4926
|
baseUrl,
|
|
4924
4927
|
openapi: spec.openapi,
|
|
@@ -4960,7 +4963,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
4960
4963
|
if (!(error instanceof OpenapiCompileError) && !Schema_exports.isSchemaError(error)) throw error;
|
|
4961
4964
|
skipped.push({
|
|
4962
4965
|
name,
|
|
4963
|
-
method,
|
|
4966
|
+
method: method2,
|
|
4964
4967
|
path,
|
|
4965
4968
|
...error instanceof OpenapiCompileError ? { code: error.code, reason: error.reason } : {
|
|
4966
4969
|
code: "invalid_document",
|
|
@@ -4998,7 +5001,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
4998
5001
|
continue;
|
|
4999
5002
|
}
|
|
5000
5003
|
imported.push({ operation, declared });
|
|
5001
|
-
for (const
|
|
5004
|
+
for (const method2 of operationMethods) methods.set(method2.name, method2);
|
|
5002
5005
|
}
|
|
5003
5006
|
const operations = imported.map(({ operation }) => operation);
|
|
5004
5007
|
if (!operations.length) {
|
|
@@ -5021,7 +5024,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
5021
5024
|
}
|
|
5022
5025
|
const supported = (requirement) => {
|
|
5023
5026
|
const keys = Object.keys(requirement);
|
|
5024
|
-
return keys.every((key) => bindings.has(key)) || keys.length === 1 && oauth.some((
|
|
5027
|
+
return keys.every((key) => bindings.has(key)) || keys.length === 1 && oauth.some((method2) => method2.name === keys[0]);
|
|
5025
5028
|
};
|
|
5026
5029
|
const schemeLabel = (key) => {
|
|
5027
5030
|
const scheme = document.resolve(record2(schemes[key]));
|
|
@@ -5031,7 +5034,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
5031
5034
|
const unsupportedBy = (requirement) => {
|
|
5032
5035
|
const keys = Object.keys(requirement);
|
|
5033
5036
|
const unknown = keys.filter(
|
|
5034
|
-
(key) => !bindings.has(key) && !oauth.some((
|
|
5037
|
+
(key) => !bindings.has(key) && !oauth.some((method2) => method2.name === key)
|
|
5035
5038
|
);
|
|
5036
5039
|
return unknown.length > 0 ? unknown.map(schemeLabel).join(" and ") : `${keys.map(schemeLabel).join(" with ")}, which combines OAuth sign-in with another scheme`;
|
|
5037
5040
|
};
|
|
@@ -5066,7 +5069,7 @@ var compileOpenApiDocument = (entry, inputDocument, options = {}) => {
|
|
|
5066
5069
|
skipped: inDefinitionOrder(skipped),
|
|
5067
5070
|
definitions: Object.fromEntries(document.definitions),
|
|
5068
5071
|
methods: Object.fromEntries(
|
|
5069
|
-
[...methods.values()].map((
|
|
5072
|
+
[...methods.values()].map((method2) => [method2.name, method2.bindings])
|
|
5070
5073
|
),
|
|
5071
5074
|
secrets: [...methods.values()],
|
|
5072
5075
|
oauth,
|
|
@@ -5202,36 +5205,46 @@ var base64 = (bytes2) => {
|
|
|
5202
5205
|
binary += String.fromCharCode(...bytes2.subarray(index, index + 32768));
|
|
5203
5206
|
return btoa(binary);
|
|
5204
5207
|
};
|
|
5205
|
-
var gzip = (text) =>
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5208
|
+
var gzip = (text) => (
|
|
5209
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Compression Streams
|
|
5210
|
+
Effect_exports.tryPromise({
|
|
5211
|
+
try: async () => base64(
|
|
5212
|
+
new Uint8Array(
|
|
5213
|
+
await new Response(
|
|
5214
|
+
new Blob([text]).stream().pipeThrough(new CompressionStream("gzip"))
|
|
5215
|
+
).arrayBuffer()
|
|
5216
|
+
)
|
|
5217
|
+
),
|
|
5218
|
+
catch: (error) => error
|
|
5219
|
+
})
|
|
5220
|
+
);
|
|
5221
|
+
var gunzip = (stored2) => (
|
|
5222
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Compression Streams
|
|
5223
|
+
Effect_exports.tryPromise({
|
|
5224
|
+
try: () => new Response(
|
|
5225
|
+
new Blob([Uint8Array.from(atob(stored2), (char) => char.charCodeAt(0))]).stream().pipeThrough(new DecompressionStream("gzip"))
|
|
5226
|
+
).text(),
|
|
5227
|
+
catch: invalid
|
|
5228
|
+
})
|
|
5213
5229
|
);
|
|
5214
|
-
var gunzip = (stored2) => Effect_exports.tryPromise({
|
|
5215
|
-
try: () => new Response(
|
|
5216
|
-
new Blob([Uint8Array.from(atob(stored2), (char) => char.charCodeAt(0))]).stream().pipeThrough(new DecompressionStream("gzip"))
|
|
5217
|
-
).text(),
|
|
5218
|
-
catch: invalid
|
|
5219
|
-
});
|
|
5220
5230
|
var decodeText = (decoder) => (text) => Effect_exports.try({ try: () => JSON.parse(text), catch: invalid }).pipe(
|
|
5221
5231
|
Effect_exports.flatMap((value) => Schema_exports.decodeUnknownEffect(decoder)(value))
|
|
5222
5232
|
);
|
|
5223
5233
|
var schema = (decoder) => wrap(decoder, false);
|
|
5224
|
-
var invoke = (work) => Effect_exports.tryPromise({ try: work, catch: (error) => error });
|
|
5225
5234
|
var invalid = () => new OpenapiError({ reason: "invalid_definition" });
|
|
5226
5235
|
var format = "openapi-v4";
|
|
5227
5236
|
var writeEntries = cacheLimits.batchEntries;
|
|
5228
5237
|
var writeBytes = cacheLimits.batchBytes - 5e5;
|
|
5229
5238
|
var readParts = Math.floor(cacheLimits.batchBytes / bucketLimit);
|
|
5230
|
-
var sha256Json = (value) =>
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5239
|
+
var sha256Json = (value) => (
|
|
5240
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Web Crypto
|
|
5241
|
+
Effect_exports.tryPromise({
|
|
5242
|
+
try: () => crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(value))),
|
|
5243
|
+
catch: (error) => error
|
|
5244
|
+
}).pipe(
|
|
5245
|
+
Effect_exports.map(
|
|
5246
|
+
(hash2) => Array.from(new Uint8Array(hash2), (byte) => byte.toString(16).padStart(2, "0")).join("")
|
|
5247
|
+
)
|
|
5235
5248
|
)
|
|
5236
5249
|
);
|
|
5237
5250
|
var partConcurrency = 4;
|
|
@@ -5335,9 +5348,10 @@ var parseYaml = (text) => {
|
|
|
5335
5348
|
return JSON.parse(JSON.stringify(parse(text)));
|
|
5336
5349
|
};
|
|
5337
5350
|
var download = (url, context) => Effect_exports.gen(function* () {
|
|
5338
|
-
const response = yield*
|
|
5339
|
-
() => context.fetch(url, { signal: context.signal, redirect: "manual" })
|
|
5340
|
-
|
|
5351
|
+
const response = yield* Effect_exports.tryPromise({
|
|
5352
|
+
try: () => context.fetch(url, { signal: context.signal, redirect: "manual" }),
|
|
5353
|
+
catch: (error) => error
|
|
5354
|
+
});
|
|
5341
5355
|
if (!response.ok || response.body === null) return yield* invalid();
|
|
5342
5356
|
const reader = response.body.getReader();
|
|
5343
5357
|
const text = yield* Effect_exports.acquireUseRelease(
|
|
@@ -5347,7 +5361,10 @@ var download = (url, context) => Effect_exports.gen(function* () {
|
|
|
5347
5361
|
const chunks = [];
|
|
5348
5362
|
let bytes2 = 0;
|
|
5349
5363
|
while (true) {
|
|
5350
|
-
const chunk = yield*
|
|
5364
|
+
const chunk = yield* Effect_exports.tryPromise({
|
|
5365
|
+
try: () => reader2.read(),
|
|
5366
|
+
catch: (error) => error
|
|
5367
|
+
});
|
|
5351
5368
|
if (chunk.done) break;
|
|
5352
5369
|
bytes2 += chunk.value.byteLength;
|
|
5353
5370
|
if (bytes2 > 4e7) return yield* invalid();
|
|
@@ -5356,7 +5373,12 @@ var download = (url, context) => Effect_exports.gen(function* () {
|
|
|
5356
5373
|
chunks.push(decoder.decode());
|
|
5357
5374
|
return chunks.join("");
|
|
5358
5375
|
}),
|
|
5359
|
-
(reader2) =>
|
|
5376
|
+
(reader2) => (
|
|
5377
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Streams
|
|
5378
|
+
Effect_exports.tryPromise({ try: () => reader2.cancel(), catch: (error) => error }).pipe(
|
|
5379
|
+
Effect_exports.catch(() => Effect_exports.void)
|
|
5380
|
+
)
|
|
5381
|
+
)
|
|
5360
5382
|
);
|
|
5361
5383
|
return yield* Effect_exports.try({
|
|
5362
5384
|
try: () => Schema_exports.decodeUnknownSync(JsonObject)(
|
|
@@ -5370,6 +5392,7 @@ var liveOpenapiRouter = (options) => {
|
|
|
5370
5392
|
const staleFor = options.staleFor ?? "1 day";
|
|
5371
5393
|
const retention = Duration_exports.toMillis(Duration_exports.fromInputUnsafe(freshFor)) + Duration_exports.toMillis(Duration_exports.fromInputUnsafe(staleFor)) + 3e5;
|
|
5372
5394
|
const identity = Effect_exports.cached(
|
|
5395
|
+
// oxlint-disable-next-line executor/authored-code-through-adapter -- Web Crypto
|
|
5373
5396
|
Effect_exports.tryPromise({
|
|
5374
5397
|
try: async () => {
|
|
5375
5398
|
const bytes2 = new TextEncoder().encode(
|
|
@@ -5413,10 +5436,10 @@ var liveOpenapiRouter = (options) => {
|
|
|
5413
5436
|
const revision = yield* sha256Json([format, yield* sourceId, document]);
|
|
5414
5437
|
const meta = documentMeta(document);
|
|
5415
5438
|
const handOver = () => {
|
|
5416
|
-
const
|
|
5439
|
+
const owned2 = document;
|
|
5417
5440
|
document = void 0;
|
|
5418
|
-
if (
|
|
5419
|
-
return
|
|
5441
|
+
if (owned2 === void 0) throw new Error("The document was already handed over.");
|
|
5442
|
+
return owned2;
|
|
5420
5443
|
};
|
|
5421
5444
|
const compiled = yield* compileOpenApiDocument(
|
|
5422
5445
|
{ name: "API", ..."url" in options.source ? { connectUrl: options.source.url } : {} },
|
|
@@ -5485,7 +5508,7 @@ var liveOpenapiRouter = (options) => {
|
|
|
5485
5508
|
const { manifest, batches, retained, retainedBytes } = yield* serialize(context);
|
|
5486
5509
|
yield* Effect_exports.forEach(
|
|
5487
5510
|
batches,
|
|
5488
|
-
({ entries, bytes: bytes2 }, index) => fromPromise(context.cache
|
|
5511
|
+
({ entries, bytes: bytes2 }, index) => fromPromise(method(context.cache, "write"), "cache")(entries, retention).pipe(
|
|
5489
5512
|
Effect_exports.withSpan("app.cache.flush", {
|
|
5490
5513
|
attributes: {
|
|
5491
5514
|
"cache.flush.index": index,
|
|
@@ -5511,12 +5534,15 @@ var liveOpenapiRouter = (options) => {
|
|
|
5511
5534
|
reading = deferred;
|
|
5512
5535
|
return pointer.pipe(
|
|
5513
5536
|
Effect_exports.flatMap(
|
|
5514
|
-
(key) => fromPromise(
|
|
5537
|
+
(key) => fromPromise(
|
|
5538
|
+
method(options.cache, "get"),
|
|
5539
|
+
"cache"
|
|
5540
|
+
)({
|
|
5515
5541
|
key,
|
|
5516
5542
|
schema: schema(Manifest),
|
|
5517
5543
|
freshFor,
|
|
5518
5544
|
staleFor,
|
|
5519
|
-
load: toPromise(refresh)
|
|
5545
|
+
load: toPromise(refresh, (context) => context.signal)
|
|
5520
5546
|
})
|
|
5521
5547
|
),
|
|
5522
5548
|
Effect_exports.onExit(
|
|
@@ -5540,7 +5566,7 @@ var liveOpenapiRouter = (options) => {
|
|
|
5540
5566
|
);
|
|
5541
5567
|
return Effect_exports.forEach(
|
|
5542
5568
|
groups,
|
|
5543
|
-
(group) => fromPromise(options.cache
|
|
5569
|
+
(group) => fromPromise(method(options.cache, "readMany"), "cache")(
|
|
5544
5570
|
group.map((name) => partKey(revision, kind, name)),
|
|
5545
5571
|
partText
|
|
5546
5572
|
).pipe(
|
|
@@ -5672,7 +5698,7 @@ var liveOpenapiRouter = (options) => {
|
|
|
5672
5698
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
5673
5699
|
const result = yield* work(yield* current);
|
|
5674
5700
|
if (result !== void 0) return result.value;
|
|
5675
|
-
yield* fromPromise(options.cache
|
|
5701
|
+
yield* fromPromise(method(options.cache, "invalidate"), "cache")(yield* pointer);
|
|
5676
5702
|
}
|
|
5677
5703
|
return yield* invalid();
|
|
5678
5704
|
});
|
package/js/skills/effect.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunk-XBG7HHXC.js";
|
|
5
5
|
import "../chunk-H72MEDMN.js";
|
|
6
6
|
import "../chunk-5FHWNLCI.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-TUMGL2OC.js";
|
|
8
|
+
import "../chunk-EOPQ727L.js";
|
|
9
9
|
import "../chunk-IFJU5SYQ.js";
|
|
10
10
|
import "../chunk-CZ7CSFO4.js";
|
|
11
11
|
export {
|