@burdenoff/fluidgrids-fe-sdk 2026.1113.1 → 2026.1113.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/{AiStudioPage-D3MAk-bs.js → AiStudioPage-5KYZ8r8-.js} +464 -7
- package/dist/{ApprovalInboxPage-Bb8H9ruw.js → ApprovalInboxPage-BsJX4osU.js} +4 -3
- package/dist/{ConnectionFormDialog-Bg9_OdHX.js → ConnectionFormDialog-Dr1-CTan.js} +2 -1
- package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
- package/dist/{DataSinkDashboardPage-Dc2QuJbL.js → DataSinkDashboardPage-8ZDn85e2.js} +1 -1
- package/dist/{DataTablesPage-Cv4veaKK.js → DataTablesPage-BBvABuxE.js} +5 -4
- package/dist/{EntityTagPicker-D8ws706D.js → EntityTagPicker-BppBSEJk.js} +2 -2
- package/dist/{ExecutionDetailPage-CTVGE-d-.js → ExecutionDetailPage-BXDF2eoT.js} +1444 -18
- package/dist/ExecutionsListDocument-CzdLPpj5.js +1259 -0
- package/dist/{ExecutionsListPage-J0sJPuoM.js → ExecutionsListPage--4BthM8L.js} +285 -11
- package/dist/FailureTriagePanel-B5WCSRFo.js +1252 -0
- package/dist/{FluidGridsProvider-C4FVNz0n.js → FluidGridsProvider-Dc_Jhtch.js} +8666 -8734
- package/dist/{HistoryPage-B9XcTPrO.js → HistoryPage-BvFk2m1m.js} +4 -3
- package/dist/{InsightsPage-DFOltjyj.js → InsightsPage-Dwmb02F6.js} +2682 -5
- package/dist/{MissingNodesInstallModal-D8H-YNCJ.js → MissingNodesInstallModal-Cze674hp.js} +2 -2
- package/dist/{NodesPage-YQ-hP60x.js → NodesPage-C5Dq-ru-.js} +3 -2
- package/dist/{OpenTemplateAsCodeButton-hH26HQCk.js → OpenTemplateAsCodeButton-8MZHih6I.js} +2 -2
- package/dist/{PaidTemplateConfirm-DoKWMBtR.js → PaidTemplateConfirm-0G-gv29n.js} +1 -1
- package/dist/{PublishCustomNodeAction-5XXnSA3H.js → PublishCustomNodeAction-OOY35dUv.js} +1 -1
- package/dist/QuotaExhaustedDialog-wvu_-WJ-.js +55 -0
- package/dist/{RunnerStatusPill-Ctg4TJcP.js → RunnerStatusPill-Bh7mEsPh.js} +2 -1
- package/dist/{RunnersPage-CAt4YDhB.js → RunnersPage-DHeuUDil.js} +2 -2
- package/dist/{SettingsPage-DEKPCVVP.js → SettingsPage-CfjXiGpb.js} +694 -14
- package/dist/{TagFilterSelect-CwM2-DU6.js → TagFilterSelect-CAShgvbS.js} +1 -1
- package/dist/{TaskQueuesPage-Dhi6SIT4.js → TaskQueuesPage--Mmn36b-.js} +3 -3
- package/dist/{TemplateCard-DVSd_4zJ.js → TemplateCard-BA_9em22.js} +644 -352
- package/dist/{TemplateConfigurationModal-BKi1z7z7.js → TemplateConfigurationModal-BT3PaR0O.js} +4 -3
- package/dist/{TemplateDetailPanel-DK1gF7P5.js → TemplateDetailPanel-BxFNnlXm.js} +2 -1
- package/dist/{TemplatePreview-DuSX2Q7H.js → TemplatePreview-Bagja6WN.js} +7 -7
- package/dist/{TemplatesPage-CAWHh61l.js → TemplatesPage-CAajpJ5w.js} +711 -6
- package/dist/{VariablesPage-D7CoatWf.js → VariablesPage-CgUBKhAe.js} +3 -3
- package/dist/{VersionDiffDialog-DGwysiyE.js → VersionDiffDialog-D9W5Fm56.js} +233 -129
- package/dist/VersionLifecycleBar-DuphLOT0.js +131 -0
- package/dist/{WorkflowBuilder-DAeoQi5E.js → WorkflowBuilder-DMpSPElu.js} +16 -13
- package/dist/{WorkflowBuilder-BJgqDboZ.js → WorkflowBuilder-v8h8skwG.js} +5 -5
- package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
- package/dist/WorkflowEditLeaseStatusDocument-Dp62med3.js +627 -0
- package/dist/WorkflowProposalCard-zCdUpCk8.js +249 -0
- package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
- package/dist/{WorkflowSearchRedirect-CMEvd_AR.js → WorkflowSearchRedirect-G78lINAE.js} +1 -1
- package/dist/{WorkflowShareDialog-BgHRsDP0.js → WorkflowShareDialog-B7VOgr4-.js} +304 -3
- package/dist/WorkflowVersionsDocument-CfPMloRW.js +3195 -0
- package/dist/{WorkflowsList-CcQPxWKL.js → WorkflowsList-CPYzfE4K.js} +11 -9
- package/dist/agent-form-D0uLvzx4.js +718 -0
- package/dist/{agentTools-DKpNKztf.js → agentTools-DTXUqtfu.js} +4 -4
- package/dist/api-BZVyX5d2.js +2286 -0
- package/dist/api-BqA-f-AD.js +8064 -0
- package/dist/app-BJUvugPM.js +3813 -0
- package/dist/assert-rules-CPNrO44K.js +318 -0
- package/dist/attach-node-helpers-CNsYtLOR.js +32 -0
- package/dist/badge-CXfPhoMH.js +26 -0
- package/dist/{canvasNoteTools-C_AN79m0.js → canvasNoteTools-DmfZwtnL.js} +3 -3
- package/dist/{channel-CZ70oI81.js → channel-DtF1n_ab.js} +1 -1
- package/dist/client-Ctl4jmY3.js +127 -0
- package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
- package/dist/{code-editor-field-Dt6KNWwN.js → code-editor-field-Cv907s3W.js} +2 -2
- package/dist/{codec-client-CJ95Rmqo.js → codec-client-CAYl6j46.js} +2 -1
- package/dist/conditionBuilder-D8aLGL1w.js +1134 -0
- package/dist/config-X97zrIvn.js +600 -0
- package/dist/{definition-canvas-Bshn_dSP.js → definition-canvas-DL25_6NH.js} +1 -1
- package/dist/{dialog-Cjb4lB4D.js → dialog-BVd152GS.js} +3 -14
- package/dist/durable-nodes-DXCCQYWD.js +81 -0
- package/dist/errors-xPZ-IbQd.js +142 -0
- package/dist/executions.js +2 -2
- package/dist/{flow-builder-D3Hl2AFk.js → flow-builder-Dv5fWJ6F.js} +9301 -8189
- package/dist/{node-registry-refresh-Dy0uRg9f.js → global-client-DP_Wxe5t.js} +2 -27
- package/dist/global-operations-7pvXw_j9.js +145 -0
- package/dist/history.js +1 -1
- package/dist/{index-CWcP-tG1.d.ts → index-DtMUtXNq.d.ts} +247 -247
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4403 -46
- package/dist/input-ChT6Q-Pr.js +17 -0
- package/dist/logs-panel-DtG93ocy.js +342 -0
- package/dist/mapping-colors-BIX_YeCQ.js +48 -0
- package/dist/{node-detail-view-bVLeYarT.js → node-detail-view-BKI_2kM6.js} +12 -11
- package/dist/{node-editor-tab-body-JHHVtQgR.js → node-editor-tab-body-Cc1MWEFR.js} +3 -3
- package/dist/{node-operation-selection-DAbS6jSY.js → node-operation-selection-Czeeb2D4.js} +2 -139
- package/dist/node-registry-refresh-s3okf83X.js +27 -0
- package/dist/nodes.js +1 -1
- package/dist/notesKey-5EaREBGA.js +12 -0
- package/dist/observability.d.ts +1 -1
- package/dist/observability.js +2 -2
- package/dist/{popover-Xx3gN7vg.js → popover-DDv7J1Kl.js} +717 -6
- package/dist/{quick-config-panel-BvVQXuIL.js → quick-config-panel-BPCRfqWI.js} +4 -4
- package/dist/read-only-context-Dt9N9SIG.js +18 -0
- package/dist/{schedule-panel-DCb40TPN.js → schedule-panel-C1KwfLCE.js} +14 -12
- package/dist/settings.js +1 -1
- package/dist/{shared-CMfn30xT.js → shared-Ctl9ZHo1.js} +2 -1
- package/dist/{sidebar-node-editor-DxCWFZG2.js → sidebar-node-editor-d9Rlq5pU.js} +4 -4
- package/dist/sticky-notes-23j-wL6Q.js +96 -0
- package/dist/template-code-dqRunGOv.js +184 -0
- package/dist/template-preview-C01KV277.js +29 -0
- package/dist/templates.js +2 -2
- package/dist/token-refresh-link-BjN7H4qA.js +291 -0
- package/dist/useAgentDefinitions-ZKX2N9aP.js +3101 -0
- package/dist/useConnections-BlB0gbOB.js +931 -0
- package/dist/useDurableParity-BgLH_SCF.js +2088 -0
- package/dist/{useEntityTags-Db4Pc8_M.js → useEntityTags-4iW6UTly.js} +227 -3
- package/dist/{useExecutions-DOpG1pUQ.js → useExecutions-Bm7q_UwN.js} +6 -3
- package/dist/useGlobalStoreClient-DMTrywdX.js +24 -0
- package/dist/{useHumanRequests-ZiR0sSzS.js → useHumanRequests-DwG2tQ3f.js} +2 -1
- package/dist/{useObservability-rQmwhoZZ.js → useObservability-DPATdbw7.js} +4 -2
- package/dist/{useRunHistory-COn6dl7l.js → useRunHistory-CGfjCsJ3.js} +1122 -4
- package/dist/{useVariables-2ddyJX4a.js → useVariables-DFdZofLQ.js} +2 -1
- package/dist/{useWorkflowCodeExport-ZoUJKRSK.js → useWorkflowCodeExport-D_mCuhKP.js} +289 -4
- package/dist/useWorkflowOrganization-r5FWNBs6.js +1690 -0
- package/dist/useWorkflowProposal-Bh2_qjmM.js +7478 -0
- package/dist/{useWorkflows-jOW60YmD.js → useWorkflows-aqVD7kGa.js} +694 -4
- package/dist/workflow-builder.js +5 -5
- package/dist/{workflow-code-transfer-l9wO34S0.js → workflow-code-transfer-5C0HUzae.js} +1 -53
- package/dist/workflow-host.js +4 -2
- package/dist/workflow-pages.d.ts +1 -1
- package/dist/workflow-pages.js +19 -19
- package/dist/workflow-preview.js +3 -2
- package/dist/workflows-list.js +1 -1
- package/package.json +1 -1
- package/dist/FailureTriagePanel-BbYFYeV_.js +0 -311
- package/dist/WorkflowProposalCard-DGMdZC4R.js +0 -1432
- package/dist/agent-form-Bfvm32j1.js +0 -83
- package/dist/api-DQtHXbIg.js +0 -224
- package/dist/api-MeAm6g7E.js +0 -55
- package/dist/client-C9XSzSXr.js +0 -1147
- package/dist/graphql-operation-types-C9qbvRa8.js +0 -53122
- package/dist/useAgentDefinitions-_hgNCK1A.js +0 -550
- package/dist/useConnections-Cs7LCWEM.js +0 -401
- package/dist/useDurableParity-CcLeCDfv.js +0 -504
- package/dist/useWorkflowOrganization-QxVePSkk.js +0 -282
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { _ as throwIfResultError, n as getFluidGridsClient } from "./client-C9XSzSXr.js";
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
4
|
-
import { gql } from "@apollo/client";
|
|
5
|
-
|
|
6
|
-
// src/modules/connections/hooks/useConnections.ts
|
|
7
|
-
/**
|
|
8
|
-
* Custom hooks for fetching connections from the integrations service.
|
|
9
|
-
*
|
|
10
|
-
* These hooks query the wspace-integrations-svc via the federated GraphQL gateway.
|
|
11
|
-
* Connections replace the legacy credentials system for third-party authentication.
|
|
12
|
-
*/
|
|
13
|
-
const PROVIDER_FIELDS = gql`
|
|
14
|
-
fragment ProviderFields on IntegrationProvider {
|
|
15
|
-
id
|
|
16
|
-
key
|
|
17
|
-
name
|
|
18
|
-
description
|
|
19
|
-
category
|
|
20
|
-
authType
|
|
21
|
-
icon
|
|
22
|
-
color
|
|
23
|
-
website
|
|
24
|
-
docsUrl
|
|
25
|
-
isBuiltIn
|
|
26
|
-
isEnabled
|
|
27
|
-
availableScopes
|
|
28
|
-
# How this provider can be authenticated, as data. The builder renders the
|
|
29
|
-
# form from this rather than from a per-provider React component, so a
|
|
30
|
-
# provider or a new method added by an administrator shows up here with no
|
|
31
|
-
# frontend change.
|
|
32
|
-
authMethods {
|
|
33
|
-
key
|
|
34
|
-
displayName
|
|
35
|
-
description
|
|
36
|
-
flow
|
|
37
|
-
authType
|
|
38
|
-
configSchema
|
|
39
|
-
availableScopes
|
|
40
|
-
defaultScopes
|
|
41
|
-
isConfigured
|
|
42
|
-
isEnabled
|
|
43
|
-
displayOrder
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
const CONNECTION_FIELDS = gql`
|
|
48
|
-
${PROVIDER_FIELDS}
|
|
49
|
-
fragment ConnectionFields on IntegrationConnection {
|
|
50
|
-
id
|
|
51
|
-
name
|
|
52
|
-
description
|
|
53
|
-
providerId
|
|
54
|
-
provider {
|
|
55
|
-
...ProviderFields
|
|
56
|
-
}
|
|
57
|
-
status
|
|
58
|
-
lastHealthCheck
|
|
59
|
-
lastUsedAt
|
|
60
|
-
errorMessage
|
|
61
|
-
externalAccountId
|
|
62
|
-
externalAccountEmail
|
|
63
|
-
externalAccountName
|
|
64
|
-
grantedScopes
|
|
65
|
-
createdBy
|
|
66
|
-
createdAt
|
|
67
|
-
updatedAt
|
|
68
|
-
visibility
|
|
69
|
-
myAccess
|
|
70
|
-
canUse
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
const GET_CONNECTIONS = gql`
|
|
74
|
-
${CONNECTION_FIELDS}
|
|
75
|
-
query GetConnections(
|
|
76
|
-
$filter: ConnectionFilterInput
|
|
77
|
-
$pagination: IntegrationsPaginationInput
|
|
78
|
-
) {
|
|
79
|
-
getConnections(filter: $filter, pagination: $pagination) {
|
|
80
|
-
items {
|
|
81
|
-
...ConnectionFields
|
|
82
|
-
}
|
|
83
|
-
total
|
|
84
|
-
hasMore
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
88
|
-
const GET_CONNECTION = gql`
|
|
89
|
-
${CONNECTION_FIELDS}
|
|
90
|
-
query GetConnection($id: ID!) {
|
|
91
|
-
getConnection(id: $id) {
|
|
92
|
-
...ConnectionFields
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
const GET_CONNECTIONS_BY_PROVIDER = gql`
|
|
97
|
-
${CONNECTION_FIELDS}
|
|
98
|
-
query GetConnectionsByProvider(
|
|
99
|
-
$providerId: ID!
|
|
100
|
-
$pagination: IntegrationsPaginationInput
|
|
101
|
-
) {
|
|
102
|
-
getConnectionsByProvider(providerId: $providerId, pagination: $pagination) {
|
|
103
|
-
items {
|
|
104
|
-
...ConnectionFields
|
|
105
|
-
}
|
|
106
|
-
total
|
|
107
|
-
hasMore
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
|
-
const GET_PROVIDERS = gql`
|
|
112
|
-
${PROVIDER_FIELDS}
|
|
113
|
-
query GetProviders(
|
|
114
|
-
$filter: ProviderFilterInput
|
|
115
|
-
$pagination: IntegrationsPaginationInput
|
|
116
|
-
) {
|
|
117
|
-
getProviders(filter: $filter, pagination: $pagination) {
|
|
118
|
-
items {
|
|
119
|
-
...ProviderFields
|
|
120
|
-
}
|
|
121
|
-
total
|
|
122
|
-
hasMore
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
`;
|
|
126
|
-
const INITIATE_OAUTH = gql`
|
|
127
|
-
mutation InitiateOAuth($input: InitiateOAuthInput!) {
|
|
128
|
-
initiateOAuth(input: $input) {
|
|
129
|
-
redirectUrl
|
|
130
|
-
state
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
`;
|
|
134
|
-
const CREATE_CONNECTION = gql`
|
|
135
|
-
${CONNECTION_FIELDS}
|
|
136
|
-
mutation CreateConnection($input: CreateConnectionInput!) {
|
|
137
|
-
createConnection(input: $input) {
|
|
138
|
-
...ConnectionFields
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
`;
|
|
142
|
-
/** Page size the integrations service allows; it clamps larger limits to 100. */
|
|
143
|
-
const CONNECTIONS_PAGE_SIZE = 100;
|
|
144
|
-
/**
|
|
145
|
-
* Every page of a connection list. A picker that accepts any provider (the
|
|
146
|
-
* HTTP Request node) must offer every saved connection, not the first 100.
|
|
147
|
-
*
|
|
148
|
-
* Reads until the server says there is no more, the reported total is reached,
|
|
149
|
-
* or a page adds no connection it has not already returned, so a server that
|
|
150
|
-
* keeps answering `hasMore` without progressing cannot loop forever.
|
|
151
|
-
*/
|
|
152
|
-
async function fetchAllConnectionPages(fetchPage) {
|
|
153
|
-
const items = [];
|
|
154
|
-
const seen = /* @__PURE__ */ new Set();
|
|
155
|
-
let total = 0;
|
|
156
|
-
let hasMore = false;
|
|
157
|
-
for (let offset = 0;; offset += 100) {
|
|
158
|
-
const result = await fetchPage(offset);
|
|
159
|
-
const fresh = (result?.items ?? []).filter((item) => !seen.has(item.id));
|
|
160
|
-
for (const item of fresh) {
|
|
161
|
-
seen.add(item.id);
|
|
162
|
-
items.push(item);
|
|
163
|
-
}
|
|
164
|
-
total = result?.total ?? items.length;
|
|
165
|
-
hasMore = result?.hasMore ?? false;
|
|
166
|
-
if (!hasMore || fresh.length === 0 || items.length >= total) break;
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
items,
|
|
170
|
-
total,
|
|
171
|
-
hasMore: hasMore && items.length < total
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Hook to fetch list of connections from the integrations service.
|
|
176
|
-
*/
|
|
177
|
-
function useConnections(filter) {
|
|
178
|
-
const [connections, setConnections] = useState([]);
|
|
179
|
-
const [total, setTotal] = useState(0);
|
|
180
|
-
const [hasMore, setHasMore] = useState(false);
|
|
181
|
-
const [loading, setLoading] = useState(true);
|
|
182
|
-
const [error, setError] = useState(null);
|
|
183
|
-
const filterKey = JSON.stringify(filter);
|
|
184
|
-
const fetchData = useCallback(async () => {
|
|
185
|
-
setLoading(true);
|
|
186
|
-
setError(null);
|
|
187
|
-
try {
|
|
188
|
-
const client = getFluidGridsClient();
|
|
189
|
-
const parsedFilter = filterKey ? JSON.parse(filterKey) : void 0;
|
|
190
|
-
const list = await fetchAllConnectionPages(async (offset) => {
|
|
191
|
-
return (await client.query({
|
|
192
|
-
query: GET_CONNECTIONS,
|
|
193
|
-
variables: {
|
|
194
|
-
filter: parsedFilter,
|
|
195
|
-
pagination: {
|
|
196
|
-
limit: 100,
|
|
197
|
-
offset
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
fetchPolicy: "network-only"
|
|
201
|
-
})).data?.getConnections;
|
|
202
|
-
});
|
|
203
|
-
setConnections(list.items);
|
|
204
|
-
setTotal(list.total);
|
|
205
|
-
setHasMore(list.hasMore);
|
|
206
|
-
} catch (err) {
|
|
207
|
-
setError(err);
|
|
208
|
-
} finally {
|
|
209
|
-
setLoading(false);
|
|
210
|
-
}
|
|
211
|
-
}, [filterKey]);
|
|
212
|
-
useEffect(() => {
|
|
213
|
-
fetchData();
|
|
214
|
-
}, [fetchData]);
|
|
215
|
-
return {
|
|
216
|
-
connections,
|
|
217
|
-
total,
|
|
218
|
-
hasMore,
|
|
219
|
-
loading,
|
|
220
|
-
error,
|
|
221
|
-
refetch: fetchData
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Hook to fetch a single connection by ID.
|
|
226
|
-
*/
|
|
227
|
-
function useConnection(connectionId) {
|
|
228
|
-
const [connection, setConnection] = useState(null);
|
|
229
|
-
const [loading, setLoading] = useState(true);
|
|
230
|
-
const [error, setError] = useState(null);
|
|
231
|
-
const fetchData = useCallback(async () => {
|
|
232
|
-
if (!connectionId) {
|
|
233
|
-
setLoading(false);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
setLoading(true);
|
|
237
|
-
setError(null);
|
|
238
|
-
try {
|
|
239
|
-
const result = await getFluidGridsClient().query({
|
|
240
|
-
query: GET_CONNECTION,
|
|
241
|
-
variables: { id: connectionId },
|
|
242
|
-
fetchPolicy: "cache-first"
|
|
243
|
-
});
|
|
244
|
-
setConnection(result.data?.getConnection ?? null);
|
|
245
|
-
} catch (err) {
|
|
246
|
-
setError(err);
|
|
247
|
-
} finally {
|
|
248
|
-
setLoading(false);
|
|
249
|
-
}
|
|
250
|
-
}, [connectionId]);
|
|
251
|
-
useEffect(() => {
|
|
252
|
-
fetchData();
|
|
253
|
-
}, [fetchData]);
|
|
254
|
-
return {
|
|
255
|
-
connection,
|
|
256
|
-
loading,
|
|
257
|
-
error,
|
|
258
|
-
refetch: fetchData
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Hook to fetch connections for a specific provider.
|
|
263
|
-
*/
|
|
264
|
-
function useConnectionsByProvider(providerId) {
|
|
265
|
-
const [connections, setConnections] = useState([]);
|
|
266
|
-
const [total, setTotal] = useState(0);
|
|
267
|
-
const [loading, setLoading] = useState(true);
|
|
268
|
-
const [error, setError] = useState(null);
|
|
269
|
-
const fetchData = useCallback(async () => {
|
|
270
|
-
if (!providerId) {
|
|
271
|
-
setLoading(false);
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
setLoading(true);
|
|
275
|
-
setError(null);
|
|
276
|
-
try {
|
|
277
|
-
const result = await getFluidGridsClient().query({
|
|
278
|
-
query: GET_CONNECTIONS_BY_PROVIDER,
|
|
279
|
-
variables: {
|
|
280
|
-
providerId,
|
|
281
|
-
pagination: { limit: 100 }
|
|
282
|
-
},
|
|
283
|
-
fetchPolicy: "network-only"
|
|
284
|
-
});
|
|
285
|
-
setConnections(result.data?.getConnectionsByProvider?.items ?? []);
|
|
286
|
-
setTotal(result.data?.getConnectionsByProvider?.total ?? 0);
|
|
287
|
-
} catch (err) {
|
|
288
|
-
setError(err);
|
|
289
|
-
} finally {
|
|
290
|
-
setLoading(false);
|
|
291
|
-
}
|
|
292
|
-
}, [providerId]);
|
|
293
|
-
useEffect(() => {
|
|
294
|
-
fetchData();
|
|
295
|
-
}, [fetchData]);
|
|
296
|
-
return {
|
|
297
|
-
connections,
|
|
298
|
-
total,
|
|
299
|
-
loading,
|
|
300
|
-
error,
|
|
301
|
-
refetch: fetchData
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Hook to fetch available integration providers.
|
|
306
|
-
*/
|
|
307
|
-
function useProviders(filter) {
|
|
308
|
-
const [providers, setProviders] = useState([]);
|
|
309
|
-
const [total, setTotal] = useState(0);
|
|
310
|
-
const [loading, setLoading] = useState(true);
|
|
311
|
-
const [error, setError] = useState(null);
|
|
312
|
-
const filterKey = JSON.stringify(filter);
|
|
313
|
-
const fetchData = useCallback(async () => {
|
|
314
|
-
setLoading(true);
|
|
315
|
-
setError(null);
|
|
316
|
-
try {
|
|
317
|
-
const client = getFluidGridsClient();
|
|
318
|
-
const parsedFilter = filterKey ? JSON.parse(filterKey) : void 0;
|
|
319
|
-
const result = await client.query({
|
|
320
|
-
query: GET_PROVIDERS,
|
|
321
|
-
variables: {
|
|
322
|
-
filter: parsedFilter,
|
|
323
|
-
pagination: { limit: 100 }
|
|
324
|
-
},
|
|
325
|
-
fetchPolicy: "cache-first"
|
|
326
|
-
});
|
|
327
|
-
setProviders(result.data?.getProviders?.items ?? []);
|
|
328
|
-
setTotal(result.data?.getProviders?.total ?? 0);
|
|
329
|
-
} catch (err) {
|
|
330
|
-
setError(err);
|
|
331
|
-
} finally {
|
|
332
|
-
setLoading(false);
|
|
333
|
-
}
|
|
334
|
-
}, [filterKey]);
|
|
335
|
-
useEffect(() => {
|
|
336
|
-
fetchData();
|
|
337
|
-
}, [fetchData]);
|
|
338
|
-
return {
|
|
339
|
-
providers,
|
|
340
|
-
total,
|
|
341
|
-
loading,
|
|
342
|
-
error,
|
|
343
|
-
refetch: fetchData
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Hook to create a new connection.
|
|
348
|
-
*/
|
|
349
|
-
function useCreateConnection() {
|
|
350
|
-
const [loading, setLoading] = useState(false);
|
|
351
|
-
const [error, setError] = useState(null);
|
|
352
|
-
return {
|
|
353
|
-
createConnection: useCallback(async (input) => {
|
|
354
|
-
setLoading(true);
|
|
355
|
-
setError(null);
|
|
356
|
-
try {
|
|
357
|
-
const client = getFluidGridsClient();
|
|
358
|
-
return throwIfResultError(await client.mutate({
|
|
359
|
-
mutation: CREATE_CONNECTION,
|
|
360
|
-
variables: { input }
|
|
361
|
-
})).data?.createConnection ?? null;
|
|
362
|
-
} catch (err) {
|
|
363
|
-
setError(err);
|
|
364
|
-
return null;
|
|
365
|
-
} finally {
|
|
366
|
-
setLoading(false);
|
|
367
|
-
}
|
|
368
|
-
}, []),
|
|
369
|
-
loading,
|
|
370
|
-
error
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Hook to initiate OAuth flow for a connection.
|
|
375
|
-
*/
|
|
376
|
-
function useInitiateOAuth() {
|
|
377
|
-
const [loading, setLoading] = useState(false);
|
|
378
|
-
const [error, setError] = useState(null);
|
|
379
|
-
return {
|
|
380
|
-
initiateOAuth: useCallback(async (input) => {
|
|
381
|
-
setLoading(true);
|
|
382
|
-
setError(null);
|
|
383
|
-
try {
|
|
384
|
-
const client = getFluidGridsClient();
|
|
385
|
-
return throwIfResultError(await client.mutate({
|
|
386
|
-
mutation: INITIATE_OAUTH,
|
|
387
|
-
variables: { input }
|
|
388
|
-
})).data?.initiateOAuth ?? null;
|
|
389
|
-
} catch (err) {
|
|
390
|
-
setError(err);
|
|
391
|
-
return null;
|
|
392
|
-
} finally {
|
|
393
|
-
setLoading(false);
|
|
394
|
-
}
|
|
395
|
-
}, []),
|
|
396
|
-
loading,
|
|
397
|
-
error
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
export { useInitiateOAuth as a, useCreateConnection as i, useConnections as n, useProviders as o, useConnectionsByProvider as r, useConnection as t };
|