@8ms/helpers 2.3.39 → 2.3.41
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/aws/{cloudWatch → cloudWatchLog}/server/index.d.mts +8 -8
- package/dist/aws/{cloudWatch → cloudWatchLog}/server/index.mjs +13 -13
- package/dist/aws/cloudWatchMetric/server/index.d.mts +35 -0
- package/dist/aws/cloudWatchMetric/server/index.mjs +53 -0
- package/dist/brightData/serpApi/server/index.d.mts +1 -1
- package/dist/brightData/server/index.d.mts +1 -1
- package/dist/brightData/webScraperIde/server/index.d.mts +1 -1
- package/dist/googleCloud/bigquery/server/index.d.mts +1 -1
- package/dist/googleCloud/server/index.d.mts +1 -1
- package/dist/googleCloud/sheets/server/index.d.mts +1 -1
- package/dist/googleCloud/storage/server/index.d.mts +1 -1
- package/package.json +8 -2
- /package/dist/{index-BqrbHL2-.d.mts → index-DDH4qfj3.d.mts} +0 -0
- /package/dist/{index-Cpfm8vFH.d.mts → index-DInsoSQm.d.mts} +0 -0
|
@@ -3,7 +3,7 @@ import { t as AwsConfig } from "../../../index-CqTOMR8f.mjs";
|
|
|
3
3
|
import * as _aws_sdk_client_cloudwatch_logs0 from "@aws-sdk/client-cloudwatch-logs";
|
|
4
4
|
import { CloudWatchLogsClient } from "@aws-sdk/client-cloudwatch-logs";
|
|
5
5
|
|
|
6
|
-
//#region src/aws/
|
|
6
|
+
//#region src/aws/cloudWatchLog/server/logEvent.d.ts
|
|
7
7
|
declare const logLevel: {
|
|
8
8
|
readonly INFO: "info";
|
|
9
9
|
readonly WARN: "warn";
|
|
@@ -19,8 +19,8 @@ type LogEvent = {
|
|
|
19
19
|
data: object;
|
|
20
20
|
};
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region src/aws/
|
|
23
|
-
declare class
|
|
22
|
+
//#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.d.ts
|
|
23
|
+
declare class AwsCloudWatchLogNamespace extends BaseNamespace {
|
|
24
24
|
client: CloudWatchLogsClient;
|
|
25
25
|
config: AwsConfig;
|
|
26
26
|
ensureInit: () => Promise<void>;
|
|
@@ -41,11 +41,11 @@ declare class AwsCloudWatchNamespace extends BaseNamespace {
|
|
|
41
41
|
* Checks whether a CloudWatch Log Stream exists within a given Log Group.
|
|
42
42
|
*/
|
|
43
43
|
logStreamExists: (logGroupName: string, logStreamName: string) => Promise<boolean>;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
logEvent: (logGroupName: string, logStreamName: string, logEvent: LogEvent) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
|
|
45
|
+
logEvents: (logGroupName: string, logStreamName: string, logEvents: LogEvent[]) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
|
-
//#region src/aws/
|
|
49
|
-
declare const
|
|
48
|
+
//#region src/aws/cloudWatchLog/server/awsCloudWatchLog.d.ts
|
|
49
|
+
declare const awsCloudWatchLogClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsCloudWatchLogNamespace>;
|
|
50
50
|
//#endregion
|
|
51
|
-
export {
|
|
51
|
+
export { AwsCloudWatchLogNamespace, LogEvent, LogLevel, awsCloudWatchLogClient, logLevel };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/index.mjs";
|
|
2
2
|
import { t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/aws/
|
|
5
|
-
var
|
|
4
|
+
//#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.ts
|
|
5
|
+
var AwsCloudWatchLogNamespace = class extends BaseNamespace {
|
|
6
6
|
ensureInit = async () => {
|
|
7
7
|
if (!this.client) try {
|
|
8
8
|
const { CloudWatchLogsClient } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
@@ -58,10 +58,10 @@ var AwsCloudWatchNamespace = class extends BaseNamespace {
|
|
|
58
58
|
if (!response?.logStreams || 0 === response.logStreams.length) return false;
|
|
59
59
|
return true;
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
return await this.
|
|
61
|
+
logEvent = async (logGroupName, logStreamName, logEvent) => {
|
|
62
|
+
return await this.logEvents(logGroupName, logStreamName, [logEvent]);
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
logEvents = async (logGroupName, logStreamName, logEvents) => {
|
|
65
65
|
await this.ensureInit();
|
|
66
66
|
const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
67
67
|
return await this.client.send(new PutLogEventsCommand({
|
|
@@ -76,17 +76,17 @@ var AwsCloudWatchNamespace = class extends BaseNamespace {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
|
-
//#region src/aws/
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
const namespace = new
|
|
84
|
-
|
|
79
|
+
//#region src/aws/cloudWatchLog/server/awsCloudWatchLog.ts
|
|
80
|
+
const awsCloudWatchLogNamespaces = /* @__PURE__ */ new Map();
|
|
81
|
+
const awsCloudWatchLogClient = async (key = "default", config, vaultId, itemId) => {
|
|
82
|
+
if (awsCloudWatchLogNamespaces.has(key)) return awsCloudWatchLogNamespaces.get(key);
|
|
83
|
+
const namespace = new AwsCloudWatchLogNamespace(key, await getConfig(key, config, vaultId, itemId));
|
|
84
|
+
awsCloudWatchLogNamespaces.set(key, namespace);
|
|
85
85
|
return namespace;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
//#endregion
|
|
89
|
-
//#region src/aws/
|
|
89
|
+
//#region src/aws/cloudWatchLog/server/logEvent.ts
|
|
90
90
|
const logLevel = {
|
|
91
91
|
INFO: "info",
|
|
92
92
|
WARN: "warn",
|
|
@@ -94,4 +94,4 @@ const logLevel = {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
//#endregion
|
|
97
|
-
export {
|
|
97
|
+
export { AwsCloudWatchLogNamespace, awsCloudWatchLogClient, logLevel };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
|
|
2
|
+
import { X as InputDate } from "../../../index-1fBbJGQz.mjs";
|
|
3
|
+
import { t as AwsConfig } from "../../../index-CqTOMR8f.mjs";
|
|
4
|
+
import * as _aws_sdk_client_cloudwatch0 from "@aws-sdk/client-cloudwatch";
|
|
5
|
+
import { CloudWatchClient, StandardUnit } from "@aws-sdk/client-cloudwatch";
|
|
6
|
+
|
|
7
|
+
//#region src/aws/cloudWatchMetric/server/logMetric.d.ts
|
|
8
|
+
type LogMetric = {
|
|
9
|
+
metricName: string;
|
|
10
|
+
value: number;
|
|
11
|
+
unit?: StandardUnit;
|
|
12
|
+
timestamp?: InputDate;
|
|
13
|
+
dimensions?: {
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.d.ts
|
|
20
|
+
declare class AwsCloudWatchMetricNamespace extends BaseNamespace {
|
|
21
|
+
client: CloudWatchClient;
|
|
22
|
+
config: AwsConfig;
|
|
23
|
+
ensureInit: () => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Publishes metric data to CloudWatch.
|
|
26
|
+
* The namespace is created automatically.
|
|
27
|
+
* Dimensions should contain additional info (but top level).
|
|
28
|
+
*/
|
|
29
|
+
logMetric: (namespace: string, metricData: LogMetric | LogMetric[]) => Promise<_aws_sdk_client_cloudwatch0.PutMetricDataCommandOutput>;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/aws/cloudWatchMetric/server/awsCloudWatchMetric.d.ts
|
|
33
|
+
declare const awsCloudWatchMetricClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsCloudWatchMetricNamespace>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AwsCloudWatchMetricNamespace, LogMetric, awsCloudWatchMetricClient };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getArray } from "../../../array/index.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../../_class/index.mjs";
|
|
3
|
+
import { getLuxonDate } from "../../../date/index.mjs";
|
|
4
|
+
import { t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
|
|
5
|
+
import { StandardUnit } from "@aws-sdk/client-cloudwatch";
|
|
6
|
+
|
|
7
|
+
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetricNamespace.ts
|
|
8
|
+
var AwsCloudWatchMetricNamespace = class extends BaseNamespace {
|
|
9
|
+
ensureInit = async () => {
|
|
10
|
+
if (!this.client) try {
|
|
11
|
+
const { CloudWatchClient } = await import("@aws-sdk/client-cloudwatch");
|
|
12
|
+
this.client = new CloudWatchClient(this.config);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw new Error("AWS CloudWatch Client not installed");
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Publishes metric data to CloudWatch.
|
|
19
|
+
* The namespace is created automatically.
|
|
20
|
+
* Dimensions should contain additional info (but top level).
|
|
21
|
+
*/
|
|
22
|
+
logMetric = async (namespace, metricData) => {
|
|
23
|
+
await this.ensureInit();
|
|
24
|
+
const { PutMetricDataCommand } = await import("@aws-sdk/client-cloudwatch");
|
|
25
|
+
const data = getArray(metricData);
|
|
26
|
+
return await this.client.send(new PutMetricDataCommand({
|
|
27
|
+
Namespace: namespace,
|
|
28
|
+
MetricData: data.map((metric) => ({
|
|
29
|
+
MetricName: metric.metricName,
|
|
30
|
+
Value: metric.value,
|
|
31
|
+
Unit: metric?.unit || StandardUnit.Count,
|
|
32
|
+
Timestamp: getLuxonDate(metric.timestamp).toJSDate(),
|
|
33
|
+
Dimensions: metric.dimensions?.map((dimension) => ({
|
|
34
|
+
Name: dimension.name,
|
|
35
|
+
Value: dimension.value
|
|
36
|
+
}))
|
|
37
|
+
}))
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/aws/cloudWatchMetric/server/awsCloudWatchMetric.ts
|
|
44
|
+
const awsCloudWatchMetricNamespaces = /* @__PURE__ */ new Map();
|
|
45
|
+
const awsCloudWatchMetricClient = async (key = "default", config, vaultId, itemId) => {
|
|
46
|
+
if (awsCloudWatchMetricNamespaces.has(key)) return awsCloudWatchMetricNamespaces.get(key);
|
|
47
|
+
const namespace = new AwsCloudWatchMetricNamespace(key, await getConfig(key, config, vaultId, itemId));
|
|
48
|
+
awsCloudWatchMetricNamespaces.set(key, namespace);
|
|
49
|
+
return namespace;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { AwsCloudWatchMetricNamespace, awsCloudWatchMetricClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as ApiResponseClass } from "../../../index-DW9yJLtI.mjs";
|
|
2
|
-
import { t as Auth } from "../../../index-
|
|
2
|
+
import { t as Auth } from "../../../index-DInsoSQm.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/brightData/serpApi/server/brightDataSerpApi.d.ts
|
|
5
5
|
declare const brightDataSerpApiType: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getCustomerId, r as getZone, t as Auth } from "../../index-
|
|
1
|
+
import { n as getCustomerId, r as getZone, t as Auth } from "../../index-DInsoSQm.mjs";
|
|
2
2
|
export { Auth, getCustomerId, getZone };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
|
|
2
|
-
import { t as GoogleCloudConfig } from "../../../index-
|
|
2
|
+
import { t as GoogleCloudConfig } from "../../../index-DDH4qfj3.mjs";
|
|
3
3
|
import { BigQuery, DatasetResource, QueryOptions } from "@google-cloud/bigquery";
|
|
4
4
|
import { GoogleAuthOptions } from "@google-cloud/common";
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getConfig, t as GoogleCloudConfig } from "../../index-
|
|
1
|
+
import { n as getConfig, t as GoogleCloudConfig } from "../../index-DDH4qfj3.mjs";
|
|
2
2
|
export { GoogleCloudConfig, getConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
|
|
2
|
-
import { t as GoogleCloudConfig } from "../../../index-
|
|
2
|
+
import { t as GoogleCloudConfig } from "../../../index-DDH4qfj3.mjs";
|
|
3
3
|
import * as _googleapis_sheets0 from "@googleapis/sheets";
|
|
4
4
|
import { GoogleAuth } from "googleapis-common";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
|
|
2
|
-
import { t as GoogleCloudConfig } from "../../../index-
|
|
2
|
+
import { t as GoogleCloudConfig } from "../../../index-DDH4qfj3.mjs";
|
|
3
3
|
import * as _google_cloud_storage0 from "@google-cloud/storage";
|
|
4
4
|
import { Storage } from "@google-cloud/storage";
|
|
5
5
|
import { GoogleAuthOptions } from "@google-cloud/common";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.41",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@1password/sdk": "<1.0.0",
|
|
25
|
+
"@aws-sdk/client-cloudwatch": "^3.0.0",
|
|
25
26
|
"@aws-sdk/client-cloudwatch-logs": "^3.0.0",
|
|
26
27
|
"@aws-sdk/client-ec2": "^3.0.0",
|
|
27
28
|
"@aws-sdk/client-ecs": "^3.0.0",
|
|
@@ -57,6 +58,9 @@
|
|
|
57
58
|
"@1password/sdk": {
|
|
58
59
|
"optional": true
|
|
59
60
|
},
|
|
61
|
+
"@aws-sdk/client-cloudwatch": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
60
64
|
"@aws-sdk/client-cloudwatch-logs": {
|
|
61
65
|
"optional": true
|
|
62
66
|
},
|
|
@@ -147,6 +151,7 @@
|
|
|
147
151
|
},
|
|
148
152
|
"devDependencies": {
|
|
149
153
|
"@1password/sdk": "^0.4.0",
|
|
154
|
+
"@aws-sdk/client-cloudwatch": "^3.992.0",
|
|
150
155
|
"@aws-sdk/client-cloudwatch-logs": "^3.992.0",
|
|
151
156
|
"@aws-sdk/client-ec2": "^3.992.0",
|
|
152
157
|
"@aws-sdk/client-ecs": "^3.992.0",
|
|
@@ -203,7 +208,8 @@
|
|
|
203
208
|
"./api": "./dist/api/index.mjs",
|
|
204
209
|
"./array": "./dist/array/index.mjs",
|
|
205
210
|
"./atInternet": "./dist/atInternet/index.mjs",
|
|
206
|
-
"./aws/
|
|
211
|
+
"./aws/cloudWatchLog/server": "./dist/aws/cloudWatchLog/server/index.mjs",
|
|
212
|
+
"./aws/cloudWatchMetric/server": "./dist/aws/cloudWatchMetric/server/index.mjs",
|
|
207
213
|
"./aws/ec2/server": "./dist/aws/ec2/server/index.mjs",
|
|
208
214
|
"./aws/ecs/server": "./dist/aws/ecs/server/index.mjs",
|
|
209
215
|
"./aws/glue/server": "./dist/aws/glue/server/index.mjs",
|
|
File without changes
|
|
File without changes
|