mblabs-roccato-backend-commons 1.0.62 → 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: 'Boolean' | 'String' | 'Int' | 'Double' | 'Decimal';
63
- measure: '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: 'Boolean' | 'String' | 'Int';
66
+ typeof: 'boolean' | 'string' | 'int';
67
67
  description: string;
68
68
  }[];
69
69
  };
@@ -12,11 +12,11 @@ class AmazonCloudwatchService {
12
12
  region: credentials.region,
13
13
  });
14
14
  const UnitMap = {
15
- Time: 'Milliseconds',
16
- Count: 'Count',
17
- Percent: 'Percent',
18
- Bytes: 'Bytes',
19
- None: 'None',
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,
@@ -8,21 +8,21 @@ class GoogleMonitorService {
8
8
  projectId: credentials.project,
9
9
  });
10
10
  const MetricKindMap = {
11
- Gauge: 'GAUGE',
12
- Delta: 'DELTA',
13
- Cumulative: 'CUMULATIVE',
11
+ gauge: 'GAUGE',
12
+ delta: 'DELTA',
13
+ cumulative: 'CUMULATIVE',
14
14
  };
15
15
  const ValueTypeMap = {
16
- Boolean: 'BOOL',
17
- String: 'STRING',
18
- Int: 'INT64',
19
- Double: 'DOUBLE',
20
- Decimal: 'MONEY',
16
+ boolean: 'BOOL',
17
+ string: 'STRING',
18
+ int: 'INT64',
19
+ double: 'DOUBLE',
20
+ decimal: 'MONEY',
21
21
  };
22
22
  const LabelValueTypeMap = {
23
- Boolean: 'BOOL',
24
- String: 'STRING',
25
- Int: 'INT64',
23
+ boolean: 'BOOL',
24
+ string: 'STRING',
25
+ int: 'INT64',
26
26
  };
27
27
  await client.createMetricDescriptor({
28
28
  name: client.projectPath(credentials.project),
@@ -32,11 +32,11 @@ class GoogleMonitorService {
32
32
  metricKind: MetricKindMap[data.metric.measure] || 'METRIC_KIND_UNSPECIFIED',
33
33
  valueType: ValueTypeMap[data.metric.typeof] || 'VALUE_TYPE_UNSPECIFIED',
34
34
  unit: data.metric.value.toString(),
35
- labels: data.metric.labels.map((label) => ({
35
+ labels: data.metric.labels?.map((label) => ({
36
36
  key: label.key,
37
37
  valueType: LabelValueTypeMap[label.typeof],
38
38
  description: label.description,
39
- })),
39
+ })) ?? [],
40
40
  },
41
41
  });
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mblabs-roccato-backend-commons",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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: 'Boolean' | 'String' | 'Int' | 'Double' | 'Decimal',
69
- measure: '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: 'Boolean' | 'String' | 'Int';
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 UnitMap: 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({
@@ -12,27 +12,27 @@ 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',
15
+ const MetricKindMap: Record<'gauge' | 'delta' | 'cumulative', 'GAUGE' | 'DELTA' | 'CUMULATIVE'> = {
16
+ gauge: 'GAUGE',
17
+ delta: 'DELTA',
18
+ cumulative: 'CUMULATIVE',
19
19
  };
20
20
 
21
21
  const ValueTypeMap: Record<
22
- 'Boolean' | 'String' | 'Int' | 'Double' | 'Decimal',
22
+ 'boolean' | 'string' | 'int' | 'double' | 'decimal',
23
23
  'BOOL' | 'INT64' | 'DOUBLE' | 'STRING' | 'DISTRIBUTION' | 'MONEY'
24
24
  > = {
25
- Boolean: 'BOOL',
26
- String: 'STRING',
27
- Int: 'INT64',
28
- Double: 'DOUBLE',
29
- Decimal: 'MONEY',
25
+ boolean: 'BOOL',
26
+ string: 'STRING',
27
+ int: 'INT64',
28
+ double: 'DOUBLE',
29
+ decimal: 'MONEY',
30
30
  };
31
31
 
32
- const LabelValueTypeMap: Record<'Boolean' | 'String' | 'Int', 'BOOL' | 'INT64' | 'STRING'> = {
33
- Boolean: 'BOOL',
34
- String: 'STRING',
35
- Int: 'INT64',
32
+ const LabelValueTypeMap: Record<'boolean' | 'string' | 'int', 'BOOL' | 'INT64' | 'STRING'> = {
33
+ boolean: 'BOOL',
34
+ string: 'STRING',
35
+ int: 'INT64',
36
36
  };
37
37
 
38
38
  await client.createMetricDescriptor({
@@ -43,11 +43,13 @@ class GoogleMonitorService implements IGoogleMonitorService {
43
43
  metricKind: MetricKindMap[data.metric.measure] || 'METRIC_KIND_UNSPECIFIED',
44
44
  valueType: ValueTypeMap[data.metric.typeof] || 'VALUE_TYPE_UNSPECIFIED',
45
45
  unit: data.metric.value.toString(),
46
- labels: data.metric.labels.map((label) => ({
47
- key: label.key,
48
- valueType: LabelValueTypeMap[label.typeof],
49
- description: label.description,
50
- })),
46
+ labels: data.metric.labels?.map(
47
+ (label) => ({
48
+ key: label.key,
49
+ valueType: LabelValueTypeMap[label.typeof],
50
+ description: label.description,
51
+ })
52
+ ) ?? [],
51
53
  },
52
54
  });
53
55
  }