@flowcore/sdk 1.12.1 → 1.14.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 (80) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/esm/commands/container-registry/container-registry.delete.d.ts.map +1 -1
  3. package/esm/commands/container-registry/container-registry.delete.js +0 -1
  4. package/esm/commands/container-registry/container-registry.update.d.ts.map +1 -1
  5. package/esm/commands/container-registry/container-registry.update.js +0 -1
  6. package/esm/commands/data-core/data-core.delete-request.d.ts +1 -0
  7. package/esm/commands/data-core/data-core.delete-request.d.ts.map +1 -1
  8. package/esm/commands/data-core/data-core.delete-request.js +1 -0
  9. package/esm/commands/data-core/data-core.request-delete.d.ts +49 -0
  10. package/esm/commands/data-core/data-core.request-delete.d.ts.map +1 -0
  11. package/esm/commands/data-core/data-core.request-delete.js +67 -0
  12. package/esm/commands/event-type/event-type.delete-request.d.ts +1 -0
  13. package/esm/commands/event-type/event-type.delete-request.d.ts.map +1 -1
  14. package/esm/commands/event-type/event-type.delete-request.js +1 -0
  15. package/esm/commands/event-type/event-type.request-delete.d.ts +48 -0
  16. package/esm/commands/event-type/event-type.request-delete.d.ts.map +1 -0
  17. package/esm/commands/event-type/event-type.request-delete.js +67 -0
  18. package/esm/commands/event-type/event-type.request-truncate.d.ts +48 -0
  19. package/esm/commands/event-type/event-type.request-truncate.d.ts.map +1 -0
  20. package/esm/commands/event-type/event-type.request-truncate.js +68 -0
  21. package/esm/commands/event-type/event-type.truncate-request.d.ts +1 -0
  22. package/esm/commands/event-type/event-type.truncate-request.d.ts.map +1 -1
  23. package/esm/commands/event-type/event-type.truncate-request.js +1 -0
  24. package/esm/commands/flow-type/flow-type.delete-request.d.ts +1 -0
  25. package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
  26. package/esm/commands/flow-type/flow-type.delete-request.js +1 -0
  27. package/esm/commands/flow-type/flow-type.request-delete.d.ts +48 -0
  28. package/esm/commands/flow-type/flow-type.request-delete.d.ts.map +1 -0
  29. package/esm/commands/flow-type/flow-type.request-delete.js +67 -0
  30. package/esm/commands/index.d.ts +17 -12
  31. package/esm/commands/index.d.ts.map +1 -1
  32. package/esm/commands/index.js +17 -12
  33. package/esm/commands/tenant/tenant.translate-name-to-id.d.ts +44 -0
  34. package/esm/commands/tenant/tenant.translate-name-to-id.d.ts.map +1 -0
  35. package/esm/commands/tenant/tenant.translate-name-to-id.js +52 -0
  36. package/esm/common/flowcore-client.js +1 -1
  37. package/esm/contracts/container.d.ts +2 -2
  38. package/esm/contracts/container.d.ts.map +1 -1
  39. package/esm/contracts/container.js +4 -2
  40. package/esm/exceptions/client-error.js +1 -1
  41. package/package.json +1 -1
  42. package/script/commands/container-registry/container-registry.delete.d.ts.map +1 -1
  43. package/script/commands/container-registry/container-registry.delete.js +0 -1
  44. package/script/commands/container-registry/container-registry.update.d.ts.map +1 -1
  45. package/script/commands/container-registry/container-registry.update.js +0 -1
  46. package/script/commands/data-core/data-core.delete-request.d.ts +1 -0
  47. package/script/commands/data-core/data-core.delete-request.d.ts.map +1 -1
  48. package/script/commands/data-core/data-core.delete-request.js +1 -0
  49. package/script/commands/data-core/data-core.request-delete.d.ts +49 -0
  50. package/script/commands/data-core/data-core.request-delete.d.ts.map +1 -0
  51. package/script/commands/data-core/data-core.request-delete.js +71 -0
  52. package/script/commands/event-type/event-type.delete-request.d.ts +1 -0
  53. package/script/commands/event-type/event-type.delete-request.d.ts.map +1 -1
  54. package/script/commands/event-type/event-type.delete-request.js +1 -0
  55. package/script/commands/event-type/event-type.request-delete.d.ts +48 -0
  56. package/script/commands/event-type/event-type.request-delete.d.ts.map +1 -0
  57. package/script/commands/event-type/event-type.request-delete.js +71 -0
  58. package/script/commands/event-type/event-type.request-truncate.d.ts +48 -0
  59. package/script/commands/event-type/event-type.request-truncate.d.ts.map +1 -0
  60. package/script/commands/event-type/event-type.request-truncate.js +72 -0
  61. package/script/commands/event-type/event-type.truncate-request.d.ts +1 -0
  62. package/script/commands/event-type/event-type.truncate-request.d.ts.map +1 -1
  63. package/script/commands/event-type/event-type.truncate-request.js +1 -0
  64. package/script/commands/flow-type/flow-type.delete-request.d.ts +1 -0
  65. package/script/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
  66. package/script/commands/flow-type/flow-type.delete-request.js +1 -0
  67. package/script/commands/flow-type/flow-type.request-delete.d.ts +48 -0
  68. package/script/commands/flow-type/flow-type.request-delete.d.ts.map +1 -0
  69. package/script/commands/flow-type/flow-type.request-delete.js +71 -0
  70. package/script/commands/index.d.ts +17 -12
  71. package/script/commands/index.d.ts.map +1 -1
  72. package/script/commands/index.js +17 -12
  73. package/script/commands/tenant/tenant.translate-name-to-id.d.ts +44 -0
  74. package/script/commands/tenant/tenant.translate-name-to-id.d.ts.map +1 -0
  75. package/script/commands/tenant/tenant.translate-name-to-id.js +56 -0
  76. package/script/common/flowcore-client.js +1 -1
  77. package/script/contracts/container.d.ts +2 -2
  78. package/script/contracts/container.d.ts.map +1 -1
  79. package/script/contracts/container.js +3 -1
  80. package/script/exceptions/client-error.js +1 -1
@@ -1,38 +1,43 @@
1
1
  export * from "./tenant/tenant.fetch.js";
2
2
  export * from "./tenant/tenant.list.js";
3
- export * from "./api-key/api-key.list.js";
3
+ export * from "./tenant/tenant.translate-name-to-id.js";
4
4
  export * from "./api-key/api-key.create.js";
5
5
  export * from "./api-key/api-key.delete.js";
6
- export * from "./secret/secret.list.js";
6
+ export * from "./api-key/api-key.list.js";
7
7
  export * from "./secret/secret.create.js";
8
8
  export * from "./secret/secret.delete.js";
9
- export * from "./variable/variable.list.js";
9
+ export * from "./secret/secret.list.js";
10
10
  export * from "./variable/variable.create.js";
11
11
  export * from "./variable/variable.delete.js";
12
+ export * from "./variable/variable.list.js";
13
+ export * from "./data-core/data-core.create.js";
14
+ export * from "./data-core/data-core.delete-request.js";
12
15
  export * from "./data-core/data-core.exists.js";
13
16
  export * from "./data-core/data-core.fetch.js";
14
17
  export * from "./data-core/data-core.list.js";
15
- export * from "./data-core/data-core.create.js";
18
+ export * from "./data-core/data-core.request-delete.js";
16
19
  export * from "./data-core/data-core.update.js";
17
- export * from "./data-core/data-core.delete-request.js";
20
+ export * from "./flow-type/flow-type.create.js";
21
+ export * from "./flow-type/flow-type.delete-request.js";
18
22
  export * from "./flow-type/flow-type.exists.js";
19
23
  export * from "./flow-type/flow-type.fetch.js";
20
24
  export * from "./flow-type/flow-type.list.js";
21
- export * from "./flow-type/flow-type.create.js";
25
+ export * from "./flow-type/flow-type.request-delete.js";
22
26
  export * from "./flow-type/flow-type.update.js";
23
- export * from "./flow-type/flow-type.delete-request.js";
27
+ export * from "./event-type/event-type.create.js";
28
+ export * from "./event-type/event-type.delete-request.js";
24
29
  export * from "./event-type/event-type.exists.js";
25
30
  export * from "./event-type/event-type.fetch.js";
26
31
  export * from "./event-type/event-type.list.js";
27
- export * from "./event-type/event-type.create.js";
28
- export * from "./event-type/event-type.update.js";
29
- export * from "./event-type/event-type.delete-request.js";
32
+ export * from "./event-type/event-type.request-delete.js";
33
+ export * from "./event-type/event-type.request-truncate.js";
30
34
  export * from "./event-type/event-type.truncate-request.js";
31
- export * from "./events/events.fetch.js";
35
+ export * from "./event-type/event-type.update.js";
32
36
  export * from "./events/events.fetch-time-buckets-by-names.js";
37
+ export * from "./events/events.fetch.js";
33
38
  export * from "./container-registry/container-registry.create.js";
39
+ export * from "./container-registry/container-registry.delete.js";
34
40
  export * from "./container-registry/container-registry.fetch.js";
35
41
  export * from "./container-registry/container-registry.list.js";
36
42
  export * from "./container-registry/container-registry.update.js";
37
- export * from "./container-registry/container-registry.delete.js";
38
43
  //# 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;AACzD,cAAc,6CAA6C,CAAA;AAG3D,cAAc,0BAA0B,CAAA;AACxC,cAAc,gDAAgD,CAAA;AAG9D,cAAc,mDAAmD,CAAA;AACjE,cAAc,kDAAkD,CAAA;AAChE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,mDAAmD,CAAA;AACjE,cAAc,mDAAmD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yCAAyC,CAAA;AAGvD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AAGzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAG3C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yCAAyC,CAAA;AACvD,cAAc,iCAAiC,CAAA;AAG/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yCAAyC,CAAA;AACvD,cAAc,iCAAiC,CAAA;AAG/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,2CAA2C,CAAA;AACzD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2CAA2C,CAAA;AACzD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,6CAA6C,CAAA;AAC3D,cAAc,mCAAmC,CAAA;AAGjD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,0BAA0B,CAAA;AAGxC,cAAc,mDAAmD,CAAA;AACjE,cAAc,mDAAmD,CAAA;AACjE,cAAc,kDAAkD,CAAA;AAChE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,mDAAmD,CAAA"}
@@ -1,46 +1,51 @@
1
1
  // Tenant
2
2
  export * from "./tenant/tenant.fetch.js";
3
3
  export * from "./tenant/tenant.list.js";
4
+ export * from "./tenant/tenant.translate-name-to-id.js";
4
5
  // Api Key
5
- export * from "./api-key/api-key.list.js";
6
6
  export * from "./api-key/api-key.create.js";
7
7
  export * from "./api-key/api-key.delete.js";
8
+ export * from "./api-key/api-key.list.js";
8
9
  // Secret
9
- export * from "./secret/secret.list.js";
10
10
  export * from "./secret/secret.create.js";
11
11
  export * from "./secret/secret.delete.js";
12
+ export * from "./secret/secret.list.js";
12
13
  // Variable
13
- export * from "./variable/variable.list.js";
14
14
  export * from "./variable/variable.create.js";
15
15
  export * from "./variable/variable.delete.js";
16
+ export * from "./variable/variable.list.js";
16
17
  // Data Core
18
+ export * from "./data-core/data-core.create.js";
19
+ export * from "./data-core/data-core.delete-request.js";
17
20
  export * from "./data-core/data-core.exists.js";
18
21
  export * from "./data-core/data-core.fetch.js";
19
22
  export * from "./data-core/data-core.list.js";
20
- export * from "./data-core/data-core.create.js";
23
+ export * from "./data-core/data-core.request-delete.js";
21
24
  export * from "./data-core/data-core.update.js";
22
- export * from "./data-core/data-core.delete-request.js";
23
25
  // Flow Types
26
+ export * from "./flow-type/flow-type.create.js";
27
+ export * from "./flow-type/flow-type.delete-request.js";
24
28
  export * from "./flow-type/flow-type.exists.js";
25
29
  export * from "./flow-type/flow-type.fetch.js";
26
30
  export * from "./flow-type/flow-type.list.js";
27
- export * from "./flow-type/flow-type.create.js";
31
+ export * from "./flow-type/flow-type.request-delete.js";
28
32
  export * from "./flow-type/flow-type.update.js";
29
- export * from "./flow-type/flow-type.delete-request.js";
30
33
  // Event Types
34
+ export * from "./event-type/event-type.create.js";
35
+ export * from "./event-type/event-type.delete-request.js";
31
36
  export * from "./event-type/event-type.exists.js";
32
37
  export * from "./event-type/event-type.fetch.js";
33
38
  export * from "./event-type/event-type.list.js";
34
- export * from "./event-type/event-type.create.js";
35
- export * from "./event-type/event-type.update.js";
36
- export * from "./event-type/event-type.delete-request.js";
39
+ export * from "./event-type/event-type.request-delete.js";
40
+ export * from "./event-type/event-type.request-truncate.js";
37
41
  export * from "./event-type/event-type.truncate-request.js";
42
+ export * from "./event-type/event-type.update.js";
38
43
  // Events
39
- export * from "./events/events.fetch.js";
40
44
  export * from "./events/events.fetch-time-buckets-by-names.js";
45
+ export * from "./events/events.fetch.js";
41
46
  //Container
42
47
  export * from "./container-registry/container-registry.create.js";
48
+ export * from "./container-registry/container-registry.delete.js";
43
49
  export * from "./container-registry/container-registry.fetch.js";
44
50
  export * from "./container-registry/container-registry.list.js";
45
51
  export * from "./container-registry/container-registry.update.js";
46
- export * from "./container-registry/container-registry.delete.js";
@@ -0,0 +1,44 @@
1
+ import { type Static, type TObject, type TString } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import type { ClientError } from "../../exceptions/client-error.js";
4
+ /**
5
+ * The input for the tenant translate name to id command
6
+ */
7
+ export interface TenantTranslateNameToIdInput {
8
+ /** The name of the tenant */
9
+ tenant: string;
10
+ }
11
+ /**
12
+ * The schema for the tenant translate name to id command
13
+ */
14
+ export declare const TenantTranslateNameToIdSchema: TObject<{
15
+ id: TString;
16
+ name: TString;
17
+ }>;
18
+ export type TenantTranslateNameToId = Static<typeof TenantTranslateNameToIdSchema>;
19
+ /**
20
+ * Translate a tenant name to an tenant id
21
+ */
22
+ export declare class TenantTranslateNameToIdCommand extends Command<TenantTranslateNameToIdInput, TenantTranslateNameToId> {
23
+ /**
24
+ * Get the method
25
+ */
26
+ protected getMethod(): string;
27
+ /**
28
+ * Get the base url
29
+ */
30
+ protected getBaseUrl(): string;
31
+ /**
32
+ * Get the path
33
+ */
34
+ protected getPath(): string;
35
+ /**
36
+ * Parse the response
37
+ */
38
+ protected parseResponse(rawResponse: unknown): TenantTranslateNameToId;
39
+ /**
40
+ * Handle the client error
41
+ */
42
+ protected handleClientError(error: ClientError): void;
43
+ }
44
+ //# sourceMappingURL=tenant.translate-name-to-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant.translate-name-to-id.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.translate-name-to-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAKnE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,OAAO,CAAC;IAClD,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;CACd,CAGC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAElF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,OAAO,CAAC,4BAA4B,EAAE,uBAAuB,CAAC;IAChH;;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,uBAAuB;IAK/E;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAQ/D"}
@@ -0,0 +1,52 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { NotFoundException } from "../../exceptions/not-found.js";
4
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
+ /**
6
+ * The schema for the tenant translate name to id command
7
+ */
8
+ export const TenantTranslateNameToIdSchema = Type.Object({
9
+ id: Type.String(),
10
+ name: Type.String(),
11
+ });
12
+ /**
13
+ * Translate a tenant name to an tenant id
14
+ */
15
+ export class TenantTranslateNameToIdCommand extends 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://tenant.api.flowcore.io";
27
+ }
28
+ /**
29
+ * Get the path
30
+ */
31
+ getPath() {
32
+ return `/api/v1/tenants/translate-name-to-id/${this.input.tenant}`;
33
+ }
34
+ /**
35
+ * Parse the response
36
+ */
37
+ parseResponse(rawResponse) {
38
+ const response = parseResponseHelper(TenantTranslateNameToIdSchema, rawResponse);
39
+ return response;
40
+ }
41
+ /**
42
+ * Handle the client error
43
+ */
44
+ handleClientError(error) {
45
+ if (error.status === 404) {
46
+ throw new NotFoundException("Tenant", {
47
+ tenant: this.input.tenant,
48
+ });
49
+ }
50
+ throw error;
51
+ }
52
+ }
@@ -107,7 +107,7 @@ export class FlowcoreClient {
107
107
  const error = new ClientError(`${commandName} failed with ${response.status}: ${response.statusText}`, response.status, body);
108
108
  request.handleClientError(error);
109
109
  }
110
- const responseBody = await response.json();
110
+ const responseBody = response.status === 204 ? { status: response.status } : await response.json();
111
111
  const parsedBody = await request.parseResponse(responseBody);
112
112
  return request.processResponse(this, parsedBody);
113
113
  }
@@ -1,4 +1,4 @@
1
- import { type Static, type TArray, type TObject, type TOptional, type TString } from "@sinclair/typebox";
1
+ import { type Static, type TArray, type TNumber, type TObject, type TOptional, type TString } from "@sinclair/typebox";
2
2
  /**
3
3
  * the schema for a container
4
4
  */
@@ -13,7 +13,7 @@ export declare const ContainerRegistryCreateSchema: TObject<{
13
13
  id: TString;
14
14
  }>;
15
15
  export declare const ContainerRegistryDeleteSchema: TObject<{
16
- id: TString;
16
+ status: TNumber;
17
17
  }>;
18
18
  export declare const ContainerRegistryListSchema: TArray;
19
19
  export type ContainerRegistry = Static<typeof ContainerRegistrySchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/contracts/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAE9G;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC5B,EAAE,EAAE,OAAO,CAAA;CACZ,CAMC,CAAA;AAEF,eAAO,MAAM,6BAA6B,EAAE,OAAO,CAAC;IAClD,EAAE,EAAE,OAAO,CAAA;CACZ,CAEC,CAAA;AAEF,eAAO,MAAM,6BAA6B;QALpC,OAAO;EAK6D,CAAA;AAE1E,eAAO,MAAM,2BAA2B,EAAE,MAA4C,CAAA;AAEtF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACtE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAC9E,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAClF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/contracts/container.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,OAAO,EAEb,MAAM,mBAAmB,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC5B,EAAE,EAAE,OAAO,CAAA;CACZ,CAMC,CAAA;AAEF,eAAO,MAAM,6BAA6B,EAAE,OAAO,CAAC;IAClD,EAAE,EAAE,OAAO,CAAA;CACZ,CAEC,CAAA;AAEF,eAAO,MAAM,6BAA6B,EAAE,OAAO,CAAC;IAClD,MAAM,EAAE,OAAO,CAAA;CAChB,CAEC,CAAA;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAA4C,CAAA;AAEtF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACtE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAC9E,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAClF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Type } from "@sinclair/typebox";
1
+ import { Type, } from "@sinclair/typebox";
2
2
  /**
3
3
  * the schema for a container
4
4
  */
@@ -12,5 +12,7 @@ export const ContainerRegistrySchema = Type.Object({
12
12
  export const ContainerRegistryCreateSchema = Type.Object({
13
13
  id: Type.String(),
14
14
  });
15
- export const ContainerRegistryDeleteSchema = ContainerRegistryCreateSchema;
15
+ export const ContainerRegistryDeleteSchema = Type.Object({
16
+ status: Type.Number(),
17
+ });
16
18
  export const ContainerRegistryListSchema = Type.Array(ContainerRegistrySchema);
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export class ClientError extends Error {
5
5
  constructor(message, status, body) {
6
- super(`Client failed with ${status}: ${message}`);
6
+ super(`Client failed with ${status}: ${body ? JSON.stringify(body) : message}`);
7
7
  Object.defineProperty(this, "status", {
8
8
  enumerable: true,
9
9
  configurable: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/sdk",
3
- "version": "1.12.1",
3
+ "version": "1.14.0",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -1 +1 @@
1
- {"version":3,"file":"container-registry.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/container-registry/container-registry.delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAiC,MAAM,8BAA8B,CAAA;AAC1G,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAA;AAE3D,MAAM,WAAW,4BAA4B;IAC3C,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,8BAA+B,SAAQ,OAAO,CAAC,4BAA4B,EAAE,uBAAuB,CAAC;cAC7F,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAGvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,uBAAuB;CAI7E"}
1
+ {"version":3,"file":"container-registry.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/container-registry/container-registry.delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAiC,MAAM,8BAA8B,CAAA;AAC1G,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAA;AAE3D,MAAM,WAAW,4BAA4B;IAC3C,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,8BAA+B,SAAQ,OAAO,CAAC,4BAA4B,EAAE,uBAAuB,CAAC;cAC7F,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAGvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,uBAAuB;CAG7E"}
@@ -23,7 +23,6 @@ class ContainerRegistryDeleteCommand extends mod_js_1.Command {
23
23
  * Parse the response
24
24
  */
25
25
  parseResponse(response) {
26
- console.log(response);
27
26
  return (0, mod_js_1.parseResponseHelper)(container_js_1.ContainerRegistryDeleteSchema, response);
28
27
  }
29
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"container-registry.update.d.ts","sourceRoot":"","sources":["../../../src/commands/container-registry/container-registry.update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,8BAA8B,CAAA;AAG9F,UAAU,4BAA4B;IACpC,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,8BAA+B,SAAQ,OAAO,CAAC,4BAA4B,EAAE,iBAAiB,CAAC;cACvF,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAGvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,iBAAiB;CAIvE"}
1
+ {"version":3,"file":"container-registry.update.d.ts","sourceRoot":"","sources":["../../../src/commands/container-registry/container-registry.update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,8BAA8B,CAAA;AAG9F,UAAU,4BAA4B;IACpC,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,8BAA+B,SAAQ,OAAO,CAAC,4BAA4B,EAAE,iBAAiB,CAAC;cACvF,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAGvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,iBAAiB;CAGvE"}
@@ -24,7 +24,6 @@ class ContainerRegistryUpdateCommand extends command_js_1.Command {
24
24
  * Parse the response
25
25
  */
26
26
  parseResponse(response) {
27
- //console.log(response)
28
27
  return (0, parse_response_helper_js_1.parseResponseHelper)(container_js_1.ContainerRegistrySchema, response);
29
28
  }
30
29
  }
@@ -11,6 +11,7 @@ export interface DataCoreDeleteRequestInput {
11
11
  }
12
12
  /**
13
13
  * Request to delete a data core
14
+ * @deprecated Use `DataCoreRequestDeleteCommand` instead
14
15
  */
15
16
  export declare class DataCoreDeleteRequestCommand extends GraphQlCommand<DataCoreDeleteRequestInput, boolean> {
16
17
  /**
@@ -1 +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,WAAW,0BAA0B;IACzC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AA4BD;;GAEG;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
+ {"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,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"}
@@ -33,6 +33,7 @@ const responseSchema = typebox_1.Type.Object({
33
33
  });
34
34
  /**
35
35
  * Request to delete a data core
36
+ * @deprecated Use `DataCoreRequestDeleteCommand` instead
36
37
  */
37
38
  class DataCoreDeleteRequestCommand extends command_js_1.GraphQlCommand {
38
39
  /**
@@ -0,0 +1,49 @@
1
+ import { Command } from "../../common/command.js";
2
+ import type { ClientError } from "../../exceptions/client-error.js";
3
+ import type { FlowcoreClient } from "../../common/flowcore-client.js";
4
+ /**
5
+ * The input for the data core request delete command
6
+ */
7
+ export interface DataCoreRequestDeleteInput {
8
+ /** The id of the data core */
9
+ dataCoreId: string;
10
+ /** Wait for the data core to be deleted (default: false) */
11
+ waitForDelete?: boolean;
12
+ }
13
+ /**
14
+ * The output for the data core request delete command
15
+ */
16
+ export interface DataCoreRequestDeleteOutput {
17
+ /** The success of the data core delete request */
18
+ success: boolean;
19
+ }
20
+ /**
21
+ * Request to delete a data core
22
+ */
23
+ export declare class DataCoreRequestDeleteCommand extends Command<DataCoreRequestDeleteInput, DataCoreRequestDeleteOutput> {
24
+ /**
25
+ * Get the method
26
+ */
27
+ protected getMethod(): string;
28
+ /**
29
+ * Get the base url
30
+ */
31
+ protected getBaseUrl(): string;
32
+ /**
33
+ * Get the path
34
+ */
35
+ protected getPath(): string;
36
+ /**
37
+ * Parse the response
38
+ */
39
+ protected parseResponse(rawResponse: unknown): DataCoreRequestDeleteOutput;
40
+ /**
41
+ * Handle the client error
42
+ */
43
+ protected handleClientError(error: ClientError): void;
44
+ /**
45
+ * Wait for the response (timeout: 25 seconds)
46
+ */
47
+ protected processResponse(client: FlowcoreClient, response: DataCoreRequestDeleteOutput): Promise<DataCoreRequestDeleteOutput>;
48
+ }
49
+ //# sourceMappingURL=data-core.request-delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-core.request-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.request-delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAGrE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,OAAO,CAAC,0BAA0B,EAAE,2BAA2B,CAAC;IAChH;;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,2BAA2B;IAUnF;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAS9D;;OAEG;cACsB,eAAe,CACtC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,2BAA2B,GACpC,OAAO,CAAC,2BAA2B,CAAC;CAkBxC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataCoreRequestDeleteCommand = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const command_js_1 = require("../../common/command.js");
6
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
7
+ const not_found_js_1 = require("../../exceptions/not-found.js");
8
+ const data_core_exists_js_1 = require("./data-core.exists.js");
9
+ /**
10
+ * Request to delete a data core
11
+ */
12
+ class DataCoreRequestDeleteCommand extends command_js_1.Command {
13
+ /**
14
+ * Get the method
15
+ */
16
+ getMethod() {
17
+ return "DELETE";
18
+ }
19
+ /**
20
+ * Get the base url
21
+ */
22
+ getBaseUrl() {
23
+ return "https://delete-manager.api.flowcore.io";
24
+ }
25
+ /**
26
+ * Get the path
27
+ */
28
+ getPath() {
29
+ return `/api/v1/data-cores/${this.input.dataCoreId}/request-delete`;
30
+ }
31
+ /**
32
+ * Parse the response
33
+ */
34
+ parseResponse(rawResponse) {
35
+ const response = (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Object({
36
+ success: typebox_1.Type.Boolean(),
37
+ }), rawResponse);
38
+ return response;
39
+ }
40
+ /**
41
+ * Handle the client error
42
+ */
43
+ handleClientError(error) {
44
+ if (error.status === 404) {
45
+ throw new not_found_js_1.NotFoundException("DataCore", {
46
+ "id": this.input.dataCoreId,
47
+ });
48
+ }
49
+ throw error;
50
+ }
51
+ /**
52
+ * Wait for the response (timeout: 25 seconds)
53
+ */
54
+ async processResponse(client, response) {
55
+ if (!this.input.waitForDelete) {
56
+ return response;
57
+ }
58
+ const start = Date.now();
59
+ while (Date.now() - start < 25_000) {
60
+ const response = await client.execute(new data_core_exists_js_1.DataCoreExistsCommand({
61
+ dataCoreId: this.input.dataCoreId,
62
+ }));
63
+ if (!response.exists) {
64
+ break;
65
+ }
66
+ await new Promise((resolve) => setTimeout(resolve, 100));
67
+ }
68
+ return response;
69
+ }
70
+ }
71
+ exports.DataCoreRequestDeleteCommand = DataCoreRequestDeleteCommand;
@@ -11,6 +11,7 @@ export interface EventTypeDeleteRequestInput {
11
11
  }
12
12
  /**
13
13
  * Request to delete a event type
14
+ * @deprecated Use `EventTypeRequestDeleteCommand` instead
14
15
  */
15
16
  export declare class EventTypeDeleteRequestCommand extends GraphQlCommand<EventTypeDeleteRequestInput, boolean> {
16
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"event-type.delete-request.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.delete-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,2BAA2B;IAC1C,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IAEnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AA+BD;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,cAAc,CAAC,2BAA2B,EAAE,OAAO,CAAC;IACrG;;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,2BAA2B;IAO9C;;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
+ {"version":3,"file":"event-type.delete-request.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.delete-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,2BAA2B;IAC1C,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IAEnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AA+BD;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,cAAc,CAAC,2BAA2B,EAAE,OAAO,CAAC;IACrG;;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,2BAA2B;IAO9C;;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"}
@@ -36,6 +36,7 @@ const responseSchema = typebox_1.Type.Object({
36
36
  });
37
37
  /**
38
38
  * Request to delete a event type
39
+ * @deprecated Use `EventTypeRequestDeleteCommand` instead
39
40
  */
40
41
  class EventTypeDeleteRequestCommand extends command_js_1.GraphQlCommand {
41
42
  /**
@@ -0,0 +1,48 @@
1
+ import { Command } from "../../common/command.js";
2
+ import type { ClientError } from "../../exceptions/client-error.js";
3
+ import type { FlowcoreClient } from "../../common/flowcore-client.js";
4
+ /**
5
+ * The input for the event type request delete command
6
+ */
7
+ export interface EventTypeRequestDeleteInput {
8
+ /** The id of the event type */
9
+ eventTypeId: string;
10
+ /** Wait for the event type to be deleted (default: false) */
11
+ waitForDelete?: boolean;
12
+ }
13
+ /**
14
+ * The output for the event type request delete command
15
+ */
16
+ export interface EventTypeRequestDeleteOutput {
17
+ success: boolean;
18
+ }
19
+ /**
20
+ * Request to delete an event type
21
+ */
22
+ export declare class EventTypeRequestDeleteCommand extends Command<EventTypeRequestDeleteInput, EventTypeRequestDeleteOutput> {
23
+ /**
24
+ * Get the method
25
+ */
26
+ protected getMethod(): string;
27
+ /**
28
+ * Get the base url
29
+ */
30
+ protected getBaseUrl(): string;
31
+ /**
32
+ * Get the path
33
+ */
34
+ protected getPath(): string;
35
+ /**
36
+ * Parse the response
37
+ */
38
+ protected parseResponse(rawResponse: unknown): EventTypeRequestDeleteOutput;
39
+ /**
40
+ * Handle the client error
41
+ */
42
+ protected handleClientError(error: ClientError): void;
43
+ /**
44
+ * Wait for the response (timeout: 25 seconds)
45
+ */
46
+ protected processResponse(client: FlowcoreClient, response: EventTypeRequestDeleteOutput): Promise<EventTypeRequestDeleteOutput>;
47
+ }
48
+ //# sourceMappingURL=event-type.request-delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-type.request-delete.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.request-delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,OAAO,CAAC,2BAA2B,EAAE,4BAA4B,CAAC;IACnH;;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,4BAA4B;IAUpF;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAS9D;;OAEG;cACsB,eAAe,CACtC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,4BAA4B,GACrC,OAAO,CAAC,4BAA4B,CAAC;CAkBzC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventTypeRequestDeleteCommand = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const command_js_1 = require("../../common/command.js");
6
+ const not_found_js_1 = require("../../exceptions/not-found.js");
7
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
+ const event_type_exists_js_1 = require("./event-type.exists.js");
9
+ /**
10
+ * Request to delete an event type
11
+ */
12
+ class EventTypeRequestDeleteCommand extends command_js_1.Command {
13
+ /**
14
+ * Get the method
15
+ */
16
+ getMethod() {
17
+ return "DELETE";
18
+ }
19
+ /**
20
+ * Get the base url
21
+ */
22
+ getBaseUrl() {
23
+ return "https://delete-manager.api.flowcore.io";
24
+ }
25
+ /**
26
+ * Get the path
27
+ */
28
+ getPath() {
29
+ return `/api/v1/event-types/${this.input.eventTypeId}/request-delete`;
30
+ }
31
+ /**
32
+ * Parse the response
33
+ */
34
+ parseResponse(rawResponse) {
35
+ const response = (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Object({
36
+ success: typebox_1.Type.Boolean(),
37
+ }), rawResponse);
38
+ return response;
39
+ }
40
+ /**
41
+ * Handle the client error
42
+ */
43
+ handleClientError(error) {
44
+ if (error.status === 404) {
45
+ throw new not_found_js_1.NotFoundException("EventType", {
46
+ [this.input.eventTypeId ? "id" : "name"]: this.input.eventTypeId ?? this.input.eventTypeId,
47
+ });
48
+ }
49
+ throw error;
50
+ }
51
+ /**
52
+ * Wait for the response (timeout: 25 seconds)
53
+ */
54
+ async processResponse(client, response) {
55
+ if (!this.input.waitForDelete) {
56
+ return response;
57
+ }
58
+ const start = Date.now();
59
+ while (Date.now() - start < 25_000) {
60
+ const response = await client.execute(new event_type_exists_js_1.EventTypeExistsCommand({
61
+ eventTypeId: this.input.eventTypeId,
62
+ }));
63
+ if (!response.exists) {
64
+ break;
65
+ }
66
+ await new Promise((resolve) => setTimeout(resolve, 100));
67
+ }
68
+ return response;
69
+ }
70
+ }
71
+ exports.EventTypeRequestDeleteCommand = EventTypeRequestDeleteCommand;