@mhubcloud/tms_core 3.1.3-beta.0 → 3.1.3-beta.1

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/index.js CHANGED
@@ -271,9 +271,7 @@ async function defaultPublisher(azureFunctionContext, serviceBusMessage, source,
271
271
  azureFunctionContext.log,
272
272
  new Error(result.reason)
273
273
  );
274
- throw new Error(
275
- typeof result.reason === "object" ? JSON.stringify(result.reason) : result.reason
276
- );
274
+ throw new Error(result.reason);
277
275
  }
278
276
  }
279
277
  }
@@ -557,6 +555,36 @@ var piano = {
557
555
  }
558
556
  };
559
557
 
558
+ // src/publishers/tablestorage.ts
559
+ var tableStorage = {
560
+ source: "f_TableStorage",
561
+ async publish(log3, config, data, event) {
562
+ if (config.SASToken && config.tableName) {
563
+ data = removeUndefined(data);
564
+ const requestOptions = {
565
+ method: "POST",
566
+ headers: {
567
+ // eslint-disable-next-line @typescript-eslint/naming-convention
568
+ "User-Agent": "mHub Cloud"
569
+ },
570
+ body: JSON.stringify(data)
571
+ };
572
+ const baseUrl = `https://${config.account}.table.core.windows.net/${config.tableName}`;
573
+ const query = config.SASToken;
574
+ await handlePlatformRequest({
575
+ source: this.source,
576
+ baseUrl,
577
+ requestOptions,
578
+ query,
579
+ event,
580
+ logger: log3
581
+ });
582
+ } else {
583
+ throw new Error("Invalid config for platform " + this.source);
584
+ }
585
+ }
586
+ };
587
+
560
588
  // src/publishers/universalAnalytics.ts
561
589
  var universalAnalytics = {
562
590
  source: "UniversalAnalytics",
@@ -635,7 +663,9 @@ var publisher = {
635
663
  // eslint-disable-next-line @typescript-eslint/naming-convention
636
664
  Piano: piano,
637
665
  // eslint-disable-next-line @typescript-eslint/naming-convention
638
- AffiliatePort: affiliatePort
666
+ AffiliatePort: affiliatePort,
667
+ // eslint-disable-next-line @typescript-eslint/naming-convention
668
+ TableStorage: tableStorage
639
669
  };
640
670
  // Annotate the CommonJS export names for ESM import in node:
641
671
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhubcloud/tms_core",
3
- "version": "3.1.3-beta.0",
3
+ "version": "3.1.3-beta.1",
4
4
  "description": "Core function for mHub Cloud TMS publishers",
5
5
  "homepage": "https://mhubcloud.com/",
6
6
  "license": "Apache 2.0",
@@ -97,7 +97,7 @@ async function processMessage(
97
97
  eventPublisher.config,
98
98
  platformPublisher,
99
99
  {
100
- message: `mhub/platformSent`,
100
+ message: `Event dispatched to platform`,
101
101
  severity: 1,
102
102
  properties: {
103
103
  publisher: platformPublisher.source