@planqk/planqk-api-sdk 1.0.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/.devcontainer/devcontainer.json +32 -0
- package/.devcontainer/post-create.sh +7 -0
- package/.env.template +2 -0
- package/.gitlab-ci.yml +71 -0
- package/.python-version +1 -0
- package/.releaserc.json +45 -0
- package/LICENSE +201 -0
- package/README-node.md +18 -0
- package/README-python.md +21 -0
- package/README.md +56 -0
- package/dist/Client.d.ts +32 -0
- package/dist/Client.js +60 -0
- package/dist/api/errors/BadRequestError.d.ts +8 -0
- package/dist/api/errors/BadRequestError.js +52 -0
- package/dist/api/errors/ForbiddenError.d.ts +8 -0
- package/dist/api/errors/ForbiddenError.js +52 -0
- package/dist/api/errors/InternalServerError.d.ts +8 -0
- package/dist/api/errors/InternalServerError.js +52 -0
- package/dist/api/errors/NotFoundError.d.ts +8 -0
- package/dist/api/errors/NotFoundError.js +52 -0
- package/dist/api/errors/UnauthorizedError.d.ts +8 -0
- package/dist/api/errors/UnauthorizedError.js +52 -0
- package/dist/api/errors/index.d.ts +5 -0
- package/dist/api/errors/index.js +21 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +19 -0
- package/dist/api/resources/dataPools/client/Client.d.ts +177 -0
- package/dist/api/resources/dataPools/client/Client.js +676 -0
- package/dist/api/resources/dataPools/client/index.d.ts +2 -0
- package/dist/api/resources/dataPools/client/index.js +17 -0
- package/dist/api/resources/dataPools/client/requests/AddDataPoolFileRequest.d.ts +14 -0
- package/dist/api/resources/dataPools/client/requests/AddDataPoolFileRequest.js +5 -0
- package/dist/api/resources/dataPools/client/requests/CreateDataPoolRequest.d.ts +10 -0
- package/dist/api/resources/dataPools/client/requests/CreateDataPoolRequest.js +5 -0
- package/dist/api/resources/dataPools/client/requests/UpdateDataPoolRequest.d.ts +12 -0
- package/dist/api/resources/dataPools/client/requests/UpdateDataPoolRequest.js +5 -0
- package/dist/api/resources/dataPools/client/requests/index.d.ts +3 -0
- package/dist/api/resources/dataPools/client/requests/index.js +2 -0
- package/dist/api/resources/dataPools/index.d.ts +1 -0
- package/dist/api/resources/dataPools/index.js +17 -0
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +41 -0
- package/dist/api/types/DataPoolDto.d.ts +23 -0
- package/dist/api/types/DataPoolDto.js +14 -0
- package/dist/api/types/DataPoolFileDto.d.ts +12 -0
- package/dist/api/types/DataPoolFileDto.js +5 -0
- package/dist/api/types/OauthScope.d.ts +9 -0
- package/dist/api/types/OauthScope.js +9 -0
- package/dist/api/types/index.d.ts +3 -0
- package/dist/api/types/index.js +19 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/BinaryResponse.d.ts +20 -0
- package/dist/core/fetcher/BinaryResponse.js +17 -0
- package/dist/core/fetcher/Fetcher.d.ts +40 -0
- package/dist/core/fetcher/Fetcher.js +105 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +85 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +94 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/ResponseWithBody.d.ts +4 -0
- package/dist/core/fetcher/ResponseWithBody.js +6 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +13 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +8 -0
- package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getErrorResponseBody.js +32 -0
- package/dist/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/core/fetcher/getFetchFn.js +6 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +11 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +12 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +44 -0
- package/dist/core/fetcher/index.d.ts +9 -0
- package/dist/core/fetcher/index.js +15 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +33 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +29 -0
- package/dist/core/fetcher/signals.d.ts +11 -0
- package/dist/core/fetcher/signals.js +36 -0
- package/dist/core/file.d.ts +1 -0
- package/dist/core/file.js +2 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +16 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +166 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +12 -0
- package/dist/core/form-data-utils/index.d.ts +2 -0
- package/dist/core/form-data-utils/index.js +20 -0
- package/dist/core/headers.d.ts +3 -0
- package/dist/core/headers.js +29 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +44 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +101 -0
- package/dist/core/url/index.d.ts +2 -0
- package/dist/core/url/index.js +7 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +49 -0
- package/dist/core/url/qs.d.ts +6 -0
- package/dist/core/url/qs.js +67 -0
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/PlanqkApiError.d.ts +15 -0
- package/dist/errors/PlanqkApiError.js +33 -0
- package/dist/errors/PlanqkApiTimeoutError.d.ts +6 -0
- package/dist/errors/PlanqkApiTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +44 -0
- package/eslint.config.mjs +11 -0
- package/fern/fern.config.json +4 -0
- package/fern/generators.yml +25 -0
- package/fern/openapi/openapi.json +610 -0
- package/notebooks/python-sdk.ipynb +218 -0
- package/package.json +48 -0
- package/planqk/__init__.py +0 -0
- package/planqk/api/__init__.py +1 -0
- package/planqk/api/_version.py +1 -0
- package/planqk/api/client.py +19 -0
- package/planqk/api/credentials.py +103 -0
- package/planqk/api/sdk/__init__.py +25 -0
- package/planqk/api/sdk/client.py +153 -0
- package/planqk/api/sdk/core/__init__.py +52 -0
- package/planqk/api/sdk/core/api_error.py +23 -0
- package/planqk/api/sdk/core/client_wrapper.py +76 -0
- package/planqk/api/sdk/core/datetime_utils.py +28 -0
- package/planqk/api/sdk/core/file.py +67 -0
- package/planqk/api/sdk/core/force_multipart.py +16 -0
- package/planqk/api/sdk/core/http_client.py +543 -0
- package/planqk/api/sdk/core/http_response.py +55 -0
- package/planqk/api/sdk/core/jsonable_encoder.py +100 -0
- package/planqk/api/sdk/core/pydantic_utilities.py +255 -0
- package/planqk/api/sdk/core/query_encoder.py +58 -0
- package/planqk/api/sdk/core/remove_none_from_dict.py +11 -0
- package/planqk/api/sdk/core/request_options.py +35 -0
- package/planqk/api/sdk/core/serialization.py +276 -0
- package/planqk/api/sdk/data_pools/__init__.py +4 -0
- package/planqk/api/sdk/data_pools/client.py +700 -0
- package/planqk/api/sdk/data_pools/raw_client.py +1650 -0
- package/planqk/api/sdk/environment.py +7 -0
- package/planqk/api/sdk/errors/__init__.py +11 -0
- package/planqk/api/sdk/errors/bad_request_error.py +10 -0
- package/planqk/api/sdk/errors/forbidden_error.py +10 -0
- package/planqk/api/sdk/errors/internal_server_error.py +10 -0
- package/planqk/api/sdk/errors/not_found_error.py +10 -0
- package/planqk/api/sdk/errors/unauthorized_error.py +10 -0
- package/planqk/api/sdk/types/__init__.py +10 -0
- package/planqk/api/sdk/types/data_pool_dto.py +33 -0
- package/planqk/api/sdk/types/data_pool_dto_current_user_permission.py +5 -0
- package/planqk/api/sdk/types/data_pool_file_dto.py +27 -0
- package/planqk/api/sdk/types/oauth_scope.py +5 -0
- package/pyproject.toml +51 -0
- package/scripts/update-version.sh +6 -0
- package/src/Client.ts +53 -0
- package/src/api/errors/BadRequestError.ts +18 -0
- package/src/api/errors/ForbiddenError.ts +18 -0
- package/src/api/errors/InternalServerError.ts +18 -0
- package/src/api/errors/NotFoundError.ts +18 -0
- package/src/api/errors/UnauthorizedError.ts +18 -0
- package/src/api/errors/index.ts +5 -0
- package/src/api/index.ts +3 -0
- package/src/api/resources/dataPools/client/Client.ts +825 -0
- package/src/api/resources/dataPools/client/index.ts +2 -0
- package/src/api/resources/dataPools/client/requests/AddDataPoolFileRequest.ts +17 -0
- package/src/api/resources/dataPools/client/requests/CreateDataPoolRequest.ts +11 -0
- package/src/api/resources/dataPools/client/requests/UpdateDataPoolRequest.ts +13 -0
- package/src/api/resources/dataPools/client/requests/index.ts +3 -0
- package/src/api/resources/dataPools/index.ts +1 -0
- package/src/api/resources/index.ts +2 -0
- package/src/api/types/DataPoolDto.ts +25 -0
- package/src/api/types/DataPoolFileDto.ts +13 -0
- package/src/api/types/OauthScope.ts +10 -0
- package/src/api/types/index.ts +3 -0
- package/src/core/fetcher/APIResponse.ts +23 -0
- package/src/core/fetcher/BinaryResponse.ts +36 -0
- package/src/core/fetcher/Fetcher.ts +163 -0
- package/src/core/fetcher/Headers.ts +93 -0
- package/src/core/fetcher/HttpResponsePromise.ts +116 -0
- package/src/core/fetcher/RawResponse.ts +61 -0
- package/src/core/fetcher/ResponseWithBody.ts +7 -0
- package/src/core/fetcher/Supplier.ts +11 -0
- package/src/core/fetcher/createRequestUrl.ts +6 -0
- package/src/core/fetcher/getErrorResponseBody.ts +32 -0
- package/src/core/fetcher/getFetchFn.ts +3 -0
- package/src/core/fetcher/getHeader.ts +8 -0
- package/src/core/fetcher/getRequestBody.ts +16 -0
- package/src/core/fetcher/getResponseBody.ts +43 -0
- package/src/core/fetcher/index.ts +9 -0
- package/src/core/fetcher/makeRequest.ts +44 -0
- package/src/core/fetcher/requestWithRetries.ts +33 -0
- package/src/core/fetcher/signals.ts +38 -0
- package/src/core/file.ts +11 -0
- package/src/core/form-data-utils/FormDataWrapper.ts +176 -0
- package/src/core/form-data-utils/encodeAsFormParameter.ts +12 -0
- package/src/core/form-data-utils/index.ts +2 -0
- package/src/core/headers.ts +35 -0
- package/src/core/index.ts +5 -0
- package/src/core/json.ts +27 -0
- package/src/core/runtime/index.ts +1 -0
- package/src/core/runtime/runtime.ts +133 -0
- package/src/core/url/index.ts +2 -0
- package/src/core/url/join.ts +55 -0
- package/src/core/url/qs.ts +74 -0
- package/src/environments.ts +9 -0
- package/src/errors/PlanqkApiError.ts +55 -0
- package/src/errors/PlanqkApiTimeoutError.ts +10 -0
- package/src/errors/index.ts +2 -0
- package/src/index.test.ts +17 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +18 -0
- package/uv.lock +1102 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FormDataWrapper = void 0;
|
|
37
|
+
exports.newFormData = newFormData;
|
|
38
|
+
const json_js_1 = require("../../core/json.js");
|
|
39
|
+
const index_js_1 = require("../runtime/index.js");
|
|
40
|
+
function isNamedValue(value) {
|
|
41
|
+
return typeof value === "object" && value != null && "name" in value;
|
|
42
|
+
}
|
|
43
|
+
function isPathedValue(value) {
|
|
44
|
+
return typeof value === "object" && value != null && "path" in value;
|
|
45
|
+
}
|
|
46
|
+
function isStreamLike(value) {
|
|
47
|
+
return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
|
|
48
|
+
}
|
|
49
|
+
function isReadableStream(value) {
|
|
50
|
+
return typeof value === "object" && value != null && "getReader" in value;
|
|
51
|
+
}
|
|
52
|
+
function isBuffer(value) {
|
|
53
|
+
return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
|
|
54
|
+
}
|
|
55
|
+
function isArrayBufferView(value) {
|
|
56
|
+
return ArrayBuffer.isView(value);
|
|
57
|
+
}
|
|
58
|
+
function getLastPathSegment(pathStr) {
|
|
59
|
+
const lastForwardSlash = pathStr.lastIndexOf("/");
|
|
60
|
+
const lastBackSlash = pathStr.lastIndexOf("\\");
|
|
61
|
+
const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
|
|
62
|
+
return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr;
|
|
63
|
+
}
|
|
64
|
+
async function streamToBuffer(stream) {
|
|
65
|
+
if (index_js_1.RUNTIME.type === "node") {
|
|
66
|
+
const { Readable } = await Promise.resolve().then(() => __importStar(require("stream")));
|
|
67
|
+
if (stream instanceof Readable) {
|
|
68
|
+
const chunks = [];
|
|
69
|
+
for await (const chunk of stream) {
|
|
70
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
71
|
+
}
|
|
72
|
+
return Buffer.concat(chunks);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (isReadableStream(stream)) {
|
|
76
|
+
const reader = stream.getReader();
|
|
77
|
+
const chunks = [];
|
|
78
|
+
try {
|
|
79
|
+
while (true) {
|
|
80
|
+
const { done, value } = await reader.read();
|
|
81
|
+
if (done)
|
|
82
|
+
break;
|
|
83
|
+
chunks.push(value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
reader.releaseLock();
|
|
88
|
+
}
|
|
89
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
90
|
+
const result = new Uint8Array(totalLength);
|
|
91
|
+
let offset = 0;
|
|
92
|
+
for (const chunk of chunks) {
|
|
93
|
+
result.set(chunk, offset);
|
|
94
|
+
offset += chunk.length;
|
|
95
|
+
}
|
|
96
|
+
return Buffer.from(result);
|
|
97
|
+
}
|
|
98
|
+
throw new Error("Unsupported stream type: " + typeof stream + ". Expected Node.js Readable stream or Web ReadableStream.");
|
|
99
|
+
}
|
|
100
|
+
async function newFormData() {
|
|
101
|
+
return new FormDataWrapper();
|
|
102
|
+
}
|
|
103
|
+
class FormDataWrapper {
|
|
104
|
+
fd = new FormData();
|
|
105
|
+
async setup() {
|
|
106
|
+
// noop
|
|
107
|
+
}
|
|
108
|
+
append(key, value) {
|
|
109
|
+
this.fd.append(key, String(value));
|
|
110
|
+
}
|
|
111
|
+
getFileName(value, filename) {
|
|
112
|
+
if (filename != null) {
|
|
113
|
+
return filename;
|
|
114
|
+
}
|
|
115
|
+
if (isNamedValue(value)) {
|
|
116
|
+
return value.name;
|
|
117
|
+
}
|
|
118
|
+
if (isPathedValue(value) && value.path) {
|
|
119
|
+
return getLastPathSegment(value.path.toString());
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
async convertToBlob(value) {
|
|
124
|
+
if (isStreamLike(value) || isReadableStream(value)) {
|
|
125
|
+
const buffer = await streamToBuffer(value);
|
|
126
|
+
return new Blob([buffer]);
|
|
127
|
+
}
|
|
128
|
+
if (value instanceof Blob) {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
if (isBuffer(value)) {
|
|
132
|
+
return new Blob([value]);
|
|
133
|
+
}
|
|
134
|
+
if (value instanceof ArrayBuffer) {
|
|
135
|
+
return new Blob([value]);
|
|
136
|
+
}
|
|
137
|
+
if (isArrayBufferView(value)) {
|
|
138
|
+
return new Blob([value]);
|
|
139
|
+
}
|
|
140
|
+
if (typeof value === "string") {
|
|
141
|
+
return new Blob([value]);
|
|
142
|
+
}
|
|
143
|
+
if (typeof value === "object" && value !== null) {
|
|
144
|
+
return new Blob([(0, json_js_1.toJson)(value)], { type: "application/json" });
|
|
145
|
+
}
|
|
146
|
+
return new Blob([String(value)]);
|
|
147
|
+
}
|
|
148
|
+
async appendFile(key, value, fileName) {
|
|
149
|
+
fileName = this.getFileName(value, fileName);
|
|
150
|
+
const blob = await this.convertToBlob(value);
|
|
151
|
+
if (fileName) {
|
|
152
|
+
this.fd.append(key, blob, fileName);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.fd.append(key, blob);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
getRequest() {
|
|
159
|
+
return {
|
|
160
|
+
body: this.fd,
|
|
161
|
+
headers: {},
|
|
162
|
+
duplex: "half",
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.FormDataWrapper = FormDataWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeAsFormParameter(value: unknown): Record<string, string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeAsFormParameter = encodeAsFormParameter;
|
|
4
|
+
const qs_js_1 = require("../url/qs.js");
|
|
5
|
+
function encodeAsFormParameter(value) {
|
|
6
|
+
const stringified = (0, qs_js_1.toQueryString)(value, { encode: false });
|
|
7
|
+
const keyValuePairs = stringified.split("&").map((pair) => {
|
|
8
|
+
const [key, value] = pair.split("=");
|
|
9
|
+
return [key, value];
|
|
10
|
+
});
|
|
11
|
+
return Object.fromEntries(keyValuePairs);
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.encodeAsFormParameter = void 0;
|
|
18
|
+
var encodeAsFormParameter_js_1 = require("./encodeAsFormParameter.js");
|
|
19
|
+
Object.defineProperty(exports, "encodeAsFormParameter", { enumerable: true, get: function () { return encodeAsFormParameter_js_1.encodeAsFormParameter; } });
|
|
20
|
+
__exportStar(require("./FormDataWrapper.js"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
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>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeHeaders = mergeHeaders;
|
|
4
|
+
exports.mergeOnlyDefinedHeaders = mergeOnlyDefinedHeaders;
|
|
5
|
+
function mergeHeaders(...headersArray) {
|
|
6
|
+
const result = {};
|
|
7
|
+
for (const [key, value] of headersArray
|
|
8
|
+
.filter((headers) => headers != null)
|
|
9
|
+
.flatMap((headers) => Object.entries(headers))) {
|
|
10
|
+
if (value != null) {
|
|
11
|
+
result[key] = value;
|
|
12
|
+
}
|
|
13
|
+
else if (key in result) {
|
|
14
|
+
delete result[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
function mergeOnlyDefinedHeaders(...headersArray) {
|
|
20
|
+
const result = {};
|
|
21
|
+
for (const [key, value] of headersArray
|
|
22
|
+
.filter((headers) => headers != null)
|
|
23
|
+
.flatMap((headers) => Object.entries(headers))) {
|
|
24
|
+
if (value != null) {
|
|
25
|
+
result[key] = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.url = void 0;
|
|
40
|
+
__exportStar(require("./fetcher/index.js"), exports);
|
|
41
|
+
__exportStar(require("./runtime/index.js"), exports);
|
|
42
|
+
exports.url = __importStar(require("./url/index.js"));
|
|
43
|
+
__exportStar(require("./form-data-utils/index.js"), exports);
|
|
44
|
+
__exportStar(require("./file.js"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a value to JSON
|
|
3
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
4
|
+
* @param replacer A function that transforms the results.
|
|
5
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
6
|
+
* @returns JSON string
|
|
7
|
+
*/
|
|
8
|
+
export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse JSON string to object, array, or other type
|
|
11
|
+
* @param text A valid JSON string.
|
|
12
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
13
|
+
* @returns Parsed object, array, or other type
|
|
14
|
+
*/
|
|
15
|
+
export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJson = void 0;
|
|
4
|
+
exports.fromJson = fromJson;
|
|
5
|
+
/**
|
|
6
|
+
* Serialize a value to JSON
|
|
7
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
8
|
+
* @param replacer A function that transforms the results.
|
|
9
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
10
|
+
* @returns JSON string
|
|
11
|
+
*/
|
|
12
|
+
const toJson = (value, replacer, space) => {
|
|
13
|
+
return JSON.stringify(value, replacer, space);
|
|
14
|
+
};
|
|
15
|
+
exports.toJson = toJson;
|
|
16
|
+
/**
|
|
17
|
+
* Parse JSON string to object, array, or other type
|
|
18
|
+
* @param text A valid JSON string.
|
|
19
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
20
|
+
* @returns Parsed object, array, or other type
|
|
21
|
+
*/
|
|
22
|
+
function fromJson(text, reviver) {
|
|
23
|
+
return JSON.parse(text, reviver);
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RUNTIME } from "./runtime.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
3
|
+
*/
|
|
4
|
+
export declare const RUNTIME: Runtime;
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
|
|
7
|
+
version?: string;
|
|
8
|
+
parsedVersion?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RUNTIME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
6
|
+
*/
|
|
7
|
+
exports.RUNTIME = evaluateRuntime();
|
|
8
|
+
function evaluateRuntime() {
|
|
9
|
+
/**
|
|
10
|
+
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
11
|
+
*/
|
|
12
|
+
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
13
|
+
if (isBrowser) {
|
|
14
|
+
return {
|
|
15
|
+
type: "browser",
|
|
16
|
+
version: window.navigator.userAgent,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A constant that indicates whether the environment the code is running is Cloudflare.
|
|
21
|
+
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
22
|
+
*/
|
|
23
|
+
const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers";
|
|
24
|
+
if (isCloudflare) {
|
|
25
|
+
return {
|
|
26
|
+
type: "workerd",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A constant that indicates whether the environment the code is running is Edge Runtime.
|
|
31
|
+
* https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime
|
|
32
|
+
*/
|
|
33
|
+
const isEdgeRuntime = typeof EdgeRuntime === "string";
|
|
34
|
+
if (isEdgeRuntime) {
|
|
35
|
+
return {
|
|
36
|
+
type: "edge-runtime",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
41
|
+
*/
|
|
42
|
+
const isWebWorker = typeof self === "object" &&
|
|
43
|
+
typeof self?.importScripts === "function" &&
|
|
44
|
+
(self.constructor?.name === "DedicatedWorkerGlobalScope" ||
|
|
45
|
+
self.constructor?.name === "ServiceWorkerGlobalScope" ||
|
|
46
|
+
self.constructor?.name === "SharedWorkerGlobalScope");
|
|
47
|
+
if (isWebWorker) {
|
|
48
|
+
return {
|
|
49
|
+
type: "web-worker",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A constant that indicates whether the environment the code is running is Deno.
|
|
54
|
+
* FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
55
|
+
*/
|
|
56
|
+
const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
57
|
+
if (isDeno) {
|
|
58
|
+
return {
|
|
59
|
+
type: "deno",
|
|
60
|
+
version: Deno.version.deno,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
65
|
+
*/
|
|
66
|
+
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
67
|
+
if (isBun) {
|
|
68
|
+
return {
|
|
69
|
+
type: "bun",
|
|
70
|
+
version: Bun.version,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
75
|
+
*/
|
|
76
|
+
const isNode = typeof process !== "undefined" &&
|
|
77
|
+
"version" in process &&
|
|
78
|
+
!!process.version &&
|
|
79
|
+
"versions" in process &&
|
|
80
|
+
!!process.versions?.node;
|
|
81
|
+
if (isNode) {
|
|
82
|
+
return {
|
|
83
|
+
type: "node",
|
|
84
|
+
version: process.versions.node,
|
|
85
|
+
parsedVersion: Number(process.versions.node.split(".")[0]),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
90
|
+
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
91
|
+
*/
|
|
92
|
+
const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative";
|
|
93
|
+
if (isReactNative) {
|
|
94
|
+
return {
|
|
95
|
+
type: "react-native",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
type: "unknown",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = exports.join = void 0;
|
|
4
|
+
var join_js_1 = require("./join.js");
|
|
5
|
+
Object.defineProperty(exports, "join", { enumerable: true, get: function () { return join_js_1.join; } });
|
|
6
|
+
var qs_js_1 = require("./qs.js");
|
|
7
|
+
Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return qs_js_1.toQueryString; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function join(base: string, ...segments: string[]): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.join = join;
|
|
4
|
+
function join(base, ...segments) {
|
|
5
|
+
if (!base) {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
if (base.includes("://")) {
|
|
9
|
+
let url;
|
|
10
|
+
try {
|
|
11
|
+
url = new URL(base);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// Fallback to path joining if URL is malformed
|
|
15
|
+
return joinPath(base, ...segments);
|
|
16
|
+
}
|
|
17
|
+
for (const segment of segments) {
|
|
18
|
+
const cleanSegment = trimSlashes(segment);
|
|
19
|
+
if (cleanSegment) {
|
|
20
|
+
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return url.toString();
|
|
24
|
+
}
|
|
25
|
+
return joinPath(base, ...segments);
|
|
26
|
+
}
|
|
27
|
+
function joinPath(base, ...segments) {
|
|
28
|
+
let result = base;
|
|
29
|
+
for (const segment of segments) {
|
|
30
|
+
const cleanSegment = trimSlashes(segment);
|
|
31
|
+
if (cleanSegment) {
|
|
32
|
+
result = joinPathSegments(result, cleanSegment);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function joinPathSegments(left, right) {
|
|
38
|
+
if (left.endsWith("/")) {
|
|
39
|
+
return left + right;
|
|
40
|
+
}
|
|
41
|
+
return left + "/" + right;
|
|
42
|
+
}
|
|
43
|
+
function trimSlashes(str) {
|
|
44
|
+
if (!str)
|
|
45
|
+
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);
|
|
49
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = toQueryString;
|
|
4
|
+
const defaultQsOptions = {
|
|
5
|
+
arrayFormat: "indices",
|
|
6
|
+
encode: true,
|
|
7
|
+
};
|
|
8
|
+
function encodeValue(value, shouldEncode) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
if (value === null) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
const stringValue = String(value);
|
|
16
|
+
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
17
|
+
}
|
|
18
|
+
function stringifyObject(obj, prefix = "", options) {
|
|
19
|
+
const parts = [];
|
|
20
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
21
|
+
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
22
|
+
if (value === undefined) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
if (value.length === 0) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
for (let i = 0; i < value.length; i++) {
|
|
30
|
+
const item = value[i];
|
|
31
|
+
if (item === undefined) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
35
|
+
const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
36
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
40
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
41
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (typeof value === "object" && value !== null) {
|
|
46
|
+
if (Object.keys(value).length === 0) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
parts.push(...stringifyObject(value, fullKey, options));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
53
|
+
parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return parts;
|
|
57
|
+
}
|
|
58
|
+
function toQueryString(obj, options) {
|
|
59
|
+
if (obj == null || typeof obj !== "object") {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
const parts = stringifyObject(obj, "", {
|
|
63
|
+
...defaultQsOptions,
|
|
64
|
+
...options,
|
|
65
|
+
});
|
|
66
|
+
return parts.join("&");
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PlanqkApiEnvironment = void 0;
|
|
7
|
+
exports.PlanqkApiEnvironment = {
|
|
8
|
+
Default: "https://34.90.225.20.nip.io/qc-catalog",
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as core from "../core/index.js";
|
|
5
|
+
export declare class PlanqkApiError extends Error {
|
|
6
|
+
readonly statusCode?: number;
|
|
7
|
+
readonly body?: unknown;
|
|
8
|
+
readonly rawResponse?: core.RawResponse;
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }: {
|
|
10
|
+
message?: string;
|
|
11
|
+
statusCode?: number;
|
|
12
|
+
body?: unknown;
|
|
13
|
+
rawResponse?: core.RawResponse;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PlanqkApiError = void 0;
|
|
7
|
+
const json_js_1 = require("../core/json.js");
|
|
8
|
+
class PlanqkApiError extends Error {
|
|
9
|
+
statusCode;
|
|
10
|
+
body;
|
|
11
|
+
rawResponse;
|
|
12
|
+
constructor({ message, statusCode, body, rawResponse, }) {
|
|
13
|
+
super(buildMessage({ message, statusCode, body }));
|
|
14
|
+
Object.setPrototypeOf(this, PlanqkApiError.prototype);
|
|
15
|
+
this.statusCode = statusCode;
|
|
16
|
+
this.body = body;
|
|
17
|
+
this.rawResponse = rawResponse;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.PlanqkApiError = PlanqkApiError;
|
|
21
|
+
function buildMessage({ message, statusCode, body, }) {
|
|
22
|
+
let lines = [];
|
|
23
|
+
if (message != null) {
|
|
24
|
+
lines.push(message);
|
|
25
|
+
}
|
|
26
|
+
if (statusCode != null) {
|
|
27
|
+
lines.push(`Status code: ${statusCode.toString()}`);
|
|
28
|
+
}
|
|
29
|
+
if (body != null) {
|
|
30
|
+
lines.push(`Body: ${(0, json_js_1.toJson)(body, undefined, 2)}`);
|
|
31
|
+
}
|
|
32
|
+
return lines.join("\n");
|
|
33
|
+
}
|