@8ms/helpers 1.42.8 → 1.42.10

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.
@@ -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 };
@@ -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
  };
@@ -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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.42.8",
4
+ "version": "1.42.10",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"