@8ms/helpers 1.42.6 → 1.42.8
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/athenaExpress/initClient.cjs +3 -3
- package/dist/aws/athenaExpress/initClient.mjs +3 -4
- package/dist/aws/ec2/initClient.cjs +2 -2
- package/dist/aws/ec2/initClient.d.cts +1 -1
- package/dist/aws/ec2/initClient.d.mts +1 -1
- package/dist/aws/ec2/initClient.mjs +2 -3
- package/dist/aws/ec2/startInstances.cjs +1 -1
- package/dist/aws/ec2/startInstances.mjs +1 -2
- package/dist/aws/ec2/stopInstances.cjs +1 -1
- package/dist/aws/ec2/stopInstances.mjs +1 -2
- package/dist/aws/ecs/getClusters.cjs +1 -1
- package/dist/aws/ecs/getClusters.mjs +1 -2
- package/dist/aws/ecs/getTaskDefinitions.cjs +1 -1
- package/dist/aws/ecs/getTaskDefinitions.mjs +1 -2
- package/dist/aws/ecs/getTasks.cjs +1 -1
- package/dist/aws/ecs/getTasks.mjs +1 -2
- package/dist/aws/ecs/initClient.cjs +2 -2
- package/dist/aws/ecs/initClient.d.cts +1 -1
- package/dist/aws/ecs/initClient.d.mts +1 -1
- package/dist/aws/ecs/initClient.mjs +2 -3
- package/dist/aws/ecs/runTask.cjs +1 -1
- package/dist/aws/ecs/runTask.mjs +1 -2
- package/dist/aws/glue/initClient.cjs +2 -2
- package/dist/aws/glue/initClient.d.cts +1 -1
- package/dist/aws/glue/initClient.d.mts +1 -1
- package/dist/aws/glue/initClient.mjs +2 -3
- package/dist/aws/glue/invoke.cjs +1 -1
- package/dist/aws/glue/invoke.mjs +1 -2
- package/dist/aws/lambda/initClient.cjs +2 -2
- package/dist/aws/lambda/initClient.d.cts +1 -1
- package/dist/aws/lambda/initClient.d.mts +1 -1
- package/dist/aws/lambda/initClient.mjs +2 -3
- package/dist/aws/lambda/invoke.cjs +1 -1
- package/dist/aws/lambda/invoke.mjs +1 -2
- package/dist/aws/s3/copyFile.cjs +1 -1
- package/dist/aws/s3/copyFile.mjs +1 -2
- package/dist/aws/s3/deleteFile.cjs +1 -1
- package/dist/aws/s3/deleteFile.mjs +1 -2
- package/dist/aws/s3/deleteFiles.cjs +1 -1
- package/dist/aws/s3/deleteFiles.mjs +1 -2
- package/dist/aws/s3/deleteFolder.cjs +1 -1
- package/dist/aws/s3/deleteFolder.mjs +1 -2
- package/dist/aws/s3/getPresignedPost.cjs +1 -1
- package/dist/aws/s3/getPresignedPost.mjs +1 -2
- package/dist/aws/s3/getSignedUrl.cjs +2 -2
- package/dist/aws/s3/getSignedUrl.d.cts +1 -3
- package/dist/aws/s3/getSignedUrl.d.mts +1 -3
- package/dist/aws/s3/getSignedUrl.mjs +2 -3
- package/dist/aws/s3/initClient.cjs +2 -2
- package/dist/aws/s3/initClient.d.cts +1 -1
- package/dist/aws/s3/initClient.d.mts +1 -1
- package/dist/aws/s3/initClient.mjs +2 -3
- package/dist/aws/s3/isFileExists.cjs +1 -1
- package/dist/aws/s3/isFileExists.mjs +1 -2
- package/dist/aws/s3/listFiles.cjs +1 -1
- package/dist/aws/s3/listFiles.mjs +1 -2
- package/dist/aws/s3/listFolders.cjs +1 -1
- package/dist/aws/s3/listFolders.mjs +1 -2
- package/dist/aws/s3/readBuffer.cjs +1 -1
- package/dist/aws/s3/readBuffer.mjs +1 -2
- package/dist/aws/s3/readFile.cjs +1 -1
- package/dist/aws/s3/readFile.mjs +1 -2
- package/dist/aws/s3/writeFile.cjs +1 -1
- package/dist/aws/s3/writeFile.mjs +1 -2
- package/dist/aws/ses/SimpleEmail.cjs +1 -1
- package/dist/aws/ses/SimpleEmail.mjs +1 -2
- package/dist/aws/ses/initClient.cjs +2 -2
- package/dist/aws/ses/initClient.d.cts +1 -1
- package/dist/aws/ses/initClient.d.mts +1 -1
- package/dist/aws/ses/initClient.mjs +2 -3
- package/dist/aws/sqs/addToQueue.cjs +1 -1
- package/dist/aws/sqs/addToQueue.mjs +1 -2
- package/dist/aws/sqs/deleteFromQueue.cjs +1 -1
- package/dist/aws/sqs/deleteFromQueue.mjs +1 -2
- package/dist/aws/sqs/initClient.cjs +2 -2
- package/dist/aws/sqs/initClient.d.cts +1 -1
- package/dist/aws/sqs/initClient.d.mts +1 -1
- package/dist/aws/sqs/initClient.mjs +2 -3
- package/dist/aws/ssm/getParameter.cjs +1 -1
- package/dist/aws/ssm/getParameter.mjs +1 -2
- package/dist/aws/ssm/initClient.cjs +2 -2
- package/dist/aws/ssm/initClient.d.cts +1 -1
- package/dist/aws/ssm/initClient.d.mts +1 -1
- package/dist/aws/ssm/initClient.mjs +2 -3
- package/dist/crypto/getDecrypt.cjs +2 -2
- package/dist/crypto/getDecrypt.d.cts +1 -1
- package/dist/crypto/getDecrypt.d.mts +1 -1
- package/dist/crypto/getDecrypt.mjs +2 -3
- package/dist/crypto/getEncrypt.cjs +2 -2
- package/dist/crypto/getEncrypt.d.cts +1 -1
- package/dist/crypto/getEncrypt.d.mts +1 -1
- package/dist/crypto/getEncrypt.mjs +2 -3
- package/dist/crypto/getSha256.cjs +2 -2
- package/dist/crypto/getSha256.d.cts +1 -1
- package/dist/crypto/getSha256.d.mts +1 -1
- package/dist/crypto/getSha256.mjs +2 -3
- package/dist/file/createDirectory.cjs +2 -2
- package/dist/file/createDirectory.mjs +2 -3
- package/dist/google/bigQuery/getClient.cjs +2 -2
- package/dist/google/bigQuery/getClient.d.cts +1 -1
- package/dist/google/bigQuery/getClient.d.mts +1 -1
- package/dist/google/bigQuery/getClient.mjs +2 -3
- package/dist/google/bigQuery/initClient.cjs +2 -2
- package/dist/google/bigQuery/initClient.d.cts +1 -1
- package/dist/google/bigQuery/initClient.d.mts +1 -1
- package/dist/google/bigQuery/initClient.mjs +2 -3
- package/dist/google/sheets/getBatchData.cjs +1 -1
- package/dist/google/sheets/getBatchData.mjs +1 -2
- package/dist/google/sheets/initClient.cjs +2 -2
- package/dist/google/sheets/initClient.d.cts +1 -1
- package/dist/google/sheets/initClient.d.mts +1 -1
- package/dist/google/sheets/initClient.mjs +2 -3
- package/dist/google/storage/copyToCloud.cjs +1 -1
- package/dist/google/storage/copyToCloud.mjs +1 -1
- package/dist/google/storage/getClient.cjs +2 -3
- package/dist/google/storage/getClient.d.cts +1 -1
- package/dist/google/storage/getClient.d.mts +1 -1
- package/dist/google/storage/getClient.mjs +2 -4
- package/dist/google/storage/initClient.cjs +2 -2
- package/dist/google/storage/initClient.d.cts +1 -1
- package/dist/google/storage/initClient.d.mts +1 -1
- package/dist/google/storage/initClient.mjs +2 -3
- package/dist/google/storage/isFileExists.cjs +1 -1
- package/dist/google/storage/isFileExists.mjs +1 -1
- package/dist/google/storage/writeFile.cjs +2 -2
- package/dist/google/storage/writeFile.mjs +2 -3
- package/dist/googleAds/initClient.cjs +1 -1
- package/dist/googleAds/initClient.mjs +1 -2
- package/dist/initClients.cjs +16 -16
- package/dist/initClients.d.cts +1 -1
- package/dist/initClients.d.mts +1 -1
- package/dist/initClients.mjs +16 -16
- package/dist/prisma/initClient.cjs +4 -4
- package/dist/prisma/initClient.d.cts +1 -1
- package/dist/prisma/initClient.d.mts +1 -1
- package/dist/prisma/initClient.mjs +4 -5
- package/dist/util/getBrotliCompressed.cjs +2 -2
- package/dist/util/getBrotliCompressed.mjs +2 -3
- package/dist/util/getBrotliDecompressed.cjs +2 -2
- package/dist/util/getBrotliDecompressed.mjs +2 -3
- package/dist/util/getGzipCompressed.cjs +2 -2
- package/dist/util/getGzipCompressed.mjs +2 -3
- package/dist/util/getGzipDecompressed.cjs +2 -2
- package/dist/util/getGzipDecompressed.mjs +2 -3
- package/package.json +6 -1
- package/tsdown.config.ts +0 -3
|
@@ -9,9 +9,9 @@ global.googleBigQueryClient = null;
|
|
|
9
9
|
* Initialise the Big Query client.
|
|
10
10
|
* It's possible to use multiple clients, so we set one up per project id.
|
|
11
11
|
*/
|
|
12
|
-
const initClient = ({ parameter, projectId }) => {
|
|
12
|
+
const initClient = async ({ parameter, projectId }) => {
|
|
13
13
|
if (!global.googleBigQueryClient) {
|
|
14
|
-
const { BigQuery } =
|
|
14
|
+
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
15
15
|
const formattedConfig = require_google_getConfig({ parameter });
|
|
16
16
|
global.googleBigQueryDefault.credentials = formattedConfig;
|
|
17
17
|
global.googleBigQueryDefault.projectId = projectId;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import getConfig from "../getConfig.mjs";
|
|
3
2
|
//#region src/google/bigQuery/initClient.ts
|
|
4
3
|
global.googleBigQueryDefault = {
|
|
@@ -10,9 +9,9 @@ global.googleBigQueryClient = null;
|
|
|
10
9
|
* Initialise the Big Query client.
|
|
11
10
|
* It's possible to use multiple clients, so we set one up per project id.
|
|
12
11
|
*/
|
|
13
|
-
const initClient = ({ parameter, projectId }) => {
|
|
12
|
+
const initClient = async ({ parameter, projectId }) => {
|
|
14
13
|
if (!global.googleBigQueryClient) {
|
|
15
|
-
const { BigQuery } =
|
|
14
|
+
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
16
15
|
const formattedConfig = getConfig({ parameter });
|
|
17
16
|
global.googleBigQueryDefault.credentials = formattedConfig;
|
|
18
17
|
global.googleBigQueryDefault.projectId = projectId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/google/sheets/getBatchData.ts
|
|
2
2
|
const getBatchData = async ({ spreadsheetId, ranges, dateTimeRender = "FORMATTED_STRING", valueRender = "UNFORMATTED_VALUE" }) => {
|
|
3
|
-
const googleApisSheets =
|
|
3
|
+
const googleApisSheets = await import("@googleapis/sheets");
|
|
4
4
|
const request = {
|
|
5
5
|
auth: global.googleSheetsClient,
|
|
6
6
|
dateTimeRenderOption: dateTimeRender,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/google/sheets/getBatchData.ts
|
|
3
2
|
const getBatchData = async ({ spreadsheetId, ranges, dateTimeRender = "FORMATTED_STRING", valueRender = "UNFORMATTED_VALUE" }) => {
|
|
4
|
-
const googleApisSheets =
|
|
3
|
+
const googleApisSheets = await import("@googleapis/sheets");
|
|
5
4
|
const request = {
|
|
6
5
|
auth: global.googleSheetsClient,
|
|
7
6
|
dateTimeRenderOption: dateTimeRender,
|
|
@@ -6,9 +6,9 @@ global.googleSheetsClient = null;
|
|
|
6
6
|
* https://github.com/googleapis/google-api-nodejs-client
|
|
7
7
|
* Library: @googleapis/sheets
|
|
8
8
|
*/
|
|
9
|
-
const initClient = ({ parameter }) => {
|
|
9
|
+
const initClient = async ({ parameter }) => {
|
|
10
10
|
if (!global.googleSheetsClient) {
|
|
11
|
-
const googleApisSheets =
|
|
11
|
+
const googleApisSheets = await import("@googleapis/sheets");
|
|
12
12
|
const formattedConfig = require_google_getConfig({ parameter });
|
|
13
13
|
global.googleSheetsClient = new googleApisSheets.auth.GoogleAuth({
|
|
14
14
|
credentials: formattedConfig,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import getConfig from "../getConfig.mjs";
|
|
3
2
|
//#region src/google/sheets/initClient.ts
|
|
4
3
|
global.googleSheetsClient = null;
|
|
@@ -7,9 +6,9 @@ global.googleSheetsClient = null;
|
|
|
7
6
|
* https://github.com/googleapis/google-api-nodejs-client
|
|
8
7
|
* Library: @googleapis/sheets
|
|
9
8
|
*/
|
|
10
|
-
const initClient = ({ parameter }) => {
|
|
9
|
+
const initClient = async ({ parameter }) => {
|
|
11
10
|
if (!global.googleSheetsClient) {
|
|
12
|
-
const googleApisSheets =
|
|
11
|
+
const googleApisSheets = await import("@googleapis/sheets");
|
|
13
12
|
const formattedConfig = getConfig({ parameter });
|
|
14
13
|
global.googleSheetsClient = new googleApisSheets.auth.GoogleAuth({
|
|
15
14
|
credentials: formattedConfig,
|
|
@@ -8,7 +8,7 @@ const require_google_storage_getClient = require("./getClient.cjs");
|
|
|
8
8
|
* Copy a local file to Google Cloud Storage.
|
|
9
9
|
*/
|
|
10
10
|
const copyToCloud = async ({ bucket, localFile, options, projectId }) => {
|
|
11
|
-
return await require_google_storage_getClient({ projectId }).bucket(bucket).upload(localFile, options);
|
|
11
|
+
return await (await require_google_storage_getClient({ projectId })).bucket(bucket).upload(localFile, options);
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
exports.copyToCloud = copyToCloud;
|
|
@@ -4,7 +4,7 @@ import getClient from "./getClient.mjs";
|
|
|
4
4
|
* Copy a local file to Google Cloud Storage.
|
|
5
5
|
*/
|
|
6
6
|
const copyToCloud = async ({ bucket, localFile, options, projectId }) => {
|
|
7
|
-
return await getClient({ projectId }).bucket(bucket).upload(localFile, options);
|
|
7
|
+
return await (await getClient({ projectId })).bucket(bucket).upload(localFile, options);
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
10
10
|
export { copyToCloud, copyToCloud as default };
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Create a new client if the project id differs from the global.
|
|
4
4
|
*/
|
|
5
|
-
const getClient = ({ projectId }) => {
|
|
5
|
+
const getClient = async ({ projectId }) => {
|
|
6
6
|
let client = global.googleStorageClient;
|
|
7
7
|
if (void 0 !== projectId && projectId !== global.googleStorageDefault.projectId) {
|
|
8
|
-
const { Storage } =
|
|
8
|
+
const { Storage } = await import("@google-cloud/storage");
|
|
9
9
|
client = new Storage({
|
|
10
10
|
credentials: global.googleStorageDefault.credentials,
|
|
11
|
-
location: "europe-west2",
|
|
12
11
|
projectId
|
|
13
12
|
});
|
|
14
13
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/google/storage/getClient.ts
|
|
3
2
|
/**
|
|
4
3
|
* Create a new client if the project id differs from the global.
|
|
5
4
|
*/
|
|
6
|
-
const getClient = ({ projectId }) => {
|
|
5
|
+
const getClient = async ({ projectId }) => {
|
|
7
6
|
let client = global.googleStorageClient;
|
|
8
7
|
if (void 0 !== projectId && projectId !== global.googleStorageDefault.projectId) {
|
|
9
|
-
const { Storage } =
|
|
8
|
+
const { Storage } = await import("@google-cloud/storage");
|
|
10
9
|
client = new Storage({
|
|
11
10
|
credentials: global.googleStorageDefault.credentials,
|
|
12
|
-
location: "europe-west2",
|
|
13
11
|
projectId
|
|
14
12
|
});
|
|
15
13
|
}
|
|
@@ -10,9 +10,9 @@ global.googleStorageClient = null;
|
|
|
10
10
|
* https://github.com/googleapis/google-api-nodejs-client
|
|
11
11
|
* Library: @googleapis/sheets
|
|
12
12
|
*/
|
|
13
|
-
const initClient = ({ parameter, projectId }) => {
|
|
13
|
+
const initClient = async ({ parameter, projectId }) => {
|
|
14
14
|
if (!global.googleStorageClient) {
|
|
15
|
-
const { Storage } =
|
|
15
|
+
const { Storage } = await import("@google-cloud/storage");
|
|
16
16
|
const formattedConfig = require_google_getConfig({ parameter });
|
|
17
17
|
global.googleStorageDefault.credentials = formattedConfig;
|
|
18
18
|
global.googleStorageDefault.projectId = projectId;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import getConfig from "../getConfig.mjs";
|
|
3
2
|
//#region src/google/storage/initClient.ts
|
|
4
3
|
global.googleStorageDefault = {
|
|
@@ -11,9 +10,9 @@ global.googleStorageClient = null;
|
|
|
11
10
|
* https://github.com/googleapis/google-api-nodejs-client
|
|
12
11
|
* Library: @googleapis/sheets
|
|
13
12
|
*/
|
|
14
|
-
const initClient = ({ parameter, projectId }) => {
|
|
13
|
+
const initClient = async ({ parameter, projectId }) => {
|
|
15
14
|
if (!global.googleStorageClient) {
|
|
16
|
-
const { Storage } =
|
|
15
|
+
const { Storage } = await import("@google-cloud/storage");
|
|
17
16
|
const formattedConfig = getConfig({ parameter });
|
|
18
17
|
global.googleStorageDefault.credentials = formattedConfig;
|
|
19
18
|
global.googleStorageDefault.projectId = projectId;
|
|
@@ -5,7 +5,7 @@ const require_google_storage_getClient = require("./getClient.cjs");
|
|
|
5
5
|
*/
|
|
6
6
|
const isFileExists = async (props) => {
|
|
7
7
|
const { bucket, key, projectId } = props;
|
|
8
|
-
return (await require_google_storage_getClient({ projectId }).bucket(bucket).file(key).exists()
|
|
8
|
+
return (await require_google_storage_getClient({ projectId })).bucket(bucket).file(key).exists()?.[0];
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
11
11
|
module.exports = isFileExists;
|
|
@@ -5,7 +5,7 @@ import getClient from "./getClient.mjs";
|
|
|
5
5
|
*/
|
|
6
6
|
const isFileExists = async (props) => {
|
|
7
7
|
const { bucket, key, projectId } = props;
|
|
8
|
-
return (await getClient({ projectId }).bucket(bucket).file(key).exists()
|
|
8
|
+
return (await getClient({ projectId })).bucket(bucket).file(key).exists()?.[0];
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
11
11
|
export { isFileExists as default };
|
|
@@ -9,8 +9,8 @@ const require_google_storage_getClient = require("./getClient.cjs");
|
|
|
9
9
|
*/
|
|
10
10
|
const writeFile = async (props) => {
|
|
11
11
|
const { bucket, contentType, data, key, projectId, ...options } = props;
|
|
12
|
-
const dataStream = new (
|
|
13
|
-
const googleFile = require_google_storage_getClient({ projectId }).bucket(bucket).file(key);
|
|
12
|
+
const dataStream = new (await (import("stream"))).PassThrough();
|
|
13
|
+
const googleFile = (await require_google_storage_getClient({ projectId })).bucket(bucket).file(key);
|
|
14
14
|
dataStream.push(data);
|
|
15
15
|
dataStream.push(null);
|
|
16
16
|
return await new Promise((resolve, reject) => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import getClient from "./getClient.mjs";
|
|
3
2
|
//#region src/google/storage/writeFile.ts
|
|
4
3
|
/**
|
|
@@ -6,8 +5,8 @@ import getClient from "./getClient.mjs";
|
|
|
6
5
|
*/
|
|
7
6
|
const writeFile = async (props) => {
|
|
8
7
|
const { bucket, contentType, data, key, projectId, ...options } = props;
|
|
9
|
-
const dataStream = new (
|
|
10
|
-
const googleFile = getClient({ projectId }).bucket(bucket).file(key);
|
|
8
|
+
const dataStream = new (await (import("stream"))).PassThrough();
|
|
9
|
+
const googleFile = (await getClient({ projectId })).bucket(bucket).file(key);
|
|
11
10
|
dataStream.push(data);
|
|
12
11
|
dataStream.push(null);
|
|
13
12
|
return await new Promise((resolve, reject) => {
|
|
@@ -10,7 +10,7 @@ global.googleAdsClient = {
|
|
|
10
10
|
*/
|
|
11
11
|
const initClient = async ({ parameter }) => {
|
|
12
12
|
if (!global.googleAdsClient.instance) {
|
|
13
|
-
const { GoogleAdsApi } =
|
|
13
|
+
const { GoogleAdsApi } = await import("google-ads-api");
|
|
14
14
|
global.googleAdsClient.instance = new GoogleAdsApi({
|
|
15
15
|
client_id: parameter.clientId,
|
|
16
16
|
client_secret: parameter.clientSecret,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/googleAds/initClient.ts
|
|
3
2
|
global.googleAdsClient = {
|
|
4
3
|
instance: null,
|
|
@@ -11,7 +10,7 @@ global.googleAdsClient = {
|
|
|
11
10
|
*/
|
|
12
11
|
const initClient = async ({ parameter }) => {
|
|
13
12
|
if (!global.googleAdsClient.instance) {
|
|
14
|
-
const { GoogleAdsApi } =
|
|
13
|
+
const { GoogleAdsApi } = await import("google-ads-api");
|
|
15
14
|
global.googleAdsClient.instance = new GoogleAdsApi({
|
|
16
15
|
client_id: parameter.clientId,
|
|
17
16
|
client_secret: parameter.clientSecret,
|
package/dist/initClients.cjs
CHANGED
|
@@ -16,38 +16,38 @@ const require_googleAds_initClient = require("./googleAds/initClient.cjs");
|
|
|
16
16
|
const require_prisma_initClient = require("./prisma/initClient.cjs");
|
|
17
17
|
//#region src/initClients.ts
|
|
18
18
|
/**
|
|
19
|
-
* Function to simplify initialising the clients.
|
|
19
|
+
* Function to simplify await initialising the clients.
|
|
20
20
|
*/
|
|
21
21
|
const initClients = async (props) => {
|
|
22
|
-
if (props?.athenaExpress) require_aws_athenaExpress_initClient({
|
|
22
|
+
if (props?.athenaExpress) await require_aws_athenaExpress_initClient({
|
|
23
23
|
config: props.awsConfig,
|
|
24
24
|
database: props.athenaExpress.database,
|
|
25
25
|
s3Bucket: props.athenaExpress.s3Bucket,
|
|
26
26
|
s3Key: props.athenaExpress.s3Key
|
|
27
27
|
});
|
|
28
|
-
if (props?.awsEc2) require_aws_ec2_initClient.initClient({ config: props.awsConfig });
|
|
29
|
-
if (props?.awsEcs) require_aws_ecs_initClient.initClient({ config: props.awsConfig });
|
|
30
|
-
if (props?.awsGlue) require_aws_glue_initClient({ config: props.awsConfig });
|
|
31
|
-
if (props?.awsLambda) require_aws_lambda_initClient({ config: props.awsConfig });
|
|
32
|
-
if (props?.awsS3) require_aws_s3_initClient({ config: props.awsConfig });
|
|
33
|
-
if (props?.awsSes) require_aws_ses_initClient({ config: props.awsConfig });
|
|
34
|
-
if (props?.awsSsm || props?.lumarApi || props?.lumarGraphql || props?.googleAds || props?.googleConfig) require_aws_ssm_initClient({ config: props.awsConfig });
|
|
35
|
-
if (props?.lumarApi) await require_lumar_api_initClient({ auth: await require_aws_ssm_getParameter({ name: props.lumarApi.parameterName }) });
|
|
36
|
-
if (props?.lumarGraphql) await require_lumar_graphql_initClient({ auth: await require_aws_ssm_getParameter({ name: props.lumarGraphql.parameterName }) });
|
|
28
|
+
if (props?.awsEc2) await require_aws_ec2_initClient.initClient({ config: props.awsConfig });
|
|
29
|
+
if (props?.awsEcs) await require_aws_ecs_initClient.initClient({ config: props.awsConfig });
|
|
30
|
+
if (props?.awsGlue) await require_aws_glue_initClient({ config: props.awsConfig });
|
|
31
|
+
if (props?.awsLambda) await require_aws_lambda_initClient({ config: props.awsConfig });
|
|
32
|
+
if (props?.awsS3) await require_aws_s3_initClient({ config: props.awsConfig });
|
|
33
|
+
if (props?.awsSes) await require_aws_ses_initClient({ config: props.awsConfig });
|
|
34
|
+
if (props?.awsSsm || props?.lumarApi || props?.lumarGraphql || props?.googleAds || props?.googleConfig) await require_aws_ssm_initClient({ config: props.awsConfig });
|
|
35
|
+
if (props?.lumarApi) await await require_lumar_api_initClient({ auth: await require_aws_ssm_getParameter({ name: props.lumarApi.parameterName }) });
|
|
36
|
+
if (props?.lumarGraphql) await await require_lumar_graphql_initClient({ auth: await require_aws_ssm_getParameter({ name: props.lumarGraphql.parameterName }) });
|
|
37
37
|
if (props?.googleConfig) {
|
|
38
38
|
const googleParameter = await require_aws_ssm_getParameter({ name: props.googleConfig.parameterName });
|
|
39
|
-
if (props?.googleBigQuery && props?.googleConfig?.projectId) require_google_bigQuery_initClient({
|
|
39
|
+
if (props?.googleBigQuery && props?.googleConfig?.projectId) await require_google_bigQuery_initClient({
|
|
40
40
|
parameter: googleParameter,
|
|
41
41
|
projectId: props.googleConfig.projectId
|
|
42
42
|
});
|
|
43
|
-
if (props?.googleSheets) require_google_sheets_initClient({ parameter: googleParameter });
|
|
44
|
-
if (props?.googleStorage && props?.googleConfig?.projectId) require_google_storage_initClient({
|
|
43
|
+
if (props?.googleSheets) await require_google_sheets_initClient({ parameter: googleParameter });
|
|
44
|
+
if (props?.googleStorage && props?.googleConfig?.projectId) await require_google_storage_initClient({
|
|
45
45
|
parameter: googleParameter,
|
|
46
46
|
projectId: props.googleConfig.projectId
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
if (props?.googleAds) await require_googleAds_initClient({ parameter: await require_aws_ssm_getParameter({ name: props.googleAds.parameterName }) });
|
|
50
|
-
if (props?.prisma) require_prisma_initClient({
|
|
49
|
+
if (props?.googleAds) await await require_googleAds_initClient({ parameter: await require_aws_ssm_getParameter({ name: props.googleAds.parameterName }) });
|
|
50
|
+
if (props?.prisma) await require_prisma_initClient({
|
|
51
51
|
debug: props?.prisma?.debug ?? false,
|
|
52
52
|
planetScale: props?.prisma?.planetScale ?? false
|
|
53
53
|
});
|
package/dist/initClients.d.cts
CHANGED
|
@@ -39,7 +39,7 @@ type InitClients = {
|
|
|
39
39
|
myTarget?: boolean;
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
-
* Function to simplify initialising the clients.
|
|
42
|
+
* Function to simplify await initialising the clients.
|
|
43
43
|
*/
|
|
44
44
|
declare const initClients: (props: InitClients) => Promise<void>;
|
|
45
45
|
export = initClients;
|
package/dist/initClients.d.mts
CHANGED
package/dist/initClients.mjs
CHANGED
|
@@ -16,38 +16,38 @@ import initClient$13 from "./googleAds/initClient.mjs";
|
|
|
16
16
|
import initClient$14 from "./prisma/initClient.mjs";
|
|
17
17
|
//#region src/initClients.ts
|
|
18
18
|
/**
|
|
19
|
-
* Function to simplify initialising the clients.
|
|
19
|
+
* Function to simplify await initialising the clients.
|
|
20
20
|
*/
|
|
21
21
|
const initClients = async (props) => {
|
|
22
|
-
if (props?.athenaExpress) initClient({
|
|
22
|
+
if (props?.athenaExpress) await initClient({
|
|
23
23
|
config: props.awsConfig,
|
|
24
24
|
database: props.athenaExpress.database,
|
|
25
25
|
s3Bucket: props.athenaExpress.s3Bucket,
|
|
26
26
|
s3Key: props.athenaExpress.s3Key
|
|
27
27
|
});
|
|
28
|
-
if (props?.awsEc2) initClient$1({ config: props.awsConfig });
|
|
29
|
-
if (props?.awsEcs) initClient$2({ config: props.awsConfig });
|
|
30
|
-
if (props?.awsGlue) initClient$3({ config: props.awsConfig });
|
|
31
|
-
if (props?.awsLambda) initClient$4({ config: props.awsConfig });
|
|
32
|
-
if (props?.awsS3) initClient$5({ config: props.awsConfig });
|
|
33
|
-
if (props?.awsSes) initClient$6({ config: props.awsConfig });
|
|
34
|
-
if (props?.awsSsm || props?.lumarApi || props?.lumarGraphql || props?.googleAds || props?.googleConfig) initClient$7({ config: props.awsConfig });
|
|
35
|
-
if (props?.lumarApi) await initClient$8({ auth: await getParameter({ name: props.lumarApi.parameterName }) });
|
|
36
|
-
if (props?.lumarGraphql) await initClient$9({ auth: await getParameter({ name: props.lumarGraphql.parameterName }) });
|
|
28
|
+
if (props?.awsEc2) await initClient$1({ config: props.awsConfig });
|
|
29
|
+
if (props?.awsEcs) await initClient$2({ config: props.awsConfig });
|
|
30
|
+
if (props?.awsGlue) await initClient$3({ config: props.awsConfig });
|
|
31
|
+
if (props?.awsLambda) await initClient$4({ config: props.awsConfig });
|
|
32
|
+
if (props?.awsS3) await initClient$5({ config: props.awsConfig });
|
|
33
|
+
if (props?.awsSes) await initClient$6({ config: props.awsConfig });
|
|
34
|
+
if (props?.awsSsm || props?.lumarApi || props?.lumarGraphql || props?.googleAds || props?.googleConfig) await initClient$7({ config: props.awsConfig });
|
|
35
|
+
if (props?.lumarApi) await await initClient$8({ auth: await getParameter({ name: props.lumarApi.parameterName }) });
|
|
36
|
+
if (props?.lumarGraphql) await await initClient$9({ auth: await getParameter({ name: props.lumarGraphql.parameterName }) });
|
|
37
37
|
if (props?.googleConfig) {
|
|
38
38
|
const googleParameter = await getParameter({ name: props.googleConfig.parameterName });
|
|
39
|
-
if (props?.googleBigQuery && props?.googleConfig?.projectId) initClient$10({
|
|
39
|
+
if (props?.googleBigQuery && props?.googleConfig?.projectId) await initClient$10({
|
|
40
40
|
parameter: googleParameter,
|
|
41
41
|
projectId: props.googleConfig.projectId
|
|
42
42
|
});
|
|
43
|
-
if (props?.googleSheets) initClient$11({ parameter: googleParameter });
|
|
44
|
-
if (props?.googleStorage && props?.googleConfig?.projectId) initClient$12({
|
|
43
|
+
if (props?.googleSheets) await initClient$11({ parameter: googleParameter });
|
|
44
|
+
if (props?.googleStorage && props?.googleConfig?.projectId) await initClient$12({
|
|
45
45
|
parameter: googleParameter,
|
|
46
46
|
projectId: props.googleConfig.projectId
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
if (props?.googleAds) await initClient$13({ parameter: await getParameter({ name: props.googleAds.parameterName }) });
|
|
50
|
-
if (props?.prisma) initClient$14({
|
|
49
|
+
if (props?.googleAds) await await initClient$13({ parameter: await getParameter({ name: props.googleAds.parameterName }) });
|
|
50
|
+
if (props?.prisma) await initClient$14({
|
|
51
51
|
debug: props?.prisma?.debug ?? false,
|
|
52
52
|
planetScale: props?.prisma?.planetScale ?? false
|
|
53
53
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/prisma/initClient.ts
|
|
2
2
|
global.prisma = null;
|
|
3
|
-
const initClient = (props = {}) => {
|
|
3
|
+
const initClient = async (props = {}) => {
|
|
4
4
|
if (!global.prisma) {
|
|
5
|
-
const { PrismaClient } =
|
|
5
|
+
const { PrismaClient } = await import("@prisma/client");
|
|
6
6
|
let adapter = null;
|
|
7
7
|
if (true === props?.planetScale) {
|
|
8
|
-
const { Client } =
|
|
8
|
+
const { Client } = await import("@planetscale/database");
|
|
9
9
|
const client = new Client({ url: process.env.DATABASE_URL });
|
|
10
|
-
const { PrismaPlanetScale } =
|
|
10
|
+
const { PrismaPlanetScale } = await import("@prisma/adapter-planetscale");
|
|
11
11
|
adapter = new PrismaPlanetScale(client);
|
|
12
12
|
}
|
|
13
13
|
if (true === props?.debug) global.prisma = new PrismaClient({
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/prisma/initClient.ts
|
|
3
2
|
global.prisma = null;
|
|
4
|
-
const initClient = (props = {}) => {
|
|
3
|
+
const initClient = async (props = {}) => {
|
|
5
4
|
if (!global.prisma) {
|
|
6
|
-
const { PrismaClient } =
|
|
5
|
+
const { PrismaClient } = await import("@prisma/client");
|
|
7
6
|
let adapter = null;
|
|
8
7
|
if (true === props?.planetScale) {
|
|
9
|
-
const { Client } =
|
|
8
|
+
const { Client } = await import("@planetscale/database");
|
|
10
9
|
const client = new Client({ url: process.env.DATABASE_URL });
|
|
11
|
-
const { PrismaPlanetScale } =
|
|
10
|
+
const { PrismaPlanetScale } = await import("@prisma/adapter-planetscale");
|
|
12
11
|
adapter = new PrismaPlanetScale(client);
|
|
13
12
|
}
|
|
14
13
|
if (true === props?.debug) global.prisma = new PrismaClient({
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const getBrotliCompressed = async ({ input, options } = {}) => {
|
|
6
6
|
return new Promise(async (resolve, reject) => {
|
|
7
|
-
|
|
8
|
-
if (err) reject(`Error compressing - ${err.
|
|
7
|
+
(await import("zlib")).brotliCompress(input || "", options || {}, (err, data) => {
|
|
8
|
+
if (err) reject(`Error compressing - ${err.message}`);
|
|
9
9
|
else resolve(data.toString("base64"));
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/util/getBrotliCompressed.ts
|
|
3
2
|
/**
|
|
4
3
|
* Compress a given input using Brotli.
|
|
5
4
|
*/
|
|
6
5
|
const getBrotliCompressed = async ({ input, options } = {}) => {
|
|
7
6
|
return new Promise(async (resolve, reject) => {
|
|
8
|
-
|
|
9
|
-
if (err) reject(`Error compressing - ${err.
|
|
7
|
+
(await import("zlib")).brotliCompress(input || "", options || {}, (err, data) => {
|
|
8
|
+
if (err) reject(`Error compressing - ${err.message}`);
|
|
10
9
|
else resolve(data.toString("base64"));
|
|
11
10
|
});
|
|
12
11
|
});
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const getBrotliDecompressed = async ({ input, options } = {}) => {
|
|
6
6
|
return new Promise(async (resolve, reject) => {
|
|
7
|
-
const zlib =
|
|
7
|
+
const zlib = await import("zlib");
|
|
8
8
|
const compressedData = Buffer.from(input || "", "base64");
|
|
9
9
|
zlib.brotliDecompress(compressedData, options || {}, (err, data) => {
|
|
10
|
-
if (err) reject(`Error decompressing - ${err.
|
|
10
|
+
if (err) reject(`Error decompressing - ${err.message}`);
|
|
11
11
|
else resolve(data.toString("utf8"));
|
|
12
12
|
});
|
|
13
13
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/util/getBrotliDecompressed.ts
|
|
3
2
|
/**
|
|
4
3
|
* Decompress a given Brotli input into a string.
|
|
5
4
|
*/
|
|
6
5
|
const getBrotliDecompressed = async ({ input, options } = {}) => {
|
|
7
6
|
return new Promise(async (resolve, reject) => {
|
|
8
|
-
const zlib =
|
|
7
|
+
const zlib = await import("zlib");
|
|
9
8
|
const compressedData = Buffer.from(input || "", "base64");
|
|
10
9
|
zlib.brotliDecompress(compressedData, options || {}, (err, data) => {
|
|
11
|
-
if (err) reject(`Error decompressing - ${err.
|
|
10
|
+
if (err) reject(`Error decompressing - ${err.message}`);
|
|
12
11
|
else resolve(data.toString("utf8"));
|
|
13
12
|
});
|
|
14
13
|
});
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const getGzipCompressed = async ({ input, options } = {}) => {
|
|
6
6
|
return new Promise(async (resolve, reject) => {
|
|
7
|
-
|
|
8
|
-
if (err) reject(`Error compressing - ${err.
|
|
7
|
+
(await import("zlib")).gzip(input || "", options || {}, (err, data) => {
|
|
8
|
+
if (err) reject(`Error compressing - ${err.message}`);
|
|
9
9
|
else resolve(data.toString("base64"));
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/util/getGzipCompressed.ts
|
|
3
2
|
/**
|
|
4
3
|
* Compress a given input using Gzip.
|
|
5
4
|
*/
|
|
6
5
|
const getGzipCompressed = async ({ input, options } = {}) => {
|
|
7
6
|
return new Promise(async (resolve, reject) => {
|
|
8
|
-
|
|
9
|
-
if (err) reject(`Error compressing - ${err.
|
|
7
|
+
(await import("zlib")).gzip(input || "", options || {}, (err, data) => {
|
|
8
|
+
if (err) reject(`Error compressing - ${err.message}`);
|
|
10
9
|
else resolve(data.toString("base64"));
|
|
11
10
|
});
|
|
12
11
|
});
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const getGzipDecompressed = async ({ input, options } = {}) => {
|
|
6
6
|
return new Promise(async (resolve, reject) => {
|
|
7
|
-
const zlib =
|
|
7
|
+
const zlib = await import("zlib");
|
|
8
8
|
const compressedData = Buffer.from(input || "", "base64");
|
|
9
9
|
zlib.gunzip(compressedData, options || {}, (err, data) => {
|
|
10
|
-
if (err) reject(`Error decompressing - ${err.
|
|
10
|
+
if (err) reject(`Error decompressing - ${err.message}`);
|
|
11
11
|
else resolve(data.toString("utf8"));
|
|
12
12
|
});
|
|
13
13
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/util/getGzipDecompressed.ts
|
|
3
2
|
/**
|
|
4
3
|
* Decompress a given Gzip input into a string.
|
|
5
4
|
*/
|
|
6
5
|
const getGzipDecompressed = async ({ input, options } = {}) => {
|
|
7
6
|
return new Promise(async (resolve, reject) => {
|
|
8
|
-
const zlib =
|
|
7
|
+
const zlib = await import("zlib");
|
|
9
8
|
const compressedData = Buffer.from(input || "", "base64");
|
|
10
9
|
zlib.gunzip(compressedData, options || {}, (err, data) => {
|
|
11
|
-
if (err) reject(`Error decompressing - ${err.
|
|
10
|
+
if (err) reject(`Error decompressing - ${err.message}`);
|
|
12
11
|
else resolve(data.toString("utf8"));
|
|
13
12
|
});
|
|
14
13
|
});
|