@8ms/helpers 2.0.37 → 2.0.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/.yarn/install-state.gz +0 -0
- package/aws/ec2/AwsEc2Namespace.d.ts +2 -2
- package/aws/ecs/AwsEcsNamespace.d.ts +2 -2
- package/aws/glue/AwsGlueNamespace.d.ts +2 -2
- package/aws/lambda/AwsLambdaNamespace.d.ts +2 -2
- package/aws/s3/AwsS3Namespace.d.ts +2 -2
- package/aws/ses/AwsSesNamespace.d.ts +2 -2
- package/aws/sqs/AwsSqsNamespace.d.ts +2 -2
- package/aws/ssm/AwsSsmNamespace.d.ts +2 -2
- package/google/bigQuery/GoogleBigQueryNamespace.d.ts +6 -4
- package/google/bigQuery/GoogleBigQueryNamespace.js +7 -8
- package/google/bigQuery/server.d.ts +1 -1
- package/google/bigQuery/server.js +15 -4
- package/google/sheets/GoogleSheetsNamespace.d.ts +2 -2
- package/google/storage/GoogleCloudStorageNamespace.d.ts +2 -2
- package/googleAds/GoogleAdsNamespace.d.ts +2 -2
- package/googlePageSpeed/GooglePageSpeedNamespace.d.ts +2 -2
- package/littleWarden/LittleWardenNamespace.d.ts +2 -2
- package/onePassword/OnePasswordNamespace.d.ts +2 -2
- package/openAi/OpenAiNamespace.d.ts +2 -2
- package/package.json +1 -1
- package/snapchat/SnapchatNamespace.d.ts +2 -2
- package/upTimeRobot/UpTimeRobotNamespace.d.ts +2 -2
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -2,8 +2,8 @@ import { BaseNamespace } from "../../_class";
|
|
|
2
2
|
import { AwsConfig } from "../server";
|
|
3
3
|
import type { EC2Client } from "@aws-sdk/client-ec2";
|
|
4
4
|
export declare class AwsEc2Namespace extends BaseNamespace {
|
|
5
|
-
client: EC2Client
|
|
6
|
-
config: AwsConfig
|
|
5
|
+
client: EC2Client;
|
|
6
|
+
config: AwsConfig;
|
|
7
7
|
ensureInit: () => Promise<void>;
|
|
8
8
|
startInstances: (instanceIds: string[], additionalInfo?: string, dryRun?: boolean) => Promise<any>;
|
|
9
9
|
stopInstances: (instanceIds: string[], hibernate?: boolean, force?: boolean, dryRun?: boolean) => Promise<any>;
|
|
@@ -25,8 +25,8 @@ type RunTaskProps = {
|
|
|
25
25
|
taskDefinition?: string;
|
|
26
26
|
};
|
|
27
27
|
export declare class AwsEcsNamespace extends BaseNamespace {
|
|
28
|
-
client: ECSClient
|
|
29
|
-
config: AwsConfig
|
|
28
|
+
client: ECSClient;
|
|
29
|
+
config: AwsConfig;
|
|
30
30
|
ensureInit: () => Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListClustersCommand/
|
|
@@ -2,8 +2,8 @@ import { BaseNamespace } from "../../_class";
|
|
|
2
2
|
import { AwsConfig } from "../server";
|
|
3
3
|
import type { GlueClient } from "@aws-sdk/client-glue";
|
|
4
4
|
export declare class AwsGlueNamespace extends BaseNamespace {
|
|
5
|
-
client: GlueClient
|
|
6
|
-
config: AwsConfig
|
|
5
|
+
client: GlueClient;
|
|
6
|
+
config: AwsConfig;
|
|
7
7
|
ensureInit: () => Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Invoke an AWS Glue Crawler by passing in the name of the Crawler.
|
|
@@ -8,8 +8,8 @@ type InvokeProps = {
|
|
|
8
8
|
payload?: object;
|
|
9
9
|
};
|
|
10
10
|
export declare class AwsLambdaNamespace extends BaseNamespace {
|
|
11
|
-
client: LambdaClient
|
|
12
|
-
config: AwsConfig
|
|
11
|
+
client: LambdaClient;
|
|
12
|
+
config: AwsConfig;
|
|
13
13
|
ensureInit: () => Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Invoke a AWS Lambda function by passing in the Function name and optional Payload data.
|
|
@@ -16,8 +16,8 @@ type WritePresignedPostProps = {
|
|
|
16
16
|
url: string;
|
|
17
17
|
};
|
|
18
18
|
export declare class AwsS3Namespace extends BaseNamespace {
|
|
19
|
-
client: S3Client
|
|
20
|
-
config: AwsConfig
|
|
19
|
+
client: S3Client;
|
|
20
|
+
config: AwsConfig;
|
|
21
21
|
ensureInit: () => Promise<void>;
|
|
22
22
|
copy: (fromBucket: string, fromKey: string, toBucket: string, toKey: string) => Promise<void>;
|
|
23
23
|
deleteFile: (bucket: string, key: string) => Promise<void>;
|
|
@@ -2,8 +2,8 @@ import { BaseNamespace } from "../../_class";
|
|
|
2
2
|
import { AwsConfig } from "../server";
|
|
3
3
|
import type { SendEmailCommandInput, SESClient } from "@aws-sdk/client-ses";
|
|
4
4
|
export declare class AwsSesNamespace extends BaseNamespace {
|
|
5
|
-
client: SESClient
|
|
6
|
-
config: AwsConfig
|
|
5
|
+
client: SESClient;
|
|
6
|
+
config: AwsConfig;
|
|
7
7
|
ensureInit: () => Promise<void>;
|
|
8
8
|
send: (input: SendEmailCommandInput) => Promise<any>;
|
|
9
9
|
}
|
|
@@ -24,8 +24,8 @@ type AddToQueue = {
|
|
|
24
24
|
queueUrl: string;
|
|
25
25
|
};
|
|
26
26
|
export declare class AwsSqsNamespace extends BaseNamespace {
|
|
27
|
-
client: SQSClient
|
|
28
|
-
config: AwsConfig
|
|
27
|
+
client: SQSClient;
|
|
28
|
+
config: AwsConfig;
|
|
29
29
|
ensureInit: () => Promise<void>;
|
|
30
30
|
addToQueue: (props: AddToQueue) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
|
|
31
31
|
deleteFromQueue: (queueUrl: string, recipientHandle: string) => Promise<import("@aws-sdk/client-sqs").DeleteMessageCommandOutput>;
|
|
@@ -2,8 +2,8 @@ import { BaseNamespace } from "../../_class";
|
|
|
2
2
|
import { AwsConfig } from "../server";
|
|
3
3
|
import type { SSMClient } from "@aws-sdk/client-ssm";
|
|
4
4
|
export declare class AwsSsmNamespace extends BaseNamespace {
|
|
5
|
-
client: SSMClient
|
|
6
|
-
config: AwsConfig
|
|
5
|
+
client: SSMClient;
|
|
6
|
+
config: AwsConfig;
|
|
7
7
|
parameters: Map<string, any>;
|
|
8
8
|
constructor(key: string, config: any);
|
|
9
9
|
ensureInit: () => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../_class";
|
|
2
|
-
import type { BigQuery, QueryOptions } from "@google-cloud/bigquery";
|
|
2
|
+
import type { BigQuery, DatasetResource, QueryOptions } from "@google-cloud/bigquery";
|
|
3
3
|
import { GoogleCloudConfig } from "../server";
|
|
4
4
|
export type QueryInput = string | {
|
|
5
5
|
query: string;
|
|
@@ -15,14 +15,16 @@ type Tables = {
|
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
17
|
export declare class GoogleBigQueryNamespace extends BaseNamespace {
|
|
18
|
-
client: BigQuery
|
|
19
|
-
config: GoogleCloudConfig
|
|
18
|
+
client: BigQuery;
|
|
19
|
+
config: GoogleCloudConfig & {
|
|
20
|
+
defaultProjectId: string;
|
|
21
|
+
};
|
|
20
22
|
ensureInit: () => Promise<void>;
|
|
21
23
|
/**
|
|
22
24
|
* Create a Dataset if it doesn't already exist.
|
|
23
25
|
* Returns table instance.
|
|
24
26
|
*/
|
|
25
|
-
createDataset: (datasetId: string, options?:
|
|
27
|
+
createDataset: (datasetId: string, options?: DatasetResource) => Promise<void>;
|
|
26
28
|
/**
|
|
27
29
|
* Check to see whether a given BigQuery dataset exists.
|
|
28
30
|
* Based off:
|
|
@@ -44,8 +44,10 @@ class GoogleBigQueryNamespace extends _class_1.BaseNamespace {
|
|
|
44
44
|
try {
|
|
45
45
|
const { BigQuery } = await Promise.resolve().then(() => __importStar(require("@google-cloud/bigquery")));
|
|
46
46
|
const formattedConfig = (0, server_1.getConfig)(this.config);
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
this.client = new BigQuery({
|
|
48
|
+
...formattedConfig,
|
|
49
|
+
projectId: this.config.defaultProjectId,
|
|
50
|
+
});
|
|
49
51
|
}
|
|
50
52
|
catch (e) {
|
|
51
53
|
throw new Error("Google BigQuery Client not installed");
|
|
@@ -60,7 +62,8 @@ class GoogleBigQueryNamespace extends _class_1.BaseNamespace {
|
|
|
60
62
|
await this.ensureInit();
|
|
61
63
|
const datasetExists = await this.datasetExists(datasetId);
|
|
62
64
|
if (!datasetExists) {
|
|
63
|
-
await this.client
|
|
65
|
+
await this.client
|
|
66
|
+
.createDataset(datasetId);
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
/**
|
|
@@ -103,11 +106,7 @@ class GoogleBigQueryNamespace extends _class_1.BaseNamespace {
|
|
|
103
106
|
await this.ensureInit();
|
|
104
107
|
let queryString = "string" === typeof props ? props : props.query;
|
|
105
108
|
let options = "string" === typeof props ? {} : props?.params;
|
|
106
|
-
const apiResponse = await this.client.query(
|
|
107
|
-
query: queryString,
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
options,
|
|
110
|
-
});
|
|
109
|
+
const apiResponse = await this.client.query(queryString, options);
|
|
111
110
|
return apiResponse;
|
|
112
111
|
};
|
|
113
112
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GoogleBigQueryNamespace } from "./GoogleBigQueryNamespace";
|
|
2
2
|
import type { GoogleAuthOptions } from "@google-cloud/common";
|
|
3
|
-
export declare const googleBigQueryClient: (key?: string, config?: GoogleAuthOptions, vaultId?: string, itemId?: string) => Promise<GoogleBigQueryNamespace>;
|
|
3
|
+
export declare const googleBigQueryClient: (defaultProjectId: string, key?: string, config?: GoogleAuthOptions, vaultId?: string, itemId?: string) => Promise<GoogleBigQueryNamespace>;
|
|
4
4
|
export declare const getHandlerPath: (input: string) => string;
|
|
5
5
|
export { loadData } from "./loadData";
|
|
6
6
|
export type { QueryInput } from "./GoogleBigQueryNamespace";
|
|
@@ -4,21 +4,32 @@ exports.loadData = exports.getHandlerPath = exports.googleBigQueryClient = void
|
|
|
4
4
|
const GoogleBigQueryNamespace_1 = require("./GoogleBigQueryNamespace");
|
|
5
5
|
const server_1 = require("../../onePassword/server");
|
|
6
6
|
const googleBigQueryNamespaces = new Map();
|
|
7
|
-
const googleBigQueryClient = async (key = "default", config, vaultId, itemId) => {
|
|
7
|
+
const googleBigQueryClient = async (defaultProjectId, key = "default", config, vaultId, itemId) => {
|
|
8
8
|
if (googleBigQueryNamespaces.has(key)) {
|
|
9
9
|
return googleBigQueryNamespaces.get(key);
|
|
10
10
|
}
|
|
11
11
|
let instanceConfig;
|
|
12
12
|
if (config) {
|
|
13
|
-
instanceConfig =
|
|
13
|
+
instanceConfig = {
|
|
14
|
+
...config,
|
|
15
|
+
defaultProjectId,
|
|
16
|
+
};
|
|
14
17
|
}
|
|
15
18
|
else if (vaultId && itemId) {
|
|
16
|
-
|
|
19
|
+
const onePasswordConfig = await (await (0, server_1.onePasswordClient)())
|
|
17
20
|
.getJsonNote(vaultId, itemId);
|
|
21
|
+
instanceConfig = {
|
|
22
|
+
...onePasswordConfig,
|
|
23
|
+
defaultProjectId,
|
|
24
|
+
};
|
|
18
25
|
}
|
|
19
26
|
else if ("default" === key && process.env.GOOGLE_CLOUD_VAULT_ID && process.env.GOOGLE_CLOUD_ITEM_ID) {
|
|
20
|
-
|
|
27
|
+
const onePasswordConfig = await (await (0, server_1.onePasswordClient)())
|
|
21
28
|
.getJsonNote(process.env.GOOGLE_CLOUD_VAULT_ID, process.env.GOOGLE_CLOUD_ITEM_ID);
|
|
29
|
+
instanceConfig = {
|
|
30
|
+
...onePasswordConfig,
|
|
31
|
+
defaultProjectId,
|
|
32
|
+
};
|
|
22
33
|
}
|
|
23
34
|
else {
|
|
24
35
|
throw new Error(`Config required for namespace '${key}'`);
|
|
@@ -8,8 +8,8 @@ type GetBatchDataProps = {
|
|
|
8
8
|
valueRender?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare class GoogleSheetsNamespace extends BaseNamespace {
|
|
11
|
-
client: GoogleAuth
|
|
12
|
-
config: GoogleCloudConfig
|
|
11
|
+
client: GoogleAuth;
|
|
12
|
+
config: GoogleCloudConfig;
|
|
13
13
|
ensureInit: () => Promise<void>;
|
|
14
14
|
getBatchData: (props: GetBatchDataProps) => Promise<import("@googleapis/sheets").sheets_v4.Schema$BatchGetValuesResponse>;
|
|
15
15
|
}
|
|
@@ -2,8 +2,8 @@ import { BaseNamespace } from "../../_class";
|
|
|
2
2
|
import type { Storage } from "@google-cloud/storage";
|
|
3
3
|
import { GoogleCloudConfig } from "../server";
|
|
4
4
|
export declare class GoogleCloudStorageNamespace extends BaseNamespace {
|
|
5
|
-
client: Storage
|
|
6
|
-
config: GoogleCloudConfig
|
|
5
|
+
client: Storage;
|
|
6
|
+
config: GoogleCloudConfig;
|
|
7
7
|
ensureInit: () => Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* Copy a local file to Google Cloud Storage.
|
|
@@ -2,8 +2,8 @@ import { BaseNamespace } from "../_class";
|
|
|
2
2
|
import type { GoogleAdsApi } from "google-ads-api";
|
|
3
3
|
import { Config } from "./server";
|
|
4
4
|
export declare class GoogleAdsNamespace extends BaseNamespace {
|
|
5
|
-
client: GoogleAdsApi
|
|
6
|
-
config: Config
|
|
5
|
+
client: GoogleAdsApi;
|
|
6
|
+
config: Config;
|
|
7
7
|
mccAccountId: string;
|
|
8
8
|
refreshToken: string;
|
|
9
9
|
ensureInit: () => Promise<void>;
|
|
@@ -4,8 +4,8 @@ import { Category, GooglePageSpeedConfig, Strategy } from "./server";
|
|
|
4
4
|
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
5
5
|
*/
|
|
6
6
|
export declare class GooglePageSpeedNamespace extends BaseNamespace {
|
|
7
|
-
client: boolean
|
|
8
|
-
config: GooglePageSpeedConfig
|
|
7
|
+
client: boolean;
|
|
8
|
+
config: GooglePageSpeedConfig;
|
|
9
9
|
ensureInit: () => Promise<void>;
|
|
10
10
|
getReport: (url: string, category?: Category, strategy?: Strategy) => Promise<any>;
|
|
11
11
|
}
|
|
@@ -4,8 +4,8 @@ import { LittleWardenConfig } from "./server";
|
|
|
4
4
|
* Based on https://developers.google.com/speed/docs/insights/rest/v5/pagespeedapi/runpagespeed
|
|
5
5
|
*/
|
|
6
6
|
export declare class LittleWardenNamespace extends BaseNamespace {
|
|
7
|
-
client: boolean
|
|
8
|
-
config: LittleWardenConfig
|
|
7
|
+
client: boolean;
|
|
8
|
+
config: LittleWardenConfig;
|
|
9
9
|
ensureInit: () => Promise<void>;
|
|
10
10
|
getReport: (urlId: string) => Promise<any>;
|
|
11
11
|
}
|
|
@@ -2,8 +2,8 @@ import { OnePasswordConfig } from "./server";
|
|
|
2
2
|
import { BaseNamespace } from "../_class";
|
|
3
3
|
import type { Client } from "@1password/sdk";
|
|
4
4
|
export declare class OnePasswordNamespace extends BaseNamespace {
|
|
5
|
-
client: Client
|
|
6
|
-
config: OnePasswordConfig
|
|
5
|
+
client: Client;
|
|
6
|
+
config: OnePasswordConfig;
|
|
7
7
|
ensureInit: () => Promise<void>;
|
|
8
8
|
listVaults: () => Promise<import("@1password/sdk").VaultOverview[]>;
|
|
9
9
|
getItem: (vaultId: string, itemId: string) => Promise<import("@1password/sdk").Item>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OpenAiConfig } from "./server";
|
|
2
2
|
import { BaseNamespace } from "../_class";
|
|
3
3
|
export declare class OpenAiNamespace extends BaseNamespace {
|
|
4
|
-
client: boolean
|
|
5
|
-
config: OpenAiConfig
|
|
4
|
+
client: boolean;
|
|
5
|
+
config: OpenAiConfig;
|
|
6
6
|
/**
|
|
7
7
|
* Renew the access token as it expires every 3 hours.
|
|
8
8
|
*/
|
package/package.json
CHANGED
|
@@ -5,8 +5,8 @@ type Client = {
|
|
|
5
5
|
refreshToken: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class SnapchatNamespace extends BaseNamespace {
|
|
8
|
-
client: Client
|
|
9
|
-
config: SnapchatConfig
|
|
8
|
+
client: Client;
|
|
9
|
+
config: SnapchatConfig;
|
|
10
10
|
/**
|
|
11
11
|
* Renew the access token as it expires every 3 hours.
|
|
12
12
|
*/
|
|
@@ -20,8 +20,8 @@ type GetReportProps = {
|
|
|
20
20
|
* https://uptimerobot.com/api/
|
|
21
21
|
*/
|
|
22
22
|
export declare class UpTimeRobotNamespace extends BaseNamespace {
|
|
23
|
-
client: boolean
|
|
24
|
-
config: UpTimeRobotConfig
|
|
23
|
+
client: boolean;
|
|
24
|
+
config: UpTimeRobotConfig;
|
|
25
25
|
/**
|
|
26
26
|
* Renew the access token as it expires every 3 hours.
|
|
27
27
|
*/
|