@ductape/sdk 0.0.4-v4 → 0.0.4-v41
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.
- package/dist/api/services/appApi.service.d.ts +48 -2
- package/dist/api/services/appApi.service.js +101 -2
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/pricingApi.service.d.ts +10 -0
- package/dist/api/services/pricingApi.service.js +34 -0
- package/dist/api/services/pricingApi.service.js.map +1 -0
- package/dist/api/services/processorApi.service.d.ts +12 -2
- package/dist/api/services/processorApi.service.js +12 -2
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +39 -1
- package/dist/api/services/productsApi.service.js +76 -0
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/services/userApi.service.js +1 -0
- package/dist/api/services/userApi.service.js.map +1 -1
- package/dist/api/services/workspaceApi.service.js +1 -0
- package/dist/api/services/workspaceApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +6 -1
- package/dist/api/urls.js +12 -2
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/cache.utils.d.ts +1 -1
- package/dist/api/utils/cache.utils.js +2 -2
- package/dist/api/utils/cache.utils.js.map +1 -1
- package/dist/api/utils/strings.utils.d.ts +2 -0
- package/dist/api/utils/strings.utils.js +14 -0
- package/dist/api/utils/strings.utils.js.map +1 -1
- package/dist/apps/services/app.service.d.ts +41 -33
- package/dist/apps/services/app.service.js +473 -185
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js +21 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
- package/dist/clients/apps.client.js +1 -1
- package/dist/clients/apps.client.js.map +1 -1
- package/dist/clients/pricing.client.d.ts +3 -0
- package/dist/clients/pricing.client.js +33 -0
- package/dist/clients/pricing.client.js.map +1 -0
- package/dist/imports/imports.service.d.ts +3 -3
- package/dist/imports/imports.service.js +7 -7
- package/dist/imports/imports.service.js.map +1 -1
- package/dist/imports/imports.types.d.ts +8 -0
- package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
- package/dist/imports/repos/postmanV21.repo.js +29 -2
- package/dist/imports/repos/postmanV21.repo.js.map +1 -1
- package/dist/index.d.ts +1009 -91
- package/dist/index.js +969 -126
- package/dist/index.js.map +1 -1
- package/dist/inputs/inputs.service.js +2 -2
- package/dist/inputs/inputs.service.js.map +1 -1
- package/dist/inputs/utils/inputs.utils.create.js +1 -1
- package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
- package/dist/logs/logs.service.js +1 -0
- package/dist/logs/logs.service.js.map +1 -1
- package/dist/logs/logs.types.d.ts +5 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/parsers/index.d.ts +3 -0
- package/dist/parsers/index.js +27 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
- package/dist/parsers/pipelines/postman.pipelines.js +103 -0
- package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
- package/dist/parsers/types/postman.types.d.ts +200 -0
- package/dist/parsers/types/postman.types.js +3 -0
- package/dist/parsers/types/postman.types.js.map +1 -0
- package/dist/parsers/utils/postman.utils.d.ts +12 -0
- package/dist/parsers/utils/postman.utils.js +116 -0
- package/dist/parsers/utils/postman.utils.js.map +1 -0
- package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
- package/dist/parsers/validators/postman-auth.validators.js +127 -0
- package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
- package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-request.validators.js +139 -0
- package/dist/parsers/validators/postman-request.validators.js.map +1 -0
- package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-response.validators.js +150 -0
- package/dist/parsers/validators/postman-response.validators.js.map +1 -0
- package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
- package/dist/parsers/validators/postman-variable.validators.js +163 -0
- package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
- package/dist/pricing/pricing.repo.d.ts +0 -0
- package/dist/pricing/pricing.repo.js +1 -0
- package/dist/pricing/pricing.repo.js.map +1 -0
- package/dist/pricing/pricing.service.d.ts +24 -0
- package/dist/pricing/pricing.service.js +51 -0
- package/dist/pricing/pricing.service.js.map +1 -0
- package/dist/pricing/pricing.types.d.ts +76 -0
- package/dist/pricing/pricing.types.js +21 -0
- package/dist/pricing/pricing.types.js.map +1 -0
- package/dist/pricing/utils/string.utils.d.ts +1 -0
- package/dist/pricing/utils/string.utils.js +9 -0
- package/dist/pricing/utils/string.utils.js.map +1 -0
- package/dist/processor/repos/sms.repo.d.ts +4 -4
- package/dist/processor/repos/sms.repo.js +23 -10
- package/dist/processor/repos/sms.repo.js.map +1 -1
- package/dist/processor/services/messagebrokers/kafka.service.js +0 -2
- package/dist/processor/services/messagebrokers/kafka.service.js.map +1 -1
- package/dist/processor/services/messagebrokers/rabbitmq.service.d.ts +9 -1
- package/dist/processor/services/messagebrokers/rabbitmq.service.js +40 -11
- package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +40 -9
- package/dist/processor/services/processor.service.js +638 -276
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/services/request.service.d.ts +36 -0
- package/dist/processor/services/request.service.js +304 -0
- package/dist/processor/services/request.service.js.map +1 -0
- package/dist/processor/types/request.types.d.ts +14 -0
- package/dist/processor/types/request.types.js +3 -0
- package/dist/processor/types/request.types.js.map +1 -0
- package/dist/processor/utils/processor.utils.d.ts +3 -0
- package/dist/processor/utils/processor.utils.js +89 -6
- package/dist/processor/utils/processor.utils.js.map +1 -1
- package/dist/processor/utils/request.utils.d.ts +20 -0
- package/dist/processor/utils/request.utils.js +113 -0
- package/dist/processor/utils/request.utils.js.map +1 -0
- package/dist/processor/utils/storage.util.js +54 -40
- package/dist/processor/utils/storage.util.js.map +1 -1
- package/dist/products/services/products.service.d.ts +98 -77
- package/dist/products/services/products.service.js +569 -325
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/services/utils/crypt.utils.d.ts +1 -0
- package/dist/products/services/utils/crypt.utils.js +17 -0
- package/dist/products/services/utils/crypt.utils.js.map +1 -0
- package/dist/products/services/utils/functions.utils.d.ts +13 -0
- package/dist/products/services/utils/functions.utils.js +294 -0
- package/dist/products/services/utils/functions.utils.js.map +1 -0
- package/dist/products/services/utils/objects.utils.d.ts +13 -0
- package/dist/products/services/utils/objects.utils.js +89 -0
- package/dist/products/services/utils/objects.utils.js.map +1 -0
- package/dist/products/services/utils/string.utils.d.ts +12 -0
- package/dist/products/services/utils/string.utils.js +168 -0
- package/dist/products/services/utils/string.utils.js.map +1 -0
- package/dist/products/utils/string.utils.d.ts +1 -1
- package/dist/products/utils/string.utils.js +14 -2
- package/dist/products/utils/string.utils.js.map +1 -1
- package/dist/products/validators/index.d.ts +2 -1
- package/dist/products/validators/index.js +3 -1
- package/dist/products/validators/index.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +9 -4
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productNotification.validator.js +5 -2
- package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.userAuth.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.dataValue.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
- package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.userAuth.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +1 -1
- package/dist/test/test.health.d.ts +1 -0
- package/dist/test/test.health.js +49 -0
- package/dist/test/test.health.js.map +1 -0
- package/dist/test/test.import.js +51 -4
- package/dist/test/test.import.js.map +1 -1
- package/dist/test/test.imports.js +22 -7
- package/dist/test/test.imports.js.map +1 -1
- package/dist/test/test.notifiers.d.ts +1 -0
- package/dist/test/test.notifiers.js +85 -0
- package/dist/test/test.notifiers.js.map +1 -0
- package/dist/test/test.processor.js +32 -115
- package/dist/test/test.processor.js.map +1 -1
- package/dist/test/test.products.d.ts +1 -0
- package/dist/test/test.products.js +49 -0
- package/dist/test/test.products.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +4 -11
- package/dist/types/enums.d.ts +3 -1
- package/dist/types/enums.js +2 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +4 -0
- package/dist/types/pricing.types.d.ts +4 -0
- package/dist/types/pricing.types.js +3 -0
- package/dist/types/pricing.types.js.map +1 -0
- package/dist/types/processor.types.d.ts +67 -9
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +52 -8
- package/dist/types/productsBuilder.types.js +9 -1
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/types/request-tracker.interface.d.ts +0 -0
- package/dist/types/request-tracker.interface.js +1 -0
- package/dist/types/request-tracker.interface.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/constants.js.map +1 -0
- package/package.json +15 -3
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,
|
|
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,193 +231,850 @@ 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
|
-
|
|
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>;
|
|
45
|
-
|
|
46
|
-
|
|
315
|
+
/**
|
|
316
|
+
* Fetches all product sessions.
|
|
317
|
+
* @returns {IProductSession[]} The list of sessions.
|
|
318
|
+
*/
|
|
319
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
325
|
+
fetch: (tag: string) => Promise<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>;
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
*/
|
|
425
|
+
fetch: (tag: string) => Promise<IProductQuota>;
|
|
426
|
+
/**
|
|
427
|
+
* Fetches all quotas for a product.
|
|
428
|
+
* @returns {IProductQuota[]} The list of quotas.
|
|
429
|
+
*/
|
|
430
|
+
fetchAll: () => Promise<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>;
|
|
68
|
-
|
|
69
|
-
|
|
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
|
+
*/
|
|
451
|
+
fetch: (tag: string) => Promise<IProductFallback>;
|
|
452
|
+
/**
|
|
453
|
+
* Fetches all fallbacks for a product.
|
|
454
|
+
* @returns {IProductFallback[]} The list of fallbacks.
|
|
455
|
+
*/
|
|
456
|
+
fetchAll: () => Promise<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>;
|
|
75
|
-
|
|
76
|
-
|
|
479
|
+
/**
|
|
480
|
+
* Fetches all environments for a product.
|
|
481
|
+
* @returns {IAppEnv[]} The list of environments.
|
|
482
|
+
*/
|
|
483
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
489
|
+
fetch: (slug: string) => Promise<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>;
|
|
81
|
-
|
|
82
|
-
|
|
505
|
+
/**
|
|
506
|
+
* Fetches all storages for a product.
|
|
507
|
+
* @returns {IProductStorage[]} The list of storages.
|
|
508
|
+
*/
|
|
509
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
515
|
+
fetch: (tag: string) => Promise<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>;
|
|
84
|
-
|
|
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[]>;
|
|
85
529
|
};
|
|
86
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
|
+
*/
|
|
87
536
|
create: (data: Partial<IProductMessageBroker>) => Promise<void>;
|
|
88
|
-
|
|
89
|
-
|
|
537
|
+
/**
|
|
538
|
+
* Fetches all message brokers for a product.
|
|
539
|
+
* @returns {IProductMessageBroker[]} The list of message brokers.
|
|
540
|
+
*/
|
|
541
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
547
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
90
554
|
update: (tag: string, data: Partial<IProductMessageBroker>) => Promise<void>;
|
|
91
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
|
+
*/
|
|
92
561
|
create: (data: IProductMessageBrokerTopic) => Promise<void>;
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
*/
|
|
567
|
+
fetchAll: (messageBrokerTag: string) => Promise<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
|
+
*/
|
|
573
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
95
580
|
update: (tag: string, data: Partial<IProductMessageBrokerTopic>) => Promise<void>;
|
|
96
581
|
};
|
|
97
582
|
};
|
|
98
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
|
+
*/
|
|
99
589
|
create: (data: IProductNotification) => Promise<void>;
|
|
100
|
-
|
|
101
|
-
|
|
590
|
+
/**
|
|
591
|
+
* Fetches all notifications for a product.
|
|
592
|
+
* @returns {IProductNotification[]} The list of notifications.
|
|
593
|
+
*/
|
|
594
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
600
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
102
607
|
update: (tag: string, data: Partial<IProductNotification>) => Promise<void>;
|
|
103
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
|
+
*/
|
|
104
614
|
create: (data: IProductNotificationTemplate) => Promise<void>;
|
|
105
|
-
|
|
106
|
-
|
|
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
|
+
*/
|
|
620
|
+
fetchAll: (notificationTag: string) => Promise<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
|
+
*/
|
|
626
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
107
633
|
update: (tag: string, data: Partial<IProductNotificationTemplate>) => Promise<void>;
|
|
108
634
|
};
|
|
109
635
|
};
|
|
110
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
|
+
*/
|
|
111
642
|
create: (data: IProductDatabase) => Promise<void>;
|
|
112
|
-
|
|
113
|
-
|
|
643
|
+
/**
|
|
644
|
+
* Fetches all databases for a product.
|
|
645
|
+
* @returns {IProductDatabase[]} The list of databases.
|
|
646
|
+
*/
|
|
647
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
653
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
114
660
|
update: (tag: string, data: Partial<IProductDatabase>) => Promise<void>;
|
|
115
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
|
+
*/
|
|
116
667
|
create: (data: IProductDatabaseAction) => Promise<void>;
|
|
117
|
-
|
|
118
|
-
|
|
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
|
+
*/
|
|
673
|
+
fetchAll: (databaseTag: string) => Promise<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
|
+
*/
|
|
679
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
119
686
|
update: (tag: string, data: Partial<IProductDatabaseAction>) => Promise<void>;
|
|
120
687
|
};
|
|
121
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
|
+
*/
|
|
122
694
|
create: (data: IProductDatabaseMigration) => Promise<void>;
|
|
123
|
-
|
|
124
|
-
|
|
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
|
+
*/
|
|
700
|
+
fetchAll: (databaseTag: string) => Promise<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
|
+
*/
|
|
706
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
125
713
|
update: (tag: string, data: Partial<IProductDatabaseMigration>) => Promise<void>;
|
|
126
714
|
};
|
|
127
715
|
};
|
|
128
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
|
+
*/
|
|
129
722
|
create: (data: Partial<IProductJobs>) => Promise<void>;
|
|
130
|
-
|
|
131
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Fetches all jobs for a product.
|
|
725
|
+
* @returns {IProductJobs[]} The list of jobs.
|
|
726
|
+
*/
|
|
727
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
733
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
132
740
|
update: (tag: string, data: Partial<IProductJobs>) => Promise<void>;
|
|
133
741
|
};
|
|
134
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
|
+
*/
|
|
135
748
|
create: (data: IProductCache) => Promise<void>;
|
|
136
|
-
|
|
137
|
-
|
|
749
|
+
/**
|
|
750
|
+
* Fetches all caches for a product.
|
|
751
|
+
* @returns {IProductCache[]} The list of caches.
|
|
752
|
+
*/
|
|
753
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
759
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
138
766
|
update: (tag: string, data: Partial<IProductCache>) => Promise<void>;
|
|
139
767
|
values: (data: FetchRemoteCachePayload) => Promise<import("./types").IRemoteCache[]>;
|
|
140
768
|
};
|
|
141
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
|
+
*/
|
|
142
775
|
create: (data: Partial<IProductFeature>) => Promise<void>;
|
|
143
|
-
|
|
144
|
-
|
|
776
|
+
/**
|
|
777
|
+
* Fetches all features for a product.
|
|
778
|
+
* @returns {IProductFeature[]} The list of features.
|
|
779
|
+
*/
|
|
780
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
786
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
145
793
|
update: (tag: string, data: Partial<IProductCache>) => Promise<void>;
|
|
146
794
|
};
|
|
147
795
|
};
|
|
796
|
+
/**
|
|
797
|
+
* App-related operations for managing apps, variables, constants, actions, auths, webhooks, environments, and validation.
|
|
798
|
+
*/
|
|
148
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
|
+
*/
|
|
149
805
|
create: (data: ICreateAppBuilder) => Promise<{
|
|
150
806
|
app_id: string;
|
|
151
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
|
+
*/
|
|
152
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
|
+
*/
|
|
153
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
|
+
*/
|
|
154
826
|
init: (appTag: string) => Promise<void>;
|
|
155
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
|
+
*/
|
|
156
833
|
create: (data: IAppVariables) => Promise<void>;
|
|
157
|
-
|
|
158
|
-
|
|
834
|
+
/**
|
|
835
|
+
* Fetches all variables for an app.
|
|
836
|
+
* @returns {IAppVariables[]} The list of variables.
|
|
837
|
+
*/
|
|
838
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
844
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
159
851
|
update: (tag: string, data: Partial<IAppVariables>) => Promise<void>;
|
|
160
852
|
};
|
|
161
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
|
+
*/
|
|
162
859
|
create: (data: IAppConstants) => Promise<void>;
|
|
163
|
-
|
|
164
|
-
|
|
860
|
+
/**
|
|
861
|
+
* Fetches all constants for an app.
|
|
862
|
+
* @returns {IAppConstants[]} The list of constants.
|
|
863
|
+
*/
|
|
864
|
+
fetchAll: () => Promise<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
|
+
*/
|
|
870
|
+
fetch: (tag: string) => Promise<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
|
+
*/
|
|
165
877
|
update: (tag: string, data: Partial<IAppVariables>) => Promise<void>;
|
|
166
878
|
};
|
|
167
879
|
actions: {
|
|
168
|
-
|
|
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, }: {
|
|
169
891
|
file: Buffer;
|
|
170
892
|
type: ImportDocsTypes;
|
|
171
893
|
version: string;
|
|
172
894
|
appTag?: string;
|
|
173
895
|
updateIfExists?: boolean;
|
|
896
|
+
isAdminImport?: boolean;
|
|
174
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
|
+
*/
|
|
175
904
|
update: (tag: string, data: Partial<IActionUpdate>) => Promise<void>;
|
|
176
|
-
|
|
177
|
-
|
|
905
|
+
/**
|
|
906
|
+
* Updates an action by tag.
|
|
907
|
+
* @param {string} tag - The action tag.
|
|
908
|
+
* @param {Partial<IActionUpdate>} data - The action data to update.
|
|
909
|
+
* @returns {Promise<void>} Resolves when the action is updated. Throws on error.
|
|
910
|
+
*/
|
|
911
|
+
create: (data: Partial<IActionUpdate> & {
|
|
912
|
+
tag: string;
|
|
913
|
+
name: string;
|
|
914
|
+
resource: string;
|
|
915
|
+
method: string;
|
|
916
|
+
}) => Promise<void>;
|
|
917
|
+
/**
|
|
918
|
+
* Fetches all actions for an app.
|
|
919
|
+
* @returns {IAppAction[]} The list of actions.
|
|
920
|
+
*/
|
|
921
|
+
fetchAll: () => Promise<IAppAction[]>;
|
|
922
|
+
/**
|
|
923
|
+
* Fetches an action by tag.
|
|
924
|
+
* @param {string} tag - The action tag.
|
|
925
|
+
* @returns {IAppAction|null} The fetched action, or null if not found.
|
|
926
|
+
*/
|
|
927
|
+
fetch: (tag: string) => Promise<IAppAction>;
|
|
178
928
|
};
|
|
179
929
|
auths: {
|
|
930
|
+
/**
|
|
931
|
+
* Creates an auth for an app.
|
|
932
|
+
* @param {IAppAuth} data - The auth data.
|
|
933
|
+
* @returns {Promise<void>} Resolves when the auth is created. Throws on error.
|
|
934
|
+
*/
|
|
180
935
|
create: (data: IAppAuth) => Promise<void>;
|
|
181
|
-
|
|
182
|
-
|
|
936
|
+
/**
|
|
937
|
+
* Fetches all auths for an app.
|
|
938
|
+
* @returns {IAppAuth[]} The list of auths.
|
|
939
|
+
*/
|
|
940
|
+
fetchAll: () => Promise<IAppAuth[]>;
|
|
941
|
+
/**
|
|
942
|
+
* Fetches an auth by tag.
|
|
943
|
+
* @param {string} tag - The auth tag.
|
|
944
|
+
* @returns {IAppAuth|null} The fetched auth, or null if not found.
|
|
945
|
+
*/
|
|
946
|
+
fetch: (tag: string) => Promise<IAppAuth>;
|
|
947
|
+
/**
|
|
948
|
+
* Updates an auth by tag.
|
|
949
|
+
* @param {string} tag - The auth tag.
|
|
950
|
+
* @param {Partial<IAppAuth>} data - The auth data to update.
|
|
951
|
+
* @returns {Promise<void>} Resolves when the auth is updated. Throws on error.
|
|
952
|
+
*/
|
|
183
953
|
update: (tag: string, data: Partial<IAppAuth>) => Promise<void>;
|
|
184
954
|
};
|
|
185
955
|
webhooks: {
|
|
956
|
+
/**
|
|
957
|
+
* Creates a webhook for an app.
|
|
958
|
+
* @param {Partial<IAppWebhook>} data - The webhook data.
|
|
959
|
+
* @returns {Promise<void>} Resolves when the webhook is created. Throws on error.
|
|
960
|
+
*/
|
|
186
961
|
create: (data: Partial<IAppWebhook>) => Promise<void>;
|
|
187
|
-
|
|
188
|
-
|
|
962
|
+
/**
|
|
963
|
+
* Fetches all webhooks for an app.
|
|
964
|
+
* @returns {IAppWebhook[]} The list of webhooks.
|
|
965
|
+
*/
|
|
966
|
+
fetchAll: () => Promise<IAppWebhook[]>;
|
|
967
|
+
/**
|
|
968
|
+
* Fetches a webhook by tag.
|
|
969
|
+
* @param {string} tag - The webhook tag.
|
|
970
|
+
* @returns {IAppWebhook|null} The fetched webhook, or null if not found.
|
|
971
|
+
*/
|
|
972
|
+
fetch: (tag: string) => Promise<IAppWebhook>;
|
|
973
|
+
/**
|
|
974
|
+
* Updates a webhook by tag.
|
|
975
|
+
* @param {string} tag - The webhook tag.
|
|
976
|
+
* @param {Partial<IAppWebhook>} data - The webhook data to update.
|
|
977
|
+
* @returns {Promise<void>} Resolves when the webhook is updated. Throws on error.
|
|
978
|
+
*/
|
|
189
979
|
update: (tag: string, data: Partial<IAppWebhook>) => Promise<void>;
|
|
190
980
|
events: {
|
|
981
|
+
/**
|
|
982
|
+
* Creates a webhook event for an app.
|
|
983
|
+
* @param {IAppWebhookEvent} data - The webhook event data.
|
|
984
|
+
* @returns {Promise<void>} Resolves when the webhook event is created. Throws on error.
|
|
985
|
+
*/
|
|
191
986
|
create: (data: IAppWebhookEvent) => Promise<void>;
|
|
192
|
-
|
|
193
|
-
|
|
987
|
+
/**
|
|
988
|
+
* Fetches all webhook events for a webhook by tag.
|
|
989
|
+
* @param {string} webhookTag - The webhook tag.
|
|
990
|
+
* @returns {IAppWebhookEvent[]} The list of webhook events.
|
|
991
|
+
*/
|
|
992
|
+
fetchAll: (webhookTag: string) => Promise<IAppWebhookEvent[]>;
|
|
993
|
+
/**
|
|
994
|
+
* Fetches a webhook event by tag.
|
|
995
|
+
* @param {string} tag - The webhook event tag.
|
|
996
|
+
* @returns {IAppWebhookEvent|null} The fetched webhook event, or null if not found.
|
|
997
|
+
*/
|
|
998
|
+
fetch: (tag: string) => Promise<IAppWebhookEvent>;
|
|
999
|
+
/**
|
|
1000
|
+
* Updates a webhook event by tag.
|
|
1001
|
+
* @param {string} tag - The webhook event tag.
|
|
1002
|
+
* @param {Partial<IAppWebhookEvent>} data - The webhook event data to update.
|
|
1003
|
+
* @returns {Promise<void>} Resolves when the webhook event is updated. Throws on error.
|
|
1004
|
+
*/
|
|
194
1005
|
update: (tag: string, data: Partial<IAppWebhookEvent>) => Promise<void>;
|
|
195
1006
|
};
|
|
196
1007
|
};
|
|
197
1008
|
environments: {
|
|
1009
|
+
/**
|
|
1010
|
+
* Creates an environment for an app.
|
|
1011
|
+
* @param {IAppEnv} data - The environment data.
|
|
1012
|
+
* @returns {Promise<void>} Resolves when the environment is created. Throws on error.
|
|
1013
|
+
*/
|
|
198
1014
|
create: (data: IAppEnv) => Promise<void>;
|
|
199
|
-
|
|
200
|
-
|
|
1015
|
+
/**
|
|
1016
|
+
* Fetches all environments for an app.
|
|
1017
|
+
* @returns {IAppEnv[]} The list of environments.
|
|
1018
|
+
*/
|
|
1019
|
+
fetchAll: () => Promise<IAppEnv[]>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Fetches an environment by slug.
|
|
1022
|
+
* @param {string} slug - The environment slug.
|
|
1023
|
+
* @returns {IAppEnv|null} The fetched environment, or null if not found.
|
|
1024
|
+
*/
|
|
1025
|
+
fetch: (slug: string) => Promise<IAppEnv>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Updates an environment by slug.
|
|
1028
|
+
* @param {string} slug - The environment slug.
|
|
1029
|
+
* @param {Partial<IAppEnv>} data - The environment data to update.
|
|
1030
|
+
* @returns {Promise<void>} Resolves when the environment is updated. Throws on error.
|
|
1031
|
+
*/
|
|
201
1032
|
update: (slug: string, data: Partial<IAppEnv>) => Promise<void>;
|
|
202
1033
|
};
|
|
1034
|
+
/**
|
|
1035
|
+
* Updates data validation for an app.
|
|
1036
|
+
* @param {string} selector - The selector for the data validation.
|
|
1037
|
+
* @param {Partial<IParsedSample>} update - The update data.
|
|
1038
|
+
* @returns {Promise<void>} Resolves when the validation is updated. Throws on error.
|
|
1039
|
+
*/
|
|
203
1040
|
validation: (selector: string, update: Partial<IParsedSample>) => Promise<void>;
|
|
204
1041
|
};
|
|
1042
|
+
/**
|
|
1043
|
+
* Processor-related operations for running jobs, actions, database actions, sessions, features, quotas, fallbacks, notifications, storage, and message broker.
|
|
1044
|
+
*/
|
|
205
1045
|
processor: {
|
|
206
1046
|
job: {
|
|
1047
|
+
/**
|
|
1048
|
+
* Schedules a job for a product.
|
|
1049
|
+
* @param {IProduct} data - The product data.
|
|
1050
|
+
* @returns {Promise<any>} The result of the job scheduling.
|
|
1051
|
+
*/
|
|
207
1052
|
schedule: (data: IProduct) => Promise<void>;
|
|
208
1053
|
};
|
|
209
1054
|
action: {
|
|
1055
|
+
/**
|
|
1056
|
+
* Runs an action processor.
|
|
1057
|
+
* @param {IActionProcessorInput} data - The action processor input.
|
|
1058
|
+
* @returns {Promise<any>} The result of the action processing.
|
|
1059
|
+
*/
|
|
210
1060
|
run: (data: IActionProcessorInput) => Promise<any>;
|
|
211
1061
|
};
|
|
212
1062
|
db: {
|
|
1063
|
+
/**
|
|
1064
|
+
* Executes a database action processor.
|
|
1065
|
+
* @param {IDBActionProcessorInput} data - The database action processor input.
|
|
1066
|
+
* @returns {Promise<any>} The result of the database action processing.
|
|
1067
|
+
*/
|
|
213
1068
|
execute: (data: IDBActionProcessorInput) => Promise<any>;
|
|
214
1069
|
migration: {
|
|
1070
|
+
/**
|
|
1071
|
+
* Runs a database migration.
|
|
1072
|
+
* @param {Object} params - The migration parameters.
|
|
1073
|
+
* @param {string} params.migration - The migration name.
|
|
1074
|
+
* @param {string} params.env - The environment.
|
|
1075
|
+
* @param {string} params.product - The product name.
|
|
1076
|
+
* @returns {Promise<any>} The result of the migration.
|
|
1077
|
+
*/
|
|
215
1078
|
run: ({ migration, env, product }: {
|
|
216
1079
|
migration: string;
|
|
217
1080
|
env: string;
|
|
@@ -219,6 +1082,14 @@ export default class Ductape implements IDuctape {
|
|
|
219
1082
|
}) => Promise<{
|
|
220
1083
|
process_id: string;
|
|
221
1084
|
}>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Rolls back a database migration.
|
|
1087
|
+
* @param {Object} params - The migration parameters.
|
|
1088
|
+
* @param {string} params.migration - The migration name.
|
|
1089
|
+
* @param {string} params.env - The environment.
|
|
1090
|
+
* @param {string} params.product - The product name.
|
|
1091
|
+
* @returns {Promise<any>} The result of the rollback.
|
|
1092
|
+
*/
|
|
222
1093
|
rollback: ({ migration, env, product }: {
|
|
223
1094
|
migration: string;
|
|
224
1095
|
env: string;
|
|
@@ -229,12 +1100,39 @@ export default class Ductape implements IDuctape {
|
|
|
229
1100
|
};
|
|
230
1101
|
};
|
|
231
1102
|
sessions: {
|
|
232
|
-
|
|
1103
|
+
/**
|
|
1104
|
+
* Starts a new session.
|
|
1105
|
+
* @param {ISessionInput} data - The session input data.
|
|
1106
|
+
* @returns {Promise<any>} The result of the session generation.
|
|
1107
|
+
*/
|
|
1108
|
+
start: (data: ISessionInput) => Promise<import("./types").ISessionOutput>;
|
|
1109
|
+
/**
|
|
1110
|
+
* Decrypts a session.
|
|
1111
|
+
* @param {ISessionPayload} data - The session payload.
|
|
1112
|
+
* @returns {Promise<any>} The decrypted session.
|
|
1113
|
+
*/
|
|
1114
|
+
decrypt: (data: ISessionPayload) => Promise<any>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Refreshes a session.
|
|
1117
|
+
* @param {ISessionRefreshPayload} data - The session refresh payload.
|
|
1118
|
+
* @returns {Promise<any>} The refreshed session.
|
|
1119
|
+
*/
|
|
1120
|
+
refresh: (data: ISessionRefreshPayload) => Promise<import("./types").ISessionOutput>;
|
|
233
1121
|
};
|
|
234
1122
|
feature: {
|
|
1123
|
+
/**
|
|
1124
|
+
* Runs a feature processor.
|
|
1125
|
+
* @param {IProcessorInput} data - The feature processor input.
|
|
1126
|
+
* @returns {Promise<any>} The result of the feature processing.
|
|
1127
|
+
*/
|
|
235
1128
|
run: (data: IProcessorInput) => Promise<{
|
|
236
1129
|
process_id: string;
|
|
237
1130
|
}>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Generates output for a process by ID.
|
|
1133
|
+
* @param {string} process_id - The process ID.
|
|
1134
|
+
* @returns {Promise<any>} The generated output.
|
|
1135
|
+
*/
|
|
238
1136
|
output: (process_id: string) => Promise<{
|
|
239
1137
|
process_id: string;
|
|
240
1138
|
status: import("./types").LogEventStatus;
|
|
@@ -251,83 +1149,99 @@ export default class Ductape implements IDuctape {
|
|
|
251
1149
|
data?: undefined;
|
|
252
1150
|
errors?: undefined;
|
|
253
1151
|
}>;
|
|
1152
|
+
/**
|
|
1153
|
+
* Replays a process by ID.
|
|
1154
|
+
* @param {string} process_id - The process ID.
|
|
1155
|
+
* @returns {Promise<any>} The result of the replay.
|
|
1156
|
+
*/
|
|
254
1157
|
replay: (process_id: string) => Promise<{
|
|
255
1158
|
process_id: string;
|
|
256
1159
|
}>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Resumes a process by ID.
|
|
1162
|
+
* @param {string} process_id - The process ID.
|
|
1163
|
+
* @returns {Promise<any>} The result of the resume.
|
|
1164
|
+
*/
|
|
257
1165
|
resume: (process_id: string) => Promise<{
|
|
258
1166
|
process_id: string;
|
|
259
1167
|
}>;
|
|
260
1168
|
};
|
|
261
1169
|
quota: {
|
|
1170
|
+
/**
|
|
1171
|
+
* Runs a quota processor.
|
|
1172
|
+
* @param {IProcessorInput} data - The quota processor input.
|
|
1173
|
+
* @returns {Promise<any>} The result of the quota processing.
|
|
1174
|
+
*/
|
|
262
1175
|
run: (data: IProcessorInput) => Promise<any>;
|
|
263
1176
|
};
|
|
264
1177
|
fallback: {
|
|
1178
|
+
/**
|
|
1179
|
+
* Runs a fallback processor.
|
|
1180
|
+
* @param {IProcessorInput} data - The fallback processor input.
|
|
1181
|
+
* @returns {Promise<any>} The result of the fallback processing.
|
|
1182
|
+
*/
|
|
265
1183
|
run: (data: IProcessorInput) => Promise<any>;
|
|
266
1184
|
};
|
|
267
1185
|
notification: {
|
|
1186
|
+
/**
|
|
1187
|
+
* Sends a notification using the notification processor.
|
|
1188
|
+
* @param {INotificationProcessorInput} data - The notification processor input.
|
|
1189
|
+
* @returns {Promise<any>} The result of the notification processing.
|
|
1190
|
+
*/
|
|
268
1191
|
send: (data: INotificationProcessorInput) => Promise<{
|
|
269
1192
|
process_id: string;
|
|
270
1193
|
}>;
|
|
271
1194
|
};
|
|
272
1195
|
storage: {
|
|
1196
|
+
/**
|
|
1197
|
+
* Reads a file from storage.
|
|
1198
|
+
* @param {string} path - The file path.
|
|
1199
|
+
* @returns {Promise<IFileReadResult>} The file read result.
|
|
1200
|
+
*/
|
|
273
1201
|
readFile: (path: string) => Promise<IFileReadResult>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Saves data to storage using the storage processor.
|
|
1204
|
+
* @param {IStorageProcessorInput} data - The storage processor input.
|
|
1205
|
+
* @returns {Promise<any>} The result of the storage processing.
|
|
1206
|
+
*/
|
|
274
1207
|
save: (data: IStorageProcessorInput) => Promise<any>;
|
|
275
1208
|
};
|
|
276
1209
|
messageBroker: {
|
|
1210
|
+
/**
|
|
1211
|
+
* Publishes a message using the message broker processor.
|
|
1212
|
+
* @param {IMessageBrokerPublishInput} data - The publish input.
|
|
1213
|
+
* @returns {Promise<any>} The result of the publish operation.
|
|
1214
|
+
*/
|
|
277
1215
|
publish: (data: IMessageBrokerPublishInput) => Promise<void | {
|
|
278
1216
|
process_id: string;
|
|
279
1217
|
}>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Subscribes to a message broker topic.
|
|
1220
|
+
* @param {IMessageBrokerSubscribeInput} data - The subscribe input.
|
|
1221
|
+
* @returns {Promise<any>} The result of the subscribe operation.
|
|
1222
|
+
*/
|
|
280
1223
|
subcribe: (data: IMessageBrokerSubscribeInput) => Promise<void | {
|
|
281
1224
|
process_id: string;
|
|
282
1225
|
}>;
|
|
283
1226
|
};
|
|
284
1227
|
};
|
|
1228
|
+
/**
|
|
1229
|
+
* Logs-related operations for initializing and fetching logs.
|
|
1230
|
+
*/
|
|
285
1231
|
logs: {
|
|
1232
|
+
/**
|
|
1233
|
+
* Initializes the logger service for a product or app.
|
|
1234
|
+
* @param {string} [productTag] - The product tag (optional).
|
|
1235
|
+
* @param {string} [appTag] - The app tag (optional).
|
|
1236
|
+
* @throws {Error} If neither productTag nor appTag is provided.
|
|
1237
|
+
* @returns {Promise<void>} Resolves when logger is initialized.
|
|
1238
|
+
*/
|
|
286
1239
|
init: (productTag?: string, appTag?: string) => Promise<void>;
|
|
287
1240
|
add: () => Promise<void>;
|
|
288
1241
|
/**
|
|
289
|
-
* Fetches logs based on
|
|
290
|
-
*
|
|
291
|
-
* @
|
|
292
|
-
* @param params.type - Optional. Type of analysis ('apps', 'process', 'feature', 'integrations', etc.)
|
|
293
|
-
* @param params.groupBy - Optional. Time period for grouping ('day', 'week', 'month', 'year')
|
|
294
|
-
* @param params.search - Optional. Search term for filtering logs
|
|
295
|
-
* @param params.page - Optional. Page number for pagination (≥ 1)
|
|
296
|
-
* @param params.limit - Optional. Number of items per page (≥ 1)
|
|
297
|
-
* @param params.status - Optional. Filter by status ('success', 'processing', 'fail')
|
|
298
|
-
*
|
|
299
|
-
* For component='app':
|
|
300
|
-
* @param params.tag - Optional. Tag identifier (only valid when type='actions')
|
|
301
|
-
* @param params.env - Optional. Environment filter
|
|
302
|
-
* @param params.name - Optional. Name filter
|
|
303
|
-
* @param params.action - Optional. Specific action filter
|
|
304
|
-
*
|
|
305
|
-
* For component='product':
|
|
306
|
-
* @param params.env - Optional. Environment filter
|
|
307
|
-
* @param params.name - Optional. Name filter
|
|
308
|
-
* @param params.action - Optional. Specific action filter
|
|
309
|
-
*
|
|
310
|
-
* @throws {Error} If logger service is not initialized
|
|
311
|
-
* @throws {Error} If required parameters are missing or invalid
|
|
312
|
-
* @throws {Error} If API request fails
|
|
313
|
-
*
|
|
314
|
-
* @returns {Promise<any>} The fetched log data
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* // Fetch app logs
|
|
318
|
-
* const appLogs = await logs.fetch({
|
|
319
|
-
* component: 'app',
|
|
320
|
-
* type: 'actions',
|
|
321
|
-
* groupBy: 'day',
|
|
322
|
-
* limit: 20
|
|
323
|
-
* });
|
|
324
|
-
*
|
|
325
|
-
* // Fetch product logs
|
|
326
|
-
* const productLogs = await logs.fetch({
|
|
327
|
-
* component: 'product',
|
|
328
|
-
* type: 'database',
|
|
329
|
-
* status: 'success'
|
|
330
|
-
* });
|
|
1242
|
+
* Fetches logs based on provided query parameters.
|
|
1243
|
+
* @param {LogQueryParams} params - The log query parameters.
|
|
1244
|
+
* @returns {Promise<any>} The fetched log data.
|
|
331
1245
|
*/
|
|
332
1246
|
fetch: (params: LogQueryParams) => Promise<any>;
|
|
333
1247
|
publish: () => Promise<void>;
|
|
@@ -344,4 +1258,8 @@ export default class Ductape implements IDuctape {
|
|
|
344
1258
|
private refreshUserAccessToken;
|
|
345
1259
|
fetchWorkspaceApps(status: PublicStates): Promise<Array<IApp>>;
|
|
346
1260
|
fetchWorkspaceProjects(status: PublicStates): Promise<Array<IProduct>>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Fetches the latest healthcheck status for a product/env from Redis cache via processor service.
|
|
1263
|
+
*/
|
|
1264
|
+
getHealthcheckStatus(productTag: string, envSlug: string): Promise<any>;
|
|
347
1265
|
}
|