apps 0.0.1-beta.11 → 0.0.1-beta.110
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/README.md +60 -42
- package/framework-reference.json +1 -1
- package/js/chunk-2RGJMA7N.js +5186 -0
- package/js/chunk-3BI34I5S.js +449 -0
- package/js/chunk-3BOEMXAJ.js +713 -0
- package/js/{chunk-JU7VHODU.js → chunk-4PIQKACY.js} +65 -10
- package/js/{chunk-VFZKSM3T.js → chunk-4X2UI4R2.js} +3 -3
- package/js/{chunk-KUMBKVJD.js → chunk-62NVUKED.js} +2 -2
- package/js/chunk-74H25C4X.js +95 -0
- package/js/chunk-7HG422GB.js +90 -0
- package/js/{chunk-UK573G7W.js → chunk-ACQXVKVQ.js} +87 -51
- package/js/chunk-BKIQCV72.js +994 -0
- package/js/{chunk-IJX4CYZO.js → chunk-DILSCQPJ.js} +228 -264
- package/js/chunk-HLMJBE4T.js +49 -0
- package/js/{chunk-RELFXUOO.js → chunk-JCX2K2SI.js} +931 -289
- package/js/{chunk-M3B3DE4K.js → chunk-KLSEU35Y.js} +463 -218
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/chunk-OIH73VFM.js +175 -0
- package/js/chunk-OWN3DP2W.js +88 -0
- package/js/{chunk-IPI4MFSN.js → chunk-PBGPES67.js} +2 -2
- package/js/{chunk-WVVV4TX2.js → chunk-RIV62DRM.js} +4 -3
- package/js/{chunk-RFVIONFX.js → chunk-SXQVVXJE.js} +123 -44
- package/js/chunk-UPTAFF6L.js +335 -0
- package/js/{chunk-ODEIDRGW.js → chunk-URKOTNDA.js} +795 -176
- package/js/{chunk-5T57N25Q.js → chunk-VAI3EVCS.js} +643 -69
- package/js/{chunk-57RKNWL2.js → chunk-YDW7DX3A.js} +4 -4
- package/js/{chunk-CDL5PM2Q.js → chunk-ZKDXML77.js} +19239 -18404
- package/js/{chunk-GPFVWWDZ.js → chunk-ZXG7RMCB.js} +113 -58
- package/js/client.js +148 -84
- package/js/contracts.js +150 -21
- package/js/effect.js +18 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +231 -188
- package/js/host.js +116 -78
- package/js/index.js +213 -98
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4349 -1415
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +9 -8
- package/js/ui/serving.js +8609 -228
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +56 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +40 -2
- package/types/apps/src/contracts/host.d.ts +1456 -20
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +14 -7
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +6869 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +85 -6
- package/types/apps/src/contracts/router.d.ts +2 -1
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +38 -7
- package/types/apps/src/implementation/openapi-document.d.ts +50 -20
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +58 -7
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +24 -18
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +108 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +3 -3
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +28 -11
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +17 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +51 -16
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/legacy-keys.d.ts +20 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-EFAPIRVB.js +0 -299
- package/js/chunk-KRSCJDTW.js +0 -2668
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-TYVDBQSI.js +0 -242
- package/js/chunk-YBRC463S.js +0 -224
- package/js/chunk-Z2QY3YTF.js +0 -507
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/mcp-stdio.d.ts +0 -5
package/js/graphql.js
CHANGED
|
@@ -1,152 +1,82 @@
|
|
|
1
1
|
import {
|
|
2
|
-
catalogCache
|
|
3
|
-
|
|
2
|
+
catalogCache,
|
|
3
|
+
catalogScope
|
|
4
|
+
} from "./chunk-SXQVVXJE.js";
|
|
4
5
|
import {
|
|
5
6
|
protocolOperations
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RIV62DRM.js";
|
|
7
8
|
import "./chunk-BCSNKUAC.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-JCX2K2SI.js";
|
|
9
10
|
import {
|
|
10
11
|
cacheKey
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
} from "./chunk-UPTAFF6L.js";
|
|
13
|
+
import {
|
|
14
|
+
GraphqlError,
|
|
15
|
+
GraphqlIntrospection,
|
|
16
|
+
GraphqlResponse,
|
|
17
|
+
GraphqlToolDefinition,
|
|
18
|
+
GraphqlToolsOptions,
|
|
19
|
+
defaultGraphqlClientLimits,
|
|
20
|
+
maxGraphqlStatedErrors,
|
|
21
|
+
maxGraphqlStatedExtensions,
|
|
22
|
+
maxGraphqlStatedFieldLength
|
|
23
|
+
} from "./chunk-BKIQCV72.js";
|
|
24
|
+
import {
|
|
25
|
+
failOnNetworkRefusal
|
|
26
|
+
} from "./chunk-HLMJBE4T.js";
|
|
27
|
+
import "./chunk-PBGPES67.js";
|
|
28
|
+
import "./chunk-3BI34I5S.js";
|
|
16
29
|
import {
|
|
17
30
|
nativeOperation,
|
|
18
31
|
routerDeclaration
|
|
19
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ZXG7RMCB.js";
|
|
20
33
|
import {
|
|
21
34
|
accountProviderError,
|
|
35
|
+
boundStated,
|
|
22
36
|
graphqlProviderError,
|
|
23
37
|
httpProviderError
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-KRSCJDTW.js";
|
|
26
|
-
import "./chunk-N7YDVXYJ.js";
|
|
38
|
+
} from "./chunk-OIH73VFM.js";
|
|
27
39
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
FailureFieldName,
|
|
41
|
+
NetworkRefused,
|
|
42
|
+
ProviderError,
|
|
43
|
+
defaultOpenapiErrorLimits,
|
|
44
|
+
maxUpstreamMessageLength
|
|
45
|
+
} from "./chunk-2RGJMA7N.js";
|
|
46
|
+
import "./chunk-4PIQKACY.js";
|
|
32
47
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
48
|
+
jsonSchemaDecoder
|
|
49
|
+
} from "./chunk-VAI3EVCS.js";
|
|
35
50
|
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} from "./chunk-UK573G7W.js";
|
|
51
|
+
owned
|
|
52
|
+
} from "./chunk-URKOTNDA.js";
|
|
39
53
|
import {
|
|
40
|
-
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
54
|
+
FetchHttpClient_exports
|
|
55
|
+
} from "./chunk-YDW7DX3A.js";
|
|
56
|
+
import "./chunk-OWN3DP2W.js";
|
|
43
57
|
import {
|
|
44
|
-
AccountId,
|
|
45
|
-
HttpUrl,
|
|
46
58
|
JsonObject
|
|
47
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-7HG422GB.js";
|
|
60
|
+
import "./chunk-DILSCQPJ.js";
|
|
61
|
+
import {
|
|
62
|
+
HttpClientRequest_exports,
|
|
63
|
+
HttpClient_exports
|
|
64
|
+
} from "./chunk-ACQXVKVQ.js";
|
|
48
65
|
import {
|
|
49
66
|
Effect_exports,
|
|
67
|
+
Option_exports,
|
|
50
68
|
Redacted_exports,
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
Ref_exports,
|
|
70
|
+
Result_exports,
|
|
71
|
+
Schema_exports,
|
|
72
|
+
Stream_exports
|
|
73
|
+
} from "./chunk-ZKDXML77.js";
|
|
53
74
|
import "./chunk-CZ7CSFO4.js";
|
|
54
75
|
|
|
55
|
-
// src/contracts/graphql.ts
|
|
56
|
-
var GraphqlClientLimits = Schema_exports.Struct({
|
|
57
|
-
timeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0)),
|
|
58
|
-
maxTimeoutMs: Schema_exports.Int.check(Schema_exports.isGreaterThan(0))
|
|
59
|
-
});
|
|
60
|
-
var defaultGraphqlClientLimits = GraphqlClientLimits.make({
|
|
61
|
-
timeoutMs: 3e4,
|
|
62
|
-
maxTimeoutMs: 3e5
|
|
63
|
-
});
|
|
64
|
-
var GraphqlToolsOptions = Schema_exports.Struct({
|
|
65
|
-
url: HttpUrl,
|
|
66
|
-
accountId: Schema_exports.optional(AccountId),
|
|
67
|
-
headers: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.String)),
|
|
68
|
-
signal: Schema_exports.optional(Schema_exports.instanceOf(AbortSignal)),
|
|
69
|
-
timeoutMs: Schema_exports.optional(
|
|
70
|
-
Schema_exports.Int.check(
|
|
71
|
-
Schema_exports.isBetween({ minimum: 1, maximum: defaultGraphqlClientLimits.maxTimeoutMs })
|
|
72
|
-
)
|
|
73
|
-
)
|
|
74
|
-
});
|
|
75
|
-
var GraphqlError = class extends Schema_exports.TaggedError()("GraphqlError", {
|
|
76
|
-
phase: Schema_exports.Literals(["discover", "call"]),
|
|
77
|
-
reason: Schema_exports.Literals([
|
|
78
|
-
"request",
|
|
79
|
-
"unauthorized",
|
|
80
|
-
"invalid_response",
|
|
81
|
-
"invalid_input",
|
|
82
|
-
"timeout",
|
|
83
|
-
"execution"
|
|
84
|
-
]),
|
|
85
|
-
status: Schema_exports.optional(Schema_exports.Number)
|
|
86
|
-
}) {
|
|
87
|
-
};
|
|
88
|
-
var Name = Schema_exports.String.check(Schema_exports.isPattern(/^[_A-Za-z][_0-9A-Za-z]*$/));
|
|
89
|
-
var Kind = Schema_exports.Literals([
|
|
90
|
-
"SCALAR",
|
|
91
|
-
"OBJECT",
|
|
92
|
-
"INTERFACE",
|
|
93
|
-
"UNION",
|
|
94
|
-
"ENUM",
|
|
95
|
-
"INPUT_OBJECT",
|
|
96
|
-
"LIST",
|
|
97
|
-
"NON_NULL"
|
|
98
|
-
]);
|
|
99
|
-
var GraphqlTypeRef = Schema_exports.Struct({
|
|
100
|
-
kind: Kind,
|
|
101
|
-
name: Schema_exports.NullOr(Name),
|
|
102
|
-
ofType: Schema_exports.optional(Schema_exports.NullOr(Schema_exports.suspend(() => GraphqlTypeRef)))
|
|
103
|
-
});
|
|
104
|
-
var Argument = Schema_exports.Struct({
|
|
105
|
-
name: Name,
|
|
106
|
-
description: Schema_exports.NullOr(Schema_exports.String),
|
|
107
|
-
type: GraphqlTypeRef,
|
|
108
|
-
defaultValue: Schema_exports.NullOr(Schema_exports.String)
|
|
109
|
-
});
|
|
110
|
-
var GraphqlField = Schema_exports.Struct({
|
|
111
|
-
name: Name,
|
|
112
|
-
description: Schema_exports.NullOr(Schema_exports.String),
|
|
113
|
-
args: Schema_exports.Array(Argument),
|
|
114
|
-
type: GraphqlTypeRef
|
|
115
|
-
});
|
|
116
|
-
var GraphqlIntrospection = Schema_exports.Struct({
|
|
117
|
-
__schema: Schema_exports.Struct({
|
|
118
|
-
queryType: Schema_exports.NullOr(Schema_exports.Struct({ name: Name })),
|
|
119
|
-
mutationType: Schema_exports.NullOr(Schema_exports.Struct({ name: Name })),
|
|
120
|
-
types: Schema_exports.Array(
|
|
121
|
-
Schema_exports.Struct({
|
|
122
|
-
kind: Kind,
|
|
123
|
-
name: Name,
|
|
124
|
-
fields: Schema_exports.NullOr(Schema_exports.Array(GraphqlField)),
|
|
125
|
-
inputFields: Schema_exports.NullOr(Schema_exports.Array(Argument)),
|
|
126
|
-
enumValues: Schema_exports.NullOr(Schema_exports.Array(Schema_exports.Struct({ name: Name })))
|
|
127
|
-
})
|
|
128
|
-
)
|
|
129
|
-
})
|
|
130
|
-
});
|
|
131
|
-
var GraphqlResponse = Schema_exports.Struct({
|
|
132
|
-
data: Schema_exports.optional(Schema_exports.NullOr(JsonObject)),
|
|
133
|
-
errors: Schema_exports.optional(Schema_exports.Array(JsonObject))
|
|
134
|
-
});
|
|
135
|
-
var GraphqlToolDefinition = Schema_exports.Struct({
|
|
136
|
-
name: Name,
|
|
137
|
-
kind: Schema_exports.Literals(["query", "mutation"]),
|
|
138
|
-
field: Name,
|
|
139
|
-
description: Schema_exports.String,
|
|
140
|
-
arguments: Schema_exports.Array(Schema_exports.Struct({ name: Name, type: Schema_exports.String })),
|
|
141
|
-
inputSchema: JsonObject,
|
|
142
|
-
composite: Schema_exports.Boolean,
|
|
143
|
-
selection: Schema_exports.String
|
|
144
|
-
});
|
|
145
|
-
|
|
146
76
|
// src/implementation/graphql.ts
|
|
147
77
|
import {
|
|
148
78
|
getIntrospectionQuery,
|
|
149
|
-
Kind
|
|
79
|
+
Kind,
|
|
150
80
|
OperationTypeNode,
|
|
151
81
|
parse,
|
|
152
82
|
parseType,
|
|
@@ -238,14 +168,91 @@ function fieldInput(field, types) {
|
|
|
238
168
|
}
|
|
239
169
|
};
|
|
240
170
|
}
|
|
171
|
+
var ResponseError = Schema_exports.Struct({
|
|
172
|
+
message: Schema_exports.String,
|
|
173
|
+
path: Schema_exports.optional(Schema_exports.Array(Schema_exports.Union([Schema_exports.String, Schema_exports.Int]))),
|
|
174
|
+
extensions: Schema_exports.optional(Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown))
|
|
175
|
+
});
|
|
176
|
+
var boundedPath = (path) => {
|
|
177
|
+
const segments = [];
|
|
178
|
+
let length = 0;
|
|
179
|
+
for (const segment of path) {
|
|
180
|
+
if (length > maxGraphqlStatedFieldLength) break;
|
|
181
|
+
const bounded = typeof segment === "number" ? segment : boundStated(segment, maxGraphqlStatedFieldLength);
|
|
182
|
+
length += typeof bounded === "number" ? String(bounded).length + 2 : Math.max(bounded.length, 1) + (segments.length === 0 ? 0 : 1);
|
|
183
|
+
segments.push(bounded);
|
|
184
|
+
}
|
|
185
|
+
return segments;
|
|
186
|
+
};
|
|
187
|
+
var extensionEntries = (extensions) => {
|
|
188
|
+
const entries = {};
|
|
189
|
+
let count = 0;
|
|
190
|
+
for (const key of [
|
|
191
|
+
...Object.hasOwn(extensions, "code") ? ["code"] : [],
|
|
192
|
+
...Object.keys(extensions).filter((key2) => key2 !== "code")
|
|
193
|
+
]) {
|
|
194
|
+
if (count === maxGraphqlStatedExtensions) break;
|
|
195
|
+
const value = extensions[key];
|
|
196
|
+
if (!Schema_exports.is(FailureFieldName)(key)) continue;
|
|
197
|
+
if (typeof value === "string") entries[key] = boundStated(value, maxGraphqlStatedFieldLength);
|
|
198
|
+
else if (typeof value === "boolean" || typeof value === "number" && Number.isFinite(value))
|
|
199
|
+
entries[key] = value;
|
|
200
|
+
else continue;
|
|
201
|
+
count++;
|
|
202
|
+
}
|
|
203
|
+
return count === 0 ? void 0 : entries;
|
|
204
|
+
};
|
|
205
|
+
var statedErrors = (errors) => {
|
|
206
|
+
const stated = errors.slice(0, maxGraphqlStatedErrors).flatMap((error) => Option_exports.toArray(Schema_exports.decodeUnknownOption(ResponseError)(error))).map(({ message, path, extensions }) => {
|
|
207
|
+
const entries = extensions === void 0 ? void 0 : extensionEntries(extensions);
|
|
208
|
+
return {
|
|
209
|
+
message: boundStated(message, maxUpstreamMessageLength),
|
|
210
|
+
...path === void 0 || path.length === 0 ? {} : { path: boundedPath(path) },
|
|
211
|
+
...entries === void 0 ? {} : { extensions: entries }
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
return {
|
|
215
|
+
...stated.length === 0 ? {} : { errors: stated },
|
|
216
|
+
...errors.length > stated.length ? { stated: errors.length } : {}
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
var RefusedBody = Schema_exports.fromJsonString(
|
|
220
|
+
Schema_exports.Struct({ errors: Schema_exports.optional(Schema_exports.Array(Schema_exports.Unknown)) })
|
|
221
|
+
);
|
|
222
|
+
var refusedBody = (response) => Effect_exports.gen(function* () {
|
|
223
|
+
if (!/^application\/(?:[\w.-]+\+)?json$/i.test(
|
|
224
|
+
response.headers["content-type"]?.split(";")[0]?.trim() ?? ""
|
|
225
|
+
))
|
|
226
|
+
return {};
|
|
227
|
+
const length = response.headers["content-length"];
|
|
228
|
+
if (length !== void 0 && Number(length) > defaultOpenapiErrorLimits.maxBodyBytes)
|
|
229
|
+
return { unreadBody: "too_large" };
|
|
230
|
+
const text = yield* response.stream.pipe(
|
|
231
|
+
Stream_exports.mapError(() => "incomplete"),
|
|
232
|
+
Stream_exports.limitBytes(
|
|
233
|
+
defaultOpenapiErrorLimits.maxBodyBytes,
|
|
234
|
+
() => Stream_exports.fail("too_large")
|
|
235
|
+
),
|
|
236
|
+
Stream_exports.decodeText,
|
|
237
|
+
Stream_exports.mkString,
|
|
238
|
+
Effect_exports.timeoutOrElse({
|
|
239
|
+
duration: defaultOpenapiErrorLimits.readTimeoutMs,
|
|
240
|
+
orElse: () => Effect_exports.fail("incomplete")
|
|
241
|
+
}),
|
|
242
|
+
Effect_exports.result
|
|
243
|
+
);
|
|
244
|
+
if (Result_exports.isFailure(text)) return { unreadBody: text.failure };
|
|
245
|
+
const body = Schema_exports.decodeUnknownOption(RefusedBody)(text.success);
|
|
246
|
+
return Option_exports.isSome(body) && body.value.errors?.length ? statedErrors(body.value.errors) : {};
|
|
247
|
+
});
|
|
241
248
|
function selection(text) {
|
|
242
249
|
const document = parse("query { result { " + text + " } }");
|
|
243
250
|
const definition = document.definitions[0];
|
|
244
|
-
if (document.definitions.length !== 1 || definition?.kind !==
|
|
251
|
+
if (document.definitions.length !== 1 || definition?.kind !== Kind.OPERATION_DEFINITION || definition.selectionSet.selections.length !== 1) {
|
|
245
252
|
throw new GraphqlError({ phase: "call", reason: "invalid_input" });
|
|
246
253
|
}
|
|
247
254
|
const field = definition.selectionSet.selections[0];
|
|
248
|
-
if (field?.kind !==
|
|
255
|
+
if (field?.kind !== Kind.FIELD || field.name.value !== "result" || !field.selectionSet)
|
|
249
256
|
throw new GraphqlError({ phase: "call", reason: "invalid_input" });
|
|
250
257
|
return field.selectionSet;
|
|
251
258
|
}
|
|
@@ -257,52 +264,83 @@ var graphqlClientEffect = (input) => Effect_exports.gen(function* () {
|
|
|
257
264
|
if (url.username || url.password || url.hash)
|
|
258
265
|
return yield* new GraphqlError({ phase: "discover", reason: "invalid_input" });
|
|
259
266
|
const headers = Redacted_exports.make({ ...options.headers });
|
|
260
|
-
const request = (phase, query, variables = {}) => Effect_exports.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
HttpClientRequest_exports.
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
const request = (phase, query, variables = {}) => Effect_exports.gen(function* () {
|
|
268
|
+
const refusal = yield* Ref_exports.make(Option_exports.none());
|
|
269
|
+
return yield* Effect_exports.scoped(
|
|
270
|
+
Effect_exports.gen(function* () {
|
|
271
|
+
const client = yield* HttpClient_exports.HttpClient;
|
|
272
|
+
const response = yield* HttpClient_exports.withScope(client).execute(
|
|
273
|
+
HttpClientRequest_exports.post(url.href).pipe(
|
|
274
|
+
// GitHub requires this header; Workers do not supply one by default.
|
|
275
|
+
HttpClientRequest_exports.setHeader("user-agent", "Executor"),
|
|
276
|
+
HttpClientRequest_exports.setHeaders(Redacted_exports.value(headers)),
|
|
277
|
+
HttpClientRequest_exports.bodyJsonUnsafe({ query, variables })
|
|
278
|
+
)
|
|
279
|
+
);
|
|
280
|
+
yield* failOnNetworkRefusal(response);
|
|
281
|
+
if (response.status < 200 || response.status >= 300) {
|
|
282
|
+
const classified = httpProviderError(response.status, response.headers);
|
|
283
|
+
if (classified !== void 0) return yield* classified;
|
|
284
|
+
yield* Ref_exports.set(refusal, Option_exports.some(response.status));
|
|
285
|
+
const refused = yield* refusedBody(response).pipe(
|
|
286
|
+
owned("upstream", "provider.http.response.read")
|
|
287
|
+
);
|
|
288
|
+
return yield* new GraphqlError({
|
|
289
|
+
phase,
|
|
290
|
+
reason: "request",
|
|
291
|
+
status: response.status,
|
|
292
|
+
...refused
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const result = yield* response.json.pipe(
|
|
296
|
+
owned("upstream", "provider.http.response.read"),
|
|
297
|
+
Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlResponse)),
|
|
298
|
+
Effect_exports.mapError(() => new GraphqlError({ phase, reason: "invalid_response" }))
|
|
299
|
+
);
|
|
300
|
+
if (result.errors?.length)
|
|
301
|
+
return yield* graphqlProviderError(result.errors, response.status) ?? new GraphqlError({
|
|
302
|
+
phase,
|
|
303
|
+
reason: "execution",
|
|
304
|
+
status: response.status,
|
|
305
|
+
...statedErrors(result.errors)
|
|
306
|
+
});
|
|
307
|
+
if (result.data == null)
|
|
308
|
+
return yield* new GraphqlError({ phase, reason: "invalid_response" });
|
|
309
|
+
return result.data;
|
|
310
|
+
})
|
|
311
|
+
).pipe(
|
|
312
|
+
owned("upstream", "provider.graphql.request", {
|
|
313
|
+
attributes: {
|
|
314
|
+
"executor.operation": phase,
|
|
315
|
+
"server.address": url.hostname
|
|
316
|
+
}
|
|
317
|
+
}),
|
|
318
|
+
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
319
|
+
Effect_exports.provideService(FetchHttpClient_exports.Fetch, globalThis.fetch),
|
|
320
|
+
Effect_exports.provide(FetchHttpClient_exports.layer),
|
|
321
|
+
Effect_exports.timeoutOrElse({
|
|
322
|
+
duration: options.timeoutMs ?? defaultGraphqlClientLimits.timeoutMs,
|
|
323
|
+
orElse: () => Effect_exports.flatMap(
|
|
324
|
+
Ref_exports.get(refusal),
|
|
325
|
+
(status) => Effect_exports.fail(
|
|
326
|
+
Option_exports.isSome(status) ? new GraphqlError({
|
|
327
|
+
phase,
|
|
328
|
+
reason: "request",
|
|
329
|
+
status: status.value,
|
|
330
|
+
unreadBody: "incomplete"
|
|
331
|
+
}) : new GraphqlError({ phase, reason: "timeout" })
|
|
332
|
+
)
|
|
269
333
|
)
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
Effect_exports.mapError(() => new GraphqlError({ phase, reason: "invalid_response" }))
|
|
277
|
-
);
|
|
278
|
-
if (result.errors?.length)
|
|
279
|
-
return yield* graphqlProviderError(result.errors, response.status) ?? new GraphqlError({ phase, reason: "execution", status: response.status });
|
|
280
|
-
if (result.data == null)
|
|
281
|
-
return yield* new GraphqlError({ phase, reason: "invalid_response" });
|
|
282
|
-
return result.data;
|
|
283
|
-
})
|
|
284
|
-
).pipe(
|
|
285
|
-
Effect_exports.withSpan("provider.graphql.request", {
|
|
286
|
-
attributes: {
|
|
287
|
-
"executor.operation": phase,
|
|
288
|
-
"server.address": url.hostname
|
|
289
|
-
}
|
|
290
|
-
}),
|
|
291
|
-
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
292
|
-
Effect_exports.provideService(FetchHttpClient_exports.Fetch, globalThis.fetch),
|
|
293
|
-
Effect_exports.provide(FetchHttpClient_exports.layer),
|
|
294
|
-
Effect_exports.timeoutOrElse({
|
|
295
|
-
duration: options.timeoutMs ?? defaultGraphqlClientLimits.timeoutMs,
|
|
296
|
-
orElse: () => Effect_exports.fail(new GraphqlError({ phase, reason: "timeout" }))
|
|
297
|
-
}),
|
|
298
|
-
Effect_exports.mapError(
|
|
299
|
-
(error) => error instanceof ProviderError && options.accountId !== void 0 ? accountProviderError(error, options.accountId) : error instanceof GraphqlError || error instanceof ProviderError ? error : new GraphqlError({ phase, reason: "request" })
|
|
300
|
-
)
|
|
301
|
-
);
|
|
334
|
+
}),
|
|
335
|
+
Effect_exports.mapError(
|
|
336
|
+
(error) => error instanceof ProviderError && options.accountId !== void 0 ? accountProviderError(error, options.accountId) : error instanceof GraphqlError || error instanceof ProviderError || error instanceof NetworkRefused ? error : new GraphqlError({ phase, reason: "request" })
|
|
337
|
+
)
|
|
338
|
+
);
|
|
339
|
+
});
|
|
302
340
|
const discover = request("discover", getIntrospectionQuery()).pipe(
|
|
303
341
|
Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(GraphqlIntrospection)),
|
|
304
342
|
Effect_exports.mapError(
|
|
305
|
-
(error) => error instanceof GraphqlError || error instanceof ProviderError ? error : new GraphqlError({ phase: "discover", reason: "invalid_response" })
|
|
343
|
+
(error) => error instanceof GraphqlError || error instanceof ProviderError || error instanceof NetworkRefused ? error : new GraphqlError({ phase: "discover", reason: "invalid_response" })
|
|
306
344
|
)
|
|
307
345
|
);
|
|
308
346
|
return { request, discover };
|
|
@@ -364,31 +402,31 @@ var adaptGraphqlTool = (client, definition) => Effect_exports.gen(function* () {
|
|
|
364
402
|
try: () => {
|
|
365
403
|
const used = definition.arguments.filter((arg) => Object.hasOwn(variables, arg.name));
|
|
366
404
|
return print({
|
|
367
|
-
kind:
|
|
405
|
+
kind: Kind.DOCUMENT,
|
|
368
406
|
definitions: [
|
|
369
407
|
{
|
|
370
|
-
kind:
|
|
408
|
+
kind: Kind.OPERATION_DEFINITION,
|
|
371
409
|
operation: kind,
|
|
372
410
|
variableDefinitions: used.map((arg) => ({
|
|
373
|
-
kind:
|
|
411
|
+
kind: Kind.VARIABLE_DEFINITION,
|
|
374
412
|
variable: {
|
|
375
|
-
kind:
|
|
376
|
-
name: { kind:
|
|
413
|
+
kind: Kind.VARIABLE,
|
|
414
|
+
name: { kind: Kind.NAME, value: arg.name }
|
|
377
415
|
},
|
|
378
416
|
type: parseType(arg.type)
|
|
379
417
|
})),
|
|
380
418
|
selectionSet: {
|
|
381
|
-
kind:
|
|
419
|
+
kind: Kind.SELECTION_SET,
|
|
382
420
|
selections: [
|
|
383
421
|
{
|
|
384
|
-
kind:
|
|
385
|
-
name: { kind:
|
|
422
|
+
kind: Kind.FIELD,
|
|
423
|
+
name: { kind: Kind.NAME, value: definition.field },
|
|
386
424
|
arguments: used.map((arg) => ({
|
|
387
|
-
kind:
|
|
388
|
-
name: { kind:
|
|
425
|
+
kind: Kind.ARGUMENT,
|
|
426
|
+
name: { kind: Kind.NAME, value: arg.name },
|
|
389
427
|
value: {
|
|
390
|
-
kind:
|
|
391
|
-
name: { kind:
|
|
428
|
+
kind: Kind.VARIABLE,
|
|
429
|
+
name: { kind: Kind.NAME, value: arg.name }
|
|
392
430
|
}
|
|
393
431
|
})),
|
|
394
432
|
...definition.composite ? {
|
|
@@ -411,7 +449,7 @@ var adaptGraphqlTool = (client, definition) => Effect_exports.gen(function* () {
|
|
|
411
449
|
return yield* new GraphqlError({ phase: "call", reason: "invalid_response" });
|
|
412
450
|
return value;
|
|
413
451
|
}).pipe(
|
|
414
|
-
|
|
452
|
+
owned("upstream", "provider.graphql.call", {
|
|
415
453
|
attributes: {
|
|
416
454
|
"graphql.operation.type": kind,
|
|
417
455
|
"executor.tool.name": name
|
|
@@ -429,17 +467,20 @@ var GraphqlToolSummary = GraphqlToolDefinition.mapFields(({ name, kind, descript
|
|
|
429
467
|
description
|
|
430
468
|
}));
|
|
431
469
|
var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
470
|
+
const invalid = () => new GraphqlError({ phase: "discover", reason: "invalid_input" });
|
|
471
|
+
const parsed = yield* Schema_exports.decodeUnknownEffect(GraphqlToolsOptions)({
|
|
472
|
+
url: options.url,
|
|
473
|
+
accountId: options.account?.id,
|
|
474
|
+
headers: options.headers,
|
|
475
|
+
signal: options.signal,
|
|
476
|
+
timeoutMs: options.timeoutMs
|
|
477
|
+
}).pipe(Effect_exports.mapError(invalid));
|
|
478
|
+
const cache = yield* catalogScope(options, options.headers, invalid);
|
|
479
|
+
const id = yield* cacheKey({ url: parsed.url });
|
|
440
480
|
const client = yield* graphqlClientEffect(parsed);
|
|
441
481
|
const catalog = yield* catalogCache({
|
|
442
482
|
...options,
|
|
483
|
+
cache,
|
|
443
484
|
prefix: ["graphql-catalog-v2", id],
|
|
444
485
|
schema: GraphqlToolDefinition,
|
|
445
486
|
summary: {
|
|
@@ -456,7 +497,9 @@ var graphqlCatalog = (options, kinds) => Effect_exports.gen(function* () {
|
|
|
456
497
|
const summarize = (tool) => ({
|
|
457
498
|
name: tool.name,
|
|
458
499
|
description: tool.description,
|
|
459
|
-
readOnly: kindOf(tool) === "query"
|
|
500
|
+
readOnly: kindOf(tool) === "query",
|
|
501
|
+
// The app's `kinds`, or the GraphQL operation type Executor sends.
|
|
502
|
+
kindConfirmed: true
|
|
460
503
|
});
|
|
461
504
|
const describe = (tool) => ({
|
|
462
505
|
...summarize(tool),
|