v1.0.19: make env vars should always overrides api keys stored in the streamlit mount in skyvern image (#4824)
This commit is contained in:
4
skyvern-ts/client/package-lock.json
generated
4
skyvern-ts/client/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@skyvern/client",
|
||||
"version": "1.0.18",
|
||||
"version": "1.0.19",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@skyvern/client",
|
||||
"version": "1.0.18",
|
||||
"version": "1.0.19",
|
||||
"dependencies": {
|
||||
"playwright": "^1.48.0"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skyvern/client",
|
||||
"version": "1.0.18",
|
||||
"version": "1.0.19",
|
||||
"private": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -26,8 +26,8 @@ export class SkyvernClient {
|
||||
"x-api-key": _options?.apiKey,
|
||||
"X-Fern-Language": "JavaScript",
|
||||
"X-Fern-SDK-Name": "@skyvern/client",
|
||||
"X-Fern-SDK-Version": "1.0.18",
|
||||
"User-Agent": "@skyvern/client/1.0.18",
|
||||
"X-Fern-SDK-Version": "1.0.19",
|
||||
"User-Agent": "@skyvern/client/1.0.19",
|
||||
"X-Fern-Runtime": core.RUNTIME.type,
|
||||
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
||||
},
|
||||
@@ -3139,6 +3139,83 @@ export class SkyvernClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all cached scripts for a specific workflow. This will trigger script regeneration on subsequent runs.
|
||||
*
|
||||
* @param {string} workflowPermanentId - The workflow permanent ID to clear cache for
|
||||
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
|
||||
*
|
||||
* @throws {@link Skyvern.UnprocessableEntityError}
|
||||
*
|
||||
* @example
|
||||
* await client.clearWorkflowCache("wpid_abc123")
|
||||
*/
|
||||
public clearWorkflowCache(
|
||||
workflowPermanentId: string,
|
||||
requestOptions?: SkyvernClient.RequestOptions,
|
||||
): core.HttpResponsePromise<Skyvern.ClearCacheResponse> {
|
||||
return core.HttpResponsePromise.fromPromise(this.__clearWorkflowCache(workflowPermanentId, requestOptions));
|
||||
}
|
||||
|
||||
private async __clearWorkflowCache(
|
||||
workflowPermanentId: string,
|
||||
requestOptions?: SkyvernClient.RequestOptions,
|
||||
): Promise<core.WithRawResponse<Skyvern.ClearCacheResponse>> {
|
||||
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/scripts/${core.url.encodePathParam(workflowPermanentId)}/cache`,
|
||||
),
|
||||
method: "DELETE",
|
||||
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 as Skyvern.ClearCacheResponse, rawResponse: _response.rawResponse };
|
||||
}
|
||||
|
||||
if (_response.error.reason === "status-code") {
|
||||
switch (_response.error.statusCode) {
|
||||
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 DELETE /v1/scripts/{workflow_permanent_id}/cache.",
|
||||
);
|
||||
case "unknown":
|
||||
throw new errors.SkyvernError({
|
||||
message: _response.error.errorMessage,
|
||||
rawResponse: _response.rawResponse,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a single SDK action with the specified parameters
|
||||
*
|
||||
|
||||
11
skyvern-ts/client/src/api/types/ClearCacheResponse.ts
Normal file
11
skyvern-ts/client/src/api/types/ClearCacheResponse.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
/**
|
||||
* Response model for cache clearing operations.
|
||||
*/
|
||||
export interface ClearCacheResponse {
|
||||
/** Number of cached entries deleted */
|
||||
deleted_count: number;
|
||||
/** Status message */
|
||||
message: string;
|
||||
}
|
||||
@@ -14,6 +14,10 @@ export interface CredentialResponse {
|
||||
credential_type: Skyvern.CredentialTypeOutput;
|
||||
/** Name of the credential */
|
||||
name: string;
|
||||
/** Browser profile ID linked to this credential */
|
||||
browser_profile_id?: string;
|
||||
/** Login page URL used during the credential test */
|
||||
tested_url?: string;
|
||||
}
|
||||
|
||||
export namespace CredentialResponse {
|
||||
|
||||
@@ -29,6 +29,9 @@ export interface WorkflowRun {
|
||||
sequential_key?: string;
|
||||
ai_fallback?: boolean;
|
||||
code_gen?: boolean;
|
||||
waiting_for_verification_code?: boolean;
|
||||
verification_code_identifier?: string;
|
||||
verification_code_polling_started_at?: string;
|
||||
queued_at?: string;
|
||||
started_at?: string;
|
||||
finished_at?: string;
|
||||
|
||||
@@ -28,6 +28,7 @@ export * from "./BrowserProfile.js";
|
||||
export * from "./BrowserSessionResponse.js";
|
||||
export * from "./ChangeTierResponse.js";
|
||||
export * from "./CheckoutSessionResponse.js";
|
||||
export * from "./ClearCacheResponse.js";
|
||||
export * from "./ClickAction.js";
|
||||
export * from "./ClickContext.js";
|
||||
export * from "./CodeBlock.js";
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const SDK_VERSION = "1.0.18";
|
||||
export const SDK_VERSION = "1.0.19";
|
||||
|
||||
@@ -1484,6 +1484,9 @@ describe("SkyvernClient", () => {
|
||||
sequential_key: "sequential_key",
|
||||
ai_fallback: true,
|
||||
code_gen: true,
|
||||
waiting_for_verification_code: true,
|
||||
verification_code_identifier: "verification_code_identifier",
|
||||
verification_code_polling_started_at: "2024-01-15T09:30:00Z",
|
||||
queued_at: "2024-01-15T09:30:00Z",
|
||||
started_at: "2024-01-15T09:30:00Z",
|
||||
finished_at: "2024-01-15T09:30:00Z",
|
||||
@@ -1531,6 +1534,9 @@ describe("SkyvernClient", () => {
|
||||
sequential_key: "sequential_key",
|
||||
ai_fallback: true,
|
||||
code_gen: true,
|
||||
waiting_for_verification_code: true,
|
||||
verification_code_identifier: "verification_code_identifier",
|
||||
verification_code_polling_started_at: "2024-01-15T09:30:00Z",
|
||||
queued_at: "2024-01-15T09:30:00Z",
|
||||
started_at: "2024-01-15T09:30:00Z",
|
||||
finished_at: "2024-01-15T09:30:00Z",
|
||||
@@ -2627,6 +2633,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
},
|
||||
];
|
||||
server.mockEndpoint().get("/v1/credentials").respondWith().statusCode(200).jsonBody(rawResponseBody).build();
|
||||
@@ -2645,6 +2653,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -2678,6 +2688,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
@@ -2706,6 +2718,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2756,6 +2770,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
@@ -2783,6 +2799,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2857,6 +2875,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
};
|
||||
server
|
||||
.mockEndpoint()
|
||||
@@ -2876,6 +2896,8 @@ describe("SkyvernClient", () => {
|
||||
},
|
||||
credential_type: "password",
|
||||
name: "Amazon Login",
|
||||
browser_profile_id: "browser_profile_id",
|
||||
tested_url: "tested_url",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3435,6 +3457,44 @@ describe("SkyvernClient", () => {
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("clear_workflow_cache (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { deleted_count: 1, message: "message" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.delete("/v1/scripts/wpid_abc123/cache")
|
||||
.respondWith()
|
||||
.statusCode(200)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
const response = await client.clearWorkflowCache("wpid_abc123");
|
||||
expect(response).toEqual({
|
||||
deleted_count: 1,
|
||||
message: "message",
|
||||
});
|
||||
});
|
||||
|
||||
test("clear_workflow_cache (2)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
const rawResponseBody = { key: "value" };
|
||||
server
|
||||
.mockEndpoint()
|
||||
.delete("/v1/scripts/workflow_permanent_id/cache")
|
||||
.respondWith()
|
||||
.statusCode(422)
|
||||
.jsonBody(rawResponseBody)
|
||||
.build();
|
||||
|
||||
await expect(async () => {
|
||||
return await client.clearWorkflowCache("workflow_permanent_id");
|
||||
}).rejects.toThrow(Skyvern.UnprocessableEntityError);
|
||||
});
|
||||
|
||||
test("run_sdk_action (1)", async () => {
|
||||
const server = mockServerPool.createServer();
|
||||
const client = new SkyvernClient({ apiKey: "test", environment: server.baseUrl });
|
||||
|
||||
Reference in New Issue
Block a user