@flowcore/sdk 1.9.3 → 1.10.1

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 (180) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/esm/commands/api-key/api-key.create.d.ts +15 -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 +31 -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.create.d.ts +6 -2
  12. package/esm/commands/data-core/data-core.create.d.ts.map +1 -1
  13. package/esm/commands/data-core/data-core.create.js +12 -0
  14. package/esm/commands/data-core/data-core.delete-request.d.ts +6 -6
  15. package/esm/commands/data-core/data-core.delete-request.d.ts.map +1 -1
  16. package/esm/commands/data-core/data-core.delete-request.js +7 -7
  17. package/esm/commands/data-core/data-core.fetch.d.ts +8 -4
  18. package/esm/commands/data-core/data-core.fetch.d.ts.map +1 -1
  19. package/esm/commands/data-core/data-core.fetch.js +12 -1
  20. package/esm/commands/data-core/data-core.list.d.ts +2 -2
  21. package/esm/commands/data-core/data-core.list.d.ts.map +1 -1
  22. package/esm/commands/data-core/data-core.update.d.ts +3 -3
  23. package/esm/commands/data-core/data-core.update.d.ts.map +1 -1
  24. package/esm/commands/data-core/data-core.update.js +1 -1
  25. package/esm/commands/event-type/event-type.create.d.ts +6 -2
  26. package/esm/commands/event-type/event-type.create.d.ts.map +1 -1
  27. package/esm/commands/event-type/event-type.create.js +12 -0
  28. package/esm/commands/event-type/event-type.delete-request.d.ts +8 -4
  29. package/esm/commands/event-type/event-type.delete-request.d.ts.map +1 -1
  30. package/esm/commands/event-type/event-type.delete-request.js +13 -4
  31. package/esm/commands/event-type/event-type.fetch.d.ts +7 -3
  32. package/esm/commands/event-type/event-type.fetch.d.ts.map +1 -1
  33. package/esm/commands/event-type/event-type.fetch.js +12 -1
  34. package/esm/commands/event-type/event-type.list.d.ts +2 -2
  35. package/esm/commands/event-type/event-type.list.d.ts.map +1 -1
  36. package/esm/commands/event-type/event-type.update.d.ts +1 -1
  37. package/esm/commands/event-type/event-type.update.d.ts.map +1 -1
  38. package/esm/commands/event-type/event-type.update.js +2 -2
  39. package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts +1 -1
  40. package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -1
  41. package/esm/commands/events/events.fetch-time-buckets-by-names.js +2 -1
  42. package/esm/commands/events/events.fetch.d.ts +1 -1
  43. package/esm/commands/events/events.fetch.d.ts.map +1 -1
  44. package/esm/commands/events/events.fetch.js +2 -2
  45. package/esm/commands/flow-type/flow-type.create.d.ts +6 -2
  46. package/esm/commands/flow-type/flow-type.create.d.ts.map +1 -1
  47. package/esm/commands/flow-type/flow-type.create.js +12 -0
  48. package/esm/commands/flow-type/flow-type.delete-request.d.ts +13 -6
  49. package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
  50. package/esm/commands/flow-type/flow-type.delete-request.js +13 -4
  51. package/esm/commands/flow-type/flow-type.fetch.d.ts +9 -5
  52. package/esm/commands/flow-type/flow-type.fetch.d.ts.map +1 -1
  53. package/esm/commands/flow-type/flow-type.fetch.js +12 -1
  54. package/esm/commands/flow-type/flow-type.list.d.ts +2 -2
  55. package/esm/commands/flow-type/flow-type.list.d.ts.map +1 -1
  56. package/esm/commands/flow-type/flow-type.update.d.ts +3 -3
  57. package/esm/commands/flow-type/flow-type.update.d.ts.map +1 -1
  58. package/esm/commands/flow-type/flow-type.update.js +1 -1
  59. package/esm/commands/secret/secret.create.d.ts +1 -1
  60. package/esm/commands/secret/secret.create.d.ts.map +1 -1
  61. package/esm/commands/secret/secret.create.js +2 -2
  62. package/esm/commands/secret/secret.delete.d.ts +1 -1
  63. package/esm/commands/secret/secret.delete.d.ts.map +1 -1
  64. package/esm/commands/secret/secret.delete.js +2 -3
  65. package/esm/commands/secret/secret.list.d.ts +1 -1
  66. package/esm/commands/secret/secret.list.d.ts.map +1 -1
  67. package/esm/commands/secret/secret.list.js +2 -2
  68. package/esm/commands/tenant/tenant.fetch.d.ts +5 -6
  69. package/esm/commands/tenant/tenant.fetch.d.ts.map +1 -1
  70. package/esm/commands/tenant/tenant.fetch.js +7 -5
  71. package/esm/commands/tenant/tenant.list.d.ts +1 -1
  72. package/esm/commands/tenant/tenant.list.d.ts.map +1 -1
  73. package/esm/commands/tenant/tenant.list.js +2 -2
  74. package/esm/commands/variable/variable.create.d.ts +1 -1
  75. package/esm/commands/variable/variable.create.d.ts.map +1 -1
  76. package/esm/commands/variable/variable.create.js +2 -2
  77. package/esm/commands/variable/variable.delete.d.ts +1 -1
  78. package/esm/commands/variable/variable.delete.d.ts.map +1 -1
  79. package/esm/commands/variable/variable.delete.js +2 -2
  80. package/esm/commands/variable/variable.list.d.ts +1 -1
  81. package/esm/commands/variable/variable.list.d.ts.map +1 -1
  82. package/esm/commands/variable/variable.list.js +2 -2
  83. package/esm/common/command.d.ts +28 -6
  84. package/esm/common/command.d.ts.map +1 -1
  85. package/esm/common/command.js +43 -5
  86. package/esm/common/flowcore-client.d.ts.map +1 -1
  87. package/esm/common/flowcore-client.js +18 -11
  88. package/esm/exceptions/not-found.d.ts +1 -1
  89. package/esm/exceptions/not-found.d.ts.map +1 -1
  90. package/esm/exceptions/not-found.js +2 -2
  91. package/package.json +1 -1
  92. package/script/commands/api-key/api-key.create.d.ts +15 -3
  93. package/script/commands/api-key/api-key.create.d.ts.map +1 -1
  94. package/script/commands/api-key/api-key.create.js +31 -11
  95. package/script/commands/api-key/api-key.delete.d.ts +1 -1
  96. package/script/commands/api-key/api-key.delete.d.ts.map +1 -1
  97. package/script/commands/api-key/api-key.delete.js +2 -2
  98. package/script/commands/api-key/api-key.list.d.ts +1 -1
  99. package/script/commands/api-key/api-key.list.d.ts.map +1 -1
  100. package/script/commands/api-key/api-key.list.js +2 -2
  101. package/script/commands/data-core/data-core.create.d.ts +6 -2
  102. package/script/commands/data-core/data-core.create.d.ts.map +1 -1
  103. package/script/commands/data-core/data-core.create.js +12 -0
  104. package/script/commands/data-core/data-core.delete-request.d.ts +6 -6
  105. package/script/commands/data-core/data-core.delete-request.d.ts.map +1 -1
  106. package/script/commands/data-core/data-core.delete-request.js +7 -7
  107. package/script/commands/data-core/data-core.fetch.d.ts +8 -4
  108. package/script/commands/data-core/data-core.fetch.d.ts.map +1 -1
  109. package/script/commands/data-core/data-core.fetch.js +12 -1
  110. package/script/commands/data-core/data-core.list.d.ts +2 -2
  111. package/script/commands/data-core/data-core.list.d.ts.map +1 -1
  112. package/script/commands/data-core/data-core.update.d.ts +3 -3
  113. package/script/commands/data-core/data-core.update.d.ts.map +1 -1
  114. package/script/commands/data-core/data-core.update.js +1 -1
  115. package/script/commands/event-type/event-type.create.d.ts +6 -2
  116. package/script/commands/event-type/event-type.create.d.ts.map +1 -1
  117. package/script/commands/event-type/event-type.create.js +12 -0
  118. package/script/commands/event-type/event-type.delete-request.d.ts +8 -4
  119. package/script/commands/event-type/event-type.delete-request.d.ts.map +1 -1
  120. package/script/commands/event-type/event-type.delete-request.js +13 -4
  121. package/script/commands/event-type/event-type.fetch.d.ts +7 -3
  122. package/script/commands/event-type/event-type.fetch.d.ts.map +1 -1
  123. package/script/commands/event-type/event-type.fetch.js +12 -1
  124. package/script/commands/event-type/event-type.list.d.ts +2 -2
  125. package/script/commands/event-type/event-type.list.d.ts.map +1 -1
  126. package/script/commands/event-type/event-type.update.d.ts +1 -1
  127. package/script/commands/event-type/event-type.update.d.ts.map +1 -1
  128. package/script/commands/event-type/event-type.update.js +2 -2
  129. package/script/commands/events/events.fetch-time-buckets-by-names.d.ts +1 -1
  130. package/script/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -1
  131. package/script/commands/events/events.fetch-time-buckets-by-names.js +2 -1
  132. package/script/commands/events/events.fetch.d.ts +1 -1
  133. package/script/commands/events/events.fetch.d.ts.map +1 -1
  134. package/script/commands/events/events.fetch.js +2 -2
  135. package/script/commands/flow-type/flow-type.create.d.ts +6 -2
  136. package/script/commands/flow-type/flow-type.create.d.ts.map +1 -1
  137. package/script/commands/flow-type/flow-type.create.js +12 -0
  138. package/script/commands/flow-type/flow-type.delete-request.d.ts +13 -6
  139. package/script/commands/flow-type/flow-type.delete-request.d.ts.map +1 -1
  140. package/script/commands/flow-type/flow-type.delete-request.js +13 -4
  141. package/script/commands/flow-type/flow-type.fetch.d.ts +9 -5
  142. package/script/commands/flow-type/flow-type.fetch.d.ts.map +1 -1
  143. package/script/commands/flow-type/flow-type.fetch.js +12 -1
  144. package/script/commands/flow-type/flow-type.list.d.ts +2 -2
  145. package/script/commands/flow-type/flow-type.list.d.ts.map +1 -1
  146. package/script/commands/flow-type/flow-type.update.d.ts +3 -3
  147. package/script/commands/flow-type/flow-type.update.d.ts.map +1 -1
  148. package/script/commands/flow-type/flow-type.update.js +1 -1
  149. package/script/commands/secret/secret.create.d.ts +1 -1
  150. package/script/commands/secret/secret.create.d.ts.map +1 -1
  151. package/script/commands/secret/secret.create.js +2 -2
  152. package/script/commands/secret/secret.delete.d.ts +1 -1
  153. package/script/commands/secret/secret.delete.d.ts.map +1 -1
  154. package/script/commands/secret/secret.delete.js +2 -3
  155. package/script/commands/secret/secret.list.d.ts +1 -1
  156. package/script/commands/secret/secret.list.d.ts.map +1 -1
  157. package/script/commands/secret/secret.list.js +2 -2
  158. package/script/commands/tenant/tenant.fetch.d.ts +5 -6
  159. package/script/commands/tenant/tenant.fetch.d.ts.map +1 -1
  160. package/script/commands/tenant/tenant.fetch.js +7 -5
  161. package/script/commands/tenant/tenant.list.d.ts +1 -1
  162. package/script/commands/tenant/tenant.list.d.ts.map +1 -1
  163. package/script/commands/tenant/tenant.list.js +2 -2
  164. package/script/commands/variable/variable.create.d.ts +1 -1
  165. package/script/commands/variable/variable.create.d.ts.map +1 -1
  166. package/script/commands/variable/variable.create.js +2 -2
  167. package/script/commands/variable/variable.delete.d.ts +1 -1
  168. package/script/commands/variable/variable.delete.d.ts.map +1 -1
  169. package/script/commands/variable/variable.delete.js +2 -2
  170. package/script/commands/variable/variable.list.d.ts +1 -1
  171. package/script/commands/variable/variable.list.d.ts.map +1 -1
  172. package/script/commands/variable/variable.list.js +2 -2
  173. package/script/common/command.d.ts +28 -6
  174. package/script/common/command.d.ts.map +1 -1
  175. package/script/common/command.js +43 -5
  176. package/script/common/flowcore-client.d.ts.map +1 -1
  177. package/script/common/flowcore-client.js +18 -11
  178. package/script/exceptions/not-found.d.ts +1 -1
  179. package/script/exceptions/not-found.d.ts.map +1 -1
  180. package/script/exceptions/not-found.js +2 -2
@@ -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,8 +1,13 @@
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
4
5
  */
5
6
  export declare abstract class Command<Input, Output> {
7
+ /**
8
+ * Whether the command should retry on failure
9
+ */
10
+ protected readonly retryOnFailure: boolean;
6
11
  /**
7
12
  * The allowed modes for the command
8
13
  */
@@ -27,7 +32,7 @@ export declare abstract class Command<Input, Output> {
27
32
  /**
28
33
  * Get the body for the request
29
34
  */
30
- protected getBody(): string | undefined;
35
+ protected getBody(): Record<string, unknown> | Array<unknown> | undefined;
31
36
  /**
32
37
  * Get the headers for the request
33
38
  */
@@ -35,29 +40,46 @@ export declare abstract class Command<Input, Output> {
35
40
  /**
36
41
  * Parse the response
37
42
  */
38
- protected abstract parseResponse(response: unknown, flowcoreClient: FlowcoreClient): Output | Promise<Output>;
43
+ protected abstract parseResponse(response: unknown): Output;
44
+ /**
45
+ * Handle the client error
46
+ */
47
+ protected handleClientError(error: ClientError): void;
39
48
  /**
40
49
  * Get the request object
41
50
  */
42
51
  getRequest(_client: FlowcoreClient): Promise<{
43
52
  allowedModes: ("apiKey" | "bearer")[];
44
- body: string | undefined;
53
+ body: string | Record<string, unknown> | Array<unknown> | undefined;
45
54
  headers: Record<string, string>;
46
55
  baseUrl: string;
47
56
  path: string;
48
57
  method: string;
49
- parseResponse: (response: unknown, client: FlowcoreClient) => Output | Promise<Output>;
50
- waitForResponse: (client: FlowcoreClient, response: Output) => Promise<Output>;
58
+ parseResponse: (response: unknown) => Output | Promise<Output>;
59
+ processResponse: (client: FlowcoreClient, response: Output) => Promise<Output>;
60
+ handleClientError: (error: ClientError) => void;
61
+ retryOnFailure: boolean;
51
62
  }>;
52
63
  /**
53
64
  * Wait for the response
54
65
  */
55
- protected waitForResponse(_client: FlowcoreClient, response: Output): Promise<Output>;
66
+ protected processResponse(_client: FlowcoreClient, response: Output): Promise<Output>;
56
67
  }
57
68
  /**
58
69
  * Abstract command for executing GraphQL requests
59
70
  */
60
71
  export declare abstract class GraphQlCommand<Input, Output> extends Command<Input, Output> {
72
+ /**
73
+ * The allowed modes for the command
74
+ */
75
+ protected allowedModes: ("apiKey" | "bearer")[];
76
+ /**
77
+ * Get the base URL for the request
78
+ */
61
79
  protected getBaseUrl(): string;
80
+ /**
81
+ * Get the path for the request
82
+ */
83
+ protected getPath(): string;
62
84
  }
63
85
  //# 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,CAA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AAO,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;QAC9D,eAAe,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;QAC9E,iBAAiB,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;QAC/C,cAAc,EAAE,OAAO,CAAA;KACxB,CAAC;IAeF;;OAEG;cAEa,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F;AAED;;GAEG;AACH,8BAAsB,cAAc,CAAC,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"}
@@ -3,6 +3,15 @@
3
3
  */
4
4
  export class Command {
5
5
  constructor(input) {
6
+ /**
7
+ * Whether the command should retry on failure
8
+ */
9
+ Object.defineProperty(this, "retryOnFailure", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: true
14
+ });
6
15
  /**
7
16
  * The allowed modes for the command
8
17
  */
@@ -45,18 +54,24 @@ export class Command {
45
54
  if (this.getMethod() === "GET") {
46
55
  return undefined;
47
56
  }
48
- return this.input ? JSON.stringify(this.input) : undefined;
57
+ return this.input ?? undefined;
49
58
  }
50
59
  /**
51
60
  * Get the headers for the request
52
61
  */
53
62
  getHeaders() {
54
- return this.getBody()
63
+ return typeof this.getBody() === "object"
55
64
  ? {
56
65
  "Content-Type": "application/json",
57
66
  }
58
67
  : {};
59
68
  }
69
+ /**
70
+ * Handle the client error
71
+ */
72
+ handleClientError(error) {
73
+ throw error;
74
+ }
60
75
  /**
61
76
  * Get the request object
62
77
  */
@@ -70,14 +85,16 @@ export class Command {
70
85
  path: this.getPath(),
71
86
  method: this.getMethod(),
72
87
  parseResponse: this.parseResponse.bind(this),
73
- waitForResponse: this.waitForResponse.bind(this),
88
+ processResponse: this.processResponse.bind(this),
89
+ handleClientError: this.handleClientError.bind(this),
90
+ retryOnFailure: this.retryOnFailure,
74
91
  };
75
92
  }
76
93
  /**
77
94
  * Wait for the response
78
95
  */
79
96
  // deno-lint-ignore require-await
80
- async waitForResponse(_client, response) {
97
+ async processResponse(_client, response) {
81
98
  return response;
82
99
  }
83
100
  }
@@ -85,7 +102,28 @@ export class Command {
85
102
  * Abstract command for executing GraphQL requests
86
103
  */
87
104
  export class GraphQlCommand extends Command {
105
+ constructor() {
106
+ super(...arguments);
107
+ /**
108
+ * The allowed modes for the command
109
+ */
110
+ Object.defineProperty(this, "allowedModes", {
111
+ enumerable: true,
112
+ configurable: true,
113
+ writable: true,
114
+ value: ["bearer"]
115
+ });
116
+ }
117
+ /**
118
+ * Get the base URL for the request
119
+ */
88
120
  getBaseUrl() {
89
- return "https://graph.api.flowcore.io/graphql";
121
+ return "https://graph.api.flowcore.io";
122
+ }
123
+ /**
124
+ * Get the path for the request
125
+ */
126
+ getPath() {
127
+ return "/graphql";
90
128
  }
91
129
  }
@@ -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,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AQ,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;IAiE1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAGzE"}
@@ -65,20 +65,25 @@ 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) {
81
- if (this.options.retry && retryCount < this.options.retry.maxRetries) {
86
+ if (request.retryOnFailure && this.options.retry && retryCount < this.options.retry.maxRetries) {
82
87
  const delay = this.options.retry.delay;
83
88
  await new Promise((resolve) => setTimeout(resolve, delay));
84
89
  return this.innerExecute(command, retryCount + 1);
@@ -90,7 +95,8 @@ export class FlowcoreClient {
90
95
  });
91
96
  }
92
97
  if (!response.ok) {
93
- if (this.options.retry && RETRYABLE_ERROR_CODES.includes(response.status) &&
98
+ if (request.retryOnFailure &&
99
+ this.options.retry && RETRYABLE_ERROR_CODES.includes(response.status) &&
94
100
  retryCount < this.options.retry.maxRetries) {
95
101
  const delay = this.options.retry.delay;
96
102
  await new Promise((resolve) => setTimeout(resolve, delay));
@@ -98,11 +104,12 @@ export class FlowcoreClient {
98
104
  }
99
105
  const body = await response.json().catch(() => undefined);
100
106
  const commandName = command.constructor.name;
101
- throw new ClientError(`${commandName} failed with ${response.status}: ${response.statusText}`, response.status, body);
107
+ const error = new ClientError(`${commandName} failed with ${response.status}: ${response.statusText}`, response.status, body);
108
+ request.handleClientError(error);
102
109
  }
103
- const body = await response.json();
104
- const parsedBody = await request.parseResponse(body, this);
105
- return request.waitForResponse(this, parsedBody);
110
+ const responseBody = await response.json();
111
+ const parsedBody = await request.parseResponse(responseBody);
112
+ return request.processResponse(this, parsedBody);
106
113
  }
107
114
  /**
108
115
  * 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.3",
3
+ "version": "1.10.1",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -16,6 +16,10 @@ export interface ApiKeyCreateInput {
16
16
  export declare class ApiKeyCreateCommand extends GraphQlCommand<ApiKeyCreateInput, ApiKey & {
17
17
  value: string;
18
18
  }> {
19
+ /**
20
+ * Whether the command should retry on failure
21
+ */
22
+ protected retryOnFailure: boolean;
19
23
  /**
20
24
  * The allowed modes for the command
21
25
  */
@@ -23,12 +27,20 @@ export declare class ApiKeyCreateCommand extends GraphQlCommand<ApiKeyCreateInpu
23
27
  /**
24
28
  * Parse the response
25
29
  */
26
- protected parseResponse(rawResponse: unknown, flowcoreClient: FlowcoreClient): Promise<ApiKey & {
30
+ protected parseResponse(rawResponse: unknown): ApiKey & {
27
31
  value: string;
28
- }>;
32
+ };
29
33
  /**
30
34
  * Get the body for the request
31
35
  */
32
- protected getBody(): string;
36
+ protected getBody(): Record<string, unknown>;
37
+ /**
38
+ * Fill in the missing fields
39
+ */
40
+ protected processResponse(flowcoreClient: FlowcoreClient, response: ApiKey & {
41
+ value: string;
42
+ }): Promise<ApiKey & {
43
+ value: string;
44
+ }>;
33
45
  }
34
46
  //# 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,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAIrE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;CACb;AA4BD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;IACpG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACsB,aAAa,CACpC,WAAW,EAAE,OAAO,EACpB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IA0BtC;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
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,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAIrE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;CACb;AA4BD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;IACpG;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAC9B,WAAW,EAAE,OAAO,GACnB,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAiB7B;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOrD;;OAEG;cACsB,eAAe,CACtC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACnC,OAAO,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAevC"}
@@ -32,6 +32,15 @@ const responseSchema = typebox_1.Type.Object({
32
32
  class ApiKeyCreateCommand extends command_js_1.GraphQlCommand {
33
33
  constructor() {
34
34
  super(...arguments);
35
+ /**
36
+ * Whether the command should retry on failure
37
+ */
38
+ Object.defineProperty(this, "retryOnFailure", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: false
43
+ });
35
44
  /**
36
45
  * The allowed modes for the command
37
46
  */
@@ -45,7 +54,7 @@ class ApiKeyCreateCommand extends command_js_1.GraphQlCommand {
45
54
  /**
46
55
  * Parse the response
47
56
  */
48
- async parseResponse(rawResponse, flowcoreClient) {
57
+ parseResponse(rawResponse) {
49
58
  const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
50
59
  if (response.errors) {
51
60
  throw new command_error_js_1.CommandError(this.constructor.name, response.errors[0].message);
@@ -53,15 +62,10 @@ class ApiKeyCreateCommand extends command_js_1.GraphQlCommand {
53
62
  if (!response.data || response.data?.organization.createApiKey === null) {
54
63
  throw new command_error_js_1.CommandError(this.constructor.name, "Failed to create API key");
55
64
  }
56
- const apiKeys = await flowcoreClient.execute(new api_key_list_js_1.ApiKeyListCommand({
57
- tenantId: this.input.tenantId,
58
- }));
59
- const apiKey = apiKeys.find((apiKey) => apiKey.name === this.input.name);
60
- if (!apiKey) {
61
- throw new Error("API key not found");
62
- }
63
65
  return {
64
- ...apiKey,
66
+ id: "",
67
+ name: "",
68
+ createdAt: "",
65
69
  value: response.data.organization.createApiKey,
66
70
  };
67
71
  }
@@ -69,10 +73,26 @@ class ApiKeyCreateCommand extends command_js_1.GraphQlCommand {
69
73
  * Get the body for the request
70
74
  */
71
75
  getBody() {
72
- return JSON.stringify({
76
+ return {
73
77
  query: graphQlQueryById,
74
78
  variables: this.input,
75
- });
79
+ };
80
+ }
81
+ /**
82
+ * Fill in the missing fields
83
+ */
84
+ async processResponse(flowcoreClient, response) {
85
+ const apiKeys = await flowcoreClient.execute(new api_key_list_js_1.ApiKeyListCommand({
86
+ tenantId: this.input.tenantId,
87
+ }));
88
+ const apiKey = apiKeys.find((apiKey) => apiKey.name === this.input.name);
89
+ if (!apiKey) {
90
+ throw new Error("API key not found");
91
+ }
92
+ return {
93
+ ...apiKey,
94
+ value: response.value,
95
+ };
76
96
  }
77
97
  }
78
98
  exports.ApiKeyCreateCommand = ApiKeyCreateCommand;
@@ -23,6 +23,6 @@ export declare class ApiKeyDeleteCommand extends GraphQlCommand<ApiKeyDeleteInpu
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=api-key.delete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAA;CACjB;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":"api-key.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAA;CACjB;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"}
@@ -55,10 +55,10 @@ class ApiKeyDeleteCommand extends command_js_1.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
  }
64
64
  exports.ApiKeyDeleteCommand = ApiKeyDeleteCommand;
@@ -22,6 +22,6 @@ export declare class ApiKeyListCommand extends GraphQlCommand<ApiKeyListInput, A
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=api-key.list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.list.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA0BD;;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;IAKhE;;OAEG;cACgB,OAAO,IAAI,MAAM;CAMrC"}
1
+ {"version":3,"file":"api-key.list.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA0BD;;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;IAKhE;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
@@ -53,10 +53,10 @@ class ApiKeyListCommand extends command_js_1.GraphQlCommand {
53
53
  * Get the body for the request
54
54
  */
55
55
  getBody() {
56
- return JSON.stringify({
56
+ return {
57
57
  query: graphQlQueryById,
58
58
  variables: this.input,
59
- });
59
+ };
60
60
  }
61
61
  }
62
62
  exports.ApiKeyListCommand = ApiKeyListCommand;
@@ -3,7 +3,7 @@ import { type DataCore } from "../../contracts/data-core.js";
3
3
  /**
4
4
  * The input for the data core create command
5
5
  */
6
- export type DataCoreCreateInput = {
6
+ export interface DataCoreCreateInput {
7
7
  /** The tenant id */
8
8
  tenantId: string;
9
9
  /** The name of the data core */
@@ -14,11 +14,15 @@ export type DataCoreCreateInput = {
14
14
  accessControl: "public" | "private";
15
15
  /** Whether the data core is delete protected */
16
16
  deleteProtection: boolean;
17
- };
17
+ }
18
18
  /**
19
19
  * Create a data core
20
20
  */
21
21
  export declare class DataCoreCreateCommand extends Command<DataCoreCreateInput, DataCore> {
22
+ /**
23
+ * Whether the command should retry on failure
24
+ */
25
+ protected retryOnFailure: boolean;
22
26
  /**
23
27
  * Get the method
24
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"data-core.create.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.create.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,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAA;IACnC,gDAAgD;IAChD,gBAAgB,EAAE,OAAO,CAAA;CAC1B,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,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
1
+ {"version":3,"file":"data-core.create.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAA;IACnC,gDAAgD;IAChD,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
@@ -8,6 +8,18 @@ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js
8
8
  * Create a data core
9
9
  */
10
10
  class DataCoreCreateCommand extends command_js_1.Command {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Whether the command should retry on failure
15
+ */
16
+ Object.defineProperty(this, "retryOnFailure", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: false
21
+ });
22
+ }
11
23
  /**
12
24
  * Get the method
13
25
  */
@@ -3,20 +3,20 @@ import type { FlowcoreClient } from "../../common/flowcore-client.js";
3
3
  /**
4
4
  * The input for the data core delete request command
5
5
  */
6
- export type DataCoreDeleteRequestInput = {
6
+ export interface DataCoreDeleteRequestInput {
7
7
  /** The id of the data core */
8
8
  dataCoreId: string;
9
9
  /** Wait for the data core to be deleted (default: true) */
10
10
  waitForDelete?: boolean;
11
- };
11
+ }
12
12
  /**
13
13
  * Request to delete a data core
14
14
  */
15
15
  export declare class DataCoreDeleteRequestCommand extends GraphQlCommand<DataCoreDeleteRequestInput, boolean> {
16
16
  /**
17
- * The allowed modes for the command
17
+ * Whether the command should retry on failure
18
18
  */
19
- protected allowedModes: ("apiKey" | "bearer")[];
19
+ protected retryOnFailure: boolean;
20
20
  /**
21
21
  * Create a new data core delete request command
22
22
  */
@@ -28,10 +28,10 @@ export declare class DataCoreDeleteRequestCommand extends GraphQlCommand<DataCor
28
28
  /**
29
29
  * Get the body for the request
30
30
  */
31
- protected getBody(): string;
31
+ protected getBody(): Record<string, unknown>;
32
32
  /**
33
33
  * Wait for the response (timeout: 25 seconds)
34
34
  */
35
- protected waitForResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
35
+ protected processResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
36
36
  }
37
37
  //# sourceMappingURL=data-core.delete-request.d.ts.map
@@ -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,MAAM,0BAA0B,GAAG;IACvC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AA4BD;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,0BAA0B,EAAE,OAAO,CAAC;IACnG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;gBACS,KAAK,EAAE,0BAA0B;IAO7C;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAW5D;;OAEG;cACgB,OAAO,IAAI,MAAM;IAOpC;;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;;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"}