@shipfox/api-integration-core-dto 5.0.0 → 8.0.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.
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 10 files with swc (311.46ms)
2
+ Successfully compiled: 12 files with swc (317.13ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @shipfox/api-integration-core-dto
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 7f227c6: Moves Projects and Integrations synchronous contracts to producer-owned inter-module entry points.
8
+
9
+ ## 6.0.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 0bb82a4: Adds the Agent and Integrations inter-module APIs, moving Workflows agent configuration, runtime credential resolution, and integration consumers behind producer-owned clients.
14
+ - f262539: Adds a composed webhook processor and optional provider-neutral delivery source for hosted API runtimes.
15
+ - 3bb4e26: Fixes composed webhook processing and exposes Slack URL-verification responses through the shared contract.
16
+ - 4604a06: Adds the shared versioned inbound webhook request and processing contracts.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [81f9544]
21
+ - @shipfox/inter-module@0.2.0
22
+
3
23
  ## 5.0.0
4
24
 
5
25
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export * from '#events.js';
4
4
  export * from '#ports.js';
5
5
  export * from '#schemas/index.js';
6
6
  export * from '#slug.js';
7
+ export * from '#webhooks.js';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -4,5 +4,6 @@ export * from '#events.js';
4
4
  export * from '#ports.js';
5
5
  export * from '#schemas/index.js';
6
6
  export * from '#slug.js';
7
+ export * from '#webhooks.js';
7
8
 
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '#contracts/index.js';\nexport * from '#errors.js';\nexport * from '#events.js';\nexport * from '#ports.js';\nexport * from '#schemas/index.js';\nexport * from '#slug.js';\n"],"names":[],"mappings":"AAAA,cAAc,sBAAsB;AACpC,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B,cAAc,oBAAoB;AAClC,cAAc,WAAW"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from '#contracts/index.js';\nexport * from '#errors.js';\nexport * from '#events.js';\nexport * from '#ports.js';\nexport * from '#schemas/index.js';\nexport * from '#slug.js';\nexport * from '#webhooks.js';\n"],"names":[],"mappings":"AAAA,cAAc,sBAAsB;AACpC,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,eAAe"}
@@ -0,0 +1,303 @@
1
+ import { type InterModuleClient } from '@shipfox/inter-module';
2
+ import { z } from 'zod';
3
+ /** Producer-owned synchronous operations for the Integrations bounded context. */
4
+ export declare const integrationsInterModuleContract: import("@shipfox/inter-module").InterModuleContract<{
5
+ readonly module: "integrations";
6
+ readonly methods: {
7
+ readonly resolveSourceRepository: {
8
+ readonly input: z.ZodObject<{
9
+ workspaceId: z.ZodString;
10
+ connectionId: z.ZodString;
11
+ externalRepositoryId: z.ZodString;
12
+ }, z.core.$strip>;
13
+ readonly output: z.ZodObject<{
14
+ connection: z.ZodObject<{
15
+ id: z.ZodString;
16
+ provider: z.ZodString;
17
+ slug: z.ZodString;
18
+ }, z.core.$strip>;
19
+ repository: z.ZodObject<{
20
+ externalRepositoryId: z.ZodString;
21
+ owner: z.ZodString;
22
+ name: z.ZodString;
23
+ fullName: z.ZodString;
24
+ defaultBranch: z.ZodString;
25
+ visibility: z.ZodEnum<{
26
+ unknown: "unknown";
27
+ public: "public";
28
+ private: "private";
29
+ internal: "internal";
30
+ }>;
31
+ cloneUrl: z.ZodString;
32
+ htmlUrl: z.ZodString;
33
+ }, z.core.$strip>;
34
+ }, z.core.$strip>;
35
+ readonly errors: {
36
+ 'connection-not-found': z.ZodObject<{
37
+ connectionId: z.ZodString;
38
+ }, z.core.$strip>;
39
+ 'connection-inactive': z.ZodObject<{
40
+ connectionId: z.ZodString;
41
+ }, z.core.$strip>;
42
+ 'connection-workspace-mismatch': z.ZodObject<{
43
+ connectionId: z.ZodString;
44
+ }, z.core.$strip>;
45
+ 'provider-unavailable': z.ZodObject<{
46
+ provider: z.ZodString;
47
+ }, z.core.$strip>;
48
+ 'capability-unavailable': z.ZodObject<{
49
+ provider: z.ZodString;
50
+ capability: z.ZodEnum<{
51
+ source_control: "source_control";
52
+ agent_tools: "agent_tools";
53
+ }>;
54
+ }, z.core.$strip>;
55
+ 'checkout-unsupported': z.ZodObject<{
56
+ provider: z.ZodString;
57
+ }, z.core.$strip>;
58
+ 'provider-failure': z.ZodObject<{
59
+ reason: z.ZodString;
60
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
61
+ }, z.core.$strip>;
62
+ };
63
+ };
64
+ readonly listSourceFiles: {
65
+ readonly input: z.ZodObject<{
66
+ workspaceId: z.ZodString;
67
+ connectionId: z.ZodString;
68
+ externalRepositoryId: z.ZodString;
69
+ ref: z.ZodString;
70
+ prefix: z.ZodString;
71
+ limit: z.ZodNumber;
72
+ cursor: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$strip>;
74
+ readonly output: z.ZodObject<{
75
+ files: z.ZodArray<z.ZodObject<{
76
+ path: z.ZodString;
77
+ type: z.ZodLiteral<"file">;
78
+ size: z.ZodNullable<z.ZodNumber>;
79
+ }, z.core.$strip>>;
80
+ nextCursor: z.ZodNullable<z.ZodString>;
81
+ }, z.core.$strip>;
82
+ readonly errors: {
83
+ 'connection-not-found': z.ZodObject<{
84
+ connectionId: z.ZodString;
85
+ }, z.core.$strip>;
86
+ 'connection-inactive': z.ZodObject<{
87
+ connectionId: z.ZodString;
88
+ }, z.core.$strip>;
89
+ 'connection-workspace-mismatch': z.ZodObject<{
90
+ connectionId: z.ZodString;
91
+ }, z.core.$strip>;
92
+ 'provider-unavailable': z.ZodObject<{
93
+ provider: z.ZodString;
94
+ }, z.core.$strip>;
95
+ 'capability-unavailable': z.ZodObject<{
96
+ provider: z.ZodString;
97
+ capability: z.ZodEnum<{
98
+ source_control: "source_control";
99
+ agent_tools: "agent_tools";
100
+ }>;
101
+ }, z.core.$strip>;
102
+ 'checkout-unsupported': z.ZodObject<{
103
+ provider: z.ZodString;
104
+ }, z.core.$strip>;
105
+ 'provider-failure': z.ZodObject<{
106
+ reason: z.ZodString;
107
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
108
+ }, z.core.$strip>;
109
+ };
110
+ };
111
+ readonly fetchSourceFile: {
112
+ readonly input: z.ZodObject<{
113
+ workspaceId: z.ZodString;
114
+ connectionId: z.ZodString;
115
+ externalRepositoryId: z.ZodString;
116
+ ref: z.ZodString;
117
+ path: z.ZodString;
118
+ }, z.core.$strip>;
119
+ readonly output: z.ZodObject<{
120
+ path: z.ZodString;
121
+ ref: z.ZodString;
122
+ content: z.ZodString;
123
+ }, z.core.$strip>;
124
+ readonly errors: {
125
+ 'connection-not-found': z.ZodObject<{
126
+ connectionId: z.ZodString;
127
+ }, z.core.$strip>;
128
+ 'connection-inactive': z.ZodObject<{
129
+ connectionId: z.ZodString;
130
+ }, z.core.$strip>;
131
+ 'connection-workspace-mismatch': z.ZodObject<{
132
+ connectionId: z.ZodString;
133
+ }, z.core.$strip>;
134
+ 'provider-unavailable': z.ZodObject<{
135
+ provider: z.ZodString;
136
+ }, z.core.$strip>;
137
+ 'capability-unavailable': z.ZodObject<{
138
+ provider: z.ZodString;
139
+ capability: z.ZodEnum<{
140
+ source_control: "source_control";
141
+ agent_tools: "agent_tools";
142
+ }>;
143
+ }, z.core.$strip>;
144
+ 'checkout-unsupported': z.ZodObject<{
145
+ provider: z.ZodString;
146
+ }, z.core.$strip>;
147
+ 'provider-failure': z.ZodObject<{
148
+ reason: z.ZodString;
149
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
150
+ }, z.core.$strip>;
151
+ };
152
+ };
153
+ readonly createCheckoutSpec: {
154
+ readonly input: z.ZodObject<{
155
+ workspaceId: z.ZodString;
156
+ connectionId: z.ZodString;
157
+ externalRepositoryId: z.ZodString;
158
+ ref: z.ZodOptional<z.ZodString>;
159
+ permissions: z.ZodOptional<z.ZodObject<{
160
+ contents: z.ZodEnum<{
161
+ read: "read";
162
+ write: "write";
163
+ }>;
164
+ }, z.core.$strip>>;
165
+ }, z.core.$strip>;
166
+ readonly output: z.ZodObject<{
167
+ repositoryUrl: z.ZodString;
168
+ ref: z.ZodString;
169
+ credentials: z.ZodOptional<z.ZodObject<{
170
+ username: z.ZodString;
171
+ token: z.ZodString;
172
+ expiresAt: z.ZodString;
173
+ }, z.core.$strip>>;
174
+ gitAuthor: z.ZodOptional<z.ZodObject<{
175
+ name: z.ZodString;
176
+ email: z.ZodString;
177
+ }, z.core.$strip>>;
178
+ }, z.core.$strip>;
179
+ readonly errors: {
180
+ 'connection-not-found': z.ZodObject<{
181
+ connectionId: z.ZodString;
182
+ }, z.core.$strip>;
183
+ 'connection-inactive': z.ZodObject<{
184
+ connectionId: z.ZodString;
185
+ }, z.core.$strip>;
186
+ 'connection-workspace-mismatch': z.ZodObject<{
187
+ connectionId: z.ZodString;
188
+ }, z.core.$strip>;
189
+ 'provider-unavailable': z.ZodObject<{
190
+ provider: z.ZodString;
191
+ }, z.core.$strip>;
192
+ 'capability-unavailable': z.ZodObject<{
193
+ provider: z.ZodString;
194
+ capability: z.ZodEnum<{
195
+ source_control: "source_control";
196
+ agent_tools: "agent_tools";
197
+ }>;
198
+ }, z.core.$strip>;
199
+ 'checkout-unsupported': z.ZodObject<{
200
+ provider: z.ZodString;
201
+ }, z.core.$strip>;
202
+ 'provider-failure': z.ZodObject<{
203
+ reason: z.ZodString;
204
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
205
+ }, z.core.$strip>;
206
+ };
207
+ };
208
+ readonly getAgentToolsContext: {
209
+ readonly input: z.ZodObject<{
210
+ workspaceId: z.ZodString;
211
+ defaultConnectionId: z.ZodString;
212
+ }, z.core.$strip>;
213
+ readonly output: z.ZodObject<{
214
+ selectionCatalogs: z.ZodArray<z.ZodObject<{
215
+ provider: z.ZodString;
216
+ selectors: z.ZodArray<z.ZodObject<{
217
+ token: z.ZodString;
218
+ kind: z.ZodEnum<{
219
+ method: "method";
220
+ family: "family";
221
+ family_wildcard: "family_wildcard";
222
+ standalone: "standalone";
223
+ }>;
224
+ sensitivity: z.ZodEnum<{
225
+ read: "read";
226
+ write: "write";
227
+ }>;
228
+ sensitive: z.ZodBoolean;
229
+ }, z.core.$strip>>;
230
+ }, z.core.$strip>>;
231
+ catalogs: z.ZodArray<z.ZodObject<{
232
+ provider: z.ZodString;
233
+ tools: z.ZodArray<z.ZodObject<{
234
+ id: z.ZodString;
235
+ description: z.ZodString;
236
+ sensitivity: z.ZodEnum<{
237
+ read: "read";
238
+ write: "write";
239
+ }>;
240
+ sensitive: z.ZodBoolean;
241
+ requiredScope: z.ZodUnknown;
242
+ inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
243
+ outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
244
+ methods: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ id: z.ZodString;
246
+ description: z.ZodString;
247
+ sensitivity: z.ZodEnum<{
248
+ read: "read";
249
+ write: "write";
250
+ }>;
251
+ sensitive: z.ZodBoolean;
252
+ requiredScope: z.ZodUnknown;
253
+ }, z.core.$strip>>>;
254
+ }, z.core.$strip>>;
255
+ }, z.core.$strip>>;
256
+ workspaceConnections: z.ZodArray<z.ZodObject<{
257
+ slug: z.ZodString;
258
+ id: z.ZodString;
259
+ provider: z.ZodString;
260
+ capabilities: z.ZodArray<z.ZodEnum<{
261
+ source_control: "source_control";
262
+ agent_tools: "agent_tools";
263
+ }>>;
264
+ }, z.core.$strip>>;
265
+ defaultConnection: z.ZodNullable<z.ZodObject<{
266
+ id: z.ZodString;
267
+ slug: z.ZodString;
268
+ provider: z.ZodString;
269
+ }, z.core.$strip>>;
270
+ }, z.core.$strip>;
271
+ readonly errors: {
272
+ 'connection-not-found': z.ZodObject<{
273
+ connectionId: z.ZodString;
274
+ }, z.core.$strip>;
275
+ 'connection-inactive': z.ZodObject<{
276
+ connectionId: z.ZodString;
277
+ }, z.core.$strip>;
278
+ 'connection-workspace-mismatch': z.ZodObject<{
279
+ connectionId: z.ZodString;
280
+ }, z.core.$strip>;
281
+ 'provider-unavailable': z.ZodObject<{
282
+ provider: z.ZodString;
283
+ }, z.core.$strip>;
284
+ 'capability-unavailable': z.ZodObject<{
285
+ provider: z.ZodString;
286
+ capability: z.ZodEnum<{
287
+ source_control: "source_control";
288
+ agent_tools: "agent_tools";
289
+ }>;
290
+ }, z.core.$strip>;
291
+ 'checkout-unsupported': z.ZodObject<{
292
+ provider: z.ZodString;
293
+ }, z.core.$strip>;
294
+ 'provider-failure': z.ZodObject<{
295
+ reason: z.ZodString;
296
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
297
+ }, z.core.$strip>;
298
+ };
299
+ };
300
+ };
301
+ }>;
302
+ export type IntegrationsModuleClient = InterModuleClient<typeof integrationsInterModuleContract>;
303
+ //# sourceMappingURL=inter-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../src/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AA8BtB,kFAAkF;AAClF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8F1C,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -0,0 +1,189 @@
1
+ import { defineInterModuleContract } from '@shipfox/inter-module';
2
+ import { z } from 'zod';
3
+ const id = z.string().uuid();
4
+ const provider = z.string().min(1);
5
+ const capability = z.enum([
6
+ 'source_control',
7
+ 'agent_tools'
8
+ ]);
9
+ const repository = z.object({
10
+ externalRepositoryId: z.string(),
11
+ owner: z.string(),
12
+ name: z.string(),
13
+ fullName: z.string(),
14
+ defaultBranch: z.string(),
15
+ visibility: z.enum([
16
+ 'public',
17
+ 'private',
18
+ 'internal',
19
+ 'unknown'
20
+ ]),
21
+ cloneUrl: z.string(),
22
+ htmlUrl: z.string()
23
+ });
24
+ const sourceInput = z.object({
25
+ workspaceId: id,
26
+ connectionId: id,
27
+ externalRepositoryId: z.string()
28
+ });
29
+ const providerError = z.object({
30
+ reason: z.string(),
31
+ retryAfterSeconds: z.number().int().positive().optional()
32
+ });
33
+ const sourceErrors = {
34
+ 'connection-not-found': z.object({
35
+ connectionId: id
36
+ }),
37
+ 'connection-inactive': z.object({
38
+ connectionId: id
39
+ }),
40
+ 'connection-workspace-mismatch': z.object({
41
+ connectionId: id
42
+ }),
43
+ 'provider-unavailable': z.object({
44
+ provider
45
+ }),
46
+ 'capability-unavailable': z.object({
47
+ provider,
48
+ capability
49
+ }),
50
+ 'checkout-unsupported': z.object({
51
+ provider
52
+ }),
53
+ 'provider-failure': providerError
54
+ };
55
+ /** Producer-owned synchronous operations for the Integrations bounded context. */ export const integrationsInterModuleContract = defineInterModuleContract({
56
+ module: 'integrations',
57
+ methods: {
58
+ resolveSourceRepository: {
59
+ input: sourceInput,
60
+ output: z.object({
61
+ connection: z.object({
62
+ id,
63
+ provider,
64
+ slug: z.string()
65
+ }),
66
+ repository
67
+ }),
68
+ errors: sourceErrors
69
+ },
70
+ listSourceFiles: {
71
+ input: sourceInput.extend({
72
+ ref: z.string(),
73
+ prefix: z.string(),
74
+ limit: z.number().int().positive(),
75
+ cursor: z.string().optional()
76
+ }),
77
+ output: z.object({
78
+ files: z.array(z.object({
79
+ path: z.string(),
80
+ type: z.literal('file'),
81
+ size: z.number().int().nullable()
82
+ })),
83
+ nextCursor: z.string().nullable()
84
+ }),
85
+ errors: sourceErrors
86
+ },
87
+ fetchSourceFile: {
88
+ input: sourceInput.extend({
89
+ ref: z.string(),
90
+ path: z.string()
91
+ }),
92
+ output: z.object({
93
+ path: z.string(),
94
+ ref: z.string(),
95
+ content: z.string()
96
+ }),
97
+ errors: sourceErrors
98
+ },
99
+ createCheckoutSpec: {
100
+ input: sourceInput.extend({
101
+ ref: z.string().optional(),
102
+ permissions: z.object({
103
+ contents: z.enum([
104
+ 'read',
105
+ 'write'
106
+ ])
107
+ }).optional()
108
+ }),
109
+ output: z.object({
110
+ repositoryUrl: z.string(),
111
+ ref: z.string(),
112
+ credentials: z.object({
113
+ username: z.string(),
114
+ token: z.string(),
115
+ expiresAt: z.string().datetime()
116
+ }).optional(),
117
+ gitAuthor: z.object({
118
+ name: z.string(),
119
+ email: z.string()
120
+ }).optional()
121
+ }),
122
+ errors: sourceErrors
123
+ },
124
+ getAgentToolsContext: {
125
+ input: z.object({
126
+ workspaceId: id,
127
+ defaultConnectionId: id
128
+ }),
129
+ output: z.object({
130
+ selectionCatalogs: z.array(z.object({
131
+ provider,
132
+ selectors: z.array(z.object({
133
+ token: z.string(),
134
+ kind: z.enum([
135
+ 'family',
136
+ 'family_wildcard',
137
+ 'method',
138
+ 'standalone'
139
+ ]),
140
+ sensitivity: z.enum([
141
+ 'read',
142
+ 'write'
143
+ ]),
144
+ sensitive: z.boolean()
145
+ }))
146
+ })),
147
+ catalogs: z.array(z.object({
148
+ provider,
149
+ tools: z.array(z.object({
150
+ id: z.string(),
151
+ description: z.string(),
152
+ sensitivity: z.enum([
153
+ 'read',
154
+ 'write'
155
+ ]),
156
+ sensitive: z.boolean(),
157
+ requiredScope: z.unknown(),
158
+ inputSchema: z.record(z.string(), z.unknown()),
159
+ outputSchema: z.record(z.string(), z.unknown()).optional(),
160
+ methods: z.array(z.object({
161
+ id: z.string(),
162
+ description: z.string(),
163
+ sensitivity: z.enum([
164
+ 'read',
165
+ 'write'
166
+ ]),
167
+ sensitive: z.boolean(),
168
+ requiredScope: z.unknown()
169
+ })).optional()
170
+ }))
171
+ })),
172
+ workspaceConnections: z.array(z.object({
173
+ slug: z.string(),
174
+ id,
175
+ provider,
176
+ capabilities: z.array(capability)
177
+ })),
178
+ defaultConnection: z.object({
179
+ id,
180
+ slug: z.string(),
181
+ provider
182
+ }).nullable()
183
+ }),
184
+ errors: sourceErrors
185
+ }
186
+ }
187
+ });
188
+
189
+ //# sourceMappingURL=inter-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/inter-module.ts"],"sourcesContent":["import {defineInterModuleContract, type InterModuleClient} from '@shipfox/inter-module';\nimport {z} from 'zod';\n\nconst id = z.string().uuid();\nconst provider = z.string().min(1);\nconst capability = z.enum(['source_control', 'agent_tools']);\nconst repository = z.object({\n externalRepositoryId: z.string(),\n owner: z.string(),\n name: z.string(),\n fullName: z.string(),\n defaultBranch: z.string(),\n visibility: z.enum(['public', 'private', 'internal', 'unknown']),\n cloneUrl: z.string(),\n htmlUrl: z.string(),\n});\nconst sourceInput = z.object({workspaceId: id, connectionId: id, externalRepositoryId: z.string()});\nconst providerError = z.object({\n reason: z.string(),\n retryAfterSeconds: z.number().int().positive().optional(),\n});\nconst sourceErrors = {\n 'connection-not-found': z.object({connectionId: id}),\n 'connection-inactive': z.object({connectionId: id}),\n 'connection-workspace-mismatch': z.object({connectionId: id}),\n 'provider-unavailable': z.object({provider}),\n 'capability-unavailable': z.object({provider, capability}),\n 'checkout-unsupported': z.object({provider}),\n 'provider-failure': providerError,\n};\n\n/** Producer-owned synchronous operations for the Integrations bounded context. */\nexport const integrationsInterModuleContract = defineInterModuleContract({\n module: 'integrations',\n methods: {\n resolveSourceRepository: {\n input: sourceInput,\n output: z.object({connection: z.object({id, provider, slug: z.string()}), repository}),\n errors: sourceErrors,\n },\n listSourceFiles: {\n input: sourceInput.extend({\n ref: z.string(),\n prefix: z.string(),\n limit: z.number().int().positive(),\n cursor: z.string().optional(),\n }),\n output: z.object({\n files: z.array(\n z.object({path: z.string(), type: z.literal('file'), size: z.number().int().nullable()}),\n ),\n nextCursor: z.string().nullable(),\n }),\n errors: sourceErrors,\n },\n fetchSourceFile: {\n input: sourceInput.extend({ref: z.string(), path: z.string()}),\n output: z.object({path: z.string(), ref: z.string(), content: z.string()}),\n errors: sourceErrors,\n },\n createCheckoutSpec: {\n input: sourceInput.extend({\n ref: z.string().optional(),\n permissions: z.object({contents: z.enum(['read', 'write'])}).optional(),\n }),\n output: z.object({\n repositoryUrl: z.string(),\n ref: z.string(),\n credentials: z\n .object({username: z.string(), token: z.string(), expiresAt: z.string().datetime()})\n .optional(),\n gitAuthor: z.object({name: z.string(), email: z.string()}).optional(),\n }),\n errors: sourceErrors,\n },\n getAgentToolsContext: {\n input: z.object({workspaceId: id, defaultConnectionId: id}),\n output: z.object({\n selectionCatalogs: z.array(\n z.object({\n provider,\n selectors: z.array(\n z.object({\n token: z.string(),\n kind: z.enum(['family', 'family_wildcard', 'method', 'standalone']),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n }),\n ),\n }),\n ),\n catalogs: z.array(\n z.object({\n provider,\n tools: z.array(\n z.object({\n id: z.string(),\n description: z.string(),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n requiredScope: z.unknown(),\n inputSchema: z.record(z.string(), z.unknown()),\n outputSchema: z.record(z.string(), z.unknown()).optional(),\n methods: z\n .array(\n z.object({\n id: z.string(),\n description: z.string(),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n requiredScope: z.unknown(),\n }),\n )\n .optional(),\n }),\n ),\n }),\n ),\n workspaceConnections: z.array(\n z.object({slug: z.string(), id, provider, capabilities: z.array(capability)}),\n ),\n defaultConnection: z.object({id, slug: z.string(), provider}).nullable(),\n }),\n errors: sourceErrors,\n },\n },\n});\n\nexport type IntegrationsModuleClient = InterModuleClient<typeof integrationsInterModuleContract>;\n"],"names":["defineInterModuleContract","z","id","string","uuid","provider","min","capability","enum","repository","object","externalRepositoryId","owner","name","fullName","defaultBranch","visibility","cloneUrl","htmlUrl","sourceInput","workspaceId","connectionId","providerError","reason","retryAfterSeconds","number","int","positive","optional","sourceErrors","integrationsInterModuleContract","module","methods","resolveSourceRepository","input","output","connection","slug","errors","listSourceFiles","extend","ref","prefix","limit","cursor","files","array","path","type","literal","size","nullable","nextCursor","fetchSourceFile","content","createCheckoutSpec","permissions","contents","repositoryUrl","credentials","username","token","expiresAt","datetime","gitAuthor","email","getAgentToolsContext","defaultConnectionId","selectionCatalogs","selectors","kind","sensitivity","sensitive","boolean","catalogs","tools","description","requiredScope","unknown","inputSchema","record","out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