@flowcore/sdk 1.10.1 → 1.10.3

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.3](https://github.com/flowcore-io/flowcore-sdk/compare/v1.10.2...v1.10.3) (2025-02-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * flowtype delete request ([66488ff](https://github.com/flowcore-io/flowcore-sdk/commit/66488ffccef62f6eefb0661c6166f3ff5bb6a82f))
9
+
10
+ ## [1.10.2](https://github.com/flowcore-io/flowcore-sdk/compare/v1.10.1...v1.10.2) (2025-02-07)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * add eventtype truncate command ([1f8d4b0](https://github.com/flowcore-io/flowcore-sdk/commit/1f8d4b0afa89e427b5835fa933208f6508d0c578))
16
+
3
17
  ## [1.10.1](https://github.com/flowcore-io/flowcore-sdk/compare/v1.10.0...v1.10.1) (2025-02-07)
4
18
 
5
19
 
@@ -0,0 +1,41 @@
1
+ import { GraphQlCommand } from "../../common/command.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
+ */
15
+ export declare class EventTypeTruncateRequestCommand extends GraphQlCommand<EventTypeTruncateRequestInput, boolean> {
16
+ /**
17
+ * Whether the command should retry on failure
18
+ */
19
+ protected retryOnFailure: boolean;
20
+ /**
21
+ * The allowed modes for the command
22
+ */
23
+ protected allowedModes: ("apiKey" | "bearer")[];
24
+ /**
25
+ * Create a new event type truncate request command
26
+ */
27
+ constructor(input: EventTypeTruncateRequestInput);
28
+ /**
29
+ * Parse the response
30
+ */
31
+ protected parseResponse(response: unknown): boolean;
32
+ /**
33
+ * Get the body for the request
34
+ */
35
+ protected getBody(): Record<string, unknown>;
36
+ /**
37
+ * Wait for the response (timeout: 25 seconds)
38
+ */
39
+ protected processResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
40
+ }
41
+ //# sourceMappingURL=event-type.truncate-request.d.ts.map
@@ -0,0 +1 @@
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,yBAAyB,CAAA;AAIxD,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;;GAEG;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"}
@@ -0,0 +1,107 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { GraphQlCommand } from "../../common/command.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
+ */
37
+ export class EventTypeTruncateRequestCommand extends GraphQlCommand {
38
+ /**
39
+ * Create a new event type truncate request command
40
+ */
41
+ constructor(input) {
42
+ super({
43
+ ...input,
44
+ waitForTruncate: input.waitForTruncate ?? true,
45
+ });
46
+ /**
47
+ * Whether the command should retry on failure
48
+ */
49
+ Object.defineProperty(this, "retryOnFailure", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: false
54
+ });
55
+ /**
56
+ * The allowed modes for the command
57
+ */
58
+ Object.defineProperty(this, "allowedModes", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: ["bearer"]
63
+ });
64
+ }
65
+ /**
66
+ * Parse the response
67
+ */
68
+ parseResponse(response) {
69
+ const parsedResponse = parseResponseHelper(responseSchema, response);
70
+ if (parsedResponse.errors) {
71
+ throw new CommandError(this.constructor.name, parsedResponse.errors[0].message);
72
+ }
73
+ if (!parsedResponse.data?.eventType?.requestTruncate) {
74
+ throw new NotFoundException("EventType", { id: this.input.eventTypeId });
75
+ }
76
+ return parsedResponse.data.eventType.requestTruncate.truncating;
77
+ }
78
+ /**
79
+ * Get the body for the request
80
+ */
81
+ getBody() {
82
+ const { waitForTruncate: _, ...rest } = this.input;
83
+ return {
84
+ query: graphQlQuery,
85
+ variables: rest,
86
+ };
87
+ }
88
+ /**
89
+ * Wait for the response (timeout: 25 seconds)
90
+ */
91
+ async processResponse(client, response) {
92
+ if (!this.input.waitForTruncate) {
93
+ return response;
94
+ }
95
+ const start = Date.now();
96
+ while (Date.now() - start < 25_000) {
97
+ const response = await client.execute(new EventTypeFetchCommand({
98
+ eventTypeId: this.input.eventTypeId,
99
+ }));
100
+ if (response.isTruncating) {
101
+ break;
102
+ }
103
+ await new Promise((resolve) => setTimeout(resolve, 100));
104
+ }
105
+ return response;
106
+ }
107
+ }
@@ -32,7 +32,7 @@ export declare class FlowTypeDeleteRequestCommand extends GraphQlCommand<FlowTyp
32
32
  protected parseResponse(response: unknown): boolean;
33
33
  getRequest(client: FlowcoreClient): Promise<{
34
34
  allowedModes: ("apiKey" | "bearer")[];
35
- body: string | undefined;
35
+ body: Record<string, unknown>;
36
36
  headers: Record<string, string>;
37
37
  baseUrl: string;
38
38
  path: string;
@@ -1 +1 @@
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,yBAAyB,CAAA;AACxD,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;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC;IACnG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAEl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O,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
@@ -87,13 +87,13 @@ export class FlowTypeDeleteRequestCommand extends GraphQlCommand {
87
87
  }));
88
88
  return {
89
89
  ...request,
90
- body: JSON.stringify({
90
+ body: {
91
91
  query: graphQlQuery,
92
92
  variables: {
93
93
  flowTypeId: this.input.flowTypeId,
94
94
  dataCoreId: response.dataCoreId,
95
95
  },
96
- }),
96
+ },
97
97
  };
98
98
  }
99
99
  /**
@@ -27,6 +27,7 @@ export * from "./event-type/event-type.list.js";
27
27
  export * from "./event-type/event-type.create.js";
28
28
  export * from "./event-type/event-type.update.js";
29
29
  export * from "./event-type/event-type.delete-request.js";
30
+ export * from "./event-type/event-type.truncate-request.js";
30
31
  export * from "./events/events.fetch.js";
31
32
  export * from "./events/events.fetch-time-buckets-by-names.js";
32
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAG3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AAGzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAG7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AAGzD,cAAc,0BAA0B,CAAA;AACxC,cAAc,gDAAgD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAG3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AAGzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAG7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AACzD,cAAc,6CAA6C,CAAA;AAG3D,cAAc,0BAA0B,CAAA;AACxC,cAAc,gDAAgD,CAAA"}
@@ -34,6 +34,7 @@ export * from "./event-type/event-type.list.js";
34
34
  export * from "./event-type/event-type.create.js";
35
35
  export * from "./event-type/event-type.update.js";
36
36
  export * from "./event-type/event-type.delete-request.js";
37
+ export * from "./event-type/event-type.truncate-request.js";
37
38
  // Events
38
39
  export * from "./events/events.fetch.js";
39
40
  export * from "./events/events.fetch-time-buckets-by-names.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/sdk",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -0,0 +1,41 @@
1
+ import { GraphQlCommand } from "../../common/command.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
+ */
15
+ export declare class EventTypeTruncateRequestCommand extends GraphQlCommand<EventTypeTruncateRequestInput, boolean> {
16
+ /**
17
+ * Whether the command should retry on failure
18
+ */
19
+ protected retryOnFailure: boolean;
20
+ /**
21
+ * The allowed modes for the command
22
+ */
23
+ protected allowedModes: ("apiKey" | "bearer")[];
24
+ /**
25
+ * Create a new event type truncate request command
26
+ */
27
+ constructor(input: EventTypeTruncateRequestInput);
28
+ /**
29
+ * Parse the response
30
+ */
31
+ protected parseResponse(response: unknown): boolean;
32
+ /**
33
+ * Get the body for the request
34
+ */
35
+ protected getBody(): Record<string, unknown>;
36
+ /**
37
+ * Wait for the response (timeout: 25 seconds)
38
+ */
39
+ protected processResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
40
+ }
41
+ //# sourceMappingURL=event-type.truncate-request.d.ts.map
@@ -0,0 +1 @@
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,yBAAyB,CAAA;AAIxD,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;;GAEG;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"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventTypeTruncateRequestCommand = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const command_js_1 = require("../../common/command.js");
6
+ const command_error_js_1 = require("../../exceptions/command-error.js");
7
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
+ const not_found_js_1 = require("../../exceptions/not-found.js");
9
+ const event_type_fetch_js_1 = require("./event-type.fetch.js");
10
+ const graphQlQuery = `
11
+ mutation FLOWCORE_SDK_EVENT_TYPE_TRUNCATE_REQUEST($eventTypeId: ID!) {
12
+ eventType(id: $eventTypeId) {
13
+ requestTruncate {
14
+ truncating
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.Union([
24
+ typebox_1.Type.Object({
25
+ eventType: typebox_1.Type.Object({
26
+ requestTruncate: typebox_1.Type.Union([
27
+ typebox_1.Type.Object({
28
+ truncating: typebox_1.Type.Boolean(),
29
+ }),
30
+ typebox_1.Type.Null(),
31
+ ]),
32
+ }),
33
+ }),
34
+ typebox_1.Type.Null(),
35
+ ]),
36
+ });
37
+ /**
38
+ * Request to truncate a event type
39
+ */
40
+ class EventTypeTruncateRequestCommand extends command_js_1.GraphQlCommand {
41
+ /**
42
+ * Create a new event type truncate request command
43
+ */
44
+ constructor(input) {
45
+ super({
46
+ ...input,
47
+ waitForTruncate: input.waitForTruncate ?? true,
48
+ });
49
+ /**
50
+ * Whether the command should retry on failure
51
+ */
52
+ Object.defineProperty(this, "retryOnFailure", {
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true,
56
+ value: false
57
+ });
58
+ /**
59
+ * The allowed modes for the command
60
+ */
61
+ Object.defineProperty(this, "allowedModes", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: ["bearer"]
66
+ });
67
+ }
68
+ /**
69
+ * Parse the response
70
+ */
71
+ parseResponse(response) {
72
+ const parsedResponse = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, response);
73
+ if (parsedResponse.errors) {
74
+ throw new command_error_js_1.CommandError(this.constructor.name, parsedResponse.errors[0].message);
75
+ }
76
+ if (!parsedResponse.data?.eventType?.requestTruncate) {
77
+ throw new not_found_js_1.NotFoundException("EventType", { id: this.input.eventTypeId });
78
+ }
79
+ return parsedResponse.data.eventType.requestTruncate.truncating;
80
+ }
81
+ /**
82
+ * Get the body for the request
83
+ */
84
+ getBody() {
85
+ const { waitForTruncate: _, ...rest } = this.input;
86
+ return {
87
+ query: graphQlQuery,
88
+ variables: rest,
89
+ };
90
+ }
91
+ /**
92
+ * Wait for the response (timeout: 25 seconds)
93
+ */
94
+ async processResponse(client, response) {
95
+ if (!this.input.waitForTruncate) {
96
+ return response;
97
+ }
98
+ const start = Date.now();
99
+ while (Date.now() - start < 25_000) {
100
+ const response = await client.execute(new event_type_fetch_js_1.EventTypeFetchCommand({
101
+ eventTypeId: this.input.eventTypeId,
102
+ }));
103
+ if (response.isTruncating) {
104
+ break;
105
+ }
106
+ await new Promise((resolve) => setTimeout(resolve, 100));
107
+ }
108
+ return response;
109
+ }
110
+ }
111
+ exports.EventTypeTruncateRequestCommand = EventTypeTruncateRequestCommand;
@@ -32,7 +32,7 @@ export declare class FlowTypeDeleteRequestCommand extends GraphQlCommand<FlowTyp
32
32
  protected parseResponse(response: unknown): boolean;
33
33
  getRequest(client: FlowcoreClient): Promise<{
34
34
  allowedModes: ("apiKey" | "bearer")[];
35
- body: string | undefined;
35
+ body: Record<string, unknown>;
36
36
  headers: Record<string, string>;
37
37
  baseUrl: string;
38
38
  path: string;
@@ -1 +1 @@
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,yBAAyB,CAAA;AACxD,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;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC;IACnG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAE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,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
@@ -90,13 +90,13 @@ class FlowTypeDeleteRequestCommand extends command_js_1.GraphQlCommand {
90
90
  }));
91
91
  return {
92
92
  ...request,
93
- body: JSON.stringify({
93
+ body: {
94
94
  query: graphQlQuery,
95
95
  variables: {
96
96
  flowTypeId: this.input.flowTypeId,
97
97
  dataCoreId: response.dataCoreId,
98
98
  },
99
- }),
99
+ },
100
100
  };
101
101
  }
102
102
  /**
@@ -27,6 +27,7 @@ export * from "./event-type/event-type.list.js";
27
27
  export * from "./event-type/event-type.create.js";
28
28
  export * from "./event-type/event-type.update.js";
29
29
  export * from "./event-type/event-type.delete-request.js";
30
+ export * from "./event-type/event-type.truncate-request.js";
30
31
  export * from "./events/events.fetch.js";
31
32
  export * from "./events/events.fetch-time-buckets-by-names.js";
32
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAG3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AAGzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAG7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AAGzD,cAAc,0BAA0B,CAAA;AACxC,cAAc,gDAAgD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAG3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AAGzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAG7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AAGvD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AACzD,cAAc,6CAA6C,CAAA;AAG3D,cAAc,0BAA0B,CAAA;AACxC,cAAc,gDAAgD,CAAA"}
@@ -50,6 +50,7 @@ __exportStar(require("./event-type/event-type.list.js"), exports);
50
50
  __exportStar(require("./event-type/event-type.create.js"), exports);
51
51
  __exportStar(require("./event-type/event-type.update.js"), exports);
52
52
  __exportStar(require("./event-type/event-type.delete-request.js"), exports);
53
+ __exportStar(require("./event-type/event-type.truncate-request.js"), exports);
53
54
  // Events
54
55
  __exportStar(require("./events/events.fetch.js"), exports);
55
56
  __exportStar(require("./events/events.fetch-time-buckets-by-names.js"), exports);