@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
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Flowcore SDK
|
|
2
|
+
|
|
3
|
+
This is the Flowcore SDK, a TypeScript library for interacting with the Flowcore API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# npm / yarn
|
|
9
|
+
npx jsr add @flowcore/sdk
|
|
10
|
+
|
|
11
|
+
# Deno
|
|
12
|
+
deno add jsr:@flowcore/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Execute a command
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { DataCoreFetchByNameCommand, FlowcoreClient } from "@flowcore/sdk"
|
|
21
|
+
// With a bearer token
|
|
22
|
+
const client = new FlowcoreClient({
|
|
23
|
+
getBearerToken: async (): Promise<string> => {
|
|
24
|
+
const token = await someMethodToGetToken()
|
|
25
|
+
return token
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// With an api key
|
|
30
|
+
const client = new FlowcoreClient({
|
|
31
|
+
apiKeyId: "my-api-key-id",
|
|
32
|
+
apiKey: "my-api-key",
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Execute a command
|
|
36
|
+
const command = new DataCoreFetchCommand({
|
|
37
|
+
dataCoreId: "my-data-core-id",
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const result = await client.execute(command)
|
|
41
|
+
```
|
|
@@ -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,74 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
import { ApiKeyListCommand } from "./api-key.list.js";
|
|
5
|
+
import { CommandError } from "../../exceptions/command-error.js";
|
|
6
|
+
const graphQlQueryById = `
|
|
7
|
+
mutation FLOWCORE_SDK_API_KEY_CREATE($tenantId: ID!, $name: String!) {
|
|
8
|
+
organization(id: $tenantId) {
|
|
9
|
+
createApiKey(name: $name)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
const responseSchema = Type.Object({
|
|
14
|
+
errors: Type.Optional(Type.Array(Type.Object({
|
|
15
|
+
message: Type.String(),
|
|
16
|
+
}))),
|
|
17
|
+
data: Type.Union([
|
|
18
|
+
Type.Object({
|
|
19
|
+
organization: Type.Object({
|
|
20
|
+
createApiKey: Type.Union([Type.String(), Type.Null()]),
|
|
21
|
+
}),
|
|
22
|
+
}),
|
|
23
|
+
Type.Null(),
|
|
24
|
+
]),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Create an API key
|
|
28
|
+
*/
|
|
29
|
+
export class ApiKeyCreateCommand extends GraphQlCommand {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
/**
|
|
33
|
+
* The allowed modes for the command
|
|
34
|
+
*/
|
|
35
|
+
Object.defineProperty(this, "allowedModes", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: ["bearer"]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parse the response
|
|
44
|
+
*/
|
|
45
|
+
async parseResponse(rawResponse, flowcoreClient) {
|
|
46
|
+
const response = parseResponseHelper(responseSchema, rawResponse);
|
|
47
|
+
if (response.errors) {
|
|
48
|
+
throw new CommandError(this.constructor.name, response.errors[0].message);
|
|
49
|
+
}
|
|
50
|
+
if (!response.data || response.data?.organization.createApiKey === null) {
|
|
51
|
+
throw new CommandError(this.constructor.name, "Failed to create API key");
|
|
52
|
+
}
|
|
53
|
+
const apiKeys = await flowcoreClient.execute(new ApiKeyListCommand({
|
|
54
|
+
tenantId: this.input.tenantId,
|
|
55
|
+
}));
|
|
56
|
+
const apiKey = apiKeys.find((apiKey) => apiKey.name === this.input.name);
|
|
57
|
+
if (!apiKey) {
|
|
58
|
+
throw new Error("API key not found");
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...apiKey,
|
|
62
|
+
value: response.data.organization.createApiKey,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the body for the request
|
|
67
|
+
*/
|
|
68
|
+
getBody() {
|
|
69
|
+
return JSON.stringify({
|
|
70
|
+
query: graphQlQueryById,
|
|
71
|
+
variables: this.input,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -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,60 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
import { CommandError } from "../../exceptions/command-error.js";
|
|
5
|
+
const graphQlQueryById = `
|
|
6
|
+
mutation FLOWCORE_SDK_API_KEY_DELETE($tenantId: ID!, $apiKeyId: ID!) {
|
|
7
|
+
organization(id: $tenantId) {
|
|
8
|
+
deleteApiKey(id: $apiKeyId)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
const responseSchema = Type.Object({
|
|
13
|
+
errors: Type.Optional(Type.Array(Type.Object({
|
|
14
|
+
message: Type.String(),
|
|
15
|
+
}))),
|
|
16
|
+
data: Type.Object({
|
|
17
|
+
organization: Type.Object({
|
|
18
|
+
deleteApiKey: Type.Union([Type.Boolean(), Type.Null()]),
|
|
19
|
+
}),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Delete an API key
|
|
24
|
+
*/
|
|
25
|
+
export class ApiKeyDeleteCommand extends GraphQlCommand {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
/**
|
|
29
|
+
* The allowed modes for the command
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(this, "allowedModes", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: ["bearer"]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse the response
|
|
40
|
+
*/
|
|
41
|
+
parseResponse(rawResponse) {
|
|
42
|
+
const response = parseResponseHelper(responseSchema, rawResponse);
|
|
43
|
+
if (response.errors) {
|
|
44
|
+
throw new CommandError(this.constructor.name, response.errors[0].message);
|
|
45
|
+
}
|
|
46
|
+
if (response.data.organization.deleteApiKey !== true) {
|
|
47
|
+
throw new CommandError(this.constructor.name, "Failed to delete API key");
|
|
48
|
+
}
|
|
49
|
+
return response.data.organization.deleteApiKey;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the body for the request
|
|
53
|
+
*/
|
|
54
|
+
getBody() {
|
|
55
|
+
return JSON.stringify({
|
|
56
|
+
query: graphQlQueryById,
|
|
57
|
+
variables: this.input,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -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,58 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
const graphQlQueryById = `
|
|
5
|
+
query FLOWCORE_SDK_API_KEY_LIST($tenantId: ID!) {
|
|
6
|
+
organization(search: {id: $tenantId}) {
|
|
7
|
+
apiKeys {
|
|
8
|
+
id
|
|
9
|
+
name
|
|
10
|
+
createdAt
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
const responseSchema = Type.Object({
|
|
16
|
+
data: Type.Object({
|
|
17
|
+
organization: Type.Object({
|
|
18
|
+
apiKeys: Type.Array(Type.Object({
|
|
19
|
+
id: Type.String(),
|
|
20
|
+
name: Type.String(),
|
|
21
|
+
createdAt: Type.String(),
|
|
22
|
+
})),
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* List api keys
|
|
28
|
+
*/
|
|
29
|
+
export class ApiKeyListCommand extends GraphQlCommand {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
/**
|
|
33
|
+
* The allowed modes for the command
|
|
34
|
+
*/
|
|
35
|
+
Object.defineProperty(this, "allowedModes", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: ["bearer"]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parse the response
|
|
44
|
+
*/
|
|
45
|
+
parseResponse(rawResponse) {
|
|
46
|
+
const response = parseResponseHelper(responseSchema, rawResponse);
|
|
47
|
+
return response.data.organization.apiKeys;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the body for the request
|
|
51
|
+
*/
|
|
52
|
+
getBody() {
|
|
53
|
+
return JSON.stringify({
|
|
54
|
+
query: graphQlQueryById,
|
|
55
|
+
variables: this.input,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -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,32 @@
|
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
import { DataCoreSchema } from "../../contracts/data-core.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create a data core
|
|
6
|
+
*/
|
|
7
|
+
export class DataCoreCreateCommand extends Command {
|
|
8
|
+
/**
|
|
9
|
+
* Get the method
|
|
10
|
+
*/
|
|
11
|
+
getMethod() {
|
|
12
|
+
return "POST";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the base url
|
|
16
|
+
*/
|
|
17
|
+
getBaseUrl() {
|
|
18
|
+
return "https://data-core-2.api.flowcore.io";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the path
|
|
22
|
+
*/
|
|
23
|
+
getPath() {
|
|
24
|
+
return `/api/v1/data-cores`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse the response
|
|
28
|
+
*/
|
|
29
|
+
parseResponse(rawResponse) {
|
|
30
|
+
return parseResponseHelper(DataCoreSchema, rawResponse);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -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,94 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { GraphQlCommand } from "../../common/command.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
import { CommandError } from "../../exceptions/command-error.js";
|
|
5
|
+
import { NotFoundException } from "../../exceptions/not-found.js";
|
|
6
|
+
import { DataCoreExistsCommand } from "./data-core.exists.js";
|
|
7
|
+
const graphQlQuery = `
|
|
8
|
+
mutation FLOWCORE_SDK_DATA_CORE_DELETE_REQUEST($dataCoreId: ID!) {
|
|
9
|
+
datacore(id: $dataCoreId) {
|
|
10
|
+
requestDelete {
|
|
11
|
+
deleting
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const responseSchema = Type.Object({
|
|
17
|
+
errors: Type.Optional(Type.Array(Type.Object({
|
|
18
|
+
message: Type.String(),
|
|
19
|
+
}))),
|
|
20
|
+
data: Type.Object({
|
|
21
|
+
datacore: Type.Object({
|
|
22
|
+
requestDelete: Type.Union([
|
|
23
|
+
Type.Object({
|
|
24
|
+
deleting: Type.Boolean(),
|
|
25
|
+
}),
|
|
26
|
+
Type.Null(),
|
|
27
|
+
]),
|
|
28
|
+
}),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Request to delete a data core
|
|
33
|
+
*/
|
|
34
|
+
export class DataCoreDeleteRequestCommand extends GraphQlCommand {
|
|
35
|
+
/**
|
|
36
|
+
* Create a new data core delete request command
|
|
37
|
+
*/
|
|
38
|
+
constructor(input) {
|
|
39
|
+
super({
|
|
40
|
+
...input,
|
|
41
|
+
waitForDelete: input.waitForDelete ?? true,
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* The allowed modes for the command
|
|
45
|
+
*/
|
|
46
|
+
Object.defineProperty(this, "allowedModes", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: ["bearer"]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parse the response
|
|
55
|
+
*/
|
|
56
|
+
parseResponse(response) {
|
|
57
|
+
const parsedResponse = parseResponseHelper(responseSchema, response);
|
|
58
|
+
if (parsedResponse.errors) {
|
|
59
|
+
throw new CommandError(this.constructor.name, parsedResponse.errors[0].message);
|
|
60
|
+
}
|
|
61
|
+
if (!parsedResponse.data.datacore?.requestDelete) {
|
|
62
|
+
throw new NotFoundException("DataCore", this.input.dataCoreId);
|
|
63
|
+
}
|
|
64
|
+
return parsedResponse.data.datacore.requestDelete.deleting;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the body for the request
|
|
68
|
+
*/
|
|
69
|
+
getBody() {
|
|
70
|
+
return JSON.stringify({
|
|
71
|
+
query: graphQlQuery,
|
|
72
|
+
variables: this.input,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Wait for the response (timeout: 25 seconds)
|
|
77
|
+
*/
|
|
78
|
+
async waitForResponse(client, response) {
|
|
79
|
+
if (!this.input.waitForDelete) {
|
|
80
|
+
return response;
|
|
81
|
+
}
|
|
82
|
+
const start = Date.now();
|
|
83
|
+
while (Date.now() - start < 25_000) {
|
|
84
|
+
const response = await client.execute(new DataCoreExistsCommand({
|
|
85
|
+
dataCoreId: this.input.dataCoreId,
|
|
86
|
+
}));
|
|
87
|
+
if (!response.exists) {
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
91
|
+
}
|
|
92
|
+
return response;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { Command } from "../../common/command.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
/**
|
|
5
|
+
* Fetch a data core
|
|
6
|
+
*/
|
|
7
|
+
export class DataCoreExistsCommand extends Command {
|
|
8
|
+
/**
|
|
9
|
+
* Get the method
|
|
10
|
+
*/
|
|
11
|
+
getMethod() {
|
|
12
|
+
return "GET";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the base url
|
|
16
|
+
*/
|
|
17
|
+
getBaseUrl() {
|
|
18
|
+
return "https://data-core-2.api.flowcore.io";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the path
|
|
22
|
+
*/
|
|
23
|
+
getPath() {
|
|
24
|
+
return `/api/v1/data-cores/${this.input.dataCoreId}/exists`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse the response
|
|
28
|
+
*/
|
|
29
|
+
parseResponse(rawResponse) {
|
|
30
|
+
const response = parseResponseHelper(Type.Object({ exists: Type.Boolean() }), rawResponse);
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
import { type DataCore } from "../../contracts/data-core.js";
|
|
3
|
+
/**
|
|
4
|
+
* The input for the data core fetch by id command
|
|
5
|
+
*/
|
|
6
|
+
type DataCoreFetchByIdInput = {
|
|
7
|
+
/** The id of the data core */
|
|
8
|
+
dataCoreId: string;
|
|
9
|
+
/** The name of the data core */
|
|
10
|
+
dataCore?: never;
|
|
11
|
+
/** The tenant id */
|
|
12
|
+
tenantId?: never;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The input for the data core fetch by name command
|
|
16
|
+
*/
|
|
17
|
+
interface DataCoreFetchByNameInput {
|
|
18
|
+
/** The tenant id */
|
|
19
|
+
tenantId: string;
|
|
20
|
+
/** The name of the data core */
|
|
21
|
+
dataCore: string;
|
|
22
|
+
/** The id of the data core */
|
|
23
|
+
dataCoreId?: never;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The input for the data core fetch command
|
|
27
|
+
*/
|
|
28
|
+
export type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameInput;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch a data core
|
|
31
|
+
*/
|
|
32
|
+
export declare class DataCoreFetchCommand extends Command<DataCoreFetchInput, DataCore> {
|
|
33
|
+
/**
|
|
34
|
+
* Get the method
|
|
35
|
+
*/
|
|
36
|
+
protected getMethod(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get the base url
|
|
39
|
+
*/
|
|
40
|
+
protected getBaseUrl(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Get the path
|
|
43
|
+
*/
|
|
44
|
+
protected getPath(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Parse the response
|
|
47
|
+
*/
|
|
48
|
+
protected parseResponse(rawResponse: unknown): DataCore;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=data-core.fetch.d.ts.map
|