@ductape/sdk 0.0.4-v10 → 0.0.4-v12

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 (32) hide show
  1. package/dist/api/services/productsApi.service.d.ts +2 -0
  2. package/dist/api/services/productsApi.service.js +11 -0
  3. package/dist/api/services/productsApi.service.js.map +1 -1
  4. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
  5. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
  6. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
  7. package/dist/index.d.ts +941 -44
  8. package/dist/index.js +847 -67
  9. package/dist/index.js.map +1 -1
  10. package/dist/processor/services/processor.service.d.ts +21 -0
  11. package/dist/processor/services/processor.service.js +116 -3
  12. package/dist/processor/services/processor.service.js.map +1 -1
  13. package/dist/products/services/products.service.d.ts +14 -2
  14. package/dist/products/services/products.service.js +151 -10
  15. package/dist/products/services/products.service.js.map +1 -1
  16. package/dist/products/validators/index.d.ts +2 -1
  17. package/dist/products/validators/index.js +3 -1
  18. package/dist/products/validators/index.js.map +1 -1
  19. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
  20. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
  21. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
  22. package/dist/test/test.health.d.ts +1 -0
  23. package/dist/test/test.health.js +49 -0
  24. package/dist/test/test.health.js.map +1 -0
  25. package/dist/types/enums.d.ts +2 -1
  26. package/dist/types/enums.js +1 -0
  27. package/dist/types/enums.js.map +1 -1
  28. package/dist/types/productsBuilder.types.d.ts +32 -0
  29. package/dist/types/productsBuilder.types.js.map +1 -1
  30. package/dist/utils/index.js +1 -1
  31. package/dist/utils/index.js.map +1 -1
  32. package/package.json +2 -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, IFetchFilesPayload, ISessionPayload, ISessionRefreshPayload, IFetchUsersPayload } 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 {
@@ -27,150 +233,660 @@ export default class Ductape implements IDuctape {
27
233
  private redisClient?;
28
234
  private jobsQueue;
29
235
  private healthCheckQueue;
236
+ private healthCheckUpdaterQueue;
30
237
  jobsWorker: any;
31
238
  healthCheckWorker: any;
239
+ healthCheckUpdaterWorker: any;
32
240
  private loadRedis;
33
241
  constructor({ workspace_id, private_key, user_id, env_type, redis_url }: IDuctapeInit);
34
242
  private loadBullMQ;
35
- connectRedis(): Promise<void>;
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
+ */
36
262
  setToken(token: string): void;
263
+ /**
264
+ * Sets the public key for API requests.
265
+ * @param {string} public_key - The public key.
266
+ */
37
267
  setPublicKey(public_key: string): void;
38
268
  private initProduct;
39
269
  private initApp;
40
270
  private checkProductInit;
41
271
  private checkAppInit;
272
+ /**
273
+ * Product-related operations for managing products, sessions, apps, quotas, and fallbacks.
274
+ */
42
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
+ */
43
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
+ */
44
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
+ */
45
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
+ */
46
300
  init: (productTag: string) => Promise<void>;
47
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
+ */
48
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
+ */
49
314
  update: (tag: string, payload: Partial<IProductSession>) => Promise<void>;
315
+ /**
316
+ * Fetches all product sessions.
317
+ * @returns {IProductSession[]} The list of sessions.
318
+ */
50
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
+ */
51
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
+ */
52
331
  users: (data: IFetchUsersPayload) => Promise<import("./types").IFileURLPayload[]>;
53
332
  };
54
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
+ */
55
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
+ */
56
345
  add: (app: IProductApp) => Promise<void>;
346
+ /**
347
+ * Fetches all apps for a product.
348
+ * @returns {IProductApp[]} The list of apps.
349
+ */
57
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
+ */
58
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
+ */
59
363
  update: (accessTag: string, data: Partial<IProductApp>) => Promise<void>;
60
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
+ */
61
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
+ */
62
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
+ */
63
382
  generateLink: (data: IGenerateWebhookLink) => Promise<string>;
64
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
+ };
65
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
+ */
66
418
  quota: {
67
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
+ */
68
425
  fetch: (tag: string) => IProductQuota;
426
+ /**
427
+ * Fetches all quotas for a product.
428
+ * @returns {IProductQuota[]} The list of quotas.
429
+ */
69
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
+ */
70
437
  update: (tag: string, data: Partial<IProductQuota>) => Promise<void>;
71
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
+ */
72
444
  fallback: {
73
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
+ */
74
451
  fetch: (tag: string) => IProductFallback;
452
+ /**
453
+ * Fetches all fallbacks for a product.
454
+ * @returns {IProductFallback[]} The list of fallbacks.
455
+ */
75
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
+ */
76
463
  update: (tag: string, data: Partial<IProductFallback>) => Promise<void>;
77
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
+ */
78
471
  updateValidation: (tag: string, update: Partial<IParsedSample>) => Promise<boolean>;
79
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
+ */
80
478
  create: (data: IProductEnv) => Promise<void>;
479
+ /**
480
+ * Fetches all environments for a product.
481
+ * @returns {IAppEnv[]} The list of environments.
482
+ */
81
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
+ */
82
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
+ */
83
496
  update: (slug: string, data: Partial<IProductEnv>) => Promise<void>;
84
497
  };
85
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
+ */
86
504
  create: (data: IProductStorage) => Promise<void>;
505
+ /**
506
+ * Fetches all storages for a product.
507
+ * @returns {IProductStorage[]} The list of storages.
508
+ */
87
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
+ */
88
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
+ */
89
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
+ */
90
528
  files: (data: IFetchFilesPayload) => Promise<import("./types").IFileURLPayload[]>;
91
529
  };
92
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
+ */
93
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
+ */
94
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
+ */
95
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
+ */
96
554
  update: (tag: string, data: Partial<IProductMessageBroker>) => Promise<void>;
97
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
+ */
98
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
+ */
99
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
+ */
100
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
+ */
101
580
  update: (tag: string, data: Partial<IProductMessageBrokerTopic>) => Promise<void>;
102
581
  };
103
582
  };
104
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
+ */
105
589
  create: (data: IProductNotification) => Promise<void>;
590
+ /**
591
+ * Fetches all notifications for a product.
592
+ * @returns {IProductNotification[]} The list of notifications.
593
+ */
106
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
+ */
107
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
+ */
108
607
  update: (tag: string, data: Partial<IProductNotification>) => Promise<void>;
109
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
+ */
110
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
+ */
111
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
+ */
112
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
+ */
113
633
  update: (tag: string, data: Partial<IProductNotificationTemplate>) => Promise<void>;
114
634
  };
115
635
  };
116
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
+ */
117
642
  create: (data: IProductDatabase) => Promise<void>;
643
+ /**
644
+ * Fetches all databases for a product.
645
+ * @returns {IProductDatabase[]} The list of databases.
646
+ */
118
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
+ */
119
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
+ */
120
660
  update: (tag: string, data: Partial<IProductDatabase>) => Promise<void>;
121
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
+ */
122
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
+ */
123
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
+ */
124
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
+ */
125
686
  update: (tag: string, data: Partial<IProductDatabaseAction>) => Promise<void>;
126
687
  };
127
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
+ */
128
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
+ */
129
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
+ */
130
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
+ */
131
713
  update: (tag: string, data: Partial<IProductDatabaseMigration>) => Promise<void>;
132
714
  };
133
715
  };
134
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
+ */
135
722
  create: (data: Partial<IProductJobs>) => Promise<void>;
723
+ /**
724
+ * Fetches all jobs for a product.
725
+ * @returns {IProductJobs[]} The list of jobs.
726
+ */
136
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
+ */
137
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
+ */
138
740
  update: (tag: string, data: Partial<IProductJobs>) => Promise<void>;
139
741
  };
140
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
+ */
141
748
  create: (data: IProductCache) => Promise<void>;
749
+ /**
750
+ * Fetches all caches for a product.
751
+ * @returns {IProductCache[]} The list of caches.
752
+ */
142
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
+ */
143
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
+ */
144
766
  update: (tag: string, data: Partial<IProductCache>) => Promise<void>;
145
767
  values: (data: FetchRemoteCachePayload) => Promise<import("./types").IRemoteCache[]>;
146
768
  };
147
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
+ */
148
775
  create: (data: Partial<IProductFeature>) => Promise<void>;
776
+ /**
777
+ * Fetches all features for a product.
778
+ * @returns {IProductFeature[]} The list of features.
779
+ */
149
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
+ */
150
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
+ */
151
793
  update: (tag: string, data: Partial<IProductCache>) => Promise<void>;
152
794
  };
153
795
  };
796
+ /**
797
+ * App-related operations for managing apps, variables, constants, actions, auths, webhooks, environments, and validation.
798
+ */
154
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
+ */
155
805
  create: (data: ICreateAppBuilder) => Promise<{
156
806
  app_id: string;
157
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
+ */
158
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
+ */
159
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
+ */
160
826
  init: (appTag: string) => Promise<void>;
161
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
+ */
162
833
  create: (data: IAppVariables) => Promise<void>;
834
+ /**
835
+ * Fetches all variables for an app.
836
+ * @returns {IAppVariables[]} The list of variables.
837
+ */
163
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
+ */
164
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
+ */
165
851
  update: (tag: string, data: Partial<IAppVariables>) => Promise<void>;
166
852
  };
167
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
+ */
168
859
  create: (data: IAppConstants) => Promise<void>;
860
+ /**
861
+ * Fetches all constants for an app.
862
+ * @returns {IAppConstants[]} The list of constants.
863
+ */
169
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
+ */
170
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
+ */
171
877
  update: (tag: string, data: Partial<IAppVariables>) => Promise<void>;
172
878
  };
173
879
  actions: {
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
+ */
174
890
  import: ({ file, type, version, appTag, updateIfExists, }: {
175
891
  file: Buffer;
176
892
  type: ImportDocsTypes;
@@ -178,46 +894,174 @@ export default class Ductape implements IDuctape {
178
894
  appTag?: string;
179
895
  updateIfExists?: boolean;
180
896
  }) => Promise<void>;
897
+ /**
898
+ * Updates an action by tag.
899
+ * @param {string} tag - The action tag.
900
+ * @param {Partial<IActionUpdate>} data - The action data to update.
901
+ * @returns {Promise<void>} Resolves when the action is updated. Throws on error.
902
+ */
181
903
  update: (tag: string, data: Partial<IActionUpdate>) => Promise<void>;
904
+ /**
905
+ * Fetches all actions for an app.
906
+ * @returns {IAppAction[]} The list of actions.
907
+ */
182
908
  fetchAll: () => IAppAction[];
909
+ /**
910
+ * Fetches an action by tag.
911
+ * @param {string} tag - The action tag.
912
+ * @returns {IAppAction|null} The fetched action, or null if not found.
913
+ */
183
914
  fetch: (tag: string) => IAppAction;
184
915
  };
185
916
  auths: {
917
+ /**
918
+ * Creates an auth for an app.
919
+ * @param {IAppAuth} data - The auth data.
920
+ * @returns {Promise<void>} Resolves when the auth is created. Throws on error.
921
+ */
186
922
  create: (data: IAppAuth) => Promise<void>;
923
+ /**
924
+ * Fetches all auths for an app.
925
+ * @returns {IAppAuth[]} The list of auths.
926
+ */
187
927
  fetchAll: () => IAppAuth[];
928
+ /**
929
+ * Fetches an auth by tag.
930
+ * @param {string} tag - The auth tag.
931
+ * @returns {IAppAuth|null} The fetched auth, or null if not found.
932
+ */
188
933
  fetch: (tag: string) => IAppAuth;
934
+ /**
935
+ * Updates an auth by tag.
936
+ * @param {string} tag - The auth tag.
937
+ * @param {Partial<IAppAuth>} data - The auth data to update.
938
+ * @returns {Promise<void>} Resolves when the auth is updated. Throws on error.
939
+ */
189
940
  update: (tag: string, data: Partial<IAppAuth>) => Promise<void>;
190
941
  };
191
942
  webhooks: {
943
+ /**
944
+ * Creates a webhook for an app.
945
+ * @param {Partial<IAppWebhook>} data - The webhook data.
946
+ * @returns {Promise<void>} Resolves when the webhook is created. Throws on error.
947
+ */
192
948
  create: (data: Partial<IAppWebhook>) => Promise<void>;
949
+ /**
950
+ * Fetches all webhooks for an app.
951
+ * @returns {IAppWebhook[]} The list of webhooks.
952
+ */
193
953
  fetchAll: () => IAppWebhook[];
954
+ /**
955
+ * Fetches a webhook by tag.
956
+ * @param {string} tag - The webhook tag.
957
+ * @returns {IAppWebhook|null} The fetched webhook, or null if not found.
958
+ */
194
959
  fetch: (tag: string) => IAppWebhook;
960
+ /**
961
+ * Updates a webhook by tag.
962
+ * @param {string} tag - The webhook tag.
963
+ * @param {Partial<IAppWebhook>} data - The webhook data to update.
964
+ * @returns {Promise<void>} Resolves when the webhook is updated. Throws on error.
965
+ */
195
966
  update: (tag: string, data: Partial<IAppWebhook>) => Promise<void>;
196
967
  events: {
968
+ /**
969
+ * Creates a webhook event for an app.
970
+ * @param {IAppWebhookEvent} data - The webhook event data.
971
+ * @returns {Promise<void>} Resolves when the webhook event is created. Throws on error.
972
+ */
197
973
  create: (data: IAppWebhookEvent) => Promise<void>;
974
+ /**
975
+ * Fetches all webhook events for a webhook by tag.
976
+ * @param {string} webhookTag - The webhook tag.
977
+ * @returns {IAppWebhookEvent[]} The list of webhook events.
978
+ */
198
979
  fetchAll: (webhookTag: string) => IAppWebhookEvent[];
980
+ /**
981
+ * Fetches a webhook event by tag.
982
+ * @param {string} tag - The webhook event tag.
983
+ * @returns {IAppWebhookEvent|null} The fetched webhook event, or null if not found.
984
+ */
199
985
  fetch: (tag: string) => IAppWebhookEvent;
986
+ /**
987
+ * Updates a webhook event by tag.
988
+ * @param {string} tag - The webhook event tag.
989
+ * @param {Partial<IAppWebhookEvent>} data - The webhook event data to update.
990
+ * @returns {Promise<void>} Resolves when the webhook event is updated. Throws on error.
991
+ */
200
992
  update: (tag: string, data: Partial<IAppWebhookEvent>) => Promise<void>;
201
993
  };
202
994
  };
203
995
  environments: {
996
+ /**
997
+ * Creates an environment for an app.
998
+ * @param {IAppEnv} data - The environment data.
999
+ * @returns {Promise<void>} Resolves when the environment is created. Throws on error.
1000
+ */
204
1001
  create: (data: IAppEnv) => Promise<void>;
1002
+ /**
1003
+ * Fetches all environments for an app.
1004
+ * @returns {IAppEnv[]} The list of environments.
1005
+ */
205
1006
  fetchAll: () => IAppEnv[];
1007
+ /**
1008
+ * Fetches an environment by slug.
1009
+ * @param {string} slug - The environment slug.
1010
+ * @returns {IAppEnv|null} The fetched environment, or null if not found.
1011
+ */
206
1012
  fetch: (slug: string) => IAppEnv;
1013
+ /**
1014
+ * Updates an environment by slug.
1015
+ * @param {string} slug - The environment slug.
1016
+ * @param {Partial<IAppEnv>} data - The environment data to update.
1017
+ * @returns {Promise<void>} Resolves when the environment is updated. Throws on error.
1018
+ */
207
1019
  update: (slug: string, data: Partial<IAppEnv>) => Promise<void>;
208
1020
  };
1021
+ /**
1022
+ * Updates data validation for an app.
1023
+ * @param {string} selector - The selector for the data validation.
1024
+ * @param {Partial<IParsedSample>} update - The update data.
1025
+ * @returns {Promise<void>} Resolves when the validation is updated. Throws on error.
1026
+ */
209
1027
  validation: (selector: string, update: Partial<IParsedSample>) => Promise<void>;
210
1028
  };
1029
+ /**
1030
+ * Processor-related operations for running jobs, actions, database actions, sessions, features, quotas, fallbacks, notifications, storage, and message broker.
1031
+ */
211
1032
  processor: {
212
1033
  job: {
1034
+ /**
1035
+ * Schedules a job for a product.
1036
+ * @param {IProduct} data - The product data.
1037
+ * @returns {Promise<any>} The result of the job scheduling.
1038
+ */
213
1039
  schedule: (data: IProduct) => Promise<void>;
214
1040
  };
215
1041
  action: {
1042
+ /**
1043
+ * Runs an action processor.
1044
+ * @param {IActionProcessorInput} data - The action processor input.
1045
+ * @returns {Promise<any>} The result of the action processing.
1046
+ */
216
1047
  run: (data: IActionProcessorInput) => Promise<any>;
217
1048
  };
218
1049
  db: {
1050
+ /**
1051
+ * Executes a database action processor.
1052
+ * @param {IDBActionProcessorInput} data - The database action processor input.
1053
+ * @returns {Promise<any>} The result of the database action processing.
1054
+ */
219
1055
  execute: (data: IDBActionProcessorInput) => Promise<any>;
220
1056
  migration: {
1057
+ /**
1058
+ * Runs a database migration.
1059
+ * @param {Object} params - The migration parameters.
1060
+ * @param {string} params.migration - The migration name.
1061
+ * @param {string} params.env - The environment.
1062
+ * @param {string} params.product - The product name.
1063
+ * @returns {Promise<any>} The result of the migration.
1064
+ */
221
1065
  run: ({ migration, env, product }: {
222
1066
  migration: string;
223
1067
  env: string;
@@ -225,6 +1069,14 @@ export default class Ductape implements IDuctape {
225
1069
  }) => Promise<{
226
1070
  process_id: string;
227
1071
  }>;
1072
+ /**
1073
+ * Rolls back a database migration.
1074
+ * @param {Object} params - The migration parameters.
1075
+ * @param {string} params.migration - The migration name.
1076
+ * @param {string} params.env - The environment.
1077
+ * @param {string} params.product - The product name.
1078
+ * @returns {Promise<any>} The result of the rollback.
1079
+ */
228
1080
  rollback: ({ migration, env, product }: {
229
1081
  migration: string;
230
1082
  env: string;
@@ -235,14 +1087,39 @@ export default class Ductape implements IDuctape {
235
1087
  };
236
1088
  };
237
1089
  sessions: {
1090
+ /**
1091
+ * Starts a new session.
1092
+ * @param {ISessionInput} data - The session input data.
1093
+ * @returns {Promise<any>} The result of the session generation.
1094
+ */
238
1095
  start: (data: ISessionInput) => Promise<import("./types").ISessionOutput>;
1096
+ /**
1097
+ * Decrypts a session.
1098
+ * @param {ISessionPayload} data - The session payload.
1099
+ * @returns {Promise<any>} The decrypted session.
1100
+ */
239
1101
  decrypt: (data: ISessionPayload) => Promise<any>;
1102
+ /**
1103
+ * Refreshes a session.
1104
+ * @param {ISessionRefreshPayload} data - The session refresh payload.
1105
+ * @returns {Promise<any>} The refreshed session.
1106
+ */
240
1107
  refresh: (data: ISessionRefreshPayload) => Promise<import("./types").ISessionOutput>;
241
1108
  };
242
1109
  feature: {
1110
+ /**
1111
+ * Runs a feature processor.
1112
+ * @param {IProcessorInput} data - The feature processor input.
1113
+ * @returns {Promise<any>} The result of the feature processing.
1114
+ */
243
1115
  run: (data: IProcessorInput) => Promise<{
244
1116
  process_id: string;
245
1117
  }>;
1118
+ /**
1119
+ * Generates output for a process by ID.
1120
+ * @param {string} process_id - The process ID.
1121
+ * @returns {Promise<any>} The generated output.
1122
+ */
246
1123
  output: (process_id: string) => Promise<{
247
1124
  process_id: string;
248
1125
  status: import("./types").LogEventStatus;
@@ -259,83 +1136,99 @@ export default class Ductape implements IDuctape {
259
1136
  data?: undefined;
260
1137
  errors?: undefined;
261
1138
  }>;
1139
+ /**
1140
+ * Replays a process by ID.
1141
+ * @param {string} process_id - The process ID.
1142
+ * @returns {Promise<any>} The result of the replay.
1143
+ */
262
1144
  replay: (process_id: string) => Promise<{
263
1145
  process_id: string;
264
1146
  }>;
1147
+ /**
1148
+ * Resumes a process by ID.
1149
+ * @param {string} process_id - The process ID.
1150
+ * @returns {Promise<any>} The result of the resume.
1151
+ */
265
1152
  resume: (process_id: string) => Promise<{
266
1153
  process_id: string;
267
1154
  }>;
268
1155
  };
269
1156
  quota: {
1157
+ /**
1158
+ * Runs a quota processor.
1159
+ * @param {IProcessorInput} data - The quota processor input.
1160
+ * @returns {Promise<any>} The result of the quota processing.
1161
+ */
270
1162
  run: (data: IProcessorInput) => Promise<any>;
271
1163
  };
272
1164
  fallback: {
1165
+ /**
1166
+ * Runs a fallback processor.
1167
+ * @param {IProcessorInput} data - The fallback processor input.
1168
+ * @returns {Promise<any>} The result of the fallback processing.
1169
+ */
273
1170
  run: (data: IProcessorInput) => Promise<any>;
274
1171
  };
275
1172
  notification: {
1173
+ /**
1174
+ * Sends a notification using the notification processor.
1175
+ * @param {INotificationProcessorInput} data - The notification processor input.
1176
+ * @returns {Promise<any>} The result of the notification processing.
1177
+ */
276
1178
  send: (data: INotificationProcessorInput) => Promise<{
277
1179
  process_id: string;
278
1180
  }>;
279
1181
  };
280
1182
  storage: {
1183
+ /**
1184
+ * Reads a file from storage.
1185
+ * @param {string} path - The file path.
1186
+ * @returns {Promise<IFileReadResult>} The file read result.
1187
+ */
281
1188
  readFile: (path: string) => Promise<IFileReadResult>;
1189
+ /**
1190
+ * Saves data to storage using the storage processor.
1191
+ * @param {IStorageProcessorInput} data - The storage processor input.
1192
+ * @returns {Promise<any>} The result of the storage processing.
1193
+ */
282
1194
  save: (data: IStorageProcessorInput) => Promise<any>;
283
1195
  };
284
1196
  messageBroker: {
1197
+ /**
1198
+ * Publishes a message using the message broker processor.
1199
+ * @param {IMessageBrokerPublishInput} data - The publish input.
1200
+ * @returns {Promise<any>} The result of the publish operation.
1201
+ */
285
1202
  publish: (data: IMessageBrokerPublishInput) => Promise<void | {
286
1203
  process_id: string;
287
1204
  }>;
1205
+ /**
1206
+ * Subscribes to a message broker topic.
1207
+ * @param {IMessageBrokerSubscribeInput} data - The subscribe input.
1208
+ * @returns {Promise<any>} The result of the subscribe operation.
1209
+ */
288
1210
  subcribe: (data: IMessageBrokerSubscribeInput) => Promise<void | {
289
1211
  process_id: string;
290
1212
  }>;
291
1213
  };
292
1214
  };
1215
+ /**
1216
+ * Logs-related operations for initializing and fetching logs.
1217
+ */
293
1218
  logs: {
1219
+ /**
1220
+ * Initializes the logger service for a product or app.
1221
+ * @param {string} [productTag] - The product tag (optional).
1222
+ * @param {string} [appTag] - The app tag (optional).
1223
+ * @throws {Error} If neither productTag nor appTag is provided.
1224
+ * @returns {Promise<void>} Resolves when logger is initialized.
1225
+ */
294
1226
  init: (productTag?: string, appTag?: string) => Promise<void>;
295
1227
  add: () => Promise<void>;
296
1228
  /**
297
- * Fetches logs based on provded query parameters.
298
- *
299
- * @param params.component - Required. Specifies the component type ('app' or 'product')
300
- * @param params.type - Optional. Type of analysis ('apps', 'process', 'feature', 'integrations', etc.)
301
- * @param params.groupBy - Optional. Time period for grouping ('day', 'week', 'month', 'year')
302
- * @param params.search - Optional. Search term for filtering logs
303
- * @param params.page - Optional. Page number for pagination (≥ 1)
304
- * @param params.limit - Optional. Number of items per page (≥ 1)
305
- * @param params.status - Optional. Filter by status ('success', 'processing', 'fail')
306
- *
307
- * For component='app':
308
- * @param params.tag - Optional. Tag identifier (only valid when type='actions')
309
- * @param params.env - Optional. Environment filter
310
- * @param params.name - Optional. Name filter
311
- * @param params.action - Optional. Specific action filter
312
- *
313
- * For component='product':
314
- * @param params.env - Optional. Environment filter
315
- * @param params.name - Optional. Name filter
316
- * @param params.action - Optional. Specific action filter
317
- *
318
- * @throws {Error} If logger service is not initialized
319
- * @throws {Error} If required parameters are missing or invalid
320
- * @throws {Error} If API request fails
321
- *
322
- * @returns {Promise<any>} The fetched log data
323
- *
324
- * @example
325
- * // Fetch app logs
326
- * const appLogs = await logs.fetch({
327
- * component: 'app',
328
- * type: 'actions',
329
- * groupBy: 'day',
330
- * limit: 20
331
- * });
332
- *
333
- * // Fetch product logs
334
- * const productLogs = await logs.fetch({
335
- * component: 'product',
336
- * type: 'database',
337
- * status: 'success'
338
- * });
1229
+ * Fetches logs based on provided query parameters.
1230
+ * @param {LogQueryParams} params - The log query parameters.
1231
+ * @returns {Promise<any>} The fetched log data.
339
1232
  */
340
1233
  fetch: (params: LogQueryParams) => Promise<any>;
341
1234
  publish: () => Promise<void>;
@@ -352,4 +1245,8 @@ export default class Ductape implements IDuctape {
352
1245
  private refreshUserAccessToken;
353
1246
  fetchWorkspaceApps(status: PublicStates): Promise<Array<IApp>>;
354
1247
  fetchWorkspaceProjects(status: PublicStates): Promise<Array<IProduct>>;
1248
+ /**
1249
+ * Fetches the latest healthcheck status for a product/env from Redis cache via processor service.
1250
+ */
1251
+ getHealthcheckStatus(productTag: string, envSlug: string): Promise<any>;
355
1252
  }