@burdenoff/microfe-integrations 2026.929.3 → 2026.930.2
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/dist/generated/wspace-operations.d.ts +0 -137
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +73 -142
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/index.js +4 -3
- package/dist/integrations/ConnectSourceDialog.d.ts +21 -0
- package/dist/integrations/ConnectSourceDialog.d.ts.map +1 -0
- package/dist/integrations/ConnectSourceDialog.js +56 -0
- package/dist/integrations/ConnectSourceDialog.js.map +1 -0
- package/dist/integrations/ConnectionsPanel.d.ts.map +1 -1
- package/dist/integrations/ConnectionsPanel.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts +22 -11
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +54 -602
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/AuthMethodsEditor.d.ts.map +1 -1
- package/dist/integrations/components/AuthMethodsEditor.js +69 -68
- package/dist/integrations/components/AuthMethodsEditor.js.map +1 -1
- package/dist/integrations/components/ConnectionCard.js +28 -28
- package/dist/integrations/components/ConnectionCard.js.map +1 -1
- package/dist/integrations/components/ConnectionModalFrame.d.ts +38 -0
- package/dist/integrations/components/ConnectionModalFrame.d.ts.map +1 -0
- package/dist/integrations/components/ConnectionModalFrame.js +64 -0
- package/dist/integrations/components/ConnectionModalFrame.js.map +1 -0
- package/dist/integrations/components/ProviderCard.js +29 -29
- package/dist/integrations/components/ProviderCard.js.map +1 -1
- package/dist/integrations/hooks/useConnections.js +91 -102
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/hooks/useLogs.js +4 -4
- package/dist/integrations/hooks/useProviders.js +36 -36
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/pages/AddConnectionWizard.d.ts.map +1 -1
- package/dist/integrations/pages/AddConnectionWizard.js +281 -277
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +24 -24
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +7 -7
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.js +34 -34
- package/dist/integrations/pages/ProviderCatalog.js +4 -4
- package/dist/integrations/pages/ProviderDetail.js +110 -110
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/translations/en.d.ts +21 -0
- package/dist/integrations/translations/en.d.ts.map +1 -1
- package/dist/integrations/utils/appearance.d.ts +0 -3
- package/dist/integrations/utils/appearance.d.ts.map +1 -1
- package/dist/integrations/utils/appearance.js +1 -20
- package/dist/integrations/utils/appearance.js.map +1 -1
- package/dist/integrations/utils/integrationsHelpers.js +1 -4
- package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
- package/package.json +5 -3
- package/dist/integrations/assets/brands/bigconsole.js +0 -6
- package/dist/integrations/assets/brands/bigconsole.js.map +0 -1
- package/dist/integrations/assets/brands/burdenoff.js +0 -6
- package/dist/integrations/assets/brands/burdenoff.js.map +0 -1
- package/dist/integrations/components/AuthMethodSelector.d.ts +0 -30
- package/dist/integrations/components/AuthMethodSelector.d.ts.map +0 -1
- package/dist/integrations/components/AuthMethodSelector.js +0 -66
- package/dist/integrations/components/AuthMethodSelector.js.map +0 -1
- package/dist/integrations/components/CredentialStorageSelector.d.ts +0 -16
- package/dist/integrations/components/CredentialStorageSelector.d.ts.map +0 -1
- package/dist/integrations/components/CredentialStorageSelector.js +0 -262
- package/dist/integrations/components/CredentialStorageSelector.js.map +0 -1
- package/dist/integrations/components/ProviderIcon.d.ts +0 -25
- package/dist/integrations/components/ProviderIcon.d.ts.map +0 -1
- package/dist/integrations/components/ProviderIcon.js +0 -166
- package/dist/integrations/components/ProviderIcon.js.map +0 -1
- package/dist/integrations/components/SchemaForm.d.ts +0 -60
- package/dist/integrations/components/SchemaForm.d.ts.map +0 -1
- package/dist/integrations/components/SchemaForm.js +0 -235
- package/dist/integrations/components/SchemaForm.js.map +0 -1
- package/dist/integrations/hooks/useCredentialVaults.d.ts +0 -40
- package/dist/integrations/hooks/useCredentialVaults.d.ts.map +0 -1
- package/dist/integrations/hooks/useCredentialVaults.js +0 -98
- package/dist/integrations/hooks/useCredentialVaults.js.map +0 -1
- package/dist/integrations/utils/oauthPopup.d.ts +0 -16
- package/dist/integrations/utils/oauthPopup.d.ts.map +0 -1
- package/dist/integrations/utils/oauthPopup.js +0 -62
- package/dist/integrations/utils/oauthPopup.js.map +0 -1
- package/dist/node_modules/@iconify/react/dist/iconify.js +0 -1005
- package/dist/node_modules/@iconify/react/dist/iconify.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderCard.js","names":[],"sources":["../../../src/integrations/components/ProviderCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Plug, Link2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks/useTr';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport type { IntegrationProvider } from '../types';\nimport { ProviderIcon } from '
|
|
1
|
+
{"version":3,"file":"ProviderCard.js","names":[],"sources":["../../../src/integrations/components/ProviderCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Plug, Link2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks/useTr';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport type { IntegrationProvider } from '../types';\nimport { ProviderIcon } from '@burdenoff/fe-libs/connections';\n\ninterface ProviderCardProps {\n provider: IntegrationProvider;\n displayMode?: 'grid' | 'list';\n onConnect?: (provider: IntegrationProvider) => void;\n onClick?: (provider: IntegrationProvider) => void;\n}\n\n/**\n * Card component showing provider info (icon, name, category, auth type, connection count).\n * Has a \"Connect\" button.\n */\nexport const ProviderCard: FC<ProviderCardProps> = ({\n provider,\n displayMode = 'grid',\n onConnect,\n onClick,\n}) => {\n const tr = useTr();\n\n const handleConnect = (e: React.MouseEvent) => {\n e.stopPropagation();\n onConnect?.(provider);\n };\n\n const getPluginStatusLabel = (status: IntegrationProvider['pluginStatus']) =>\n tr(`integrations.pluginStatus.${status}`, status);\n\n const getCategoryLabel = (category: IntegrationProvider['category']) =>\n tr(`integrations.category.${category}`, category);\n\n const getAuthTypeLabel = (authType: IntegrationProvider['authType']) =>\n tr(`integrations.authType.${authType}`, authType);\n\n const pluginBadgeClass =\n provider.pluginStatus === 'installed'\n ? 'text-status-success-text bg-status-success-bg-subtle border-border-default'\n : provider.pluginStatus === 'update_available'\n ? 'text-status-warning-text bg-status-warning-bg-subtle border-border-default'\n : provider.pluginStatus === 'deprecated'\n ? 'text-status-error-text bg-status-error-bg-subtle border-border-default'\n : 'text-text-secondary bg-bg-sunken border-border-subtle';\n\n if (displayMode === 'list') {\n return (\n <GlassCard\n className={cn(\n 'group flex items-center gap-4 p-4 border-border-seam',\n 'cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n 'animate-in fade-in-0'\n )}\n onClick={() => onClick?.(provider)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(provider);\n }\n }}\n >\n <ProviderIcon provider={provider} size={40} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-text-primary truncate\">{provider.name}</h3>\n <span className={cn('text-xs px-2 py-0.5 rounded-full border', pluginBadgeClass)}>\n {getPluginStatusLabel(provider.pluginStatus)}\n </span>\n </div>\n <p className=\"text-sm text-text-secondary truncate mt-0.5\">{provider.description}</p>\n </div>\n\n <div className=\"flex items-center gap-3 flex-shrink-0\">\n <span className=\"text-xs text-text-secondary\">{getCategoryLabel(provider.category)}</span>\n <span className=\"text-xs text-text-secondary\">{getAuthTypeLabel(provider.authType)}</span>\n <span className=\"inline-flex items-center gap-1 text-xs text-text-secondary\">\n <Link2 size={12} />\n {provider.connectionCount}\n </span>\n {onConnect && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <button\n type=\"button\"\n onClick={handleConnect}\n className=\"px-3 py-1.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n {tr('integrations.providerCard.actions.connect', 'Connect')}\n </button>\n )}\n </div>\n </GlassCard>\n );\n }\n\n return (\n <GlassCard\n className={cn(\n 'group relative flex flex-col p-5 border-border-seam',\n 'cursor-pointer hover:shadow-[var(--shadow-pop)] hover:border-border-strong',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n 'animate-in fade-in-0'\n )}\n onClick={() => onClick?.(provider)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(provider);\n }\n }}\n >\n <div className=\"flex items-start justify-between mb-3\">\n <ProviderIcon provider={provider} size={48} />\n <span className={cn('text-xs px-2 py-0.5 rounded-full border', pluginBadgeClass)}>\n {getPluginStatusLabel(provider.pluginStatus)}\n </span>\n </div>\n\n <h3 className=\"font-semibold text-text-primary mb-1 truncate\">{provider.name}</h3>\n <p className=\"text-sm text-text-secondary line-clamp-2 mb-3 flex-1\">{provider.description}</p>\n\n <div className=\"flex items-center gap-2 flex-wrap mb-3\">\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-bg-sunken text-text-secondary\">\n {getCategoryLabel(provider.category)}\n </span>\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-bg-sunken text-text-secondary\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n </div>\n\n <div className=\"flex items-center justify-between mt-auto pt-3 border-t border-border-seam\">\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary\">\n <Plug size={14} />\n {provider.connectionCount}{' '}\n {provider.connectionCount === 1\n ? tr('integrations.providerCard.connectionCount.single', 'connection')\n : tr('integrations.providerCard.connectionCount.multiple', 'connections')}\n </span>\n {onConnect && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <button\n type=\"button\"\n onClick={handleConnect}\n className=\"px-3 py-1.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n {tr('integrations.providerCard.actions.connect', 'Connect')}\n </button>\n )}\n </div>\n </GlassCard>\n );\n};\n"],"mappings":";;;;;;;AAmBA,IAAa,KAAuC,EAClD,aACA,iBAAc,QACd,cACA,iBACI;CACJ,IAAM,IAAK,GAAO,EAEZ,KAAiB,MAAwB;AAE7C,EADA,EAAE,iBAAiB,EACnB,IAAY,EAAS;IAGjB,KAAwB,MAC5B,EAAG,6BAA6B,KAAU,EAAO,EAE7C,KAAoB,MACxB,EAAG,yBAAyB,KAAY,EAAS,EAE7C,KAAoB,MACxB,EAAG,yBAAyB,KAAY,EAAS,EAE7C,IACJ,EAAS,iBAAiB,cACtB,+EACA,EAAS,iBAAiB,qBACxB,+EACA,EAAS,iBAAiB,eACxB,2EACA;AAsDV,QApDI,MAAgB,SAEhB,kBAAC,GAAD;EACE,WAAW,EACT,wDACA,8EACA,gGACA,uBACD;EACD,eAAe,IAAU,EAAS;EAClC,MAAK;EACL,UAAU;EACV,YAAY,MAAM;AAChB,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,IAAU,EAAS;;YAbzB;GAiBE,kBAAC,GAAD;IAAwB;IAAU,MAAM;IAAM,CAAA;GAE9C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBAA4C,EA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C,QAAD;KAAM,WAAU;eACb,EAAiB,EAAS,SAAS;KAC/B,CAAA,CACH;;GAEN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;MACjB,EAAS;MAAiB;MAC1B,EAAS,oBAAoB,IAC1B,EAAG,oDAAoD,aAAa,GACpE,EAAG,sDAAsD,cAAc;MACtE;QACN,KAAa,EAAS,iBAAiB,eAAe,EAAS,aAC9D,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;eAET,EAAG,6CAA6C,UAAU;KACpD,CAAA,CAEP;;GACI"}
|
|
@@ -1,132 +1,121 @@
|
|
|
1
1
|
import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import { mapConnection as
|
|
4
|
-
import {
|
|
5
|
-
import { useCallback as
|
|
6
|
-
import { gql as
|
|
7
|
-
import { useMutation as
|
|
2
|
+
import { useIntegrationsEventBus as t } from "../events/useIntegrationsEventBus.js";
|
|
3
|
+
import { mapConnection as n } from "../utils/mappers.js";
|
|
4
|
+
import { useAuthenticateWithApiKeyMutation as r, useAuthenticateWithBasicAuthMutation as i, useAuthenticateWithBearerTokenMutation as a, useCreateConnectionMutation as o, useDeleteConnectionMutation as s, useGetConnectionQuery as c, useGetConnectionsByProviderQuery as l, useGetConnectionsQuery as u, useInitiateOAuthMutation as d, useRefreshConnectionTokenMutation as f, useRevokeConnectionMutation as p, useTestConnectionMutation as m } from "../../generated/wspace-operations.js";
|
|
5
|
+
import { useCallback as h } from "react";
|
|
6
|
+
import { gql as g } from "@apollo/client";
|
|
7
|
+
import { useMutation as _ } from "@apollo/client/react";
|
|
8
8
|
//#region src/integrations/hooks/useConnections.ts
|
|
9
|
-
function
|
|
10
|
-
let { workspaceId:
|
|
9
|
+
function v(t) {
|
|
10
|
+
let { workspaceId: r } = e(), { data: i, loading: a, error: o, refetch: s } = u({
|
|
11
11
|
variables: {
|
|
12
12
|
filter: t,
|
|
13
13
|
pagination: { limit: 100 }
|
|
14
14
|
},
|
|
15
|
-
skip: !
|
|
15
|
+
skip: !r,
|
|
16
16
|
errorPolicy: "all"
|
|
17
|
-
}),
|
|
17
|
+
}), c = i?.getConnections !== void 0;
|
|
18
18
|
return {
|
|
19
|
-
connections: (
|
|
20
|
-
total:
|
|
21
|
-
loading:
|
|
22
|
-
answered:
|
|
23
|
-
error:
|
|
24
|
-
refetch:
|
|
19
|
+
connections: (i?.getConnections?.items ?? []).map((e) => n(e)),
|
|
20
|
+
total: i?.getConnections?.total ?? 0,
|
|
21
|
+
loading: a,
|
|
22
|
+
answered: c,
|
|
23
|
+
error: o,
|
|
24
|
+
refetch: s
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
let { workspaceId:
|
|
27
|
+
function y(t) {
|
|
28
|
+
let { workspaceId: r } = e(), { data: i, loading: a, error: o, refetch: s } = c({
|
|
29
29
|
variables: { id: t },
|
|
30
|
-
skip: !
|
|
30
|
+
skip: !r || !t,
|
|
31
31
|
errorPolicy: "all"
|
|
32
|
-
}),
|
|
32
|
+
}), l = i?.getConnection !== void 0;
|
|
33
33
|
return {
|
|
34
|
-
connection:
|
|
35
|
-
loading:
|
|
36
|
-
answered:
|
|
37
|
-
error:
|
|
38
|
-
refetch:
|
|
34
|
+
connection: i?.getConnection ? n(i.getConnection) : null,
|
|
35
|
+
loading: a,
|
|
36
|
+
answered: l,
|
|
37
|
+
error: o,
|
|
38
|
+
refetch: s
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
let { workspaceId:
|
|
41
|
+
function b(t) {
|
|
42
|
+
let { workspaceId: r } = e(), { data: i, loading: a, error: o, refetch: s } = l({
|
|
43
43
|
variables: {
|
|
44
44
|
providerId: t,
|
|
45
45
|
pagination: { limit: 100 }
|
|
46
46
|
},
|
|
47
|
-
skip: !
|
|
47
|
+
skip: !r || !t,
|
|
48
48
|
errorPolicy: "all"
|
|
49
49
|
});
|
|
50
50
|
return {
|
|
51
|
-
connections: (
|
|
52
|
-
total:
|
|
53
|
-
loading:
|
|
54
|
-
error:
|
|
55
|
-
refetch:
|
|
51
|
+
connections: (i?.getConnectionsByProvider?.items ?? []).map((e) => n(e)),
|
|
52
|
+
total: i?.getConnectionsByProvider?.total ?? 0,
|
|
53
|
+
loading: a,
|
|
54
|
+
error: o,
|
|
55
|
+
refetch: s
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let [e, { loading:
|
|
58
|
+
function x() {
|
|
59
|
+
let [e, { loading: n }] = o({ refetchQueries: ["GetConnections"] }), r = t();
|
|
60
60
|
return {
|
|
61
|
-
createConnection:
|
|
62
|
-
let
|
|
63
|
-
return
|
|
64
|
-
connectionId:
|
|
61
|
+
createConnection: h(async (t) => {
|
|
62
|
+
let n = (await e({ variables: { input: t } })).data?.createConnection?.id;
|
|
63
|
+
return n && r.emit("integrations:connection-created", {
|
|
64
|
+
connectionId: n,
|
|
65
65
|
providerKey: t.providerId
|
|
66
|
-
}),
|
|
67
|
-
}, [e,
|
|
68
|
-
loading:
|
|
66
|
+
}), n;
|
|
67
|
+
}, [e, r]),
|
|
68
|
+
loading: n
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
let [e, { loading:
|
|
71
|
+
function S() {
|
|
72
|
+
let [e, { loading: n }] = s({ refetchQueries: ["GetConnections"] }), r = t();
|
|
73
73
|
return {
|
|
74
|
-
deleteConnection:
|
|
74
|
+
deleteConnection: h(async (t, n = !1) => {
|
|
75
75
|
await e({ variables: {
|
|
76
76
|
id: t,
|
|
77
|
-
deleteVaultSecret:
|
|
78
|
-
} }),
|
|
79
|
-
}, [e,
|
|
80
|
-
loading:
|
|
77
|
+
deleteVaultSecret: n
|
|
78
|
+
} }), r.emit("integrations:connection-deleted", { connectionId: t });
|
|
79
|
+
}, [e, r]),
|
|
80
|
+
loading: n
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
let [e, { loading:
|
|
83
|
+
function C() {
|
|
84
|
+
let [e, { loading: n }] = d(), r = t();
|
|
85
85
|
return {
|
|
86
|
-
initiateOAuth:
|
|
87
|
-
|
|
86
|
+
initiateOAuth: h(async (t, n, i, a) => {
|
|
87
|
+
r.emit("integrations:oauth-started", {
|
|
88
88
|
connectionId: t,
|
|
89
89
|
providerKey: i
|
|
90
90
|
});
|
|
91
91
|
let o = await e({ variables: { input: {
|
|
92
92
|
connectionId: t,
|
|
93
|
-
redirectUri:
|
|
93
|
+
redirectUri: n,
|
|
94
94
|
scopes: a
|
|
95
95
|
} } });
|
|
96
|
-
return o.error &&
|
|
96
|
+
return o.error && r.emit("integrations:oauth-failed", {
|
|
97
97
|
connectionId: t,
|
|
98
98
|
providerKey: i,
|
|
99
99
|
error: o.error.message
|
|
100
100
|
}), o.data?.initiateOAuth ?? null;
|
|
101
|
-
}, [e,
|
|
102
|
-
loading: t
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function T() {
|
|
106
|
-
let [e, { loading: n }] = t({ refetchQueries: ["GetConnection"] });
|
|
107
|
-
return {
|
|
108
|
-
authenticateConnection: g(async (t, n, r) => (await e({ variables: { input: {
|
|
109
|
-
connectionId: t,
|
|
110
|
-
authMethodKey: n,
|
|
111
|
-
values: r
|
|
112
|
-
} } })).data?.authenticateConnection, [e]),
|
|
101
|
+
}, [e, r]),
|
|
113
102
|
loading: n
|
|
114
103
|
};
|
|
115
104
|
}
|
|
116
|
-
function
|
|
117
|
-
let [e, { loading: t }] =
|
|
105
|
+
function w() {
|
|
106
|
+
let [e, { loading: t }] = r({ refetchQueries: ["GetConnection"] });
|
|
118
107
|
return {
|
|
119
|
-
authenticateWithApiKey:
|
|
108
|
+
authenticateWithApiKey: h(async (t, n) => (await e({ variables: { input: {
|
|
120
109
|
connectionId: t,
|
|
121
110
|
apiKey: n
|
|
122
111
|
} } })).data?.authenticateWithApiKey, [e]),
|
|
123
112
|
loading: t
|
|
124
113
|
};
|
|
125
114
|
}
|
|
126
|
-
function
|
|
127
|
-
let [e, { loading: t }] =
|
|
115
|
+
function T() {
|
|
116
|
+
let [e, { loading: t }] = i({ refetchQueries: ["GetConnection"] });
|
|
128
117
|
return {
|
|
129
|
-
authenticateWithBasicAuth:
|
|
118
|
+
authenticateWithBasicAuth: h(async (t, n, r) => (await e({ variables: { input: {
|
|
130
119
|
connectionId: t,
|
|
131
120
|
username: n,
|
|
132
121
|
password: r
|
|
@@ -134,17 +123,17 @@ function D() {
|
|
|
134
123
|
loading: t
|
|
135
124
|
};
|
|
136
125
|
}
|
|
137
|
-
function
|
|
138
|
-
let [e, { loading: t }] =
|
|
126
|
+
function E() {
|
|
127
|
+
let [e, { loading: t }] = a({ refetchQueries: ["GetConnection"] });
|
|
139
128
|
return {
|
|
140
|
-
authenticateWithBearerToken:
|
|
129
|
+
authenticateWithBearerToken: h(async (t, n) => (await e({ variables: { input: {
|
|
141
130
|
connectionId: t,
|
|
142
131
|
token: n
|
|
143
132
|
} } })).data?.authenticateWithBearerToken, [e]),
|
|
144
133
|
loading: t
|
|
145
134
|
};
|
|
146
135
|
}
|
|
147
|
-
var
|
|
136
|
+
var D = g`
|
|
148
137
|
mutation AuthenticateWithServiceAccount($input: ServiceAccountAuthInput!) {
|
|
149
138
|
authenticateWithServiceAccount(input: $input) {
|
|
150
139
|
id
|
|
@@ -152,17 +141,17 @@ var k = _`
|
|
|
152
141
|
}
|
|
153
142
|
}
|
|
154
143
|
`;
|
|
155
|
-
function
|
|
156
|
-
let [e, { loading: t }] =
|
|
144
|
+
function O() {
|
|
145
|
+
let [e, { loading: t }] = _(D, { refetchQueries: ["GetConnection"] });
|
|
157
146
|
return {
|
|
158
|
-
authenticateWithServiceAccount:
|
|
147
|
+
authenticateWithServiceAccount: h(async (t, n) => (await e({ variables: { input: {
|
|
159
148
|
connectionId: t,
|
|
160
149
|
scopes: n
|
|
161
150
|
} } })).data?.authenticateWithServiceAccount, [e]),
|
|
162
151
|
loading: t
|
|
163
152
|
};
|
|
164
153
|
}
|
|
165
|
-
var
|
|
154
|
+
var k = g`
|
|
166
155
|
mutation AuthenticateWithCustomConfig($input: CustomConfigAuthInput!) {
|
|
167
156
|
authenticateWithCustomConfig(input: $input) {
|
|
168
157
|
id
|
|
@@ -170,44 +159,44 @@ var j = _`
|
|
|
170
159
|
}
|
|
171
160
|
}
|
|
172
161
|
`;
|
|
173
|
-
function
|
|
174
|
-
let [e, { loading: t }] =
|
|
162
|
+
function A() {
|
|
163
|
+
let [e, { loading: t }] = _(k, { refetchQueries: ["GetConnection"] });
|
|
175
164
|
return {
|
|
176
|
-
authenticateWithCustomConfig:
|
|
165
|
+
authenticateWithCustomConfig: h(async (t, n) => (await e({ variables: { input: {
|
|
177
166
|
connectionId: t,
|
|
178
167
|
config: n
|
|
179
168
|
} } })).data?.authenticateWithCustomConfig, [e]),
|
|
180
169
|
loading: t
|
|
181
170
|
};
|
|
182
171
|
}
|
|
183
|
-
function
|
|
184
|
-
let [e, { loading:
|
|
172
|
+
function j() {
|
|
173
|
+
let [e, { loading: n }] = f({ refetchQueries: ["GetConnection"] }), r = t();
|
|
185
174
|
return {
|
|
186
|
-
refreshToken:
|
|
187
|
-
let
|
|
188
|
-
return
|
|
189
|
-
}, [e,
|
|
190
|
-
loading:
|
|
175
|
+
refreshToken: h(async (t) => {
|
|
176
|
+
let n = await e({ variables: { connectionId: t } });
|
|
177
|
+
return n.data?.refreshConnectionToken && r.emit("integrations:token-refreshed", { connectionId: t }), n.data?.refreshConnectionToken;
|
|
178
|
+
}, [e, r]),
|
|
179
|
+
loading: n
|
|
191
180
|
};
|
|
192
181
|
}
|
|
193
|
-
function
|
|
194
|
-
let [e, { loading:
|
|
182
|
+
function M() {
|
|
183
|
+
let [e, { loading: n }] = p({ refetchQueries: ["GetConnection"] }), r = t();
|
|
195
184
|
return {
|
|
196
|
-
revokeConnection:
|
|
197
|
-
let
|
|
198
|
-
return
|
|
199
|
-
}, [e,
|
|
200
|
-
loading:
|
|
185
|
+
revokeConnection: h(async (t) => {
|
|
186
|
+
let n = await e({ variables: { connectionId: t } });
|
|
187
|
+
return n.data?.revokeConnection && r.emit("integrations:token-revoked", { connectionId: t }), n.data?.revokeConnection;
|
|
188
|
+
}, [e, r]),
|
|
189
|
+
loading: n
|
|
201
190
|
};
|
|
202
191
|
}
|
|
203
|
-
function
|
|
204
|
-
let [e, { loading: t }] =
|
|
192
|
+
function N() {
|
|
193
|
+
let [e, { loading: t }] = m();
|
|
205
194
|
return {
|
|
206
|
-
testConnection:
|
|
195
|
+
testConnection: h(async (t) => (await e({ variables: { connectionId: t } })).data?.testConnection ?? null, [e]),
|
|
207
196
|
loading: t
|
|
208
197
|
};
|
|
209
198
|
}
|
|
210
199
|
//#endregion
|
|
211
|
-
export {
|
|
200
|
+
export { w as useAuthenticateWithApiKey, T as useAuthenticateWithBasicAuth, E as useAuthenticateWithBearerToken, A as useAuthenticateWithCustomConfig, O as useAuthenticateWithServiceAccount, y as useConnection, v as useConnections, b as useConnectionsByProvider, x as useCreateConnection, S as useDeleteConnection, C as useInitiateOAuth, j as useRefreshToken, M as useRevokeConnection, N as useTestConnection };
|
|
212
201
|
|
|
213
202
|
//# sourceMappingURL=useConnections.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnections.js","names":[],"sources":["../../../src/integrations/hooks/useConnections.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for connections.\n */\n\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport {\n useGetConnectionsQuery,\n useGetConnectionQuery,\n useGetConnectionsByProviderQuery,\n useCreateConnectionMutation,\n useInitiateOAuthMutation,\n useAuthenticateConnectionMutation,\n useAuthenticateWithApiKeyMutation,\n useAuthenticateWithBasicAuthMutation,\n useAuthenticateWithBearerTokenMutation,\n useRefreshConnectionTokenMutation,\n useRevokeConnectionMutation,\n useTestConnectionMutation,\n useDeleteConnectionMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { mapConnection } from '../utils/mappers';\nimport type {\n IntegrationConnection,\n ConnectionStatus,\n OAuthInitiationResult,\n ConnectionTestResult,\n} from '../types';\n\n/**\n * A query we never asked is NOT an empty result.\n *\n * ★★ THE BUG THIS EXISTS TO PREVENT. Apollo returns `loading: false`,\n * `error: undefined`, `data: undefined` for a SKIPPED query — identical, from a\n * caller's point of view, to a query that ran and found nothing. Pages then\n * render their empty state and tell the user, definitively, that they have no\n * connections.\n *\n * Measured in production 2026-09-13: `/integrations/connections` showed\n * \"No connections yet\" while the workspace held **46** connections — 8 ACTIVE\n * (Gmail, GitHub, Google Sheets, Linear, Anthropic), 1 EXPIRED, 37 PENDING_AUTH.\n * The assistant, asked the same question through the API, listed all 46. No\n * request left the browser and no error appeared anywhere.\n *\n * `workspaceId` is falsy whenever the active context has not resolved — and the\n * shell passes `activeContext.workspaceId ?? \"\"`, so \"not yet known\" arrives as\n * an empty string, which is falsy. Any render in that window produces a\n * confident, wrong answer.\n *\n * So `notReady` is returned separately and callers MUST NOT treat it as empty.\n * It is deliberately not folded into `loading`: a caller that shows a spinner is\n * right, and a caller that ignores it still cannot mistake it for \"none\".\n */\n\n// ─── Query Hooks ────────────────────────────────────────────────────────────\n\ninterface ConnectionFilterOptions {\n status?: ConnectionStatus;\n providerId?: string;\n search?: string;\n}\n\nexport function useConnections(filter?: ConnectionFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n // ★ Keyed on the ABSENCE OF DATA, not on why it is absent. A skipped query, a\n // query still in flight and a query that resolved from an empty cache entry all\n // land here, and none of them is evidence that the workspace has no connections.\n const answered = data?.getConnections !== undefined;\n\n const connections: IntegrationConnection[] = (data?.getConnections?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnections?.total ?? 0,\n loading,\n // ★ False until the server has actually told us. Callers MUST gate their\n // empty state on this — see the note above.\n answered,\n error,\n refetch,\n };\n}\n\nexport function useConnection(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const answered = data?.getConnection !== undefined;\n\n const connection: IntegrationConnection | null = data?.getConnection\n ? mapConnection(data.getConnection as Record<string, unknown>)\n : null;\n\n return { connection, loading, answered, error, refetch };\n}\n\nexport function useConnectionsByProvider(providerId: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsByProviderQuery({\n variables: { providerId, pagination: { limit: 100 } },\n skip: !workspaceId || !providerId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnectionsByProvider?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnectionsByProvider?.total ?? 0,\n loading,\n error,\n refetch,\n };\n}\n\n// ─── Mutation Hooks ─────────────────────────────────────────────────────────\n\nexport function useCreateConnection() {\n const [mutate, { loading }] = useCreateConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const createConnection = useCallback(\n async (input: {\n name: string;\n description?: string;\n providerId: string;\n authMethodKey?: string;\n vaultId?: string;\n credentialSecretId?: string;\n managedSecretName?: string;\n config?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n const id = result.data?.createConnection?.id as string | undefined;\n if (id) {\n eventBus.emit('integrations:connection-created', {\n connectionId: id,\n providerKey: input.providerId,\n });\n }\n return id;\n },\n [mutate, eventBus]\n );\n\n return { createConnection, loading };\n}\n\nexport function useDeleteConnection() {\n const [mutate, { loading }] = useDeleteConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const deleteConnection = useCallback(\n async (id: string, deleteVaultSecret = false) => {\n await mutate({ variables: { id, deleteVaultSecret } });\n eventBus.emit('integrations:connection-deleted', { connectionId: id });\n },\n [mutate, eventBus]\n );\n\n return { deleteConnection, loading };\n}\n\nexport function useInitiateOAuth() {\n const [mutate, { loading }] = useInitiateOAuthMutation();\n const eventBus = useIntegrationsEventBus();\n\n const initiateOAuth = useCallback(\n async (\n connectionId: string,\n redirectUri: string,\n providerKey: string,\n scopes?: string[]\n ): Promise<OAuthInitiationResult | null> => {\n eventBus.emit('integrations:oauth-started', { connectionId, providerKey });\n const result = await mutate({ variables: { input: { connectionId, redirectUri, scopes } } });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n }\n return result.data?.initiateOAuth ?? null;\n },\n [mutate, eventBus]\n );\n\n return { initiateOAuth, loading };\n}\n\n/**\n * Authenticate a connection with values shaped by its auth method's schema.\n *\n * Generic replacement for the per-auth-type hooks below: the caller passes\n * whatever the rendered form collected, so a new auth type needs no new hook,\n * no new mutation document and no new branch at the call site.\n */\nexport function useAuthenticateConnection() {\n const [mutate, { loading }] = useAuthenticateConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateConnection = useCallback(\n async (\n connectionId: string,\n authMethodKey: string | undefined,\n values: Record<string, unknown>\n ) => {\n const result = await mutate({\n variables: { input: { connectionId, authMethodKey, values } },\n });\n return result.data?.authenticateConnection;\n },\n [mutate]\n );\n\n return { authenticateConnection, loading };\n}\n\nexport function useAuthenticateWithApiKey() {\n const [mutate, { loading }] = useAuthenticateWithApiKeyMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithApiKey = useCallback(\n async (connectionId: string, apiKey: string) => {\n const result = await mutate({ variables: { input: { connectionId, apiKey } } });\n return result.data?.authenticateWithApiKey;\n },\n [mutate]\n );\n\n return { authenticateWithApiKey, loading };\n}\n\nexport function useAuthenticateWithBasicAuth() {\n const [mutate, { loading }] = useAuthenticateWithBasicAuthMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBasicAuth = useCallback(\n async (connectionId: string, username: string, password: string) => {\n const result = await mutate({ variables: { input: { connectionId, username, password } } });\n return result.data?.authenticateWithBasicAuth;\n },\n [mutate]\n );\n\n return { authenticateWithBasicAuth, loading };\n}\n\nexport function useAuthenticateWithBearerToken() {\n const [mutate, { loading }] = useAuthenticateWithBearerTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBearerToken = useCallback(\n async (connectionId: string, token: string) => {\n const result = await mutate({ variables: { input: { connectionId, token } } });\n return result.data?.authenticateWithBearerToken;\n },\n [mutate]\n );\n\n return { authenticateWithBearerToken, loading };\n}\n\n/**\n * GraphQL document for the first-party SERVICE_ACCOUNT auth flow. Defined inline\n * (rather than via codegen) so it does not depend on a fresh `schema:pull` from\n * a gateway that already exposes the new `authenticateWithServiceAccount`\n * mutation. Once the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_SERVICE_ACCOUNT = gql`\n mutation AuthenticateWithServiceAccount($input: ServiceAccountAuthInput!) {\n authenticateWithServiceAccount(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a first-party SERVICE_ACCOUNT provider (e.g. Burdenoff). No user\n * credentials are collected — the platform mints an app-as-user token per\n * execution. Calling this records the user's consent (delegation) for the\n * reserved app and activates the connection.\n */\nexport function useAuthenticateWithServiceAccount() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithServiceAccount: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; scopes?: string[] } }\n >(AUTHENTICATE_WITH_SERVICE_ACCOUNT, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithServiceAccount = useCallback(\n async (connectionId: string, scopes?: string[]) => {\n const result = await mutate({ variables: { input: { connectionId, scopes } } });\n return result.data?.authenticateWithServiceAccount;\n },\n [mutate]\n );\n\n return { authenticateWithServiceAccount, loading };\n}\n\n/**\n * GraphQL document for CUSTOM provider auth (configSchema-driven config, e.g.\n * Google Workspace Admin domain-wide delegation). Defined inline (rather than\n * via codegen) so it does not depend on a fresh `schema:pull` from a gateway\n * that already exposes the new `authenticateWithCustomConfig` mutation. Once\n * the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_CUSTOM_CONFIG = gql`\n mutation AuthenticateWithCustomConfig($input: CustomConfigAuthInput!) {\n authenticateWithCustomConfig(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a CUSTOM provider with a configSchema-shaped config object. The full\n * config is stored inside the encrypted credential payload (secrets never hit\n * plain columns); the connection becomes ACTIVE immediately.\n */\nexport function useAuthenticateWithCustomConfig() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithCustomConfig: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; config: Record<string, unknown> } }\n >(AUTHENTICATE_WITH_CUSTOM_CONFIG, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithCustomConfig = useCallback(\n async (connectionId: string, config: Record<string, unknown>) => {\n const result = await mutate({ variables: { input: { connectionId, config } } });\n return result.data?.authenticateWithCustomConfig;\n },\n [mutate]\n );\n\n return { authenticateWithCustomConfig, loading };\n}\n\nexport function useRefreshToken() {\n const [mutate, { loading }] = useRefreshConnectionTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const refreshToken = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.refreshConnectionToken) {\n eventBus.emit('integrations:token-refreshed', { connectionId });\n }\n return result.data?.refreshConnectionToken;\n },\n [mutate, eventBus]\n );\n\n return { refreshToken, loading };\n}\n\nexport function useRevokeConnection() {\n const [mutate, { loading }] = useRevokeConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const revokeConnection = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.revokeConnection) {\n eventBus.emit('integrations:token-revoked', { connectionId });\n }\n return result.data?.revokeConnection;\n },\n [mutate, eventBus]\n );\n\n return { revokeConnection, loading };\n}\n\nexport function useTestConnection() {\n const [mutate, { loading }] = useTestConnectionMutation();\n\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n const result = await mutate({ variables: { connectionId } });\n return result.data?.testConnection ?? null;\n },\n [mutate]\n );\n\n return { testConnection, loading };\n}\n"],"mappings":";;;;;;;;AAiEA,SAAgB,EAAe,GAAkC;CAC/D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuB;EAC/D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EAKI,IAAW,GAAM,mBAAmB,KAAA;AAM1C,QAAO;EACL,cAL4C,GAAM,gBAAgB,SAAS,EAAE,EAAE,KAC9E,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,gBAAgB,SAAS;EACtC;EAGA;EACA;EACA;EACD;;AAGH,SAAgB,EAAc,GAAY;CACxC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAsB;EAC9D,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC,EAEI,IAAW,GAAM,kBAAkB,KAAA;AAMzC,QAAO;EAAE,YAJwC,GAAM,gBACnD,EAAc,EAAK,cAAyC,GAC5D;EAEiB;EAAS;EAAU;EAAO;EAAS;;AAG1D,SAAgB,EAAyB,GAAoB;CAC3D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAiC;EACzE,W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BAAa,EAA4B,EACxD,gBAAgB,CAAC,gBAAgB,EAClC,CAAC,EACI,IAAW,GAAyB;AAa1C,QAAO;EAAE,kBAXgB,EACvB,OAAO,MAAyB;GAC9B,IAAM,IAAS,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC;AAI5D,UAHI,EAAO,MAAM,oBACf,EAAS,KAAK,8BAA8B,EAAE,iBAAc,CAAC,EAExD,EAAO,MAAM;KAEtB,CAAC,GAAQ,EAAS,CACnB;EAE0B;EAAS;;AAGtC,SAAgB,IAAoB;CAClC,IAAM,CAAC,GAAQ,EAAE,gBAAa,GAA2B;AAUzD,QAAO;EAAE,gBARc,EACrB,OAAO,OACU,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC,EAC9C,MAAM,kBAAkB,MAExC,CAAC,EAAO,CACT;EAEwB;EAAS"}
|
|
1
|
+
{"version":3,"file":"useConnections.js","names":[],"sources":["../../../src/integrations/hooks/useConnections.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for connections.\n */\n\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@apollo/client/react';\nimport {\n useGetConnectionsQuery,\n useGetConnectionQuery,\n useGetConnectionsByProviderQuery,\n useCreateConnectionMutation,\n useInitiateOAuthMutation,\n useAuthenticateConnectionMutation,\n useAuthenticateWithApiKeyMutation,\n useAuthenticateWithBasicAuthMutation,\n useAuthenticateWithBearerTokenMutation,\n useRefreshConnectionTokenMutation,\n useRevokeConnectionMutation,\n useTestConnectionMutation,\n useDeleteConnectionMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { mapConnection } from '../utils/mappers';\nimport type {\n IntegrationConnection,\n ConnectionStatus,\n OAuthInitiationResult,\n ConnectionTestResult,\n} from '../types';\n\n/**\n * A query we never asked is NOT an empty result.\n *\n * ★★ THE BUG THIS EXISTS TO PREVENT. Apollo returns `loading: false`,\n * `error: undefined`, `data: undefined` for a SKIPPED query — identical, from a\n * caller's point of view, to a query that ran and found nothing. Pages then\n * render their empty state and tell the user, definitively, that they have no\n * connections.\n *\n * Measured in production 2026-09-13: `/integrations/connections` showed\n * \"No connections yet\" while the workspace held **46** connections — 8 ACTIVE\n * (Gmail, GitHub, Google Sheets, Linear, Anthropic), 1 EXPIRED, 37 PENDING_AUTH.\n * The assistant, asked the same question through the API, listed all 46. No\n * request left the browser and no error appeared anywhere.\n *\n * `workspaceId` is falsy whenever the active context has not resolved — and the\n * shell passes `activeContext.workspaceId ?? \"\"`, so \"not yet known\" arrives as\n * an empty string, which is falsy. Any render in that window produces a\n * confident, wrong answer.\n *\n * So `notReady` is returned separately and callers MUST NOT treat it as empty.\n * It is deliberately not folded into `loading`: a caller that shows a spinner is\n * right, and a caller that ignores it still cannot mistake it for \"none\".\n */\n\n// ─── Query Hooks ────────────────────────────────────────────────────────────\n\ninterface ConnectionFilterOptions {\n status?: ConnectionStatus;\n providerId?: string;\n search?: string;\n}\n\nexport function useConnections(filter?: ConnectionFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n // ★ Keyed on the ABSENCE OF DATA, not on why it is absent. A skipped query, a\n // query still in flight and a query that resolved from an empty cache entry all\n // land here, and none of them is evidence that the workspace has no connections.\n const answered = data?.getConnections !== undefined;\n\n const connections: IntegrationConnection[] = (data?.getConnections?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnections?.total ?? 0,\n loading,\n // ★ False until the server has actually told us. Callers MUST gate their\n // empty state on this — see the note above.\n answered,\n error,\n refetch,\n };\n}\n\nexport function useConnection(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const answered = data?.getConnection !== undefined;\n\n const connection: IntegrationConnection | null = data?.getConnection\n ? mapConnection(data.getConnection as Record<string, unknown>)\n : null;\n\n return { connection, loading, answered, error, refetch };\n}\n\nexport function useConnectionsByProvider(providerId: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsByProviderQuery({\n variables: { providerId, pagination: { limit: 100 } },\n skip: !workspaceId || !providerId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnectionsByProvider?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnectionsByProvider?.total ?? 0,\n loading,\n error,\n refetch,\n };\n}\n\n// ─── Mutation Hooks ─────────────────────────────────────────────────────────\n\nexport function useCreateConnection() {\n const [mutate, { loading }] = useCreateConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const createConnection = useCallback(\n async (input: {\n name: string;\n description?: string;\n providerId: string;\n authMethodKey?: string;\n vaultId?: string;\n credentialSecretId?: string;\n managedSecretName?: string;\n config?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n const id = result.data?.createConnection?.id as string | undefined;\n if (id) {\n eventBus.emit('integrations:connection-created', {\n connectionId: id,\n providerKey: input.providerId,\n });\n }\n return id;\n },\n [mutate, eventBus]\n );\n\n return { createConnection, loading };\n}\n\nexport function useDeleteConnection() {\n const [mutate, { loading }] = useDeleteConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const deleteConnection = useCallback(\n async (id: string, deleteVaultSecret = false) => {\n await mutate({ variables: { id, deleteVaultSecret } });\n eventBus.emit('integrations:connection-deleted', { connectionId: id });\n },\n [mutate, eventBus]\n );\n\n return { deleteConnection, loading };\n}\n\nexport function useInitiateOAuth() {\n const [mutate, { loading }] = useInitiateOAuthMutation();\n const eventBus = useIntegrationsEventBus();\n\n const initiateOAuth = useCallback(\n async (\n connectionId: string,\n redirectUri: string,\n providerKey: string,\n scopes?: string[]\n ): Promise<OAuthInitiationResult | null> => {\n eventBus.emit('integrations:oauth-started', { connectionId, providerKey });\n const result = await mutate({ variables: { input: { connectionId, redirectUri, scopes } } });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n }\n return result.data?.initiateOAuth ?? null;\n },\n [mutate, eventBus]\n );\n\n return { initiateOAuth, loading };\n}\n\n/**\n * Authenticate a connection with values shaped by its auth method's schema.\n *\n * Generic replacement for the per-auth-type hooks below: the caller passes\n * whatever the rendered form collected, so a new auth type needs no new hook,\n * no new mutation document and no new branch at the call site.\n */\nexport function useAuthenticateConnection() {\n const [mutate, { loading }] = useAuthenticateConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateConnection = useCallback(\n async (\n connectionId: string,\n authMethodKey: string | undefined,\n values: Record<string, unknown>\n ) => {\n const result = await mutate({\n variables: { input: { connectionId, authMethodKey, values } },\n });\n return result.data?.authenticateConnection;\n },\n [mutate]\n );\n\n return { authenticateConnection, loading };\n}\n\nexport function useAuthenticateWithApiKey() {\n const [mutate, { loading }] = useAuthenticateWithApiKeyMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithApiKey = useCallback(\n async (connectionId: string, apiKey: string) => {\n const result = await mutate({ variables: { input: { connectionId, apiKey } } });\n return result.data?.authenticateWithApiKey;\n },\n [mutate]\n );\n\n return { authenticateWithApiKey, loading };\n}\n\nexport function useAuthenticateWithBasicAuth() {\n const [mutate, { loading }] = useAuthenticateWithBasicAuthMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBasicAuth = useCallback(\n async (connectionId: string, username: string, password: string) => {\n const result = await mutate({ variables: { input: { connectionId, username, password } } });\n return result.data?.authenticateWithBasicAuth;\n },\n [mutate]\n );\n\n return { authenticateWithBasicAuth, loading };\n}\n\nexport function useAuthenticateWithBearerToken() {\n const [mutate, { loading }] = useAuthenticateWithBearerTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBearerToken = useCallback(\n async (connectionId: string, token: string) => {\n const result = await mutate({ variables: { input: { connectionId, token } } });\n return result.data?.authenticateWithBearerToken;\n },\n [mutate]\n );\n\n return { authenticateWithBearerToken, loading };\n}\n\n/**\n * GraphQL document for the first-party SERVICE_ACCOUNT auth flow. Defined inline\n * (rather than via codegen) so it does not depend on a fresh `schema:pull` from\n * a gateway that already exposes the new `authenticateWithServiceAccount`\n * mutation. Once the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_SERVICE_ACCOUNT = gql`\n mutation AuthenticateWithServiceAccount($input: ServiceAccountAuthInput!) {\n authenticateWithServiceAccount(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a first-party SERVICE_ACCOUNT provider (e.g. Burdenoff). No user\n * credentials are collected — the platform mints an app-as-user token per\n * execution. Calling this records the user's consent (delegation) for the\n * reserved app and activates the connection.\n */\nexport function useAuthenticateWithServiceAccount() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithServiceAccount: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; scopes?: string[] } }\n >(AUTHENTICATE_WITH_SERVICE_ACCOUNT, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithServiceAccount = useCallback(\n async (connectionId: string, scopes?: string[]) => {\n const result = await mutate({ variables: { input: { connectionId, scopes } } });\n return result.data?.authenticateWithServiceAccount;\n },\n [mutate]\n );\n\n return { authenticateWithServiceAccount, loading };\n}\n\n/**\n * GraphQL document for CUSTOM provider auth (configSchema-driven config, e.g.\n * Google Workspace Admin domain-wide delegation). Defined inline (rather than\n * via codegen) so it does not depend on a fresh `schema:pull` from a gateway\n * that already exposes the new `authenticateWithCustomConfig` mutation. Once\n * the gateway supergraph includes it, this can be migrated to an\n * `src/operations/...` document like the other mutations.\n */\nconst AUTHENTICATE_WITH_CUSTOM_CONFIG = gql`\n mutation AuthenticateWithCustomConfig($input: CustomConfigAuthInput!) {\n authenticateWithCustomConfig(input: $input) {\n id\n status\n }\n }\n`;\n\n/**\n * Connect a CUSTOM provider with a configSchema-shaped config object. The full\n * config is stored inside the encrypted credential payload (secrets never hit\n * plain columns); the connection becomes ACTIVE immediately.\n */\nexport function useAuthenticateWithCustomConfig() {\n const [mutate, { loading }] = useMutation<\n { authenticateWithCustomConfig: { id: string; status: ConnectionStatus } },\n { input: { connectionId: string; config: Record<string, unknown> } }\n >(AUTHENTICATE_WITH_CUSTOM_CONFIG, {\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithCustomConfig = useCallback(\n async (connectionId: string, config: Record<string, unknown>) => {\n const result = await mutate({ variables: { input: { connectionId, config } } });\n return result.data?.authenticateWithCustomConfig;\n },\n [mutate]\n );\n\n return { authenticateWithCustomConfig, loading };\n}\n\nexport function useRefreshToken() {\n const [mutate, { loading }] = useRefreshConnectionTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const refreshToken = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.refreshConnectionToken) {\n eventBus.emit('integrations:token-refreshed', { connectionId });\n }\n return result.data?.refreshConnectionToken;\n },\n [mutate, eventBus]\n );\n\n return { refreshToken, loading };\n}\n\nexport function useRevokeConnection() {\n const [mutate, { loading }] = useRevokeConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const revokeConnection = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.revokeConnection) {\n eventBus.emit('integrations:token-revoked', { connectionId });\n }\n return result.data?.revokeConnection;\n },\n [mutate, eventBus]\n );\n\n return { revokeConnection, loading };\n}\n\nexport function useTestConnection() {\n const [mutate, { loading }] = useTestConnectionMutation();\n\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n const result = await mutate({ variables: { connectionId } });\n return result.data?.testConnection ?? null;\n },\n [mutate]\n );\n\n return { testConnection, loading };\n}\n"],"mappings":";;;;;;;;AAiEA,SAAgB,EAAe,GAAkC;CAC/D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuB;EAC/D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EAKI,IAAW,GAAM,mBAAmB,KAAA;AAM1C,QAAO;EACL,cAL4C,GAAM,gBAAgB,SAAS,EAAE,EAAE,KAC9E,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,gBAAgB,SAAS;EACtC;EAGA;EACA;EACA;EACD;;AAGH,SAAgB,EAAc,GAAY;CACxC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAsB;EAC9D,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC,EAEI,IAAW,GAAM,kBAAkB,KAAA;AAMzC,QAAO;EAAE,YAJwC,GAAM,gBACnD,EAAc,EAAK,cAAyC,GAC5D;EAEiB;EAAS;EAAU;EAAO;EAAS;;AAG1D,SAAgB,EAAyB,GAAoB;CAC3D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAiC;EACzE,WAAW;GAAE;GAAY,YAAY,EAAE,OAAO,KAAK;GAAE;EACrD,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EACL,cAL4C,GAAM,0BAA0B,SAAS,EAAE,EAAE,KACxF,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,0BAA0B,SAAS;EAChD;EACA;EACA;EACD;;AAKH,SAAgB,IAAsB;CACpC,IAAM,CAAC,GAAQ,EAAE,gBAAa,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providers/IntegrationsProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { mapLog as t } from "../utils/mappers.js";
|
|
3
|
+
import { useGetIntegrationLogsQuery as n } from "../../generated/wspace-operations.js";
|
|
4
4
|
//#region src/integrations/hooks/useLogs.ts
|
|
5
5
|
function r(r) {
|
|
6
|
-
let { workspaceId: i } = e(), a = r?.page ?? 1, o = r?.pageSize ?? 20, { data: s, loading: c, error: l, refetch: u } =
|
|
6
|
+
let { workspaceId: i } = e(), a = r?.page ?? 1, o = r?.pageSize ?? 20, { data: s, loading: c, error: l, refetch: u } = n({
|
|
7
7
|
variables: {
|
|
8
8
|
filter: {
|
|
9
9
|
level: r?.level,
|
|
@@ -18,7 +18,7 @@ function r(r) {
|
|
|
18
18
|
errorPolicy: "all"
|
|
19
19
|
});
|
|
20
20
|
return {
|
|
21
|
-
logs: (s?.getIntegrationLogs?.items ?? []).map((e) =>
|
|
21
|
+
logs: (s?.getIntegrationLogs?.items ?? []).map((e) => t(e)),
|
|
22
22
|
total: s?.getIntegrationLogs?.total ?? 0,
|
|
23
23
|
hasMore: s?.getIntegrationLogs?.hasMore ?? !1,
|
|
24
24
|
loading: c,
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { mapProvider as t } from "../utils/mappers.js";
|
|
3
|
+
import { useDeleteProviderAuthMethodMutation as n, useDisableProviderMutation as r, useEnableProviderMutation as i, useGetProviderByKeyQuery as a, useGetProviderQuery as o, useGetProvidersQuery as s, useInstallProviderPluginMutation as c, useUninstallProviderPluginMutation as l, useUpdateProviderPluginMutation as u, useUpsertProviderAuthMethodMutation as d } from "../../generated/wspace-operations.js";
|
|
4
4
|
import { useCallback as f, useMemo as p } from "react";
|
|
5
5
|
//#region src/integrations/hooks/useProviders.ts
|
|
6
|
-
function m(
|
|
7
|
-
let { workspaceId:
|
|
6
|
+
function m(n) {
|
|
7
|
+
let { workspaceId: r } = e(), { data: i, loading: a, error: o, refetch: c } = s({
|
|
8
8
|
variables: {
|
|
9
|
-
filter:
|
|
9
|
+
filter: n,
|
|
10
10
|
pagination: { limit: 100 }
|
|
11
11
|
},
|
|
12
|
-
skip: !
|
|
12
|
+
skip: !r,
|
|
13
13
|
errorPolicy: "all"
|
|
14
|
-
}),
|
|
14
|
+
}), l = p(() => (i?.getProviders?.items ?? []).map((e) => t(e)), [i]);
|
|
15
15
|
return {
|
|
16
|
-
providers:
|
|
17
|
-
total:
|
|
18
|
-
loading:
|
|
19
|
-
error:
|
|
20
|
-
refetch:
|
|
16
|
+
providers: l,
|
|
17
|
+
total: l.length,
|
|
18
|
+
loading: a,
|
|
19
|
+
error: o,
|
|
20
|
+
refetch: c
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function h(
|
|
24
|
-
let { workspaceId:
|
|
25
|
-
variables: { id:
|
|
26
|
-
skip: !
|
|
23
|
+
function h(n) {
|
|
24
|
+
let { workspaceId: r } = e(), { data: i, loading: a, error: s, refetch: c } = o({
|
|
25
|
+
variables: { id: n },
|
|
26
|
+
skip: !r || !n,
|
|
27
27
|
errorPolicy: "all"
|
|
28
28
|
});
|
|
29
29
|
return {
|
|
30
|
-
provider:
|
|
31
|
-
loading:
|
|
32
|
-
error:
|
|
33
|
-
refetch:
|
|
30
|
+
provider: i?.getProvider ? t(i.getProvider) : null,
|
|
31
|
+
loading: a,
|
|
32
|
+
error: s,
|
|
33
|
+
refetch: c
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function g(
|
|
37
|
-
let { workspaceId:
|
|
38
|
-
variables: { key:
|
|
39
|
-
skip: !
|
|
36
|
+
function g(n) {
|
|
37
|
+
let { workspaceId: r } = e(), { data: i, loading: o, error: s, refetch: c } = a({
|
|
38
|
+
variables: { key: n },
|
|
39
|
+
skip: !r || !n,
|
|
40
40
|
errorPolicy: "all"
|
|
41
41
|
});
|
|
42
42
|
return {
|
|
43
|
-
provider:
|
|
44
|
-
loading:
|
|
45
|
-
error:
|
|
46
|
-
refetch:
|
|
43
|
+
provider: i?.getProviderByKey ? t(i.getProviderByKey) : null,
|
|
44
|
+
loading: o,
|
|
45
|
+
error: s,
|
|
46
|
+
refetch: c
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
function _() {
|
|
50
|
-
let [e, { loading: t }] =
|
|
50
|
+
let [e, { loading: t }] = c({ refetchQueries: [
|
|
51
51
|
"GetProviders",
|
|
52
52
|
"GetProvider",
|
|
53
53
|
"GetProviderCatalog"
|
|
@@ -58,7 +58,7 @@ function _() {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
function v() {
|
|
61
|
-
let [e, { loading: t }] =
|
|
61
|
+
let [e, { loading: t }] = u({ refetchQueries: [
|
|
62
62
|
"GetProviders",
|
|
63
63
|
"GetProvider",
|
|
64
64
|
"GetProviderCatalog"
|
|
@@ -72,7 +72,7 @@ function v() {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
function y() {
|
|
75
|
-
let [e, { loading: t }] =
|
|
75
|
+
let [e, { loading: t }] = l({ refetchQueries: [
|
|
76
76
|
"GetProviders",
|
|
77
77
|
"GetProvider",
|
|
78
78
|
"GetProviderCatalog"
|
|
@@ -83,21 +83,21 @@ function y() {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
function b() {
|
|
86
|
-
let [e, { loading: t }] =
|
|
86
|
+
let [e, { loading: t }] = i({ refetchQueries: ["GetProviders", "GetProvider"] });
|
|
87
87
|
return {
|
|
88
88
|
enableProvider: f(async (t) => (await e({ variables: { id: t } })).data?.enableProvider, [e]),
|
|
89
89
|
loading: t
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
function x() {
|
|
93
|
-
let [e, { loading: t }] =
|
|
93
|
+
let [e, { loading: t }] = r({ refetchQueries: ["GetProviders", "GetProvider"] });
|
|
94
94
|
return {
|
|
95
95
|
disableProvider: f(async (t) => (await e({ variables: { id: t } })).data?.disableProvider, [e]),
|
|
96
96
|
loading: t
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
function S() {
|
|
100
|
-
let [e, { loading: t }] =
|
|
100
|
+
let [e, { loading: t }] = d({ refetchQueries: ["GetProvider", "GetProviders"] });
|
|
101
101
|
return {
|
|
102
102
|
upsertAuthMethod: f(async (t, n) => (await e({ variables: {
|
|
103
103
|
providerId: t,
|
|
@@ -107,13 +107,13 @@ function S() {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
function C() {
|
|
110
|
-
let [e, { loading:
|
|
110
|
+
let [e, { loading: t }] = n({ refetchQueries: ["GetProvider", "GetProviders"] });
|
|
111
111
|
return {
|
|
112
112
|
deleteAuthMethod: f(async (t, n) => (await e({ variables: {
|
|
113
113
|
providerId: t,
|
|
114
114
|
key: n
|
|
115
115
|
} })).data?.deleteProviderAuthMethod, [e]),
|
|
116
|
-
loading:
|
|
116
|
+
loading: t
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
//#endregion
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
export { IntegrationsRoot } from './IntegrationsRoot';
|
|
26
26
|
export { ConnectionsPanel } from './ConnectionsPanel';
|
|
27
27
|
export type { ConnectionsPanelProps } from './ConnectionsPanel';
|
|
28
|
+
export { ConnectSourceDialog } from './ConnectSourceDialog';
|
|
29
|
+
export type { ConnectSourceDialogProps } from './ConnectSourceDialog';
|
|
28
30
|
export { IntegrationsAdminRoot } from './IntegrationsAdminRoot';
|
|
29
31
|
export type { IntegrationsRootProps, IntegrationProvider, IntegrationConnection } from './types';
|
|
30
32
|
export { useIntegrations } from './providers/IntegrationsProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,gBAAgB,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