@shipfox/api-integration-core 12.0.0 → 12.1.1
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/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +42 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/db/db.d.ts +6 -6
- package/dist/db/schema/connections.d.ts +1 -1
- package/dist/db/schema/outbox.d.ts +1 -1
- package/dist/db/schema/webhook-deliveries.d.ts +1 -1
- package/dist/presentation/dto/integrations.d.ts +3 -3
- package/dist/presentation/dto/integrations.d.ts.map +1 -1
- package/dist/providers/jira.d.ts.map +1 -1
- package/dist/providers/jira.js +10 -1
- package/dist/providers/jira.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/providers/jira.test.ts +3 -0
- package/src/providers/jira.ts +8 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled: 50 files with swc (
|
|
3
|
-
2026-08-
|
|
2
|
+
Successfully compiled: 50 files with swc (418.39ms)
|
|
3
|
+
2026-08-05T14:09:59.637Z [INFO] asset workflow-bundle-646aca428e9943f8cf17.js 3.17 MiB [emitted] [immutable] (name: main)
|
|
4
4
|
orphan modules 33.5 KiB [orphan] 21 modules
|
|
5
5
|
runtime modules 1.13 KiB 5 modules
|
|
6
6
|
modules by path ../../../../node_modules/.pnpm/ 970 KiB 196 modules
|
|
@@ -12,6 +12,6 @@ optional modules 30 bytes [optional]
|
|
|
12
12
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
13
13
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
14
14
|
../../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
|
|
15
|
-
webpack 5.107.2 compiled successfully in
|
|
16
|
-
2026-08-
|
|
15
|
+
webpack 5.107.2 compiled successfully in 7262 ms
|
|
16
|
+
2026-08-05T14:09:59.645Z [INFO] Workflow bundle created { size: '3.17MB' }
|
|
17
17
|
/home/runner/work/shipfox/shipfox/libs/api/integration/core/dist/temporal/workflows/index.js: 3323154 bytes
|
package/.turbo/turbo-type.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @shipfox/api-integration-core
|
|
2
2
|
|
|
3
|
+
## 12.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [4636839]
|
|
8
|
+
- @shipfox/api-integration-jira@12.1.1
|
|
9
|
+
- @shipfox/api-agent-dto@12.0.0
|
|
10
|
+
- @shipfox/api-auth-context@12.0.0
|
|
11
|
+
- @shipfox/api-integration-core-dto@12.0.0
|
|
12
|
+
- @shipfox/api-integration-gitea@12.0.0
|
|
13
|
+
- @shipfox/api-integration-github@12.0.0
|
|
14
|
+
- @shipfox/api-integration-linear@12.0.0
|
|
15
|
+
- @shipfox/api-integration-sentry@12.0.0
|
|
16
|
+
- @shipfox/api-integration-slack@12.0.0
|
|
17
|
+
- @shipfox/api-integration-spi@1.0.0
|
|
18
|
+
- @shipfox/api-integration-webhook@12.0.0
|
|
19
|
+
- @shipfox/api-workflows-dto@12.1.0
|
|
20
|
+
- @shipfox/api-workspaces-dto@12.0.0
|
|
21
|
+
- @shipfox/config@1.2.4
|
|
22
|
+
- @shipfox/inter-module@0.2.3
|
|
23
|
+
- @shipfox/redact@0.2.6
|
|
24
|
+
- @shipfox/regex@0.2.4
|
|
25
|
+
- @shipfox/node-drizzle@0.3.5
|
|
26
|
+
- @shipfox/node-error-monitoring@0.3.0
|
|
27
|
+
- @shipfox/node-fastify@0.4.1
|
|
28
|
+
- @shipfox/node-module@1.0.5
|
|
29
|
+
- @shipfox/node-opentelemetry@0.6.3
|
|
30
|
+
- @shipfox/node-outbox@0.2.6
|
|
31
|
+
- @shipfox/node-postgres@0.5.0
|
|
32
|
+
- @shipfox/node-temporal@0.4.4
|
|
33
|
+
|
|
34
|
+
## 12.1.0
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 70e33c0: Adds the in-process Jira REST agent-tool catalog and write-selection support.
|
|
39
|
+
- Updated dependencies [70e33c0]
|
|
40
|
+
- Updated dependencies [312a137]
|
|
41
|
+
- Updated dependencies [af7adfc]
|
|
42
|
+
- @shipfox/api-integration-jira@12.1.0
|
|
43
|
+
- @shipfox/api-workflows-dto@12.1.0
|
|
44
|
+
|
|
3
45
|
## 12.0.0
|
|
4
46
|
|
|
5
47
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAC,qBAAqB,EAAE,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AAE/F,qBAAa,kCAAmC,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAC,qBAAqB,EAAE,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AAE/F,qBAAa,kCAAmC,SAAQ,KAAK;IAC3D,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,kCAAmC,SAAQ,KAAK;IAC3D,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,2CAA4C,SAAQ,KAAK;IACpE,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,uCAAwC,SAAQ,KAAK;aAE9C,WAAW,EAAE,MAAM;aACnB,QAAQ,EAAE,uBAAuB;aACjC,iBAAiB,EAAE,MAAM;IAH3C,YACkB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,uBAAuB,EACjC,iBAAiB,EAAE,MAAM,EAI1C;CACF;AAED,qBAAa,qCAAsC,SAAQ,KAAK;aAE5C,UAAU,EAAE,qBAAqB;aACjC,QAAQ,EAAE,uBAAuB;IAFnD,YACkB,UAAU,EAAE,qBAAqB,EACjC,QAAQ,EAAE,uBAAuB,EAGlD;CACF;AAED,qBAAa,mCAAoC,SAAQ,KAAK;aAChC,QAAQ,EAAE,uBAAuB;IAA7D,YAA4B,QAAQ,EAAE,uBAAuB,EAE5D;CACF;AAED,qBAAa,mCAAoC,SAAQ,KAAK;aAChC,QAAQ,EAAE,uBAAuB;IAA7D,YAA4B,QAAQ,EAAE,uBAAuB,EAE5D;CACF;AAED,qBAAa,kCAAmC,SAAQ,KAAK;aAC/B,OAAO,EAAE,MAAM;IAA3C,YAA4B,OAAO,EAAE,MAAM,EAG1C;CACF;AAED,OAAO,EAAC,2BAA2B,EAAE,wBAAwB,EAAE,KAAK,8BAA8B,EAAC,CAAC"}
|
package/dist/db/db.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ export declare const schema: {
|
|
|
158
158
|
generated: undefined;
|
|
159
159
|
}, {}, {}>;
|
|
160
160
|
};
|
|
161
|
-
dialect:
|
|
161
|
+
dialect: 'pg';
|
|
162
162
|
}>;
|
|
163
163
|
integrationsOutbox: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
164
164
|
name: "outbox";
|
|
@@ -352,7 +352,7 @@ export declare const schema: {
|
|
|
352
352
|
generated: undefined;
|
|
353
353
|
}, {}, {}>;
|
|
354
354
|
};
|
|
355
|
-
dialect:
|
|
355
|
+
dialect: 'pg';
|
|
356
356
|
}>;
|
|
357
357
|
integrationsWebhookDeliveries: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
358
358
|
name: "webhook_deliveries";
|
|
@@ -427,7 +427,7 @@ export declare const schema: {
|
|
|
427
427
|
generated: undefined;
|
|
428
428
|
}, {}, {}>;
|
|
429
429
|
};
|
|
430
|
-
dialect:
|
|
430
|
+
dialect: 'pg';
|
|
431
431
|
}>;
|
|
432
432
|
};
|
|
433
433
|
export declare function db(): NodePgDatabase<{
|
|
@@ -589,7 +589,7 @@ export declare function db(): NodePgDatabase<{
|
|
|
589
589
|
generated: undefined;
|
|
590
590
|
}, {}, {}>;
|
|
591
591
|
};
|
|
592
|
-
dialect:
|
|
592
|
+
dialect: 'pg';
|
|
593
593
|
}>;
|
|
594
594
|
integrationsOutbox: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
595
595
|
name: "outbox";
|
|
@@ -783,7 +783,7 @@ export declare function db(): NodePgDatabase<{
|
|
|
783
783
|
generated: undefined;
|
|
784
784
|
}, {}, {}>;
|
|
785
785
|
};
|
|
786
|
-
dialect:
|
|
786
|
+
dialect: 'pg';
|
|
787
787
|
}>;
|
|
788
788
|
integrationsWebhookDeliveries: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
789
789
|
name: "webhook_deliveries";
|
|
@@ -858,7 +858,7 @@ export declare function db(): NodePgDatabase<{
|
|
|
858
858
|
generated: undefined;
|
|
859
859
|
}, {}, {}>;
|
|
860
860
|
};
|
|
861
|
-
dialect:
|
|
861
|
+
dialect: 'pg';
|
|
862
862
|
}>;
|
|
863
863
|
}>;
|
|
864
864
|
export declare function closeDb(): void;
|
|
@@ -157,7 +157,7 @@ export declare const integrationConnections: import("drizzle-orm/pg-core").PgTab
|
|
|
157
157
|
generated: undefined;
|
|
158
158
|
}, {}, {}>;
|
|
159
159
|
};
|
|
160
|
-
dialect:
|
|
160
|
+
dialect: 'pg';
|
|
161
161
|
}>;
|
|
162
162
|
export type IntegrationConnectionDb = typeof integrationConnections.$inferSelect;
|
|
163
163
|
export type IntegrationConnectionCreateDb = typeof integrationConnections.$inferInsert;
|
|
@@ -10,9 +10,6 @@ export declare function toIntegrationConnectionDto(connection: IntegrationConnec
|
|
|
10
10
|
capabilities: IntegrationCapability[];
|
|
11
11
|
externalUrl?: string | undefined;
|
|
12
12
|
}): {
|
|
13
|
-
created_at: string;
|
|
14
|
-
updated_at: string;
|
|
15
|
-
external_url?: string;
|
|
16
13
|
id: string;
|
|
17
14
|
workspace_id: string;
|
|
18
15
|
provider: string;
|
|
@@ -21,6 +18,9 @@ export declare function toIntegrationConnectionDto(connection: IntegrationConnec
|
|
|
21
18
|
display_name: string;
|
|
22
19
|
lifecycle_status: import("#core/entities/connection.js").IntegrationConnectionLifecycleStatus;
|
|
23
20
|
capabilities: IntegrationCapability[];
|
|
21
|
+
external_url?: string;
|
|
22
|
+
created_at: string;
|
|
23
|
+
updated_at: string;
|
|
24
24
|
};
|
|
25
25
|
export declare function toRepositoryDto(connectionId: string, repository: RepositorySnapshot): {
|
|
26
26
|
connection_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EACV,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mCAAmC,CAAC;AAE1E,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,6BAA6B
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EACV,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mCAAmC,CAAC;AAE1E,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,6BAA6B;IAE5E,QAAQ;IACR,YAAY;IACZ,YAAY;EAEf;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,qBAAqB,EACjC,OAAO,EAAE;IACP,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;;;;;;;;;;;;EAGF;AAsBD,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB;IAEhF,aAAa;IACb,sBAAsB;IACtB,KAAK;IACL,IAAI;IACJ,SAAS;IACT,cAAc;IACd,UAAU;IACV,SAAS;IACT,QAAQ;EAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jira.d.ts","sourceRoot":"","sources":["../../src/providers/jira.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAyB,yBAAyB,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"jira.d.ts","sourceRoot":"","sources":["../../src/providers/jira.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAyB,yBAAyB,EAAC,MAAM,qBAAqB,CAAC;AAgL3F,eAAO,MAAM,kBAAkB,EAAE,yBAIhC,CAAC"}
|
package/dist/providers/jira.js
CHANGED
|
@@ -5,7 +5,7 @@ import { publishIntegrationEventReceived, recordDeliveryOnly } from '#db/webhook
|
|
|
5
5
|
import { retryConnectionSlugCollision, slugifyConnectionSlug } from '#providers/connection-slug.js';
|
|
6
6
|
const JIRA_SECRETS_NAMESPACE_PREFIX = 'system/integrations/jira/';
|
|
7
7
|
async function loadJiraModuleParts(options = {}) {
|
|
8
|
-
const { createJiraIntegrationProvider, createJiraPendingSelectionStore, createJiraTokenStore, db: jiraDb, disconnectJiraInstallation: disconnectJiraInstallationRecords, getJiraInstallationByCloudId, migrationsPath, upsertJiraInstallation } = await import('@shipfox/api-integration-jira');
|
|
8
|
+
const { createJiraIntegrationProvider, createJiraMaintenanceWorker, createJiraPendingSelectionStore, createJiraTokenStore, db: jiraDb, disconnectJiraInstallation: disconnectJiraInstallationRecords, getJiraInstallationByCloudId, migrationsPath, upsertJiraInstallation } = await import('@shipfox/api-integration-jira');
|
|
9
9
|
async function getExistingJiraConnection(input) {
|
|
10
10
|
const installation = await getJiraInstallationByCloudId(input.cloudId);
|
|
11
11
|
if (!installation) return undefined;
|
|
@@ -95,6 +95,9 @@ async function loadJiraModuleParts(options = {}) {
|
|
|
95
95
|
secrets
|
|
96
96
|
});
|
|
97
97
|
const integrationProvider = createJiraIntegrationProvider({
|
|
98
|
+
agentTools: {
|
|
99
|
+
tokenStore
|
|
100
|
+
},
|
|
98
101
|
routes: {
|
|
99
102
|
tokenStore,
|
|
100
103
|
pendingStore,
|
|
@@ -128,6 +131,12 @@ async function loadJiraModuleParts(options = {}) {
|
|
|
128
131
|
});
|
|
129
132
|
return {
|
|
130
133
|
provider: integrationProvider,
|
|
134
|
+
workers: [
|
|
135
|
+
createJiraMaintenanceWorker({
|
|
136
|
+
tokenStore,
|
|
137
|
+
resolveConnection: getIntegrationConnectionById
|
|
138
|
+
})
|
|
139
|
+
],
|
|
131
140
|
webhookProcessors: integrationProvider.webhookProcessors,
|
|
132
141
|
database: {
|
|
133
142
|
db: jiraDb,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/jira.ts"],"sourcesContent":["import type {\n ConnectJiraInstallationInput,\n JiraPendingSelectionSecretsStore,\n JiraSecretsStore,\n} from '@shipfox/api-integration-jira';\nimport type {IntegrationConnection as CoreIntegrationConnection} from '@shipfox/api-integration-spi';\nimport {config} from '#config.js';\nimport {\n deleteIntegrationConnection,\n getIntegrationConnectionById,\n resolveUniqueConnectionSlug,\n updateIntegrationConnectionLifecycleStatus,\n upsertIntegrationConnection,\n} from '#db/connections.js';\nimport {db} from '#db/db.js';\nimport {publishIntegrationEventReceived, recordDeliveryOnly} from '#db/webhook-deliveries.js';\nimport {retryConnectionSlugCollision, slugifyConnectionSlug} from '#providers/connection-slug.js';\nimport type {IntegrationModuleParts, IntegrationProviderModule} from '#providers/types.js';\n\nconst JIRA_SECRETS_NAMESPACE_PREFIX = 'system/integrations/jira/';\ntype IntegrationDb = ReturnType<typeof db>;\ntype IntegrationTx = Parameters<Parameters<IntegrationDb['transaction']>[0]>[0];\n\nasync function loadJiraModuleParts(\n options: Parameters<IntegrationProviderModule['load']>[0] = {},\n): Promise<IntegrationModuleParts> {\n const {\n createJiraIntegrationProvider,\n createJiraPendingSelectionStore,\n createJiraTokenStore,\n db: jiraDb,\n disconnectJiraInstallation: disconnectJiraInstallationRecords,\n getJiraInstallationByCloudId,\n migrationsPath,\n upsertJiraInstallation,\n } = await import('@shipfox/api-integration-jira');\n\n async function getExistingJiraConnection(input: {\n cloudId: string;\n }): Promise<CoreIntegrationConnection<'jira'> | undefined> {\n const installation = await getJiraInstallationByCloudId(input.cloudId);\n if (!installation) return undefined;\n return (await getIntegrationConnectionById(installation.connectionId)) as\n | CoreIntegrationConnection<'jira'>\n | undefined;\n }\n\n function connectJiraInstallation(\n input: ConnectJiraInstallationInput,\n ): Promise<CoreIntegrationConnection<'jira'>> {\n return retryConnectionSlugCollision(() =>\n db().transaction(async (tx) => {\n const slug = await resolveUniqueConnectionSlug(\n {\n workspaceId: input.workspaceId,\n provider: 'jira',\n externalAccountId: input.cloudId,\n baseSlug: slugifyConnectionSlug(`jira_${input.siteName || input.cloudId}`, {\n fallback: 'jira',\n }),\n },\n {tx},\n );\n const connection = await upsertIntegrationConnection(\n {\n workspaceId: input.workspaceId,\n provider: 'jira',\n externalAccountId: input.cloudId,\n slug,\n displayName: input.displayName,\n lifecycleStatus: 'active',\n },\n {tx},\n );\n await upsertJiraInstallation(\n {\n connectionId: connection.id,\n cloudId: input.cloudId,\n siteUrl: input.siteUrl,\n siteName: input.siteName,\n authorizingAccountId: input.authorizingAccountId,\n scopes: input.scopes,\n status: 'installed',\n tokenExpiresAt: input.tokenExpiresAt,\n },\n {tx},\n );\n return connection as CoreIntegrationConnection<'jira'>;\n }),\n );\n }\n\n async function disconnectJiraInstallation(input: {connectionId: string}): Promise<void> {\n await disconnectJiraInstallationRecords<IntegrationTx>({\n connectionId: input.connectionId,\n getConnection: getIntegrationConnectionById,\n deleteSecrets: (params) =>\n options.secrets?.jira?.deleteSecrets({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(0),\n transaction: (fn) => db().transaction((tx) => fn(tx)),\n deleteConnection: (params, transactionOptions) =>\n deleteIntegrationConnection({id: params.connectionId}, transactionOptions),\n });\n }\n\n const fallbackSecrets: JiraSecretsStore & JiraPendingSelectionSecretsStore = {\n getSecret: () => Promise.resolve(null),\n setSecrets: () => Promise.reject(new Error('Jira token storage is not configured')),\n deleteSecrets: () => Promise.resolve(0),\n };\n const secrets: JiraSecretsStore & JiraPendingSelectionSecretsStore = options.secrets?.jira\n ? {\n getSecret: (params) =>\n options.secrets?.jira?.getSecret({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(null),\n setSecrets: (params) =>\n options.secrets?.jira?.setSecrets({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(),\n deleteSecrets: (params) =>\n options.secrets?.jira?.deleteSecrets({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(0),\n }\n : fallbackSecrets;\n const tokenStore = createJiraTokenStore({\n resolveConnection: getIntegrationConnectionById,\n secrets,\n markConnectionError: async ({connectionId}) => {\n await updateIntegrationConnectionLifecycleStatus({\n id: connectionId,\n lifecycleStatus: 'error',\n });\n },\n });\n const pendingStore = createJiraPendingSelectionStore({secrets});\n\n const integrationProvider = createJiraIntegrationProvider({\n routes: {\n tokenStore,\n pendingStore,\n getExistingJiraConnection,\n connectJiraInstallation,\n disconnectJiraInstallation,\n coreDb: db,\n publishIntegrationEventReceived,\n recordDeliveryOnly,\n getIntegrationConnectionById,\n markConnectionActive: async ({connectionId, tx}) => {\n await updateIntegrationConnectionLifecycleStatus(\n {\n id: connectionId,\n lifecycleStatus: 'active',\n },\n tx === undefined ? {} : {tx: tx as IntegrationTx},\n );\n },\n markConnectionError: async ({connectionId, tx}) => {\n await updateIntegrationConnectionLifecycleStatus(\n {\n id: connectionId,\n lifecycleStatus: 'error',\n },\n tx === undefined ? {} : {tx: tx as IntegrationTx},\n );\n },\n ...(options.requireActiveWorkspaceMembership\n ? {requireActiveWorkspaceMembership: options.requireActiveWorkspaceMembership}\n : {}),\n },\n });\n\n return {\n provider: integrationProvider,\n webhookProcessors: integrationProvider.webhookProcessors,\n database: {db: jiraDb, migrationsPath, databaseNamespace: 'integrations_jira'},\n };\n}\n\nexport const jiraProviderModule: IntegrationProviderModule = {\n id: 'jira',\n enabled: config.INTEGRATIONS_ENABLE_JIRA_PROVIDER,\n load: loadJiraModuleParts,\n};\n\nfunction jiraNamespaceSuffix(namespace: string): string {\n if (!namespace.startsWith(JIRA_SECRETS_NAMESPACE_PREFIX)) {\n throw new Error('Jira provider attempted to access an unscoped secret namespace');\n }\n return namespace.slice(JIRA_SECRETS_NAMESPACE_PREFIX.length);\n}\n"],"names":["config","deleteIntegrationConnection","getIntegrationConnectionById","resolveUniqueConnectionSlug","updateIntegrationConnectionLifecycleStatus","upsertIntegrationConnection","db","publishIntegrationEventReceived","recordDeliveryOnly","retryConnectionSlugCollision","slugifyConnectionSlug","JIRA_SECRETS_NAMESPACE_PREFIX","loadJiraModuleParts","options","createJiraIntegrationProvider","createJiraPendingSelectionStore","createJiraTokenStore","jiraDb","disconnectJiraInstallation","disconnectJiraInstallationRecords","getJiraInstallationByCloudId","migrationsPath","upsertJiraInstallation","getExistingJiraConnection","input","installation","cloudId","undefined","connectionId","connectJiraInstallation","transaction","tx","slug","workspaceId","provider","externalAccountId","baseSlug","siteName","fallback","connection","displayName","lifecycleStatus","id","siteUrl","authorizingAccountId","scopes","status","tokenExpiresAt","getConnection","deleteSecrets","params","secrets","jira","namespace","jiraNamespaceSuffix","Promise","resolve","fn","deleteConnection","transactionOptions","fallbackSecrets","getSecret","setSecrets","reject","Error","tokenStore","resolveConnection","markConnectionError","pendingStore","integrationProvider","routes","coreDb","markConnectionActive","requireActiveWorkspaceMembership","webhookProcessors","database","databaseNamespace","jiraProviderModule","enabled","INTEGRATIONS_ENABLE_JIRA_PROVIDER","load","startsWith","slice","length"],"mappings":"AAMA,SAAQA,MAAM,QAAO,aAAa;AAClC,SACEC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,2BAA2B,EAC3BC,0CAA0C,EAC1CC,2BAA2B,QACtB,qBAAqB;AAC5B,SAAQC,EAAE,QAAO,YAAY;AAC7B,SAAQC,+BAA+B,EAAEC,kBAAkB,QAAO,4BAA4B;AAC9F,SAAQC,4BAA4B,EAAEC,qBAAqB,QAAO,gCAAgC;AAGlG,MAAMC,gCAAgC;AAItC,eAAeC,oBACbC,UAA4D,CAAC,CAAC;IAE9D,MAAM,EACJC,6BAA6B,EAC7BC,+BAA+B,EAC/BC,oBAAoB,EACpBV,IAAIW,MAAM,EACVC,4BAA4BC,iCAAiC,EAC7DC,4BAA4B,EAC5BC,cAAc,EACdC,sBAAsB,EACvB,GAAG,MAAM,MAAM,CAAC;IAEjB,eAAeC,0BAA0BC,KAExC;QACC,MAAMC,eAAe,MAAML,6BAA6BI,MAAME,OAAO;QACrE,IAAI,CAACD,cAAc,OAAOE;QAC1B,OAAQ,MAAMzB,6BAA6BuB,aAAaG,YAAY;IAGtE;IAEA,SAASC,wBACPL,KAAmC;QAEnC,OAAOf,6BAA6B,IAClCH,KAAKwB,WAAW,CAAC,OAAOC;gBACtB,MAAMC,OAAO,MAAM7B,4BACjB;oBACE8B,aAAaT,MAAMS,WAAW;oBAC9BC,UAAU;oBACVC,mBAAmBX,MAAME,OAAO;oBAChCU,UAAU1B,sBAAsB,CAAC,KAA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AAgC;YAAA,IAC3E,CAAC,CAAC;QACR;IACF;IAEA,OAAO;QACLvC,UAAUmC;QACVK,mBAAmBL,oBAAoBK,iBAAiB;QACxDC,UAAU;YAACrE,IAAIW;YAAQI;YAAgBuD,mBAAmB;QAAmB;IAC/E;AACF;AAEA,OAAO,MAAMC,qBAAgD;IAC3DnC,IAAI;IACJoC,SAAS9E,OAAO+E,iCAAiC;IACjDC,MAAMpE;AACR,EAAE;AAEF,SAAS0C,oBAAoBD,SAAiB;IAC5C,IAAI,CAACA,UAAU4B,UAAU,CAACtE,gCAAgC;QACxD,MAAM,IAAIqD,MAAM;IAClB;IACA,OAAOX,UAAU6B,KAAK,CAACvE,8BAA8BwE,MAAM;AAC7D"}
|
|
1
|
+
{"version":3,"sources":["../../src/providers/jira.ts"],"sourcesContent":["import type {\n ConnectJiraInstallationInput,\n JiraPendingSelectionSecretsStore,\n JiraSecretsStore,\n} from '@shipfox/api-integration-jira';\nimport type {IntegrationConnection as CoreIntegrationConnection} from '@shipfox/api-integration-spi';\nimport {config} from '#config.js';\nimport {\n deleteIntegrationConnection,\n getIntegrationConnectionById,\n resolveUniqueConnectionSlug,\n updateIntegrationConnectionLifecycleStatus,\n upsertIntegrationConnection,\n} from '#db/connections.js';\nimport {db} from '#db/db.js';\nimport {publishIntegrationEventReceived, recordDeliveryOnly} from '#db/webhook-deliveries.js';\nimport {retryConnectionSlugCollision, slugifyConnectionSlug} from '#providers/connection-slug.js';\nimport type {IntegrationModuleParts, IntegrationProviderModule} from '#providers/types.js';\n\nconst JIRA_SECRETS_NAMESPACE_PREFIX = 'system/integrations/jira/';\ntype IntegrationDb = ReturnType<typeof db>;\ntype IntegrationTx = Parameters<Parameters<IntegrationDb['transaction']>[0]>[0];\n\nasync function loadJiraModuleParts(\n options: Parameters<IntegrationProviderModule['load']>[0] = {},\n): Promise<IntegrationModuleParts> {\n const {\n createJiraIntegrationProvider,\n createJiraMaintenanceWorker,\n createJiraPendingSelectionStore,\n createJiraTokenStore,\n db: jiraDb,\n disconnectJiraInstallation: disconnectJiraInstallationRecords,\n getJiraInstallationByCloudId,\n migrationsPath,\n upsertJiraInstallation,\n } = await import('@shipfox/api-integration-jira');\n\n async function getExistingJiraConnection(input: {\n cloudId: string;\n }): Promise<CoreIntegrationConnection<'jira'> | undefined> {\n const installation = await getJiraInstallationByCloudId(input.cloudId);\n if (!installation) return undefined;\n return (await getIntegrationConnectionById(installation.connectionId)) as\n | CoreIntegrationConnection<'jira'>\n | undefined;\n }\n\n function connectJiraInstallation(\n input: ConnectJiraInstallationInput,\n ): Promise<CoreIntegrationConnection<'jira'>> {\n return retryConnectionSlugCollision(() =>\n db().transaction(async (tx) => {\n const slug = await resolveUniqueConnectionSlug(\n {\n workspaceId: input.workspaceId,\n provider: 'jira',\n externalAccountId: input.cloudId,\n baseSlug: slugifyConnectionSlug(`jira_${input.siteName || input.cloudId}`, {\n fallback: 'jira',\n }),\n },\n {tx},\n );\n const connection = await upsertIntegrationConnection(\n {\n workspaceId: input.workspaceId,\n provider: 'jira',\n externalAccountId: input.cloudId,\n slug,\n displayName: input.displayName,\n lifecycleStatus: 'active',\n },\n {tx},\n );\n await upsertJiraInstallation(\n {\n connectionId: connection.id,\n cloudId: input.cloudId,\n siteUrl: input.siteUrl,\n siteName: input.siteName,\n authorizingAccountId: input.authorizingAccountId,\n scopes: input.scopes,\n status: 'installed',\n tokenExpiresAt: input.tokenExpiresAt,\n },\n {tx},\n );\n return connection as CoreIntegrationConnection<'jira'>;\n }),\n );\n }\n\n async function disconnectJiraInstallation(input: {connectionId: string}): Promise<void> {\n await disconnectJiraInstallationRecords<IntegrationTx>({\n connectionId: input.connectionId,\n getConnection: getIntegrationConnectionById,\n deleteSecrets: (params) =>\n options.secrets?.jira?.deleteSecrets({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(0),\n transaction: (fn) => db().transaction((tx) => fn(tx)),\n deleteConnection: (params, transactionOptions) =>\n deleteIntegrationConnection({id: params.connectionId}, transactionOptions),\n });\n }\n\n const fallbackSecrets: JiraSecretsStore & JiraPendingSelectionSecretsStore = {\n getSecret: () => Promise.resolve(null),\n setSecrets: () => Promise.reject(new Error('Jira token storage is not configured')),\n deleteSecrets: () => Promise.resolve(0),\n };\n const secrets: JiraSecretsStore & JiraPendingSelectionSecretsStore = options.secrets?.jira\n ? {\n getSecret: (params) =>\n options.secrets?.jira?.getSecret({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(null),\n setSecrets: (params) =>\n options.secrets?.jira?.setSecrets({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(),\n deleteSecrets: (params) =>\n options.secrets?.jira?.deleteSecrets({\n ...params,\n namespace: jiraNamespaceSuffix(params.namespace),\n }) ?? Promise.resolve(0),\n }\n : fallbackSecrets;\n const tokenStore = createJiraTokenStore({\n resolveConnection: getIntegrationConnectionById,\n secrets,\n markConnectionError: async ({connectionId}) => {\n await updateIntegrationConnectionLifecycleStatus({\n id: connectionId,\n lifecycleStatus: 'error',\n });\n },\n });\n const pendingStore = createJiraPendingSelectionStore({secrets});\n\n const integrationProvider = createJiraIntegrationProvider({\n agentTools: {tokenStore},\n routes: {\n tokenStore,\n pendingStore,\n getExistingJiraConnection,\n connectJiraInstallation,\n disconnectJiraInstallation,\n coreDb: db,\n publishIntegrationEventReceived,\n recordDeliveryOnly,\n getIntegrationConnectionById,\n markConnectionActive: async ({connectionId, tx}) => {\n await updateIntegrationConnectionLifecycleStatus(\n {\n id: connectionId,\n lifecycleStatus: 'active',\n },\n tx === undefined ? {} : {tx: tx as IntegrationTx},\n );\n },\n markConnectionError: async ({connectionId, tx}) => {\n await updateIntegrationConnectionLifecycleStatus(\n {\n id: connectionId,\n lifecycleStatus: 'error',\n },\n tx === undefined ? {} : {tx: tx as IntegrationTx},\n );\n },\n ...(options.requireActiveWorkspaceMembership\n ? {requireActiveWorkspaceMembership: options.requireActiveWorkspaceMembership}\n : {}),\n },\n });\n\n return {\n provider: integrationProvider,\n workers: [\n createJiraMaintenanceWorker({\n tokenStore,\n resolveConnection: getIntegrationConnectionById,\n }),\n ],\n webhookProcessors: integrationProvider.webhookProcessors,\n database: {db: jiraDb, migrationsPath, databaseNamespace: 'integrations_jira'},\n };\n}\n\nexport const jiraProviderModule: IntegrationProviderModule = {\n id: 'jira',\n enabled: config.INTEGRATIONS_ENABLE_JIRA_PROVIDER,\n load: loadJiraModuleParts,\n};\n\nfunction jiraNamespaceSuffix(namespace: string): string {\n if (!namespace.startsWith(JIRA_SECRETS_NAMESPACE_PREFIX)) {\n throw new Error('Jira provider attempted to access an unscoped secret namespace');\n }\n return namespace.slice(JIRA_SECRETS_NAMESPACE_PREFIX.length);\n}\n"],"names":["config","deleteIntegrationConnection","getIntegrationConnectionById","resolveUniqueConnectionSlug","updateIntegrationConnectionLifecycleStatus","upsertIntegrationConnection","db","publishIntegrationEventReceived","recordDeliveryOnly","retryConnectionSlugCollision","slugifyConnectionSlug","JIRA_SECRETS_NAMESPACE_PREFIX","loadJiraModuleParts","options","createJiraIntegrationProvider","createJiraMaintenanceWorker","createJiraPendingSelectionStore","createJiraTokenStore","jiraDb","disconnectJiraInstallation","disconnectJiraInstallationRecords","getJiraInstallationByCloudId","migrationsPath","upsertJiraInstallation","getExistingJiraConnection","input","installation","cloudId","undefined","connectionId","connectJiraInstallation","transaction","tx","slug","workspaceId","provider","externalAccountId","baseSlug","siteName","fallback","connection","displayName","lifecycleStatus","id","siteUrl","authorizingAccountId","scopes","status","tokenExpiresAt","getConnection","deleteSecrets","params","secrets","jira","namespace","jiraNamespaceSuffix","Promise","resolve","fn","deleteConnection","transactionOptions","fallbackSecrets","getSecret","setSecrets","reject","Error","tokenStore","resolveConnection","markConnectionError","pendingStore","integrationProvider","agentTools","routes","coreDb","markConnectionActive","requireActiveWorkspaceMembership","workers","webhookProcessors","database","databaseNamespace","jiraProviderModule","enabled","INTEGRATIONS_ENABLE_JIRA_PROVIDER","load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