@8ms/helpers 2.4.10 → 2.4.12

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 (78) hide show
  1. package/dist/_class/BaseClass.cjs +31 -21
  2. package/dist/_class/BaseClass.mjs +31 -21
  3. package/dist/_class/BaseNamespace.cjs +10 -9
  4. package/dist/_class/BaseNamespace.mjs +10 -9
  5. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  6. package/dist/_virtual/_rolldown/runtime.mjs +1 -1
  7. package/dist/api/ApiResponseClass.cjs +96 -96
  8. package/dist/api/ApiResponseClass.mjs +96 -96
  9. package/dist/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.cjs +70 -60
  10. package/dist/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.mjs +70 -60
  11. package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.cjs +30 -28
  12. package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.mjs +30 -28
  13. package/dist/aws/ec2/server/AwsEc2Namespace.cjs +29 -32
  14. package/dist/aws/ec2/server/AwsEc2Namespace.mjs +29 -32
  15. package/dist/aws/ecs/server/AwsEcsNamespace.cjs +92 -78
  16. package/dist/aws/ecs/server/AwsEcsNamespace.mjs +92 -78
  17. package/dist/aws/glue/server/AwsGlueNamespace.cjs +17 -17
  18. package/dist/aws/glue/server/AwsGlueNamespace.mjs +17 -17
  19. package/dist/aws/lambda/server/AwsLambdaNamespace.cjs +33 -31
  20. package/dist/aws/lambda/server/AwsLambdaNamespace.mjs +33 -31
  21. package/dist/aws/s3/server/AwsS3Namespace.cjs +280 -265
  22. package/dist/aws/s3/server/AwsS3Namespace.mjs +280 -265
  23. package/dist/aws/ses/server/AwsSesNamespace.cjs +27 -30
  24. package/dist/aws/ses/server/AwsSesNamespace.mjs +27 -30
  25. package/dist/aws/ses/server/SimpleEmail.cjs +202 -199
  26. package/dist/aws/ses/server/SimpleEmail.mjs +202 -199
  27. package/dist/aws/sqs/server/AwsSqsNamespace.cjs +35 -38
  28. package/dist/aws/sqs/server/AwsSqsNamespace.mjs +35 -38
  29. package/dist/aws/ssm/server/AwsSsmNamespace.cjs +24 -23
  30. package/dist/aws/ssm/server/AwsSsmNamespace.mjs +24 -23
  31. package/dist/date/index.cjs +1 -1
  32. package/dist/date/index.mjs +1 -1
  33. package/dist/drizzle/server/DrizzleNamespace.cjs +39 -42
  34. package/dist/drizzle/server/DrizzleNamespace.d.cts +1 -0
  35. package/dist/drizzle/server/DrizzleNamespace.mjs +39 -42
  36. package/dist/googleAds/server/GoogleAdsNamespace.cjs +21 -24
  37. package/dist/googleAds/server/GoogleAdsNamespace.mjs +21 -24
  38. package/dist/googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.cjs +87 -70
  39. package/dist/googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.mjs +87 -70
  40. package/dist/googleCloud/sheets/server/GoogleCloudSheetsNamespace.cjs +22 -25
  41. package/dist/googleCloud/sheets/server/GoogleCloudSheetsNamespace.mjs +22 -25
  42. package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.cjs +45 -38
  43. package/dist/googleCloud/storage/server/GoogleCloudStorageNamespace.mjs +45 -38
  44. package/dist/googlePageSpeed/server/GooglePageSpeedNamespace.cjs +12 -15
  45. package/dist/googlePageSpeed/server/GooglePageSpeedNamespace.mjs +12 -15
  46. package/dist/littleWarden/server/LittleWardenNamespace.cjs +12 -15
  47. package/dist/littleWarden/server/LittleWardenNamespace.mjs +12 -15
  48. package/dist/nextJs/client/index.cjs +2 -0
  49. package/dist/nextJs/client/index.d.cts +2 -1
  50. package/dist/nextJs/client/index.d.mts +2 -1
  51. package/dist/nextJs/client/index.mjs +2 -1
  52. package/dist/nextJs/client/useAsyncEffect.cjs +23 -0
  53. package/dist/nextJs/client/useAsyncEffect.d.cts +4 -0
  54. package/dist/nextJs/client/useAsyncEffect.d.mts +4 -0
  55. package/dist/nextJs/client/useAsyncEffect.mjs +21 -0
  56. package/dist/onePassword/server/OnePasswordNamespace.cjs +30 -33
  57. package/dist/onePassword/server/OnePasswordNamespace.mjs +30 -33
  58. package/dist/openAi/server/OpenAiNamespace.cjs +20 -20
  59. package/dist/openAi/server/OpenAiNamespace.mjs +20 -20
  60. package/dist/prisma/server/PrismaNamespace.cjs +35 -38
  61. package/dist/prisma/server/PrismaNamespace.mjs +35 -38
  62. package/dist/snapchat/server/SnapchatNamespace.cjs +12 -12
  63. package/dist/snapchat/server/SnapchatNamespace.mjs +12 -12
  64. package/dist/upTimeRobot/server/UpTimeRobotNamespace.cjs +19 -19
  65. package/dist/upTimeRobot/server/UpTimeRobotNamespace.mjs +19 -19
  66. package/package.json +4 -12
  67. package/dist/nextJs/index.cjs +0 -4
  68. package/dist/nextJs/index.d.cts +0 -2
  69. package/dist/nextJs/index.d.mts +0 -2
  70. package/dist/nextJs/index.mjs +0 -2
  71. package/dist/nextJs/nextJs.cjs +0 -13
  72. package/dist/nextJs/nextJs.d.cts +0 -19
  73. package/dist/nextJs/nextJs.d.mts +0 -19
  74. package/dist/nextJs/nextJs.mjs +0 -11
  75. package/dist/nextJs/tests/getIp.cjs +0 -9
  76. package/dist/nextJs/tests/getIp.d.cts +0 -1
  77. package/dist/nextJs/tests/getIp.d.mts +0 -1
  78. package/dist/nextJs/tests/getIp.mjs +0 -10
@@ -4,66 +4,76 @@ const require_date_calculation = require("../../../date/calculation.cjs");
4
4
  require("../../../date/index.cjs");
5
5
  //#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.ts
6
6
  var AwsCloudWatchLogNamespace = class extends require__class_BaseNamespace.BaseNamespace {
7
- constructor(..._args) {
8
- super(..._args);
9
- this.ensureInit = async () => {
10
- if (!this.client) try {
11
- const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
12
- this.client = new CloudWatchLogsClient(this.config);
13
- } catch (e) {
14
- throw new Error("AWS CloudWatch Logs Client not installed");
15
- }
16
- };
17
- this.createLogGroup = async (logGroupName) => {
18
- await this.ensureInit();
19
- const { CreateLogGroupCommand } = await import("@aws-sdk/client-cloudwatch-logs");
20
- return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
21
- };
22
- this.logGroupExists = async (logGroupName) => {
23
- await this.ensureInit();
24
- const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
25
- const response = await this.client.send(new DescribeLogGroupsCommand({
26
- logGroupNamePrefix: logGroupName,
27
- limit: 1
28
- }));
29
- if (!response?.logGroups || 0 === response.logGroups.length) return false;
30
- return true;
31
- };
32
- this.createStream = async (logGroupName, logStreamName) => {
33
- await this.ensureInit();
34
- const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
35
- return await this.client.send(new CreateLogStreamCommand({
36
- logGroupName,
37
- logStreamName
38
- }));
39
- };
40
- this.logStreamExists = async (logGroupName, logStreamName) => {
41
- await this.ensureInit();
42
- const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
43
- const response = await this.client.send(new DescribeLogStreamsCommand({
44
- logGroupName,
45
- logStreamNamePrefix: logStreamName,
46
- limit: 1
47
- }));
48
- if (!response?.logStreams || 0 === response.logStreams.length) return false;
49
- return true;
50
- };
51
- this.logEvent = async (logGroupName, logStreamName, logEvent) => {
52
- return await this.logEvents(logGroupName, logStreamName, [logEvent]);
53
- };
54
- this.logEvents = async (logGroupName, logStreamName, logEvents) => {
55
- await this.ensureInit();
56
- const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
57
- return await this.client.send(new PutLogEventsCommand({
58
- logGroupName,
59
- logStreamName,
60
- logEvents: logEvents.map((event) => ({
61
- timestamp: require_date_calculation.getLuxonDate(event.timestamp).toMillis(),
62
- message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
63
- }))
64
- }));
65
- };
66
- }
7
+ ensureInit = async () => {
8
+ if (!this.client) try {
9
+ const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
10
+ this.client = new CloudWatchLogsClient(this.config);
11
+ } catch (e) {
12
+ throw new Error("AWS CloudWatch Logs Client not installed");
13
+ }
14
+ };
15
+ /**
16
+ * Create a CloudWatch Log Group.
17
+ * This should typically be the name of the application + environment
18
+ */
19
+ createLogGroup = async (logGroupName) => {
20
+ await this.ensureInit();
21
+ const { CreateLogGroupCommand } = await import("@aws-sdk/client-cloudwatch-logs");
22
+ return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
23
+ };
24
+ /**
25
+ * Checks whether a CloudWatch Log Group exists.
26
+ */
27
+ logGroupExists = async (logGroupName) => {
28
+ await this.ensureInit();
29
+ const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
30
+ const response = await this.client.send(new DescribeLogGroupsCommand({
31
+ logGroupNamePrefix: logGroupName,
32
+ limit: 1
33
+ }));
34
+ if (!response?.logGroups || 0 === response.logGroups.length) return false;
35
+ return true;
36
+ };
37
+ /**
38
+ * Creates a stream within a CloudWatch Log Group.
39
+ */
40
+ createStream = async (logGroupName, logStreamName) => {
41
+ await this.ensureInit();
42
+ const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
43
+ return await this.client.send(new CreateLogStreamCommand({
44
+ logGroupName,
45
+ logStreamName
46
+ }));
47
+ };
48
+ /**
49
+ * Checks whether a CloudWatch Log Stream exists within a given Log Group.
50
+ */
51
+ logStreamExists = async (logGroupName, logStreamName) => {
52
+ await this.ensureInit();
53
+ const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
54
+ const response = await this.client.send(new DescribeLogStreamsCommand({
55
+ logGroupName,
56
+ logStreamNamePrefix: logStreamName,
57
+ limit: 1
58
+ }));
59
+ if (!response?.logStreams || 0 === response.logStreams.length) return false;
60
+ return true;
61
+ };
62
+ logEvent = async (logGroupName, logStreamName, logEvent) => {
63
+ return await this.logEvents(logGroupName, logStreamName, [logEvent]);
64
+ };
65
+ logEvents = async (logGroupName, logStreamName, logEvents) => {
66
+ await this.ensureInit();
67
+ const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
68
+ return await this.client.send(new PutLogEventsCommand({
69
+ logGroupName,
70
+ logStreamName,
71
+ logEvents: logEvents.map((event) => ({
72
+ timestamp: require_date_calculation.getLuxonDate(event.timestamp).toMillis(),
73
+ message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
74
+ }))
75
+ }));
76
+ };
67
77
  };
68
78
  //#endregion
69
79
  exports.AwsCloudWatchLogNamespace = AwsCloudWatchLogNamespace;
@@ -3,66 +3,76 @@ import { getLuxonDate } from "../../../date/calculation.mjs";
3
3
  import "../../../date/index.mjs";
4
4
  //#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.ts
5
5
  var AwsCloudWatchLogNamespace = class extends BaseNamespace {
6
- constructor(..._args) {
7
- super(..._args);
8
- this.ensureInit = async () => {
9
- if (!this.client) try {
10
- const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
11
- this.client = new CloudWatchLogsClient(this.config);
12
- } catch (e) {
13
- throw new Error("AWS CloudWatch Logs Client not installed");
14
- }
15
- };
16
- this.createLogGroup = async (logGroupName) => {
17
- await this.ensureInit();
18
- const { CreateLogGroupCommand } = await import("@aws-sdk/client-cloudwatch-logs");
19
- return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
20
- };
21
- this.logGroupExists = async (logGroupName) => {
22
- await this.ensureInit();
23
- const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
24
- const response = await this.client.send(new DescribeLogGroupsCommand({
25
- logGroupNamePrefix: logGroupName,
26
- limit: 1
27
- }));
28
- if (!response?.logGroups || 0 === response.logGroups.length) return false;
29
- return true;
30
- };
31
- this.createStream = async (logGroupName, logStreamName) => {
32
- await this.ensureInit();
33
- const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
34
- return await this.client.send(new CreateLogStreamCommand({
35
- logGroupName,
36
- logStreamName
37
- }));
38
- };
39
- this.logStreamExists = async (logGroupName, logStreamName) => {
40
- await this.ensureInit();
41
- const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
42
- const response = await this.client.send(new DescribeLogStreamsCommand({
43
- logGroupName,
44
- logStreamNamePrefix: logStreamName,
45
- limit: 1
46
- }));
47
- if (!response?.logStreams || 0 === response.logStreams.length) return false;
48
- return true;
49
- };
50
- this.logEvent = async (logGroupName, logStreamName, logEvent) => {
51
- return await this.logEvents(logGroupName, logStreamName, [logEvent]);
52
- };
53
- this.logEvents = async (logGroupName, logStreamName, logEvents) => {
54
- await this.ensureInit();
55
- const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
56
- return await this.client.send(new PutLogEventsCommand({
57
- logGroupName,
58
- logStreamName,
59
- logEvents: logEvents.map((event) => ({
60
- timestamp: getLuxonDate(event.timestamp).toMillis(),
61
- message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
62
- }))
63
- }));
64
- };
65
- }
6
+ ensureInit = async () => {
7
+ if (!this.client) try {
8
+ const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
9
+ this.client = new CloudWatchLogsClient(this.config);
10
+ } catch (e) {
11
+ throw new Error("AWS CloudWatch Logs Client not installed");
12
+ }
13
+ };
14
+ /**
15
+ * Create a CloudWatch Log Group.
16
+ * This should typically be the name of the application + environment
17
+ */
18
+ createLogGroup = async (logGroupName) => {
19
+ await this.ensureInit();
20
+ const { CreateLogGroupCommand } = await import("@aws-sdk/client-cloudwatch-logs");
21
+ return await this.client.send(new CreateLogGroupCommand({ logGroupName }));
22
+ };
23
+ /**
24
+ * Checks whether a CloudWatch Log Group exists.
25
+ */
26
+ logGroupExists = async (logGroupName) => {
27
+ await this.ensureInit();
28
+ const { DescribeLogGroupsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
29
+ const response = await this.client.send(new DescribeLogGroupsCommand({
30
+ logGroupNamePrefix: logGroupName,
31
+ limit: 1
32
+ }));
33
+ if (!response?.logGroups || 0 === response.logGroups.length) return false;
34
+ return true;
35
+ };
36
+ /**
37
+ * Creates a stream within a CloudWatch Log Group.
38
+ */
39
+ createStream = async (logGroupName, logStreamName) => {
40
+ await this.ensureInit();
41
+ const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
42
+ return await this.client.send(new CreateLogStreamCommand({
43
+ logGroupName,
44
+ logStreamName
45
+ }));
46
+ };
47
+ /**
48
+ * Checks whether a CloudWatch Log Stream exists within a given Log Group.
49
+ */
50
+ logStreamExists = async (logGroupName, logStreamName) => {
51
+ await this.ensureInit();
52
+ const { DescribeLogStreamsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
53
+ const response = await this.client.send(new DescribeLogStreamsCommand({
54
+ logGroupName,
55
+ logStreamNamePrefix: logStreamName,
56
+ limit: 1
57
+ }));
58
+ if (!response?.logStreams || 0 === response.logStreams.length) return false;
59
+ return true;
60
+ };
61
+ logEvent = async (logGroupName, logStreamName, logEvent) => {
62
+ return await this.logEvents(logGroupName, logStreamName, [logEvent]);
63
+ };
64
+ logEvents = async (logGroupName, logStreamName, logEvents) => {
65
+ await this.ensureInit();
66
+ const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
67
+ return await this.client.send(new PutLogEventsCommand({
68
+ logGroupName,
69
+ logStreamName,
70
+ logEvents: logEvents.map((event) => ({
71
+ timestamp: getLuxonDate(event.timestamp).toMillis(),
72
+ message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
73
+ }))
74
+ }));
75
+ };
66
76
  };
67
77
  //#endregion
68
78
  export { AwsCloudWatchLogNamespace };
@@ -7,35 +7,37 @@ require("../../../date/index.cjs");
7
7
  let _aws_sdk_client_cloudwatch = require("@aws-sdk/client-cloudwatch");
8
8
  //#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.ts
9
9
  var AwsCloudWatchMetricNamespace = class extends require__class_BaseNamespace.BaseNamespace {
10
- constructor(..._args) {
11
- super(..._args);
12
- this.ensureInit = async () => {
13
- if (!this.client) try {
14
- const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
15
- this.client = new CloudWatchClient(this.config);
16
- } catch (e) {
17
- throw new Error("AWS CloudWatch Client not installed");
18
- }
19
- };
20
- this.logMetric = async (namespace, metricData) => {
21
- await this.ensureInit();
22
- const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
23
- const data = require_array_array.getArray(metricData);
24
- return await this.client.send(new PutMetricDataCommand({
25
- Namespace: namespace,
26
- MetricData: data.map((metric) => ({
27
- MetricName: metric.metricName,
28
- Value: metric.value,
29
- Unit: metric?.unit || _aws_sdk_client_cloudwatch.StandardUnit.Count,
30
- Timestamp: require_date_calculation.getLuxonDate(metric.timestamp).toJSDate(),
31
- Dimensions: metric.dimensions?.map((dimension) => ({
32
- Name: dimension.name,
33
- Value: dimension.value
34
- }))
10
+ ensureInit = async () => {
11
+ if (!this.client) try {
12
+ const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
13
+ this.client = new CloudWatchClient(this.config);
14
+ } catch (e) {
15
+ throw new Error("AWS CloudWatch Client not installed");
16
+ }
17
+ };
18
+ /**
19
+ * Publishes metric data to CloudWatch.
20
+ * The namespace is created automatically.
21
+ * Dimensions should contain additional info (but top level).
22
+ */
23
+ logMetric = async (namespace, metricData) => {
24
+ await this.ensureInit();
25
+ const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
26
+ const data = require_array_array.getArray(metricData);
27
+ return await this.client.send(new PutMetricDataCommand({
28
+ Namespace: namespace,
29
+ MetricData: data.map((metric) => ({
30
+ MetricName: metric.metricName,
31
+ Value: metric.value,
32
+ Unit: metric?.unit || _aws_sdk_client_cloudwatch.StandardUnit.Count,
33
+ Timestamp: require_date_calculation.getLuxonDate(metric.timestamp).toJSDate(),
34
+ Dimensions: metric.dimensions?.map((dimension) => ({
35
+ Name: dimension.name,
36
+ Value: dimension.value
35
37
  }))
36
- }));
37
- };
38
- }
38
+ }))
39
+ }));
40
+ };
39
41
  };
40
42
  //#endregion
41
43
  exports.AwsCloudWatchMetricNamespace = AwsCloudWatchMetricNamespace;
@@ -5,35 +5,37 @@ import "../../../date/index.mjs";
5
5
  import { StandardUnit } from "@aws-sdk/client-cloudwatch";
6
6
  //#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.ts
7
7
  var AwsCloudWatchMetricNamespace = class extends BaseNamespace {
8
- constructor(..._args) {
9
- super(..._args);
10
- this.ensureInit = async () => {
11
- if (!this.client) try {
12
- const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
13
- this.client = new CloudWatchClient(this.config);
14
- } catch (e) {
15
- throw new Error("AWS CloudWatch Client not installed");
16
- }
17
- };
18
- this.logMetric = async (namespace, metricData) => {
19
- await this.ensureInit();
20
- const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
21
- const data = getArray(metricData);
22
- return await this.client.send(new PutMetricDataCommand({
23
- Namespace: namespace,
24
- MetricData: data.map((metric) => ({
25
- MetricName: metric.metricName,
26
- Value: metric.value,
27
- Unit: metric?.unit || StandardUnit.Count,
28
- Timestamp: getLuxonDate(metric.timestamp).toJSDate(),
29
- Dimensions: metric.dimensions?.map((dimension) => ({
30
- Name: dimension.name,
31
- Value: dimension.value
32
- }))
8
+ ensureInit = async () => {
9
+ if (!this.client) try {
10
+ const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
11
+ this.client = new CloudWatchClient(this.config);
12
+ } catch (e) {
13
+ throw new Error("AWS CloudWatch Client not installed");
14
+ }
15
+ };
16
+ /**
17
+ * Publishes metric data to CloudWatch.
18
+ * The namespace is created automatically.
19
+ * Dimensions should contain additional info (but top level).
20
+ */
21
+ logMetric = async (namespace, metricData) => {
22
+ await this.ensureInit();
23
+ const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
24
+ const data = getArray(metricData);
25
+ return await this.client.send(new PutMetricDataCommand({
26
+ Namespace: namespace,
27
+ MetricData: data.map((metric) => ({
28
+ MetricName: metric.metricName,
29
+ Value: metric.value,
30
+ Unit: metric?.unit || StandardUnit.Count,
31
+ Timestamp: getLuxonDate(metric.timestamp).toJSDate(),
32
+ Dimensions: metric.dimensions?.map((dimension) => ({
33
+ Name: dimension.name,
34
+ Value: dimension.value
33
35
  }))
34
- }));
35
- };
36
- }
36
+ }))
37
+ }));
38
+ };
37
39
  };
38
40
  //#endregion
39
41
  export { AwsCloudWatchMetricNamespace };
@@ -2,38 +2,35 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require__class_BaseNamespace = require("../../../_class/BaseNamespace.cjs");
3
3
  //#region src/aws/ec2/server/AwsEc2Namespace.ts
4
4
  var AwsEc2Namespace = class extends require__class_BaseNamespace.BaseNamespace {
5
- constructor(..._args) {
6
- super(..._args);
7
- this.ensureInit = async () => {
8
- if (!this.client) try {
9
- const { EC2Client } = await import("@aws-sdk/client-ec2");
10
- this.client = new EC2Client(this.config);
11
- } catch (e) {
12
- throw new Error("AWS EC2 Client not installed");
13
- }
14
- };
15
- this.startInstances = async (instanceIds, additionalInfo, dryRun) => {
16
- await this.ensureInit();
17
- const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
18
- const command = new StartInstancesCommand({
19
- InstanceIds: instanceIds,
20
- AdditionalInfo: additionalInfo,
21
- DryRun: dryRun
22
- });
23
- return await this.client.send(command);
24
- };
25
- this.stopInstances = async (instanceIds, hibernate, force, dryRun) => {
26
- await this.ensureInit();
27
- const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
28
- const command = new StopInstancesCommand({
29
- InstanceIds: instanceIds,
30
- Hibernate: hibernate,
31
- DryRun: dryRun,
32
- Force: force
33
- });
34
- return await this.client.send(command);
35
- };
36
- }
5
+ ensureInit = async () => {
6
+ if (!this.client) try {
7
+ const { EC2Client } = await import("@aws-sdk/client-ec2");
8
+ this.client = new EC2Client(this.config);
9
+ } catch (e) {
10
+ throw new Error("AWS EC2 Client not installed");
11
+ }
12
+ };
13
+ startInstances = async (instanceIds, additionalInfo, dryRun) => {
14
+ await this.ensureInit();
15
+ const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
16
+ const command = new StartInstancesCommand({
17
+ InstanceIds: instanceIds,
18
+ AdditionalInfo: additionalInfo,
19
+ DryRun: dryRun
20
+ });
21
+ return await this.client.send(command);
22
+ };
23
+ stopInstances = async (instanceIds, hibernate, force, dryRun) => {
24
+ await this.ensureInit();
25
+ const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
26
+ const command = new StopInstancesCommand({
27
+ InstanceIds: instanceIds,
28
+ Hibernate: hibernate,
29
+ DryRun: dryRun,
30
+ Force: force
31
+ });
32
+ return await this.client.send(command);
33
+ };
37
34
  };
38
35
  //#endregion
39
36
  exports.AwsEc2Namespace = AwsEc2Namespace;
@@ -1,38 +1,35 @@
1
1
  import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
2
2
  //#region src/aws/ec2/server/AwsEc2Namespace.ts
3
3
  var AwsEc2Namespace = class extends BaseNamespace {
4
- constructor(..._args) {
5
- super(..._args);
6
- this.ensureInit = async () => {
7
- if (!this.client) try {
8
- const { EC2Client } = await import("@aws-sdk/client-ec2");
9
- this.client = new EC2Client(this.config);
10
- } catch (e) {
11
- throw new Error("AWS EC2 Client not installed");
12
- }
13
- };
14
- this.startInstances = async (instanceIds, additionalInfo, dryRun) => {
15
- await this.ensureInit();
16
- const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
17
- const command = new StartInstancesCommand({
18
- InstanceIds: instanceIds,
19
- AdditionalInfo: additionalInfo,
20
- DryRun: dryRun
21
- });
22
- return await this.client.send(command);
23
- };
24
- this.stopInstances = async (instanceIds, hibernate, force, dryRun) => {
25
- await this.ensureInit();
26
- const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
27
- const command = new StopInstancesCommand({
28
- InstanceIds: instanceIds,
29
- Hibernate: hibernate,
30
- DryRun: dryRun,
31
- Force: force
32
- });
33
- return await this.client.send(command);
34
- };
35
- }
4
+ ensureInit = async () => {
5
+ if (!this.client) try {
6
+ const { EC2Client } = await import("@aws-sdk/client-ec2");
7
+ this.client = new EC2Client(this.config);
8
+ } catch (e) {
9
+ throw new Error("AWS EC2 Client not installed");
10
+ }
11
+ };
12
+ startInstances = async (instanceIds, additionalInfo, dryRun) => {
13
+ await this.ensureInit();
14
+ const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
15
+ const command = new StartInstancesCommand({
16
+ InstanceIds: instanceIds,
17
+ AdditionalInfo: additionalInfo,
18
+ DryRun: dryRun
19
+ });
20
+ return await this.client.send(command);
21
+ };
22
+ stopInstances = async (instanceIds, hibernate, force, dryRun) => {
23
+ await this.ensureInit();
24
+ const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
25
+ const command = new StopInstancesCommand({
26
+ InstanceIds: instanceIds,
27
+ Hibernate: hibernate,
28
+ DryRun: dryRun,
29
+ Force: force
30
+ });
31
+ return await this.client.send(command);
32
+ };
36
33
  };
37
34
  //#endregion
38
35
  export { AwsEc2Namespace };