@ductape/sdk 0.1.92 → 0.1.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/brokers/brokers.service.d.ts +1 -0
  2. package/dist/brokers/brokers.service.js +16 -2
  3. package/dist/brokers/brokers.service.js.map +1 -1
  4. package/dist/brokers/types/index.d.ts +6 -2
  5. package/dist/brokers/utils/providers/azure-servicebus.service.d.ts +6 -3
  6. package/dist/brokers/utils/providers/azure-servicebus.service.js +25 -4
  7. package/dist/brokers/utils/providers/azure-servicebus.service.js.map +1 -1
  8. package/dist/brokers/utils/providers/google-pubsub.service.d.ts +3 -3
  9. package/dist/brokers/utils/providers/google-pubsub.service.js +22 -9
  10. package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -1
  11. package/dist/brokers/utils/providers/kafka.service.d.ts +3 -3
  12. package/dist/brokers/utils/providers/kafka.service.js +14 -3
  13. package/dist/brokers/utils/providers/kafka.service.js.map +1 -1
  14. package/dist/brokers/utils/providers/nats.service.d.ts +3 -3
  15. package/dist/brokers/utils/providers/nats.service.js +4 -4
  16. package/dist/brokers/utils/providers/nats.service.js.map +1 -1
  17. package/dist/brokers/utils/providers/rabbitmq.service.d.ts +4 -3
  18. package/dist/brokers/utils/providers/rabbitmq.service.js +14 -8
  19. package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -1
  20. package/dist/brokers/utils/providers/redis.service.d.ts +3 -3
  21. package/dist/brokers/utils/providers/redis.service.js +4 -4
  22. package/dist/brokers/utils/providers/redis.service.js.map +1 -1
  23. package/dist/cloud/types/cloud.types.d.ts +2 -2
  24. package/dist/index.d.ts +16 -0
  25. package/dist/index.js +18 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/notifications/index.d.ts +1 -1
  28. package/dist/notifications/index.js.map +1 -1
  29. package/dist/notifications/types/notifications.types.d.ts +38 -0
  30. package/dist/processor/services/processor.service.js +12 -2
  31. package/dist/processor/services/processor.service.js.map +1 -1
  32. package/dist/products/validators/joi-validators/create.productNotification.validator.js +8 -2
  33. package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/dist/types/processor.types.d.ts +2 -0
  36. package/dist/types/processor.types.js.map +1 -1
  37. package/package.json +1 -1
@@ -65,6 +65,10 @@ export interface IPushNotificationHandler {
65
65
  type: PushNotificationProvider;
66
66
  credentials?: IFirebaseCredential | object;
67
67
  databaseUrl?: string;
68
+ /** GCP cloud connection tag. For Firebase, credentials are issued at runtime. */
69
+ cloud?: string;
70
+ /** Must be cloud_connection when cloud is supplied. */
71
+ authMode?: 'cloud_connection';
68
72
  }
69
73
  /**
70
74
  * Push notification input payload
@@ -401,11 +405,45 @@ export interface INotificationOptions {
401
405
  sms?: ISmsInput;
402
406
  /** Callback payload (optional) */
403
407
  callback?: ICallbackInput;
408
+ /** Slack webhook payload */
409
+ slack?: {
410
+ text?: string;
411
+ blocks?: Record<string, unknown>[];
412
+ channel?: string;
413
+ };
414
+ /** Discord webhook payload */
415
+ discord?: {
416
+ content?: string;
417
+ embeds?: Record<string, unknown>[];
418
+ };
404
419
  /** Session token in format: session_tag:jwt_token */
405
420
  session?: string;
406
421
  /** Cache tag for response caching */
407
422
  cache?: string;
408
423
  }
424
+ export interface ISlackOptions {
425
+ product: string;
426
+ env: string;
427
+ notification: string;
428
+ input: {
429
+ text?: string;
430
+ blocks?: Record<string, unknown>[];
431
+ channel?: string;
432
+ };
433
+ session?: string;
434
+ cache?: string;
435
+ }
436
+ export interface IDiscordOptions {
437
+ product: string;
438
+ env: string;
439
+ notification: string;
440
+ input: {
441
+ content?: string;
442
+ embeds?: Record<string, unknown>[];
443
+ };
444
+ session?: string;
445
+ cache?: string;
446
+ }
409
447
  /**
410
448
  * Query options for fetching notification message logs (send history) with time filters.
411
449
  * Used by ductape.notifications.getMessages().
@@ -51,6 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  const products_service_1 = __importDefault(require("../../products/services/products.service"));
52
52
  const types_1 = require("../../types");
53
53
  const logs_service_1 = __importDefault(require("../../logs/logs.service"));
54
+ const cloud_runtime_util_1 = require("../../cloud/cloud-runtime.util");
54
55
  const inputs_service_1 = __importDefault(require("../../inputs/inputs.service"));
55
56
  const processor_utils_1 = require("../utils/processor.utils");
56
57
  const axios_1 = __importDefault(require("axios"));
@@ -3792,6 +3793,15 @@ class ProcessorService {
3792
3793
  throw new Error(`Notification env config for ${notification.env.slug} not found`);
3793
3794
  }
3794
3795
  let { push_notifications: notifications, emails, callbacks, sms: smses, slack: slackConfig, discord: discordConfig } = envConfig;
3796
+ if ((notifications === null || notifications === void 0 ? void 0 : notifications.type) === types_1.Notifiers.FIREBASE && (notifications === null || notifications === void 0 ? void 0 : notifications.cloud)) {
3797
+ notifications = await (0, cloud_runtime_util_1.resolveCloudLinkedConfig)(notifications, {
3798
+ environment: this.environment,
3799
+ auth: Object.assign(Object.assign({}, this.getUserAccess()), { access_key: this.accessKey }),
3800
+ productTag: this.productTag,
3801
+ componentTag: event.split(':')[0],
3802
+ envSlug: notification.env.slug,
3803
+ });
3804
+ }
3795
3805
  debugLog('[runNotification] Env config channels', {
3796
3806
  hasPush: !!notifications,
3797
3807
  pushType: notifications === null || notifications === void 0 ? void 0 : notifications.type,
@@ -4376,7 +4386,7 @@ class ProcessorService {
4376
4386
  const createBrokerService = await loadBrokerService();
4377
4387
  if (createBrokerService) {
4378
4388
  const brokerService = createBrokerService(brokerEnv.type, brokerConfig);
4379
- await brokerService.subscribe(url, input.callback);
4389
+ await brokerService.subscribe(url, input.callback, { logicalTopic: topicTag });
4380
4390
  this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { successful_execution: true, message: 'Subscribe to broker topic - success', data: { event }, status: types_1.LogEventStatus.SUCCESS }));
4381
4391
  return;
4382
4392
  }
@@ -4448,7 +4458,7 @@ class ProcessorService {
4448
4458
  brokerConfig = resolved.value;
4449
4459
  }
4450
4460
  const brokerService = await this.getBrokerServiceForPublish(brokerEnv.type, brokerConfig);
4451
- await brokerService.publish(url, input.message);
4461
+ await brokerService.publish(url, input.message, { logicalTopic: topicTag });
4452
4462
  /*this.logService.add({
4453
4463
  ...this.baseLogs,
4454
4464
  ...additional_logs,