@keboola/api-client 42.0.0 → 43.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.
- package/API-SURFACE.md +2 -1
- package/CHANGELOG.md +12 -0
- package/dist/collect-97WhfEpt.js +30 -0
- package/dist/collect-97WhfEpt.js.map +1 -0
- package/dist/collect-B5TCNiT1.cjs +35 -0
- package/dist/collect-B5TCNiT1.cjs.map +1 -0
- package/dist/createAbortError-BxupOt-6.js +6 -0
- package/dist/createAbortError-BxupOt-6.js.map +1 -0
- package/dist/createAbortError-RendOpo7.cjs +11 -0
- package/dist/createAbortError-RendOpo7.cjs.map +1 -0
- package/dist/dataScience/index.d.cts +1 -1
- package/dist/dataScience/index.d.ts +1 -1
- package/dist/dataScience/types.d.cts +1 -1
- package/dist/dataScience/types.d.ts +1 -1
- package/dist/developerPortal/index.d.cts +2 -2
- package/dist/developerPortal/index.d.ts +2 -2
- package/dist/developerPortal/types.d.cts +1 -1
- package/dist/developerPortal/types.d.ts +1 -1
- package/dist/{index-VnJCp8IL.d.cts → index-04pgr-EO.d.cts} +3 -2
- package/dist/{index-CcMHJcuP.d.cts → index-BHWTa4YN.d.cts} +3 -2
- package/dist/{index-CpE_NWuq.d.ts → index-BQZ9njUC.d.ts} +28 -10
- package/dist/{index-Cz0MXhzs.d.cts → index-C7KThHI3.d.cts} +6 -2
- package/dist/{index-D-VMgpGc.d.ts → index-CAvT_ahE.d.ts} +6 -2
- package/dist/{index-C11JSxBY.d.ts → index-CX8GAP2g.d.ts} +13 -8
- package/dist/{index-CKENwClW.d.cts → index-CdS-c6sC.d.cts} +3 -3
- package/dist/{index-B2-7WJ-E.d.cts → index-Cm04GKm9.d.cts} +28 -10
- package/dist/{index-C4TNAA8-.d.cts → index-Cvkrjh--.d.cts} +13 -8
- package/dist/{index-Cw-d6vV3.d.ts → index-D7of2MMN.d.ts} +3 -3
- package/dist/{index-DwM1EpnZ.d.ts → index-R-w0Zncz.d.ts} +3 -2
- package/dist/{index-D_-4uQF8.d.ts → index-zyxZVJnd.d.ts} +3 -2
- package/dist/index.cjs +6 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{jobStatus-CfRtsIpv.js → jobStatus-CDp4r5JQ.js} +3 -5
- package/dist/jobStatus-CDp4r5JQ.js.map +1 -0
- package/dist/{jobStatus-BMlsyXWI.cjs → jobStatus-CcNlIy5R.cjs} +5 -13
- package/dist/{jobStatus-CfRtsIpv.js.map → jobStatus-CcNlIy5R.cjs.map} +1 -1
- package/dist/kaiAgent/index.d.cts +1 -1
- package/dist/kaiAgent/index.d.ts +1 -1
- package/dist/kaiAgent/types.d.cts +1 -1
- package/dist/kaiAgent/types.d.ts +1 -1
- package/dist/microsoftGraph/index.d.cts +2 -1
- package/dist/microsoftGraph/index.d.ts +2 -1
- package/dist/microsoftGraph/types.d.cts +1 -1
- package/dist/microsoftGraph/types.d.ts +1 -1
- package/dist/oauth/index.d.cts +1 -1
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/types.d.cts +1 -1
- package/dist/oauth/types.d.ts +1 -1
- package/dist/omnisearch/index.d.cts +1 -1
- package/dist/omnisearch/index.d.ts +1 -1
- package/dist/omnisearch/types.d.cts +1 -1
- package/dist/omnisearch/types.d.ts +1 -1
- package/dist/queryService/index.cjs +1 -1
- package/dist/queryService/index.d.cts +1 -1
- package/dist/queryService/index.d.ts +1 -1
- package/dist/queryService/index.js +1 -1
- package/dist/{queryService-Dx6AdxOl.cjs → queryService-DSww_TJp.cjs} +2 -2
- package/dist/{queryService-Dx6AdxOl.cjs.map → queryService-DSww_TJp.cjs.map} +1 -1
- package/dist/{queryService-CdtogGr7.js → queryService-Drvy1ztW.js} +2 -2
- package/dist/{queryService-CdtogGr7.js.map → queryService-Drvy1ztW.js.map} +1 -1
- package/dist/queue/index.cjs +1 -1
- package/dist/queue/index.d.cts +1 -1
- package/dist/queue/index.d.ts +1 -1
- package/dist/queue/index.js +1 -1
- package/dist/{queue-f2xsjy0o.js → queue-Ci_f_5TI.js} +4 -29
- package/dist/queue-Ci_f_5TI.js.map +1 -0
- package/dist/{queue-wIdnMtaZ.cjs → queue-DpMvv8C-.cjs} +4 -35
- package/dist/{queue-f2xsjy0o.js.map → queue-DpMvv8C-.cjs.map} +1 -1
- package/dist/scheduler/index.d.cts +13 -1
- package/dist/scheduler/index.d.ts +13 -1
- package/dist/scheduler/types.d.cts +1 -1
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/{schema-D1oxyn1O.d.cts → schema-DJa9WBjR.d.cts} +28 -1
- package/dist/{schema-D1oxyn1O.d.ts → schema-DJa9WBjR.d.ts} +28 -1
- package/dist/sdk/configurations/index.d.cts +1 -1
- package/dist/sdk/configurations/index.d.ts +1 -1
- package/dist/sdk/developerPortal/index.d.cts +13 -8
- package/dist/sdk/developerPortal/index.d.ts +13 -8
- package/dist/sdk/queryService/index.cjs +1 -1
- package/dist/sdk/queryService/index.d.cts +1 -1
- package/dist/sdk/queryService/index.d.ts +1 -1
- package/dist/sdk/queryService/index.js +1 -1
- package/dist/sdk/storage/index.d.cts +1 -1
- package/dist/sdk/storage/index.d.ts +1 -1
- package/dist/sdk/vault/index.d.cts +1 -1
- package/dist/sdk/vault/index.d.ts +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.d.cts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/{storage-BkdjgtCU.js → storage-C-lyo_iX.js} +2 -2
- package/dist/{storage-BkdjgtCU.js.map → storage-C-lyo_iX.js.map} +1 -1
- package/dist/{storage-CXQTTVXl.cjs → storage-DAJquqEw.cjs} +2 -2
- package/dist/{storage-CXQTTVXl.cjs.map → storage-DAJquqEw.cjs.map} +1 -1
- package/dist/{types-n4PTnLii.d.ts → types-AYX7VtS6.d.ts} +179 -2
- package/dist/{types-DIiOMV-t.d.ts → types-B3P5yAuI.d.ts} +5 -1
- package/dist/{types-BLNB882w.d.cts → types-B3i04d_A.d.cts} +5 -1
- package/dist/{types-CZXPu3gn.d.ts → types-BBUZ9EHs.d.ts} +4 -1
- package/dist/{types-CP_LBmw3.d.cts → types-BhOUS9j1.d.cts} +26 -3
- package/dist/{types-tKkeLa2B.d.cts → types-BiEh5c_t.d.cts} +60 -8
- package/dist/{types-RbrfiY8T.d.ts → types-CAp1VexS.d.ts} +3 -3
- package/dist/{types-DinIJ1D_.d.cts → types-CBPKpLTf.d.cts} +179 -2
- package/dist/{types-DE9hgr7i.d.cts → types-CgBzm1YR.d.cts} +106 -1
- package/dist/{types-B61aCifg.d.cts → types-D9axmt5o.d.cts} +4 -1
- package/dist/{types-CWyXTMwy.d.ts → types-DaMmgW-O.d.ts} +106 -1
- package/dist/{types-q-1r_9d1.d.ts → types-DzV6LaZq.d.ts} +60 -8
- package/dist/{types-6kuMW4JW.d.cts → types-c_bsDkV6.d.cts} +3 -3
- package/dist/{types-DgJeO9Nd.d.ts → types-gcAb6olM.d.ts} +26 -3
- package/dist/vault/index.cjs +27 -2
- package/dist/vault/index.cjs.map +1 -1
- package/dist/vault/index.d.cts +1 -1
- package/dist/vault/index.d.ts +1 -1
- package/dist/vault/index.js +27 -2
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/types.d.cts +1 -1
- package/dist/vault/types.d.ts +1 -1
- package/package.json +1 -1
- package/surface/dataScience.md +2 -2
- package/surface/kaiAgent.md +1 -1
- package/surface/scheduler.md +3 -3
- package/surface/vault.md +1 -0
- package/dist/jobStatus-BMlsyXWI.cjs.map +0 -1
- package/dist/queue-wIdnMtaZ.cjs.map +0 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { t as createAbortError } from "./createAbortError-BxupOt-6.js";
|
|
1
2
|
import { n as createEmitter, t as createStore } from "./store-C9FQCHGe.js";
|
|
2
|
-
//#region src/utils/createAbortError.ts
|
|
3
|
-
const createAbortError = (reason) => new DOMException(reason, "AbortError");
|
|
4
|
-
//#endregion
|
|
5
3
|
//#region src/utils/async/delay.ts
|
|
6
4
|
const delay = (timeout, signal) => new Promise((resolve, reject) => {
|
|
7
5
|
if (signal?.aborted) return reject(createAbortError(signal.reason));
|
|
@@ -409,6 +407,6 @@ const jobStatus = {
|
|
|
409
407
|
query: forService(QUERY)
|
|
410
408
|
};
|
|
411
409
|
//#endregion
|
|
412
|
-
export { poller as a, Result as c, delay as d,
|
|
410
|
+
export { poller as a, Result as c, delay as d, poll as i, asError as l, emitter as n, clamp as o, failureOf as r, finiteOr as s, jobStatus as t, lazy as u };
|
|
413
411
|
|
|
414
|
-
//# sourceMappingURL=jobStatus-
|
|
412
|
+
//# sourceMappingURL=jobStatus-CDp4r5JQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobStatus-CDp4r5JQ.js","names":[],"sources":["../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts"],"sourcesContent":["import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollKey = readonly unknown[];\n\nexport type PollContext<K extends PollKey = PollKey> = {\n pollKey: K;\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T, K extends PollKey = PollKey> = PollContext<K> & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T, K extends PollKey = PollKey> = PollTick<T, K> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T, K extends PollKey = PollKey> = {\n pollKey?: K;\n pollFn: (context: PollContext<K> & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T, K> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\nconst pollResult = {\n done: <T, K extends PollKey>(data: T, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T, K extends PollKey>(error: Error, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T, K extends PollKey>(context: PollTick<T, K>, reason: unknown): PollResult<T, K> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T, K extends PollKey = PollKey>({\n pollKey,\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T, K>): Promise<PollResult<T, K>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // A poll without a key has an empty one, and `K` is opaque in here — the one place the absent\n // case is materialised is the one place it has to be asserted.\n const key = pollKey ?? ([] as unknown as K);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ pollKey: key, attempt: at, elapsed }: PollContext<K>) =>\n Result.tryCatchAsync(() =>\n Promise.race([\n _pollFn({ pollKey: key, attempt: at, elapsed, signal: anySignal }),\n anyAborted.promise,\n ]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T, K> => ({\n pollKey: key,\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T, K>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\n\nimport {\n type PollKey,\n pollLoop,\n type PollOptions,\n type PollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollState = 'idle' | 'polling' | PollResultState;\nexport type PollSnapshot = PollTick<unknown> & { state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>) => Error | undefined;\n\nexport type PollerStartFn<T> = () => Promise<PollResult<T>>;\nexport type PollerStopFn = (reason?: string) => void;\ntype PollerSubscribeFn = (listener: (snapshot: PollSnapshot) => void) => () => void;\ntype PollerDebugFn = () => PollSnapshot;\ntype PollerUnwrapFn<T> = (onFailure?: OnFailure<T>) => Promise<T>;\nexport type Poller<T> = {\n readonly state: PollState;\n start: PollerStartFn<T>;\n unwrap: PollerUnwrapFn<T>;\n stop: PollerStopFn;\n subscribe: PollerSubscribeFn;\n debug: PollerDebugFn;\n};\n\nexport type PollTask<T> = Promise<PollResult<T>> &\n Pick<Poller<T>, 'unwrap' | 'stop' | 'subscribe' | 'debug'>;\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey>({\n pollKey,\n signal,\n until,\n ...pollLoopOptions\n}: PollOptions<T, K>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n // snapshoting\n const snapshot = createStore<PollSnapshot>({\n pollKey: pollKey ?? [],\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (context: PollTick<T, K> & { data: T }) => {\n updateSnapshot({ attempt: context.attempt, elapsed: context.elapsed, last: context.data });\n return until(context);\n };\n\n const start: PollerStartFn<T> = lazy(async () => {\n updateSnapshot({ state: 'polling' });\n const result = await pollLoop({\n ...pollLoopOptions,\n pollKey,\n until: handleUntil,\n signal: anySignal,\n });\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n snapshot.set({\n pollKey: result.pollKey,\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n });\n\n const stop: PollerStopFn = (reason) => pollerSignal.abort(reason);\n const subscribe: PollerSubscribeFn = (listener) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug: PollerDebugFn = snapshot.get;\n\n const unwrap: PollerUnwrapFn<T> = async (onFailure) => {\n const result = await start();\n if (result.state === 'done') return result.data;\n throw onFailure?.(result) ?? failureOf(result);\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n unwrap,\n ...controls,\n };\n};\n\nexport const poll = <T, K extends PollKey = PollKey>(options: PollOptions<T, K>): PollTask<T> => {\n const p = poller(options);\n\n return Object.assign(p.start(), {\n unwrap: p.unwrap,\n stop: p.stop,\n subscribe: p.subscribe,\n debug: p.debug,\n });\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - `warning` is a success; the backend has no success/failure split.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n stor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CAAC,GAAG,OAAO,YAAY,GAAG,OAAO,MAAM,CAAC;CACtF,MAAM,QAA6B,IAAI,IAAY,GAAG;CAEtD,OAAO;EACL,YAAY,WAAmB,QAAQ,IAAI,MAAM;EACjD,aAAa,WAAmB,SAAS,IAAI,MAAM;EACnD,eAAe,WAAmB,WAAW,IAAI,MAAM;EACvD,WAAW,WAAmB,OAAO,IAAI,MAAM;EAC/C,UAAU,UAAmC,MAAM,IAAI,KAAK;EAC5D,WAAW,YAAoB;GAC7B,WAAW,QAAQ,IAAI,MAAM;GAC7B,YAAY,SAAS,IAAI,MAAM;GAC/B,cAAc,WAAW,IAAI,MAAM;GACnC,UAAU,OAAO,IAAI,MAAM;EAC7B;EACA,UAAU;GAAE;GAAS;GAAY;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
+
const require_createAbortError = require("./createAbortError-RendOpo7.cjs");
|
|
1
2
|
const require_store = require("./store-xS-Cu_VS.cjs");
|
|
2
|
-
//#region src/utils/createAbortError.ts
|
|
3
|
-
const createAbortError = (reason) => new DOMException(reason, "AbortError");
|
|
4
|
-
//#endregion
|
|
5
3
|
//#region src/utils/async/delay.ts
|
|
6
4
|
const delay = (timeout, signal) => new Promise((resolve, reject) => {
|
|
7
|
-
if (signal?.aborted) return reject(createAbortError(signal.reason));
|
|
5
|
+
if (signal?.aborted) return reject(require_createAbortError.createAbortError(signal.reason));
|
|
8
6
|
const onAbort = () => {
|
|
9
7
|
clearTimeout(timeoutId);
|
|
10
|
-
reject(createAbortError(signal?.reason));
|
|
8
|
+
reject(require_createAbortError.createAbortError(signal?.reason));
|
|
11
9
|
};
|
|
12
10
|
const timeoutId = setTimeout(() => {
|
|
13
11
|
signal?.removeEventListener("abort", onAbort);
|
|
@@ -246,7 +244,7 @@ const failureOf = (result) => {
|
|
|
246
244
|
if ("error" in result && result.error) return result.error;
|
|
247
245
|
if (result.state === "aborted") {
|
|
248
246
|
if (result.reason instanceof Error) return result.reason;
|
|
249
|
-
return createAbortError(typeof result.reason === "string" ? result.reason : "The poll was stopped.");
|
|
247
|
+
return require_createAbortError.createAbortError(typeof result.reason === "string" ? result.reason : "The poll was stopped.");
|
|
250
248
|
}
|
|
251
249
|
return /* @__PURE__ */ new Error(`The poll ${result.state} after ${result.attempt} attempts.`);
|
|
252
250
|
};
|
|
@@ -427,12 +425,6 @@ Object.defineProperty(exports, "clamp", {
|
|
|
427
425
|
return clamp;
|
|
428
426
|
}
|
|
429
427
|
});
|
|
430
|
-
Object.defineProperty(exports, "createAbortError", {
|
|
431
|
-
enumerable: true,
|
|
432
|
-
get: function() {
|
|
433
|
-
return createAbortError;
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
428
|
Object.defineProperty(exports, "delay", {
|
|
437
429
|
enumerable: true,
|
|
438
430
|
get: function() {
|
|
@@ -482,4 +474,4 @@ Object.defineProperty(exports, "poller", {
|
|
|
482
474
|
}
|
|
483
475
|
});
|
|
484
476
|
|
|
485
|
-
//# sourceMappingURL=jobStatus-
|
|
477
|
+
//# sourceMappingURL=jobStatus-CcNlIy5R.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobStatus-CfRtsIpv.js","names":[],"sources":["../src/utils/createAbortError.ts","../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts"],"sourcesContent":["export const createAbortError = (reason?: string) => new DOMException(reason, 'AbortError');\n","import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollKey = readonly unknown[];\n\nexport type PollContext<K extends PollKey = PollKey> = {\n pollKey: K;\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T, K extends PollKey = PollKey> = PollContext<K> & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T, K extends PollKey = PollKey> = PollTick<T, K> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T, K extends PollKey = PollKey> = {\n pollKey?: K;\n pollFn: (context: PollContext<K> & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T, K> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\nconst pollResult = {\n done: <T, K extends PollKey>(data: T, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T, K extends PollKey>(error: Error, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T, K extends PollKey>(context: PollTick<T, K>, reason: unknown): PollResult<T, K> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T, K extends PollKey = PollKey>({\n pollKey,\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T, K>): Promise<PollResult<T, K>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // A poll without a key has an empty one, and `K` is opaque in here — the one place the absent\n // case is materialised is the one place it has to be asserted.\n const key = pollKey ?? ([] as unknown as K);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ pollKey: key, attempt: at, elapsed }: PollContext<K>) =>\n Result.tryCatchAsync(() =>\n Promise.race([\n _pollFn({ pollKey: key, attempt: at, elapsed, signal: anySignal }),\n anyAborted.promise,\n ]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T, K> => ({\n pollKey: key,\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T, K>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\n\nimport {\n type PollKey,\n pollLoop,\n type PollOptions,\n type PollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollState = 'idle' | 'polling' | PollResultState;\nexport type PollSnapshot = PollTick<unknown> & { state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>) => Error | undefined;\n\nexport type PollerStartFn<T> = () => Promise<PollResult<T>>;\nexport type PollerStopFn = (reason?: string) => void;\ntype PollerSubscribeFn = (listener: (snapshot: PollSnapshot) => void) => () => void;\ntype PollerDebugFn = () => PollSnapshot;\ntype PollerUnwrapFn<T> = (onFailure?: OnFailure<T>) => Promise<T>;\nexport type Poller<T> = {\n readonly state: PollState;\n start: PollerStartFn<T>;\n unwrap: PollerUnwrapFn<T>;\n stop: PollerStopFn;\n subscribe: PollerSubscribeFn;\n debug: PollerDebugFn;\n};\n\nexport type PollTask<T> = Promise<PollResult<T>> &\n Pick<Poller<T>, 'unwrap' | 'stop' | 'subscribe' | 'debug'>;\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey>({\n pollKey,\n signal,\n until,\n ...pollLoopOptions\n}: PollOptions<T, K>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n // snapshoting\n const snapshot = createStore<PollSnapshot>({\n pollKey: pollKey ?? [],\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (context: PollTick<T, K> & { data: T }) => {\n updateSnapshot({ attempt: context.attempt, elapsed: context.elapsed, last: context.data });\n return until(context);\n };\n\n const start: PollerStartFn<T> = lazy(async () => {\n updateSnapshot({ state: 'polling' });\n const result = await pollLoop({\n ...pollLoopOptions,\n pollKey,\n until: handleUntil,\n signal: anySignal,\n });\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n snapshot.set({\n pollKey: result.pollKey,\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n });\n\n const stop: PollerStopFn = (reason) => pollerSignal.abort(reason);\n const subscribe: PollerSubscribeFn = (listener) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug: PollerDebugFn = snapshot.get;\n\n const unwrap: PollerUnwrapFn<T> = async (onFailure) => {\n const result = await start();\n if (result.state === 'done') return result.data;\n throw onFailure?.(result) ?? failureOf(result);\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n unwrap,\n ...controls,\n };\n};\n\nexport const poll = <T, K extends PollKey = PollKey>(options: PollOptions<T, K>): PollTask<T> => {\n const p = poller(options);\n\n return Object.assign(p.start(), {\n unwrap: p.unwrap,\n stop: p.stop,\n subscribe: p.subscribe,\n debug: p.debug,\n });\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - `warning` is a success; the backend has no success/failure split.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n"],"mappings":";;AAAA,MAAa,oBAAoB,WAAoB,IAAI,aAAa,QAAQ,YAAY;;;ACE1F,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAO,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAO,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACvE,IAAI,QAAoC;CAGxC,MAAM,UAAU,YAAiC,MAAM,KAAK;CAE5D,aAAa;EACX,UAAU,QAAQ,CAAC,CAAC,OAAO,UAAmB;GAC5C,QAAQ;GACR,MAAM;EACR,CAAC;EACD,OAAO;CACT;AACF;;;ACbA,MAAa,WAAW,WACtB,kBAAkB,QAAQ,SAAS,IAAI,MAAM,OAAO,MAAM,GAAG,EAAE,OAAO,OAAO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names":["createAbortError","createEmitter","createAbortError","createStore"],"sources":["../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts"],"sourcesContent":["import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollKey = readonly unknown[];\n\nexport type PollContext<K extends PollKey = PollKey> = {\n pollKey: K;\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T, K extends PollKey = PollKey> = PollContext<K> & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T, K extends PollKey = PollKey> = PollTick<T, K> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T, K extends PollKey = PollKey> = {\n pollKey?: K;\n pollFn: (context: PollContext<K> & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T, K> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\nconst pollResult = {\n done: <T, K extends PollKey>(data: T, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T, K extends PollKey>(error: Error, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T, K extends PollKey>(context: PollTick<T, K>, reason: unknown): PollResult<T, K> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T, K extends PollKey = PollKey>({\n pollKey,\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T, K>): Promise<PollResult<T, K>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // A poll without a key has an empty one, and `K` is opaque in here — the one place the absent\n // case is materialised is the one place it has to be asserted.\n const key = pollKey ?? ([] as unknown as K);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ pollKey: key, attempt: at, elapsed }: PollContext<K>) =>\n Result.tryCatchAsync(() =>\n Promise.race([\n _pollFn({ pollKey: key, attempt: at, elapsed, signal: anySignal }),\n anyAborted.promise,\n ]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T, K> => ({\n pollKey: key,\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T, K>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\n\nimport {\n type PollKey,\n pollLoop,\n type PollOptions,\n type PollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollState = 'idle' | 'polling' | PollResultState;\nexport type PollSnapshot = PollTick<unknown> & { state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>) => Error | undefined;\n\nexport type PollerStartFn<T> = () => Promise<PollResult<T>>;\nexport type PollerStopFn = (reason?: string) => void;\ntype PollerSubscribeFn = (listener: (snapshot: PollSnapshot) => void) => () => void;\ntype PollerDebugFn = () => PollSnapshot;\ntype PollerUnwrapFn<T> = (onFailure?: OnFailure<T>) => Promise<T>;\nexport type Poller<T> = {\n readonly state: PollState;\n start: PollerStartFn<T>;\n unwrap: PollerUnwrapFn<T>;\n stop: PollerStopFn;\n subscribe: PollerSubscribeFn;\n debug: PollerDebugFn;\n};\n\nexport type PollTask<T> = Promise<PollResult<T>> &\n Pick<Poller<T>, 'unwrap' | 'stop' | 'subscribe' | 'debug'>;\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey>({\n pollKey,\n signal,\n until,\n ...pollLoopOptions\n}: PollOptions<T, K>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n // snapshoting\n const snapshot = createStore<PollSnapshot>({\n pollKey: pollKey ?? [],\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (context: PollTick<T, K> & { data: T }) => {\n updateSnapshot({ attempt: context.attempt, elapsed: context.elapsed, last: context.data });\n return until(context);\n };\n\n const start: PollerStartFn<T> = lazy(async () => {\n updateSnapshot({ state: 'polling' });\n const result = await pollLoop({\n ...pollLoopOptions,\n pollKey,\n until: handleUntil,\n signal: anySignal,\n });\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n snapshot.set({\n pollKey: result.pollKey,\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n });\n\n const stop: PollerStopFn = (reason) => pollerSignal.abort(reason);\n const subscribe: PollerSubscribeFn = (listener) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug: PollerDebugFn = snapshot.get;\n\n const unwrap: PollerUnwrapFn<T> = async (onFailure) => {\n const result = await start();\n if (result.state === 'done') return result.data;\n throw onFailure?.(result) ?? failureOf(result);\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n unwrap,\n ...controls,\n };\n};\n\nexport const poll = <T, K extends PollKey = PollKey>(options: PollOptions<T, K>): PollTask<T> => {\n const p = poller(options);\n\n return Object.assign(p.start(), {\n unwrap: p.unwrap,\n stop: p.stop,\n subscribe: p.subscribe,\n debug: p.debug,\n });\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - `warning` is a success; the backend has no success/failure split.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n"],"mappings":";;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAOA,yBAAAA,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAOA,yBAAAA,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACvE,IAAI,QAAoC;CAGxC,MAAM,UAAU,YAAiC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EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { h as ProjectToolPolicyValue, m as ProjectToolPolicy } from "../types-ByLH46Dt.cjs";
|
|
2
|
-
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-
|
|
2
|
+
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-04pgr-EO.cjs";
|
|
3
3
|
export { type AgentSettings, type ProjectToolPolicy, type ProjectToolPolicyValue, type UserAgentSettings, type UserMemory, createKaiAgentClient };
|
package/dist/kaiAgent/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { h as ProjectToolPolicyValue, m as ProjectToolPolicy } from "../types-DlQw6FCi.js";
|
|
2
|
-
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-
|
|
2
|
+
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-R-w0Zncz.js";
|
|
3
3
|
export { type AgentSettings, type ProjectToolPolicy, type ProjectToolPolicyValue, type UserAgentSettings, type UserMemory, createKaiAgentClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-
|
|
1
|
+
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-CBPKpLTf.cjs";
|
|
2
2
|
export { ApprovalBody, ArtifactListResponse, ArtifactResponse, ChatRequest, ChatWithMessages, GetArtifactPath, GetArtifactsQuery, GetChatPath, GetHistoryQuery, GetVotesQuery, PrepareChatRequest, UsageResponse, VoteRequest };
|
package/dist/kaiAgent/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-
|
|
1
|
+
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-AYX7VtS6.js";
|
|
2
2
|
export { ApprovalBody, ArtifactListResponse, ArtifactResponse, ChatRequest, ChatWithMessages, GetArtifactPath, GetArtifactsQuery, GetChatPath, GetHistoryQuery, GetVotesQuery, PrepareChatRequest, UsageResponse, VoteRequest };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { O as MiddlewareFn } from "../index-BVhHt5lx.cjs";
|
|
2
2
|
import { n as ClientInitOptions } from "../types-DoZtE9tz.cjs";
|
|
3
|
-
import { t as components } from "../schema-
|
|
3
|
+
import { t as components } from "../schema-DJa9WBjR.cjs";
|
|
4
4
|
//#region src/clients/microsoftGraph/microsoftGraphClient.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Auth arrives as a middleware, never as a token: a client here holds no credential. Pair it with
|
|
@@ -130,6 +130,7 @@ declare const createMicrosoftGraphClient: ({ baseUrl, middlewares }?: MicrosoftG
|
|
|
130
130
|
manager?: components['schemas']['microsoft.graph.directoryObject'] | (Record<string, never> | null);
|
|
131
131
|
memberOf?: components['schemas']['microsoft.graph.directoryObject'][];
|
|
132
132
|
messages?: components['schemas']['microsoft.graph.message'][];
|
|
133
|
+
notes?: components['schemas']['microsoft.graph.note'][];
|
|
133
134
|
oauth2PermissionGrants?: components['schemas']['microsoft.graph.oAuth2PermissionGrant'][];
|
|
134
135
|
onenote?: components['schemas']['microsoft.graph.onenote'] | (Record<string, never> | null);
|
|
135
136
|
onlineMeetings?: components['schemas']['microsoft.graph.onlineMeeting'][];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { O as MiddlewareFn } from "../index-BgR5zcjJ.js";
|
|
2
2
|
import { n as ClientInitOptions } from "../types-B2w2TtSA.js";
|
|
3
|
-
import { t as components } from "../schema-
|
|
3
|
+
import { t as components } from "../schema-DJa9WBjR.js";
|
|
4
4
|
//#region src/clients/microsoftGraph/microsoftGraphClient.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Auth arrives as a middleware, never as a token: a client here holds no credential. Pair it with
|
|
@@ -130,6 +130,7 @@ declare const createMicrosoftGraphClient: ({ baseUrl, middlewares }?: MicrosoftG
|
|
|
130
130
|
manager?: components['schemas']['microsoft.graph.directoryObject'] | (Record<string, never> | null);
|
|
131
131
|
memberOf?: components['schemas']['microsoft.graph.directoryObject'][];
|
|
132
132
|
messages?: components['schemas']['microsoft.graph.message'][];
|
|
133
|
+
notes?: components['schemas']['microsoft.graph.note'][];
|
|
133
134
|
oauth2PermissionGrants?: components['schemas']['microsoft.graph.oAuth2PermissionGrant'][];
|
|
134
135
|
onenote?: components['schemas']['microsoft.graph.onenote'] | (Record<string, never> | null);
|
|
135
136
|
onlineMeetings?: components['schemas']['microsoft.graph.onlineMeeting'][];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as OpenapiReturnType } from "../index-BVhHt5lx.cjs";
|
|
2
|
-
import { n as paths } from "../schema-
|
|
2
|
+
import { n as paths } from "../schema-DJa9WBjR.cjs";
|
|
3
3
|
//#region src/clients/microsoftGraph/types.d.ts
|
|
4
4
|
type User = OpenapiReturnType<paths['/me']['get']>;
|
|
5
5
|
type Drive = OpenapiReturnType<paths['/me/drive']['get']>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as OpenapiReturnType } from "../index-BgR5zcjJ.js";
|
|
2
|
-
import { n as paths } from "../schema-
|
|
2
|
+
import { n as paths } from "../schema-DJa9WBjR.js";
|
|
3
3
|
//#region src/clients/microsoftGraph/types.d.ts
|
|
4
4
|
type User = OpenapiReturnType<paths['/me']['get']>;
|
|
5
5
|
type Drive = OpenapiReturnType<paths['/me/drive']['get']>;
|
package/dist/oauth/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ClientInitOptions } from "../types-DoZtE9tz.cjs";
|
|
2
|
-
import { a as CredentialInput, r as CreateCredentialInput, s as GetCredentialsInput } from "../types-
|
|
2
|
+
import { a as CredentialInput, r as CreateCredentialInput, s as GetCredentialsInput } from "../types-BhOUS9j1.cjs";
|
|
3
3
|
//#region src/clients/oauth/oauthClient.d.ts
|
|
4
4
|
declare const createOauthClient: ({ baseUrl, middlewares, auth }: ClientInitOptions) => {
|
|
5
5
|
healthCheck: (signal?: AbortSignal) => Promise<unknown>;
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ClientInitOptions } from "../types-B2w2TtSA.js";
|
|
2
|
-
import { a as CredentialInput, r as CreateCredentialInput, s as GetCredentialsInput } from "../types-
|
|
2
|
+
import { a as CredentialInput, r as CreateCredentialInput, s as GetCredentialsInput } from "../types-gcAb6olM.js";
|
|
3
3
|
//#region src/clients/oauth/oauthClient.d.ts
|
|
4
4
|
declare const createOauthClient: ({ baseUrl, middlewares, auth }: ClientInitOptions) => {
|
|
5
5
|
healthCheck: (signal?: AbortSignal) => Promise<unknown>;
|
package/dist/oauth/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CredentialInput, i as Credential, n as CreateCredentialBody, o as CredentialPath, r as CreateCredentialInput, s as GetCredentialsInput, t as ComponentPath } from "../types-
|
|
1
|
+
import { a as CredentialInput, i as Credential, n as CreateCredentialBody, o as CredentialPath, r as CreateCredentialInput, s as GetCredentialsInput, t as ComponentPath } from "../types-BhOUS9j1.cjs";
|
|
2
2
|
export { ComponentPath, CreateCredentialBody, CreateCredentialInput, Credential, CredentialInput, CredentialPath, type GetCredentialsInput };
|
package/dist/oauth/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CredentialInput, i as Credential, n as CreateCredentialBody, o as CredentialPath, r as CreateCredentialInput, s as GetCredentialsInput, t as ComponentPath } from "../types-
|
|
1
|
+
import { a as CredentialInput, i as Credential, n as CreateCredentialBody, o as CredentialPath, r as CreateCredentialInput, s as GetCredentialsInput, t as ComponentPath } from "../types-gcAb6olM.js";
|
|
2
2
|
export { ComponentPath, CreateCredentialBody, CreateCredentialInput, Credential, CredentialInput, CredentialPath, type GetCredentialsInput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ClientInitOptions } from "../types-DoZtE9tz.cjs";
|
|
2
|
-
import { h as components, m as TablesLineageResponse, n as GetTablesLineageQuery, t as GetProjectsLineageQuery } from "../types-
|
|
2
|
+
import { h as components, m as TablesLineageResponse, n as GetTablesLineageQuery, t as GetProjectsLineageQuery } from "../types-c_bsDkV6.cjs";
|
|
3
3
|
//#region src/clients/omnisearch/omnisearchClient.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Omnisearch — data lineage.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ClientInitOptions } from "../types-B2w2TtSA.js";
|
|
2
|
-
import { h as components, m as TablesLineageResponse, n as GetTablesLineageQuery, t as GetProjectsLineageQuery } from "../types-
|
|
2
|
+
import { h as components, m as TablesLineageResponse, n as GetTablesLineageQuery, t as GetProjectsLineageQuery } from "../types-CAp1VexS.js";
|
|
3
3
|
//#region src/clients/omnisearch/omnisearchClient.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Omnisearch — data lineage.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LineageMetadata, c as LineageTable, d as ProjectsLineageResponse, f as TableLineageRelation, i as LineageConfiguration, l as ProjectLineageRelation, m as TablesLineageResponse, n as GetTablesLineageQuery, o as LineageProject, p as TablesLineage, r as LineageBucket, s as LineageSource, t as GetProjectsLineageQuery, u as ProjectsLineage } from "../types-
|
|
1
|
+
import { a as LineageMetadata, c as LineageTable, d as ProjectsLineageResponse, f as TableLineageRelation, i as LineageConfiguration, l as ProjectLineageRelation, m as TablesLineageResponse, n as GetTablesLineageQuery, o as LineageProject, p as TablesLineage, r as LineageBucket, s as LineageSource, t as GetProjectsLineageQuery, u as ProjectsLineage } from "../types-c_bsDkV6.cjs";
|
|
2
2
|
export { GetProjectsLineageQuery, GetTablesLineageQuery, LineageBucket, LineageConfiguration, LineageMetadata, LineageProject, LineageSource, LineageTable, ProjectLineageRelation, ProjectsLineage, ProjectsLineageResponse, TableLineageRelation, TablesLineage, TablesLineageResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LineageMetadata, c as LineageTable, d as ProjectsLineageResponse, f as TableLineageRelation, i as LineageConfiguration, l as ProjectLineageRelation, m as TablesLineageResponse, n as GetTablesLineageQuery, o as LineageProject, p as TablesLineage, r as LineageBucket, s as LineageSource, t as GetProjectsLineageQuery, u as ProjectsLineage } from "../types-
|
|
1
|
+
import { a as LineageMetadata, c as LineageTable, d as ProjectsLineageResponse, f as TableLineageRelation, i as LineageConfiguration, l as ProjectLineageRelation, m as TablesLineageResponse, n as GetTablesLineageQuery, o as LineageProject, p as TablesLineage, r as LineageBucket, s as LineageSource, t as GetProjectsLineageQuery, u as ProjectsLineage } from "../types-CAp1VexS.js";
|
|
2
2
|
export { GetProjectsLineageQuery, GetTablesLineageQuery, LineageBucket, LineageConfiguration, LineageMetadata, LineageProject, LineageSource, LineageTable, ProjectLineageRelation, ProjectsLineage, ProjectsLineageResponse, TableLineageRelation, TablesLineage, TablesLineageResponse };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_queryService = require("../queryService-
|
|
2
|
+
const require_queryService = require("../queryService-DSww_TJp.cjs");
|
|
3
3
|
exports.createQueryServiceClient = require_queryService.createQueryServiceClient;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createQueryServiceClient } from "../index-
|
|
1
|
+
import { t as createQueryServiceClient } from "../index-Cm04GKm9.cjs";
|
|
2
2
|
export { createQueryServiceClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createQueryServiceClient } from "../index-
|
|
1
|
+
import { t as createQueryServiceClient } from "../index-BQZ9njUC.js";
|
|
2
2
|
export { createQueryServiceClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createQueryServiceClient } from "../queryService-
|
|
1
|
+
import { t as createQueryServiceClient } from "../queryService-Drvy1ztW.js";
|
|
2
2
|
export { createQueryServiceClient };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_jobStatus = require("./jobStatus-
|
|
1
|
+
const require_jobStatus = require("./jobStatus-CcNlIy5R.cjs");
|
|
2
2
|
const require_createFetchClient = require("./createFetchClient-BgihytBn.cjs");
|
|
3
3
|
const require_createGenericFetchClient = require("./createGenericFetchClient-C7Y0YVfc.cjs");
|
|
4
4
|
const require_createOpenapiFetchClient = require("./createOpenapiFetchClient-DY5s-aH6.cjs");
|
|
@@ -116,4 +116,4 @@ Object.defineProperty(exports, "createQueryServiceClient", {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
//# sourceMappingURL=queryService-
|
|
119
|
+
//# sourceMappingURL=queryService-DSww_TJp.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryService-
|
|
1
|
+
{"version":3,"file":"queryService-DSww_TJp.cjs","names":["poller","jobStatus","createOpenapiFetchClient","createAuthHeaders","createGenericFetchClient","HttpHeader","parseContentDispositionHeader"],"sources":["../src/clients/queryService/poller.ts","../src/clients/queryService/queryServiceClient.ts"],"sourcesContent":["import { jobStatus } from '../../domain/jobStatus';\nimport { poller } from '../../utils/async';\n\nimport type { GetQueryJobPath, JobStatusResponse } from './types';\n\nconst DEFAULT_POLL_INTERVAL = 2000;\n\ntype QueryJobPollOptions = {\n interval?: number;\n maxAttempts?: number;\n timeout?: number;\n signal?: AbortSignal;\n};\n\ntype GetQueryJob = (\n queryJobId: GetQueryJobPath['queryJobId'],\n signal?: AbortSignal,\n) => Promise<JobStatusResponse>;\n\n/**\n * Waits on a query job.\n *\n * - Takes the job rather than its id, so a caller hands over what `createQueryJob` gave it.\n * - The request reads the id off the key rather than out of a closure, which is what makes the key\n * the whole input.\n * - Terminal is the job's own terminal set, not its statements': a `completed` job can still hold a\n * statement that failed, and what that means is the caller's business.\n */\nexport const createJobPoller =\n ({ getQueryJob }: { getQueryJob: GetQueryJob }) =>\n (\n { id }: { id: GetQueryJobPath['queryJobId'] },\n { interval, maxAttempts, timeout, signal }: QueryJobPollOptions = {},\n ) =>\n poller({\n pollKey: ['queryService.job', { queryJobId: id }] as const,\n pollFn: ({ pollKey: [, params], signal: pollSignal }) =>\n getQueryJob(params.queryJobId, pollSignal),\n until: ({ data }) => jobStatus.query.isTerminal(data.status),\n backoff: { type: 'constant', interval: interval ?? DEFAULT_POLL_INTERVAL },\n maxAttempts,\n timeout,\n signal,\n });\n","import {\n createGenericFetchClient,\n createOpenapiFetchClient,\n HttpHeader,\n parseContentDispositionHeader,\n} from '../../fetchClient';\nimport { createAuthHeaders } from '../auth';\nimport type { ClientInitOptions } from '../types';\n\nimport type { paths } from './__generated__/schema';\nimport { createJobPoller } from './poller';\nimport type {\n ExportResultsResponse,\n GetExportResultsQuery,\n GetQueriesHistoryQuery,\n GetQueriesPath,\n GetQueryJobPath,\n GetQueryResultsPath,\n GetQueryResutsQuery,\n PostCancelQueryJobPath,\n PostQueryBody,\n PostQueryPath,\n} from './types';\n\nexport const createQueryServiceClient = ({ baseUrl, middlewares, auth }: ClientInitOptions) => {\n const client = createOpenapiFetchClient<paths>({\n baseUrl,\n middlewares,\n headers: createAuthHeaders(auth),\n });\n const genericClient = createGenericFetchClient({ baseUrl, middlewares });\n\n const createQueryJob = async (\n branchId: PostQueryPath['branchId'],\n workspaceId: PostQueryPath['workspaceId'],\n body: PostQueryBody,\n ) => {\n const { data } = await client.post(\n '/api/v1/branches/{branchId}/workspaces/{workspaceId}/queries',\n { path: { branchId, workspaceId }, body },\n );\n\n return data;\n };\n\n const cancelQueryJob = async (queryJobId: PostCancelQueryJobPath['queryJobId']) => {\n const { data } = await client.post('/api/v1/queries/{queryJobId}/cancel', {\n path: { queryJobId },\n body: { reason: 'Cancelled by user' },\n });\n\n return data;\n };\n\n const getQueryJob = async (queryJobId: GetQueryJobPath['queryJobId'], signal?: AbortSignal) => {\n const { data } = await client.get(\n '/api/v1/queries/{queryJobId}',\n { path: { queryJobId } },\n { signal },\n );\n\n return data;\n };\n\n const getQueryResults = async (\n queryJobId: GetQueryResultsPath['queryJobId'],\n statementId: GetQueryResultsPath['statementId'],\n query?: GetQueryResutsQuery,\n ) => {\n const { data } = await client.get('/api/v1/queries/{queryJobId}/{statementId}/results', {\n path: { queryJobId, statementId },\n query,\n });\n\n return data;\n };\n\n const getQueryHistory = async (\n branchId: GetQueriesPath['branchId'],\n workspaceId: GetQueriesPath['workspaceId'],\n query?: GetQueriesHistoryQuery,\n ) => {\n const { data } = await client.get(\n '/api/v1/branches/{branchId}/workspaces/{workspaceId}/queries',\n {\n path: { branchId, workspaceId },\n query,\n },\n );\n\n return data;\n };\n\n const exportResults = async (\n queryJobId: GetQueryResultsPath['queryJobId'],\n statementId: GetQueryResultsPath['statementId'],\n query: GetExportResultsQuery,\n signal?: AbortSignal,\n ): Promise<ExportResultsResponse> => {\n const { data, response } = await client.get(\n '/api/v1/queries/{queryJobId}/{statementId}/export',\n {\n path: { queryJobId, statementId },\n query,\n },\n { signal },\n );\n\n const mimeType = response.headers.get(HttpHeader.CONTENT_TYPE) ?? 'text/csv';\n const contentDisposition = parseContentDispositionHeader(\n response.headers.get(HttpHeader.CONTENT_DISPOSITION),\n );\n\n return {\n mimeType,\n content: data,\n fileName: contentDisposition?.filename ?? 'export.csv',\n };\n };\n\n const healthCheck = async (signal?: AbortSignal) => {\n const { data } = await genericClient.get('/health-check', {}, { signal });\n\n return data;\n };\n\n // Every wait on a query job is the same wait, so it is the client's rather than a caller's.\n const poller = createJobPoller({ getQueryJob });\n\n return {\n healthCheck,\n poller,\n createQueryJob,\n cancelQueryJob,\n getQueryJob,\n getQueryResults,\n getQueryHistory,\n exportResults,\n };\n};\n"],"mappings":";;;;;;AAKA,MAAM,wBAAwB;;;;;;;;;;AAuB9B,MAAa,mBACV,EAAE,mBAED,EAAE,MACF,EAAE,UAAU,aAAa,SAAS,WAAgC,CAAC,MAEnEA,kBAAAA,OAAO;CACL,SAAS,CAAC,oBAAoB,EAAE,YAAY,GAAG,CAAC;CAChD,SAAS,EAAE,SAAS,GAAG,SAAS,QAAQ,iBACtC,YAAY,OAAO,YAAY,UAAU;CAC3C,QAAQ,EAAE,WAAWC,kBAAAA,UAAU,MAAM,WAAW,KAAK,MAAM;CAC3D,SAAS;EAAE,MAAM;EAAY,UAAU,YAAY;CAAsB;CACzE;CACA;CACA;AACF,CAAC;;;ACnBL,MAAa,4BAA4B,EAAE,SAAS,aAAa,WAA8B;CAC7F,MAAM,SAASC,iCAAAA,yBAAgC;EAC7C;EACA;EACA,SAASC,aAAAA,kBAAkB,IAAI;CACjC,CAAC;CACD,MAAM,gBAAgBC,iCAAAA,yBAAyB;EAAE;EAAS;CAAY,CAAC;CAEvE,MAAM,iBAAiB,OACrB,UACA,aACA,SAC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AKA,OAAO;EACL;EACA,QAJa,gBAAgB,EAAE,YAAY,CAItC;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as poller, t as jobStatus } from "./jobStatus-
|
|
1
|
+
import { a as poller, t as jobStatus } from "./jobStatus-CDp4r5JQ.js";
|
|
2
2
|
import { f as parseContentDispositionHeader, s as HttpHeader } from "./createFetchClient-cgWkwgAQ.js";
|
|
3
3
|
import { t as createGenericFetchClient } from "./createGenericFetchClient-CX9Hn3Aq.js";
|
|
4
4
|
import { t as createOpenapiFetchClient } from "./createOpenapiFetchClient-BxcLLU_N.js";
|
|
@@ -111,4 +111,4 @@ const createQueryServiceClient = ({ baseUrl, middlewares, auth }) => {
|
|
|
111
111
|
//#endregion
|
|
112
112
|
export { createQueryServiceClient as t };
|
|
113
113
|
|
|
114
|
-
//# sourceMappingURL=queryService-
|
|
114
|
+
//# sourceMappingURL=queryService-Drvy1ztW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryService-
|
|
1
|
+
{"version":3,"file":"queryService-Drvy1ztW.js","names":[],"sources":["../src/clients/queryService/poller.ts","../src/clients/queryService/queryServiceClient.ts"],"sourcesContent":["import { jobStatus } from '../../domain/jobStatus';\nimport { poller } from '../../utils/async';\n\nimport type { GetQueryJobPath, JobStatusResponse } from './types';\n\nconst DEFAULT_POLL_INTERVAL = 2000;\n\ntype QueryJobPollOptions = {\n interval?: number;\n maxAttempts?: number;\n timeout?: number;\n signal?: AbortSignal;\n};\n\ntype GetQueryJob = (\n queryJobId: GetQueryJobPath['queryJobId'],\n signal?: AbortSignal,\n) => Promise<JobStatusResponse>;\n\n/**\n * Waits on a query job.\n *\n * - Takes the job rather than its id, so a caller hands over what `createQueryJob` gave it.\n * - The request reads the id off the key rather than out of a closure, which is what makes the key\n * the whole input.\n * - Terminal is the job's own terminal set, not its statements': a `completed` job can still hold a\n * statement that failed, and what that means is the caller's business.\n */\nexport const createJobPoller =\n ({ getQueryJob }: { getQueryJob: GetQueryJob }) =>\n (\n { id }: { id: GetQueryJobPath['queryJobId'] },\n { interval, maxAttempts, timeout, signal }: QueryJobPollOptions = {},\n ) =>\n poller({\n pollKey: ['queryService.job', { queryJobId: id }] as const,\n pollFn: ({ pollKey: [, params], signal: pollSignal }) =>\n getQueryJob(params.queryJobId, pollSignal),\n until: ({ data }) => jobStatus.query.isTerminal(data.status),\n backoff: { type: 'constant', interval: interval ?? DEFAULT_POLL_INTERVAL },\n maxAttempts,\n timeout,\n signal,\n });\n","import {\n createGenericFetchClient,\n createOpenapiFetchClient,\n HttpHeader,\n parseContentDispositionHeader,\n} from '../../fetchClient';\nimport { createAuthHeaders } from '../auth';\nimport type { ClientInitOptions } from '../types';\n\nimport type { paths } from './__generated__/schema';\nimport { createJobPoller } from './poller';\nimport type {\n ExportResultsResponse,\n GetExportResultsQuery,\n GetQueriesHistoryQuery,\n GetQueriesPath,\n GetQueryJobPath,\n GetQueryResultsPath,\n GetQueryResutsQuery,\n PostCancelQueryJobPath,\n PostQueryBody,\n PostQueryPath,\n} from './types';\n\nexport const createQueryServiceClient = ({ baseUrl, middlewares, auth }: ClientInitOptions) => {\n const client = createOpenapiFetchClient<paths>({\n baseUrl,\n middlewares,\n headers: createAuthHeaders(auth),\n });\n const genericClient = createGenericFetchClient({ baseUrl, middlewares });\n\n const createQueryJob = async (\n branchId: PostQueryPath['branchId'],\n workspaceId: PostQueryPath['workspaceId'],\n body: PostQueryBody,\n ) => {\n const { data } = await client.post(\n '/api/v1/branches/{branchId}/workspaces/{workspaceId}/queries',\n { path: { branchId, workspaceId }, body },\n );\n\n return data;\n };\n\n const cancelQueryJob = async (queryJobId: PostCancelQueryJobPath['queryJobId']) => {\n const { data } = await client.post('/api/v1/queries/{queryJobId}/cancel', {\n path: { queryJobId },\n body: { reason: 'Cancelled by user' },\n });\n\n return data;\n };\n\n const getQueryJob = async (queryJobId: GetQueryJobPath['queryJobId'], signal?: AbortSignal) => {\n const { data } = await client.get(\n '/api/v1/queries/{queryJobId}',\n { path: { queryJobId } },\n { signal },\n );\n\n return data;\n };\n\n const getQueryResults = async (\n queryJobId: GetQueryResultsPath['queryJobId'],\n statementId: GetQueryResultsPath['statementId'],\n query?: GetQueryResutsQuery,\n ) => {\n const { data } = await client.get('/api/v1/queries/{queryJobId}/{statementId}/results', {\n path: { queryJobId, statementId },\n query,\n });\n\n return data;\n };\n\n const getQueryHistory = async (\n branchId: GetQueriesPath['branchId'],\n workspaceId: GetQueriesPath['workspaceId'],\n query?: GetQueriesHistoryQuery,\n ) => {\n const { data } = await client.get(\n '/api/v1/branches/{branchId}/workspaces/{workspaceId}/queries',\n {\n path: { branchId, workspaceId },\n query,\n },\n );\n\n return data;\n };\n\n const exportResults = async (\n queryJobId: GetQueryResultsPath['queryJobId'],\n statementId: GetQueryResultsPath['statementId'],\n query: GetExportResultsQuery,\n signal?: AbortSignal,\n ): Promise<ExportResultsResponse> => {\n const { data, response } = await client.get(\n '/api/v1/queries/{queryJobId}/{statementId}/export',\n {\n path: { queryJobId, statementId },\n query,\n },\n { signal },\n );\n\n const mimeType = response.headers.get(HttpHeader.CONTENT_TYPE) ?? 'text/csv';\n const contentDisposition = parseContentDispositionHeader(\n response.headers.get(HttpHeader.CONTENT_DISPOSITION),\n );\n\n return {\n mimeType,\n content: data,\n fileName: contentDisposition?.filename ?? 'export.csv',\n };\n };\n\n const healthCheck = async (signal?: AbortSignal) => {\n const { data } = await genericClient.get('/health-check', {}, { signal });\n\n return data;\n };\n\n // Every wait on a query job is the same wait, so it is the client's rather than a caller's.\n const poller = createJobPoller({ getQueryJob });\n\n return {\n healthCheck,\n poller,\n createQueryJob,\n cancelQueryJob,\n getQueryJob,\n getQueryResults,\n getQueryHistory,\n exportResults,\n };\n};\n"],"mappings":";;;;;;AAKA,MAAM,wBAAwB;;;;;;;;;;AAuB9B,MAAa,mBACV,EAAE,mBAED,EAAE,MACF,EAAE,UAAU,aAAa,SA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,CACF;EAEA,OAAO;CACT;CAEA,MAAM,gBAAgB,OACpB,YACA,aACA,OACA,WACmC;EACnC,MAAM,EAAE,MAAM,aAAa,MAAM,OAAO,IACtC,qDACA;GACE,MAAM;IAAE;IAAY;GAAY;GAChC;EACF,GACA,EAAE,OAAO,CACX;EAOA,OAAO;GACL,UANe,SAAS,QAAQ,IAAI,WAAW,YAAY,KAAK;GAOhE,SAAS;GACT,UAPyB,8BACzB,SAAS,QAAQ,IAAI,WAAW,mBAAmB,CAMxB,CAAC,EAAE,YAAY;EAC5C;CACF;CAEA,MAAM,cAAc,OAAO,WAAyB;EAClD,MAAM,EAAE,SAAS,MAAM,cAAc,IAAI,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC;EAExE,OAAO;CACT;CAKA,OAAO;EACL;EACA,QAJa,gBAAgB,EAAE,YAAY,CAItC;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
package/dist/queue/index.cjs
CHANGED
package/dist/queue/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dt as Poller } from "../index-
|
|
1
|
+
import { Dt as Poller } from "../index-Cm04GKm9.cjs";
|
|
2
2
|
import { n as ClientInitOptions } from "../types-DoZtE9tz.cjs";
|
|
3
3
|
import { a as OrchestrationRerunPlanPath, c as SearchAllJobsQuery, d as SearchJobsQuery, l as SearchGroupedJobsQuery, n as GetQueueJobPath, p as components, r as KillJobPath, t as CreateJobBody } from "../types-DUMal2E-.cjs";
|
|
4
4
|
//#region src/clients/queue/queueClient.d.ts
|
package/dist/queue/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dt as Poller } from "../index-
|
|
1
|
+
import { Dt as Poller } from "../index-BQZ9njUC.js";
|
|
2
2
|
import { n as ClientInitOptions } from "../types-B2w2TtSA.js";
|
|
3
3
|
import { a as OrchestrationRerunPlanPath, c as SearchAllJobsQuery, d as SearchJobsQuery, l as SearchGroupedJobsQuery, n as GetQueueJobPath, p as components, r as KillJobPath, t as CreateJobBody } from "../types-DwVSj-Da.js";
|
|
4
4
|
//#region src/clients/queue/queueClient.d.ts
|
package/dist/queue/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createQueueClient } from "../queue-
|
|
1
|
+
import { t as createQueueClient } from "../queue-Ci_f_5TI.js";
|
|
2
2
|
export { createQueueClient };
|