@shipfox/api-integration-core-dto 3.0.0 → 6.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.
@@ -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","outputSchema","workspaceConnections","capabilities","defaultConnection"],"mappings":"AAAA,SAAQA,yBAAyB,QAA+B,wBAAwB;AACxF,SAAQC,CAAC,QAAO,MAAM;AAEtB,MAAMC,KAAKD,EAAEE,MAAM,GAAGC,IAAI;AAC1B,MAAMC,WAAWJ,EAAEE,MAAM,GAAGG,GAAG,CAAC;AAChC,MAAMC,aAAaN,EAAEO,IAAI,CAAC;IAAC;IAAkB;CAAc;AAC3D,MAAMC,aAAaR,EAAES,MAAM,CAAC;IAC1BC,sBAAsBV,EAAEE,MAAM;IAC9BS,OAAOX,EAAEE,MAAM;IACfU,MAAMZ,EAAEE,MAAM;IACdW,UAAUb,EAAEE,MAAM;IAClBY,eAAed,EAAEE,MAAM;IACvBa,YAAYf,EAAEO,IAAI,CAAC;QAAC;QAAU;QAAW;QAAY;KAAU;IAC/DS,UAAUhB,EAAEE,MAAM;IAClBe,SAASjB,EAAEE,MAAM;AACnB;AACA,MAAMgB,cAAclB,EAAES,MAAM,CAAC;IAACU,aAAalB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AQ,GAAG8C,QAAQ;YACxE;YACAb,QAAQT;QACV;IACF;AACF,GAAG"}
package/dist/ports.d.ts CHANGED
@@ -42,6 +42,13 @@ export type RecordDeliveryOnlyFn = (params: {
42
42
  provider: string;
43
43
  deliveryId: string;
44
44
  }) => Promise<void>;
45
+ export type ClaimWebhookDeliveryFn = (params: {
46
+ tx: IntegrationTx;
47
+ provider: string;
48
+ deliveryId: string;
49
+ }) => Promise<{
50
+ claimed: boolean;
51
+ }>;
45
52
  export type GetIntegrationConnectionByIdFn = (id: string, options?: {
46
53
  tx?: IntegrationTx;
47
54
  }) => Promise<IntegrationConnection | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,oCAAoC,EACrC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,6BAA6B,EAAE,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAQjF;;;;;GAKG;AAEH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAEhC,MAAM,MAAM,iCAAiC,GAAG,CAAC,MAAM,EAAE;IACvD,EAAE,EAAE,aAAa,CAAC;IAClB,KAAK,EAAE,6BAA6B,CAAC;CACtC,KAAK,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,CAAC,CAAC;AAEpC,MAAM,MAAM,6BAA6B,GAAG,CAC1C,MAAM,EAAE;IACN,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,oCAAoC,GAAG,SAAS,CAAC;CACpE,EACD,OAAO,CAAC,EAAE;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAC,KAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAC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,CAAC,CAAC;AAEpC,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE;IAC1C,EAAE,EAAE,aAAa,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpB,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE;IAC5C,EAAE,EAAE,aAAa,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,KAAK,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAAC,CAAC;AAElC,MAAM,MAAM,8BAA8B,GAAG,CAC3C,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAC,KAC3B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;AAEhD,MAAM,MAAM,4CAA4C,GAAG,CACzD,MAAM,EAAE;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,oCAAoC,CAAA;CAAC,EAC3E,OAAO,CAAC,EAAE;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAC,KAC3B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;AAEhD,MAAM,MAAM,6BAA6B,GAAG,CAC1C,MAAM,EAAE;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,EACpB,OAAO,CAAC,EAAE;IAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAAC,KAC3B,OAAO,CAAC,OAAO,CAAC,CAAC"}
package/dist/ports.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ports.ts"],"sourcesContent":["import type {\n IntegrationConnection,\n IntegrationConnectionLifecycleStatus,\n} from '#contracts/index.js';\nimport type {IntegrationEventReceivedEvent, SourcePushPayload} from '#events.js';\n\n// The persistence seam between the integrations core and a provider package.\n// `@shipfox/api-integration-core` implements these against its own tables and\n// injects them into each provider at composition time, so providers depend only\n// on this contract — never on core itself, which would create a dependency cycle\n// (core composes the providers).\n\n/**\n * Database/transaction handle threaded from core into a provider and back into\n * core-owned persistence. Typed loosely so providers don't take a Drizzle\n * dependency just to pass a transaction through; core supplies the concrete\n * executor and conformance is checked where it wires the providers.\n */\n// biome-ignore lint/suspicious/noExplicitAny: cross-package tx handle, kept opaque to avoid a cyclic dep on core\nexport type IntegrationTx = any;\n\nexport type PublishIntegrationEventReceivedFn = (params: {\n tx: IntegrationTx;\n event: IntegrationEventReceivedEvent;\n}) => Promise<{published: boolean}>;\n\nexport type CreateIntegrationConnectionFn = (\n params: {\n workspaceId: string;\n provider: string;\n externalAccountId: string;\n slug: string;\n displayName: string;\n lifecycleStatus?: IntegrationConnectionLifecycleStatus | undefined;\n },\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection>;\n\n// Emitted by source-control providers for a single push. The delivery dedup and the outbox\n// rows it writes must commit together, so it requires a transaction, never a bare connection.\nexport type PublishSourcePushFn = (params: {\n tx: IntegrationTx;\n provider: string;\n source: string;\n workspaceId: string;\n connectionId: string;\n connectionName: string;\n deliveryId: string;\n receivedAt: string;\n rawPayload: unknown;\n push: SourcePushPayload;\n}) => Promise<{published: boolean}>;\n\nexport type RecordDeliveryOnlyFn = (params: {\n tx: IntegrationTx;\n provider: string;\n deliveryId: string;\n}) => Promise<void>;\n\nexport type GetIntegrationConnectionByIdFn = (\n id: string,\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection | undefined>;\n\nexport type UpdateIntegrationConnectionLifecycleStatusFn = (\n params: {id: string; lifecycleStatus: IntegrationConnectionLifecycleStatus},\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection | undefined>;\n\nexport type DeleteIntegrationConnectionFn = (\n params: {id: string},\n options?: {tx?: IntegrationTx},\n) => Promise<boolean>;\n"],"names":[],"mappings":"AAqEA,WAGsB"}
1
+ {"version":3,"sources":["../src/ports.ts"],"sourcesContent":["import type {\n IntegrationConnection,\n IntegrationConnectionLifecycleStatus,\n} from '#contracts/index.js';\nimport type {IntegrationEventReceivedEvent, SourcePushPayload} from '#events.js';\n\n// The persistence seam between the integrations core and a provider package.\n// `@shipfox/api-integration-core` implements these against its own tables and\n// injects them into each provider at composition time, so providers depend only\n// on this contract — never on core itself, which would create a dependency cycle\n// (core composes the providers).\n\n/**\n * Database/transaction handle threaded from core into a provider and back into\n * core-owned persistence. Typed loosely so providers don't take a Drizzle\n * dependency just to pass a transaction through; core supplies the concrete\n * executor and conformance is checked where it wires the providers.\n */\n// biome-ignore lint/suspicious/noExplicitAny: cross-package tx handle, kept opaque to avoid a cyclic dep on core\nexport type IntegrationTx = any;\n\nexport type PublishIntegrationEventReceivedFn = (params: {\n tx: IntegrationTx;\n event: IntegrationEventReceivedEvent;\n}) => Promise<{published: boolean}>;\n\nexport type CreateIntegrationConnectionFn = (\n params: {\n workspaceId: string;\n provider: string;\n externalAccountId: string;\n slug: string;\n displayName: string;\n lifecycleStatus?: IntegrationConnectionLifecycleStatus | undefined;\n },\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection>;\n\n// Emitted by source-control providers for a single push. The delivery dedup and the outbox\n// rows it writes must commit together, so it requires a transaction, never a bare connection.\nexport type PublishSourcePushFn = (params: {\n tx: IntegrationTx;\n provider: string;\n source: string;\n workspaceId: string;\n connectionId: string;\n connectionName: string;\n deliveryId: string;\n receivedAt: string;\n rawPayload: unknown;\n push: SourcePushPayload;\n}) => Promise<{published: boolean}>;\n\nexport type RecordDeliveryOnlyFn = (params: {\n tx: IntegrationTx;\n provider: string;\n deliveryId: string;\n}) => Promise<void>;\n\nexport type ClaimWebhookDeliveryFn = (params: {\n tx: IntegrationTx;\n provider: string;\n deliveryId: string;\n}) => Promise<{claimed: boolean}>;\n\nexport type GetIntegrationConnectionByIdFn = (\n id: string,\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection | undefined>;\n\nexport type UpdateIntegrationConnectionLifecycleStatusFn = (\n params: {id: string; lifecycleStatus: IntegrationConnectionLifecycleStatus},\n options?: {tx?: IntegrationTx},\n) => Promise<IntegrationConnection | undefined>;\n\nexport type DeleteIntegrationConnectionFn = (\n params: {id: string},\n options?: {tx?: IntegrationTx},\n) => Promise<boolean>;\n"],"names":[],"mappings":"AA2EA,WAGsB"}