@keetanetwork/anchor 0.0.37 → 0.0.38

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.
@@ -289,6 +289,7 @@ export declare abstract class KeetaAnchorQueueRunner<UserRequest = unknown, User
289
289
  * Checks to see if the queue is runnable
290
290
  */
291
291
  runnable(): Promise<boolean>;
292
+ private updateRunnerLockTimestamp;
292
293
  private getRunnerLock;
293
294
  private maintainRunnerLock;
294
295
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/queue/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAU9D,MAAM,MAAM,uBAAuB,CAAC,YAAY,IAAI,YAAY,CAAC;AACjE,MAAM,MAAM,yBAAyB,GAAG,aAAa,CAAC,oBAAoB,CAAC,CAAC;AAC5E,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;AAEjF,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,oBAAoB,GAAG,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AACxK,MAAM,MAAM,qBAAqB,CAAC,YAAY,EAAE,WAAW,IAAI;IAC9D;;OAEG;IACH,EAAE,EAAE,yBAAyB,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC,yBAAyB,CAAC,GAAG,SAAS,CAAC;IAC5D,OAAO,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,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SAAS,gBAAgB,GAAG,gBAAgB,EAAE,UAAU,SAAS,gBAAgB,GAAG,gBAAgB,CAAE,SAAQ,0BAA0B,CAAC,WAAW,EAAE,UAAU,CAAC;IAC7N,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;gBAE/E,MAAM,EAAE,qBAAqB,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG;QAC7E,SAAS,EAAE,sBAAsB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC;QACxE,cAAc,CAAC,EAAE,sBAAsB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;QAC/F,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC;KACnG;CAUD"}
@@ -379,6 +379,21 @@ export class KeetaAnchorQueueRunner {
379
379
  }
380
380
  return (false);
381
381
  }
382
+ async updateRunnerLockTimestamp() {
383
+ const logger = this.methodLogger('updateRunnerLockTimestamp');
384
+ try {
385
+ logger?.debug('Updating sequential processing lock timestamp for worker ID', this.workerID);
386
+ await this.queue.setStatus(this.runnerLockKey, 'processing', {
387
+ oldStatus: 'processing',
388
+ by: this.workerID
389
+ });
390
+ logger?.debug('Updated sequential processing lock timestamp for worker ID', this.workerID);
391
+ }
392
+ catch (error) {
393
+ logger?.error('Failed to update sequential processing lock timestamp for worker ID', this.workerID, ':', error);
394
+ throw (error);
395
+ }
396
+ }
382
397
  async getRunnerLock(cleanup) {
383
398
  const logger = this.methodLogger('getRunnerLock');
384
399
  try {
@@ -484,6 +499,7 @@ export class KeetaAnchorQueueRunner {
484
499
  return (processJobTimeout);
485
500
  }
486
501
  }
502
+ await this.updateRunnerLockTimestamp();
487
503
  let setEntryStatus = { status: 'failed_temporarily', output: null };
488
504
  logger?.debug(`Processing entry request with id ${String(entry.id)}`);
489
505
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/queue/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAwLzD;;GAEG;AACH,MAAM,OAAO,mCAAmC;IACrC,YAAY,GAA4E,EAAE,CAAC;IAClF,MAAM,CAAsB;IACrC,gBAAgB,GAAG,CAAC,CAAC;IACvB,SAAS,GAAG,KAAK,CAAC;IACjB,IAAI,GAAW,qCAAqC,CAAC;IACrD,EAAE,CAAS;IACX,IAAI,GAAa,EAAE,CAAC;IAE7B,YAAY,OAAwC;QACnD,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/E,CAAC;IAES,KAAK,CAAC,OAAiD;QAChE,MAAM,MAAM,GAAG,IAAI,mCAAmC,CAA4B;YACjF,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,gBAAgB,EAAE,EAAE;YAC5C,IAAI,EAAE,CAAC,GAAG,I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C,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC7C,CAAC;QACD,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC7B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { BrandedString, Brand } from '../utils/brand.ts';\nimport type { Logger } from '../log/index.ts';\nimport type { JSONSerializable } from '../utils/json.ts';\nimport type { AssertNever } from '../utils/never.ts';\nimport type { KeetaAnchorQueueRunOptions } from './common.js';\nimport { asleep } from '../utils/asleep.js';\nimport { Errors } from './common.js';\nimport {\n\tMethodLogger,\n\tManageStatusUpdates,\n\tConvertStringToRequestID\n} from './internal.js';\nimport { AsyncDisposableStack } from '../utils/defer.js';\n\nexport type KeetaAnchorQueueRequest<QueueRequest> = QueueRequest;\nexport type KeetaAnchorQueueRequestID = BrandedString<'KeetaAnchorQueueID'>;\nexport type KeetaAnchorQueueWorkerID = Brand<number, 'KeetaAnchorQueueWorkerID'>;\n\nexport type KeetaAnchorQueueStatus = 'pending' | 'processing' | 'completed' | 'failed_temporarily' | 'failed_permanently' | 'stuck' | 'aborted' | 'moved' | '@internal';\nexport type KeetaAnchorQueueEntry<QueueRequest, QueueResult> = {\n\t/**\n\t * The Job ID\n\t */\n\tid: KeetaAnchorQueueRequestID;\n\t/**\n\t * Idempotent IDs from a previous stage\n\t */\n\tidempotentKeys?: Set<KeetaAnchorQueueRequestID> | undefined;\n\trequest: KeetaAnchorQueueRequest<QueueRequest>;\n\toutput: QueueResult | null;\n\tlastError: string | null;\n\tstatus: KeetaAnchorQueueStatus;\n\tcreated: Date;\n\tupdated: Date;\n\tworker: KeetaAnchorQueueWorkerID | null;\n\tfailures: number;\n};\n\n/**\n * Extra information to provide to a request when adding an entry to the queue\n */\nexport type KeetaAnchorQueueEntryExtra = {\n\t[key in 'idempotentKeys' | 'id' | 'status']?: (key extends 'id' ? KeetaAnchorQueueRequestID | string : KeetaAnchorQueueEntry<never, never>[key]) | undefined;\n};\n\nexport type KeetaAnchorQueueFilter = {\n\t/**\n\t * Only return entries with this status\n\t */\n\tstatus?: KeetaAnchorQueueStatus;\n\t/**\n\t * Only return entries last updated before this date\n\t */\n\tupdatedBefore?: Date;\n\t/**\n\t * Limit the number of entries returned\n\t */\n\tlimit?: number;\n};\n\nexport type KeetaAnchorQueueCommonOptions = {\n\tlogger?: Logger | undefined;\n\tid?: string | undefined;\n};\n\nexport type KeetaAnchorQueueRunnerOptions = KeetaAnchorQueueCommonOptions & {\n\t/**\n\t * If specified, then multiple workers can be used to process this queue\n\t * in parallel by splitting the work among the workers.\n\t *\n\t * By default, only a single worker will process the queue (count=1, id=0)\n\t */\n\tworkers?: {\n\t\tcount: number;\n\t\tid: number;\n\t} | undefined;\n};\n\nexport type KeetaAnchorQueueStorageOptions = KeetaAnchorQueueCommonOptions & {\n\tpath?: string[] | undefined;\n};\n\nexport type KeetaAnchorQueueEntryAncillaryData<QueueResult> = {\n\t/**\n\t * The previous status of the entry -- if the entry is not currently in this status,\n\t * the status update will fail\n\t */\n\toldStatus?: KeetaAnchorQueueStatus | undefined;\n\t/**\n\t * The worker ID performing the status update\n\t */\n\tby?: KeetaAnchorQueueWorkerID | undefined;\n\t/**\n\t * The output data to store with the entry\n\t */\n\toutput?: QueueResult | null | undefined;\n\t/**\n\t * An error message to store with the entry\n\t */\n\terror?: string | undefined;\n};\n\nexport type KeetaAnchorQueueStorageDriverConstructor<QueueRequest extends JSONSerializable, QueueResult extends JSONSerializable> = new(options?: KeetaAnchorQueueStorageOptions) => KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>;\n\nexport interface KeetaAnchorQueueStorageDriver<QueueRequest extends JSONSerializable, QueueResult extends JSONSerializable> {\n\t/**\n\t * An ID for this instance of the storage driver\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The name of the storage driver\n\t */\n\treadonly name: string;\n\n\t/**\n\t * The partition ID for this instance of the storage driver\n\t *\n\t * This is used to divide a single storage backend into multiple\n\t * independent queues.\n\t *\n\t * The root partition is an empty array, and each element is\n\t * a hierarchical partition name.\n\t */\n\treadonly path: string[];\n\n\t/**\n\t * Enqueue an item to be processed by the queue\n\t *\n\t * It will be inserted into the queue as a 'pending' entry\n\t *\n\t * @param request The request to enqueue\n\t * @param id Optional ID to use for the entry -- if not provided, a new\n\t * ID will be generated. If the ID is already in use then\n\t * nothing will be added.\n\t * @returns The ID for the newly created pending entry\n\t */\n\tadd: (request: KeetaAnchorQueueRequest<QueueRequest>, info?: KeetaAnchorQueueEntryExtra) => Promise<KeetaAnchorQueueRequestID>;\n\n\t/**\n\t * Update the status of an entry in the queue\n\t *\n\t * If the status is \"failed_temporarily\", the failure count will be incremented\n\t *\n\t * @param id The entry ID to update\n\t * @param status The new status of the entry\n\t * @param ancillary Optional ancillary data for the status update\n\t * @returns void\n\t */\n\tsetStatus: (id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<QueueResult>) => Promise<void>;\n\n\t/**\n\t * Get entries from storage with an optional filter\n\t *\n\t * @param filter The filter to apply (optional)\n\t * @returns An array of entries matching the criteria\n\t */\n\tquery(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult>[]>;\n\n\t/**\n\t * Get a single entry from storage by ID\n\t *\n\t * @param id The ID of the entry to retrieve\n\t * @returns The entry if found, or null if not found\n\t */\n\tget(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult> | null>;\n\n\t/**\n\t * Perform maintenance tasks on the storage driver\n\t * (e.g. cleaning up old entries, etc)\n\t *\n\t * @returns void\n\t */\n\tmaintain?: () => Promise<void>;\n\n\t/**\n\t * Create a partitioned view of the queue\n\t *\n\t * @param partitionID The partition ID to use\n\t * @returns A new storage driver instance for the partition\n\t */\n\tpartition: (path: string) => Promise<KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>>;\n\n\t/**\n\t * Close the storage driver and release any resources\n\t */\n\tdestroy(): Promise<void>;\n\t[Symbol.asyncDispose](): Promise<void>;\n\n\t/** @internal */\n\t_Testing?: (key: string) => {\n\t\tsetToctouDelay?(delay: number): void;\n\t\tunsetToctouDelay?(): void;\n\t};\n}\n\n/**\n * An in-memory implementation of the KeetaAnchorQueueStorageDriver\n */\nexport class KeetaAnchorQueueStorageDriverMemory<QueueRequest extends JSONSerializable = JSONSerializable, QueueResult extends JSONSerializable = JSONSerializable> implements KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult> {\n\tprotected queueStorage: { [path: string]: KeetaAnchorQueueEntry<QueueRequest, QueueResult>[]; } = {};\n\tprotected readonly logger?: Logger | undefined;\n\tprotected partitionCounter = 0;\n\tprivate destroyed = false;\n\treadonly name: string = 'KeetaAnchorQueueStorageDriverMemory';\n\treadonly id: string;\n\treadonly path: string[] = [];\n\n\tconstructor(options?: KeetaAnchorQueueStorageOptions) {\n\t\tthis.id = options?.id ?? crypto.randomUUID();\n\t\tthis.logger = options?.logger;\n\t\tthis.path.push(...(options?.path ?? []));\n\t\tObject.freeze(this.path);\n\n\t\tthis.methodLogger('new')?.debug('Created new in-memory queue storage driver');\n\t}\n\n\tprotected clone(options?: Partial<KeetaAnchorQueueStorageOptions>): KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult> {\n\t\tconst cloned = new KeetaAnchorQueueStorageDriverMemory<QueueRequest, QueueResult>({\n\t\t\tlogger: this.logger,\n\t\t\tid: `${this.id}::${this.partitionCounter++}`,\n\t\t\tpath: [...this.path],\n\t\t\t...options\n\t\t});\n\t\tcloned.queueStorage = this.queueStorage;\n\n\t\treturn(cloned);\n\t}\n\n\tprotected get queue(): KeetaAnchorQueueEntry<QueueRequest, QueueResult>[] {\n\t\tconst pathKey = ['root', ...this.path].join('.');\n\t\tlet retval = this.queueStorage[pathKey];\n\t\tif (retval === undefined) {\n\t\t\tretval = this.queueStorage[pathKey] = [];\n\t\t}\n\t\treturn(retval);\n\t}\n\n\tprotected methodLogger(method: string): Logger | undefined {\n\t\treturn(MethodLogger(this.logger, {\n\t\t\tclass: 'KeetaAnchorQueueStorageDriverMemory',\n\t\t\tfile: 'src/lib/queue/index.ts',\n\t\t\tmethod: method,\n\t\t\tinstanceID: this.id\n\t\t}));\n\t}\n\n\tprivate checkDestroyed(): void {\n\t\tif (this.destroyed) {\n\t\t\tthrow(new Error('Queue has been destroyed'));\n\t\t}\n\t}\n\n\tasync add(request: KeetaAnchorQueueRequest<QueueRequest>, info?: KeetaAnchorQueueEntryExtra): Promise<KeetaAnchorQueueRequestID> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('add');\n\n\t\tlet id = ConvertStringToRequestID(info?.id);\n\t\tif (id) {\n\t\t\tconst duplicateID = this.queue.some(function(checkEntry) {\n\t\t\t\treturn(checkEntry.id === id);\n\t\t\t});\n\n\t\t\tif (duplicateID) {\n\t\t\t\tlogger?.debug(`Request with id ${String(id)} already exists, ignoring`);\n\n\t\t\t\treturn(id);\n\t\t\t}\n\t\t}\n\n\t\tconst idempotentIDs = info?.idempotentKeys;\n\t\tif (idempotentIDs) {\n\t\t\tconst matchingIdempotentEntries = new Set<KeetaAnchorQueueRequestID>();\n\t\t\tfor (const idempotentID of idempotentIDs) {\n\t\t\t\tconst idempotentEntryExists = this.queue.some(function(checkEntry) {\n\t\t\t\t\treturn(checkEntry.idempotentKeys?.has(idempotentID) ?? false);\n\t\t\t\t});\n\n\t\t\t\tif (idempotentEntryExists) {\n\t\t\t\t\tmatchingIdempotentEntries.add(idempotentID);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (matchingIdempotentEntries.size !== 0) {\n\t\t\t\tthrow(new Errors.IdempotentExistsError('One or more idempotent entries already exist in the queue', matchingIdempotentEntries));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * The status to use for the new entry\n\t\t */\n\t\tconst status = info?.status ?? 'pending';\n\n\t\t/*\n\t\t * The ID is a branded string, so we must convert the generated UUID\n\t\t */\n\t\tid ??= ConvertStringToRequestID(crypto.randomUUID());\n\n\t\tlogger?.debug(`Enqueuing request with id ${String(id)}`);\n\n\t\tthis.queue.push({\n\t\t\tid: id,\n\t\t\trequest: request,\n\t\t\toutput: null,\n\t\t\tlastError: null,\n\t\t\tstatus: status,\n\t\t\tfailures: 0,\n\t\t\tcreated: new Date(),\n\t\t\tupdated: new Date(),\n\t\t\tworker: null,\n\t\t\tidempotentKeys: idempotentIDs ? new Set(idempotentIDs) : undefined\n\t\t});\n\n\t\treturn(id);\n\t}\n\n\tasync setStatus(id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<QueueResult>): Promise<void> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('setStatus');\n\n\t\tconst entry = this.queue.find(function(checkEntry) {\n\t\t\treturn(checkEntry.id === id);\n\t\t});\n\t\tif (!entry) {\n\t\t\tthrow(new Error(`Request with ID ${String(id)} not found`));\n\t\t}\n\n\t\tconst changedFields = ManageStatusUpdates<QueueResult>(id, entry, status, ancillary, logger);\n\n\t\tObject.assign(entry, changedFields);\n\t}\n\n\tasync get(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult> | null> {\n\t\tthis.checkDestroyed();\n\n\t\tconst entry = this.queue.find(function(checkEntry) {\n\t\t\treturn(checkEntry.id === id);\n\t\t});\n\n\t\tif (!entry) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(structuredClone(entry));\n\t}\n\n\tasync query(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult>[]> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('query');\n\n\t\tconst queueDuplicate = structuredClone(this.queue);\n\n\t\tlogger?.debug(`Querying queue with id ${this.id} with filter:`, filter);\n\n\t\tconst allEntriesInStatus = (function() {\n\t\t\tconst filterStatus = filter?.status;\n\t\t\tconst filterLastUpdateBefore = filter?.updatedBefore;\n\t\t\tif (filterStatus || filterLastUpdateBefore) {\n\t\t\t\treturn(queueDuplicate.filter(function(entry) {\n\t\t\t\t\tif (filterStatus) {\n\t\t\t\t\t\tif (entry.status !== filterStatus) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (filterLastUpdateBefore) {\n\t\t\t\t\t\tif (entry.updated >= filterLastUpdateBefore) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn(true);\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\treturn(queueDuplicate);\n\t\t\t}\n\t\t})();\n\n\t\tlet retval = allEntriesInStatus;\n\t\tif (filter?.limit !== undefined) {\n\t\t\tretval = allEntriesInStatus.slice(0, filter.limit);\n\t\t}\n\n\t\tlogger?.debug(`Queried queue with id ${this.id} with filter:`, filter, '-- found', retval.length, 'entries');\n\n\t\treturn(retval);\n\t}\n\n\tasync partition(path: string): Promise<KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('partition');\n\n\t\tlogger?.debug(`Creating partitioned queue storage driver for path \"${path}\"`);\n\n\t\tconst partitioned = this.clone({\n\t\t\tpath: [...this.path, path]\n\t\t});\n\n\t\treturn(partitioned);\n\t}\n\n\tasync destroy(): Promise<void> {\n\t\tthis.destroyed = true;\n\t\tthis.methodLogger('destroy')?.debug('Destroying in-memory queue');\n\t}\n\n\tasync [Symbol.asyncDispose](): Promise<void> {\n\t\treturn(await this.destroy());\n\t}\n}\n\n/**\n * A Queue Runner and Request Translator for processing entries in a queue\n *\n * The queue runner is responsible for pulling entries from the queue,\n * processing them, and updating their status in the queue. As well\n * as moving jobs between queues by piping the output of one runner\n * to another. Additionally, maintenance tasks such as re-queuing\n * failed jobs and marking stuck jobs are also handled by the runner.\n *\n * This is an abstract base class that must be extended to provide\n * the actual processing logic as well as the encoding and decoding\n * for requests and responses.\n */\nexport abstract class KeetaAnchorQueueRunner<UserRequest = unknown, UserResult = unknown, QueueRequest extends JSONSerializable = JSONSerializable, QueueResult extends JSONSerializable = JSONSerializable> {\n\t/**\n\t * The queue this runner is responsible for running\n\t */\n\tprivate readonly queue: KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>;\n\t/**\n\t * The logger we should use for logging anything\n\t */\n\tprivate readonly logger?: Logger | undefined;\n\t/**\n\t * The processor function to use for processing entries\n\t */\n\tprotected abstract processor(entry: KeetaAnchorQueueEntry<UserRequest, UserResult>): Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>;\n\n\t/**\n\t * The processor for stuck jobs (optional)\n\t */\n\tprotected processorStuck?(entry: KeetaAnchorQueueEntry<UserRequest, UserResult>): Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>;\n\n\t/**\n\t * The processor for aborted jobs (optional)\n\t */\n\tprotected processorAborted?(entry: KeetaAnchorQueueEntry<UserRequest, UserResult>): Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>;\n\n\t/**\n\t * Worker configuration\n\t */\n\tprivate readonly workers: NonNullable<KeetaAnchorQueueRunnerOptions['workers']>;\n\tprivate readonly workerID: KeetaAnchorQueueWorkerID;\n\n\t/**\n\t * Pipes to other runners we have registered\n\t */\n\tprivate readonly pipes: ({\n\t\tisBatchPipe: false;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\ttarget: KeetaAnchorQueueRunner<UserResult, any, QueueResult, any>\n\t} | {\n\t\tisBatchPipe: true;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\ttarget: KeetaAnchorQueueRunner<UserResult[], any, JSONSerializable, any>;\n\t\tminBatchSize: number;\n\t\tmaxBatchSize: number;\n\t})[] = [];\n\n\t/**\n\t * Initialization promise\n\t */\n\tprivate initializePromise: Promise<void> | undefined;\n\n\t/**\n\t * Configuration for this queue\n\t */\n\tprotected maxRetries = 5;\n\tprotected processTimeout = 300_000; /* 5 minutes */\n\tprotected batchSize = 100;\n\n\t/**\n\t * How many runners can process this queue in parallel\n\t */\n\tprotected maxRunners?: number;\n\tprivate readonly runnerLockKey: KeetaAnchorQueueRequestID;\n\n\t/**\n\t * The ID of this runner for diagnostic purposes\n\t */\n\treadonly id: string;\n\n\tconstructor(config: { queue: KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>; } & KeetaAnchorQueueRunnerOptions) {\n\t\tthis.queue = config.queue;\n\t\tthis.logger = config.logger;\n\t\tthis.workers = config.workers ?? {\n\t\t\tcount: 1,\n\t\t\tid: 0\n\t\t};\n\n\t\tif (this.workers.id < 0) {\n\t\t\tthrow(new Error('Worker ID cannot be negative'));\n\t\t}\n\n\t\tif (this.maxRunners) {\n\t\t\tif (this.workers.id > this.maxRunners - 1 || this.workers.count > this.maxRunners) {\n\t\t\t\tthrow(new Error('Worker ID other than 0 or worker count other than 1 is not supported yet'));\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * The worker ID is just a branded version of the worker number\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.workerID = this.workers.id as KeetaAnchorQueueWorkerID;\n\n\t\t/*\n\t\t * The runner lock key, a unique key used to ensure only\n\t\t * one instance of a given runner is running at a time\n\t\t */\n\t\tthis.runnerLockKey = ConvertStringToRequestID(`@runner-lock:9ba756f0-7aa2-41c7-a1ea-b010dc752ae8.worker.${this.workerID}`);\n\n\t\t/**\n\t\t * Instance ID\n\t\t */\n\t\tthis.id = config.id ?? crypto.randomUUID();\n\n\t\tthis.methodLogger('new')?.debug('Created new queue runner attached to queue', this.queue.id);\n\t}\n\n\tprivate async initialize(): Promise<void> {\n\t\tif (this.initializePromise) {\n\t\t\treturn(await this.initializePromise);\n\t\t}\n\n\t\t/* Ensure the sequential lock entry exists */\n\t\tthis.initializePromise = (async () => {\n\t\t\t/*\n\t\t\t * We store `null` as the request value because we\n\t\t\t * don't have anything better to store -- it's not\n\t\t\t * always going to be compatible with the type\n\t\t\t * QueueRequest but we know that we will never actually\n\t\t\t * use the value.\n\t\t\t */\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tawait this.queue.add(null as unknown as QueueRequest, {\n\t\t\t\tid: this.runnerLockKey,\n\t\t\t\tstatus: '@internal'\n\t\t\t});\n\t\t})();\n\n\t\treturn(await this.initializePromise);\n\t}\n\n\tprivate methodLogger(method: string): Logger | undefined {\n\t\treturn(MethodLogger(this.logger, {\n\t\t\tclass: 'KeetaAnchorQueueRunner',\n\t\t\tfile: 'src/lib/queue/index.ts',\n\t\t\tmethod: method,\n\t\t\tinstanceID: this.id\n\t\t}));\n\t}\n\n\t/** @internal */\n\t_Testing(key: string): {\n\t\tsetParams: (maxBatchSize: number, processTimeout: number, maxRetries: number, maxWorkers?: number) => void;\n\t\tqueue: () => KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>;\n\t\tmarkWorkerAsProcessing: () => Promise<void>;\n\t} {\n\t\tif (key !== 'bc81abf8-e43b-490b-b486-744fb49a5082') {\n\t\t\tthrow(new Error('This is a testing only method'));\n\t\t}\n\n\t\treturn({\n\t\t\tsetParams: (maxBatchSize: number, processTimeout: number, maxRetries: number, maxWorkers?: number) => {\n\t\t\t\tthis.batchSize = maxBatchSize;\n\t\t\t\tthis.processTimeout = processTimeout;\n\t\t\t\tthis.maxRetries = maxRetries;\n\t\t\t\tif (maxWorkers !== undefined) {\n\t\t\t\t\tthis.maxRunners = maxWorkers;\n\t\t\t\t}\n\t\t\t},\n\t\t\tqueue: () => {\n\t\t\t\treturn(this.queue);\n\t\t\t},\n\t\t\tmarkWorkerAsProcessing: async () => {\n\t\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\t\toldStatus: '@internal',\n\t\t\t\t\tby: this.workerID\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected abstract decodeRequest(request: QueueRequest): UserRequest;\n\tprotected abstract decodeResponse(response: QueueResult | null): UserResult | null;\n\n\tprotected abstract encodeRequest(request: UserRequest): QueueRequest;\n\tprotected abstract encodeResponse(response: UserResult | null): QueueResult | null;\n\n\tprotected decodeEntry(entry: KeetaAnchorQueueEntry<QueueRequest, QueueResult>): KeetaAnchorQueueEntry<UserRequest, UserResult> {\n\t\treturn({\n\t\t\t...entry,\n\t\t\trequest: this.decodeRequest(entry.request),\n\t\t\toutput: this.decodeResponse(entry.output)\n\t\t});\n\t}\n\n\t/**\n\t * Enqueue an item to be processed by the queue\n\t */\n\tasync add(request: UserRequest, info?: KeetaAnchorQueueEntryExtra): Promise<KeetaAnchorQueueRequestID> {\n\t\tawait this.initialize();\n\n\t\tconst encodedRequest = this.encodeRequest(request);\n\t\tconst newID = await this.queue.add(encodedRequest, info);\n\t\treturn(newID);\n\t}\n\n\t/**\n\t * Get a single entry from storage by ID\n\t */\n\tasync get(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<UserRequest, UserResult> | null> {\n\t\tawait this.initialize();\n\n\t\tconst entry = await this.queue.get(id);\n\t\tif (!entry) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(this.decodeEntry(entry));\n\t}\n\n\t/**\n\t * Get entries from storage with an optional filter\n\t */\n\tasync query(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<UserRequest, UserResult>[]> {\n\t\tawait this.initialize();\n\n\t\tconst entries = await this.queue.query(filter);\n\t\treturn(entries.map((entry) => {\n\t\t\treturn(this.decodeEntry(entry));\n\t\t}));\n\t}\n\n\t/**\n\t * Set the status of an entry in the queue\n\t */\n\tasync setStatus(id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<UserResult>): Promise<void> {\n\t\tawait this.initialize();\n\n\t\tlet encodedOutput: QueueResult | null | undefined = undefined;\n\t\tif (ancillary?.output !== undefined) {\n\t\t\tencodedOutput = this.encodeResponse(ancillary.output);\n\t\t}\n\n\t\treturn(await this.queue.setStatus(id, status, {\n\t\t\t...ancillary,\n\t\t\toutput: encodedOutput\n\t\t}));\n\t}\n\n\t/**\n\t * Checks to see if the queue is runnable\n\t */\n\tasync runnable(): Promise<boolean> {\n\t\tawait this.initialize();\n\n\t\tconst pendingEntries = await this.queue.query({ status: 'pending', limit: 1 });\n\t\tif (pendingEntries.length > 0) {\n\t\t\treturn(true);\n\t\t}\n\n\t\tfor (const pipe of this.pipes) {\n\t\t\tconst pipeRunnable = await pipe.target.runnable();\n\t\t\tif (pipeRunnable) {\n\t\t\t\treturn(true);\n\t\t\t}\n\t\t}\n\n\t\treturn(false);\n\t}\n\n\tprivate async getRunnerLock(cleanup: InstanceType<typeof AsyncDisposableStack>): Promise<boolean> {\n\t\tconst logger = this.methodLogger('getRunnerLock');\n\n\t\ttry {\n\t\t\tlogger?.debug('Acquiring sequential processing lock for worker ID', this.workerID);\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\toldStatus: '@internal',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t\tlogger?.debug('Acquired sequential processing lock for worker ID', this.workerID);\n\t\t} catch (error: unknown) {\n\t\t\tif (Errors.IncorrectStateAssertedError.isInstance(error)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\n\t\t\tthrow(error);\n\t\t}\n\n\t\tcleanup.defer(async () => {\n\t\t\tfor (let retry = 0; retry < 10; retry++) {\n\t\t\t\tlogger?.debug(`Releasing sequential processing lock try #${retry + 1} for worker ID`, this.workerID);\n\t\t\t\ttry {\n\t\t\t\t\tawait this.queue.setStatus(this.runnerLockKey, '@internal', {\n\t\t\t\t\t\toldStatus: 'processing',\n\t\t\t\t\t\tby: undefined\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\tawait asleep(1000);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\n\t\treturn(true);\n\t}\n\n\tprivate async maintainRunnerLock(): Promise<void> {\n\t\tconst logger = this.methodLogger('maintainRunnerLock');\n\t\tconst moment = new Date();\n\t\tawait using cleanup = new AsyncDisposableStack();\n\n\t\tconst obtained = await this.getRunnerLock(cleanup);\n\t\tif (obtained) {\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * Check to see if the lock is stale\n\t\t */\n\t\tconst lockEntry = await this.queue.get(this.runnerLockKey);\n\n\t\tif (!lockEntry) {\n\t\t\treturn;\n\t\t}\n\t\tconst lockAge = moment.getTime() - lockEntry.updated.getTime();\n\t\tif (lockAge > this.processTimeout * 10) {\n\t\t\tlogger?.warn('Processing lock is stale, taking over lock for worker ID', this.workerID);\n\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, '@internal', {\n\t\t\t\toldStatus: 'processing',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Run the queue processor\n\t *\n\t * Processes up to `batchSize` entries from the queue and returns\n\t * true if there may be more work to do, or false if the queue\n\t * is empty.\n\t *\n\t * @param options Optional run options\n\t */\n\tasync run(options?: KeetaAnchorQueueRunOptions): Promise<boolean> {\n\t\tconst timeout = options?.timeoutMs;\n\n\t\tawait this.initialize();\n\n\t\tconst logger = this.methodLogger('run');\n\t\tconst batchSize = this.batchSize;\n\t\tconst processTimeout = this.processTimeout;\n\t\tawait using cleanup = new AsyncDisposableStack();\n\n\t\tlet retval = true;\n\n\t\tconst startTime = Date.now();\n\n\t\tconst locked = await this.getRunnerLock(cleanup);\n\t\tif (!locked) {\n\t\t\tlogger?.debug('Another worker is already processing the queue, skipping run');\n\n\t\t\treturn(true);\n\t\t}\n\n\t\tconst processJobOk = Symbol('processJobOk');\n\t\tconst processJobTimeout = Symbol('processJobTimeout');\n\n\t\tconst processJob = async (index: number, entry: KeetaAnchorQueueEntry<QueueRequest, QueueResult>, startingStatus: KeetaAnchorQueueStatus, processor: (entry: KeetaAnchorQueueEntry<UserRequest, UserResult>) => Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>): Promise<typeof processJobTimeout | typeof processJobOk> => {\n\t\t\tif (timeout !== undefined) {\n\t\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\tlogger?.debug(`Timeout of ${timeout}ms reached after processing ${index} entries (${startingStatus} phase; elapsed ${elapsed}ms)`);\n\n\t\t\t\t\treturn(processJobTimeout);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet setEntryStatus: { status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; } = { status: 'failed_temporarily', output: null };\n\n\t\t\tlogger?.debug(`Processing entry request with id ${String(entry.id)}`);\n\n\t\t\ttry {\n\t\t\t\t/*\n\t\t\t\t * Get a lock by setting it to 'processing'\n\t\t\t\t */\n\t\t\t\tawait this.queue.setStatus(entry.id, 'processing', { oldStatus: startingStatus, by: this.workerID });\n\n\t\t\t\t/*\n\t\t\t\t * Process the entry with a timeout, if the timeout is reached\n\t\t\t\t * we should mark the process as aborted because we no longer\n\t\t\t\t * know what state the work is in and someone will need to\n\t\t\t\t * inspect the job and determine through some other means if\n\t\t\t\t * it is completed or failed.\n\t\t\t\t */\n\t\t\t\tlet timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n\t\t\t\tsetEntryStatus = await Promise.race([\n\t\t\t\t\tnew Promise<{ status: 'aborted', output: null }>(function(resolve) {\n\t\t\t\t\t\ttimeoutTimer = setTimeout(function() {\n\t\t\t\t\t\t\tresolve({ status: 'aborted', output: null });\n\t\t\t\t\t\t}, processTimeout);\n\t\t\t\t\t}),\n\t\t\t\t\t(async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn(await processor(this.decodeEntry(entry)));\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (timeoutTimer) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutTimer);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})()\n\t\t\t\t]);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (Errors.IncorrectStateAssertedError.isInstance(error)) {\n\t\t\t\t\tlogger?.info(`Skipping request with id ${String(entry.id)} because it is no longer in the expected state \"${startingStatus}\"`, error);\n\n\t\t\t\t\treturn(processJobOk);\n\t\t\t\t}\n\n\t\t\t\tlogger?.error(`Failed to process request with id ${String(entry.id)}, setting state to \"${setEntryStatus.status}\":`, error);\n\t\t\t\tsetEntryStatus.status = 'failed_temporarily';\n\t\t\t\tsetEntryStatus.error = String(error);\n\t\t\t}\n\n\t\t\tif (setEntryStatus.status === 'processing') {\n\t\t\t\tlogger?.error(`Processor for request with id ${String(entry.id)} returned invalid status \"processing\"`);\n\t\t\t\tsetEntryStatus.status = 'failed_temporarily';\n\t\t\t\tsetEntryStatus.error = 'Processor returned invalid status \"processing\"';\n\t\t\t}\n\n\t\t\tlet by: KeetaAnchorQueueWorkerID | undefined = this.workerID;\n\t\t\tif (setEntryStatus.status === 'pending') {\n\t\t\t\tby = undefined;\n\t\t\t}\n\n\t\t\tawait this.queue.setStatus(entry.id, setEntryStatus.status, { oldStatus: 'processing', by: by, output: this.encodeResponse(setEntryStatus.output), error: setEntryStatus.error });\n\n\t\t\treturn(processJobOk);\n\t\t};\n\n\t\t/*\n\t\t * Process pending jobs first\n\t\t */\n\t\tfor (let index = 0; index < batchSize; index++) {\n\t\t\tconst entries = await this.queue.query({ status: 'pending', limit: 1 });\n\t\t\tconst entry = entries[0];\n\t\t\tif (entry === undefined) {\n\t\t\t\tretval = false;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst result = await processJob(index, entry, 'pending', this.processor.bind(this));\n\t\t\tif (result === processJobTimeout) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Next process any pipes to other runners\n\t\t */\n\t\tconst pipes = [...this.pipes];\n\t\tfor (const pipe of pipes) {\n\t\t\tlet remainingTime: number | undefined = undefined;\n\t\t\tif (timeout !== undefined) {\n\t\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\t\tremainingTime = timeout - elapsed;\n\t\t\t\tif (remainingTime <= 0) {\n\t\t\t\t\tremainingTime = -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst pipeHasMoreWork = await pipe.target.run({\n\t\t\t\t...options,\n\t\t\t\ttimeoutMs: remainingTime\n\t\t\t});\n\n\t\t\tif (pipeHasMoreWork) {\n\t\t\t\tretval = true;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process stuck or aborted jobs (if possible)\n\t\t */\n\t\tconst conditions = [{\n\t\t\tstatus: 'aborted' as const,\n\t\t\tprocessor: this.processorAborted?.bind(this)\n\t\t}, {\n\t\t\tstatus: 'stuck' as const,\n\t\t\tprocessor: this.processorStuck?.bind(this)\n\t\t}];\n\n\t\tlet timeoutReached = false;\n\t\tfor (const condition of conditions) {\n\t\t\tif (condition.processor === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (let index = 0; index < batchSize; index++) {\n\t\t\t\tconst entries = await this.queue.query({ status: condition.status, limit: 1 });\n\t\t\t\tconst entry = entries[0];\n\t\t\t\tif (entry === undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst result = await processJob(index, entry, condition.status, condition.processor);\n\t\t\t\tif (result === processJobTimeout) {\n\t\t\t\t\ttimeoutReached = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (timeoutReached) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tprivate async markStuckRequestsAsStuck(): Promise<void> {\n\t\tconst stuckThreshold = this.processTimeout * 10;\n\n\t\tconst logger = this.methodLogger('markStuckRequestsAsStuck');\n\t\tconst now = Date.now();\n\n\t\tconst requests = await this.queue.query({ status: 'processing', limit: 100, updatedBefore: new Date(now - stuckThreshold) });\n\t\tfor (const request of requests) {\n\t\t\t/*\n\t\t\t * Skip the runner lock entries, they are managed separately\n\t\t\t */\n\t\t\tif (request.id.toString().startsWith('@runner-lock:9ba756f0-7aa2-41c7-a1ea-b010dc752ae8.worker.')) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tlogger?.warn(`Marking request with id ${String(request.id)} as stuck`);\n\n\t\t\t\tawait this.queue.setStatus(request.id, 'stuck', { oldStatus: 'processing', by: this.workerID });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.error(`Failed to mark request with id ${String(request.id)} as stuck:`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async requeueFailedRequests(): Promise<void> {\n\t\tconst retryDelay = this.processTimeout * 10;\n\t\tconst maxRetries = this.maxRetries;\n\n\t\tconst logger = this.methodLogger('requeueFailedRequests');\n\t\tconst now = Date.now();\n\n\t\tconst requests = await this.queue.query({ status: 'failed_temporarily', limit: 100, updatedBefore: new Date(now - retryDelay) });\n\t\tfor (const request of requests) {\n\t\t\ttry {\n\t\t\t\tif (request.failures >= maxRetries) {\n\t\t\t\t\tlogger?.info(`Request with id ${String(request.id)} has exceeded maximum retries, not requeuing -- moving to failed_permanently`);\n\t\t\t\t\tawait this.queue.setStatus(request.id, 'failed_permanently', { oldStatus: 'failed_temporarily', by: this.workerID });\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tlogger?.debug(`Requeuing failed request with id ${String(request.id)}`);\n\n\t\t\t\tawait this.queue.setStatus(request.id, 'pending', { oldStatus: 'failed_temporarily', by: this.workerID });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.error(`Failed to requeue request with id ${String(request.id)}:`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async moveCompletedToNextStage(): Promise<void> {\n\t\tconst logger = this.methodLogger('moveCompletedToNextStage');\n\n\t\tconst pipes = [...this.pipes];\n\t\tif (pipes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst allRequests = await this.queue.query({ status: 'completed', limit: 100 });\n\t\tlet requests = allRequests;\n\n\t\tconst RequestSentToPipes = new Map<KeetaAnchorQueueRequestID, number>();\n\t\tfunction IncrRequestSentToPipes(requestID: KeetaAnchorQueueRequestID): void {\n\t\t\tconst sentCount = RequestSentToPipes.get(requestID) ?? 0;\n\t\t\tRequestSentToPipes.set(requestID, sentCount + 1);\n\t\t}\n\n\n\t\tfor (const pipe of pipes) {\n\t\t\tlogger?.debug('Processing pipe to target', pipe.target.id, pipe.isBatchPipe ? '(batch pipe)' : '(single item pipe)');\n\n\t\t\tif (pipe.isBatchPipe) {\n\t\t\t\t/**\n\t\t\t\t * Keep track of all the requests we successfully\n\t\t\t\t * sent to the target stage\n\t\t\t\t */\n\t\t\t\tconst allTargetSeenRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * During each iteration of the batch processing, we keep track\n\t\t\t\t * of the IDs we have already seen by the target and processed\n\t\t\t\t * so we don't try to reprocess them again\n\t\t\t\t */\n\t\t\t\tconst iterationTargetSeenRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * If we get a batch that cannot be added to the target pipe,\n\t\t\t\t * we just skip over them for retrying at a later date\n\t\t\t\t */\n\t\t\t\tconst skipRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * Compute a durable ID for this batch and target\n\t\t\t\t */\n\t\t\t\tlet batchID = ConvertStringToRequestID(crypto.randomUUID());\n\n\t\t\t\t/**\n\t\t\t\t * Keep track of sequential failures to find enough entries\n\t\t\t\t * and stop processing if we can't find enough after a few tries\n\t\t\t\t * in a row\n\t\t\t\t */\n\t\t\t\tlet sequentialFailureCount = 0;\n\n\t\t\t\tfor (;requests.length >= pipe.minBatchSize;\n\t\t\t\t\t/*\n\t\t\t\t\t * Remove any entries we have already seen during\n\t\t\t\t\t * the last iteration of the loop\n\t\t\t\t\t */\n\t\t\t\t\trequests = requests.filter(function(entry) {\n\t\t\t\t\t\treturn(!iterationTargetSeenRequestIDs.has(entry.id) && !skipRequestIDs.has(entry.id));\n\t\t\t\t\t})\n\t\t\t\t) {\n\t\t\t\t\titerationTargetSeenRequestIDs.clear();\n\n\t\t\t\t\tlogger?.debug(`Preparing to move completed requests to next stage ${pipe.target.id} (min=${pipe.minBatchSize}, max=${pipe.maxBatchSize}), have ${requests.length} completed requests available`);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Compute a batch of entries to send to the next stage,\n\t\t\t\t\t * constrained to the max batch size of the pipe and\n\t\t\t\t\t * the entries which have non-null outputs\n\t\t\t\t\t */\n\t\t\t\t\tconst batchRaw = requests.map((entry) => {\n\t\t\t\t\t\treturn({ output: this.decodeResponse(entry.output), id: entry.id });\n\t\t\t\t\t}).filter(function(entry): entry is { output: UserResult; id: KeetaAnchorQueueRequestID; } {\n\t\t\t\t\t\tif (entry === null) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(true);\n\t\t\t\t\t}).slice(0, pipe.maxBatchSize);\n\n\t\t\t\t\t/*\n\t\t\t\t\t * If we don't have enough entries to meet the minimum\n\t\t\t\t\t * batch size, skip this iteration\n\t\t\t\t\t */\n\t\t\t\t\tif (batchRaw.length < pipe.minBatchSize) {\n\t\t\t\t\t\tsequentialFailureCount++;\n\t\t\t\t\t\tif (sequentialFailureCount >= 3) {\n\t\t\t\t\t\t\tlogger?.debug(`Not enough completed requests to move to next stage ${pipe.target.id}, stopping batch processing`);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogger?.debug(`Not moving completed requests to next stage ${pipe.target.id} because batch size ${batchRaw.length} is less than minimum size ${pipe.minBatchSize}`);\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tsequentialFailureCount = 0;\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The IDs for the entries we are sending to the next stage\n\t\t\t\t\t * target -- this may get reduced if we find there are already\n\t\t\t\t\t * jobs in the next stage that have the idempotentIDs of one of\n\t\t\t\t\t * these jobs\n\t\t\t\t\t */\n\t\t\t\t\tconst batchLocalIDs = new Set(batchRaw.map(function(entry) {\n\t\t\t\t\t\treturn(entry.id);\n\t\t\t\t\t}));\n\t\t\t\t\t/**\n\t\t\t\t\t * The outputs for the batch we are sending to the next stage\n\t\t\t\t\t */\n\t\t\t\t\tconst batchOutput = batchRaw.map(function(entry) {\n\t\t\t\t\t\treturn(entry.output);\n\t\t\t\t\t});\n\n\t\t\t\t\tlogger?.debug(`Moving batch of ${batchOutput.length} completed requests to next pipe`, pipe.target.id, '(input entry IDs:', Array.from(batchLocalIDs), '->', `${pipe.target.id}:${String(batchID)})`);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait pipe.target.add(batchOutput, {\n\t\t\t\t\t\t\tid: batchID,\n\t\t\t\t\t\t\t/* Use the set of IDs as the idempotent IDs for the batch */\n\t\t\t\t\t\t\tidempotentKeys: batchLocalIDs\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbatchID = ConvertStringToRequestID(crypto.randomUUID());\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tif (Errors.IdempotentExistsError.isInstance(error) && error.idempotentIDsFound) {\n\t\t\t\t\t\t\tlogger?.debug('Some of the jobs have already been added to the target queue, skipping those:', error.idempotentIDsFound.values());\n\t\t\t\t\t\t\tfor (const requestID of error.idempotentIDsFound) {\n\t\t\t\t\t\t\t\titerationTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\t\t\tallTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * If we got some kind of other error adding these\n\t\t\t\t\t\t\t * items to the target queue runner, just skip them\n\t\t\t\t\t\t\t * and we will retry them on the next iteration\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tlogger?.error(`Failed to move completed batch to next stage ${pipe.target.id}, will try to create another batch without them:`, error);\n\n\t\t\t\t\t\t\tfor (const requestID of batchLocalIDs) {\n\t\t\t\t\t\t\t\tskipRequestIDs.add(requestID);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const requestID of batchLocalIDs) {\n\t\t\t\t\t\titerationTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\tallTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * For every request we know the target has definitely seen, mark it\n\t\t\t\t * as moved for this pipe\n\t\t\t\t */\n\t\t\t\tfor (const requestID of allTargetSeenRequestIDs) {\n\t\t\t\t\tIncrRequestSentToPipes(requestID);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const request of requests) {\n\t\t\t\t\tlet shouldMarkAsMoved = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst output = this.decodeResponse(request.output);\n\t\t\t\t\t\tif (output === null) {\n\t\t\t\t\t\t\tlogger?.debug(`Completed request with id ${String(request.id)} has no output -- next stage will not be run`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlogger?.debug(`Moving completed request with id ${String(request.id)} to next pipe`, pipe.target.id);\n\t\t\t\t\t\t\tawait pipe.target.add(output, { id: request.id });\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tlogger?.error(`Failed to move completed request with id ${String(request.id)} to next stage:`, error);\n\t\t\t\t\t\tshouldMarkAsMoved = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (shouldMarkAsMoved) {\n\t\t\t\t\t\tIncrRequestSentToPipes(request.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst TotalPipes = pipes.length;\n\t\tfor (const request of allRequests) {\n\t\t\tconst sentCount = RequestSentToPipes.get(request.id) ?? 0;\n\t\t\tif (sentCount !== TotalPipes) {\n\t\t\t\tlogger?.debug(`Completed request with id ${String(request.id)} was only moved to ${sentCount} out of ${TotalPipes} pipes -- not marking as moved`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlogger?.debug(`Marking completed request with id ${String(request.id)} as moved`);\n\n\t\t\tawait this.queue.setStatus(request.id, 'moved', { oldStatus: 'completed', by: this.workerID });\n\t\t}\n\n\t}\n\n\tasync maintain(): Promise<void> {\n\t\tconst logger = this.methodLogger('maintain');\n\n\t\tawait this.initialize();\n\n\t\t/*\n\t\t * Each worker should maintain its own lock\n\t\t */\n\t\ttry {\n\t\t\tawait this.maintainRunnerLock();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to maintain runner lock:', error);\n\t\t}\n\n\t\tif (this.workers.id !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Only the worker with ID 0 should perform maintenance tasks on requests\n\t\t */\n\t\ttry {\n\t\t\tawait this.markStuckRequestsAsStuck();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to mark stuck requests as stuck:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.requeueFailedRequests();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to requeue failed requests:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.moveCompletedToNextStage();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to move completed requests to next stage:', error);\n\t\t}\n\n\t\tfor (const pipe of this.pipes) {\n\t\t\ttry {\n\t\t\t\tawait pipe.target.maintain();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.debug(`Failed to maintain piped runner with ID ${pipe.target.id}:`, error);\n\t\t\t}\n\t\t}\n\n\t\tif (this.queue.maintain) {\n\t\t\ttry {\n\t\t\t\tawait this.queue.maintain();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.debug(`Failed to maintain queue storage driver with ID ${this.queue.id}`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Pipe the the completed entries of this runner to another runner\n\t */\n\tpipe<T1, T2 extends JSONSerializable>(target: KeetaAnchorQueueRunner<UserResult, T1, QueueResult, T2>): typeof target {\n\t\tthis.pipes.push({\n\t\t\tisBatchPipe: false,\n\t\t\ttarget: target\n\t\t});\n\t\treturn(target);\n\t}\n\n\t/**\n\t * Pipe batches of completed entries from this runner to another runner\n\t */\n\tpipeBatch<T1, T2 extends JSONSerializable>(target: KeetaAnchorQueueRunner<UserResult[], T1, JSONSerializable, T2>, maxBatchSize = 100, minBatchSize = 1): typeof target {\n\t\tthis.pipes.push({\n\t\t\tisBatchPipe: true,\n\t\t\ttarget: target,\n\t\t\tminBatchSize: minBatchSize,\n\t\t\tmaxBatchSize: maxBatchSize\n\t\t});\n\t\treturn(target);\n\t}\n\n\tasync destroy(): Promise<void> {\n\t\tthis.methodLogger('destroy')?.debug('Destroying queue runner attached to queue', this.queue.id);\n\t}\n\n\tasync [Symbol.asyncDispose](): Promise<void> {\n\t\tawait this.destroy();\n\t}\n}\n\n/**\n * A KeetaAnchorQueueRunner for use when you want to process already\n * JSON-serializable data without any encoding/decoding needed\n */\nexport abstract class KeetaAnchorQueueRunnerJSON<UserRequest extends JSONSerializable = JSONSerializable, UserResult extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunner<UserRequest, UserResult, JSONSerializable, JSONSerializable> {\n\tprotected decodeRequest(request: JSONSerializable): UserRequest {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(request as UserRequest);\n\t}\n\n\tprotected decodeResponse(response: JSONSerializable | null): UserResult | null {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(response as UserResult | null);\n\t}\n\n\tprotected encodeRequest(request: JSONSerializable): JSONSerializable {\n\t\treturn(request);\n\t}\n\n\tprotected encodeResponse(response: JSONSerializable | null): JSONSerializable | null {\n\t\treturn(response);\n\t}\n}\n\n/**\n * A KeetaAnchorQueueRunnerJSON that takes a processor function\n * in the constructor -- this is mainly useful for testing\n */\nexport class KeetaAnchorQueueRunnerJSONConfigProc<UserRequest extends JSONSerializable = JSONSerializable, UserResult extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunnerJSON<UserRequest, UserResult> {\n\tprotected readonly processor: KeetaAnchorQueueRunner<UserRequest, UserResult>['processor'];\n\n\tconstructor(config: ConstructorParameters<typeof KeetaAnchorQueueRunner>[0] & {\n\t\tprocessor: KeetaAnchorQueueRunner<UserRequest, UserResult>['processor'];\n\t\tprocessorStuck?: KeetaAnchorQueueRunner<UserRequest, UserResult>['processorStuck'] | undefined;\n\t\tprocessorAborted?: KeetaAnchorQueueRunner<UserRequest, UserResult>['processorAborted'] | undefined;\n\t}) {\n\t\tsuper(config);\n\t\tthis.processor = config.processor;\n\t\tif (config.processorStuck) {\n\t\t\tthis.processorStuck = config.processorStuck;\n\t\t}\n\t\tif (config.processorAborted) {\n\t\t\tthis.processorAborted = config.processorAborted;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype _ignore_static_assert_memory = AssertNever<typeof KeetaAnchorQueueStorageDriverMemory<{ a: string; }, number> extends KeetaAnchorQueueStorageDriverConstructor<{ a: string; }, number> ? never : false>;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/queue/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAwLzD;;GAEG;AACH,MAAM,OAAO,mCAAmC;I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QAAQ,CAAC,CAAC;IAClB,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,oCAAsJ,SAAQ,0BAAmD;IAC1M,SAAS,CAA+D;IAE3F,YAAY,MAIX;QACA,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC3B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC7C,CAAC;QACD,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC7B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { BrandedString, Brand } from '../utils/brand.ts';\nimport type { Logger } from '../log/index.ts';\nimport type { JSONSerializable } from '../utils/json.ts';\nimport type { AssertNever } from '../utils/never.ts';\nimport type { KeetaAnchorQueueRunOptions } from './common.js';\nimport { asleep } from '../utils/asleep.js';\nimport { Errors } from './common.js';\nimport {\n\tMethodLogger,\n\tManageStatusUpdates,\n\tConvertStringToRequestID\n} from './internal.js';\nimport { AsyncDisposableStack } from '../utils/defer.js';\n\nexport type KeetaAnchorQueueRequest<QueueRequest> = QueueRequest;\nexport type KeetaAnchorQueueRequestID = BrandedString<'KeetaAnchorQueueID'>;\nexport type KeetaAnchorQueueWorkerID = Brand<number, 'KeetaAnchorQueueWorkerID'>;\n\nexport type KeetaAnchorQueueStatus = 'pending' | 'processing' | 'completed' | 'failed_temporarily' | 'failed_permanently' | 'stuck' | 'aborted' | 'moved' | '@internal';\nexport type KeetaAnchorQueueEntry<QueueRequest, QueueResult> = {\n\t/**\n\t * The Job ID\n\t */\n\tid: KeetaAnchorQueueRequestID;\n\t/**\n\t * Idempotent IDs from a previous stage\n\t */\n\tidempotentKeys?: Set<KeetaAnchorQueueRequestID> | undefined;\n\trequest: KeetaAnchorQueueRequest<QueueRequest>;\n\toutput: QueueResult | null;\n\tlastError: string | null;\n\tstatus: KeetaAnchorQueueStatus;\n\tcreated: Date;\n\tupdated: Date;\n\tworker: KeetaAnchorQueueWorkerID | null;\n\tfailures: number;\n};\n\n/**\n * Extra information to provide to a request when adding an entry to the queue\n */\nexport type KeetaAnchorQueueEntryExtra = {\n\t[key in 'idempotentKeys' | 'id' | 'status']?: (key extends 'id' ? KeetaAnchorQueueRequestID | string : KeetaAnchorQueueEntry<never, never>[key]) | undefined;\n};\n\nexport type KeetaAnchorQueueFilter = {\n\t/**\n\t * Only return entries with this status\n\t */\n\tstatus?: KeetaAnchorQueueStatus;\n\t/**\n\t * Only return entries last updated before this date\n\t */\n\tupdatedBefore?: Date;\n\t/**\n\t * Limit the number of entries returned\n\t */\n\tlimit?: number;\n};\n\nexport type KeetaAnchorQueueCommonOptions = {\n\tlogger?: Logger | undefined;\n\tid?: string | undefined;\n};\n\nexport type KeetaAnchorQueueRunnerOptions = KeetaAnchorQueueCommonOptions & {\n\t/**\n\t * If specified, then multiple workers can be used to process this queue\n\t * in parallel by splitting the work among the workers.\n\t *\n\t * By default, only a single worker will process the queue (count=1, id=0)\n\t */\n\tworkers?: {\n\t\tcount: number;\n\t\tid: number;\n\t} | undefined;\n};\n\nexport type KeetaAnchorQueueStorageOptions = KeetaAnchorQueueCommonOptions & {\n\tpath?: string[] | undefined;\n};\n\nexport type KeetaAnchorQueueEntryAncillaryData<QueueResult> = {\n\t/**\n\t * The previous status of the entry -- if the entry is not currently in this status,\n\t * the status update will fail\n\t */\n\toldStatus?: KeetaAnchorQueueStatus | undefined;\n\t/**\n\t * The worker ID performing the status update\n\t */\n\tby?: KeetaAnchorQueueWorkerID | undefined;\n\t/**\n\t * The output data to store with the entry\n\t */\n\toutput?: QueueResult | null | undefined;\n\t/**\n\t * An error message to store with the entry\n\t */\n\terror?: string | undefined;\n};\n\nexport type KeetaAnchorQueueStorageDriverConstructor<QueueRequest extends JSONSerializable, QueueResult extends JSONSerializable> = new(options?: KeetaAnchorQueueStorageOptions) => KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>;\n\nexport interface KeetaAnchorQueueStorageDriver<QueueRequest extends JSONSerializable, QueueResult extends JSONSerializable> {\n\t/**\n\t * An ID for this instance of the storage driver\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The name of the storage driver\n\t */\n\treadonly name: string;\n\n\t/**\n\t * The partition ID for this instance of the storage driver\n\t *\n\t * This is used to divide a single storage backend into multiple\n\t * independent queues.\n\t *\n\t * The root partition is an empty array, and each element is\n\t * a hierarchical partition name.\n\t */\n\treadonly path: string[];\n\n\t/**\n\t * Enqueue an item to be processed by the queue\n\t *\n\t * It will be inserted into the queue as a 'pending' entry\n\t *\n\t * @param request The request to enqueue\n\t * @param id Optional ID to use for the entry -- if not provided, a new\n\t * ID will be generated. If the ID is already in use then\n\t * nothing will be added.\n\t * @returns The ID for the newly created pending entry\n\t */\n\tadd: (request: KeetaAnchorQueueRequest<QueueRequest>, info?: KeetaAnchorQueueEntryExtra) => Promise<KeetaAnchorQueueRequestID>;\n\n\t/**\n\t * Update the status of an entry in the queue\n\t *\n\t * If the status is \"failed_temporarily\", the failure count will be incremented\n\t *\n\t * @param id The entry ID to update\n\t * @param status The new status of the entry\n\t * @param ancillary Optional ancillary data for the status update\n\t * @returns void\n\t */\n\tsetStatus: (id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<QueueResult>) => Promise<void>;\n\n\t/**\n\t * Get entries from storage with an optional filter\n\t *\n\t * @param filter The filter to apply (optional)\n\t * @returns An array of entries matching the criteria\n\t */\n\tquery(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult>[]>;\n\n\t/**\n\t * Get a single entry from storage by ID\n\t *\n\t * @param id The ID of the entry to retrieve\n\t * @returns The entry if found, or null if not found\n\t */\n\tget(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult> | null>;\n\n\t/**\n\t * Perform maintenance tasks on the storage driver\n\t * (e.g. cleaning up old entries, etc)\n\t *\n\t * @returns void\n\t */\n\tmaintain?: () => Promise<void>;\n\n\t/**\n\t * Create a partitioned view of the queue\n\t *\n\t * @param partitionID The partition ID to use\n\t * @returns A new storage driver instance for the partition\n\t */\n\tpartition: (path: string) => Promise<KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>>;\n\n\t/**\n\t * Close the storage driver and release any resources\n\t */\n\tdestroy(): Promise<void>;\n\t[Symbol.asyncDispose](): Promise<void>;\n\n\t/** @internal */\n\t_Testing?: (key: string) => {\n\t\tsetToctouDelay?(delay: number): void;\n\t\tunsetToctouDelay?(): void;\n\t};\n}\n\n/**\n * An in-memory implementation of the KeetaAnchorQueueStorageDriver\n */\nexport class KeetaAnchorQueueStorageDriverMemory<QueueRequest extends JSONSerializable = JSONSerializable, QueueResult extends JSONSerializable = JSONSerializable> implements KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult> {\n\tprotected queueStorage: { [path: string]: KeetaAnchorQueueEntry<QueueRequest, QueueResult>[]; } = {};\n\tprotected readonly logger?: Logger | undefined;\n\tprotected partitionCounter = 0;\n\tprivate destroyed = false;\n\treadonly name: string = 'KeetaAnchorQueueStorageDriverMemory';\n\treadonly id: string;\n\treadonly path: string[] = [];\n\n\tconstructor(options?: KeetaAnchorQueueStorageOptions) {\n\t\tthis.id = options?.id ?? crypto.randomUUID();\n\t\tthis.logger = options?.logger;\n\t\tthis.path.push(...(options?.path ?? []));\n\t\tObject.freeze(this.path);\n\n\t\tthis.methodLogger('new')?.debug('Created new in-memory queue storage driver');\n\t}\n\n\tprotected clone(options?: Partial<KeetaAnchorQueueStorageOptions>): KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult> {\n\t\tconst cloned = new KeetaAnchorQueueStorageDriverMemory<QueueRequest, QueueResult>({\n\t\t\tlogger: this.logger,\n\t\t\tid: `${this.id}::${this.partitionCounter++}`,\n\t\t\tpath: [...this.path],\n\t\t\t...options\n\t\t});\n\t\tcloned.queueStorage = this.queueStorage;\n\n\t\treturn(cloned);\n\t}\n\n\tprotected get queue(): KeetaAnchorQueueEntry<QueueRequest, QueueResult>[] {\n\t\tconst pathKey = ['root', ...this.path].join('.');\n\t\tlet retval = this.queueStorage[pathKey];\n\t\tif (retval === undefined) {\n\t\t\tretval = this.queueStorage[pathKey] = [];\n\t\t}\n\t\treturn(retval);\n\t}\n\n\tprotected methodLogger(method: string): Logger | undefined {\n\t\treturn(MethodLogger(this.logger, {\n\t\t\tclass: 'KeetaAnchorQueueStorageDriverMemory',\n\t\t\tfile: 'src/lib/queue/index.ts',\n\t\t\tmethod: method,\n\t\t\tinstanceID: this.id\n\t\t}));\n\t}\n\n\tprivate checkDestroyed(): void {\n\t\tif (this.destroyed) {\n\t\t\tthrow(new Error('Queue has been destroyed'));\n\t\t}\n\t}\n\n\tasync add(request: KeetaAnchorQueueRequest<QueueRequest>, info?: KeetaAnchorQueueEntryExtra): Promise<KeetaAnchorQueueRequestID> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('add');\n\n\t\tlet id = ConvertStringToRequestID(info?.id);\n\t\tif (id) {\n\t\t\tconst duplicateID = this.queue.some(function(checkEntry) {\n\t\t\t\treturn(checkEntry.id === id);\n\t\t\t});\n\n\t\t\tif (duplicateID) {\n\t\t\t\tlogger?.debug(`Request with id ${String(id)} already exists, ignoring`);\n\n\t\t\t\treturn(id);\n\t\t\t}\n\t\t}\n\n\t\tconst idempotentIDs = info?.idempotentKeys;\n\t\tif (idempotentIDs) {\n\t\t\tconst matchingIdempotentEntries = new Set<KeetaAnchorQueueRequestID>();\n\t\t\tfor (const idempotentID of idempotentIDs) {\n\t\t\t\tconst idempotentEntryExists = this.queue.some(function(checkEntry) {\n\t\t\t\t\treturn(checkEntry.idempotentKeys?.has(idempotentID) ?? false);\n\t\t\t\t});\n\n\t\t\t\tif (idempotentEntryExists) {\n\t\t\t\t\tmatchingIdempotentEntries.add(idempotentID);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (matchingIdempotentEntries.size !== 0) {\n\t\t\t\tthrow(new Errors.IdempotentExistsError('One or more idempotent entries already exist in the queue', matchingIdempotentEntries));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * The status to use for the new entry\n\t\t */\n\t\tconst status = info?.status ?? 'pending';\n\n\t\t/*\n\t\t * The ID is a branded string, so we must convert the generated UUID\n\t\t */\n\t\tid ??= ConvertStringToRequestID(crypto.randomUUID());\n\n\t\tlogger?.debug(`Enqueuing request with id ${String(id)}`);\n\n\t\tthis.queue.push({\n\t\t\tid: id,\n\t\t\trequest: request,\n\t\t\toutput: null,\n\t\t\tlastError: null,\n\t\t\tstatus: status,\n\t\t\tfailures: 0,\n\t\t\tcreated: new Date(),\n\t\t\tupdated: new Date(),\n\t\t\tworker: null,\n\t\t\tidempotentKeys: idempotentIDs ? new Set(idempotentIDs) : undefined\n\t\t});\n\n\t\treturn(id);\n\t}\n\n\tasync setStatus(id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<QueueResult>): Promise<void> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('setStatus');\n\n\t\tconst entry = this.queue.find(function(checkEntry) {\n\t\t\treturn(checkEntry.id === id);\n\t\t});\n\t\tif (!entry) {\n\t\t\tthrow(new Error(`Request with ID ${String(id)} not found`));\n\t\t}\n\n\t\tconst changedFields = ManageStatusUpdates<QueueResult>(id, entry, status, ancillary, logger);\n\n\t\tObject.assign(entry, changedFields);\n\t}\n\n\tasync get(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult> | null> {\n\t\tthis.checkDestroyed();\n\n\t\tconst entry = this.queue.find(function(checkEntry) {\n\t\t\treturn(checkEntry.id === id);\n\t\t});\n\n\t\tif (!entry) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(structuredClone(entry));\n\t}\n\n\tasync query(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<QueueRequest, QueueResult>[]> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('query');\n\n\t\tconst queueDuplicate = structuredClone(this.queue);\n\n\t\tlogger?.debug(`Querying queue with id ${this.id} with filter:`, filter);\n\n\t\tconst allEntriesInStatus = (function() {\n\t\t\tconst filterStatus = filter?.status;\n\t\t\tconst filterLastUpdateBefore = filter?.updatedBefore;\n\t\t\tif (filterStatus || filterLastUpdateBefore) {\n\t\t\t\treturn(queueDuplicate.filter(function(entry) {\n\t\t\t\t\tif (filterStatus) {\n\t\t\t\t\t\tif (entry.status !== filterStatus) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (filterLastUpdateBefore) {\n\t\t\t\t\t\tif (entry.updated >= filterLastUpdateBefore) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn(true);\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\treturn(queueDuplicate);\n\t\t\t}\n\t\t})();\n\n\t\tlet retval = allEntriesInStatus;\n\t\tif (filter?.limit !== undefined) {\n\t\t\tretval = allEntriesInStatus.slice(0, filter.limit);\n\t\t}\n\n\t\tlogger?.debug(`Queried queue with id ${this.id} with filter:`, filter, '-- found', retval.length, 'entries');\n\n\t\treturn(retval);\n\t}\n\n\tasync partition(path: string): Promise<KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>> {\n\t\tthis.checkDestroyed();\n\n\t\tconst logger = this.methodLogger('partition');\n\n\t\tlogger?.debug(`Creating partitioned queue storage driver for path \"${path}\"`);\n\n\t\tconst partitioned = this.clone({\n\t\t\tpath: [...this.path, path]\n\t\t});\n\n\t\treturn(partitioned);\n\t}\n\n\tasync destroy(): Promise<void> {\n\t\tthis.destroyed = true;\n\t\tthis.methodLogger('destroy')?.debug('Destroying in-memory queue');\n\t}\n\n\tasync [Symbol.asyncDispose](): Promise<void> {\n\t\treturn(await this.destroy());\n\t}\n}\n\n/**\n * A Queue Runner and Request Translator for processing entries in a queue\n *\n * The queue runner is responsible for pulling entries from the queue,\n * processing them, and updating their status in the queue. As well\n * as moving jobs between queues by piping the output of one runner\n * to another. Additionally, maintenance tasks such as re-queuing\n * failed jobs and marking stuck jobs are also handled by the runner.\n *\n * This is an abstract base class that must be extended to provide\n * the actual processing logic as well as the encoding and decoding\n * for requests and responses.\n */\nexport abstract class KeetaAnchorQueueRunner<UserRequest = unknown, UserResult = unknown, QueueRequest extends JSONSerializable = JSONSerializable, QueueResult extends JSONSerializable = JSONSerializable> {\n\t/**\n\t * The queue this runner is responsible for running\n\t */\n\tprivate readonly queue: KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>;\n\t/**\n\t * The logger we should use for logging anything\n\t */\n\tprivate readonly logger?: Logger | undefined;\n\t/**\n\t * The processor function to use for processing entries\n\t */\n\tprotected abstract processor(entry: KeetaAnchorQueueEntry<UserRequest, UserResult>): Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>;\n\n\t/**\n\t * The processor for stuck jobs (optional)\n\t */\n\tprotected processorStuck?(entry: KeetaAnchorQueueEntry<UserRequest, UserResult>): Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>;\n\n\t/**\n\t * The processor for aborted jobs (optional)\n\t */\n\tprotected processorAborted?(entry: KeetaAnchorQueueEntry<UserRequest, UserResult>): Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>;\n\n\t/**\n\t * Worker configuration\n\t */\n\tprivate readonly workers: NonNullable<KeetaAnchorQueueRunnerOptions['workers']>;\n\tprivate readonly workerID: KeetaAnchorQueueWorkerID;\n\n\t/**\n\t * Pipes to other runners we have registered\n\t */\n\tprivate readonly pipes: ({\n\t\tisBatchPipe: false;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\ttarget: KeetaAnchorQueueRunner<UserResult, any, QueueResult, any>\n\t} | {\n\t\tisBatchPipe: true;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\ttarget: KeetaAnchorQueueRunner<UserResult[], any, JSONSerializable, any>;\n\t\tminBatchSize: number;\n\t\tmaxBatchSize: number;\n\t})[] = [];\n\n\t/**\n\t * Initialization promise\n\t */\n\tprivate initializePromise: Promise<void> | undefined;\n\n\t/**\n\t * Configuration for this queue\n\t */\n\tprotected maxRetries = 5;\n\tprotected processTimeout = 300_000; /* 5 minutes */\n\tprotected batchSize = 100;\n\n\t/**\n\t * How many runners can process this queue in parallel\n\t */\n\tprotected maxRunners?: number;\n\tprivate readonly runnerLockKey: KeetaAnchorQueueRequestID;\n\n\t/**\n\t * The ID of this runner for diagnostic purposes\n\t */\n\treadonly id: string;\n\n\tconstructor(config: { queue: KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>; } & KeetaAnchorQueueRunnerOptions) {\n\t\tthis.queue = config.queue;\n\t\tthis.logger = config.logger;\n\t\tthis.workers = config.workers ?? {\n\t\t\tcount: 1,\n\t\t\tid: 0\n\t\t};\n\n\t\tif (this.workers.id < 0) {\n\t\t\tthrow(new Error('Worker ID cannot be negative'));\n\t\t}\n\n\t\tif (this.maxRunners) {\n\t\t\tif (this.workers.id > this.maxRunners - 1 || this.workers.count > this.maxRunners) {\n\t\t\t\tthrow(new Error('Worker ID other than 0 or worker count other than 1 is not supported yet'));\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * The worker ID is just a branded version of the worker number\n\t\t */\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.workerID = this.workers.id as KeetaAnchorQueueWorkerID;\n\n\t\t/*\n\t\t * The runner lock key, a unique key used to ensure only\n\t\t * one instance of a given runner is running at a time\n\t\t */\n\t\tthis.runnerLockKey = ConvertStringToRequestID(`@runner-lock:9ba756f0-7aa2-41c7-a1ea-b010dc752ae8.worker.${this.workerID}`);\n\n\t\t/**\n\t\t * Instance ID\n\t\t */\n\t\tthis.id = config.id ?? crypto.randomUUID();\n\n\t\tthis.methodLogger('new')?.debug('Created new queue runner attached to queue', this.queue.id);\n\t}\n\n\tprivate async initialize(): Promise<void> {\n\t\tif (this.initializePromise) {\n\t\t\treturn(await this.initializePromise);\n\t\t}\n\n\t\t/* Ensure the sequential lock entry exists */\n\t\tthis.initializePromise = (async () => {\n\t\t\t/*\n\t\t\t * We store `null` as the request value because we\n\t\t\t * don't have anything better to store -- it's not\n\t\t\t * always going to be compatible with the type\n\t\t\t * QueueRequest but we know that we will never actually\n\t\t\t * use the value.\n\t\t\t */\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tawait this.queue.add(null as unknown as QueueRequest, {\n\t\t\t\tid: this.runnerLockKey,\n\t\t\t\tstatus: '@internal'\n\t\t\t});\n\t\t})();\n\n\t\treturn(await this.initializePromise);\n\t}\n\n\tprivate methodLogger(method: string): Logger | undefined {\n\t\treturn(MethodLogger(this.logger, {\n\t\t\tclass: 'KeetaAnchorQueueRunner',\n\t\t\tfile: 'src/lib/queue/index.ts',\n\t\t\tmethod: method,\n\t\t\tinstanceID: this.id\n\t\t}));\n\t}\n\n\t/** @internal */\n\t_Testing(key: string): {\n\t\tsetParams: (maxBatchSize: number, processTimeout: number, maxRetries: number, maxWorkers?: number) => void;\n\t\tqueue: () => KeetaAnchorQueueStorageDriver<QueueRequest, QueueResult>;\n\t\tmarkWorkerAsProcessing: () => Promise<void>;\n\t} {\n\t\tif (key !== 'bc81abf8-e43b-490b-b486-744fb49a5082') {\n\t\t\tthrow(new Error('This is a testing only method'));\n\t\t}\n\n\t\treturn({\n\t\t\tsetParams: (maxBatchSize: number, processTimeout: number, maxRetries: number, maxWorkers?: number) => {\n\t\t\t\tthis.batchSize = maxBatchSize;\n\t\t\t\tthis.processTimeout = processTimeout;\n\t\t\t\tthis.maxRetries = maxRetries;\n\t\t\t\tif (maxWorkers !== undefined) {\n\t\t\t\t\tthis.maxRunners = maxWorkers;\n\t\t\t\t}\n\t\t\t},\n\t\t\tqueue: () => {\n\t\t\t\treturn(this.queue);\n\t\t\t},\n\t\t\tmarkWorkerAsProcessing: async () => {\n\t\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\t\toldStatus: '@internal',\n\t\t\t\t\tby: this.workerID\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected abstract decodeRequest(request: QueueRequest): UserRequest;\n\tprotected abstract decodeResponse(response: QueueResult | null): UserResult | null;\n\n\tprotected abstract encodeRequest(request: UserRequest): QueueRequest;\n\tprotected abstract encodeResponse(response: UserResult | null): QueueResult | null;\n\n\tprotected decodeEntry(entry: KeetaAnchorQueueEntry<QueueRequest, QueueResult>): KeetaAnchorQueueEntry<UserRequest, UserResult> {\n\t\treturn({\n\t\t\t...entry,\n\t\t\trequest: this.decodeRequest(entry.request),\n\t\t\toutput: this.decodeResponse(entry.output)\n\t\t});\n\t}\n\n\t/**\n\t * Enqueue an item to be processed by the queue\n\t */\n\tasync add(request: UserRequest, info?: KeetaAnchorQueueEntryExtra): Promise<KeetaAnchorQueueRequestID> {\n\t\tawait this.initialize();\n\n\t\tconst encodedRequest = this.encodeRequest(request);\n\t\tconst newID = await this.queue.add(encodedRequest, info);\n\t\treturn(newID);\n\t}\n\n\t/**\n\t * Get a single entry from storage by ID\n\t */\n\tasync get(id: KeetaAnchorQueueRequestID): Promise<KeetaAnchorQueueEntry<UserRequest, UserResult> | null> {\n\t\tawait this.initialize();\n\n\t\tconst entry = await this.queue.get(id);\n\t\tif (!entry) {\n\t\t\treturn(null);\n\t\t}\n\n\t\treturn(this.decodeEntry(entry));\n\t}\n\n\t/**\n\t * Get entries from storage with an optional filter\n\t */\n\tasync query(filter?: KeetaAnchorQueueFilter): Promise<KeetaAnchorQueueEntry<UserRequest, UserResult>[]> {\n\t\tawait this.initialize();\n\n\t\tconst entries = await this.queue.query(filter);\n\t\treturn(entries.map((entry) => {\n\t\t\treturn(this.decodeEntry(entry));\n\t\t}));\n\t}\n\n\t/**\n\t * Set the status of an entry in the queue\n\t */\n\tasync setStatus(id: KeetaAnchorQueueRequestID, status: KeetaAnchorQueueStatus, ancillary?: KeetaAnchorQueueEntryAncillaryData<UserResult>): Promise<void> {\n\t\tawait this.initialize();\n\n\t\tlet encodedOutput: QueueResult | null | undefined = undefined;\n\t\tif (ancillary?.output !== undefined) {\n\t\t\tencodedOutput = this.encodeResponse(ancillary.output);\n\t\t}\n\n\t\treturn(await this.queue.setStatus(id, status, {\n\t\t\t...ancillary,\n\t\t\toutput: encodedOutput\n\t\t}));\n\t}\n\n\t/**\n\t * Checks to see if the queue is runnable\n\t */\n\tasync runnable(): Promise<boolean> {\n\t\tawait this.initialize();\n\n\t\tconst pendingEntries = await this.queue.query({ status: 'pending', limit: 1 });\n\t\tif (pendingEntries.length > 0) {\n\t\t\treturn(true);\n\t\t}\n\n\t\tfor (const pipe of this.pipes) {\n\t\t\tconst pipeRunnable = await pipe.target.runnable();\n\t\t\tif (pipeRunnable) {\n\t\t\t\treturn(true);\n\t\t\t}\n\t\t}\n\n\t\treturn(false);\n\t}\n\n\tprivate async updateRunnerLockTimestamp(): Promise<void> {\n\t\tconst logger = this.methodLogger('updateRunnerLockTimestamp');\n\n\t\ttry {\n\t\t\tlogger?.debug('Updating sequential processing lock timestamp for worker ID', this.workerID);\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\toldStatus: 'processing',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t\tlogger?.debug('Updated sequential processing lock timestamp for worker ID', this.workerID);\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.error('Failed to update sequential processing lock timestamp for worker ID', this.workerID, ':', error);\n\t\t\tthrow(error);\n\t\t}\n\t}\n\n\tprivate async getRunnerLock(cleanup: InstanceType<typeof AsyncDisposableStack>): Promise<boolean> {\n\t\tconst logger = this.methodLogger('getRunnerLock');\n\n\t\ttry {\n\t\t\tlogger?.debug('Acquiring sequential processing lock for worker ID', this.workerID);\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, 'processing', {\n\t\t\t\toldStatus: '@internal',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t\tlogger?.debug('Acquired sequential processing lock for worker ID', this.workerID);\n\t\t} catch (error: unknown) {\n\t\t\tif (Errors.IncorrectStateAssertedError.isInstance(error)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\n\t\t\tthrow(error);\n\t\t}\n\n\t\tcleanup.defer(async () => {\n\t\t\tfor (let retry = 0; retry < 10; retry++) {\n\t\t\t\tlogger?.debug(`Releasing sequential processing lock try #${retry + 1} for worker ID`, this.workerID);\n\t\t\t\ttry {\n\t\t\t\t\tawait this.queue.setStatus(this.runnerLockKey, '@internal', {\n\t\t\t\t\t\toldStatus: 'processing',\n\t\t\t\t\t\tby: undefined\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\tawait asleep(1000);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\n\t\treturn(true);\n\t}\n\n\tprivate async maintainRunnerLock(): Promise<void> {\n\t\tconst logger = this.methodLogger('maintainRunnerLock');\n\t\tconst moment = new Date();\n\t\tawait using cleanup = new AsyncDisposableStack();\n\n\t\tconst obtained = await this.getRunnerLock(cleanup);\n\t\tif (obtained) {\n\t\t\treturn;\n\t\t}\n\n\t\t/**\n\t\t * Check to see if the lock is stale\n\t\t */\n\t\tconst lockEntry = await this.queue.get(this.runnerLockKey);\n\n\t\tif (!lockEntry) {\n\t\t\treturn;\n\t\t}\n\t\tconst lockAge = moment.getTime() - lockEntry.updated.getTime();\n\t\tif (lockAge > this.processTimeout * 10) {\n\t\t\tlogger?.warn('Processing lock is stale, taking over lock for worker ID', this.workerID);\n\n\t\t\tawait this.queue.setStatus(this.runnerLockKey, '@internal', {\n\t\t\t\toldStatus: 'processing',\n\t\t\t\tby: this.workerID\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Run the queue processor\n\t *\n\t * Processes up to `batchSize` entries from the queue and returns\n\t * true if there may be more work to do, or false if the queue\n\t * is empty.\n\t *\n\t * @param options Optional run options\n\t */\n\tasync run(options?: KeetaAnchorQueueRunOptions): Promise<boolean> {\n\t\tconst timeout = options?.timeoutMs;\n\n\t\tawait this.initialize();\n\n\t\tconst logger = this.methodLogger('run');\n\t\tconst batchSize = this.batchSize;\n\t\tconst processTimeout = this.processTimeout;\n\t\tawait using cleanup = new AsyncDisposableStack();\n\n\t\tlet retval = true;\n\n\t\tconst startTime = Date.now();\n\n\t\tconst locked = await this.getRunnerLock(cleanup);\n\t\tif (!locked) {\n\t\t\tlogger?.debug('Another worker is already processing the queue, skipping run');\n\n\t\t\treturn(true);\n\t\t}\n\n\t\tconst processJobOk = Symbol('processJobOk');\n\t\tconst processJobTimeout = Symbol('processJobTimeout');\n\n\t\tconst processJob = async (index: number, entry: KeetaAnchorQueueEntry<QueueRequest, QueueResult>, startingStatus: KeetaAnchorQueueStatus, processor: (entry: KeetaAnchorQueueEntry<UserRequest, UserResult>) => Promise<{ status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; }>): Promise<typeof processJobTimeout | typeof processJobOk> => {\n\t\t\tif (timeout !== undefined) {\n\t\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\tlogger?.debug(`Timeout of ${timeout}ms reached after processing ${index} entries (${startingStatus} phase; elapsed ${elapsed}ms)`);\n\n\t\t\t\t\treturn(processJobTimeout);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait this.updateRunnerLockTimestamp();\n\n\t\t\tlet setEntryStatus: { status: KeetaAnchorQueueStatus; output: UserResult | null; error?: string | undefined; } = { status: 'failed_temporarily', output: null };\n\n\t\t\tlogger?.debug(`Processing entry request with id ${String(entry.id)}`);\n\n\t\t\ttry {\n\t\t\t\t/*\n\t\t\t\t * Get a lock by setting it to 'processing'\n\t\t\t\t */\n\t\t\t\tawait this.queue.setStatus(entry.id, 'processing', { oldStatus: startingStatus, by: this.workerID });\n\n\t\t\t\t/*\n\t\t\t\t * Process the entry with a timeout, if the timeout is reached\n\t\t\t\t * we should mark the process as aborted because we no longer\n\t\t\t\t * know what state the work is in and someone will need to\n\t\t\t\t * inspect the job and determine through some other means if\n\t\t\t\t * it is completed or failed.\n\t\t\t\t */\n\t\t\t\tlet timeoutTimer: ReturnType<typeof setTimeout> | null = null;\n\t\t\t\tsetEntryStatus = await Promise.race([\n\t\t\t\t\tnew Promise<{ status: 'aborted', output: null }>(function(resolve) {\n\t\t\t\t\t\ttimeoutTimer = setTimeout(function() {\n\t\t\t\t\t\t\tresolve({ status: 'aborted', output: null });\n\t\t\t\t\t\t}, processTimeout);\n\t\t\t\t\t}),\n\t\t\t\t\t(async () => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn(await processor(this.decodeEntry(entry)));\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (timeoutTimer) {\n\t\t\t\t\t\t\t\tclearTimeout(timeoutTimer);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})()\n\t\t\t\t]);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (Errors.IncorrectStateAssertedError.isInstance(error)) {\n\t\t\t\t\tlogger?.info(`Skipping request with id ${String(entry.id)} because it is no longer in the expected state \"${startingStatus}\"`, error);\n\n\t\t\t\t\treturn(processJobOk);\n\t\t\t\t}\n\n\t\t\t\tlogger?.error(`Failed to process request with id ${String(entry.id)}, setting state to \"${setEntryStatus.status}\":`, error);\n\t\t\t\tsetEntryStatus.status = 'failed_temporarily';\n\t\t\t\tsetEntryStatus.error = String(error);\n\t\t\t}\n\n\t\t\tif (setEntryStatus.status === 'processing') {\n\t\t\t\tlogger?.error(`Processor for request with id ${String(entry.id)} returned invalid status \"processing\"`);\n\t\t\t\tsetEntryStatus.status = 'failed_temporarily';\n\t\t\t\tsetEntryStatus.error = 'Processor returned invalid status \"processing\"';\n\t\t\t}\n\n\t\t\tlet by: KeetaAnchorQueueWorkerID | undefined = this.workerID;\n\t\t\tif (setEntryStatus.status === 'pending') {\n\t\t\t\tby = undefined;\n\t\t\t}\n\n\t\t\tawait this.queue.setStatus(entry.id, setEntryStatus.status, { oldStatus: 'processing', by: by, output: this.encodeResponse(setEntryStatus.output), error: setEntryStatus.error });\n\n\t\t\treturn(processJobOk);\n\t\t};\n\n\t\t/*\n\t\t * Process pending jobs first\n\t\t */\n\t\tfor (let index = 0; index < batchSize; index++) {\n\t\t\tconst entries = await this.queue.query({ status: 'pending', limit: 1 });\n\t\t\tconst entry = entries[0];\n\t\t\tif (entry === undefined) {\n\t\t\t\tretval = false;\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst result = await processJob(index, entry, 'pending', this.processor.bind(this));\n\t\t\tif (result === processJobTimeout) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * Next process any pipes to other runners\n\t\t */\n\t\tconst pipes = [...this.pipes];\n\t\tfor (const pipe of pipes) {\n\t\t\tlet remainingTime: number | undefined = undefined;\n\t\t\tif (timeout !== undefined) {\n\t\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\t\tremainingTime = timeout - elapsed;\n\t\t\t\tif (remainingTime <= 0) {\n\t\t\t\t\tremainingTime = -1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst pipeHasMoreWork = await pipe.target.run({\n\t\t\t\t...options,\n\t\t\t\ttimeoutMs: remainingTime\n\t\t\t});\n\n\t\t\tif (pipeHasMoreWork) {\n\t\t\t\tretval = true;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process stuck or aborted jobs (if possible)\n\t\t */\n\t\tconst conditions = [{\n\t\t\tstatus: 'aborted' as const,\n\t\t\tprocessor: this.processorAborted?.bind(this)\n\t\t}, {\n\t\t\tstatus: 'stuck' as const,\n\t\t\tprocessor: this.processorStuck?.bind(this)\n\t\t}];\n\n\t\tlet timeoutReached = false;\n\t\tfor (const condition of conditions) {\n\t\t\tif (condition.processor === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (let index = 0; index < batchSize; index++) {\n\t\t\t\tconst entries = await this.queue.query({ status: condition.status, limit: 1 });\n\t\t\t\tconst entry = entries[0];\n\t\t\t\tif (entry === undefined) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tconst result = await processJob(index, entry, condition.status, condition.processor);\n\t\t\t\tif (result === processJobTimeout) {\n\t\t\t\t\ttimeoutReached = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (timeoutReached) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn(retval);\n\t}\n\n\tprivate async markStuckRequestsAsStuck(): Promise<void> {\n\t\tconst stuckThreshold = this.processTimeout * 10;\n\n\t\tconst logger = this.methodLogger('markStuckRequestsAsStuck');\n\t\tconst now = Date.now();\n\n\t\tconst requests = await this.queue.query({ status: 'processing', limit: 100, updatedBefore: new Date(now - stuckThreshold) });\n\t\tfor (const request of requests) {\n\t\t\t/*\n\t\t\t * Skip the runner lock entries, they are managed separately\n\t\t\t */\n\t\t\tif (request.id.toString().startsWith('@runner-lock:9ba756f0-7aa2-41c7-a1ea-b010dc752ae8.worker.')) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tlogger?.warn(`Marking request with id ${String(request.id)} as stuck`);\n\n\t\t\t\tawait this.queue.setStatus(request.id, 'stuck', { oldStatus: 'processing', by: this.workerID });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.error(`Failed to mark request with id ${String(request.id)} as stuck:`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async requeueFailedRequests(): Promise<void> {\n\t\tconst retryDelay = this.processTimeout * 10;\n\t\tconst maxRetries = this.maxRetries;\n\n\t\tconst logger = this.methodLogger('requeueFailedRequests');\n\t\tconst now = Date.now();\n\n\t\tconst requests = await this.queue.query({ status: 'failed_temporarily', limit: 100, updatedBefore: new Date(now - retryDelay) });\n\t\tfor (const request of requests) {\n\t\t\ttry {\n\t\t\t\tif (request.failures >= maxRetries) {\n\t\t\t\t\tlogger?.info(`Request with id ${String(request.id)} has exceeded maximum retries, not requeuing -- moving to failed_permanently`);\n\t\t\t\t\tawait this.queue.setStatus(request.id, 'failed_permanently', { oldStatus: 'failed_temporarily', by: this.workerID });\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tlogger?.debug(`Requeuing failed request with id ${String(request.id)}`);\n\n\t\t\t\tawait this.queue.setStatus(request.id, 'pending', { oldStatus: 'failed_temporarily', by: this.workerID });\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.error(`Failed to requeue request with id ${String(request.id)}:`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async moveCompletedToNextStage(): Promise<void> {\n\t\tconst logger = this.methodLogger('moveCompletedToNextStage');\n\n\t\tconst pipes = [...this.pipes];\n\t\tif (pipes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst allRequests = await this.queue.query({ status: 'completed', limit: 100 });\n\t\tlet requests = allRequests;\n\n\t\tconst RequestSentToPipes = new Map<KeetaAnchorQueueRequestID, number>();\n\t\tfunction IncrRequestSentToPipes(requestID: KeetaAnchorQueueRequestID): void {\n\t\t\tconst sentCount = RequestSentToPipes.get(requestID) ?? 0;\n\t\t\tRequestSentToPipes.set(requestID, sentCount + 1);\n\t\t}\n\n\n\t\tfor (const pipe of pipes) {\n\t\t\tlogger?.debug('Processing pipe to target', pipe.target.id, pipe.isBatchPipe ? '(batch pipe)' : '(single item pipe)');\n\n\t\t\tif (pipe.isBatchPipe) {\n\t\t\t\t/**\n\t\t\t\t * Keep track of all the requests we successfully\n\t\t\t\t * sent to the target stage\n\t\t\t\t */\n\t\t\t\tconst allTargetSeenRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * During each iteration of the batch processing, we keep track\n\t\t\t\t * of the IDs we have already seen by the target and processed\n\t\t\t\t * so we don't try to reprocess them again\n\t\t\t\t */\n\t\t\t\tconst iterationTargetSeenRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * If we get a batch that cannot be added to the target pipe,\n\t\t\t\t * we just skip over them for retrying at a later date\n\t\t\t\t */\n\t\t\t\tconst skipRequestIDs = new Set<KeetaAnchorQueueRequestID>();\n\n\t\t\t\t/**\n\t\t\t\t * Compute a durable ID for this batch and target\n\t\t\t\t */\n\t\t\t\tlet batchID = ConvertStringToRequestID(crypto.randomUUID());\n\n\t\t\t\t/**\n\t\t\t\t * Keep track of sequential failures to find enough entries\n\t\t\t\t * and stop processing if we can't find enough after a few tries\n\t\t\t\t * in a row\n\t\t\t\t */\n\t\t\t\tlet sequentialFailureCount = 0;\n\n\t\t\t\tfor (;requests.length >= pipe.minBatchSize;\n\t\t\t\t\t/*\n\t\t\t\t\t * Remove any entries we have already seen during\n\t\t\t\t\t * the last iteration of the loop\n\t\t\t\t\t */\n\t\t\t\t\trequests = requests.filter(function(entry) {\n\t\t\t\t\t\treturn(!iterationTargetSeenRequestIDs.has(entry.id) && !skipRequestIDs.has(entry.id));\n\t\t\t\t\t})\n\t\t\t\t) {\n\t\t\t\t\titerationTargetSeenRequestIDs.clear();\n\n\t\t\t\t\tlogger?.debug(`Preparing to move completed requests to next stage ${pipe.target.id} (min=${pipe.minBatchSize}, max=${pipe.maxBatchSize}), have ${requests.length} completed requests available`);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Compute a batch of entries to send to the next stage,\n\t\t\t\t\t * constrained to the max batch size of the pipe and\n\t\t\t\t\t * the entries which have non-null outputs\n\t\t\t\t\t */\n\t\t\t\t\tconst batchRaw = requests.map((entry) => {\n\t\t\t\t\t\treturn({ output: this.decodeResponse(entry.output), id: entry.id });\n\t\t\t\t\t}).filter(function(entry): entry is { output: UserResult; id: KeetaAnchorQueueRequestID; } {\n\t\t\t\t\t\tif (entry === null) {\n\t\t\t\t\t\t\treturn(false);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn(true);\n\t\t\t\t\t}).slice(0, pipe.maxBatchSize);\n\n\t\t\t\t\t/*\n\t\t\t\t\t * If we don't have enough entries to meet the minimum\n\t\t\t\t\t * batch size, skip this iteration\n\t\t\t\t\t */\n\t\t\t\t\tif (batchRaw.length < pipe.minBatchSize) {\n\t\t\t\t\t\tsequentialFailureCount++;\n\t\t\t\t\t\tif (sequentialFailureCount >= 3) {\n\t\t\t\t\t\t\tlogger?.debug(`Not enough completed requests to move to next stage ${pipe.target.id}, stopping batch processing`);\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlogger?.debug(`Not moving completed requests to next stage ${pipe.target.id} because batch size ${batchRaw.length} is less than minimum size ${pipe.minBatchSize}`);\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tsequentialFailureCount = 0;\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The IDs for the entries we are sending to the next stage\n\t\t\t\t\t * target -- this may get reduced if we find there are already\n\t\t\t\t\t * jobs in the next stage that have the idempotentIDs of one of\n\t\t\t\t\t * these jobs\n\t\t\t\t\t */\n\t\t\t\t\tconst batchLocalIDs = new Set(batchRaw.map(function(entry) {\n\t\t\t\t\t\treturn(entry.id);\n\t\t\t\t\t}));\n\t\t\t\t\t/**\n\t\t\t\t\t * The outputs for the batch we are sending to the next stage\n\t\t\t\t\t */\n\t\t\t\t\tconst batchOutput = batchRaw.map(function(entry) {\n\t\t\t\t\t\treturn(entry.output);\n\t\t\t\t\t});\n\n\t\t\t\t\tlogger?.debug(`Moving batch of ${batchOutput.length} completed requests to next pipe`, pipe.target.id, '(input entry IDs:', Array.from(batchLocalIDs), '->', `${pipe.target.id}:${String(batchID)})`);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait pipe.target.add(batchOutput, {\n\t\t\t\t\t\t\tid: batchID,\n\t\t\t\t\t\t\t/* Use the set of IDs as the idempotent IDs for the batch */\n\t\t\t\t\t\t\tidempotentKeys: batchLocalIDs\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbatchID = ConvertStringToRequestID(crypto.randomUUID());\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tif (Errors.IdempotentExistsError.isInstance(error) && error.idempotentIDsFound) {\n\t\t\t\t\t\t\tlogger?.debug('Some of the jobs have already been added to the target queue, skipping those:', error.idempotentIDsFound.values());\n\t\t\t\t\t\t\tfor (const requestID of error.idempotentIDsFound) {\n\t\t\t\t\t\t\t\titerationTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\t\t\tallTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * If we got some kind of other error adding these\n\t\t\t\t\t\t\t * items to the target queue runner, just skip them\n\t\t\t\t\t\t\t * and we will retry them on the next iteration\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tlogger?.error(`Failed to move completed batch to next stage ${pipe.target.id}, will try to create another batch without them:`, error);\n\n\t\t\t\t\t\t\tfor (const requestID of batchLocalIDs) {\n\t\t\t\t\t\t\t\tskipRequestIDs.add(requestID);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const requestID of batchLocalIDs) {\n\t\t\t\t\t\titerationTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t\tallTargetSeenRequestIDs.add(requestID);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * For every request we know the target has definitely seen, mark it\n\t\t\t\t * as moved for this pipe\n\t\t\t\t */\n\t\t\t\tfor (const requestID of allTargetSeenRequestIDs) {\n\t\t\t\t\tIncrRequestSentToPipes(requestID);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const request of requests) {\n\t\t\t\t\tlet shouldMarkAsMoved = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst output = this.decodeResponse(request.output);\n\t\t\t\t\t\tif (output === null) {\n\t\t\t\t\t\t\tlogger?.debug(`Completed request with id ${String(request.id)} has no output -- next stage will not be run`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlogger?.debug(`Moving completed request with id ${String(request.id)} to next pipe`, pipe.target.id);\n\t\t\t\t\t\t\tawait pipe.target.add(output, { id: request.id });\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tlogger?.error(`Failed to move completed request with id ${String(request.id)} to next stage:`, error);\n\t\t\t\t\t\tshouldMarkAsMoved = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (shouldMarkAsMoved) {\n\t\t\t\t\t\tIncrRequestSentToPipes(request.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst TotalPipes = pipes.length;\n\t\tfor (const request of allRequests) {\n\t\t\tconst sentCount = RequestSentToPipes.get(request.id) ?? 0;\n\t\t\tif (sentCount !== TotalPipes) {\n\t\t\t\tlogger?.debug(`Completed request with id ${String(request.id)} was only moved to ${sentCount} out of ${TotalPipes} pipes -- not marking as moved`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlogger?.debug(`Marking completed request with id ${String(request.id)} as moved`);\n\n\t\t\tawait this.queue.setStatus(request.id, 'moved', { oldStatus: 'completed', by: this.workerID });\n\t\t}\n\n\t}\n\n\tasync maintain(): Promise<void> {\n\t\tconst logger = this.methodLogger('maintain');\n\n\t\tawait this.initialize();\n\n\t\t/*\n\t\t * Each worker should maintain its own lock\n\t\t */\n\t\ttry {\n\t\t\tawait this.maintainRunnerLock();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to maintain runner lock:', error);\n\t\t}\n\n\t\tif (this.workers.id !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Only the worker with ID 0 should perform maintenance tasks on requests\n\t\t */\n\t\ttry {\n\t\t\tawait this.markStuckRequestsAsStuck();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to mark stuck requests as stuck:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.requeueFailedRequests();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to requeue failed requests:', error);\n\t\t}\n\n\t\ttry {\n\t\t\tawait this.moveCompletedToNextStage();\n\t\t} catch (error: unknown) {\n\t\t\tlogger?.debug('Failed to move completed requests to next stage:', error);\n\t\t}\n\n\t\tfor (const pipe of this.pipes) {\n\t\t\ttry {\n\t\t\t\tawait pipe.target.maintain();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.debug(`Failed to maintain piped runner with ID ${pipe.target.id}:`, error);\n\t\t\t}\n\t\t}\n\n\t\tif (this.queue.maintain) {\n\t\t\ttry {\n\t\t\t\tawait this.queue.maintain();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tlogger?.debug(`Failed to maintain queue storage driver with ID ${this.queue.id}`, error);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Pipe the the completed entries of this runner to another runner\n\t */\n\tpipe<T1, T2 extends JSONSerializable>(target: KeetaAnchorQueueRunner<UserResult, T1, QueueResult, T2>): typeof target {\n\t\tthis.pipes.push({\n\t\t\tisBatchPipe: false,\n\t\t\ttarget: target\n\t\t});\n\t\treturn(target);\n\t}\n\n\t/**\n\t * Pipe batches of completed entries from this runner to another runner\n\t */\n\tpipeBatch<T1, T2 extends JSONSerializable>(target: KeetaAnchorQueueRunner<UserResult[], T1, JSONSerializable, T2>, maxBatchSize = 100, minBatchSize = 1): typeof target {\n\t\tthis.pipes.push({\n\t\t\tisBatchPipe: true,\n\t\t\ttarget: target,\n\t\t\tminBatchSize: minBatchSize,\n\t\t\tmaxBatchSize: maxBatchSize\n\t\t});\n\t\treturn(target);\n\t}\n\n\tasync destroy(): Promise<void> {\n\t\tthis.methodLogger('destroy')?.debug('Destroying queue runner attached to queue', this.queue.id);\n\t}\n\n\tasync [Symbol.asyncDispose](): Promise<void> {\n\t\tawait this.destroy();\n\t}\n}\n\n/**\n * A KeetaAnchorQueueRunner for use when you want to process already\n * JSON-serializable data without any encoding/decoding needed\n */\nexport abstract class KeetaAnchorQueueRunnerJSON<UserRequest extends JSONSerializable = JSONSerializable, UserResult extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunner<UserRequest, UserResult, JSONSerializable, JSONSerializable> {\n\tprotected decodeRequest(request: JSONSerializable): UserRequest {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(request as UserRequest);\n\t}\n\n\tprotected decodeResponse(response: JSONSerializable | null): UserResult | null {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(response as UserResult | null);\n\t}\n\n\tprotected encodeRequest(request: JSONSerializable): JSONSerializable {\n\t\treturn(request);\n\t}\n\n\tprotected encodeResponse(response: JSONSerializable | null): JSONSerializable | null {\n\t\treturn(response);\n\t}\n}\n\n/**\n * A KeetaAnchorQueueRunnerJSON that takes a processor function\n * in the constructor -- this is mainly useful for testing\n */\nexport class KeetaAnchorQueueRunnerJSONConfigProc<UserRequest extends JSONSerializable = JSONSerializable, UserResult extends JSONSerializable = JSONSerializable> extends KeetaAnchorQueueRunnerJSON<UserRequest, UserResult> {\n\tprotected readonly processor: KeetaAnchorQueueRunner<UserRequest, UserResult>['processor'];\n\n\tconstructor(config: ConstructorParameters<typeof KeetaAnchorQueueRunner>[0] & {\n\t\tprocessor: KeetaAnchorQueueRunner<UserRequest, UserResult>['processor'];\n\t\tprocessorStuck?: KeetaAnchorQueueRunner<UserRequest, UserResult>['processorStuck'] | undefined;\n\t\tprocessorAborted?: KeetaAnchorQueueRunner<UserRequest, UserResult>['processorAborted'] | undefined;\n\t}) {\n\t\tsuper(config);\n\t\tthis.processor = config.processor;\n\t\tif (config.processorStuck) {\n\t\t\tthis.processorStuck = config.processorStuck;\n\t\t}\n\t\tif (config.processorAborted) {\n\t\t\tthis.processorAborted = config.processorAborted;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype _ignore_static_assert_memory = AssertNever<typeof KeetaAnchorQueueStorageDriverMemory<{ a: string; }, number> extends KeetaAnchorQueueStorageDriverConstructor<{ a: string; }, number> ? never : false>;\n"]}
@@ -1,4 +1,16 @@
1
- export type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? {
1
+ type AnyFunction = (...args: any[]) => any;
2
+ /**
3
+ * Determine if an object type has at least one function property,
4
+ * if so it's not a plain object
5
+ */
6
+ type HasFunctionProperty<T extends object> = Extract<{
7
+ [K in keyof T]-?: T[K] extends AnyFunction ? K : never;
8
+ }[keyof T], keyof T> extends never ? false : true;
9
+ export type DeepPartial<T> = T extends AnyFunction ? T : T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? (HasFunctionProperty<T> extends true ? T : {
2
10
  [P in keyof T]?: DeepPartial<T[P]>;
3
- } : T;
11
+ }) : T;
12
+ export type DeepRequired<T> = T extends AnyFunction ? T : T extends (infer U)[] ? DeepRequired<U>[] : T extends object ? (HasFunctionProperty<T> extends true ? T : {
13
+ [P in keyof T]-?: DeepRequired<T[P]>;
14
+ }) : T;
15
+ export {};
4
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,CAAC,CAAC,IAExB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,CAAC,GACpC,CAAC,SAAS,CAAC,MAAM,CAA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GAAG,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,GACtG,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["export type DeepPartial<T> =\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tT extends (...args: any[]) => any ? T :\n\t\tT extends (infer U)[] ? DeepPartial<U>[] :\n\t\t\tT extends object ? { [P in keyof T]?: DeepPartial<T[P]> } :\n\t\t\t\tT;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any;\n\n/**\n * Determine if an object type has at least one function property,\n * if so it's not a plain object\n */\ntype HasFunctionProperty<T extends object> = Extract< { [K in keyof T]-?: T[K] extends AnyFunction ? K : never }[keyof T], keyof T> extends never ? false : true;\n\nexport type DeepPartial<T> =\n\tT extends AnyFunction ? T :\n\t\tT extends (infer U)[] ? DeepPartial<U>[] :\n\t\t\tT extends object ? (HasFunctionProperty<T> extends true ? T : { [P in keyof T]?: DeepPartial<T[P]> }) :\n\t\t\t\tT;\n\nexport type DeepRequired<T> =\n\tT extends AnyFunction ? T :\n\t\tT extends (infer U)[] ? DeepRequired<U>[] :\n\t\t\tT extends object ? (HasFunctionProperty<T> extends true ? T : { [P in keyof T]-?: DeepRequired<T[P]> }) :\n\t\t\t\tT;\n"]}
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@keetanetwork/anchor",
9
- "version": "0.0.37",
9
+ "version": "0.0.38",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@keetanetwork/currency-info": "1.2.5",
13
- "@keetanetwork/keetanet-client": "0.14.12",
13
+ "@keetanetwork/keetanet-client": "0.14.14",
14
14
  "typia": "9.5.0"
15
15
  },
16
16
  "engines": {
@@ -185,8 +185,8 @@
185
185
  "license": "ISC"
186
186
  },
187
187
  "node_modules/@keetanetwork/keetanet-client": {
188
- "version": "0.14.12",
189
- "integrity": "sha512-9abaDfOZjaLoPlHSIFLuFm3plu+N551yXuNukSjIm/wkogftmVwT37fb3bvJEyBAxOkNll0zDGh1Pfgwq6nsaQ==",
188
+ "version": "0.14.14",
189
+ "integrity": "sha512-A8rFMb3xe/hRMXj4VUxjetAW5SZ0ZKUxZv0xP+z7kAs8btaADvVUwTFSqOS4K+eL93l12RJB4PuarWh055vh/Q==",
190
190
  "license": "see LICENSE",
191
191
  "dependencies": {
192
192
  "secp256k1": "5.0.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "KeetaNetwork Network Anchor",
5
5
  "main": "client/index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "sideEffects": false,
24
24
  "dependencies": {
25
25
  "@keetanetwork/currency-info": "1.2.5",
26
- "@keetanetwork/keetanet-client": "0.14.12",
26
+ "@keetanetwork/keetanet-client": "0.14.14",
27
27
  "typia": "9.5.0"
28
28
  },
29
29
  "engines": {