@sixb/client 0.1.9 → 0.1.11
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/README.md +26 -0
- package/dist/browser.js +2 -2
- package/dist/{chunk-dp68jpeq.js → chunk-65bdf9vw.js} +2 -2
- package/dist/{chunk-6pmyt76w.js → chunk-65mmaq7r.js} +8 -6
- package/dist/{chunk-6pmyt76w.js.map → chunk-65mmaq7r.js.map} +3 -3
- package/dist/{chunk-62nthgkf.js → chunk-7bv57jcq.js} +3 -2
- package/dist/chunk-7bv57jcq.js.map +19 -0
- package/dist/{chunk-rvaq39w5.js → chunk-f4qeqxz2.js} +1 -1
- package/dist/{chunk-cs98dfbc.js → chunk-qaacaq2e.js} +2 -2
- package/dist/{chunk-d0m9gz29.js → chunk-y4g6jrvs.js} +1 -1
- package/dist/connectors/connection.d.ts.map +1 -1
- package/dist/connectors/mutations.d.ts.map +1 -1
- package/dist/connectors/queries.d.ts +0 -4
- package/dist/connectors/queries.d.ts.map +1 -1
- package/dist/file.d.ts +3 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/generated/@tanstack/react-query.gen.d.ts +597 -54
- package/dist/generated/@tanstack/react-query.gen.d.ts.map +1 -1
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/sdk.gen.d.ts +5 -1
- package/dist/generated/sdk.gen.d.ts.map +1 -1
- package/dist/generated/types.gen.d.ts +228 -4
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/hooks.js +77 -32
- package/dist/hooks.js.map +6 -6
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/logs.js +3 -3
- package/dist/models.js +4 -2
- package/dist/models.js.map +1 -1
- package/dist/query.js +3 -3
- package/package.json +2 -2
- package/src/connectors/connection.ts +45 -7
- package/src/connectors/mutations.ts +9 -4
- package/src/file.ts +11 -6
- package/src/generated/@tanstack/react-query.gen.ts +32 -0
- package/src/generated/index.ts +6 -0
- package/src/generated/sdk.gen.ts +15 -0
- package/src/generated/types.gen.ts +258 -4
- package/dist/chunk-62nthgkf.js.map +0 -19
- /package/dist/{chunk-dp68jpeq.js.map → chunk-65bdf9vw.js.map} +0 -0
- /package/dist/{chunk-rvaq39w5.js.map → chunk-f4qeqxz2.js.map} +0 -0
- /package/dist/{chunk-cs98dfbc.js.map → chunk-qaacaq2e.js.map} +0 -0
- /package/dist/{chunk-d0m9gz29.js.map → chunk-y4g6jrvs.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
listConnectorConnections2,
|
|
45
45
|
disconnectConnectorConnection2,
|
|
46
46
|
revokeConnectorConnection2,
|
|
47
|
+
listPendingConnectorConnectionRuns2,
|
|
47
48
|
startConnectorConnectionRun2,
|
|
48
49
|
getConnectorConnectionRun2,
|
|
49
50
|
addConnectorConnection2,
|
|
@@ -139,7 +140,7 @@ import {
|
|
|
139
140
|
listProjectionRuns2,
|
|
140
141
|
getProjectionRun2,
|
|
141
142
|
listWebhookRuns2
|
|
142
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-7bv57jcq.js";
|
|
143
144
|
import {
|
|
144
145
|
createSixbAgentsWebSocketUrl2,
|
|
145
146
|
createAgentRunSocket2,
|
|
@@ -164,7 +165,7 @@ import {
|
|
|
164
165
|
objectFileContentUrl2,
|
|
165
166
|
SixbFileUploadError2,
|
|
166
167
|
uploadFile2
|
|
167
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-65mmaq7r.js";
|
|
168
169
|
import {
|
|
169
170
|
SIXB_CSRF_HEADER_NAME2,
|
|
170
171
|
SIXB_CSRF_TOKEN_RESPONSE_HEADER_NAME2,
|
|
@@ -175,7 +176,7 @@ import {
|
|
|
175
176
|
configureSixbClient2,
|
|
176
177
|
createSixbClientConfig2,
|
|
177
178
|
normalizeSixbApiBaseUrl2
|
|
178
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-f4qeqxz2.js";
|
|
179
180
|
import {
|
|
180
181
|
encodeObjectId2,
|
|
181
182
|
decodeObjectId2,
|
|
@@ -191,8 +192,8 @@ import {
|
|
|
191
192
|
logs2,
|
|
192
193
|
isStoredLogLine2,
|
|
193
194
|
isStoredLogLine3
|
|
194
|
-
} from "./chunk-
|
|
195
|
-
import"./chunk-
|
|
195
|
+
} from "./chunk-65bdf9vw.js";
|
|
196
|
+
import"./chunk-y4g6jrvs.js";
|
|
196
197
|
import"./chunk-0ka9ykez.js";
|
|
197
198
|
export {
|
|
198
199
|
ActionRunFailedError2 as ActionRunFailedError,
|
|
@@ -315,6 +316,7 @@ export {
|
|
|
315
316
|
listModels2 as listModels,
|
|
316
317
|
listObjectTypes2 as listObjectTypes,
|
|
317
318
|
listObjects2 as listObjects,
|
|
319
|
+
listPendingConnectorConnectionRuns2 as listPendingConnectorConnectionRuns,
|
|
318
320
|
listPipelineRuns2 as listPipelineRuns,
|
|
319
321
|
listPipelines2 as listPipelines,
|
|
320
322
|
listProjectionRuns2 as listProjectionRuns,
|
|
@@ -379,4 +381,4 @@ export {
|
|
|
379
381
|
waitForActionRun2 as waitForActionRun
|
|
380
382
|
};
|
|
381
383
|
|
|
382
|
-
//# debugId=
|
|
384
|
+
//# debugId=E4000332E1084DC464756E2164756E21
|
package/dist/index.js.map
CHANGED
package/dist/logs.js
CHANGED
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
logs2,
|
|
7
7
|
isStoredLogLine2,
|
|
8
8
|
isStoredLogLine3
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import"./chunk-
|
|
9
|
+
} from "./chunk-65bdf9vw.js";
|
|
10
|
+
import"./chunk-y4g6jrvs.js";
|
|
11
11
|
import"./chunk-0ka9ykez.js";
|
|
12
12
|
import"./chunk-65zz479s.js";
|
|
13
|
-
import"./chunk-
|
|
13
|
+
import"./chunk-7bv57jcq.js";
|
|
14
14
|
export {
|
|
15
15
|
createLogSocket2 as createLogSocket,
|
|
16
16
|
createSixbLogsWebSocketUrl2 as createSixbLogsWebSocketUrl,
|
package/dist/models.js
CHANGED
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
listConnectorConnections2,
|
|
53
53
|
disconnectConnectorConnection2,
|
|
54
54
|
revokeConnectorConnection2,
|
|
55
|
+
listPendingConnectorConnectionRuns2,
|
|
55
56
|
startConnectorConnectionRun2,
|
|
56
57
|
getConnectorConnectionRun2,
|
|
57
58
|
addConnectorConnection2,
|
|
@@ -147,7 +148,7 @@ import {
|
|
|
147
148
|
listProjectionRuns2,
|
|
148
149
|
getProjectionRun2,
|
|
149
150
|
listWebhookRuns2
|
|
150
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-7bv57jcq.js";
|
|
151
152
|
export {
|
|
152
153
|
abortFileUpload2 as abortFileUpload,
|
|
153
154
|
addConnectorConnection2 as addConnectorConnection,
|
|
@@ -244,6 +245,7 @@ export {
|
|
|
244
245
|
listModels2 as listModels,
|
|
245
246
|
listObjectTypes2 as listObjectTypes,
|
|
246
247
|
listObjects2 as listObjects,
|
|
248
|
+
listPendingConnectorConnectionRuns2 as listPendingConnectorConnectionRuns,
|
|
247
249
|
listPipelineRuns2 as listPipelineRuns,
|
|
248
250
|
listPipelines2 as listPipelines,
|
|
249
251
|
listProjectionRuns2 as listProjectionRuns,
|
|
@@ -295,4 +297,4 @@ export {
|
|
|
295
297
|
upsertObjectLink2 as upsertObjectLink
|
|
296
298
|
};
|
|
297
299
|
|
|
298
|
-
//# debugId=
|
|
300
|
+
//# debugId=BC9F4E81B7BA740864756E2164756E21
|
package/dist/models.js.map
CHANGED
package/dist/query.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
SixbQueryError2,
|
|
4
4
|
objects2,
|
|
5
5
|
createHttpQueryExecutor2
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import"./chunk-
|
|
6
|
+
} from "./chunk-qaacaq2e.js";
|
|
7
|
+
import"./chunk-f4qeqxz2.js";
|
|
8
8
|
import"./chunk-65zz479s.js";
|
|
9
|
-
import"./chunk-
|
|
9
|
+
import"./chunk-7bv57jcq.js";
|
|
10
10
|
export {
|
|
11
11
|
SixbQueryError2 as SixbQueryError,
|
|
12
12
|
createHttpQueryExecutor2 as createHttpQueryExecutor,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Type-safe SDK for Sixb API with TanStack Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"prepack": "bun run build"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@sixb/core": "^0.1.
|
|
70
|
+
"@sixb/core": "^0.1.11"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query"
|
|
1
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|
2
3
|
import { isSixbApiError } from "../api"
|
|
4
|
+
import { useSixbProviderClient } from "../client-provider"
|
|
5
|
+
import {
|
|
6
|
+
listPendingConnectorConnectionRunsOptions,
|
|
7
|
+
listPendingConnectorConnectionRunsQueryKey,
|
|
8
|
+
} from "../generated/@tanstack/react-query.gen"
|
|
3
9
|
import {
|
|
4
10
|
useConnectConnector,
|
|
5
11
|
useDisconnectConnector,
|
|
@@ -88,13 +94,35 @@ export function useConnectorConnection({
|
|
|
88
94
|
returnTo,
|
|
89
95
|
}: UseConnectorConnectionOptions): UseConnectorConnectionResult {
|
|
90
96
|
const [callback, setCallback] = useState(readConnectorConnectionCallback)
|
|
97
|
+
const providerClient = useSixbProviderClient()
|
|
98
|
+
const queryClient = useQueryClient()
|
|
99
|
+
const [dismissedRunIds, setDismissedRunIds] = useState<readonly string[]>([])
|
|
91
100
|
const connectInFlightRef = useRef<Promise<void> | null>(null)
|
|
92
101
|
const callbackRunId = callback?.connectorId === connectorId ? callback.runId : null
|
|
102
|
+
const pendingRunsQuery = useQuery({
|
|
103
|
+
...listPendingConnectorConnectionRunsOptions({ client: providerClient, path: { connectorId } }),
|
|
104
|
+
enabled: callbackRunId === null,
|
|
105
|
+
staleTime: 0,
|
|
106
|
+
})
|
|
107
|
+
const recoveryPending = callbackRunId === null && pendingRunsQuery.isPending
|
|
108
|
+
const recoveryError = callbackRunId === null ? pendingRunsQuery.error : null
|
|
93
109
|
const connectionsQuery = useConnectorConnections({ connectorId })
|
|
94
110
|
const connection = useMemo(
|
|
95
111
|
() => connectionsQuery.data?.find((candidate) => candidate.slot === slot),
|
|
96
112
|
[connectionsQuery.data, slot]
|
|
97
113
|
)
|
|
114
|
+
const pendingRun = pendingRunsQuery.data?.find(
|
|
115
|
+
(run) => run.slot === slot && !dismissedRunIds.includes(run.id)
|
|
116
|
+
)
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (
|
|
119
|
+
callbackRunId === null &&
|
|
120
|
+
!connectionsQuery.isPending &&
|
|
121
|
+
!connectionsQuery.error &&
|
|
122
|
+
pendingRun
|
|
123
|
+
)
|
|
124
|
+
setCallback({ connectorId, runId: pendingRun.id })
|
|
125
|
+
}, [callbackRunId, connectorId, pendingRun, connectionsQuery.isPending, connectionsQuery.error])
|
|
98
126
|
const runQuery = useConnectorConnectionRun({
|
|
99
127
|
connectorId,
|
|
100
128
|
runId: callbackRunId,
|
|
@@ -131,12 +159,20 @@ export function useConnectorConnection({
|
|
|
131
159
|
if (result.error || !expectedCallback || !canConsume()) return
|
|
132
160
|
if (!result.data?.some((candidate) => candidate.slot === slot)) return
|
|
133
161
|
|
|
162
|
+
await queryClient.invalidateQueries({
|
|
163
|
+
queryKey: listPendingConnectorConnectionRunsQueryKey({
|
|
164
|
+
client: providerClient,
|
|
165
|
+
path: { connectorId },
|
|
166
|
+
}),
|
|
167
|
+
})
|
|
168
|
+
if (!canConsume()) return
|
|
169
|
+
setDismissedRunIds((current) => [...current, expectedCallback.runId])
|
|
134
170
|
clearConnectorConnectionCallback(expectedCallback)
|
|
135
171
|
setCallback((current) =>
|
|
136
172
|
sameConnectorConnectionCallback(current, expectedCallback) ? null : current
|
|
137
173
|
)
|
|
138
174
|
},
|
|
139
|
-
[connectionsQuery.refetch, slot]
|
|
175
|
+
[connectionsQuery.refetch, slot, queryClient, connectorId, providerClient]
|
|
140
176
|
)
|
|
141
177
|
|
|
142
178
|
const completedRunId = resumedRun?.status === "succeeded" ? resumedRun.id : null
|
|
@@ -197,6 +233,7 @@ export function useConnectorConnection({
|
|
|
197
233
|
}
|
|
198
234
|
|
|
199
235
|
async function refresh(): Promise<void> {
|
|
236
|
+
if (callbackRunId === null) await pendingRunsQuery.refetch()
|
|
200
237
|
let completedCallback: ConnectorConnectionCallback | undefined
|
|
201
238
|
if (callbackRunId !== null) {
|
|
202
239
|
const runResult = await runQuery.refetch()
|
|
@@ -217,6 +254,7 @@ export function useConnectorConnection({
|
|
|
217
254
|
|
|
218
255
|
function dismiss(): void {
|
|
219
256
|
if (!callback) return
|
|
257
|
+
setDismissedRunIds((current) => [...current, callback.runId])
|
|
220
258
|
clearConnectorConnectionCallback(callback)
|
|
221
259
|
setCallback(null)
|
|
222
260
|
resetError()
|
|
@@ -232,8 +270,8 @@ export function useConnectorConnection({
|
|
|
232
270
|
|
|
233
271
|
const status = connectionStatus({
|
|
234
272
|
callbackRunId,
|
|
235
|
-
connectionsPending: connectionsQuery.isPending,
|
|
236
|
-
connectionsError: connectionsQuery.error,
|
|
273
|
+
connectionsPending: connectionsQuery.isPending || recoveryPending,
|
|
274
|
+
connectionsError: connectionsQuery.error ?? recoveryError,
|
|
237
275
|
runPending: runQuery.isPending,
|
|
238
276
|
runError: runQuery.error,
|
|
239
277
|
run: resumedRun,
|
|
@@ -247,7 +285,7 @@ export function useConnectorConnection({
|
|
|
247
285
|
revokeMutation.isPending
|
|
248
286
|
const canConnect = connectorCanConnect({
|
|
249
287
|
status,
|
|
250
|
-
connectionsError: connectionsQuery.error,
|
|
288
|
+
connectionsError: connectionsQuery.error ?? recoveryError,
|
|
251
289
|
runError: runQuery.error,
|
|
252
290
|
run: resumedRun,
|
|
253
291
|
connection,
|
|
@@ -265,7 +303,7 @@ export function useConnectorConnection({
|
|
|
265
303
|
mutationFailure("disconnect", disconnectMutation.error) ??
|
|
266
304
|
mutationFailure("revoke", revokeMutation.error) ??
|
|
267
305
|
runFailure(callbackRunId, resumedRun, runQuery.error) ??
|
|
268
|
-
mutationFailure("load", connectionsQuery.error),
|
|
306
|
+
mutationFailure("load", connectionsQuery.error ?? recoveryError),
|
|
269
307
|
canConnect,
|
|
270
308
|
isPending: status === "loading" || status === "authorizing" || mutationPending,
|
|
271
309
|
selectedAccountId: selectMutation.variables?.accountId,
|
|
@@ -291,7 +329,7 @@ export function isConnectorReplacementRequired(error: unknown): boolean {
|
|
|
291
329
|
|
|
292
330
|
function connectorCanConnect(input: {
|
|
293
331
|
readonly status: ConnectorConnectionStatus
|
|
294
|
-
readonly connectionsError:
|
|
332
|
+
readonly connectionsError: unknown
|
|
295
333
|
readonly runError: Error | null
|
|
296
334
|
readonly run: ConnectorConnectionRun | undefined
|
|
297
335
|
readonly connection: ConnectorConnection | undefined
|
|
@@ -308,7 +346,7 @@ function connectorCanConnect(input: {
|
|
|
308
346
|
function connectionStatus(input: {
|
|
309
347
|
readonly callbackRunId: string | null
|
|
310
348
|
readonly connectionsPending: boolean
|
|
311
|
-
readonly connectionsError:
|
|
349
|
+
readonly connectionsError: unknown
|
|
312
350
|
readonly runPending: boolean
|
|
313
351
|
readonly runError: Error | null
|
|
314
352
|
readonly run: ConnectorConnectionRun | undefined
|
|
@@ -9,6 +9,7 @@ import { useSixbProviderClient } from "../client-provider"
|
|
|
9
9
|
import {
|
|
10
10
|
getConnectorConnectionRunQueryKey,
|
|
11
11
|
listConnectorConnectionsQueryKey,
|
|
12
|
+
listPendingConnectorConnectionRunsQueryKey,
|
|
12
13
|
} from "../generated/@tanstack/react-query.gen"
|
|
13
14
|
import type { Client } from "../generated/client"
|
|
14
15
|
import {
|
|
@@ -201,7 +202,7 @@ export function selectConnectorAccountMutationOptions<TContext = unknown>(
|
|
|
201
202
|
onSuccess: async (run, variables, context, mutation) => {
|
|
202
203
|
const resolvedPath = path()
|
|
203
204
|
queryClient?.setQueryData(getConnectorConnectionRunQueryKey({ path: resolvedPath }), run)
|
|
204
|
-
await invalidateConnectorConnections(queryClient, resolvedPath.connectorId)
|
|
205
|
+
await invalidateConnectorConnections(queryClient, resolvedPath.connectorId, client)
|
|
205
206
|
await onSuccess?.(run, variables, context, mutation)
|
|
206
207
|
},
|
|
207
208
|
}
|
|
@@ -263,7 +264,7 @@ export function disconnectConnectorMutationOptions<TContext = unknown>(
|
|
|
263
264
|
return data
|
|
264
265
|
},
|
|
265
266
|
onSuccess: async (result, variables, context, mutation) => {
|
|
266
|
-
await invalidateConnectorConnections(queryClient, normalizedConnectorId)
|
|
267
|
+
await invalidateConnectorConnections(queryClient, normalizedConnectorId, client)
|
|
267
268
|
await onSuccess?.(result, variables, context, mutation)
|
|
268
269
|
},
|
|
269
270
|
}
|
|
@@ -310,7 +311,7 @@ export function revokeConnectorMutationOptions<TContext = unknown>(
|
|
|
310
311
|
return data
|
|
311
312
|
},
|
|
312
313
|
onSuccess: async (result, variables, context, mutation) => {
|
|
313
|
-
await invalidateConnectorConnections(queryClient, normalizedConnectorId)
|
|
314
|
+
await invalidateConnectorConnections(queryClient, normalizedConnectorId, client)
|
|
314
315
|
await onSuccess?.(result, variables, context, mutation)
|
|
315
316
|
},
|
|
316
317
|
}
|
|
@@ -408,9 +409,13 @@ function resolveReturnTo(value: string): string {
|
|
|
408
409
|
|
|
409
410
|
async function invalidateConnectorConnections(
|
|
410
411
|
queryClient: QueryClient | undefined,
|
|
411
|
-
connectorId: string
|
|
412
|
+
connectorId: string,
|
|
413
|
+
client: Client | undefined
|
|
412
414
|
): Promise<void> {
|
|
413
415
|
if (!queryClient) return
|
|
416
|
+
await queryClient.invalidateQueries({
|
|
417
|
+
queryKey: listPendingConnectorConnectionRunsQueryKey({ client, path: { connectorId } }),
|
|
418
|
+
})
|
|
414
419
|
await queryClient.invalidateQueries({
|
|
415
420
|
queryKey: listConnectorConnectionsQueryKey({ path: { connectorId } }),
|
|
416
421
|
})
|
package/src/file.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileRef } from "@sixb/core"
|
|
1
|
+
import type { AuthSessionAudience, FileRef } from "@sixb/core"
|
|
2
2
|
import { DEFAULT_SIMPLE_FILE_UPLOAD_BYTES } from "@sixb/core/blob-storage"
|
|
3
3
|
import { isSixbApiError, type SixbClient } from "./api"
|
|
4
4
|
import { client as sharedClient } from "./generated/client.gen"
|
|
@@ -18,6 +18,8 @@ export interface ObjectFileContentUrlInput {
|
|
|
18
18
|
/** Property path segments, without the leading `properties` segment. */
|
|
19
19
|
readonly pathSegments: readonly string[]
|
|
20
20
|
readonly fileRef: FileRef
|
|
21
|
+
/** Session audience for browser file navigation, e.g. "app" in split-domain deployments. */
|
|
22
|
+
readonly audience?: AuthSessionAudience
|
|
21
23
|
readonly disposition?: "inline" | "attachment"
|
|
22
24
|
readonly client?: SixbClient
|
|
23
25
|
}
|
|
@@ -38,6 +40,7 @@ export function objectFileContentUrl(input: ObjectFileContentUrlInput): string {
|
|
|
38
40
|
.map((segment) => segment.replaceAll("~", "~0").replaceAll("/", "~1"))
|
|
39
41
|
.join("/")}`,
|
|
40
42
|
disposition: input.disposition,
|
|
43
|
+
audience: input.audience,
|
|
41
44
|
// Opaque cache key, not a historical-file selector. Include per-reference metadata.
|
|
42
45
|
// Encode each field so Elysia won't interpret commas in filenames as an array.
|
|
43
46
|
v: [digest, fileName ?? "", mediaType ?? "", logicalPath ?? ""]
|
|
@@ -131,7 +134,7 @@ async function uploadFileStaged(file: File | Blob, options: UploadFileOptions):
|
|
|
131
134
|
createFileUpload({ body: uploadBody, client: options.client, ...callOptions(options.signal) })
|
|
132
135
|
)
|
|
133
136
|
|
|
134
|
-
let parts: Array<{ partNumber: number; etag
|
|
137
|
+
let parts: Array<{ partNumber: number; etag?: string }> | undefined
|
|
135
138
|
let completed: Omit<FileRef, "digest"> & { readonly digest: string }
|
|
136
139
|
try {
|
|
137
140
|
if (upload.strategy === "server") {
|
|
@@ -158,6 +161,7 @@ async function uploadFileStaged(file: File | Blob, options: UploadFileOptions):
|
|
|
158
161
|
fetch: options.fetch ?? globalThis.fetch,
|
|
159
162
|
file,
|
|
160
163
|
partSizeBytes: upload.partSizeBytes,
|
|
164
|
+
partReceipt: upload.partReceipt ?? "etag",
|
|
161
165
|
uploadId: upload.uploadId,
|
|
162
166
|
signal: options.signal,
|
|
163
167
|
})
|
|
@@ -220,10 +224,11 @@ async function uploadMultipartFile(input: {
|
|
|
220
224
|
readonly fetch: typeof fetch
|
|
221
225
|
readonly file: File | Blob
|
|
222
226
|
readonly partSizeBytes: number
|
|
227
|
+
readonly partReceipt: "etag" | "none"
|
|
223
228
|
readonly uploadId: string
|
|
224
229
|
readonly signal?: AbortSignal
|
|
225
|
-
}): Promise<Array<{ partNumber: number; etag
|
|
226
|
-
const parts: Array<{ partNumber: number; etag
|
|
230
|
+
}): Promise<Array<{ partNumber: number; etag?: string }>> {
|
|
231
|
+
const parts: Array<{ partNumber: number; etag?: string }> = []
|
|
227
232
|
let partNumber = 1
|
|
228
233
|
|
|
229
234
|
for (let offset = 0; offset < input.file.size; offset += input.partSizeBytes) {
|
|
@@ -255,14 +260,14 @@ async function uploadMultipartFile(input: {
|
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
const etag = response.headers.get("etag")
|
|
258
|
-
if (!etag) {
|
|
263
|
+
if (input.partReceipt === "etag" && !etag) {
|
|
259
264
|
throw new SixbFileUploadError(
|
|
260
265
|
`[SixbClient] Multipart file upload part ${partNumber} did not return an ETag.`,
|
|
261
266
|
{ stage: "multipart" }
|
|
262
267
|
)
|
|
263
268
|
}
|
|
264
269
|
|
|
265
|
-
parts.push({ partNumber, etag })
|
|
270
|
+
parts.push(input.partReceipt === "etag" && etag ? { partNumber, etag } : { partNumber })
|
|
266
271
|
partNumber += 1
|
|
267
272
|
}
|
|
268
273
|
|
|
@@ -97,6 +97,7 @@ import {
|
|
|
97
97
|
listModels,
|
|
98
98
|
listObjects,
|
|
99
99
|
listObjectTypes,
|
|
100
|
+
listPendingConnectorConnectionRuns,
|
|
100
101
|
listPipelineRuns,
|
|
101
102
|
listPipelines,
|
|
102
103
|
listProjectionRuns,
|
|
@@ -398,6 +399,9 @@ import type {
|
|
|
398
399
|
ListObjectsResponse,
|
|
399
400
|
ListObjectTypesData,
|
|
400
401
|
ListObjectTypesResponse,
|
|
402
|
+
ListPendingConnectorConnectionRunsData,
|
|
403
|
+
ListPendingConnectorConnectionRunsError,
|
|
404
|
+
ListPendingConnectorConnectionRunsResponse,
|
|
401
405
|
ListPipelineRunsData,
|
|
402
406
|
ListPipelineRunsError,
|
|
403
407
|
ListPipelineRunsResponse,
|
|
@@ -1867,6 +1871,34 @@ export const revokeConnectorConnectionMutation = (
|
|
|
1867
1871
|
return mutationOptions
|
|
1868
1872
|
}
|
|
1869
1873
|
|
|
1874
|
+
export const listPendingConnectorConnectionRunsQueryKey = (
|
|
1875
|
+
options: Options<ListPendingConnectorConnectionRunsData>
|
|
1876
|
+
) => createQueryKey("listPendingConnectorConnectionRuns", options)
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* List the initiating user's pending connector connection runs
|
|
1880
|
+
*/
|
|
1881
|
+
export const listPendingConnectorConnectionRunsOptions = (
|
|
1882
|
+
options: Options<ListPendingConnectorConnectionRunsData>
|
|
1883
|
+
) =>
|
|
1884
|
+
queryOptions<
|
|
1885
|
+
ListPendingConnectorConnectionRunsResponse,
|
|
1886
|
+
ListPendingConnectorConnectionRunsError,
|
|
1887
|
+
ListPendingConnectorConnectionRunsResponse,
|
|
1888
|
+
ReturnType<typeof listPendingConnectorConnectionRunsQueryKey>
|
|
1889
|
+
>({
|
|
1890
|
+
queryFn: async ({ queryKey, signal }) => {
|
|
1891
|
+
const { data } = await listPendingConnectorConnectionRuns({
|
|
1892
|
+
...options,
|
|
1893
|
+
...queryKey[0],
|
|
1894
|
+
signal,
|
|
1895
|
+
throwOnError: true,
|
|
1896
|
+
})
|
|
1897
|
+
return data
|
|
1898
|
+
},
|
|
1899
|
+
queryKey: listPendingConnectorConnectionRunsQueryKey(options),
|
|
1900
|
+
})
|
|
1901
|
+
|
|
1870
1902
|
/**
|
|
1871
1903
|
* Start a connector connection run
|
|
1872
1904
|
*/
|
package/src/generated/index.ts
CHANGED
|
@@ -93,6 +93,7 @@ export {
|
|
|
93
93
|
listModels,
|
|
94
94
|
listObjects,
|
|
95
95
|
listObjectTypes,
|
|
96
|
+
listPendingConnectorConnectionRuns,
|
|
96
97
|
listPipelineRuns,
|
|
97
98
|
listPipelines,
|
|
98
99
|
listProjectionRuns,
|
|
@@ -582,6 +583,11 @@ export type {
|
|
|
582
583
|
ListObjectTypesData,
|
|
583
584
|
ListObjectTypesResponse,
|
|
584
585
|
ListObjectTypesResponses,
|
|
586
|
+
ListPendingConnectorConnectionRunsData,
|
|
587
|
+
ListPendingConnectorConnectionRunsError,
|
|
588
|
+
ListPendingConnectorConnectionRunsErrors,
|
|
589
|
+
ListPendingConnectorConnectionRunsResponse,
|
|
590
|
+
ListPendingConnectorConnectionRunsResponses,
|
|
585
591
|
ListPipelineRunsData,
|
|
586
592
|
ListPipelineRunsError,
|
|
587
593
|
ListPipelineRunsErrors,
|
package/src/generated/sdk.gen.ts
CHANGED
|
@@ -276,6 +276,9 @@ import type {
|
|
|
276
276
|
ListObjectsResponses,
|
|
277
277
|
ListObjectTypesData,
|
|
278
278
|
ListObjectTypesResponses,
|
|
279
|
+
ListPendingConnectorConnectionRunsData,
|
|
280
|
+
ListPendingConnectorConnectionRunsErrors,
|
|
281
|
+
ListPendingConnectorConnectionRunsResponses,
|
|
279
282
|
ListPipelineRunsData,
|
|
280
283
|
ListPipelineRunsErrors,
|
|
281
284
|
ListPipelineRunsResponses,
|
|
@@ -1090,6 +1093,18 @@ export const revokeConnectorConnection = <ThrowOnError extends boolean = false>(
|
|
|
1090
1093
|
...options,
|
|
1091
1094
|
})
|
|
1092
1095
|
|
|
1096
|
+
/**
|
|
1097
|
+
* List the initiating user's pending connector connection runs
|
|
1098
|
+
*/
|
|
1099
|
+
export const listPendingConnectorConnectionRuns = <ThrowOnError extends boolean = false>(
|
|
1100
|
+
options: Options<ListPendingConnectorConnectionRunsData, ThrowOnError>
|
|
1101
|
+
) =>
|
|
1102
|
+
(options.client ?? client).get<
|
|
1103
|
+
ListPendingConnectorConnectionRunsResponses,
|
|
1104
|
+
ListPendingConnectorConnectionRunsErrors,
|
|
1105
|
+
ThrowOnError
|
|
1106
|
+
>({ url: "/api/connectors/{connectorId}/connection-runs", ...options })
|
|
1107
|
+
|
|
1093
1108
|
/**
|
|
1094
1109
|
* Start a connector connection run
|
|
1095
1110
|
*/
|