@8ms/helpers 3.2.9 → 3.2.11
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/adverity/server/getJobs.cjs +1 -1
- package/dist/adverity/server/getJobs.mjs +1 -1
- package/dist/api/_shared/index.cjs +1 -1
- package/dist/api/_shared/index.mjs +1 -1
- package/dist/api/client/index.cjs +1 -1
- package/dist/api/client/index.mjs +1 -1
- package/dist/api/server/index.cjs +1 -1
- package/dist/api/server/index.mjs +1 -1
- package/dist/aws/s3/server/AwsS3.cjs +1 -1
- package/dist/aws/s3/server/AwsS3.mjs +1 -1
- package/dist/googleCloud/bigquery/_shared/field/bqFloat.cjs +2 -2
- package/dist/googleCloud/bigquery/_shared/field/bqFloat.d.cts +1 -2
- package/dist/googleCloud/bigquery/_shared/field/bqFloat.d.mts +1 -2
- package/dist/googleCloud/bigquery/_shared/field/bqFloat.mjs +2 -2
- package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.cjs → bqStringNullable.cjs} +3 -3
- package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.d.cts → bqStringNullable.d.cts} +2 -2
- package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.d.mts → bqStringNullable.d.mts} +2 -2
- package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.mjs → bqStringNullable.mjs} +3 -3
- package/dist/googleCloud/bigquery/_shared/index.cjs +1 -1
- package/dist/googleCloud/bigquery/_shared/index.d.cts +2 -2
- package/dist/googleCloud/bigquery/_shared/index.d.mts +2 -2
- package/dist/googleCloud/bigquery/_shared/index.mjs +2 -2
- package/dist/googleCloud/bigquery/_shared/lookup/country.cjs +3 -3
- package/dist/googleCloud/bigquery/_shared/lookup/country.mjs +3 -3
- package/dist/googleCloud/bigquery/_shared/lookup/language.cjs +3 -3
- package/dist/googleCloud/bigquery/_shared/lookup/language.mjs +3 -3
- package/dist/googleCloud/bigquery/_shared/types.d.cts +6 -7
- package/dist/googleCloud/bigquery/_shared/types.d.mts +6 -7
- package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.cjs +3 -2
- package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.d.cts +1 -1
- package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.d.mts +1 -1
- package/dist/googleCloud/bigquery/_shared/zodToBQDefinition.mjs +3 -2
- package/dist/googleCloud/bigquery/client/index.cjs +1 -1
- package/dist/googleCloud/bigquery/client/index.d.cts +2 -2
- package/dist/googleCloud/bigquery/client/index.d.mts +2 -2
- package/dist/googleCloud/bigquery/client/index.mjs +2 -2
- package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.cjs +37 -30
- package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.d.cts +9 -4
- package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.d.mts +9 -4
- package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.mjs +37 -30
- package/dist/googleCloud/bigquery/server/index.cjs +1 -1
- package/dist/googleCloud/bigquery/server/index.d.cts +2 -2
- package/dist/googleCloud/bigquery/server/index.d.mts +2 -2
- package/dist/googleCloud/bigquery/server/index.mjs +2 -2
- package/dist/url/server/writeUrlContents.cjs +3 -14
- package/dist/url/server/writeUrlContents.mjs +3 -14
- package/dist/xlsx/_shared/createXlsx.cjs +1 -1
- package/dist/xlsx/_shared/createXlsx.mjs +1 -1
- package/package.json +26 -26
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_api__shared_get = require("../../api/_shared/get.cjs");
|
|
2
3
|
const require_date__shared_calculation = require("../../date/_shared/calculation.cjs");
|
|
3
4
|
const require_date__shared_format = require("../../date/_shared/format.cjs");
|
|
4
|
-
const require_api__shared_get = require("../../api/_shared/get.cjs");
|
|
5
5
|
//#region src/adverity/server/getJobs.ts
|
|
6
6
|
/**
|
|
7
7
|
* Fetch all the jobs that ran yesterday by default.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { get } from "../../api/_shared/get.mjs";
|
|
1
2
|
import { getLuxonDate, getToday, getYesterday } from "../../date/_shared/calculation.mjs";
|
|
2
3
|
import { getYmdString } from "../../date/_shared/format.mjs";
|
|
3
|
-
import { get } from "../../api/_shared/get.mjs";
|
|
4
4
|
//#region src/adverity/server/getJobs.ts
|
|
5
5
|
/**
|
|
6
6
|
* Fetch all the jobs that ran yesterday by default.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_api__shared_api = require("./api.cjs");
|
|
3
3
|
const require_api__shared_ApiResponseClass = require("./ApiResponseClass.cjs");
|
|
4
|
-
const require_api__shared_get = require("./get.cjs");
|
|
5
4
|
const require_api__shared_deleteRequest = require("./deleteRequest.cjs");
|
|
6
5
|
const require_api__shared_functions = require("./functions.cjs");
|
|
6
|
+
const require_api__shared_get = require("./get.cjs");
|
|
7
7
|
const require_api__shared_httpMethod = require("./httpMethod.cjs");
|
|
8
8
|
const require_api__shared_post = require("./post.cjs");
|
|
9
9
|
exports.ApiResponseClass = require_api__shared_ApiResponseClass.ApiResponseClass;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { apiState, defaultResponse, unexpectedError } from "./api.mjs";
|
|
2
2
|
import { ApiResponseClass } from "./ApiResponseClass.mjs";
|
|
3
|
-
import { get } from "./get.mjs";
|
|
4
3
|
import { deleteRequest } from "./deleteRequest.mjs";
|
|
5
4
|
import { isCancelled, isError, isIdle, isPending, isSuccess, isValidationError } from "./functions.mjs";
|
|
5
|
+
import { get } from "./get.mjs";
|
|
6
6
|
import { httpMethod } from "./httpMethod.mjs";
|
|
7
7
|
import { post } from "./post.mjs";
|
|
8
8
|
export { ApiResponseClass, apiState, defaultResponse, deleteRequest, get, httpMethod, isCancelled, isError, isIdle, isPending, isSuccess, isValidationError, post, unexpectedError };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_api__shared_api = require("../_shared/api.cjs");
|
|
3
3
|
const require_api__shared_ApiResponseClass = require("../_shared/ApiResponseClass.cjs");
|
|
4
|
-
const require_api__shared_get = require("../_shared/get.cjs");
|
|
5
4
|
const require_api__shared_deleteRequest = require("../_shared/deleteRequest.cjs");
|
|
6
5
|
const require_api__shared_functions = require("../_shared/functions.cjs");
|
|
6
|
+
const require_api__shared_get = require("../_shared/get.cjs");
|
|
7
7
|
const require_api__shared_httpMethod = require("../_shared/httpMethod.cjs");
|
|
8
8
|
const require_api__shared_post = require("../_shared/post.cjs");
|
|
9
9
|
require("../_shared/index.cjs");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { apiState, defaultResponse, unexpectedError } from "../_shared/api.mjs";
|
|
2
2
|
import { ApiResponseClass } from "../_shared/ApiResponseClass.mjs";
|
|
3
|
-
import { get } from "../_shared/get.mjs";
|
|
4
3
|
import { deleteRequest } from "../_shared/deleteRequest.mjs";
|
|
5
4
|
import { isCancelled, isError, isIdle, isPending, isSuccess, isValidationError } from "../_shared/functions.mjs";
|
|
5
|
+
import { get } from "../_shared/get.mjs";
|
|
6
6
|
import { httpMethod } from "../_shared/httpMethod.mjs";
|
|
7
7
|
import { post } from "../_shared/post.mjs";
|
|
8
8
|
import "../_shared/index.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_api__shared_api = require("../_shared/api.cjs");
|
|
3
3
|
const require_api__shared_ApiResponseClass = require("../_shared/ApiResponseClass.cjs");
|
|
4
|
-
const require_api__shared_get = require("../_shared/get.cjs");
|
|
5
4
|
const require_api__shared_deleteRequest = require("../_shared/deleteRequest.cjs");
|
|
6
5
|
const require_api__shared_functions = require("../_shared/functions.cjs");
|
|
6
|
+
const require_api__shared_get = require("../_shared/get.cjs");
|
|
7
7
|
const require_api__shared_httpMethod = require("../_shared/httpMethod.cjs");
|
|
8
8
|
const require_api__shared_post = require("../_shared/post.cjs");
|
|
9
9
|
require("../_shared/index.cjs");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { apiState, defaultResponse, unexpectedError } from "../_shared/api.mjs";
|
|
2
2
|
import { ApiResponseClass } from "../_shared/ApiResponseClass.mjs";
|
|
3
|
-
import { get } from "../_shared/get.mjs";
|
|
4
3
|
import { deleteRequest } from "../_shared/deleteRequest.mjs";
|
|
5
4
|
import { isCancelled, isError, isIdle, isPending, isSuccess, isValidationError } from "../_shared/functions.mjs";
|
|
5
|
+
import { get } from "../_shared/get.mjs";
|
|
6
6
|
import { httpMethod } from "../_shared/httpMethod.mjs";
|
|
7
7
|
import { post } from "../_shared/post.mjs";
|
|
8
8
|
import "../_shared/index.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require__class__shared_BaseNamespace = require("../../../_class/_shared/BaseNamespace.cjs");
|
|
4
|
+
const require_aws_server_isResponse200 = require("../../server/isResponse200.cjs");
|
|
4
5
|
const require_date__shared_calculation = require("../../../date/_shared/calculation.cjs");
|
|
5
6
|
const require_date__shared_format = require("../../../date/_shared/format.cjs");
|
|
6
|
-
const require_aws_server_isResponse200 = require("../../server/isResponse200.cjs");
|
|
7
7
|
const require_date__shared_date = require("../../../date/_shared/date.cjs");
|
|
8
8
|
require("../../../date/_shared/index.cjs");
|
|
9
9
|
const require_stream_server_json_read = require("../../../stream/server/json/read.cjs");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/_shared/BaseNamespace.mjs";
|
|
2
|
+
import { isResponse200 } from "../../server/isResponse200.mjs";
|
|
2
3
|
import { getToday } from "../../../date/_shared/calculation.mjs";
|
|
3
4
|
import { getYmdHisString } from "../../../date/_shared/format.mjs";
|
|
4
|
-
import { isResponse200 } from "../../server/isResponse200.mjs";
|
|
5
5
|
import { defaultDateTime } from "../../../date/_shared/date.mjs";
|
|
6
6
|
import "../../../date/_shared/index.mjs";
|
|
7
7
|
import { readJsonGzipStream, readJsonStream } from "../../../stream/server/json/read.mjs";
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
/**
|
|
4
4
|
* FLOAT64 → plain JS number
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
6
|
+
const zBQFloat = require("zod").z.number().describe("bq:float");
|
|
7
7
|
//#endregion
|
|
8
|
-
exports.
|
|
8
|
+
exports.zBQFloat = zBQFloat;
|
package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.cjs → bqStringNullable.cjs}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let zod = require("zod");
|
|
3
|
-
//#region src/googleCloud/bigquery/_shared/field/
|
|
3
|
+
//#region src/googleCloud/bigquery/_shared/field/bqStringNullable.ts
|
|
4
4
|
/**
|
|
5
5
|
* BigQuery's Node client returns small INT64 values as a native `number` and only falls back to
|
|
6
6
|
* `string` once precision would be lost - so an INT64/NUMERIC column stored as an id (e.g.
|
|
7
7
|
* google_ads_id) can't be trusted to always arrive as a string. Coerce defensively instead.
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const BQStringNullable = zod.z.preprocess((value) => null === value || void 0 === value ? null : String(value), zod.z.string().nullable());
|
|
10
10
|
//#endregion
|
|
11
|
-
exports.
|
|
11
|
+
exports.BQStringNullable = BQStringNullable;
|
package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.d.cts → bqStringNullable.d.cts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/googleCloud/bigquery/_shared/field/
|
|
2
|
+
//#region src/googleCloud/bigquery/_shared/field/bqStringNullable.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* BigQuery's Node client returns small INT64 values as a native `number` and only falls back to
|
|
5
5
|
* `string` once precision would be lost - so an INT64/NUMERIC column stored as an id (e.g.
|
|
6
6
|
* google_ads_id) can't be trusted to always arrive as a string. Coerce defensively instead.
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const BQStringNullable: z.ZodPreprocess<z.ZodNullable<z.ZodString>, unknown>;
|
|
9
9
|
//#endregion
|
package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.d.mts → bqStringNullable.d.mts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/googleCloud/bigquery/_shared/field/
|
|
2
|
+
//#region src/googleCloud/bigquery/_shared/field/bqStringNullable.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* BigQuery's Node client returns small INT64 values as a native `number` and only falls back to
|
|
5
5
|
* `string` once precision would be lost - so an INT64/NUMERIC column stored as an id (e.g.
|
|
6
6
|
* google_ads_id) can't be trusted to always arrive as a string. Coerce defensively instead.
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const BQStringNullable: z.ZodPreprocess<z.ZodNullable<z.ZodString>, unknown>;
|
|
9
9
|
//#endregion
|
package/dist/googleCloud/bigquery/_shared/field/{bqNullableString.mjs → bqStringNullable.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/googleCloud/bigquery/_shared/field/
|
|
2
|
+
//#region src/googleCloud/bigquery/_shared/field/bqStringNullable.ts
|
|
3
3
|
/**
|
|
4
4
|
* BigQuery's Node client returns small INT64 values as a native `number` and only falls back to
|
|
5
5
|
* `string` once precision would be lost - so an INT64/NUMERIC column stored as an id (e.g.
|
|
6
6
|
* google_ads_id) can't be trusted to always arrive as a string. Coerce defensively instead.
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const BQStringNullable = z.preprocess((value) => null === value || void 0 === value ? null : String(value), z.string().nullable());
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export { BQStringNullable };
|
|
@@ -26,7 +26,6 @@ exports.BQFieldMode = require_googleCloud_bigquery__shared_field_bqFieldMode.BQF
|
|
|
26
26
|
exports.BQFieldModeSchema = require_googleCloud_bigquery__shared_field_bqFieldMode.BQFieldModeSchema;
|
|
27
27
|
exports.BQFieldType = require_googleCloud_bigquery__shared_field_bqFieldType.BQFieldType;
|
|
28
28
|
exports.BQFieldTypeSchema = require_googleCloud_bigquery__shared_field_bqFieldType.BQFieldTypeSchema;
|
|
29
|
-
exports.BQFloat = require_googleCloud_bigquery__shared_field_bqFloat.BQFloat;
|
|
30
29
|
exports.BQInt64 = require_googleCloud_bigquery__shared_field_bqInt64.BQInt64;
|
|
31
30
|
exports.BQNumeric = require_googleCloud_bigquery__shared_field_bqNumeric.BQNumeric;
|
|
32
31
|
exports.BQString = require_googleCloud_bigquery__shared_field_bqString.BQString;
|
|
@@ -42,6 +41,7 @@ exports.googleCloudBQRow = require_googleCloud_bigquery__shared_lookup_googleClo
|
|
|
42
41
|
exports.languageBQRow = require_googleCloud_bigquery__shared_lookup_language.languageBQRow;
|
|
43
42
|
exports.partitionType = require_googleCloud_bigquery__shared_partitionType.partitionType;
|
|
44
43
|
exports.zBQBytes = require_googleCloud_bigquery__shared_field_bqBytes.zBQBytes;
|
|
44
|
+
exports.zBQFloat = require_googleCloud_bigquery__shared_field_bqFloat.zBQFloat;
|
|
45
45
|
exports.zBQInt = require_googleCloud_bigquery__shared_field_bqInt.zBQInt;
|
|
46
46
|
exports.zBQInt64 = require_googleCloud_bigquery__shared_field_bqInt64.zBQInt64;
|
|
47
47
|
exports.zBQNumeric = require_googleCloud_bigquery__shared_field_bqNumeric.zBQNumeric;
|
|
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "./field/bqDate.c
|
|
|
4
4
|
import { BQDateTime, BQDatetime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "./field/bqDateTime.cjs";
|
|
5
5
|
import { BQFieldMode, BQFieldModeSchema } from "./field/bqFieldMode.cjs";
|
|
6
6
|
import { BQFieldType, BQFieldTypeSchema } from "./field/bqFieldType.cjs";
|
|
7
|
-
import {
|
|
7
|
+
import { zBQFloat } from "./field/bqFloat.cjs";
|
|
8
8
|
import { zBQInt } from "./field/bqInt.cjs";
|
|
9
9
|
import { BQInt64, zBQInt64 } from "./field/bqInt64.cjs";
|
|
10
10
|
import { BQNumeric, zBQNumeric } from "./field/bqNumeric.cjs";
|
|
@@ -18,4 +18,4 @@ import { LanguageBQRow, languageBQRow } from "./lookup/language.cjs";
|
|
|
18
18
|
import { PartitionType, partitionType } from "./partitionType.cjs";
|
|
19
19
|
import { BQField, zodToBQSchema } from "./zodToBQDefinition.cjs";
|
|
20
20
|
import { BigqueryLoadFormat, Dataset, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table, TableDefinition } from "./types.cjs";
|
|
21
|
-
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema,
|
|
21
|
+
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQFloat, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
|
|
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "./field/bqDate.m
|
|
|
4
4
|
import { BQDateTime, BQDatetime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "./field/bqDateTime.mjs";
|
|
5
5
|
import { BQFieldMode, BQFieldModeSchema } from "./field/bqFieldMode.mjs";
|
|
6
6
|
import { BQFieldType, BQFieldTypeSchema } from "./field/bqFieldType.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { zBQFloat } from "./field/bqFloat.mjs";
|
|
8
8
|
import { zBQInt } from "./field/bqInt.mjs";
|
|
9
9
|
import { BQInt64, zBQInt64 } from "./field/bqInt64.mjs";
|
|
10
10
|
import { BQNumeric, zBQNumeric } from "./field/bqNumeric.mjs";
|
|
@@ -18,4 +18,4 @@ import { LanguageBQRow, languageBQRow } from "./lookup/language.mjs";
|
|
|
18
18
|
import { PartitionType, partitionType } from "./partitionType.mjs";
|
|
19
19
|
import { BQField, zodToBQSchema } from "./zodToBQDefinition.mjs";
|
|
20
20
|
import { BigqueryLoadFormat, Dataset, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table, TableDefinition } from "./types.mjs";
|
|
21
|
-
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema,
|
|
21
|
+
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, googleAdsAccountBQRow, googleCloudBQRow, languageBQRow, partitionType, zBQBytes, zBQFloat, zBQInt, zBQInt64, zBQNumeric, zBQTime, zLuxonDate, zLuxonDateTime, zodToBQSchema };
|
|
@@ -4,7 +4,7 @@ import { BQDate, decodeBQDate, encodeBQDate, zLuxonDate } from "./field/bqDate.m
|
|
|
4
4
|
import { BQDateTime, decodeBQDateTime, encodeBQDateTime, zLuxonDateTime } from "./field/bqDateTime.mjs";
|
|
5
5
|
import { BQFieldMode, BQFieldModeSchema } from "./field/bqFieldMode.mjs";
|
|
6
6
|
import { BQFieldType, BQFieldTypeSchema } from "./field/bqFieldType.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { zBQFloat } from "./field/bqFloat.mjs";
|
|
8
8
|
import { zBQInt } from "./field/bqInt.mjs";
|
|
9
9
|
import { BQInt64, zBQInt64 } from "./field/bqInt64.mjs";
|
|
10
10
|
import { BQNumeric, zBQNumeric } from "./field/bqNumeric.mjs";
|
|
@@ -17,4 +17,4 @@ import { googleCloudBQRow } from "./lookup/googleCloud.mjs";
|
|
|
17
17
|
import { languageBQRow } from "./lookup/language.mjs";
|
|
18
18
|
import { partitionType } from "./partitionType.mjs";
|
|
19
19
|
import { zodToBQSchema } from "./zodToBQDefinition.mjs";
|
|
20
|
-
export { BQBool, BQBytes, BQDate, BQDateTime, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema,
|
|
20
|
+
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_googleCloud_bigquery__shared_field_bqDateTime = require("../field/bqDateTime.cjs");
|
|
3
|
-
const
|
|
3
|
+
const require_googleCloud_bigquery__shared_field_bqStringNullable = require("../field/bqStringNullable.cjs");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
//#region src/googleCloud/bigquery/_shared/lookup/country.ts
|
|
6
6
|
/**
|
|
@@ -12,8 +12,8 @@ const countryBQRow = zod.z.object({
|
|
|
12
12
|
country: zod.z.string(),
|
|
13
13
|
alpha2: zod.z.string().nullable(),
|
|
14
14
|
alpha3: zod.z.string().nullable(),
|
|
15
|
-
google_ads_id:
|
|
16
|
-
meta_id:
|
|
15
|
+
google_ads_id: require_googleCloud_bigquery__shared_field_bqStringNullable.BQStringNullable,
|
|
16
|
+
meta_id: require_googleCloud_bigquery__shared_field_bqStringNullable.BQStringNullable,
|
|
17
17
|
inserted_at: require_googleCloud_bigquery__shared_field_bqDateTime.BQDateTime.transform(require_googleCloud_bigquery__shared_field_bqDateTime.decodeBQDateTime)
|
|
18
18
|
});
|
|
19
19
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BQDateTime, decodeBQDateTime } from "../field/bqDateTime.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { BQStringNullable } from "../field/bqStringNullable.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/googleCloud/bigquery/_shared/lookup/country.ts
|
|
5
5
|
/**
|
|
@@ -11,8 +11,8 @@ const countryBQRow = z.object({
|
|
|
11
11
|
country: z.string(),
|
|
12
12
|
alpha2: z.string().nullable(),
|
|
13
13
|
alpha3: z.string().nullable(),
|
|
14
|
-
google_ads_id:
|
|
15
|
-
meta_id:
|
|
14
|
+
google_ads_id: BQStringNullable,
|
|
15
|
+
meta_id: BQStringNullable,
|
|
16
16
|
inserted_at: BQDateTime.transform(decodeBQDateTime)
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_googleCloud_bigquery__shared_field_bqDateTime = require("../field/bqDateTime.cjs");
|
|
3
|
-
const
|
|
3
|
+
const require_googleCloud_bigquery__shared_field_bqStringNullable = require("../field/bqStringNullable.cjs");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
//#region src/googleCloud/bigquery/_shared/lookup/language.ts
|
|
6
6
|
/**
|
|
@@ -11,8 +11,8 @@ let zod = require("zod");
|
|
|
11
11
|
const languageBQRow = zod.z.object({
|
|
12
12
|
language: zod.z.string(),
|
|
13
13
|
iso2: zod.z.string().nullable(),
|
|
14
|
-
google_ads_id:
|
|
15
|
-
meta_id:
|
|
14
|
+
google_ads_id: require_googleCloud_bigquery__shared_field_bqStringNullable.BQStringNullable,
|
|
15
|
+
meta_id: require_googleCloud_bigquery__shared_field_bqStringNullable.BQStringNullable,
|
|
16
16
|
inserted_at: require_googleCloud_bigquery__shared_field_bqDateTime.BQDateTime.transform(require_googleCloud_bigquery__shared_field_bqDateTime.decodeBQDateTime)
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BQDateTime, decodeBQDateTime } from "../field/bqDateTime.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { BQStringNullable } from "../field/bqStringNullable.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/googleCloud/bigquery/_shared/lookup/language.ts
|
|
5
5
|
/**
|
|
@@ -10,8 +10,8 @@ import { z } from "zod";
|
|
|
10
10
|
const languageBQRow = z.object({
|
|
11
11
|
language: z.string(),
|
|
12
12
|
iso2: z.string().nullable(),
|
|
13
|
-
google_ads_id:
|
|
14
|
-
meta_id:
|
|
13
|
+
google_ads_id: BQStringNullable,
|
|
14
|
+
meta_id: BQStringNullable,
|
|
15
15
|
inserted_at: BQDateTime.transform(decodeBQDateTime)
|
|
16
16
|
});
|
|
17
17
|
//#endregion
|
|
@@ -8,7 +8,7 @@ import { QueryOptions } from "@google-cloud/bigquery";
|
|
|
8
8
|
/** The only load formats this library can actually serialise/pass through for loadTable/loadStreamTable. */
|
|
9
9
|
export type BigqueryLoadFormat = typeof fileType.CSV | typeof fileType.JSON_NEWLINE | typeof fileType.PARQUET;
|
|
10
10
|
export type TableDefinition = {
|
|
11
|
-
projectId
|
|
11
|
+
projectId: string;
|
|
12
12
|
datasetId: string;
|
|
13
13
|
tableId: string;
|
|
14
14
|
options?: {
|
|
@@ -45,18 +45,17 @@ export type LoadData<TData> = {
|
|
|
45
45
|
sourceFormat?: BigqueryLoadFormat;
|
|
46
46
|
region?: string;
|
|
47
47
|
};
|
|
48
|
-
table: {
|
|
49
|
-
|
|
50
|
-
tableId?: string;
|
|
51
|
-
region?: string;
|
|
52
|
-
definition?: TableDefinition;
|
|
48
|
+
table: TableDefinition & {
|
|
49
|
+
tableId: string;
|
|
53
50
|
};
|
|
51
|
+
autodetect?: boolean;
|
|
52
|
+
schema?: BQField[];
|
|
54
53
|
};
|
|
55
54
|
export type LoadTableProps = LoadData<any[]>;
|
|
56
55
|
export type LoadStreamTableProps = LoadData<RowSource<any>>;
|
|
57
56
|
export type MergeTableProps = Omit<LoadData<any[]>, "table"> & {
|
|
58
57
|
table: LoadData<any[]>["table"] & {
|
|
59
|
-
|
|
58
|
+
mergeColumns: string[];
|
|
60
59
|
updateColumns: string[];
|
|
61
60
|
};
|
|
62
61
|
};
|
|
@@ -8,7 +8,7 @@ import { QueryOptions } from "@google-cloud/bigquery";
|
|
|
8
8
|
/** The only load formats this library can actually serialise/pass through for loadTable/loadStreamTable. */
|
|
9
9
|
export type BigqueryLoadFormat = typeof fileType.CSV | typeof fileType.JSON_NEWLINE | typeof fileType.PARQUET;
|
|
10
10
|
export type TableDefinition = {
|
|
11
|
-
projectId
|
|
11
|
+
projectId: string;
|
|
12
12
|
datasetId: string;
|
|
13
13
|
tableId: string;
|
|
14
14
|
options?: {
|
|
@@ -45,18 +45,17 @@ export type LoadData<TData> = {
|
|
|
45
45
|
sourceFormat?: BigqueryLoadFormat;
|
|
46
46
|
region?: string;
|
|
47
47
|
};
|
|
48
|
-
table: {
|
|
49
|
-
|
|
50
|
-
tableId?: string;
|
|
51
|
-
region?: string;
|
|
52
|
-
definition?: TableDefinition;
|
|
48
|
+
table: TableDefinition & {
|
|
49
|
+
tableId: string;
|
|
53
50
|
};
|
|
51
|
+
autodetect?: boolean;
|
|
52
|
+
schema?: BQField[];
|
|
54
53
|
};
|
|
55
54
|
export type LoadTableProps = LoadData<any[]>;
|
|
56
55
|
export type LoadStreamTableProps = LoadData<RowSource<any>>;
|
|
57
56
|
export type MergeTableProps = Omit<LoadData<any[]>, "table"> & {
|
|
58
57
|
table: LoadData<any[]>["table"] & {
|
|
59
|
-
|
|
58
|
+
mergeColumns: string[];
|
|
60
59
|
updateColumns: string[];
|
|
61
60
|
};
|
|
62
61
|
};
|
|
@@ -5,14 +5,15 @@ const getBqType = (schema) => {
|
|
|
5
5
|
if ("bq:date" === schema.description) return "DATE";
|
|
6
6
|
if ("bq:datetime" === schema.description) return "DATETIME";
|
|
7
7
|
if ("bq:int" === schema.description) return "INTEGER";
|
|
8
|
+
if ("bq:float" === schema.description) return "FLOAT";
|
|
8
9
|
if ("bq:numeric" === schema.description) return "NUMERIC";
|
|
9
10
|
if ("bq:int64" === schema.description) return "INTEGER";
|
|
10
11
|
if ("bq:time" === schema.description) return "TIME";
|
|
11
12
|
if ("bq:bytes" === schema.description) return "BYTES";
|
|
12
13
|
if (schema instanceof zod.z.ZodString || schema instanceof zod.z.ZodEnum) return "STRING";
|
|
13
|
-
if (schema instanceof zod.z.ZodNumber) return "FLOAT";
|
|
14
14
|
if (schema instanceof zod.z.ZodBoolean) return "BOOLEAN";
|
|
15
15
|
if (schema instanceof zod.z.ZodDate) return "TIMESTAMP";
|
|
16
|
+
if (schema instanceof zod.z.ZodNumber) throw new Error("A BigQuery number field must be tagged zBQInt or zBQFloat - plain z.number() is ambiguous between INTEGER and FLOAT.");
|
|
16
17
|
throw new Error(`Cannot infer a BigQuery type for zod schema "${schema.constructor.name}".`);
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
@@ -37,7 +38,7 @@ const buildBQField = (name, fieldSchema) => {
|
|
|
37
38
|
name,
|
|
38
39
|
type: "RECORD",
|
|
39
40
|
mode,
|
|
40
|
-
|
|
41
|
+
subFields: zodToBQSchema(inner)
|
|
41
42
|
};
|
|
42
43
|
return {
|
|
43
44
|
name,
|
|
@@ -4,14 +4,15 @@ const getBqType = (schema) => {
|
|
|
4
4
|
if ("bq:date" === schema.description) return "DATE";
|
|
5
5
|
if ("bq:datetime" === schema.description) return "DATETIME";
|
|
6
6
|
if ("bq:int" === schema.description) return "INTEGER";
|
|
7
|
+
if ("bq:float" === schema.description) return "FLOAT";
|
|
7
8
|
if ("bq:numeric" === schema.description) return "NUMERIC";
|
|
8
9
|
if ("bq:int64" === schema.description) return "INTEGER";
|
|
9
10
|
if ("bq:time" === schema.description) return "TIME";
|
|
10
11
|
if ("bq:bytes" === schema.description) return "BYTES";
|
|
11
12
|
if (schema instanceof z.ZodString || schema instanceof z.ZodEnum) return "STRING";
|
|
12
|
-
if (schema instanceof z.ZodNumber) return "FLOAT";
|
|
13
13
|
if (schema instanceof z.ZodBoolean) return "BOOLEAN";
|
|
14
14
|
if (schema instanceof z.ZodDate) return "TIMESTAMP";
|
|
15
|
+
if (schema instanceof z.ZodNumber) throw new Error("A BigQuery number field must be tagged zBQInt or zBQFloat - plain z.number() is ambiguous between INTEGER and FLOAT.");
|
|
15
16
|
throw new Error(`Cannot infer a BigQuery type for zod schema "${schema.constructor.name}".`);
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
@@ -36,7 +37,7 @@ const buildBQField = (name, fieldSchema) => {
|
|
|
36
37
|
name,
|
|
37
38
|
type: "RECORD",
|
|
38
39
|
mode,
|
|
39
|
-
|
|
40
|
+
subFields: zodToBQSchema(inner)
|
|
40
41
|
};
|
|
41
42
|
return {
|
|
42
43
|
name,
|
|
@@ -27,7 +27,6 @@ exports.BQFieldMode = require_googleCloud_bigquery__shared_field_bqFieldMode.BQF
|
|
|
27
27
|
exports.BQFieldModeSchema = require_googleCloud_bigquery__shared_field_bqFieldMode.BQFieldModeSchema;
|
|
28
28
|
exports.BQFieldType = require_googleCloud_bigquery__shared_field_bqFieldType.BQFieldType;
|
|
29
29
|
exports.BQFieldTypeSchema = require_googleCloud_bigquery__shared_field_bqFieldType.BQFieldTypeSchema;
|
|
30
|
-
exports.BQFloat = require_googleCloud_bigquery__shared_field_bqFloat.BQFloat;
|
|
31
30
|
exports.BQInt64 = require_googleCloud_bigquery__shared_field_bqInt64.BQInt64;
|
|
32
31
|
exports.BQNumeric = require_googleCloud_bigquery__shared_field_bqNumeric.BQNumeric;
|
|
33
32
|
exports.BQString = require_googleCloud_bigquery__shared_field_bqString.BQString;
|
|
@@ -43,6 +42,7 @@ exports.googleCloudBQRow = require_googleCloud_bigquery__shared_lookup_googleClo
|
|
|
43
42
|
exports.languageBQRow = require_googleCloud_bigquery__shared_lookup_language.languageBQRow;
|
|
44
43
|
exports.partitionType = require_googleCloud_bigquery__shared_partitionType.partitionType;
|
|
45
44
|
exports.zBQBytes = require_googleCloud_bigquery__shared_field_bqBytes.zBQBytes;
|
|
45
|
+
exports.zBQFloat = require_googleCloud_bigquery__shared_field_bqFloat.zBQFloat;
|
|
46
46
|
exports.zBQInt = require_googleCloud_bigquery__shared_field_bqInt.zBQInt;
|
|
47
47
|
exports.zBQInt64 = require_googleCloud_bigquery__shared_field_bqInt64.zBQInt64;
|
|
48
48
|
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 {
|
|
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";
|
|
@@ -19,4 +19,4 @@ import { PartitionType, partitionType } from "../_shared/partitionType.cjs";
|
|
|
19
19
|
import { BQField, zodToBQSchema } from "../_shared/zodToBQDefinition.cjs";
|
|
20
20
|
import { BigqueryLoadFormat, Dataset, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table, TableDefinition } from "../_shared/types.cjs";
|
|
21
21
|
import "../_shared/index.cjs";
|
|
22
|
-
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema,
|
|
22
|
+
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, 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 {
|
|
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";
|
|
@@ -19,4 +19,4 @@ import { PartitionType, partitionType } from "../_shared/partitionType.mjs";
|
|
|
19
19
|
import { BQField, zodToBQSchema } from "../_shared/zodToBQDefinition.mjs";
|
|
20
20
|
import { BigqueryLoadFormat, Dataset, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, QueryInput, Table, TableDefinition } from "../_shared/types.mjs";
|
|
21
21
|
import "../_shared/index.mjs";
|
|
22
|
-
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema,
|
|
22
|
+
export { BQBool, BQBytes, BQDate, BQDateTime, BQDatetime, BQField, BQFieldMode, BQFieldModeSchema, BQFieldType, BQFieldTypeSchema, BQInt64, BQNumeric, BQString, BQTime, BQTimestamp, BigqueryLoadFormat, CountryBQRow, Dataset, GoogleAdsAccountBQRow, GoogleCloudBQRow, LanguageBQRow, LoadData, LoadStreamTableProps, LoadTableProps, MergeTableProps, PartitionType, QueryInput, Table, TableDefinition, countryBQRow, decodeBQDate, decodeBQDateTime, encodeBQDate, encodeBQDateTime, 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 {
|
|
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,
|
|
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
|
-
|
|
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.
|
|
@@ -147,12 +155,11 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
|
|
|
147
155
|
* pre-checking existence and silently skipping the load if it isn't there.
|
|
148
156
|
*/
|
|
149
157
|
loadData = async (props) => {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
autodetect: true,
|
|
158
|
+
const finalRegion = props.table.options?.location ?? this.region;
|
|
159
|
+
await this.createTable(props.table.datasetId, {}, props.table.tableId, props.table.options);
|
|
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), {
|
|
161
|
+
autodetect: props.schema ? false : props.autodetect ?? true,
|
|
162
|
+
schema: props.schema ? { fields: props.schema } : void 0,
|
|
156
163
|
sourceFormat: bigQuerySourceFormat[props.file.sourceFormat ?? require_file__shared_fileType.fileType.JSON_NEWLINE],
|
|
157
164
|
schemaUpdateOptions: ["ALLOW_FIELD_ADDITION"],
|
|
158
165
|
location: finalRegion
|
|
@@ -165,8 +172,14 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
|
|
|
165
172
|
* this library has no Parquet encoder.
|
|
166
173
|
*/
|
|
167
174
|
loadTable = async (props) => {
|
|
168
|
-
const
|
|
169
|
-
|
|
175
|
+
const finalSourceFormat = props.file?.sourceFormat ?? require_file__shared_fileType.fileType.JSON_NEWLINE;
|
|
176
|
+
let finalData;
|
|
177
|
+
switch (finalSourceFormat) {
|
|
178
|
+
case require_file__shared_fileType.fileType.JSON_NEWLINE:
|
|
179
|
+
finalData = require_json__shared_getJsonNewline.getJsonNewline(props.file.data);
|
|
180
|
+
break;
|
|
181
|
+
default: finalData = props.file.data;
|
|
182
|
+
}
|
|
170
183
|
await props.googleCloudStorage.writeFile(props.file.bucket, props.file.key, finalData);
|
|
171
184
|
await this.loadData(props);
|
|
172
185
|
};
|
|
@@ -198,12 +211,12 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
|
|
|
198
211
|
* Partitioning is immutable on an existing BigQuery table - changing it requires recreating the
|
|
199
212
|
* table and backfilling data, which this method deliberately does not attempt.
|
|
200
213
|
*/
|
|
201
|
-
|
|
202
|
-
const [metadata] = await this.client.dataset(datasetId).table(tableId).getMetadata();
|
|
214
|
+
updateTableClustering = async (table) => {
|
|
215
|
+
const [metadata] = await this.client.dataset(table.datasetId).table(table.tableId).getMetadata();
|
|
203
216
|
const currentFields = metadata?.clustering?.fields ?? [];
|
|
204
|
-
const desiredFields = clustering?.fields ?? [];
|
|
217
|
+
const desiredFields = table.options?.clustering?.fields ?? [];
|
|
205
218
|
if (currentFields.length === desiredFields.length && currentFields.every((field, index) => field === desiredFields[index])) return;
|
|
206
|
-
await this.client.dataset(datasetId).table(tableId).setMetadata(desiredFields.length > 0 ? { clustering: { fields: desiredFields } } : { clustering: void 0 });
|
|
219
|
+
await this.client.dataset(table.datasetId).table(table.tableId).setMetadata(desiredFields.length > 0 ? { clustering: { fields: desiredFields } } : { clustering: void 0 });
|
|
207
220
|
};
|
|
208
221
|
/**
|
|
209
222
|
* Upsert rows into a table via a staging table + a single MERGE statement.
|
|
@@ -214,18 +227,16 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
|
|
|
214
227
|
*/
|
|
215
228
|
mergeTable = async (props) => {
|
|
216
229
|
if (0 === props.file.data.length) return;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (await this.tableExists(props.table.datasetId, finalTableId)) await this.syncTableClustering(props.table.datasetId, finalTableId, props.table.definition?.options?.clustering);
|
|
220
|
-
const stagingTableId = `${finalTableId}_staging_${require_date__shared_format.getYmdHisNumber()}`;
|
|
230
|
+
if (await this.tableExists(props.table.datasetId, props.table.tableId)) await this.updateTableClustering(props.table);
|
|
231
|
+
const stagingTableId = `${props.table.tableId}_staging_${require_date__shared_format.getYmdHisNumber()}`;
|
|
221
232
|
const stagingTableRef = `\`${props.table.datasetId}.${stagingTableId}\``;
|
|
222
233
|
try {
|
|
234
|
+
const { mergeColumns: _mergeColumns, updateColumns: _updateColumns, ...tableDefinition } = props.table;
|
|
223
235
|
const stagingDefinition = {
|
|
224
|
-
...
|
|
225
|
-
datasetId: props.table.datasetId,
|
|
236
|
+
...tableDefinition,
|
|
226
237
|
tableId: stagingTableId,
|
|
227
|
-
options: props.table.
|
|
228
|
-
...props.table.
|
|
238
|
+
options: props.table.options ? {
|
|
239
|
+
...props.table.options,
|
|
229
240
|
timePartitioning: void 0,
|
|
230
241
|
clustering: void 0
|
|
231
242
|
} : void 0
|
|
@@ -233,20 +244,16 @@ var GoogleCloudBigquery = class extends require__class__shared_BaseNamespace.Bas
|
|
|
233
244
|
await this.loadTable({
|
|
234
245
|
googleCloudStorage: props.googleCloudStorage,
|
|
235
246
|
file: props.file,
|
|
236
|
-
table:
|
|
237
|
-
datasetId: props.table.datasetId,
|
|
238
|
-
definition: stagingDefinition,
|
|
239
|
-
tableId: stagingTableId,
|
|
240
|
-
region: props.table.region
|
|
241
|
-
}
|
|
247
|
+
table: stagingDefinition
|
|
242
248
|
});
|
|
243
|
-
const mainTableRef = `\`${props.table.datasetId}.${
|
|
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.");
|
|
244
251
|
const updateSet = props.table.updateColumns.map((column) => `${column} = S.${column}`).join(", ");
|
|
245
|
-
const allColumns = props.table.
|
|
252
|
+
const allColumns = props.table.options?.schema.map((field) => field.name) ?? [];
|
|
246
253
|
const mergeQuery = `
|
|
247
254
|
MERGE ${mainTableRef} AS T
|
|
248
255
|
USING ${stagingTableRef} AS S
|
|
249
|
-
ON
|
|
256
|
+
ON ${props.table.mergeColumns.map((key) => `T.${key} = S.${key}`).join(" AND ")}
|
|
250
257
|
WHEN MATCHED THEN
|
|
251
258
|
UPDATE SET ${updateSet}
|
|
252
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<
|
|
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?:
|
|
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
|
|
@@ -79,7 +84,7 @@ export declare class GoogleCloudBigquery extends BaseNamespace {
|
|
|
79
84
|
* Partitioning is immutable on an existing BigQuery table - changing it requires recreating the
|
|
80
85
|
* table and backfilling data, which this method deliberately does not attempt.
|
|
81
86
|
*/
|
|
82
|
-
private
|
|
87
|
+
private updateTableClustering;
|
|
83
88
|
/**
|
|
84
89
|
* Upsert rows into a table via a staging table + a single MERGE statement.
|
|
85
90
|
*
|
|
@@ -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<
|
|
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?:
|
|
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
|
|
@@ -79,7 +84,7 @@ export declare class GoogleCloudBigquery extends BaseNamespace {
|
|
|
79
84
|
* Partitioning is immutable on an existing BigQuery table - changing it requires recreating the
|
|
80
85
|
* table and backfilling data, which this method deliberately does not attempt.
|
|
81
86
|
*/
|
|
82
|
-
private
|
|
87
|
+
private updateTableClustering;
|
|
83
88
|
/**
|
|
84
89
|
* Upsert rows into a table via a staging table + a single MERGE statement.
|
|
85
90
|
*
|
|
@@ -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
|
-
|
|
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.
|
|
@@ -146,12 +154,11 @@ var GoogleCloudBigquery = class extends BaseNamespace {
|
|
|
146
154
|
* pre-checking existence and silently skipping the load if it isn't there.
|
|
147
155
|
*/
|
|
148
156
|
loadData = async (props) => {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
autodetect: true,
|
|
157
|
+
const finalRegion = props.table.options?.location ?? this.region;
|
|
158
|
+
await this.createTable(props.table.datasetId, {}, props.table.tableId, props.table.options);
|
|
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), {
|
|
160
|
+
autodetect: props.schema ? false : props.autodetect ?? true,
|
|
161
|
+
schema: props.schema ? { fields: props.schema } : void 0,
|
|
155
162
|
sourceFormat: bigQuerySourceFormat[props.file.sourceFormat ?? fileType.JSON_NEWLINE],
|
|
156
163
|
schemaUpdateOptions: ["ALLOW_FIELD_ADDITION"],
|
|
157
164
|
location: finalRegion
|
|
@@ -164,8 +171,14 @@ var GoogleCloudBigquery = class extends BaseNamespace {
|
|
|
164
171
|
* this library has no Parquet encoder.
|
|
165
172
|
*/
|
|
166
173
|
loadTable = async (props) => {
|
|
167
|
-
const
|
|
168
|
-
|
|
174
|
+
const finalSourceFormat = props.file?.sourceFormat ?? fileType.JSON_NEWLINE;
|
|
175
|
+
let finalData;
|
|
176
|
+
switch (finalSourceFormat) {
|
|
177
|
+
case fileType.JSON_NEWLINE:
|
|
178
|
+
finalData = getJsonNewline(props.file.data);
|
|
179
|
+
break;
|
|
180
|
+
default: finalData = props.file.data;
|
|
181
|
+
}
|
|
169
182
|
await props.googleCloudStorage.writeFile(props.file.bucket, props.file.key, finalData);
|
|
170
183
|
await this.loadData(props);
|
|
171
184
|
};
|
|
@@ -197,12 +210,12 @@ var GoogleCloudBigquery = class extends BaseNamespace {
|
|
|
197
210
|
* Partitioning is immutable on an existing BigQuery table - changing it requires recreating the
|
|
198
211
|
* table and backfilling data, which this method deliberately does not attempt.
|
|
199
212
|
*/
|
|
200
|
-
|
|
201
|
-
const [metadata] = await this.client.dataset(datasetId).table(tableId).getMetadata();
|
|
213
|
+
updateTableClustering = async (table) => {
|
|
214
|
+
const [metadata] = await this.client.dataset(table.datasetId).table(table.tableId).getMetadata();
|
|
202
215
|
const currentFields = metadata?.clustering?.fields ?? [];
|
|
203
|
-
const desiredFields = clustering?.fields ?? [];
|
|
216
|
+
const desiredFields = table.options?.clustering?.fields ?? [];
|
|
204
217
|
if (currentFields.length === desiredFields.length && currentFields.every((field, index) => field === desiredFields[index])) return;
|
|
205
|
-
await this.client.dataset(datasetId).table(tableId).setMetadata(desiredFields.length > 0 ? { clustering: { fields: desiredFields } } : { clustering: void 0 });
|
|
218
|
+
await this.client.dataset(table.datasetId).table(table.tableId).setMetadata(desiredFields.length > 0 ? { clustering: { fields: desiredFields } } : { clustering: void 0 });
|
|
206
219
|
};
|
|
207
220
|
/**
|
|
208
221
|
* Upsert rows into a table via a staging table + a single MERGE statement.
|
|
@@ -213,18 +226,16 @@ var GoogleCloudBigquery = class extends BaseNamespace {
|
|
|
213
226
|
*/
|
|
214
227
|
mergeTable = async (props) => {
|
|
215
228
|
if (0 === props.file.data.length) return;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (await this.tableExists(props.table.datasetId, finalTableId)) await this.syncTableClustering(props.table.datasetId, finalTableId, props.table.definition?.options?.clustering);
|
|
219
|
-
const stagingTableId = `${finalTableId}_staging_${getYmdHisNumber()}`;
|
|
229
|
+
if (await this.tableExists(props.table.datasetId, props.table.tableId)) await this.updateTableClustering(props.table);
|
|
230
|
+
const stagingTableId = `${props.table.tableId}_staging_${getYmdHisNumber()}`;
|
|
220
231
|
const stagingTableRef = `\`${props.table.datasetId}.${stagingTableId}\``;
|
|
221
232
|
try {
|
|
233
|
+
const { mergeColumns: _mergeColumns, updateColumns: _updateColumns, ...tableDefinition } = props.table;
|
|
222
234
|
const stagingDefinition = {
|
|
223
|
-
...
|
|
224
|
-
datasetId: props.table.datasetId,
|
|
235
|
+
...tableDefinition,
|
|
225
236
|
tableId: stagingTableId,
|
|
226
|
-
options: props.table.
|
|
227
|
-
...props.table.
|
|
237
|
+
options: props.table.options ? {
|
|
238
|
+
...props.table.options,
|
|
228
239
|
timePartitioning: void 0,
|
|
229
240
|
clustering: void 0
|
|
230
241
|
} : void 0
|
|
@@ -232,20 +243,16 @@ var GoogleCloudBigquery = class extends BaseNamespace {
|
|
|
232
243
|
await this.loadTable({
|
|
233
244
|
googleCloudStorage: props.googleCloudStorage,
|
|
234
245
|
file: props.file,
|
|
235
|
-
table:
|
|
236
|
-
datasetId: props.table.datasetId,
|
|
237
|
-
definition: stagingDefinition,
|
|
238
|
-
tableId: stagingTableId,
|
|
239
|
-
region: props.table.region
|
|
240
|
-
}
|
|
246
|
+
table: stagingDefinition
|
|
241
247
|
});
|
|
242
|
-
const mainTableRef = `\`${props.table.datasetId}.${
|
|
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.");
|
|
243
250
|
const updateSet = props.table.updateColumns.map((column) => `${column} = S.${column}`).join(", ");
|
|
244
|
-
const allColumns = props.table.
|
|
251
|
+
const allColumns = props.table.options?.schema.map((field) => field.name) ?? [];
|
|
245
252
|
const mergeQuery = `
|
|
246
253
|
MERGE ${mainTableRef} AS T
|
|
247
254
|
USING ${stagingTableRef} AS S
|
|
248
|
-
ON
|
|
255
|
+
ON ${props.table.mergeColumns.map((key) => `T.${key} = S.${key}`).join(" AND ")}
|
|
249
256
|
WHEN MATCHED THEN
|
|
250
257
|
UPDATE SET ${updateSet}
|
|
251
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 {
|
|
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,
|
|
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 {
|
|
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,
|
|
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 {
|
|
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,
|
|
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 };
|
|
@@ -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
|
-
|
|
17
|
-
await
|
|
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
|
-
|
|
14
|
-
await
|
|
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.
|
|
5
|
-
"packageManager": "yarn@4.18.
|
|
4
|
+
"version": "3.2.11",
|
|
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.
|
|
200
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
201
|
-
"@aws-sdk/client-ec2": "^3.
|
|
202
|
-
"@aws-sdk/client-ecs": "^3.
|
|
203
|
-
"@aws-sdk/client-glue": "^3.
|
|
204
|
-
"@aws-sdk/client-lambda": "^3.
|
|
205
|
-
"@aws-sdk/client-s3": "^3.
|
|
206
|
-
"@aws-sdk/client-sesv2": "^3.
|
|
207
|
-
"@aws-sdk/client-sqs": "^3.
|
|
208
|
-
"@aws-sdk/client-ssm": "^3.
|
|
209
|
-
"@aws-sdk/client-sts": "^3.
|
|
210
|
-
"@aws-sdk/lib-storage": "^3.
|
|
211
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
|
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.
|
|
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.
|
|
229
|
-
"@types/node": "^24.19.
|
|
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.
|
|
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.
|
|
241
|
-
"next": "^16.3.
|
|
242
|
-
"pg": "^8.23.
|
|
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"
|