@shipfox/api-integration-core 11.0.0 → 12.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.
Files changed (53) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +62 -0
  3. package/dist/core/providers/source-control.d.ts +1 -1
  4. package/dist/core/providers/source-control.d.ts.map +1 -1
  5. package/dist/core/providers/source-control.js.map +1 -1
  6. package/dist/core/source-control-service.d.ts +7 -1
  7. package/dist/core/source-control-service.d.ts.map +1 -1
  8. package/dist/core/source-control-service.js +11 -0
  9. package/dist/core/source-control-service.js.map +1 -1
  10. package/dist/db/connections.d.ts +6 -0
  11. package/dist/db/connections.d.ts.map +1 -1
  12. package/dist/db/connections.js +6 -0
  13. package/dist/db/connections.js.map +1 -1
  14. package/dist/db/webhook-deliveries.d.ts +18 -1
  15. package/dist/db/webhook-deliveries.d.ts.map +1 -1
  16. package/dist/db/webhook-deliveries.js +65 -19
  17. package/dist/db/webhook-deliveries.js.map +1 -1
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/presentation/inter-module.d.ts.map +1 -1
  23. package/dist/presentation/inter-module.js +10 -1
  24. package/dist/presentation/inter-module.js.map +1 -1
  25. package/dist/providers/github.d.ts.map +1 -1
  26. package/dist/providers/github.js +2 -1
  27. package/dist/providers/github.js.map +1 -1
  28. package/dist/providers/jira.d.ts.map +1 -1
  29. package/dist/providers/jira.js +35 -12
  30. package/dist/providers/jira.js.map +1 -1
  31. package/dist/providers/types.d.ts +1 -1
  32. package/dist/providers/types.js.map +1 -1
  33. package/dist/tsconfig.test.tsbuildinfo +1 -1
  34. package/package.json +20 -20
  35. package/src/core/agent-tool-selection.test.ts +1 -0
  36. package/src/core/providers/registry.test.ts +1 -0
  37. package/src/core/providers/source-control.ts +1 -0
  38. package/src/core/source-control-service.test.ts +25 -0
  39. package/src/core/source-control-service.ts +21 -0
  40. package/src/db/connections.test.ts +18 -0
  41. package/src/db/connections.ts +25 -0
  42. package/src/db/webhook-deliveries.test.ts +77 -0
  43. package/src/db/webhook-deliveries.ts +110 -21
  44. package/src/index.ts +13 -3
  45. package/src/presentation/inter-module.ts +11 -1
  46. package/src/presentation/routes/list-repositories.test.ts +1 -0
  47. package/src/providers/github.ts +2 -0
  48. package/src/providers/jira.test.ts +2 -0
  49. package/src/providers/jira.ts +38 -12
  50. package/src/providers/types.ts +1 -1
  51. package/test/env.ts +0 -1
  52. package/test/route-utils.ts +1 -0
  53. package/tsconfig.build.tsbuildinfo +1 -1
@@ -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
 
@@ -140,19 +141,44 @@ async function loadJiraModuleParts(
140
141
  });
141
142
  const pendingStore = createJiraPendingSelectionStore({secrets});
142
143
 
143
- return {
144
- provider: createJiraIntegrationProvider({
145
- routes: {
146
- tokenStore,
147
- pendingStore,
148
- getExistingJiraConnection,
149
- connectJiraInstallation,
150
- disconnectJiraInstallation,
151
- ...(options.requireActiveWorkspaceMembership
152
- ? {requireActiveWorkspaceMembership: options.requireActiveWorkspaceMembership}
153
- : {}),
144
+ const integrationProvider = createJiraIntegrationProvider({
145
+ routes: {
146
+ tokenStore,
147
+ pendingStore,
148
+ getExistingJiraConnection,
149
+ connectJiraInstallation,
150
+ disconnectJiraInstallation,
151
+ coreDb: db,
152
+ publishIntegrationEventReceived,
153
+ recordDeliveryOnly,
154
+ getIntegrationConnectionById,
155
+ markConnectionActive: async ({connectionId, tx}) => {
156
+ await updateIntegrationConnectionLifecycleStatus(
157
+ {
158
+ id: connectionId,
159
+ lifecycleStatus: 'active',
160
+ },
161
+ tx === undefined ? {} : {tx: tx as IntegrationTx},
162
+ );
154
163
  },
155
- }),
164
+ markConnectionError: async ({connectionId, tx}) => {
165
+ await updateIntegrationConnectionLifecycleStatus(
166
+ {
167
+ id: connectionId,
168
+ lifecycleStatus: 'error',
169
+ },
170
+ tx === undefined ? {} : {tx: tx as IntegrationTx},
171
+ );
172
+ },
173
+ ...(options.requireActiveWorkspaceMembership
174
+ ? {requireActiveWorkspaceMembership: options.requireActiveWorkspaceMembership}
175
+ : {}),
176
+ },
177
+ });
178
+
179
+ return {
180
+ provider: integrationProvider,
181
+ webhookProcessors: integrationProvider.webhookProcessors,
156
182
  database: {db: jiraDb, migrationsPath, databaseNamespace: 'integrations_jira'},
157
183
  };
158
184
  }
@@ -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 core runs each task generically and isolates
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';
@@ -66,6 +66,7 @@ export function sourceProvider(overrides: Partial<IntegrationProvider> = {}): In
66
66
  await Promise.resolve();
67
67
  throw new Error('not used');
68
68
  },
69
+ resolveTriggerReference: () => null,
69
70
  },
70
71
  },
71
72
  ...overrides,