@flytedesk/app-kit 7.6.0 → 9.0.0

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 (52) hide show
  1. package/README.md +49 -10
  2. package/dist/auth/client/authSession.d.ts +6 -0
  3. package/dist/auth/client/authSession.js +34 -10
  4. package/dist/auth/client/authSession.js.map +1 -1
  5. package/dist/auth/client/httpClient.d.ts +1 -3
  6. package/dist/auth/client/httpClient.js +4 -3
  7. package/dist/auth/client/httpClient.js.map +1 -1
  8. package/dist/bigquery/client.d.ts +3 -0
  9. package/dist/bigquery/client.js +2 -0
  10. package/dist/bigquery/client.js.map +1 -1
  11. package/dist/bigquery/errors.d.ts +60 -8
  12. package/dist/bigquery/errors.js +221 -22
  13. package/dist/bigquery/errors.js.map +1 -1
  14. package/dist/bigquery/index.d.ts +7 -3
  15. package/dist/bigquery/index.js +3 -2
  16. package/dist/bigquery/index.js.map +1 -1
  17. package/dist/bigquery/insert.d.ts +10 -0
  18. package/dist/bigquery/insert.js +22 -0
  19. package/dist/bigquery/insert.js.map +1 -0
  20. package/dist/bigquery/jobIdentity.d.ts +39 -0
  21. package/dist/bigquery/jobIdentity.js +83 -0
  22. package/dist/bigquery/jobIdentity.js.map +1 -0
  23. package/dist/bigquery/load.d.ts +11 -14
  24. package/dist/bigquery/load.js +132 -56
  25. package/dist/bigquery/load.js.map +1 -1
  26. package/dist/bigquery/query.d.ts +19 -1
  27. package/dist/bigquery/query.js +143 -48
  28. package/dist/bigquery/query.js.map +1 -1
  29. package/dist/bigquery/retry.d.ts +56 -0
  30. package/dist/bigquery/retry.js +110 -0
  31. package/dist/bigquery/retry.js.map +1 -0
  32. package/dist/bigquery/types.d.ts +51 -5
  33. package/dist/bigquery/values.d.ts +3 -0
  34. package/dist/bigquery/values.js +5 -0
  35. package/dist/bigquery/values.js.map +1 -1
  36. package/dist/chat/callback-secret.js +6 -1
  37. package/dist/chat/callback-secret.js.map +1 -1
  38. package/dist/chat/env.js.map +1 -1
  39. package/dist/chat/index.d.ts +8 -4
  40. package/dist/chat/index.js +7 -3
  41. package/dist/chat/index.js.map +1 -1
  42. package/dist/chat/job-status.js +10 -3
  43. package/dist/chat/job-status.js.map +1 -1
  44. package/dist/chat/launcher.d.ts +3 -4
  45. package/dist/chat/launcher.js +21 -29
  46. package/dist/chat/launcher.js.map +1 -1
  47. package/dist/chat/mcp-protocol.js +45 -13
  48. package/dist/chat/mcp-protocol.js.map +1 -1
  49. package/dist/chat/mcp-server.js +6 -2
  50. package/dist/chat/mcp-server.js.map +1 -1
  51. package/dist/chat/types.d.ts +8 -12
  52. package/package.json +1 -1
@@ -30,6 +30,17 @@ export class RateLimitExceededError extends BigQueryReadError {
30
30
  this.name = "RateLimitExceededError";
31
31
  }
32
32
  }
33
+ /** BigQuery failed on its own side (`jobBackendError`, `backendError`,
34
+ * `internalError`, `jobInternalError`, `tableUnavailable`; Google's message for the first reads
35
+ * "Retrying the job may solve the problem"). Transient, and the caller's
36
+ * request is not at fault, so it is distinct from BadQueryError even when
37
+ * Google reports it with HTTP 400. Retried like RateLimitExceededError. */
38
+ export class TransientBackendError extends BigQueryReadError {
39
+ constructor(message, cause) {
40
+ super(message, cause);
41
+ this.name = "TransientBackendError";
42
+ }
43
+ }
33
44
  /** A dry-run estimate exceeded the caller-supplied byte budget — thrown
34
45
  * before any billable query actually runs. */
35
46
  export class DryRunBudgetExceededError extends BigQueryReadError {
@@ -83,10 +94,21 @@ export class MaximumBytesBilledExceededError extends BigQueryReadError {
83
94
  this.name = "MaximumBytesBilledExceededError";
84
95
  }
85
96
  }
97
+ /** A streaming insert was partially rejected (the SDK's `PartialFailureError`).
98
+ * `rowErrors` keeps each rejected row with its `{reason, message}` entries. */
99
+ export class InsertRowsPartialFailureError extends BigQueryReadError {
100
+ rowErrors;
101
+ constructor(rowErrors, cause) {
102
+ const first = rowErrors[0]?.errors?.[0];
103
+ super(`BigQuery rejected ${rowErrors.length} row(s) of a streaming insert${first ? `: ${first.reason ?? "unknown"}: ${first.message ?? ""}` : ""}`, cause);
104
+ this.rowErrors = rowErrors;
105
+ this.name = "InsertRowsPartialFailureError";
106
+ }
107
+ }
86
108
  /** Reason codes the Google APIs client library attaches to a rejected job
87
109
  * promise's `.errors[]` — see
88
110
  * https://cloud.google.com/bigquery/docs/error-messages for the full list.
89
- * Anything not in these two sets falls through to the generic
111
+ * Anything not in these sets falls through to the generic
90
112
  * BigQueryReadError rather than being mis-classified. */
91
113
  const PERMISSION_DENIED_REASONS = new Set([
92
114
  "accessDenied",
@@ -99,34 +121,103 @@ const BAD_QUERY_REASONS = new Set([
99
121
  "parseError",
100
122
  "invalidQueryParameter",
101
123
  ]);
102
- /** BigQuery's own rate-limit/quota class of error — e.g. "too many table
103
- * update operations for this table" on a load job. Transient: the same job
104
- * almost always succeeds seconds later, so callers (see `loadRowsWithRetry`
105
- * in ./load.js) retry on this and only this. */
106
- const RATE_LIMIT_REASONS = new Set(["rateLimitExceeded", "quotaExceeded"]);
124
+ /** Reasons that classify as `RateLimitExceededError`. Classification is wider
125
+ * than what `runQuery` retries: Google gives no retry guidance for
126
+ * `quotaExceeded`, so `runQuery` and `estimateQueryBytes` never retry it. The
127
+ * load helpers retried it before SMS-293 and still do (see
128
+ * `TransientPolicy`). */
129
+ const RATE_LIMIT_REASONS = new Set([
130
+ "rateLimitExceeded",
131
+ "quotaExceeded",
132
+ "jobRateLimitExceeded",
133
+ ]);
107
134
  const RATE_LIMIT_REASON_TEXT = new RegExp([...RATE_LIMIT_REASONS].join("|"));
135
+ /** Reasons that say the JOB failed, which Google's error-messages table says to
136
+ * resubmit as a new job (new job id). */
137
+ const JOB_LEVEL_REASONS = new Set([
138
+ "jobBackendError",
139
+ "jobInternalError",
140
+ "jobRateLimitExceeded",
141
+ ]);
142
+ /** Reasons BigQuery reports for a failed REQUEST (creating a job, checking a
143
+ * job's status, fetching its results). Against an existing job the answer is
144
+ * to wait and ask again about that same job, never to start another. */
145
+ const REQUEST_LEVEL_BACKEND_REASONS = new Set([
146
+ "backendError",
147
+ "internalError",
148
+ // Google's error-messages table (cloud.google.com/bigquery/docs/error-messages)
149
+ // says to retry it, following the internalError suggestions.
150
+ "tableUnavailable",
151
+ ]);
152
+ /** Every reason that classifies as `TransientBackendError`. */
153
+ const BACKEND_ERROR_REASONS = new Set([
154
+ "jobBackendError",
155
+ "jobInternalError",
156
+ ...REQUEST_LEVEL_BACKEND_REASONS,
157
+ ]);
158
+ /** What `runQuery` retries on a request: rate limiting and backend failures,
159
+ * never `quotaExceeded`. */
160
+ const REQUEST_RETRY_REASONS = new Set([
161
+ ...REQUEST_LEVEL_BACKEND_REASONS,
162
+ "rateLimitExceeded",
163
+ ]);
164
+ const REQUEST_RETRY_REASON_TEXT = /rateLimitExceeded/;
108
165
  /** BigQuery reports a `maximumBytesBilled` refusal as an `invalidQuery`-
109
166
  * reasoned error whose message reads e.g. "Query exceeded limit for bytes
110
167
  * billed: 123456789. Limit: 100000000." — text-matched (case-insensitively)
111
168
  * since it shares its `reason` with every other bad-query case. */
112
169
  const MAXIMUM_BYTES_BILLED_REASON_TEXT = /bytes billed/i;
170
+ function reasonsOf(err) {
171
+ if (!err || typeof err !== "object")
172
+ return [];
173
+ const entries = err.errors;
174
+ if (!Array.isArray(entries))
175
+ return [];
176
+ return entries.flatMap((cause) => cause && typeof cause.reason === "string" ? [cause.reason] : []);
177
+ }
178
+ /** True when the error list carries a fault of the caller (a bad query or
179
+ * missing permission). A caller fault wins over a transient reason listed
180
+ * beside it: resubmitting the same request cannot fix it. */
181
+ function hasCallerFault(err) {
182
+ return reasonsOf(err).some((reason) => BAD_QUERY_REASONS.has(reason) || PERMISSION_DENIED_REASONS.has(reason));
183
+ }
184
+ /** The structured `errors[]` entry that carries a caller fault. */
185
+ function callerFaultCause(apiErr) {
186
+ return apiErr?.errors?.find((cause) => cause.reason !== undefined &&
187
+ (BAD_QUERY_REASONS.has(cause.reason) ||
188
+ PERMISSION_DENIED_REASONS.has(cause.reason)));
189
+ }
113
190
  /** The structured `errors[]` entry that carries a rate-limit reason, wherever it
114
191
  * sits in the list — so a rate limit reported as a later entry is both detected
115
192
  * and described by its own message, not an unrelated sibling's. */
116
193
  function rateLimitCause(apiErr) {
117
194
  return apiErr?.errors?.find((cause) => cause.reason !== undefined && RATE_LIMIT_REASONS.has(cause.reason));
118
195
  }
196
+ /** The structured `errors[]` entry that carries a backend-failure reason. */
197
+ function backendCause(apiErr) {
198
+ return apiErr?.errors?.find((cause) => cause.reason !== undefined && BACKEND_ERROR_REASONS.has(cause.reason));
199
+ }
200
+ /** True when BigQuery reports it failed on its own side: a structured
201
+ * `errors[].reason` in BACKEND_ERROR_REASONS, with no caller fault beside it. */
202
+ function isBackendFailure(err) {
203
+ if (err instanceof TransientBackendError)
204
+ return true;
205
+ if (!err || typeof err !== "object" || hasCallerFault(err))
206
+ return false;
207
+ return backendCause(err) !== undefined;
208
+ }
119
209
  /**
120
210
  * The one definition of "BigQuery rate-limited this call", shared by
121
- * `classifyBigQueryError` and `isRetryableBigQueryError` so that what gets
122
- * retried and how a retry-exhausted failure is reported can never disagree.
211
+ * `classifyBigQueryError` and the retry predicates so that what gets retried
212
+ * and how a retry-exhausted failure is reported can never disagree.
123
213
  * True for any structured `errors[].reason` in RATE_LIMIT_REASONS or, for a raw
124
- * REST error with no `errors[]`, that reason text in its `message`.
214
+ * REST error with no `errors[]`, that reason text in its `message`; never when
215
+ * a caller fault is listed beside it.
125
216
  */
126
217
  function isRateLimited(err) {
127
218
  if (err instanceof RateLimitExceededError)
128
219
  return true;
129
- if (!err || typeof err !== "object")
220
+ if (!err || typeof err !== "object" || hasCallerFault(err))
130
221
  return false;
131
222
  const apiErr = err;
132
223
  if (rateLimitCause(apiErr))
@@ -144,9 +235,13 @@ export function classifyBigQueryError(err) {
144
235
  if (err instanceof BigQueryReadError)
145
236
  return err;
146
237
  const apiErr = err;
147
- // The entry that explains the classification: the rate-limit cause when there
148
- // is one (it decides the class below), otherwise the first reported error.
149
- const detail = rateLimitCause(apiErr) ?? apiErr?.errors?.[0];
238
+ // The entry that explains the classification: the caller fault when one is
239
+ // listed (it outranks a transient reason beside it), else the rate-limit or
240
+ // backend cause, else the first reported error.
241
+ const detail = callerFaultCause(apiErr) ??
242
+ rateLimitCause(apiErr) ??
243
+ backendCause(apiErr) ??
244
+ apiErr?.errors?.[0];
150
245
  const reason = detail?.reason;
151
246
  const message = detail?.message ??
152
247
  apiErr?.message ??
@@ -154,6 +249,9 @@ export function classifyBigQueryError(err) {
154
249
  if (isRateLimited(err)) {
155
250
  return new RateLimitExceededError(message, err);
156
251
  }
252
+ if (isBackendFailure(err)) {
253
+ return new TransientBackendError(message, err);
254
+ }
157
255
  if (reason && PERMISSION_DENIED_REASONS.has(reason)) {
158
256
  return new PermissionDeniedError(message, err);
159
257
  }
@@ -171,15 +269,86 @@ export function classifyBigQueryError(err) {
171
269
  }
172
270
  return new BigQueryReadError(message, err);
173
271
  }
174
- /**
175
- * True only for BigQuery's own rate-limit/quota class of error. Deliberately
176
- * narrow: a bad schema, a permissions/auth failure, or any other error must
177
- * keep failing immediately, not get masked behind a retry loop. Retryable
178
- * exactly when `classifyBigQueryError` would report a RateLimitExceededError
179
- * (see `isRateLimited`).
180
- */
181
- export function isRetryableBigQueryError(err) {
182
- return isRateLimited(err);
272
+ function retryReasons(policy) {
273
+ return policy?.quota
274
+ ? new Set([...REQUEST_RETRY_REASONS, "quotaExceeded"])
275
+ : REQUEST_RETRY_REASONS;
276
+ }
277
+ /** An error as the client library threw it: an already-classified one is final. */
278
+ function isRawError(err) {
279
+ return (!!err && typeof err === "object" && !(err instanceof BigQueryReadError));
280
+ }
281
+ /** The job resource a `BigQuery#createJob` rejection carries as `response`: the
282
+ * SDK builds that rejection from `status.errors` of the job it just created,
283
+ * and Google says `status.errors` does not by itself mean the job failed (only
284
+ * `status.errorResult` on a DONE job does). `Job#poll_` rejects only for an
285
+ * `errorResult`, and its error carries no `response`. */
286
+ function createdJobStatus(err) {
287
+ const response = err.response;
288
+ const status = response?.status;
289
+ return status && typeof status === "object" ? status : undefined;
290
+ }
291
+ /** True when the error comes from a job that exists and has NOT finished failed:
292
+ * its status is not DONE with an `errorResult`. A new job id would run it twice. */
293
+ function isFromUnfinishedJob(err) {
294
+ const status = createdJobStatus(err);
295
+ return (status !== undefined && !(status.state === "DONE" && status.errorResult));
296
+ }
297
+ /** True when `err` is a `createJob` rejection for a job that EXISTS and has not
298
+ * finished failed (its status is not DONE with an `errorResult`) and that names
299
+ * no fault of the caller: the SDK rejects with the job's `status.errors` even
300
+ * for warnings, and the job may still finish. The caller waits on that job
301
+ * under its id; it is never a new job and not yet an error. */
302
+ export function isUnfinishedJobError(err) {
303
+ return isRawError(err) && isFromUnfinishedJob(err) && !hasCallerFault(err);
304
+ }
305
+ /** The location the job resource in a `createJob` rejection reports, if any. */
306
+ export function unfinishedJobLocation(err) {
307
+ const reference = err?.response?.jobReference;
308
+ return typeof reference?.location === "string"
309
+ ? reference.location
310
+ : undefined;
311
+ }
312
+ /** A failure the JOB itself reports is an error with structured reasons, no HTTP
313
+ * `code` (a failed request always has one). The caller has already excluded a
314
+ * job that has not finished failed (`isFromUnfinishedJob`). */
315
+ function isReportedByJob(err) {
316
+ return (typeof err.code !== "number" &&
317
+ reasonsOf(err).length > 0);
318
+ }
319
+ /** True when the JOB failed in a way a new job fixes: it reports
320
+ * `jobBackendError`, `jobInternalError` or `jobRateLimitExceeded` (Google's
321
+ * table says to retry with a new job id), or it finished failed with any other
322
+ * transient reason (a job's own `backendError` or `rateLimitExceeded`, which
323
+ * re-checking it would only report again). Only this, or a failure to create
324
+ * the job at all, justifies resubmitting. */
325
+ export function isJobLevelFailure(err, policy) {
326
+ if (!isRawError(err) || hasCallerFault(err) || isFromUnfinishedJob(err)) {
327
+ return false;
328
+ }
329
+ const reasons = reasonsOf(err);
330
+ if (reasons.some((reason) => JOB_LEVEL_REASONS.has(reason)))
331
+ return true;
332
+ const retryable = retryReasons(policy);
333
+ return (isReportedByJob(err) && reasons.some((reason) => retryable.has(reason)));
334
+ }
335
+ /** True when a REQUEST failed in a way Google says to retry after a wait
336
+ * (`backendError`, `internalError`, `tableUnavailable`, `rateLimitExceeded`):
337
+ * when it concerns an existing job, ask again about that same job. A job-level
338
+ * failure is not a request failure (see `isJobLevelFailure`). */
339
+ export function isTransientRequestError(err, policy) {
340
+ if (!isRawError(err) || hasCallerFault(err))
341
+ return false;
342
+ if (isJobLevelFailure(err, policy))
343
+ return false;
344
+ const reasons = reasonsOf(err);
345
+ const retryable = retryReasons(policy);
346
+ if (reasons.length > 0) {
347
+ return reasons.some((reason) => retryable.has(reason));
348
+ }
349
+ const message = err.message;
350
+ return (typeof message === "string" &&
351
+ (policy?.quota ? RATE_LIMIT_REASON_TEXT : REQUEST_RETRY_REASON_TEXT).test(message));
183
352
  }
184
353
  /** BigQuery reports a `jobTimeoutMs`-stopped job as an `errorResult`/`errors[]`
185
354
  * entry with `reason: "stopped"` whose message names the timeout (e.g.
@@ -195,4 +364,34 @@ export function isJobTimeoutError(err) {
195
364
  const message = detail?.message ?? apiErr.message;
196
365
  return typeof message === "string" && JOB_TIMEOUT_REASON_TEXT.test(message);
197
366
  }
367
+ /** Classifies a streaming-insert failure. A `PartialFailureError` carries
368
+ * `errors[] = {row, errors: [{reason, message}]}`; a rate-limit/quota reason in
369
+ * any row is a `RateLimitExceededError`, anything else keeps the per-row reasons
370
+ * in an `InsertRowsPartialFailureError`. Other failures go through
371
+ * `classifyBigQueryError`. */
372
+ export function classifyInsertError(err) {
373
+ if (err instanceof BigQueryReadError)
374
+ return err;
375
+ const entries = err?.errors;
376
+ const isPartial = Array.isArray(entries) &&
377
+ entries.length > 0 &&
378
+ entries.every((e) => e &&
379
+ typeof e === "object" &&
380
+ Array.isArray(e.errors));
381
+ if (!isPartial)
382
+ return classifyBigQueryError(err);
383
+ const rowErrors = entries;
384
+ const limited = rowErrors
385
+ .flatMap((r) => r.errors)
386
+ .find((d) => d.reason !== undefined && RATE_LIMIT_REASONS.has(d.reason));
387
+ if (limited) {
388
+ return new RateLimitExceededError(limited.message ?? limited.reason ?? "", err);
389
+ }
390
+ return new InsertRowsPartialFailureError(rowErrors, err);
391
+ }
392
+ /** True when the SDK's `getQueryResults` gave up waiting client-side. */
393
+ export function isQueryWaitTimeoutError(err) {
394
+ const message = err?.message;
395
+ return typeof message === "string" && /did not complete before/.test(message);
396
+ }
198
397
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/bigquery/errors.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAGxB;IAFlB,YACE,OAAe,EACC,KAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,UAAK,GAAL,KAAK,CAAU;QAG/B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,+DAA+D;AAC/D,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAClD,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,2EAA2E;AAC3E,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAC1D,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;;yEAGyE;AACzE,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAC3D,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED;+CAC+C;AAC/C,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAE5C;IACA;IAFlB,YACk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AAC3D,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,uBAAuB,CAAC,GAAY;IAClD,MAAM,OAAO,GAAI,GAAoC,EAAE,OAAO,CAAC;IAC/D,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAChF,CAAC"}
@@ -46,7 +46,11 @@ export { runQuery, runQueryAllPages, estimateQueryBytes } from "./query.js";
46
46
  export { extractTableToGCS, getExtractJobStatus, waitForExtractJob, } from "./extract.js";
47
47
  export { loadFromUrisWithRetry, loadRowsWithRetry } from "./load.js";
48
48
  export type { LoadFromUrisOptions, LoadJobOptions, LoadRowSource, LoadRowsOptions, LoadRowsResult, } from "./load.js";
49
+ export type { RetryOptions } from "./retry.js";
49
50
  export { buildJobLabels, sanitizeLabelValue } from "./labels.js";
50
- export { unwrapBigQueryCount, unwrapBigQueryValue } from "./values.js";
51
- export { BadQueryError, BigQueryReadError, DryRunBudgetExceededError, JobTimeoutError, MalformedResultSchemaError, MaximumBytesBilledExceededError, PermissionDeniedError, RateLimitExceededError, classifyBigQueryError, isRetryableBigQueryError, } from "./errors.js";
52
- export type { BigQueryApiErrorDetail, BigQueryCreateQueryJobOptions, BigQueryDatasetLike, BigQueryExtractOptions, BigQueryJobLike, BigQueryJobMetadata, BigQueryLike, BigQueryLoadOptions, BigQueryLoadJobLike, BigQueryNextQuery, BigQueryParamTypes, BigQueryParamTypeStruct, BigQueryQueryResultsOptions, BigQueryRawSchema, BigQueryRawSchemaField, BigQueryResultSchemaField, BigQuerySchemaField, BigQueryTableLike, BigQueryTableReference, DryRunEstimate, EstimateQueryBytesOptions, ExtractJobHandle, ExtractJobState, ExtractJobStatus, ExtractTableToGCSInput, GcsFileLike, JobLabelInput, QueryPage, RunQueryOptions, WaitForExtractJobOptions, } from "./types.js";
51
+ export { insertRows } from "./insert.js";
52
+ export type { InsertRowsOptions } from "./insert.js";
53
+ export { unwrapBigQueryCount, unwrapBigQueryRow, unwrapBigQueryValue, } from "./values.js";
54
+ export { BadQueryError, BigQueryReadError, DryRunBudgetExceededError, InsertRowsPartialFailureError, JobTimeoutError, MalformedResultSchemaError, MaximumBytesBilledExceededError, PermissionDeniedError, RateLimitExceededError, TransientBackendError, classifyBigQueryError, } from "./errors.js";
55
+ export type { InsertRowError } from "./errors.js";
56
+ export type { BigQueryApiErrorDetail, BigQueryCreateQueryJobOptions, BigQueryDatasetLike, BigQueryExtractOptions, BigQueryInsertOptions, BigQueryJobLike, BigQueryJobMetadata, BigQueryLike, BigQueryLoadOptions, BigQueryLoadJobLike, BigQueryNextQuery, BigQueryParamTypes, BigQueryParamTypeStruct, BigQueryQueryResultsOptions, BigQueryRawSchema, BigQueryRawSchemaField, BigQueryResultSchemaField, BigQuerySchemaField, BigQueryTableLike, BigQueryTableReference, DryRunEstimate, EstimateQueryBytesOptions, ExtractJobHandle, ExtractJobState, ExtractJobStatus, ExtractTableToGCSInput, GcsFileLike, JobLabelInput, QueryPage, RunQueryOptions, WaitForExtractJobOptions, } from "./types.js";
@@ -45,6 +45,7 @@ export { runQuery, runQueryAllPages, estimateQueryBytes } from "./query.js";
45
45
  export { extractTableToGCS, getExtractJobStatus, waitForExtractJob, } from "./extract.js";
46
46
  export { loadFromUrisWithRetry, loadRowsWithRetry } from "./load.js";
47
47
  export { buildJobLabels, sanitizeLabelValue } from "./labels.js";
48
- export { unwrapBigQueryCount, unwrapBigQueryValue } from "./values.js";
49
- export { BadQueryError, BigQueryReadError, DryRunBudgetExceededError, JobTimeoutError, MalformedResultSchemaError, MaximumBytesBilledExceededError, PermissionDeniedError, RateLimitExceededError, classifyBigQueryError, isRetryableBigQueryError, } from "./errors.js";
48
+ export { insertRows } from "./insert.js";
49
+ export { unwrapBigQueryCount, unwrapBigQueryRow, unwrapBigQueryValue, } from "./values.js";
50
+ export { BadQueryError, BigQueryReadError, DryRunBudgetExceededError, InsertRowsPartialFailureError, JobTimeoutError, MalformedResultSchemaError, MaximumBytesBilledExceededError, PermissionDeniedError, RateLimitExceededError, TransientBackendError, classifyBigQueryError, } from "./errors.js";
50
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bigquery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;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,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AASrE,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,eAAe,EACf,0BAA0B,EAC1B,+BAA+B,EAC/B,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bigquery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;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,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAWrE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,eAAe,EACf,0BAA0B,EAC1B,+BAA+B,EAC/B,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { BigQueryLike } from "./types.js";
2
+ export interface InsertRowsOptions {
3
+ datasetId: string;
4
+ tableId: string;
5
+ /** Default false: a rejected row fails the call. */
6
+ skipInvalidRows?: boolean;
7
+ /** Default false: an unknown field fails the call. */
8
+ ignoreUnknownValues?: boolean;
9
+ }
10
+ export declare function insertRows(bq: BigQueryLike, options: InsertRowsOptions, rows: readonly object[]): Promise<void>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Streaming row insert (AK-42) over `BigQueryTableLike.insert`. Strict by
3
+ * default: one bad row fails the whole call. No retry of its own.
4
+ */
5
+ import { BigQueryReadError, classifyInsertError } from "./errors.js";
6
+ export async function insertRows(bq, options, rows) {
7
+ const table = bq.dataset(options.datasetId).table(options.tableId);
8
+ const insert = table.insert;
9
+ if (!insert) {
10
+ throw new BigQueryReadError(`dataset(${options.datasetId}).table(${options.tableId}) does not implement insert — this BigQueryLike was not constructed for streaming inserts`);
11
+ }
12
+ try {
13
+ await insert.call(table, rows, {
14
+ skipInvalidRows: options.skipInvalidRows ?? false,
15
+ ignoreUnknownValues: options.ignoreUnknownValues ?? false,
16
+ });
17
+ }
18
+ catch (err) {
19
+ throw classifyInsertError(err);
20
+ }
21
+ }
22
+ //# sourceMappingURL=insert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert.js","sourceRoot":"","sources":["../../src/bigquery/insert.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAYrE,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,EAAgB,EAChB,OAA0B,EAC1B,IAAuB;IAEvB,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,iBAAiB,CACzB,WAAW,OAAO,CAAC,SAAS,WAAW,OAAO,CAAC,OAAO,2FAA2F,CAClJ,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE;YAC7B,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK;YACjD,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,KAAK;SAC1D,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { BigQueryJobLike, BigQueryLike } from "./types.js";
2
+ /** The `{ location }` option `BigQueryLike#job` and `#dataset` take, or none when
3
+ * there is no location: the one place that shape is built. */
4
+ export declare function locationOption(location: string | undefined): {
5
+ location: string;
6
+ } | undefined;
7
+ export declare class JobIdentity {
8
+ private current;
9
+ private submitted;
10
+ /** The location the job lives in: the one it was submitted with, replaced by
11
+ * the one BigQuery reports once the job is confirmed. BigQuery jobs are per
12
+ * location, so every lookup and re-wait must name it. */
13
+ location: string | undefined;
14
+ /** `requested` is the caller's job id; a random one is chosen when omitted.
15
+ * `location` is the one the job is submitted with. */
16
+ constructor(requested?: string, location?: string);
17
+ /** Takes the location BigQuery reports for the job, if it reports one. */
18
+ confirmLocation(reported: string | undefined): void;
19
+ /** The `{ location }` option for `BigQueryLike#job`, or none. */
20
+ get jobOptions(): {
21
+ location: string;
22
+ } | undefined;
23
+ get id(): string;
24
+ /** True once a submission under this id was sent: the job may exist even if
25
+ * that call failed, so look it up before submitting again. */
26
+ get mayExist(): boolean;
27
+ /** Marks that a submission under this id is about to be sent. */
28
+ markSubmitted(): void;
29
+ /** The job reported a failure and is final: the next submission is a new job
30
+ * and gets a new id. */
31
+ renew(): void;
32
+ }
33
+ /** The job lookup answered 404: no job has that id. */
34
+ export declare function isJobNotFound(err: unknown): boolean;
35
+ /** Submitting a job answered 409: a job with that id already exists. */
36
+ export declare function isJobAlreadyExists(err: unknown): boolean;
37
+ /** A handle on the job `jobId` if BigQuery has it, or `undefined` if the lookup
38
+ * answers 404 (it was never created). Any other lookup failure is thrown. */
39
+ export declare function findJob(bq: BigQueryLike, jobId: string, location?: string): Promise<BigQueryJobLike | undefined>;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The identity of one logical BigQuery job across the attempts of a retried
3
+ * call. Google says the outcome of `jobs.insert` is unclear after a
4
+ * `backendError`: the job may exist although the call failed. So the id is
5
+ * chosen ONCE and reused by every submission of that job, which makes a repeat
6
+ * either find the job (and wait on it) or fail with 409 (it exists). A new id is
7
+ * taken only when the job itself reported a failure, because that job is final.
8
+ */
9
+ import { randomUUID } from "node:crypto";
10
+ /** The `{ location }` option `BigQueryLike#job` and `#dataset` take, or none when
11
+ * there is no location: the one place that shape is built. */
12
+ export function locationOption(location) {
13
+ return location ? { location } : undefined;
14
+ }
15
+ export class JobIdentity {
16
+ current;
17
+ submitted = false;
18
+ /** The location the job lives in: the one it was submitted with, replaced by
19
+ * the one BigQuery reports once the job is confirmed. BigQuery jobs are per
20
+ * location, so every lookup and re-wait must name it. */
21
+ location;
22
+ /** `requested` is the caller's job id; a random one is chosen when omitted.
23
+ * `location` is the one the job is submitted with. */
24
+ constructor(requested, location) {
25
+ this.current = requested ?? randomUUID();
26
+ this.location = location;
27
+ }
28
+ /** Takes the location BigQuery reports for the job, if it reports one. */
29
+ confirmLocation(reported) {
30
+ if (reported)
31
+ this.location = reported;
32
+ }
33
+ /** The `{ location }` option for `BigQueryLike#job`, or none. */
34
+ get jobOptions() {
35
+ return locationOption(this.location);
36
+ }
37
+ get id() {
38
+ return this.current;
39
+ }
40
+ /** True once a submission under this id was sent: the job may exist even if
41
+ * that call failed, so look it up before submitting again. */
42
+ get mayExist() {
43
+ return this.submitted;
44
+ }
45
+ /** Marks that a submission under this id is about to be sent. */
46
+ markSubmitted() {
47
+ this.submitted = true;
48
+ }
49
+ /** The job reported a failure and is final: the next submission is a new job
50
+ * and gets a new id. */
51
+ renew() {
52
+ this.current = randomUUID();
53
+ this.submitted = false;
54
+ }
55
+ }
56
+ function httpCode(err) {
57
+ return err && typeof err === "object"
58
+ ? err.code
59
+ : undefined;
60
+ }
61
+ /** The job lookup answered 404: no job has that id. */
62
+ export function isJobNotFound(err) {
63
+ return httpCode(err) === 404;
64
+ }
65
+ /** Submitting a job answered 409: a job with that id already exists. */
66
+ export function isJobAlreadyExists(err) {
67
+ return httpCode(err) === 409;
68
+ }
69
+ /** A handle on the job `jobId` if BigQuery has it, or `undefined` if the lookup
70
+ * answers 404 (it was never created). Any other lookup failure is thrown. */
71
+ export async function findJob(bq, jobId, location) {
72
+ const handle = bq.job(jobId, locationOption(location));
73
+ try {
74
+ await handle.getMetadata();
75
+ return handle;
76
+ }
77
+ catch (err) {
78
+ if (isJobNotFound(err))
79
+ return undefined;
80
+ throw err;
81
+ }
82
+ }
83
+ //# sourceMappingURL=jobIdentity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobIdentity.js","sourceRoot":"","sources":["../../src/bigquery/jobIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;+DAC+D;AA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AK,GAAG,CAAC;AAC/B,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;AAC/B,CAAC;AAED;8EAC8E;AAC9E,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,EAAgB,EAChB,KAAa,EACb,QAAiB;IAEjB,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,aAAa,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QACzC,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,21 +1,16 @@
1
+ import type { RetryOptions } from "./retry.js";
1
2
  import type { BigQueryLike, BigQueryLoadOptions } from "./types.js";
2
3
  /**
3
4
  * Opens the rows for one load attempt. Called once per attempt: a retry after
4
- * a rate-limit error re-uploads everything, so it calls this again and must
5
+ * a transient error re-uploads everything, so it calls this again and must
5
6
  * get the same rows. That is why the source is a function and not an
6
7
  * iterable — a generator object can only be consumed once, so a retry handed
7
8
  * the same one would silently load nothing.
8
9
  */
9
10
  export type LoadRowSource<T extends object> = () => AsyncIterable<T> | Iterable<T>;
10
- export interface LoadJobOptions extends BigQueryLoadOptions {
11
+ export interface LoadJobOptions extends BigQueryLoadOptions, RetryOptions {
11
12
  datasetId: string;
12
13
  tableId: string;
13
- /** Total attempts before giving up, including the first. Default 5. */
14
- attempts?: number;
15
- /** Delay before the first retry; doubles every subsequent retry. Default 1000ms. */
16
- initialDelayMs?: number;
17
- /** Injectable for tests — real code always uses a real timer. */
18
- sleep?: (ms: number) => Promise<void>;
19
14
  }
20
15
  export interface LoadRowsOptions extends LoadJobOptions {
21
16
  /** Target size of each NDJSON chunk written to the load job, in bytes. The
@@ -34,11 +29,13 @@ export interface LoadRowsResult {
34
29
  }
35
30
  /**
36
31
  * Streams the rows `source` yields into `datasetId.tableId` in one load job,
37
- * retrying with exponential backoff ONLY when the failure is BigQuery's
38
- * rateLimitExceeded/quotaExceeded class of error (see
39
- * `isRetryableBigQueryError`). Any other error (bad schema, auth failure, a
40
- * throw from the source, etc.) is classified and rethrown on the first
41
- * attempt. Each attempt calls `source` afresh — see `LoadRowSource`.
32
+ * retrying with exponential backoff ONLY for BigQuery's transient errors, and
33
+ * never loading the rows twice: see `loadWithRetry` for when the same job is
34
+ * waited on and when a new one is submitted. Any other error (bad schema, auth
35
+ * failure, a throw from the source, etc.) is classified and rethrown on the
36
+ * first attempt. Each submission calls `source` afresh — see `LoadRowSource`.
37
+ * \`options.jobId\` is the id the load job is submitted under (random when
38
+ * omitted).
42
39
  *
43
40
  * Pass `writeDisposition: "WRITE_TRUNCATE"` for a full-refresh reload; omit it
44
41
  * for an append load.
@@ -49,7 +46,7 @@ export declare function loadRowsWithRetry<T extends object>(bq: BigQueryLike, op
49
46
  * gzip-compressed or not) into `datasetId.tableId` in ONE load job, which
50
47
  * BigQuery runs reading the files in parallel. Nothing is parsed or
51
48
  * re-serialised here. Retry and error classes are those of
52
- * `loadRowsWithRetry`; a retry submits the job again.
49
+ * `loadRowsWithRetry`.
53
50
  *
54
51
  * `rowCount` is what BigQuery reports the job wrote
55
52
  * (`statistics.load.outputRows`), never a count taken locally; a job that