@rafads/plugin-openapi 1.5.38
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 +83 -0
- package/dist/AddOpenApiIntegration-JPAEXE56.js +512 -0
- package/dist/AddOpenApiIntegration-JPAEXE56.js.map +1 -0
- package/dist/OpenApiAccountsPanel-GZFDSTAU.js +106 -0
- package/dist/OpenApiAccountsPanel-GZFDSTAU.js.map +1 -0
- package/dist/UpdateSpecSection-KUSNI44Q.js +106 -0
- package/dist/UpdateSpecSection-KUSNI44Q.js.map +1 -0
- package/dist/api/group.d.ts +239 -0
- package/dist/api/handlers.d.ts +7 -0
- package/dist/api/index.d.ts +237 -0
- package/dist/chunk-6V45G2XQ.js +199 -0
- package/dist/chunk-6V45G2XQ.js.map +1 -0
- package/dist/chunk-CURJJXB3.js +132 -0
- package/dist/chunk-CURJJXB3.js.map +1 -0
- package/dist/chunk-CXFO6TLJ.js +39 -0
- package/dist/chunk-CXFO6TLJ.js.map +1 -0
- package/dist/chunk-HTHEUUJA.js +2873 -0
- package/dist/chunk-HTHEUUJA.js.map +1 -0
- package/dist/chunk-IG6QTTZB.js +79 -0
- package/dist/chunk-IG6QTTZB.js.map +1 -0
- package/dist/chunk-O2LMSZ2Z.js +120 -0
- package/dist/chunk-O2LMSZ2Z.js.map +1 -0
- package/dist/chunk-OR27BCXQ.js +956 -0
- package/dist/chunk-OR27BCXQ.js.map +1 -0
- package/dist/chunk-R7TVM3XD.js +275 -0
- package/dist/chunk-R7TVM3XD.js.map +1 -0
- package/dist/client.js +38 -0
- package/dist/client.js.map +1 -0
- package/dist/core.js +331 -0
- package/dist/core.js.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/google/config.d.ts +34 -0
- package/dist/providers/google/discovery.d.ts +49 -0
- package/dist/providers/google/discovery.test.d.ts +1 -0
- package/dist/providers/google/index.d.ts +5 -0
- package/dist/providers/google/oauth-scopes.d.ts +3 -0
- package/dist/providers/google/oauth-scopes.test.d.ts +1 -0
- package/dist/providers/google/openapi-ownership-migration.d.ts +7 -0
- package/dist/providers/google/openapi-ownership-migration.test.d.ts +1 -0
- package/dist/providers/google/presets.d.ts +31 -0
- package/dist/providers/google/presets.test.d.ts +1 -0
- package/dist/providers/google/spec-format-adapter.d.ts +3 -0
- package/dist/providers/google/spec-format-adapter.test.d.ts +1 -0
- package/dist/providers/google.js +1446 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/microsoft/graph.d.ts +76 -0
- package/dist/providers/microsoft/graph.test.d.ts +1 -0
- package/dist/providers/microsoft/index.d.ts +3 -0
- package/dist/providers/microsoft/presets.d.ts +46 -0
- package/dist/providers/microsoft/presets.test.d.ts +1 -0
- package/dist/providers/microsoft/spec-format-adapter.d.ts +2 -0
- package/dist/providers/microsoft/spec-format-adapter.test.d.ts +1 -0
- package/dist/providers/microsoft.js +1056 -0
- package/dist/providers/microsoft.js.map +1 -0
- package/dist/react/AddOpenApiIntegration.d.ts +22 -0
- package/dist/react/AddOpenApiIntegration.test.d.ts +1 -0
- package/dist/react/OpenApiAccountsPanel.d.ts +6 -0
- package/dist/react/OpenApiIntegrationDetailsFields.d.ts +25 -0
- package/dist/react/UpdateSpecSection.d.ts +2 -0
- package/dist/react/atoms.d.ts +317 -0
- package/dist/react/auth-method-config.d.ts +18 -0
- package/dist/react/auth-method-config.test.d.ts +1 -0
- package/dist/react/client.d.ts +233 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/integration-plugin.d.ts +6 -0
- package/dist/react/plugin-client.d.ts +2 -0
- package/dist/sdk/backing.d.ts +188 -0
- package/dist/sdk/client-credentials-oauth.test.d.ts +1 -0
- package/dist/sdk/compiled-spec-cache.test.d.ts +1 -0
- package/dist/sdk/config.d.ts +81 -0
- package/dist/sdk/configure.test.d.ts +1 -0
- package/dist/sdk/definitions.d.ts +57 -0
- package/dist/sdk/derive-auth.d.ts +11 -0
- package/dist/sdk/describe-auth-methods.test.d.ts +1 -0
- package/dist/sdk/errors.d.ts +45 -0
- package/dist/sdk/extract.d.ts +157 -0
- package/dist/sdk/extract.test.d.ts +1 -0
- package/dist/sdk/form-urlencoded-body.test.d.ts +1 -0
- package/dist/sdk/index.d.ts +19 -0
- package/dist/sdk/index.test.d.ts +1 -0
- package/dist/sdk/invoke.d.ts +150 -0
- package/dist/sdk/migrate-config.d.ts +4 -0
- package/dist/sdk/migrate-config.test.d.ts +1 -0
- package/dist/sdk/multi-scope-bearer.test.d.ts +1 -0
- package/dist/sdk/multi-scope-oauth.test.d.ts +1 -0
- package/dist/sdk/ndjson-output-migration.d.ts +13 -0
- package/dist/sdk/ndjson-output-migration.test.d.ts +1 -0
- package/dist/sdk/non-json-body.test.d.ts +1 -0
- package/dist/sdk/oauth-refresh.test.d.ts +1 -0
- package/dist/sdk/openapi-utils.d.ts +65 -0
- package/dist/sdk/output-schema-migration.d.ts +21 -0
- package/dist/sdk/output-schema-migration.test.d.ts +1 -0
- package/dist/sdk/parse.d.ts +33 -0
- package/dist/sdk/parse.test.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +109 -0
- package/dist/sdk/plugin.test.d.ts +1 -0
- package/dist/sdk/presets.d.ts +15 -0
- package/dist/sdk/preview-oauth2.test.d.ts +1 -0
- package/dist/sdk/preview.d.ts +514 -0
- package/dist/sdk/query-serialization.test.d.ts +1 -0
- package/dist/sdk/real-specs.test.d.ts +1 -0
- package/dist/sdk/request-user-agent.test.d.ts +1 -0
- package/dist/sdk/response-headers-timeout.test.d.ts +1 -0
- package/dist/sdk/server-url-resolution.test.d.ts +1 -0
- package/dist/sdk/spec-blob-migration.d.ts +7 -0
- package/dist/sdk/spec-blob.test.d.ts +1 -0
- package/dist/sdk/spec-format.d.ts +36 -0
- package/dist/sdk/spec-format.test.d.ts +1 -0
- package/dist/sdk/split.d.ts +84 -0
- package/dist/sdk/store.d.ts +49 -0
- package/dist/sdk/store.test.d.ts +1 -0
- package/dist/sdk/streaming-response.test.d.ts +1 -0
- package/dist/sdk/tool-row-projection.test.d.ts +1 -0
- package/dist/sdk/types.d.ts +352 -0
- package/dist/sdk/upstream-failures.test.d.ts +1 -0
- package/dist/sdk/usage-scope-isolation.test.d.ts +1 -0
- package/dist/testing/index.d.ts +177 -0
- package/dist/testing.js +454 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.test.d.ts +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
export declare const OpenApiClient: import("effect/unstable/reactivity/AtomHttpApi").AtomHttpApiClient<"Plugin_openapiClient", `Plugin_${string}Client`, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"openapi", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"previewSpec", "POST", "/openapi/preview", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
2
|
+
readonly spec: import("effect/Schema").String;
|
|
3
|
+
readonly specFormat: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
5
|
+
readonly title: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
6
|
+
readonly description: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
7
|
+
readonly version: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
8
|
+
readonly servers: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
9
|
+
readonly url: import("effect/Schema").String;
|
|
10
|
+
readonly description: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
11
|
+
readonly variables: import("effect/Schema").OptionFromOptional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
12
|
+
readonly default: import("effect/Schema").String;
|
|
13
|
+
readonly enum: import("effect/Schema").OptionFromOptional<import("effect/Schema").$Array<import("effect/Schema").String>>;
|
|
14
|
+
readonly description: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
15
|
+
}>>>;
|
|
16
|
+
}>>;
|
|
17
|
+
readonly operationCount: import("effect/Schema").Number;
|
|
18
|
+
readonly tags: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
19
|
+
readonly securitySchemes: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
20
|
+
readonly name: import("effect/Schema").String;
|
|
21
|
+
readonly type: import("effect/Schema").Literals<readonly ["http", "apiKey", "oauth2", "openIdConnect"]>;
|
|
22
|
+
readonly scheme: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
23
|
+
readonly bearerFormat: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
24
|
+
readonly in: import("effect/Schema").OptionFromOptional<import("effect/Schema").Literals<readonly ["header", "query", "cookie"]>>;
|
|
25
|
+
readonly headerName: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
26
|
+
readonly description: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
27
|
+
readonly flows: import("effect/Schema").OptionFromOptional<import("effect/Schema").Struct<{
|
|
28
|
+
readonly authorizationCode: import("effect/Schema").OptionFromOptional<import("effect/Schema").Struct<{
|
|
29
|
+
readonly authorizationUrl: import("effect/Schema").String;
|
|
30
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
31
|
+
readonly refreshUrl: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
32
|
+
readonly scopes: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>;
|
|
33
|
+
}>>;
|
|
34
|
+
readonly clientCredentials: import("effect/Schema").OptionFromOptional<import("effect/Schema").Struct<{
|
|
35
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
36
|
+
readonly refreshUrl: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
37
|
+
readonly scopes: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>;
|
|
38
|
+
}>>;
|
|
39
|
+
}>>;
|
|
40
|
+
readonly openIdConnectUrl: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
41
|
+
}>>;
|
|
42
|
+
readonly authStrategies: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
43
|
+
readonly schemes: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
44
|
+
}>>;
|
|
45
|
+
readonly headerPresets: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
46
|
+
readonly label: import("effect/Schema").String;
|
|
47
|
+
readonly headers: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
48
|
+
readonly secretHeaders: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
49
|
+
}>>;
|
|
50
|
+
readonly oauth2Presets: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
51
|
+
readonly label: import("effect/Schema").String;
|
|
52
|
+
readonly securitySchemeName: import("effect/Schema").String;
|
|
53
|
+
readonly flow: import("effect/Schema").Literals<readonly ["authorizationCode", "clientCredentials"]>;
|
|
54
|
+
readonly authorizationUrl: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
55
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
56
|
+
readonly resource: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
57
|
+
readonly refreshUrl: import("effect/Schema").OptionFromOptional<import("effect/Schema").String>;
|
|
58
|
+
readonly scopes: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>;
|
|
59
|
+
readonly identityScopes: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"auto">, import("effect/Schema").Literal<false>, import("effect/Schema").$Array<import("effect/Schema").String>]>;
|
|
60
|
+
readonly supportsClientIdMetadataDocument: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
61
|
+
}>>;
|
|
62
|
+
readonly healthCheckCandidates: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
63
|
+
readonly operation: import("effect/Schema").String;
|
|
64
|
+
readonly method: import("effect/Schema").String;
|
|
65
|
+
readonly requiredArgCount: import("effect/Schema").Number;
|
|
66
|
+
readonly destructive: import("effect/Schema").Boolean;
|
|
67
|
+
readonly summary: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
68
|
+
readonly parameters: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
69
|
+
readonly name: import("effect/Schema").String;
|
|
70
|
+
readonly location: import("effect/Schema").String;
|
|
71
|
+
readonly required: import("effect/Schema").Boolean;
|
|
72
|
+
readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
73
|
+
}>>>;
|
|
74
|
+
readonly responseFields: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
75
|
+
readonly path: import("effect/Schema").String;
|
|
76
|
+
readonly type: import("effect/Schema").String;
|
|
77
|
+
}>>>;
|
|
78
|
+
}>>;
|
|
79
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/sdk").IntegrationAlreadyExistsError | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"addSpec", "POST", "/openapi/specs", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
80
|
+
readonly spec: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
81
|
+
readonly kind: import("effect/Schema").Literal<"url">;
|
|
82
|
+
readonly url: import("effect/Schema").String;
|
|
83
|
+
}>, import("effect/Schema").Struct<{
|
|
84
|
+
readonly kind: import("effect/Schema").Literal<"blob">;
|
|
85
|
+
readonly value: import("effect/Schema").String;
|
|
86
|
+
}>]>;
|
|
87
|
+
readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
88
|
+
readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
89
|
+
readonly description: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
90
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
91
|
+
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
92
|
+
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
93
|
+
readonly specFormat: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
94
|
+
readonly family: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
95
|
+
readonly healthCheck: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
96
|
+
readonly operation: import("effect/Schema").String;
|
|
97
|
+
readonly args: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>;
|
|
98
|
+
readonly identityField: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
99
|
+
}>>;
|
|
100
|
+
readonly authenticationTemplate: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
101
|
+
readonly slug: import("effect/Schema").String;
|
|
102
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
103
|
+
readonly authorizationUrl: import("effect/Schema").String;
|
|
104
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
105
|
+
readonly resource: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
106
|
+
readonly scopes: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
107
|
+
readonly supportsClientIdMetadataDocument: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
108
|
+
}>, import("effect/Schema").Struct<{
|
|
109
|
+
readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
110
|
+
readonly type: import("effect/Schema").Literal<"apiKey">;
|
|
111
|
+
readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
112
|
+
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
113
|
+
readonly type: import("effect/Schema").Literal<"variable">;
|
|
114
|
+
readonly name: import("effect/Schema").String;
|
|
115
|
+
}>]>>]>>>;
|
|
116
|
+
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
117
|
+
readonly type: import("effect/Schema").Literal<"variable">;
|
|
118
|
+
readonly name: import("effect/Schema").String;
|
|
119
|
+
}>]>>]>>>;
|
|
120
|
+
}>]>>>;
|
|
121
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
122
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
123
|
+
readonly toolCount: import("effect/Schema").Number;
|
|
124
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/sdk").IntegrationAlreadyExistsError | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getIntegration", "GET", "/openapi/integrations/:slug", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
125
|
+
slug: import("effect/Schema").String;
|
|
126
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
127
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
128
|
+
readonly description: import("effect/Schema").String;
|
|
129
|
+
readonly kind: import("effect/Schema").String;
|
|
130
|
+
readonly canRemove: import("effect/Schema").Boolean;
|
|
131
|
+
readonly canRefresh: import("effect/Schema").Boolean;
|
|
132
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/sdk").IntegrationAlreadyExistsError | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getConfig", "GET", "/openapi/integrations/:slug/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
133
|
+
slug: import("effect/Schema").String;
|
|
134
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
135
|
+
readonly specUrl: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
136
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
137
|
+
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
138
|
+
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
|
|
139
|
+
readonly authenticationTemplate: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
140
|
+
readonly slug: import("effect/Schema").String;
|
|
141
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
142
|
+
readonly authorizationUrl: import("effect/Schema").String;
|
|
143
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
144
|
+
readonly resource: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
145
|
+
readonly scopes: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
146
|
+
readonly supportsClientIdMetadataDocument: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
147
|
+
}>, import("effect/Schema").Struct<{
|
|
148
|
+
readonly slug: import("effect/Schema").String;
|
|
149
|
+
readonly kind: import("effect/Schema").Literal<"apikey">;
|
|
150
|
+
readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
151
|
+
readonly placements: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
152
|
+
readonly carrier: import("effect/Schema").Literals<readonly ["header", "query"]>;
|
|
153
|
+
readonly name: import("effect/Schema").String;
|
|
154
|
+
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
155
|
+
readonly variable: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
156
|
+
readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
157
|
+
}>>;
|
|
158
|
+
}>]>>>;
|
|
159
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/sdk").IntegrationAlreadyExistsError | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"configure", "POST", "/openapi/integrations/:slug/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
160
|
+
slug: import("effect/Schema").String;
|
|
161
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
162
|
+
readonly authenticationTemplate: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
163
|
+
readonly slug: import("effect/Schema").String;
|
|
164
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
165
|
+
readonly authorizationUrl: import("effect/Schema").String;
|
|
166
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
167
|
+
readonly resource: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
168
|
+
readonly scopes: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
169
|
+
readonly supportsClientIdMetadataDocument: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
170
|
+
}>, import("effect/Schema").Struct<{
|
|
171
|
+
readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
172
|
+
readonly type: import("effect/Schema").Literal<"apiKey">;
|
|
173
|
+
readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
174
|
+
readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
175
|
+
readonly type: import("effect/Schema").Literal<"variable">;
|
|
176
|
+
readonly name: import("effect/Schema").String;
|
|
177
|
+
}>]>>]>>>;
|
|
178
|
+
readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
|
|
179
|
+
readonly type: import("effect/Schema").Literal<"variable">;
|
|
180
|
+
readonly name: import("effect/Schema").String;
|
|
181
|
+
}>]>>]>>>;
|
|
182
|
+
}>]>>>;
|
|
183
|
+
readonly mode: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["merge", "replace"]>>;
|
|
184
|
+
readonly baseUrl: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
185
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
186
|
+
readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
187
|
+
readonly slug: import("effect/Schema").String;
|
|
188
|
+
readonly kind: import("effect/Schema").Literal<"oauth2">;
|
|
189
|
+
readonly authorizationUrl: import("effect/Schema").String;
|
|
190
|
+
readonly tokenUrl: import("effect/Schema").String;
|
|
191
|
+
readonly resource: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
192
|
+
readonly scopes: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
193
|
+
readonly supportsClientIdMetadataDocument: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
194
|
+
}>, import("effect/Schema").Struct<{
|
|
195
|
+
readonly slug: import("effect/Schema").String;
|
|
196
|
+
readonly kind: import("effect/Schema").Literal<"apikey">;
|
|
197
|
+
readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
198
|
+
readonly placements: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
199
|
+
readonly carrier: import("effect/Schema").Literals<readonly ["header", "query"]>;
|
|
200
|
+
readonly name: import("effect/Schema").String;
|
|
201
|
+
readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
202
|
+
readonly variable: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
203
|
+
readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
204
|
+
}>>;
|
|
205
|
+
}>]>>;
|
|
206
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/sdk").IntegrationAlreadyExistsError | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"updateSpec", "POST", "/openapi/integrations/:slug/spec", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
207
|
+
slug: import("effect/Schema").String;
|
|
208
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
209
|
+
readonly spec: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
210
|
+
readonly kind: import("effect/Schema").Literal<"url">;
|
|
211
|
+
readonly url: import("effect/Schema").String;
|
|
212
|
+
}>, import("effect/Schema").Struct<{
|
|
213
|
+
readonly kind: import("effect/Schema").Literal<"blob">;
|
|
214
|
+
readonly value: import("effect/Schema").String;
|
|
215
|
+
}>]>>;
|
|
216
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
217
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
218
|
+
readonly toolCount: import("effect/Schema").Number;
|
|
219
|
+
readonly addedTools: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
220
|
+
readonly removedTools: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
221
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").decodeTo<import("effect/Schema").declareConstructor<import("@rafads/sdk").IntegrationNotFoundError, {
|
|
222
|
+
readonly _tag: "IntegrationNotFoundError";
|
|
223
|
+
readonly slug: string;
|
|
224
|
+
}, readonly [import("effect/Schema").TaggedStruct<"IntegrationNotFoundError", {
|
|
225
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
226
|
+
}>], {
|
|
227
|
+
readonly _tag: "IntegrationNotFoundError";
|
|
228
|
+
readonly slug: string & import("effect/Brand").Brand<"IntegrationSlug">;
|
|
229
|
+
}>, import("effect/Schema").TaggedStruct<"IntegrationNotFoundError", {
|
|
230
|
+
readonly slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
|
|
231
|
+
}>, never, never> | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"removeSpec", "DELETE", "/openapi/integrations/:slug", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
232
|
+
slug: import("effect/Schema").String;
|
|
233
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Void>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@rafads/sdk").IntegrationAlreadyExistsError | typeof import("@rafads/sdk").InternalError | typeof import("../sdk").OpenApiParseError | typeof import("../sdk").OpenApiExtractionError | typeof import("../sdk").OpenApiOAuthError>, never, never>, false>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { openApiIntegrationPlugin } from "./integration-plugin";
|
|
2
|
+
export { OpenApiClient } from "./client";
|
|
3
|
+
export { OpenApiIntegrationDetailsFields } from "./OpenApiIntegrationDetailsFields";
|
|
4
|
+
export { authenticationFromEditorValue, authMethodsFromConfig, editorValueFromAuthentication, openApiWireAuthInput, placementsFromApiKey, templateFromPlacements, } from "./auth-method-config";
|
|
5
|
+
export { previewOpenApiSpec, addOpenApiSpec, removeOpenApiSpec, openapiConfigure, openApiConfigAtom, openApiConfigFamily, openApiIntegrationAtom, openApiIntegrationFamily, } from "./atoms";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IntegrationPlugin, IntegrationPreset } from "@rafads/sdk/client";
|
|
2
|
+
export interface OpenApiClientConfig {
|
|
3
|
+
readonly presets?: readonly IntegrationPreset[];
|
|
4
|
+
}
|
|
5
|
+
export declare const createOpenApiIntegrationPlugin: (config?: OpenApiClientConfig) => IntegrationPlugin;
|
|
6
|
+
export declare const openApiIntegrationPlugin: IntegrationPlugin;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { Layer } from "effect";
|
|
3
|
+
import { HttpClient } from "effect/unstable/http";
|
|
4
|
+
import { type HealthCheckCandidate, type HealthCheckResult, type HealthCheckSpec, type IntegrationRecord, type PluginCtx, type ResolveToolsResult, type StorageFailure, type ToolDef, type ToolInvocationCredential } from "@rafads/sdk/core";
|
|
5
|
+
import { type OpenApiIntegrationConfig } from "./config";
|
|
6
|
+
import { OpenApiExtractionError, OpenApiInvocationError, OpenApiParseError } from "./errors";
|
|
7
|
+
import { type ToolDefinition } from "./definitions";
|
|
8
|
+
import { type InvokeOptions } from "./invoke";
|
|
9
|
+
import { type ParsedDocument } from "./parse";
|
|
10
|
+
import { type KeepPathItem, type SpecStructure } from "./split";
|
|
11
|
+
import { type OpenapiStore, type StoredOperation } from "./store";
|
|
12
|
+
export declare const extractOpenApiUpstreamMessage: (body: unknown, status: number) => string;
|
|
13
|
+
/** Rewrite OpenAPI `#/components/schemas/X` refs to standard `#/$defs/X`. */
|
|
14
|
+
export declare const normalizeOpenApiRefs: (node: unknown) => unknown;
|
|
15
|
+
export interface CompiledOpenApiSpec {
|
|
16
|
+
readonly definitions: readonly ToolDefinition[];
|
|
17
|
+
readonly hoistedDefs: Record<string, unknown>;
|
|
18
|
+
readonly title: string | undefined;
|
|
19
|
+
readonly description: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare const compileOpenApiDocument: (doc: ParsedDocument) => Effect.Effect<CompiledOpenApiSpec, OpenApiExtractionError>;
|
|
22
|
+
export declare const compileOpenApiSpec: (specText: string) => Effect.Effect<CompiledOpenApiSpec, OpenApiParseError | OpenApiExtractionError>;
|
|
23
|
+
/** Test-only reset so unit tests can observe cold-cache behavior. */
|
|
24
|
+
export declare const clearCompiledOpenApiSpecCache: () => void;
|
|
25
|
+
/** Compile through the module-level LRU. `specHash` is the content hash the
|
|
26
|
+
* spec text was loaded by (`OpenApiIntegrationConfig.specHash`). A missing
|
|
27
|
+
* hash (legacy config shape) bypasses the cache rather than paying to hash
|
|
28
|
+
* multi-MB text on the request path. */
|
|
29
|
+
export declare const compileOpenApiSpecCached: (specHash: string | null | undefined, specText: string) => Effect.Effect<CompiledOpenApiSpec, OpenApiParseError | OpenApiExtractionError>;
|
|
30
|
+
export declare const openApiToolDefsFromCompiled: (compiled: CompiledOpenApiSpec) => readonly ToolDef[];
|
|
31
|
+
export declare const openApiStoredOperationsFromCompiled: (integration: string, compiled: CompiledOpenApiSpec) => readonly StoredOperation[];
|
|
32
|
+
/**
|
|
33
|
+
* Serialize a document's `components.schemas` into the content-addressed defs
|
|
34
|
+
* blob JSON (`{ "<Name>": <normalized schema>, ... }`), one schema at a time.
|
|
35
|
+
* Normalizing + stringifying per entry keeps the whole normalized definition
|
|
36
|
+
* tree from ever being co-resident with the parsed document, so the streaming
|
|
37
|
+
* add path's peak stays near parse level. The serve path JSON-parses this blob
|
|
38
|
+
* to rebuild the shared `definitions` instead of re-parsing the spec.
|
|
39
|
+
*/
|
|
40
|
+
export declare const buildDefsJson: (doc: ParsedDocument) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Streaming twin of `buildDefsJson`: serialize the content-addressed defs blob
|
|
43
|
+
* from a `SpecStructure` by parsing each `components.schemas` entry in isolation
|
|
44
|
+
* (indent-4 range) rather than from a whole-document parse. Used by the fully
|
|
45
|
+
* streaming add path so the 37MB Microsoft Graph spec never builds its
|
|
46
|
+
* ~300MB tree. The blob carries *all* source schemas (it is shared across every
|
|
47
|
+
* tenant/selection on the same spec hash); extra unreferenced `$defs` are
|
|
48
|
+
* harmless. Like `buildDefsJson`, normalizing + stringifying per entry keeps the
|
|
49
|
+
* whole normalized tree from being co-resident with any parsed schema, and the
|
|
50
|
+
* ConsString accumulation avoids the join-doubling of an array build.
|
|
51
|
+
*/
|
|
52
|
+
export declare const buildDefsJsonStreaming: (structure: SpecStructure) => string;
|
|
53
|
+
export interface OpenApiPersistResult {
|
|
54
|
+
readonly toolCount: number;
|
|
55
|
+
readonly toolNames: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Compile a parsed document straight to persisted operation bindings, streaming
|
|
59
|
+
* in bounded chunks so a huge spec's bindings are never all co-resident with
|
|
60
|
+
* the parsed tree. This is the memory-safe replacement for
|
|
61
|
+
* `compileOpenApiDocument` + `openApiStoredOperationsFromCompiled` + `putOperations`
|
|
62
|
+
* on the add/update path: it skips per-op input/output schema assembly (the
|
|
63
|
+
* serve path rebuilds those on demand from the bindings). Clears existing
|
|
64
|
+
* operations first, then appends each chunk. When `specHash` is given, also
|
|
65
|
+
* stream-serializes the document's `#/$defs/*` into the content-addressed defs
|
|
66
|
+
* blob so the serve path can resolve the shared `definitions` without
|
|
67
|
+
* re-parsing the spec.
|
|
68
|
+
*/
|
|
69
|
+
export declare const compileAndPersistOpenApiOperations: ({ doc, integration, storage, specHash, chunkSize, }: {
|
|
70
|
+
readonly doc: ParsedDocument;
|
|
71
|
+
readonly integration: string;
|
|
72
|
+
readonly storage: OpenapiStore;
|
|
73
|
+
readonly specHash?: string;
|
|
74
|
+
readonly chunkSize?: number;
|
|
75
|
+
}) => Effect.Effect<OpenApiPersistResult, OpenApiExtractionError | StorageFailure>;
|
|
76
|
+
/** Parse spec text, then stream-compile + persist its bindings (and, when
|
|
77
|
+
* `specHash` is given, the content-addressed defs blob). */
|
|
78
|
+
export declare const compileAndPersistOpenApiSpec: ({ specText, integration, storage, specHash, chunkSize, }: {
|
|
79
|
+
readonly specText: string;
|
|
80
|
+
readonly integration: string;
|
|
81
|
+
readonly storage: OpenapiStore;
|
|
82
|
+
readonly specHash?: string;
|
|
83
|
+
readonly chunkSize?: number;
|
|
84
|
+
}) => Effect.Effect<OpenApiPersistResult, OpenApiParseError | OpenApiExtractionError | StorageFailure>;
|
|
85
|
+
/**
|
|
86
|
+
* Fully streaming add/update path: compile + persist operation bindings (and the
|
|
87
|
+
* content-addressed defs blob) straight from spec *text*, without ever parsing
|
|
88
|
+
* the whole document. The text is structurally split, then each path-item and
|
|
89
|
+
* each schema is parsed in isolation and discarded, so peak memory stays near
|
|
90
|
+
* one item rather than the ~300MB whole-tree parse that OOMs a 128MB Workers
|
|
91
|
+
* isolate on the 37MB Microsoft Graph spec.
|
|
92
|
+
*
|
|
93
|
+
* There is deliberately no whole-parse fallback: a spec that does not present
|
|
94
|
+
* the streamable block-YAML profile (no top-level `paths:` block) is a hard
|
|
95
|
+
* `OpenApiExtractionError`, because the fallback is exactly the OOM this path
|
|
96
|
+
* exists to avoid. `keepPathItem` optionally filters/trims path-items (the
|
|
97
|
+
* Microsoft Graph scope selection), so the same primitive serves a full-spec
|
|
98
|
+
* compile and a selection identically.
|
|
99
|
+
*/
|
|
100
|
+
export declare const compileAndPersistOpenApiSpecStreaming: ({ specText, integration, storage, specHash, chunkSize, keepPathItem, }: {
|
|
101
|
+
readonly specText: string;
|
|
102
|
+
readonly integration: string;
|
|
103
|
+
readonly storage: OpenapiStore;
|
|
104
|
+
readonly specHash?: string;
|
|
105
|
+
readonly chunkSize?: number;
|
|
106
|
+
readonly keepPathItem?: KeepPathItem;
|
|
107
|
+
}) => Effect.Effect<OpenApiPersistResult, OpenApiExtractionError | StorageFailure>;
|
|
108
|
+
export declare const loadOpenApiSpecText: (storage: OpenapiStore, config: OpenApiIntegrationConfig) => Effect.Effect<string | null, StorageFailure>;
|
|
109
|
+
/**
|
|
110
|
+
* Resolve the tool defs + shared definitions for a connection refresh
|
|
111
|
+
* (`tools/list`). Fast path: serve from the persisted operation bindings plus
|
|
112
|
+
* the content-addressed defs blob, rebuilding each tool's input/output schema
|
|
113
|
+
* on demand, so a 37MB spec is never re-parsed (the 2nd OOM site). The defs
|
|
114
|
+
* blob is global per `specHash`, so the heavy normalize work is done once at
|
|
115
|
+
* add time and shared across every tenant on the same spec. Falls back to the
|
|
116
|
+
* spec re-parse for legacy rows persisted before the defs blob existed (or if
|
|
117
|
+
* the blob is missing/corrupt).
|
|
118
|
+
*/
|
|
119
|
+
export declare const resolveOpenApiBackedTools: ({ integration, config, storage, }: {
|
|
120
|
+
readonly integration: {
|
|
121
|
+
readonly slug: string;
|
|
122
|
+
};
|
|
123
|
+
readonly config: unknown;
|
|
124
|
+
readonly storage: OpenapiStore;
|
|
125
|
+
}) => Effect.Effect<ResolveToolsResult, StorageFailure>;
|
|
126
|
+
export declare const invokeOpenApiBackedTool: (input: {
|
|
127
|
+
readonly ctx: PluginCtx<OpenapiStore>;
|
|
128
|
+
readonly toolRow: {
|
|
129
|
+
readonly integration: string;
|
|
130
|
+
readonly name: string;
|
|
131
|
+
};
|
|
132
|
+
readonly credential: ToolInvocationCredential;
|
|
133
|
+
readonly args: unknown;
|
|
134
|
+
readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>;
|
|
135
|
+
readonly invokeOptions?: InvokeOptions;
|
|
136
|
+
}) => Effect.Effect<{
|
|
137
|
+
readonly ok: false;
|
|
138
|
+
readonly error: import("@rafads/sdk/core").ToolError;
|
|
139
|
+
} | {
|
|
140
|
+
readonly ok: true;
|
|
141
|
+
readonly data: unknown;
|
|
142
|
+
readonly http?: import("@rafads/sdk/core").ToolHttpMeta;
|
|
143
|
+
}, StorageFailure | OpenApiExtractionError | OpenApiInvocationError, never>;
|
|
144
|
+
/** Pre-approval argument validation: run the exact request-building pass
|
|
145
|
+
* `invoke` runs (path params, request body, base64 payloads) and discard the
|
|
146
|
+
* built request. Fails with the same pre-flight OpenApiInvocationError the
|
|
147
|
+
* real invocation would raise, so a call guaranteed to fail is rejected
|
|
148
|
+
* before the executor pauses it for approval. Legacy rows without a
|
|
149
|
+
* persisted binding skip validation (re-parsing the spec here would repeat
|
|
150
|
+
* invokeTool's heavy fallback for no user-visible gain). */
|
|
151
|
+
export declare const validateOpenApiBackedToolArgs: (input: {
|
|
152
|
+
readonly ctx: PluginCtx<OpenapiStore>;
|
|
153
|
+
readonly toolRow: {
|
|
154
|
+
readonly integration: string;
|
|
155
|
+
readonly name: string;
|
|
156
|
+
};
|
|
157
|
+
readonly args: unknown;
|
|
158
|
+
}) => Effect.Effect<void, StorageFailure | OpenApiInvocationError, never>;
|
|
159
|
+
export declare const resolveOpenApiBackedAnnotations: (input: {
|
|
160
|
+
readonly ctx: PluginCtx<OpenapiStore>;
|
|
161
|
+
readonly integration: string;
|
|
162
|
+
readonly toolRows: readonly {
|
|
163
|
+
readonly name: string;
|
|
164
|
+
}[];
|
|
165
|
+
}) => Effect.Effect<Record<string, {
|
|
166
|
+
requiresApproval?: boolean;
|
|
167
|
+
approvalDescription?: string;
|
|
168
|
+
}>, StorageFailure, never>;
|
|
169
|
+
/** Run the given probe against a resolved credential and classify the outcome.
|
|
170
|
+
* The spec is resolved by CORE (its own storage) and passed in; this never
|
|
171
|
+
* reads it from the plugin config. Never fails for credential/upstream
|
|
172
|
+
* reasons: a rejected credential is a `HealthCheckResult` with
|
|
173
|
+
* `status: "expired"`, not an error. */
|
|
174
|
+
export declare const checkHealthOpenApi: (input: {
|
|
175
|
+
readonly ctx: PluginCtx<OpenapiStore>;
|
|
176
|
+
readonly integration: IntegrationRecord;
|
|
177
|
+
readonly credential: ToolInvocationCredential;
|
|
178
|
+
readonly spec?: HealthCheckSpec;
|
|
179
|
+
readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>;
|
|
180
|
+
}) => Effect.Effect<HealthCheckResult, StorageFailure>;
|
|
181
|
+
/** List the operations a user can pick as the health check, ranked
|
|
182
|
+
* non-destructive-first then fewest-required-args so the obvious "GET /me"
|
|
183
|
+
* identity endpoint floats to the top. Recompiles the spec once (best-effort)
|
|
184
|
+
* to recover human summaries the stored binding does not keep. */
|
|
185
|
+
export declare const listHealthCheckCandidatesOpenApi: (input: {
|
|
186
|
+
readonly ctx: PluginCtx<OpenapiStore>;
|
|
187
|
+
readonly integration: IntegrationRecord;
|
|
188
|
+
}) => Effect.Effect<readonly HealthCheckCandidate[], StorageFailure>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { Authentication } from "./types";
|
|
3
|
+
export declare const AuthenticationSchema: Schema.Union<readonly [Schema.Struct<{
|
|
4
|
+
readonly slug: Schema.String;
|
|
5
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
6
|
+
readonly authorizationUrl: Schema.String;
|
|
7
|
+
readonly tokenUrl: Schema.String;
|
|
8
|
+
readonly resource: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
9
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
10
|
+
readonly supportsClientIdMetadataDocument: Schema.optional<Schema.Boolean>;
|
|
11
|
+
}>, Schema.Struct<{
|
|
12
|
+
readonly slug: Schema.String;
|
|
13
|
+
readonly kind: Schema.Literal<"apikey">;
|
|
14
|
+
readonly label: Schema.optional<Schema.String>;
|
|
15
|
+
readonly placements: Schema.$Array<Schema.Struct<{
|
|
16
|
+
readonly carrier: Schema.Literals<readonly ["header", "query"]>;
|
|
17
|
+
readonly name: Schema.String;
|
|
18
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
19
|
+
readonly variable: Schema.optional<Schema.String>;
|
|
20
|
+
readonly literal: Schema.optional<Schema.String>;
|
|
21
|
+
}>>;
|
|
22
|
+
}>]>;
|
|
23
|
+
export declare const OpenApiIntegrationConfigSchema: Schema.Struct<{
|
|
24
|
+
/** Hex SHA-256 of the resolved spec text — the content address of the spec
|
|
25
|
+
* blob (`spec/<hash>` in the plugin blob store). */
|
|
26
|
+
readonly specHash: Schema.optional<Schema.String>;
|
|
27
|
+
/** Origin URL the spec was fetched from, when known. Enables refresh. */
|
|
28
|
+
readonly specUrl: Schema.optional<Schema.String>;
|
|
29
|
+
/** Optional base URL override. */
|
|
30
|
+
readonly baseUrl: Schema.optional<Schema.String>;
|
|
31
|
+
/** Static headers applied to every request (no secret material). */
|
|
32
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
33
|
+
/** Static query params applied to every request (no secret material). */
|
|
34
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
35
|
+
/** Adapter id used to fetch/convert the source format, when not plain OpenAPI. */
|
|
36
|
+
readonly specFormat: Schema.optional<Schema.String>;
|
|
37
|
+
/** Catalog family for grouped integration display. */
|
|
38
|
+
readonly family: Schema.optional<Schema.String>;
|
|
39
|
+
/** The auth methods a connection's value can be applied through. */
|
|
40
|
+
readonly authenticationTemplate: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
41
|
+
readonly slug: Schema.String;
|
|
42
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
43
|
+
readonly authorizationUrl: Schema.String;
|
|
44
|
+
readonly tokenUrl: Schema.String;
|
|
45
|
+
readonly resource: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
46
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
47
|
+
readonly supportsClientIdMetadataDocument: Schema.optional<Schema.Boolean>;
|
|
48
|
+
}>, Schema.Struct<{
|
|
49
|
+
readonly slug: Schema.String;
|
|
50
|
+
readonly kind: Schema.Literal<"apikey">;
|
|
51
|
+
readonly label: Schema.optional<Schema.String>;
|
|
52
|
+
readonly placements: Schema.$Array<Schema.Struct<{
|
|
53
|
+
readonly carrier: Schema.Literals<readonly ["header", "query"]>;
|
|
54
|
+
readonly name: Schema.String;
|
|
55
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
56
|
+
readonly variable: Schema.optional<Schema.String>;
|
|
57
|
+
readonly literal: Schema.optional<Schema.String>;
|
|
58
|
+
}>>;
|
|
59
|
+
}>]>>>;
|
|
60
|
+
}>;
|
|
61
|
+
export type OpenApiIntegrationConfig = Omit<typeof OpenApiIntegrationConfigSchema.Type, "authenticationTemplate"> & {
|
|
62
|
+
/** Branded over the schema's structural form so the template renderer can
|
|
63
|
+
* treat `slug` as an `AuthTemplateSlug`. */
|
|
64
|
+
readonly authenticationTemplate?: readonly Authentication[];
|
|
65
|
+
};
|
|
66
|
+
/** Decode the opaque integration config blob into the openapi shape.
|
|
67
|
+
* Returns null when the blob is missing/incompatible. */
|
|
68
|
+
export declare const decodeOpenApiIntegrationConfig: (value: unknown) => OpenApiIntegrationConfig | null;
|
|
69
|
+
export interface RenderedAuth {
|
|
70
|
+
readonly headers: Record<string, string>;
|
|
71
|
+
readonly queryParams: Record<string, string>;
|
|
72
|
+
}
|
|
73
|
+
/** Render an auth template against a connection's resolved input `values`
|
|
74
|
+
* (`variable → value`). Each placement substitutes from its own entry, so a
|
|
75
|
+
* method with two distinct inputs (e.g. Datadog) fills each header from a
|
|
76
|
+
* different value. */
|
|
77
|
+
export declare const renderAuthTemplate: (template: Authentication, values: Record<string, string | null>) => RenderedAuth;
|
|
78
|
+
/** The distinct input variables a template references — the inputs a connection
|
|
79
|
+
* must supply. An oauth template needs `token`; an apiKey method needs every
|
|
80
|
+
* variable across its placements. */
|
|
81
|
+
export declare const requiredTemplateVariables: (template: Authentication) => readonly string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives structured `group.leaf` tool paths from extracted OpenAPI operations.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the v3 executor's `definitions.ts`. Turns flat operation IDs like
|
|
5
|
+
* `zones_listZones` into nested paths like `zones.listZones` that the tree UI
|
|
6
|
+
* can render with proper nesting.
|
|
7
|
+
*/
|
|
8
|
+
import type { ExtractedOperation } from "./types";
|
|
9
|
+
export interface ToolDefinition {
|
|
10
|
+
/** Dot-separated path like `zones.listZones` */
|
|
11
|
+
readonly toolPath: string;
|
|
12
|
+
/** The group segment */
|
|
13
|
+
readonly group: string;
|
|
14
|
+
/** The leaf segment */
|
|
15
|
+
readonly leaf: string;
|
|
16
|
+
/** Index into the original operations array */
|
|
17
|
+
readonly operationIndex: number;
|
|
18
|
+
/** The original operation */
|
|
19
|
+
readonly operation: ExtractedOperation;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The minimal per-operation metadata the tool-path planner needs. Kept
|
|
23
|
+
* deliberately light (no schemas) so the streaming compile path can plan paths
|
|
24
|
+
* for tens of thousands of operations without holding the full extracted
|
|
25
|
+
* operations in memory.
|
|
26
|
+
*/
|
|
27
|
+
export interface OperationPathInput {
|
|
28
|
+
readonly operationId: string;
|
|
29
|
+
readonly explicitToolPath: string | undefined;
|
|
30
|
+
readonly method: string;
|
|
31
|
+
readonly pathTemplate: string;
|
|
32
|
+
/** The first non-empty tag, used to seed the group segment. */
|
|
33
|
+
readonly tag0: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** A resolved tool path plus its index back into the input operations array. */
|
|
36
|
+
export interface PlannedToolPath {
|
|
37
|
+
readonly toolPath: string;
|
|
38
|
+
readonly group: string;
|
|
39
|
+
readonly leaf: string;
|
|
40
|
+
readonly operationIndex: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Plan structured `group.leaf` tool paths from lightweight per-operation
|
|
44
|
+
* metadata. Path derivation + collision resolution need a global view of every
|
|
45
|
+
* operation, but only its name/method/path/tag, never its schemas. Keeping this
|
|
46
|
+
* pass schema-free lets the streaming compile path plan paths for a 16k-op spec
|
|
47
|
+
* without materializing the full extracted operations.
|
|
48
|
+
*
|
|
49
|
+
* The returned `operationIndex` points back into the `inputs` array.
|
|
50
|
+
*/
|
|
51
|
+
export declare const planToolPaths: (inputs: readonly OperationPathInput[]) => PlannedToolPath[];
|
|
52
|
+
/**
|
|
53
|
+
* Compile extracted operations into tool definitions with structured
|
|
54
|
+
* `group.leaf` paths suitable for tree rendering. Thin wrapper over
|
|
55
|
+
* `planToolPaths` that re-attaches each operation by index.
|
|
56
|
+
*/
|
|
57
|
+
export declare const compileToolDefinitions: (operations: readonly ExtractedOperation[]) => ToolDefinition[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HeaderPreset, OAuth2Preset, SpecPreview, SpecPreviewSummary } from "./preview";
|
|
2
|
+
import type { Authentication } from "./types";
|
|
3
|
+
type PreviewAuthMetadata = SpecPreview | SpecPreviewSummary;
|
|
4
|
+
export declare function resolveOAuthUrl(url: string, baseUrl: string): string;
|
|
5
|
+
export declare const resolvedOAuthScopes: (apiScopes: Iterable<string>, identityScopes: OAuth2Preset["identityScopes"]) => string[];
|
|
6
|
+
export declare const detectedAuthenticationTemplates: (headerPresets: readonly HeaderPreset[], oauth2Presets: readonly OAuth2Preset[], baseUrl: string) => readonly Authentication[];
|
|
7
|
+
export declare const firstBaseUrlForPreview: (preview: PreviewAuthMetadata) => string;
|
|
8
|
+
/** The fallback `addSpec` uses when no explicit template was passed: every
|
|
9
|
+
* spec-detected method, resolved against the integration's base URL. */
|
|
10
|
+
export declare const deriveAuthenticationTemplateFromPreview: (preview: PreviewAuthMetadata, baseUrl: string | undefined) => readonly Authentication[];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|