@8ms/helpers 1.42.7 → 1.42.9
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/moveFile.cjs +1 -1
- package/dist/aws/s3/moveFile.mjs +1 -1
- 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/s3cache/getCache.cjs +1 -1
- package/dist/aws/s3cache/getCache.mjs +1 -1
- package/dist/aws/s3cache/updateCache.cjs +1 -1
- package/dist/aws/s3cache/updateCache.mjs +1 -1
- 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/IsTableExists.cjs +1 -1
- package/dist/google/bigQuery/IsTableExists.mjs +1 -1
- package/dist/google/bigQuery/createDataset.cjs +1 -1
- package/dist/google/bigQuery/createDataset.mjs +1 -1
- package/dist/google/bigQuery/createTable.cjs +1 -1
- package/dist/google/bigQuery/createTable.mjs +1 -1
- 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/getDatasets.cjs +1 -1
- package/dist/google/bigQuery/getDatasets.mjs +1 -1
- package/dist/google/bigQuery/getTables.cjs +1 -1
- package/dist/google/bigQuery/getTables.mjs +1 -1
- 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/bigQuery/isDatasetExists.cjs +1 -1
- package/dist/google/bigQuery/isDatasetExists.mjs +1 -1
- package/dist/google/bigQuery/query.cjs +1 -1
- package/dist/google/bigQuery/query.mjs +1 -1
- 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
|
@@ -6,7 +6,7 @@ const require_google_bigQuery_getClient = require("./getClient.cjs");
|
|
|
6
6
|
*/
|
|
7
7
|
const isTableExists = async ({ datasetId, projectId, tableId }) => {
|
|
8
8
|
let response;
|
|
9
|
-
const dataset = require_google_bigQuery_getClient({ projectId }).dataset(datasetId);
|
|
9
|
+
const dataset = (await require_google_bigQuery_getClient({ projectId })).dataset(datasetId);
|
|
10
10
|
try {
|
|
11
11
|
await dataset.table(tableId).get();
|
|
12
12
|
response = true;
|
|
@@ -6,7 +6,7 @@ import getClient from "./getClient.mjs";
|
|
|
6
6
|
*/
|
|
7
7
|
const isTableExists = async ({ datasetId, projectId, tableId }) => {
|
|
8
8
|
let response;
|
|
9
|
-
const dataset = getClient({ projectId }).dataset(datasetId);
|
|
9
|
+
const dataset = (await getClient({ projectId })).dataset(datasetId);
|
|
10
10
|
try {
|
|
11
11
|
await dataset.table(tableId).get();
|
|
12
12
|
response = true;
|
|
@@ -9,7 +9,7 @@ const createDataset = async ({ datasetId, options, projectId }) => {
|
|
|
9
9
|
if (!await require_google_bigQuery_isDatasetExists({
|
|
10
10
|
datasetId,
|
|
11
11
|
projectId
|
|
12
|
-
})) await require_google_bigQuery_getClient({ projectId }).createDataset(datasetId, options || {});
|
|
12
|
+
})) await (await require_google_bigQuery_getClient({ projectId })).createDataset(datasetId, options || {});
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
15
15
|
module.exports = createDataset;
|
|
@@ -9,7 +9,7 @@ const createDataset = async ({ datasetId, options, projectId }) => {
|
|
|
9
9
|
if (!await isDatasetExists({
|
|
10
10
|
datasetId,
|
|
11
11
|
projectId
|
|
12
|
-
})) await getClient({ projectId }).createDataset(datasetId, options || {});
|
|
12
|
+
})) await (await getClient({ projectId })).createDataset(datasetId, options || {});
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
15
15
|
export { createDataset as default };
|
|
@@ -15,7 +15,7 @@ const createTable = async ({ datasetId, datasetOptions, options, projectId, tabl
|
|
|
15
15
|
datasetId,
|
|
16
16
|
projectId,
|
|
17
17
|
tableId
|
|
18
|
-
})) await require_google_bigQuery_getClient({ projectId }).dataset(datasetId).createTable(tableId, options || {});
|
|
18
|
+
})) await (await require_google_bigQuery_getClient({ projectId })).dataset(datasetId).createTable(tableId, options || {});
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
21
|
module.exports = createTable;
|
|
@@ -15,7 +15,7 @@ const createTable = async ({ datasetId, datasetOptions, options, projectId, tabl
|
|
|
15
15
|
datasetId,
|
|
16
16
|
projectId,
|
|
17
17
|
tableId
|
|
18
|
-
})) await getClient({ projectId }).dataset(datasetId).createTable(tableId, options || {});
|
|
18
|
+
})) await (await getClient({ projectId })).dataset(datasetId).createTable(tableId, options || {});
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
21
|
export { createTable as default };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Create a new client if the project id differs from the global.
|
|
4
4
|
*/
|
|
5
|
-
const getClient = (props) => {
|
|
5
|
+
const getClient = async (props) => {
|
|
6
6
|
let client = global.googleBigQueryClient;
|
|
7
7
|
if (props?.projectId && props?.projectId !== global.googleBigQueryDefaultProjectId) {
|
|
8
|
-
const { BigQuery } =
|
|
8
|
+
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
9
9
|
client = new BigQuery({
|
|
10
10
|
credentials: global.googleBigQueryDefault.credentials,
|
|
11
11
|
location: props?.location || "europe-west2",
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
//#region src/google/bigQuery/getClient.ts
|
|
3
2
|
/**
|
|
4
3
|
* Create a new client if the project id differs from the global.
|
|
5
4
|
*/
|
|
6
|
-
const getClient = (props) => {
|
|
5
|
+
const getClient = async (props) => {
|
|
7
6
|
let client = global.googleBigQueryClient;
|
|
8
7
|
if (props?.projectId && props?.projectId !== global.googleBigQueryDefaultProjectId) {
|
|
9
|
-
const { BigQuery } =
|
|
8
|
+
const { BigQuery } = await import("@google-cloud/bigquery");
|
|
10
9
|
client = new BigQuery({
|
|
11
10
|
credentials: global.googleBigQueryDefault.credentials,
|
|
12
11
|
location: props?.location || "europe-west2",
|
|
@@ -5,7 +5,7 @@ const require_google_bigQuery_getClient = require("./getClient.cjs");
|
|
|
5
5
|
*/
|
|
6
6
|
const getDatasets = async ({ projectId }) => {
|
|
7
7
|
let response = [];
|
|
8
|
-
const datasets = await require_google_bigQuery_getClient({ projectId }).getDatasets();
|
|
8
|
+
const datasets = await (await require_google_bigQuery_getClient({ projectId })).getDatasets();
|
|
9
9
|
if (datasets?.[0]) for (let i = 0; i < datasets[0].length; i++) response.push({
|
|
10
10
|
id: datasets[0][i].id,
|
|
11
11
|
location: datasets[0][i].location,
|
|
@@ -5,7 +5,7 @@ import getClient from "./getClient.mjs";
|
|
|
5
5
|
*/
|
|
6
6
|
const getDatasets = async ({ projectId }) => {
|
|
7
7
|
let response = [];
|
|
8
|
-
const datasets = await getClient({ projectId }).getDatasets();
|
|
8
|
+
const datasets = await (await getClient({ projectId })).getDatasets();
|
|
9
9
|
if (datasets?.[0]) for (let i = 0; i < datasets[0].length; i++) response.push({
|
|
10
10
|
id: datasets[0][i].id,
|
|
11
11
|
location: datasets[0][i].location,
|
|
@@ -5,7 +5,7 @@ const require_google_bigQuery_getClient = require("./getClient.cjs");
|
|
|
5
5
|
*/
|
|
6
6
|
const getTables = async (props) => {
|
|
7
7
|
let response = [];
|
|
8
|
-
const tables = await require_google_bigQuery_getClient({ projectId: props.projectId }).dataset(props.datasetId).getTables();
|
|
8
|
+
const tables = await (await require_google_bigQuery_getClient({ projectId: props.projectId })).dataset(props.datasetId).getTables();
|
|
9
9
|
if (tables?.[0]) for (let i = 0; i < tables[0].length; i++) response.push({ id: tables[0][i].id });
|
|
10
10
|
return response;
|
|
11
11
|
};
|
|
@@ -5,7 +5,7 @@ import getClient from "./getClient.mjs";
|
|
|
5
5
|
*/
|
|
6
6
|
const getTables = async (props) => {
|
|
7
7
|
let response = [];
|
|
8
|
-
const tables = await getClient({ projectId: props.projectId }).dataset(props.datasetId).getTables();
|
|
8
|
+
const tables = await (await getClient({ projectId: props.projectId })).dataset(props.datasetId).getTables();
|
|
9
9
|
if (tables?.[0]) for (let i = 0; i < tables[0].length; i++) response.push({ id: tables[0][i].id });
|
|
10
10
|
return response;
|
|
11
11
|
};
|
|
@@ -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;
|
|
@@ -7,7 +7,7 @@ const require_google_bigQuery_getClient = require("./getClient.cjs");
|
|
|
7
7
|
*/
|
|
8
8
|
const isDatasetExists = async ({ datasetId, projectId }) => {
|
|
9
9
|
let response;
|
|
10
|
-
let client = require_google_bigQuery_getClient({ projectId });
|
|
10
|
+
let client = await require_google_bigQuery_getClient({ projectId });
|
|
11
11
|
try {
|
|
12
12
|
await client.dataset(datasetId).get();
|
|
13
13
|
response = true;
|
|
@@ -7,7 +7,7 @@ import getClient from "./getClient.mjs";
|
|
|
7
7
|
*/
|
|
8
8
|
const isDatasetExists = async ({ datasetId, projectId }) => {
|
|
9
9
|
let response;
|
|
10
|
-
let client = getClient({ projectId });
|
|
10
|
+
let client = await getClient({ projectId });
|
|
11
11
|
try {
|
|
12
12
|
await client.dataset(datasetId).get();
|
|
13
13
|
response = true;
|
|
@@ -4,7 +4,7 @@ const require_google_bigQuery_getClient = require("./getClient.cjs");
|
|
|
4
4
|
* Build the query and return the data.
|
|
5
5
|
*/
|
|
6
6
|
const query = async ({ input, projectId }) => {
|
|
7
|
-
return await require_google_bigQuery_getClient({ projectId }).query(input);
|
|
7
|
+
return await (await require_google_bigQuery_getClient({ projectId })).query(input);
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
10
10
|
module.exports = query;
|
|
@@ -4,7 +4,7 @@ import getClient from "./getClient.mjs";
|
|
|
4
4
|
* Build the query and return the data.
|
|
5
5
|
*/
|
|
6
6
|
const query = async ({ input, projectId }) => {
|
|
7
|
-
return await getClient({ projectId }).query(input);
|
|
7
|
+
return await (await getClient({ projectId })).query(input);
|
|
8
8
|
};
|
|
9
9
|
//#endregion
|
|
10
10
|
export { query as default };
|
|
@@ -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