@eigenpal/sdk 0.5.12 → 0.6.0
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/README.md +2 -2
- package/package.json +1 -1
- package/src/client.ts +8 -0
- package/src/generated/index.ts +131 -85
- package/src/generated/sdk.gen.ts +287 -170
- package/src/generated/types.gen.ts +903 -452
- package/src/index.ts +11 -7
- package/src/resources/agents.ts +82 -80
- package/src/resources/automations.ts +22 -0
- package/src/resources/source.ts +85 -0
- package/src/telemetry.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -34,11 +34,8 @@ export {
|
|
|
34
34
|
|
|
35
35
|
export { toFile } from './lib/files';
|
|
36
36
|
export type { FileDescriptor, FileInput, NodeReadableStream } from './lib/files';
|
|
37
|
-
export type {
|
|
38
|
-
|
|
39
|
-
ListAgentsOptions,
|
|
40
|
-
RunAgentOptions,
|
|
41
|
-
} from './resources/agents';
|
|
37
|
+
export type { ListAgentRunsOptions, ListAgentsOptions, RunAgentOptions } from './resources/agents';
|
|
38
|
+
export type { SourceRawOptions, SourceReleasesOptions } from './resources/source';
|
|
42
39
|
export type {
|
|
43
40
|
ListVersionsOptions,
|
|
44
41
|
ListWorkflowsOptions,
|
|
@@ -57,24 +54,31 @@ export type {
|
|
|
57
54
|
AgentExecutionExpectedArtifacts,
|
|
58
55
|
AgentExecutionFeedback,
|
|
59
56
|
AgentExecutionFeedbackDetail,
|
|
60
|
-
AgentExecutionResponse,
|
|
61
57
|
AgentExecutionSummary,
|
|
58
|
+
AgentRunResponse,
|
|
62
59
|
AgentSummary,
|
|
63
60
|
ApiErrorEnvelope,
|
|
64
61
|
ApiErrorIssue,
|
|
62
|
+
AutomationSyncResponse,
|
|
65
63
|
CancelAgentExecutionResponse,
|
|
66
64
|
CancelWorkflowExecutionResponse,
|
|
67
65
|
ExecutionStatus,
|
|
68
66
|
ExecutionSummary,
|
|
69
67
|
GetAgentResponse,
|
|
70
|
-
|
|
68
|
+
ListAgentRunsResponse,
|
|
71
69
|
ListAgentsResponse,
|
|
72
70
|
ListVersionsResponse,
|
|
73
71
|
ListWorkflowExecutionsResponse,
|
|
74
72
|
ListWorkflowsResponse,
|
|
73
|
+
RawSourceResponse,
|
|
75
74
|
RunAgentResponse,
|
|
76
75
|
RunWorkflowBody,
|
|
77
76
|
RunWorkflowResponse,
|
|
77
|
+
SourceLockfileResponse,
|
|
78
|
+
SourceReleasesResponse,
|
|
79
|
+
SourceRepositoryResponse,
|
|
80
|
+
SourceSecretsDecryptBody,
|
|
81
|
+
SourceSecretsDecryptResponse,
|
|
78
82
|
WorkflowDetail,
|
|
79
83
|
WorkflowExecutionStatusResponse,
|
|
80
84
|
WorkflowSummary,
|
package/src/resources/agents.ts
CHANGED
|
@@ -3,43 +3,42 @@ import { EigenpalError } from '../errors';
|
|
|
3
3
|
import type { Client } from '../generated/client';
|
|
4
4
|
import {
|
|
5
5
|
agentsCreate,
|
|
6
|
-
agentsExecutionsCancel,
|
|
7
|
-
agentsExecutionsExpectedCreate,
|
|
8
|
-
agentsExecutionsExpectedDelete,
|
|
9
|
-
agentsExecutionsExpectedDownload,
|
|
10
|
-
agentsExecutionsExpectedList,
|
|
11
|
-
agentsExecutionsExpectedRename,
|
|
12
|
-
agentsExecutionsFeedbackDelete,
|
|
13
|
-
agentsExecutionsFeedbackGet,
|
|
14
|
-
agentsExecutionsFeedbackUpdate,
|
|
15
|
-
agentsExecutionsFilesDownload,
|
|
16
|
-
agentsExecutionsGet,
|
|
17
|
-
agentsExecutionsList,
|
|
18
|
-
agentsExecutionsRerun,
|
|
19
6
|
agentsFilesListOrGet,
|
|
20
7
|
agentsFilesPut,
|
|
21
8
|
agentsFilesUploadBatch,
|
|
22
9
|
agentsGet,
|
|
23
10
|
agentsList,
|
|
24
11
|
agentsRun,
|
|
12
|
+
agentsRunsCancel,
|
|
13
|
+
agentsRunsExpectedCreate,
|
|
14
|
+
agentsRunsExpectedDelete,
|
|
15
|
+
agentsRunsExpectedDownload,
|
|
16
|
+
agentsRunsExpectedList,
|
|
17
|
+
agentsRunsExpectedRename,
|
|
18
|
+
agentsRunsFeedbackDelete,
|
|
19
|
+
agentsRunsFeedbackGet,
|
|
20
|
+
agentsRunsFeedbackUpdate,
|
|
21
|
+
agentsRunsFilesDownload,
|
|
22
|
+
agentsRunsGet,
|
|
23
|
+
agentsRunsList,
|
|
24
|
+
agentsRunsRerun,
|
|
25
25
|
agentsUpdate,
|
|
26
26
|
} from '../generated/sdk.gen';
|
|
27
27
|
import type {
|
|
28
28
|
AgentExecutionExpectedArtifacts,
|
|
29
29
|
AgentExecutionFeedbackDetail,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
AgentFilesBody,
|
|
30
|
+
AgentRunResponse,
|
|
31
|
+
CancelAgentExecutionResponse,
|
|
33
32
|
CopyAgentExecutionOutputToExpectedBody,
|
|
34
33
|
CreateAgentBody,
|
|
35
34
|
CreateAgentResponse,
|
|
36
35
|
GetAgentResponse,
|
|
37
|
-
|
|
36
|
+
ListAgentRunsResponse,
|
|
38
37
|
ListAgentsResponse,
|
|
39
38
|
PatchAgentBody,
|
|
40
39
|
PatchAgentResponse,
|
|
41
40
|
RenameExpectedFileBody,
|
|
42
|
-
|
|
41
|
+
RerunAgentRunResponse,
|
|
43
42
|
RunAgentResponse,
|
|
44
43
|
UpdateAgentExecutionFeedbackBody,
|
|
45
44
|
} from '../generated/types.gen';
|
|
@@ -57,14 +56,15 @@ export interface ListAgentsOptions {
|
|
|
57
56
|
|
|
58
57
|
export interface RunAgentOptions {
|
|
59
58
|
waitForCompletion?: number;
|
|
59
|
+
sourceRef?: string;
|
|
60
60
|
signal?: AbortSignal;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export interface
|
|
63
|
+
export interface ListAgentRunsOptions {
|
|
64
64
|
status?: string;
|
|
65
65
|
batchId?: string;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
exampleId?: string;
|
|
67
|
+
exampleIdContains?: string;
|
|
68
68
|
createdAfter?: string;
|
|
69
69
|
createdBefore?: string;
|
|
70
70
|
completedAfter?: string;
|
|
@@ -87,7 +87,7 @@ export interface ListAgentExecutionsOptions {
|
|
|
87
87
|
promotedExampleName?: string;
|
|
88
88
|
sinceLastResolved?: boolean;
|
|
89
89
|
include?: string;
|
|
90
|
-
sort?: 'createdAt' | 'completedAt' | 'status' | '
|
|
90
|
+
sort?: 'createdAt' | 'completedAt' | 'status' | 'exampleId';
|
|
91
91
|
order?: 'asc' | 'desc';
|
|
92
92
|
scanLimit?: number;
|
|
93
93
|
limit?: number;
|
|
@@ -97,31 +97,28 @@ export interface ListAgentExecutionsOptions {
|
|
|
97
97
|
|
|
98
98
|
export type AgentExecutionFileKind = 'input' | 'output' | 'issues' | 'trace';
|
|
99
99
|
|
|
100
|
-
export class
|
|
100
|
+
export class AgentRunsResource {
|
|
101
101
|
constructor(
|
|
102
102
|
private readonly client: Client,
|
|
103
103
|
private readonly dispatch: Dispatch
|
|
104
104
|
) {}
|
|
105
105
|
|
|
106
|
-
async list(
|
|
107
|
-
agentId: string,
|
|
108
|
-
options: ListAgentExecutionsOptions = {}
|
|
109
|
-
): Promise<ListAgentExecutionsResponse> {
|
|
106
|
+
async list(agentId: string, options: ListAgentRunsOptions = {}): Promise<ListAgentRunsResponse> {
|
|
110
107
|
const { signal, ...query } = options;
|
|
111
108
|
return this.dispatch(() =>
|
|
112
|
-
|
|
109
|
+
agentsRunsList({ client: this.client, path: { agentId }, query, signal })
|
|
113
110
|
);
|
|
114
111
|
}
|
|
115
112
|
|
|
116
113
|
async get(
|
|
117
|
-
|
|
114
|
+
runId: string,
|
|
118
115
|
options: { include?: string; signal?: AbortSignal } = {}
|
|
119
|
-
): Promise<
|
|
116
|
+
): Promise<AgentRunResponse> {
|
|
120
117
|
const { signal, include } = options;
|
|
121
118
|
return this.dispatch(() =>
|
|
122
|
-
|
|
119
|
+
agentsRunsGet({
|
|
123
120
|
client: this.client,
|
|
124
|
-
path: {
|
|
121
|
+
path: { runId },
|
|
125
122
|
query: include ? { include } : {},
|
|
126
123
|
signal,
|
|
127
124
|
})
|
|
@@ -129,53 +126,53 @@ export class AgentExecutionsResource {
|
|
|
129
126
|
}
|
|
130
127
|
|
|
131
128
|
async cancel(
|
|
132
|
-
|
|
129
|
+
runId: string,
|
|
133
130
|
options: { signal?: AbortSignal } = {}
|
|
134
|
-
): Promise<
|
|
131
|
+
): Promise<CancelAgentExecutionResponse> {
|
|
135
132
|
return this.dispatch(() =>
|
|
136
|
-
|
|
133
|
+
agentsRunsCancel({
|
|
137
134
|
client: this.client,
|
|
138
|
-
path: {
|
|
135
|
+
path: { runId },
|
|
139
136
|
signal: options.signal,
|
|
140
137
|
})
|
|
141
138
|
);
|
|
142
139
|
}
|
|
143
140
|
|
|
144
141
|
async rerun(
|
|
145
|
-
|
|
142
|
+
runId: string,
|
|
146
143
|
options: { signal?: AbortSignal } = {}
|
|
147
|
-
): Promise<
|
|
144
|
+
): Promise<RerunAgentRunResponse> {
|
|
148
145
|
return this.dispatch(() =>
|
|
149
|
-
|
|
146
|
+
agentsRunsRerun({
|
|
150
147
|
client: this.client,
|
|
151
|
-
path: {
|
|
148
|
+
path: { runId },
|
|
152
149
|
signal: options.signal,
|
|
153
150
|
})
|
|
154
151
|
);
|
|
155
152
|
}
|
|
156
153
|
|
|
157
154
|
async getFeedback(
|
|
158
|
-
|
|
155
|
+
runId: string,
|
|
159
156
|
options: { signal?: AbortSignal } = {}
|
|
160
157
|
): Promise<AgentExecutionFeedbackDetail> {
|
|
161
158
|
return this.dispatch(() =>
|
|
162
|
-
|
|
159
|
+
agentsRunsFeedbackGet({
|
|
163
160
|
client: this.client,
|
|
164
|
-
path: {
|
|
161
|
+
path: { runId },
|
|
165
162
|
signal: options.signal,
|
|
166
163
|
})
|
|
167
164
|
);
|
|
168
165
|
}
|
|
169
166
|
|
|
170
167
|
async updateFeedback(
|
|
171
|
-
|
|
168
|
+
runId: string,
|
|
172
169
|
body: UpdateAgentExecutionFeedbackBody,
|
|
173
170
|
options: { signal?: AbortSignal } = {}
|
|
174
171
|
): Promise<AgentExecutionFeedbackDetail> {
|
|
175
172
|
return this.dispatch(() =>
|
|
176
|
-
|
|
173
|
+
agentsRunsFeedbackUpdate({
|
|
177
174
|
client: this.client,
|
|
178
|
-
path: {
|
|
175
|
+
path: { runId },
|
|
179
176
|
body,
|
|
180
177
|
signal: options.signal,
|
|
181
178
|
})
|
|
@@ -183,40 +180,40 @@ export class AgentExecutionsResource {
|
|
|
183
180
|
}
|
|
184
181
|
|
|
185
182
|
async clearFeedback(
|
|
186
|
-
|
|
183
|
+
runId: string,
|
|
187
184
|
options: { signal?: AbortSignal } = {}
|
|
188
185
|
): Promise<AgentExecutionFeedbackDetail> {
|
|
189
186
|
return this.dispatch(() =>
|
|
190
|
-
|
|
187
|
+
agentsRunsFeedbackDelete({
|
|
191
188
|
client: this.client,
|
|
192
|
-
path: {
|
|
189
|
+
path: { runId },
|
|
193
190
|
signal: options.signal,
|
|
194
191
|
})
|
|
195
192
|
);
|
|
196
193
|
}
|
|
197
194
|
|
|
198
195
|
async listExpected(
|
|
199
|
-
|
|
196
|
+
runId: string,
|
|
200
197
|
options: { signal?: AbortSignal } = {}
|
|
201
198
|
): Promise<AgentExecutionExpectedArtifacts> {
|
|
202
199
|
return this.dispatch(() =>
|
|
203
|
-
|
|
200
|
+
agentsRunsExpectedList({
|
|
204
201
|
client: this.client,
|
|
205
|
-
path: {
|
|
202
|
+
path: { runId },
|
|
206
203
|
signal: options.signal,
|
|
207
204
|
})
|
|
208
205
|
);
|
|
209
206
|
}
|
|
210
207
|
|
|
211
208
|
async copyOutputToExpected(
|
|
212
|
-
|
|
209
|
+
runId: string,
|
|
213
210
|
body: CopyAgentExecutionOutputToExpectedBody,
|
|
214
211
|
options: { signal?: AbortSignal } = {}
|
|
215
212
|
): Promise<{ name: string }> {
|
|
216
213
|
return this.dispatch(() =>
|
|
217
|
-
|
|
214
|
+
agentsRunsExpectedCreate({
|
|
218
215
|
client: this.client,
|
|
219
|
-
path: {
|
|
216
|
+
path: { runId },
|
|
220
217
|
body,
|
|
221
218
|
signal: options.signal,
|
|
222
219
|
})
|
|
@@ -224,15 +221,15 @@ export class AgentExecutionsResource {
|
|
|
224
221
|
}
|
|
225
222
|
|
|
226
223
|
async renameExpected(
|
|
227
|
-
|
|
224
|
+
runId: string,
|
|
228
225
|
filename: string,
|
|
229
226
|
body: RenameExpectedFileBody,
|
|
230
227
|
options: { signal?: AbortSignal } = {}
|
|
231
228
|
): Promise<{ name: string }> {
|
|
232
229
|
return this.dispatch(() =>
|
|
233
|
-
|
|
230
|
+
agentsRunsExpectedRename({
|
|
234
231
|
client: this.client,
|
|
235
|
-
path: {
|
|
232
|
+
path: { runId, filename },
|
|
236
233
|
body,
|
|
237
234
|
signal: options.signal,
|
|
238
235
|
})
|
|
@@ -240,21 +237,21 @@ export class AgentExecutionsResource {
|
|
|
240
237
|
}
|
|
241
238
|
|
|
242
239
|
async deleteExpected(
|
|
243
|
-
|
|
240
|
+
runId: string,
|
|
244
241
|
filename: string,
|
|
245
242
|
options: { signal?: AbortSignal } = {}
|
|
246
243
|
): Promise<void> {
|
|
247
244
|
await this.dispatch(() =>
|
|
248
|
-
|
|
245
|
+
agentsRunsExpectedDelete({
|
|
249
246
|
client: this.client,
|
|
250
|
-
path: {
|
|
247
|
+
path: { runId, filename },
|
|
251
248
|
signal: options.signal,
|
|
252
249
|
})
|
|
253
250
|
);
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
async uploadExpected(
|
|
257
|
-
|
|
254
|
+
runId: string,
|
|
258
255
|
file: Blob,
|
|
259
256
|
options: { name?: string; signal?: AbortSignal } = {}
|
|
260
257
|
): Promise<{ name: string }> {
|
|
@@ -264,8 +261,8 @@ export class AgentExecutionsResource {
|
|
|
264
261
|
return this.dispatch(
|
|
265
262
|
() =>
|
|
266
263
|
this.client.post({
|
|
267
|
-
url: '/api/v1/agents/
|
|
268
|
-
path: {
|
|
264
|
+
url: '/api/v1/agents/runs/{runId}/expected',
|
|
265
|
+
path: { runId },
|
|
269
266
|
body: formData,
|
|
270
267
|
bodySerializer: null,
|
|
271
268
|
headers: { 'Content-Type': null },
|
|
@@ -275,15 +272,15 @@ export class AgentExecutionsResource {
|
|
|
275
272
|
}
|
|
276
273
|
|
|
277
274
|
async downloadExpected(
|
|
278
|
-
|
|
275
|
+
runId: string,
|
|
279
276
|
filename: string,
|
|
280
277
|
options: { signal?: AbortSignal } = {}
|
|
281
278
|
): Promise<Blob> {
|
|
282
279
|
return this.downloadBlob(
|
|
283
280
|
() =>
|
|
284
|
-
|
|
281
|
+
agentsRunsExpectedDownload({
|
|
285
282
|
client: this.client,
|
|
286
|
-
path: {
|
|
283
|
+
path: { runId, filename },
|
|
287
284
|
parseAs: 'blob',
|
|
288
285
|
signal: options.signal,
|
|
289
286
|
}) as Promise<OperationResult<Blob>>
|
|
@@ -291,16 +288,16 @@ export class AgentExecutionsResource {
|
|
|
291
288
|
}
|
|
292
289
|
|
|
293
290
|
async downloadFile(
|
|
294
|
-
|
|
291
|
+
runId: string,
|
|
295
292
|
kind: AgentExecutionFileKind,
|
|
296
293
|
filename: string,
|
|
297
294
|
options: { signal?: AbortSignal } = {}
|
|
298
295
|
): Promise<Blob> {
|
|
299
296
|
return this.downloadBlob(
|
|
300
297
|
() =>
|
|
301
|
-
|
|
298
|
+
agentsRunsFilesDownload({
|
|
302
299
|
client: this.client,
|
|
303
|
-
path: {
|
|
300
|
+
path: { runId, kind, filename },
|
|
304
301
|
parseAs: 'blob',
|
|
305
302
|
signal: options.signal,
|
|
306
303
|
}) as Promise<OperationResult<Blob>>
|
|
@@ -319,13 +316,13 @@ export class AgentExecutionsResource {
|
|
|
319
316
|
}
|
|
320
317
|
|
|
321
318
|
export class AgentsResource {
|
|
322
|
-
public readonly
|
|
319
|
+
public readonly runs: AgentRunsResource;
|
|
323
320
|
|
|
324
321
|
constructor(
|
|
325
322
|
private readonly client: Client,
|
|
326
323
|
private readonly dispatch: Dispatch
|
|
327
324
|
) {
|
|
328
|
-
this.
|
|
325
|
+
this.runs = new AgentRunsResource(client, dispatch);
|
|
329
326
|
}
|
|
330
327
|
|
|
331
328
|
async list(options: ListAgentsOptions = {}): Promise<ListAgentsResponse> {
|
|
@@ -352,9 +349,9 @@ export class AgentsResource {
|
|
|
352
349
|
async putFile(
|
|
353
350
|
agentId: string,
|
|
354
351
|
path: string,
|
|
355
|
-
body:
|
|
352
|
+
body: Record<string, unknown>,
|
|
356
353
|
options: { signal?: AbortSignal } = {}
|
|
357
|
-
): Promise<
|
|
354
|
+
): Promise<unknown> {
|
|
358
355
|
return this.dispatch(() =>
|
|
359
356
|
agentsFilesPut({
|
|
360
357
|
client: this.client,
|
|
@@ -368,9 +365,9 @@ export class AgentsResource {
|
|
|
368
365
|
|
|
369
366
|
async uploadFiles(
|
|
370
367
|
agentId: string,
|
|
371
|
-
body:
|
|
368
|
+
body: Record<string, unknown>,
|
|
372
369
|
options: { signal?: AbortSignal } = {}
|
|
373
|
-
): Promise<
|
|
370
|
+
): Promise<unknown> {
|
|
374
371
|
return this.dispatch(() =>
|
|
375
372
|
agentsFilesUploadBatch({
|
|
376
373
|
client: this.client,
|
|
@@ -403,10 +400,12 @@ export class AgentsResource {
|
|
|
403
400
|
input?: WorkflowInput,
|
|
404
401
|
options: RunAgentOptions = {}
|
|
405
402
|
): Promise<RunAgentResponse> {
|
|
406
|
-
const query =
|
|
407
|
-
options.waitForCompletion !== undefined
|
|
403
|
+
const query = {
|
|
404
|
+
...(options.waitForCompletion !== undefined
|
|
408
405
|
? { wait_for_completion: options.waitForCompletion }
|
|
409
|
-
: {}
|
|
406
|
+
: {}),
|
|
407
|
+
...(options.sourceRef !== undefined ? { sourceRef: options.sourceRef } : {}),
|
|
408
|
+
};
|
|
410
409
|
|
|
411
410
|
if (hasFileInput(input)) {
|
|
412
411
|
const { formData } = await buildAgentMultipart(input);
|
|
@@ -429,7 +428,10 @@ export class AgentsResource {
|
|
|
429
428
|
client: this.client,
|
|
430
429
|
path: { agentId },
|
|
431
430
|
query,
|
|
432
|
-
body: {
|
|
431
|
+
body: {
|
|
432
|
+
...(input !== undefined ? { input } : {}),
|
|
433
|
+
...(options.sourceRef !== undefined ? { sourceRef: options.sourceRef } : {}),
|
|
434
|
+
},
|
|
433
435
|
signal: options.signal,
|
|
434
436
|
})
|
|
435
437
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OperationResult } from '../client';
|
|
2
|
+
import type { Client } from '../generated/client';
|
|
3
|
+
import { automationsSync } from '../generated/sdk.gen';
|
|
4
|
+
import type { AutomationSyncResponse } from '../generated/types.gen';
|
|
5
|
+
|
|
6
|
+
type Dispatch = <T>(call: () => Promise<OperationResult<T>>) => Promise<T>;
|
|
7
|
+
|
|
8
|
+
export class AutomationsResource {
|
|
9
|
+
constructor(
|
|
10
|
+
private readonly client: Client,
|
|
11
|
+
private readonly dispatch: Dispatch
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
async sync(
|
|
15
|
+
automation: string,
|
|
16
|
+
options: { signal?: AbortSignal } = {}
|
|
17
|
+
): Promise<AutomationSyncResponse> {
|
|
18
|
+
return this.dispatch(() =>
|
|
19
|
+
automationsSync({ client: this.client, path: { automation }, signal: options.signal })
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { OperationResult } from '../client';
|
|
2
|
+
import type { Client } from '../generated/client';
|
|
3
|
+
import {
|
|
4
|
+
sourceLockfilePreview,
|
|
5
|
+
sourceRaw,
|
|
6
|
+
sourceReleases,
|
|
7
|
+
sourceRepository,
|
|
8
|
+
sourceSecretsDecrypt,
|
|
9
|
+
} from '../generated/sdk.gen';
|
|
10
|
+
import type {
|
|
11
|
+
RawSourceResponse,
|
|
12
|
+
SourceLockfileResponse,
|
|
13
|
+
SourceReleasesResponse,
|
|
14
|
+
SourceRepositoryResponse,
|
|
15
|
+
SourceSecretsDecryptBody,
|
|
16
|
+
SourceSecretsDecryptResponse,
|
|
17
|
+
} from '../generated/types.gen';
|
|
18
|
+
|
|
19
|
+
type Dispatch = <T>(call: () => Promise<OperationResult<T>>) => Promise<T>;
|
|
20
|
+
|
|
21
|
+
export interface SourceRawOptions {
|
|
22
|
+
ref?: string;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SourceReleasesOptions {
|
|
27
|
+
version?: string;
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class SourceResource {
|
|
32
|
+
constructor(
|
|
33
|
+
private readonly client: Client,
|
|
34
|
+
private readonly dispatch: Dispatch
|
|
35
|
+
) {}
|
|
36
|
+
|
|
37
|
+
async repository(options: { signal?: AbortSignal } = {}): Promise<SourceRepositoryResponse> {
|
|
38
|
+
return this.dispatch(() => sourceRepository({ client: this.client, signal: options.signal }));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async raw(path: string, options: SourceRawOptions = {}): Promise<RawSourceResponse> {
|
|
42
|
+
const { signal, ref = 'main' } = options;
|
|
43
|
+
return this.dispatch(() => sourceRaw({ client: this.client, query: { path, ref }, signal }));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async releases(
|
|
47
|
+
packagePath: string,
|
|
48
|
+
options: SourceReleasesOptions = {}
|
|
49
|
+
): Promise<SourceReleasesResponse> {
|
|
50
|
+
const { signal, version } = options;
|
|
51
|
+
return this.dispatch(() =>
|
|
52
|
+
sourceReleases({
|
|
53
|
+
client: this.client,
|
|
54
|
+
query: { packagePath, ...(version !== undefined ? { version } : {}) },
|
|
55
|
+
signal,
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async lockfile(
|
|
61
|
+
packageRef: string,
|
|
62
|
+
options: { signal?: AbortSignal } = {}
|
|
63
|
+
): Promise<SourceLockfileResponse> {
|
|
64
|
+
return this.dispatch(() =>
|
|
65
|
+
sourceLockfilePreview({
|
|
66
|
+
client: this.client,
|
|
67
|
+
query: { packageRef },
|
|
68
|
+
signal: options.signal,
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async decryptSecrets(
|
|
74
|
+
body: SourceSecretsDecryptBody,
|
|
75
|
+
options: { signal?: AbortSignal } = {}
|
|
76
|
+
): Promise<SourceSecretsDecryptResponse> {
|
|
77
|
+
return this.dispatch(() =>
|
|
78
|
+
sourceSecretsDecrypt({
|
|
79
|
+
client: this.client,
|
|
80
|
+
body,
|
|
81
|
+
signal: options.signal,
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/telemetry.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
export const SDK_LANGUAGE = 'typescript';
|
|
20
20
|
// Rewritten at publish time by scripts/render-sdk-versions.sh.
|
|
21
21
|
// Keep this string literal exactly stable — sed matches on it.
|
|
22
|
-
export const SDK_VERSION = '0.
|
|
22
|
+
export const SDK_VERSION = '0.6.0';
|
|
23
23
|
|
|
24
24
|
function detectRuntime(): string {
|
|
25
25
|
const g = globalThis as unknown as {
|