Fix the TS SDK npm release: stop .gitignore from swallowing the artifacts resource (#8476)
Some checks failed
Run tests and pre-commit / Frontend Lint and Build (push) Has been cancelled
Run tests and pre-commit / Run tests and pre-commit hooks (push) Has been cancelled
Run tests and pre-commit / pip Package Smoke Tests (3.11) (push) Has been cancelled
Run tests and pre-commit / pip Package Smoke Tests (3.13) (push) Has been cancelled
Publish Fern Docs / run (push) Has been cancelled
Build Skyvern TS SDK and publish to npm / check-version-change (push) Has been cancelled
Build Skyvern TS SDK and publish to npm / build-and-publish-sdk (push) Has been cancelled

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Shuchang Zheng 2026-09-23 00:35:23 -04:00 • committed by GitHub
parent fa0235cab8
commit f42220c891
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 113 additions and 0 deletions

3
.gitignore vendored
View file

@ -166,6 +166,9 @@ credential_vault/
videos/
skyvern/artifacts/
artifacts/
# The bare artifacts/ rule above is unanchored and would otherwise swallow the
# Fern-generated TS SDK resource of the same name, breaking the npm release build.
!skyvern-ts/client/src/api/resources/artifacts/
traces/
*.pkl
har/

View file

@ -0,0 +1,108 @@
// This file was auto-generated by Fern from our API Definition.
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
import * as core from "../../../../core/index.js";
import * as environments from "../../../../environments.js";
import * as errors from "../../../../errors/index.js";
import * as Skyvern from "../../../index.js";
export declare namespace Artifacts {
export interface Options extends BaseClientOptions {}
export interface RequestOptions extends BaseRequestOptions {}
}
export class Artifacts {
protected readonly _options: Artifacts.Options;
constructor(_options: Artifacts.Options = {}) {
this._options = _options;
}
/**
* Download the raw content of an artifact (supports bundled artifacts).
*
* @param {string} artifactId
* @param {Artifacts.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Skyvern.ForbiddenError}
* @throws {@link Skyvern.NotFoundError}
* @throws {@link Skyvern.RangeNotSatisfiableError}
* @throws {@link Skyvern.UnprocessableEntityError}
*
* @example
* await client.artifacts.getArtifactContent("artifact_id")
*/
public getArtifactContent(
artifactId: string,
requestOptions?: Artifacts.RequestOptions,
): core.HttpResponsePromise<unknown> {
return core.HttpResponsePromise.fromPromise(this.__getArtifactContent(artifactId, requestOptions));
}
private async __getArtifactContent(
artifactId: string,
requestOptions?: Artifacts.RequestOptions,
): Promise<core.WithRawResponse<unknown>> {
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)) ??
environments.SkyvernEnvironment.Cloud,
`v1/artifacts/${core.url.encodePathParam(artifactId)}/content`,
),
method: "GET",
headers: _headers,
queryParameters: requestOptions?.queryParams,
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return { data: _response.body, rawResponse: _response.rawResponse };
}
if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 403:
throw new Skyvern.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
case 404:
throw new Skyvern.NotFoundError(_response.error.body as unknown, _response.rawResponse);
case 416:
throw new Skyvern.RangeNotSatisfiableError(_response.error.body as unknown, _response.rawResponse);
case 422:
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
default:
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}
}
switch (_response.error.reason) {
case "non-json":
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.SkyvernTimeoutError(
"Timeout exceeded when calling GET /v1/artifacts/{artifact_id}/content.",
);
case "unknown":
throw new errors.SkyvernError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1 @@
export * from "./client/index.js";