@shipfox/client-integrations 4.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 +22 -0
- package/dist/feature.d.ts +11 -0
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +14 -0
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/integrations.d.ts +6 -1
- package/dist/hooks/api/integrations.d.ts.map +1 -1
- package/dist/hooks/api/integrations.js +15 -12
- package/dist/hooks/api/integrations.js.map +1 -1
- package/dist/pages/linear-callback-page.d.ts.map +1 -1
- package/dist/pages/linear-callback-page.js +1 -1
- package/dist/pages/linear-callback-page.js.map +1 -1
- package/dist/pages/sentry-callback-page.js +1 -1
- package/dist/pages/sentry-callback-page.js.map +1 -1
- package/dist/pages/slack-callback-page.d.ts.map +1 -1
- package/dist/pages/slack-callback-page.js +1 -1
- package/dist/pages/slack-callback-page.js.map +1 -1
- package/dist/routes/github-callback.js +1 -1
- package/dist/routes/github-callback.js.map +1 -1
- package/dist/routes/integrations-settings.d.ts +6 -0
- package/dist/routes/integrations-settings.d.ts.map +1 -0
- package/dist/routes/integrations-settings.js +7 -0
- package/dist/routes/integrations-settings.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/feature.ts +14 -0
- package/src/hooks/api/integrations.ts +32 -8
- package/src/pages/linear-callback-page.test.tsx +1 -1
- package/src/pages/linear-callback-page.tsx +2 -1
- package/src/pages/sentry-callback-page.test.tsx +1 -1
- package/src/pages/sentry-callback-page.tsx +1 -1
- package/src/pages/slack-callback-page.tsx +2 -1
- package/src/routes/github-callback.tsx +1 -1
- package/src/routes/integrations-settings.tsx +4 -0
- package/test/render.tsx +1 -5
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/client-integrations",
|
|
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",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@swc/helpers": "^0.5.17",
|
|
33
33
|
"@tanstack/react-form": "^1.32.0",
|
|
34
|
-
"@shipfox/api-integration-core-dto": "
|
|
35
|
-
"@shipfox/api-integration-gitea-dto": "
|
|
36
|
-
"@shipfox/api-integration-github-dto": "
|
|
37
|
-
"@shipfox/api-integration-linear-dto": "
|
|
38
|
-
"@shipfox/api-integration-slack-dto": "
|
|
39
|
-
"@shipfox/api-integration-sentry-dto": "
|
|
40
|
-
"@shipfox/api-integration-webhook-dto": "
|
|
34
|
+
"@shipfox/api-integration-core-dto": "8.0.0",
|
|
35
|
+
"@shipfox/api-integration-gitea-dto": "8.0.0",
|
|
36
|
+
"@shipfox/api-integration-github-dto": "8.0.0",
|
|
37
|
+
"@shipfox/api-integration-linear-dto": "8.0.0",
|
|
38
|
+
"@shipfox/api-integration-slack-dto": "8.0.0",
|
|
39
|
+
"@shipfox/api-integration-sentry-dto": "8.0.0",
|
|
40
|
+
"@shipfox/api-integration-webhook-dto": "8.0.0",
|
|
41
41
|
"@shipfox/client-api": "4.0.0",
|
|
42
|
-
"@shipfox/client-auth": "
|
|
43
|
-
"@shipfox/client-shell": "
|
|
42
|
+
"@shipfox/client-auth": "5.0.0",
|
|
43
|
+
"@shipfox/client-shell": "5.0.0",
|
|
44
44
|
"@shipfox/client-ui": "4.0.0",
|
|
45
45
|
"@shipfox/react-ui": "0.3.5"
|
|
46
46
|
},
|
package/src/feature.ts
CHANGED
|
@@ -53,5 +53,19 @@ export const integrationsFeature = defineClientFeature({
|
|
|
53
53
|
parent: 'workspaceLayout',
|
|
54
54
|
impl: '@shipfox/client-integrations/routes/slack',
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
path: '/workspaces/$wid/settings/integrations',
|
|
58
|
+
parent: 'workspaceSettings',
|
|
59
|
+
impl: '@shipfox/client-integrations/routes/integrations-settings',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
settingsSections: [
|
|
63
|
+
{
|
|
64
|
+
id: 'settings.integrations',
|
|
65
|
+
pathSegment: 'integrations',
|
|
66
|
+
label: 'Integrations',
|
|
67
|
+
icon: 'plugLine',
|
|
68
|
+
order: 700,
|
|
69
|
+
},
|
|
56
70
|
],
|
|
57
71
|
});
|
|
@@ -33,7 +33,14 @@ import type {
|
|
|
33
33
|
SlackCallbackResponseDto,
|
|
34
34
|
} from '@shipfox/api-integration-slack-dto';
|
|
35
35
|
import {apiRequest} from '@shipfox/client-api';
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
type FetchQueryOptions,
|
|
38
|
+
queryOptions,
|
|
39
|
+
useInfiniteQuery,
|
|
40
|
+
useMutation,
|
|
41
|
+
useQuery,
|
|
42
|
+
useQueryClient,
|
|
43
|
+
} from '@tanstack/react-query';
|
|
37
44
|
import {serializeLinearCallbackQuery} from '#linear-callback.js';
|
|
38
45
|
import {serializeSlackCallbackQuery} from '#slack-callback.js';
|
|
39
46
|
|
|
@@ -54,6 +61,17 @@ export const integrationsQueryKeys = {
|
|
|
54
61
|
[...integrationsQueryKeys.all, 'repositories', connectionId, search] as const,
|
|
55
62
|
};
|
|
56
63
|
|
|
64
|
+
type SourceConnectionsQueryKey =
|
|
65
|
+
| ReturnType<typeof integrationsQueryKeys.sourceConnections>
|
|
66
|
+
| readonly ['integrations', 'source-connections'];
|
|
67
|
+
|
|
68
|
+
type SourceConnectionsQueryOptions = FetchQueryOptions<
|
|
69
|
+
ListIntegrationConnectionsResponseDto,
|
|
70
|
+
Error,
|
|
71
|
+
ListIntegrationConnectionsResponseDto,
|
|
72
|
+
SourceConnectionsQueryKey
|
|
73
|
+
>;
|
|
74
|
+
|
|
57
75
|
export async function listIntegrationProviders({
|
|
58
76
|
capability,
|
|
59
77
|
signal,
|
|
@@ -108,6 +126,18 @@ export async function listSourceConnections({
|
|
|
108
126
|
};
|
|
109
127
|
}
|
|
110
128
|
|
|
129
|
+
export function sourceConnectionsQueryOptions(
|
|
130
|
+
workspaceId: string | undefined,
|
|
131
|
+
): SourceConnectionsQueryOptions {
|
|
132
|
+
return queryOptions({
|
|
133
|
+
queryKey: workspaceId
|
|
134
|
+
? integrationsQueryKeys.sourceConnections(workspaceId)
|
|
135
|
+
: ([...integrationsQueryKeys.all, 'source-connections'] as const),
|
|
136
|
+
enabled: Boolean(workspaceId),
|
|
137
|
+
queryFn: ({signal}) => listSourceConnections({workspaceId: workspaceId ?? '', signal}),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
111
141
|
export async function createGiteaConnection(body: CreateGiteaConnectionBodyDto) {
|
|
112
142
|
return await apiRequest<CreateGiteaConnectionResponseDto>('/integrations/gitea/connections', {
|
|
113
143
|
method: 'POST',
|
|
@@ -228,13 +258,7 @@ export function useIntegrationProvidersQuery(params?: {capability?: IntegrationC
|
|
|
228
258
|
}
|
|
229
259
|
|
|
230
260
|
export function useSourceConnectionsQuery(workspaceId: string | undefined) {
|
|
231
|
-
return useQuery(
|
|
232
|
-
queryKey: workspaceId
|
|
233
|
-
? integrationsQueryKeys.sourceConnections(workspaceId)
|
|
234
|
-
: [...integrationsQueryKeys.all, 'source-connections'],
|
|
235
|
-
enabled: Boolean(workspaceId),
|
|
236
|
-
queryFn: ({signal}) => listSourceConnections({workspaceId: workspaceId ?? '', signal}),
|
|
237
|
-
});
|
|
261
|
+
return useQuery(sourceConnectionsQueryOptions(workspaceId));
|
|
238
262
|
}
|
|
239
263
|
|
|
240
264
|
export function useIntegrationConnectionsQuery(workspaceId: string | undefined) {
|
|
@@ -13,7 +13,7 @@ vi.mock('@shipfox/client-auth', async (importOriginal) => {
|
|
|
13
13
|
const actual = await importOriginal<typeof import('@shipfox/client-auth')>();
|
|
14
14
|
return {
|
|
15
15
|
...actual,
|
|
16
|
-
useRefreshAuth: () => () => Promise.resolve({
|
|
16
|
+
useRefreshAuth: () => () => Promise.resolve({accessToken: 'test-token'}),
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -50,7 +50,8 @@ export function LinearCallbackPage() {
|
|
|
50
50
|
key,
|
|
51
51
|
async () =>
|
|
52
52
|
await refreshAuth().then(
|
|
53
|
-
async (session) =>
|
|
53
|
+
async (session) =>
|
|
54
|
+
await completeLinearCallback({query: params, token: session.accessToken}),
|
|
54
55
|
),
|
|
55
56
|
);
|
|
56
57
|
|
|
@@ -13,7 +13,7 @@ vi.mock('@shipfox/client-auth', async (importOriginal) => {
|
|
|
13
13
|
const actual = await importOriginal<typeof import('@shipfox/client-auth')>();
|
|
14
14
|
return {
|
|
15
15
|
...actual,
|
|
16
|
-
useRefreshAuth: () => () => Promise.resolve({
|
|
16
|
+
useRefreshAuth: () => () => Promise.resolve({accessToken: 'test-token'}),
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -44,7 +44,8 @@ export function SlackCallbackPage() {
|
|
|
44
44
|
key,
|
|
45
45
|
async () =>
|
|
46
46
|
await refreshAuth().then(
|
|
47
|
-
async (session) =>
|
|
47
|
+
async (session) =>
|
|
48
|
+
await completeSlackCallback({query: params, token: session.accessToken}),
|
|
48
49
|
),
|
|
49
50
|
);
|
|
50
51
|
request.then(
|
|
@@ -48,7 +48,7 @@ function GithubCallbackRoute() {
|
|
|
48
48
|
async () =>
|
|
49
49
|
await refreshAuth().then(async (session) => {
|
|
50
50
|
await apiRequest(`/integrations/github/callback/api?${key}`, {
|
|
51
|
-
headers: {authorization: `Bearer ${session.
|
|
51
|
+
headers: {authorization: `Bearer ${session.accessToken}`},
|
|
52
52
|
});
|
|
53
53
|
}),
|
|
54
54
|
);
|
package/test/render.tsx
CHANGED
|
@@ -41,11 +41,7 @@ function authState(workspaces: TestWorkspace[]): AuthState {
|
|
|
41
41
|
user: {
|
|
42
42
|
id: '22222222-2222-4222-8222-222222222222',
|
|
43
43
|
email: 'user@example.com',
|
|
44
|
-
|
|
45
|
-
email_verified_at: new Date().toISOString(),
|
|
46
|
-
status: 'active',
|
|
47
|
-
created_at: new Date().toISOString(),
|
|
48
|
-
updated_at: new Date().toISOString(),
|
|
44
|
+
emailVerifiedAt: new Date().toISOString(),
|
|
49
45
|
},
|
|
50
46
|
workspaces,
|
|
51
47
|
};
|