@shipfox/api-integration-core 11.0.0 → 12.1.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.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +73 -0
- package/dist/core/providers/source-control.d.ts +1 -1
- package/dist/core/providers/source-control.d.ts.map +1 -1
- package/dist/core/providers/source-control.js.map +1 -1
- package/dist/core/source-control-service.d.ts +7 -1
- package/dist/core/source-control-service.d.ts.map +1 -1
- package/dist/core/source-control-service.js +11 -0
- package/dist/core/source-control-service.js.map +1 -1
- package/dist/db/connections.d.ts +6 -0
- package/dist/db/connections.d.ts.map +1 -1
- package/dist/db/connections.js +6 -0
- package/dist/db/connections.js.map +1 -1
- package/dist/db/webhook-deliveries.d.ts +18 -1
- package/dist/db/webhook-deliveries.d.ts.map +1 -1
- package/dist/db/webhook-deliveries.js +65 -19
- package/dist/db/webhook-deliveries.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +10 -1
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/providers/github.d.ts.map +1 -1
- package/dist/providers/github.js +2 -1
- package/dist/providers/github.js.map +1 -1
- package/dist/providers/jira.d.ts.map +1 -1
- package/dist/providers/jira.js +44 -12
- package/dist/providers/jira.js.map +1 -1
- package/dist/providers/types.d.ts +1 -1
- package/dist/providers/types.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/core/agent-tool-selection.test.ts +1 -0
- package/src/core/providers/registry.test.ts +1 -0
- package/src/core/providers/source-control.ts +1 -0
- package/src/core/source-control-service.test.ts +25 -0
- package/src/core/source-control-service.ts +21 -0
- package/src/db/connections.test.ts +18 -0
- package/src/db/connections.ts +25 -0
- package/src/db/webhook-deliveries.test.ts +77 -0
- package/src/db/webhook-deliveries.ts +110 -21
- package/src/index.ts +13 -3
- package/src/presentation/inter-module.ts +11 -1
- package/src/presentation/routes/list-repositories.test.ts +1 -0
- package/src/providers/github.ts +2 -0
- package/src/providers/jira.test.ts +5 -0
- package/src/providers/jira.ts +45 -11
- package/src/providers/types.ts +1 -1
- package/test/env.ts +0 -1
- package/test/route-utils.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/src/providers/jira.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
upsertIntegrationConnection,
|
|
14
14
|
} from '#db/connections.js';
|
|
15
15
|
import {db} from '#db/db.js';
|
|
16
|
+
import {publishIntegrationEventReceived, recordDeliveryOnly} from '#db/webhook-deliveries.js';
|
|
16
17
|
import {retryConnectionSlugCollision, slugifyConnectionSlug} from '#providers/connection-slug.js';
|
|
17
18
|
import type {IntegrationModuleParts, IntegrationProviderModule} from '#providers/types.js';
|
|
18
19
|
|
|
@@ -25,6 +26,7 @@ async function loadJiraModuleParts(
|
|
|
25
26
|
): Promise<IntegrationModuleParts> {
|
|
26
27
|
const {
|
|
27
28
|
createJiraIntegrationProvider,
|
|
29
|
+
createJiraMaintenanceWorker,
|
|
28
30
|
createJiraPendingSelectionStore,
|
|
29
31
|
createJiraTokenStore,
|
|
30
32
|
db: jiraDb,
|
|
@@ -140,19 +142,51 @@ async function loadJiraModuleParts(
|
|
|
140
142
|
});
|
|
141
143
|
const pendingStore = createJiraPendingSelectionStore({secrets});
|
|
142
144
|
|
|
145
|
+
const integrationProvider = createJiraIntegrationProvider({
|
|
146
|
+
agentTools: {tokenStore},
|
|
147
|
+
routes: {
|
|
148
|
+
tokenStore,
|
|
149
|
+
pendingStore,
|
|
150
|
+
getExistingJiraConnection,
|
|
151
|
+
connectJiraInstallation,
|
|
152
|
+
disconnectJiraInstallation,
|
|
153
|
+
coreDb: db,
|
|
154
|
+
publishIntegrationEventReceived,
|
|
155
|
+
recordDeliveryOnly,
|
|
156
|
+
getIntegrationConnectionById,
|
|
157
|
+
markConnectionActive: async ({connectionId, tx}) => {
|
|
158
|
+
await updateIntegrationConnectionLifecycleStatus(
|
|
159
|
+
{
|
|
160
|
+
id: connectionId,
|
|
161
|
+
lifecycleStatus: 'active',
|
|
162
|
+
},
|
|
163
|
+
tx === undefined ? {} : {tx: tx as IntegrationTx},
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
markConnectionError: async ({connectionId, tx}) => {
|
|
167
|
+
await updateIntegrationConnectionLifecycleStatus(
|
|
168
|
+
{
|
|
169
|
+
id: connectionId,
|
|
170
|
+
lifecycleStatus: 'error',
|
|
171
|
+
},
|
|
172
|
+
tx === undefined ? {} : {tx: tx as IntegrationTx},
|
|
173
|
+
);
|
|
174
|
+
},
|
|
175
|
+
...(options.requireActiveWorkspaceMembership
|
|
176
|
+
? {requireActiveWorkspaceMembership: options.requireActiveWorkspaceMembership}
|
|
177
|
+
: {}),
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
143
181
|
return {
|
|
144
|
-
provider:
|
|
145
|
-
|
|
182
|
+
provider: integrationProvider,
|
|
183
|
+
workers: [
|
|
184
|
+
createJiraMaintenanceWorker({
|
|
146
185
|
tokenStore,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
...(options.requireActiveWorkspaceMembership
|
|
152
|
-
? {requireActiveWorkspaceMembership: options.requireActiveWorkspaceMembership}
|
|
153
|
-
: {}),
|
|
154
|
-
},
|
|
155
|
-
}),
|
|
186
|
+
resolveConnection: getIntegrationConnectionById,
|
|
187
|
+
}),
|
|
188
|
+
],
|
|
189
|
+
webhookProcessors: integrationProvider.webhookProcessors,
|
|
156
190
|
database: {db: jiraDb, migrationsPath, databaseNamespace: 'integrations_jira'},
|
|
157
191
|
};
|
|
158
192
|
}
|
package/src/providers/types.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type {IntegrationProvider} from '#core/entities/provider.js';
|
|
|
10
10
|
* and one-shot boot-time tasks. Providers that own none of these simply omit them.
|
|
11
11
|
*
|
|
12
12
|
* A startup task is run once after modules are initialized (migrations done). The
|
|
13
|
-
* provider owns its own wiring
|
|
13
|
+
* provider owns its own wiring: core runs each task generically and isolates
|
|
14
14
|
* failures so a task can never gate API boot.
|
|
15
15
|
*/
|
|
16
16
|
export interface IntegrationModuleParts {
|
package/test/env.ts
CHANGED
|
@@ -15,7 +15,6 @@ process.env.GITHUB_INSTALL_STATE_SECRET = 'test-install-state-secret';
|
|
|
15
15
|
process.env.JIRA_OAUTH_CLIENT_ID = 'test-client-id';
|
|
16
16
|
process.env.JIRA_OAUTH_CLIENT_SECRET = 'test-client-secret';
|
|
17
17
|
process.env.JIRA_OAUTH_REDIRECT_URL = 'https://shipfox.example.com/integrations/jira/callback';
|
|
18
|
-
process.env.JIRA_WEBHOOK_SIGNING_SECRET = 'test-webhook-secret';
|
|
19
18
|
process.env.JIRA_WEBHOOK_BASE_URL = 'https://shipfox.example.com';
|
|
20
19
|
process.env.JIRA_API_BASE_URL = 'https://jira.example.com/api';
|
|
21
20
|
process.env.JIRA_AUTH_BASE_URL = 'https://jira.example.com/auth';
|