@flowcore/sdk 1.9.2 → 1.10.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 (150) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/esm/commands/api-key/api-key.create.d.ts +11 -3
  3. package/esm/commands/api-key/api-key.create.d.ts.map +1 -1
  4. package/esm/commands/api-key/api-key.create.js +22 -11
  5. package/esm/commands/api-key/api-key.delete.d.ts +1 -1
  6. package/esm/commands/api-key/api-key.delete.d.ts.map +1 -1
  7. package/esm/commands/api-key/api-key.delete.js +2 -2
  8. package/esm/commands/api-key/api-key.list.d.ts +1 -1
  9. package/esm/commands/api-key/api-key.list.d.ts.map +1 -1
  10. package/esm/commands/api-key/api-key.list.js +2 -2
  11. package/esm/commands/data-core/data-core.delete-request.d.ts +2 -6
  12. package/esm/commands/data-core/data-core.delete-request.d.ts.map +1 -1
  13. package/esm/commands/data-core/data-core.delete-request.js +4 -13
  14. package/esm/commands/data-core/data-core.fetch.d.ts +5 -0
  15. package/esm/commands/data-core/data-core.fetch.d.ts.map +1 -1
  16. package/esm/commands/data-core/data-core.fetch.js +12 -1
  17. package/esm/commands/data-core/data-core.update.d.ts +1 -1
  18. package/esm/commands/data-core/data-core.update.d.ts.map +1 -1
  19. package/esm/commands/data-core/data-core.update.js +1 -1
  20. package/esm/commands/event-type/event-type.delete-request.d.ts +2 -2
  21. package/esm/commands/event-type/event-type.delete-request.d.ts.map +1 -1
  22. package/esm/commands/event-type/event-type.delete-request.js +4 -4
  23. package/esm/commands/event-type/event-type.fetch.d.ts +5 -0
  24. package/esm/commands/event-type/event-type.fetch.d.ts.map +1 -1
  25. package/esm/commands/event-type/event-type.fetch.js +12 -1
  26. package/esm/commands/event-type/event-type.update.d.ts +2 -2
  27. package/esm/commands/event-type/event-type.update.d.ts.map +1 -1
  28. package/esm/commands/event-type/event-type.update.js +2 -2
  29. package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts +1 -1
  30. package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -1
  31. package/esm/commands/events/events.fetch-time-buckets-by-names.js +2 -1
  32. package/esm/commands/events/events.fetch.d.ts +1 -1
  33. package/esm/commands/events/events.fetch.d.ts.map +1 -1
  34. package/esm/commands/events/events.fetch.js +2 -2
  35. package/esm/commands/flow-type/flow-type.delete-request.d.ts +6 -4
  36. package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
  37. package/esm/commands/flow-type/flow-type.delete-request.js +4 -4
  38. package/esm/commands/flow-type/flow-type.fetch.d.ts +5 -0
  39. package/esm/commands/flow-type/flow-type.fetch.d.ts.map +1 -1
  40. package/esm/commands/flow-type/flow-type.fetch.js +12 -1
  41. package/esm/commands/flow-type/flow-type.update.d.ts +2 -2
  42. package/esm/commands/flow-type/flow-type.update.d.ts.map +1 -1
  43. package/esm/commands/flow-type/flow-type.update.js +1 -1
  44. package/esm/commands/secret/secret.create.d.ts +1 -1
  45. package/esm/commands/secret/secret.create.d.ts.map +1 -1
  46. package/esm/commands/secret/secret.create.js +2 -2
  47. package/esm/commands/secret/secret.delete.d.ts +1 -1
  48. package/esm/commands/secret/secret.delete.d.ts.map +1 -1
  49. package/esm/commands/secret/secret.delete.js +2 -3
  50. package/esm/commands/secret/secret.list.d.ts +1 -1
  51. package/esm/commands/secret/secret.list.d.ts.map +1 -1
  52. package/esm/commands/secret/secret.list.js +2 -2
  53. package/esm/commands/tenant/tenant.fetch.d.ts +1 -1
  54. package/esm/commands/tenant/tenant.fetch.d.ts.map +1 -1
  55. package/esm/commands/tenant/tenant.fetch.js +7 -5
  56. package/esm/commands/tenant/tenant.list.d.ts +1 -1
  57. package/esm/commands/tenant/tenant.list.d.ts.map +1 -1
  58. package/esm/commands/tenant/tenant.list.js +2 -2
  59. package/esm/commands/variable/variable.create.d.ts +1 -1
  60. package/esm/commands/variable/variable.create.d.ts.map +1 -1
  61. package/esm/commands/variable/variable.create.js +2 -2
  62. package/esm/commands/variable/variable.delete.d.ts +1 -1
  63. package/esm/commands/variable/variable.delete.d.ts.map +1 -1
  64. package/esm/commands/variable/variable.delete.js +2 -2
  65. package/esm/commands/variable/variable.list.d.ts +1 -1
  66. package/esm/commands/variable/variable.list.d.ts.map +1 -1
  67. package/esm/commands/variable/variable.list.js +2 -2
  68. package/esm/common/command.d.ts +23 -6
  69. package/esm/common/command.d.ts.map +1 -1
  70. package/esm/common/command.js +33 -5
  71. package/esm/common/flowcore-client.d.ts.map +1 -1
  72. package/esm/common/flowcore-client.js +15 -9
  73. package/esm/exceptions/not-found.d.ts +1 -1
  74. package/esm/exceptions/not-found.d.ts.map +1 -1
  75. package/esm/exceptions/not-found.js +2 -2
  76. package/package.json +1 -1
  77. package/script/commands/api-key/api-key.create.d.ts +11 -3
  78. package/script/commands/api-key/api-key.create.d.ts.map +1 -1
  79. package/script/commands/api-key/api-key.create.js +22 -11
  80. package/script/commands/api-key/api-key.delete.d.ts +1 -1
  81. package/script/commands/api-key/api-key.delete.d.ts.map +1 -1
  82. package/script/commands/api-key/api-key.delete.js +2 -2
  83. package/script/commands/api-key/api-key.list.d.ts +1 -1
  84. package/script/commands/api-key/api-key.list.d.ts.map +1 -1
  85. package/script/commands/api-key/api-key.list.js +2 -2
  86. package/script/commands/data-core/data-core.delete-request.d.ts +2 -6
  87. package/script/commands/data-core/data-core.delete-request.d.ts.map +1 -1
  88. package/script/commands/data-core/data-core.delete-request.js +4 -13
  89. package/script/commands/data-core/data-core.fetch.d.ts +5 -0
  90. package/script/commands/data-core/data-core.fetch.d.ts.map +1 -1
  91. package/script/commands/data-core/data-core.fetch.js +12 -1
  92. package/script/commands/data-core/data-core.update.d.ts +1 -1
  93. package/script/commands/data-core/data-core.update.d.ts.map +1 -1
  94. package/script/commands/data-core/data-core.update.js +1 -1
  95. package/script/commands/event-type/event-type.delete-request.d.ts +2 -2
  96. package/script/commands/event-type/event-type.delete-request.d.ts.map +1 -1
  97. package/script/commands/event-type/event-type.delete-request.js +4 -4
  98. package/script/commands/event-type/event-type.fetch.d.ts +5 -0
  99. package/script/commands/event-type/event-type.fetch.d.ts.map +1 -1
  100. package/script/commands/event-type/event-type.fetch.js +12 -1
  101. package/script/commands/event-type/event-type.update.d.ts +2 -2
  102. package/script/commands/event-type/event-type.update.d.ts.map +1 -1
  103. package/script/commands/event-type/event-type.update.js +2 -2
  104. package/script/commands/events/events.fetch-time-buckets-by-names.d.ts +1 -1
  105. package/script/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -1
  106. package/script/commands/events/events.fetch-time-buckets-by-names.js +2 -1
  107. package/script/commands/events/events.fetch.d.ts +1 -1
  108. package/script/commands/events/events.fetch.d.ts.map +1 -1
  109. package/script/commands/events/events.fetch.js +2 -2
  110. package/script/commands/flow-type/flow-type.delete-request.d.ts +6 -4
  111. package/script/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
  112. package/script/commands/flow-type/flow-type.delete-request.js +4 -4
  113. package/script/commands/flow-type/flow-type.fetch.d.ts +5 -0
  114. package/script/commands/flow-type/flow-type.fetch.d.ts.map +1 -1
  115. package/script/commands/flow-type/flow-type.fetch.js +12 -1
  116. package/script/commands/flow-type/flow-type.update.d.ts +2 -2
  117. package/script/commands/flow-type/flow-type.update.d.ts.map +1 -1
  118. package/script/commands/flow-type/flow-type.update.js +1 -1
  119. package/script/commands/secret/secret.create.d.ts +1 -1
  120. package/script/commands/secret/secret.create.d.ts.map +1 -1
  121. package/script/commands/secret/secret.create.js +2 -2
  122. package/script/commands/secret/secret.delete.d.ts +1 -1
  123. package/script/commands/secret/secret.delete.d.ts.map +1 -1
  124. package/script/commands/secret/secret.delete.js +2 -3
  125. package/script/commands/secret/secret.list.d.ts +1 -1
  126. package/script/commands/secret/secret.list.d.ts.map +1 -1
  127. package/script/commands/secret/secret.list.js +2 -2
  128. package/script/commands/tenant/tenant.fetch.d.ts +1 -1
  129. package/script/commands/tenant/tenant.fetch.d.ts.map +1 -1
  130. package/script/commands/tenant/tenant.fetch.js +7 -5
  131. package/script/commands/tenant/tenant.list.d.ts +1 -1
  132. package/script/commands/tenant/tenant.list.d.ts.map +1 -1
  133. package/script/commands/tenant/tenant.list.js +2 -2
  134. package/script/commands/variable/variable.create.d.ts +1 -1
  135. package/script/commands/variable/variable.create.d.ts.map +1 -1
  136. package/script/commands/variable/variable.create.js +2 -2
  137. package/script/commands/variable/variable.delete.d.ts +1 -1
  138. package/script/commands/variable/variable.delete.d.ts.map +1 -1
  139. package/script/commands/variable/variable.delete.js +2 -2
  140. package/script/commands/variable/variable.list.d.ts +1 -1
  141. package/script/commands/variable/variable.list.d.ts.map +1 -1
  142. package/script/commands/variable/variable.list.js +2 -2
  143. package/script/common/command.d.ts +23 -6
  144. package/script/common/command.d.ts.map +1 -1
  145. package/script/common/command.js +33 -5
  146. package/script/common/flowcore-client.d.ts.map +1 -1
  147. package/script/common/flowcore-client.js +15 -9
  148. package/script/exceptions/not-found.d.ts +1 -1
  149. package/script/exceptions/not-found.d.ts.map +1 -1
  150. package/script/exceptions/not-found.js +2 -2
@@ -41,8 +41,19 @@ export class FlowTypeFetchCommand extends Command {
41
41
  }
42
42
  const response = parseResponseHelper(Type.Array(FlowTypeSchema), rawResponse);
43
43
  if (response.length === 0) {
44
- throw new NotFoundException("FlowType", this.input.flowType);
44
+ throw new NotFoundException("FlowType", { name: this.input.flowType });
45
45
  }
46
46
  return response[0];
47
47
  }
48
+ /**
49
+ * Handle the client error
50
+ */
51
+ handleClientError(error) {
52
+ if (error.status === 404) {
53
+ throw new NotFoundException("FlowType", {
54
+ [this.input.flowTypeId ? "id" : "name"]: this.input.flowTypeId ?? this.input.flowType,
55
+ });
56
+ }
57
+ throw error;
58
+ }
48
59
  }
@@ -7,7 +7,7 @@ export type FlowTypeUpdateInput = {
7
7
  /** The id of the data core */
8
8
  flowTypeId: string;
9
9
  /** The description of the flow type */
10
- description: string;
10
+ description?: string;
11
11
  };
12
12
  /**
13
13
  * Update a flow type
@@ -28,7 +28,7 @@ export declare class FlowTypeUpdateCommand extends Command<FlowTypeUpdateInput,
28
28
  /**
29
29
  * Get the body for the request
30
30
  */
31
- protected getBody(): string | undefined;
31
+ protected getBody(): Record<string, unknown>;
32
32
  /**
33
33
  * Parse the response
34
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flow-type.update.d.ts","sourceRoot":"","sources":["../../../src/commands/flow-type/flow-type.update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,OAAO,IAAI,MAAM,GAAG,SAAS;IAKhD;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
1
+ {"version":3,"file":"flow-type.update.d.ts","sourceRoot":"","sources":["../../../src/commands/flow-type/flow-type.update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKrD;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
@@ -28,7 +28,7 @@ export class FlowTypeUpdateCommand extends Command {
28
28
  */
29
29
  getBody() {
30
30
  const { flowTypeId: _flowTypeId, ...payload } = this.input;
31
- return JSON.stringify(payload);
31
+ return payload;
32
32
  }
33
33
  /**
34
34
  * Parse the response
@@ -25,6 +25,6 @@ export declare class SecretCreateCommand extends GraphQlCommand<SecretCreateInpu
25
25
  /**
26
26
  * Get the body for the request
27
27
  */
28
- protected getBody(): string;
28
+ protected getBody(): Record<string, unknown>;
29
29
  }
30
30
  //# sourceMappingURL=secret.create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"secret.create.d.ts","sourceRoot":"","sources":["../../../src/commands/secret/secret.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAA;CACd;AAyBD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"secret.create.d.ts","sourceRoot":"","sources":["../../../src/commands/secret/secret.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAA;CACd;AAyBD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -52,9 +52,9 @@ export class SecretCreateCommand extends GraphQlCommand {
52
52
  * Get the body for the request
53
53
  */
54
54
  getBody() {
55
- return JSON.stringify({
55
+ return {
56
56
  query: graphQlQueryById,
57
57
  variables: this.input,
58
- });
58
+ };
59
59
  }
60
60
  }
@@ -23,6 +23,6 @@ export declare class SecretDeleteCommand extends GraphQlCommand<SecretDeleteInpu
23
23
  /**
24
24
  * Get the body for the request
25
25
  */
26
- protected getBody(): string;
26
+ protected getBody(): Record<string, unknown>;
27
27
  }
28
28
  //# sourceMappingURL=secret.delete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"secret.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/secret/secret.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAA;CACZ;AAyBD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAY/D;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"secret.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/secret/secret.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAA;CACZ;AAyBD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -39,7 +39,6 @@ export class SecretDeleteCommand extends GraphQlCommand {
39
39
  * Parse the response
40
40
  */
41
41
  parseResponse(rawResponse) {
42
- console.log("rawResponse", rawResponse);
43
42
  const response = parseResponseHelper(responseSchema, rawResponse);
44
43
  if (response.errors) {
45
44
  throw new CommandError(this.constructor.name, response.errors[0].message);
@@ -53,9 +52,9 @@ export class SecretDeleteCommand extends GraphQlCommand {
53
52
  * Get the body for the request
54
53
  */
55
54
  getBody() {
56
- return JSON.stringify({
55
+ return {
57
56
  query: graphQlQueryById,
58
57
  variables: this.input,
59
- });
58
+ };
60
59
  }
61
60
  }
@@ -21,6 +21,6 @@ export declare class SecretListCommand extends GraphQlCommand<SecretListInput, s
21
21
  /**
22
22
  * Get the body for the request
23
23
  */
24
- protected getBody(): string;
24
+ protected getBody(): Record<string, unknown>;
25
25
  }
26
26
  //# sourceMappingURL=secret.list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"secret.list.d.ts","sourceRoot":"","sources":["../../../src/commands/secret/secret.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA4BD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC9E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE;IAWhE;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"secret.list.d.ts","sourceRoot":"","sources":["../../../src/commands/secret/secret.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA4BD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC9E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE;IAWhE;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -55,9 +55,9 @@ export class SecretListCommand extends GraphQlCommand {
55
55
  * Get the body for the request
56
56
  */
57
57
  getBody() {
58
- return JSON.stringify({
58
+ return {
59
59
  query: graphQlQueryById,
60
60
  variables: this.input,
61
- });
61
+ };
62
62
  }
63
63
  }
@@ -37,7 +37,7 @@ export declare class TenantFetchCommand extends GraphQlCommand<TenantFetchInput,
37
37
  /**
38
38
  * Get the body for the request
39
39
  */
40
- protected getBody(): string;
40
+ protected getBody(): Record<string, unknown>;
41
41
  }
42
42
  export {};
43
43
  //# sourceMappingURL=tenant.fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,KAAK,MAAM,EAAoC,MAAM,2BAA2B,CAAA;AAIzF;;GAEG;AACH,KAAK,oBAAoB,GAAG;IAC1B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,KAAK,CAAA;CACf,CAAA;AAED;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC5B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,sBAAsB,CAAA;AAmC5E;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC9E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM;IAQ9D;;OAEG;cACgB,OAAO,IAAI,MAAM;CAYrC"}
1
+ {"version":3,"file":"tenant.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,KAAK,MAAM,EAAoC,MAAM,2BAA2B,CAAA;AAIzF;;GAEG;AACH,KAAK,oBAAoB,GAAG;IAC1B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,KAAK,CAAA;CACf,CAAA;AAED;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC5B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,sBAAsB,CAAA;AAmC5E;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC9E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM;IAU9D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAYtD"}
@@ -55,7 +55,9 @@ export class TenantFetchCommand extends GraphQlCommand {
55
55
  parseResponse(rawResponse) {
56
56
  const response = parseResponseHelper(responseSchema, rawResponse);
57
57
  if (!response.data.organization) {
58
- throw new NotFoundException("Tenant", this.input.tenantId ?? this.input.tenant);
58
+ throw new NotFoundException("Tenant", {
59
+ [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant,
60
+ });
59
61
  }
60
62
  return tenantV0ToTenant(response.data.organization);
61
63
  }
@@ -64,14 +66,14 @@ export class TenantFetchCommand extends GraphQlCommand {
64
66
  */
65
67
  getBody() {
66
68
  if ("tenantId" in this.input) {
67
- return JSON.stringify({
69
+ return {
68
70
  query: graphQlQueryById,
69
71
  variables: this.input,
70
- });
72
+ };
71
73
  }
72
- return JSON.stringify({
74
+ return {
73
75
  query: graphQlQueryByName,
74
76
  variables: this.input,
75
- });
77
+ };
76
78
  }
77
79
  }
@@ -15,6 +15,6 @@ export declare class TenantListCommand extends GraphQlCommand<Record<string, nev
15
15
  /**
16
16
  * Get the body for the request
17
17
  */
18
- protected getBody(): string;
18
+ protected getBody(): Record<string, unknown>;
19
19
  }
20
20
  //# sourceMappingURL=tenant.list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.list.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AA+BrG;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAChG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,kBAAkB,EAAE;IAQ5E;;OAEG;cACgB,OAAO,IAAI,MAAM;CAKrC"}
1
+ {"version":3,"file":"tenant.list.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AA+BrG;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAChG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,kBAAkB,EAAE;IAQ5E;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAKtD"}
@@ -58,8 +58,8 @@ export class TenantListCommand extends GraphQlCommand {
58
58
  * Get the body for the request
59
59
  */
60
60
  getBody() {
61
- return JSON.stringify({
61
+ return {
62
62
  query: graphQlQueryById,
63
- });
63
+ };
64
64
  }
65
65
  }
@@ -26,6 +26,6 @@ export declare class VariableCreateCommand extends GraphQlCommand<VariableCreate
26
26
  /**
27
27
  * Get the body for the request
28
28
  */
29
- protected getBody(): string;
29
+ protected getBody(): Record<string, unknown>;
30
30
  }
31
31
  //# sourceMappingURL=variable.create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable.create.d.ts","sourceRoot":"","sources":["../../../src/commands/variable/variable.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAG3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;CACd;AA4BD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IACtF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;IAchE;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"variable.create.d.ts","sourceRoot":"","sources":["../../../src/commands/variable/variable.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAG3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;CACd;AA4BD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IACtF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;IAchE;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -58,9 +58,9 @@ export class VariableCreateCommand extends GraphQlCommand {
58
58
  * Get the body for the request
59
59
  */
60
60
  getBody() {
61
- return JSON.stringify({
61
+ return {
62
62
  query: graphQlQueryById,
63
63
  variables: this.input,
64
- });
64
+ };
65
65
  }
66
66
  }
@@ -23,6 +23,6 @@ export declare class VariableDeleteCommand extends GraphQlCommand<VariableDelete
23
23
  /**
24
24
  * Get the body for the request
25
25
  */
26
- protected getBody(): string;
26
+ protected getBody(): Record<string, unknown>;
27
27
  }
28
28
  //# sourceMappingURL=variable.delete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/variable/variable.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;CACZ;AA4BD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACrF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"variable.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/variable/variable.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;CACZ;AA4BD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACrF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -55,9 +55,9 @@ export class VariableDeleteCommand extends GraphQlCommand {
55
55
  * Get the body for the request
56
56
  */
57
57
  getBody() {
58
- return JSON.stringify({
58
+ return {
59
59
  query: graphQlQueryById,
60
60
  variables: this.input,
61
- });
61
+ };
62
62
  }
63
63
  }
@@ -22,6 +22,6 @@ export declare class VariableListCommand extends GraphQlCommand<VariableListInpu
22
22
  /**
23
23
  * Get the body for the request
24
24
  */
25
- protected getBody(): string;
25
+ protected getBody(): Record<string, unknown>;
26
26
  }
27
27
  //# sourceMappingURL=variable.list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable.list.d.ts","sourceRoot":"","sources":["../../../src/commands/variable/variable.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAG3D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAkCD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IACpF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,EAAE;IAWlE;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"variable.list.d.ts","sourceRoot":"","sources":["../../../src/commands/variable/variable.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAG3D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAkCD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IACpF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,EAAE;IAWlE;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -61,9 +61,9 @@ export class VariableListCommand extends GraphQlCommand {
61
61
  * Get the body for the request
62
62
  */
63
63
  getBody() {
64
- return JSON.stringify({
64
+ return {
65
65
  query: graphQlQueryById,
66
66
  variables: this.input,
67
- });
67
+ };
68
68
  }
69
69
  }
@@ -1,3 +1,4 @@
1
+ import type { ClientError } from "../exceptions/client-error.js";
1
2
  import type { FlowcoreClient } from "./flowcore-client.js";
2
3
  /**
3
4
  * Abstract command for executing requests
@@ -27,7 +28,7 @@ export declare abstract class Command<Input, Output> {
27
28
  /**
28
29
  * Get the body for the request
29
30
  */
30
- protected getBody(): string | undefined;
31
+ protected getBody(): Record<string, unknown> | Array<unknown> | undefined;
31
32
  /**
32
33
  * Get the headers for the request
33
34
  */
@@ -35,29 +36,45 @@ export declare abstract class Command<Input, Output> {
35
36
  /**
36
37
  * Parse the response
37
38
  */
38
- protected abstract parseResponse(response: unknown, flowcoreClient: FlowcoreClient): Output | Promise<Output>;
39
+ protected abstract parseResponse(response: unknown): Output;
40
+ /**
41
+ * Handle the client error
42
+ */
43
+ protected handleClientError(error: ClientError): void;
39
44
  /**
40
45
  * Get the request object
41
46
  */
42
47
  getRequest(_client: FlowcoreClient): Promise<{
43
48
  allowedModes: ("apiKey" | "bearer")[];
44
- body: string | undefined;
49
+ body: string | Record<string, unknown> | Array<unknown> | undefined;
45
50
  headers: Record<string, string>;
46
51
  baseUrl: string;
47
52
  path: string;
48
53
  method: string;
49
- parseResponse: (response: unknown, client: FlowcoreClient) => Output | Promise<Output>;
50
- waitForResponse: (client: FlowcoreClient, response: Output) => Promise<Output>;
54
+ parseResponse: (response: unknown) => Output | Promise<Output>;
55
+ processResponse: (client: FlowcoreClient, response: Output) => Promise<Output>;
56
+ handleClientError: (error: ClientError) => void;
51
57
  }>;
52
58
  /**
53
59
  * Wait for the response
54
60
  */
55
- protected waitForResponse(_client: FlowcoreClient, response: Output): Promise<Output>;
61
+ protected processResponse(_client: FlowcoreClient, response: Output): Promise<Output>;
56
62
  }
57
63
  /**
58
64
  * Abstract command for executing GraphQL requests
59
65
  */
60
66
  export declare abstract class GraphQlCommand<Input, Output> extends Command<Input, Output> {
67
+ /**
68
+ * The allowed modes for the command
69
+ */
70
+ protected allowedModes: ("apiKey" | "bearer")[];
71
+ /**
72
+ * Get the base URL for the request
73
+ */
61
74
  protected getBaseUrl(): string;
75
+ /**
76
+ * Get the path for the request
77
+ */
78
+ protected getPath(): string;
62
79
  }
63
80
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/common/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D;;GAEG;AACH,8BAAsB,OAAO,CAAC,KAAK,EAAE,MAAM;IACzC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAuB;IAE/E;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;gBAEnB,KAAK,EAAE,KAAK;IAOxB;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAEvC;;OAEG;IACH,SAAS,CAAC,SAAS,IAAI,MAAM;IAI7B;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM;IAI3B;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM,GAAG,SAAS;IAOvC;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQ9C;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE7G;;OAEG;IAEU,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC;QACxD,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,E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KAAK,EAAE,MAAM,CAAE,SAAQ,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;IAChF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;CAGrC"}
@@ -45,18 +45,24 @@ export class Command {
45
45
  if (this.getMethod() === "GET") {
46
46
  return undefined;
47
47
  }
48
- return this.input ? JSON.stringify(this.input) : undefined;
48
+ return this.input ?? undefined;
49
49
  }
50
50
  /**
51
51
  * Get the headers for the request
52
52
  */
53
53
  getHeaders() {
54
- return this.getBody()
54
+ return typeof this.getBody() === "object"
55
55
  ? {
56
56
  "Content-Type": "application/json",
57
57
  }
58
58
  : {};
59
59
  }
60
+ /**
61
+ * Handle the client error
62
+ */
63
+ handleClientError(error) {
64
+ throw error;
65
+ }
60
66
  /**
61
67
  * Get the request object
62
68
  */
@@ -70,14 +76,15 @@ export class Command {
70
76
  path: this.getPath(),
71
77
  method: this.getMethod(),
72
78
  parseResponse: this.parseResponse.bind(this),
73
- waitForResponse: this.waitForResponse.bind(this),
79
+ processResponse: this.processResponse.bind(this),
80
+ handleClientError: this.handleClientError.bind(this),
74
81
  };
75
82
  }
76
83
  /**
77
84
  * Wait for the response
78
85
  */
79
86
  // deno-lint-ignore require-await
80
- async waitForResponse(_client, response) {
87
+ async processResponse(_client, response) {
81
88
  return response;
82
89
  }
83
90
  }
@@ -85,7 +92,28 @@ export class Command {
85
92
  * Abstract command for executing GraphQL requests
86
93
  */
87
94
  export class GraphQlCommand extends Command {
95
+ constructor() {
96
+ super(...arguments);
97
+ /**
98
+ * The allowed modes for the command
99
+ */
100
+ Object.defineProperty(this, "allowedModes", {
101
+ enumerable: true,
102
+ configurable: true,
103
+ writable: true,
104
+ value: ["bearer"]
105
+ });
106
+ }
107
+ /**
108
+ * Get the base URL for the request
109
+ */
88
110
  getBaseUrl() {
89
- return "https://graph.api.flowcore.io/graphql";
111
+ return "https://graph.api.flowcore.io";
112
+ }
113
+ /**
114
+ * Get the path for the request
115
+ */
116
+ getPath() {
117
+ return "/graphql";
90
118
  }
91
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"flowcore-client.d.ts","sourceRoot":"","sources":["../../src/common/flowcore-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAI3C;;GAEG;AACH,UAAU,mBAAmB;IAC3B,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAA;IAC5D,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAErE;;GAEG;AACH,qBAAa,cAAc;IAIb,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,OAAO,CAAoB;gBAEN,OAAO,EAAE,aAAa;IAiBnD;;OAEG;YACW,aAAa;IAc3B;;OAEG;YACW,YAAY;IA0D1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,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C,MAAM,CAAC;CAGzE"}
@@ -65,16 +65,21 @@ export class FlowcoreClient {
65
65
  throw new CommandError(command.constructor.name, `Not allowed in "${this.mode}" mode`);
66
66
  }
67
67
  const authHeader = await this.getAuthHeader();
68
+ const headers = {
69
+ ...request.headers,
70
+ ...(authHeader ? { Authorization: authHeader } : {}),
71
+ };
68
72
  let response;
69
73
  const url = this.baseUrl ? this.baseUrl + request.path : request.baseUrl + request.path;
74
+ let body;
75
+ if (typeof request.body === "object") {
76
+ body = JSON.stringify(request.body);
77
+ }
70
78
  try {
71
79
  response = await fetch(url, {
72
80
  method: request.method,
73
- headers: {
74
- ...request.headers,
75
- ...(authHeader ? { Authorization: authHeader } : {}),
76
- },
77
- body: request.body,
81
+ headers,
82
+ body,
78
83
  });
79
84
  }
80
85
  catch (error) {
@@ -98,11 +103,12 @@ export class FlowcoreClient {
98
103
  }
99
104
  const body = await response.json().catch(() => undefined);
100
105
  const commandName = command.constructor.name;
101
- throw new ClientError(`${commandName} failed with ${response.status}: ${response.statusText}`, response.status, body);
106
+ const error = new ClientError(`${commandName} failed with ${response.status}: ${response.statusText}`, response.status, body);
107
+ request.handleClientError(error);
102
108
  }
103
- const body = await response.json();
104
- const parsedBody = await request.parseResponse(body, this);
105
- return request.waitForResponse(this, parsedBody);
109
+ const responseBody = await response.json();
110
+ const parsedBody = await request.parseResponse(responseBody);
111
+ return request.processResponse(this, parsedBody);
106
112
  }
107
113
  /**
108
114
  * Override the base URL for all commands
@@ -2,6 +2,6 @@
2
2
  * An error thrown when a resource is not found
3
3
  */
4
4
  export declare class NotFoundException extends Error {
5
- constructor(resource: string, id: string);
5
+ constructor(resource: string, filters: Record<string, string>);
6
6
  }
7
7
  //# sourceMappingURL=not-found.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../src/exceptions/not-found.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;CAGzC"}
1
+ {"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../src/exceptions/not-found.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAG9D"}
@@ -2,7 +2,7 @@
2
2
  * An error thrown when a resource is not found
3
3
  */
4
4
  export class NotFoundException extends Error {
5
- constructor(resource, id) {
6
- super(`${resource} with id ${id} not found`);
5
+ constructor(resource, filters) {
6
+ super(`${resource} not found: ${JSON.stringify(filters)}`);
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/sdk",
3
- "version": "1.9.2",
3
+ "version": "1.10.0",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -23,12 +23,20 @@ export declare class ApiKeyCreateCommand extends GraphQlCommand<ApiKeyCreateInpu
23
23
  /**
24
24
  * Parse the response
25
25
  */
26
- protected parseResponse(rawResponse: unknown, flowcoreClient: FlowcoreClient): Promise<ApiKey & {
26
+ protected parseResponse(rawResponse: unknown): ApiKey & {
27
27
  value: string;
28
- }>;
28
+ };
29
29
  /**
30
30
  * Get the body for the request
31
31
  */
32
- protected getBody(): string;
32
+ protected getBody(): Record<string, unknown>;
33
+ /**
34
+ * Fill in the missing fields
35
+ */
36
+ protected processResponse(flowcoreClient: FlowcoreClient, response: ApiKey & {
37
+ value: string;
38
+ }): Promise<ApiKey & {
39
+ value: string;
40
+ }>;
33
41
  }
34
42
  //# sourceMappingURL=api-key.create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.create.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EA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