@flowcore/sdk 1.22.1 → 1.23.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/CHANGELOG.md +15 -0
- package/esm/commands/data-core/data-core.list.d.ts +5 -3
- package/esm/commands/data-core/data-core.list.d.ts.map +1 -1
- package/esm/commands/data-core/data-core.list.js +9 -2
- package/esm/commands/index.d.ts +0 -5
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +0 -5
- package/package.json +1 -1
- package/script/commands/data-core/data-core.list.d.ts +5 -3
- package/script/commands/data-core/data-core.list.d.ts.map +1 -1
- package/script/commands/data-core/data-core.list.js +8 -1
- package/script/commands/index.d.ts +0 -5
- package/script/commands/index.d.ts.map +1 -1
- package/script/commands/index.js +0 -5
- package/esm/commands/data-core/data-core.delete-request.d.ts +0 -38
- package/esm/commands/data-core/data-core.delete-request.d.ts.map +0 -1
- package/esm/commands/data-core/data-core.delete-request.js +0 -95
- package/esm/commands/data-core/data-core.list-new.d.ts +0 -35
- package/esm/commands/data-core/data-core.list-new.d.ts.map +0 -1
- package/esm/commands/data-core/data-core.list-new.js +0 -47
- package/esm/commands/event-type/event-type.delete-request.d.ts +0 -42
- package/esm/commands/event-type/event-type.delete-request.d.ts.map +0 -1
- package/esm/commands/event-type/event-type.delete-request.js +0 -108
- package/esm/commands/event-type/event-type.truncate-request.d.ts +0 -42
- package/esm/commands/event-type/event-type.truncate-request.d.ts.map +0 -1
- package/esm/commands/event-type/event-type.truncate-request.js +0 -108
- package/esm/commands/flow-type/flow-type.delete-request.d.ts +0 -55
- package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +0 -1
- package/esm/commands/flow-type/flow-type.delete-request.js +0 -128
- package/script/commands/data-core/data-core.delete-request.d.ts +0 -38
- package/script/commands/data-core/data-core.delete-request.d.ts.map +0 -1
- package/script/commands/data-core/data-core.delete-request.js +0 -99
- package/script/commands/data-core/data-core.list-new.d.ts +0 -35
- package/script/commands/data-core/data-core.list-new.d.ts.map +0 -1
- package/script/commands/data-core/data-core.list-new.js +0 -51
- package/script/commands/event-type/event-type.delete-request.d.ts +0 -42
- package/script/commands/event-type/event-type.delete-request.d.ts.map +0 -1
- package/script/commands/event-type/event-type.delete-request.js +0 -112
- package/script/commands/event-type/event-type.truncate-request.d.ts +0 -42
- package/script/commands/event-type/event-type.truncate-request.d.ts.map +0 -1
- package/script/commands/event-type/event-type.truncate-request.js +0 -112
- package/script/commands/flow-type/flow-type.delete-request.d.ts +0 -55
- package/script/commands/flow-type/flow-type.delete-request.d.ts.map +0 -1
- package/script/commands/flow-type/flow-type.delete-request.js +0 -132
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
3
|
-
import { CommandError } from "../../exceptions/command-error.js";
|
|
4
|
-
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
5
|
-
import { NotFoundException } from "../../exceptions/not-found.js";
|
|
6
|
-
import { EventTypeExistsCommand } from "./event-type.exists.js";
|
|
7
|
-
const graphQlQuery = `
|
|
8
|
-
mutation FLOWCORE_SDK_EVENT_TYPE_DELETE_REQUEST($eventTypeId: ID!) {
|
|
9
|
-
eventType(id: $eventTypeId) {
|
|
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.Union([
|
|
21
|
-
Type.Object({
|
|
22
|
-
eventType: Type.Object({
|
|
23
|
-
requestDelete: Type.Union([
|
|
24
|
-
Type.Object({
|
|
25
|
-
deleting: Type.Boolean(),
|
|
26
|
-
}),
|
|
27
|
-
Type.Null(),
|
|
28
|
-
]),
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
Type.Null(),
|
|
32
|
-
]),
|
|
33
|
-
});
|
|
34
|
-
/**
|
|
35
|
-
* Request to delete a event type
|
|
36
|
-
* @deprecated Use `EventTypeRequestDeleteCommand` instead
|
|
37
|
-
*/
|
|
38
|
-
export class EventTypeDeleteRequestCommand extends GraphQlCommand {
|
|
39
|
-
/**
|
|
40
|
-
* Create a new event type delete request command
|
|
41
|
-
*/
|
|
42
|
-
constructor(input) {
|
|
43
|
-
super({
|
|
44
|
-
...input,
|
|
45
|
-
waitForDelete: input.waitForDelete ?? true,
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* Whether the command should retry on failure
|
|
49
|
-
*/
|
|
50
|
-
Object.defineProperty(this, "retryOnFailure", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: false
|
|
55
|
-
});
|
|
56
|
-
/**
|
|
57
|
-
* The allowed modes for the command
|
|
58
|
-
*/
|
|
59
|
-
Object.defineProperty(this, "allowedModes", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: ["bearer"]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Parse the response
|
|
68
|
-
*/
|
|
69
|
-
parseResponse(response) {
|
|
70
|
-
const parsedResponse = parseResponseHelper(responseSchema, response);
|
|
71
|
-
if (parsedResponse.errors) {
|
|
72
|
-
throw new CommandError(this.constructor.name, parsedResponse.errors[0].message);
|
|
73
|
-
}
|
|
74
|
-
if (!parsedResponse.data?.eventType?.requestDelete) {
|
|
75
|
-
throw new NotFoundException("EventType", { id: this.input.eventTypeId });
|
|
76
|
-
}
|
|
77
|
-
return parsedResponse.data.eventType.requestDelete.deleting;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get the body for the request
|
|
81
|
-
*/
|
|
82
|
-
getBody() {
|
|
83
|
-
const { waitForDelete: _, ...rest } = this.input;
|
|
84
|
-
return {
|
|
85
|
-
query: graphQlQuery,
|
|
86
|
-
variables: rest,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Wait for the response (timeout: 25 seconds)
|
|
91
|
-
*/
|
|
92
|
-
async processResponse(client, response) {
|
|
93
|
-
if (!this.input.waitForDelete) {
|
|
94
|
-
return response;
|
|
95
|
-
}
|
|
96
|
-
const start = Date.now();
|
|
97
|
-
while (Date.now() - start < 25_000) {
|
|
98
|
-
const response = await client.execute(new EventTypeExistsCommand({
|
|
99
|
-
eventTypeId: this.input.eventTypeId,
|
|
100
|
-
}));
|
|
101
|
-
if (!response.exists) {
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
105
|
-
}
|
|
106
|
-
return response;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
2
|
-
import type { FlowcoreClient } from "../../common/flowcore-client.js";
|
|
3
|
-
/**
|
|
4
|
-
* The input for the event type truncate request command
|
|
5
|
-
*/
|
|
6
|
-
export interface EventTypeTruncateRequestInput {
|
|
7
|
-
/** The id of the event type */
|
|
8
|
-
eventTypeId: string;
|
|
9
|
-
/** Wait for the event type to be truncated (default: true) */
|
|
10
|
-
waitForTruncate?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Request to truncate a event type
|
|
14
|
-
* @deprecated Use `EventTypeRequestTruncateCommand` instead
|
|
15
|
-
*/
|
|
16
|
-
export declare class EventTypeTruncateRequestCommand extends GraphQlCommand<EventTypeTruncateRequestInput, boolean> {
|
|
17
|
-
/**
|
|
18
|
-
* Whether the command should retry on failure
|
|
19
|
-
*/
|
|
20
|
-
protected retryOnFailure: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The allowed modes for the command
|
|
23
|
-
*/
|
|
24
|
-
protected allowedModes: ("apiKey" | "bearer")[];
|
|
25
|
-
/**
|
|
26
|
-
* Create a new event type truncate request command
|
|
27
|
-
*/
|
|
28
|
-
constructor(input: EventTypeTruncateRequestInput);
|
|
29
|
-
/**
|
|
30
|
-
* Parse the response
|
|
31
|
-
*/
|
|
32
|
-
protected parseResponse(response: unknown): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Get the body for the request
|
|
35
|
-
*/
|
|
36
|
-
protected getBody(): Record<string, unknown>;
|
|
37
|
-
/**
|
|
38
|
-
* Wait for the response (timeout: 25 seconds)
|
|
39
|
-
*/
|
|
40
|
-
protected processResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=event-type.truncate-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-type.truncate-request.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.truncate-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAIhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAGrE;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IAEnB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AA+BD;;;GAGG;AACH,qBAAa,+BAAgC,SAAQ,cAAc,CAAC,6BAA6B,EAAE,OAAO,CAAC;IACzG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;gBACS,KAAK,EAAE,6BAA6B;IAOhD;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAW5D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrD;;OAEG;cACsB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
3
|
-
import { CommandError } from "../../exceptions/command-error.js";
|
|
4
|
-
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
5
|
-
import { NotFoundException } from "../../exceptions/not-found.js";
|
|
6
|
-
import { EventTypeFetchCommand } from "./event-type.fetch.js";
|
|
7
|
-
const graphQlQuery = `
|
|
8
|
-
mutation FLOWCORE_SDK_EVENT_TYPE_TRUNCATE_REQUEST($eventTypeId: ID!) {
|
|
9
|
-
eventType(id: $eventTypeId) {
|
|
10
|
-
requestTruncate {
|
|
11
|
-
truncating
|
|
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.Union([
|
|
21
|
-
Type.Object({
|
|
22
|
-
eventType: Type.Object({
|
|
23
|
-
requestTruncate: Type.Union([
|
|
24
|
-
Type.Object({
|
|
25
|
-
truncating: Type.Boolean(),
|
|
26
|
-
}),
|
|
27
|
-
Type.Null(),
|
|
28
|
-
]),
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
Type.Null(),
|
|
32
|
-
]),
|
|
33
|
-
});
|
|
34
|
-
/**
|
|
35
|
-
* Request to truncate a event type
|
|
36
|
-
* @deprecated Use `EventTypeRequestTruncateCommand` instead
|
|
37
|
-
*/
|
|
38
|
-
export class EventTypeTruncateRequestCommand extends GraphQlCommand {
|
|
39
|
-
/**
|
|
40
|
-
* Create a new event type truncate request command
|
|
41
|
-
*/
|
|
42
|
-
constructor(input) {
|
|
43
|
-
super({
|
|
44
|
-
...input,
|
|
45
|
-
waitForTruncate: input.waitForTruncate ?? true,
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* Whether the command should retry on failure
|
|
49
|
-
*/
|
|
50
|
-
Object.defineProperty(this, "retryOnFailure", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: false
|
|
55
|
-
});
|
|
56
|
-
/**
|
|
57
|
-
* The allowed modes for the command
|
|
58
|
-
*/
|
|
59
|
-
Object.defineProperty(this, "allowedModes", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: ["bearer"]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Parse the response
|
|
68
|
-
*/
|
|
69
|
-
parseResponse(response) {
|
|
70
|
-
const parsedResponse = parseResponseHelper(responseSchema, response);
|
|
71
|
-
if (parsedResponse.errors) {
|
|
72
|
-
throw new CommandError(this.constructor.name, parsedResponse.errors[0].message);
|
|
73
|
-
}
|
|
74
|
-
if (!parsedResponse.data?.eventType?.requestTruncate) {
|
|
75
|
-
throw new NotFoundException("EventType", { id: this.input.eventTypeId });
|
|
76
|
-
}
|
|
77
|
-
return parsedResponse.data.eventType.requestTruncate.truncating;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get the body for the request
|
|
81
|
-
*/
|
|
82
|
-
getBody() {
|
|
83
|
-
const { waitForTruncate: _, ...rest } = this.input;
|
|
84
|
-
return {
|
|
85
|
-
query: graphQlQuery,
|
|
86
|
-
variables: rest,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Wait for the response (timeout: 25 seconds)
|
|
91
|
-
*/
|
|
92
|
-
async processResponse(client, response) {
|
|
93
|
-
if (!this.input.waitForTruncate) {
|
|
94
|
-
return response;
|
|
95
|
-
}
|
|
96
|
-
const start = Date.now();
|
|
97
|
-
while (Date.now() - start < 25_000) {
|
|
98
|
-
const response = await client.execute(new EventTypeFetchCommand({
|
|
99
|
-
eventTypeId: this.input.eventTypeId,
|
|
100
|
-
}));
|
|
101
|
-
if (response.isTruncating) {
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
105
|
-
}
|
|
106
|
-
return response;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
2
|
-
import type { FlowcoreClient } from "../../common/flowcore-client.js";
|
|
3
|
-
import type { ClientError } from "../../exceptions/client-error.js";
|
|
4
|
-
/**
|
|
5
|
-
* The input for the flow type delete request command
|
|
6
|
-
*/
|
|
7
|
-
export interface FlowTypeDeleteRequestInput {
|
|
8
|
-
/** The id of the flow type */
|
|
9
|
-
flowTypeId: string;
|
|
10
|
-
/** Whether to wait for the flow type to be deleted */
|
|
11
|
-
waitForDelete?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Request to delete a flow type
|
|
15
|
-
* @deprecated Use `FlowTypeRequestDeleteCommand` instead
|
|
16
|
-
*/
|
|
17
|
-
export declare class FlowTypeDeleteRequestCommand extends GraphQlCommand<FlowTypeDeleteRequestInput, boolean> {
|
|
18
|
-
/**
|
|
19
|
-
* Whether the command should retry on failure
|
|
20
|
-
*/
|
|
21
|
-
protected retryOnFailure: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* The allowed modes for the command
|
|
24
|
-
*/
|
|
25
|
-
protected allowedModes: ("apiKey" | "bearer")[];
|
|
26
|
-
/**
|
|
27
|
-
* Create a new flow type delete request command
|
|
28
|
-
*/
|
|
29
|
-
constructor(input: FlowTypeDeleteRequestInput);
|
|
30
|
-
/**
|
|
31
|
-
* Parse the response
|
|
32
|
-
*/
|
|
33
|
-
protected parseResponse(response: unknown): boolean;
|
|
34
|
-
getRequest(client: FlowcoreClient): Promise<{
|
|
35
|
-
allowedModes: ("apiKey" | "bearer")[];
|
|
36
|
-
body: Record<string, unknown>;
|
|
37
|
-
headers: Record<string, string>;
|
|
38
|
-
baseUrl: string;
|
|
39
|
-
path: string;
|
|
40
|
-
method: string;
|
|
41
|
-
parseResponse: (response: unknown) => boolean | Promise<boolean>;
|
|
42
|
-
processResponse: (client: FlowcoreClient, response: boolean) => Promise<boolean>;
|
|
43
|
-
handleClientError: (error: ClientError) => void;
|
|
44
|
-
retryOnFailure: boolean;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* Get the body for the request
|
|
48
|
-
*/
|
|
49
|
-
protected getBody(): Record<string, unknown>;
|
|
50
|
-
/**
|
|
51
|
-
* Wait for the response (timeout: 25 seconds)
|
|
52
|
-
*/
|
|
53
|
-
protected processResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=flow-type.delete-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flow-type.delete-request.d.ts","sourceRoot":"","sources":["../../../src/commands/flow-type/flow-type.delete-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAMrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAEnE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAmCD;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC;IACnG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;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;IAWtC,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAC/D;QACE,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAA;QACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC/B,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,aAAa,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;QAChE,eAAe,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;QAChF,iBAAiB,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;QAC/C,cAAc,EAAE,OAAO,CAAA;KACxB,CACF;IAqBD;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOrD;;OAEG;cACsB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
3
|
-
import { FlowTypeFetchCommand } from "./flow-type.fetch.js";
|
|
4
|
-
import { CommandError } from "../../exceptions/command-error.js";
|
|
5
|
-
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
6
|
-
import { NotFoundException } from "../../exceptions/not-found.js";
|
|
7
|
-
import { FlowTypeExistsCommand } from "./flow-type.exists.js";
|
|
8
|
-
const graphQlQuery = `
|
|
9
|
-
mutation FLOWCORE_SDK_FLOW_TYPE_DELETE_REQUEST($flowTypeId: ID!, $dataCoreId: ID!) {
|
|
10
|
-
datacore(id: $dataCoreId) {
|
|
11
|
-
flowtype(id: $flowTypeId) {
|
|
12
|
-
requestDelete {
|
|
13
|
-
deleting
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
const responseSchema = Type.Object({
|
|
20
|
-
errors: Type.Optional(Type.Array(Type.Object({
|
|
21
|
-
message: Type.String(),
|
|
22
|
-
}))),
|
|
23
|
-
data: Type.Union([
|
|
24
|
-
Type.Object({
|
|
25
|
-
datacore: Type.Object({
|
|
26
|
-
flowtype: Type.Object({
|
|
27
|
-
requestDelete: Type.Union([
|
|
28
|
-
Type.Object({
|
|
29
|
-
deleting: Type.Boolean(),
|
|
30
|
-
}),
|
|
31
|
-
Type.Null(),
|
|
32
|
-
]),
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
Type.Null(),
|
|
37
|
-
]),
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Request to delete a flow type
|
|
41
|
-
* @deprecated Use `FlowTypeRequestDeleteCommand` instead
|
|
42
|
-
*/
|
|
43
|
-
export class FlowTypeDeleteRequestCommand extends GraphQlCommand {
|
|
44
|
-
/**
|
|
45
|
-
* Create a new flow type delete request command
|
|
46
|
-
*/
|
|
47
|
-
constructor(input) {
|
|
48
|
-
super({
|
|
49
|
-
...input,
|
|
50
|
-
waitForDelete: input.waitForDelete ?? true,
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Whether the command should retry on failure
|
|
54
|
-
*/
|
|
55
|
-
Object.defineProperty(this, "retryOnFailure", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: false
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* The allowed modes for the command
|
|
63
|
-
*/
|
|
64
|
-
Object.defineProperty(this, "allowedModes", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
writable: true,
|
|
68
|
-
value: ["bearer"]
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Parse the response
|
|
73
|
-
*/
|
|
74
|
-
parseResponse(response) {
|
|
75
|
-
const parsedResponse = parseResponseHelper(responseSchema, response);
|
|
76
|
-
if (parsedResponse.errors) {
|
|
77
|
-
throw new CommandError(this.constructor.name, parsedResponse.errors[0].message);
|
|
78
|
-
}
|
|
79
|
-
if (!parsedResponse.data?.datacore?.flowtype?.requestDelete) {
|
|
80
|
-
throw new NotFoundException("FlowType", { id: this.input.flowTypeId });
|
|
81
|
-
}
|
|
82
|
-
return parsedResponse.data.datacore.flowtype.requestDelete.deleting;
|
|
83
|
-
}
|
|
84
|
-
async getRequest(client) {
|
|
85
|
-
const request = await super.getRequest(client);
|
|
86
|
-
const response = await client.execute(new FlowTypeFetchCommand({
|
|
87
|
-
flowTypeId: this.input.flowTypeId,
|
|
88
|
-
}));
|
|
89
|
-
return {
|
|
90
|
-
...request,
|
|
91
|
-
body: {
|
|
92
|
-
query: graphQlQuery,
|
|
93
|
-
variables: {
|
|
94
|
-
flowTypeId: this.input.flowTypeId,
|
|
95
|
-
dataCoreId: response.dataCoreId,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get the body for the request
|
|
102
|
-
*/
|
|
103
|
-
getBody() {
|
|
104
|
-
return {
|
|
105
|
-
query: graphQlQuery,
|
|
106
|
-
variables: this.input,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Wait for the response (timeout: 25 seconds)
|
|
111
|
-
*/
|
|
112
|
-
async processResponse(client, response) {
|
|
113
|
-
if (!this.input.waitForDelete) {
|
|
114
|
-
return response;
|
|
115
|
-
}
|
|
116
|
-
const start = Date.now();
|
|
117
|
-
while (Date.now() - start < 25_000) {
|
|
118
|
-
const response = await client.execute(new FlowTypeExistsCommand({
|
|
119
|
-
flowTypeId: this.input.flowTypeId,
|
|
120
|
-
}));
|
|
121
|
-
if (!response.exists) {
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
125
|
-
}
|
|
126
|
-
return response;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
2
|
-
import type { FlowcoreClient } from "../../common/flowcore-client.js";
|
|
3
|
-
/**
|
|
4
|
-
* The input for the data core delete request command
|
|
5
|
-
*/
|
|
6
|
-
export interface 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
|
-
* @deprecated Use `DataCoreRequestDeleteCommand` instead
|
|
15
|
-
*/
|
|
16
|
-
export declare class DataCoreDeleteRequestCommand extends GraphQlCommand<DataCoreDeleteRequestInput, boolean> {
|
|
17
|
-
/**
|
|
18
|
-
* Whether the command should retry on failure
|
|
19
|
-
*/
|
|
20
|
-
protected retryOnFailure: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Create a new data core delete request command
|
|
23
|
-
*/
|
|
24
|
-
constructor(input: DataCoreDeleteRequestInput);
|
|
25
|
-
/**
|
|
26
|
-
* Parse the response
|
|
27
|
-
*/
|
|
28
|
-
protected parseResponse(response: unknown): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Get the body for the request
|
|
31
|
-
*/
|
|
32
|
-
protected getBody(): Record<string, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* Wait for the response (timeout: 25 seconds)
|
|
35
|
-
*/
|
|
36
|
-
protected processResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=data-core.delete-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,iCAAiC,CAAA;AAKhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AA4BD;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC;IACnG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;gBACS,KAAK,EAAE,0BAA0B;IAO7C;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAW5D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOrD;;OAEG;cACsB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
|
|
@@ -1,99 +0,0 @@
|
|
|
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_graphql_js_1 = require("../../common/command-graphql.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
|
-
* @deprecated Use `DataCoreRequestDeleteCommand` instead
|
|
37
|
-
*/
|
|
38
|
-
class DataCoreDeleteRequestCommand extends command_graphql_js_1.GraphQlCommand {
|
|
39
|
-
/**
|
|
40
|
-
* Create a new data core delete request command
|
|
41
|
-
*/
|
|
42
|
-
constructor(input) {
|
|
43
|
-
super({
|
|
44
|
-
...input,
|
|
45
|
-
waitForDelete: input.waitForDelete ?? true,
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* Whether the command should retry on failure
|
|
49
|
-
*/
|
|
50
|
-
Object.defineProperty(this, "retryOnFailure", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: false
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Parse the response
|
|
59
|
-
*/
|
|
60
|
-
parseResponse(response) {
|
|
61
|
-
const parsedResponse = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, response);
|
|
62
|
-
if (parsedResponse.errors) {
|
|
63
|
-
throw new command_error_js_1.CommandError(this.constructor.name, parsedResponse.errors[0].message);
|
|
64
|
-
}
|
|
65
|
-
if (!parsedResponse.data.datacore?.requestDelete) {
|
|
66
|
-
throw new not_found_js_1.NotFoundException("DataCore", { id: this.input.dataCoreId });
|
|
67
|
-
}
|
|
68
|
-
return parsedResponse.data.datacore.requestDelete.deleting;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get the body for the request
|
|
72
|
-
*/
|
|
73
|
-
getBody() {
|
|
74
|
-
return {
|
|
75
|
-
query: graphQlQuery,
|
|
76
|
-
variables: this.input,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Wait for the response (timeout: 25 seconds)
|
|
81
|
-
*/
|
|
82
|
-
async processResponse(client, response) {
|
|
83
|
-
if (!this.input.waitForDelete) {
|
|
84
|
-
return response;
|
|
85
|
-
}
|
|
86
|
-
const start = Date.now();
|
|
87
|
-
while (Date.now() - start < 25_000) {
|
|
88
|
-
const response = await client.execute(new data_core_exists_js_1.DataCoreExistsCommand({
|
|
89
|
-
dataCoreId: this.input.dataCoreId,
|
|
90
|
-
}));
|
|
91
|
-
if (!response.exists) {
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
95
|
-
}
|
|
96
|
-
return response;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.DataCoreDeleteRequestCommand = DataCoreDeleteRequestCommand;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Command } from "../../common/command.js";
|
|
2
|
-
import { type DataCoreWithAccess } from "../../contracts/data-core.js";
|
|
3
|
-
/**
|
|
4
|
-
* The input for the data core fetch by name command
|
|
5
|
-
*/
|
|
6
|
-
export interface DataCoreListNewInput {
|
|
7
|
-
/** The tenant id */
|
|
8
|
-
tenantId?: string;
|
|
9
|
-
/** The tenant name */
|
|
10
|
-
tenant?: string;
|
|
11
|
-
/** The data core name */
|
|
12
|
-
name?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Fetch all data cores for a tenant
|
|
16
|
-
*/
|
|
17
|
-
export declare class DataCoreListNewCommand extends Command<DataCoreListNewInput, DataCoreWithAccess[]> {
|
|
18
|
-
/**
|
|
19
|
-
* Get the method
|
|
20
|
-
*/
|
|
21
|
-
protected getMethod(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Get the base url
|
|
24
|
-
*/
|
|
25
|
-
protected getBaseUrl(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Get the path
|
|
28
|
-
*/
|
|
29
|
-
protected getPath(): string;
|
|
30
|
-
/**
|
|
31
|
-
* Parse the response
|
|
32
|
-
*/
|
|
33
|
-
protected parseResponse(rawResponse: unknown): DataCoreWithAccess[];
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=data-core.list-new.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-core.list-new.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.list-new.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,8BAA8B,CAAA;AAGhG;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAOD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;IAC7F;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAcpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,kBAAkB,EAAE;CAG7E"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataCoreListNewCommand = void 0;
|
|
4
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
-
const command_js_1 = require("../../common/command.js");
|
|
6
|
-
const data_core_js_1 = require("../../contracts/data-core.js");
|
|
7
|
-
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
8
|
-
const responseSchema = typebox_1.Type.Object({
|
|
9
|
-
...data_core_js_1.DataCoreWithAccessSchema.properties,
|
|
10
|
-
access: typebox_1.Type.Array(typebox_1.Type.String()),
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* Fetch all data cores for a tenant
|
|
14
|
-
*/
|
|
15
|
-
class DataCoreListNewCommand extends command_js_1.Command {
|
|
16
|
-
/**
|
|
17
|
-
* Get the method
|
|
18
|
-
*/
|
|
19
|
-
getMethod() {
|
|
20
|
-
return "GET";
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the base url
|
|
24
|
-
*/
|
|
25
|
-
getBaseUrl() {
|
|
26
|
-
return "https://data-core-2.api.flowcore.io";
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get the path
|
|
30
|
-
*/
|
|
31
|
-
getPath() {
|
|
32
|
-
const queryParams = new URLSearchParams();
|
|
33
|
-
if (this.input.tenantId) {
|
|
34
|
-
queryParams.set("tenantId", this.input.tenantId);
|
|
35
|
-
}
|
|
36
|
-
if (this.input.tenant) {
|
|
37
|
-
queryParams.set("tenant", this.input.tenant);
|
|
38
|
-
}
|
|
39
|
-
if (this.input.name) {
|
|
40
|
-
queryParams.set("name", this.input.name);
|
|
41
|
-
}
|
|
42
|
-
return `/api/v1/data-cores/new?${queryParams.toString()}`;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Parse the response
|
|
46
|
-
*/
|
|
47
|
-
parseResponse(rawResponse) {
|
|
48
|
-
return (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Array(responseSchema), rawResponse);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.DataCoreListNewCommand = DataCoreListNewCommand;
|