@ductape/sdk 0.0.4-v99 → 0.0.5
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/agents/agent-context.d.ts +3 -1
- package/dist/agents/agent-context.js +19 -3
- package/dist/agents/agent-context.js.map +1 -1
- package/dist/agents/agents.service.js +9 -5
- package/dist/agents/agents.service.js.map +1 -1
- package/dist/agents/types/agents.types.d.ts +14 -1
- package/dist/agents/types/agents.types.js.map +1 -1
- package/dist/api/services/appApi.service.js +15 -6
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/logsApi.service.d.ts +51 -0
- package/dist/api/services/logsApi.service.js +19 -2
- package/dist/api/services/logsApi.service.js.map +1 -1
- package/dist/api/services/processorApi.service.d.ts +568 -2
- package/dist/api/services/processorApi.service.js +412 -21
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +20 -0
- package/dist/api/services/productsApi.service.js +44 -15
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/services/secretsApi.service.js +0 -11
- package/dist/api/services/secretsApi.service.js.map +1 -1
- package/dist/api/services/webhooksApi.service.js +13 -6
- package/dist/api/services/webhooksApi.service.js.map +1 -1
- package/dist/api/services/workflowApi.service.js +30 -12
- package/dist/api/services/workflowApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +26 -0
- package/dist/api/urls.js +30 -3
- package/dist/api/urls.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +12 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
- package/dist/brokers/brokers.service.d.ts +140 -2
- package/dist/brokers/brokers.service.js +444 -36
- package/dist/brokers/brokers.service.js.map +1 -1
- package/dist/brokers/types/index.d.ts +251 -0
- package/dist/brokers/utils/providers/rabbitmq.service.d.ts +14 -4
- package/dist/brokers/utils/providers/rabbitmq.service.js +22 -35
- package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -1
- package/dist/cache/cache.manager.d.ts +84 -5
- package/dist/cache/cache.manager.js +478 -38
- package/dist/cache/cache.manager.js.map +1 -1
- package/dist/cache/cache.service.d.ts +5 -0
- package/dist/cache/cache.service.js +163 -6
- package/dist/cache/cache.service.js.map +1 -1
- package/dist/cache/index.d.ts +1 -1
- package/dist/cache/index.js +3 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/types/index.d.ts +4 -0
- package/dist/database/databases.service.d.ts +70 -2
- package/dist/database/databases.service.js +150 -35
- package/dist/database/databases.service.js.map +1 -1
- package/dist/database/types/dashboard.interface.d.ts +74 -0
- package/dist/database/types/dashboard.interface.js +7 -0
- package/dist/database/types/dashboard.interface.js.map +1 -0
- package/dist/database/types/index.d.ts +1 -0
- package/dist/graph/graphs.service.d.ts +50 -12
- package/dist/graph/graphs.service.js +689 -203
- package/dist/graph/graphs.service.js.map +1 -1
- package/dist/graph/types/connection.interface.d.ts +2 -2
- package/dist/index.d.ts +286 -4
- package/dist/index.js +370 -21
- package/dist/index.js.map +1 -1
- package/dist/logs/logs.types.d.ts +16 -3
- package/dist/logs/logs.types.js +11 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/notifications/notifications.service.d.ts +3 -0
- package/dist/notifications/notifications.service.js +57 -14
- package/dist/notifications/notifications.service.js.map +1 -1
- package/dist/notifications/types/notifications.types.d.ts +50 -0
- package/dist/processor/services/processor.service.d.ts +132 -8
- package/dist/processor/services/processor.service.js +1174 -267
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/utils/processor.utils.d.ts +5 -0
- package/dist/processor/utils/processor.utils.js +65 -12
- package/dist/processor/utils/processor.utils.js.map +1 -1
- package/dist/processor/utils/storage.util.js +11 -2
- package/dist/processor/utils/storage.util.js.map +1 -1
- package/dist/products/services/products.service.d.ts +19 -2
- package/dist/products/services/products.service.js +388 -54
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productFeature.validator.js +1 -1
- package/dist/products/validators/joi-validators/create.productJob.validator.js +2 -2
- package/dist/products/validators/joi-validators/create.productJob.validator.js.map +1 -1
- 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.productNotification.validator.js +23 -12
- package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
- package/dist/resilience/fallback.service.d.ts +1 -0
- package/dist/resilience/fallback.service.js +2 -0
- package/dist/resilience/fallback.service.js.map +1 -1
- package/dist/resilience/quota.service.d.ts +1 -0
- package/dist/resilience/quota.service.js +2 -0
- package/dist/resilience/quota.service.js.map +1 -1
- package/dist/secrets/secrets.resolver.js +4 -1
- package/dist/secrets/secrets.resolver.js.map +1 -1
- package/dist/secrets/secrets.service.js +0 -12
- package/dist/secrets/secrets.service.js.map +1 -1
- package/dist/secrets/secrets.types.d.ts +3 -3
- package/dist/secrets/secrets.types.js +5 -5
- package/dist/secrets/secrets.types.js.map +1 -1
- package/dist/sessions/index.d.ts +1 -1
- package/dist/sessions/index.js +4 -1
- package/dist/sessions/index.js.map +1 -1
- package/dist/sessions/sessions.helper.d.ts +23 -3
- package/dist/sessions/sessions.helper.js +20 -3
- package/dist/sessions/sessions.helper.js.map +1 -1
- package/dist/sessions/sessions.resolver.d.ts +31 -0
- package/dist/sessions/sessions.resolver.js +230 -1
- package/dist/sessions/sessions.resolver.js.map +1 -1
- package/dist/sessions/sessions.service.d.ts +18 -2
- package/dist/sessions/sessions.service.js +121 -57
- package/dist/sessions/sessions.service.js.map +1 -1
- package/dist/sessions/types/index.d.ts +65 -21
- package/dist/storage/storage.service.d.ts +3 -0
- package/dist/storage/storage.service.js +179 -39
- package/dist/storage/storage.service.js.map +1 -1
- package/dist/types/index.types.d.ts +2 -0
- package/dist/types/inputs.types.d.ts +1 -0
- package/dist/types/inputs.types.js +3 -2
- package/dist/types/inputs.types.js.map +1 -1
- package/dist/types/processor.types.d.ts +72 -6
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +10 -0
- package/dist/types/productsBuilder.types.js +4 -0
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/vector/adapters/weaviate.adapter.js +22 -6
- package/dist/vector/adapters/weaviate.adapter.js.map +1 -1
- package/dist/vector/vector-database.service.d.ts +4 -2
- package/dist/vector/vector-database.service.js +71 -29
- package/dist/vector/vector-database.service.js.map +1 -1
- package/dist/workflows/types/workflows.types.d.ts +61 -3
- package/dist/workflows/types/workflows.types.js.map +1 -1
- package/dist/workflows/workflow-builder.js +17 -2
- package/dist/workflows/workflow-builder.js.map +1 -1
- package/dist/workflows/workflow-executor.d.ts +97 -18
- package/dist/workflows/workflow-executor.js +1449 -244
- package/dist/workflows/workflow-executor.js.map +1 -1
- package/dist/workflows/workflows.service.d.ts +2 -0
- package/dist/workflows/workflows.service.js +538 -74
- package/dist/workflows/workflows.service.js.map +1 -1
- package/package.json +11 -1
- package/dist/processor/services/fallback.service.d.ts +0 -5
- package/dist/processor/services/fallback.service.js +0 -43
- package/dist/processor/services/fallback.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/aws-sqs.service.d.ts +0 -15
- package/dist/processor/services/messagebrokers/aws-sqs.service.js +0 -77
- package/dist/processor/services/messagebrokers/aws-sqs.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/google-pubsub.service.d.ts +0 -16
- package/dist/processor/services/messagebrokers/google-pubsub.service.js +0 -34
- package/dist/processor/services/messagebrokers/google-pubsub.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/index.d.ts +0 -3
- package/dist/processor/services/messagebrokers/index.js +0 -26
- package/dist/processor/services/messagebrokers/index.js.map +0 -1
- package/dist/processor/services/messagebrokers/kafka.service.d.ts +0 -14
- package/dist/processor/services/messagebrokers/kafka.service.js +0 -45
- package/dist/processor/services/messagebrokers/kafka.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/messagebrokers.type.d.ts +0 -6
- package/dist/processor/services/messagebrokers/messagebrokers.type.js +0 -3
- package/dist/processor/services/messagebrokers/messagebrokers.type.js.map +0 -1
- package/dist/processor/services/messagebrokers/rabbitmq.service.d.ts +0 -14
- package/dist/processor/services/messagebrokers/rabbitmq.service.js +0 -67
- package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/redis.service.d.ts +0 -18
- package/dist/processor/services/messagebrokers/redis.service.js +0 -82
- package/dist/processor/services/messagebrokers/redis.service.js.map +0 -1
- package/dist/processor/services/quota.service.d.ts +0 -15
- package/dist/processor/services/quota.service.js +0 -63
- package/dist/processor/services/quota.service.js.map +0 -1
- package/dist/test/index.d.ts +0 -3
- package/dist/test/index.js +0 -11
- package/dist/test/index.js.map +0 -1
- package/dist/test/test.appBuilder.d.ts +0 -0
- package/dist/test/test.appBuilder.js +0 -1
- package/dist/test/test.appBuilder.js.map +0 -1
- package/dist/test/test.broker.kafka.d.ts +0 -1
- package/dist/test/test.broker.kafka.js +0 -172
- package/dist/test/test.broker.kafka.js.map +0 -1
- package/dist/test/test.broker.nats.d.ts +0 -1
- package/dist/test/test.broker.nats.js +0 -193
- package/dist/test/test.broker.nats.js.map +0 -1
- package/dist/test/test.broker.pubsub.d.ts +0 -1
- package/dist/test/test.broker.pubsub.js +0 -171
- package/dist/test/test.broker.pubsub.js.map +0 -1
- package/dist/test/test.broker.rabbitmq.d.ts +0 -1
- package/dist/test/test.broker.rabbitmq.js +0 -164
- package/dist/test/test.broker.rabbitmq.js.map +0 -1
- package/dist/test/test.broker.redis.d.ts +0 -1
- package/dist/test/test.broker.redis.js +0 -168
- package/dist/test/test.broker.redis.js.map +0 -1
- package/dist/test/test.broker.sqs.d.ts +0 -1
- package/dist/test/test.broker.sqs.js +0 -158
- package/dist/test/test.broker.sqs.js.map +0 -1
- package/dist/test/test.caches.d.ts +0 -1
- package/dist/test/test.caches.js +0 -231
- package/dist/test/test.caches.js.map +0 -1
- package/dist/test/test.database.d.ts +0 -1
- package/dist/test/test.database.dynamo.d.ts +0 -1
- package/dist/test/test.database.dynamo.js +0 -265
- package/dist/test/test.database.dynamo.js.map +0 -1
- package/dist/test/test.database.js +0 -140
- package/dist/test/test.database.js.map +0 -1
- package/dist/test/test.database.mongo.d.ts +0 -1
- package/dist/test/test.database.mongo.js +0 -371
- package/dist/test/test.database.mongo.js.map +0 -1
- package/dist/test/test.database.mysql.d.ts +0 -1
- package/dist/test/test.database.mysql.js +0 -415
- package/dist/test/test.database.mysql.js.map +0 -1
- package/dist/test/test.database.postgres.d.ts +0 -1
- package/dist/test/test.database.postgres.js +0 -412
- package/dist/test/test.database.postgres.js.map +0 -1
- package/dist/test/test.email.brevo.d.ts +0 -1
- package/dist/test/test.email.brevo.js +0 -326
- package/dist/test/test.email.brevo.js.map +0 -1
- package/dist/test/test.email.mailgun.d.ts +0 -1
- package/dist/test/test.email.mailgun.js +0 -352
- package/dist/test/test.email.mailgun.js.map +0 -1
- package/dist/test/test.email.postmark.d.ts +0 -1
- package/dist/test/test.email.postmark.js +0 -316
- package/dist/test/test.email.postmark.js.map +0 -1
- package/dist/test/test.email.sendgrid.d.ts +0 -1
- package/dist/test/test.email.sendgrid.js +0 -365
- package/dist/test/test.email.sendgrid.js.map +0 -1
- package/dist/test/test.email.smtp.d.ts +0 -1
- package/dist/test/test.email.smtp.js +0 -323
- package/dist/test/test.email.smtp.js.map +0 -1
- package/dist/test/test.graph.arangodb.d.ts +0 -1
- package/dist/test/test.graph.arangodb.js +0 -358
- package/dist/test/test.graph.arangodb.js.map +0 -1
- package/dist/test/test.graph.memgraph.d.ts +0 -1
- package/dist/test/test.graph.memgraph.js +0 -320
- package/dist/test/test.graph.memgraph.js.map +0 -1
- package/dist/test/test.graph.neo4j.d.ts +0 -1
- package/dist/test/test.graph.neo4j.js +0 -218
- package/dist/test/test.graph.neo4j.js.map +0 -1
- package/dist/test/test.graph.neptune.d.ts +0 -1
- package/dist/test/test.graph.neptune.js +0 -331
- package/dist/test/test.graph.neptune.js.map +0 -1
- package/dist/test/test.health.d.ts +0 -0
- package/dist/test/test.health.js +0 -1
- package/dist/test/test.health.js.map +0 -1
- package/dist/test/test.import.d.ts +0 -0
- package/dist/test/test.import.js +0 -1
- package/dist/test/test.import.js.map +0 -1
- package/dist/test/test.import.openapi.d.ts +0 -0
- package/dist/test/test.import.openapi.js +0 -1
- package/dist/test/test.import.openapi.js.map +0 -1
- package/dist/test/test.imports.d.ts +0 -1
- package/dist/test/test.imports.js +0 -21
- package/dist/test/test.imports.js.map +0 -1
- package/dist/test/test.logs.d.ts +0 -0
- package/dist/test/test.logs.js +0 -1
- package/dist/test/test.logs.js.map +0 -1
- package/dist/test/test.notifications.d.ts +0 -1
- package/dist/test/test.notifications.js +0 -198
- package/dist/test/test.notifications.js.map +0 -1
- package/dist/test/test.notifiers.d.ts +0 -0
- package/dist/test/test.notifiers.js +0 -1
- package/dist/test/test.notifiers.js.map +0 -1
- package/dist/test/test.processor.d.ts +0 -0
- package/dist/test/test.processor.js +0 -1
- package/dist/test/test.processor.js.map +0 -1
- package/dist/test/test.productBuilder.d.ts +0 -0
- package/dist/test/test.productBuilder.js +0 -1
- package/dist/test/test.productBuilder.js.map +0 -1
- package/dist/test/test.products.d.ts +0 -0
- package/dist/test/test.products.js +0 -1
- package/dist/test/test.products.js.map +0 -1
- package/dist/test/test.push.expo.d.ts +0 -1
- package/dist/test/test.push.expo.js +0 -442
- package/dist/test/test.push.expo.js.map +0 -1
- package/dist/test/test.push.firebase.d.ts +0 -1
- package/dist/test/test.push.firebase.js +0 -409
- package/dist/test/test.push.firebase.js.map +0 -1
- package/dist/test/test.session.d.ts +0 -1
- package/dist/test/test.session.js +0 -299
- package/dist/test/test.session.js.map +0 -1
- package/dist/test/test.sms.nexmo.d.ts +0 -1
- package/dist/test/test.sms.nexmo.js +0 -278
- package/dist/test/test.sms.nexmo.js.map +0 -1
- package/dist/test/test.sms.twilio.d.ts +0 -1
- package/dist/test/test.sms.twilio.js +0 -275
- package/dist/test/test.sms.twilio.js.map +0 -1
- package/dist/test/test.storage.d.ts +0 -1
- package/dist/test/test.storage.js +0 -202
- package/dist/test/test.storage.js.map +0 -1
- package/dist/test/test.triggers.d.ts +0 -1
- package/dist/test/test.triggers.js +0 -314
- package/dist/test/test.triggers.js.map +0 -1
- package/dist/test/test.vector.pinecone.d.ts +0 -1
- package/dist/test/test.vector.pinecone.js +0 -238
- package/dist/test/test.vector.pinecone.js.map +0 -1
- package/dist/test/test.vector.qdrant.d.ts +0 -1
- package/dist/test/test.vector.qdrant.js +0 -307
- package/dist/test/test.vector.qdrant.js.map +0 -1
- package/dist/test/test.vector.weaviate.d.ts +0 -1
- package/dist/test/test.vector.weaviate.js +0 -325
- package/dist/test/test.vector.weaviate.js.map +0 -1
|
@@ -24,17 +24,27 @@ class ProcessorApiService {
|
|
|
24
24
|
}
|
|
25
25
|
async saveFileURL(payload, auth) {
|
|
26
26
|
try {
|
|
27
|
-
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
28
|
-
|
|
27
|
+
const { token, access_key } = auth, userAuthData = __rest(auth, ["token", "access_key"]);
|
|
28
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
29
|
+
if (access_key)
|
|
30
|
+
config.headers['x-access-key'] = access_key;
|
|
31
|
+
await (0, products_client_1.productsClient)(this.environment).post(urls_1.PROCESSOR_SAVE_FILE, Object.assign(Object.assign({}, userAuthData), payload), config);
|
|
29
32
|
}
|
|
30
33
|
catch (e) {
|
|
31
34
|
throw e;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Save processor result (fire-and-forget from workflow executor / processor).
|
|
39
|
+
* data must include start and end (Unix ms) for timeline and list ordering.
|
|
40
|
+
*/
|
|
34
41
|
async saveResult(data, payload) {
|
|
35
42
|
try {
|
|
36
|
-
const { token } = payload, userAuthData = __rest(payload, ["token"]);
|
|
37
|
-
|
|
43
|
+
const { token, access_key } = payload, userAuthData = __rest(payload, ["token", "access_key"]);
|
|
44
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
45
|
+
if (access_key)
|
|
46
|
+
config.headers['x-access-key'] = access_key;
|
|
47
|
+
await (0, products_client_1.productsClient)(this.environment).post(urls_1.PROCESSOR_SAVE_RESULT, Object.assign(Object.assign({}, userAuthData), { data }), config);
|
|
38
48
|
}
|
|
39
49
|
catch (e) {
|
|
40
50
|
throw e;
|
|
@@ -55,9 +65,11 @@ class ProcessorApiService {
|
|
|
55
65
|
var _a;
|
|
56
66
|
try {
|
|
57
67
|
const URL = (0, strings_utils_1.Parameterize)(urls_1.PROCESS_INTEGRATION_URL, ':product_id', product_id);
|
|
58
|
-
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
const { token, access_key } = auth, userAuthData = __rest(auth, ["token", "access_key"]);
|
|
69
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
70
|
+
if (access_key)
|
|
71
|
+
config.headers['x-access-key'] = access_key;
|
|
72
|
+
const response = await (0, products_client_1.productsClient)(this.environment).post(URL, Object.assign(Object.assign({}, payload), userAuthData), config);
|
|
61
73
|
return (_a = response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
62
74
|
}
|
|
63
75
|
catch (e) {
|
|
@@ -103,20 +115,40 @@ class ProcessorApiService {
|
|
|
103
115
|
}
|
|
104
116
|
}
|
|
105
117
|
async addToRemoteCache(payload, auth) {
|
|
118
|
+
var _a;
|
|
106
119
|
try {
|
|
107
|
-
const { token } = auth;
|
|
108
|
-
const
|
|
109
|
-
const
|
|
120
|
+
const { token, access_key } = auth, restAuth = __rest(auth, ["token", "access_key"]);
|
|
121
|
+
const serializedPayload = Object.assign(Object.assign({}, payload), { expiry: payload.expiry instanceof Date ? payload.expiry.toISOString() : payload.expiry });
|
|
122
|
+
const body = Object.assign(Object.assign({}, serializedPayload), restAuth);
|
|
123
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
124
|
+
if (access_key)
|
|
125
|
+
config.headers['x-access-key'] = access_key;
|
|
126
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(urls_1.INTEGRATION_REMOTE_CACHE, body, config);
|
|
110
127
|
return res.data.data;
|
|
111
128
|
}
|
|
112
129
|
catch (e) {
|
|
130
|
+
// Enhanced error logging for debugging
|
|
131
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
132
|
+
const errorResponse = e === null || e === void 0 ? void 0 : e.response;
|
|
133
|
+
console.error('[ProcessorApiService] addToRemoteCache failed:', {
|
|
134
|
+
key: ((_a = payload.key) === null || _a === void 0 ? void 0 : _a.substring(0, 50)) + '...',
|
|
135
|
+
cache_tag: payload.cache_tag,
|
|
136
|
+
product_tag: payload.product_tag,
|
|
137
|
+
error: errorMessage,
|
|
138
|
+
status: errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.status,
|
|
139
|
+
statusText: errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.statusText,
|
|
140
|
+
data: errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.data,
|
|
141
|
+
});
|
|
113
142
|
throw e;
|
|
114
143
|
}
|
|
115
144
|
}
|
|
116
145
|
async createSessionInfo(payload, auth) {
|
|
117
146
|
try {
|
|
118
|
-
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
119
|
-
|
|
147
|
+
const { token, access_key } = auth, userAuthData = __rest(auth, ["token", "access_key"]);
|
|
148
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
149
|
+
if (access_key)
|
|
150
|
+
config.headers['x-access-key'] = access_key;
|
|
151
|
+
await (0, products_client_1.productsClient)(this.environment).post(urls_1.SESSION_SAVE, Object.assign(Object.assign({}, userAuthData), { payload }), config);
|
|
120
152
|
}
|
|
121
153
|
catch (e) {
|
|
122
154
|
throw e;
|
|
@@ -124,8 +156,11 @@ class ProcessorApiService {
|
|
|
124
156
|
}
|
|
125
157
|
async revokeSession(payload, auth) {
|
|
126
158
|
try {
|
|
127
|
-
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
128
|
-
|
|
159
|
+
const { token, access_key } = auth, userAuthData = __rest(auth, ["token", "access_key"]);
|
|
160
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
161
|
+
if (access_key)
|
|
162
|
+
config.headers['x-access-key'] = access_key;
|
|
163
|
+
await (0, products_client_1.productsClient)(this.environment).post(urls_1.SESSION_REVOKE, Object.assign(Object.assign({}, userAuthData), payload), config);
|
|
129
164
|
}
|
|
130
165
|
catch (e) {
|
|
131
166
|
throw e;
|
|
@@ -144,14 +179,32 @@ class ProcessorApiService {
|
|
|
144
179
|
}
|
|
145
180
|
async validateRefreshToken(payload, auth) {
|
|
146
181
|
try {
|
|
147
|
-
const { token } = auth
|
|
148
|
-
const
|
|
182
|
+
const { token, access_key } = auth;
|
|
183
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
184
|
+
if (access_key)
|
|
185
|
+
config.headers['x-access-key'] = access_key;
|
|
186
|
+
const encodedRefreshToken = encodeURIComponent(payload.refreshToken);
|
|
187
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${urls_1.VALIDATE_REFRESH_TOKEN}?user_id=${auth.user_id}&public_key=${auth.public_key}&workspace_id=${auth.workspace_id}&refreshToken=${encodedRefreshToken}&product=${payload.product}&env=${payload.env}`, config);
|
|
149
188
|
return res.data.data;
|
|
150
189
|
}
|
|
151
190
|
catch (e) {
|
|
191
|
+
console.log('Error validating refresh token:', e);
|
|
152
192
|
return false;
|
|
153
193
|
}
|
|
154
194
|
}
|
|
195
|
+
async checkSessionRevoked(payload, auth) {
|
|
196
|
+
try {
|
|
197
|
+
const { token } = auth;
|
|
198
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id, product: payload.product, env: payload.env }, (payload.sessionId && { sessionId: payload.sessionId })), (payload.identifier && { identifier: payload.identifier })));
|
|
199
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${urls_1.SESSION_CHECK_REVOKED}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
200
|
+
return res.data.data;
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
// If check fails, default to not revoked to avoid blocking valid sessions
|
|
204
|
+
console.log('Error checking session revocation:', e);
|
|
205
|
+
return { revoked: false };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
155
208
|
// ============================================================================
|
|
156
209
|
// BROKER EVENT METHODS
|
|
157
210
|
// ============================================================================
|
|
@@ -185,9 +238,12 @@ class ProcessorApiService {
|
|
|
185
238
|
}
|
|
186
239
|
async replayBrokerEvent(payload, auth) {
|
|
187
240
|
try {
|
|
188
|
-
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
241
|
+
const { token, access_key } = auth, userAuthData = __rest(auth, ["token", "access_key"]);
|
|
189
242
|
const url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_EVENT_REPLAY, ':event_id', payload.eventId);
|
|
190
|
-
const
|
|
243
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
244
|
+
if (access_key)
|
|
245
|
+
config.headers['x-access-key'] = access_key;
|
|
246
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(url, Object.assign(Object.assign({}, userAuthData), { product: payload.product, env: payload.env, force: payload.force }), config);
|
|
191
247
|
return res.data.data;
|
|
192
248
|
}
|
|
193
249
|
catch (e) {
|
|
@@ -224,8 +280,11 @@ class ProcessorApiService {
|
|
|
224
280
|
}
|
|
225
281
|
async reprocessDLQ(payload, auth) {
|
|
226
282
|
try {
|
|
227
|
-
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
228
|
-
const
|
|
283
|
+
const { token, access_key } = auth, userAuthData = __rest(auth, ["token", "access_key"]);
|
|
284
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
285
|
+
if (access_key)
|
|
286
|
+
config.headers['x-access-key'] = access_key;
|
|
287
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(urls_1.BROKER_DLQ_REPROCESS, Object.assign(Object.assign({}, userAuthData), payload), config);
|
|
229
288
|
return res.data.data;
|
|
230
289
|
}
|
|
231
290
|
catch (e) {
|
|
@@ -261,6 +320,7 @@ class ProcessorApiService {
|
|
|
261
320
|
return res.data.data;
|
|
262
321
|
}
|
|
263
322
|
catch (e) {
|
|
323
|
+
console.error('[fetchSessionUsers] Error fetching users:', e);
|
|
264
324
|
return { users: [], total: 0, page: payload.page || 1, limit: payload.limit || 20, totalPages: 0 };
|
|
265
325
|
}
|
|
266
326
|
}
|
|
@@ -296,13 +356,42 @@ class ProcessorApiService {
|
|
|
296
356
|
return res.data.data;
|
|
297
357
|
}
|
|
298
358
|
catch (e) {
|
|
359
|
+
console.error('[fetchSessionUsersDashboard] Error fetching dashboard:', e);
|
|
299
360
|
return {
|
|
300
361
|
totalUsers: 0,
|
|
301
362
|
activeUsers: 0,
|
|
363
|
+
inactiveUsers: 0,
|
|
364
|
+
expiredUsers: 0,
|
|
302
365
|
newUsersToday: 0,
|
|
303
366
|
newUsersThisWeek: 0,
|
|
304
367
|
totalSessions: 0,
|
|
305
368
|
activeSessions: 0,
|
|
369
|
+
averageSessionsPerUser: 0,
|
|
370
|
+
dau: { current: 0, previous: 0, change: 0 },
|
|
371
|
+
wau: { current: 0, previous: 0, change: 0 },
|
|
372
|
+
mau: { current: 0, previous: 0, change: 0 },
|
|
373
|
+
activityTimeline: [],
|
|
374
|
+
peakHours: [],
|
|
375
|
+
environmentBreakdown: [],
|
|
376
|
+
avgSessionDuration: { current: '0s', previous: '0s', change: 0 },
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
async fetchUserDashboard(payload, auth) {
|
|
381
|
+
try {
|
|
382
|
+
const { token } = auth;
|
|
383
|
+
const url = (0, strings_utils_1.Parameterize)(urls_1.SESSION_USER_DASHBOARD, ':identifier', encodeURIComponent(payload.identifier));
|
|
384
|
+
const queryParams = new URLSearchParams(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id, product_tag: payload.product_tag, session_tag: payload.session_tag }, (payload.env && { env: payload.env })));
|
|
385
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
386
|
+
return res.data.data;
|
|
387
|
+
}
|
|
388
|
+
catch (e) {
|
|
389
|
+
console.error('[fetchUserDashboard] Error fetching user dashboard:', e);
|
|
390
|
+
return {
|
|
391
|
+
totalLogs: 0,
|
|
392
|
+
successRate: 0,
|
|
393
|
+
activityTimeline: [],
|
|
394
|
+
peakHours: [],
|
|
306
395
|
};
|
|
307
396
|
}
|
|
308
397
|
}
|
|
@@ -332,7 +421,7 @@ class ProcessorApiService {
|
|
|
332
421
|
async fetchCacheValues(payload, auth) {
|
|
333
422
|
try {
|
|
334
423
|
const { token } = auth;
|
|
335
|
-
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id, product_tag: payload.product_tag, cache_tag: payload.cache_tag }, (payload.env && { env: payload.env })), (payload.page && { page: String(payload.page) })), (payload.limit && { limit: String(payload.limit) })));
|
|
424
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id, product_tag: payload.product_tag, cache_tag: payload.cache_tag }, (payload.env && { env: payload.env })), (payload.page && { page: String(payload.page) })), (payload.limit && { limit: String(payload.limit) })), (payload.expiryFilter && { expiryFilter: payload.expiryFilter })));
|
|
336
425
|
const res = await (0, products_client_1.productsClient)(this.environment).get(`${urls_1.CACHE_VALUES}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
337
426
|
return res.data.data;
|
|
338
427
|
}
|
|
@@ -383,6 +472,308 @@ class ProcessorApiService {
|
|
|
383
472
|
return { deleted: 0 };
|
|
384
473
|
}
|
|
385
474
|
}
|
|
475
|
+
// ============================================================================
|
|
476
|
+
// NOTIFICATION MESSAGE LOG (fire-and-forget from processor)
|
|
477
|
+
// ============================================================================
|
|
478
|
+
async logNotificationMessage(payload, auth) {
|
|
479
|
+
const { token, access_key, user_id } = auth;
|
|
480
|
+
const body = Object.assign(Object.assign({}, payload), { user_id });
|
|
481
|
+
console.log('[logNotificationMessage] POST', {
|
|
482
|
+
url: urls_1.NOTIFICATION_MESSAGE_LOG,
|
|
483
|
+
workspace_id: payload.workspace_id,
|
|
484
|
+
product_tag: payload.product_tag,
|
|
485
|
+
notification_tag: payload.notification_tag,
|
|
486
|
+
type: payload.type,
|
|
487
|
+
status: payload.status,
|
|
488
|
+
process_id: payload.process_id,
|
|
489
|
+
hasAccessKey: !!access_key,
|
|
490
|
+
hasUserId: !!user_id,
|
|
491
|
+
});
|
|
492
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
493
|
+
if (access_key)
|
|
494
|
+
config.headers['x-access-key'] = access_key;
|
|
495
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(urls_1.NOTIFICATION_MESSAGE_LOG, body, config);
|
|
496
|
+
console.log('[logNotificationMessage] response', { status: res === null || res === void 0 ? void 0 : res.status, data: res === null || res === void 0 ? void 0 : res.data });
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Create job execution record (fire-and-forget from processor). Does not throw; errors are logged.
|
|
500
|
+
*/
|
|
501
|
+
async createJobExecution(payload, auth) {
|
|
502
|
+
const { access_key, user_id } = auth;
|
|
503
|
+
const body = Object.assign(Object.assign({}, payload), { scheduled_at: payload.scheduled_at != null ? (typeof payload.scheduled_at === 'number' ? new Date(payload.scheduled_at) : payload.scheduled_at) : undefined, started_at: payload.started_at != null ? (typeof payload.started_at === 'number' ? new Date(payload.started_at) : payload.started_at) : undefined, user_id });
|
|
504
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(auth.token, types_1.DataFormats.JSON);
|
|
505
|
+
if (access_key)
|
|
506
|
+
config.headers['x-access-key'] = access_key;
|
|
507
|
+
await (0, products_client_1.productsClient)(this.environment).post(urls_1.JOB_EXECUTION_CREATE, body, config);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Update job execution phase (fire-and-forget from processor). Does not throw; errors are logged.
|
|
511
|
+
*/
|
|
512
|
+
async updateJobExecutionPhase(payload, auth) {
|
|
513
|
+
var _a;
|
|
514
|
+
const { access_key, user_id } = auth;
|
|
515
|
+
const body = Object.assign(Object.assign({}, payload), { started_at: payload.started_at != null ? (typeof payload.started_at === 'number' ? new Date(payload.started_at) : payload.started_at) : undefined, completed_at: payload.completed_at != null ? (typeof payload.completed_at === 'number' ? new Date(payload.completed_at) : payload.completed_at) : undefined, user_id });
|
|
516
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(auth.token, types_1.DataFormats.JSON);
|
|
517
|
+
if (access_key)
|
|
518
|
+
config.headers['x-access-key'] = access_key;
|
|
519
|
+
try {
|
|
520
|
+
await (0, products_client_1.productsClient)(this.environment).patch(urls_1.JOB_EXECUTION_PHASE, body, config);
|
|
521
|
+
}
|
|
522
|
+
catch (err) {
|
|
523
|
+
const status = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.status;
|
|
524
|
+
if (status === 404) {
|
|
525
|
+
console.warn('[updateJobExecutionPhase] API returned 404 — endpoint /integrations/v1/job-executions/phase may not be deployed', { job_id: payload.job_id, phase: payload.phase });
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
throw err;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
async queryNotificationMessageLogs(payload, auth) {
|
|
532
|
+
var _a, _b;
|
|
533
|
+
try {
|
|
534
|
+
const { token } = auth;
|
|
535
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: payload.workspace_id || auth.workspace_id }, (payload.product_tag && { product_tag: payload.product_tag })), (payload.product_id && { product_id: payload.product_id })), (payload.env && { env: payload.env })), (payload.notification_tag && { notification_tag: payload.notification_tag })), (payload.status && { status: payload.status })), (payload.type && { type: payload.type })), (payload.process_id && { process_id: payload.process_id })), (payload.start_date && { start_date: payload.start_date })), (payload.end_date && { end_date: payload.end_date })), (payload.page != null && { page: String(payload.page) })), (payload.limit != null && { limit: String(payload.limit) })));
|
|
536
|
+
const url = `${urls_1.NOTIFICATION_MESSAGE_LOG}?${queryParams.toString()}`;
|
|
537
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(url, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
538
|
+
return res.data.data;
|
|
539
|
+
}
|
|
540
|
+
catch (e) {
|
|
541
|
+
return { items: [], total: 0, page: (_a = payload.page) !== null && _a !== void 0 ? _a : 1, limit: (_b = payload.limit) !== null && _b !== void 0 ? _b : 20, hasMore: false };
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
// ============================================================================
|
|
545
|
+
// BROKER MESSAGE TRACKING METHODS
|
|
546
|
+
// ============================================================================
|
|
547
|
+
async trackBrokerMessage(payload, auth) {
|
|
548
|
+
try {
|
|
549
|
+
const { token, access_key, user_id } = auth;
|
|
550
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
551
|
+
if (access_key)
|
|
552
|
+
config.headers['x-access-key'] = access_key;
|
|
553
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(urls_1.BROKER_MESSAGE_TRACK, Object.assign(Object.assign({}, payload), { user_id }), config);
|
|
554
|
+
return res.data.data;
|
|
555
|
+
}
|
|
556
|
+
catch (e) {
|
|
557
|
+
console.log(e);
|
|
558
|
+
throw e;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async trackBrokerMessageIdempotent(payload, auth) {
|
|
562
|
+
try {
|
|
563
|
+
const { token, access_key, user_id } = auth;
|
|
564
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
565
|
+
if (access_key)
|
|
566
|
+
config.headers['x-access-key'] = access_key;
|
|
567
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(urls_1.BROKER_MESSAGE_TRACK_IDEMPOTENT, Object.assign(Object.assign({}, payload), { user_id }), config);
|
|
568
|
+
return res.data.data;
|
|
569
|
+
}
|
|
570
|
+
catch (e) {
|
|
571
|
+
throw e;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
async registerBrokerConsumer(payload, auth) {
|
|
575
|
+
try {
|
|
576
|
+
const { token, access_key, user_id, workspace_id } = auth;
|
|
577
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
578
|
+
if (access_key)
|
|
579
|
+
config.headers['x-access-key'] = access_key;
|
|
580
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(urls_1.BROKER_MESSAGE_REGISTER_CONSUMER, Object.assign(Object.assign({}, payload), { user_id, workspace_id }), config);
|
|
581
|
+
return res.data.data;
|
|
582
|
+
}
|
|
583
|
+
catch (e) {
|
|
584
|
+
throw e;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
async updateBrokerConsumerStatus(payload, auth) {
|
|
588
|
+
try {
|
|
589
|
+
const { token, access_key, user_id, workspace_id } = auth;
|
|
590
|
+
const config = (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON);
|
|
591
|
+
if (access_key)
|
|
592
|
+
config.headers['x-access-key'] = access_key;
|
|
593
|
+
const res = await (0, products_client_1.productsClient)(this.environment).put(urls_1.BROKER_MESSAGE_UPDATE_CONSUMER, Object.assign(Object.assign({}, payload), { user_id, workspace_id }), config);
|
|
594
|
+
return res.data.data;
|
|
595
|
+
}
|
|
596
|
+
catch (e) {
|
|
597
|
+
throw e;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
async getBrokerMessageStats(payload, auth) {
|
|
601
|
+
try {
|
|
602
|
+
const { token } = auth;
|
|
603
|
+
let url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_STATS, ':product_tag', payload.product_tag);
|
|
604
|
+
url = (0, strings_utils_1.Parameterize)(url, ':env', payload.env);
|
|
605
|
+
url = (0, strings_utils_1.Parameterize)(url, ':broker_tag', payload.broker_tag);
|
|
606
|
+
const queryParams = new URLSearchParams({
|
|
607
|
+
user_id: auth.user_id,
|
|
608
|
+
public_key: auth.public_key,
|
|
609
|
+
workspace_id: auth.workspace_id,
|
|
610
|
+
});
|
|
611
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
612
|
+
return res.data.data;
|
|
613
|
+
}
|
|
614
|
+
catch (e) {
|
|
615
|
+
throw e;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
async retryBrokerMessage(payload, auth) {
|
|
619
|
+
try {
|
|
620
|
+
const { token } = auth;
|
|
621
|
+
const url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_RETRY, ':message_id', payload.message_id);
|
|
622
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(url, { consumer_tag: payload.consumer_tag }, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
623
|
+
return res.data.data;
|
|
624
|
+
}
|
|
625
|
+
catch (e) {
|
|
626
|
+
throw e;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
async failBrokerMessage(payload, auth) {
|
|
630
|
+
try {
|
|
631
|
+
const { token } = auth;
|
|
632
|
+
const url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_FAIL, ':message_id', payload.message_id);
|
|
633
|
+
const res = await (0, products_client_1.productsClient)(this.environment).post(url, { error: payload.error }, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
634
|
+
return res.data.data;
|
|
635
|
+
}
|
|
636
|
+
catch (e) {
|
|
637
|
+
throw e;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
// ============================================================================
|
|
641
|
+
// BROKER MESSAGE QUERY METHODS (for workbench)
|
|
642
|
+
// ============================================================================
|
|
643
|
+
async queryBrokerMessages(payload, auth) {
|
|
644
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
645
|
+
const LOG_PREFIX = '[ProcessorApiService.queryBrokerMessages]';
|
|
646
|
+
const startTime = Date.now();
|
|
647
|
+
console.log(`${LOG_PREFIX} Starting request...`);
|
|
648
|
+
console.log(`${LOG_PREFIX} Payload: product_tag=${payload.product_tag}, env=${payload.env}, broker_tag=${payload.broker_tag}, page=${payload.page}, limit=${payload.limit}`);
|
|
649
|
+
try {
|
|
650
|
+
const { token } = auth;
|
|
651
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id, product_tag: payload.product_tag, env: payload.env, broker_tag: payload.broker_tag }, (payload.topic_tag && { topic_tag: payload.topic_tag })), (payload.producer_tag && { producer_tag: payload.producer_tag })), (payload.consumer_tag && { consumer_tag: payload.consumer_tag })), (payload.status && { status: payload.status })), (payload.start_date && { start_date: payload.start_date })), (payload.end_date && { end_date: payload.end_date })), (payload.page && { page: String(payload.page) })), (payload.limit && { limit: String(payload.limit) })));
|
|
652
|
+
const url = `${urls_1.BROKER_MESSAGE_QUERY}?${queryParams.toString()}`;
|
|
653
|
+
console.log(`${LOG_PREFIX} Making HTTP GET request to: ${url}`);
|
|
654
|
+
const httpStart = Date.now();
|
|
655
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(url, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
656
|
+
console.log(`${LOG_PREFIX} HTTP request completed in ${Date.now() - httpStart}ms`);
|
|
657
|
+
console.log(`${LOG_PREFIX} Response status: ${res.status}, data.status: ${(_a = res.data) === null || _a === void 0 ? void 0 : _a.status}`);
|
|
658
|
+
console.log(`${LOG_PREFIX} Response data: total=${(_c = (_b = res.data) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.total}, messagesCount=${((_f = (_e = (_d = res.data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.messages) === null || _f === void 0 ? void 0 : _f.length) || 0}`);
|
|
659
|
+
const totalTime = Date.now() - startTime;
|
|
660
|
+
console.log(`${LOG_PREFIX} Total time: ${totalTime}ms`);
|
|
661
|
+
return res.data.data;
|
|
662
|
+
}
|
|
663
|
+
catch (e) {
|
|
664
|
+
const totalTime = Date.now() - startTime;
|
|
665
|
+
console.error(`${LOG_PREFIX} FAILED after ${totalTime}ms:`, (e === null || e === void 0 ? void 0 : e.message) || e);
|
|
666
|
+
console.error(`${LOG_PREFIX} Error details:`, ((_g = e === null || e === void 0 ? void 0 : e.response) === null || _g === void 0 ? void 0 : _g.data) || 'No response data');
|
|
667
|
+
return { messages: [], total: 0, page: payload.page || 1, limit: payload.limit || 20, hasMore: false };
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
async getBrokerProducers(payload, auth) {
|
|
671
|
+
try {
|
|
672
|
+
const { token } = auth;
|
|
673
|
+
let url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_PRODUCERS, ':product_tag', payload.product_tag);
|
|
674
|
+
url = (0, strings_utils_1.Parameterize)(url, ':env', payload.env);
|
|
675
|
+
url = (0, strings_utils_1.Parameterize)(url, ':broker_tag', payload.broker_tag);
|
|
676
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id }, (payload.topic_tag && { topic_tag: payload.topic_tag })), (payload.page && { page: String(payload.page) })), (payload.limit && { limit: String(payload.limit) })));
|
|
677
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
678
|
+
return res.data.data;
|
|
679
|
+
}
|
|
680
|
+
catch (e) {
|
|
681
|
+
return { producers: [], total: 0, page: payload.page || 1, limit: payload.limit || 20, hasMore: false };
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
async getBrokerConsumers(payload, auth) {
|
|
685
|
+
try {
|
|
686
|
+
const { token } = auth;
|
|
687
|
+
let url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_CONSUMERS, ':product_tag', payload.product_tag);
|
|
688
|
+
url = (0, strings_utils_1.Parameterize)(url, ':env', payload.env);
|
|
689
|
+
url = (0, strings_utils_1.Parameterize)(url, ':broker_tag', payload.broker_tag);
|
|
690
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id }, (payload.topic_tag && { topic_tag: payload.topic_tag })), (payload.page && { page: String(payload.page) })), (payload.limit && { limit: String(payload.limit) })));
|
|
691
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
692
|
+
return res.data.data;
|
|
693
|
+
}
|
|
694
|
+
catch (e) {
|
|
695
|
+
return { consumers: [], total: 0, page: payload.page || 1, limit: payload.limit || 20, hasMore: false };
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
async getBrokerDeadLetters(payload, auth) {
|
|
699
|
+
try {
|
|
700
|
+
const { token } = auth;
|
|
701
|
+
let url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_DEAD_LETTERS, ':product_tag', payload.product_tag);
|
|
702
|
+
url = (0, strings_utils_1.Parameterize)(url, ':env', payload.env);
|
|
703
|
+
url = (0, strings_utils_1.Parameterize)(url, ':broker_tag', payload.broker_tag);
|
|
704
|
+
const queryParams = new URLSearchParams(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ user_id: auth.user_id, public_key: auth.public_key, workspace_id: auth.workspace_id }, (payload.topic_tag && { topic_tag: payload.topic_tag })), (payload.consumer_tag && { consumer_tag: payload.consumer_tag })), (payload.start_date && { start_date: payload.start_date })), (payload.end_date && { end_date: payload.end_date })), (payload.page && { page: String(payload.page) })), (payload.limit && { limit: String(payload.limit) })));
|
|
705
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
706
|
+
return res.data.data;
|
|
707
|
+
}
|
|
708
|
+
catch (e) {
|
|
709
|
+
return { deadLetters: [], total: 0, page: payload.page || 1, limit: payload.limit || 20, hasMore: false };
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
async getBrokerComprehensiveStats(payload, auth) {
|
|
713
|
+
try {
|
|
714
|
+
const { token } = auth;
|
|
715
|
+
let url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_COMPREHENSIVE_STATS, ':product_tag', payload.product_tag);
|
|
716
|
+
url = (0, strings_utils_1.Parameterize)(url, ':env', payload.env);
|
|
717
|
+
url = (0, strings_utils_1.Parameterize)(url, ':broker_tag', payload.broker_tag);
|
|
718
|
+
const queryParams = new URLSearchParams({
|
|
719
|
+
user_id: auth.user_id,
|
|
720
|
+
public_key: auth.public_key,
|
|
721
|
+
workspace_id: auth.workspace_id,
|
|
722
|
+
});
|
|
723
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
724
|
+
return res.data.data;
|
|
725
|
+
}
|
|
726
|
+
catch (e) {
|
|
727
|
+
return {
|
|
728
|
+
total: 0,
|
|
729
|
+
pending: 0,
|
|
730
|
+
success: 0,
|
|
731
|
+
failed: 0,
|
|
732
|
+
partial: 0,
|
|
733
|
+
producer_count: 0,
|
|
734
|
+
consumer_count: 0,
|
|
735
|
+
dead_letter_count: 0,
|
|
736
|
+
messages_by_topic: {},
|
|
737
|
+
messages_by_producer: {},
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
async getBrokerDashboard(payload, auth) {
|
|
742
|
+
try {
|
|
743
|
+
const { token } = auth;
|
|
744
|
+
let url = (0, strings_utils_1.Parameterize)(urls_1.BROKER_MESSAGE_DASHBOARD, ':product_tag', payload.product_tag);
|
|
745
|
+
url = (0, strings_utils_1.Parameterize)(url, ':env', payload.env);
|
|
746
|
+
url = (0, strings_utils_1.Parameterize)(url, ':broker_tag', payload.broker_tag);
|
|
747
|
+
const queryParams = new URLSearchParams({
|
|
748
|
+
user_id: auth.user_id,
|
|
749
|
+
public_key: auth.public_key,
|
|
750
|
+
workspace_id: auth.workspace_id,
|
|
751
|
+
});
|
|
752
|
+
const res = await (0, products_client_1.productsClient)(this.environment).get(`${url}?${queryParams.toString()}`, (0, auth_utils_1.generateAxiosConfig)(token, types_1.DataFormats.JSON));
|
|
753
|
+
return res.data.data;
|
|
754
|
+
}
|
|
755
|
+
catch (e) {
|
|
756
|
+
return {
|
|
757
|
+
stats: {
|
|
758
|
+
total: 0,
|
|
759
|
+
pending: 0,
|
|
760
|
+
success: 0,
|
|
761
|
+
failed: 0,
|
|
762
|
+
partial: 0,
|
|
763
|
+
producer_count: 0,
|
|
764
|
+
consumer_count: 0,
|
|
765
|
+
dead_letter_count: 0,
|
|
766
|
+
messages_by_topic: {},
|
|
767
|
+
messages_by_producer: {},
|
|
768
|
+
},
|
|
769
|
+
recent_messages: [],
|
|
770
|
+
top_producers: [],
|
|
771
|
+
top_consumers: [],
|
|
772
|
+
daily_activity: [],
|
|
773
|
+
hourly_distribution: [],
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
}
|
|
386
777
|
}
|
|
387
778
|
exports.ProcessorApiService = ProcessorApiService;
|
|
388
779
|
//# sourceMappingURL=processorApi.service.js.map
|