mblabs-roccato-backend-commons 1.0.61 → 1.0.63

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.
@@ -36,7 +36,7 @@ export declare namespace AmazonCloudwatch {
36
36
  value: string;
37
37
  }[];
38
38
  value: number;
39
- unit: 'Time' | 'Count' | 'Percent' | 'Bytes' | 'None';
39
+ unit: 'time' | 'count' | 'percent' | 'bytes' | 'none';
40
40
  };
41
41
  };
42
42
  credentials: Credentials;
@@ -59,11 +59,11 @@ export declare namespace GoogleMonitor {
59
59
  metric: {
60
60
  title: string;
61
61
  value: number;
62
- typeof: 'VALUE_TYPE_UNSPECIFIED' | 'BOOL' | 'INT64' | 'DOUBLE' | 'STRING' | 'DISTRIBUTION' | 'MONEY';
63
- measure: 'METRIC_KIND_UNSPECIFIED' | 'GAUGE' | 'DELTA' | 'CUMULATIVE';
64
- labels: {
62
+ typeof: 'boolean' | 'string' | 'int' | 'double' | 'decimal';
63
+ measure: 'gauge' | 'delta' | 'cumulative';
64
+ labels?: {
65
65
  key: string;
66
- typeof: 'STRING' | 'BOOL' | 'INT64';
66
+ typeof: 'boolean' | 'string' | 'int';
67
67
  description: string;
68
68
  }[];
69
69
  };
@@ -11,12 +11,12 @@ class AmazonCloudwatchService {
11
11
  },
12
12
  region: credentials.region,
13
13
  });
14
- const CloudwatchUnitMap = {
15
- Time: 'Milliseconds',
16
- Count: 'Count',
17
- Percent: 'Percent',
18
- Bytes: 'Bytes',
19
- None: 'None',
14
+ const UnitMap = {
15
+ time: 'Milliseconds',
16
+ count: 'Count',
17
+ percent: 'Percent',
18
+ bytes: 'Bytes',
19
+ none: 'None',
20
20
  };
21
21
  await client.putMetricData({
22
22
  Namespace: data.namespace,
@@ -28,7 +28,7 @@ class AmazonCloudwatchService {
28
28
  Value: dimension.value,
29
29
  })),
30
30
  Value: data.metric.value,
31
- Unit: CloudwatchUnitMap[data.metric.unit] || 'None',
31
+ Unit: UnitMap[data.metric.unit] || 'None',
32
32
  },
33
33
  ],
34
34
  });
@@ -7,19 +7,36 @@ class GoogleMonitorService {
7
7
  apiKey: credentials.apiKey,
8
8
  projectId: credentials.project,
9
9
  });
10
+ const MetricKindMap = {
11
+ gauge: 'GAUGE',
12
+ delta: 'DELTA',
13
+ cumulative: 'CUMULATIVE',
14
+ };
15
+ const ValueTypeMap = {
16
+ boolean: 'BOOL',
17
+ string: 'STRING',
18
+ int: 'INT64',
19
+ double: 'DOUBLE',
20
+ decimal: 'MONEY',
21
+ };
22
+ const LabelValueTypeMap = {
23
+ boolean: 'BOOL',
24
+ string: 'STRING',
25
+ int: 'INT64',
26
+ };
10
27
  await client.createMetricDescriptor({
11
28
  name: client.projectPath(credentials.project),
12
29
  metricDescriptor: {
13
30
  name: data.metric.title,
14
31
  type: data.namespace,
15
- metricKind: data.metric.measure,
16
- valueType: data.metric.typeof,
32
+ metricKind: MetricKindMap[data.metric.measure] || 'METRIC_KIND_UNSPECIFIED',
33
+ valueType: ValueTypeMap[data.metric.typeof] || 'VALUE_TYPE_UNSPECIFIED',
17
34
  unit: data.metric.value.toString(),
18
- labels: data.metric.labels.map((label) => ({
35
+ labels: data.metric.labels?.map((label) => ({
19
36
  key: label.key,
20
- valueType: label.typeof,
37
+ valueType: LabelValueTypeMap[label.typeof],
21
38
  description: label.description,
22
- })),
39
+ })) ?? [],
23
40
  },
24
41
  });
25
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mblabs-roccato-backend-commons",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,8 +52,7 @@
52
52
  "@azure/communication-sms": "^1.2.0-beta.3",
53
53
  "@azure/identity": "^4.9.1",
54
54
  "@azure/keyvault-secrets": "^4.9.0",
55
- "@azure/monitor-query": "^1.3.3",
56
- "@azure/monitor-query-metrics": "^1.0.0",
55
+ "@azure/monitor-ingestion": "^1.2.0",
57
56
  "@azure/msal-node": "^3.8.0",
58
57
  "@azure/storage-blob": "^12.27.0",
59
58
  "@google-cloud/monitoring": "^5.3.0",
@@ -40,7 +40,7 @@ export namespace AmazonCloudwatch {
40
40
  value: string
41
41
  }[];
42
42
  value: number;
43
- unit: 'Time' | 'Count' | 'Percent' | 'Bytes' | 'None';
43
+ unit: 'time' | 'count' | 'percent' | 'bytes' | 'none';
44
44
  };
45
45
  };
46
46
  credentials: Credentials;
@@ -65,11 +65,11 @@ export namespace GoogleMonitor {
65
65
  metric: {
66
66
  title: string;
67
67
  value: number;
68
- typeof: 'VALUE_TYPE_UNSPECIFIED' | 'BOOL' | 'INT64' | 'DOUBLE' | 'STRING' | 'DISTRIBUTION' | 'MONEY',
69
- measure: 'METRIC_KIND_UNSPECIFIED' | 'GAUGE' | 'DELTA' | 'CUMULATIVE',
70
- labels: {
68
+ typeof: 'boolean' | 'string' | 'int' | 'double' | 'decimal',
69
+ measure: 'gauge' | 'delta' | 'cumulative',
70
+ labels?: {
71
71
  key: string;
72
- typeof: 'STRING' | 'BOOL' | 'INT64';
72
+ typeof: 'boolean' | 'string' | 'int';
73
73
  description: string;
74
74
  }[];
75
75
  };
@@ -13,12 +13,12 @@ class AmazonCloudwatchService implements IAmazonCloudwatchService {
13
13
  region: credentials.region,
14
14
  });
15
15
 
16
- const CloudwatchUnitMap: Record<'Time' | 'Count' | 'Percent' | 'Bytes' | 'None', StandardUnit> = {
17
- Time: 'Milliseconds',
18
- Count: 'Count',
19
- Percent: 'Percent',
20
- Bytes: 'Bytes',
21
- None: 'None',
16
+ const UnitMap: Record<'time' | 'count' | 'percent' | 'bytes' | 'none', StandardUnit> = {
17
+ time: 'Milliseconds',
18
+ count: 'Count',
19
+ percent: 'Percent',
20
+ bytes: 'Bytes',
21
+ none: 'None',
22
22
  };
23
23
 
24
24
  await client.putMetricData({
@@ -31,7 +31,7 @@ class AmazonCloudwatchService implements IAmazonCloudwatchService {
31
31
  Value: dimension.value,
32
32
  })),
33
33
  Value: data.metric.value,
34
- Unit: CloudwatchUnitMap[data.metric.unit] || 'None',
34
+ Unit: UnitMap[data.metric.unit] || 'None',
35
35
  },
36
36
  ],
37
37
  });
@@ -12,19 +12,44 @@ class GoogleMonitorService implements IGoogleMonitorService {
12
12
  projectId: credentials.project,
13
13
  });
14
14
 
15
+ const MetricKindMap: Record<'gauge' | 'delta' | 'cumulative', 'GAUGE' | 'DELTA' | 'CUMULATIVE'> = {
16
+ gauge: 'GAUGE',
17
+ delta: 'DELTA',
18
+ cumulative: 'CUMULATIVE',
19
+ };
20
+
21
+ const ValueTypeMap: Record<
22
+ 'boolean' | 'string' | 'int' | 'double' | 'decimal',
23
+ 'BOOL' | 'INT64' | 'DOUBLE' | 'STRING' | 'DISTRIBUTION' | 'MONEY'
24
+ > = {
25
+ boolean: 'BOOL',
26
+ string: 'STRING',
27
+ int: 'INT64',
28
+ double: 'DOUBLE',
29
+ decimal: 'MONEY',
30
+ };
31
+
32
+ const LabelValueTypeMap: Record<'boolean' | 'string' | 'int', 'BOOL' | 'INT64' | 'STRING'> = {
33
+ boolean: 'BOOL',
34
+ string: 'STRING',
35
+ int: 'INT64',
36
+ };
37
+
15
38
  await client.createMetricDescriptor({
16
39
  name: client.projectPath(credentials.project),
17
40
  metricDescriptor: {
18
41
  name: data.metric.title,
19
42
  type: data.namespace,
20
- metricKind: data.metric.measure,
21
- valueType: data.metric.typeof,
43
+ metricKind: MetricKindMap[data.metric.measure] || 'METRIC_KIND_UNSPECIFIED',
44
+ valueType: ValueTypeMap[data.metric.typeof] || 'VALUE_TYPE_UNSPECIFIED',
22
45
  unit: data.metric.value.toString(),
23
- labels: data.metric.labels.map((label) => ({
24
- key: label.key,
25
- valueType: label.typeof,
26
- description: label.description,
27
- })),
46
+ labels: data.metric.labels?.map(
47
+ (label) => ({
48
+ key: label.key,
49
+ valueType: LabelValueTypeMap[label.typeof],
50
+ description: label.description,
51
+ })
52
+ ) ?? [],
28
53
  },
29
54
  });
30
55
  }
package/yarn.lock CHANGED
@@ -1257,7 +1257,7 @@
1257
1257
  resolved "https://registry.yarnpkg.com/@aws/lambda-invoke-store/-/lambda-invoke-store-0.0.1.tgz#92d792a7dda250dfcb902e13228f37a81be57c8f"
1258
1258
  integrity sha512-ORHRQ2tmvnBXc8t/X9Z8IcSbBA4xTLKuN873FopzklHMeqBst7YG0d+AX97inkvDX+NChYtSr+qGfcqGFaI8Zw==
1259
1259
 
1260
- "@azure-rest/core-client@^2.5.0":
1260
+ "@azure-rest/core-client@^2.4.0":
1261
1261
  version "2.5.1"
1262
1262
  resolved "https://registry.yarnpkg.com/@azure-rest/core-client/-/core-client-2.5.1.tgz#4c1346d6698d7a40252869799958928ac98babe8"
1263
1263
  integrity sha512-EHaOXW0RYDKS5CFffnixdyRPak5ytiCtU7uXDcP/uiY+A6jFRwNGzzJBiznkCzvi5EYpY+YWinieqHb0oY916A==
@@ -1377,7 +1377,7 @@
1377
1377
  "@azure/logger" "^1.0.0"
1378
1378
  tslib "^2.6.2"
1379
1379
 
1380
- "@azure/core-paging@^1.1.1", "@azure/core-paging@^1.6.2":
1380
+ "@azure/core-paging@^1.1.1":
1381
1381
  version "1.6.2"
1382
1382
  resolved "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz#40d3860dc2df7f291d66350b2cfd9171526433e7"
1383
1383
  integrity sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==
@@ -1533,6 +1533,22 @@
1533
1533
  "@typespec/ts-http-runtime" "^0.3.0"
1534
1534
  tslib "^2.6.2"
1535
1535
 
1536
+ "@azure/monitor-ingestion@^1.2.0":
1537
+ version "1.2.0"
1538
+ resolved "https://registry.yarnpkg.com/@azure/monitor-ingestion/-/monitor-ingestion-1.2.0.tgz#7bd4e0e4987530395ff9a18d501b33b930e3cee9"
1539
+ integrity sha512-e03DQeZCVsUoCLxTF6AMAs3YSQTv2/X4685dp1+p84ctArCWNckVbzOgPKGcWn+A5oUit9rtEyujH1iIL5SIdQ==
1540
+ dependencies:
1541
+ "@azure-rest/core-client" "^2.4.0"
1542
+ "@azure/abort-controller" "^2.1.2"
1543
+ "@azure/core-auth" "^1.9.0"
1544
+ "@azure/core-client" "^1.9.2"
1545
+ "@azure/core-rest-pipeline" "^1.19.0"
1546
+ "@azure/core-tracing" "^1.2.0"
1547
+ "@azure/core-util" "^1.11.0"
1548
+ "@azure/logger" "^1.1.4"
1549
+ pako "^2.1.0"
1550
+ tslib "^2.8.1"
1551
+
1536
1552
  "@azure/monitor-opentelemetry-exporter@1.0.0-beta.31", "@azure/monitor-opentelemetry-exporter@^1.0.0-beta.31":
1537
1553
  version "1.0.0-beta.31"
1538
1554
  resolved "https://registry.npmjs.org/@azure/monitor-opentelemetry-exporter/-/monitor-opentelemetry-exporter-1.0.0-beta.31.tgz#5a560c0ac35aa7b09c6898c89ec514d2fc9fe4c1"
@@ -1586,32 +1602,6 @@
1586
1602
  "@opentelemetry/winston-transport" "^0.10.1"
1587
1603
  tslib "^2.8.1"
1588
1604
 
1589
- "@azure/monitor-query-metrics@^1.0.0":
1590
- version "1.0.0"
1591
- resolved "https://registry.yarnpkg.com/@azure/monitor-query-metrics/-/monitor-query-metrics-1.0.0.tgz#6c942fd797787ba636e5d806a3d00a1f096866b6"
1592
- integrity sha512-/VzDAVKsQnMnDHmk+y+AdoOJpG/DGGUghsDR3QgiwIW/94rBLLyw/QhjbzeBO3qbJhj+akCVK7j0vW5kNFppUA==
1593
- dependencies:
1594
- "@azure-rest/core-client" "^2.5.0"
1595
- "@azure/core-auth" "^1.9.0"
1596
- "@azure/core-rest-pipeline" "^1.19.0"
1597
- "@azure/core-tracing" "^1.2.0"
1598
- "@azure/logger" "^1.1.4"
1599
- tslib "^2.8.1"
1600
-
1601
- "@azure/monitor-query@^1.3.3":
1602
- version "1.3.3"
1603
- resolved "https://registry.yarnpkg.com/@azure/monitor-query/-/monitor-query-1.3.3.tgz#d9a3b4b77f1d6d6807fec539cf9b32a0c203d4eb"
1604
- integrity sha512-wm91Wengw8SGmPbuPrB+Q+ydK7m9yyytoj03Z9/LZT3wQpAm1RizSFonjP7eyL4g4Xwhkp92okylIrmh2lD99A==
1605
- dependencies:
1606
- "@azure/core-auth" "^1.9.0"
1607
- "@azure/core-client" "^1.9.2"
1608
- "@azure/core-paging" "^1.6.2"
1609
- "@azure/core-rest-pipeline" "^1.19.0"
1610
- "@azure/core-tracing" "^1.2.0"
1611
- "@azure/core-util" "^1.11.0"
1612
- "@azure/logger" "^1.1.4"
1613
- tslib "^2.8.1"
1614
-
1615
1605
  "@azure/msal-browser@^4.2.0":
1616
1606
  version "4.13.0"
1617
1607
  resolved "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.0.tgz#a8777fab55544433581b52dd7f86e3de1532dde6"
@@ -6992,6 +6982,11 @@ package-json-from-dist@^1.0.0:
6992
6982
  resolved "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505"
6993
6983
  integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==
6994
6984
 
6985
+ pako@^2.1.0:
6986
+ version "2.1.0"
6987
+ resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
6988
+ integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==
6989
+
6995
6990
  parent-module@^1.0.0:
6996
6991
  version "1.0.1"
6997
6992
  resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"