@8ms/helpers 3.2.10 → 3.2.12

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.
Files changed (55) hide show
  1. package/dist/adverity/server/getJobs.cjs +1 -1
  2. package/dist/adverity/server/getJobs.mjs +1 -1
  3. package/dist/api/_shared/index.cjs +1 -1
  4. package/dist/api/_shared/index.mjs +1 -1
  5. package/dist/api/client/index.cjs +1 -1
  6. package/dist/api/client/index.mjs +1 -1
  7. package/dist/api/server/index.cjs +1 -1
  8. package/dist/api/server/index.mjs +1 -1
  9. package/dist/googleAds/keywordPlanner/_shared/bigquery.cjs +4 -3
  10. package/dist/googleAds/keywordPlanner/_shared/bigquery.mjs +4 -3
  11. package/dist/googleCloud/bigquery/_shared/field/bqFloat.cjs +2 -2
  12. package/dist/googleCloud/bigquery/_shared/field/bqFloat.d.cts +1 -2
  13. package/dist/googleCloud/bigquery/_shared/field/bqFloat.d.mts +1 -2
  14. package/dist/googleCloud/bigquery/_shared/field/bqFloat.mjs +2 -2
  15. package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.cjs → bqStringNullable.cjs} +3 -3
  16. package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.d.cts → bqStringNullable.d.cts} +2 -2
  17. package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.d.mts → bqStringNullable.d.mts} +2 -2
  18. package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.mjs → bqStringNullable.mjs} +3 -3
  19. package/dist/googleCloud/bigquery/_shared/index.cjs +1 -1
  20. package/dist/googleCloud/bigquery/_shared/index.d.cts +2 -2
  21. package/dist/googleCloud/bigquery/_shared/index.d.mts +2 -2
  22. package/dist/googleCloud/bigquery/_shared/index.mjs +2 -2
  23. package/dist/googleCloud/bigquery/_shared/lookup/country.cjs +3 -3
  24. package/dist/googleCloud/bigquery/_shared/lookup/country.mjs +3 -3
  25. package/dist/googleCloud/bigquery/_shared/lookup/language.cjs +3 -3
  26. package/dist/googleCloud/bigquery/_shared/lookup/language.mjs +3 -3
  27. package/dist/googleCloud/bigquery/_shared/types.d.cts +7 -5
  28. package/dist/googleCloud/bigquery/_shared/types.d.mts +7 -5
  29. package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.cjs +3 -2
  30. package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.d.cts +1 -1
  31. package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.d.mts +1 -1
  32. package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.mjs +3 -2
  33. package/dist/googleCloud/bigquery/client/index.cjs +1 -1
  34. package/dist/googleCloud/bigquery/client/index.d.cts +2 -2
  35. package/dist/googleCloud/bigquery/client/index.d.mts +2 -2
  36. package/dist/googleCloud/bigquery/client/index.mjs +2 -2
  37. package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.cjs +14 -4
  38. package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.d.cts +8 -3
  39. package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.d.mts +8 -3
  40. package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.mjs +14 -4
  41. package/dist/googleCloud/bigquery/server/index.cjs +1 -1
  42. package/dist/googleCloud/bigquery/server/index.d.cts +2 -2
  43. package/dist/googleCloud/bigquery/server/index.d.mts +2 -2
  44. package/dist/googleCloud/bigquery/server/index.mjs +2 -2
  45. package/dist/lodash/_shared/index.cjs +4 -4
  46. package/dist/lodash/_shared/index.mjs +4 -4
  47. package/dist/lodash/client/index.cjs +4 -4
  48. package/dist/lodash/client/index.mjs +4 -4
  49. package/dist/lodash/server/index.cjs +4 -4
  50. package/dist/lodash/server/index.mjs +4 -4
  51. package/dist/url/server/writeUrlContents.cjs +3 -14
  52. package/dist/url/server/writeUrlContents.mjs +3 -14
  53. package/dist/xlsx/_shared/createXlsx.cjs +1 -1
  54. package/dist/xlsx/_shared/createXlsx.mjs +1 -1
  55. package/package.json +26 -26
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "../_shared/field
4
4
  import { BQDateTime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "../_shared/field/bqDateTime.mjs";
5
5
  import { BQFieldMode, BQFieldModeSchema } from "../_shared/field/bqFieldMode.mjs";
6
6
  import { BQFieldType, BQFieldTypeSchema } from "../_shared/field/bqFieldType.mjs";
7
- import { BQFloat } from "../_shared/field/bqFloat.mjs";
7
+ import { zBQFloat } from "../_shared/field/bqFloat.mjs";
8
8
  import { zBQInt } from "../_shared/field/bqInt.mjs";
9
9
  import { BQInt64, zBQInt64 } from "../_shared/field/bqInt64.mjs";
10
10
  import { BQNumeric, zBQNumeric } from "../_shared/field/bqNumeric.mjs";
@@ -18,4 +18,4 @@ import { languageBQRow } from "../_shared/lookup/language.mjs";
18
18
  import { partitionType } from "../_shared/partitionType.mjs";
19
19
  import { zodToBQSchema } from "../_shared/zodToBQDefinition.mjs";
20
20
  import "../_shared/index.mjs";
21
- export { BQBool, BQBytes, BQDate, BQDateTime, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQFloat, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
21
+ export { BQBool, BQBytes, BQDate, BQDateTime, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQFloat, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
@@ -98,7 +98,15 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
98
98
  * Make a request to the database and return the object per row.
99
99
  */
100
100
  query = async (props) => {
101
- return await this.client.query(this.buildQueryOptions(props));
101
+ const [rows] = await this.client.query(this.buildQueryOptions(props));
102
+ return rows;
103
+ };
104
+ /**
105
+ * Make a request to the database and return the first row, or null if there are none.
106
+ * Does not add a LIMIT - the full result set is still fetched, so include one in the query if it is large.
107
+ */
108
+ querySingle = async (props) => {
109
+ return (await this.query(props))[0] ?? null;
102
110
  };
103
111
  /**
104
112
  * Return the raw row stream for a query, without buffering the full result set in memory.
@@ -150,7 +158,8 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
150
158
  const finalRegion = props.table.options?.location ?? this.region;
151
159
  await this.createTable(props.table.datasetId, {}, props.table.tableId, props.table.options);
152
160
  await this.client.dataset(props.table.datasetId, { location: finalRegion }).table(props.table.tableId).load(props.googleCloudStorage.client.bucket(props.file.bucket).file(props.file.key), {
153
- autodetect: true,
161
+ autodetect: props.schema ? false : props.autodetect ?? true,
162
+ schema: props.schema ? { fields: props.schema } : void 0,
154
163
  sourceFormat: bigQuerySourceFormat[props.file.sourceFormat ?? require_file__shared_fileType.fileType.JSON_NEWLINE],
155
164
  schemaUpdateOptions: ["ALLOW_FIELD_ADDITION"],
156
165
  location: finalRegion
@@ -222,7 +231,7 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
222
231
  const stagingTableId = `${props.table.tableId}_staging_${require_date__shared_format.getYmdHisNumber()}`;
223
232
  const stagingTableRef = `\`${props.table.datasetId}.${stagingTableId}\``;
224
233
  try {
225
- const { mergeKey: _mergeKey, updateColumns: _updateColumns, ...tableDefinition } = props.table;
234
+ const { mergeColumns: _mergeColumns, updateColumns: _updateColumns, ...tableDefinition } = props.table;
226
235
  const stagingDefinition = {
227
236
  ...tableDefinition,
228
237
  tableId: stagingTableId,
@@ -238,12 +247,13 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
238
247
  table: stagingDefinition
239
248
  });
240
249
  const mainTableRef = `\`${props.table.datasetId}.${props.table.tableId}\``;
250
+ if (0 === props.table.mergeColumns.length) throw new Error("mergeTable requires at least one merge key.");
241
251
  const updateSet = props.table.updateColumns.map((column) => `${column} = S.${column}`).join(", ");
242
252
  const allColumns = props.table.options?.schema.map((field) => field.name) ?? [];
243
253
  const mergeQuery = `
244
254
  MERGE ${mainTableRef} AS T
245
255
  USING ${stagingTableRef} AS S
246
- ON T.${props.table.mergeKey} = S.${props.table.mergeKey}
256
+ ON ${props.table.mergeColumns.map((key) => `T.${key} = S.${key}`).join(" AND ")}
247
257
  WHEN MATCHED THEN
248
258
  UPDATE SET ${updateSet}
249
259
  WHEN NOT MATCHED THEN
@@ -1,5 +1,5 @@
1
1
  import { BaseNamespace } from "../../../_class/_shared/BaseNamespace.cjs";
2
- import { Dataset, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table } from "../_shared/types.cjs";
2
+ import { Dataset, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table, TableDefinition } from "../_shared/types.cjs";
3
3
  import "../_shared/index.cjs";
4
4
  import { ResourceStream } from "../../../node_modules/@google-cloud/paginator/build/src/resource-stream.cjs";
5
5
  import { BigQuery, DatasetResource } from "@google-cloud/bigquery";
@@ -32,7 +32,12 @@ export declare class GoogleCloudBigquery extends BaseNamespace {
32
32
  /**
33
33
  * Make a request to the database and return the object per row.
34
34
  */
35
- query: (props: QueryInput) => Promise<any>;
35
+ query: <TRow = any>(props: QueryInput) => Promise<TRow[]>;
36
+ /**
37
+ * Make a request to the database and return the first row, or null if there are none.
38
+ * Does not add a LIMIT - the full result set is still fetched, so include one in the query if it is large.
39
+ */
40
+ querySingle: <TRow = any>(props: QueryInput) => Promise<TRow | null>;
36
41
  /**
37
42
  * Return the raw row stream for a query, without buffering the full result set in memory.
38
43
  */
@@ -40,7 +45,7 @@ export declare class GoogleCloudBigquery extends BaseNamespace {
40
45
  /**
41
46
  * Create a Table if it doesn't already exist.
42
47
  */
43
- createTable: (datasetId: string, datasetOptions: object | undefined, tableId: string, options?: object) => Promise<void>;
48
+ createTable: (datasetId: string, datasetOptions: object | undefined, tableId: string, options?: TableDefinition["options"]) => Promise<void>;
44
49
  /**
45
50
  * Check to see whether a given BigQuery table exists.
46
51
  * https://cloud.google.com/bigquery/docs/samples/bigquery-table-exists
@@ -1,5 +1,5 @@
1
1
  import { BaseNamespace } from "../../../_class/_shared/BaseNamespace.mjs";
2
- import { Dataset, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table } from "../_shared/types.mjs";
2
+ import { Dataset, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table, TableDefinition } from "../_shared/types.mjs";
3
3
  import "../_shared/index.mjs";
4
4
  import { ResourceStream } from "../../../node_modules/@google-cloud/paginator/build/src/resource-stream.mjs";
5
5
  import { BigQuery, DatasetResource } from "@google-cloud/bigquery";
@@ -32,7 +32,12 @@ export declare class GoogleCloudBigquery extends BaseNamespace {
32
32
  /**
33
33
  * Make a request to the database and return the object per row.
34
34
  */
35
- query: (props: QueryInput) => Promise<any>;
35
+ query: <TRow = any>(props: QueryInput) => Promise<TRow[]>;
36
+ /**
37
+ * Make a request to the database and return the first row, or null if there are none.
38
+ * Does not add a LIMIT - the full result set is still fetched, so include one in the query if it is large.
39
+ */
40
+ querySingle: <TRow = any>(props: QueryInput) => Promise<TRow | null>;
36
41
  /**
37
42
  * Return the raw row stream for a query, without buffering the full result set in memory.
38
43
  */
@@ -40,7 +45,7 @@ export declare class GoogleCloudBigquery extends BaseNamespace {
40
45
  /**
41
46
  * Create a Table if it doesn't already exist.
42
47
  */
43
- createTable: (datasetId: string, datasetOptions: object | undefined, tableId: string, options?: object) => Promise<void>;
48
+ createTable: (datasetId: string, datasetOptions: object | undefined, tableId: string, options?: TableDefinition["options"]) => Promise<void>;
44
49
  /**
45
50
  * Check to see whether a given BigQuery table exists.
46
51
  * https://cloud.google.com/bigquery/docs/samples/bigquery-table-exists
@@ -97,7 +97,15 @@ var GoogleCloudBigquery = class extends BaseNamespace {
97
97
  * Make a request to the database and return the object per row.
98
98
  */
99
99
  query = async (props) => {
100
- return await this.client.query(this.buildQueryOptions(props));
100
+ const [rows] = await this.client.query(this.buildQueryOptions(props));
101
+ return rows;
102
+ };
103
+ /**
104
+ * Make a request to the database and return the first row, or null if there are none.
105
+ * Does not add a LIMIT - the full result set is still fetched, so include one in the query if it is large.
106
+ */
107
+ querySingle = async (props) => {
108
+ return (await this.query(props))[0] ?? null;
101
109
  };
102
110
  /**
103
111
  * Return the raw row stream for a query, without buffering the full result set in memory.
@@ -149,7 +157,8 @@ var GoogleCloudBigquery = class extends BaseNamespace {
149
157
  const finalRegion = props.table.options?.location ?? this.region;
150
158
  await this.createTable(props.table.datasetId, {}, props.table.tableId, props.table.options);
151
159
  await this.client.dataset(props.table.datasetId, { location: finalRegion }).table(props.table.tableId).load(props.googleCloudStorage.client.bucket(props.file.bucket).file(props.file.key), {
152
- autodetect: true,
160
+ autodetect: props.schema ? false : props.autodetect ?? true,
161
+ schema: props.schema ? { fields: props.schema } : void 0,
153
162
  sourceFormat: bigQuerySourceFormat[props.file.sourceFormat ?? fileType.JSON_NEWLINE],
154
163
  schemaUpdateOptions: ["ALLOW_FIELD_ADDITION"],
155
164
  location: finalRegion
@@ -221,7 +230,7 @@ var GoogleCloudBigquery = class extends BaseNamespace {
221
230
  const stagingTableId = `${props.table.tableId}_staging_${getYmdHisNumber()}`;
222
231
  const stagingTableRef = `\`${props.table.datasetId}.${stagingTableId}\``;
223
232
  try {
224
- const { mergeKey: _mergeKey, updateColumns: _updateColumns, ...tableDefinition } = props.table;
233
+ const { mergeColumns: _mergeColumns, updateColumns: _updateColumns, ...tableDefinition } = props.table;
225
234
  const stagingDefinition = {
226
235
  ...tableDefinition,
227
236
  tableId: stagingTableId,
@@ -237,12 +246,13 @@ var GoogleCloudBigquery = class extends BaseNamespace {
237
246
  table: stagingDefinition
238
247
  });
239
248
  const mainTableRef = `\`${props.table.datasetId}.${props.table.tableId}\``;
249
+ if (0 === props.table.mergeColumns.length) throw new Error("mergeTable requires at least one merge key.");
240
250
  const updateSet = props.table.updateColumns.map((column) => `${column} = S.${column}`).join(", ");
241
251
  const allColumns = props.table.options?.schema.map((field) => field.name) ?? [];
242
252
  const mergeQuery = `
243
253
  MERGE ${mainTableRef} AS T
244
254
  USING ${stagingTableRef} AS S
245
- ON T.${props.table.mergeKey} = S.${props.table.mergeKey}
255
+ ON ${props.table.mergeColumns.map((key) => `T.${key} = S.${key}`).join(" AND ")}
246
256
  WHEN MATCHED THEN
247
257
  UPDATE SET ${updateSet}
248
258
  WHEN NOT MATCHED THEN
@@ -29,7 +29,6 @@ exports.BQFieldMode = require_googleCloud_bigquery__shared_field_bqFieldMode.BQF
29
29
  exports.BQFieldModeSchema = require_googleCloud_bigquery__shared_field_bqFieldMode.BQFieldModeSchema;
30
30
  exports.BQFieldType = require_googleCloud_bigquery__shared_field_bqFieldType.BQFieldType;
31
31
  exports.BQFieldTypeSchema = require_googleCloud_bigquery__shared_field_bqFieldType.BQFieldTypeSchema;
32
- exports.BQFloat = require_googleCloud_bigquery__shared_field_bqFloat.BQFloat;
33
32
  exports.BQInt64 = require_googleCloud_bigquery__shared_field_bqInt64.BQInt64;
34
33
  exports.BQNumeric = require_googleCloud_bigquery__shared_field_bqNumeric.BQNumeric;
35
34
  exports.BQString = require_googleCloud_bigquery__shared_field_bqString.BQString;
@@ -47,6 +46,7 @@ exports.googleCloudBQRow = require_googleCloud_bigquery__shared_lookup_googleClo
47
46
  exports.languageBQRow = require_googleCloud_bigquery__shared_lookup_language.languageBQRow;
48
47
  exports.partitionType = require_googleCloud_bigquery__shared_partitionType.partitionType;
49
48
  exports.zBQBytes = require_googleCloud_bigquery__shared_field_bqBytes.zBQBytes;
49
+ exports.zBQFloat = require_googleCloud_bigquery__shared_field_bqFloat.zBQFloat;
50
50
  exports.zBQInt = require_googleCloud_bigquery__shared_field_bqInt.zBQInt;
51
51
  exports.zBQInt64 = require_googleCloud_bigquery__shared_field_bqInt64.zBQInt64;
52
52
  exports.zBQNumeric = require_googleCloud_bigquery__shared_field_bqNumeric.zBQNumeric;
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "../_shared/field
4
4
  import { BQDateTime, BQDatetime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "../_shared/field/bqDateTime.cjs";
5
5
  import { BQFieldMode, BQFieldModeSchema } from "../_shared/field/bqFieldMode.cjs";
6
6
  import { BQFieldType, BQFieldTypeSchema } from "../_shared/field/bqFieldType.cjs";
7
- import { BQFloat } from "../_shared/field/bqFloat.cjs";
7
+ import { zBQFloat } from "../_shared/field/bqFloat.cjs";
8
8
  import { zBQInt } from "../_shared/field/bqInt.cjs";
9
9
  import { BQInt64, zBQInt64 } from "../_shared/field/bqInt64.cjs";
10
10
  import { BQNumeric, zBQNumeric } from "../_shared/field/bqNumeric.cjs";
@@ -21,4 +21,4 @@ import { BigqueryLoadFormat, Dataset, LoadData, LoadStreamTableProps, LoadTableP
21
21
  import "../_shared/index.cjs";
22
22
  import { GoogleCloudBigquery } from "./GoogleCloudBigquery.cjs";
23
23
  import { getHandlerPath } from "./getHandlerPath.cjs";
24
- export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQFloat, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, GoogleCloudBigquery, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, getHandlerPath, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
24
+ export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, GoogleCloudBigquery, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, getHandlerPath, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQFloat, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "../_shared/field
4
4
  import { BQDateTime, BQDatetime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "../_shared/field/bqDateTime.mjs";
5
5
  import { BQFieldMode, BQFieldModeSchema } from "../_shared/field/bqFieldMode.mjs";
6
6
  import { BQFieldType, BQFieldTypeSchema } from "../_shared/field/bqFieldType.mjs";
7
- import { BQFloat } from "../_shared/field/bqFloat.mjs";
7
+ import { zBQFloat } from "../_shared/field/bqFloat.mjs";
8
8
  import { zBQInt } from "../_shared/field/bqInt.mjs";
9
9
  import { BQInt64, zBQInt64 } from "../_shared/field/bqInt64.mjs";
10
10
  import { BQNumeric, zBQNumeric } from "../_shared/field/bqNumeric.mjs";
@@ -21,4 +21,4 @@ import { BigqueryLoadFormat, Dataset, LoadData, LoadStreamTableProps, LoadTableP
21
21
  import "../_shared/index.mjs";
22
22
  import { GoogleCloudBigquery } from "./GoogleCloudBigquery.mjs";
23
23
  import { getHandlerPath } from "./getHandlerPath.mjs";
24
- export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQFloat, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, GoogleCloudBigquery, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, getHandlerPath, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
24
+ export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, GoogleCloudBigquery, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, getHandlerPath, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQFloat, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "../_shared/field
4
4
  import { BQDateTime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "../_shared/field/bqDateTime.mjs";
5
5
  import { BQFieldMode, BQFieldModeSchema } from "../_shared/field/bqFieldMode.mjs";
6
6
  import { BQFieldType, BQFieldTypeSchema } from "../_shared/field/bqFieldType.mjs";
7
- import { BQFloat } from "../_shared/field/bqFloat.mjs";
7
+ import { zBQFloat } from "../_shared/field/bqFloat.mjs";
8
8
  import { zBQInt } from "../_shared/field/bqInt.mjs";
9
9
  import { BQInt64, zBQInt64 } from "../_shared/field/bqInt64.mjs";
10
10
  import { BQNumeric, zBQNumeric } from "../_shared/field/bqNumeric.mjs";
@@ -20,4 +20,4 @@ import { zodToBQSchema } from "../_shared/zodToBQDefinition.mjs";
20
20
  import "../_shared/index.mjs";
21
21
  import { GoogleCloudBigquery } from "./GoogleCloudBigquery.mjs";
22
22
  import { getHandlerPath } from "./getHandlerPath.mjs";
23
- export { BQBool, BQBytes, BQDate, BQDateTime, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQFloat, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, GoogleCloudBigquery, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, getHandlerPath, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
23
+ export { BQBool, BQBytes, BQDate, BQDateTime, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, GoogleCloudBigquery, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, getHandlerPath, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQFloat, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
@@ -2,16 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_lodash__shared_set = require("./set.cjs");
3
3
  const require_lodash__shared_isObject = require("./isObject.cjs");
4
4
  const require_lodash__shared_isDate = require("./isDate.cjs");
5
- const require_lodash__shared_merge = require("./merge.cjs");
6
- const require_lodash__shared_unescape = require("./unescape.cjs");
7
- const require_lodash__shared_trim = require("./trim.cjs");
8
5
  const require_lodash__shared_chunk = require("./chunk.cjs");
9
- const require_lodash__shared_flatten = require("./flatten.cjs");
10
6
  const require_lodash__shared_findKey = require("./findKey.cjs");
7
+ const require_lodash__shared_flatten = require("./flatten.cjs");
8
+ const require_lodash__shared_trim = require("./trim.cjs");
11
9
  const require_lodash__shared_isEmpty = require("./isEmpty.cjs");
12
10
  const require_lodash__shared_isEqual = require("./isEqual.cjs");
13
11
  const require_lodash__shared_isFunction = require("./isFunction.cjs");
12
+ const require_lodash__shared_merge = require("./merge.cjs");
14
13
  const require_lodash__shared_orderBy = require("./orderBy.cjs");
14
+ const require_lodash__shared_unescape = require("./unescape.cjs");
15
15
  const require_lodash__shared_uniq = require("./uniq.cjs");
16
16
  const require_lodash__shared_uniqBy = require("./uniqBy.cjs");
17
17
  exports.chunk = require_lodash__shared_chunk.chunk;
@@ -1,16 +1,16 @@
1
1
  import { set } from "./set.mjs";
2
2
  import { isObject } from "./isObject.mjs";
3
3
  import { isDate } from "./isDate.mjs";
4
- import { merge } from "./merge.mjs";
5
- import { unescape } from "./unescape.mjs";
6
- import { trim } from "./trim.mjs";
7
4
  import { chunk } from "./chunk.mjs";
8
- import { flatten } from "./flatten.mjs";
9
5
  import { findKey } from "./findKey.mjs";
6
+ import { flatten } from "./flatten.mjs";
7
+ import { trim } from "./trim.mjs";
10
8
  import { isEmpty } from "./isEmpty.mjs";
11
9
  import { isEqual } from "./isEqual.mjs";
12
10
  import { isFunction } from "./isFunction.mjs";
11
+ import { merge } from "./merge.mjs";
13
12
  import { orderBy } from "./orderBy.mjs";
13
+ import { unescape } from "./unescape.mjs";
14
14
  import { uniq } from "./uniq.mjs";
15
15
  import { uniqBy } from "./uniqBy.mjs";
16
16
  export { chunk, findKey, flatten, isDate, isEmpty, isEqual, isFunction, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
@@ -2,16 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_lodash__shared_set = require("../_shared/set.cjs");
3
3
  const require_lodash__shared_isObject = require("../_shared/isObject.cjs");
4
4
  const require_lodash__shared_isDate = require("../_shared/isDate.cjs");
5
- const require_lodash__shared_merge = require("../_shared/merge.cjs");
6
- const require_lodash__shared_unescape = require("../_shared/unescape.cjs");
7
- const require_lodash__shared_trim = require("../_shared/trim.cjs");
8
5
  const require_lodash__shared_chunk = require("../_shared/chunk.cjs");
9
- const require_lodash__shared_flatten = require("../_shared/flatten.cjs");
10
6
  const require_lodash__shared_findKey = require("../_shared/findKey.cjs");
7
+ const require_lodash__shared_flatten = require("../_shared/flatten.cjs");
8
+ const require_lodash__shared_trim = require("../_shared/trim.cjs");
11
9
  const require_lodash__shared_isEmpty = require("../_shared/isEmpty.cjs");
12
10
  const require_lodash__shared_isEqual = require("../_shared/isEqual.cjs");
13
11
  const require_lodash__shared_isFunction = require("../_shared/isFunction.cjs");
12
+ const require_lodash__shared_merge = require("../_shared/merge.cjs");
14
13
  const require_lodash__shared_orderBy = require("../_shared/orderBy.cjs");
14
+ const require_lodash__shared_unescape = require("../_shared/unescape.cjs");
15
15
  const require_lodash__shared_uniq = require("../_shared/uniq.cjs");
16
16
  const require_lodash__shared_uniqBy = require("../_shared/uniqBy.cjs");
17
17
  exports.chunk = require_lodash__shared_chunk.chunk;
@@ -1,16 +1,16 @@
1
1
  import { set } from "../_shared/set.mjs";
2
2
  import { isObject } from "../_shared/isObject.mjs";
3
3
  import { isDate } from "../_shared/isDate.mjs";
4
- import { merge } from "../_shared/merge.mjs";
5
- import { unescape } from "../_shared/unescape.mjs";
6
- import { trim } from "../_shared/trim.mjs";
7
4
  import { chunk } from "../_shared/chunk.mjs";
8
- import { flatten } from "../_shared/flatten.mjs";
9
5
  import { findKey } from "../_shared/findKey.mjs";
6
+ import { flatten } from "../_shared/flatten.mjs";
7
+ import { trim } from "../_shared/trim.mjs";
10
8
  import { isEmpty } from "../_shared/isEmpty.mjs";
11
9
  import { isEqual } from "../_shared/isEqual.mjs";
12
10
  import { isFunction } from "../_shared/isFunction.mjs";
11
+ import { merge } from "../_shared/merge.mjs";
13
12
  import { orderBy } from "../_shared/orderBy.mjs";
13
+ import { unescape } from "../_shared/unescape.mjs";
14
14
  import { uniq } from "../_shared/uniq.mjs";
15
15
  import { uniqBy } from "../_shared/uniqBy.mjs";
16
16
  export { chunk, findKey, flatten, isDate, isEmpty, isEqual, isFunction, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
@@ -2,16 +2,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_lodash__shared_set = require("../_shared/set.cjs");
3
3
  const require_lodash__shared_isObject = require("../_shared/isObject.cjs");
4
4
  const require_lodash__shared_isDate = require("../_shared/isDate.cjs");
5
- const require_lodash__shared_merge = require("../_shared/merge.cjs");
6
- const require_lodash__shared_unescape = require("../_shared/unescape.cjs");
7
- const require_lodash__shared_trim = require("../_shared/trim.cjs");
8
5
  const require_lodash__shared_chunk = require("../_shared/chunk.cjs");
9
- const require_lodash__shared_flatten = require("../_shared/flatten.cjs");
10
6
  const require_lodash__shared_findKey = require("../_shared/findKey.cjs");
7
+ const require_lodash__shared_flatten = require("../_shared/flatten.cjs");
8
+ const require_lodash__shared_trim = require("../_shared/trim.cjs");
11
9
  const require_lodash__shared_isEmpty = require("../_shared/isEmpty.cjs");
12
10
  const require_lodash__shared_isEqual = require("../_shared/isEqual.cjs");
13
11
  const require_lodash__shared_isFunction = require("../_shared/isFunction.cjs");
12
+ const require_lodash__shared_merge = require("../_shared/merge.cjs");
14
13
  const require_lodash__shared_orderBy = require("../_shared/orderBy.cjs");
14
+ const require_lodash__shared_unescape = require("../_shared/unescape.cjs");
15
15
  const require_lodash__shared_uniq = require("../_shared/uniq.cjs");
16
16
  const require_lodash__shared_uniqBy = require("../_shared/uniqBy.cjs");
17
17
  exports.chunk = require_lodash__shared_chunk.chunk;
@@ -1,16 +1,16 @@
1
1
  import { set } from "../_shared/set.mjs";
2
2
  import { isObject } from "../_shared/isObject.mjs";
3
3
  import { isDate } from "../_shared/isDate.mjs";
4
- import { merge } from "../_shared/merge.mjs";
5
- import { unescape } from "../_shared/unescape.mjs";
6
- import { trim } from "../_shared/trim.mjs";
7
4
  import { chunk } from "../_shared/chunk.mjs";
8
- import { flatten } from "../_shared/flatten.mjs";
9
5
  import { findKey } from "../_shared/findKey.mjs";
6
+ import { flatten } from "../_shared/flatten.mjs";
7
+ import { trim } from "../_shared/trim.mjs";
10
8
  import { isEmpty } from "../_shared/isEmpty.mjs";
11
9
  import { isEqual } from "../_shared/isEqual.mjs";
12
10
  import { isFunction } from "../_shared/isFunction.mjs";
11
+ import { merge } from "../_shared/merge.mjs";
13
12
  import { orderBy } from "../_shared/orderBy.mjs";
13
+ import { unescape } from "../_shared/unescape.mjs";
14
14
  import { uniq } from "../_shared/uniq.mjs";
15
15
  import { uniqBy } from "../_shared/uniqBy.mjs";
16
16
  export { chunk, findKey, flatten, isDate, isEmpty, isEqual, isFunction, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
@@ -4,6 +4,7 @@ const require_file_server_createDirectory = require("../../file/server/createDir
4
4
  let ky = require("ky");
5
5
  ky = require_runtime.__toESM(ky);
6
6
  let stream = require("stream");
7
+ let stream_promises = require("stream/promises");
7
8
  let fs = require("fs");
8
9
  //#region src/url/server/writeUrlContents.ts
9
10
  /**
@@ -11,21 +12,9 @@ let fs = require("fs");
11
12
  */
12
13
  const writeUrlContents = async (filePath, url) => {
13
14
  await require_file_server_createDirectory.createDirectory(filePath);
14
- const writer = (0, fs.createWriteStream)(filePath);
15
15
  const response = await ky.default.get(url);
16
- const stream$1 = stream.Readable.fromWeb(response.body);
17
- await new Promise((resolve, reject) => {
18
- stream$1.pipe(writer);
19
- let error = null;
20
- writer.on("error", (err) => {
21
- error = err;
22
- writer.close();
23
- reject(err);
24
- });
25
- writer.on("close", () => {
26
- if (!error) resolve();
27
- });
28
- });
16
+ if (!response.body) throw new Error(`No response body for ${url}`);
17
+ await (0, stream_promises.pipeline)(stream.Readable.fromWeb(response.body), (0, fs.createWriteStream)(filePath));
29
18
  };
30
19
  //#endregion
31
20
  exports.writeUrlContents = writeUrlContents;
@@ -1,6 +1,7 @@
1
1
  import { createDirectory } from "../../file/server/createDirectory.mjs";
2
2
  import ky from "ky";
3
3
  import { Readable } from "stream";
4
+ import { pipeline } from "stream/promises";
4
5
  import { createWriteStream } from "fs";
5
6
  //#region src/url/server/writeUrlContents.ts
6
7
  /**
@@ -8,21 +9,9 @@ import { createWriteStream } from "fs";
8
9
  */
9
10
  const writeUrlContents = async (filePath, url) => {
10
11
  await createDirectory(filePath);
11
- const writer = createWriteStream(filePath);
12
12
  const response = await ky.get(url);
13
- const stream = Readable.fromWeb(response.body);
14
- await new Promise((resolve, reject) => {
15
- stream.pipe(writer);
16
- let error = null;
17
- writer.on("error", (err) => {
18
- error = err;
19
- writer.close();
20
- reject(err);
21
- });
22
- writer.on("close", () => {
23
- if (!error) resolve();
24
- });
25
- });
13
+ if (!response.body) throw new Error(`No response body for ${url}`);
14
+ await pipeline(Readable.fromWeb(response.body), createWriteStream(filePath));
26
15
  };
27
16
  //#endregion
28
17
  export { writeUrlContents };
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_xlsx__shared_column = require("./column.cjs");
3
3
  const require_xlsx__shared_cell = require("./cell.cjs");
4
- const require_zip__shared_ZipArchive = require("../../zip/_shared/ZipArchive.cjs");
5
4
  const require_xlsx__shared_sheet = require("./sheet.cjs");
5
+ const require_zip__shared_ZipArchive = require("../../zip/_shared/ZipArchive.cjs");
6
6
  //#region src/xlsx/_shared/createXlsx.ts
7
7
  /**
8
8
  * Builds a complete .xlsx workbook from scratch, using hand-written OOXML rather
@@ -1,7 +1,7 @@
1
1
  import { getColumLetter, getColumnWidth } from "./column.mjs";
2
2
  import { buildCellXml, getCellValue, getEscapedXml } from "./cell.mjs";
3
- import { ZipArchive } from "../../zip/_shared/ZipArchive.mjs";
4
3
  import { getUniqueSheetNames } from "./sheet.mjs";
4
+ import { ZipArchive } from "../../zip/_shared/ZipArchive.mjs";
5
5
  //#region src/xlsx/_shared/createXlsx.ts
6
6
  /**
7
7
  * Builds a complete .xlsx workbook from scratch, using hand-written OOXML rather
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "3.2.10",
5
- "packageManager": "yarn@4.18.0",
4
+ "version": "3.2.12",
5
+ "packageManager": "yarn@4.18.1",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -196,19 +196,19 @@
196
196
  },
197
197
  "devDependencies": {
198
198
  "@1password/sdk": "^0.5.0",
199
- "@aws-sdk/client-cloudwatch": "^3.1141.0",
200
- "@aws-sdk/client-cloudwatch-logs": "^3.1141.0",
201
- "@aws-sdk/client-ec2": "^3.1141.0",
202
- "@aws-sdk/client-ecs": "^3.1141.0",
203
- "@aws-sdk/client-glue": "^3.1141.0",
204
- "@aws-sdk/client-lambda": "^3.1141.0",
205
- "@aws-sdk/client-s3": "^3.1141.0",
206
- "@aws-sdk/client-sesv2": "^3.1141.0",
207
- "@aws-sdk/client-sqs": "^3.1141.0",
208
- "@aws-sdk/client-ssm": "^3.1141.0",
209
- "@aws-sdk/client-sts": "^3.1141.0",
210
- "@aws-sdk/lib-storage": "^3.1141.0",
211
- "@aws-sdk/s3-request-presigner": "^3.1141.0",
199
+ "@aws-sdk/client-cloudwatch": "^3.1145.0",
200
+ "@aws-sdk/client-cloudwatch-logs": "^3.1145.0",
201
+ "@aws-sdk/client-ec2": "^3.1145.0",
202
+ "@aws-sdk/client-ecs": "^3.1145.0",
203
+ "@aws-sdk/client-glue": "^3.1145.0",
204
+ "@aws-sdk/client-lambda": "^3.1145.0",
205
+ "@aws-sdk/client-s3": "^3.1145.0",
206
+ "@aws-sdk/client-sesv2": "^3.1145.0",
207
+ "@aws-sdk/client-sqs": "^3.1145.0",
208
+ "@aws-sdk/client-ssm": "^3.1145.0",
209
+ "@aws-sdk/client-sts": "^3.1145.0",
210
+ "@aws-sdk/lib-storage": "^3.1145.0",
211
+ "@aws-sdk/s3-request-presigner": "^3.1145.0",
212
212
  "@aws-sdk/types": "^3.974.6",
213
213
  "@babel/core": "^8.0.6",
214
214
  "@babel/preset-env": "^8.0.6",
@@ -218,28 +218,28 @@
218
218
  "@google-cloud/storage": "^8.2.0",
219
219
  "@googleapis/drive": "^26.0.1",
220
220
  "@googleapis/sheets": "^18.0.1",
221
- "@planetscale/database": "^1.20.1",
221
+ "@planetscale/database": "^1.20.2",
222
222
  "@prisma/adapter-mariadb": "^7.10.0",
223
223
  "@prisma/adapter-pg": "^7.10.0",
224
224
  "@prisma/adapter-planetscale": "^7.10.0",
225
225
  "@prisma/client": "^7.10.0",
226
226
  "@types/fs-extra": "^11.0.4",
227
227
  "@types/jest": "^30.0.0",
228
- "@types/luxon": "^3.7.5",
229
- "@types/node": "^24.19.0",
228
+ "@types/luxon": "^3.7.6",
229
+ "@types/node": "^24.19.1",
230
230
  "@types/react": "^19.3.0",
231
231
  "@vercel/oidc": "^3.8.9",
232
232
  "@vercel/oidc-aws-credentials-provider": "^3.3.9",
233
233
  "babel-jest": "30.5.2",
234
- "dotenv": "^18.0.4",
234
+ "dotenv": "^18.0.5",
235
235
  "drizzle-orm": "1.0.0-beta.22",
236
236
  "gaxios": "^8.1.0",
237
237
  "google-auth-library": "^11.1.0",
238
238
  "googleapis-common": "^9.1.0",
239
239
  "jest": "^30.5.2",
240
- "mysql2": "^3.24.4",
241
- "next": "^16.3.6",
242
- "pg": "^8.23.0",
240
+ "mysql2": "^3.24.5",
241
+ "next": "^16.3.8",
242
+ "pg": "^8.23.1",
243
243
  "react": "^19.3.0",
244
244
  "react-intersection-observer": "^11.0.1",
245
245
  "stream-json": "^3.7.0",
@@ -995,10 +995,6 @@
995
995
  "import": "./dist/googleCloud/bigquery/_shared/field/bqInt64.mjs",
996
996
  "require": "./dist/googleCloud/bigquery/_shared/field/bqInt64.cjs"
997
997
  },
998
- "./googleCloud/bigquery/_shared/field/bqNullableString": {
999
- "import": "./dist/googleCloud/bigquery/_shared/field/bqNullableString.mjs",
1000
- "require": "./dist/googleCloud/bigquery/_shared/field/bqNullableString.cjs"
1001
- },
1002
998
  "./googleCloud/bigquery/_shared/field/bqNumeric": {
1003
999
  "import": "./dist/googleCloud/bigquery/_shared/field/bqNumeric.mjs",
1004
1000
  "require": "./dist/googleCloud/bigquery/_shared/field/bqNumeric.cjs"
@@ -1007,6 +1003,10 @@
1007
1003
  "import": "./dist/googleCloud/bigquery/_shared/field/bqString.mjs",
1008
1004
  "require": "./dist/googleCloud/bigquery/_shared/field/bqString.cjs"
1009
1005
  },
1006
+ "./googleCloud/bigquery/_shared/field/bqStringNullable": {
1007
+ "import": "./dist/googleCloud/bigquery/_shared/field/bqStringNullable.mjs",
1008
+ "require": "./dist/googleCloud/bigquery/_shared/field/bqStringNullable.cjs"
1009
+ },
1010
1010
  "./googleCloud/bigquery/_shared/field/bqTime": {
1011
1011
  "import": "./dist/googleCloud/bigquery/_shared/field/bqTime.mjs",
1012
1012
  "require": "./dist/googleCloud/bigquery/_shared/field/bqTime.cjs"