@planqk/planqk-service-sdk 2.7.0 → 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.
Files changed (95) hide show
  1. package/dist/sdk/BaseClient.d.ts +26 -0
  2. package/dist/sdk/{api/resources/serviceApi/types/GetResultResponse.js → BaseClient.js} +1 -3
  3. package/dist/sdk/Client.d.ts +3 -21
  4. package/dist/sdk/Client.js +1 -3
  5. package/dist/sdk/api/index.d.ts +1 -1
  6. package/dist/sdk/api/index.js +1 -1
  7. package/dist/sdk/api/resources/index.d.ts +0 -1
  8. package/dist/sdk/api/resources/index.js +0 -4
  9. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +6 -23
  10. package/dist/sdk/api/resources/serviceApi/client/Client.js +37 -25
  11. package/dist/sdk/api/resources/serviceApi/index.d.ts +0 -1
  12. package/dist/sdk/api/resources/serviceApi/index.js +0 -1
  13. package/dist/sdk/api/types/HalLink.d.ts +0 -3
  14. package/dist/sdk/api/types/HalLink.js +1 -3
  15. package/dist/sdk/api/types/LogEntry.d.ts +15 -4
  16. package/dist/sdk/api/types/LogEntry.js +13 -3
  17. package/dist/sdk/api/types/RequestBody.d.ts +1 -0
  18. package/dist/sdk/api/types/RequestBody.js +3 -0
  19. package/dist/sdk/api/types/ResultResponse.d.ts +15 -0
  20. package/dist/sdk/api/types/ResultResponse.js +3 -0
  21. package/dist/sdk/api/types/ServiceExecution.d.ts +1 -4
  22. package/dist/sdk/api/types/ServiceExecution.js +1 -3
  23. package/dist/sdk/api/types/index.d.ts +2 -0
  24. package/dist/sdk/api/types/index.js +2 -0
  25. package/dist/sdk/core/auth/AuthProvider.d.ts +4 -0
  26. package/dist/sdk/core/auth/AuthProvider.js +2 -0
  27. package/dist/sdk/core/auth/AuthRequest.d.ts +9 -0
  28. package/dist/sdk/core/auth/AuthRequest.js +2 -0
  29. package/dist/sdk/core/auth/BasicAuth.js +2 -1
  30. package/dist/sdk/core/auth/index.d.ts +2 -0
  31. package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -1
  32. package/dist/sdk/core/fetcher/BinaryResponse.d.ts +1 -1
  33. package/dist/sdk/core/fetcher/EndpointMetadata.d.ts +13 -0
  34. package/dist/sdk/core/fetcher/EndpointMetadata.js +2 -0
  35. package/dist/sdk/core/fetcher/EndpointSupplier.d.ts +12 -0
  36. package/dist/sdk/core/fetcher/EndpointSupplier.js +13 -0
  37. package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -4
  38. package/dist/sdk/core/fetcher/Fetcher.js +3 -3
  39. package/dist/sdk/core/fetcher/HttpResponsePromise.d.ts +1 -1
  40. package/dist/sdk/core/fetcher/index.d.ts +7 -5
  41. package/dist/sdk/core/fetcher/index.js +7 -5
  42. package/dist/sdk/core/fetcher/requestWithRetries.js +44 -8
  43. package/dist/sdk/core/headers.d.ts +2 -3
  44. package/dist/sdk/core/url/join.js +23 -3
  45. package/dist/sdk/environments.d.ts +0 -3
  46. package/dist/sdk/environments.js +1 -3
  47. package/dist/sdk/errors/PlanqkServiceApiError.d.ts +0 -3
  48. package/dist/sdk/errors/PlanqkServiceApiError.js +1 -3
  49. package/dist/sdk/errors/PlanqkServiceApiTimeoutError.d.ts +0 -3
  50. package/dist/sdk/errors/PlanqkServiceApiTimeoutError.js +1 -3
  51. package/dist/sdk/index.d.ts +1 -0
  52. package/fern/openapi/openapi.yml +13 -2
  53. package/package.json +1 -1
  54. package/planqk/service/_version.py +1 -1
  55. package/planqk/service/sdk/__init__.py +3 -0
  56. package/planqk/service/sdk/types/__init__.py +3 -0
  57. package/planqk/service/sdk/types/log_entry.py +15 -3
  58. package/planqk/service/sdk/types/log_entry_severity.py +5 -0
  59. package/pyproject.toml +1 -1
  60. package/src/index.test.ts +10 -0
  61. package/src/sdk/BaseClient.ts +30 -0
  62. package/src/sdk/Client.ts +5 -22
  63. package/src/sdk/api/index.ts +1 -1
  64. package/src/sdk/api/resources/index.ts +0 -1
  65. package/src/sdk/api/resources/serviceApi/client/Client.ts +73 -76
  66. package/src/sdk/api/resources/serviceApi/index.ts +0 -1
  67. package/src/sdk/api/types/HalLink.ts +1 -3
  68. package/src/sdk/api/types/LogEntry.ts +17 -4
  69. package/src/sdk/api/types/RequestBody.ts +3 -0
  70. package/src/sdk/api/types/ResultResponse.ts +20 -0
  71. package/src/sdk/api/types/ServiceExecution.ts +2 -4
  72. package/src/sdk/api/types/index.ts +2 -0
  73. package/src/sdk/core/auth/AuthProvider.ts +5 -0
  74. package/src/sdk/core/auth/AuthRequest.ts +9 -0
  75. package/src/sdk/core/auth/BasicAuth.ts +2 -1
  76. package/src/sdk/core/auth/index.ts +2 -0
  77. package/src/sdk/core/fetcher/APIResponse.ts +1 -1
  78. package/src/sdk/core/fetcher/BinaryResponse.ts +1 -1
  79. package/src/sdk/core/fetcher/EndpointMetadata.ts +13 -0
  80. package/src/sdk/core/fetcher/EndpointSupplier.ts +14 -0
  81. package/src/sdk/core/fetcher/Fetcher.ts +8 -6
  82. package/src/sdk/core/fetcher/HttpResponsePromise.ts +1 -1
  83. package/src/sdk/core/fetcher/index.ts +7 -5
  84. package/src/sdk/core/fetcher/requestWithRetries.ts +49 -9
  85. package/src/sdk/core/headers.ts +8 -10
  86. package/src/sdk/core/url/join.ts +28 -3
  87. package/src/sdk/environments.ts +1 -3
  88. package/src/sdk/errors/PlanqkServiceApiError.ts +1 -3
  89. package/src/sdk/errors/PlanqkServiceApiTimeoutError.ts +1 -3
  90. package/src/sdk/index.ts +1 -0
  91. package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +0 -18
  92. package/dist/sdk/api/resources/serviceApi/types/index.d.ts +0 -1
  93. package/dist/sdk/api/resources/serviceApi/types/index.js +0 -17
  94. package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +0 -22
  95. package/src/sdk/api/resources/serviceApi/types/index.ts +0 -1
@@ -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 Supplier_js_1.Supplier.get(value);
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,4 +1,4 @@
1
- import { WithRawResponse } from "./RawResponse.js";
1
+ import type { WithRawResponse } from "./RawResponse.js";
2
2
  /**
3
3
  * A promise that returns the parsed response and lets you retrieve the raw response too.
4
4
  */
@@ -1,9 +1,11 @@
1
1
  export type { APIResponse } from "./APIResponse.js";
2
- export { fetcher } from "./Fetcher.js";
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 { BinaryResponse } from "./BinaryResponse.js";
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.HttpResponsePromise = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.Supplier = exports.getHeader = exports.fetcher = void 0;
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 Supplier_js_1 = require("./Supplier.js");
9
- Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_js_1.Supplier; } });
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 HttpResponsePromise_js_1 = require("./HttpResponsePromise.js");
15
- Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_js_1.HttpResponsePromise; } });
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 addJitter(delay) {
9
- // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR
10
- const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
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
- // Calculate base delay using exponential backoff (in milliseconds)
18
- const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
19
- // Add jitter to the delay
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
- import * as core from "./index.js";
2
- export declare function mergeHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
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 = str.startsWith("/") ? 1 : 0;
47
- let end = str.endsWith("/") ? str.length - 1 : str.length;
48
- return str.slice(start, end);
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
  }
@@ -1,6 +1,3 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
1
  export declare const PlanqkServiceApiEnvironment: {
5
2
  readonly Default: "https://gateway.platform.planqk.de/<context>/<service>/<version>";
6
3
  };
@@ -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,6 +1,3 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
1
  import * as core from "../core/index.js";
5
2
  export declare class PlanqkServiceApiError extends Error {
6
3
  readonly statusCode?: number;
@@ -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,6 +1,3 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
1
  export declare class PlanqkServiceApiTimeoutError extends Error {
5
2
  constructor(message: string);
6
3
  }
@@ -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 {
@@ -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";
@@ -57,11 +57,22 @@ components:
57
57
  properties:
58
58
  message:
59
59
  type: string
60
+ description: Log message content.
60
61
  severity:
61
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" ]
62
71
  timestamp:
63
72
  type: string
64
73
  format: date-time
74
+ description: Timestamp when the entry was logged.
75
+ examples: [ "2025-10-10T08:23:26.452335419Z" ]
65
76
  # Representation of link as defined in HAL: https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-11
66
77
  HALLink:
67
78
  type: object
@@ -97,9 +108,9 @@ components:
97
108
  flows:
98
109
  clientCredentials:
99
110
  tokenUrl: https://gateway.platform.planqk.de/token
100
- scopes: {}
111
+ scopes: { }
101
112
  security:
102
- - ApplicationCredentials: []
113
+ - ApplicationCredentials: [ ]
103
114
  servers:
104
115
  - url: https://gateway.platform.planqk.de/<context>/<service>/<version>
105
116
  description: The service endpoint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planqk/planqk-service-sdk",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "SDK to interact with PLANQK Managed Services.",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
@@ -1 +1 @@
1
- __version__ = "2.7.0"
1
+ __version__ = "2.8.0"
@@ -9,6 +9,7 @@ if typing.TYPE_CHECKING:
9
9
  from .types import (
10
10
  HalLink,
11
11
  LogEntry,
12
+ LogEntrySeverity,
12
13
  RequestBody,
13
14
  ResultResponse,
14
15
  ResultResponseEmbedded,
@@ -23,6 +24,7 @@ _dynamic_imports: typing.Dict[str, str] = {
23
24
  "AsyncPlanqkServiceApi": ".client",
24
25
  "HalLink": ".types",
25
26
  "LogEntry": ".types",
27
+ "LogEntrySeverity": ".types",
26
28
  "PlanqkServiceApi": ".client",
27
29
  "PlanqkServiceApiEnvironment": ".environment",
28
30
  "RequestBody": ".types",
@@ -60,6 +62,7 @@ __all__ = [
60
62
  "AsyncPlanqkServiceApi",
61
63
  "HalLink",
62
64
  "LogEntry",
65
+ "LogEntrySeverity",
63
66
  "PlanqkServiceApi",
64
67
  "PlanqkServiceApiEnvironment",
65
68
  "RequestBody",
@@ -8,6 +8,7 @@ from importlib import import_module
8
8
  if typing.TYPE_CHECKING:
9
9
  from .hal_link import HalLink
10
10
  from .log_entry import LogEntry
11
+ from .log_entry_severity import LogEntrySeverity
11
12
  from .request_body import RequestBody
12
13
  from .result_response import ResultResponse
13
14
  from .result_response_embedded import ResultResponseEmbedded
@@ -17,6 +18,7 @@ if typing.TYPE_CHECKING:
17
18
  _dynamic_imports: typing.Dict[str, str] = {
18
19
  "HalLink": ".hal_link",
19
20
  "LogEntry": ".log_entry",
21
+ "LogEntrySeverity": ".log_entry_severity",
20
22
  "RequestBody": ".request_body",
21
23
  "ResultResponse": ".result_response",
22
24
  "ResultResponseEmbedded": ".result_response_embedded",
@@ -50,6 +52,7 @@ def __dir__():
50
52
  __all__ = [
51
53
  "HalLink",
52
54
  "LogEntry",
55
+ "LogEntrySeverity",
53
56
  "RequestBody",
54
57
  "ResultResponse",
55
58
  "ResultResponseEmbedded",
@@ -6,12 +6,24 @@ import typing
6
6
  import pydantic
7
7
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
8
  from ..core.unchecked_base_model import UncheckedBaseModel
9
+ from .log_entry_severity import LogEntrySeverity
9
10
 
10
11
 
11
12
  class LogEntry(UncheckedBaseModel):
12
- message: typing.Optional[str] = None
13
- severity: typing.Optional[str] = None
14
- timestamp: typing.Optional[dt.datetime] = None
13
+ message: typing.Optional[str] = pydantic.Field(default=None)
14
+ """
15
+ Log message content.
16
+ """
17
+
18
+ severity: typing.Optional[LogEntrySeverity] = pydantic.Field(default=None)
19
+ """
20
+ Severity of the log entry.
21
+ """
22
+
23
+ timestamp: typing.Optional[dt.datetime] = pydantic.Field(default=None)
24
+ """
25
+ Timestamp when the entry was logged.
26
+ """
15
27
 
16
28
  if IS_PYDANTIC_V2:
17
29
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ LogEntrySeverity = typing.Union[typing.Literal["DEBUG", "NOTICE", "INFO", "WARNING", "ERROR"], typing.Any]
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "planqk-service-sdk"
3
- version = "2.7.0"
3
+ version = "2.8.0"
4
4
  description = "SDK to interact with PLANQK Managed Services."
5
5
  authors = [
6
6
  { name = "Kipu Quantum GmbH", email = "info@kipu-quantum.com" },
package/src/index.test.ts CHANGED
@@ -14,6 +14,16 @@ console.log(`Service endpoint: ${serviceEndpoint}`)
14
14
  console.log(`Consumer key: ${consumerKey}`)
15
15
  console.log(`Consumer secret: ${consumerSecret}`)
16
16
 
17
+ test.skip('integration test: retrieve logs', {timeout: 5 * 60 * 1000}, async () => {
18
+ const client = new PlanqkServiceClient(serviceEndpoint!, consumerKey, consumerSecret, tokenEndpoint);
19
+
20
+ const serviceExecutions = await client.api().getServiceExecutions()
21
+ console.log(serviceExecutions)
22
+
23
+ const logs = await client.api().getLogs(serviceExecutions[0].id!)
24
+ console.log(logs)
25
+ })
26
+
17
27
  test.skip('integration test: coin toss', {timeout: 5 * 60 * 1000}, async () => {
18
28
  const client = new PlanqkServiceClient(serviceEndpoint!, consumerKey, consumerSecret, tokenEndpoint);
19
29
 
@@ -0,0 +1,30 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ import * as environments from "./environments.js";
4
+ import * as core from "./core/index.js";
5
+
6
+ export interface BaseClientOptions {
7
+ environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
8
+ /** Specify a custom URL to connect the client to. */
9
+ baseUrl?: core.Supplier<string>;
10
+ token?: core.Supplier<core.BearerToken | undefined>;
11
+ /** Additional headers to include in requests. */
12
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
13
+ /** The default maximum time to wait for a response in seconds. */
14
+ timeoutInSeconds?: number;
15
+ /** The default number of times to retry the request. Defaults to 2. */
16
+ maxRetries?: number;
17
+ }
18
+
19
+ export interface BaseRequestOptions {
20
+ /** The maximum time to wait for a response in seconds. */
21
+ timeoutInSeconds?: number;
22
+ /** The number of times to retry the request. Defaults to 2. */
23
+ maxRetries?: number;
24
+ /** A hook to abort the request. */
25
+ abortSignal?: AbortSignal;
26
+ /** Additional query string parameters to include in the request. */
27
+ queryParams?: Record<string, unknown>;
28
+ /** Additional headers to include in the request. */
29
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
30
+ }
package/src/sdk/Client.ts CHANGED
@@ -1,32 +1,15 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
1
+ // This file was auto-generated by Fern from our API Definition.
4
2
 
5
- import * as environments from "./environments.js";
3
+ import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
6
4
  import * as core from "./core/index.js";
7
5
  import { mergeHeaders } from "./core/headers.js";
6
+ import * as environments from "./environments.js";
8
7
  import { ServiceApi } from "./api/resources/serviceApi/client/Client.js";
9
8
 
10
9
  export declare namespace PlanqkServiceApiClient {
11
- export interface Options {
12
- environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
13
- /** Specify a custom URL to connect the client to. */
14
- baseUrl?: core.Supplier<string>;
15
- token?: core.Supplier<core.BearerToken | undefined>;
16
- /** Additional headers to include in requests. */
17
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
18
- }
10
+ export interface Options extends BaseClientOptions {}
19
11
 
20
- export interface RequestOptions {
21
- /** The maximum time to wait for a response in seconds. */
22
- timeoutInSeconds?: number;
23
- /** The number of times to retry the request. Defaults to 2. */
24
- maxRetries?: number;
25
- /** A hook to abort the request. */
26
- abortSignal?: AbortSignal;
27
- /** Additional headers to include in the request. */
28
- headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
29
- }
12
+ export interface RequestOptions extends BaseRequestOptions {}
30
13
  }
31
14
 
32
15
  export class PlanqkServiceApiClient {
@@ -1,2 +1,2 @@
1
- export * from "./resources/index.js";
2
1
  export * from "./types/index.js";
2
+ export * from "./resources/index.js";
@@ -1,2 +1 @@
1
1
  export * as serviceApi from "./serviceApi/index.js";
2
- export * from "./serviceApi/types/index.js";