@sixb/client 0.1.8 → 0.1.10
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/browser.js +47 -47
- package/dist/browser.js.map +2 -2
- package/dist/{chunk-n4160ht2.js → chunk-62nthgkf.js} +169 -169
- package/dist/{chunk-n4160ht2.js.map → chunk-62nthgkf.js.map} +2 -2
- package/dist/{chunk-0g4bg41z.js → chunk-6pmyt76w.js} +86 -86
- package/dist/{chunk-0g4bg41z.js.map → chunk-6pmyt76w.js.map} +2 -2
- package/dist/{chunk-se1tydhh.js → chunk-cs98dfbc.js} +20 -20
- package/dist/{chunk-se1tydhh.js.map → chunk-cs98dfbc.js.map} +2 -2
- package/dist/{chunk-cmfd585n.js → chunk-d0m9gz29.js} +6 -6
- package/dist/{chunk-cmfd585n.js.map → chunk-d0m9gz29.js.map} +2 -2
- package/dist/{chunk-x6pk2xhn.js → chunk-dp68jpeq.js} +19 -19
- package/dist/{chunk-x6pk2xhn.js.map → chunk-dp68jpeq.js.map} +2 -2
- package/dist/{chunk-v8q8185t.js → chunk-rvaq39w5.js} +34 -34
- package/dist/{chunk-v8q8185t.js.map → chunk-rvaq39w5.js.map} +2 -2
- package/dist/{chunk-mpgzkmwc.js → chunk-tyym13kq.js} +10 -10
- package/dist/{chunk-mpgzkmwc.js.map → chunk-tyym13kq.js.map} +2 -2
- package/dist/connectors/queries.d.ts +8 -0
- package/dist/connectors/queries.d.ts.map +1 -1
- package/dist/generated/@tanstack/react-query.gen.d.ts +911 -9
- package/dist/generated/@tanstack/react-query.gen.d.ts.map +1 -1
- package/dist/generated/types.gen.d.ts +163 -0
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/hooks.js +693 -693
- package/dist/hooks.js.map +2 -2
- package/dist/index.js +373 -373
- package/dist/index.js.map +1 -1
- package/dist/logs.js +18 -18
- package/dist/logs.js.map +1 -1
- package/dist/models.js +292 -292
- package/dist/models.js.map +1 -1
- package/dist/query.js +11 -11
- package/dist/query.js.map +1 -1
- package/package.json +3 -3
- package/src/generated/types.gen.ts +172 -0
- /package/dist/{chunk-trpg18dp.js → chunk-0ka9ykez.js} +0 -0
- /package/dist/{chunk-trpg18dp.js.map → chunk-0ka9ykez.js.map} +0 -0
- /package/dist/{chunk-3gvmb0w6.js → chunk-65zz479s.js} +0 -0
- /package/dist/{chunk-3gvmb0w6.js.map → chunk-65zz479s.js.map} +0 -0
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-
|
|
3
|
+
SHARED_ACCESS_REALTIME_UNAVAILABLE,
|
|
4
|
+
hasClientSharedAuthority
|
|
5
|
+
} from "./chunk-65zz479s.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
client2,
|
|
8
|
+
requestAction2,
|
|
9
|
+
uploadFileRaw2,
|
|
10
|
+
createFileUpload2,
|
|
11
|
+
uploadFileContent2,
|
|
12
|
+
signFileUploadPart2,
|
|
13
|
+
completeFileUpload2,
|
|
14
|
+
abortFileUpload2,
|
|
15
|
+
getActionRun2
|
|
16
|
+
} from "./chunk-62nthgkf.js";
|
|
10
17
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
encodeObjectId2,
|
|
19
|
+
decodeObjectId2
|
|
20
|
+
} from "./chunk-tyym13kq.js";
|
|
13
21
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "./chunk-3gvmb0w6.js";
|
|
22
|
+
isSixbApiError2
|
|
23
|
+
} from "./chunk-rvaq39w5.js";
|
|
17
24
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
createFileUpload,
|
|
22
|
-
getActionRun,
|
|
23
|
-
requestAction,
|
|
24
|
-
signFileUploadPart,
|
|
25
|
-
uploadFileContent,
|
|
26
|
-
uploadFileRaw
|
|
27
|
-
} from "./chunk-n4160ht2.js";
|
|
25
|
+
createReconnectingSocket,
|
|
26
|
+
createSixbWebSocketUrl
|
|
27
|
+
} from "./chunk-d0m9gz29.js";
|
|
28
28
|
|
|
29
29
|
// src/agent-streams.ts
|
|
30
30
|
import { isAgentRunActivityEvent, isAgentRunStreamEvent } from "@sixb/core/agents/streams";
|
|
31
|
-
function
|
|
31
|
+
function createSixbAgentsWebSocketUrl2(baseUrl) {
|
|
32
32
|
return createSixbWebSocketUrl("/ws/agents", baseUrl);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function createAgentRunSocket2(options) {
|
|
35
35
|
let latestCursor = options.afterCursor;
|
|
36
36
|
return createReconnectingSocket({
|
|
37
|
-
url:
|
|
37
|
+
url: createSixbAgentsWebSocketUrl2(options.baseUrl),
|
|
38
38
|
reconnect: options.reconnect,
|
|
39
39
|
reconnectDelayMs: options.reconnectDelayMs,
|
|
40
40
|
connectionErrorMessage: "Agent stream websocket connection failed.",
|
|
@@ -46,7 +46,7 @@ function createAgentRunSocket(options) {
|
|
|
46
46
|
...latestCursor ? { afterCursor: latestCursor } : {}
|
|
47
47
|
}),
|
|
48
48
|
onMessage: (data, sink) => {
|
|
49
|
-
const message =
|
|
49
|
+
const message = parseAgentRunStreamServerMessage2(data);
|
|
50
50
|
if (!message)
|
|
51
51
|
return;
|
|
52
52
|
if (message.type === "record") {
|
|
@@ -64,9 +64,9 @@ function createAgentRunSocket(options) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function createAgentActivitySocket2(options) {
|
|
68
68
|
return createReconnectingSocket({
|
|
69
|
-
url:
|
|
69
|
+
url: createSixbAgentsWebSocketUrl2(options.baseUrl),
|
|
70
70
|
reconnect: options.reconnect,
|
|
71
71
|
reconnectDelayMs: options.reconnectDelayMs,
|
|
72
72
|
connectionErrorMessage: "Agent activity websocket connection failed.",
|
|
@@ -74,7 +74,7 @@ function createAgentActivitySocket(options) {
|
|
|
74
74
|
onStateChange: options.onStateChange,
|
|
75
75
|
subscribeMessage: () => ({ type: "subscribe.activity" }),
|
|
76
76
|
onMessage: (data, sink) => {
|
|
77
|
-
const message =
|
|
77
|
+
const message = parseAgentRunStreamServerMessage2(data);
|
|
78
78
|
if (!message)
|
|
79
79
|
return;
|
|
80
80
|
if (message.type === "activity") {
|
|
@@ -90,7 +90,7 @@ function createAgentActivitySocket(options) {
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function parseAgentRunStreamServerMessage2(value) {
|
|
94
94
|
if (typeof value !== "string") {
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
@@ -170,7 +170,7 @@ function isRecord(value) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// src/events-model.ts
|
|
173
|
-
function
|
|
173
|
+
function isSixbEvent2(value) {
|
|
174
174
|
return isRecord2(value) && typeof value.id === "string" && typeof value.cursor === "string" && typeof value.projectId === "string" && typeof value.occurredAt === "string" && typeof value.type === "string" && typeof value.topic === "string" && typeof value.partitionKey === "string";
|
|
175
175
|
}
|
|
176
176
|
function isRecord2(value) {
|
|
@@ -178,7 +178,7 @@ function isRecord2(value) {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
// src/events-transport.ts
|
|
181
|
-
function
|
|
181
|
+
function createEventSocket2(options) {
|
|
182
182
|
const { topic, types, objectTypeId, primaryId, actionId, runId, limit } = options;
|
|
183
183
|
let latestCursor = options.afterCursor;
|
|
184
184
|
let transportState = {
|
|
@@ -194,7 +194,7 @@ function createEventSocket(options) {
|
|
|
194
194
|
});
|
|
195
195
|
};
|
|
196
196
|
return createReconnectingSocket({
|
|
197
|
-
url:
|
|
197
|
+
url: createSixbEventsWebSocketUrl2(options.baseUrl),
|
|
198
198
|
reconnect: options.reconnect,
|
|
199
199
|
reconnectDelayMs: options.reconnectDelayMs,
|
|
200
200
|
readyTimeoutMs: options.handshakeTimeoutMs,
|
|
@@ -218,15 +218,15 @@ function createEventSocket(options) {
|
|
|
218
218
|
...latestCursor ? { afterCursor: latestCursor } : {},
|
|
219
219
|
...limit ? { limit } : {}
|
|
220
220
|
}),
|
|
221
|
-
subscribeWhen: (data) =>
|
|
222
|
-
readyWhen: (data) =>
|
|
221
|
+
subscribeWhen: (data) => parseEventStreamMessage2(data)?.type === "connected",
|
|
222
|
+
readyWhen: (data) => parseEventStreamMessage2(data)?.type === "subscribed",
|
|
223
223
|
onMessage: (data, sink) => {
|
|
224
|
-
const message =
|
|
224
|
+
const message = parseEventStreamMessage2(data);
|
|
225
225
|
if (!message)
|
|
226
226
|
return;
|
|
227
227
|
if (message.type === "event") {
|
|
228
228
|
latestCursor = message.event.cursor;
|
|
229
|
-
if (
|
|
229
|
+
if (matchesSubscription2(message.event, topic, types)) {
|
|
230
230
|
options.onEvent(message.event);
|
|
231
231
|
}
|
|
232
232
|
return;
|
|
@@ -242,10 +242,10 @@ function createEventSocket(options) {
|
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function createSixbEventsWebSocketUrl2(baseUrl) {
|
|
246
246
|
return createSixbWebSocketUrl("/ws/events", baseUrl);
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function parseEventStreamMessage2(value) {
|
|
249
249
|
if (typeof value !== "string") {
|
|
250
250
|
return null;
|
|
251
251
|
}
|
|
@@ -258,7 +258,7 @@ function parseEventStreamMessage(value) {
|
|
|
258
258
|
if (!isRecord3(parsed) || typeof parsed.type !== "string") {
|
|
259
259
|
return null;
|
|
260
260
|
}
|
|
261
|
-
if (parsed.type === "event" &&
|
|
261
|
+
if (parsed.type === "event" && isSixbEvent2(parsed.event)) {
|
|
262
262
|
return { type: "event", event: parsed.event };
|
|
263
263
|
}
|
|
264
264
|
if (parsed.type === "error") {
|
|
@@ -269,7 +269,7 @@ function parseEventStreamMessage(value) {
|
|
|
269
269
|
}
|
|
270
270
|
return null;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function matchesSubscription2(event, topic, types) {
|
|
273
273
|
if (topic && event.topic !== topic) {
|
|
274
274
|
return false;
|
|
275
275
|
}
|
|
@@ -288,8 +288,8 @@ import {
|
|
|
288
288
|
eventSelectorSpec,
|
|
289
289
|
events as selectEvents
|
|
290
290
|
} from "@sixb/core/events/selectors";
|
|
291
|
-
function
|
|
292
|
-
const transportClient = options?.client ??
|
|
291
|
+
function createWsSubscribeExecutor2(options) {
|
|
292
|
+
const transportClient = options?.client ?? client2;
|
|
293
293
|
const baseUrl = transportClient.getConfig().baseUrl;
|
|
294
294
|
if (hasClientSharedAuthority(transportClient)) {
|
|
295
295
|
return {
|
|
@@ -308,8 +308,8 @@ function createWsSubscribeExecutor(options) {
|
|
|
308
308
|
}
|
|
309
309
|
return {
|
|
310
310
|
subscribe(filter, handler, subscribeOptions) {
|
|
311
|
-
const matches =
|
|
312
|
-
const socket =
|
|
311
|
+
const matches = buildEventPredicate2(filter);
|
|
312
|
+
const socket = createEventSocket2({
|
|
313
313
|
topic: filter.topic,
|
|
314
314
|
types: filter.types,
|
|
315
315
|
objectTypeId: filter.objectTypeId,
|
|
@@ -333,7 +333,7 @@ function createWsSubscribeExecutor(options) {
|
|
|
333
333
|
}
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function buildEventPredicate2(filter) {
|
|
337
337
|
const matches = buildEventSelectorPredicate(filter);
|
|
338
338
|
return (event) => matches(event);
|
|
339
339
|
}
|
|
@@ -492,7 +492,7 @@ class EventsBuilderImpl {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
function createBuilder(filter, options, params = {}) {
|
|
495
|
-
return new EventsBuilderImpl({ filter, executor:
|
|
495
|
+
return new EventsBuilderImpl({ filter, executor: createWsSubscribeExecutor2(options), ...params });
|
|
496
496
|
}
|
|
497
497
|
function createPropertySelectorMap(tokens, createSelector) {
|
|
498
498
|
return Object.fromEntries(Object.entries(tokens).map(([propertyId, token]) => [propertyId, createSelector(token)]));
|
|
@@ -555,10 +555,10 @@ eventsApi.datasets = (options) => topicBuilder("datasets", options);
|
|
|
555
555
|
eventsApi.workflows = (options) => runBuilder("workflows", options);
|
|
556
556
|
eventsApi.pipelines = (options) => runBuilder("pipelines", options);
|
|
557
557
|
eventsApi.syncs = (options) => runBuilder("syncs", options);
|
|
558
|
-
var
|
|
558
|
+
var events2 = eventsApi;
|
|
559
559
|
|
|
560
560
|
// src/telemetry-events.ts
|
|
561
|
-
function
|
|
561
|
+
function telemetryUpdateFromEvent2(event) {
|
|
562
562
|
return {
|
|
563
563
|
type: "telemetryUpdate",
|
|
564
564
|
projectId: event.projectId,
|
|
@@ -572,13 +572,13 @@ function telemetryUpdateFromEvent(event) {
|
|
|
572
572
|
unit: event.payload.unit
|
|
573
573
|
};
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
const parsed =
|
|
575
|
+
function objectIdAliases2(objectId) {
|
|
576
|
+
const parsed = decodeObjectId2(objectId);
|
|
577
577
|
if (!parsed)
|
|
578
578
|
return [objectId];
|
|
579
|
-
return [objectId, parsed.primaryId,
|
|
579
|
+
return [objectId, parsed.primaryId, encodeObjectId2(parsed.objectTypeId, parsed.primaryId)];
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function telemetryUpdateKey2(projectId, objectId, propertyId) {
|
|
582
582
|
return `${projectId}:${objectId}:${propertyId}`;
|
|
583
583
|
}
|
|
584
584
|
function normalizeTelemetryValue(value) {
|
|
@@ -599,7 +599,7 @@ var DEFAULT_ACTION_WAIT_TIMEOUT_MS = 60000;
|
|
|
599
599
|
var DEFAULT_ACTION_WAIT_FALLBACK_POLL_MS = 1e4;
|
|
600
600
|
var DEFAULT_ACTION_WAIT_DISCONNECTED_POLL_MS = 1000;
|
|
601
601
|
|
|
602
|
-
class
|
|
602
|
+
class ActionRunFailedError2 extends Error {
|
|
603
603
|
name = "ActionRunFailedError";
|
|
604
604
|
run;
|
|
605
605
|
runId;
|
|
@@ -618,7 +618,7 @@ class ActionRunFailedError extends Error {
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
class
|
|
621
|
+
class ActionRunTimeoutError2 extends Error {
|
|
622
622
|
name = "ActionRunTimeoutError";
|
|
623
623
|
runId;
|
|
624
624
|
timeoutMs;
|
|
@@ -628,7 +628,7 @@ class ActionRunTimeoutError extends Error {
|
|
|
628
628
|
this.timeoutMs = params.timeoutMs;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
async function
|
|
631
|
+
async function requestActionAndWait2(input) {
|
|
632
632
|
const {
|
|
633
633
|
timeoutMs,
|
|
634
634
|
fallbackPollIntervalMs,
|
|
@@ -637,12 +637,12 @@ async function requestActionAndWait(input) {
|
|
|
637
637
|
onRequested,
|
|
638
638
|
...requestOptions
|
|
639
639
|
} = input;
|
|
640
|
-
const response = await
|
|
640
|
+
const response = await requestAction2({
|
|
641
641
|
...requestOptions,
|
|
642
642
|
throwOnError: true
|
|
643
643
|
});
|
|
644
644
|
await onRequested?.(response.data);
|
|
645
|
-
return
|
|
645
|
+
return waitForActionRun2({
|
|
646
646
|
runId: response.data.runId,
|
|
647
647
|
client: input.client,
|
|
648
648
|
signal: input.signal,
|
|
@@ -652,7 +652,7 @@ async function requestActionAndWait(input) {
|
|
|
652
652
|
rejectOnTerminalFailure
|
|
653
653
|
});
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function waitForActionRun2(input) {
|
|
656
656
|
const timeoutMs = input.timeoutMs ?? DEFAULT_ACTION_WAIT_TIMEOUT_MS;
|
|
657
657
|
const fallbackPollIntervalMs = input.fallbackPollIntervalMs ?? DEFAULT_ACTION_WAIT_FALLBACK_POLL_MS;
|
|
658
658
|
const disconnectedPollIntervalMs = input.disconnectedPollIntervalMs ?? DEFAULT_ACTION_WAIT_DISCONNECTED_POLL_MS;
|
|
@@ -690,7 +690,7 @@ function waitForActionRun(input) {
|
|
|
690
690
|
const resolveWith = (run) => {
|
|
691
691
|
cleanup();
|
|
692
692
|
if (rejectOnTerminalFailure && isTerminalFailureRun(run)) {
|
|
693
|
-
reject(new
|
|
693
|
+
reject(new ActionRunFailedError2(run));
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
696
|
resolve(run);
|
|
@@ -729,7 +729,7 @@ function waitForActionRun(input) {
|
|
|
729
729
|
client: input.client,
|
|
730
730
|
signal
|
|
731
731
|
});
|
|
732
|
-
if (run &&
|
|
732
|
+
if (run && isTerminalActionRun2(run)) {
|
|
733
733
|
resolveWith(run);
|
|
734
734
|
return;
|
|
735
735
|
}
|
|
@@ -748,10 +748,10 @@ function waitForActionRun(input) {
|
|
|
748
748
|
rejectWith(signal?.reason ?? new Error("aborted"));
|
|
749
749
|
};
|
|
750
750
|
timeoutTimer = setTimeout(() => {
|
|
751
|
-
rejectWith(new
|
|
751
|
+
rejectWith(new ActionRunTimeoutError2({ runId: input.runId, timeoutMs }));
|
|
752
752
|
}, Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
753
753
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
754
|
-
unsubscribeFromTerminalEvents =
|
|
754
|
+
unsubscribeFromTerminalEvents = events2.actions({ client: input.client }).run(input.runId).terminal().subscribe(() => {
|
|
755
755
|
wakeAndCheck();
|
|
756
756
|
}, {
|
|
757
757
|
onError: () => {
|
|
@@ -772,14 +772,14 @@ function waitForActionRun(input) {
|
|
|
772
772
|
check();
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function isTerminalActionRun2(run) {
|
|
776
776
|
return run.status === "succeeded" || isTerminalFailureRun(run);
|
|
777
777
|
}
|
|
778
778
|
function isTerminalFailureRun(run) {
|
|
779
779
|
return run.status === "failed" || run.status === "cancelled";
|
|
780
780
|
}
|
|
781
781
|
async function fetchActionRun(runId, options) {
|
|
782
|
-
const result = await
|
|
782
|
+
const result = await getActionRun2({
|
|
783
783
|
client: options.client,
|
|
784
784
|
path: { runId },
|
|
785
785
|
signal: options.signal,
|
|
@@ -994,14 +994,14 @@ async function computeStreamingBlobDigest(file, chunkBytes = 8 * 1024 * 1024) {
|
|
|
994
994
|
}
|
|
995
995
|
|
|
996
996
|
// src/file.ts
|
|
997
|
-
function
|
|
997
|
+
function objectFileContentUrl2(input) {
|
|
998
998
|
if (!input.objectTypeId || !input.objectId || input.pathSegments.length === 0) {
|
|
999
999
|
throw new Error("[SixbClient] File content URLs require an object type, ID, and property path.");
|
|
1000
1000
|
}
|
|
1001
|
-
const
|
|
1001
|
+
const client = input.client ?? client2;
|
|
1002
1002
|
const { digest, fileName, mediaType, logicalPath } = input.fileRef;
|
|
1003
|
-
return
|
|
1004
|
-
baseUrl:
|
|
1003
|
+
return client.buildUrl({
|
|
1004
|
+
baseUrl: client.getConfig().baseUrl,
|
|
1005
1005
|
url: "/api/objects/{objectTypeId}/{objectId}/files/content",
|
|
1006
1006
|
path: { objectTypeId: input.objectTypeId, objectId: input.objectId },
|
|
1007
1007
|
query: {
|
|
@@ -1012,7 +1012,7 @@ function objectFileContentUrl(input) {
|
|
|
1012
1012
|
});
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
|
-
class
|
|
1015
|
+
class SixbFileUploadError2 extends Error {
|
|
1016
1016
|
stage;
|
|
1017
1017
|
status;
|
|
1018
1018
|
aborted;
|
|
@@ -1024,7 +1024,7 @@ class SixbFileUploadError extends Error {
|
|
|
1024
1024
|
this.aborted = options.aborted ?? false;
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
async function
|
|
1027
|
+
async function uploadFile2(file, options = {}) {
|
|
1028
1028
|
const thresholdBytes = options.stagedUploadThresholdBytes ?? DEFAULT_SIMPLE_FILE_UPLOAD_BYTES;
|
|
1029
1029
|
if (file.size > thresholdBytes) {
|
|
1030
1030
|
return uploadFileStaged(file, options);
|
|
@@ -1036,7 +1036,7 @@ async function uploadFileSimple(file, options) {
|
|
|
1036
1036
|
file: resolveUploadFile(file, options.fileName),
|
|
1037
1037
|
...options.logicalPath === undefined ? {} : { logicalPath: options.logicalPath }
|
|
1038
1038
|
};
|
|
1039
|
-
const data = await runUploadStep("server-put", () =>
|
|
1039
|
+
const data = await runUploadStep("server-put", () => uploadFileRaw2({ body, client: options.client, ...callOptions(options.signal) }));
|
|
1040
1040
|
return toFileRef(data, "server-put");
|
|
1041
1041
|
}
|
|
1042
1042
|
async function uploadFileStaged(file, options) {
|
|
@@ -1048,12 +1048,12 @@ async function uploadFileStaged(file, options) {
|
|
|
1048
1048
|
digest,
|
|
1049
1049
|
...options.logicalPath === undefined ? {} : { logicalPath: options.logicalPath }
|
|
1050
1050
|
};
|
|
1051
|
-
const upload = await runUploadStep("create", () =>
|
|
1051
|
+
const upload = await runUploadStep("create", () => createFileUpload2({ body: uploadBody, client: options.client, ...callOptions(options.signal) }));
|
|
1052
1052
|
let parts;
|
|
1053
1053
|
let completed;
|
|
1054
1054
|
try {
|
|
1055
1055
|
if (upload.strategy === "server") {
|
|
1056
|
-
await runUploadStep("server-put", () =>
|
|
1056
|
+
await runUploadStep("server-put", () => uploadFileContent2({
|
|
1057
1057
|
body: resolveUploadFile(file, options.fileName),
|
|
1058
1058
|
path: { uploadId: upload.uploadId },
|
|
1059
1059
|
client: options.client,
|
|
@@ -1078,14 +1078,14 @@ async function uploadFileStaged(file, options) {
|
|
|
1078
1078
|
signal: options.signal
|
|
1079
1079
|
});
|
|
1080
1080
|
}
|
|
1081
|
-
completed = await runUploadStep("complete", () =>
|
|
1081
|
+
completed = await runUploadStep("complete", () => completeFileUpload2({
|
|
1082
1082
|
body: { digest, sizeBytes: file.size, ...parts === undefined ? {} : { parts } },
|
|
1083
1083
|
path: { uploadId: upload.uploadId },
|
|
1084
1084
|
client: options.client,
|
|
1085
1085
|
...callOptions(options.signal)
|
|
1086
1086
|
}));
|
|
1087
1087
|
} catch (error) {
|
|
1088
|
-
await
|
|
1088
|
+
await abortFileUpload2({
|
|
1089
1089
|
path: { uploadId: upload.uploadId },
|
|
1090
1090
|
client: options.client,
|
|
1091
1091
|
responseStyle: "fields",
|
|
@@ -1110,14 +1110,14 @@ async function putDirectUpload(input) {
|
|
|
1110
1110
|
throw toSixbFileUploadError(error, "direct-put");
|
|
1111
1111
|
}
|
|
1112
1112
|
if (!response.ok) {
|
|
1113
|
-
throw new
|
|
1113
|
+
throw new SixbFileUploadError2(`[SixbClient] Direct file upload failed with HTTP ${response.status}.`, { stage: "direct-put", status: response.status });
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
1116
|
async function uploadMultipartFile(input) {
|
|
1117
1117
|
const parts = [];
|
|
1118
1118
|
let partNumber = 1;
|
|
1119
1119
|
for (let offset = 0;offset < input.file.size; offset += input.partSizeBytes) {
|
|
1120
|
-
const signedPart = await runUploadStep("multipart", () =>
|
|
1120
|
+
const signedPart = await runUploadStep("multipart", () => signFileUploadPart2({
|
|
1121
1121
|
path: { uploadId: input.uploadId, partNumber: partNumber.toString() },
|
|
1122
1122
|
client: input.client,
|
|
1123
1123
|
...callOptions(input.signal)
|
|
@@ -1134,11 +1134,11 @@ async function uploadMultipartFile(input) {
|
|
|
1134
1134
|
throw toSixbFileUploadError(error, "multipart");
|
|
1135
1135
|
}
|
|
1136
1136
|
if (!response.ok) {
|
|
1137
|
-
throw new
|
|
1137
|
+
throw new SixbFileUploadError2(`[SixbClient] Multipart file upload part ${partNumber} failed with HTTP ${response.status}.`, { stage: "multipart", status: response.status });
|
|
1138
1138
|
}
|
|
1139
1139
|
const etag = response.headers.get("etag");
|
|
1140
1140
|
if (!etag) {
|
|
1141
|
-
throw new
|
|
1141
|
+
throw new SixbFileUploadError2(`[SixbClient] Multipart file upload part ${partNumber} did not return an ETag.`, { stage: "multipart" });
|
|
1142
1142
|
}
|
|
1143
1143
|
parts.push({ partNumber, etag });
|
|
1144
1144
|
partNumber += 1;
|
|
@@ -1171,7 +1171,7 @@ async function runUploadStep(stage, call) {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
function toSixbFileUploadError(error, stage, status) {
|
|
1173
1173
|
if (isAbortError(error)) {
|
|
1174
|
-
return new
|
|
1174
|
+
return new SixbFileUploadError2("[SixbClient] File upload was aborted.", {
|
|
1175
1175
|
stage: "abort",
|
|
1176
1176
|
aborted: true,
|
|
1177
1177
|
cause: error
|
|
@@ -1179,9 +1179,9 @@ function toSixbFileUploadError(error, stage, status) {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
const detail = uploadErrorDetail(error);
|
|
1181
1181
|
const message = detail ? `[SixbClient] ${detail}` : "[SixbClient] File upload request failed.";
|
|
1182
|
-
return new
|
|
1182
|
+
return new SixbFileUploadError2(message, {
|
|
1183
1183
|
stage,
|
|
1184
|
-
status: status ?? (
|
|
1184
|
+
status: status ?? (isSixbApiError2(error) ? error.status : undefined),
|
|
1185
1185
|
cause: error
|
|
1186
1186
|
});
|
|
1187
1187
|
}
|
|
@@ -1189,7 +1189,7 @@ function isAbortError(error) {
|
|
|
1189
1189
|
return typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
|
|
1190
1190
|
}
|
|
1191
1191
|
function uploadErrorDetail(error) {
|
|
1192
|
-
const body =
|
|
1192
|
+
const body = isSixbApiError2(error) ? error.body : error;
|
|
1193
1193
|
if (typeof body === "string") {
|
|
1194
1194
|
return body.trim() || undefined;
|
|
1195
1195
|
}
|
|
@@ -1219,7 +1219,7 @@ function resolveUploadFileName(file, fileName) {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
function toFileRef(value, stage) {
|
|
1221
1221
|
if (!value.digest.startsWith("sha256:")) {
|
|
1222
|
-
throw new
|
|
1222
|
+
throw new SixbFileUploadError2("[SixbClient] File upload response did not include a sha256 digest.", { stage });
|
|
1223
1223
|
}
|
|
1224
1224
|
return {
|
|
1225
1225
|
...value,
|
|
@@ -1227,6 +1227,6 @@ function toFileRef(value, stage) {
|
|
|
1227
1227
|
};
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
export {
|
|
1230
|
+
export { createSixbAgentsWebSocketUrl2, createAgentRunSocket2, createAgentActivitySocket2, parseAgentRunStreamServerMessage2, isSixbEvent2, createEventSocket2, createSixbEventsWebSocketUrl2, parseEventStreamMessage2, matchesSubscription2, createWsSubscribeExecutor2, buildEventPredicate2, events2, telemetryUpdateFromEvent2, objectIdAliases2, telemetryUpdateKey2, ActionRunFailedError2, ActionRunTimeoutError2, requestActionAndWait2, waitForActionRun2, isTerminalActionRun2, objectFileContentUrl2, SixbFileUploadError2, uploadFile2 };
|
|
1231
1231
|
|
|
1232
|
-
//# debugId=
|
|
1232
|
+
//# debugId=B5B0F60FD368FE6A64756E2164756E21
|