@pipelex/sdk 0.72.0 → 0.74.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 +1 -1
- package/dist/artifacts.d.ts +24 -1
- package/dist/artifacts.js +95 -15
- package/dist/artifacts.js.map +1 -1
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.js +13 -5
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/script.d.ts +1 -1
- package/dist/client.d.ts +48 -21
- package/dist/client.js +100 -32
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +13 -8
- package/dist/errors.js +6 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/product-models.d.ts +55 -22
- package/dist/run-artifact-links.d.ts +73 -0
- package/dist/run-artifact-links.js +167 -0
- package/dist/run-artifact-links.js.map +1 -0
- package/dist/runs.d.ts +53 -3
- package/dist/runs.js +7 -4
- package/dist/runs.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +1 -1
- package/docs/cli.md +1 -1
- package/docs/errors.md +2 -2
- package/docs/organization-branding.md +33 -16
- package/docs/run-results.md +32 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import type { MTHDSProtocol, ModelCategory, ModelDeck, RunOptions, StartOptions,
|
|
|
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
4
|
import type { MethodShowcaseDetail, MethodShowcaseFreezeResult, MethodShowcaseInput, MethodShowcaseList } from "./method-showcases.js";
|
|
5
|
-
import { type GetRunResultOptions, type RunProgress, type RunRead, type RunResults, type RunResultState, type StartAndWaitForResultOptions, type WaitForResultOptions } from "./runs.js";
|
|
5
|
+
import { type GetRunResultOptions, type RunArtifactLink, type RunProgress, type RunRead, type RunResultArtifact, type RunResults, type RunResultState, type StartAndWaitForResultOptions, type WaitForResultOptions } from "./runs.js";
|
|
6
6
|
import type { BillingPortalResponse, ChangePlanResponse, CheckoutResponse, DraftFileFromFileInput, DraftFileFromFileResult, FileArchive, FileArchiveRequest, FileDetail, FileLinkTarget, FileLinksResult, FilePage, FilePreview, 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";
|
|
7
7
|
import type { MethodTreeForms, MethodTreeLimits } from "./method-trees.js";
|
|
8
8
|
import type { AppInfo } from "./user-agent.js";
|
|
9
9
|
import type { WebhookDeliveryDetail, WebhookDeliveryList, WebhookReplayAccepted, WebhookReplayOptions, WebhookSecret, WebhookSecretRotateOptions } from "./webhooks.js";
|
|
10
10
|
import type { UploadableAsset, UploadFileOptions, UploadRecord } from "./upload.js";
|
|
11
11
|
import type { PrepareInputsRequest, PreparedInputs } from "./prepare-inputs.js";
|
|
12
|
+
import type { FollowArtifactLinksOptions } from "./run-artifact-links.js";
|
|
12
13
|
import type { BulkResolveStorageUrlsInput, BulkResolvedStorageUrls, DownloadArtifactsRequest, DownloadArtifactsResult, FetchArtifactOptions, ResolvedArtifact } from "./artifacts.js";
|
|
13
14
|
import { PipelexExecuteResult } from "./execute-result.js";
|
|
14
15
|
/**
|
|
@@ -940,7 +941,13 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
940
941
|
* selected one the run never wrote is `null`. Omitted, every artifact is
|
|
941
942
|
* read. An empty selection or an unknown name throws a `RequestArgumentError`
|
|
942
943
|
* before any request. `MissingMainStuffError` is thrown only for a read that asked
|
|
943
|
-
* for `main_stuff` — no selection, or one naming it.
|
|
944
|
+
* for `main_stuff` — no selection, or one naming it — and found it `null` with no link.
|
|
945
|
+
*
|
|
946
|
+
* An artifact the platform handed back by reference, because inline it would have taken the
|
|
947
|
+
* body past the API Gateway's limit, is fetched from its signed link into its field by default
|
|
948
|
+
* (`followArtifactLinks`), before the main-stuff check and the stored-text load, so it reads as
|
|
949
|
+
* its content. `followArtifactLinks: false` hands the links back on `artifact_links`, each such
|
|
950
|
+
* field `null`, for a caller that passes the link on rather than pull the file through itself.
|
|
944
951
|
*
|
|
945
952
|
* A completed result is read with `parseExactJson`, so an integer past
|
|
946
953
|
* `Number.MAX_SAFE_INTEGER` anywhere in it, the main output, the working memory and the graph
|
|
@@ -1943,14 +1950,15 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1943
1950
|
}): Promise<Membership>;
|
|
1944
1951
|
/**
|
|
1945
1952
|
* The branding of the caller's active organization — `GET /v1/branding`: its name, its light
|
|
1946
|
-
* and dark colour sets, its
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1951
|
-
*
|
|
1952
|
-
* `
|
|
1953
|
-
*
|
|
1953
|
+
* and dark colour sets, its square and wide logos with their dark variants, its preset, shell
|
|
1954
|
+
* and typeface, its design system, and whether it holds the white-label entitlement. Any role
|
|
1955
|
+
* reads it, `runner` included, by web session or API key, so an app scaffolded from the
|
|
1956
|
+
* method-app template reads its organization's branding with its own key. A personal workspace,
|
|
1957
|
+
* or a team that set nothing, answers every colour and logo `null`, no preset, shell or typeface
|
|
1958
|
+
* and no design system. A logo's `uri` is a `pipelex-storage://` reference, which
|
|
1959
|
+
* `resolveStorageUrl` turns into a short-lived link to its bytes. An answer without one of the
|
|
1960
|
+
* dark logos, the three ids or the design system, as a platform that predates them sends, reads
|
|
1961
|
+
* it as `null`, and one without `white_label` reads it as `false`.
|
|
1954
1962
|
*
|
|
1955
1963
|
* Throws `ApiResponseError`: `403` `pipelex.org.required` when the caller has no active
|
|
1956
1964
|
* organization, `404` when its row is missing, and an answer that is not a JSON object, an
|
|
@@ -1964,9 +1972,10 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1964
1972
|
* value (`OrganizationBrandingUpdate`), so `{}` writes nothing. A new logo is the
|
|
1965
1973
|
* `pipelex-storage://` URI of a file the organization uploaded on its own, which the platform
|
|
1966
1974
|
* reads and measures, then copies under `branding/`: the answer's `uri` is that copy, and sending
|
|
1967
|
-
* it back unchanged keeps the logo. The logo a write replaces or clears is erased. A
|
|
1968
|
-
* typeface is an id of the shape `^[a-z0-9-]{1,32}$`, stored whether or not it names
|
|
1969
|
-
* exists.
|
|
1975
|
+
* it back unchanged keeps the logo. The logo a write replaces or clears is erased. A preset, a
|
|
1976
|
+
* shell or a typeface is an id of the shape `^[a-z0-9-]{1,32}$`, stored whether or not it names
|
|
1977
|
+
* one that exists. A design system replaces the stored one whole, and `null` removes it. Answers
|
|
1978
|
+
* the branding as the write left it, read as `getBranding` reads it.
|
|
1970
1979
|
*
|
|
1971
1980
|
* Throws `RequestArgumentError` for an organization id that is empty, `.` or `..`, before any
|
|
1972
1981
|
* request. Throws `ApiResponseError`, refusing every change of the request when it refuses one:
|
|
@@ -1974,14 +1983,16 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1974
1983
|
* `auth.forbidden` for a runner or a caller with no recognised role, `404`
|
|
1975
1984
|
* `pipelex.org.not_found` for a missing organization, `409` `pipelex.org.not_manageable` for a
|
|
1976
1985
|
* personal workspace, which has no branding, and `422` `request.invalid` for a colour that is
|
|
1977
|
-
* not `#rrggbb`, a
|
|
1978
|
-
* names the field in `location.field`: the
|
|
1979
|
-
* item's of its `errors` when it refuses
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
1982
|
-
*
|
|
1983
|
-
* `pipelex.org.mismatch` for another organization's file,
|
|
1984
|
-
*
|
|
1986
|
+
* not `#rrggbb`, a preset, a shell or a typeface of another shape, a design system of another
|
|
1987
|
+
* shape, or a key the body does not know, which names the field in `location.field`: the
|
|
1988
|
+
* problem's own when it refuses one field alone, each item's of its `errors` when it refuses
|
|
1989
|
+
* several. `white_label` is such a key, since only Pipelex staff grant it, and so is `style`, the
|
|
1990
|
+
* retired app style. A logo's refusal names its slot's key, such as `square_logo` or
|
|
1991
|
+
* `dark_wide_logo`, in `location.field`: `422` `pipelex.storage.uri_invalid` for a URI that is
|
|
1992
|
+
* not a storage URI and `403` `pipelex.org.mismatch` for another organization's file, both on the
|
|
1993
|
+
* problem itself, and `422` `request.unsupported` for a file the platform refused, naming the
|
|
1994
|
+
* first broken rule in `params.field` and `params.reason`, a `LogoRefusalCode`, and, when several
|
|
1995
|
+
* rules are broken, one item per rule in its `errors`, each naming its own slot and reason. A
|
|
1985
1996
|
* `503` `runtime.unavailable` is a failure of the platform's storage or its database, after which
|
|
1986
1997
|
* the write may have landed or not: the same input sent again is safe.
|
|
1987
1998
|
*/
|
|
@@ -2094,6 +2105,22 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
2094
2105
|
* same-origin proxy share. See `docs/artifact-download.md`.
|
|
2095
2106
|
*/
|
|
2096
2107
|
fetchArtifact(uri: string, options?: FetchArtifactOptions): Promise<Response>;
|
|
2108
|
+
/**
|
|
2109
|
+
* Fetch one result artifact the platform handed back by reference — an entry of
|
|
2110
|
+
* `RunResults.artifact_links` — and read it as the result fields it fills: `{ graph_spec }`,
|
|
2111
|
+
* `{ main_stuff }`, …, and `{ tokens_usages, usage_assembly_error }` unpacked from the usage
|
|
2112
|
+
* envelope. Read exactly (`parseExactJson`), under `fetchArtifact`'s bounds. The links inside the
|
|
2113
|
+
* artifact are as stored, never re-signed. See `docs/run-results.md`, "Artifacts handed back by
|
|
2114
|
+
* reference".
|
|
2115
|
+
*/
|
|
2116
|
+
fetchRunArtifact(artifact: RunResultArtifact, link: RunArtifactLink, options?: FetchArtifactOptions): Promise<Partial<RunResults>>;
|
|
2117
|
+
/**
|
|
2118
|
+
* A result with the artifacts it handed back by reference fetched into their fields, every one
|
|
2119
|
+
* or those `options.artifacts` names, each followed entry dropped from `artifact_links`. What the
|
|
2120
|
+
* result readers do by default; for a result read with `followArtifactLinks: false`. Returns a
|
|
2121
|
+
* new result, or the same one when it holds no link to follow.
|
|
2122
|
+
*/
|
|
2123
|
+
followArtifactLinks(results: RunResults, options?: FollowArtifactLinksOptions): Promise<RunResults>;
|
|
2097
2124
|
/**
|
|
2098
2125
|
* Save a run's produced files under a directory — the download twin of
|
|
2099
2126
|
* {@link prepareInputs}, Node-only. Keyed on a `run_id` (the results are
|
package/dist/client.js
CHANGED
|
@@ -13,7 +13,8 @@ import { HANDSHAKE_TTL_MS, INLINE_TREE_MAX_BYTES, MAX_CONCURRENT_TRANSFERS, REQU
|
|
|
13
13
|
import { buildUserAgent } from "./user-agent.js";
|
|
14
14
|
import { uploadFile as uploadFileImpl } from "./upload.js";
|
|
15
15
|
import { prepareInputs as prepareInputsImpl } from "./prepare-inputs.js";
|
|
16
|
-
import { carriesConceptArtifacts, downloadArtifacts as downloadArtifactsImpl, fetchArtifact as fetchArtifactImpl, loadStoredTexts as loadStoredTextsImpl, mayHoldStoredTexts, resolveArtifacts as resolveArtifactsImpl, withConceptArtifacts, } from "./artifacts.js";
|
|
16
|
+
import { carriesConceptArtifacts, CONCEPT_ARTIFACTS, downloadArtifacts as downloadArtifactsImpl, fetchArtifact as fetchArtifactImpl, loadStoredTexts as loadStoredTextsImpl, mayHoldStoredTexts, resolveArtifacts as resolveArtifactsImpl, withConceptArtifacts, } from "./artifacts.js";
|
|
17
|
+
import { fetchRunArtifact as fetchRunArtifactImpl, followArtifactLinks as followArtifactLinksImpl, holdsArtifactLinks, } from "./run-artifact-links.js";
|
|
17
18
|
import { PipelexExecuteResult, resultsFromExecute } from "./execute-result.js";
|
|
18
19
|
import { ExactJsonUnsupportedError, parseExactJson, stringifyExactJson } from "./exact-json.js";
|
|
19
20
|
import { eitherSignal } from "./signals.js";
|
|
@@ -119,6 +120,8 @@ const DEFAULT_REQUEST_TIMEOUT_MS = 1_200_000; // 20 min — matches the runner's
|
|
|
119
120
|
const POLL_REQUEST_TIMEOUT_MS = 30_000; // single status/result GETs; the hosted gateway caps responses at ~30s.
|
|
120
121
|
const DEFAULT_DEGRADED_RETRY_SECONDS = 5; // matches the platform's `_DEGRADE_RETRY_AFTER_SECONDS`.
|
|
121
122
|
const VALIDATE_MARKDOWN_RENDER_FORMAT = "markdown";
|
|
123
|
+
/** What the stored-text load reads: the main stuff, and the artifacts telling its texts by concept. */
|
|
124
|
+
const LOAD_ARTIFACTS = ["main_stuff", ...CONCEPT_ARTIFACTS];
|
|
122
125
|
/**
|
|
123
126
|
* `VersionInfo.implementation` of the bare open-source runner (no run store).
|
|
124
127
|
* Anything else — the hosted `pipelex-hosted` first — is assumed to serve the
|
|
@@ -1751,7 +1754,13 @@ export class PipelexApiClient {
|
|
|
1751
1754
|
* selected one the run never wrote is `null`. Omitted, every artifact is
|
|
1752
1755
|
* read. An empty selection or an unknown name throws a `RequestArgumentError`
|
|
1753
1756
|
* before any request. `MissingMainStuffError` is thrown only for a read that asked
|
|
1754
|
-
* for `main_stuff` — no selection, or one naming it.
|
|
1757
|
+
* for `main_stuff` — no selection, or one naming it — and found it `null` with no link.
|
|
1758
|
+
*
|
|
1759
|
+
* An artifact the platform handed back by reference, because inline it would have taken the
|
|
1760
|
+
* body past the API Gateway's limit, is fetched from its signed link into its field by default
|
|
1761
|
+
* (`followArtifactLinks`), before the main-stuff check and the stored-text load, so it reads as
|
|
1762
|
+
* its content. `followArtifactLinks: false` hands the links back on `artifact_links`, each such
|
|
1763
|
+
* field `null`, for a caller that passes the link on rather than pull the file through itself.
|
|
1755
1764
|
*
|
|
1756
1765
|
* A completed result is read with `parseExactJson`, so an integer past
|
|
1757
1766
|
* `Number.MAX_SAFE_INTEGER` anywhere in it, the main output, the working memory and the graph
|
|
@@ -1792,8 +1801,15 @@ export class PipelexApiClient {
|
|
|
1792
1801
|
this.throwApiResponseError("GET", endpoint, res);
|
|
1793
1802
|
}
|
|
1794
1803
|
// Read exactly: the output, the working memory and the graph hold the run's data.
|
|
1795
|
-
|
|
1796
|
-
if (
|
|
1804
|
+
let result = this.readObjectAnswer("GET", endpoint, res, {}, parseExactJson);
|
|
1805
|
+
if (options.followArtifactLinks !== false) {
|
|
1806
|
+
result = await followArtifactLinksImpl(this, result, { signal: options.signal });
|
|
1807
|
+
}
|
|
1808
|
+
// A `main_stuff` handed back by reference is there, at the end of its link: only a null one
|
|
1809
|
+
// with no link breaks the main-stuff invariant.
|
|
1810
|
+
if (selectionIncludesMainStuff(options.artifacts) &&
|
|
1811
|
+
result.main_stuff == null &&
|
|
1812
|
+
result.artifact_links?.main_stuff == null) {
|
|
1797
1813
|
throw new MissingMainStuffError(`Completed run '${runId}' returned no main stuff — a completed run always delivers a main stuff.`, runId);
|
|
1798
1814
|
}
|
|
1799
1815
|
if (options.loadStoredTexts === false || !selectionIncludesMainStuff(options.artifacts)) {
|
|
@@ -1814,9 +1830,14 @@ export class PipelexApiClient {
|
|
|
1814
1830
|
async withStoredTextsLoaded(result, selection, signal) {
|
|
1815
1831
|
if (result.main_stuff == null)
|
|
1816
1832
|
return result;
|
|
1817
|
-
|
|
1833
|
+
// A concept artifact handed back by reference, from a read that did not follow its links,
|
|
1834
|
+
// says nothing until fetched: read like one the selection left out, only when worth it.
|
|
1835
|
+
const linkedConcepts = holdsArtifactLinks(result, CONCEPT_ARTIFACTS);
|
|
1836
|
+
if ((!carriesConceptArtifacts(selection) || linkedConcepts) &&
|
|
1837
|
+
!mayHoldStoredTexts(result.main_stuff)) {
|
|
1818
1838
|
return result;
|
|
1819
1839
|
}
|
|
1840
|
+
// The loader fetches a linked concept artifact for the load alone: the result keeps its links.
|
|
1820
1841
|
const source = await withConceptArtifacts(this, result, selection, signal);
|
|
1821
1842
|
const loaded = await loadStoredTextsImpl(this, { ...result, ...source }, {
|
|
1822
1843
|
signal,
|
|
@@ -1835,9 +1856,26 @@ export class PipelexApiClient {
|
|
|
1835
1856
|
*/
|
|
1836
1857
|
async waitForResult(runId, options) {
|
|
1837
1858
|
const selection = options?.artifacts;
|
|
1838
|
-
|
|
1859
|
+
const follows = options?.followArtifactLinks !== false;
|
|
1860
|
+
const loads = options?.loadStoredTexts !== false && selectionIncludesMainStuff(selection);
|
|
1861
|
+
return pollUntilResult((id, opts) => this.getRunResult(id, opts), runId, options, (id, opts) => this.getRunProgress(id, opts), !follows && !loads
|
|
1839
1862
|
? undefined
|
|
1840
|
-
: (result, opts) =>
|
|
1863
|
+
: async (result, opts) => {
|
|
1864
|
+
let current = result;
|
|
1865
|
+
if (follows && loads) {
|
|
1866
|
+
// What the load reads first, and only that: a load that finds the concepts missing
|
|
1867
|
+
// polls again, so nothing else is fetched before it has passed.
|
|
1868
|
+
current = await followArtifactLinksImpl(this, current, {
|
|
1869
|
+
artifacts: LOAD_ARTIFACTS,
|
|
1870
|
+
signal: opts.signal,
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
if (loads)
|
|
1874
|
+
current = await this.withStoredTextsLoaded(current, selection, opts.signal);
|
|
1875
|
+
return follows
|
|
1876
|
+
? followArtifactLinksImpl(this, current, { signal: opts.signal })
|
|
1877
|
+
: current;
|
|
1878
|
+
});
|
|
1841
1879
|
}
|
|
1842
1880
|
/**
|
|
1843
1881
|
* Whether the configured server serves the durable run lifecycle, decided
|
|
@@ -3462,14 +3500,15 @@ export class PipelexApiClient {
|
|
|
3462
3500
|
}
|
|
3463
3501
|
/**
|
|
3464
3502
|
* The branding of the caller's active organization — `GET /v1/branding`: its name, its light
|
|
3465
|
-
* and dark colour sets, its
|
|
3466
|
-
*
|
|
3467
|
-
*
|
|
3468
|
-
*
|
|
3469
|
-
*
|
|
3470
|
-
*
|
|
3471
|
-
* `
|
|
3472
|
-
*
|
|
3503
|
+
* and dark colour sets, its square and wide logos with their dark variants, its preset, shell
|
|
3504
|
+
* and typeface, its design system, and whether it holds the white-label entitlement. Any role
|
|
3505
|
+
* reads it, `runner` included, by web session or API key, so an app scaffolded from the
|
|
3506
|
+
* method-app template reads its organization's branding with its own key. A personal workspace,
|
|
3507
|
+
* or a team that set nothing, answers every colour and logo `null`, no preset, shell or typeface
|
|
3508
|
+
* and no design system. A logo's `uri` is a `pipelex-storage://` reference, which
|
|
3509
|
+
* `resolveStorageUrl` turns into a short-lived link to its bytes. An answer without one of the
|
|
3510
|
+
* dark logos, the three ids or the design system, as a platform that predates them sends, reads
|
|
3511
|
+
* it as `null`, and one without `white_label` reads it as `false`.
|
|
3473
3512
|
*
|
|
3474
3513
|
* Throws `ApiResponseError`: `403` `pipelex.org.required` when the caller has no active
|
|
3475
3514
|
* organization, `404` when its row is missing, and an answer that is not a JSON object, an
|
|
@@ -3486,9 +3525,10 @@ export class PipelexApiClient {
|
|
|
3486
3525
|
* value (`OrganizationBrandingUpdate`), so `{}` writes nothing. A new logo is the
|
|
3487
3526
|
* `pipelex-storage://` URI of a file the organization uploaded on its own, which the platform
|
|
3488
3527
|
* reads and measures, then copies under `branding/`: the answer's `uri` is that copy, and sending
|
|
3489
|
-
* it back unchanged keeps the logo. The logo a write replaces or clears is erased. A
|
|
3490
|
-
* typeface is an id of the shape `^[a-z0-9-]{1,32}$`, stored whether or not it names
|
|
3491
|
-
* exists.
|
|
3528
|
+
* it back unchanged keeps the logo. The logo a write replaces or clears is erased. A preset, a
|
|
3529
|
+
* shell or a typeface is an id of the shape `^[a-z0-9-]{1,32}$`, stored whether or not it names
|
|
3530
|
+
* one that exists. A design system replaces the stored one whole, and `null` removes it. Answers
|
|
3531
|
+
* the branding as the write left it, read as `getBranding` reads it.
|
|
3492
3532
|
*
|
|
3493
3533
|
* Throws `RequestArgumentError` for an organization id that is empty, `.` or `..`, before any
|
|
3494
3534
|
* request. Throws `ApiResponseError`, refusing every change of the request when it refuses one:
|
|
@@ -3496,14 +3536,16 @@ export class PipelexApiClient {
|
|
|
3496
3536
|
* `auth.forbidden` for a runner or a caller with no recognised role, `404`
|
|
3497
3537
|
* `pipelex.org.not_found` for a missing organization, `409` `pipelex.org.not_manageable` for a
|
|
3498
3538
|
* personal workspace, which has no branding, and `422` `request.invalid` for a colour that is
|
|
3499
|
-
* not `#rrggbb`, a
|
|
3500
|
-
* names the field in `location.field`: the
|
|
3501
|
-
* item's of its `errors` when it refuses
|
|
3502
|
-
*
|
|
3503
|
-
*
|
|
3504
|
-
*
|
|
3505
|
-
* `pipelex.org.mismatch` for another organization's file,
|
|
3506
|
-
*
|
|
3539
|
+
* not `#rrggbb`, a preset, a shell or a typeface of another shape, a design system of another
|
|
3540
|
+
* shape, or a key the body does not know, which names the field in `location.field`: the
|
|
3541
|
+
* problem's own when it refuses one field alone, each item's of its `errors` when it refuses
|
|
3542
|
+
* several. `white_label` is such a key, since only Pipelex staff grant it, and so is `style`, the
|
|
3543
|
+
* retired app style. A logo's refusal names its slot's key, such as `square_logo` or
|
|
3544
|
+
* `dark_wide_logo`, in `location.field`: `422` `pipelex.storage.uri_invalid` for a URI that is
|
|
3545
|
+
* not a storage URI and `403` `pipelex.org.mismatch` for another organization's file, both on the
|
|
3546
|
+
* problem itself, and `422` `request.unsupported` for a file the platform refused, naming the
|
|
3547
|
+
* first broken rule in `params.field` and `params.reason`, a `LogoRefusalCode`, and, when several
|
|
3548
|
+
* rules are broken, one item per rule in its `errors`, each naming its own slot and reason. A
|
|
3507
3549
|
* `503` `runtime.unavailable` is a failure of the platform's storage or its database, after which
|
|
3508
3550
|
* the write may have landed or not: the same input sent again is safe.
|
|
3509
3551
|
*/
|
|
@@ -3648,6 +3690,26 @@ export class PipelexApiClient {
|
|
|
3648
3690
|
async fetchArtifact(uri, options) {
|
|
3649
3691
|
return fetchArtifactImpl(this, uri, options);
|
|
3650
3692
|
}
|
|
3693
|
+
/**
|
|
3694
|
+
* Fetch one result artifact the platform handed back by reference — an entry of
|
|
3695
|
+
* `RunResults.artifact_links` — and read it as the result fields it fills: `{ graph_spec }`,
|
|
3696
|
+
* `{ main_stuff }`, …, and `{ tokens_usages, usage_assembly_error }` unpacked from the usage
|
|
3697
|
+
* envelope. Read exactly (`parseExactJson`), under `fetchArtifact`'s bounds. The links inside the
|
|
3698
|
+
* artifact are as stored, never re-signed. See `docs/run-results.md`, "Artifacts handed back by
|
|
3699
|
+
* reference".
|
|
3700
|
+
*/
|
|
3701
|
+
async fetchRunArtifact(artifact, link, options) {
|
|
3702
|
+
return fetchRunArtifactImpl(this, artifact, link, options);
|
|
3703
|
+
}
|
|
3704
|
+
/**
|
|
3705
|
+
* A result with the artifacts it handed back by reference fetched into their fields, every one
|
|
3706
|
+
* or those `options.artifacts` names, each followed entry dropped from `artifact_links`. What the
|
|
3707
|
+
* result readers do by default; for a result read with `followArtifactLinks: false`. Returns a
|
|
3708
|
+
* new result, or the same one when it holds no link to follow.
|
|
3709
|
+
*/
|
|
3710
|
+
async followArtifactLinks(results, options) {
|
|
3711
|
+
return followArtifactLinksImpl(this, results, options);
|
|
3712
|
+
}
|
|
3651
3713
|
/**
|
|
3652
3714
|
* Save a run's produced files under a directory — the download twin of
|
|
3653
3715
|
* {@link prepareInputs}, Node-only. Keyed on a `run_id` (the results are
|
|
@@ -5370,17 +5432,23 @@ function withCheckedUse(use) {
|
|
|
5370
5432
|
};
|
|
5371
5433
|
}
|
|
5372
5434
|
/**
|
|
5373
|
-
* A branding with its `
|
|
5374
|
-
*
|
|
5375
|
-
*
|
|
5376
|
-
*
|
|
5377
|
-
*
|
|
5435
|
+
* A branding with its `preset`, `shell` and `typeface` kept only when each is a string, its
|
|
5436
|
+
* `design_system` only when it is a JSON object, each read as `null` otherwise, its dark logos read
|
|
5437
|
+
* as `null` when the answer leaves them out, and its `white_label` read as `true` only when it is
|
|
5438
|
+
* `true`: when the answer leaves a member out, as a platform that predates it does, sends `null`,
|
|
5439
|
+
* or sends any other type. So each is what `OrganizationBranding` declares, never `undefined`, and
|
|
5440
|
+
* anything but the entitlement itself reads as no entitlement, which keeps Pipelex's mark. The rest
|
|
5441
|
+
* is returned as it came.
|
|
5378
5442
|
*/
|
|
5379
5443
|
function withCheckedBrandingChoices(answer) {
|
|
5380
5444
|
return {
|
|
5381
5445
|
...answer,
|
|
5382
|
-
|
|
5446
|
+
dark_square_logo: answer.dark_square_logo ?? null,
|
|
5447
|
+
dark_wide_logo: answer.dark_wide_logo ?? null,
|
|
5448
|
+
preset: typeof answer.preset === "string" ? answer.preset : null,
|
|
5449
|
+
shell: typeof answer.shell === "string" ? answer.shell : null,
|
|
5383
5450
|
typeface: typeof answer.typeface === "string" ? answer.typeface : null,
|
|
5451
|
+
design_system: isPlainObject(answer.design_system) ? answer.design_system : null,
|
|
5384
5452
|
white_label: answer.white_label === true,
|
|
5385
5453
|
};
|
|
5386
5454
|
}
|