@ductape/sdk 0.0.4-v2 → 0.0.4-v21

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 (163) hide show
  1. package/dist/api/services/appApi.service.d.ts +2 -2
  2. package/dist/api/services/appApi.service.js +1 -2
  3. package/dist/api/services/appApi.service.js.map +1 -1
  4. package/dist/api/services/pricingApi.service.d.ts +10 -0
  5. package/dist/api/services/pricingApi.service.js +34 -0
  6. package/dist/api/services/pricingApi.service.js.map +1 -0
  7. package/dist/api/services/processorApi.service.d.ts +12 -2
  8. package/dist/api/services/processorApi.service.js +12 -2
  9. package/dist/api/services/processorApi.service.js.map +1 -1
  10. package/dist/api/services/productsApi.service.d.ts +7 -1
  11. package/dist/api/services/productsApi.service.js +33 -0
  12. package/dist/api/services/productsApi.service.js.map +1 -1
  13. package/dist/api/services/userApi.service.js +1 -0
  14. package/dist/api/services/userApi.service.js.map +1 -1
  15. package/dist/api/services/workspaceApi.service.js +1 -0
  16. package/dist/api/services/workspaceApi.service.js.map +1 -1
  17. package/dist/api/urls.d.ts +7 -1
  18. package/dist/api/urls.js +13 -2
  19. package/dist/api/urls.js.map +1 -1
  20. package/dist/api/utils/strings.utils.d.ts +2 -0
  21. package/dist/api/utils/strings.utils.js +14 -0
  22. package/dist/api/utils/strings.utils.js.map +1 -1
  23. package/dist/apps/services/app.service.js +7 -5
  24. package/dist/apps/services/app.service.js.map +1 -1
  25. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
  26. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
  27. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
  28. package/dist/clients/apps.client.js +1 -1
  29. package/dist/clients/apps.client.js.map +1 -1
  30. package/dist/clients/pricing.client.d.ts +3 -0
  31. package/dist/clients/pricing.client.js +33 -0
  32. package/dist/clients/pricing.client.js.map +1 -0
  33. package/dist/imports/imports.service.d.ts +3 -3
  34. package/dist/imports/imports.service.js +7 -7
  35. package/dist/imports/imports.service.js.map +1 -1
  36. package/dist/imports/imports.types.d.ts +8 -0
  37. package/dist/imports/repos/openApi.repo.d.ts +1 -2
  38. package/dist/imports/repos/openApi.repo.js +43 -71
  39. package/dist/imports/repos/openApi.repo.js.map +1 -1
  40. package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
  41. package/dist/imports/repos/postmanV21.repo.js +29 -2
  42. package/dist/imports/repos/postmanV21.repo.js.map +1 -1
  43. package/dist/index.d.ts +953 -46
  44. package/dist/index.js +918 -81
  45. package/dist/index.js.map +1 -1
  46. package/dist/inputs/inputs.service.js +2 -2
  47. package/dist/inputs/inputs.service.js.map +1 -1
  48. package/dist/inputs/utils/inputs.utils.create.js +1 -1
  49. package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
  50. package/dist/logs/logs.service.js +1 -0
  51. package/dist/logs/logs.service.js.map +1 -1
  52. package/dist/logs/logs.types.d.ts +5 -0
  53. package/dist/logs/logs.types.js.map +1 -1
  54. package/dist/parsers/index.d.ts +3 -0
  55. package/dist/parsers/index.js +27 -0
  56. package/dist/parsers/index.js.map +1 -0
  57. package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
  58. package/dist/parsers/pipelines/postman.pipelines.js +103 -0
  59. package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
  60. package/dist/parsers/types/postman.types.d.ts +200 -0
  61. package/dist/parsers/types/postman.types.js +3 -0
  62. package/dist/parsers/types/postman.types.js.map +1 -0
  63. package/dist/parsers/utils/postman.utils.d.ts +12 -0
  64. package/dist/parsers/utils/postman.utils.js +116 -0
  65. package/dist/parsers/utils/postman.utils.js.map +1 -0
  66. package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
  67. package/dist/parsers/validators/postman-auth.validators.js +127 -0
  68. package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
  69. package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
  70. package/dist/parsers/validators/postman-request.validators.js +139 -0
  71. package/dist/parsers/validators/postman-request.validators.js.map +1 -0
  72. package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
  73. package/dist/parsers/validators/postman-response.validators.js +150 -0
  74. package/dist/parsers/validators/postman-response.validators.js.map +1 -0
  75. package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
  76. package/dist/parsers/validators/postman-variable.validators.js +163 -0
  77. package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
  78. package/dist/pricing/pricing.repo.d.ts +0 -0
  79. package/dist/pricing/pricing.repo.js +1 -0
  80. package/dist/pricing/pricing.repo.js.map +1 -0
  81. package/dist/pricing/pricing.service.d.ts +24 -0
  82. package/dist/pricing/pricing.service.js +51 -0
  83. package/dist/pricing/pricing.service.js.map +1 -0
  84. package/dist/pricing/pricing.types.d.ts +76 -0
  85. package/dist/pricing/pricing.types.js +21 -0
  86. package/dist/pricing/pricing.types.js.map +1 -0
  87. package/dist/pricing/utils/string.utils.d.ts +1 -0
  88. package/dist/pricing/utils/string.utils.js +9 -0
  89. package/dist/pricing/utils/string.utils.js.map +1 -0
  90. package/dist/processor/repos/sms.repo.d.ts +4 -4
  91. package/dist/processor/repos/sms.repo.js +23 -10
  92. package/dist/processor/repos/sms.repo.js.map +1 -1
  93. package/dist/processor/services/processor.service.d.ts +36 -5
  94. package/dist/processor/services/processor.service.js +556 -201
  95. package/dist/processor/services/processor.service.js.map +1 -1
  96. package/dist/processor/services/request.service.d.ts +36 -0
  97. package/dist/processor/services/request.service.js +304 -0
  98. package/dist/processor/services/request.service.js.map +1 -0
  99. package/dist/processor/types/request.types.d.ts +14 -0
  100. package/dist/processor/types/request.types.js +3 -0
  101. package/dist/processor/types/request.types.js.map +1 -0
  102. package/dist/processor/utils/processor.utils.d.ts +3 -0
  103. package/dist/processor/utils/processor.utils.js +88 -5
  104. package/dist/processor/utils/processor.utils.js.map +1 -1
  105. package/dist/processor/utils/request.utils.d.ts +20 -0
  106. package/dist/processor/utils/request.utils.js +113 -0
  107. package/dist/processor/utils/request.utils.js.map +1 -0
  108. package/dist/processor/utils/storage.util.js +54 -40
  109. package/dist/processor/utils/storage.util.js.map +1 -1
  110. package/dist/products/services/products.service.d.ts +21 -6
  111. package/dist/products/services/products.service.js +286 -44
  112. package/dist/products/services/products.service.js.map +1 -1
  113. package/dist/products/utils/string.utils.d.ts +1 -1
  114. package/dist/products/utils/string.utils.js +14 -2
  115. package/dist/products/utils/string.utils.js.map +1 -1
  116. package/dist/products/validators/index.d.ts +2 -1
  117. package/dist/products/validators/index.js +3 -1
  118. package/dist/products/validators/index.js.map +1 -1
  119. package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
  120. package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
  121. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
  122. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
  123. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
  124. package/dist/products/validators/joi-validators/create.userAuth.validator.js +1 -0
  125. package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +1 -1
  126. package/dist/products/validators/joi-validators/update.dataValue.validator.js +1 -0
  127. package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
  128. package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
  129. package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
  130. package/dist/products/validators/joi-validators/update.userAuth.validator.js +1 -0
  131. package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +1 -1
  132. package/dist/test/test.health.d.ts +1 -0
  133. package/dist/test/test.health.js +49 -0
  134. package/dist/test/test.health.js.map +1 -0
  135. package/dist/test/test.import.js +51 -4
  136. package/dist/test/test.import.js.map +1 -1
  137. package/dist/test/test.imports.js +22 -7
  138. package/dist/test/test.imports.js.map +1 -1
  139. package/dist/test/test.processor.js +32 -115
  140. package/dist/test/test.processor.js.map +1 -1
  141. package/dist/test/test.products.d.ts +1 -0
  142. package/dist/test/test.products.js +49 -0
  143. package/dist/test/test.products.js.map +1 -0
  144. package/dist/types/appBuilder.types.d.ts +1 -11
  145. package/dist/types/enums.d.ts +3 -1
  146. package/dist/types/enums.js +2 -0
  147. package/dist/types/enums.js.map +1 -1
  148. package/dist/types/index.types.d.ts +4 -0
  149. package/dist/types/pricing.types.d.ts +4 -0
  150. package/dist/types/pricing.types.js +3 -0
  151. package/dist/types/pricing.types.js.map +1 -0
  152. package/dist/types/processor.types.d.ts +68 -9
  153. package/dist/types/processor.types.js.map +1 -1
  154. package/dist/types/productsBuilder.types.d.ts +59 -3
  155. package/dist/types/productsBuilder.types.js +9 -1
  156. package/dist/types/productsBuilder.types.js.map +1 -1
  157. package/dist/types/request-tracker.interface.d.ts +0 -0
  158. package/dist/types/request-tracker.interface.js +1 -0
  159. package/dist/types/request-tracker.interface.js.map +1 -0
  160. package/dist/utils/constants.d.ts +1 -0
  161. package/dist/utils/constants.js +5 -0
  162. package/dist/utils/constants.js.map +1 -0
  163. package/package.json +13 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,212 @@
1
- import { ImportDocsTypes, IApp, IAppConstants, IAppEnv, IAppVariables, IAppWebhook, IAppWebhookEvent, ICreateAppBuilder, IProduct, IProductApp, IProductCache, IProductDatabase, IProductDatabaseAction, IProductEnv, IProductFeature, IProductJobs, IProductStorage, IProcessorInput, IActionProcessorInput, IDBActionProcessorInput, IProductMessageBroker, IProductNotification, INotificationProcessorInput, IProductNotificationTemplate, IStorageProcessorInput, IParsedSample, IRegisterWebhook, IGenerateWebhookLink, IAppAuth, IMessageBrokerPublishInput, IMessageBrokerSubscribeInput, IProductMessageBrokerTopic, IAppAction, IProductDatabaseMigration, LogQueryParams, IProductQuota, FetchRemoteCachePayload, IFileReadResult, IProductSession, ISessionInput, IActionUpdate, IProductFallback } from './types';
1
+ import { ImportDocsTypes, IApp, IAppConstants, IAppEnv, IAppVariables, IAppWebhook, IAppWebhookEvent, ICreateAppBuilder, IProduct, IProductApp, IProductCache, IProductDatabase, IProductDatabaseAction, IProductEnv, IProductFeature, IProductJobs, IProductStorage, IProcessorInput, IActionProcessorInput, IDBActionProcessorInput, IProductMessageBroker, IProductNotification, INotificationProcessorInput, IProductNotificationTemplate, IStorageProcessorInput, IParsedSample, IRegisterWebhook, IGenerateWebhookLink, IAppAuth, IMessageBrokerPublishInput, IMessageBrokerSubscribeInput, IProductMessageBrokerTopic, IAppAction, IProductDatabaseMigration, LogQueryParams, IProductQuota, FetchRemoteCachePayload, IFileReadResult, IProductSession, ISessionInput, IActionUpdate, IProductFallback, IFetchFilesPayload, ISessionPayload, ISessionRefreshPayload, IFetchUsersPayload, IProductAppHealth } from './types';
2
2
  import { IDuctapeInit } from './types/index.types';
3
3
  import { PublicStates } from './types/enums';
4
+ /**
5
+ * @typedef {Object} IProduct
6
+ * @property {string} tag - Unique product tag.
7
+ * @property {string} name - Product name.
8
+ * @property {string} [description] - Optional product description.
9
+ * @property {Array<IProductApp>} [apps] - Associated apps.
10
+ * @property {Array<IProductSession>} [sessions] - Product sessions.
11
+ * @property {Array<IProductFeature>} [features] - Product features.
12
+ * @property {Array<IProductQuota>} [quotas] - Product quotas.
13
+ * @property {Array<IProductFallback>} [fallbacks] - Product fallbacks.
14
+ * @property {Array<IProductEnv>} [environments] - Product environments.
15
+ * @property {Array<IProductStorage>} [storages] - Product storages.
16
+ * @property {Array<IProductMessageBroker>} [messageBrokers] - Product message brokers.
17
+ * @property {Array<IProductNotification>} [notifications] - Product notifications.
18
+ * @property {Array<IProductDatabase>} [databases] - Product databases.
19
+ * @property {Array<IProductJobs>} [jobs] - Product jobs.
20
+ * @property {Array<IProductCache>} [caches] - Product caches.
21
+ * @property {Array<IProductFunction>} [functions] - Product functions.
22
+ * @see ts/src/types/productsBuilder.types.ts
23
+ */
24
+ /**
25
+ * @typedef {Object} IApp
26
+ * @property {string} tag - Unique app tag.
27
+ * @property {string} name - App name.
28
+ * @property {string} [description] - Optional app description.
29
+ * @property {Array<IAppVariables>} [variables] - App variables.
30
+ * @property {Array<IAppConstants>} [constants] - App constants.
31
+ * @property {Array<IAppWebhook>} [webhooks] - App webhooks.
32
+ * @property {Array<IAppEnv>} [environments] - App environments.
33
+ * @property {Array<IAppAction>} [actions] - App actions.
34
+ * @property {Array<IAppAuth>} [auths] - App authentication configs.
35
+ * @see ts/src/types/appBuilder.types.ts
36
+ */
37
+ /**
38
+ * @typedef {Object} IProductSession
39
+ * @property {string} tag - Session tag.
40
+ * @property {string} token - Session token.
41
+ * @property {string} [user_id] - Associated user ID.
42
+ * @property {string} [product_tag] - Associated product tag.
43
+ * @property {Record<string, unknown>} [data] - Session data.
44
+ * @see ts/src/types/productsBuilder.types.ts
45
+ */
46
+ /**
47
+ * @typedef {Object} IProductApp
48
+ * @property {string} tag - App tag.
49
+ * @property {string} name - App name.
50
+ * @property {string} [description] - App description.
51
+ * @property {Array<IAppEnv>} [environments] - App environments.
52
+ * @see ts/src/types/productsBuilder.types.ts
53
+ */
54
+ /**
55
+ * @typedef {Object} IProductFeature
56
+ * @property {string} tag - Feature tag.
57
+ * @property {string} name - Feature name.
58
+ * @property {string} [description] - Feature description.
59
+ * @property {Array<any>} [actions] - Feature actions.
60
+ * @see ts/src/types/productsBuilder.types.ts
61
+ */
62
+ /**
63
+ * @typedef {Object} IProductQuota
64
+ * @property {string} tag - Quota tag.
65
+ * @property {string} name - Quota name.
66
+ * @property {number} [limit] - Quota limit.
67
+ * @property {string} [period] - Quota period.
68
+ * @see ts/src/types/productsBuilder.types.ts
69
+ */
70
+ /**
71
+ * @typedef {Object} IProductFallback
72
+ * @property {string} tag - Fallback tag.
73
+ * @property {string} name - Fallback name.
74
+ * @property {string} [description] - Fallback description.
75
+ * @see ts/src/types/productsBuilder.types.ts
76
+ */
77
+ /**
78
+ * @typedef {Object} IProductEnv
79
+ * @property {string} slug - Environment slug.
80
+ * @property {string} [name] - Environment name.
81
+ * @property {string} [description] - Environment description.
82
+ * @see ts/src/types/productsBuilder.types.ts
83
+ */
84
+ /**
85
+ * @typedef {Object} IProductStorage
86
+ * @property {string} tag - Storage tag.
87
+ * @property {string} name - Storage name.
88
+ * @property {string} [description] - Storage description.
89
+ * @see ts/src/types/productsBuilder.types.ts
90
+ */
91
+ /**
92
+ * @typedef {Object} IProductMessageBroker
93
+ * @property {string} tag - Message broker tag.
94
+ * @property {string} name - Message broker name.
95
+ * @property {string} [description] - Message broker description.
96
+ * @property {Array<IProductMessageBrokerTopic>} [topics] - Message broker topics.
97
+ * @see ts/src/types/productsBuilder.types.ts
98
+ */
99
+ /**
100
+ * @typedef {Object} IProductNotification
101
+ * @property {string} tag - Notification tag.
102
+ * @property {string} name - Notification name.
103
+ * @property {string} [description] - Notification description.
104
+ * @property {Array<IProductNotificationTemplate>} [messages] - Notification messages.
105
+ * @see ts/src/types/productsBuilder.types.ts
106
+ */
107
+ /**
108
+ * @typedef {Object} IProductDatabase
109
+ * @property {string} tag - Database tag.
110
+ * @property {string} name - Database name.
111
+ * @property {string} [description] - Database description.
112
+ * @property {Array<IProductDatabaseAction>} [actions] - Database actions.
113
+ * @property {Array<IProductDatabaseMigration>} [migrations] - Database migrations.
114
+ * @see ts/src/types/productsBuilder.types.ts
115
+ */
116
+ /**
117
+ * @typedef {Object} IProductJobs
118
+ * @property {string} tag - Job tag.
119
+ * @property {string} name - Job name.
120
+ * @property {string} [description] - Job description.
121
+ * @see ts/src/types/productsBuilder.types.ts
122
+ */
123
+ /**
124
+ * @typedef {Object} IProductCache
125
+ * @property {string} tag - Cache tag.
126
+ * @property {string} name - Cache name.
127
+ * @property {string} [description] - Cache description.
128
+ * @see ts/src/types/productsBuilder.types.ts
129
+ */
130
+ /**
131
+ * @typedef {Object} IProductFunction
132
+ * @property {string} tag - Function tag.
133
+ * @property {string} name - Function name.
134
+ * @property {string} [description] - Function description.
135
+ * @see ts/src/types/productsBuilder.types.ts
136
+ */
137
+ /**
138
+ * @typedef {Object} IAppVariables
139
+ * @property {string} tag - Variable tag.
140
+ * @property {string} name - Variable name.
141
+ * @property {string} [description] - Variable description.
142
+ * @see ts/src/types/appBuilder.types.ts
143
+ */
144
+ /**
145
+ * @typedef {Object} IAppConstants
146
+ * @property {string} tag - Constant tag.
147
+ * @property {string} name - Constant name.
148
+ * @property {string} [description] - Constant description.
149
+ * @see ts/src/types/appBuilder.types.ts
150
+ */
151
+ /**
152
+ * @typedef {Object} IAppWebhook
153
+ * @property {string} tag - Webhook tag.
154
+ * @property {string} url - Webhook URL.
155
+ * @property {string} [description] - Webhook description.
156
+ * @property {Array<IAppWebhookEvent>} [events] - Webhook events.
157
+ * @see ts/src/types/appBuilder.types.ts
158
+ */
159
+ /**
160
+ * @typedef {Object} IAppWebhookEvent
161
+ * @property {string} tag - Webhook event tag.
162
+ * @property {string} name - Webhook event name.
163
+ * @property {string} [description] - Webhook event description.
164
+ * @see ts/src/types/appBuilder.types.ts
165
+ */
166
+ /**
167
+ * @typedef {Object} IAppEnv
168
+ * @property {string} slug - Environment slug.
169
+ * @property {string} [name] - Environment name.
170
+ * @property {string} [description] - Environment description.
171
+ * @see ts/src/types/appBuilder.types.ts
172
+ */
173
+ /**
174
+ * @typedef {Object} IAppAction
175
+ * @property {string} tag - Action tag.
176
+ * @property {string} name - Action name.
177
+ * @property {string} [description] - Action description.
178
+ * @see ts/src/types/appBuilder.types.ts
179
+ */
180
+ /**
181
+ * @typedef {Object} IAppAuth
182
+ * @property {string} tag - Auth tag.
183
+ * @property {string} name - Auth name.
184
+ * @property {string} [description] - Auth description.
185
+ * @see ts/src/types/appBuilder.types.ts
186
+ */
187
+ /**
188
+ * @typedef {Object} IProductAppHealth
189
+ * @property {string} name - Health check name.
190
+ * @property {string} description - Health check description.
191
+ * @property {string} tag - Health check tag.
192
+ * @property {string} app - App access tag.
193
+ * @property {string} action - Action to execute for health check.
194
+ * @property {number} checkIntervals - Interval between health checks in milliseconds.
195
+ * @property {number} retries - Number of retry attempts.
196
+ * @property {Array<CheckEnvStatus>} envs - Environment-specific health check configurations.
197
+ * @see ts/src/types/productsBuilder.types.ts
198
+ */
199
+ /**
200
+ * @typedef {Object} CheckEnvStatus
201
+ * @property {string} slug - Environment slug.
202
+ * @property {string} [status] - Current health status.
203
+ * @property {string} [lastAvailable] - Last available timestamp.
204
+ * @property {string} [lastChecked] - Last check timestamp.
205
+ * @property {string} [lastLatency] - Last response latency.
206
+ * @property {string} [averageLatency] - Average response latency.
207
+ * @property {any} input - Health check input data.
208
+ * @see ts/src/types/productsBuilder.types.ts
209
+ */
4
210
  export interface IDuctape {
5
211
  }
6
212
  export default class Ductape implements IDuctape {
@@ -25,192 +231,838 @@ export default class Ductape implements IDuctape {
25
231
  private environment;
26
232
  private redis_url;
27
233
  private redisClient?;
234
+ private jobsQueue;
235
+ private healthCheckQueue;
236
+ private healthCheckUpdaterQueue;
237
+ jobsWorker: any;
238
+ healthCheckWorker: any;
239
+ healthCheckUpdaterWorker: any;
28
240
  private loadRedis;
29
241
  constructor({ workspace_id, private_key, user_id, env_type, redis_url }: IDuctapeInit);
30
- connectRedis(): Promise<void>;
242
+ private loadBullMQ;
243
+ /**
244
+ * Connects to Redis and initializes job and health check queues and workers.
245
+ * @throws {Error} If called in a browser environment or if Redis URL is missing.
246
+ * @returns {Promise<void>} Resolves when Redis and queues are initialized.
247
+ */
248
+ monitor(): Promise<void>;
249
+ /**
250
+ * Schedules all healthcheck jobs for all products and environments.
251
+ */
252
+ private scheduleAllHealthcheckJobs;
253
+ /**
254
+ * Schedules a single healthcheck job with the given interval (ms).
255
+ * If interval is not provided, defaults to 60s.
256
+ */
257
+ private scheduleHealthcheckJob;
258
+ /**
259
+ * Sets the authentication token for API requests.
260
+ * @param {string} token - The authentication token.
261
+ */
31
262
  setToken(token: string): void;
263
+ /**
264
+ * Sets the public key for API requests.
265
+ * @param {string} public_key - The public key.
266
+ */
32
267
  setPublicKey(public_key: string): void;
33
268
  private initProduct;
34
269
  private initApp;
35
270
  private checkProductInit;
36
271
  private checkAppInit;
272
+ /**
273
+ * Product-related operations for managing products, sessions, apps, quotas, and fallbacks.
274
+ */
37
275
  product: {
276
+ /**
277
+ * Creates a new product.
278
+ * @param {IProduct} data - The product data.
279
+ * @returns {Promise<void>} Resolves when the product is created. Throws on error.
280
+ */
38
281
  create: (data: IProduct) => Promise<void>;
282
+ /**
283
+ * Fetches a product by tag.
284
+ * @param {string} tag - The product tag.
285
+ * @returns {Promise<IProduct|null>} The fetched product, or null if not found.
286
+ */
39
287
  fetch: (tag: string) => Promise<IProduct>;
288
+ /**
289
+ * Updates a product by tag.
290
+ * @param {string} tag - The product tag.
291
+ * @param {Partial<IProduct>} data - The product data to update.
292
+ * @returns {Promise<void>} Resolves when the product is updated. Throws on error.
293
+ */
40
294
  update: (tag: string, data: Partial<IProduct>) => Promise<void>;
295
+ /**
296
+ * Initializes a product by tag.
297
+ * @param {string} productTag - The product tag.
298
+ * @returns {Promise<void>} Resolves when initialization is complete. Throws on error.
299
+ */
41
300
  init: (productTag: string) => Promise<void>;
42
301
  sessions: {
302
+ /**
303
+ * Creates a new product session.
304
+ * @param {IProductSession} payload - The session payload.
305
+ * @returns {Promise<void>} Resolves when the session is created. Throws on error.
306
+ */
43
307
  create: (payload: IProductSession) => Promise<void>;
308
+ /**
309
+ * Updates a product session by tag.
310
+ * @param {string} tag - The session tag.
311
+ * @param {Partial<IProductSession>} payload - The session data to update.
312
+ * @returns {Promise<void>} Resolves when the session is updated. Throws on error.
313
+ */
44
314
  update: (tag: string, payload: Partial<IProductSession>) => Promise<void>;
315
+ /**
316
+ * Fetches all product sessions.
317
+ * @returns {IProductSession[]} The list of sessions.
318
+ */
45
319
  fetchAll: () => IProductSession[];
320
+ /**
321
+ * Fetches a product session by tag.
322
+ * @param {string} tag - The session tag.
323
+ * @returns {IProductSession|null} The fetched session, or null if not found.
324
+ */
46
325
  fetch: (tag: string) => IProductSession;
326
+ /**
327
+ * Fetches users for a session.
328
+ * @param {IFetchUsersPayload} data - The user fetch payload.
329
+ * @returns {Promise<any[]>} The users for the session.
330
+ */
331
+ users: (data: IFetchUsersPayload) => Promise<import("./types").IFileURLPayload[]>;
47
332
  };
48
333
  apps: {
334
+ /**
335
+ * Connects an app to a product by app tag.
336
+ * @param {string} appTag - The app tag.
337
+ * @returns {Promise<IAppAccess>} The result of the connection.
338
+ */
49
339
  connect: (appTag: string) => Promise<import("./types").IAppAccess>;
340
+ /**
341
+ * Adds an app to a product.
342
+ * @param {IProductApp} app - The app data.
343
+ * @returns {Promise<void>} Resolves when the app is added. Throws on error.
344
+ */
50
345
  add: (app: IProductApp) => Promise<void>;
346
+ /**
347
+ * Fetches all apps for a product.
348
+ * @returns {IProductApp[]} The list of apps.
349
+ */
51
350
  fetchAll: () => Promise<IProductApp[]>;
351
+ /**
352
+ * Fetches an app by tag.
353
+ * @param {string} tag - The app tag.
354
+ * @returns {IProductApp|null} The fetched app, or null if not found.
355
+ */
52
356
  fetch: (tag: string) => Promise<IProductApp>;
357
+ /**
358
+ * Updates an app by access tag.
359
+ * @param {string} accessTag - The app access tag.
360
+ * @param {Partial<IProductApp>} data - The app data to update.
361
+ * @returns {Promise<void>} Resolves when the app is updated. Throws on error.
362
+ */
53
363
  update: (accessTag: string, data: Partial<IProductApp>) => Promise<void>;
54
364
  webhooks: {
365
+ /**
366
+ * Fetches all webhooks for an app by access tag.
367
+ * @param {string} accessTag - The app access tag.
368
+ * @returns {Promise<IAppWebhook[]>} The list of webhooks.
369
+ */
55
370
  fetchAll: (accessTag: string) => Promise<IAppWebhook[]>;
371
+ /**
372
+ * Enables a webhook for an app.
373
+ * @param {IRegisterWebhook} data - The webhook registration data.
374
+ * @returns {Promise<void>} Resolves when the webhook is enabled. Throws on error.
375
+ */
56
376
  enable: (data: IRegisterWebhook) => Promise<void>;
377
+ /**
378
+ * Generates a webhook link for an app.
379
+ * @param {IGenerateWebhookLink} data - The webhook link data.
380
+ * @returns {Promise<string>} The generated webhook link.
381
+ */
57
382
  generateLink: (data: IGenerateWebhookLink) => Promise<string>;
58
383
  };
384
+ health: {
385
+ /**
386
+ * Creates a health check for an app.
387
+ * @param {Partial<IProductAppHealth>} data - The health check data.
388
+ * @returns {Promise<void>} Resolves when the health check is created. Throws on error.
389
+ */
390
+ create: (data: Partial<IProductAppHealth>) => Promise<void>;
391
+ /**
392
+ * Updates a health check by tag.
393
+ * @param {string} tag - The health check tag.
394
+ * @param {Partial<IProductAppHealth>} data - The health check data to update.
395
+ * @returns {Promise<void>} Resolves when the health check is updated. Throws on error.
396
+ */
397
+ update: (tag: string, data: Partial<IProductAppHealth>) => Promise<void>;
398
+ /**
399
+ * Fetches a health check by access tag and tag.
400
+ * @param {string} access_tag - The app access tag.
401
+ * @param {string} tag - The health check tag.
402
+ * @returns {Promise<IProductAppHealth|null>} The fetched health check, or null if not found.
403
+ */
404
+ fetch: (access_tag: string, tag: string) => Promise<IProductAppHealth>;
405
+ /**
406
+ * Fetches all health checks for an app by access tag.
407
+ * @param {string} access_tag - The app access tag.
408
+ * @returns {Promise<IProductAppHealth[]>} The list of health checks.
409
+ */
410
+ fetchAll: (access_tag: string) => Promise<IProductAppHealth[]>;
411
+ };
59
412
  };
413
+ /**
414
+ * Creates a quota for a product.
415
+ * @param {Partial<IProductQuota>} data - The quota data.
416
+ * @returns {Promise<void>} Resolves when the quota is created. Throws on error.
417
+ */
60
418
  quota: {
61
419
  create: (data: Partial<IProductQuota>) => Promise<void>;
420
+ /**
421
+ * Fetches a quota by tag.
422
+ * @param {string} tag - The quota tag.
423
+ * @returns {IProductQuota|null} The fetched quota, or null if not found.
424
+ */
62
425
  fetch: (tag: string) => IProductQuota;
426
+ /**
427
+ * Fetches all quotas for a product.
428
+ * @returns {IProductQuota[]} The list of quotas.
429
+ */
63
430
  fetchAll: () => IProductQuota[];
431
+ /**
432
+ * Updates a quota by tag.
433
+ * @param {string} tag - The quota tag.
434
+ * @param {Partial<IProductQuota>} data - The quota data to update.
435
+ * @returns {Promise<void>} Resolves when the quota is updated. Throws on error.
436
+ */
64
437
  update: (tag: string, data: Partial<IProductQuota>) => Promise<void>;
65
438
  };
439
+ /**
440
+ * Creates a fallback for a product.
441
+ * @param {Partial<IProductFallback>} data - The fallback data.
442
+ * @returns {Promise<void>} Resolves when the fallback is created. Throws on error.
443
+ */
66
444
  fallback: {
67
445
  create: (data: Partial<IProductFallback>) => Promise<void>;
446
+ /**
447
+ * Fetches a fallback by tag.
448
+ * @param {string} tag - The fallback tag.
449
+ * @returns {IProductFallback|null} The fetched fallback, or null if not found.
450
+ */
68
451
  fetch: (tag: string) => IProductFallback;
452
+ /**
453
+ * Fetches all fallbacks for a product.
454
+ * @returns {IProductFallback[]} The list of fallbacks.
455
+ */
69
456
  fetchAll: () => IProductFallback[];
457
+ /**
458
+ * Updates a fallback by tag.
459
+ * @param {string} tag - The fallback tag.
460
+ * @param {Partial<IProductFallback>} data - The fallback data to update.
461
+ * @returns {Promise<void>} Resolves when the fallback is updated. Throws on error.
462
+ */
70
463
  update: (tag: string, data: Partial<IProductFallback>) => Promise<void>;
71
464
  };
465
+ /**
466
+ * Updates data validation for a product.
467
+ * @param {string} tag - The product tag.
468
+ * @param {Partial<IParsedSample>} update - The update data.
469
+ * @returns {Promise<void>} Resolves when the validation is updated. Throws on error.
470
+ */
72
471
  updateValidation: (tag: string, update: Partial<IParsedSample>) => Promise<boolean>;
73
472
  environments: {
473
+ /**
474
+ * Creates an environment for a product.
475
+ * @param {IProductEnv} data - The environment data.
476
+ * @returns {Promise<void>} Resolves when the environment is created. Throws on error.
477
+ */
74
478
  create: (data: IProductEnv) => Promise<void>;
479
+ /**
480
+ * Fetches all environments for a product.
481
+ * @returns {IAppEnv[]} The list of environments.
482
+ */
75
483
  fetchAll: () => IProductEnv[];
484
+ /**
485
+ * Fetches an environment by slug.
486
+ * @param {string} slug - The environment slug.
487
+ * @returns {IAppEnv|null} The fetched environment, or null if not found.
488
+ */
76
489
  fetch: (slug: string) => IProductEnv;
490
+ /**
491
+ * Updates an environment by slug.
492
+ * @param {string} slug - The environment slug.
493
+ * @param {Partial<IProductEnv>} data - The environment data to update.
494
+ * @returns {Promise<void>} Resolves when the environment is updated. Throws on error.
495
+ */
77
496
  update: (slug: string, data: Partial<IProductEnv>) => Promise<void>;
78
497
  };
79
498
  storage: {
499
+ /**
500
+ * Creates a storage for a product.
501
+ * @param {IProductStorage} data - The storage data.
502
+ * @returns {Promise<void>} Resolves when the storage is created. Throws on error.
503
+ */
80
504
  create: (data: IProductStorage) => Promise<void>;
505
+ /**
506
+ * Fetches all storages for a product.
507
+ * @returns {IProductStorage[]} The list of storages.
508
+ */
81
509
  fetchAll: () => IProductStorage[];
510
+ /**
511
+ * Fetches a storage by tag.
512
+ * @param {string} tag - The storage tag.
513
+ * @returns {IProductStorage|null} The fetched storage, or null if not found.
514
+ */
82
515
  fetch: (tag: string) => IProductStorage;
516
+ /**
517
+ * Updates a storage by tag.
518
+ * @param {string} tag - The storage tag.
519
+ * @param {Partial<IProductStorage>} data - The storage data to update.
520
+ * @returns {Promise<void>} Resolves when the storage is updated. Throws on error.
521
+ */
83
522
  update: (tag: string, data: Partial<IProductStorage>) => Promise<void>;
523
+ /**
524
+ * Fetches storage files for a product.
525
+ * @param {IFetchFilesPayload} data - The fetch files payload.
526
+ * @returns {Promise<void>} Resolves when the storage files are fetched. Throws on error.
527
+ */
528
+ files: (data: IFetchFilesPayload) => Promise<import("./types").IFileURLPayload[]>;
84
529
  };
85
530
  messageBrokers: {
531
+ /**
532
+ * Creates a message broker for a product.
533
+ * @param {Partial<IProductMessageBroker>} data - The message broker data.
534
+ * @returns {Promise<void>} Resolves when the message broker is created. Throws on error.
535
+ */
86
536
  create: (data: Partial<IProductMessageBroker>) => Promise<void>;
537
+ /**
538
+ * Fetches all message brokers for a product.
539
+ * @returns {IProductMessageBroker[]} The list of message brokers.
540
+ */
87
541
  fetchAll: () => IProductMessageBroker[];
542
+ /**
543
+ * Fetches a message broker by tag.
544
+ * @param {string} tag - The message broker tag.
545
+ * @returns {IProductMessageBroker|null} The fetched message broker, or null if not found.
546
+ */
88
547
  fetch: (tag: string) => IProductMessageBroker;
548
+ /**
549
+ * Updates a message broker by tag.
550
+ * @param {string} tag - The message broker tag.
551
+ * @param {Partial<IProductMessageBroker>} data - The message broker data to update.
552
+ * @returns {Promise<void>} Resolves when the message broker is updated. Throws on error.
553
+ */
89
554
  update: (tag: string, data: Partial<IProductMessageBroker>) => Promise<void>;
90
555
  topics: {
556
+ /**
557
+ * Creates a message broker topic for a product.
558
+ * @param {IProductMessageBrokerTopic} data - The message broker topic data.
559
+ * @returns {Promise<void>} Resolves when the message broker topic is created. Throws on error.
560
+ */
91
561
  create: (data: IProductMessageBrokerTopic) => Promise<void>;
562
+ /**
563
+ * Fetches all message broker topics for a message broker by tag.
564
+ * @param {string} messageBrokerTag - The message broker tag.
565
+ * @returns {IProductMessageBrokerTopic[]} The list of message broker topics.
566
+ */
92
567
  fetchAll: (messageBrokerTag: string) => IProductMessageBrokerTopic[];
568
+ /**
569
+ * Fetches a message broker topic by tag.
570
+ * @param {string} tag - The message broker topic tag.
571
+ * @returns {IProductMessageBrokerTopic|null} The fetched message broker topic, or null if not found.
572
+ */
93
573
  fetch: (tag: string) => IProductMessageBrokerTopic;
574
+ /**
575
+ * Updates a message broker topic by tag.
576
+ * @param {string} tag - The message broker topic tag.
577
+ * @param {Partial<IProductMessageBrokerTopic>} data - The message broker topic data to update.
578
+ * @returns {Promise<void>} Resolves when the message broker topic is updated. Throws on error.
579
+ */
94
580
  update: (tag: string, data: Partial<IProductMessageBrokerTopic>) => Promise<void>;
95
581
  };
96
582
  };
97
583
  notifications: {
584
+ /**
585
+ * Creates a notification for a product.
586
+ * @param {IProductNotification} data - The notification data.
587
+ * @returns {Promise<void>} Resolves when the notification is created. Throws on error.
588
+ */
98
589
  create: (data: IProductNotification) => Promise<void>;
590
+ /**
591
+ * Fetches all notifications for a product.
592
+ * @returns {IProductNotification[]} The list of notifications.
593
+ */
99
594
  fetchAll: () => IProductNotification[];
595
+ /**
596
+ * Fetches a notification by tag.
597
+ * @param {string} tag - The notification tag.
598
+ * @returns {IProductNotification|null} The fetched notification, or null if not found.
599
+ */
100
600
  fetch: (tag: string) => IProductNotification;
601
+ /**
602
+ * Updates a notification by tag.
603
+ * @param {string} tag - The notification tag.
604
+ * @param {Partial<IProductNotification>} data - The notification data to update.
605
+ * @returns {Promise<void>} Resolves when the notification is updated. Throws on error.
606
+ */
101
607
  update: (tag: string, data: Partial<IProductNotification>) => Promise<void>;
102
608
  messages: {
609
+ /**
610
+ * Creates a notification message for a product.
611
+ * @param {IProductNotificationTemplate} data - The notification message data.
612
+ * @returns {Promise<void>} Resolves when the notification message is created. Throws on error.
613
+ */
103
614
  create: (data: IProductNotificationTemplate) => Promise<void>;
615
+ /**
616
+ * Fetches all notification messages for a notification by tag.
617
+ * @param {string} notificationTag - The notification tag.
618
+ * @returns {IProductNotificationTemplate[]} The list of notification messages.
619
+ */
104
620
  fetchAll: (notificationTag: string) => IProductNotificationTemplate[];
621
+ /**
622
+ * Fetches a notification message by tag.
623
+ * @param {string} tag - The notification message tag.
624
+ * @returns {IProductNotificationTemplate|null} The fetched notification message, or null if not found.
625
+ */
105
626
  fetch: (tag: string) => IProductNotificationTemplate;
627
+ /**
628
+ * Updates a notification message by tag.
629
+ * @param {string} tag - The notification message tag.
630
+ * @param {Partial<IProductNotificationTemplate>} data - The notification message data to update.
631
+ * @returns {Promise<void>} Resolves when the notification message is updated. Throws on error.
632
+ */
106
633
  update: (tag: string, data: Partial<IProductNotificationTemplate>) => Promise<void>;
107
634
  };
108
635
  };
109
636
  databases: {
637
+ /**
638
+ * Creates a database for a product.
639
+ * @param {IProductDatabase} data - The database data.
640
+ * @returns {Promise<void>} Resolves when the database is created. Throws on error.
641
+ */
110
642
  create: (data: IProductDatabase) => Promise<void>;
643
+ /**
644
+ * Fetches all databases for a product.
645
+ * @returns {IProductDatabase[]} The list of databases.
646
+ */
111
647
  fetchAll: () => IProductDatabase[];
648
+ /**
649
+ * Fetches a database by tag.
650
+ * @param {string} tag - The database tag.
651
+ * @returns {IProductDatabase|null} The fetched database, or null if not found.
652
+ */
112
653
  fetch: (tag: string) => IProductDatabase;
654
+ /**
655
+ * Updates a database by tag.
656
+ * @param {string} tag - The database tag.
657
+ * @param {Partial<IProductDatabase>} data - The database data to update.
658
+ * @returns {Promise<void>} Resolves when the database is updated. Throws on error.
659
+ */
113
660
  update: (tag: string, data: Partial<IProductDatabase>) => Promise<void>;
114
661
  actions: {
662
+ /**
663
+ * Creates a database action for a product.
664
+ * @param {IProductDatabaseAction} data - The database action data.
665
+ * @returns {Promise<void>} Resolves when the database action is created. Throws on error.
666
+ */
115
667
  create: (data: IProductDatabaseAction) => Promise<void>;
668
+ /**
669
+ * Fetches all database actions for a product.
670
+ * @param {string} databaseTag - The database tag.
671
+ * @returns {IProductDatabaseAction[]} The list of database actions.
672
+ */
116
673
  fetchAll: (databaseTag: string) => IProductDatabaseAction[];
674
+ /**
675
+ * Fetches a database action by tag.
676
+ * @param {string} tag - The database action tag.
677
+ * @returns {IProductDatabaseAction|null} The fetched database action, or null if not found.
678
+ */
117
679
  fetch: (tag: string) => IProductDatabaseAction;
680
+ /**
681
+ * Updates a database action by tag.
682
+ * @param {string} tag - The database action tag.
683
+ * @param {Partial<IProductDatabaseAction>} data - The database action data to update.
684
+ * @returns {Promise<void>} Resolves when the database action is updated. Throws on error.
685
+ */
118
686
  update: (tag: string, data: Partial<IProductDatabaseAction>) => Promise<void>;
119
687
  };
120
688
  migrations: {
689
+ /**
690
+ * Creates a database migration for a product.
691
+ * @param {IProductDatabaseMigration} data - The database migration data.
692
+ * @returns {void} Resolves when the database migration is created. Throws on error.
693
+ */
121
694
  create: (data: IProductDatabaseMigration) => Promise<void>;
695
+ /**
696
+ * Fetches all database migrations for a product.
697
+ * @param {string} databaseTag - The database tag.
698
+ * @returns {IProductDatabaseMigration[]} The list of database migrations.
699
+ */
122
700
  fetchAll: (databaseTag: string) => IProductDatabaseMigration[];
701
+ /**
702
+ * Fetches a database migration by tag.
703
+ * @param {string} tag - The database migration tag.
704
+ * @returns {IProductDatabaseMigration|null} The fetched database migration, or null if not found.
705
+ */
123
706
  fetch: (tag: string) => IProductDatabaseMigration;
707
+ /**
708
+ * Updates a database migration by tag.
709
+ * @param {string} tag - The database migration tag.
710
+ * @param {Partial<IProductDatabaseMigration>} data - The database migration data to update.
711
+ * @returns {void} Resolves when the database migration is updated. Throws on error.
712
+ */
124
713
  update: (tag: string, data: Partial<IProductDatabaseMigration>) => Promise<void>;
125
714
  };
126
715
  };
127
716
  jobs: {
717
+ /**
718
+ * Creates a job for a product.
719
+ * @param {Partial<IProductJobs>} data - The job data.
720
+ * @returns {Promise<void>} Resolves when the job is created. Throws on error.
721
+ */
128
722
  create: (data: Partial<IProductJobs>) => Promise<void>;
723
+ /**
724
+ * Fetches all jobs for a product.
725
+ * @returns {IProductJobs[]} The list of jobs.
726
+ */
129
727
  fetchAll: () => IProductJobs[];
728
+ /**
729
+ * Fetches a job by tag.
730
+ * @param {string} tag - The job tag.
731
+ * @returns {IProductJobs|null} The fetched job, or null if not found.
732
+ */
130
733
  fetch: (tag: string) => IProductJobs;
734
+ /**
735
+ * Updates a job by tag.
736
+ * @param {string} tag - The job tag.
737
+ * @param {Partial<IProductJobs>} data - The job data to update.
738
+ * @returns {Promise<void>} Resolves when the job is updated. Throws on error.
739
+ */
131
740
  update: (tag: string, data: Partial<IProductJobs>) => Promise<void>;
132
741
  };
133
742
  caches: {
743
+ /**
744
+ * Creates a cache for a product.
745
+ * @param {IProductCache} data - The cache data.
746
+ * @returns {Promise<void>} Resolves when the cache is created. Throws on error.
747
+ */
134
748
  create: (data: IProductCache) => Promise<void>;
749
+ /**
750
+ * Fetches all caches for a product.
751
+ * @returns {IProductCache[]} The list of caches.
752
+ */
135
753
  fetchAll: () => IProductCache[];
754
+ /**
755
+ * Fetches a cache by tag.
756
+ * @param {string} tag - The cache tag.
757
+ * @returns {IProductCache|null} The fetched cache, or null if not found.
758
+ */
136
759
  fetch: (tag: string) => IProductCache;
760
+ /**
761
+ * Updates a cache by tag.
762
+ * @param {string} tag - The cache tag.
763
+ * @param {Partial<IProductCache>} data - The cache data to update.
764
+ * @returns {Promise<void>} Resolves when the cache is updated. Throws on error.
765
+ */
137
766
  update: (tag: string, data: Partial<IProductCache>) => Promise<void>;
138
767
  values: (data: FetchRemoteCachePayload) => Promise<import("./types").IRemoteCache[]>;
139
768
  };
140
769
  features: {
770
+ /**
771
+ * Creates a feature for a product.
772
+ * @param {Partial<IProductFeature>} data - The feature data.
773
+ * @returns {Promise<void>} Resolves when the feature is created. Throws on error.
774
+ */
141
775
  create: (data: Partial<IProductFeature>) => Promise<void>;
776
+ /**
777
+ * Fetches all features for a product.
778
+ * @returns {IProductFeature[]} The list of features.
779
+ */
142
780
  fetchAll: () => IProductFeature[];
781
+ /**
782
+ * Fetches a feature by tag.
783
+ * @param {string} tag - The feature tag.
784
+ * @returns {IProductFeature|null} The fetched feature, or null if not found.
785
+ */
143
786
  fetch: (tag: string) => IProductFeature;
787
+ /**
788
+ * Updates a feature by tag.
789
+ * @param {string} tag - The feature tag.
790
+ * @param {Partial<IProductCache>} data - The feature data to update.
791
+ * @returns {Promise<void>} Resolves when the feature is updated. Throws on error.
792
+ */
144
793
  update: (tag: string, data: Partial<IProductCache>) => Promise<void>;
145
794
  };
146
795
  };
796
+ /**
797
+ * App-related operations for managing apps, variables, constants, actions, auths, webhooks, environments, and validation.
798
+ */
147
799
  app: {
800
+ /**
801
+ * Creates a new app.
802
+ * @param {ICreateAppBuilder} data - The app data.
803
+ * @returns {Promise<{ app_id: string }>} The ID of the created app.
804
+ */
148
805
  create: (data: ICreateAppBuilder) => Promise<{
149
806
  app_id: string;
150
807
  }>;
808
+ /**
809
+ * Fetches an app by tag.
810
+ * @param {string} tag - The app tag.
811
+ * @returns {Promise<IApp|null>} The fetched app, or null if not found.
812
+ */
151
813
  fetch: (tag: string) => Promise<IApp>;
814
+ /**
815
+ * Updates an app by tag.
816
+ * @param {string} tag - The app tag.
817
+ * @param {Partial<IApp>} data - The app data to update.
818
+ * @returns {Promise<void>} Resolves when the app is updated. Throws on error.
819
+ */
152
820
  update: (tag: string, data: Partial<IApp>) => Promise<void>;
821
+ /**
822
+ * Initializes an app by tag.
823
+ * @param {string} appTag - The app tag.
824
+ * @returns {Promise<void>} Resolves when initialization is complete. Throws on error.
825
+ */
153
826
  init: (appTag: string) => Promise<void>;
154
827
  variables: {
828
+ /**
829
+ * Creates a variable for an app.
830
+ * @param {IAppVariables} data - The variable data.
831
+ * @returns {Promise<void>} Resolves when the variable is created. Throws on error.
832
+ */
155
833
  create: (data: IAppVariables) => Promise<void>;
834
+ /**
835
+ * Fetches all variables for an app.
836
+ * @returns {IAppVariables[]} The list of variables.
837
+ */
156
838
  fetchAll: () => IAppVariables[];
839
+ /**
840
+ * Fetches a variable by tag.
841
+ * @param {string} tag - The variable tag.
842
+ * @returns {IAppVariables|null} The fetched variable, or null if not found.
843
+ */
157
844
  fetch: (tag: string) => IAppVariables;
845
+ /**
846
+ * Updates a variable by tag.
847
+ * @param {string} tag - The variable tag.
848
+ * @param {Partial<IAppVariables>} data - The variable data to update.
849
+ * @returns {Promise<void>} Resolves when the variable is updated. Throws on error.
850
+ */
158
851
  update: (tag: string, data: Partial<IAppVariables>) => Promise<void>;
159
852
  };
160
853
  constants: {
854
+ /**
855
+ * Creates a constant for an app.
856
+ * @param {IAppConstants} data - The constant data.
857
+ * @returns {Promise<void>} Resolves when the constant is created. Throws on error.
858
+ */
161
859
  create: (data: IAppConstants) => Promise<void>;
860
+ /**
861
+ * Fetches all constants for an app.
862
+ * @returns {IAppConstants[]} The list of constants.
863
+ */
162
864
  fetchAll: () => IAppConstants[];
865
+ /**
866
+ * Fetches a constant by tag.
867
+ * @param {string} tag - The constant tag.
868
+ * @returns {IAppConstants|null} The fetched constant, or null if not found.
869
+ */
163
870
  fetch: (tag: string) => IAppConstants;
871
+ /**
872
+ * Updates a constant by tag.
873
+ * @param {string} tag - The constant tag.
874
+ * @param {Partial<IAppVariables>} data - The constant data to update.
875
+ * @returns {Promise<void>} Resolves when the constant is updated. Throws on error.
876
+ */
164
877
  update: (tag: string, data: Partial<IAppVariables>) => Promise<void>;
165
878
  };
166
879
  actions: {
167
- import: ({ file, type, version, appTag, updateIfExists, }: {
880
+ /**
881
+ * Imports actions for an app from a file.
882
+ * @param {Object} params - The import parameters.
883
+ * @param {Buffer} params.file - The file buffer.
884
+ * @param {ImportDocsTypes} params.type - The import type.
885
+ * @param {string} params.version - The version.
886
+ * @param {string} [params.appTag] - The app tag (optional).
887
+ * @param {boolean} [params.updateIfExists] - Whether to update if actions exist (optional).
888
+ * @returns {Promise<void>} Resolves when the import is complete. Throws on error.
889
+ */
890
+ import: ({ file, type, version, appTag, updateIfExists, isAdminImport, }: {
168
891
  file: Buffer;
169
892
  type: ImportDocsTypes;
170
893
  version: string;
171
894
  appTag?: string;
172
895
  updateIfExists?: boolean;
896
+ isAdminImport?: boolean;
173
897
  }) => Promise<void>;
898
+ /**
899
+ * Updates an action by tag.
900
+ * @param {string} tag - The action tag.
901
+ * @param {Partial<IActionUpdate>} data - The action data to update.
902
+ * @returns {Promise<void>} Resolves when the action is updated. Throws on error.
903
+ */
174
904
  update: (tag: string, data: Partial<IActionUpdate>) => Promise<void>;
905
+ /**
906
+ * Fetches all actions for an app.
907
+ * @returns {IAppAction[]} The list of actions.
908
+ */
175
909
  fetchAll: () => IAppAction[];
910
+ /**
911
+ * Fetches an action by tag.
912
+ * @param {string} tag - The action tag.
913
+ * @returns {IAppAction|null} The fetched action, or null if not found.
914
+ */
176
915
  fetch: (tag: string) => IAppAction;
177
916
  };
178
917
  auths: {
918
+ /**
919
+ * Creates an auth for an app.
920
+ * @param {IAppAuth} data - The auth data.
921
+ * @returns {Promise<void>} Resolves when the auth is created. Throws on error.
922
+ */
179
923
  create: (data: IAppAuth) => Promise<void>;
924
+ /**
925
+ * Fetches all auths for an app.
926
+ * @returns {IAppAuth[]} The list of auths.
927
+ */
180
928
  fetchAll: () => IAppAuth[];
929
+ /**
930
+ * Fetches an auth by tag.
931
+ * @param {string} tag - The auth tag.
932
+ * @returns {IAppAuth|null} The fetched auth, or null if not found.
933
+ */
181
934
  fetch: (tag: string) => IAppAuth;
935
+ /**
936
+ * Updates an auth by tag.
937
+ * @param {string} tag - The auth tag.
938
+ * @param {Partial<IAppAuth>} data - The auth data to update.
939
+ * @returns {Promise<void>} Resolves when the auth is updated. Throws on error.
940
+ */
182
941
  update: (tag: string, data: Partial<IAppAuth>) => Promise<void>;
183
942
  };
184
943
  webhooks: {
944
+ /**
945
+ * Creates a webhook for an app.
946
+ * @param {Partial<IAppWebhook>} data - The webhook data.
947
+ * @returns {Promise<void>} Resolves when the webhook is created. Throws on error.
948
+ */
185
949
  create: (data: Partial<IAppWebhook>) => Promise<void>;
950
+ /**
951
+ * Fetches all webhooks for an app.
952
+ * @returns {IAppWebhook[]} The list of webhooks.
953
+ */
186
954
  fetchAll: () => IAppWebhook[];
955
+ /**
956
+ * Fetches a webhook by tag.
957
+ * @param {string} tag - The webhook tag.
958
+ * @returns {IAppWebhook|null} The fetched webhook, or null if not found.
959
+ */
187
960
  fetch: (tag: string) => IAppWebhook;
961
+ /**
962
+ * Updates a webhook by tag.
963
+ * @param {string} tag - The webhook tag.
964
+ * @param {Partial<IAppWebhook>} data - The webhook data to update.
965
+ * @returns {Promise<void>} Resolves when the webhook is updated. Throws on error.
966
+ */
188
967
  update: (tag: string, data: Partial<IAppWebhook>) => Promise<void>;
189
968
  events: {
969
+ /**
970
+ * Creates a webhook event for an app.
971
+ * @param {IAppWebhookEvent} data - The webhook event data.
972
+ * @returns {Promise<void>} Resolves when the webhook event is created. Throws on error.
973
+ */
190
974
  create: (data: IAppWebhookEvent) => Promise<void>;
975
+ /**
976
+ * Fetches all webhook events for a webhook by tag.
977
+ * @param {string} webhookTag - The webhook tag.
978
+ * @returns {IAppWebhookEvent[]} The list of webhook events.
979
+ */
191
980
  fetchAll: (webhookTag: string) => IAppWebhookEvent[];
981
+ /**
982
+ * Fetches a webhook event by tag.
983
+ * @param {string} tag - The webhook event tag.
984
+ * @returns {IAppWebhookEvent|null} The fetched webhook event, or null if not found.
985
+ */
192
986
  fetch: (tag: string) => IAppWebhookEvent;
987
+ /**
988
+ * Updates a webhook event by tag.
989
+ * @param {string} tag - The webhook event tag.
990
+ * @param {Partial<IAppWebhookEvent>} data - The webhook event data to update.
991
+ * @returns {Promise<void>} Resolves when the webhook event is updated. Throws on error.
992
+ */
193
993
  update: (tag: string, data: Partial<IAppWebhookEvent>) => Promise<void>;
194
994
  };
195
995
  };
196
996
  environments: {
997
+ /**
998
+ * Creates an environment for an app.
999
+ * @param {IAppEnv} data - The environment data.
1000
+ * @returns {Promise<void>} Resolves when the environment is created. Throws on error.
1001
+ */
197
1002
  create: (data: IAppEnv) => Promise<void>;
1003
+ /**
1004
+ * Fetches all environments for an app.
1005
+ * @returns {IAppEnv[]} The list of environments.
1006
+ */
198
1007
  fetchAll: () => IAppEnv[];
1008
+ /**
1009
+ * Fetches an environment by slug.
1010
+ * @param {string} slug - The environment slug.
1011
+ * @returns {IAppEnv|null} The fetched environment, or null if not found.
1012
+ */
199
1013
  fetch: (slug: string) => IAppEnv;
1014
+ /**
1015
+ * Updates an environment by slug.
1016
+ * @param {string} slug - The environment slug.
1017
+ * @param {Partial<IAppEnv>} data - The environment data to update.
1018
+ * @returns {Promise<void>} Resolves when the environment is updated. Throws on error.
1019
+ */
200
1020
  update: (slug: string, data: Partial<IAppEnv>) => Promise<void>;
201
1021
  };
1022
+ /**
1023
+ * Updates data validation for an app.
1024
+ * @param {string} selector - The selector for the data validation.
1025
+ * @param {Partial<IParsedSample>} update - The update data.
1026
+ * @returns {Promise<void>} Resolves when the validation is updated. Throws on error.
1027
+ */
202
1028
  validation: (selector: string, update: Partial<IParsedSample>) => Promise<void>;
203
1029
  };
1030
+ /**
1031
+ * Processor-related operations for running jobs, actions, database actions, sessions, features, quotas, fallbacks, notifications, storage, and message broker.
1032
+ */
204
1033
  processor: {
205
1034
  job: {
1035
+ /**
1036
+ * Schedules a job for a product.
1037
+ * @param {IProduct} data - The product data.
1038
+ * @returns {Promise<any>} The result of the job scheduling.
1039
+ */
206
1040
  schedule: (data: IProduct) => Promise<void>;
207
1041
  };
208
1042
  action: {
1043
+ /**
1044
+ * Runs an action processor.
1045
+ * @param {IActionProcessorInput} data - The action processor input.
1046
+ * @returns {Promise<any>} The result of the action processing.
1047
+ */
209
1048
  run: (data: IActionProcessorInput) => Promise<any>;
210
1049
  };
211
1050
  db: {
1051
+ /**
1052
+ * Executes a database action processor.
1053
+ * @param {IDBActionProcessorInput} data - The database action processor input.
1054
+ * @returns {Promise<any>} The result of the database action processing.
1055
+ */
212
1056
  execute: (data: IDBActionProcessorInput) => Promise<any>;
213
1057
  migration: {
1058
+ /**
1059
+ * Runs a database migration.
1060
+ * @param {Object} params - The migration parameters.
1061
+ * @param {string} params.migration - The migration name.
1062
+ * @param {string} params.env - The environment.
1063
+ * @param {string} params.product - The product name.
1064
+ * @returns {Promise<any>} The result of the migration.
1065
+ */
214
1066
  run: ({ migration, env, product }: {
215
1067
  migration: string;
216
1068
  env: string;
@@ -218,6 +1070,14 @@ export default class Ductape implements IDuctape {
218
1070
  }) => Promise<{
219
1071
  process_id: string;
220
1072
  }>;
1073
+ /**
1074
+ * Rolls back a database migration.
1075
+ * @param {Object} params - The migration parameters.
1076
+ * @param {string} params.migration - The migration name.
1077
+ * @param {string} params.env - The environment.
1078
+ * @param {string} params.product - The product name.
1079
+ * @returns {Promise<any>} The result of the rollback.
1080
+ */
221
1081
  rollback: ({ migration, env, product }: {
222
1082
  migration: string;
223
1083
  env: string;
@@ -228,12 +1088,39 @@ export default class Ductape implements IDuctape {
228
1088
  };
229
1089
  };
230
1090
  sessions: {
231
- generate: (data: ISessionInput) => Promise<import("./types").ISessionOutput>;
1091
+ /**
1092
+ * Starts a new session.
1093
+ * @param {ISessionInput} data - The session input data.
1094
+ * @returns {Promise<any>} The result of the session generation.
1095
+ */
1096
+ start: (data: ISessionInput) => Promise<import("./types").ISessionOutput>;
1097
+ /**
1098
+ * Decrypts a session.
1099
+ * @param {ISessionPayload} data - The session payload.
1100
+ * @returns {Promise<any>} The decrypted session.
1101
+ */
1102
+ decrypt: (data: ISessionPayload) => Promise<any>;
1103
+ /**
1104
+ * Refreshes a session.
1105
+ * @param {ISessionRefreshPayload} data - The session refresh payload.
1106
+ * @returns {Promise<any>} The refreshed session.
1107
+ */
1108
+ refresh: (data: ISessionRefreshPayload) => Promise<import("./types").ISessionOutput>;
232
1109
  };
233
1110
  feature: {
1111
+ /**
1112
+ * Runs a feature processor.
1113
+ * @param {IProcessorInput} data - The feature processor input.
1114
+ * @returns {Promise<any>} The result of the feature processing.
1115
+ */
234
1116
  run: (data: IProcessorInput) => Promise<{
235
1117
  process_id: string;
236
1118
  }>;
1119
+ /**
1120
+ * Generates output for a process by ID.
1121
+ * @param {string} process_id - The process ID.
1122
+ * @returns {Promise<any>} The generated output.
1123
+ */
237
1124
  output: (process_id: string) => Promise<{
238
1125
  process_id: string;
239
1126
  status: import("./types").LogEventStatus;
@@ -250,83 +1137,99 @@ export default class Ductape implements IDuctape {
250
1137
  data?: undefined;
251
1138
  errors?: undefined;
252
1139
  }>;
1140
+ /**
1141
+ * Replays a process by ID.
1142
+ * @param {string} process_id - The process ID.
1143
+ * @returns {Promise<any>} The result of the replay.
1144
+ */
253
1145
  replay: (process_id: string) => Promise<{
254
1146
  process_id: string;
255
1147
  }>;
1148
+ /**
1149
+ * Resumes a process by ID.
1150
+ * @param {string} process_id - The process ID.
1151
+ * @returns {Promise<any>} The result of the resume.
1152
+ */
256
1153
  resume: (process_id: string) => Promise<{
257
1154
  process_id: string;
258
1155
  }>;
259
1156
  };
260
1157
  quota: {
1158
+ /**
1159
+ * Runs a quota processor.
1160
+ * @param {IProcessorInput} data - The quota processor input.
1161
+ * @returns {Promise<any>} The result of the quota processing.
1162
+ */
261
1163
  run: (data: IProcessorInput) => Promise<any>;
262
1164
  };
263
1165
  fallback: {
1166
+ /**
1167
+ * Runs a fallback processor.
1168
+ * @param {IProcessorInput} data - The fallback processor input.
1169
+ * @returns {Promise<any>} The result of the fallback processing.
1170
+ */
264
1171
  run: (data: IProcessorInput) => Promise<any>;
265
1172
  };
266
1173
  notification: {
1174
+ /**
1175
+ * Sends a notification using the notification processor.
1176
+ * @param {INotificationProcessorInput} data - The notification processor input.
1177
+ * @returns {Promise<any>} The result of the notification processing.
1178
+ */
267
1179
  send: (data: INotificationProcessorInput) => Promise<{
268
1180
  process_id: string;
269
1181
  }>;
270
1182
  };
271
1183
  storage: {
1184
+ /**
1185
+ * Reads a file from storage.
1186
+ * @param {string} path - The file path.
1187
+ * @returns {Promise<IFileReadResult>} The file read result.
1188
+ */
272
1189
  readFile: (path: string) => Promise<IFileReadResult>;
1190
+ /**
1191
+ * Saves data to storage using the storage processor.
1192
+ * @param {IStorageProcessorInput} data - The storage processor input.
1193
+ * @returns {Promise<any>} The result of the storage processing.
1194
+ */
273
1195
  save: (data: IStorageProcessorInput) => Promise<any>;
274
1196
  };
275
1197
  messageBroker: {
1198
+ /**
1199
+ * Publishes a message using the message broker processor.
1200
+ * @param {IMessageBrokerPublishInput} data - The publish input.
1201
+ * @returns {Promise<any>} The result of the publish operation.
1202
+ */
276
1203
  publish: (data: IMessageBrokerPublishInput) => Promise<void | {
277
1204
  process_id: string;
278
1205
  }>;
1206
+ /**
1207
+ * Subscribes to a message broker topic.
1208
+ * @param {IMessageBrokerSubscribeInput} data - The subscribe input.
1209
+ * @returns {Promise<any>} The result of the subscribe operation.
1210
+ */
279
1211
  subcribe: (data: IMessageBrokerSubscribeInput) => Promise<void | {
280
1212
  process_id: string;
281
1213
  }>;
282
1214
  };
283
1215
  };
1216
+ /**
1217
+ * Logs-related operations for initializing and fetching logs.
1218
+ */
284
1219
  logs: {
1220
+ /**
1221
+ * Initializes the logger service for a product or app.
1222
+ * @param {string} [productTag] - The product tag (optional).
1223
+ * @param {string} [appTag] - The app tag (optional).
1224
+ * @throws {Error} If neither productTag nor appTag is provided.
1225
+ * @returns {Promise<void>} Resolves when logger is initialized.
1226
+ */
285
1227
  init: (productTag?: string, appTag?: string) => Promise<void>;
286
1228
  add: () => Promise<void>;
287
1229
  /**
288
- * Fetches logs based on provded query parameters.
289
- *
290
- * @param params.component - Required. Specifies the component type ('app' or 'product')
291
- * @param params.type - Optional. Type of analysis ('apps', 'process', 'feature', 'integrations', etc.)
292
- * @param params.groupBy - Optional. Time period for grouping ('day', 'week', 'month', 'year')
293
- * @param params.search - Optional. Search term for filtering logs
294
- * @param params.page - Optional. Page number for pagination (≥ 1)
295
- * @param params.limit - Optional. Number of items per page (≥ 1)
296
- * @param params.status - Optional. Filter by status ('success', 'processing', 'fail')
297
- *
298
- * For component='app':
299
- * @param params.tag - Optional. Tag identifier (only valid when type='actions')
300
- * @param params.env - Optional. Environment filter
301
- * @param params.name - Optional. Name filter
302
- * @param params.action - Optional. Specific action filter
303
- *
304
- * For component='product':
305
- * @param params.env - Optional. Environment filter
306
- * @param params.name - Optional. Name filter
307
- * @param params.action - Optional. Specific action filter
308
- *
309
- * @throws {Error} If logger service is not initialized
310
- * @throws {Error} If required parameters are missing or invalid
311
- * @throws {Error} If API request fails
312
- *
313
- * @returns {Promise<any>} The fetched log data
314
- *
315
- * @example
316
- * // Fetch app logs
317
- * const appLogs = await logs.fetch({
318
- * component: 'app',
319
- * type: 'actions',
320
- * groupBy: 'day',
321
- * limit: 20
322
- * });
323
- *
324
- * // Fetch product logs
325
- * const productLogs = await logs.fetch({
326
- * component: 'product',
327
- * type: 'database',
328
- * status: 'success'
329
- * });
1230
+ * Fetches logs based on provided query parameters.
1231
+ * @param {LogQueryParams} params - The log query parameters.
1232
+ * @returns {Promise<any>} The fetched log data.
330
1233
  */
331
1234
  fetch: (params: LogQueryParams) => Promise<any>;
332
1235
  publish: () => Promise<void>;
@@ -343,4 +1246,8 @@ export default class Ductape implements IDuctape {
343
1246
  private refreshUserAccessToken;
344
1247
  fetchWorkspaceApps(status: PublicStates): Promise<Array<IApp>>;
345
1248
  fetchWorkspaceProjects(status: PublicStates): Promise<Array<IProduct>>;
1249
+ /**
1250
+ * Fetches the latest healthcheck status for a product/env from Redis cache via processor service.
1251
+ */
1252
+ getHealthcheckStatus(productTag: string, envSlug: string): Promise<any>;
346
1253
  }