@pipelex/sdk 0.65.0 → 0.67.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 +10 -0
- package/dist/cli/script.d.ts +1 -1
- package/dist/client.d.ts +157 -3
- package/dist/client.js +229 -6
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js.map +1 -1
- package/dist/method-showcases.d.ts +169 -0
- package/dist/method-showcases.js +139 -0
- package/dist/method-showcases.js.map +1 -0
- package/dist/product-models.d.ts +31 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +4 -2
- package/docs/errors.md +1 -1
- package/docs/method-copy.md +1 -1
- package/docs/method-examples.md +1 -0
- package/docs/method-layouts.md +9 -1
- package/docs/method-showcases.md +100 -0
- package/docs/public-methods.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -203,6 +203,15 @@ const { items: laidOutPages } = await client.listMethodLayouts(created.method_id
|
|
|
203
203
|
console.log(laidOutPages.length);
|
|
204
204
|
await client.setMethodLayoutsOff(created.method_id, ["composer"]);
|
|
205
205
|
|
|
206
|
+
// A completed run frozen as a showcase, which readers of a published version look at for free.
|
|
207
|
+
const verdict = await client.freezeMethodShowcase(created.method_id, {
|
|
208
|
+
run_id: "run_123",
|
|
209
|
+
name: "A first example",
|
|
210
|
+
});
|
|
211
|
+
if (verdict.outcome === "refused") console.log(verdict.reason, verdict.message);
|
|
212
|
+
const { items: showcases } = await client.listMethodVersionShowcases(created.method_id, 1);
|
|
213
|
+
console.log(showcases.length);
|
|
214
|
+
|
|
206
215
|
// The template catalog: the public methods every organization reads, in the platform's order, with
|
|
207
216
|
// the categories that have a template and each card's thumbnails behind short-lived links. A
|
|
208
217
|
// category's `labels` name it by language tag and may lack a language, in which case a client
|
|
@@ -328,6 +337,7 @@ These pages ship inside the published package, so a reader who has only installe
|
|
|
328
337
|
| [`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, the build assistant's save and its `kept` or `created` verdict, how an integer past `Number.MAX_SAFE_INTEGER` in the inputs stays exact, and what is refused before sending |
|
|
329
338
|
| [`docs/method-copy.md`](./docs/method-copy.md) | Copying a method into another organization or duplicating it: what a copy holds and the stored files it copies, the `copied` or `refused` verdict, every refusal, the copy's idempotency key, and `copied_from` |
|
|
330
339
|
| [`docs/method-layouts.md`](./docs/method-layouts.md) | A method's stored layouts: `storeMethodLayout`, which stores a layout designed for one pipe of a published version, its closed body and its refusals, the layout, its provenance and its written sample, `listMethodLayouts`, which reads a version's layouts with no dry run, `setMethodLayoutsOff`, which switches a page's design off, and the `layouts` a validate by `method_id` carries when `views` names `layouts`, absent when there are none |
|
|
340
|
+
| [`docs/method-showcases.md`](./docs/method-showcases.md) | A method's showcases, completed runs frozen with a private copy of their files: `freezeMethodShowcase` and its verdict, `withdrawMethodShowcase`, the holder's reads (`listMethodShowcases`, `getMethodShowcase`) and every reader's reads of a published version (`listMethodVersionShowcases`, `getMethodVersionShowcase`) |
|
|
331
341
|
| [`docs/public-methods.md`](./docs/public-methods.md) | Public methods and the template catalog: `listMethodTemplates` and its iterator, the ordering, the categories with their labels by language and `listMethodCategories`, the thumbnails' links, another organization's public method read in its narrower shape, the copy of a public method, `visibility` and `categories` on a method, and the refusals a public method's publish adds |
|
|
332
342
|
| [`docs/organization-branding.md`](./docs/organization-branding.md) | An organization's logos, colours, app style and typeface, and its white-label entitlement: `getBranding`, which every member and API key reads, `updateOrganizationBranding`, a write by the `admin` or the `member` role that sets, clears or keeps each key, and how a refused logo, colour, style or typeface names its field so a settings screen shows the sentence under it |
|
|
333
343
|
| [`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 |
|
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.67.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,6 +1,7 @@
|
|
|
1
1
|
import type { MTHDSProtocol, ModelCategory, ModelDeck, RunOptions, StartOptions, VersionInfo } from "mthds/protocol";
|
|
2
2
|
import type { CodegenRequest, CodegenResponse, CrateRouteOptions, DictPipeOutput, FormatResponse, LintResponse, ModelCheckCategory, ModelReferenceVerdict, PipeIORequest, PipeIOResponse, PipelexRunResultStart, PipelexValidateSource, PipelexValidationResult, ResolveRequest, ResolveResponse, ValidateMethodSelector, ValidateView } from "./models.js";
|
|
3
3
|
import type { MethodLayout, MethodLayoutInput, MethodLayoutList } from "./method-layouts.js";
|
|
4
|
+
import type { MethodShowcaseDetail, MethodShowcaseFreezeResult, MethodShowcaseInput, MethodShowcaseList } from "./method-showcases.js";
|
|
4
5
|
import { type GetRunResultOptions, type RunProgress, type RunRead, type RunResults, type RunResultState, type StartAndWaitForResultOptions, type WaitForResultOptions } from "./runs.js";
|
|
5
6
|
import type { BillingPortalResponse, ChangePlanResponse, CheckoutResponse, DraftFileFromFileInput, DraftFileFromFileResult, FileArchive, FileArchiveRequest, FileDetail, FileLinkTarget, FileLinksResult, FilePage, FileRecord, FileRecordList, FileRenameInput, FileSummary, GetFileQuery, GetFilesByUriOptions, InvoiceView, Membership, MembershipsResponse, OrganizationBranding, OrganizationBrandingUpdate, ListFilesQuery, ListMethodExamplesQuery, ListMethodsQuery, ListMethodTemplatesQuery, ListMethodVersionsQuery, ListRunFilesQuery, MethodCategoryList, MethodCopyInput, MethodCopyResult, MethodData, MethodDeletionAccepted, MethodDetail, MethodDraftInput, MethodExample, MethodExampleAssistantSaveInput, MethodExampleAssistantSaveResult, MethodExampleCreateInput, MethodExampleLatestRunInput, MethodExampleLatestRunResult, MethodExamplePage, MethodExampleUpdateInput, MethodPage, MethodPublishInput, MethodPublishResult, MethodRenameInput, MethodSummary, MethodTemplate, MethodTemplatePage, MethodVersion, MethodVersionPage, MethodWriteInput, OnboardingSubmission, PublicMethodDetail, PipelexApiKeyCreated, PipelexApiKeyList, ListRunsQuery, RunHistoryItem, RunDetail, RunFilesPage, RunPage, PlanView, ResolvedStorageUrl, SavedMethodFile, SubscriptionResponse, UpdateRunInput, UploadGrant, UploadGrantInput, UploadInput, UploadedFile, UserProfile } from "./product-models.js";
|
|
6
7
|
import type { MethodTreeForms, MethodTreeLimits } from "./method-trees.js";
|
|
@@ -182,6 +183,29 @@ export interface MethodLayoutListOptions {
|
|
|
182
183
|
*/
|
|
183
184
|
signal?: AbortSignal;
|
|
184
185
|
}
|
|
186
|
+
/** Options for the reads of a method's showcases. */
|
|
187
|
+
export interface MethodShowcaseReadOptions {
|
|
188
|
+
/**
|
|
189
|
+
* Caller-driven cancellation, such as an `AbortSignal.timeout(…)` for a page that can do without
|
|
190
|
+
* the showcases; the abort reason propagates untouched.
|
|
191
|
+
*/
|
|
192
|
+
signal?: AbortSignal;
|
|
193
|
+
}
|
|
194
|
+
/** Options for `freezeMethodShowcase` and `withdrawMethodShowcase`. */
|
|
195
|
+
export interface MethodShowcaseWriteOptions {
|
|
196
|
+
/**
|
|
197
|
+
* The write's idempotency key, sent as the `Idempotency-Key` header, and not sent at all when
|
|
198
|
+
* absent or `null`. Generate one per write the caller means to make (a `crypto.randomUUID()` is a
|
|
199
|
+
* good key), and keep it, with the arguments unchanged, across that write's retries.
|
|
200
|
+
*
|
|
201
|
+
* A freeze sent again without a key is safe in itself, since freezing a run already frozen
|
|
202
|
+
* answers `unchanged`. A withdrawal sent again without one answers a `404`, so a withdrawal whose
|
|
203
|
+
* answer was lost, as on a client timeout, reads as a failure: under the same key the hosted API
|
|
204
|
+
* answers the retry with the first write's stored answer and runs nothing. The rest of the rule,
|
|
205
|
+
* a key's form and its `409`s included, is `MethodLayoutWriteOptions.idempotencyKey`'s.
|
|
206
|
+
*/
|
|
207
|
+
idempotencyKey?: string | null;
|
|
208
|
+
}
|
|
185
209
|
/** Options for `setMethodLayoutsOff`. */
|
|
186
210
|
export interface MethodLayoutsOffOptions {
|
|
187
211
|
/**
|
|
@@ -340,7 +364,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
340
364
|
* whose errors then say whether it may have (see `RunCreation`).
|
|
341
365
|
* `idempotencyKey`, already checked by `idempotencyKeyOf`, is sent as the
|
|
342
366
|
* `Idempotency-Key` header; only `start`, `copyMethod`, `storeMethodLayout`,
|
|
343
|
-
* `setMethodLayoutsOff`, `
|
|
367
|
+
* `setMethodLayoutsOff`, `freezeMethodShowcase`, `withdrawMethodShowcase`, `rotateWebhookSecret`
|
|
368
|
+
* and `replayRunWebhookDelivery` pass one.
|
|
344
369
|
*/
|
|
345
370
|
private requestRaw;
|
|
346
371
|
/**
|
|
@@ -1355,6 +1380,11 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1355
1380
|
* `422` for an empty name or one holding a lone surrogate, `413` `request.too_large` for a name
|
|
1356
1381
|
* so long it would leave the method too large to publish, and a `503` that wrote nothing, safe
|
|
1357
1382
|
* to retry, when draft writes kept landing under the rename.
|
|
1383
|
+
*
|
|
1384
|
+
* `expected_name` makes the rename conditional on the name the caller read: a method no longer
|
|
1385
|
+
* named so is a `409` `pipelex.catalog.update_conflict` whose `location.field` is
|
|
1386
|
+
* `expected_name`, and nothing is written. A client applying a name nobody typed, such as a
|
|
1387
|
+
* proposed one, uses it so that a name a person set meanwhile is never overwritten.
|
|
1358
1388
|
*/
|
|
1359
1389
|
renameMethod(methodId: string, input: MethodRenameInput): Promise<MethodData>;
|
|
1360
1390
|
/**
|
|
@@ -1370,7 +1400,7 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1370
1400
|
* `refused` with a `reason`, a `message` and the runner's `validation` verdict, whose problem
|
|
1371
1401
|
* items are read member by member as `validate` reads them. The reason is `invalid`, or
|
|
1372
1402
|
* `not_runnable` for a draft that validates with pending signatures, and for a public method
|
|
1373
|
-
* also `thumbnail_missing`, `thumbnail_invalid` or `
|
|
1403
|
+
* also `thumbnail_missing`, `thumbnail_invalid`, `storage_reference` or `showcase_missing` (see
|
|
1374
1404
|
* `MethodPublishRefusalReason`); a reason this SDK does not know is passed through as its raw
|
|
1375
1405
|
* string, still a verdict, so show its `message`. Every arm carries the `method`. A publish
|
|
1376
1406
|
* moves no token.
|
|
@@ -1498,6 +1528,129 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1498
1528
|
* never costs the caller the others.
|
|
1499
1529
|
*/
|
|
1500
1530
|
listMethodLayouts(methodId: string, version: number, options?: MethodLayoutListOptions): Promise<MethodLayoutList>;
|
|
1531
|
+
/**
|
|
1532
|
+
* The layouts stored for the content of a method's draft — `GET /v1/methods/{id}/draft/layouts` —
|
|
1533
|
+
* newest first, `items` empty for an empty draft or a draft none was designed for. A layout is
|
|
1534
|
+
* keyed by its content, so a draft holding a published tree finds that tree's layouts here, and a
|
|
1535
|
+
* builder sees the designs of what it is editing.
|
|
1536
|
+
*
|
|
1537
|
+
* It reads for the organization that holds the method alone, since a draft is its holder's. Takes
|
|
1538
|
+
* a bare catalog id, as `getMethod` does. `options.signal` cancels the read. Throws
|
|
1539
|
+
* `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the organization does not
|
|
1540
|
+
* hold, another organization's public one included, and `409` `pipelex.catalog.being_deleted`
|
|
1541
|
+
* while its erasure is pending, under way or stopped. An answer whose `items` is not an array is
|
|
1542
|
+
* an answer the SDK cannot read, thrown as an `ApiResponseError` too; an entry that does not read
|
|
1543
|
+
* as a layout is left out (`readMethodLayouts`).
|
|
1544
|
+
*/
|
|
1545
|
+
listMethodDraftLayouts(methodId: string, options?: MethodLayoutListOptions): Promise<MethodLayoutList>;
|
|
1546
|
+
/** The `{items}` of a route answering layouts, each entry read as `readMethodLayouts` reads it. */
|
|
1547
|
+
private requestMethodLayoutList;
|
|
1548
|
+
/**
|
|
1549
|
+
* Freeze a completed run of a method into a showcase — `POST /v1/methods/{id}/showcases` — and
|
|
1550
|
+
* answer what the freeze did.
|
|
1551
|
+
*
|
|
1552
|
+
* A showcase is real output, frozen: the run's inputs, its main output, the forms and contracts
|
|
1553
|
+
* that describe them, and a private copy of every stored file they name. It is keyed by the
|
|
1554
|
+
* digest of the run's tree, so a builder freezes a run of the draft before publishing it, and
|
|
1555
|
+
* another organization reads it only through a published version holding that tree. The run must
|
|
1556
|
+
* be this method's, completed and with stored results, and its tree must be the draft's or the
|
|
1557
|
+
* latest published version's.
|
|
1558
|
+
*
|
|
1559
|
+
* The answer is a `MethodShowcaseFreezeResult`, a `200` discriminated on `outcome` — branch on it:
|
|
1560
|
+
* `frozen` with the new `showcase`; `unchanged` with the one that stands, when this run is already
|
|
1561
|
+
* a showcase, whatever has happened to its tree since, the name in the request being ignored; or
|
|
1562
|
+
* `refused` with a `reason` and a `message`, nothing written (`MethodShowcaseRefusalReason`, read
|
|
1563
|
+
* open, so a later reason arrives as its raw string).
|
|
1564
|
+
*
|
|
1565
|
+
* The write changes the method, so it takes an `admin` or a `member` of the method's organization.
|
|
1566
|
+
* Takes a bare catalog id, as `getMethod` does. Sends `run_id` and `name` and nothing else, the
|
|
1567
|
+
* body being closed. `options.idempotencyKey` is sent as the `Idempotency-Key` header
|
|
1568
|
+
* (`MethodShowcaseWriteOptions`). Throws `RequestArgumentError` before any request for a `run_id`
|
|
1569
|
+
* or a `name` that is not a non-empty string, and for a malformed idempotency key. Throws
|
|
1570
|
+
* `ApiResponseError` when no verdict was produced: `403` `auth.forbidden` for a `runner`; `404`
|
|
1571
|
+
* `pipelex.catalog.not_found` for a method the organization does not hold; `409`
|
|
1572
|
+
* `pipelex.catalog.being_deleted` while its erasure is pending, under way or stopped; `422`
|
|
1573
|
+
* `request.invalid` for a body that does not validate; and `503` `runtime.unavailable`, with
|
|
1574
|
+
* `retry` `yes`, past the freeze's deadline. An answer that is none of the verdict's arms is an
|
|
1575
|
+
* answer the SDK cannot read, thrown as an `ApiResponseError` too.
|
|
1576
|
+
*/
|
|
1577
|
+
freezeMethodShowcase(methodId: string, input: MethodShowcaseInput, options?: MethodShowcaseWriteOptions): Promise<MethodShowcaseFreezeResult>;
|
|
1578
|
+
/**
|
|
1579
|
+
* Withdraw a showcase — `DELETE /v1/methods/{id}/showcases/{showcase_id}`. The platform answers
|
|
1580
|
+
* `204`, the row going first, so every read closes at once, and then its stored document and
|
|
1581
|
+
* files. It runs no check, even on a public method's last showcase, because taking down something
|
|
1582
|
+
* published by mistake is never refused; the method then stays public and its next publish needs
|
|
1583
|
+
* a showcase. What another organization already copied stays theirs.
|
|
1584
|
+
*
|
|
1585
|
+
* `options.idempotencyKey` is sent as the `Idempotency-Key` header, so a withdrawal whose answer
|
|
1586
|
+
* was lost is sent again under the same key and answered as the first was
|
|
1587
|
+
* (`MethodShowcaseWriteOptions`). Throws `RequestArgumentError` before any request for a showcase
|
|
1588
|
+
* id that is empty, `.` or `..`, or holds a lone surrogate, and for a malformed idempotency key.
|
|
1589
|
+
* Throws `ApiResponseError`: `404` `pipelex.catalog.not_found`, its `params.resource` `example`,
|
|
1590
|
+
* when there is no such showcase, one already withdrawn included; `403` `auth.forbidden` for a
|
|
1591
|
+
* `runner`; and `422` `request.invalid` for an id that is not one a showcase can have.
|
|
1592
|
+
*/
|
|
1593
|
+
withdrawMethodShowcase(methodId: string, showcaseId: string, options?: MethodShowcaseWriteOptions): Promise<void>;
|
|
1594
|
+
/**
|
|
1595
|
+
* Every showcase of a method the caller's organization holds, across every tree, each naming its
|
|
1596
|
+
* digest, oldest first — `GET /v1/methods/{id}/showcases`.
|
|
1597
|
+
*
|
|
1598
|
+
* It reads for the holding organization's members alone: another organization reads a `404`,
|
|
1599
|
+
* public method or not, and reads a public method's showcases through
|
|
1600
|
+
* `listMethodVersionShowcases`. Takes a bare catalog id, as `getMethod` does. `options.signal`
|
|
1601
|
+
* cancels the read. Throws `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the
|
|
1602
|
+
* organization does not hold and `409` `pipelex.catalog.being_deleted` while its erasure is
|
|
1603
|
+
* pending, under way or stopped. An answer whose `items` is not an array is an answer the SDK
|
|
1604
|
+
* cannot read, thrown as an `ApiResponseError` too; an entry that does not read as a summary is
|
|
1605
|
+
* left out (`readMethodShowcaseSummaries`).
|
|
1606
|
+
*/
|
|
1607
|
+
listMethodShowcases(methodId: string, options?: MethodShowcaseReadOptions): Promise<MethodShowcaseList>;
|
|
1608
|
+
/**
|
|
1609
|
+
* One showcase of a method the caller's organization holds, in full, with a short-lived link to
|
|
1610
|
+
* each of its files — `GET /v1/methods/{id}/showcases/{showcase_id}`. Read with `parseExactJson`,
|
|
1611
|
+
* so an integer past `Number.MAX_SAFE_INTEGER` in its document is a `bigint`.
|
|
1612
|
+
*
|
|
1613
|
+
* It reads for the holding organization's members alone. Takes a bare catalog id, as `getMethod`
|
|
1614
|
+
* does, and refuses a showcase id as `withdrawMethodShowcase` does, before any request. Throws
|
|
1615
|
+
* `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the organization does not
|
|
1616
|
+
* hold and for a showcase it does not have, the latter's `params.resource` being `example`, and
|
|
1617
|
+
* `409` `pipelex.catalog.being_deleted` while its erasure is pending, under way or stopped. An
|
|
1618
|
+
* answer that does not read as a detail (`methodShowcaseDetailFault`) is an answer the SDK cannot
|
|
1619
|
+
* read, thrown as an `ApiResponseError` too, its signed links redacted.
|
|
1620
|
+
*/
|
|
1621
|
+
getMethodShowcase(methodId: string, showcaseId: string, options?: MethodShowcaseReadOptions): Promise<MethodShowcaseDetail>;
|
|
1622
|
+
/**
|
|
1623
|
+
* The showcases of the tree a published version holds, oldest first —
|
|
1624
|
+
* `GET /v1/methods/{id}/versions/{n}/showcases` — for every reader of that version, another
|
|
1625
|
+
* organization's on a public method included. `items` is empty when none is frozen. A showcase of
|
|
1626
|
+
* a tree no published version holds is never read through this route.
|
|
1627
|
+
*
|
|
1628
|
+
* Takes a bare catalog id, as `getMethod` does, and the version number. `options.signal` cancels
|
|
1629
|
+
* the read. Throws `RequestArgumentError` for a `version` that is not a positive integer, before
|
|
1630
|
+
* any request. Throws `ApiResponseError`: `404` `pipelex.catalog.not_found` for an unknown method
|
|
1631
|
+
* or another organization's internal one, its `params.resource` `method`, and for a version the
|
|
1632
|
+
* method never published, its `params.resource` `version`; and `409`
|
|
1633
|
+
* `pipelex.catalog.being_deleted` while the erasure of the caller's own method is pending, under
|
|
1634
|
+
* way or stopped. An answer whose `items` is not an array is an answer the SDK cannot read, thrown
|
|
1635
|
+
* as an `ApiResponseError` too; an entry that does not read as a summary is left out.
|
|
1636
|
+
*/
|
|
1637
|
+
listMethodVersionShowcases(methodId: string, version: number, options?: MethodShowcaseReadOptions): Promise<MethodShowcaseList>;
|
|
1638
|
+
/**
|
|
1639
|
+
* One showcase of the tree a published version holds, in full, with a short-lived link to each of
|
|
1640
|
+
* its files — `GET /v1/methods/{id}/versions/{n}/showcases/{showcase_id}`. Read with
|
|
1641
|
+
* `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in its document is a `bigint`. A
|
|
1642
|
+
* showcase of another tree reads as not found.
|
|
1643
|
+
*
|
|
1644
|
+
* The refusals are `listMethodVersionShowcases`'s, and a showcase that tree does not hold is a
|
|
1645
|
+
* `404` `pipelex.catalog.not_found` whose `params.resource` is `example`. The showcase id is
|
|
1646
|
+
* refused as `withdrawMethodShowcase` refuses it. An answer that does not read as a detail is an
|
|
1647
|
+
* answer the SDK cannot read, thrown as an `ApiResponseError` too, its signed links redacted.
|
|
1648
|
+
*/
|
|
1649
|
+
getMethodVersionShowcase(methodId: string, version: number, showcaseId: string, options?: MethodShowcaseReadOptions): Promise<MethodShowcaseDetail>;
|
|
1650
|
+
/** The `{items}` of a route answering showcase summaries, each read as `readMethodShowcaseSummaries` reads it. */
|
|
1651
|
+
private requestMethodShowcaseList;
|
|
1652
|
+
/** A route answering one showcase in full, its answer read exactly and any error's links redacted. */
|
|
1653
|
+
private requestMethodShowcaseDetail;
|
|
1501
1654
|
/**
|
|
1502
1655
|
* Set which catalogs of a method have their layouts switched off —
|
|
1503
1656
|
* `PUT /v1/methods/{id}/layouts-off` — and return the method, its `layouts_off` the list as held.
|
|
@@ -1546,7 +1699,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1546
1699
|
* is refused with a `422` `request.invalid` naming it.
|
|
1547
1700
|
*
|
|
1548
1701
|
* The answer is a `MethodCopyResult` discriminated on `outcome` — branch on it: `copied` with
|
|
1549
|
-
* the copy as `method`, `examples_copied` and
|
|
1702
|
+
* the copy as `method`, `examples_copied`, `stored_files_copied` and the counts reserved for
|
|
1703
|
+
* showcases, `showcases_copied` and `layouts_copied`; `refused` with the
|
|
1550
1704
|
* `reason` `bundle_names_other_storage`, a `message` and every `references` entry (`{ path, uri
|
|
1551
1705
|
* }`) a `.mthds` file of the tree holds that the destination cannot read and, in a duplicate,
|
|
1552
1706
|
* that names a file under the original's run files, which erasing the original would remove,
|
package/dist/client.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// client and the MTHDS runners cannot disagree about what they reject.
|
|
4
4
|
import { assertOneMethodSource, buildProblem, isProblem, parseJsonBody, readProblemBody, } from "mthds/protocol";
|
|
5
5
|
import { LAYOUT_INPUT_MEMBERS, PROVENANCE_INPUT_MEMBERS, methodLayoutFault, readMethodLayout, readMethodLayouts, } from "./method-layouts.js";
|
|
6
|
+
import { methodShowcaseDetailFault, methodShowcaseFreezeFault, readMethodShowcaseSummaries, } from "./method-showcases.js";
|
|
6
7
|
import { assertArtifactSelection, assertWaitOptions, pollUntilResult, readRunDegradation, RUN_STATUSES, runProgressFault, runStatusFilter, selectionIncludesMainStuff, throwIfAborted, withCheckedProgressHealth, } from "./runs.js";
|
|
7
8
|
import { ABORT_TIMEOUT, ApiResponseError, argumentInvalidProblem, ApiUnreachableError, MissingMainStuffError, PagingNotTerminatingError, PipelineExecuteTimeoutError, ProblemError, RequestArgumentError, RunLifecycleUnavailableError, RunStillRunningError, } from "./errors.js";
|
|
8
9
|
import { isPlainObject } from "./records.js";
|
|
@@ -313,6 +314,23 @@ function checkRunListQuery(call, query) {
|
|
|
313
314
|
return;
|
|
314
315
|
throw argumentRefusal(call, RUN_LIST_QUERY_ARGUMENT, describeNumberArgument(query), "not_an_object");
|
|
315
316
|
}
|
|
317
|
+
/** What each argument of a showcase call is, as a refusal of it names it. */
|
|
318
|
+
const SHOWCASE_ID_ARGUMENT = {
|
|
319
|
+
name: "showcase_id",
|
|
320
|
+
what: "a showcase id, the showcase's non-empty `showcase_id`",
|
|
321
|
+
};
|
|
322
|
+
const SHOWCASE_VERSION_ARGUMENT = {
|
|
323
|
+
name: "version",
|
|
324
|
+
what: "a version number, the published version whose showcases to read, a positive integer",
|
|
325
|
+
};
|
|
326
|
+
const SHOWCASE_RUN_ID_ARGUMENT = {
|
|
327
|
+
name: "run_id",
|
|
328
|
+
what: "a run id, the non-empty `pipeline_run_id` of the completed run to freeze",
|
|
329
|
+
};
|
|
330
|
+
const SHOWCASE_NAME_ARGUMENT = {
|
|
331
|
+
name: "name",
|
|
332
|
+
what: "a name for the showcase, a non-empty string",
|
|
333
|
+
};
|
|
316
334
|
/** What each argument of a method copy is, as a refusal of it names it. */
|
|
317
335
|
const COPY_DESTINATION_ARGUMENT = {
|
|
318
336
|
name: "destination_org_id",
|
|
@@ -461,6 +479,16 @@ function methodExamplePath(methodId, exampleId, call) {
|
|
|
461
479
|
const path = methodPath(methodId, call);
|
|
462
480
|
return `${path}/examples/${idPathSegment(exampleId, call, EXAMPLE_ID_ARGUMENT)}`;
|
|
463
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* The path of a published version's showcases, `methods/{id}/versions/{n}/showcases`, for a bare
|
|
484
|
+
* catalog id and a positive integer version, each refused before anything is sent.
|
|
485
|
+
*/
|
|
486
|
+
function methodVersionShowcasesPath(methodId, version, call) {
|
|
487
|
+
if (!Number.isSafeInteger(version) || version < 1) {
|
|
488
|
+
throw argumentRefusal(call, SHOWCASE_VERSION_ARGUMENT, describeNumberArgument(version), "not_a_positive_integer");
|
|
489
|
+
}
|
|
490
|
+
return `${methodPath(methodId, call)}/versions/${version}/showcases`;
|
|
491
|
+
}
|
|
464
492
|
const isString = (value) => typeof value === "string";
|
|
465
493
|
/** The states an archive is in, the field a caller branches on, in the order a refusal lists them. */
|
|
466
494
|
const FILE_ARCHIVE_STATES = ["queued", "building", "ready", "failed"];
|
|
@@ -498,7 +526,8 @@ function fileLinkTarget(value) {
|
|
|
498
526
|
* Python SDK's model requires, held to the same strict types it holds them to, so both SDKs refuse
|
|
499
527
|
* the same answers, the ones a caller acts on (`example_id`, `inputs`, `input_revision`,
|
|
500
528
|
* `latest_run_id`) among them. `latest_run_id` must be present, `null` saying there is no latest
|
|
501
|
-
* run
|
|
529
|
+
* run; `showcase_id` may be absent, since a platform that predates it does not send it, and is held
|
|
530
|
+
* to its type when it is there; and `input_revision` must be a safe integer, so a string, a boolean, a fraction and an
|
|
502
531
|
* integer past the safe range, which `parseExactJson` reads as a `bigint`, are each refused by
|
|
503
532
|
* both. The one spelling they read apart is a revision of `2.0`: JavaScript reads it as the number
|
|
504
533
|
* `2` and cannot tell it from `2`, while the Python SDK refuses the float.
|
|
@@ -514,6 +543,10 @@ const METHOD_EXAMPLE_FIELDS = {
|
|
|
514
543
|
inputs: ["an object", isPlainObject],
|
|
515
544
|
input_revision: ["an integer", (value) => Number.isSafeInteger(value)],
|
|
516
545
|
latest_run_id: ["a string or null", (value) => value === null || isString(value)],
|
|
546
|
+
showcase_id: [
|
|
547
|
+
"a string or null",
|
|
548
|
+
(value) => value === undefined || value === null || isString(value),
|
|
549
|
+
],
|
|
517
550
|
created_by_user_id: ["a string", isString],
|
|
518
551
|
created_at: ["a string", isString],
|
|
519
552
|
updated_at: ["a string", isString],
|
|
@@ -609,7 +642,8 @@ export class PipelexApiClient {
|
|
|
609
642
|
* whose errors then say whether it may have (see `RunCreation`).
|
|
610
643
|
* `idempotencyKey`, already checked by `idempotencyKeyOf`, is sent as the
|
|
611
644
|
* `Idempotency-Key` header; only `start`, `copyMethod`, `storeMethodLayout`,
|
|
612
|
-
* `setMethodLayoutsOff`, `
|
|
645
|
+
* `setMethodLayoutsOff`, `freezeMethodShowcase`, `withdrawMethodShowcase`, `rotateWebhookSecret`
|
|
646
|
+
* and `replayRunWebhookDelivery` pass one.
|
|
613
647
|
*/
|
|
614
648
|
async requestRaw(method, url, options = {}) {
|
|
615
649
|
const hasBody = options.body !== undefined;
|
|
@@ -2534,10 +2568,16 @@ export class PipelexApiClient {
|
|
|
2534
2568
|
* `422` for an empty name or one holding a lone surrogate, `413` `request.too_large` for a name
|
|
2535
2569
|
* so long it would leave the method too large to publish, and a `503` that wrote nothing, safe
|
|
2536
2570
|
* to retry, when draft writes kept landing under the rename.
|
|
2571
|
+
*
|
|
2572
|
+
* `expected_name` makes the rename conditional on the name the caller read: a method no longer
|
|
2573
|
+
* named so is a `409` `pipelex.catalog.update_conflict` whose `location.field` is
|
|
2574
|
+
* `expected_name`, and nothing is written. A client applying a name nobody typed, such as a
|
|
2575
|
+
* proposed one, uses it so that a name a person set meanwhile is never overwritten.
|
|
2537
2576
|
*/
|
|
2538
2577
|
async renameMethod(methodId, input) {
|
|
2539
2578
|
return this.requestMethodData("PATCH", methodPath(methodId, "renameMethod"), {
|
|
2540
2579
|
name: input.name,
|
|
2580
|
+
...(input.expected_name === undefined ? {} : { expected_name: input.expected_name }),
|
|
2541
2581
|
});
|
|
2542
2582
|
}
|
|
2543
2583
|
/**
|
|
@@ -2553,7 +2593,7 @@ export class PipelexApiClient {
|
|
|
2553
2593
|
* `refused` with a `reason`, a `message` and the runner's `validation` verdict, whose problem
|
|
2554
2594
|
* items are read member by member as `validate` reads them. The reason is `invalid`, or
|
|
2555
2595
|
* `not_runnable` for a draft that validates with pending signatures, and for a public method
|
|
2556
|
-
* also `thumbnail_missing`, `thumbnail_invalid` or `
|
|
2596
|
+
* also `thumbnail_missing`, `thumbnail_invalid`, `storage_reference` or `showcase_missing` (see
|
|
2557
2597
|
* `MethodPublishRefusalReason`); a reason this SDK does not know is passed through as its raw
|
|
2558
2598
|
* string, still a verdict, so show its `message`. Every arm carries the `method`. A publish
|
|
2559
2599
|
* moves no token.
|
|
@@ -2752,6 +2792,28 @@ export class PipelexApiClient {
|
|
|
2752
2792
|
throw argumentRefusal(call, LAYOUT_LIST_VERSION_ARGUMENT, describeNumberArgument(version), "not_a_positive_integer");
|
|
2753
2793
|
}
|
|
2754
2794
|
const endpoint = `${methodPath(methodId, call)}/versions/${version}/layouts`;
|
|
2795
|
+
return this.requestMethodLayoutList(endpoint, options);
|
|
2796
|
+
}
|
|
2797
|
+
/**
|
|
2798
|
+
* The layouts stored for the content of a method's draft — `GET /v1/methods/{id}/draft/layouts` —
|
|
2799
|
+
* newest first, `items` empty for an empty draft or a draft none was designed for. A layout is
|
|
2800
|
+
* keyed by its content, so a draft holding a published tree finds that tree's layouts here, and a
|
|
2801
|
+
* builder sees the designs of what it is editing.
|
|
2802
|
+
*
|
|
2803
|
+
* It reads for the organization that holds the method alone, since a draft is its holder's. Takes
|
|
2804
|
+
* a bare catalog id, as `getMethod` does. `options.signal` cancels the read. Throws
|
|
2805
|
+
* `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the organization does not
|
|
2806
|
+
* hold, another organization's public one included, and `409` `pipelex.catalog.being_deleted`
|
|
2807
|
+
* while its erasure is pending, under way or stopped. An answer whose `items` is not an array is
|
|
2808
|
+
* an answer the SDK cannot read, thrown as an `ApiResponseError` too; an entry that does not read
|
|
2809
|
+
* as a layout is left out (`readMethodLayouts`).
|
|
2810
|
+
*/
|
|
2811
|
+
async listMethodDraftLayouts(methodId, options = {}) {
|
|
2812
|
+
const endpoint = `${methodPath(methodId, "listMethodDraftLayouts")}/draft/layouts`;
|
|
2813
|
+
return this.requestMethodLayoutList(endpoint, options);
|
|
2814
|
+
}
|
|
2815
|
+
/** The `{items}` of a route answering layouts, each entry read as `readMethodLayouts` reads it. */
|
|
2816
|
+
async requestMethodLayoutList(endpoint, options) {
|
|
2755
2817
|
const res = await this.requestProductAnswer("GET", endpoint, undefined, {
|
|
2756
2818
|
signal: options.signal,
|
|
2757
2819
|
});
|
|
@@ -2761,6 +2823,165 @@ export class PipelexApiClient {
|
|
|
2761
2823
|
}
|
|
2762
2824
|
return { ...answer, items: readMethodLayouts(answer.items) };
|
|
2763
2825
|
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Freeze a completed run of a method into a showcase — `POST /v1/methods/{id}/showcases` — and
|
|
2828
|
+
* answer what the freeze did.
|
|
2829
|
+
*
|
|
2830
|
+
* A showcase is real output, frozen: the run's inputs, its main output, the forms and contracts
|
|
2831
|
+
* that describe them, and a private copy of every stored file they name. It is keyed by the
|
|
2832
|
+
* digest of the run's tree, so a builder freezes a run of the draft before publishing it, and
|
|
2833
|
+
* another organization reads it only through a published version holding that tree. The run must
|
|
2834
|
+
* be this method's, completed and with stored results, and its tree must be the draft's or the
|
|
2835
|
+
* latest published version's.
|
|
2836
|
+
*
|
|
2837
|
+
* The answer is a `MethodShowcaseFreezeResult`, a `200` discriminated on `outcome` — branch on it:
|
|
2838
|
+
* `frozen` with the new `showcase`; `unchanged` with the one that stands, when this run is already
|
|
2839
|
+
* a showcase, whatever has happened to its tree since, the name in the request being ignored; or
|
|
2840
|
+
* `refused` with a `reason` and a `message`, nothing written (`MethodShowcaseRefusalReason`, read
|
|
2841
|
+
* open, so a later reason arrives as its raw string).
|
|
2842
|
+
*
|
|
2843
|
+
* The write changes the method, so it takes an `admin` or a `member` of the method's organization.
|
|
2844
|
+
* Takes a bare catalog id, as `getMethod` does. Sends `run_id` and `name` and nothing else, the
|
|
2845
|
+
* body being closed. `options.idempotencyKey` is sent as the `Idempotency-Key` header
|
|
2846
|
+
* (`MethodShowcaseWriteOptions`). Throws `RequestArgumentError` before any request for a `run_id`
|
|
2847
|
+
* or a `name` that is not a non-empty string, and for a malformed idempotency key. Throws
|
|
2848
|
+
* `ApiResponseError` when no verdict was produced: `403` `auth.forbidden` for a `runner`; `404`
|
|
2849
|
+
* `pipelex.catalog.not_found` for a method the organization does not hold; `409`
|
|
2850
|
+
* `pipelex.catalog.being_deleted` while its erasure is pending, under way or stopped; `422`
|
|
2851
|
+
* `request.invalid` for a body that does not validate; and `503` `runtime.unavailable`, with
|
|
2852
|
+
* `retry` `yes`, past the freeze's deadline. An answer that is none of the verdict's arms is an
|
|
2853
|
+
* answer the SDK cannot read, thrown as an `ApiResponseError` too.
|
|
2854
|
+
*/
|
|
2855
|
+
async freezeMethodShowcase(methodId, input, options = {}) {
|
|
2856
|
+
const call = "freezeMethodShowcase";
|
|
2857
|
+
const endpoint = `${methodPath(methodId, call)}/showcases`;
|
|
2858
|
+
const { run_id: runId, name } = input ?? {};
|
|
2859
|
+
const body = {
|
|
2860
|
+
run_id: requireNonEmptyId(runId, call, SHOWCASE_RUN_ID_ARGUMENT),
|
|
2861
|
+
name: requireNonEmptyId(name, call, SHOWCASE_NAME_ARGUMENT),
|
|
2862
|
+
};
|
|
2863
|
+
const idempotencyKey = idempotencyKeyOf(options, "freeze the showcase");
|
|
2864
|
+
const res = await this.requestProductAnswer("POST", endpoint, body, { idempotencyKey });
|
|
2865
|
+
const answer = this.readObjectAnswer("POST", endpoint, res);
|
|
2866
|
+
const fault = methodShowcaseFreezeFault(answer);
|
|
2867
|
+
if (fault !== null) {
|
|
2868
|
+
throw this.unreadableAnswer("POST", `/${API_PREFIX}/${endpoint}`, res, fault);
|
|
2869
|
+
}
|
|
2870
|
+
return answer;
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Withdraw a showcase — `DELETE /v1/methods/{id}/showcases/{showcase_id}`. The platform answers
|
|
2874
|
+
* `204`, the row going first, so every read closes at once, and then its stored document and
|
|
2875
|
+
* files. It runs no check, even on a public method's last showcase, because taking down something
|
|
2876
|
+
* published by mistake is never refused; the method then stays public and its next publish needs
|
|
2877
|
+
* a showcase. What another organization already copied stays theirs.
|
|
2878
|
+
*
|
|
2879
|
+
* `options.idempotencyKey` is sent as the `Idempotency-Key` header, so a withdrawal whose answer
|
|
2880
|
+
* was lost is sent again under the same key and answered as the first was
|
|
2881
|
+
* (`MethodShowcaseWriteOptions`). Throws `RequestArgumentError` before any request for a showcase
|
|
2882
|
+
* id that is empty, `.` or `..`, or holds a lone surrogate, and for a malformed idempotency key.
|
|
2883
|
+
* Throws `ApiResponseError`: `404` `pipelex.catalog.not_found`, its `params.resource` `example`,
|
|
2884
|
+
* when there is no such showcase, one already withdrawn included; `403` `auth.forbidden` for a
|
|
2885
|
+
* `runner`; and `422` `request.invalid` for an id that is not one a showcase can have.
|
|
2886
|
+
*/
|
|
2887
|
+
async withdrawMethodShowcase(methodId, showcaseId, options = {}) {
|
|
2888
|
+
const call = "withdrawMethodShowcase";
|
|
2889
|
+
const endpoint = `${methodPath(methodId, call)}/showcases/${idPathSegment(showcaseId, call, SHOWCASE_ID_ARGUMENT)}`;
|
|
2890
|
+
const idempotencyKey = idempotencyKeyOf(options, "withdraw the showcase");
|
|
2891
|
+
await this.requestProduct("DELETE", endpoint, undefined, { idempotencyKey });
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* Every showcase of a method the caller's organization holds, across every tree, each naming its
|
|
2895
|
+
* digest, oldest first — `GET /v1/methods/{id}/showcases`.
|
|
2896
|
+
*
|
|
2897
|
+
* It reads for the holding organization's members alone: another organization reads a `404`,
|
|
2898
|
+
* public method or not, and reads a public method's showcases through
|
|
2899
|
+
* `listMethodVersionShowcases`. Takes a bare catalog id, as `getMethod` does. `options.signal`
|
|
2900
|
+
* cancels the read. Throws `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the
|
|
2901
|
+
* organization does not hold and `409` `pipelex.catalog.being_deleted` while its erasure is
|
|
2902
|
+
* pending, under way or stopped. An answer whose `items` is not an array is an answer the SDK
|
|
2903
|
+
* cannot read, thrown as an `ApiResponseError` too; an entry that does not read as a summary is
|
|
2904
|
+
* left out (`readMethodShowcaseSummaries`).
|
|
2905
|
+
*/
|
|
2906
|
+
async listMethodShowcases(methodId, options = {}) {
|
|
2907
|
+
const endpoint = `${methodPath(methodId, "listMethodShowcases")}/showcases`;
|
|
2908
|
+
return this.requestMethodShowcaseList(endpoint, options);
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* One showcase of a method the caller's organization holds, in full, with a short-lived link to
|
|
2912
|
+
* each of its files — `GET /v1/methods/{id}/showcases/{showcase_id}`. Read with `parseExactJson`,
|
|
2913
|
+
* so an integer past `Number.MAX_SAFE_INTEGER` in its document is a `bigint`.
|
|
2914
|
+
*
|
|
2915
|
+
* It reads for the holding organization's members alone. Takes a bare catalog id, as `getMethod`
|
|
2916
|
+
* does, and refuses a showcase id as `withdrawMethodShowcase` does, before any request. Throws
|
|
2917
|
+
* `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the organization does not
|
|
2918
|
+
* hold and for a showcase it does not have, the latter's `params.resource` being `example`, and
|
|
2919
|
+
* `409` `pipelex.catalog.being_deleted` while its erasure is pending, under way or stopped. An
|
|
2920
|
+
* answer that does not read as a detail (`methodShowcaseDetailFault`) is an answer the SDK cannot
|
|
2921
|
+
* read, thrown as an `ApiResponseError` too, its signed links redacted.
|
|
2922
|
+
*/
|
|
2923
|
+
async getMethodShowcase(methodId, showcaseId, options = {}) {
|
|
2924
|
+
const call = "getMethodShowcase";
|
|
2925
|
+
const endpoint = `${methodPath(methodId, call)}/showcases/${idPathSegment(showcaseId, call, SHOWCASE_ID_ARGUMENT)}`;
|
|
2926
|
+
return this.requestMethodShowcaseDetail(endpoint, options);
|
|
2927
|
+
}
|
|
2928
|
+
/**
|
|
2929
|
+
* The showcases of the tree a published version holds, oldest first —
|
|
2930
|
+
* `GET /v1/methods/{id}/versions/{n}/showcases` — for every reader of that version, another
|
|
2931
|
+
* organization's on a public method included. `items` is empty when none is frozen. A showcase of
|
|
2932
|
+
* a tree no published version holds is never read through this route.
|
|
2933
|
+
*
|
|
2934
|
+
* Takes a bare catalog id, as `getMethod` does, and the version number. `options.signal` cancels
|
|
2935
|
+
* the read. Throws `RequestArgumentError` for a `version` that is not a positive integer, before
|
|
2936
|
+
* any request. Throws `ApiResponseError`: `404` `pipelex.catalog.not_found` for an unknown method
|
|
2937
|
+
* or another organization's internal one, its `params.resource` `method`, and for a version the
|
|
2938
|
+
* method never published, its `params.resource` `version`; and `409`
|
|
2939
|
+
* `pipelex.catalog.being_deleted` while the erasure of the caller's own method is pending, under
|
|
2940
|
+
* way or stopped. An answer whose `items` is not an array is an answer the SDK cannot read, thrown
|
|
2941
|
+
* as an `ApiResponseError` too; an entry that does not read as a summary is left out.
|
|
2942
|
+
*/
|
|
2943
|
+
async listMethodVersionShowcases(methodId, version, options = {}) {
|
|
2944
|
+
const endpoint = methodVersionShowcasesPath(methodId, version, "listMethodVersionShowcases");
|
|
2945
|
+
return this.requestMethodShowcaseList(endpoint, options);
|
|
2946
|
+
}
|
|
2947
|
+
/**
|
|
2948
|
+
* One showcase of the tree a published version holds, in full, with a short-lived link to each of
|
|
2949
|
+
* its files — `GET /v1/methods/{id}/versions/{n}/showcases/{showcase_id}`. Read with
|
|
2950
|
+
* `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in its document is a `bigint`. A
|
|
2951
|
+
* showcase of another tree reads as not found.
|
|
2952
|
+
*
|
|
2953
|
+
* The refusals are `listMethodVersionShowcases`'s, and a showcase that tree does not hold is a
|
|
2954
|
+
* `404` `pipelex.catalog.not_found` whose `params.resource` is `example`. The showcase id is
|
|
2955
|
+
* refused as `withdrawMethodShowcase` refuses it. An answer that does not read as a detail is an
|
|
2956
|
+
* answer the SDK cannot read, thrown as an `ApiResponseError` too, its signed links redacted.
|
|
2957
|
+
*/
|
|
2958
|
+
async getMethodVersionShowcase(methodId, version, showcaseId, options = {}) {
|
|
2959
|
+
const call = "getMethodVersionShowcase";
|
|
2960
|
+
const list = methodVersionShowcasesPath(methodId, version, call);
|
|
2961
|
+
const endpoint = `${list}/${idPathSegment(showcaseId, call, SHOWCASE_ID_ARGUMENT)}`;
|
|
2962
|
+
return this.requestMethodShowcaseDetail(endpoint, options);
|
|
2963
|
+
}
|
|
2964
|
+
/** The `{items}` of a route answering showcase summaries, each read as `readMethodShowcaseSummaries` reads it. */
|
|
2965
|
+
async requestMethodShowcaseList(endpoint, options) {
|
|
2966
|
+
const res = await this.requestProductAnswer("GET", endpoint, undefined, {
|
|
2967
|
+
signal: options.signal,
|
|
2968
|
+
});
|
|
2969
|
+
const answer = this.readObjectAnswer("GET", endpoint, res);
|
|
2970
|
+
if (!Array.isArray(answer.items)) {
|
|
2971
|
+
throw this.unreadableAnswer("GET", `/${API_PREFIX}/${endpoint}`, res, "a list of showcases whose `items` is not an array");
|
|
2972
|
+
}
|
|
2973
|
+
return { ...answer, items: readMethodShowcaseSummaries(answer.items) };
|
|
2974
|
+
}
|
|
2975
|
+
/** A route answering one showcase in full, its answer read exactly and any error's links redacted. */
|
|
2976
|
+
async requestMethodShowcaseDetail(endpoint, options) {
|
|
2977
|
+
const res = withLinks(await this.requestProductAnswer("GET", endpoint, undefined, { signal: options.signal }));
|
|
2978
|
+
const answer = this.readObjectAnswer("GET", endpoint, res, {}, parseExactJson);
|
|
2979
|
+
const fault = methodShowcaseDetailFault(answer);
|
|
2980
|
+
if (fault !== null) {
|
|
2981
|
+
throw this.unreadableAnswer("GET", `/${API_PREFIX}/${endpoint}`, res, `a showcase ${fault}`);
|
|
2982
|
+
}
|
|
2983
|
+
return answer;
|
|
2984
|
+
}
|
|
2764
2985
|
/**
|
|
2765
2986
|
* Set which catalogs of a method have their layouts switched off —
|
|
2766
2987
|
* `PUT /v1/methods/{id}/layouts-off` — and return the method, its `layouts_off` the list as held.
|
|
@@ -2817,7 +3038,8 @@ export class PipelexApiClient {
|
|
|
2817
3038
|
* is refused with a `422` `request.invalid` naming it.
|
|
2818
3039
|
*
|
|
2819
3040
|
* The answer is a `MethodCopyResult` discriminated on `outcome` — branch on it: `copied` with
|
|
2820
|
-
* the copy as `method`, `examples_copied` and
|
|
3041
|
+
* the copy as `method`, `examples_copied`, `stored_files_copied` and the counts reserved for
|
|
3042
|
+
* showcases, `showcases_copied` and `layouts_copied`; `refused` with the
|
|
2821
3043
|
* `reason` `bundle_names_other_storage`, a `message` and every `references` entry (`{ path, uri
|
|
2822
3044
|
* }`) a `.mthds` file of the tree holds that the destination cannot read and, in a duplicate,
|
|
2823
3045
|
* that names a file under the original's run files, which erasing the original would remove,
|
|
@@ -4566,13 +4788,14 @@ const MAX_IDEMPOTENCY_KEY_LENGTH = 255;
|
|
|
4566
4788
|
const VISIBLE_ASCII = /^[\x21-\x7E]+$/;
|
|
4567
4789
|
/**
|
|
4568
4790
|
* The idempotency key a start, a method copy, a layout write, a write of the layouts switched off,
|
|
4569
|
-
* a secret rotation or a delivery replay sends, or
|
|
4791
|
+
* a showcase write, a secret rotation or a delivery replay sends, or
|
|
4570
4792
|
* `undefined` when the options carry none (absent or `null`). A key that is not a string of 1 to
|
|
4571
4793
|
* 255 visible ASCII characters is refused with a `RequestArgumentError` rather than dropped, an
|
|
4572
4794
|
* empty one included, since a request sent without the key its caller gave would lose the
|
|
4573
4795
|
* protection the caller asked for without a word. `request` says what the request does, as the
|
|
4574
4796
|
* refusal's last sentence names it ("start the run", "copy the method", "store the layout",
|
|
4575
|
-
* "set the layouts off", "
|
|
4797
|
+
* "set the layouts off", "freeze the showcase", "withdraw the showcase", "rotate the secret",
|
|
4798
|
+
* "replay the delivery"). The message never quotes the key, which a caller may derive from
|
|
4576
4799
|
* something private. The Python SDK holds a key to the same rule, in the same words.
|
|
4577
4800
|
*/
|
|
4578
4801
|
function idempotencyKeyOf(options, request = "start the run") {
|