@shipfox/api-integration-jira 12.1.1 → 12.2.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/api-integration-jira",
3
3
  "license": "MIT",
4
- "version": "12.1.1",
4
+ "version": "12.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ShipfoxHQ/shipfox.git",
@@ -27,15 +27,15 @@
27
27
  "drizzle-orm": "^0.45.2",
28
28
  "ky": "^2.0.0",
29
29
  "zod": "^4.4.3",
30
- "@shipfox/api-auth-context": "12.0.0",
31
- "@shipfox/api-integration-spi": "1.0.0",
32
- "@shipfox/api-integration-jira-dto": "12.0.0",
30
+ "@shipfox/api-auth-context": "12.2.0",
31
+ "@shipfox/api-integration-spi": "1.0.1",
32
+ "@shipfox/api-integration-jira-dto": "12.2.0",
33
33
  "@shipfox/config": "1.2.4",
34
34
  "@shipfox/node-drizzle": "0.3.5",
35
- "@shipfox/node-fastify": "0.4.1",
35
+ "@shipfox/node-fastify": "0.4.2",
36
36
  "@shipfox/node-jwt": "0.4.0",
37
- "@shipfox/node-module": "1.0.5",
38
- "@shipfox/node-opentelemetry": "0.6.3",
37
+ "@shipfox/node-module": "1.0.6",
38
+ "@shipfox/node-opentelemetry": "0.6.4",
39
39
  "@shipfox/node-postgres": "0.5.0"
40
40
  },
41
41
  "imports": {
package/src/index.test.ts CHANGED
@@ -31,6 +31,17 @@ describe('createJiraIntegrationProvider', () => {
31
31
  }),
32
32
  ).toThrow('requires all webhook receiver dependencies');
33
33
  });
34
+
35
+ it('exposes explicit connection cleanup without requiring routes', () => {
36
+ const deleteConnectionRecords = vi.fn(() => Promise.resolve());
37
+ const deleteConnectionSecrets = vi.fn(() => Promise.resolve());
38
+ const provider = createJiraIntegrationProvider({
39
+ cleanup: {deleteConnectionRecords, deleteConnectionSecrets},
40
+ });
41
+
42
+ expect(provider.deleteConnectionRecords).toBe(deleteConnectionRecords);
43
+ expect(provider.deleteConnectionSecrets).toBe(deleteConnectionSecrets);
44
+ });
34
45
  });
35
46
 
36
47
  describe('createJiraMaintenanceWorker', () => {
package/src/index.ts CHANGED
@@ -126,6 +126,7 @@ export {
126
126
  updateJiraInstallationWebhook,
127
127
  upsertJiraInstallation,
128
128
  withJiraRefreshLock,
129
+ withJiraRefreshLockAndWait,
129
130
  withJiraWebhookRegistrationLock,
130
131
  } from '#db/installations.js';
131
132
  export type {CreateJiraWebhookRoutesOptions} from '#presentation/routes/webhooks.js';
@@ -142,6 +143,15 @@ export interface CreateJiraIntegrationProviderOptions {
142
143
  }
143
144
  | undefined;
144
145
  getJiraInstallationByConnectionId?: typeof getJiraInstallationByConnectionId | undefined;
146
+ cleanup?:
147
+ | {
148
+ deleteConnectionRecords?: (
149
+ connection: {id: string},
150
+ options: {tx: unknown},
151
+ ) => Promise<void>;
152
+ deleteConnectionSecrets?: (connection: {id: string; workspaceId: string}) => Promise<void>;
153
+ }
154
+ | undefined;
145
155
  routes?: JiraIntegrationProviderRoutesOptions | undefined;
146
156
  }
147
157
 
@@ -210,6 +220,7 @@ export function createJiraIntegrationProvider(options: CreateJiraIntegrationProv
210
220
  async connectionExternalUrl(connection: {id: string}): Promise<string | undefined> {
211
221
  return (await getInstallationByConnectionId(connection.id))?.siteUrl;
212
222
  },
223
+ ...options.cleanup,
213
224
  routes,
214
225
  webhookProcessors: webhookProcessor
215
226
  ? [{routeIds: ['jira'] as const, processor: webhookProcessor}]