@flowcore/sdk 1.22.2 → 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.
Files changed (32) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/esm/commands/index.d.ts +0 -4
  3. package/esm/commands/index.d.ts.map +1 -1
  4. package/esm/commands/index.js +0 -4
  5. package/package.json +1 -1
  6. package/script/commands/index.d.ts +0 -4
  7. package/script/commands/index.d.ts.map +1 -1
  8. package/script/commands/index.js +0 -4
  9. package/esm/commands/data-core/data-core.delete-request.d.ts +0 -38
  10. package/esm/commands/data-core/data-core.delete-request.d.ts.map +0 -1
  11. package/esm/commands/data-core/data-core.delete-request.js +0 -95
  12. package/esm/commands/event-type/event-type.delete-request.d.ts +0 -42
  13. package/esm/commands/event-type/event-type.delete-request.d.ts.map +0 -1
  14. package/esm/commands/event-type/event-type.delete-request.js +0 -108
  15. package/esm/commands/event-type/event-type.truncate-request.d.ts +0 -42
  16. package/esm/commands/event-type/event-type.truncate-request.d.ts.map +0 -1
  17. package/esm/commands/event-type/event-type.truncate-request.js +0 -108
  18. package/esm/commands/flow-type/flow-type.delete-request.d.ts +0 -55
  19. package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +0 -1
  20. package/esm/commands/flow-type/flow-type.delete-request.js +0 -128
  21. package/script/commands/data-core/data-core.delete-request.d.ts +0 -38
  22. package/script/commands/data-core/data-core.delete-request.d.ts.map +0 -1
  23. package/script/commands/data-core/data-core.delete-request.js +0 -99
  24. package/script/commands/event-type/event-type.delete-request.d.ts +0 -42
  25. package/script/commands/event-type/event-type.delete-request.d.ts.map +0 -1
  26. package/script/commands/event-type/event-type.delete-request.js +0 -112
  27. package/script/commands/event-type/event-type.truncate-request.d.ts +0 -42
  28. package/script/commands/event-type/event-type.truncate-request.d.ts.map +0 -1
  29. package/script/commands/event-type/event-type.truncate-request.js +0 -112
  30. package/script/commands/flow-type/flow-type.delete-request.d.ts +0 -55
  31. package/script/commands/flow-type/flow-type.delete-request.d.ts.map +0 -1
  32. package/script/commands/flow-type/flow-type.delete-request.js +0 -132
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowTypeDeleteRequestCommand = void 0;
4
- const typebox_1 = require("@sinclair/typebox");
5
- const command_graphql_js_1 = require("../../common/command-graphql.js");
6
- const flow_type_fetch_js_1 = require("./flow-type.fetch.js");
7
- const command_error_js_1 = require("../../exceptions/command-error.js");
8
- const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
9
- const not_found_js_1 = require("../../exceptions/not-found.js");
10
- const flow_type_exists_js_1 = require("./flow-type.exists.js");
11
- const graphQlQuery = `
12
- mutation FLOWCORE_SDK_FLOW_TYPE_DELETE_REQUEST($flowTypeId: ID!, $dataCoreId: ID!) {
13
- datacore(id: $dataCoreId) {
14
- flowtype(id: $flowTypeId) {
15
- requestDelete {
16
- deleting
17
- }
18
- }
19
- }
20
- }
21
- `;
22
- const responseSchema = typebox_1.Type.Object({
23
- errors: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
24
- message: typebox_1.Type.String(),
25
- }))),
26
- data: typebox_1.Type.Union([
27
- typebox_1.Type.Object({
28
- datacore: typebox_1.Type.Object({
29
- flowtype: typebox_1.Type.Object({
30
- requestDelete: typebox_1.Type.Union([
31
- typebox_1.Type.Object({
32
- deleting: typebox_1.Type.Boolean(),
33
- }),
34
- typebox_1.Type.Null(),
35
- ]),
36
- }),
37
- }),
38
- }),
39
- typebox_1.Type.Null(),
40
- ]),
41
- });
42
- /**
43
- * Request to delete a flow type
44
- * @deprecated Use `FlowTypeRequestDeleteCommand` instead
45
- */
46
- class FlowTypeDeleteRequestCommand extends command_graphql_js_1.GraphQlCommand {
47
- /**
48
- * Create a new flow type delete request command
49
- */
50
- constructor(input) {
51
- super({
52
- ...input,
53
- waitForDelete: input.waitForDelete ?? true,
54
- });
55
- /**
56
- * Whether the command should retry on failure
57
- */
58
- Object.defineProperty(this, "retryOnFailure", {
59
- enumerable: true,
60
- configurable: true,
61
- writable: true,
62
- value: false
63
- });
64
- /**
65
- * The allowed modes for the command
66
- */
67
- Object.defineProperty(this, "allowedModes", {
68
- enumerable: true,
69
- configurable: true,
70
- writable: true,
71
- value: ["bearer"]
72
- });
73
- }
74
- /**
75
- * Parse the response
76
- */
77
- parseResponse(response) {
78
- const parsedResponse = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, response);
79
- if (parsedResponse.errors) {
80
- throw new command_error_js_1.CommandError(this.constructor.name, parsedResponse.errors[0].message);
81
- }
82
- if (!parsedResponse.data?.datacore?.flowtype?.requestDelete) {
83
- throw new not_found_js_1.NotFoundException("FlowType", { id: this.input.flowTypeId });
84
- }
85
- return parsedResponse.data.datacore.flowtype.requestDelete.deleting;
86
- }
87
- async getRequest(client) {
88
- const request = await super.getRequest(client);
89
- const response = await client.execute(new flow_type_fetch_js_1.FlowTypeFetchCommand({
90
- flowTypeId: this.input.flowTypeId,
91
- }));
92
- return {
93
- ...request,
94
- body: {
95
- query: graphQlQuery,
96
- variables: {
97
- flowTypeId: this.input.flowTypeId,
98
- dataCoreId: response.dataCoreId,
99
- },
100
- },
101
- };
102
- }
103
- /**
104
- * Get the body for the request
105
- */
106
- getBody() {
107
- return {
108
- query: graphQlQuery,
109
- variables: this.input,
110
- };
111
- }
112
- /**
113
- * Wait for the response (timeout: 25 seconds)
114
- */
115
- async processResponse(client, response) {
116
- if (!this.input.waitForDelete) {
117
- return response;
118
- }
119
- const start = Date.now();
120
- while (Date.now() - start < 25_000) {
121
- const response = await client.execute(new flow_type_exists_js_1.FlowTypeExistsCommand({
122
- flowTypeId: this.input.flowTypeId,
123
- }));
124
- if (!response.exists) {
125
- break;
126
- }
127
- await new Promise((resolve) => setTimeout(resolve, 100));
128
- }
129
- return response;
130
- }
131
- }
132
- exports.FlowTypeDeleteRequestCommand = FlowTypeDeleteRequestCommand;