@planqk/planqk-service-sdk 2.6.2 → 2.8.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/dist/sdk/BaseClient.d.ts +26 -0
- package/dist/sdk/{api/resources/serviceApi/types/GetResultResponse.js → BaseClient.js} +1 -3
- package/dist/sdk/Client.d.ts +4 -22
- package/dist/sdk/Client.js +2 -4
- package/dist/sdk/api/index.d.ts +1 -1
- package/dist/sdk/api/index.js +1 -1
- package/dist/sdk/api/resources/index.d.ts +0 -1
- package/dist/sdk/api/resources/index.js +0 -4
- package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +9 -26
- package/dist/sdk/api/resources/serviceApi/client/Client.js +43 -27
- package/dist/sdk/api/resources/serviceApi/index.d.ts +0 -1
- package/dist/sdk/api/resources/serviceApi/index.js +0 -1
- package/dist/sdk/api/types/HalLink.d.ts +0 -3
- package/dist/sdk/api/types/HalLink.js +1 -3
- package/dist/sdk/api/types/LogEntry.d.ts +19 -0
- package/dist/sdk/api/types/LogEntry.js +15 -0
- package/dist/sdk/api/types/RequestBody.d.ts +1 -0
- package/dist/sdk/api/types/RequestBody.js +3 -0
- package/dist/sdk/api/types/ResultResponse.d.ts +15 -0
- package/dist/sdk/api/types/ResultResponse.js +3 -0
- package/dist/sdk/api/types/ServiceExecution.d.ts +1 -4
- package/dist/sdk/api/types/ServiceExecution.js +1 -3
- package/dist/sdk/api/types/index.d.ts +3 -0
- package/dist/sdk/api/types/index.js +3 -0
- package/dist/sdk/core/auth/AuthProvider.d.ts +4 -0
- package/dist/sdk/core/auth/AuthProvider.js +2 -0
- package/dist/sdk/core/auth/AuthRequest.d.ts +9 -0
- package/dist/sdk/core/auth/AuthRequest.js +2 -0
- package/dist/sdk/core/auth/BasicAuth.js +2 -1
- package/dist/sdk/core/auth/index.d.ts +2 -0
- package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/sdk/core/fetcher/BinaryResponse.d.ts +1 -1
- package/dist/sdk/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/sdk/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/sdk/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/sdk/core/fetcher/EndpointSupplier.js +13 -0
- package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -4
- package/dist/sdk/core/fetcher/Fetcher.js +3 -3
- package/dist/sdk/core/fetcher/HttpResponsePromise.d.ts +1 -1
- package/dist/sdk/core/fetcher/index.d.ts +7 -5
- package/dist/sdk/core/fetcher/index.js +7 -5
- package/dist/sdk/core/fetcher/requestWithRetries.js +44 -8
- package/dist/sdk/core/headers.d.ts +2 -3
- package/dist/sdk/core/url/join.js +23 -3
- package/dist/sdk/environments.d.ts +0 -3
- package/dist/sdk/environments.js +1 -3
- package/dist/sdk/errors/PlanqkServiceApiError.d.ts +0 -3
- package/dist/sdk/errors/PlanqkServiceApiError.js +1 -3
- package/dist/sdk/errors/PlanqkServiceApiTimeoutError.d.ts +0 -3
- package/dist/sdk/errors/PlanqkServiceApiTimeoutError.js +1 -3
- package/dist/sdk/index.d.ts +1 -0
- package/fern/fern.config.json +1 -1
- package/fern/generators.yml +6 -4
- package/fern/openapi/openapi.yml +115 -80
- package/package.json +1 -1
- package/planqk/service/_version.py +1 -1
- package/planqk/service/client.py +3 -3
- package/planqk/service/sdk/__init__.py +61 -8
- package/planqk/service/sdk/client.py +27 -7
- package/planqk/service/sdk/core/__init__.py +80 -20
- package/planqk/service/sdk/core/client_wrapper.py +8 -6
- package/planqk/service/sdk/core/force_multipart.py +4 -2
- package/planqk/service/sdk/core/http_response.py +1 -1
- package/planqk/service/sdk/core/http_sse/__init__.py +42 -0
- package/planqk/service/sdk/core/http_sse/_api.py +112 -0
- package/planqk/service/sdk/core/http_sse/_decoders.py +61 -0
- package/planqk/service/sdk/core/http_sse/_exceptions.py +7 -0
- package/planqk/service/sdk/core/http_sse/_models.py +17 -0
- package/planqk/service/sdk/core/pydantic_utilities.py +5 -2
- package/planqk/service/sdk/core/unchecked_base_model.py +341 -0
- package/planqk/service/sdk/service_api/__init__.py +0 -3
- package/planqk/service/sdk/service_api/client.py +17 -21
- package/planqk/service/sdk/service_api/raw_client.py +36 -40
- package/planqk/service/sdk/types/__init__.py +57 -4
- package/planqk/service/sdk/types/hal_link.py +3 -2
- package/planqk/service/sdk/types/log_entry.py +35 -0
- package/planqk/service/sdk/types/log_entry_severity.py +5 -0
- package/planqk/service/sdk/types/request_body.py +5 -0
- package/planqk/service/sdk/types/result_response.py +27 -0
- package/planqk/service/sdk/{service_api/types/get_result_response_embedded.py → types/result_response_embedded.py} +4 -3
- package/planqk/service/sdk/{service_api/types/get_result_response_links.py → types/result_response_links.py} +4 -3
- package/planqk/service/sdk/types/service_execution.py +3 -2
- package/pyproject.toml +1 -1
- package/requirements-dev.txt +59 -43
- package/requirements.txt +6 -6
- package/src/index.test.ts +10 -0
- package/src/sdk/BaseClient.ts +30 -0
- package/src/sdk/Client.ts +6 -23
- package/src/sdk/api/index.ts +1 -1
- package/src/sdk/api/resources/index.ts +0 -1
- package/src/sdk/api/resources/serviceApi/client/Client.ts +87 -82
- package/src/sdk/api/resources/serviceApi/index.ts +0 -1
- package/src/sdk/api/types/HalLink.ts +1 -3
- package/src/sdk/api/types/LogEntry.ts +22 -0
- package/src/sdk/api/types/RequestBody.ts +3 -0
- package/src/sdk/api/types/ResultResponse.ts +20 -0
- package/src/sdk/api/types/ServiceExecution.ts +2 -4
- package/src/sdk/api/types/index.ts +3 -0
- package/src/sdk/core/auth/AuthProvider.ts +5 -0
- package/src/sdk/core/auth/AuthRequest.ts +9 -0
- package/src/sdk/core/auth/BasicAuth.ts +2 -1
- package/src/sdk/core/auth/index.ts +2 -0
- package/src/sdk/core/fetcher/APIResponse.ts +1 -1
- package/src/sdk/core/fetcher/BinaryResponse.ts +1 -1
- package/src/sdk/core/fetcher/EndpointMetadata.ts +13 -0
- package/src/sdk/core/fetcher/EndpointSupplier.ts +14 -0
- package/src/sdk/core/fetcher/Fetcher.ts +8 -6
- package/src/sdk/core/fetcher/HttpResponsePromise.ts +1 -1
- package/src/sdk/core/fetcher/index.ts +7 -5
- package/src/sdk/core/fetcher/requestWithRetries.ts +49 -9
- package/src/sdk/core/headers.ts +8 -10
- package/src/sdk/core/url/join.ts +28 -3
- package/src/sdk/environments.ts +1 -3
- package/src/sdk/errors/PlanqkServiceApiError.ts +1 -3
- package/src/sdk/errors/PlanqkServiceApiTimeoutError.ts +1 -3
- package/src/sdk/index.ts +1 -0
- package/uv.lock +77 -47
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +0 -18
- package/dist/sdk/api/resources/serviceApi/types/index.d.ts +0 -1
- package/dist/sdk/api/resources/serviceApi/types/index.js +0 -17
- package/planqk/service/sdk/service_api/types/__init__.py +0 -9
- package/planqk/service/sdk/service_api/types/get_result_response.py +0 -26
- package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +0 -22
- package/src/sdk/api/resources/serviceApi/types/index.ts +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { APIResponse } from "./APIResponse.js";
|
|
2
|
-
import {
|
|
1
|
+
import type { APIResponse } from "./APIResponse.js";
|
|
2
|
+
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
3
|
+
import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
3
4
|
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
4
5
|
export declare namespace Fetcher {
|
|
5
6
|
interface Args {
|
|
6
7
|
url: string;
|
|
7
8
|
method: string;
|
|
8
9
|
contentType?: string;
|
|
9
|
-
headers?: Record<string, string |
|
|
10
|
-
queryParameters?: Record<string,
|
|
10
|
+
headers?: Record<string, string | EndpointSupplier<string | null | undefined> | null | undefined>;
|
|
11
|
+
queryParameters?: Record<string, unknown>;
|
|
11
12
|
body?: unknown;
|
|
12
13
|
timeoutMs?: number;
|
|
13
14
|
maxRetries?: number;
|
|
@@ -16,6 +17,7 @@ export declare namespace Fetcher {
|
|
|
16
17
|
requestType?: "json" | "file" | "bytes";
|
|
17
18
|
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response";
|
|
18
19
|
duplex?: "half";
|
|
20
|
+
endpointMetadata?: EndpointMetadata;
|
|
19
21
|
}
|
|
20
22
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
|
21
23
|
interface FailedStatusCodeError {
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetcher = void 0;
|
|
4
4
|
exports.fetcherImpl = fetcherImpl;
|
|
5
5
|
const json_js_1 = require("../json.js");
|
|
6
|
-
const RawResponse_js_1 = require("./RawResponse.js");
|
|
7
|
-
const Supplier_js_1 = require("./Supplier.js");
|
|
8
6
|
const createRequestUrl_js_1 = require("./createRequestUrl.js");
|
|
7
|
+
const EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
9
8
|
const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
|
|
10
9
|
const getFetchFn_js_1 = require("./getFetchFn.js");
|
|
11
10
|
const getRequestBody_js_1 = require("./getRequestBody.js");
|
|
12
11
|
const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
13
12
|
const makeRequest_js_1 = require("./makeRequest.js");
|
|
13
|
+
const RawResponse_js_1 = require("./RawResponse.js");
|
|
14
14
|
const requestWithRetries_js_1 = require("./requestWithRetries.js");
|
|
15
15
|
async function getHeaders(args) {
|
|
16
16
|
const newHeaders = {};
|
|
@@ -21,7 +21,7 @@ async function getHeaders(args) {
|
|
|
21
21
|
return newHeaders;
|
|
22
22
|
}
|
|
23
23
|
for (const [key, value] of Object.entries(args.headers)) {
|
|
24
|
-
const result = await
|
|
24
|
+
const result = await EndpointSupplier_js_1.EndpointSupplier.get(value, { endpointMetadata: args.endpointMetadata ?? {} });
|
|
25
25
|
if (typeof result === "string") {
|
|
26
26
|
newHeaders[key] = result;
|
|
27
27
|
continue;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type { APIResponse } from "./APIResponse.js";
|
|
2
|
-
export {
|
|
2
|
+
export type { BinaryResponse } from "./BinaryResponse.js";
|
|
3
|
+
export type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
4
|
+
export { EndpointSupplier } from "./EndpointSupplier.js";
|
|
3
5
|
export type { Fetcher, FetchFunction } from "./Fetcher.js";
|
|
6
|
+
export { fetcher } from "./Fetcher.js";
|
|
4
7
|
export { getHeader } from "./getHeader.js";
|
|
5
|
-
export { Supplier } from "./Supplier.js";
|
|
6
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
7
|
-
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
|
|
8
8
|
export { HttpResponsePromise } from "./HttpResponsePromise.js";
|
|
9
|
-
export {
|
|
9
|
+
export type { RawResponse, WithRawResponse } from "./RawResponse.js";
|
|
10
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
11
|
+
export { Supplier } from "./Supplier.js";
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Supplier = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.HttpResponsePromise = exports.getHeader = exports.fetcher = exports.EndpointSupplier = void 0;
|
|
4
|
+
var EndpointSupplier_js_1 = require("./EndpointSupplier.js");
|
|
5
|
+
Object.defineProperty(exports, "EndpointSupplier", { enumerable: true, get: function () { return EndpointSupplier_js_1.EndpointSupplier; } });
|
|
4
6
|
var Fetcher_js_1 = require("./Fetcher.js");
|
|
5
7
|
Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_js_1.fetcher; } });
|
|
6
8
|
var getHeader_js_1 = require("./getHeader.js");
|
|
7
9
|
Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_js_1.getHeader; } });
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
|
|
11
|
+
Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
|
|
10
12
|
var RawResponse_js_1 = require("./RawResponse.js");
|
|
11
13
|
Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.abortRawResponse; } });
|
|
12
14
|
Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.toRawResponse; } });
|
|
13
15
|
Object.defineProperty(exports, "unknownRawResponse", { enumerable: true, get: function () { return RawResponse_js_1.unknownRawResponse; } });
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
+
var Supplier_js_1 = require("./Supplier.js");
|
|
17
|
+
Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_js_1.Supplier; } });
|
|
@@ -5,20 +5,56 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
|
|
|
5
5
|
const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
6
6
|
const DEFAULT_MAX_RETRIES = 2;
|
|
7
7
|
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
8
|
-
function
|
|
9
|
-
// Generate a random value between
|
|
10
|
-
const jitterMultiplier = 1 +
|
|
8
|
+
function addPositiveJitter(delay) {
|
|
9
|
+
// Generate a random value between 0 and +JITTER_FACTOR
|
|
10
|
+
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
11
11
|
return delay * jitterMultiplier;
|
|
12
12
|
}
|
|
13
|
+
function addSymmetricJitter(delay) {
|
|
14
|
+
// Generate a random value in a JITTER_FACTOR-sized percentage range around delay
|
|
15
|
+
const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
|
|
16
|
+
return delay * jitterMultiplier;
|
|
17
|
+
}
|
|
18
|
+
function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
19
|
+
// Check for Retry-After header first (RFC 7231), with no jitter
|
|
20
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
21
|
+
if (retryAfter) {
|
|
22
|
+
// Parse as number of seconds...
|
|
23
|
+
const retryAfterSeconds = parseInt(retryAfter, 10);
|
|
24
|
+
if (!isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
|
|
25
|
+
return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
|
|
26
|
+
}
|
|
27
|
+
// ...or as an HTTP date; both are valid
|
|
28
|
+
const retryAfterDate = new Date(retryAfter);
|
|
29
|
+
if (!isNaN(retryAfterDate.getTime())) {
|
|
30
|
+
const delay = retryAfterDate.getTime() - Date.now();
|
|
31
|
+
if (delay > 0) {
|
|
32
|
+
return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Then check for industry-standard X-RateLimit-Reset header, with positive jitter
|
|
37
|
+
const rateLimitReset = response.headers.get("X-RateLimit-Reset");
|
|
38
|
+
if (rateLimitReset) {
|
|
39
|
+
const resetTime = parseInt(rateLimitReset, 10);
|
|
40
|
+
if (!isNaN(resetTime)) {
|
|
41
|
+
// Assume Unix timestamp in epoch seconds
|
|
42
|
+
const delay = resetTime * 1000 - Date.now();
|
|
43
|
+
if (delay > 0) {
|
|
44
|
+
return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Fall back to exponential backoff, with symmetric jitter
|
|
49
|
+
return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
|
|
50
|
+
}
|
|
13
51
|
async function requestWithRetries(requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
14
52
|
let response = await requestFn();
|
|
15
53
|
for (let i = 0; i < maxRetries; ++i) {
|
|
16
54
|
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
17
|
-
//
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const delayWithJitter = addJitter(baseDelay);
|
|
21
|
-
await new Promise((resolve) => setTimeout(resolve, delayWithJitter));
|
|
55
|
+
// Get delay with appropriate jitter applied
|
|
56
|
+
const delay = getRetryDelayFromHeaders(response, i);
|
|
57
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
22
58
|
response = await requestFn();
|
|
23
59
|
}
|
|
24
60
|
else {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
|
|
1
|
+
export declare function mergeHeaders<THeaderValue>(...headersArray: (Record<string, THeaderValue> | null | undefined)[]): Record<string, string | THeaderValue>;
|
|
2
|
+
export declare function mergeOnlyDefinedHeaders<THeaderValue>(...headersArray: (Record<string, THeaderValue> | null | undefined)[]): Record<string, THeaderValue>;
|
|
@@ -5,6 +5,9 @@ function join(base, ...segments) {
|
|
|
5
5
|
if (!base) {
|
|
6
6
|
return "";
|
|
7
7
|
}
|
|
8
|
+
if (segments.length === 0) {
|
|
9
|
+
return base;
|
|
10
|
+
}
|
|
8
11
|
if (base.includes("://")) {
|
|
9
12
|
let url;
|
|
10
13
|
try {
|
|
@@ -14,24 +17,37 @@ function join(base, ...segments) {
|
|
|
14
17
|
// Fallback to path joining if URL is malformed
|
|
15
18
|
return joinPath(base, ...segments);
|
|
16
19
|
}
|
|
20
|
+
const lastSegment = segments[segments.length - 1];
|
|
21
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
17
22
|
for (const segment of segments) {
|
|
18
23
|
const cleanSegment = trimSlashes(segment);
|
|
19
24
|
if (cleanSegment) {
|
|
20
25
|
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
21
26
|
}
|
|
22
27
|
}
|
|
28
|
+
if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
|
|
29
|
+
url.pathname += "/";
|
|
30
|
+
}
|
|
23
31
|
return url.toString();
|
|
24
32
|
}
|
|
25
33
|
return joinPath(base, ...segments);
|
|
26
34
|
}
|
|
27
35
|
function joinPath(base, ...segments) {
|
|
36
|
+
if (segments.length === 0) {
|
|
37
|
+
return base;
|
|
38
|
+
}
|
|
28
39
|
let result = base;
|
|
40
|
+
const lastSegment = segments[segments.length - 1];
|
|
41
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
29
42
|
for (const segment of segments) {
|
|
30
43
|
const cleanSegment = trimSlashes(segment);
|
|
31
44
|
if (cleanSegment) {
|
|
32
45
|
result = joinPathSegments(result, cleanSegment);
|
|
33
46
|
}
|
|
34
47
|
}
|
|
48
|
+
if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
|
|
49
|
+
result += "/";
|
|
50
|
+
}
|
|
35
51
|
return result;
|
|
36
52
|
}
|
|
37
53
|
function joinPathSegments(left, right) {
|
|
@@ -43,7 +59,11 @@ function joinPathSegments(left, right) {
|
|
|
43
59
|
function trimSlashes(str) {
|
|
44
60
|
if (!str)
|
|
45
61
|
return str;
|
|
46
|
-
let start =
|
|
47
|
-
let end = str.
|
|
48
|
-
|
|
62
|
+
let start = 0;
|
|
63
|
+
let end = str.length;
|
|
64
|
+
if (str.startsWith("/"))
|
|
65
|
+
start = 1;
|
|
66
|
+
if (str.endsWith("/"))
|
|
67
|
+
end = str.length - 1;
|
|
68
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
49
69
|
}
|
package/dist/sdk/environments.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.PlanqkServiceApiEnvironment = void 0;
|
|
7
5
|
exports.PlanqkServiceApiEnvironment = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.PlanqkServiceApiError = void 0;
|
|
7
5
|
const json_js_1 = require("../core/json.js");
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.PlanqkServiceApiTimeoutError = void 0;
|
|
7
5
|
class PlanqkServiceApiTimeoutError extends Error {
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as PlanqkServiceApi from "./api/index.js";
|
|
2
2
|
export { PlanqkServiceApiError, PlanqkServiceApiTimeoutError } from "./errors/index.js";
|
|
3
|
+
export { type BaseClientOptions, type BaseRequestOptions } from "./BaseClient.js";
|
|
3
4
|
export { PlanqkServiceApiClient } from "./Client.js";
|
|
4
5
|
export { PlanqkServiceApiEnvironment } from "./environments.js";
|
package/fern/fern.config.json
CHANGED
package/fern/generators.yml
CHANGED
|
@@ -6,8 +6,8 @@ default-group: local
|
|
|
6
6
|
groups:
|
|
7
7
|
local:
|
|
8
8
|
generators:
|
|
9
|
-
- name: fernapi/fern-typescript-
|
|
10
|
-
version:
|
|
9
|
+
- name: fernapi/fern-typescript-sdk
|
|
10
|
+
version: 3.7.1
|
|
11
11
|
output:
|
|
12
12
|
location: local-file-system
|
|
13
13
|
path: ../generated/typescript
|
|
@@ -18,8 +18,10 @@ groups:
|
|
|
18
18
|
skipResponseValidation: true
|
|
19
19
|
noSerdeLayer: true
|
|
20
20
|
- name: fernapi/fern-python-sdk
|
|
21
|
-
version: 4.
|
|
21
|
+
version: 4.31.0
|
|
22
22
|
output:
|
|
23
23
|
location: local-file-system
|
|
24
24
|
path: ../generated/python
|
|
25
|
-
config:
|
|
25
|
+
config:
|
|
26
|
+
pydantic_config:
|
|
27
|
+
skip_validation: true
|
package/fern/openapi/openapi.yml
CHANGED
|
@@ -4,6 +4,116 @@ info:
|
|
|
4
4
|
title: PLANQK Service API
|
|
5
5
|
description: |
|
|
6
6
|
API description for a managed PLANQK Service.
|
|
7
|
+
components:
|
|
8
|
+
schemas:
|
|
9
|
+
RequestBody:
|
|
10
|
+
type: object
|
|
11
|
+
additionalProperties: true
|
|
12
|
+
#
|
|
13
|
+
# Define the schema of your service execution input here
|
|
14
|
+
#
|
|
15
|
+
ResultResponse:
|
|
16
|
+
type: object
|
|
17
|
+
additionalProperties: true
|
|
18
|
+
properties:
|
|
19
|
+
#
|
|
20
|
+
# Add the schema of your result response here
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
# DO NOT REMOVE THE FOLLOWING LINES
|
|
24
|
+
_links:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
status:
|
|
28
|
+
$ref: '#/components/schemas/HALLink'
|
|
29
|
+
additionalProperties:
|
|
30
|
+
$ref: '#/components/schemas/HALLink'
|
|
31
|
+
_embedded:
|
|
32
|
+
type: object
|
|
33
|
+
properties:
|
|
34
|
+
status:
|
|
35
|
+
$ref: '#/components/schemas/ServiceExecution'
|
|
36
|
+
ServiceExecution:
|
|
37
|
+
type: object
|
|
38
|
+
properties:
|
|
39
|
+
id:
|
|
40
|
+
type: string
|
|
41
|
+
examples: [ 87cb778e-ac43-11ec-b909-0242ac120002 ]
|
|
42
|
+
status:
|
|
43
|
+
type: string
|
|
44
|
+
enum: [ UNKNOWN, PENDING, RUNNING, SUCCEEDED, CANCELLED, FAILED ]
|
|
45
|
+
examples: [ SUCCEEDED ]
|
|
46
|
+
createdAt:
|
|
47
|
+
type: string
|
|
48
|
+
examples: [ "2022-01-01 22:38:08" ]
|
|
49
|
+
startedAt:
|
|
50
|
+
type: string
|
|
51
|
+
examples: [ "2022-01-01 22:39:08" ]
|
|
52
|
+
endedAt:
|
|
53
|
+
type: string
|
|
54
|
+
examples: [ "2022-01-01 22:40:08" ]
|
|
55
|
+
LogEntry:
|
|
56
|
+
type: object
|
|
57
|
+
properties:
|
|
58
|
+
message:
|
|
59
|
+
type: string
|
|
60
|
+
description: Log message content.
|
|
61
|
+
severity:
|
|
62
|
+
type: string
|
|
63
|
+
description: Severity of the log entry.
|
|
64
|
+
enum:
|
|
65
|
+
- DEBUG
|
|
66
|
+
- NOTICE
|
|
67
|
+
- INFO
|
|
68
|
+
- WARNING
|
|
69
|
+
- ERROR
|
|
70
|
+
examples: [ "INFO" ]
|
|
71
|
+
timestamp:
|
|
72
|
+
type: string
|
|
73
|
+
format: date-time
|
|
74
|
+
description: Timestamp when the entry was logged.
|
|
75
|
+
examples: [ "2025-10-10T08:23:26.452335419Z" ]
|
|
76
|
+
# Representation of link as defined in HAL: https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-11
|
|
77
|
+
HALLink:
|
|
78
|
+
type: object
|
|
79
|
+
properties:
|
|
80
|
+
href:
|
|
81
|
+
type: string
|
|
82
|
+
description: The URL of the link
|
|
83
|
+
templated:
|
|
84
|
+
type: boolean
|
|
85
|
+
description: Whether the link is templated (optional)
|
|
86
|
+
default: false
|
|
87
|
+
type:
|
|
88
|
+
type: string
|
|
89
|
+
description: The media type of the link (optional)
|
|
90
|
+
deprecation:
|
|
91
|
+
type: string
|
|
92
|
+
description: A URL that provides further information about the deprecation of the link (optional)
|
|
93
|
+
name:
|
|
94
|
+
type: string
|
|
95
|
+
description: The name of the link (optional)
|
|
96
|
+
profile:
|
|
97
|
+
type: string
|
|
98
|
+
description: A URL that provides further information about the profile of the link (optional)
|
|
99
|
+
title:
|
|
100
|
+
type: string
|
|
101
|
+
description: The title of the link (optional)
|
|
102
|
+
hreflang:
|
|
103
|
+
type: string
|
|
104
|
+
description: The language of the link's target resource (optional)
|
|
105
|
+
securitySchemes:
|
|
106
|
+
ApplicationCredentials:
|
|
107
|
+
type: oauth2
|
|
108
|
+
flows:
|
|
109
|
+
clientCredentials:
|
|
110
|
+
tokenUrl: https://gateway.platform.planqk.de/token
|
|
111
|
+
scopes: { }
|
|
112
|
+
security:
|
|
113
|
+
- ApplicationCredentials: [ ]
|
|
114
|
+
servers:
|
|
115
|
+
- url: https://gateway.platform.planqk.de/<context>/<service>/<version>
|
|
116
|
+
description: The service endpoint
|
|
7
117
|
paths:
|
|
8
118
|
/:
|
|
9
119
|
get:
|
|
@@ -36,8 +146,7 @@ paths:
|
|
|
36
146
|
content:
|
|
37
147
|
application/json:
|
|
38
148
|
schema:
|
|
39
|
-
|
|
40
|
-
additionalProperties: true
|
|
149
|
+
$ref: "#/components/schemas/RequestBody"
|
|
41
150
|
responses:
|
|
42
151
|
"201":
|
|
43
152
|
description: Service execution is submitted
|
|
@@ -96,21 +205,7 @@ paths:
|
|
|
96
205
|
content:
|
|
97
206
|
application/json:
|
|
98
207
|
schema:
|
|
99
|
-
|
|
100
|
-
additionalProperties: true
|
|
101
|
-
properties:
|
|
102
|
-
_links:
|
|
103
|
-
type: object
|
|
104
|
-
properties:
|
|
105
|
-
status:
|
|
106
|
-
$ref: '#/components/schemas/HALLink'
|
|
107
|
-
additionalProperties:
|
|
108
|
-
$ref: '#/components/schemas/HALLink'
|
|
109
|
-
_embedded:
|
|
110
|
-
type: object
|
|
111
|
-
properties:
|
|
112
|
-
status:
|
|
113
|
-
$ref: '#/components/schemas/ServiceExecution'
|
|
208
|
+
$ref: "#/components/schemas/ResultResponse"
|
|
114
209
|
/{id}/result/{file}:
|
|
115
210
|
get:
|
|
116
211
|
tags:
|
|
@@ -165,7 +260,9 @@ paths:
|
|
|
165
260
|
schema:
|
|
166
261
|
type: array
|
|
167
262
|
items:
|
|
168
|
-
|
|
263
|
+
$ref: "#/components/schemas/LogEntry"
|
|
264
|
+
"204":
|
|
265
|
+
description: No log entries available
|
|
169
266
|
/{id}/cancel:
|
|
170
267
|
put:
|
|
171
268
|
tags:
|
|
@@ -188,65 +285,3 @@ paths:
|
|
|
188
285
|
application/json:
|
|
189
286
|
schema:
|
|
190
287
|
$ref: "#/components/schemas/ServiceExecution"
|
|
191
|
-
components:
|
|
192
|
-
schemas:
|
|
193
|
-
ServiceExecution:
|
|
194
|
-
type: object
|
|
195
|
-
properties:
|
|
196
|
-
id:
|
|
197
|
-
type: string
|
|
198
|
-
examples: [ 87cb778e-ac43-11ec-b909-0242ac120002 ]
|
|
199
|
-
status:
|
|
200
|
-
type: string
|
|
201
|
-
enum: [ UNKNOWN, PENDING, RUNNING, SUCCEEDED, CANCELLED, FAILED ]
|
|
202
|
-
examples: [ SUCCEEDED ]
|
|
203
|
-
createdAt:
|
|
204
|
-
type: string
|
|
205
|
-
examples: [ "2022-01-01 22:38:08" ]
|
|
206
|
-
startedAt:
|
|
207
|
-
type: string
|
|
208
|
-
examples: [ "2022-01-01 22:39:08" ]
|
|
209
|
-
endedAt:
|
|
210
|
-
type: string
|
|
211
|
-
examples: [ "2022-01-01 22:40:08" ]
|
|
212
|
-
# Representation of link as defined in HAL: https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-11
|
|
213
|
-
HALLink:
|
|
214
|
-
type: object
|
|
215
|
-
properties:
|
|
216
|
-
href:
|
|
217
|
-
type: string
|
|
218
|
-
description: The URL of the link
|
|
219
|
-
templated:
|
|
220
|
-
type: boolean
|
|
221
|
-
description: Whether the link is templated (optional)
|
|
222
|
-
default: false
|
|
223
|
-
type:
|
|
224
|
-
type: string
|
|
225
|
-
description: The media type of the link (optional)
|
|
226
|
-
deprecation:
|
|
227
|
-
type: string
|
|
228
|
-
description: A URL that provides further information about the deprecation of the link (optional)
|
|
229
|
-
name:
|
|
230
|
-
type: string
|
|
231
|
-
description: The name of the link (optional)
|
|
232
|
-
profile:
|
|
233
|
-
type: string
|
|
234
|
-
description: A URL that provides further information about the profile of the link (optional)
|
|
235
|
-
title:
|
|
236
|
-
type: string
|
|
237
|
-
description: The title of the link (optional)
|
|
238
|
-
hreflang:
|
|
239
|
-
type: string
|
|
240
|
-
description: The language of the link's target resource (optional)
|
|
241
|
-
securitySchemes:
|
|
242
|
-
ApplicationCredentials:
|
|
243
|
-
type: oauth2
|
|
244
|
-
flows:
|
|
245
|
-
clientCredentials:
|
|
246
|
-
tokenUrl: https://gateway.platform.planqk.de/token
|
|
247
|
-
scopes: {}
|
|
248
|
-
security:
|
|
249
|
-
- ApplicationCredentials: []
|
|
250
|
-
servers:
|
|
251
|
-
- url: https://gateway.platform.planqk.de/<context>/<service>/<version>
|
|
252
|
-
description: The service endpoint
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.
|
|
1
|
+
__version__ = "2.8.0"
|
package/planqk/service/client.py
CHANGED
|
@@ -5,7 +5,7 @@ import time
|
|
|
5
5
|
import typing
|
|
6
6
|
|
|
7
7
|
from planqk.service.auth import DEFAULT_TOKEN_ENDPOINT, PlanqkServiceAuth
|
|
8
|
-
from planqk.service.sdk import PlanqkServiceApi, ServiceExecution,
|
|
8
|
+
from planqk.service.sdk import PlanqkServiceApi, ServiceExecution, LogEntry, ResultResponse
|
|
9
9
|
from planqk.service.sdk.service_api.client import ServiceApiClient
|
|
10
10
|
from planqk.service.sdk.types.service_execution_status import ServiceExecutionStatus
|
|
11
11
|
|
|
@@ -61,7 +61,7 @@ class PlanqkServiceExecution:
|
|
|
61
61
|
def refresh(self):
|
|
62
62
|
self._service_execution = self._client.api.get_status(id=self.id)
|
|
63
63
|
|
|
64
|
-
def result(self) ->
|
|
64
|
+
def result(self) -> ResultResponse:
|
|
65
65
|
self.wait_for_final_state()
|
|
66
66
|
delay = 1 # Start with a small delay
|
|
67
67
|
max_delay = 16 # Maximum delay
|
|
@@ -105,7 +105,7 @@ class PlanqkServiceExecution:
|
|
|
105
105
|
def cancel(self) -> None:
|
|
106
106
|
self._client.api.cancel_execution(id=self.id)
|
|
107
107
|
|
|
108
|
-
def logs(self) -> typing.List[
|
|
108
|
+
def logs(self) -> typing.List[LogEntry]:
|
|
109
109
|
return self._client.api.get_logs(id=self.id)
|
|
110
110
|
|
|
111
111
|
|