@flytedesk/app-kit 3.1.0 → 3.2.1
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/bigquery/index.d.ts +1 -0
- package/dist/bigquery/index.js +1 -0
- package/dist/bigquery/index.js.map +1 -1
- package/dist/bigquery/types.d.ts +3 -3
- package/dist/bigquery/values.d.ts +18 -0
- package/dist/bigquery/values.js +35 -0
- package/dist/bigquery/values.js.map +1 -0
- package/package.json +1 -1
package/dist/bigquery/index.d.ts
CHANGED
|
@@ -45,5 +45,6 @@ export { extractTableToGCS, getExtractJobStatus, waitForExtractJob, } from "./ex
|
|
|
45
45
|
export { loadRowsWithRetry } from "./load.js";
|
|
46
46
|
export type { LoadRowsOptions } from "./load.js";
|
|
47
47
|
export { buildJobLabels, sanitizeLabelValue } from "./labels.js";
|
|
48
|
+
export { unwrapBigQueryCount, unwrapBigQueryValue } from "./values.js";
|
|
48
49
|
export { BadQueryError, BigQueryReadError, DryRunBudgetExceededError, PermissionDeniedError, classifyBigQueryError, isRetryableBigQueryError, } from "./errors.js";
|
|
49
50
|
export type { BigQueryApiErrorDetail, BigQueryCreateQueryJobOptions, BigQueryDatasetLike, BigQueryExtractOptions, BigQueryJobLike, BigQueryJobMetadata, BigQueryLike, BigQueryLoadOptions, BigQueryNextQuery, BigQueryQueryResultsOptions, BigQuerySchemaField, BigQueryTableLike, BigQueryWriteStreamLike, DryRunEstimate, EstimateQueryBytesOptions, ExtractJobHandle, ExtractJobState, ExtractJobStatus, ExtractTableToGCSInput, GcsFileLike, JobLabelInput, QueryPage, RunQueryOptions, WaitForExtractJobOptions, } from "./types.js";
|
package/dist/bigquery/index.js
CHANGED
|
@@ -43,5 +43,6 @@ export { runQuery, runQueryAllPages, estimateQueryBytes } from "./query.js";
|
|
|
43
43
|
export { extractTableToGCS, getExtractJobStatus, waitForExtractJob, } from "./extract.js";
|
|
44
44
|
export { loadRowsWithRetry } from "./load.js";
|
|
45
45
|
export { buildJobLabels, sanitizeLabelValue } from "./labels.js";
|
|
46
|
+
export { unwrapBigQueryCount, unwrapBigQueryValue } from "./values.js";
|
|
46
47
|
export { BadQueryError, BigQueryReadError, DryRunBudgetExceededError, PermissionDeniedError, classifyBigQueryError, isRetryableBigQueryError, } from "./errors.js";
|
|
47
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bigquery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bigquery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
|
package/dist/bigquery/types.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface BigQueryCreateQueryJobOptions {
|
|
|
58
58
|
/** Positional (`?`) or named (`@name`) query parameters. */
|
|
59
59
|
params?: unknown[] | Record<string, unknown>;
|
|
60
60
|
/** Only needed when the SDK can't infer a param's BigQuery type. */
|
|
61
|
-
types?:
|
|
61
|
+
types?: string[] | Record<string, string>;
|
|
62
62
|
labels?: Record<string, string>;
|
|
63
63
|
dryRun?: boolean;
|
|
64
64
|
location?: string;
|
|
@@ -130,7 +130,7 @@ export interface RunQueryOptions {
|
|
|
130
130
|
* values — never string-interpolate them into `sql`. */
|
|
131
131
|
sql: string;
|
|
132
132
|
params?: unknown[] | Record<string, unknown>;
|
|
133
|
-
types?:
|
|
133
|
+
types?: string[] | Record<string, string>;
|
|
134
134
|
labels?: Record<string, string>;
|
|
135
135
|
location?: string;
|
|
136
136
|
/** Page size. Omit to let BigQuery pick a default. */
|
|
@@ -147,7 +147,7 @@ export interface QueryPage<T = Record<string, unknown>> {
|
|
|
147
147
|
export interface EstimateQueryBytesOptions {
|
|
148
148
|
sql: string;
|
|
149
149
|
params?: unknown[] | Record<string, unknown>;
|
|
150
|
-
types?:
|
|
150
|
+
types?: string[] | Record<string, string>;
|
|
151
151
|
location?: string;
|
|
152
152
|
/** When given, `estimateQueryBytes` throws `DryRunBudgetExceededError`
|
|
153
153
|
* instead of returning once the estimate exceeds this many bytes. */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-value normalisation — BigQuery's client library hands some column
|
|
3
|
+
* types back as its own wrapper objects rather than plain JS primitives
|
|
4
|
+
* (NUMERIC -> a `Big` instance exposing `.toNumber()`, TIMESTAMP/DATE -> an
|
|
5
|
+
* object exposing `.value`, an ISO string). Every other type (STRING,
|
|
6
|
+
* INTEGER, FLOAT, BOOLEAN, null) passes through unchanged. Generalized out
|
|
7
|
+
* of media-planner's identical helper (also independently ported into
|
|
8
|
+
* flytedesk-id's `src/lib/bigquery.ts`, MP-200/PLN-2 — this is that helper's
|
|
9
|
+
* one shared home).
|
|
10
|
+
*/
|
|
11
|
+
/** Unwraps a single BigQuery result-row value into a plain,
|
|
12
|
+
* JSON-serializable value. */
|
|
13
|
+
export declare function unwrapBigQueryValue(value: unknown): unknown;
|
|
14
|
+
/** Unwraps a BigQuery result-row value and coerces it to a number —
|
|
15
|
+
* convenient for `SELECT COUNT(*) AS total` / other scalar-aggregate
|
|
16
|
+
* results, which the client library may hand back as a NUMERIC wrapper
|
|
17
|
+
* rather than a plain number. Missing/unparseable values become 0. */
|
|
18
|
+
export declare function unwrapBigQueryCount(value: unknown): number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-value normalisation — BigQuery's client library hands some column
|
|
3
|
+
* types back as its own wrapper objects rather than plain JS primitives
|
|
4
|
+
* (NUMERIC -> a `Big` instance exposing `.toNumber()`, TIMESTAMP/DATE -> an
|
|
5
|
+
* object exposing `.value`, an ISO string). Every other type (STRING,
|
|
6
|
+
* INTEGER, FLOAT, BOOLEAN, null) passes through unchanged. Generalized out
|
|
7
|
+
* of media-planner's identical helper (also independently ported into
|
|
8
|
+
* flytedesk-id's `src/lib/bigquery.ts`, MP-200/PLN-2 — this is that helper's
|
|
9
|
+
* one shared home).
|
|
10
|
+
*/
|
|
11
|
+
/** Unwraps a single BigQuery result-row value into a plain,
|
|
12
|
+
* JSON-serializable value. */
|
|
13
|
+
export function unwrapBigQueryValue(value) {
|
|
14
|
+
if (value === null || value === undefined)
|
|
15
|
+
return value;
|
|
16
|
+
if (typeof value === "object") {
|
|
17
|
+
if ("toNumber" in value && typeof value.toNumber === "function") {
|
|
18
|
+
return value.toNumber();
|
|
19
|
+
}
|
|
20
|
+
if ("value" in value) {
|
|
21
|
+
return value.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
/** Unwraps a BigQuery result-row value and coerces it to a number —
|
|
27
|
+
* convenient for `SELECT COUNT(*) AS total` / other scalar-aggregate
|
|
28
|
+
* results, which the client library may hand back as a NUMERIC wrapper
|
|
29
|
+
* rather than a plain number. Missing/unparseable values become 0. */
|
|
30
|
+
export function unwrapBigQueryCount(value) {
|
|
31
|
+
const raw = unwrapBigQueryValue(value);
|
|
32
|
+
const num = typeof raw === "number" ? raw : Number(raw ?? 0);
|
|
33
|
+
return Number.isFinite(num) ? num : 0;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/bigquery/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;+BAC+B;AAC/B,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,UAAU,IAAI,KAAK,IAAI,OAAQ,KAA+B,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC3F,OAAQ,KAAgC,CAAC,QAAQ,EAAE,CAAC;QACtD,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;YACrB,OAAQ,KAA4B,CAAC,KAAK,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;uEAGuE;AACvE,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
package/package.json
CHANGED