@eigenpal/sdk 0.20.26 → 0.20.27
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/resources/automations.ts +73 -40
- package/src/resources/files.ts +36 -12
- package/src/telemetry.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @eigenpal/sdk
|
|
2
2
|
|
|
3
|
+
## 0.20.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3267908: Strengthened Python SDK generation security while preserving Python 3.10 compatibility.
|
|
8
|
+
- 736a6c8: TypeScript SDK file uploads and automation operations now return precise response types, improving autocomplete and compile-time checks.
|
|
9
|
+
|
|
3
10
|
## 0.20.21
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -32,8 +32,36 @@ import {
|
|
|
32
32
|
} from '../generated/sdk.gen';
|
|
33
33
|
import type {
|
|
34
34
|
AutomationDetail,
|
|
35
|
+
AutomationsDatasetImportResponse,
|
|
36
|
+
AutomationsDatasetReviewRequestsCreateResponse,
|
|
37
|
+
AutomationsDatasetReviewRequestsGetResponse,
|
|
38
|
+
AutomationsDatasetReviewRequestsListEventsResponse,
|
|
39
|
+
AutomationsDatasetReviewRequestsListItemsResponse,
|
|
40
|
+
AutomationsDatasetReviewRequestsListResponse,
|
|
41
|
+
AutomationsDatasetReviewRequestsUpdateItemResponse,
|
|
42
|
+
AutomationsDatasetReviewRequestsUpdateResponse,
|
|
43
|
+
AutomationsEvaluatorsGetResponse,
|
|
44
|
+
AutomationsEvaluatorsUpdateResponse,
|
|
45
|
+
AutomationsExamplesCreateResponse,
|
|
46
|
+
AutomationsExamplesDeleteResponse,
|
|
47
|
+
AutomationsExamplesGetResponse,
|
|
48
|
+
AutomationsExamplesListResponse,
|
|
49
|
+
AutomationsExamplesRunResponse,
|
|
50
|
+
AutomationsExamplesUpdateResponse,
|
|
51
|
+
AutomationsExperimentsCancelResponse,
|
|
52
|
+
AutomationsExperimentsCreateResponse,
|
|
53
|
+
AutomationsExperimentsGetResponse,
|
|
54
|
+
AutomationsExperimentsListResponse,
|
|
55
|
+
AutomationsGetResponse,
|
|
35
56
|
AutomationsListData,
|
|
36
57
|
AutomationsReviewsHealthData,
|
|
58
|
+
AutomationsReviewsHealthResponse,
|
|
59
|
+
AutomationsSyncResponse,
|
|
60
|
+
AutomationsTriggersGetResponse,
|
|
61
|
+
AutomationsVersionsCreateResponse,
|
|
62
|
+
AutomationsVersionsListResponse,
|
|
63
|
+
AutomationsVersionsPromoteResponse,
|
|
64
|
+
AutomationsVersionsRestoreResponse,
|
|
37
65
|
CreateAutomationVersionRequest,
|
|
38
66
|
DeleteAutomationResponse,
|
|
39
67
|
ListAutomationsResponse,
|
|
@@ -45,7 +73,6 @@ type Dispatch = <T>(
|
|
|
45
73
|
options?: RequestDispatchOptions
|
|
46
74
|
) => Promise<T>;
|
|
47
75
|
type SignalOptions = { signal?: AbortSignal };
|
|
48
|
-
type AnyResponse = any;
|
|
49
76
|
|
|
50
77
|
export type ListAutomationsOptions = NonNullable<AutomationsListData['query']> & SignalOptions;
|
|
51
78
|
|
|
@@ -74,7 +101,7 @@ export class AutomationsResource {
|
|
|
74
101
|
return this.dispatch(() => automationsList({ client: this.client, query, signal }));
|
|
75
102
|
}
|
|
76
103
|
|
|
77
|
-
async get(id: string, options: SignalOptions = {}): Promise<
|
|
104
|
+
async get(id: string, options: SignalOptions = {}): Promise<AutomationsGetResponse> {
|
|
78
105
|
return this.dispatch(() =>
|
|
79
106
|
automationsGet({ client: this.client, path: { id }, signal: options.signal })
|
|
80
107
|
);
|
|
@@ -111,7 +138,10 @@ export class AutomationsResource {
|
|
|
111
138
|
);
|
|
112
139
|
}
|
|
113
140
|
|
|
114
|
-
async versions(
|
|
141
|
+
async versions(
|
|
142
|
+
id: string,
|
|
143
|
+
options: SignalOptions = {}
|
|
144
|
+
): Promise<AutomationsVersionsListResponse> {
|
|
115
145
|
return this.dispatch(() =>
|
|
116
146
|
automationsVersionsList({ client: this.client, path: { id }, signal: options.signal })
|
|
117
147
|
);
|
|
@@ -121,7 +151,7 @@ export class AutomationsResource {
|
|
|
121
151
|
id: string,
|
|
122
152
|
body: CreateAutomationVersionRequest,
|
|
123
153
|
options: SignalOptions = {}
|
|
124
|
-
): Promise<
|
|
154
|
+
): Promise<AutomationsVersionsCreateResponse> {
|
|
125
155
|
return this.dispatch(() =>
|
|
126
156
|
automationsVersionsCreate({
|
|
127
157
|
client: this.client,
|
|
@@ -137,7 +167,7 @@ export class AutomationsResource {
|
|
|
137
167
|
versionId: string,
|
|
138
168
|
body: { message?: string } = {},
|
|
139
169
|
options: SignalOptions = {}
|
|
140
|
-
): Promise<
|
|
170
|
+
): Promise<AutomationsVersionsRestoreResponse> {
|
|
141
171
|
return this.dispatch(() =>
|
|
142
172
|
automationsVersionsRestore({
|
|
143
173
|
client: this.client,
|
|
@@ -152,7 +182,7 @@ export class AutomationsResource {
|
|
|
152
182
|
id: string,
|
|
153
183
|
versionId: string,
|
|
154
184
|
options: SignalOptions = {}
|
|
155
|
-
): Promise<
|
|
185
|
+
): Promise<AutomationsVersionsPromoteResponse> {
|
|
156
186
|
return this.dispatch(() =>
|
|
157
187
|
automationsVersionsPromote({
|
|
158
188
|
client: this.client,
|
|
@@ -162,13 +192,13 @@ export class AutomationsResource {
|
|
|
162
192
|
);
|
|
163
193
|
}
|
|
164
194
|
|
|
165
|
-
async triggers(id: string, options: SignalOptions = {}): Promise<
|
|
195
|
+
async triggers(id: string, options: SignalOptions = {}): Promise<AutomationsTriggersGetResponse> {
|
|
166
196
|
return this.dispatch(() =>
|
|
167
197
|
automationsTriggersGet({ client: this.client, path: { id }, signal: options.signal })
|
|
168
198
|
);
|
|
169
199
|
}
|
|
170
200
|
|
|
171
|
-
async sync(id: string, options: SignalOptions = {}): Promise<
|
|
201
|
+
async sync(id: string, options: SignalOptions = {}): Promise<AutomationsSyncResponse> {
|
|
172
202
|
return this.dispatch(() =>
|
|
173
203
|
automationsSync({ client: this.client, path: { id }, signal: options.signal })
|
|
174
204
|
);
|
|
@@ -187,7 +217,7 @@ export class AutomationReviewsResource {
|
|
|
187
217
|
async health(
|
|
188
218
|
automationId: string,
|
|
189
219
|
options: AutomationReviewHealthOptions = {}
|
|
190
|
-
): Promise<
|
|
220
|
+
): Promise<AutomationsReviewsHealthResponse> {
|
|
191
221
|
const { signal, ...query } = options;
|
|
192
222
|
return this.dispatch(() =>
|
|
193
223
|
automationsReviewsHealth({
|
|
@@ -226,7 +256,7 @@ export class AutomationDatasetResource {
|
|
|
226
256
|
automationId: string,
|
|
227
257
|
file: Blob | File,
|
|
228
258
|
options: { mode?: 'append' | 'replace'; signal?: AbortSignal } = {}
|
|
229
|
-
): Promise<
|
|
259
|
+
): Promise<AutomationsDatasetImportResponse> {
|
|
230
260
|
const formData = new FormData();
|
|
231
261
|
formData.set('file', file);
|
|
232
262
|
formData.set('mode', options.mode ?? 'append');
|
|
@@ -257,7 +287,7 @@ export class AutomationExamplesResource {
|
|
|
257
287
|
include?: 'full' | 'metadata';
|
|
258
288
|
signal?: AbortSignal;
|
|
259
289
|
} = {}
|
|
260
|
-
): Promise<
|
|
290
|
+
): Promise<AutomationsExamplesListResponse> {
|
|
261
291
|
const { signal, ...query } = options;
|
|
262
292
|
return this.dispatch(() =>
|
|
263
293
|
automationsExamplesList({ client: this.client, path: { id: automationId }, query, signal })
|
|
@@ -268,7 +298,7 @@ export class AutomationExamplesResource {
|
|
|
268
298
|
automationId: string,
|
|
269
299
|
body: Record<string, unknown>,
|
|
270
300
|
options: SignalOptions = {}
|
|
271
|
-
): Promise<
|
|
301
|
+
): Promise<AutomationsExamplesCreateResponse> {
|
|
272
302
|
return this.dispatch(() =>
|
|
273
303
|
automationsExamplesCreate({
|
|
274
304
|
client: this.client,
|
|
@@ -283,7 +313,7 @@ export class AutomationExamplesResource {
|
|
|
283
313
|
automationId: string,
|
|
284
314
|
exampleId: string,
|
|
285
315
|
options: SignalOptions = {}
|
|
286
|
-
): Promise<
|
|
316
|
+
): Promise<AutomationsExamplesGetResponse> {
|
|
287
317
|
return this.dispatch(() =>
|
|
288
318
|
automationsExamplesGet({
|
|
289
319
|
client: this.client,
|
|
@@ -298,7 +328,7 @@ export class AutomationExamplesResource {
|
|
|
298
328
|
exampleId: string,
|
|
299
329
|
body: Record<string, unknown>,
|
|
300
330
|
options: SignalOptions = {}
|
|
301
|
-
): Promise<
|
|
331
|
+
): Promise<AutomationsExamplesUpdateResponse> {
|
|
302
332
|
return this.dispatch(() =>
|
|
303
333
|
automationsExamplesUpdate({
|
|
304
334
|
client: this.client,
|
|
@@ -313,7 +343,7 @@ export class AutomationExamplesResource {
|
|
|
313
343
|
automationId: string,
|
|
314
344
|
exampleId: string,
|
|
315
345
|
options: SignalOptions = {}
|
|
316
|
-
): Promise<
|
|
346
|
+
): Promise<AutomationsExamplesDeleteResponse> {
|
|
317
347
|
return this.dispatch(() =>
|
|
318
348
|
automationsExamplesDelete({
|
|
319
349
|
client: this.client,
|
|
@@ -327,7 +357,7 @@ export class AutomationExamplesResource {
|
|
|
327
357
|
automationId: string,
|
|
328
358
|
exampleId: string,
|
|
329
359
|
options: SignalOptions = {}
|
|
330
|
-
): Promise<
|
|
360
|
+
): Promise<AutomationsExamplesRunResponse> {
|
|
331
361
|
return this.dispatch(() =>
|
|
332
362
|
automationsExamplesRun({
|
|
333
363
|
client: this.client,
|
|
@@ -344,7 +374,10 @@ export class AutomationEvaluatorsResource {
|
|
|
344
374
|
private readonly dispatch: Dispatch
|
|
345
375
|
) {}
|
|
346
376
|
|
|
347
|
-
async get(
|
|
377
|
+
async get(
|
|
378
|
+
automationId: string,
|
|
379
|
+
options: SignalOptions = {}
|
|
380
|
+
): Promise<AutomationsEvaluatorsGetResponse> {
|
|
348
381
|
return this.dispatch(() =>
|
|
349
382
|
automationsEvaluatorsGet({
|
|
350
383
|
client: this.client,
|
|
@@ -358,7 +391,7 @@ export class AutomationEvaluatorsResource {
|
|
|
358
391
|
automationId: string,
|
|
359
392
|
yaml: string,
|
|
360
393
|
options: SignalOptions = {}
|
|
361
|
-
): Promise<
|
|
394
|
+
): Promise<AutomationsEvaluatorsUpdateResponse> {
|
|
362
395
|
return this.dispatch(() =>
|
|
363
396
|
automationsEvaluatorsUpdate({
|
|
364
397
|
client: this.client,
|
|
@@ -379,7 +412,7 @@ export class AutomationExperimentsResource {
|
|
|
379
412
|
async list(
|
|
380
413
|
automationId: string,
|
|
381
414
|
options: { limit?: number; offset?: number; signal?: AbortSignal } = {}
|
|
382
|
-
): Promise<
|
|
415
|
+
): Promise<AutomationsExperimentsListResponse> {
|
|
383
416
|
const { signal, ...query } = options;
|
|
384
417
|
return this.dispatch(() =>
|
|
385
418
|
automationsExperimentsList({ client: this.client, path: { id: automationId }, query, signal })
|
|
@@ -390,7 +423,7 @@ export class AutomationExperimentsResource {
|
|
|
390
423
|
automationId: string,
|
|
391
424
|
body: Record<string, unknown> = {},
|
|
392
425
|
options: SignalOptions = {}
|
|
393
|
-
): Promise<
|
|
426
|
+
): Promise<AutomationsExperimentsCreateResponse> {
|
|
394
427
|
return this.dispatch(() =>
|
|
395
428
|
automationsExperimentsCreate({
|
|
396
429
|
client: this.client,
|
|
@@ -405,7 +438,7 @@ export class AutomationExperimentsResource {
|
|
|
405
438
|
automationId: string,
|
|
406
439
|
experimentId: string,
|
|
407
440
|
options: SignalOptions = {}
|
|
408
|
-
): Promise<
|
|
441
|
+
): Promise<AutomationsExperimentsGetResponse> {
|
|
409
442
|
return this.dispatch(() =>
|
|
410
443
|
automationsExperimentsGet({
|
|
411
444
|
client: this.client,
|
|
@@ -419,7 +452,7 @@ export class AutomationExperimentsResource {
|
|
|
419
452
|
automationId: string,
|
|
420
453
|
experimentId: string,
|
|
421
454
|
options: SignalOptions = {}
|
|
422
|
-
): Promise<
|
|
455
|
+
): Promise<AutomationsExperimentsCancelResponse> {
|
|
423
456
|
return this.dispatch(() =>
|
|
424
457
|
automationsExperimentsCancel({
|
|
425
458
|
client: this.client,
|
|
@@ -601,7 +634,7 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
601
634
|
async list(
|
|
602
635
|
automationId: string,
|
|
603
636
|
options: ListDatasetReviewRequestsOptions = {}
|
|
604
|
-
): Promise<
|
|
637
|
+
): Promise<AutomationsDatasetReviewRequestsListResponse> {
|
|
605
638
|
const { signal, status, limit, offset } = options;
|
|
606
639
|
const query = {
|
|
607
640
|
status: joinCsv(status),
|
|
@@ -614,7 +647,7 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
614
647
|
url: datasetReviewRequestsBaseUrl(automationId),
|
|
615
648
|
query,
|
|
616
649
|
signal,
|
|
617
|
-
}) as Promise<OperationResult<
|
|
650
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsListResponse>>
|
|
618
651
|
);
|
|
619
652
|
}
|
|
620
653
|
|
|
@@ -622,14 +655,14 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
622
655
|
automationId: string,
|
|
623
656
|
body: CreateDatasetReviewRequestBody,
|
|
624
657
|
options: SignalOptions = {}
|
|
625
|
-
): Promise<
|
|
658
|
+
): Promise<AutomationsDatasetReviewRequestsCreateResponse> {
|
|
626
659
|
return this.dispatch(
|
|
627
660
|
() =>
|
|
628
661
|
this.client.post({
|
|
629
662
|
url: datasetReviewRequestsBaseUrl(automationId),
|
|
630
663
|
body: body as never,
|
|
631
664
|
signal: options.signal,
|
|
632
|
-
}) as Promise<OperationResult<
|
|
665
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsCreateResponse>>
|
|
633
666
|
);
|
|
634
667
|
}
|
|
635
668
|
|
|
@@ -637,13 +670,13 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
637
670
|
automationId: string,
|
|
638
671
|
reviewId: string,
|
|
639
672
|
options: SignalOptions = {}
|
|
640
|
-
): Promise<
|
|
673
|
+
): Promise<AutomationsDatasetReviewRequestsGetResponse> {
|
|
641
674
|
return this.dispatch(
|
|
642
675
|
() =>
|
|
643
676
|
this.client.get({
|
|
644
677
|
url: `${datasetReviewRequestsBaseUrl(automationId)}/${reviewId}`,
|
|
645
678
|
signal: options.signal,
|
|
646
|
-
}) as Promise<OperationResult<
|
|
679
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsGetResponse>>
|
|
647
680
|
);
|
|
648
681
|
}
|
|
649
682
|
|
|
@@ -652,14 +685,14 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
652
685
|
reviewId: string,
|
|
653
686
|
body: UpdateDatasetReviewRequestBody,
|
|
654
687
|
options: SignalOptions = {}
|
|
655
|
-
): Promise<
|
|
688
|
+
): Promise<AutomationsDatasetReviewRequestsUpdateResponse> {
|
|
656
689
|
return this.dispatch(
|
|
657
690
|
() =>
|
|
658
691
|
this.client.patch({
|
|
659
692
|
url: `${datasetReviewRequestsBaseUrl(automationId)}/${reviewId}`,
|
|
660
693
|
body: body as never,
|
|
661
694
|
signal: options.signal,
|
|
662
|
-
}) as Promise<OperationResult<
|
|
695
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsUpdateResponse>>
|
|
663
696
|
);
|
|
664
697
|
}
|
|
665
698
|
|
|
@@ -667,7 +700,7 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
667
700
|
automationId: string,
|
|
668
701
|
reviewId: string,
|
|
669
702
|
options: SignalOptions & { status?: string | readonly DatasetReviewItemStatus[] } = {}
|
|
670
|
-
): Promise<
|
|
703
|
+
): Promise<AutomationsDatasetReviewRequestsListItemsResponse> {
|
|
671
704
|
const { signal, status } = options;
|
|
672
705
|
return this.dispatch(
|
|
673
706
|
() =>
|
|
@@ -675,7 +708,7 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
675
708
|
url: `${datasetReviewRequestsBaseUrl(automationId)}/${reviewId}/items`,
|
|
676
709
|
query: { status: joinCsv(status) },
|
|
677
710
|
signal,
|
|
678
|
-
}) as Promise<OperationResult<
|
|
711
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsListItemsResponse>>
|
|
679
712
|
);
|
|
680
713
|
}
|
|
681
714
|
|
|
@@ -685,14 +718,14 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
685
718
|
itemId: string,
|
|
686
719
|
body: UpdateDatasetReviewItemBody,
|
|
687
720
|
options: SignalOptions = {}
|
|
688
|
-
): Promise<
|
|
721
|
+
): Promise<AutomationsDatasetReviewRequestsUpdateItemResponse> {
|
|
689
722
|
return this.dispatch(
|
|
690
723
|
() =>
|
|
691
724
|
this.client.patch({
|
|
692
725
|
url: `${datasetReviewRequestsBaseUrl(automationId)}/${reviewId}/items/${itemId}`,
|
|
693
726
|
body: body as never,
|
|
694
727
|
signal: options.signal,
|
|
695
|
-
}) as Promise<OperationResult<
|
|
728
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsUpdateItemResponse>>
|
|
696
729
|
);
|
|
697
730
|
}
|
|
698
731
|
|
|
@@ -735,14 +768,14 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
735
768
|
itemId: string,
|
|
736
769
|
body: RecordDatasetReviewItemFileDecisionBody,
|
|
737
770
|
options: SignalOptions = {}
|
|
738
|
-
): Promise<
|
|
771
|
+
): Promise<AutomationsDatasetReviewRequestsUpdateItemResponse> {
|
|
739
772
|
return this.dispatch(
|
|
740
773
|
() =>
|
|
741
774
|
this.client.patch({
|
|
742
775
|
url: `${datasetReviewRequestsBaseUrl(automationId)}/${reviewId}/items/${itemId}`,
|
|
743
776
|
body: { action: 'file-decision', ...body } as never,
|
|
744
777
|
signal: options.signal,
|
|
745
|
-
}) as Promise<OperationResult<
|
|
778
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsUpdateItemResponse>>
|
|
746
779
|
);
|
|
747
780
|
}
|
|
748
781
|
|
|
@@ -758,7 +791,7 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
758
791
|
itemId: string,
|
|
759
792
|
file: Blob | File,
|
|
760
793
|
options: EditDatasetReviewItemFileOptions
|
|
761
|
-
): Promise<
|
|
794
|
+
): Promise<AutomationsDatasetReviewRequestsUpdateItemResponse> {
|
|
762
795
|
const target = options.filePath ?? options.newPath ?? 'file';
|
|
763
796
|
const fallbackName = target.split('/').pop() || 'file';
|
|
764
797
|
const filename = file instanceof File && file.name ? file.name : fallbackName;
|
|
@@ -777,7 +810,7 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
777
810
|
bodySerializer: null,
|
|
778
811
|
headers: { 'Content-Type': null },
|
|
779
812
|
signal: options.signal,
|
|
780
|
-
}) as Promise<OperationResult<
|
|
813
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsUpdateItemResponse>>
|
|
781
814
|
);
|
|
782
815
|
}
|
|
783
816
|
|
|
@@ -785,13 +818,13 @@ export class AutomationDatasetReviewRequestsResource {
|
|
|
785
818
|
automationId: string,
|
|
786
819
|
reviewId: string,
|
|
787
820
|
options: SignalOptions = {}
|
|
788
|
-
): Promise<
|
|
821
|
+
): Promise<AutomationsDatasetReviewRequestsListEventsResponse> {
|
|
789
822
|
return this.dispatch(
|
|
790
823
|
() =>
|
|
791
824
|
this.client.get({
|
|
792
825
|
url: `${datasetReviewRequestsBaseUrl(automationId)}/${reviewId}/events`,
|
|
793
826
|
signal: options.signal,
|
|
794
|
-
}) as Promise<OperationResult<
|
|
827
|
+
}) as Promise<OperationResult<AutomationsDatasetReviewRequestsListEventsResponse>>
|
|
795
828
|
);
|
|
796
829
|
}
|
|
797
830
|
}
|
package/src/resources/files.ts
CHANGED
|
@@ -11,6 +11,16 @@ import {
|
|
|
11
11
|
filesUploadsPartsList,
|
|
12
12
|
filesUploadsPartsPresign,
|
|
13
13
|
} from '../generated/sdk.gen';
|
|
14
|
+
import type {
|
|
15
|
+
FilesDeleteResponse,
|
|
16
|
+
FilesGetResponse,
|
|
17
|
+
FilesUploadsAbortResponse,
|
|
18
|
+
FilesUploadsCompleteResponse,
|
|
19
|
+
FilesUploadsCreateResponse,
|
|
20
|
+
FilesUploadsGetResponse,
|
|
21
|
+
FilesUploadsPartsListResponse,
|
|
22
|
+
FilesUploadsPartsPresignResponse,
|
|
23
|
+
} from '../generated/types.gen';
|
|
14
24
|
import {
|
|
15
25
|
byteViewToArrayBuffer,
|
|
16
26
|
destroyUnreadNodeReadable,
|
|
@@ -43,7 +53,6 @@ type Dispatch = <T>(
|
|
|
43
53
|
call: () => Promise<OperationResult<T>>,
|
|
44
54
|
options?: RequestDispatchOptions
|
|
45
55
|
) => Promise<T>;
|
|
46
|
-
type AnyResponse = any;
|
|
47
56
|
type SignalOptions = { signal?: AbortSignal };
|
|
48
57
|
type UploadOptions = SignalOptions & {
|
|
49
58
|
/** Required only when `file` is a nameless Blob. */
|
|
@@ -92,7 +101,10 @@ export class FilesResource {
|
|
|
92
101
|
private readonly dispatch: Dispatch
|
|
93
102
|
) {}
|
|
94
103
|
|
|
95
|
-
async upload(
|
|
104
|
+
async upload(
|
|
105
|
+
file: UploadableFile,
|
|
106
|
+
options: UploadOptions = {}
|
|
107
|
+
): Promise<FilesUploadsCompleteResponse> {
|
|
96
108
|
const source = await resolveUploadableSource(file, options.filename);
|
|
97
109
|
const idempotencyKey = options.idempotencyKey ?? newIdempotencyKey();
|
|
98
110
|
const negotiation = await this.createUpload(
|
|
@@ -166,7 +178,7 @@ export class FilesResource {
|
|
|
166
178
|
url: negotiation.completeUrl,
|
|
167
179
|
body: {} as never,
|
|
168
180
|
signal: options.signal,
|
|
169
|
-
}) as Promise<OperationResult<
|
|
181
|
+
}) as Promise<OperationResult<FilesUploadsCompleteResponse>>
|
|
170
182
|
);
|
|
171
183
|
} catch (error) {
|
|
172
184
|
if (shouldAbortMultipartUploadSession({ partsReady })) {
|
|
@@ -223,13 +235,16 @@ export class FilesResource {
|
|
|
223
235
|
bodySerializer: null,
|
|
224
236
|
headers: { 'Content-Type': null },
|
|
225
237
|
signal: options.signal,
|
|
226
|
-
}) as Promise<OperationResult<
|
|
238
|
+
}) as Promise<OperationResult<FilesUploadsCompleteResponse>>
|
|
227
239
|
);
|
|
228
240
|
options.onProgress?.(source.size, source.size);
|
|
229
241
|
return uploaded;
|
|
230
242
|
}
|
|
231
243
|
|
|
232
|
-
async createUpload(
|
|
244
|
+
async createUpload(
|
|
245
|
+
input: CreateUploadInput,
|
|
246
|
+
options: SignalOptions = {}
|
|
247
|
+
): Promise<FilesUploadsCreateResponse> {
|
|
233
248
|
const body = {
|
|
234
249
|
filename: input.filename,
|
|
235
250
|
contentType: input.contentType,
|
|
@@ -247,7 +262,10 @@ export class FilesResource {
|
|
|
247
262
|
);
|
|
248
263
|
}
|
|
249
264
|
|
|
250
|
-
async completeUpload(
|
|
265
|
+
async completeUpload(
|
|
266
|
+
uploadId: string,
|
|
267
|
+
options: SignalOptions = {}
|
|
268
|
+
): Promise<FilesUploadsCompleteResponse> {
|
|
251
269
|
return this.dispatch(() =>
|
|
252
270
|
filesUploadsComplete({
|
|
253
271
|
client: this.client,
|
|
@@ -257,7 +275,10 @@ export class FilesResource {
|
|
|
257
275
|
);
|
|
258
276
|
}
|
|
259
277
|
|
|
260
|
-
async abortUpload(
|
|
278
|
+
async abortUpload(
|
|
279
|
+
uploadId: string,
|
|
280
|
+
options: SignalOptions = {}
|
|
281
|
+
): Promise<FilesUploadsAbortResponse> {
|
|
261
282
|
return this.dispatch(() =>
|
|
262
283
|
filesUploadsAbort({
|
|
263
284
|
client: this.client,
|
|
@@ -267,7 +288,7 @@ export class FilesResource {
|
|
|
267
288
|
);
|
|
268
289
|
}
|
|
269
290
|
|
|
270
|
-
async getUpload(uploadId: string, options: SignalOptions = {}): Promise<
|
|
291
|
+
async getUpload(uploadId: string, options: SignalOptions = {}): Promise<FilesUploadsGetResponse> {
|
|
271
292
|
return this.dispatch(() =>
|
|
272
293
|
filesUploadsGet({
|
|
273
294
|
client: this.client,
|
|
@@ -277,7 +298,10 @@ export class FilesResource {
|
|
|
277
298
|
);
|
|
278
299
|
}
|
|
279
300
|
|
|
280
|
-
async listUploadParts(
|
|
301
|
+
async listUploadParts(
|
|
302
|
+
uploadId: string,
|
|
303
|
+
options: SignalOptions = {}
|
|
304
|
+
): Promise<FilesUploadsPartsListResponse> {
|
|
281
305
|
return this.dispatch(() =>
|
|
282
306
|
filesUploadsPartsList({
|
|
283
307
|
client: this.client,
|
|
@@ -291,7 +315,7 @@ export class FilesResource {
|
|
|
291
315
|
uploadId: string,
|
|
292
316
|
partNumber: number,
|
|
293
317
|
options: SignalOptions = {}
|
|
294
|
-
): Promise<
|
|
318
|
+
): Promise<FilesUploadsPartsPresignResponse> {
|
|
295
319
|
return this.dispatch(() =>
|
|
296
320
|
filesUploadsPartsPresign({
|
|
297
321
|
client: this.client,
|
|
@@ -302,7 +326,7 @@ export class FilesResource {
|
|
|
302
326
|
);
|
|
303
327
|
}
|
|
304
328
|
|
|
305
|
-
async get(fileId: string, options: SignalOptions = {}): Promise<
|
|
329
|
+
async get(fileId: string, options: SignalOptions = {}): Promise<FilesGetResponse> {
|
|
306
330
|
return this.dispatch(() =>
|
|
307
331
|
filesGet({ client: this.client, path: { id: fileId }, signal: options.signal })
|
|
308
332
|
);
|
|
@@ -323,7 +347,7 @@ export class FilesResource {
|
|
|
323
347
|
);
|
|
324
348
|
}
|
|
325
349
|
|
|
326
|
-
async delete(fileId: string, options: SignalOptions = {}): Promise<
|
|
350
|
+
async delete(fileId: string, options: SignalOptions = {}): Promise<FilesDeleteResponse> {
|
|
327
351
|
return this.dispatch(() =>
|
|
328
352
|
filesDelete({ client: this.client, path: { id: fileId }, signal: options.signal })
|
|
329
353
|
);
|
package/src/telemetry.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
export const SDK_LANGUAGE = 'typescript';
|
|
20
20
|
// Rewritten at publish time by scripts/release/platform/render-sdk-versions.sh.
|
|
21
21
|
// Keep this string literal exactly stable — sed matches on it.
|
|
22
|
-
export const SDK_VERSION = '0.20.
|
|
22
|
+
export const SDK_VERSION = '0.20.27';
|
|
23
23
|
|
|
24
24
|
function detectRuntime(): string {
|
|
25
25
|
const g = globalThis as unknown as {
|