@shipfox/api-integration-linear 3.0.0 → 5.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +33 -0
- package/dist/db/installations.d.ts.map +1 -1
- package/dist/db/installations.js +1 -11
- package/dist/db/installations.js.map +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +18 -28
- package/src/db/installations.ts +1 -18
- package/src/index.test.ts +11 -0
- package/src/index.ts +11 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/turbo.json +9 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-integration-linear",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -13,22 +13,12 @@
|
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
14
|
"imports": {
|
|
15
15
|
"#test/*": "./test/*",
|
|
16
|
-
"#*":
|
|
17
|
-
"workspace-source": "./src/*",
|
|
18
|
-
"development": "./src/*",
|
|
19
|
-
"default": "./dist/*"
|
|
20
|
-
}
|
|
16
|
+
"#*": "./dist/*"
|
|
21
17
|
},
|
|
22
18
|
"exports": {
|
|
23
19
|
".": {
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
"default": "./src/index.ts"
|
|
27
|
-
},
|
|
28
|
-
"default": {
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"default": "./dist/index.js"
|
|
31
|
-
}
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.js"
|
|
32
22
|
}
|
|
33
23
|
},
|
|
34
24
|
"dependencies": {
|
|
@@ -36,29 +26,29 @@
|
|
|
36
26
|
"drizzle-orm": "^0.45.2",
|
|
37
27
|
"ky": "^2.0.0",
|
|
38
28
|
"zod": "^4.4.3",
|
|
39
|
-
"@shipfox/api-auth-context": "
|
|
40
|
-
"@shipfox/api-integration-core-dto": "
|
|
41
|
-
"@shipfox/api-
|
|
42
|
-
"@shipfox/
|
|
43
|
-
"@shipfox/
|
|
44
|
-
"@shipfox/node-drizzle": "0.
|
|
45
|
-
"@shipfox/node-fastify": "0.2.
|
|
46
|
-
"@shipfox/node-opentelemetry": "0.5.
|
|
47
|
-
"@shipfox/node-postgres": "0.4.
|
|
29
|
+
"@shipfox/api-auth-context": "5.0.0",
|
|
30
|
+
"@shipfox/api-integration-core-dto": "5.0.0",
|
|
31
|
+
"@shipfox/api-workspaces": "5.0.0",
|
|
32
|
+
"@shipfox/config": "1.2.2",
|
|
33
|
+
"@shipfox/api-integration-linear-dto": "5.0.0",
|
|
34
|
+
"@shipfox/node-drizzle": "0.3.1",
|
|
35
|
+
"@shipfox/node-fastify": "0.2.3",
|
|
36
|
+
"@shipfox/node-opentelemetry": "0.5.2",
|
|
37
|
+
"@shipfox/node-postgres": "0.4.2"
|
|
48
38
|
},
|
|
49
39
|
"peerDependencies": {
|
|
50
|
-
"@shipfox/api-secrets": "
|
|
40
|
+
"@shipfox/api-secrets": "5.0.0"
|
|
51
41
|
},
|
|
52
42
|
"devDependencies": {
|
|
53
43
|
"@types/pg": "^8.15.5",
|
|
54
44
|
"drizzle-kit": "^0.31.10",
|
|
55
45
|
"fastify": "^5.3.3",
|
|
56
46
|
"fishery": "^2.4.0",
|
|
57
|
-
"@shipfox/biome": "1.8.
|
|
58
|
-
"@shipfox/swc": "1.2.
|
|
47
|
+
"@shipfox/biome": "1.8.2",
|
|
48
|
+
"@shipfox/swc": "1.2.6",
|
|
49
|
+
"@shipfox/typescript": "1.1.7",
|
|
59
50
|
"@shipfox/ts-config": "1.3.8",
|
|
60
|
-
"@shipfox/
|
|
61
|
-
"@shipfox/vitest": "1.2.2"
|
|
51
|
+
"@shipfox/vitest": "1.2.3"
|
|
62
52
|
},
|
|
63
53
|
"scripts": {
|
|
64
54
|
"build": "shipfox-swc",
|
package/src/db/installations.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {isUniqueViolation} from '@shipfox/node-drizzle';
|
|
1
2
|
import {pgClient} from '@shipfox/node-postgres';
|
|
2
3
|
import {eq} from 'drizzle-orm';
|
|
3
4
|
import {
|
|
@@ -41,12 +42,6 @@ export interface UpdateLinearInstallationTokenExpiryParams {
|
|
|
41
42
|
type LinearDb = ReturnType<typeof db>;
|
|
42
43
|
type LinearTx = Parameters<Parameters<LinearDb['transaction']>[0]>[0];
|
|
43
44
|
|
|
44
|
-
interface PostgresErrorFields {
|
|
45
|
-
code?: unknown;
|
|
46
|
-
constraint?: unknown;
|
|
47
|
-
cause?: unknown;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
45
|
export async function upsertLinearInstallation(
|
|
51
46
|
params: UpsertLinearInstallationParams,
|
|
52
47
|
options: {tx?: unknown} = {},
|
|
@@ -93,18 +88,6 @@ export async function upsertLinearInstallation(
|
|
|
93
88
|
return toLinearInstallation(row);
|
|
94
89
|
}
|
|
95
90
|
|
|
96
|
-
function isUniqueViolation(error: unknown, constraint: string): boolean {
|
|
97
|
-
let current = error;
|
|
98
|
-
while (typeof current === 'object' && current !== null) {
|
|
99
|
-
const postgresError = current as PostgresErrorFields;
|
|
100
|
-
if (postgresError.code === '23505' && postgresError.constraint === constraint) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
current = postgresError.cause;
|
|
104
|
-
}
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
91
|
export async function getLinearInstallationByConnectionId(
|
|
109
92
|
connectionId: string,
|
|
110
93
|
options: {tx?: unknown} = {},
|
package/src/index.test.ts
CHANGED
|
@@ -17,4 +17,15 @@ describe('createLinearIntegrationProvider', () => {
|
|
|
17
17
|
|
|
18
18
|
expect(provider.adapters.agent_tools?.catalog()).toBe(linearAgentToolCatalog);
|
|
19
19
|
});
|
|
20
|
+
|
|
21
|
+
it('exposes explicit connection cleanup without requiring routes', () => {
|
|
22
|
+
const deleteConnectionRecords = vi.fn(() => Promise.resolve());
|
|
23
|
+
const deleteConnectionSecrets = vi.fn(() => Promise.resolve());
|
|
24
|
+
const provider = createLinearIntegrationProvider({
|
|
25
|
+
cleanup: {deleteConnectionRecords, deleteConnectionSecrets},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
expect(provider.deleteConnectionRecords).toBe(deleteConnectionRecords);
|
|
29
|
+
expect(provider.deleteConnectionSecrets).toBe(deleteConnectionSecrets);
|
|
30
|
+
});
|
|
20
31
|
});
|
package/src/index.ts
CHANGED
|
@@ -74,6 +74,7 @@ export type {
|
|
|
74
74
|
UpsertLinearInstallationParams,
|
|
75
75
|
} from '#db/installations.js';
|
|
76
76
|
export {
|
|
77
|
+
deleteLinearInstallationByConnectionId,
|
|
77
78
|
getLinearInstallationByConnectionId,
|
|
78
79
|
getLinearInstallationByOrganizationId,
|
|
79
80
|
markLinearInstallationRevoked,
|
|
@@ -97,6 +98,15 @@ export interface CreateLinearIntegrationProviderOptions {
|
|
|
97
98
|
}
|
|
98
99
|
| undefined;
|
|
99
100
|
getLinearInstallationByConnectionId?: typeof getLinearInstallationByConnectionId | undefined;
|
|
101
|
+
cleanup?:
|
|
102
|
+
| {
|
|
103
|
+
deleteConnectionRecords?: (
|
|
104
|
+
connection: {id: string},
|
|
105
|
+
options: {tx: unknown},
|
|
106
|
+
) => Promise<void>;
|
|
107
|
+
deleteConnectionSecrets?: (connection: {id: string; workspaceId: string}) => Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
| undefined;
|
|
100
110
|
routes?:
|
|
101
111
|
| (Omit<CreateLinearIntegrationRoutesOptions, 'linear' | 'connectionCapabilities'> &
|
|
102
112
|
Partial<CreateLinearWebhookRoutesOptions>)
|
|
@@ -137,6 +147,7 @@ export function createLinearIntegrationProvider(
|
|
|
137
147
|
if (!installation?.organizationUrlKey) return undefined;
|
|
138
148
|
return `https://linear.app/${encodeURIComponent(installation.organizationUrlKey)}/settings`;
|
|
139
149
|
},
|
|
150
|
+
...options.cleanup,
|
|
140
151
|
routes,
|
|
141
152
|
};
|
|
142
153
|
}
|