@flowcore/sdk 1.48.0 → 1.50.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 (157) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +47 -0
  3. package/esm/_dnt.shims.d.ts +1 -1
  4. package/esm/commands/adapter/reset-adapter.d.ts +52 -0
  5. package/esm/commands/adapter/reset-adapter.d.ts.map +1 -0
  6. package/esm/commands/adapter/reset-adapter.js +38 -0
  7. package/esm/commands/ai-agent-coordinator/conversation-stream.command.js +1 -6
  8. package/esm/commands/api-key/api-key.create.js +8 -21
  9. package/esm/commands/api-key/api-key.delete.js +4 -12
  10. package/esm/commands/api-key/api-key.list.js +4 -12
  11. package/esm/commands/data-core/data-core.create.js +4 -12
  12. package/esm/commands/data-core/data-core.request-delete.js +4 -12
  13. package/esm/commands/event-type/event-type.create.js +4 -12
  14. package/esm/commands/event-type/event-type.request-delete.js +4 -12
  15. package/esm/commands/event-type/event-type.request-truncate.js +4 -12
  16. package/esm/commands/events/event.list.js +4 -12
  17. package/esm/commands/events/events.fetch-time-buckets-by-names.js +4 -12
  18. package/esm/commands/events/events.fetch.js +4 -12
  19. package/esm/commands/events/time-bucket.list.js +4 -12
  20. package/esm/commands/flow-type/flow-type.create.js +4 -12
  21. package/esm/commands/flow-type/flow-type.request-delete.js +4 -12
  22. package/esm/commands/index.d.ts +1 -7
  23. package/esm/commands/index.d.ts.map +1 -1
  24. package/esm/commands/index.js +2 -8
  25. package/esm/commands/ingestion/ingest.batch.js +5 -18
  26. package/esm/commands/ingestion/ingest.event.js +5 -18
  27. package/esm/commands/scenario/scenario.create.js +4 -12
  28. package/esm/commands/scenario/scenario.delete.js +4 -12
  29. package/esm/commands/scenario/scenario.fetch.d.ts +22 -4
  30. package/esm/commands/scenario/scenario.fetch.d.ts.map +1 -1
  31. package/esm/commands/scenario/scenario.fetch.js +29 -13
  32. package/esm/commands/scenario/scenario.list.js +4 -12
  33. package/esm/commands/scenario/scenario.update.d.ts +4 -2
  34. package/esm/commands/scenario/scenario.update.d.ts.map +1 -1
  35. package/esm/commands/scenario/scenario.update.js +13 -12
  36. package/esm/commands/secret/secret.create.js +4 -12
  37. package/esm/commands/secret/secret.delete.js +4 -12
  38. package/esm/commands/secret/secret.list.js +4 -12
  39. package/esm/commands/security/pat.create.js +4 -12
  40. package/esm/commands/security/pat.delete.js +4 -12
  41. package/esm/commands/security/pat.exchange.js +4 -12
  42. package/esm/commands/security/pat.get.js +4 -12
  43. package/esm/commands/security/pat.list.js +4 -12
  44. package/esm/commands/tenant/tenant.list.js +4 -12
  45. package/esm/commands/variable/variable.create.js +4 -12
  46. package/esm/commands/variable/variable.delete.js +4 -12
  47. package/esm/commands/variable/variable.list.js +4 -12
  48. package/esm/common/command-graphql.js +4 -12
  49. package/esm/common/command.js +20 -45
  50. package/esm/common/flowcore-client.js +4 -18
  51. package/esm/common/notification-client.js +15 -72
  52. package/esm/common/websocket-client.js +16 -80
  53. package/esm/exceptions/client-error.js +6 -18
  54. package/esm/exceptions/invalid-response.js +2 -6
  55. package/esm/utils/local-cache.js +5 -19
  56. package/package.json +1 -1
  57. package/script/_dnt.shims.d.ts +1 -1
  58. package/script/commands/adapter/reset-adapter.d.ts +52 -0
  59. package/script/commands/adapter/reset-adapter.d.ts.map +1 -0
  60. package/script/commands/adapter/reset-adapter.js +42 -0
  61. package/script/commands/ai-agent-coordinator/conversation-stream.command.js +1 -6
  62. package/script/commands/api-key/api-key.create.js +8 -21
  63. package/script/commands/api-key/api-key.delete.js +4 -12
  64. package/script/commands/api-key/api-key.list.js +4 -12
  65. package/script/commands/data-core/data-core.create.js +4 -12
  66. package/script/commands/data-core/data-core.request-delete.js +4 -12
  67. package/script/commands/event-type/event-type.create.js +4 -12
  68. package/script/commands/event-type/event-type.request-delete.js +4 -12
  69. package/script/commands/event-type/event-type.request-truncate.js +4 -12
  70. package/script/commands/events/event.list.js +4 -12
  71. package/script/commands/events/events.fetch-time-buckets-by-names.js +4 -12
  72. package/script/commands/events/events.fetch.js +4 -12
  73. package/script/commands/events/time-bucket.list.js +4 -12
  74. package/script/commands/flow-type/flow-type.create.js +4 -12
  75. package/script/commands/flow-type/flow-type.request-delete.js +4 -12
  76. package/script/commands/index.d.ts +1 -7
  77. package/script/commands/index.d.ts.map +1 -1
  78. package/script/commands/index.js +2 -8
  79. package/script/commands/ingestion/ingest.batch.js +5 -18
  80. package/script/commands/ingestion/ingest.event.js +5 -18
  81. package/script/commands/scenario/scenario.create.js +4 -12
  82. package/script/commands/scenario/scenario.delete.js +4 -12
  83. package/script/commands/scenario/scenario.fetch.d.ts +22 -4
  84. package/script/commands/scenario/scenario.fetch.d.ts.map +1 -1
  85. package/script/commands/scenario/scenario.fetch.js +29 -13
  86. package/script/commands/scenario/scenario.list.js +4 -12
  87. package/script/commands/scenario/scenario.update.d.ts +4 -2
  88. package/script/commands/scenario/scenario.update.d.ts.map +1 -1
  89. package/script/commands/scenario/scenario.update.js +13 -12
  90. package/script/commands/secret/secret.create.js +4 -12
  91. package/script/commands/secret/secret.delete.js +4 -12
  92. package/script/commands/secret/secret.list.js +4 -12
  93. package/script/commands/security/pat.create.js +4 -12
  94. package/script/commands/security/pat.delete.js +4 -12
  95. package/script/commands/security/pat.exchange.js +4 -12
  96. package/script/commands/security/pat.get.js +4 -12
  97. package/script/commands/security/pat.list.js +4 -12
  98. package/script/commands/tenant/tenant.list.js +4 -12
  99. package/script/commands/variable/variable.create.js +4 -12
  100. package/script/commands/variable/variable.delete.js +4 -12
  101. package/script/commands/variable/variable.list.js +4 -12
  102. package/script/common/command-graphql.js +4 -12
  103. package/script/common/command.js +20 -45
  104. package/script/common/flowcore-client.js +4 -18
  105. package/script/common/notification-client.js +15 -72
  106. package/script/common/websocket-client.js +16 -80
  107. package/script/exceptions/client-error.js +6 -18
  108. package/script/exceptions/invalid-response.js +2 -6
  109. package/script/utils/local-cache.js +5 -19
  110. package/esm/commands/iam/api-key-role-association.create.d.ts +0 -45
  111. package/esm/commands/iam/api-key-role-association.create.d.ts.map +0 -1
  112. package/esm/commands/iam/api-key-role-association.create.js +0 -44
  113. package/esm/commands/iam/api-key-role-association.delete.d.ts +0 -45
  114. package/esm/commands/iam/api-key-role-association.delete.d.ts.map +0 -1
  115. package/esm/commands/iam/api-key-role-association.delete.js +0 -44
  116. package/esm/commands/iam/api-key-role-association.list.d.ts +0 -31
  117. package/esm/commands/iam/api-key-role-association.list.d.ts.map +0 -1
  118. package/esm/commands/iam/api-key-role-association.list.js +0 -37
  119. package/esm/commands/iam/role.list.d.ts +0 -33
  120. package/esm/commands/iam/role.list.d.ts.map +0 -1
  121. package/esm/commands/iam/role.list.js +0 -41
  122. package/esm/commands/iam/user-role-association.create.d.ts +0 -42
  123. package/esm/commands/iam/user-role-association.create.d.ts.map +0 -1
  124. package/esm/commands/iam/user-role-association.create.js +0 -40
  125. package/esm/commands/iam/user-role-association.delete.d.ts +0 -42
  126. package/esm/commands/iam/user-role-association.delete.d.ts.map +0 -1
  127. package/esm/commands/iam/user-role-association.delete.js +0 -40
  128. package/esm/commands/iam/user-role-association.list.d.ts +0 -33
  129. package/esm/commands/iam/user-role-association.list.d.ts.map +0 -1
  130. package/esm/commands/iam/user-role-association.list.js +0 -39
  131. package/esm/contracts/iam.d.ts +0 -13
  132. package/esm/contracts/iam.d.ts.map +0 -1
  133. package/esm/contracts/iam.js +0 -9
  134. package/script/commands/iam/api-key-role-association.create.d.ts +0 -45
  135. package/script/commands/iam/api-key-role-association.create.d.ts.map +0 -1
  136. package/script/commands/iam/api-key-role-association.create.js +0 -48
  137. package/script/commands/iam/api-key-role-association.delete.d.ts +0 -45
  138. package/script/commands/iam/api-key-role-association.delete.d.ts.map +0 -1
  139. package/script/commands/iam/api-key-role-association.delete.js +0 -48
  140. package/script/commands/iam/api-key-role-association.list.d.ts +0 -31
  141. package/script/commands/iam/api-key-role-association.list.d.ts.map +0 -1
  142. package/script/commands/iam/api-key-role-association.list.js +0 -41
  143. package/script/commands/iam/role.list.d.ts +0 -33
  144. package/script/commands/iam/role.list.d.ts.map +0 -1
  145. package/script/commands/iam/role.list.js +0 -45
  146. package/script/commands/iam/user-role-association.create.d.ts +0 -42
  147. package/script/commands/iam/user-role-association.create.d.ts.map +0 -1
  148. package/script/commands/iam/user-role-association.create.js +0 -44
  149. package/script/commands/iam/user-role-association.delete.d.ts +0 -42
  150. package/script/commands/iam/user-role-association.delete.d.ts.map +0 -1
  151. package/script/commands/iam/user-role-association.delete.js +0 -44
  152. package/script/commands/iam/user-role-association.list.d.ts +0 -33
  153. package/script/commands/iam/user-role-association.list.d.ts.map +0 -1
  154. package/script/commands/iam/user-role-association.list.js +0 -43
  155. package/script/contracts/iam.d.ts +0 -13
  156. package/script/contracts/iam.d.ts.map +0 -1
  157. package/script/contracts/iam.js +0 -12
@@ -8,18 +8,10 @@ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js
8
8
  * Get a Personal Access Token (PAT)
9
9
  */
10
10
  class SecurityGetPATCommand 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
+ /**
12
+ * Whether the command should retry on failure
13
+ */
14
+ retryOnFailure = false;
23
15
  /**
24
16
  * Get the method
25
17
  */
@@ -9,18 +9,10 @@ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js
9
9
  * List all your Personal Access Token (PAT)
10
10
  */
11
11
  class SecurityListPATCommand extends command_js_1.Command {
12
- constructor() {
13
- super(...arguments);
14
- /**
15
- * Whether the command should retry on failure
16
- */
17
- Object.defineProperty(this, "retryOnFailure", {
18
- enumerable: true,
19
- configurable: true,
20
- writable: true,
21
- value: false
22
- });
23
- }
12
+ /**
13
+ * Whether the command should retry on failure
14
+ */
15
+ retryOnFailure = false;
24
16
  /**
25
17
  * Get the method
26
18
  */
@@ -48,18 +48,10 @@ const responseSchema = typebox_1.Type.Object({
48
48
  * List tenants
49
49
  */
50
50
  class TenantListCommand extends command_graphql_js_1.GraphQlCommand {
51
- constructor() {
52
- super(...arguments);
53
- /**
54
- * The allowed modes for the command
55
- */
56
- Object.defineProperty(this, "allowedModes", {
57
- enumerable: true,
58
- configurable: true,
59
- writable: true,
60
- value: ["bearer"]
61
- });
62
- }
51
+ /**
52
+ * The allowed modes for the command
53
+ */
54
+ allowedModes = ["bearer"];
63
55
  /**
64
56
  * Parse the response
65
57
  */
@@ -29,18 +29,10 @@ const responseSchema = typebox_1.Type.Object({
29
29
  * Create a variable
30
30
  */
31
31
  class VariableCreateCommand extends command_graphql_js_1.GraphQlCommand {
32
- constructor() {
33
- super(...arguments);
34
- /**
35
- * The allowed modes for the command
36
- */
37
- Object.defineProperty(this, "allowedModes", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: ["bearer"]
42
- });
43
- }
32
+ /**
33
+ * The allowed modes for the command
34
+ */
35
+ allowedModes = ["bearer"];
44
36
  /**
45
37
  * Parse the response
46
38
  */
@@ -29,18 +29,10 @@ const responseSchema = typebox_1.Type.Object({
29
29
  * Create a variable
30
30
  */
31
31
  class VariableDeleteCommand extends command_graphql_js_1.GraphQlCommand {
32
- constructor() {
33
- super(...arguments);
34
- /**
35
- * The allowed modes for the command
36
- */
37
- Object.defineProperty(this, "allowedModes", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: ["bearer"]
42
- });
43
- }
32
+ /**
33
+ * The allowed modes for the command
34
+ */
35
+ allowedModes = ["bearer"];
44
36
  /**
45
37
  * Parse the response
46
38
  */
@@ -35,18 +35,10 @@ const responseSchema = typebox_1.Type.Object({
35
35
  * List variables
36
36
  */
37
37
  class VariableListCommand extends command_graphql_js_1.GraphQlCommand {
38
- constructor() {
39
- super(...arguments);
40
- /**
41
- * The allowed modes for the command
42
- */
43
- Object.defineProperty(this, "allowedModes", {
44
- enumerable: true,
45
- configurable: true,
46
- writable: true,
47
- value: ["bearer"]
48
- });
49
- }
38
+ /**
39
+ * The allowed modes for the command
40
+ */
41
+ allowedModes = ["bearer"];
50
42
  /**
51
43
  * Parse the response
52
44
  */
@@ -6,18 +6,10 @@ const command_js_1 = require("./command.js");
6
6
  * Abstract command for executing GraphQL requests
7
7
  */
8
8
  class GraphQlCommand extends command_js_1.Command {
9
- constructor() {
10
- super(...arguments);
11
- /**
12
- * The allowed modes for the command
13
- */
14
- Object.defineProperty(this, "allowedModes", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: ["bearer"]
19
- });
20
- }
9
+ /**
10
+ * The allowed modes for the command
11
+ */
12
+ allowedModes = ["bearer"];
21
13
  /**
22
14
  * Get the base URL for the request
23
15
  */
@@ -31,52 +31,27 @@ const tenant_cache_js_1 = require("./tenant.cache.js");
31
31
  * Abstract command for executing requests
32
32
  */
33
33
  class Command {
34
+ /**
35
+ * Whether the command should retry on failure
36
+ */
37
+ retryOnFailure = true;
38
+ /**
39
+ * The dedicated subdomain for the command
40
+ */
41
+ dedicatedSubdomain;
42
+ /**
43
+ * The allowed modes for the command
44
+ */
45
+ allowedModes = ["apiKey", "bearer"];
46
+ /**
47
+ * The input for the command
48
+ */
49
+ input;
50
+ /**
51
+ * The client auth options
52
+ */
53
+ clientAuthOptions = {};
34
54
  constructor(input) {
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: true
43
- });
44
- /**
45
- * The dedicated subdomain for the command
46
- */
47
- Object.defineProperty(this, "dedicatedSubdomain", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
52
- });
53
- /**
54
- * The allowed modes for the command
55
- */
56
- Object.defineProperty(this, "allowedModes", {
57
- enumerable: true,
58
- configurable: true,
59
- writable: true,
60
- value: ["apiKey", "bearer"]
61
- });
62
- /**
63
- * The input for the command
64
- */
65
- Object.defineProperty(this, "input", {
66
- enumerable: true,
67
- configurable: true,
68
- writable: true,
69
- value: void 0
70
- });
71
- /**
72
- * The client auth options
73
- */
74
- Object.defineProperty(this, "clientAuthOptions", {
75
- enumerable: true,
76
- configurable: true,
77
- writable: true,
78
- value: {}
79
- });
80
55
  /**
81
56
  * The input for the command
82
57
  */
@@ -10,25 +10,11 @@ const RETRYABLE_ERROR_CODES = [408, 429, 500, 502, 503, 504];
10
10
  * A base client for executing commands
11
11
  */
12
12
  class FlowcoreClient {
13
+ options;
14
+ mode;
15
+ baseUrl;
13
16
  constructor(options) {
14
- Object.defineProperty(this, "options", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: options
19
- });
20
- Object.defineProperty(this, "mode", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: void 0
25
- });
26
- Object.defineProperty(this, "baseUrl", {
27
- enumerable: true,
28
- configurable: true,
29
- writable: true,
30
- value: void 0
31
- });
17
+ this.options = options;
32
18
  if (this.options.getBearerToken) {
33
19
  this.mode = "bearer";
34
20
  }
@@ -38,6 +38,18 @@ const MAX_RECONNECT_INTERVAL = 30_000;
38
38
  * Manages connection lifecycle, authentication, and event handling.
39
39
  */
40
40
  class NotificationClient {
41
+ observer;
42
+ authOptions;
43
+ subscriptionSpec;
44
+ url = "wss://tenant.api.flowcore.io/notifications";
45
+ webSocket;
46
+ options;
47
+ logger;
48
+ eventCount = 0;
49
+ reconnectInterval;
50
+ reconnectAttempts = 0;
51
+ _isOpen = false;
52
+ _isConnecting = false;
41
53
  /**
42
54
  * Creates a new NotificationClient instance
43
55
  * @param observer - RxJS Subject for emitting notification events
@@ -46,78 +58,9 @@ class NotificationClient {
46
58
  * @param options - Configuration options for the client
47
59
  */
48
60
  constructor(observer, authOptions, subscriptionSpec, options) {
49
- Object.defineProperty(this, "observer", {
50
- enumerable: true,
51
- configurable: true,
52
- writable: true,
53
- value: observer
54
- });
55
- Object.defineProperty(this, "authOptions", {
56
- enumerable: true,
57
- configurable: true,
58
- writable: true,
59
- value: authOptions
60
- });
61
- Object.defineProperty(this, "subscriptionSpec", {
62
- enumerable: true,
63
- configurable: true,
64
- writable: true,
65
- value: subscriptionSpec
66
- });
67
- Object.defineProperty(this, "url", {
68
- enumerable: true,
69
- configurable: true,
70
- writable: true,
71
- value: "wss://tenant.api.flowcore.io/notifications"
72
- });
73
- Object.defineProperty(this, "webSocket", {
74
- enumerable: true,
75
- configurable: true,
76
- writable: true,
77
- value: void 0
78
- });
79
- Object.defineProperty(this, "options", {
80
- enumerable: true,
81
- configurable: true,
82
- writable: true,
83
- value: void 0
84
- });
85
- Object.defineProperty(this, "logger", {
86
- enumerable: true,
87
- configurable: true,
88
- writable: true,
89
- value: void 0
90
- });
91
- Object.defineProperty(this, "eventCount", {
92
- enumerable: true,
93
- configurable: true,
94
- writable: true,
95
- value: 0
96
- });
97
- Object.defineProperty(this, "reconnectInterval", {
98
- enumerable: true,
99
- configurable: true,
100
- writable: true,
101
- value: void 0
102
- });
103
- Object.defineProperty(this, "reconnectAttempts", {
104
- enumerable: true,
105
- configurable: true,
106
- writable: true,
107
- value: 0
108
- });
109
- Object.defineProperty(this, "_isOpen", {
110
- enumerable: true,
111
- configurable: true,
112
- writable: true,
113
- value: false
114
- });
115
- Object.defineProperty(this, "_isConnecting", {
116
- enumerable: true,
117
- configurable: true,
118
- writable: true,
119
- value: false
120
- });
61
+ this.observer = observer;
62
+ this.authOptions = authOptions;
63
+ this.subscriptionSpec = subscriptionSpec;
121
64
  this.options = {
122
65
  reconnectInterval: 1000,
123
66
  ...options,
@@ -35,6 +35,21 @@ const MAX_RECONNECT_INTERVAL = 30_000;
35
35
  * Handles connection lifecycle, authentication, reconnection, and message sending/receiving.
36
36
  */
37
37
  class WebSocketClient {
38
+ authOptions;
39
+ overrideBaseUrl; // Field to store the override URL
40
+ webSocket;
41
+ options;
42
+ logger;
43
+ reconnectInterval;
44
+ reconnectAttempts = 0;
45
+ _isOpen = false;
46
+ _isConnecting = false;
47
+ webSocketFactory;
48
+ // Internal subject to push received data
49
+ internalSubject = new rxjs_1.Subject();
50
+ // Store the current command and config for reconnects and sending
51
+ currentCommand = null;
52
+ currentConfig = null;
38
53
  /**
39
54
  * Creates a new WebSocketClient instance.
40
55
  * @param authOptions - Authentication options (Bearer token via OIDC client or API Key).
@@ -42,86 +57,7 @@ class WebSocketClient {
42
57
  * @param webSocketFactory - Optional WebSocket factory for testing.
43
58
  */
44
59
  constructor(authOptions, options, webSocketFactory) {
45
- Object.defineProperty(this, "authOptions", {
46
- enumerable: true,
47
- configurable: true,
48
- writable: true,
49
- value: authOptions
50
- });
51
- Object.defineProperty(this, "overrideBaseUrl", {
52
- enumerable: true,
53
- configurable: true,
54
- writable: true,
55
- value: void 0
56
- }); // Field to store the override URL
57
- Object.defineProperty(this, "webSocket", {
58
- enumerable: true,
59
- configurable: true,
60
- writable: true,
61
- value: void 0
62
- });
63
- Object.defineProperty(this, "options", {
64
- enumerable: true,
65
- configurable: true,
66
- writable: true,
67
- value: void 0
68
- });
69
- Object.defineProperty(this, "logger", {
70
- enumerable: true,
71
- configurable: true,
72
- writable: true,
73
- value: void 0
74
- });
75
- Object.defineProperty(this, "reconnectInterval", {
76
- enumerable: true,
77
- configurable: true,
78
- writable: true,
79
- value: void 0
80
- });
81
- Object.defineProperty(this, "reconnectAttempts", {
82
- enumerable: true,
83
- configurable: true,
84
- writable: true,
85
- value: 0
86
- });
87
- Object.defineProperty(this, "_isOpen", {
88
- enumerable: true,
89
- configurable: true,
90
- writable: true,
91
- value: false
92
- });
93
- Object.defineProperty(this, "_isConnecting", {
94
- enumerable: true,
95
- configurable: true,
96
- writable: true,
97
- value: false
98
- });
99
- Object.defineProperty(this, "webSocketFactory", {
100
- enumerable: true,
101
- configurable: true,
102
- writable: true,
103
- value: void 0
104
- });
105
- // Internal subject to push received data
106
- Object.defineProperty(this, "internalSubject", {
107
- enumerable: true,
108
- configurable: true,
109
- writable: true,
110
- value: new rxjs_1.Subject()
111
- });
112
- // Store the current command and config for reconnects and sending
113
- Object.defineProperty(this, "currentCommand", {
114
- enumerable: true,
115
- configurable: true,
116
- writable: true,
117
- value: null
118
- });
119
- Object.defineProperty(this, "currentConfig", {
120
- enumerable: true,
121
- configurable: true,
122
- writable: true,
123
- value: null
124
- });
60
+ this.authOptions = authOptions;
125
61
  this.options = { reconnectInterval: 1000, ...options };
126
62
  this.logger = options?.logger ?? logger_js_1.defaultLogger;
127
63
  this.reconnectInterval = this.options.reconnectInterval;
@@ -5,26 +5,14 @@ exports.ClientError = void 0;
5
5
  * An error thrown when the client request fails
6
6
  */
7
7
  class ClientError extends Error {
8
+ status;
9
+ command;
10
+ body;
8
11
  constructor(message, status, command, body) {
9
12
  super(`${command} failed with ${status}: ${body ? JSON.stringify(body) : message}`);
10
- Object.defineProperty(this, "status", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: status
15
- });
16
- Object.defineProperty(this, "command", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: command
21
- });
22
- Object.defineProperty(this, "body", {
23
- enumerable: true,
24
- configurable: true,
25
- writable: true,
26
- value: body
27
- });
13
+ this.status = status;
14
+ this.command = command;
15
+ this.body = body;
28
16
  }
29
17
  }
30
18
  exports.ClientError = ClientError;
@@ -5,15 +5,11 @@ exports.InvalidResponseException = void 0;
5
5
  * An error thrown when the response from the server is invalid
6
6
  */
7
7
  class InvalidResponseException extends Error {
8
+ errors;
8
9
  constructor(message, errors) {
9
10
  const errorString = JSON.stringify(errors);
10
11
  super(`${message}: ${errorString.slice(0, 1000)}`);
11
- Object.defineProperty(this, "errors", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: errors
16
- });
12
+ this.errors = errors;
17
13
  this.errors = errors;
18
14
  }
19
15
  }
@@ -2,26 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalCache = void 0;
4
4
  class LocalCache {
5
+ defaultTtlMs;
6
+ cache = new Map();
7
+ // deno-lint-ignore no-explicit-any
8
+ timers = new Map();
5
9
  constructor(defaultTtlMs) {
6
- Object.defineProperty(this, "defaultTtlMs", {
7
- enumerable: true,
8
- configurable: true,
9
- writable: true,
10
- value: defaultTtlMs
11
- });
12
- Object.defineProperty(this, "cache", {
13
- enumerable: true,
14
- configurable: true,
15
- writable: true,
16
- value: new Map()
17
- });
18
- // deno-lint-ignore no-explicit-any
19
- Object.defineProperty(this, "timers", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: new Map()
24
- });
10
+ this.defaultTtlMs = defaultTtlMs;
25
11
  }
26
12
  get(key) {
27
13
  return this.cache.get(key);
@@ -1,45 +0,0 @@
1
- import { type Static, type TObject, type TString } from "@sinclair/typebox";
2
- import { Command } from "../../common/command.js";
3
- /**
4
- * The input for the api key role associations create command
5
- */
6
- export interface ApiKeyRoleAssociationCreateInput {
7
- /** the api key id */
8
- apiKeyId: string;
9
- /** the role id */
10
- roleId: string;
11
- }
12
- /**
13
- * The response for the api key role associations create command
14
- */
15
- declare const responseSchema: TObject<{
16
- roleId: TString;
17
- organizationId: TString;
18
- keyId: TString;
19
- }>;
20
- type ApiKeyRoleAssociationCreateOutput = Omit<Static<typeof responseSchema>, "keyId"> & {
21
- apiKeyId: string;
22
- };
23
- /**
24
- * Create a api key role association
25
- */
26
- export declare class ApiKeyRoleAssociationCreateCommand extends Command<ApiKeyRoleAssociationCreateInput, ApiKeyRoleAssociationCreateOutput> {
27
- /**
28
- * Get the method
29
- */
30
- protected getMethod(): string;
31
- /**
32
- * Get the base url
33
- */
34
- protected getBaseUrl(): string;
35
- /**
36
- * Get the path
37
- */
38
- protected getPath(): string;
39
- /**
40
- * Parse the response
41
- */
42
- protected parseResponse(rawResponse: unknown): ApiKeyRoleAssociationCreateOutput;
43
- }
44
- export {};
45
- //# sourceMappingURL=api-key-role-association.create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-key-role-association.create.d.ts","sourceRoot":"","sources":["../../../src/commands/iam/api-key-role-association.create.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;AAGjD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,OAAO,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAA;IACf,cAAc,EAAE,OAAO,CAAA;IACvB,KAAK,EAAE,OAAO,CAAA;CACf,CAIC,CAAA;AAEF,KAAK,iCAAiC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,EAAE,OAAO,CAAC,GAAG;IACtF,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,qBAAa,kCACX,SAAQ,OAAO,CAAC,gCAAgC,EAAE,iCAAiC,CAAC;IACpF;;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,iCAAiC;CAO1F"}
@@ -1,44 +0,0 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { Command } from "../../common/command.js";
3
- import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
- /**
5
- * The response for the api key role associations create command
6
- */
7
- const responseSchema = Type.Object({
8
- roleId: Type.String(),
9
- organizationId: Type.String(),
10
- keyId: Type.String(),
11
- });
12
- /**
13
- * Create a api key role association
14
- */
15
- export class ApiKeyRoleAssociationCreateCommand extends Command {
16
- /**
17
- * Get the method
18
- */
19
- getMethod() {
20
- return "POST";
21
- }
22
- /**
23
- * Get the base url
24
- */
25
- getBaseUrl() {
26
- return "https://iam.api.flowcore.io";
27
- }
28
- /**
29
- * Get the path
30
- */
31
- getPath() {
32
- return `/api/v1/role-associations/key/${this.input.apiKeyId}`;
33
- }
34
- /**
35
- * Parse the response
36
- */
37
- parseResponse(rawResponse) {
38
- const { keyId, ...rest } = parseResponseHelper(responseSchema, rawResponse);
39
- return {
40
- ...rest,
41
- apiKeyId: keyId,
42
- };
43
- }
44
- }