velocious 1.0.666 → 1.0.668
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/README.md +40 -11
- package/build/background-jobs/adapter-client.js +22 -0
- package/build/background-jobs/adapter.js +15 -0
- package/build/background-jobs/client.js +147 -1
- package/build/background-jobs/job-semantics.js +30 -0
- package/build/background-jobs/job.js +26 -1
- package/build/background-jobs/local-adapter.js +36 -8
- package/build/background-jobs/local-store.js +410 -39
- package/build/background-jobs/main.js +69 -2
- package/build/background-jobs/platform-job.js +26 -1
- package/build/background-jobs/runtime.js +58 -0
- package/build/background-jobs/store.js +374 -6
- package/build/background-jobs/types.js +27 -2
- package/build/background-jobs/web/controller.js +1 -0
- package/build/configuration.js +30 -6
- package/build/database/drivers/mssql/column.js +2 -2
- package/build/database/drivers/mssql/table.js +19 -5
- package/build/database/pool/async-tracked-multi-connection.js +2 -1
- package/build/database/query/alter-table-base.js +8 -1
- package/build/database/record/attachments/store.js +2 -2
- package/build/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +2 -48
- package/build/environment-handlers/node/cli/commands/test.js +17 -69
- package/build/frontend-model-controller.js +22 -2
- package/build/frontend-models/websocket-channel.js +18 -0
- package/build/http-server/client/websocket-session.js +41 -4
- package/build/http-server/websocket-channel.js +14 -0
- package/build/http-server/websocket-event-log-store.js +85 -12
- package/build/http-server/websocket-events-host.js +17 -7
- package/build/src/background-jobs/adapter-client.d.ts +17 -0
- package/build/src/background-jobs/adapter-client.d.ts.map +1 -1
- package/build/src/background-jobs/adapter-client.js +19 -1
- package/build/src/background-jobs/adapter.d.ts +15 -0
- package/build/src/background-jobs/adapter.d.ts.map +1 -1
- package/build/src/background-jobs/adapter.js +14 -1
- package/build/src/background-jobs/client.d.ts +17 -0
- package/build/src/background-jobs/client.d.ts.map +1 -1
- package/build/src/background-jobs/client.js +129 -1
- package/build/src/background-jobs/job-semantics.d.ts +18 -0
- package/build/src/background-jobs/job-semantics.d.ts.map +1 -1
- package/build/src/background-jobs/job-semantics.js +28 -1
- package/build/src/background-jobs/job.d.ts +15 -0
- package/build/src/background-jobs/job.d.ts.map +1 -1
- package/build/src/background-jobs/job.js +21 -2
- package/build/src/background-jobs/local-adapter.d.ts +23 -8
- package/build/src/background-jobs/local-adapter.d.ts.map +1 -1
- package/build/src/background-jobs/local-adapter.js +35 -9
- package/build/src/background-jobs/local-store.d.ts +120 -5
- package/build/src/background-jobs/local-store.d.ts.map +1 -1
- package/build/src/background-jobs/local-store.js +366 -40
- package/build/src/background-jobs/main.d.ts +24 -2
- package/build/src/background-jobs/main.d.ts.map +1 -1
- package/build/src/background-jobs/main.js +68 -3
- package/build/src/background-jobs/platform-job.d.ts +15 -0
- package/build/src/background-jobs/platform-job.d.ts.map +1 -1
- package/build/src/background-jobs/platform-job.js +19 -2
- package/build/src/background-jobs/runtime.d.ts +39 -0
- package/build/src/background-jobs/runtime.d.ts.map +1 -1
- package/build/src/background-jobs/runtime.js +49 -1
- package/build/src/background-jobs/store.d.ts +100 -1
- package/build/src/background-jobs/store.d.ts.map +1 -1
- package/build/src/background-jobs/store.js +334 -8
- package/build/src/background-jobs/types.d.ts +97 -4
- package/build/src/background-jobs/types.d.ts.map +1 -1
- package/build/src/background-jobs/types.js +28 -3
- package/build/src/background-jobs/web/controller.d.ts.map +1 -1
- package/build/src/background-jobs/web/controller.js +2 -1
- package/build/src/configuration.d.ts +18 -1
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +28 -6
- package/build/src/database/drivers/mssql/column.d.ts.map +1 -1
- package/build/src/database/drivers/mssql/column.js +2 -2
- package/build/src/database/drivers/mssql/table.d.ts.map +1 -1
- package/build/src/database/drivers/mssql/table.js +19 -5
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +3 -2
- package/build/src/database/query/alter-table-base.d.ts.map +1 -1
- package/build/src/database/query/alter-table-base.js +9 -2
- package/build/src/database/record/attachments/store.js +3 -3
- package/build/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +3 -47
- package/build/src/environment-handlers/node/cli/commands/test.d.ts +2 -28
- package/build/src/environment-handlers/node/cli/commands/test.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/test.js +10 -61
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +18 -3
- package/build/src/frontend-models/websocket-channel.d.ts +9 -0
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +16 -1
- package/build/src/http-server/client/websocket-session.d.ts +25 -2
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +40 -5
- package/build/src/http-server/websocket-channel.d.ts +11 -0
- package/build/src/http-server/websocket-channel.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel.js +14 -1
- package/build/src/http-server/websocket-event-log-store.d.ts +60 -41
- package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
- package/build/src/http-server/websocket-event-log-store.js +79 -12
- package/build/src/http-server/websocket-events-host.d.ts +10 -3
- package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
- package/build/src/http-server/websocket-events-host.js +17 -8
- package/build/src/testing/test-files-finder.d.ts +17 -117
- package/build/src/testing/test-files-finder.d.ts.map +1 -1
- package/build/src/testing/test-files-finder.js +29 -294
- package/build/src/testing/test-filter-parser.d.ts +32 -22
- package/build/src/testing/test-filter-parser.d.ts.map +1 -1
- package/build/src/testing/test-filter-parser.js +25 -217
- package/build/src/testing/test-profile-activity.d.ts +1 -6
- package/build/src/testing/test-profile-activity.d.ts.map +1 -1
- package/build/src/testing/test-profile-activity.js +2 -12
- package/build/src/testing/test-profile-output.d.ts +1 -40
- package/build/src/testing/test-profile-output.d.ts.map +1 -1
- package/build/src/testing/test-profile-output.js +2 -217
- package/build/src/testing/test-profiler.d.ts +15 -659
- package/build/src/testing/test-profiler.d.ts.map +1 -1
- package/build/src/testing/test-profiler.js +35 -833
- package/build/src/testing/test-runner.d.ts +10 -1
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +26 -4
- package/build/src/testing/test-suite-splitter.d.ts +1 -128
- package/build/src/testing/test-suite-splitter.d.ts.map +1 -1
- package/build/src/testing/test-suite-splitter.js +2 -259
- package/build/src/testing/timing-manifest.d.ts +5 -93
- package/build/src/testing/timing-manifest.d.ts.map +1 -1
- package/build/src/testing/timing-manifest.js +4 -283
- package/build/src/testing/velocious-attempt-executor.d.ts.map +1 -1
- package/build/src/testing/velocious-attempt-executor.js +8 -2
- package/build/testing/test-files-finder.js +32 -343
- package/build/testing/test-filter-parser.js +29 -248
- package/build/testing/test-profile-activity.js +1 -12
- package/build/testing/test-profile-output.js +8 -253
- package/build/testing/test-profiler.js +38 -895
- package/build/testing/test-runner.js +33 -9
- package/build/testing/test-suite-splitter.js +1 -301
- package/build/testing/timing-manifest.js +10 -344
- package/build/testing/velocious-attempt-executor.js +7 -1
- package/package.json +3 -3
- package/scripts/test-browser.js +30 -6
- package/scripts/verify-docker-dev-environment.js +13 -1
- package/src/background-jobs/adapter-client.js +22 -0
- package/src/background-jobs/adapter.js +15 -0
- package/src/background-jobs/client.js +147 -1
- package/src/background-jobs/job-semantics.js +30 -0
- package/src/background-jobs/job.js +26 -1
- package/src/background-jobs/local-adapter.js +36 -8
- package/src/background-jobs/local-store.js +410 -39
- package/src/background-jobs/main.js +69 -2
- package/src/background-jobs/platform-job.js +26 -1
- package/src/background-jobs/runtime.js +58 -0
- package/src/background-jobs/store.js +374 -6
- package/src/background-jobs/types.js +27 -2
- package/src/background-jobs/web/controller.js +1 -0
- package/src/configuration.js +30 -6
- package/src/database/drivers/mssql/column.js +2 -2
- package/src/database/drivers/mssql/table.js +19 -5
- package/src/database/pool/async-tracked-multi-connection.js +2 -1
- package/src/database/query/alter-table-base.js +8 -1
- package/src/database/record/attachments/store.js +2 -2
- package/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +2 -48
- package/src/environment-handlers/node/cli/commands/test.js +17 -69
- package/src/frontend-model-controller.js +22 -2
- package/src/frontend-models/websocket-channel.js +18 -0
- package/src/http-server/client/websocket-session.js +41 -4
- package/src/http-server/websocket-channel.js +14 -0
- package/src/http-server/websocket-event-log-store.js +85 -12
- package/src/http-server/websocket-events-host.js +17 -7
- package/src/testing/test-files-finder.js +32 -343
- package/src/testing/test-filter-parser.js +29 -248
- package/src/testing/test-profile-activity.js +1 -12
- package/src/testing/test-profile-output.js +8 -253
- package/src/testing/test-profiler.js +38 -895
- package/src/testing/test-runner.js +33 -9
- package/src/testing/test-suite-splitter.js +1 -301
- package/src/testing/timing-manifest.js +10 -344
- package/src/testing/velocious-attempt-executor.js +7 -1
|
@@ -1,12 +1,82 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import timeout, {TimeoutError} from "awaitery/build/timeout.js"
|
|
3
|
+
import timeout, { TimeoutError } from "awaitery/build/timeout.js"
|
|
4
4
|
import configurationResolver from "../configuration-resolver.js"
|
|
5
|
+
import isPlainObject from "../utils/plain-object.js"
|
|
5
6
|
import BackgroundJobEnqueueAcknowledgementTimeoutError from "./enqueue-acknowledgement-timeout-error.js"
|
|
6
7
|
import BackgroundJobsSocketRequest from "./socket-request.js"
|
|
7
8
|
import { DEFAULT_GENERATION_HANDSHAKE_TIMEOUT_MS, validateGenerationHandshakeTimeoutMs } from "./generation-handshake-timeout-error.js"
|
|
9
|
+
import { BACKGROUND_JOB_ACTIVE_STATUSES, BACKGROUND_JOB_EXECUTION_MODES, BACKGROUND_JOB_STATUSES, BACKGROUND_JOB_TERMINAL_STATUSES } from "./job-semantics.js"
|
|
8
10
|
|
|
9
11
|
const DEFAULT_ENQUEUE_TIMEOUT_MS = 5000
|
|
12
|
+
const BACKGROUND_JOB_WAKE_OUTCOMES = ["woken", "already_due", "handed_off", "not_found"]
|
|
13
|
+
const BACKGROUND_JOB_NULLABLE_NUMBER_FIELDS = [
|
|
14
|
+
"attempts",
|
|
15
|
+
"childPid",
|
|
16
|
+
"childReceivedAtMs",
|
|
17
|
+
"childStartedAtMs",
|
|
18
|
+
"completedAtMs",
|
|
19
|
+
"createdAtMs",
|
|
20
|
+
"failedAtMs",
|
|
21
|
+
"handedOffAtMs",
|
|
22
|
+
"maxConcurrency",
|
|
23
|
+
"maxRetries",
|
|
24
|
+
"orphanedAtMs",
|
|
25
|
+
"scheduleOrder",
|
|
26
|
+
"scheduledAtMs",
|
|
27
|
+
"timeoutMs"
|
|
28
|
+
]
|
|
29
|
+
const BACKGROUND_JOB_NULLABLE_STRING_FIELDS = ["childInstanceId", "concurrencyKey", "handoffId", "lastError", "scheduleKey", "workerId"]
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Checks a required nullable number from a normalized wire row.
|
|
33
|
+
* @param {ReturnType<typeof JSON.parse>} value - Field value.
|
|
34
|
+
* @returns {boolean} - Whether the field is null or a finite number.
|
|
35
|
+
*/
|
|
36
|
+
function isNullableBackgroundJobNumber(value) {
|
|
37
|
+
return value === null || (typeof value === "number" && Number.isFinite(value))
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Checks a required nullable string from a normalized wire row.
|
|
42
|
+
* @param {ReturnType<typeof JSON.parse>} value - Field value.
|
|
43
|
+
* @returns {boolean} - Whether the field is null or a string.
|
|
44
|
+
*/
|
|
45
|
+
function isNullableBackgroundJobString(value) {
|
|
46
|
+
return value === null || typeof value === "string"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Checks that a transport job uses the normalized public camel-case shape.
|
|
51
|
+
* @param {ReturnType<typeof JSON.parse>} value - Transport value.
|
|
52
|
+
* @returns {value is import("./types.js").BackgroundJobRow} - Whether normalized.
|
|
53
|
+
*/
|
|
54
|
+
function isNormalizedBackgroundJob(value) {
|
|
55
|
+
if (!isPlainObject(value)) return false
|
|
56
|
+
|
|
57
|
+
const job = value
|
|
58
|
+
|
|
59
|
+
return typeof job.id === "string"
|
|
60
|
+
&& typeof job.jobName === "string"
|
|
61
|
+
&& Array.isArray(job.args)
|
|
62
|
+
&& BACKGROUND_JOB_EXECUTION_MODES.some((executionMode) => executionMode === job.executionMode)
|
|
63
|
+
&& typeof job.queue === "string"
|
|
64
|
+
&& BACKGROUND_JOB_STATUSES.some((status) => status === job.status)
|
|
65
|
+
&& BACKGROUND_JOB_NULLABLE_NUMBER_FIELDS.every((field) => isNullableBackgroundJobNumber(job[field]))
|
|
66
|
+
&& BACKGROUND_JOB_NULLABLE_STRING_FIELDS.every((field) => isNullableBackgroundJobString(job[field]))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Describes an unexpected protocol response without echoing its payload.
|
|
71
|
+
* @param {string} operation - Public operation name.
|
|
72
|
+
* @param {import("./types.js").BackgroundJobSocketMessage} message - Response.
|
|
73
|
+
* @returns {Error} - Protocol error.
|
|
74
|
+
*/
|
|
75
|
+
function unexpectedResponseError(operation, message) {
|
|
76
|
+
const responseType = message && typeof message.type === "string" ? message.type : "missing type"
|
|
77
|
+
|
|
78
|
+
return new Error(`Unexpected ${operation} response: ${responseType}`)
|
|
79
|
+
}
|
|
10
80
|
|
|
11
81
|
export default class BackgroundJobsClient {
|
|
12
82
|
/**
|
|
@@ -236,4 +306,80 @@ export default class BackgroundJobsClient {
|
|
|
236
306
|
}
|
|
237
307
|
})
|
|
238
308
|
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Reads current stable ownership and optional terminal history.
|
|
312
|
+
* @param {{scheduleKey: string, includeLatestTerminal?: boolean}} args - Lookup request.
|
|
313
|
+
* @returns {Promise<import("./types.js").BackgroundJobScheduledLookupResult>} - Normalized stable schedule jobs.
|
|
314
|
+
*/
|
|
315
|
+
async getScheduledJob({scheduleKey, includeLatestTerminal}) {
|
|
316
|
+
const request = await this._request()
|
|
317
|
+
|
|
318
|
+
return await request.run({
|
|
319
|
+
onConnect: (jsonSocket) => {
|
|
320
|
+
jsonSocket.send({type: "get-scheduled-job", scheduleKey, includeLatestTerminal})
|
|
321
|
+
},
|
|
322
|
+
onMessage: ({message, resolve, reject}) => {
|
|
323
|
+
if (message?.type === "scheduled-job") {
|
|
324
|
+
const {currentJob, latestTerminalJob} = message
|
|
325
|
+
const currentJobValid = currentJob === null
|
|
326
|
+
|| (isNormalizedBackgroundJob(currentJob) && BACKGROUND_JOB_ACTIVE_STATUSES.some((status) => status === currentJob.status))
|
|
327
|
+
const latestTerminalJobValid = latestTerminalJob === null
|
|
328
|
+
|| (isNormalizedBackgroundJob(latestTerminalJob) && BACKGROUND_JOB_TERMINAL_STATUSES.some((status) => status === latestTerminalJob.status))
|
|
329
|
+
|
|
330
|
+
if (!currentJobValid || !latestTerminalJobValid) {
|
|
331
|
+
reject(new Error("Invalid getScheduledJob response: expected normalized public job values"))
|
|
332
|
+
return
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
resolve({currentJob, latestTerminalJob})
|
|
336
|
+
return
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (message?.type === "get-scheduled-job-error") {
|
|
340
|
+
reject(new Error(message.error || "Failed to read scheduled job"))
|
|
341
|
+
return
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
reject(unexpectedResponseError("getScheduledJob", message))
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Expedites a future queued stable owner without changing job identity.
|
|
351
|
+
* @param {{scheduleKey: string}} args - Wake request.
|
|
352
|
+
* @returns {Promise<import("./types.js").BackgroundJobWakeResult>} - Wake result.
|
|
353
|
+
*/
|
|
354
|
+
async wakeScheduled({scheduleKey}) {
|
|
355
|
+
const request = await this._request()
|
|
356
|
+
|
|
357
|
+
return await request.run({
|
|
358
|
+
onConnect: (jsonSocket) => {
|
|
359
|
+
jsonSocket.send({type: "wake-scheduled", scheduleKey})
|
|
360
|
+
},
|
|
361
|
+
onMessage: ({message, resolve, reject}) => {
|
|
362
|
+
if (message?.type === "schedule-woken") {
|
|
363
|
+
const outcome = message.outcome
|
|
364
|
+
const knownOutcome = BACKGROUND_JOB_WAKE_OUTCOMES.includes(outcome)
|
|
365
|
+
const validJobId = outcome === "not_found" ? message.jobId === null : typeof message.jobId === "string" && message.jobId.length > 0
|
|
366
|
+
|
|
367
|
+
if (!knownOutcome || !validJobId) {
|
|
368
|
+
reject(new Error("Invalid wakeScheduled response"))
|
|
369
|
+
return
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
resolve({jobId: message.jobId, outcome})
|
|
373
|
+
return
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (message?.type === "wake-scheduled-error") {
|
|
377
|
+
reject(new Error(message.error || "Failed to wake scheduled job"))
|
|
378
|
+
return
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
reject(unexpectedResponseError("wakeScheduled", message))
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
}
|
|
239
385
|
}
|
|
@@ -8,6 +8,36 @@ export const DEFAULT_BACKGROUND_JOB_QUEUE = "default"
|
|
|
8
8
|
export const QUEUE_CONCURRENCY_KEY_PREFIX = "queue:"
|
|
9
9
|
/** @type {import("./types.js").BackgroundJobExecutionMode[]} */
|
|
10
10
|
export const BACKGROUND_JOB_EXECUTION_MODES = ["inline", "forked", "pooled", "spawned"]
|
|
11
|
+
/** @type {import("./types.js").BackgroundJobActiveStatus[]} */
|
|
12
|
+
export const BACKGROUND_JOB_ACTIVE_STATUSES = ["queued", "handed_off"]
|
|
13
|
+
/** @type {import("./types.js").BackgroundJobTerminalStatus[]} */
|
|
14
|
+
export const BACKGROUND_JOB_TERMINAL_STATUSES = ["cancelled", "completed", "failed", "orphaned"]
|
|
15
|
+
/** @type {import("./types.js").BackgroundJobStatus[]} */
|
|
16
|
+
export const BACKGROUND_JOB_STATUSES = [...BACKGROUND_JOB_ACTIVE_STATUSES, ...BACKGROUND_JOB_TERMINAL_STATUSES]
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Normalizes persisted or transported job status vocabulary.
|
|
20
|
+
* @param {string} value - Candidate status.
|
|
21
|
+
* @returns {import("./types.js").BackgroundJobStatus} - Known status.
|
|
22
|
+
*/
|
|
23
|
+
export function normalizeBackgroundJobStatus(value) {
|
|
24
|
+
const status = BACKGROUND_JOB_STATUSES.find((candidate) => candidate === value)
|
|
25
|
+
|
|
26
|
+
if (status) return status
|
|
27
|
+
|
|
28
|
+
throw new Error(`Unknown background job status: ${value}`)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Validates a stable logical schedule key at every persistence boundary.
|
|
33
|
+
* @param {string} scheduleKey - Stable schedule key.
|
|
34
|
+
* @returns {string} - Validated key.
|
|
35
|
+
*/
|
|
36
|
+
export function normalizeBackgroundJobScheduleKey(scheduleKey) {
|
|
37
|
+
if (typeof scheduleKey === "string" && scheduleKey.length > 0 && scheduleKey.length <= 255) return scheduleKey
|
|
38
|
+
|
|
39
|
+
throw VelociousError.safe("background job scheduleKey must be a non-empty string of at most 255 characters")
|
|
40
|
+
}
|
|
11
41
|
|
|
12
42
|
/**
|
|
13
43
|
* Normalizes a job queue.
|
|
@@ -8,7 +8,9 @@ import PlatformVelociousJob from "./platform-job.js"
|
|
|
8
8
|
import {
|
|
9
9
|
cancelScheduledBackgroundJobForConfiguration,
|
|
10
10
|
enqueueBackgroundJobForConfiguration,
|
|
11
|
-
|
|
11
|
+
getScheduledBackgroundJobForConfiguration,
|
|
12
|
+
replaceScheduledBackgroundJobForConfiguration,
|
|
13
|
+
wakeScheduledBackgroundJobForConfiguration
|
|
12
14
|
} from "./runtime.js"
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -84,4 +86,27 @@ export default class VelociousJob extends PlatformVelociousJob {
|
|
|
84
86
|
|
|
85
87
|
return await cancelScheduledBackgroundJobForConfiguration({configuration, scheduleKey})
|
|
86
88
|
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Reads current ownership and optional terminal history for a stable key.
|
|
92
|
+
* @param {string} scheduleKey - Stable logical schedule key.
|
|
93
|
+
* @param {{includeLatestTerminal?: boolean}} [options] - Lookup options.
|
|
94
|
+
* @returns {Promise<import("./types.js").BackgroundJobScheduledLookupResult>} - Normalized stable schedule jobs.
|
|
95
|
+
*/
|
|
96
|
+
static async getScheduledJob(scheduleKey, options = {}) {
|
|
97
|
+
const configuration = await configurationResolver()
|
|
98
|
+
|
|
99
|
+
return await getScheduledBackgroundJobForConfiguration({configuration, scheduleKey, ...options})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Expedites a future queued owner without creating another job.
|
|
104
|
+
* @param {string} scheduleKey - Stable logical schedule key.
|
|
105
|
+
* @returns {Promise<import("./types.js").BackgroundJobWakeResult>} - Wake result.
|
|
106
|
+
*/
|
|
107
|
+
static async wakeScheduled(scheduleKey) {
|
|
108
|
+
const configuration = await configurationResolver()
|
|
109
|
+
|
|
110
|
+
return await wakeScheduledBackgroundJobForConfiguration({configuration, scheduleKey})
|
|
111
|
+
}
|
|
87
112
|
}
|
|
@@ -67,18 +67,46 @@ export default class LocalBackgroundJobsAdapter extends BackgroundJobsAdapter {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @param {string}
|
|
72
|
-
* @returns {Promise<import("./types.js").BackgroundJobCancellationResult>} -
|
|
70
|
+
* Cancels or detaches the current owner of a stable schedule key.
|
|
71
|
+
* @param {string} scheduleKey - Stable schedule key.
|
|
72
|
+
* @returns {Promise<import("./types.js").BackgroundJobCancellationResult>} - Cancellation result.
|
|
73
73
|
*/
|
|
74
|
-
async cancelScheduled(
|
|
74
|
+
async cancelScheduled(scheduleKey) {
|
|
75
|
+
await this.ensureReady()
|
|
76
|
+
return await this.store.cancelScheduled(scheduleKey)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Replaces the current owner of a stable schedule key.
|
|
81
|
+
* @param {{scheduleKey: string, jobName: string, args: Array<ReturnType<typeof JSON.parse>>, options?: import("./types.js").BackgroundJobOptions}} args - Replacement request.
|
|
82
|
+
* @returns {Promise<import("./types.js").BackgroundJobReplacementResult>} - Replacement result.
|
|
83
|
+
*/
|
|
84
|
+
async replaceScheduled(args) {
|
|
85
|
+
await this.ensureReady()
|
|
86
|
+
this.registry.resolve(args.jobName)
|
|
87
|
+
return await this.store.replaceScheduled(args)
|
|
88
|
+
}
|
|
75
89
|
|
|
76
90
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @param {
|
|
79
|
-
* @
|
|
91
|
+
* Reads stable ownership and optional terminal history.
|
|
92
|
+
* @param {string} scheduleKey - Stable schedule key.
|
|
93
|
+
* @param {{includeLatestTerminal?: boolean}} [options] - Lookup options.
|
|
94
|
+
* @returns {Promise<import("./types.js").BackgroundJobScheduledLookupResult>} - Normalized local jobs.
|
|
80
95
|
*/
|
|
81
|
-
async
|
|
96
|
+
async getScheduledJob(scheduleKey, options) {
|
|
97
|
+
await this.ensureReady()
|
|
98
|
+
return await this.store.getScheduledJob(scheduleKey, options)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Makes a future queued stable owner due without replacing it.
|
|
103
|
+
* @param {string} scheduleKey - Stable schedule key.
|
|
104
|
+
* @returns {Promise<import("./types.js").BackgroundJobWakeResult>} - Exact wake result.
|
|
105
|
+
*/
|
|
106
|
+
async wakeScheduled(scheduleKey) {
|
|
107
|
+
await this.ensureReady()
|
|
108
|
+
return await this.store.wakeScheduled(scheduleKey)
|
|
109
|
+
}
|
|
82
110
|
|
|
83
111
|
/**
|
|
84
112
|
* Finds the next eligible local job.
|