@pipelex/sdk 0.42.0 → 0.43.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/README.md +17 -0
- package/dist/cli/present.d.ts +3 -2
- package/dist/cli/present.js +5 -4
- package/dist/cli/present.js.map +1 -1
- package/dist/cli/script.d.ts +1 -1
- package/dist/client.d.ts +176 -11
- package/dist/client.js +523 -102
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/exact-json.d.ts +64 -0
- package/dist/exact-json.js +127 -0
- package/dist/exact-json.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/product-models.d.ts +136 -2
- package/dist/product-models.js +1 -1
- package/dist/runs.d.ts +3 -1
- package/dist/runs.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +4 -1
- package/docs/cli.md +1 -1
- package/docs/errors.md +4 -3
- package/docs/exact-integers.md +32 -0
- package/docs/method-examples.md +89 -0
- package/docs/run-results.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,21 @@ else console.log(`version ${published.version.version}`); // "published" or "unc
|
|
|
141
141
|
const versions = await client.listMethodVersions(created.method_id); // newest first
|
|
142
142
|
const { method_id, version } = parseMethodSelector("mt_abc123@3"); // the method routes take a bare id
|
|
143
143
|
|
|
144
|
+
// A saved example is a named set of inputs with the latest run of exactly those inputs. Record a
|
|
145
|
+
// run against the revision whose inputs it used: an edit since answers `stale`, never an error.
|
|
146
|
+
const example = await client.createMethodExample(created.method_id, {
|
|
147
|
+
name: "March receipt",
|
|
148
|
+
inputs: { total: 3 },
|
|
149
|
+
});
|
|
150
|
+
const run = await client.start({ method_id: created.method_id, inputs: example.inputs });
|
|
151
|
+
const verdict = await client.recordMethodExampleLatestRun(created.method_id, example.example_id, {
|
|
152
|
+
run_id: run.pipeline_run_id,
|
|
153
|
+
input_revision: example.input_revision,
|
|
154
|
+
});
|
|
155
|
+
for await (const saved of client.iterateMethodExamples(created.method_id)) {
|
|
156
|
+
// every example, oldest first
|
|
157
|
+
}
|
|
158
|
+
|
|
144
159
|
try {
|
|
145
160
|
const { portal_url } = await client.getBillingPortal();
|
|
146
161
|
// open portal_url ...
|
|
@@ -229,6 +244,8 @@ These pages ship inside the published package, so a reader who has only installe
|
|
|
229
244
|
| [`docs/artifact-download.md`](./docs/artifact-download.md) | Turning the `pipelex-storage://` references a run produced back into bytes: `locateArtifacts`, `collectArtifacts`, `resolveArtifacts`, `fetchArtifact`, `downloadArtifacts`, and how a saved file is named after the field it fills |
|
|
230
245
|
| [`docs/input-preparation.md`](./docs/input-preparation.md) | The other direction — `uploadFile` and `prepareInputs`, which turn local files into references a run can take, and the upload grant a browser page sends a file with |
|
|
231
246
|
| [`docs/bundle-resources.md`](./docs/bundle-resources.md) | Sending the files a bundle's steps read, such as a `PipeDocGen` step's template, as `resources` beside its `.mthds` contents: where they go, what is refused and by whom, and the template check's warnings |
|
|
247
|
+
| [`docs/method-examples.md`](./docs/method-examples.md) | A method's saved examples: the create, the paged list and its iterator, the edit that raises the input revision, the latest-run write and its `recorded` or `stale` verdict, how an integer past `Number.MAX_SAFE_INTEGER` in the inputs stays exact, and what is refused before sending |
|
|
248
|
+
| [`docs/exact-integers.md`](./docs/exact-integers.md) | Which reads keep an integer past `Number.MAX_SAFE_INTEGER` exact, as a `bigint` (a run's inputs and outputs, an example's inputs), how a request body writes it back with its digits, and `parseExactJson` and `stringifyExactJson` for code showing such data as JSON text |
|
|
232
249
|
| [`docs/crate-routes.md`](./docs/crate-routes.md) | `resolve`, `codegen` and `pipeIo` — the normalized crate, the stamped types, and a method's I/O artifacts without a validation — and the offline `runCodegenCheck` that guards a committed tree |
|
|
233
250
|
| [`docs/client-identification.md`](./docs/client-identification.md) | The `User-Agent` every API request carries, and `appInfo`, the option that puts your program's name in front of it |
|
|
234
251
|
| [`docs/errors.md`](./docs/errors.md) | The verdict every error carries (`retryable`, `errorDomain`, `errorVerdictOf`), a failed run's stored error report on `RunFailedError` and `RunRead`, and every member of a refused request's `ApiResponseError`, with the fields to branch on |
|
package/dist/cli/present.d.ts
CHANGED
|
@@ -43,7 +43,8 @@ export declare function validationLine(item: Pick<ValidationErrorItem, "message"
|
|
|
43
43
|
export declare function isAbsence(mainStuff: unknown): boolean;
|
|
44
44
|
/**
|
|
45
45
|
* Print a finished run's main output on stdout, as the method produced it: indented JSON,
|
|
46
|
-
* unvalidated and unrepaired, a list included whichever shape it arrived in
|
|
47
|
-
*
|
|
46
|
+
* unvalidated and unrepaired, a list included whichever shape it arrived in, an integer past
|
|
47
|
+
* `Number.MAX_SAFE_INTEGER`, which the client reads as a `bigint`, printed with its exact digits.
|
|
48
|
+
* An output the method left absent prints `null`, and a line on stderr says so.
|
|
48
49
|
*/
|
|
49
50
|
export declare function printResult(mainStuff: unknown, io: CommandIO): void;
|
package/dist/cli/present.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* alone names what could not be read (`API POST /v1/start answered 202 with a body that is not
|
|
14
14
|
* JSON`). Both SDKs word those messages alike, and the case table holds the ones both meet.
|
|
15
15
|
*/
|
|
16
|
-
import { ApiResponseError, ApiUnreachableError, InputPreparationError, InvalidInputValueError, InvalidLocalSourceError, MethodLoadError, PipelineRequestError, RejectedAssetError, RunFailedError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, } from "../index.js";
|
|
16
|
+
import { ApiResponseError, ApiUnreachableError, InputPreparationError, InvalidInputValueError, InvalidLocalSourceError, MethodLoadError, PipelineRequestError, RejectedAssetError, RunFailedError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, stringifyExactJson, } from "../index.js";
|
|
17
17
|
import { CommandError, EXIT_FAILED, EXIT_USAGE } from "./io.js";
|
|
18
18
|
/** Word any failure for stderr and choose its exit code. */
|
|
19
19
|
export function presentError(error) {
|
|
@@ -189,8 +189,9 @@ export function isAbsence(mainStuff) {
|
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* Print a finished run's main output on stdout, as the method produced it: indented JSON,
|
|
192
|
-
* unvalidated and unrepaired, a list included whichever shape it arrived in
|
|
193
|
-
*
|
|
192
|
+
* unvalidated and unrepaired, a list included whichever shape it arrived in, an integer past
|
|
193
|
+
* `Number.MAX_SAFE_INTEGER`, which the client reads as a `bigint`, printed with its exact digits.
|
|
194
|
+
* An output the method left absent prints `null`, and a line on stderr says so.
|
|
194
195
|
*/
|
|
195
196
|
export function printResult(mainStuff, io) {
|
|
196
197
|
if (isAbsence(mainStuff)) {
|
|
@@ -203,6 +204,6 @@ export function printResult(mainStuff, io) {
|
|
|
203
204
|
}
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
206
|
-
io.writeStdout(`${
|
|
207
|
+
io.writeStdout(`${stringifyExactJson(mainStuff, 2)}\n`);
|
|
207
208
|
}
|
|
208
209
|
//# sourceMappingURL=present.js.map
|
package/dist/cli/present.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present.js","sourceRoot":"","sources":["../../src/cli/present.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"present.js","sourceRoot":"","sources":["../../src/cli/present.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,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AC,SAAS,CAAC,MAAM,CAAC,6BAA6B,CACjI,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,WAAW,CAAC,yDAAyD,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO;IACT,CAAC;IACD,EAAE,CAAC,WAAW,CAAC,GAAG,kBAAkB,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/cli/script.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { CommandIO } from "./io.js";
|
|
|
15
15
|
* update notice and npm 12's run notices off the script's stderr, which carries the command's
|
|
16
16
|
* own lines, while npm's warnings and errors still print.
|
|
17
17
|
*/
|
|
18
|
-
export declare const SCRIPT_RUNNER = "npx --yes --no-update-notifier --loglevel=warn @pipelex/sdk@0.
|
|
18
|
+
export declare const SCRIPT_RUNNER = "npx --yes --no-update-notifier --loglevel=warn @pipelex/sdk@0.43.0";
|
|
19
19
|
export declare const SCRIPT_WRITER = "@pipelex/sdk";
|
|
20
20
|
export declare const SCRIPT_NEEDS = "Node 22.12 or later";
|
|
21
21
|
/** Run `pipelex-sdk script` and return its exit code. */
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MTHDSProtocol, ModelCategory, ModelDeck, RunOptions, StartOptions, VersionInfo } from "mthds/protocol";
|
|
2
2
|
import type { CodegenRequest, CodegenResponse, DictPipeOutput, FormatResponse, LintResponse, ModelCheckCategory, ModelReferenceVerdict, MthdsFileItem, PipeIORequest, PipeIOResponse, PipelexRunResultStart, PipelexValidationResult, ResolveRequest, ResolveResponse, ValidateMethodSelector } from "./models.js";
|
|
3
3
|
import { type GetRunResultOptions, type RunRead, type RunResults, type RunResultState, type StartAndWaitForResultOptions, type WaitForResultOptions } from "./runs.js";
|
|
4
|
-
import type { BillingPortalResponse, ChangePlanResponse, CheckoutResponse, InvoiceView, Membership, MembershipsResponse, ListMethodsQuery, ListMethodVersionsQuery, MethodData, MethodDeletionAccepted, MethodDraftInput, MethodPage, MethodPublishInput, MethodPublishResult, MethodRenameInput, MethodSummary, MethodVersion, MethodVersionPage, MethodWriteInput, OnboardingSubmission, PipelexApiKeyCreated, PipelexApiKeyList, ListRunsQuery, RunHistoryItem, RunDetail, RunPage, PlanView, ResolvedStorageUrl, SubscriptionResponse, UpdateRunInput, UploadGrant, UploadGrantInput, UploadInput, UploadedFile, UserProfile } from "./product-models.js";
|
|
4
|
+
import type { BillingPortalResponse, ChangePlanResponse, CheckoutResponse, InvoiceView, Membership, MembershipsResponse, ListMethodExamplesQuery, ListMethodsQuery, ListMethodVersionsQuery, MethodData, MethodDeletionAccepted, MethodDraftInput, MethodExample, MethodExampleCreateInput, MethodExampleLatestRunInput, MethodExampleLatestRunResult, MethodExamplePage, MethodExampleUpdateInput, MethodPage, MethodPublishInput, MethodPublishResult, MethodRenameInput, MethodSummary, MethodVersion, MethodVersionPage, MethodWriteInput, OnboardingSubmission, PipelexApiKeyCreated, PipelexApiKeyList, ListRunsQuery, RunHistoryItem, RunDetail, RunPage, PlanView, ResolvedStorageUrl, SubscriptionResponse, UpdateRunInput, UploadGrant, UploadGrantInput, UploadInput, UploadedFile, UserProfile } from "./product-models.js";
|
|
5
5
|
import type { AppInfo } from "./user-agent.js";
|
|
6
6
|
import type { UploadableAsset, UploadFileOptions, UploadRecord } from "./upload.js";
|
|
7
7
|
import type { BundleResources } from "./bundle-resources.js";
|
|
@@ -270,14 +270,45 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
270
270
|
*/
|
|
271
271
|
private readStoredSources;
|
|
272
272
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* `
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
273
|
+
* A verdict, the `200` a route answers discriminated on `outcome` with the object the verdict
|
|
274
|
+
* is about as one `member`: `publishMethod`'s `method`, `recordMethodExampleLatestRun`'s
|
|
275
|
+
* `example`. The answer is read as `readObjectAnswer` reads it, then an `outcome` that is none
|
|
276
|
+
* of `outcomes` is an answer the SDK cannot read, and so is a `member` that is not an object,
|
|
277
|
+
* the check `readObjectAnswerAt` holds a route's whole answer to: each throws the
|
|
278
|
+
* `ApiResponseError` `unreadableAnswer` builds, `verdict` naming the answer in the message.
|
|
279
|
+
* A route whose member has a reader of its own passes it as `readMember`, which then checks the
|
|
280
|
+
* member in place of that object check, so the member is checked once. `parse` reads the
|
|
281
|
+
* answer's text, `readJson` unless the route names another. Returns the answer, its `outcome`
|
|
282
|
+
* and the member as `subject`, for the route to read further.
|
|
283
|
+
*/
|
|
284
|
+
private readVerdict;
|
|
285
|
+
/**
|
|
286
|
+
* One page of a cursor-paged product route (`listMethods`, `listMethodVersions`,
|
|
287
|
+
* `listMethodExamples`, `listRuns`), read as the platform always serializes it: `items` an
|
|
288
|
+
* array, `next_cursor` a string or `null`. A page breaking either is an answer the SDK cannot
|
|
289
|
+
* read, so it throws the `ApiResponseError` `unreadableAnswer` builds, `runtime` and not
|
|
290
|
+
* retryable, rather than handing the iterators a page they cannot walk: `items` that is not
|
|
291
|
+
* iterable, or a missing cursor that is neither the end nor a next page, which `iterateRuns`
|
|
292
|
+
* would follow forever. A route reading its rows itself passes `rows`: `parse` reads the page's
|
|
293
|
+
* text, and `item` reads each row, throwing as `unreadableAnswer` does for one it cannot read.
|
|
279
294
|
*/
|
|
280
295
|
private requestPage;
|
|
296
|
+
/**
|
|
297
|
+
* A route answering one method example (`createMethodExample`, `getMethodExample`,
|
|
298
|
+
* `updateMethodExample`), its answer read with `parseExactJson`, so an integer past the safe
|
|
299
|
+
* range in the inputs is a `bigint` holding its exact digits, and checked by
|
|
300
|
+
* `readMethodExample`.
|
|
301
|
+
*/
|
|
302
|
+
private requestMethodExample;
|
|
303
|
+
/**
|
|
304
|
+
* A method example as `res` carried it, checked against `METHOD_EXAMPLE_FIELDS`: a value that
|
|
305
|
+
* is not an object, or that misses a field the Python SDK's model requires or holds one of
|
|
306
|
+
* another type, is an answer the SDK cannot read, thrown as the `ApiResponseError`
|
|
307
|
+
* `unreadableAnswer` builds, `where` naming the example's place in the answer in the message.
|
|
308
|
+
* Every route answering an example reads it here, the page rows and the latest-run verdict's
|
|
309
|
+
* member included.
|
|
310
|
+
*/
|
|
311
|
+
private readMethodExample;
|
|
281
312
|
/** Issue a product request and return its 2xx answer, a non-2xx thrown as `ApiResponseError`. */
|
|
282
313
|
private requestProductAnswer;
|
|
283
314
|
private throwApiResponseError;
|
|
@@ -287,9 +318,11 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
287
318
|
private readObjectAnswer;
|
|
288
319
|
/**
|
|
289
320
|
* The JSON body of a 2xx answer, naming the route by its `path` from the origin as a refusal
|
|
290
|
-
* does
|
|
291
|
-
*
|
|
292
|
-
*
|
|
321
|
+
* does, its text read by `parse`: `JSON.parse`, or `parseExactJson` for an answer carrying a
|
|
322
|
+
* person's data. A body that is not UTF-8, or not JSON, an empty one included, is an answer the
|
|
323
|
+
* SDK cannot read, so it throws the `ApiResponseError` `unreadableAnswer` builds, with the parse
|
|
324
|
+
* failure as `cause`; so is a body holding a number `parseExactJson` cannot read exactly on this
|
|
325
|
+
* runtime (`ExactJsonUnsupportedError`), rather than read rounded.
|
|
293
326
|
* The one place a success body is parsed.
|
|
294
327
|
*/
|
|
295
328
|
private readAnswerAt;
|
|
@@ -354,6 +387,9 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
354
387
|
* that exceeds that surfaces as `PipelineExecuteTimeoutError` pointing at the
|
|
355
388
|
* durable start+poll path. Throws `RunStillRunningError` on the protocol's
|
|
356
389
|
* optional 202 degrade.
|
|
390
|
+
*
|
|
391
|
+
* The answer is read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the
|
|
392
|
+
* working memory, the main output included, is a `bigint` holding its exact digits.
|
|
357
393
|
*/
|
|
358
394
|
execute(options: PipelexRunOptions): Promise<PipelexExecuteResult>;
|
|
359
395
|
/**
|
|
@@ -676,6 +712,11 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
676
712
|
* before any request. `MissingMainStuffError` is thrown only for a read that asked
|
|
677
713
|
* for `main_stuff` — no selection, or one naming it.
|
|
678
714
|
*
|
|
715
|
+
* A completed result is read with `parseExactJson`, so an integer past
|
|
716
|
+
* `Number.MAX_SAFE_INTEGER` anywhere in it, the main output, the working memory and the graph
|
|
717
|
+
* included, is a `bigint` holding its exact digits, and an output passed back to `start` goes
|
|
718
|
+
* back as the run produced it.
|
|
719
|
+
*
|
|
679
720
|
* Throws `RunLifecycleUnavailableError` when the lifecycle routes are absent
|
|
680
721
|
* (a bare runner).
|
|
681
722
|
*/
|
|
@@ -790,7 +831,9 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
790
831
|
* Takes a bare catalog id: the method routes address the method itself, never a version of
|
|
791
832
|
* it. A caller holding `mt_…@3` strips the suffix with `parseMethodSelector` and reads that
|
|
792
833
|
* version with `getMethodVersion`. Every method route throws `RequestArgumentError` for a
|
|
793
|
-
* suffixed id, before any request, rather than read back the `404` the platform would answer
|
|
834
|
+
* suffixed id, before any request, rather than read back the `404` the platform would answer,
|
|
835
|
+
* and for an id that is empty, `.` or `..`, which the URL would resolve into another route's
|
|
836
|
+
* path.
|
|
794
837
|
*/
|
|
795
838
|
getMethod(methodId: string): Promise<MethodData>;
|
|
796
839
|
/**
|
|
@@ -938,6 +981,124 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
938
981
|
* as `getMethod` does: the whole method is erased, never one of its versions.
|
|
939
982
|
*/
|
|
940
983
|
deleteMethod(methodId: string): Promise<MethodDeletionAccepted>;
|
|
984
|
+
/**
|
|
985
|
+
* Save an example on a method — `POST /v1/methods/{id}/examples`: a named set of inputs, and
|
|
986
|
+
* with `run_id`, a run of this method that used exactly those inputs, recorded as its latest
|
|
987
|
+
* run. Answers the example as stored, at `input_revision` 1.
|
|
988
|
+
*
|
|
989
|
+
* Sends `name`, `inputs` and, when given, `run_id`, and nothing else: the route's body is
|
|
990
|
+
* closed, and a `null` `run_id` reads as not given. Throws `RequestArgumentError` before any
|
|
991
|
+
* request when `name` or `inputs` is not given (`null` counting as not given), and for a
|
|
992
|
+
* `run_id` that is given but is not a non-empty string. Throws `ApiResponseError`: `404`
|
|
993
|
+
* `run_not_found` for a `run_id` that is not one of this method's runs in the caller's
|
|
994
|
+
* organization, with nothing written; `413` `payload_too_large` for an example larger than one
|
|
995
|
+
* stored item holds; `422` for a name that is empty, blank or over 200 characters, or inputs
|
|
996
|
+
* that are not a JSON object; and the codes every example route answers.
|
|
997
|
+
*/
|
|
998
|
+
createMethodExample(methodId: string, input: MethodExampleCreateInput): Promise<MethodExample>;
|
|
999
|
+
/**
|
|
1000
|
+
* One page of a method's examples, oldest first, inputs included —
|
|
1001
|
+
* `GET /v1/methods/{id}/examples`.
|
|
1002
|
+
*
|
|
1003
|
+
* Pass the page's `nextCursor` back as `cursor` to continue; `null` is the last page. A page
|
|
1004
|
+
* may be short while `nextCursor` is set, because the platform reads examples whole and stops
|
|
1005
|
+
* a read at 1 MB; `iterateMethodExamples` follows the cursor for a caller that wants them all.
|
|
1006
|
+
*
|
|
1007
|
+
* Throws `ApiResponseError`: `400` `malformed_request` for a cursor the listing did not issue
|
|
1008
|
+
* for this method, `422` for a `limit` outside 1 to 100, and the codes every example route
|
|
1009
|
+
* answers. A page whose `items` is not an array, whose `next_cursor` is neither a string nor
|
|
1010
|
+
* `null`, or one of whose items is not an example `readMethodExample` can read, is an answer
|
|
1011
|
+
* the SDK cannot read, thrown as an `ApiResponseError` too. An example whose inputs hold an
|
|
1012
|
+
* integer past the safe range is read like any other, that integer as a `bigint`.
|
|
1013
|
+
*/
|
|
1014
|
+
listMethodExamples(methodId: string, query?: ListMethodExamplesQuery): Promise<MethodExamplePage>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Every example of a method, oldest first, streamed — follows the cursor of
|
|
1017
|
+
* `listMethodExamples` for you.
|
|
1018
|
+
*
|
|
1019
|
+
* ```ts
|
|
1020
|
+
* for await (const example of client.iterateMethodExamples(methodId)) {
|
|
1021
|
+
* rerun(example); // stop whenever you like
|
|
1022
|
+
* }
|
|
1023
|
+
* ```
|
|
1024
|
+
*
|
|
1025
|
+
* An iterator rather than an all-at-once list, for the reason `iterateMethods` is one: a
|
|
1026
|
+
* helper returning an array needs a page cap, and a cap returns a truncated list with no
|
|
1027
|
+
* error. It runs the same loop as `iterateMethods` and `iterateRuns`, so it keeps going through
|
|
1028
|
+
* a short or empty page that carries a cursor, stops on a `null` cursor or on a cursor the
|
|
1029
|
+
* server failed to advance, and throws `PagingNotTerminatingError` past the same page ceiling.
|
|
1030
|
+
*
|
|
1031
|
+
* Throws `RequestArgumentError` at the call, before the iterator is pulled or anything is sent,
|
|
1032
|
+
* for a method id `listMethodExamples` refuses: a suffixed one, or one that is empty, `.` or `..`
|
|
1033
|
+
* or holds a lone surrogate.
|
|
1034
|
+
*/
|
|
1035
|
+
iterateMethodExamples(methodId: string, query?: Omit<ListMethodExamplesQuery, "cursor">): AsyncGenerator<MethodExample, void, undefined>;
|
|
1036
|
+
/**
|
|
1037
|
+
* One example of a method — `GET /v1/methods/{id}/examples/{example_id}`, read consistently,
|
|
1038
|
+
* so an example saved a moment ago is found.
|
|
1039
|
+
*
|
|
1040
|
+
* Throws `RequestArgumentError` for an example id that is empty, `.` or `..`, or holds a lone
|
|
1041
|
+
* surrogate, before any request. Throws `ApiResponseError`: `422` for an example id longer
|
|
1042
|
+
* than one can be (64 characters), and the codes every example route answers.
|
|
1043
|
+
*/
|
|
1044
|
+
getMethodExample(methodId: string, exampleId: string): Promise<MethodExample>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Rename an example, give it new inputs, or both —
|
|
1047
|
+
* `PATCH /v1/methods/{id}/examples/{example_id}` — and return it as it now stands.
|
|
1048
|
+
*
|
|
1049
|
+
* **New inputs raise `input_revision` by one and clear `latest_run_id`**, since the run no
|
|
1050
|
+
* longer shows what the inputs produce; inputs that are the same as the stored ones, their
|
|
1051
|
+
* keys in another order included, change nothing, while `3` becoming `3.0` is a change. A
|
|
1052
|
+
* rename alone keeps both. The edit takes no revision or token: the latest-run write is what
|
|
1053
|
+
* the revision guards. Sends `name` and `inputs` when given, and nothing else; `null` reads as
|
|
1054
|
+
* not given, as the platform reads it.
|
|
1055
|
+
*
|
|
1056
|
+
* **Send `inputs` only when they changed.** Inputs read from an example and sent back unchanged
|
|
1057
|
+
* are a change for the platform when they hold a float with no fractional part, `3.0`, which
|
|
1058
|
+
* JavaScript reads as `3` (see `MethodExample.inputs`): they raise the revision and clear the
|
|
1059
|
+
* latest run. A rename sent alone never does. An integer past `Number.MAX_SAFE_INTEGER` is no
|
|
1060
|
+
* such case: it reads as a `bigint` and is sent back as its exact digits.
|
|
1061
|
+
*
|
|
1062
|
+
* Throws `RequestArgumentError` before any request for an example id that is empty, `.` or
|
|
1063
|
+
* `..`, or when neither `name` nor `inputs` is given. Throws `ApiResponseError`: `413`
|
|
1064
|
+
* `payload_too_large` for inputs larger than one stored item holds, `422` for a name that is
|
|
1065
|
+
* empty, blank or over 200 characters, or inputs that are not a JSON object, a `503` that wrote
|
|
1066
|
+
* nothing, safe to retry, when concurrent edits kept landing under the write, and the codes
|
|
1067
|
+
* every example route answers.
|
|
1068
|
+
*/
|
|
1069
|
+
updateMethodExample(methodId: string, exampleId: string, input: MethodExampleUpdateInput): Promise<MethodExample>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Record a run as an example's latest —
|
|
1072
|
+
* `PUT /v1/methods/{id}/examples/{example_id}/latest-run` — **only while the example still
|
|
1073
|
+
* holds the revision whose inputs the run used**.
|
|
1074
|
+
*
|
|
1075
|
+
* `input_revision` is the example's `input_revision` the caller read when it started the run
|
|
1076
|
+
* with the example's inputs; the platform trusts it and does not compare the run's own inputs.
|
|
1077
|
+
* The answer is a `MethodExampleLatestRunResult` discriminated on `outcome` — branch on it:
|
|
1078
|
+
* `recorded`, the run is now the example's latest; `stale`, the example's inputs were edited
|
|
1079
|
+
* since and nothing was written. A stale run is the expected end of a run that outlasted an
|
|
1080
|
+
* edit, so it is answered, never thrown. Both arms carry the `example` as it stands.
|
|
1081
|
+
*
|
|
1082
|
+
* Throws `RequestArgumentError` before any request, checking in this order: an example id that
|
|
1083
|
+
* is empty, `.` or `..`, or holds a lone surrogate, a `run_id` that is not a non-empty string,
|
|
1084
|
+
* and an `input_revision` that is not a positive integer. Throws `ApiResponseError` when no
|
|
1085
|
+
* verdict was produced: `404` `not_found` for an example deleted since, `404` `run_not_found`
|
|
1086
|
+
* for a run that is not one of this method's, with nothing written, and the codes every example
|
|
1087
|
+
* route answers. An answer whose `outcome` is neither arm's, or whose `example` is not an
|
|
1088
|
+
* example `readMethodExample` can read, is an answer the SDK cannot read, thrown as an
|
|
1089
|
+
* `ApiResponseError` too, read as `publishMethod` reads its verdict.
|
|
1090
|
+
*/
|
|
1091
|
+
recordMethodExampleLatestRun(methodId: string, exampleId: string, input: MethodExampleLatestRunInput): Promise<MethodExampleLatestRunResult>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Delete an example — `DELETE /v1/methods/{id}/examples/{example_id}`. The platform answers
|
|
1094
|
+
* `204`. Deleting the example leaves its latest run in the method's history.
|
|
1095
|
+
*
|
|
1096
|
+
* Throws `RequestArgumentError` for an example id that is empty, `.` or `..`, before any
|
|
1097
|
+
* request: `..` would address the method, and its erasure would answer the delete. Throws
|
|
1098
|
+
* `ApiResponseError`: `404` `not_found` when there is no such example, one already deleted
|
|
1099
|
+
* included, and the codes every example route answers.
|
|
1100
|
+
*/
|
|
1101
|
+
deleteMethodExample(methodId: string, exampleId: string): Promise<void>;
|
|
941
1102
|
/** The caller's org memberships + active-org feature flags — `GET /v1/organizations/memberships`. */
|
|
942
1103
|
listMemberships(): Promise<MembershipsResponse>;
|
|
943
1104
|
/** Create an organization — `POST /v1/organizations`. */
|
|
@@ -1169,6 +1330,10 @@ export declare class PipelexApiClient implements MTHDSProtocol<DictPipeOutput> {
|
|
|
1169
1330
|
* executed) and `inputs`. Kept off the status read, which pollers hit every
|
|
1170
1331
|
* few seconds. A failed run's stored report, `error`, is checked field by
|
|
1171
1332
|
* field (see `RunErrorReport`).
|
|
1333
|
+
*
|
|
1334
|
+
* Read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the inputs is a
|
|
1335
|
+
* `bigint` holding its exact digits, and the inputs passed back to `start` or saved as an
|
|
1336
|
+
* example's go back as the run used them.
|
|
1172
1337
|
*/
|
|
1173
1338
|
getRunDetail(runId: string): Promise<RunDetail>;
|
|
1174
1339
|
/** Patch a run's status (admin/manual) — `PUT /v1/runs/{id}`. */
|