@flowcore/sdk 1.4.2
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/README.md +41 -0
- package/esm/commands/api-key/api-key.create.d.ts +34 -0
- package/esm/commands/api-key/api-key.create.d.ts.map +1 -0
- package/esm/commands/api-key/api-key.create.js +74 -0
- package/esm/commands/api-key/api-key.delete.d.ts +28 -0
- package/esm/commands/api-key/api-key.delete.d.ts.map +1 -0
- package/esm/commands/api-key/api-key.delete.js +60 -0
- package/esm/commands/api-key/api-key.list.d.ts +27 -0
- package/esm/commands/api-key/api-key.list.d.ts.map +1 -0
- package/esm/commands/api-key/api-key.list.js +58 -0
- package/esm/commands/data-core/data-core.create.d.ts +39 -0
- package/esm/commands/data-core/data-core.create.d.ts.map +1 -0
- package/esm/commands/data-core/data-core.create.js +32 -0
- package/esm/commands/data-core/data-core.delete-request.d.ts +37 -0
- package/esm/commands/data-core/data-core.delete-request.d.ts.map +1 -0
- package/esm/commands/data-core/data-core.delete-request.js +94 -0
- package/esm/commands/data-core/data-core.exists.d.ts +37 -0
- package/esm/commands/data-core/data-core.exists.d.ts.map +1 -0
- package/esm/commands/data-core/data-core.exists.js +33 -0
- package/esm/commands/data-core/data-core.fetch.d.ts +51 -0
- package/esm/commands/data-core/data-core.fetch.d.ts.map +1 -0
- package/esm/commands/data-core/data-core.fetch.js +48 -0
- package/esm/commands/data-core/data-core.list.d.ts +33 -0
- package/esm/commands/data-core/data-core.list.d.ts.map +1 -0
- package/esm/commands/data-core/data-core.list.js +40 -0
- package/esm/commands/data-core/data-core.update.d.ts +41 -0
- package/esm/commands/data-core/data-core.update.d.ts.map +1 -0
- package/esm/commands/data-core/data-core.update.js +43 -0
- package/esm/commands/event-type/event-type.create.d.ts +35 -0
- package/esm/commands/event-type/event-type.create.d.ts.map +1 -0
- package/esm/commands/event-type/event-type.create.js +32 -0
- package/esm/commands/event-type/event-type.delete-request.d.ts +37 -0
- package/esm/commands/event-type/event-type.delete-request.d.ts.map +1 -0
- package/esm/commands/event-type/event-type.delete-request.js +98 -0
- package/esm/commands/event-type/event-type.exists.d.ts +37 -0
- package/esm/commands/event-type/event-type.exists.d.ts.map +1 -0
- package/esm/commands/event-type/event-type.exists.js +33 -0
- package/esm/commands/event-type/event-type.fetch.d.ts +45 -0
- package/esm/commands/event-type/event-type.fetch.d.ts.map +1 -0
- package/esm/commands/event-type/event-type.fetch.js +48 -0
- package/esm/commands/event-type/event-type.list.d.ts +31 -0
- package/esm/commands/event-type/event-type.list.d.ts.map +1 -0
- package/esm/commands/event-type/event-type.list.js +36 -0
- package/esm/commands/event-type/event-type.update.d.ts +37 -0
- package/esm/commands/event-type/event-type.update.d.ts.map +1 -0
- package/esm/commands/event-type/event-type.update.js +39 -0
- package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts +53 -0
- package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -0
- package/esm/commands/events/events.fetch-time-buckets-by-names.js +40 -0
- package/esm/commands/events/events.fetch.d.ts +58 -0
- package/esm/commands/events/events.fetch.d.ts.map +1 -0
- package/esm/commands/events/events.fetch.js +54 -0
- package/esm/commands/flow-type/flow-type.create.d.ts +35 -0
- package/esm/commands/flow-type/flow-type.create.d.ts.map +1 -0
- package/esm/commands/flow-type/flow-type.create.js +32 -0
- package/esm/commands/flow-type/flow-type.delete-request.d.ts +47 -0
- package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +1 -0
- package/esm/commands/flow-type/flow-type.delete-request.js +118 -0
- package/esm/commands/flow-type/flow-type.exists.d.ts +39 -0
- package/esm/commands/flow-type/flow-type.exists.d.ts.map +1 -0
- package/esm/commands/flow-type/flow-type.exists.js +33 -0
- package/esm/commands/flow-type/flow-type.fetch.d.ts +51 -0
- package/esm/commands/flow-type/flow-type.fetch.d.ts.map +1 -0
- package/esm/commands/flow-type/flow-type.fetch.js +48 -0
- package/esm/commands/flow-type/flow-type.list.d.ts +31 -0
- package/esm/commands/flow-type/flow-type.list.d.ts.map +1 -0
- package/esm/commands/flow-type/flow-type.list.js +36 -0
- package/esm/commands/flow-type/flow-type.update.d.ts +37 -0
- package/esm/commands/flow-type/flow-type.update.d.ts.map +1 -0
- package/esm/commands/flow-type/flow-type.update.js +39 -0
- package/esm/commands/index.d.ts +32 -0
- package/esm/commands/index.d.ts.map +1 -0
- package/esm/commands/index.js +39 -0
- package/esm/commands/secret/secret.create.d.ts +30 -0
- package/esm/commands/secret/secret.create.d.ts.map +1 -0
- package/esm/commands/secret/secret.create.js +60 -0
- package/esm/commands/secret/secret.delete.d.ts +28 -0
- package/esm/commands/secret/secret.delete.d.ts.map +1 -0
- package/esm/commands/secret/secret.delete.js +61 -0
- package/esm/commands/secret/secret.list.d.ts +26 -0
- package/esm/commands/secret/secret.list.d.ts.map +1 -0
- package/esm/commands/secret/secret.list.js +63 -0
- package/esm/commands/tenant/tenant.fetch.d.ts +43 -0
- package/esm/commands/tenant/tenant.fetch.d.ts.map +1 -0
- package/esm/commands/tenant/tenant.fetch.js +77 -0
- package/esm/commands/tenant/tenant.list.d.ts +20 -0
- package/esm/commands/tenant/tenant.list.d.ts.map +1 -0
- package/esm/commands/tenant/tenant.list.js +65 -0
- package/esm/commands/variable/variable.create.d.ts +31 -0
- package/esm/commands/variable/variable.create.d.ts.map +1 -0
- package/esm/commands/variable/variable.create.js +66 -0
- package/esm/commands/variable/variable.delete.d.ts +28 -0
- package/esm/commands/variable/variable.delete.d.ts.map +1 -0
- package/esm/commands/variable/variable.delete.js +63 -0
- package/esm/commands/variable/variable.list.d.ts +27 -0
- package/esm/commands/variable/variable.list.d.ts.map +1 -0
- package/esm/commands/variable/variable.list.js +69 -0
- package/esm/common/command.d.ts +63 -0
- package/esm/common/command.d.ts.map +1 -0
- package/esm/common/command.js +91 -0
- package/esm/common/flowcore-client.d.ts +39 -0
- package/esm/common/flowcore-client.d.ts.map +1 -0
- package/esm/common/flowcore-client.js +72 -0
- package/esm/contracts/api-key.d.ts +14 -0
- package/esm/contracts/api-key.d.ts.map +1 -0
- package/esm/contracts/api-key.js +9 -0
- package/esm/contracts/data-core.d.ts +38 -0
- package/esm/contracts/data-core.d.ts.map +1 -0
- package/esm/contracts/data-core.js +38 -0
- package/esm/contracts/event-type.d.ts +33 -0
- package/esm/contracts/event-type.d.ts.map +1 -0
- package/esm/contracts/event-type.js +33 -0
- package/esm/contracts/event.d.ts +20 -0
- package/esm/contracts/event.d.ts.map +1 -0
- package/esm/contracts/event.js +15 -0
- package/esm/contracts/flow-type.d.ts +32 -0
- package/esm/contracts/flow-type.d.ts.map +1 -0
- package/esm/contracts/flow-type.js +31 -0
- package/esm/contracts/index.d.ts +4 -0
- package/esm/contracts/index.d.ts.map +1 -0
- package/esm/contracts/index.js +1 -0
- package/esm/contracts/tenant.d.ts +50 -0
- package/esm/contracts/tenant.d.ts.map +1 -0
- package/esm/contracts/tenant.js +33 -0
- package/esm/contracts/variable.d.ts +13 -0
- package/esm/contracts/variable.d.ts.map +1 -0
- package/esm/contracts/variable.js +8 -0
- package/esm/exceptions/client-error.d.ts +9 -0
- package/esm/exceptions/client-error.d.ts.map +1 -0
- package/esm/exceptions/client-error.js +20 -0
- package/esm/exceptions/command-error.d.ts +7 -0
- package/esm/exceptions/command-error.d.ts.map +1 -0
- package/esm/exceptions/command-error.js +8 -0
- package/esm/exceptions/index.d.ts +4 -0
- package/esm/exceptions/index.d.ts.map +1 -0
- package/esm/exceptions/index.js +3 -0
- package/esm/exceptions/invalid-response.d.ts +8 -0
- package/esm/exceptions/invalid-response.d.ts.map +1 -0
- package/esm/exceptions/invalid-response.js +15 -0
- package/esm/exceptions/not-found.d.ts +7 -0
- package/esm/exceptions/not-found.d.ts.map +1 -0
- package/esm/exceptions/not-found.js +8 -0
- package/esm/mod.d.ts +6 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +5 -0
- package/esm/package.json +3 -0
- package/esm/utils/parse-response-helper.d.ts +6 -0
- package/esm/utils/parse-response-helper.d.ts.map +1 -0
- package/esm/utils/parse-response-helper.js +16 -0
- package/package.json +28 -0
- package/script/commands/api-key/api-key.create.d.ts +34 -0
- package/script/commands/api-key/api-key.create.d.ts.map +1 -0
- package/script/commands/api-key/api-key.create.js +78 -0
- package/script/commands/api-key/api-key.delete.d.ts +28 -0
- package/script/commands/api-key/api-key.delete.d.ts.map +1 -0
- package/script/commands/api-key/api-key.delete.js +64 -0
- package/script/commands/api-key/api-key.list.d.ts +27 -0
- package/script/commands/api-key/api-key.list.d.ts.map +1 -0
- package/script/commands/api-key/api-key.list.js +62 -0
- package/script/commands/data-core/data-core.create.d.ts +39 -0
- package/script/commands/data-core/data-core.create.d.ts.map +1 -0
- package/script/commands/data-core/data-core.create.js +36 -0
- package/script/commands/data-core/data-core.delete-request.d.ts +37 -0
- package/script/commands/data-core/data-core.delete-request.d.ts.map +1 -0
- package/script/commands/data-core/data-core.delete-request.js +98 -0
- package/script/commands/data-core/data-core.exists.d.ts +37 -0
- package/script/commands/data-core/data-core.exists.d.ts.map +1 -0
- package/script/commands/data-core/data-core.exists.js +37 -0
- package/script/commands/data-core/data-core.fetch.d.ts +51 -0
- package/script/commands/data-core/data-core.fetch.d.ts.map +1 -0
- package/script/commands/data-core/data-core.fetch.js +52 -0
- package/script/commands/data-core/data-core.list.d.ts +33 -0
- package/script/commands/data-core/data-core.list.d.ts.map +1 -0
- package/script/commands/data-core/data-core.list.js +44 -0
- package/script/commands/data-core/data-core.update.d.ts +41 -0
- package/script/commands/data-core/data-core.update.d.ts.map +1 -0
- package/script/commands/data-core/data-core.update.js +47 -0
- package/script/commands/event-type/event-type.create.d.ts +35 -0
- package/script/commands/event-type/event-type.create.d.ts.map +1 -0
- package/script/commands/event-type/event-type.create.js +36 -0
- package/script/commands/event-type/event-type.delete-request.d.ts +37 -0
- package/script/commands/event-type/event-type.delete-request.d.ts.map +1 -0
- package/script/commands/event-type/event-type.delete-request.js +102 -0
- package/script/commands/event-type/event-type.exists.d.ts +37 -0
- package/script/commands/event-type/event-type.exists.d.ts.map +1 -0
- package/script/commands/event-type/event-type.exists.js +37 -0
- package/script/commands/event-type/event-type.fetch.d.ts +45 -0
- package/script/commands/event-type/event-type.fetch.d.ts.map +1 -0
- package/script/commands/event-type/event-type.fetch.js +52 -0
- package/script/commands/event-type/event-type.list.d.ts +31 -0
- package/script/commands/event-type/event-type.list.d.ts.map +1 -0
- package/script/commands/event-type/event-type.list.js +40 -0
- package/script/commands/event-type/event-type.update.d.ts +37 -0
- package/script/commands/event-type/event-type.update.d.ts.map +1 -0
- package/script/commands/event-type/event-type.update.js +43 -0
- package/script/commands/events/events.fetch-time-buckets-by-names.d.ts +53 -0
- package/script/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -0
- package/script/commands/events/events.fetch-time-buckets-by-names.js +44 -0
- package/script/commands/events/events.fetch.d.ts +58 -0
- package/script/commands/events/events.fetch.d.ts.map +1 -0
- package/script/commands/events/events.fetch.js +58 -0
- package/script/commands/flow-type/flow-type.create.d.ts +35 -0
- package/script/commands/flow-type/flow-type.create.d.ts.map +1 -0
- package/script/commands/flow-type/flow-type.create.js +36 -0
- package/script/commands/flow-type/flow-type.delete-request.d.ts +47 -0
- package/script/commands/flow-type/flow-type.delete-request.d.ts.map +1 -0
- package/script/commands/flow-type/flow-type.delete-request.js +122 -0
- package/script/commands/flow-type/flow-type.exists.d.ts +39 -0
- package/script/commands/flow-type/flow-type.exists.d.ts.map +1 -0
- package/script/commands/flow-type/flow-type.exists.js +37 -0
- package/script/commands/flow-type/flow-type.fetch.d.ts +51 -0
- package/script/commands/flow-type/flow-type.fetch.d.ts.map +1 -0
- package/script/commands/flow-type/flow-type.fetch.js +52 -0
- package/script/commands/flow-type/flow-type.list.d.ts +31 -0
- package/script/commands/flow-type/flow-type.list.d.ts.map +1 -0
- package/script/commands/flow-type/flow-type.list.js +40 -0
- package/script/commands/flow-type/flow-type.update.d.ts +37 -0
- package/script/commands/flow-type/flow-type.update.d.ts.map +1 -0
- package/script/commands/flow-type/flow-type.update.js +43 -0
- package/script/commands/index.d.ts +32 -0
- package/script/commands/index.d.ts.map +1 -0
- package/script/commands/index.js +55 -0
- package/script/commands/secret/secret.create.d.ts +30 -0
- package/script/commands/secret/secret.create.d.ts.map +1 -0
- package/script/commands/secret/secret.create.js +64 -0
- package/script/commands/secret/secret.delete.d.ts +28 -0
- package/script/commands/secret/secret.delete.d.ts.map +1 -0
- package/script/commands/secret/secret.delete.js +65 -0
- package/script/commands/secret/secret.list.d.ts +26 -0
- package/script/commands/secret/secret.list.d.ts.map +1 -0
- package/script/commands/secret/secret.list.js +67 -0
- package/script/commands/tenant/tenant.fetch.d.ts +43 -0
- package/script/commands/tenant/tenant.fetch.d.ts.map +1 -0
- package/script/commands/tenant/tenant.fetch.js +81 -0
- package/script/commands/tenant/tenant.list.d.ts +20 -0
- package/script/commands/tenant/tenant.list.d.ts.map +1 -0
- package/script/commands/tenant/tenant.list.js +69 -0
- package/script/commands/variable/variable.create.d.ts +31 -0
- package/script/commands/variable/variable.create.d.ts.map +1 -0
- package/script/commands/variable/variable.create.js +70 -0
- package/script/commands/variable/variable.delete.d.ts +28 -0
- package/script/commands/variable/variable.delete.d.ts.map +1 -0
- package/script/commands/variable/variable.delete.js +67 -0
- package/script/commands/variable/variable.list.d.ts +27 -0
- package/script/commands/variable/variable.list.d.ts.map +1 -0
- package/script/commands/variable/variable.list.js +73 -0
- package/script/common/command.d.ts +63 -0
- package/script/common/command.d.ts.map +1 -0
- package/script/common/command.js +96 -0
- package/script/common/flowcore-client.d.ts +39 -0
- package/script/common/flowcore-client.d.ts.map +1 -0
- package/script/common/flowcore-client.js +76 -0
- package/script/contracts/api-key.d.ts +14 -0
- package/script/contracts/api-key.d.ts.map +1 -0
- package/script/contracts/api-key.js +12 -0
- package/script/contracts/data-core.d.ts +38 -0
- package/script/contracts/data-core.d.ts.map +1 -0
- package/script/contracts/data-core.js +42 -0
- package/script/contracts/event-type.d.ts +33 -0
- package/script/contracts/event-type.d.ts.map +1 -0
- package/script/contracts/event-type.js +37 -0
- package/script/contracts/event.d.ts +20 -0
- package/script/contracts/event.d.ts.map +1 -0
- package/script/contracts/event.js +18 -0
- package/script/contracts/flow-type.d.ts +32 -0
- package/script/contracts/flow-type.d.ts.map +1 -0
- package/script/contracts/flow-type.js +35 -0
- package/script/contracts/index.d.ts +4 -0
- package/script/contracts/index.d.ts.map +1 -0
- package/script/contracts/index.js +2 -0
- package/script/contracts/tenant.d.ts +50 -0
- package/script/contracts/tenant.d.ts.map +1 -0
- package/script/contracts/tenant.js +37 -0
- package/script/contracts/variable.d.ts +13 -0
- package/script/contracts/variable.d.ts.map +1 -0
- package/script/contracts/variable.js +11 -0
- package/script/exceptions/client-error.d.ts +9 -0
- package/script/exceptions/client-error.d.ts.map +1 -0
- package/script/exceptions/client-error.js +24 -0
- package/script/exceptions/command-error.d.ts +7 -0
- package/script/exceptions/command-error.d.ts.map +1 -0
- package/script/exceptions/command-error.js +12 -0
- package/script/exceptions/index.d.ts +4 -0
- package/script/exceptions/index.d.ts.map +1 -0
- package/script/exceptions/index.js +19 -0
- package/script/exceptions/invalid-response.d.ts +8 -0
- package/script/exceptions/invalid-response.d.ts.map +1 -0
- package/script/exceptions/invalid-response.js +19 -0
- package/script/exceptions/not-found.d.ts +7 -0
- package/script/exceptions/not-found.d.ts.map +1 -0
- package/script/exceptions/not-found.js +12 -0
- package/script/mod.d.ts +6 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +21 -0
- package/script/package.json +3 -0
- package/script/utils/parse-response-helper.d.ts +6 -0
- package/script/utils/parse-response-helper.d.ts.map +1 -0
- package/script/utils/parse-response-helper.js +20 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Static, TSchema } from "@sinclair/typebox";
|
|
2
|
+
/**
|
|
3
|
+
* Helper method for parsing the response
|
|
4
|
+
*/
|
|
5
|
+
export declare const parseResponseHelper: <T extends TSchema>(schema: T, response: unknown) => Static<T>;
|
|
6
|
+
//# sourceMappingURL=parse-response-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-response-helper.d.ts","sourceRoot":"","sources":["../../src/utils/parse-response-helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGxD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,OAAO,UAAU,CAAC,YAAY,OAAO,KAAG,MAAM,CAAC,CAAC,CAU7F,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Value } from "@sinclair/typebox/value";
|
|
2
|
+
import { InvalidResponseException } from "../exceptions/invalid-response.js";
|
|
3
|
+
/**
|
|
4
|
+
* Helper method for parsing the response
|
|
5
|
+
*/
|
|
6
|
+
export const parseResponseHelper = (schema, response) => {
|
|
7
|
+
if (!Value.Check(schema, response)) {
|
|
8
|
+
const parseErrors = Value.Errors(schema, response);
|
|
9
|
+
const errors = {};
|
|
10
|
+
for (const error of parseErrors) {
|
|
11
|
+
errors[error.path] = error.message;
|
|
12
|
+
}
|
|
13
|
+
throw new InvalidResponseException("Invalid response", errors);
|
|
14
|
+
}
|
|
15
|
+
return response;
|
|
16
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowcore/sdk",
|
|
3
|
+
"version": "1.4.2",
|
|
4
|
+
"description": "Flowcore SDK",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/flowcore/flowcore-sdk.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/flowcore/flowcore-sdk/issues"
|
|
12
|
+
},
|
|
13
|
+
"main": "./script/mod.js",
|
|
14
|
+
"module": "./esm/mod.js",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./esm/mod.js",
|
|
18
|
+
"require": "./script/mod.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@sinclair/typebox": "0.32.15"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^20.9.0"
|
|
26
|
+
},
|
|
27
|
+
"_generatedBy": "dnt@dev"
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
2
|
+
import type { ApiKey } from "../../contracts/api-key.js";
|
|
3
|
+
import type { FlowcoreClient } from "../../common/flowcore-client.js";
|
|
4
|
+
/**
|
|
5
|
+
* The input for the API key create command
|
|
6
|
+
*/
|
|
7
|
+
export interface ApiKeyCreateInput {
|
|
8
|
+
/** The tenant id */
|
|
9
|
+
tenantId: string;
|
|
10
|
+
/** The name of the API key */
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create an API key
|
|
15
|
+
*/
|
|
16
|
+
export declare class ApiKeyCreateCommand extends GraphQlCommand<ApiKeyCreateInput, ApiKey & {
|
|
17
|
+
value: string;
|
|
18
|
+
}> {
|
|
19
|
+
/**
|
|
20
|
+
* The allowed modes for the command
|
|
21
|
+
*/
|
|
22
|
+
protected allowedModes: ("apiKey" | "bearer")[];
|
|
23
|
+
/**
|
|
24
|
+
* Parse the response
|
|
25
|
+
*/
|
|
26
|
+
protected parseResponse(rawResponse: unknown, flowcoreClient: FlowcoreClient): Promise<ApiKey & {
|
|
27
|
+
value: string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Get the body for the request
|
|
31
|
+
*/
|
|
32
|
+
protected getBody(): string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=api-key.create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key.create.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAIrE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;CACb;AA4BD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;IACpG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACsB,aAAa,CACpC,WAAW,EAAE,OAAO,EACpB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IA0BtC;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiKeyCreateCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
const api_key_list_js_1 = require("./api-key.list.js");
|
|
8
|
+
const command_error_js_1 = require("../../exceptions/command-error.js");
|
|
9
|
+
const graphQlQueryById = `
|
|
10
|
+
mutation FLOWCORE_SDK_API_KEY_CREATE($tenantId: ID!, $name: String!) {
|
|
11
|
+
organization(id: $tenantId) {
|
|
12
|
+
createApiKey(name: $name)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const responseSchema = typebox_1.Type.Object({
|
|
17
|
+
errors: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
18
|
+
message: typebox_1.Type.String(),
|
|
19
|
+
}))),
|
|
20
|
+
data: typebox_1.Type.Union([
|
|
21
|
+
typebox_1.Type.Object({
|
|
22
|
+
organization: typebox_1.Type.Object({
|
|
23
|
+
createApiKey: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
typebox_1.Type.Null(),
|
|
27
|
+
]),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Create an API key
|
|
31
|
+
*/
|
|
32
|
+
class ApiKeyCreateCommand extends command_js_1.GraphQlCommand {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
/**
|
|
36
|
+
* The allowed modes for the command
|
|
37
|
+
*/
|
|
38
|
+
Object.defineProperty(this, "allowedModes", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: ["bearer"]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse the response
|
|
47
|
+
*/
|
|
48
|
+
async parseResponse(rawResponse, flowcoreClient) {
|
|
49
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
|
|
50
|
+
if (response.errors) {
|
|
51
|
+
throw new command_error_js_1.CommandError(this.constructor.name, response.errors[0].message);
|
|
52
|
+
}
|
|
53
|
+
if (!response.data || response.data?.organization.createApiKey === null) {
|
|
54
|
+
throw new command_error_js_1.CommandError(this.constructor.name, "Failed to create API key");
|
|
55
|
+
}
|
|
56
|
+
const apiKeys = await flowcoreClient.execute(new api_key_list_js_1.ApiKeyListCommand({
|
|
57
|
+
tenantId: this.input.tenantId,
|
|
58
|
+
}));
|
|
59
|
+
const apiKey = apiKeys.find((apiKey) => apiKey.name === this.input.name);
|
|
60
|
+
if (!apiKey) {
|
|
61
|
+
throw new Error("API key not found");
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
...apiKey,
|
|
65
|
+
value: response.data.organization.createApiKey,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the body for the request
|
|
70
|
+
*/
|
|
71
|
+
getBody() {
|
|
72
|
+
return JSON.stringify({
|
|
73
|
+
query: graphQlQueryById,
|
|
74
|
+
variables: this.input,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ApiKeyCreateCommand = ApiKeyCreateCommand;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
2
|
+
/**
|
|
3
|
+
* The input for the API key delete command
|
|
4
|
+
*/
|
|
5
|
+
export interface ApiKeyDeleteInput {
|
|
6
|
+
/** The id of the tenant */
|
|
7
|
+
tenantId: string;
|
|
8
|
+
/** The id of the API key */
|
|
9
|
+
apiKeyId: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Delete an API key
|
|
13
|
+
*/
|
|
14
|
+
export declare class ApiKeyDeleteCommand extends GraphQlCommand<ApiKeyDeleteInput, boolean> {
|
|
15
|
+
/**
|
|
16
|
+
* The allowed modes for the command
|
|
17
|
+
*/
|
|
18
|
+
protected allowedModes: ("apiKey" | "bearer")[];
|
|
19
|
+
/**
|
|
20
|
+
* Parse the response
|
|
21
|
+
*/
|
|
22
|
+
protected parseResponse(rawResponse: unknown): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get the body for the request
|
|
25
|
+
*/
|
|
26
|
+
protected getBody(): string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=api-key.delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAyBD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiKeyDeleteCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
const command_error_js_1 = require("../../exceptions/command-error.js");
|
|
8
|
+
const graphQlQueryById = `
|
|
9
|
+
mutation FLOWCORE_SDK_API_KEY_DELETE($tenantId: ID!, $apiKeyId: ID!) {
|
|
10
|
+
organization(id: $tenantId) {
|
|
11
|
+
deleteApiKey(id: $apiKeyId)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
const responseSchema = typebox_1.Type.Object({
|
|
16
|
+
errors: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
17
|
+
message: typebox_1.Type.String(),
|
|
18
|
+
}))),
|
|
19
|
+
data: typebox_1.Type.Object({
|
|
20
|
+
organization: typebox_1.Type.Object({
|
|
21
|
+
deleteApiKey: typebox_1.Type.Union([typebox_1.Type.Boolean(), typebox_1.Type.Null()]),
|
|
22
|
+
}),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Delete an API key
|
|
27
|
+
*/
|
|
28
|
+
class ApiKeyDeleteCommand extends command_js_1.GraphQlCommand {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
/**
|
|
32
|
+
* The allowed modes for the command
|
|
33
|
+
*/
|
|
34
|
+
Object.defineProperty(this, "allowedModes", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: ["bearer"]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Parse the response
|
|
43
|
+
*/
|
|
44
|
+
parseResponse(rawResponse) {
|
|
45
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
|
|
46
|
+
if (response.errors) {
|
|
47
|
+
throw new command_error_js_1.CommandError(this.constructor.name, response.errors[0].message);
|
|
48
|
+
}
|
|
49
|
+
if (response.data.organization.deleteApiKey !== true) {
|
|
50
|
+
throw new command_error_js_1.CommandError(this.constructor.name, "Failed to delete API key");
|
|
51
|
+
}
|
|
52
|
+
return response.data.organization.deleteApiKey;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the body for the request
|
|
56
|
+
*/
|
|
57
|
+
getBody() {
|
|
58
|
+
return JSON.stringify({
|
|
59
|
+
query: graphQlQueryById,
|
|
60
|
+
variables: this.input,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.ApiKeyDeleteCommand = ApiKeyDeleteCommand;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
2
|
+
import type { ApiKey } from "../../contracts/api-key.js";
|
|
3
|
+
/**
|
|
4
|
+
* The input for the API key list command
|
|
5
|
+
*/
|
|
6
|
+
export interface ApiKeyListInput {
|
|
7
|
+
/** The tenant id */
|
|
8
|
+
tenantId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* List api keys
|
|
12
|
+
*/
|
|
13
|
+
export declare class ApiKeyListCommand extends GraphQlCommand<ApiKeyListInput, ApiKey[]> {
|
|
14
|
+
/**
|
|
15
|
+
* The allowed modes for the command
|
|
16
|
+
*/
|
|
17
|
+
protected allowedModes: ("apiKey" | "bearer")[];
|
|
18
|
+
/**
|
|
19
|
+
* Parse the response
|
|
20
|
+
*/
|
|
21
|
+
protected parseResponse(rawResponse: unknown): ApiKey[];
|
|
22
|
+
/**
|
|
23
|
+
* Get the body for the request
|
|
24
|
+
*/
|
|
25
|
+
protected getBody(): string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=api-key.list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key.list.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA0BD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC9E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE;IAKhE;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiKeyListCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
const graphQlQueryById = `
|
|
8
|
+
query FLOWCORE_SDK_API_KEY_LIST($tenantId: ID!) {
|
|
9
|
+
organization(search: {id: $tenantId}) {
|
|
10
|
+
apiKeys {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
createdAt
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
const responseSchema = typebox_1.Type.Object({
|
|
19
|
+
data: typebox_1.Type.Object({
|
|
20
|
+
organization: typebox_1.Type.Object({
|
|
21
|
+
apiKeys: typebox_1.Type.Array(typebox_1.Type.Object({
|
|
22
|
+
id: typebox_1.Type.String(),
|
|
23
|
+
name: typebox_1.Type.String(),
|
|
24
|
+
createdAt: typebox_1.Type.String(),
|
|
25
|
+
})),
|
|
26
|
+
}),
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* List api keys
|
|
31
|
+
*/
|
|
32
|
+
class ApiKeyListCommand extends command_js_1.GraphQlCommand {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
/**
|
|
36
|
+
* The allowed modes for the command
|
|
37
|
+
*/
|
|
38
|
+
Object.defineProperty(this, "allowedModes", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: ["bearer"]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Parse the response
|
|
47
|
+
*/
|
|
48
|
+
parseResponse(rawResponse) {
|
|
49
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
|
|
50
|
+
return response.data.organization.apiKeys;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the body for the request
|
|
54
|
+
*/
|
|
55
|
+
getBody() {
|
|
56
|
+
return JSON.stringify({
|
|
57
|
+
query: graphQlQueryById,
|
|
58
|
+
variables: this.input,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ApiKeyListCommand = ApiKeyListCommand;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
import { type DataCore } from "../../contracts/data-core.js";
|
|
3
|
+
/**
|
|
4
|
+
* The input for the data core create command
|
|
5
|
+
*/
|
|
6
|
+
export type DataCoreCreateInput = {
|
|
7
|
+
/** The tenant id */
|
|
8
|
+
tenantId: string;
|
|
9
|
+
/** The name of the data core */
|
|
10
|
+
name: string;
|
|
11
|
+
/** The description of the data core */
|
|
12
|
+
description: string;
|
|
13
|
+
/** The access control of the data core */
|
|
14
|
+
accessControl: "public" | "private";
|
|
15
|
+
/** Whether the data core is delete protected */
|
|
16
|
+
deleteProtected: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Create a data core
|
|
20
|
+
*/
|
|
21
|
+
export declare class DataCoreCreateCommand extends Command<DataCoreCreateInput, DataCore> {
|
|
22
|
+
/**
|
|
23
|
+
* Get the method
|
|
24
|
+
*/
|
|
25
|
+
protected getMethod(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get the base url
|
|
28
|
+
*/
|
|
29
|
+
protected getBaseUrl(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get the path
|
|
32
|
+
*/
|
|
33
|
+
protected getPath(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Parse the response
|
|
36
|
+
*/
|
|
37
|
+
protected parseResponse(rawResponse: unknown): DataCore;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=data-core.create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-core.create.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAA;IACnC,gDAAgD;IAChD,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataCoreCreateCommand = void 0;
|
|
4
|
+
const command_js_1 = require("../../common/command.js");
|
|
5
|
+
const data_core_js_1 = require("../../contracts/data-core.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
/**
|
|
8
|
+
* Create a data core
|
|
9
|
+
*/
|
|
10
|
+
class DataCoreCreateCommand extends command_js_1.Command {
|
|
11
|
+
/**
|
|
12
|
+
* Get the method
|
|
13
|
+
*/
|
|
14
|
+
getMethod() {
|
|
15
|
+
return "POST";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the base url
|
|
19
|
+
*/
|
|
20
|
+
getBaseUrl() {
|
|
21
|
+
return "https://data-core-2.api.flowcore.io";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the path
|
|
25
|
+
*/
|
|
26
|
+
getPath() {
|
|
27
|
+
return `/api/v1/data-cores`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Parse the response
|
|
31
|
+
*/
|
|
32
|
+
parseResponse(rawResponse) {
|
|
33
|
+
return (0, parse_response_helper_js_1.parseResponseHelper)(data_core_js_1.DataCoreSchema, rawResponse);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.DataCoreCreateCommand = DataCoreCreateCommand;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
2
|
+
import type { FlowcoreClient } from "../../common/flowcore-client.js";
|
|
3
|
+
/**
|
|
4
|
+
* The input for the data core delete request command
|
|
5
|
+
*/
|
|
6
|
+
export type DataCoreDeleteRequestInput = {
|
|
7
|
+
/** The id of the data core */
|
|
8
|
+
dataCoreId: string;
|
|
9
|
+
/** Wait for the data core to be deleted (default: true) */
|
|
10
|
+
waitForDelete?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Request to delete a data core
|
|
14
|
+
*/
|
|
15
|
+
export declare class DataCoreDeleteRequestCommand extends GraphQlCommand<DataCoreDeleteRequestInput, boolean> {
|
|
16
|
+
/**
|
|
17
|
+
* The allowed modes for the command
|
|
18
|
+
*/
|
|
19
|
+
protected allowedModes: ("apiKey" | "bearer")[];
|
|
20
|
+
/**
|
|
21
|
+
* Create a new data core delete request command
|
|
22
|
+
*/
|
|
23
|
+
constructor(input: DataCoreDeleteRequestInput);
|
|
24
|
+
/**
|
|
25
|
+
* Parse the response
|
|
26
|
+
*/
|
|
27
|
+
protected parseResponse(response: unknown): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Get the body for the request
|
|
30
|
+
*/
|
|
31
|
+
protected getBody(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Wait for the response (timeout: 25 seconds)
|
|
34
|
+
*/
|
|
35
|
+
protected waitForResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=data-core.delete-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-core.delete-request.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.delete-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAKxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AA4BD;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC;IACnG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;gBACS,KAAK,EAAE,0BAA0B;IAO7C;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAW5D;;OAEG;cACgB,OAAO,IAAI,MAAM;IAOpC;;OAEG;cACsB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataCoreDeleteRequestCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
const command_error_js_1 = require("../../exceptions/command-error.js");
|
|
8
|
+
const not_found_js_1 = require("../../exceptions/not-found.js");
|
|
9
|
+
const data_core_exists_js_1 = require("./data-core.exists.js");
|
|
10
|
+
const graphQlQuery = `
|
|
11
|
+
mutation FLOWCORE_SDK_DATA_CORE_DELETE_REQUEST($dataCoreId: ID!) {
|
|
12
|
+
datacore(id: $dataCoreId) {
|
|
13
|
+
requestDelete {
|
|
14
|
+
deleting
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
const responseSchema = typebox_1.Type.Object({
|
|
20
|
+
errors: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
|
|
21
|
+
message: typebox_1.Type.String(),
|
|
22
|
+
}))),
|
|
23
|
+
data: typebox_1.Type.Object({
|
|
24
|
+
datacore: typebox_1.Type.Object({
|
|
25
|
+
requestDelete: typebox_1.Type.Union([
|
|
26
|
+
typebox_1.Type.Object({
|
|
27
|
+
deleting: typebox_1.Type.Boolean(),
|
|
28
|
+
}),
|
|
29
|
+
typebox_1.Type.Null(),
|
|
30
|
+
]),
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Request to delete a data core
|
|
36
|
+
*/
|
|
37
|
+
class DataCoreDeleteRequestCommand extends command_js_1.GraphQlCommand {
|
|
38
|
+
/**
|
|
39
|
+
* Create a new data core delete request command
|
|
40
|
+
*/
|
|
41
|
+
constructor(input) {
|
|
42
|
+
super({
|
|
43
|
+
...input,
|
|
44
|
+
waitForDelete: input.waitForDelete ?? true,
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* The allowed modes for the command
|
|
48
|
+
*/
|
|
49
|
+
Object.defineProperty(this, "allowedModes", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: ["bearer"]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse the response
|
|
58
|
+
*/
|
|
59
|
+
parseResponse(response) {
|
|
60
|
+
const parsedResponse = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, response);
|
|
61
|
+
if (parsedResponse.errors) {
|
|
62
|
+
throw new command_error_js_1.CommandError(this.constructor.name, parsedResponse.errors[0].message);
|
|
63
|
+
}
|
|
64
|
+
if (!parsedResponse.data.datacore?.requestDelete) {
|
|
65
|
+
throw new not_found_js_1.NotFoundException("DataCore", this.input.dataCoreId);
|
|
66
|
+
}
|
|
67
|
+
return parsedResponse.data.datacore.requestDelete.deleting;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get the body for the request
|
|
71
|
+
*/
|
|
72
|
+
getBody() {
|
|
73
|
+
return JSON.stringify({
|
|
74
|
+
query: graphQlQuery,
|
|
75
|
+
variables: this.input,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Wait for the response (timeout: 25 seconds)
|
|
80
|
+
*/
|
|
81
|
+
async waitForResponse(client, response) {
|
|
82
|
+
if (!this.input.waitForDelete) {
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
const start = Date.now();
|
|
86
|
+
while (Date.now() - start < 25_000) {
|
|
87
|
+
const response = await client.execute(new data_core_exists_js_1.DataCoreExistsCommand({
|
|
88
|
+
dataCoreId: this.input.dataCoreId,
|
|
89
|
+
}));
|
|
90
|
+
if (!response.exists) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
94
|
+
}
|
|
95
|
+
return response;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.DataCoreDeleteRequestCommand = DataCoreDeleteRequestCommand;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
/**
|
|
3
|
+
* The input for the data core fetch by id command
|
|
4
|
+
*/
|
|
5
|
+
export interface DataCoreExistsInput {
|
|
6
|
+
/** The id of the data core */
|
|
7
|
+
dataCoreId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The output for the data core exists command
|
|
11
|
+
*/
|
|
12
|
+
export interface DataCoreExistsOutput {
|
|
13
|
+
/** Whether the data core exists */
|
|
14
|
+
exists: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Fetch a data core
|
|
18
|
+
*/
|
|
19
|
+
export declare class DataCoreExistsCommand extends Command<DataCoreExistsInput, DataCoreExistsOutput> {
|
|
20
|
+
/**
|
|
21
|
+
* Get the method
|
|
22
|
+
*/
|
|
23
|
+
protected getMethod(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get the base url
|
|
26
|
+
*/
|
|
27
|
+
protected getBaseUrl(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get the path
|
|
30
|
+
*/
|
|
31
|
+
protected getPath(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Parse the response
|
|
34
|
+
*/
|
|
35
|
+
protected parseResponse(rawResponse: unknown): DataCoreExistsOutput;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=data-core.exists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-core.exists.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.exists.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;IAC3F;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,oBAAoB;CAI7E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataCoreExistsCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
/**
|
|
8
|
+
* Fetch a data core
|
|
9
|
+
*/
|
|
10
|
+
class DataCoreExistsCommand extends command_js_1.Command {
|
|
11
|
+
/**
|
|
12
|
+
* Get the method
|
|
13
|
+
*/
|
|
14
|
+
getMethod() {
|
|
15
|
+
return "GET";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the base url
|
|
19
|
+
*/
|
|
20
|
+
getBaseUrl() {
|
|
21
|
+
return "https://data-core-2.api.flowcore.io";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the path
|
|
25
|
+
*/
|
|
26
|
+
getPath() {
|
|
27
|
+
return `/api/v1/data-cores/${this.input.dataCoreId}/exists`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Parse the response
|
|
31
|
+
*/
|
|
32
|
+
parseResponse(rawResponse) {
|
|
33
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Object({ exists: typebox_1.Type.Boolean() }), rawResponse);
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.DataCoreExistsCommand = DataCoreExistsCommand;
|