@planqk/planqk-service-sdk 2.1.1 → 2.2.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/.gitlab-ci.yml +8 -39
- package/README-node.md +16 -12
- package/README.md +30 -41
- package/dist/sdk/Client.d.ts +10 -4
- package/dist/sdk/Client.js +46 -4
- package/dist/sdk/api/index.d.ts +2 -3
- package/dist/sdk/api/index.js +2 -3
- package/dist/sdk/api/resources/index.d.ts +2 -2
- package/dist/sdk/api/resources/index.js +2 -2
- package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +41 -55
- package/dist/sdk/api/resources/serviceApi/client/Client.js +131 -227
- package/dist/sdk/api/resources/serviceApi/index.d.ts +2 -2
- package/dist/sdk/api/resources/serviceApi/index.js +2 -2
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +13 -3
- package/dist/sdk/api/resources/serviceApi/types/index.d.ts +1 -4
- package/dist/sdk/api/resources/serviceApi/types/index.js +1 -4
- package/dist/sdk/api/types/ServiceExecution.d.ts +12 -2
- package/dist/sdk/api/types/ServiceExecution.js +12 -0
- package/dist/sdk/api/types/index.d.ts +2 -6
- package/dist/sdk/api/types/index.js +2 -6
- package/dist/sdk/core/auth/BasicAuth.js +3 -3
- package/dist/sdk/core/auth/index.d.ts +2 -2
- package/dist/sdk/core/auth/index.js +4 -4
- package/dist/sdk/core/base64.d.ts +2 -0
- package/dist/sdk/core/base64.js +26 -0
- package/dist/sdk/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/sdk/core/fetcher/BinaryResponse.d.ts +20 -0
- package/dist/sdk/core/fetcher/BinaryResponse.js +17 -0
- package/dist/sdk/core/fetcher/Fetcher.d.ts +5 -4
- package/dist/sdk/core/fetcher/Fetcher.js +41 -22
- package/dist/sdk/core/fetcher/Headers.d.ts +2 -0
- package/dist/sdk/core/fetcher/Headers.js +85 -0
- package/dist/sdk/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/sdk/core/fetcher/HttpResponsePromise.js +94 -0
- package/dist/sdk/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/sdk/core/fetcher/RawResponse.js +44 -0
- package/dist/sdk/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/sdk/core/fetcher/ResponseWithBody.js +6 -0
- package/dist/sdk/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/sdk/core/fetcher/createRequestUrl.js +3 -7
- package/dist/sdk/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/sdk/core/fetcher/getErrorResponseBody.js +32 -0
- package/dist/sdk/core/fetcher/getFetchFn.d.ts +1 -4
- package/dist/sdk/core/fetcher/getFetchFn.js +1 -52
- package/dist/sdk/core/fetcher/getRequestBody.js +2 -1
- package/dist/sdk/core/fetcher/getResponseBody.js +34 -30
- package/dist/sdk/core/fetcher/index.d.ts +9 -5
- package/dist/sdk/core/fetcher/index.js +13 -7
- package/dist/sdk/core/fetcher/makeRequest.js +3 -3
- package/dist/sdk/core/fetcher/requestWithRetries.js +14 -5
- package/dist/sdk/core/headers.d.ts +3 -0
- package/dist/sdk/core/headers.js +29 -0
- package/dist/sdk/core/index.d.ts +5 -3
- package/dist/sdk/core/index.js +28 -3
- package/dist/sdk/core/json.d.ts +15 -0
- package/dist/sdk/core/json.js +24 -0
- package/dist/sdk/core/runtime/index.d.ts +1 -1
- package/dist/sdk/core/runtime/index.js +2 -2
- package/dist/sdk/core/runtime/runtime.d.ts +1 -1
- package/dist/sdk/core/runtime/runtime.js +49 -40
- package/dist/sdk/core/url/index.d.ts +2 -0
- package/dist/sdk/core/url/index.js +7 -0
- package/dist/sdk/core/url/join.d.ts +1 -0
- package/dist/sdk/core/url/join.js +49 -0
- package/dist/sdk/core/url/qs.d.ts +6 -0
- package/dist/sdk/core/url/qs.js +67 -0
- package/dist/sdk/errors/PlanqkServiceApiError.d.ts +4 -1
- package/dist/sdk/errors/PlanqkServiceApiError.js +7 -8
- package/dist/sdk/errors/PlanqkServiceApiTimeoutError.d.ts +1 -1
- package/dist/sdk/errors/PlanqkServiceApiTimeoutError.js +2 -2
- package/dist/sdk/errors/index.d.ts +2 -2
- package/dist/sdk/errors/index.js +4 -4
- package/dist/sdk/index.d.ts +4 -4
- package/dist/sdk/index.js +9 -9
- package/fern/fern.config.json +1 -1
- package/fern/generators.yml +2 -2
- package/fern/openapi/openapi.yml +41 -131
- package/notebooks/python-sdk.ipynb +1 -1
- package/package.json +2 -3
- package/planqk/service/_version.py +1 -1
- package/pyproject.toml +1 -1
- package/src/index.test.ts +29 -16
- package/src/sdk/Client.ts +27 -7
- package/src/sdk/api/index.ts +2 -3
- package/src/sdk/api/resources/index.ts +2 -2
- package/src/sdk/api/resources/serviceApi/client/Client.ts +223 -250
- package/src/sdk/api/resources/serviceApi/index.ts +2 -2
- package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +15 -3
- package/src/sdk/api/resources/serviceApi/types/index.ts +1 -4
- package/src/sdk/api/types/ServiceExecution.ts +13 -3
- package/src/sdk/api/types/index.ts +2 -6
- package/src/sdk/core/auth/BasicAuth.ts +3 -3
- package/src/sdk/core/auth/index.ts +2 -2
- package/src/sdk/core/base64.ts +27 -0
- package/src/sdk/core/fetcher/APIResponse.ts +11 -0
- package/src/sdk/core/fetcher/BinaryResponse.ts +36 -0
- package/src/sdk/core/fetcher/Fetcher.ts +46 -26
- package/src/sdk/core/fetcher/Headers.ts +93 -0
- package/src/sdk/core/fetcher/HttpResponsePromise.ts +116 -0
- package/src/sdk/core/fetcher/RawResponse.ts +61 -0
- package/src/sdk/core/fetcher/ResponseWithBody.ts +7 -0
- package/src/sdk/core/fetcher/createRequestUrl.ts +4 -8
- package/src/sdk/core/fetcher/getErrorResponseBody.ts +32 -0
- package/src/sdk/core/fetcher/getFetchFn.ts +2 -24
- package/src/sdk/core/fetcher/getRequestBody.ts +3 -1
- package/src/sdk/core/fetcher/getResponseBody.ts +38 -27
- package/src/sdk/core/fetcher/index.ts +9 -5
- package/src/sdk/core/fetcher/makeRequest.ts +2 -2
- package/src/sdk/core/fetcher/requestWithRetries.ts +18 -6
- package/src/sdk/core/fetcher/signals.ts +1 -1
- package/src/sdk/core/headers.ts +35 -0
- package/src/sdk/core/index.ts +5 -3
- package/src/sdk/core/json.ts +27 -0
- package/src/sdk/core/runtime/index.ts +1 -1
- package/src/sdk/core/runtime/runtime.ts +60 -53
- package/src/sdk/core/url/index.ts +2 -0
- package/src/sdk/core/url/join.ts +55 -0
- package/src/sdk/core/url/qs.ts +74 -0
- package/src/sdk/errors/PlanqkServiceApiError.ts +21 -11
- package/src/sdk/errors/PlanqkServiceApiTimeoutError.ts +2 -2
- package/src/sdk/errors/index.ts +2 -2
- package/src/sdk/index.ts +4 -4
- package/dist/sdk/api/errors/BadRequestError.d.ts +0 -7
- package/dist/sdk/api/errors/BadRequestError.js +0 -51
- package/dist/sdk/api/errors/ForbiddenError.d.ts +0 -7
- package/dist/sdk/api/errors/ForbiddenError.js +0 -51
- package/dist/sdk/api/errors/InternalServerError.d.ts +0 -7
- package/dist/sdk/api/errors/InternalServerError.js +0 -51
- package/dist/sdk/api/errors/NotFoundError.d.ts +0 -7
- package/dist/sdk/api/errors/NotFoundError.js +0 -51
- package/dist/sdk/api/errors/UnauthorizedError.d.ts +0 -7
- package/dist/sdk/api/errors/UnauthorizedError.js +0 -51
- package/dist/sdk/api/errors/index.d.ts +0 -5
- package/dist/sdk/api/errors/index.js +0 -21
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.d.ts +0 -7
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.js +0 -5
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.d.ts +0 -7
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.js +0 -5
- package/dist/sdk/api/resources/serviceApi/types/HealthCheckResponse.d.ts +0 -7
- package/dist/sdk/api/resources/serviceApi/types/HealthCheckResponse.js +0 -5
- package/dist/sdk/api/types/InputData.d.ts +0 -4
- package/dist/sdk/api/types/InputData.js +0 -5
- package/dist/sdk/api/types/InputDataRef.d.ts +0 -8
- package/dist/sdk/api/types/InputDataRef.js +0 -5
- package/dist/sdk/api/types/InputParams.d.ts +0 -4
- package/dist/sdk/api/types/InputParams.js +0 -5
- package/dist/sdk/api/types/ServiceExecutionStatus.d.ts +0 -12
- package/dist/sdk/api/types/ServiceExecutionStatus.js +0 -14
- package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -232
- package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -91
- package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -214
- package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -48
- package/src/sdk/api/errors/BadRequestError.ts +0 -16
- package/src/sdk/api/errors/ForbiddenError.ts +0 -16
- package/src/sdk/api/errors/InternalServerError.ts +0 -16
- package/src/sdk/api/errors/NotFoundError.ts +0 -16
- package/src/sdk/api/errors/UnauthorizedError.ts +0 -16
- package/src/sdk/api/errors/index.ts +0 -5
- package/src/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.ts +0 -9
- package/src/sdk/api/resources/serviceApi/types/GetResultResponseLinks.ts +0 -9
- package/src/sdk/api/resources/serviceApi/types/HealthCheckResponse.ts +0 -8
- package/src/sdk/api/types/InputData.ts +0 -5
- package/src/sdk/api/types/InputDataRef.ts +0 -9
- package/src/sdk/api/types/InputParams.ts +0 -5
- package/src/sdk/api/types/ServiceExecutionStatus.ts +0 -14
- package/src/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +0 -252
- package/src/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +0 -106
- package/src/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +0 -239
- package/src/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +0 -33
package/src/index.test.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {test} from 'vitest'
|
|
|
3
3
|
import 'dotenv/config'
|
|
4
4
|
import {PlanqkServiceClient} from "./client";
|
|
5
5
|
|
|
6
|
-
test.skip('
|
|
6
|
+
test.skip('integration test', {timeout: 5 * 60 * 1000}, async () => {
|
|
7
7
|
const tokenEndpoint = process.env.TOKEN_ENDPOINT
|
|
8
8
|
const serviceEndpoint = process.env.SERVICE_ENDPOINT
|
|
9
9
|
const consumerKey = process.env.CONSUMER_KEY
|
|
@@ -15,29 +15,42 @@ test.skip('adds 1 + 2 to equal 3', {timeout: 5 * 60 * 1000}, async () => {
|
|
|
15
15
|
console.log(`Consumer secret: ${consumerSecret}`)
|
|
16
16
|
|
|
17
17
|
const client = new PlanqkServiceClient(serviceEndpoint!, consumerKey, consumerSecret, tokenEndpoint);
|
|
18
|
-
await client.api().healthCheck()
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const params = {param1: "value1", param2: "value2"};
|
|
19
|
+
let serviceExecutions = await client.api().getServiceExecutions()
|
|
20
|
+
console.log(serviceExecutions)
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const data = {n_coin_tosses: 2}
|
|
23
|
+
// const dataRef = {
|
|
24
|
+
// dataPoolId: "87cb778e-ac43-11ec-b909-0242ac120002",
|
|
25
|
+
// dataSourceDescriptorId: "87cb778e-ac43-11ec-b909-0242ac120002",
|
|
26
|
+
// fileId: "87cb778e-ac43-11ec-b909-0242ac120002"
|
|
27
|
+
// }
|
|
28
|
+
const params = {shots: 100}
|
|
29
|
+
|
|
30
|
+
let serviceExecution = await client.api().startExecution({data, params}, {timeoutInSeconds: 60})
|
|
26
31
|
console.log(serviceExecution)
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
serviceExecution = await client.api().getStatus(serviceExecution.id!)
|
|
34
|
+
console.log(serviceExecution)
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"];
|
|
36
|
+
const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"]
|
|
33
37
|
while (!finalStates.includes(serviceExecution.status!)) {
|
|
34
|
-
serviceExecution = await client.api().getStatus(serviceExecution.id!)
|
|
38
|
+
serviceExecution = await client.api().getStatus(serviceExecution.id!)
|
|
35
39
|
}
|
|
36
40
|
console.log(serviceExecution)
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
const result = await client.api().getResult(serviceExecution.id!)
|
|
43
|
+
console.log(result)
|
|
44
|
+
|
|
45
|
+
const logs = await client.api().getLogs(serviceExecution.id!)
|
|
46
|
+
console.log(logs)
|
|
47
|
+
|
|
48
|
+
serviceExecution = await client.api().cancelExecution(serviceExecution.id!)
|
|
49
|
+
console.log(serviceExecution)
|
|
50
|
+
|
|
51
|
+
serviceExecution = await client.api().getStatus(serviceExecution.id!)
|
|
52
|
+
console.log(serviceExecution)
|
|
40
53
|
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
serviceExecutions = await client.api().getServiceExecutions()
|
|
55
|
+
console.log(serviceExecutions)
|
|
43
56
|
})
|
package/src/sdk/Client.ts
CHANGED
|
@@ -2,31 +2,51 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import * as environments from "./environments";
|
|
6
|
-
import * as core from "./core";
|
|
7
|
-
import {
|
|
5
|
+
import * as environments from "./environments.js";
|
|
6
|
+
import * as core from "./core/index.js";
|
|
7
|
+
import { mergeHeaders } from "./core/headers.js";
|
|
8
|
+
import { ServiceApi } from "./api/resources/serviceApi/client/Client.js";
|
|
8
9
|
|
|
9
10
|
export declare namespace PlanqkServiceApiClient {
|
|
10
|
-
interface Options {
|
|
11
|
+
export interface Options {
|
|
11
12
|
environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
|
|
13
|
+
/** Specify a custom URL to connect the client to. */
|
|
14
|
+
baseUrl?: core.Supplier<string>;
|
|
12
15
|
token: core.Supplier<core.BearerToken>;
|
|
16
|
+
/** Additional headers to include in requests. */
|
|
17
|
+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
interface RequestOptions {
|
|
20
|
+
export interface RequestOptions {
|
|
16
21
|
/** The maximum time to wait for a response in seconds. */
|
|
17
22
|
timeoutInSeconds?: number;
|
|
18
23
|
/** The number of times to retry the request. Defaults to 2. */
|
|
19
24
|
maxRetries?: number;
|
|
20
25
|
/** A hook to abort the request. */
|
|
21
26
|
abortSignal?: AbortSignal;
|
|
27
|
+
/** Additional headers to include in the request. */
|
|
28
|
+
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
export class PlanqkServiceApiClient {
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
protected readonly _options: PlanqkServiceApiClient.Options;
|
|
28
34
|
protected _serviceApi: ServiceApi | undefined;
|
|
29
35
|
|
|
36
|
+
constructor(_options: PlanqkServiceApiClient.Options) {
|
|
37
|
+
this._options = {
|
|
38
|
+
..._options,
|
|
39
|
+
headers: mergeHeaders(
|
|
40
|
+
{
|
|
41
|
+
"X-Fern-Language": "JavaScript",
|
|
42
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
43
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
44
|
+
},
|
|
45
|
+
_options?.headers,
|
|
46
|
+
),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
30
50
|
public get serviceApi(): ServiceApi {
|
|
31
51
|
return (this._serviceApi ??= new ServiceApi(this._options));
|
|
32
52
|
}
|
package/src/sdk/api/index.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from "./resources";
|
|
2
|
-
export * from "./types";
|
|
3
|
-
export * from "./errors";
|
|
1
|
+
export * from "./resources/index.js";
|
|
2
|
+
export * from "./types/index.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as serviceApi from "./serviceApi";
|
|
2
|
-
export * from "./serviceApi/types";
|
|
1
|
+
export * as serviceApi from "./serviceApi/index.js";
|
|
2
|
+
export * from "./serviceApi/types/index.js";
|