@8ms/helpers 2.3.36 → 2.3.38
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/server/index.d.mts +43 -0
- package/dist/aws/cloudWatch/server/index.mjs +70 -0
- package/dist/aws/lambda/server/index.mjs +1 -1
- 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/dist/googlePageSpeed/server/index.mjs +1 -1
- package/dist/littleWarden/server/index.mjs +1 -1
- package/dist/openAi/server/index.mjs +1 -1
- package/dist/snapchat/server/index.mjs +1 -1
- package/dist/upTimeRobot/server/index.mjs +1 -1
- package/package.json +7 -1
- /package/dist/{index-DmCSxHCc.d.mts → index-BqrbHL2-.d.mts} +0 -0
- /package/dist/{index-BfyGIdDD.d.mts → index-Cpfm8vFH.d.mts} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
|
|
2
|
+
import { t as AwsConfig } from "../../../index-CqTOMR8f.mjs";
|
|
3
|
+
import * as _aws_sdk_client_cloudwatch_logs0 from "@aws-sdk/client-cloudwatch-logs";
|
|
4
|
+
import { CloudWatchLogsClient } from "@aws-sdk/client-cloudwatch-logs";
|
|
5
|
+
|
|
6
|
+
//#region src/aws/cloudWatch/server/logEvent.d.ts
|
|
7
|
+
declare const logLevel: {
|
|
8
|
+
readonly INFO: "info";
|
|
9
|
+
readonly WARN: "warn";
|
|
10
|
+
readonly ERROR: "error";
|
|
11
|
+
};
|
|
12
|
+
type LogLevel = typeof logLevel[keyof typeof logLevel];
|
|
13
|
+
type LogEvent = {
|
|
14
|
+
unixTimestamp: number;
|
|
15
|
+
level: LogLevel;
|
|
16
|
+
app: string;
|
|
17
|
+
environment: string;
|
|
18
|
+
stream: string;
|
|
19
|
+
data: object;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/aws/cloudWatch/server/AwsCloudWatchNamespace.d.ts
|
|
23
|
+
declare class AwsCloudWatchNamespace extends BaseNamespace {
|
|
24
|
+
client: CloudWatchLogsClient;
|
|
25
|
+
config: AwsConfig;
|
|
26
|
+
ensureInit: () => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a CloudWatch Log Group.
|
|
29
|
+
* This should typically be the name of the application + environment
|
|
30
|
+
*/
|
|
31
|
+
createLogGroup: (logGroupName: string) => Promise<_aws_sdk_client_cloudwatch_logs0.CreateLogGroupCommandOutput>;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a stream within a CloudWatch Log Group.
|
|
34
|
+
*/
|
|
35
|
+
createStream: (logGroupName: string, logStreamName: string) => Promise<_aws_sdk_client_cloudwatch_logs0.CreateLogStreamCommandOutput>;
|
|
36
|
+
createEvent: (logGroupName: string, logStreamName: string, logEvent: LogEvent) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
|
|
37
|
+
createEvents: (logGroupName: string, logStreamName: string, logEvents: LogEvent[]) => Promise<_aws_sdk_client_cloudwatch_logs0.PutLogEventsCommandOutput>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/aws/cloudWatch/server/awsCloudWatch.d.ts
|
|
41
|
+
declare const awsCloudWatchClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsCloudWatchNamespace>;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { AwsCloudWatchNamespace, LogEvent, LogLevel, awsCloudWatchClient, logLevel };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BaseNamespace } from "../../../_class/index.mjs";
|
|
2
|
+
import { t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/aws/cloudWatch/server/AwsCloudWatchNamespace.ts
|
|
5
|
+
var AwsCloudWatchNamespace = class extends BaseNamespace {
|
|
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
|
+
* Creates a stream within a CloudWatch Log Group.
|
|
25
|
+
*/
|
|
26
|
+
createStream = async (logGroupName, logStreamName) => {
|
|
27
|
+
await this.ensureInit();
|
|
28
|
+
const { CreateLogStreamCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
29
|
+
return await this.client.send(new CreateLogStreamCommand({
|
|
30
|
+
logGroupName,
|
|
31
|
+
logStreamName
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
createEvent = async (logGroupName, logStreamName, logEvent) => {
|
|
35
|
+
return await this.createEvents(logGroupName, logStreamName, [logEvent]);
|
|
36
|
+
};
|
|
37
|
+
createEvents = async (logGroupName, logStreamName, logEvents) => {
|
|
38
|
+
await this.ensureInit();
|
|
39
|
+
const { PutLogEventsCommand } = await import("@aws-sdk/client-cloudwatch-logs");
|
|
40
|
+
return await this.client.send(new PutLogEventsCommand({
|
|
41
|
+
logGroupName,
|
|
42
|
+
logStreamName,
|
|
43
|
+
logEvents: logEvents.map((event) => ({
|
|
44
|
+
timestamp: event.unixTimestamp ?? Date.now(),
|
|
45
|
+
message: typeof event === "string" ? event : JSON.stringify(event)
|
|
46
|
+
}))
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/aws/cloudWatch/server/awsCloudWatch.ts
|
|
53
|
+
const awsCloudWatchNamespaces = /* @__PURE__ */ new Map();
|
|
54
|
+
const awsCloudWatchClient = async (key = "default", config, vaultId, itemId) => {
|
|
55
|
+
if (awsCloudWatchNamespaces.has(key)) return awsCloudWatchNamespaces.get(key);
|
|
56
|
+
const namespace = new AwsCloudWatchNamespace(key, await getConfig(key, config, vaultId, itemId));
|
|
57
|
+
awsCloudWatchNamespaces.set(key, namespace);
|
|
58
|
+
return namespace;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/aws/cloudWatch/server/logEvent.ts
|
|
63
|
+
const logLevel = {
|
|
64
|
+
INFO: "info",
|
|
65
|
+
WARN: "warn",
|
|
66
|
+
ERROR: "error"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { AwsCloudWatchNamespace, awsCloudWatchClient, logLevel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNamespace } from "../../../_class/index.mjs";
|
|
2
1
|
import { u as ApiResponseClass } from "../../../api-DGKJDAfb.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../../_class/index.mjs";
|
|
3
3
|
import { n as isResponse200, t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/aws/lambda/server/AwsLambdaNamespace.ts
|
|
@@ -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-Cpfm8vFH.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-Cpfm8vFH.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-BqrbHL2-.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-BqrbHL2-.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-BqrbHL2-.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-BqrbHL2-.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";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
1
|
import "../../api-DGKJDAfb.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../_class/index.mjs";
|
|
3
3
|
import { get } from "../../axios/index.mjs";
|
|
4
4
|
import { onePasswordClient } from "../../onePassword/server/index.mjs";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
1
|
import "../../api-DGKJDAfb.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../_class/index.mjs";
|
|
3
3
|
import { get } from "../../axios/index.mjs";
|
|
4
4
|
import { onePasswordClient } from "../../onePassword/server/index.mjs";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
1
|
import "../../api-DGKJDAfb.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../_class/index.mjs";
|
|
3
3
|
import { post } from "../../axios/index.mjs";
|
|
4
4
|
import { onePasswordClient } from "../../onePassword/server/index.mjs";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
1
|
import "../../api-DGKJDAfb.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../_class/index.mjs";
|
|
3
3
|
import { post } from "../../axios/index.mjs";
|
|
4
4
|
import { onePasswordClient } from "../../onePassword/server/index.mjs";
|
|
5
5
|
import { DateTime } from "luxon";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
1
|
import "../../api-DGKJDAfb.mjs";
|
|
2
|
+
import { BaseNamespace } from "../../_class/index.mjs";
|
|
3
3
|
import { post } from "../../axios/index.mjs";
|
|
4
4
|
import { onePasswordClient } from "../../onePassword/server/index.mjs";
|
|
5
5
|
|
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.38",
|
|
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-logs": "^3.0.0",
|
|
25
26
|
"@aws-sdk/client-ec2": "^3.0.0",
|
|
26
27
|
"@aws-sdk/client-ecs": "^3.0.0",
|
|
27
28
|
"@aws-sdk/client-glue": "^3.0.0",
|
|
@@ -56,6 +57,9 @@
|
|
|
56
57
|
"@1password/sdk": {
|
|
57
58
|
"optional": true
|
|
58
59
|
},
|
|
60
|
+
"@aws-sdk/client-cloudwatch-logs": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
59
63
|
"@aws-sdk/client-ec2": {
|
|
60
64
|
"optional": true
|
|
61
65
|
},
|
|
@@ -143,6 +147,7 @@
|
|
|
143
147
|
},
|
|
144
148
|
"devDependencies": {
|
|
145
149
|
"@1password/sdk": "^0.4.0",
|
|
150
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.992.0",
|
|
146
151
|
"@aws-sdk/client-ec2": "^3.992.0",
|
|
147
152
|
"@aws-sdk/client-ecs": "^3.992.0",
|
|
148
153
|
"@aws-sdk/client-glue": "^3.992.0",
|
|
@@ -198,6 +203,7 @@
|
|
|
198
203
|
"./api": "./dist/api/index.mjs",
|
|
199
204
|
"./array": "./dist/array/index.mjs",
|
|
200
205
|
"./atInternet": "./dist/atInternet/index.mjs",
|
|
206
|
+
"./aws/cloudWatch/server": "./dist/aws/cloudWatch/server/index.mjs",
|
|
201
207
|
"./aws/ec2/server": "./dist/aws/ec2/server/index.mjs",
|
|
202
208
|
"./aws/ecs/server": "./dist/aws/ecs/server/index.mjs",
|
|
203
209
|
"./aws/glue/server": "./dist/aws/glue/server/index.mjs",
|
|
File without changes
|
|
File without changes
|