@opengeni/contracts 2.15.2 → 3.0.1-canary.0

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.
Files changed (42) hide show
  1. package/dist/atlassian.js +10 -9
  2. package/dist/{chunk-NPYLOZAP.js → chunk-5LYFSZ7O.js} +12 -12
  3. package/dist/{chunk-QP3BIGSC.js → chunk-FBXZZSXA.js} +7668 -7654
  4. package/dist/chunk-FBXZZSXA.js.map +1 -0
  5. package/dist/chunk-FY5DZL7T.js +348 -0
  6. package/dist/chunk-FY5DZL7T.js.map +1 -0
  7. package/dist/{chunk-6TCVR53X.js → chunk-O5LEQHDM.js} +2 -2
  8. package/dist/chunk-P3HLDT77.js +59 -0
  9. package/dist/chunk-P3HLDT77.js.map +1 -0
  10. package/dist/chunk-TEMFILR7.js +143 -0
  11. package/dist/chunk-TEMFILR7.js.map +1 -0
  12. package/dist/connect.d.ts +325 -0
  13. package/dist/connect.js +182 -0
  14. package/dist/connect.js.map +1 -0
  15. package/dist/connection-authority.js +28 -334
  16. package/dist/connection-authority.js.map +1 -1
  17. package/dist/editable-artifact-codec-registry.js +2 -2
  18. package/dist/editable-artifact-live.js +2 -2
  19. package/dist/editable-artifact-serialized-commit.js +3 -3
  20. package/dist/editable-artifacts.js +24 -24
  21. package/dist/external-identities.d.ts +620 -0
  22. package/dist/external-identities.js +34 -0
  23. package/dist/external-identities.js.map +1 -0
  24. package/dist/google-drive.js +12 -11
  25. package/dist/google-drive.js.map +1 -1
  26. package/dist/host-mcp-bindings.d.ts +297 -0
  27. package/dist/host-mcp-bindings.js +195 -0
  28. package/dist/host-mcp-bindings.js.map +1 -0
  29. package/dist/index.d.ts +150 -72
  30. package/dist/index.js +89 -81
  31. package/dist/personal-github.js +10 -9
  32. package/dist/personal-github.js.map +1 -1
  33. package/dist/sandbox-snapshots.d.ts +18 -0
  34. package/package.json +13 -1
  35. package/src/connect.ts +202 -0
  36. package/src/external-identities.ts +213 -0
  37. package/src/host-mcp-bindings.ts +226 -0
  38. package/src/index.ts +165 -69
  39. package/src/sandbox-snapshots.ts +67 -3
  40. package/dist/chunk-QP3BIGSC.js.map +0 -1
  41. /package/dist/{chunk-NPYLOZAP.js.map → chunk-5LYFSZ7O.js.map} +0 -0
  42. /package/dist/{chunk-6TCVR53X.js.map → chunk-O5LEQHDM.js.map} +0 -0
@@ -0,0 +1,325 @@
1
+ import { z } from "zod";
2
+ export declare const ConnectOwnership: z.ZodEnum<{
3
+ personal: "personal";
4
+ workspace: "workspace";
5
+ }>;
6
+ export type ConnectOwnership = z.infer<typeof ConnectOwnership>;
7
+ export declare const ConnectProvider: z.ZodObject<{
8
+ id: z.ZodString;
9
+ label: z.ZodString;
10
+ family: z.ZodString;
11
+ readiness: z.ZodEnum<{
12
+ available: "available";
13
+ needs_configuration: "needs_configuration";
14
+ operator_only: "operator_only";
15
+ unsupported: "unsupported";
16
+ }>;
17
+ reason: z.ZodOptional<z.ZodString>;
18
+ ownership: z.ZodArray<z.ZodEnum<{
19
+ personal: "personal";
20
+ workspace: "workspace";
21
+ }>>;
22
+ setup: z.ZodArray<z.ZodEnum<{
23
+ credentials: "credentials";
24
+ device: "device";
25
+ graphql: "graphql";
26
+ installation: "installation";
27
+ none: "none";
28
+ oauth: "oauth";
29
+ openapi: "openapi";
30
+ }>>;
31
+ }, z.core.$strict>;
32
+ export type ConnectProvider = z.infer<typeof ConnectProvider>;
33
+ export declare const ConnectAccount: z.ZodObject<{
34
+ id: z.ZodString;
35
+ providerId: z.ZodString;
36
+ version: z.ZodOptional<z.ZodNumber>;
37
+ label: z.ZodString;
38
+ ownership: z.ZodEnum<{
39
+ personal: "personal";
40
+ workspace: "workspace";
41
+ }>;
42
+ status: z.ZodEnum<{
43
+ auth_needed: "auth_needed";
44
+ connected: "connected";
45
+ disabled: "disabled";
46
+ }>;
47
+ }, z.core.$strict>;
48
+ export type ConnectAccount = z.infer<typeof ConnectAccount>;
49
+ export declare const ConnectResource: z.ZodObject<{
50
+ id: z.ZodString;
51
+ label: z.ZodString;
52
+ kind: z.ZodString;
53
+ }, z.core.$strict>;
54
+ export type ConnectResource = z.infer<typeof ConnectResource>;
55
+ export declare const ConnectNextAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
+ type: z.ZodLiteral<"authorize">;
57
+ url: z.ZodString;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ type: z.ZodLiteral<"credentials">;
60
+ fields: z.ZodArray<z.ZodObject<{
61
+ name: z.ZodString;
62
+ label: z.ZodString;
63
+ required: z.ZodBoolean;
64
+ secret: z.ZodBoolean;
65
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
+ value: z.ZodString;
67
+ label: z.ZodString;
68
+ }, z.core.$strict>>>;
69
+ }, z.core.$strict>>;
70
+ }, z.core.$strict>, z.ZodObject<{
71
+ type: z.ZodLiteral<"wait">;
72
+ pollAfterMs: z.ZodNumber;
73
+ userCode: z.ZodOptional<z.ZodString>;
74
+ verificationUrl: z.ZodOptional<z.ZodString>;
75
+ }, z.core.$strict>, z.ZodObject<{
76
+ type: z.ZodLiteral<"select_account">;
77
+ accounts: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodString;
79
+ providerId: z.ZodString;
80
+ version: z.ZodOptional<z.ZodNumber>;
81
+ label: z.ZodString;
82
+ ownership: z.ZodEnum<{
83
+ personal: "personal";
84
+ workspace: "workspace";
85
+ }>;
86
+ status: z.ZodEnum<{
87
+ auth_needed: "auth_needed";
88
+ connected: "connected";
89
+ disabled: "disabled";
90
+ }>;
91
+ }, z.core.$strict>>;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ type: z.ZodLiteral<"select_resources">;
94
+ resources: z.ZodArray<z.ZodObject<{
95
+ id: z.ZodString;
96
+ label: z.ZodString;
97
+ kind: z.ZodString;
98
+ }, z.core.$strict>>;
99
+ cursor: z.ZodOptional<z.ZodString>;
100
+ }, z.core.$strict>, z.ZodObject<{
101
+ type: z.ZodLiteral<"preview">;
102
+ previewId: z.ZodString;
103
+ contentHash: z.ZodString;
104
+ operations: z.ZodArray<z.ZodObject<{
105
+ id: z.ZodString;
106
+ label: z.ZodString;
107
+ kind: z.ZodString;
108
+ }, z.core.$strict>>;
109
+ }, z.core.$strict>, z.ZodObject<{
110
+ type: z.ZodLiteral<"none">;
111
+ }, z.core.$strict>], "type">;
112
+ export type ConnectNextAction = z.infer<typeof ConnectNextAction>;
113
+ export declare const ConnectInstallationTarget: z.ZodObject<{
114
+ instanceKey: z.ZodString;
115
+ displayName: z.ZodString;
116
+ expectedInstanceVersion: z.ZodOptional<z.ZodNumber>;
117
+ }, z.core.$strict>;
118
+ export type ConnectInstallationTarget = z.infer<typeof ConnectInstallationTarget>;
119
+ export declare const ConnectAttemptState: z.ZodEnum<{
120
+ account_selection: "account_selection";
121
+ cancelled: "cancelled";
122
+ complete: "complete";
123
+ connected_but_incomplete: "connected_but_incomplete";
124
+ credential_input: "credential_input";
125
+ expired: "expired";
126
+ failed: "failed";
127
+ installing: "installing";
128
+ preview: "preview";
129
+ provider_wait: "provider_wait";
130
+ ready: "ready";
131
+ requires_user_action: "requires_user_action";
132
+ resource_selection: "resource_selection";
133
+ uncertain: "uncertain";
134
+ }>;
135
+ export declare const ConnectAttempt: z.ZodObject<{
136
+ id: z.ZodString;
137
+ workspaceId: z.ZodString;
138
+ providerId: z.ZodString;
139
+ ownership: z.ZodEnum<{
140
+ personal: "personal";
141
+ workspace: "workspace";
142
+ }>;
143
+ revision: z.ZodNumber;
144
+ state: z.ZodEnum<{
145
+ account_selection: "account_selection";
146
+ cancelled: "cancelled";
147
+ complete: "complete";
148
+ connected_but_incomplete: "connected_but_incomplete";
149
+ credential_input: "credential_input";
150
+ expired: "expired";
151
+ failed: "failed";
152
+ installing: "installing";
153
+ preview: "preview";
154
+ provider_wait: "provider_wait";
155
+ ready: "ready";
156
+ requires_user_action: "requires_user_action";
157
+ resource_selection: "resource_selection";
158
+ uncertain: "uncertain";
159
+ }>;
160
+ credentialsCommitted: z.ZodBoolean;
161
+ integrationInstalled: z.ZodBoolean;
162
+ completionRequirement: z.ZodEnum<{
163
+ connection: "connection";
164
+ integration: "integration";
165
+ provider_setup: "provider_setup";
166
+ }>;
167
+ nextAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
168
+ type: z.ZodLiteral<"authorize">;
169
+ url: z.ZodString;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ type: z.ZodLiteral<"credentials">;
172
+ fields: z.ZodArray<z.ZodObject<{
173
+ name: z.ZodString;
174
+ label: z.ZodString;
175
+ required: z.ZodBoolean;
176
+ secret: z.ZodBoolean;
177
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
178
+ value: z.ZodString;
179
+ label: z.ZodString;
180
+ }, z.core.$strict>>>;
181
+ }, z.core.$strict>>;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ type: z.ZodLiteral<"wait">;
184
+ pollAfterMs: z.ZodNumber;
185
+ userCode: z.ZodOptional<z.ZodString>;
186
+ verificationUrl: z.ZodOptional<z.ZodString>;
187
+ }, z.core.$strict>, z.ZodObject<{
188
+ type: z.ZodLiteral<"select_account">;
189
+ accounts: z.ZodArray<z.ZodObject<{
190
+ id: z.ZodString;
191
+ providerId: z.ZodString;
192
+ version: z.ZodOptional<z.ZodNumber>;
193
+ label: z.ZodString;
194
+ ownership: z.ZodEnum<{
195
+ personal: "personal";
196
+ workspace: "workspace";
197
+ }>;
198
+ status: z.ZodEnum<{
199
+ auth_needed: "auth_needed";
200
+ connected: "connected";
201
+ disabled: "disabled";
202
+ }>;
203
+ }, z.core.$strict>>;
204
+ }, z.core.$strict>, z.ZodObject<{
205
+ type: z.ZodLiteral<"select_resources">;
206
+ resources: z.ZodArray<z.ZodObject<{
207
+ id: z.ZodString;
208
+ label: z.ZodString;
209
+ kind: z.ZodString;
210
+ }, z.core.$strict>>;
211
+ cursor: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strict>, z.ZodObject<{
213
+ type: z.ZodLiteral<"preview">;
214
+ previewId: z.ZodString;
215
+ contentHash: z.ZodString;
216
+ operations: z.ZodArray<z.ZodObject<{
217
+ id: z.ZodString;
218
+ label: z.ZodString;
219
+ kind: z.ZodString;
220
+ }, z.core.$strict>>;
221
+ }, z.core.$strict>, z.ZodObject<{
222
+ type: z.ZodLiteral<"none">;
223
+ }, z.core.$strict>], "type">;
224
+ expiresAt: z.ZodString;
225
+ account: z.ZodOptional<z.ZodObject<{
226
+ id: z.ZodString;
227
+ providerId: z.ZodString;
228
+ version: z.ZodOptional<z.ZodNumber>;
229
+ label: z.ZodString;
230
+ ownership: z.ZodEnum<{
231
+ personal: "personal";
232
+ workspace: "workspace";
233
+ }>;
234
+ status: z.ZodEnum<{
235
+ auth_needed: "auth_needed";
236
+ connected: "connected";
237
+ disabled: "disabled";
238
+ }>;
239
+ }, z.core.$strict>>;
240
+ installationTarget: z.ZodOptional<z.ZodObject<{
241
+ instanceKey: z.ZodString;
242
+ displayName: z.ZodString;
243
+ expectedInstanceVersion: z.ZodOptional<z.ZodNumber>;
244
+ }, z.core.$strict>>;
245
+ source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
246
+ kind: z.ZodLiteral<"definition">;
247
+ definitionId: z.ZodString;
248
+ }, z.core.$strict>, z.ZodObject<{
249
+ kind: z.ZodLiteral<"openapi">;
250
+ url: z.ZodString;
251
+ baseUrl: z.ZodOptional<z.ZodString>;
252
+ }, z.core.$strict>, z.ZodObject<{
253
+ kind: z.ZodLiteral<"graphql">;
254
+ endpoint: z.ZodString;
255
+ name: z.ZodOptional<z.ZodString>;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ kind: z.ZodLiteral<"auto">;
258
+ url: z.ZodString;
259
+ baseUrl: z.ZodOptional<z.ZodString>;
260
+ }, z.core.$strict>], "kind">>;
261
+ error: z.ZodOptional<z.ZodObject<{
262
+ code: z.ZodString;
263
+ message: z.ZodString;
264
+ retryable: z.ZodBoolean;
265
+ }, z.core.$strict>>;
266
+ }, z.core.$strict>;
267
+ export type ConnectAttempt = z.infer<typeof ConnectAttempt>;
268
+ export declare const ConnectAdvance: z.ZodDiscriminatedUnion<[z.ZodObject<{
269
+ type: z.ZodLiteral<"credentials">;
270
+ values: z.ZodRecord<z.ZodString, z.ZodString>;
271
+ }, z.core.$strict>, z.ZodObject<{
272
+ type: z.ZodLiteral<"account">;
273
+ accountId: z.ZodString;
274
+ }, z.core.$strict>, z.ZodObject<{
275
+ type: z.ZodLiteral<"resources">;
276
+ resourceIds: z.ZodArray<z.ZodString>;
277
+ }, z.core.$strict>, z.ZodObject<{
278
+ type: z.ZodLiteral<"install">;
279
+ previewId: z.ZodString;
280
+ contentHash: z.ZodString;
281
+ operationIds: z.ZodArray<z.ZodString>;
282
+ }, z.core.$strict>, z.ZodObject<{
283
+ type: z.ZodLiteral<"retry">;
284
+ }, z.core.$strict>], "type">;
285
+ export type ConnectAdvance = z.infer<typeof ConnectAdvance>;
286
+ export declare const ConnectOperationRequest: z.ZodObject<{
287
+ expectedRevision: z.ZodNumber;
288
+ idempotencyKey: z.ZodString;
289
+ }, z.core.$strict>;
290
+ export declare const AdvanceConnectRequest: z.ZodObject<{
291
+ expectedRevision: z.ZodNumber;
292
+ idempotencyKey: z.ZodString;
293
+ action: z.ZodDiscriminatedUnion<[z.ZodObject<{
294
+ type: z.ZodLiteral<"credentials">;
295
+ values: z.ZodRecord<z.ZodString, z.ZodString>;
296
+ }, z.core.$strict>, z.ZodObject<{
297
+ type: z.ZodLiteral<"account">;
298
+ accountId: z.ZodString;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ type: z.ZodLiteral<"resources">;
301
+ resourceIds: z.ZodArray<z.ZodString>;
302
+ }, z.core.$strict>, z.ZodObject<{
303
+ type: z.ZodLiteral<"install">;
304
+ previewId: z.ZodString;
305
+ contentHash: z.ZodString;
306
+ operationIds: z.ZodArray<z.ZodString>;
307
+ }, z.core.$strict>, z.ZodObject<{
308
+ type: z.ZodLiteral<"retry">;
309
+ }, z.core.$strict>], "type">;
310
+ }, z.core.$strict>;
311
+ export declare const BeginConnectRequest: z.ZodObject<{
312
+ providerId: z.ZodString;
313
+ ownership: z.ZodEnum<{
314
+ personal: "personal";
315
+ workspace: "workspace";
316
+ }>;
317
+ returnUrl: z.ZodString;
318
+ idempotencyKey: z.ZodString;
319
+ reconnectAccountId: z.ZodOptional<z.ZodString>;
320
+ installationTarget: z.ZodOptional<z.ZodObject<{
321
+ instanceKey: z.ZodString;
322
+ displayName: z.ZodString;
323
+ expectedInstanceVersion: z.ZodOptional<z.ZodNumber>;
324
+ }, z.core.$strict>>;
325
+ }, z.core.$strict>;
@@ -0,0 +1,182 @@
1
+ import {
2
+ IntegrationInstanceKey,
3
+ IntegrationSource
4
+ } from "./chunk-FBXZZSXA.js";
5
+ import "./chunk-YBW5JSA3.js";
6
+ import "./chunk-O5LEQHDM.js";
7
+ import "./chunk-GRG7PHWQ.js";
8
+ import "./chunk-MRWYRAS5.js";
9
+ import "./chunk-3SIZGL3O.js";
10
+ import "./chunk-NVJMJWLL.js";
11
+ import "./chunk-YRKRZ6OF.js";
12
+ import "./chunk-JUFK3T4Q.js";
13
+ import "./chunk-M5ZGRVIQ.js";
14
+ import "./chunk-BCS7WHCK.js";
15
+ import "./chunk-5LYFSZ7O.js";
16
+ import "./chunk-Y3KNXVTD.js";
17
+ import "./chunk-D2HKF2EF.js";
18
+ import "./chunk-TXTQIYCV.js";
19
+ import "./chunk-RIY7GYQS.js";
20
+ import "./chunk-MYBZRDTY.js";
21
+ import "./chunk-PX3VCKAU.js";
22
+ import "./chunk-UGTBTPTQ.js";
23
+ import "./chunk-WYBDERIY.js";
24
+ import "./chunk-P3HLDT77.js";
25
+ import "./chunk-7ABONTXE.js";
26
+
27
+ // src/connect.ts
28
+ import { z } from "zod";
29
+ var opaqueId = z.string().min(1).max(512);
30
+ var ConnectOwnership = z.enum(["personal", "workspace"]);
31
+ var ConnectProvider = z.object({
32
+ id: opaqueId,
33
+ label: z.string().min(1).max(256),
34
+ family: opaqueId,
35
+ readiness: z.enum(["available", "needs_configuration", "operator_only", "unsupported"]),
36
+ reason: z.string().max(1024).optional(),
37
+ ownership: z.array(ConnectOwnership).max(2),
38
+ setup: z.array(
39
+ z.enum(["none", "oauth", "credentials", "device", "installation", "openapi", "graphql"])
40
+ ).max(7)
41
+ }).strict();
42
+ var ConnectAccount = z.object({
43
+ id: opaqueId,
44
+ providerId: opaqueId,
45
+ version: z.number().int().positive().optional(),
46
+ label: z.string().max(256),
47
+ ownership: ConnectOwnership,
48
+ status: z.enum(["connected", "auth_needed", "disabled"])
49
+ }).strict();
50
+ var ConnectResource = z.object({ id: opaqueId, label: z.string().max(512), kind: opaqueId }).strict();
51
+ var ConnectNextAction = z.discriminatedUnion("type", [
52
+ z.object({ type: z.literal("authorize"), url: z.string().url().max(16384) }).strict(),
53
+ z.object({
54
+ type: z.literal("credentials"),
55
+ fields: z.array(
56
+ z.object({
57
+ name: opaqueId,
58
+ label: z.string().max(256),
59
+ required: z.boolean(),
60
+ secret: z.boolean(),
61
+ options: z.array(z.object({ value: opaqueId, label: z.string().max(512) }).strict()).max(1e3).optional()
62
+ }).strict()
63
+ ).max(32)
64
+ }).strict(),
65
+ z.object({
66
+ type: z.literal("wait"),
67
+ pollAfterMs: z.number().int().min(250).max(6e4),
68
+ userCode: z.string().max(128).optional(),
69
+ verificationUrl: z.string().url().max(2048).optional()
70
+ }).strict(),
71
+ z.object({ type: z.literal("select_account"), accounts: z.array(ConnectAccount).max(100) }).strict(),
72
+ z.object({
73
+ type: z.literal("select_resources"),
74
+ resources: z.array(ConnectResource).max(100),
75
+ cursor: z.string().max(2048).optional()
76
+ }).strict(),
77
+ z.object({
78
+ type: z.literal("preview"),
79
+ previewId: opaqueId,
80
+ contentHash: opaqueId,
81
+ operations: z.array(ConnectResource).max(2e3)
82
+ }).strict(),
83
+ z.object({ type: z.literal("none") }).strict()
84
+ ]);
85
+ var ConnectInstallationTarget = z.object({
86
+ instanceKey: IntegrationInstanceKey,
87
+ displayName: z.string().min(1).max(200),
88
+ expectedInstanceVersion: z.number().int().positive().optional()
89
+ }).strict();
90
+ var ConnectAttemptState = z.enum([
91
+ "ready",
92
+ "requires_user_action",
93
+ "credential_input",
94
+ "provider_wait",
95
+ "account_selection",
96
+ "resource_selection",
97
+ "preview",
98
+ "installing",
99
+ "connected_but_incomplete",
100
+ "complete",
101
+ "cancelled",
102
+ "expired",
103
+ "failed",
104
+ "uncertain"
105
+ ]);
106
+ var ConnectAttempt = z.object({
107
+ id: opaqueId,
108
+ workspaceId: opaqueId,
109
+ providerId: opaqueId,
110
+ ownership: ConnectOwnership,
111
+ revision: z.number().int().positive(),
112
+ state: ConnectAttemptState,
113
+ credentialsCommitted: z.boolean(),
114
+ integrationInstalled: z.boolean(),
115
+ completionRequirement: z.enum(["connection", "integration", "provider_setup"]),
116
+ nextAction: ConnectNextAction,
117
+ expiresAt: z.string().datetime({ offset: true }),
118
+ account: ConnectAccount.optional(),
119
+ installationTarget: ConnectInstallationTarget.optional(),
120
+ source: IntegrationSource.optional(),
121
+ error: z.object({ code: opaqueId, message: z.string().max(2048), retryable: z.boolean() }).strict().optional()
122
+ }).strict().superRefine((value, context) => {
123
+ if (value.state === "complete" && value.completionRequirement === "integration" && !value.integrationInstalled) {
124
+ context.addIssue({
125
+ code: "custom",
126
+ message: "Complete setup requires an installed integration"
127
+ });
128
+ }
129
+ if (value.state === "complete" && value.completionRequirement === "connection" && !value.credentialsCommitted) {
130
+ context.addIssue({
131
+ code: "custom",
132
+ message: "Connection setup requires committed credentials"
133
+ });
134
+ }
135
+ if (["complete", "cancelled", "expired"].includes(value.state) && value.nextAction.type !== "none") {
136
+ context.addIssue({ code: "custom", message: "A terminal setup has no next action" });
137
+ }
138
+ });
139
+ var ConnectAdvance = z.discriminatedUnion("type", [
140
+ z.object({
141
+ type: z.literal("credentials"),
142
+ values: z.record(z.string().max(256), z.string().max(16384))
143
+ }).strict(),
144
+ z.object({ type: z.literal("account"), accountId: opaqueId }).strict(),
145
+ z.object({ type: z.literal("resources"), resourceIds: z.array(opaqueId).max(1e3) }).strict(),
146
+ z.object({
147
+ type: z.literal("install"),
148
+ previewId: opaqueId,
149
+ contentHash: opaqueId,
150
+ operationIds: z.array(opaqueId).max(2e3)
151
+ }).strict(),
152
+ z.object({ type: z.literal("retry") }).strict()
153
+ ]);
154
+ var ConnectOperationRequest = z.object({
155
+ expectedRevision: z.number().int().positive().safe(),
156
+ idempotencyKey: opaqueId
157
+ }).strict();
158
+ var AdvanceConnectRequest = ConnectOperationRequest.extend({ action: ConnectAdvance });
159
+ var BeginConnectRequest = z.object({
160
+ providerId: opaqueId,
161
+ ownership: ConnectOwnership,
162
+ // URL parsing validates separately; never transform this original string.
163
+ returnUrl: z.string().min(1).max(4096),
164
+ idempotencyKey: opaqueId,
165
+ reconnectAccountId: opaqueId.optional(),
166
+ installationTarget: ConnectInstallationTarget.optional()
167
+ }).strict();
168
+ export {
169
+ AdvanceConnectRequest,
170
+ BeginConnectRequest,
171
+ ConnectAccount,
172
+ ConnectAdvance,
173
+ ConnectAttempt,
174
+ ConnectAttemptState,
175
+ ConnectInstallationTarget,
176
+ ConnectNextAction,
177
+ ConnectOperationRequest,
178
+ ConnectOwnership,
179
+ ConnectProvider,
180
+ ConnectResource
181
+ };
182
+ //# sourceMappingURL=connect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { IntegrationInstanceKey, IntegrationSource } from \"./index\";\n\nconst opaqueId = z.string().min(1).max(512);\nexport const ConnectOwnership = z.enum([\"personal\", \"workspace\"]);\nexport type ConnectOwnership = z.infer<typeof ConnectOwnership>;\nexport const ConnectProvider = z\n .object({\n id: opaqueId,\n label: z.string().min(1).max(256),\n family: opaqueId,\n readiness: z.enum([\"available\", \"needs_configuration\", \"operator_only\", \"unsupported\"]),\n reason: z.string().max(1024).optional(),\n ownership: z.array(ConnectOwnership).max(2),\n setup: z\n .array(\n z.enum([\"none\", \"oauth\", \"credentials\", \"device\", \"installation\", \"openapi\", \"graphql\"]),\n )\n .max(7),\n })\n .strict();\nexport type ConnectProvider = z.infer<typeof ConnectProvider>;\nexport const ConnectAccount = z\n .object({\n id: opaqueId,\n providerId: opaqueId,\n version: z.number().int().positive().optional(),\n label: z.string().max(256),\n ownership: ConnectOwnership,\n status: z.enum([\"connected\", \"auth_needed\", \"disabled\"]),\n })\n .strict();\nexport type ConnectAccount = z.infer<typeof ConnectAccount>;\nexport const ConnectResource = z\n .object({ id: opaqueId, label: z.string().max(512), kind: opaqueId })\n .strict();\nexport type ConnectResource = z.infer<typeof ConnectResource>;\nexport const ConnectNextAction = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"authorize\"), url: z.string().url().max(16_384) }).strict(),\n z\n .object({\n type: z.literal(\"credentials\"),\n fields: z\n .array(\n z\n .object({\n name: opaqueId,\n label: z.string().max(256),\n required: z.boolean(),\n secret: z.boolean(),\n options: z\n .array(z.object({ value: opaqueId, label: z.string().max(512) }).strict())\n .max(1000)\n .optional(),\n })\n .strict(),\n )\n .max(32),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"wait\"),\n pollAfterMs: z.number().int().min(250).max(60_000),\n userCode: z.string().max(128).optional(),\n verificationUrl: z.string().url().max(2048).optional(),\n })\n .strict(),\n z\n .object({ type: z.literal(\"select_account\"), accounts: z.array(ConnectAccount).max(100) })\n .strict(),\n z\n .object({\n type: z.literal(\"select_resources\"),\n resources: z.array(ConnectResource).max(100),\n cursor: z.string().max(2048).optional(),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"preview\"),\n previewId: opaqueId,\n contentHash: opaqueId,\n operations: z.array(ConnectResource).max(2000),\n })\n .strict(),\n z.object({ type: z.literal(\"none\") }).strict(),\n]);\nexport type ConnectNextAction = z.infer<typeof ConnectNextAction>;\nexport const ConnectInstallationTarget = z\n .object({\n instanceKey: IntegrationInstanceKey,\n displayName: z.string().min(1).max(200),\n expectedInstanceVersion: z.number().int().positive().optional(),\n })\n .strict();\nexport type ConnectInstallationTarget = z.infer<typeof ConnectInstallationTarget>;\nexport const ConnectAttemptState = z.enum([\n \"ready\",\n \"requires_user_action\",\n \"credential_input\",\n \"provider_wait\",\n \"account_selection\",\n \"resource_selection\",\n \"preview\",\n \"installing\",\n \"connected_but_incomplete\",\n \"complete\",\n \"cancelled\",\n \"expired\",\n \"failed\",\n \"uncertain\",\n]);\nexport const ConnectAttempt = z\n .object({\n id: opaqueId,\n workspaceId: opaqueId,\n providerId: opaqueId,\n ownership: ConnectOwnership,\n revision: z.number().int().positive(),\n state: ConnectAttemptState,\n credentialsCommitted: z.boolean(),\n integrationInstalled: z.boolean(),\n completionRequirement: z.enum([\"connection\", \"integration\", \"provider_setup\"]),\n nextAction: ConnectNextAction,\n expiresAt: z.string().datetime({ offset: true }),\n account: ConnectAccount.optional(),\n installationTarget: ConnectInstallationTarget.optional(),\n source: IntegrationSource.optional(),\n error: z\n .object({ code: opaqueId, message: z.string().max(2048), retryable: z.boolean() })\n .strict()\n .optional(),\n })\n .strict()\n .superRefine((value, context) => {\n if (\n value.state === \"complete\" &&\n value.completionRequirement === \"integration\" &&\n !value.integrationInstalled\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Complete setup requires an installed integration\",\n });\n }\n if (\n value.state === \"complete\" &&\n value.completionRequirement === \"connection\" &&\n !value.credentialsCommitted\n ) {\n context.addIssue({\n code: \"custom\",\n message: \"Connection setup requires committed credentials\",\n });\n }\n if (\n [\"complete\", \"cancelled\", \"expired\"].includes(value.state) &&\n value.nextAction.type !== \"none\"\n ) {\n context.addIssue({ code: \"custom\", message: \"A terminal setup has no next action\" });\n }\n });\nexport type ConnectAttempt = z.infer<typeof ConnectAttempt>;\nexport const ConnectAdvance = z.discriminatedUnion(\"type\", [\n z\n .object({\n type: z.literal(\"credentials\"),\n values: z.record(z.string().max(256), z.string().max(16_384)),\n })\n .strict(),\n z.object({ type: z.literal(\"account\"), accountId: opaqueId }).strict(),\n z.object({ type: z.literal(\"resources\"), resourceIds: z.array(opaqueId).max(1000) }).strict(),\n z\n .object({\n type: z.literal(\"install\"),\n previewId: opaqueId,\n contentHash: opaqueId,\n operationIds: z.array(opaqueId).max(2000),\n })\n .strict(),\n z.object({ type: z.literal(\"retry\") }).strict(),\n]);\nexport type ConnectAdvance = z.infer<typeof ConnectAdvance>;\nexport const ConnectOperationRequest = z\n .object({\n expectedRevision: z.number().int().positive().safe(),\n idempotencyKey: opaqueId,\n })\n .strict();\nexport const AdvanceConnectRequest = ConnectOperationRequest.extend({ action: ConnectAdvance });\nexport const BeginConnectRequest = z\n .object({\n providerId: opaqueId,\n ownership: ConnectOwnership,\n // URL parsing validates separately; never transform this original string.\n returnUrl: z.string().min(1).max(4096),\n idempotencyKey: opaqueId,\n reconnectAccountId: opaqueId.optional(),\n installationTarget: ConnectInstallationTarget.optional(),\n })\n .strict();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAGlB,IAAM,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AACnC,IAAM,mBAAmB,EAAE,KAAK,CAAC,YAAY,WAAW,CAAC;AAEzD,IAAM,kBAAkB,EAC5B,OAAO;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAChC,QAAQ;AAAA,EACR,WAAW,EAAE,KAAK,CAAC,aAAa,uBAAuB,iBAAiB,aAAa,CAAC;AAAA,EACtF,QAAQ,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,SAAS;AAAA,EACtC,WAAW,EAAE,MAAM,gBAAgB,EAAE,IAAI,CAAC;AAAA,EAC1C,OAAO,EACJ;AAAA,IACC,EAAE,KAAK,CAAC,QAAQ,SAAS,eAAe,UAAU,gBAAgB,WAAW,SAAS,CAAC;AAAA,EACzF,EACC,IAAI,CAAC;AACV,CAAC,EACA,OAAO;AAEH,IAAM,iBAAiB,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