diff --git a/src/communicator.ts b/src/communicator.ts index 3961616ed..d594ab5b5 100644 --- a/src/communicator.ts +++ b/src/communicator.ts @@ -4,8 +4,8 @@ import { WorkflowContextImpl } from "./workflow"; import { DBOSContext, DBOSContextImpl } from "./context"; import { WorkflowContextDebug } from "./debugger/debug_workflow"; -/* eslint-disable @typescript-eslint/no-explicit-any */ -export type Communicator = (ctxt: CommunicatorContext, ...args: T) => Promise; +/* eslint-disable-next-line @typescript-eslint/no-explicit-any */ +export type Communicator = (ctxt: CommunicatorContext, ...args: any[]) => Promise; export interface CommunicatorConfig { retriesAllowed?: boolean; // Should failures be retried? (default true) diff --git a/src/dbos-executor.ts b/src/dbos-executor.ts index 8f844ac0f..b27b2b0cb 100644 --- a/src/dbos-executor.ts +++ b/src/dbos-executor.ts @@ -68,17 +68,17 @@ export interface DBOSConfig { } interface WorkflowInfo { - workflow: Workflow; + workflow: Workflow; config: WorkflowConfig; } interface TransactionInfo { - transaction: Transaction; + transaction: Transaction; config: TransactionConfig; } interface CommunicatorInfo { - communicator: Communicator; + communicator: Communicator; config: CommunicatorConfig; } @@ -258,15 +258,15 @@ export class DBOSExecutor { this.registeredOperations.push(...registeredClassOperations); for (const ro of registeredClassOperations) { if (ro.workflowConfig) { - const wf = ro.registeredFunction as Workflow; + const wf = ro.registeredFunction as Workflow; this.#registerWorkflow(wf, {...ro.workflowConfig}); this.logger.debug(`Registered workflow ${ro.name}`); } else if (ro.txnConfig) { - const tx = ro.registeredFunction as Transaction; + const tx = ro.registeredFunction as Transaction; this.#registerTransaction(tx, ro.txnConfig); this.logger.debug(`Registered transaction ${ro.name}`); } else if (ro.commConfig) { - const comm = ro.registeredFunction as Communicator; + const comm = ro.registeredFunction as Communicator; this.#registerCommunicator(comm, ro.commConfig); this.logger.debug(`Registered communicator ${ro.name}`); } @@ -347,7 +347,7 @@ export class DBOSExecutor { /* WORKFLOW OPERATIONS */ - #registerWorkflow(wf: Workflow, config: WorkflowConfig = {}) { + #registerWorkflow(wf: Workflow, config: WorkflowConfig = {}) { if (wf.name === DBOSExecutor.tempWorkflowName || this.workflowInfoMap.has(wf.name)) { throw new DBOSError(`Repeated workflow name: ${wf.name}`); } @@ -358,7 +358,7 @@ export class DBOSExecutor { this.workflowInfoMap.set(wf.name, workflowInfo); } - #registerTransaction(txn: Transaction, params: TransactionConfig = {}) { + #registerTransaction(txn: Transaction, params: TransactionConfig = {}) { if (this.transactionInfoMap.has(txn.name)) { throw new DBOSError(`Repeated Transaction name: ${txn.name}`); } @@ -369,7 +369,7 @@ export class DBOSExecutor { this.transactionInfoMap.set(txn.name, txnInfo); } - #registerCommunicator(comm: Communicator, params: CommunicatorConfig = {}) { + #registerCommunicator(comm: Communicator, params: CommunicatorConfig = {}) { if (this.communicatorInfoMap.has(comm.name)) { throw new DBOSError(`Repeated Commmunicator name: ${comm.name}`); } @@ -380,7 +380,7 @@ export class DBOSExecutor { this.communicatorInfoMap.set(comm.name, commInfo); } - async workflow(wf: Workflow, params: InternalWorkflowParams, ...args: T): Promise> { + async workflow(wf: Workflow, params: InternalWorkflowParams, ...args: unknown[]): Promise> { if (this.debugMode) { return this.debugWorkflow(wf, params, undefined, undefined, ...args); } @@ -388,7 +388,7 @@ export class DBOSExecutor { } // If callerUUID and functionID are set, it means the workflow is invoked from within a workflow. - async internalWorkflow(wf: Workflow, params: InternalWorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise> { + async internalWorkflow(wf: Workflow, params: InternalWorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: unknown[]): Promise> { const workflowUUID: string = params.workflowUUID ? params.workflowUUID : this.#generateUUID(); const presetUUID: boolean = params.workflowUUID ? true : false; @@ -494,7 +494,7 @@ export class DBOSExecutor { /** * DEBUG MODE workflow execution, skipping all the recording */ - async debugWorkflow(wf: Workflow, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise> { + async debugWorkflow(wf: Workflow, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: unknown[]): Promise> { // In debug mode, we must have a specific workflow UUID. if (!params.workflowUUID) { throw new DBOSDebuggerError("Workflow UUID not found!"); @@ -535,18 +535,18 @@ export class DBOSExecutor { return new InvokedHandle(this.systemDatabase, workflowPromise, workflowUUID, wf.name, callerUUID, callerFunctionID); } - async transaction(txn: Transaction, params: WorkflowParams, ...args: T): Promise { + async transaction(txn: Transaction, params: WorkflowParams, ...args: unknown[] ): Promise { // Create a workflow and call transaction. - const temp_workflow = async (ctxt: WorkflowContext, ...args: T) => { + const temp_workflow = async (ctxt: WorkflowContext, ...args: unknown[]) => { const ctxtImpl = ctxt as WorkflowContextImpl; return await ctxtImpl.transaction(txn, ...args); }; - return (await this.workflow(temp_workflow, { ...params, tempWfType: TempWorkflowType.transaction, tempWfName: txn.name }, ...args)).getResult(); + return (await this.workflow(temp_workflow, { ...params, tempWfType: TempWorkflowType.transaction, tempWfName: txn.name }, ...args)).getResult(); } - async external(commFn: Communicator, params: WorkflowParams, ...args: T): Promise { + async external(commFn: Communicator, params: WorkflowParams, ...args: unknown[]): Promise { // Create a workflow and call external. - const temp_workflow = async (ctxt: WorkflowContext, ...args: T) => { + const temp_workflow = async (ctxt: WorkflowContext, ...args: unknown[]) => { const ctxtImpl = ctxt as WorkflowContextImpl; return await ctxtImpl.external(commFn, ...args); }; @@ -559,7 +559,9 @@ export class DBOSExecutor { return await ctxt.send(destinationUUID, message, topic); }; const workflowUUID = idempotencyKey ? destinationUUID + idempotencyKey : undefined; - return (await this.workflow(temp_workflow, { workflowUUID: workflowUUID, tempWfType: TempWorkflowType.send }, destinationUUID, message, topic)).getResult(); + const internalWorkflowParams = { workflowUUID: workflowUUID, tempWfType: TempWorkflowType.send } + const args: unknown[] = [destinationUUID, message, topic] + return (await this.workflow(temp_workflow, internalWorkflowParams, args)).getResult(); } /** @@ -631,16 +633,15 @@ export class DBOSExecutor { throw new DBOSError(`This should never happen! Cannot find workflow info for a non-temporary workflow! UUID ${workflowUUID}, name ${wfName}`); } - let temp_workflow: Workflow; + let temp_workflow: Workflow; if (nameArr[1] === TempWorkflowType.transaction) { const txnInfo: TransactionInfo | undefined = this.transactionInfoMap.get(nameArr[2]); if (!txnInfo) { this.logger.error(`Cannot find transaction info for UUID ${workflowUUID}, name ${nameArr[2]}`); throw new DBOSNotRegisteredError(nameArr[2]); } - temp_workflow = async (ctxt: WorkflowContext, ...args: any[]) => { + temp_workflow = async (ctxt: WorkflowContext, ...args: unknown[]) => { const ctxtImpl = ctxt as WorkflowContextImpl; - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument return await ctxtImpl.transaction(txnInfo.transaction, ...args); }; } else if (nameArr[1] === TempWorkflowType.external) { @@ -649,9 +650,8 @@ export class DBOSExecutor { this.logger.error(`Cannot find communicator info for UUID ${workflowUUID}, name ${nameArr[2]}`); throw new DBOSNotRegisteredError(nameArr[2]); } - temp_workflow = async (ctxt: WorkflowContext, ...args: any[]) => { + temp_workflow = async (ctxt: WorkflowContext, ...args: unknown[]) => { const ctxtImpl = ctxt as WorkflowContextImpl; - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument return await ctxtImpl.external(commInfo.communicator, ...args); }; } else if (nameArr[1] === TempWorkflowType.send) { diff --git a/src/debugger/debug_workflow.ts b/src/debugger/debug_workflow.ts index dd0688c19..e3437f2db 100644 --- a/src/debugger/debug_workflow.ts +++ b/src/debugger/debug_workflow.ts @@ -56,11 +56,11 @@ export class WorkflowContextDebug extends DBOSContextImpl implements WorkflowCon for (const op of ops) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access proxy[op.name] = op.txnConfig - ? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - (...args: any[]) => this.transaction(op.registeredFunction as Transaction, ...args) + ? + (...args: unknown[]) => this.transaction(op.registeredFunction as Transaction, ...args) : op.commConfig - ? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - (...args: any[]) => this.external(op.registeredFunction as Communicator, ...args) + ? + (...args: unknown[]) => this.external(op.registeredFunction as Communicator, ...args) : undefined; } return proxy as WFInvokeFuncs; @@ -99,7 +99,7 @@ export class WorkflowContextDebug extends DBOSContextImpl implements WorkflowCon * Execute a transactional function in debug mode. * If a debug proxy is provided, it connects to a debug proxy and everything should be read-only. */ - async transaction(txn: Transaction, ...args: T): Promise { + async transaction(txn: Transaction, ...args: unknown[]): Promise { const txnInfo = this.#dbosExec.transactionInfoMap.get(txn.name); if (txnInfo === undefined) { throw new DBOSDebuggerError(`Transaction ${txn.name} not registered!`); @@ -168,7 +168,7 @@ export class WorkflowContextDebug extends DBOSContextImpl implements WorkflowCon return check.output; // Always return the recorded result. } - async external(commFn: Communicator, ..._args: T): Promise { + async external(commFn: Communicator, ..._args: unknown[]): Promise { const commConfig = this.#dbosExec.communicatorInfoMap.get(commFn.name); if (commConfig === undefined) { throw new DBOSDebuggerError(`Communicator ${commFn.name} not registered!`); @@ -187,18 +187,18 @@ export class WorkflowContextDebug extends DBOSContextImpl implements WorkflowCon } // Invoke the debugWorkflow() function instead. - async startChildWorkflow(wf: Workflow, ...args: T): Promise> { + async startChildWorkflow(wf: Workflow, ...args: unknown[]): Promise> { const funcId = this.functionIDGetIncrement(); const childUUID: string = this.workflowUUID + "-" + funcId; return this.#dbosExec.debugWorkflow(wf, { parentCtx: this, workflowUUID: childUUID }, this.workflowUUID, funcId, ...args); } - async invokeChildWorkflow(wf: Workflow, ...args: T): Promise { + async invokeChildWorkflow(wf: Workflow, ...args: unknown[]): Promise { return this.startChildWorkflow(wf, ...args).then((handle) => handle.getResult()); } // Deprecated - async childWorkflow(wf: Workflow, ...args: T): Promise> { + async childWorkflow(wf: Workflow, ...args: unknown[]): Promise> { return this.startChildWorkflow(wf, ...args); } diff --git a/src/httpServer/handler.ts b/src/httpServer/handler.ts index b94edb547..56aa49b92 100644 --- a/src/httpServer/handler.ts +++ b/src/httpServer/handler.ts @@ -125,20 +125,16 @@ export class HandlerContextImpl extends DBOSContextImpl implements HandlerContex if (asyncWf) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access proxy[op.name] = op.txnConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => this.#transaction(op.registeredFunction as Transaction, params, ...args) + ? (...args: unknown[]) => this.#transaction(op.registeredFunction as Transaction, params, ...args) : op.workflowConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => this.#workflow(op.registeredFunction as Workflow, params, ...args) + ? (...args: unknown[]) => this.#workflow(op.registeredFunction as Workflow, params, ...args) : op.commConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => this.#external(op.registeredFunction as Communicator, params, ...args) + ? (...args: unknown[]) => this.#external(op.registeredFunction as Communicator, params, ...args) : undefined; } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access proxy[op.name] = op.workflowConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => this.#workflow(op.registeredFunction as Workflow, params, ...args).then((handle) => handle.getResult()) + ? (...args: unknown[]) => this.#workflow(op.registeredFunction as Workflow, params, ...args).then((handle) => handle.getResult()) : undefined; } } @@ -161,15 +157,15 @@ export class HandlerContextImpl extends DBOSContextImpl implements HandlerContex /* PRIVATE METHODS */ ///////////////////// - async #workflow(wf: Workflow, params: WorkflowParams, ...args: T): Promise> { + async #workflow(wf: Workflow, params: WorkflowParams, ...args: unknown[]): Promise> { return this.#dbosExec.workflow(wf, params, ...args); } - async #transaction(txn: Transaction, params: WorkflowParams, ...args: T): Promise { + async #transaction(txn: Transaction, params: WorkflowParams, ...args: unknown[]): Promise { return this.#dbosExec.transaction(txn, params, ...args); } - async #external(commFn: Communicator, params: WorkflowParams, ...args: T): Promise { + async #external(commFn: Communicator, params: WorkflowParams, ...args: unknown[]): Promise { return this.#dbosExec.external(commFn, params, ...args); } } diff --git a/src/httpServer/server.ts b/src/httpServer/server.ts index 1d8906c64..319b009d7 100644 --- a/src/httpServer/server.ts +++ b/src/httpServer/server.ts @@ -285,11 +285,11 @@ async checkPortAvailability(port: number, host: string): Promise { // - Otherwise, we return 500. const wfParams = { parentCtx: oc, workflowUUID: headerWorkflowUUID }; if (ro.txnConfig) { - koaCtxt.body = await dbosExec.transaction(ro.registeredFunction as Transaction, wfParams, ...args); + koaCtxt.body = await dbosExec.transaction(ro.registeredFunction as Transaction, wfParams, ...args); } else if (ro.workflowConfig) { - koaCtxt.body = await (await dbosExec.workflow(ro.registeredFunction as Workflow, wfParams, ...args)).getResult(); + koaCtxt.body = await (await dbosExec.workflow(ro.registeredFunction as Workflow, wfParams, ...args)).getResult(); } else if (ro.commConfig) { - koaCtxt.body = await dbosExec.external(ro.registeredFunction as Communicator, wfParams, ...args); + koaCtxt.body = await dbosExec.external(ro.registeredFunction as Communicator, wfParams, ...args); } else { // Directly invoke the handler code. const retValue = await ro.invoke(undefined, [oc, ...args]); diff --git a/src/kafka/kafka.ts b/src/kafka/kafka.ts index 87e9db537..035990755 100644 --- a/src/kafka/kafka.ts +++ b/src/kafka/kafka.ts @@ -124,10 +124,10 @@ export class DBOSKafka { // We can only guarantee exactly-once-per-message execution of transactions and workflows. if (ro.txnConfig) { // Execute the transaction - await this.dbosExec.transaction(ro.registeredFunction as Transaction, wfParams, ...args); + await this.dbosExec.transaction(ro.registeredFunction as Transaction, wfParams, ...args); } else if (ro.workflowConfig) { // Safely start the workflow - await this.dbosExec.workflow(ro.registeredFunction as Workflow, wfParams, ...args); + await this.dbosExec.workflow(ro.registeredFunction as Workflow, wfParams, ...args); } }, }) diff --git a/src/scheduler/scheduler.ts b/src/scheduler/scheduler.ts index 6fd72a86e..3c8d16eed 100644 --- a/src/scheduler/scheduler.ts +++ b/src/scheduler/scheduler.ts @@ -168,7 +168,7 @@ class DetachableLoop { // We currently only support scheduled workflows if (this.scheduledMethod.workflowConfig) { // Execute the workflow - await this.dbosExec.workflow(this.scheduledMethod.registeredFunction as Workflow, wfParams, ...args); + await this.dbosExec.workflow(this.scheduledMethod.registeredFunction as Workflow, wfParams, ...args); } else { this.dbosExec.logger.error(`Function ${this.scheduledMethod.name} is @scheduled but not a workflow`); diff --git a/src/system_database.ts b/src/system_database.ts index 01e3d0311..3ce2d5b8b 100644 --- a/src/system_database.ts +++ b/src/system_database.ts @@ -234,7 +234,7 @@ export class PostgresSystemDatabase implements SystemDatabase { while (finishedCnt < totalSize) { let sqlStmt = `INSERT INTO ${DBOSExecutor.systemDBSchemaName}.workflow_inputs (workflow_uuid, inputs) VALUES `; let paramCnt = 1; - const values: any[] = []; + const values: unknown[] = []; const batchUUIDs: string[] = []; for (const [workflowUUID, args] of localBuffer) { finishedCnt++; diff --git a/src/testing/testing_runtime.ts b/src/testing/testing_runtime.ts index 96377e93b..5d41165ef 100644 --- a/src/testing/testing_runtime.ts +++ b/src/testing/testing_runtime.ts @@ -64,7 +64,7 @@ export interface TestingRuntime { setConfig(key: string, newValue: T): void; // User database operations. - queryUserDB(sql: string, ...params: any[]): Promise; // Execute a raw SQL query on the user database. + queryUserDB(sql: string, ...params: unknown[]): Promise; // Execute a raw SQL query on the user database. createUserSchema(): Promise; // Only valid if using TypeORM. Create tables based on the provided schema. dropUserSchema(): Promise; // Only valid if using TypeORM. Drop all tables created by createUserSchema(). @@ -159,20 +159,16 @@ export class TestingRuntimeImpl implements TestingRuntime { if (asyncWf) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access proxy[op.name] = op.txnConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => dbosExec.transaction(op.registeredFunction as Transaction, wfParams, ...args) + ? (...args: unknown[]) => dbosExec.transaction(op.registeredFunction as Transaction, wfParams, ...args) : op.workflowConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => dbosExec.workflow(op.registeredFunction as Workflow, wfParams, ...args) + ? (...args: unknown[]) => dbosExec.workflow(op.registeredFunction as Workflow, wfParams, ...args) : op.commConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => dbosExec.external(op.registeredFunction as Communicator, wfParams, ...args) + ? (...args: unknown[]) => dbosExec.external(op.registeredFunction as Communicator, wfParams, ...args) : undefined; } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access proxy[op.name] = op.workflowConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => dbosExec.workflow(op.registeredFunction as Workflow, wfParams, ...args).then((handle) => handle.getResult()) + ? (...args: unknown[]) => dbosExec.workflow(op.registeredFunction as Workflow, wfParams, ...args).then((handle) => handle.getResult()) : undefined; } } @@ -220,8 +216,7 @@ export class TestingRuntimeImpl implements TestingRuntime { return this.getDBOSExec().retrieveWorkflow(workflowUUID); } - async queryUserDB(sql: string, ...params: any[]): Promise { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + async queryUserDB(sql: string, ...params: unknown[]): Promise { return this.getDBOSExec().userDatabase.query(sql, ...params); } diff --git a/src/transaction.ts b/src/transaction.ts index b864c0c05..ae79f69e8 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -8,7 +8,7 @@ import { GlobalLogger as Logger } from "./telemetry/logs"; import { WorkflowContextDebug } from "./debugger/debug_workflow"; // Can we call it TransactionFunction -export type Transaction = (ctxt: TransactionContext, ...args: T) => Promise; +export type Transaction = (ctxt: TransactionContext, ...args: unknown[]) => Promise; export interface TransactionConfig { isolationLevel?: IsolationLevel; diff --git a/src/user_database.ts b/src/user_database.ts index e645edb33..de06eedcc 100644 --- a/src/user_database.ts +++ b/src/user_database.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ + import { Pool, PoolConfig, PoolClient, DatabaseError as PGDatabaseError, QueryResultRow } from "pg"; import { createUserDBSchema, userDBIndex, userDBSchema } from "../schemas/user_db_schema"; import { IsolationLevel, TransactionConfig } from "./transaction"; @@ -409,9 +409,7 @@ export class KnexUserDatabase implements UserDatabase { async queryWithClient(client: Knex, sql: string, ...uparams: T): Promise { const knexSql = sql.replace(/\$\d+/g, '?'); // Replace $1, $2... with ? - let params = uparams as any[]; - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - params = params.map(i => i === undefined ? null : i); // Set undefined parameters to null. + const params = uparams.map(i => i === undefined ? null : i); // Set undefined parameters to null. const rows = await client.raw(knexSql, params) as { rows: R[] }; return rows.rows; } diff --git a/src/workflow.ts b/src/workflow.ts index db3d6299b..836901a92 100644 --- a/src/workflow.ts +++ b/src/workflow.ts @@ -13,7 +13,7 @@ import { Span } from "@opentelemetry/sdk-trace-base"; import { HTTPRequest, DBOSContext, DBOSContextImpl } from './context'; import { getRegisteredOperations } from "./decorators"; -export type Workflow = (ctxt: WorkflowContext, ...args: T) => Promise; +export type Workflow = (ctxt: WorkflowContext, ...args: any[]) => Promise; // Utility type that removes the initial parameter of a function export type TailParameters any> = T extends (arg: any, ...args: infer P) => any ? P : never; @@ -62,9 +62,9 @@ export const StatusString = { export interface WorkflowContext extends DBOSContext { invoke(targetClass: T): WFInvokeFuncs; - startChildWorkflow(wf: Workflow, ...args: T): Promise>; - invokeChildWorkflow(wf: Workflow, ...args: T): Promise; - childWorkflow(wf: Workflow, ...args: T): Promise>; // Deprecated, calls startChildWorkflow + startChildWorkflow(wf: Workflow, ...args: unknown[]): Promise>; + invokeChildWorkflow(wf: Workflow, ...args: unknown[]): Promise; + childWorkflow(wf: Workflow, ...args: unknown[]): Promise>; // Deprecated, calls startChildWorkflow send>(destinationUUID: string, message: T, topic?: string): Promise; recv>(topic?: string, timeoutSeconds?: number): Promise; @@ -175,7 +175,7 @@ export class WorkflowContextImpl extends DBOSContextImpl implements WorkflowCont try { let sqlStmt = "INSERT INTO dbos.transaction_outputs (workflow_uuid, function_id, output, error, txn_id, txn_snapshot, created_at) VALUES "; let paramCnt = 1; - const values: any[] = []; + const values: unknown[] = []; for (const funcID of funcIDs) { // Capture output and also transaction snapshot information. // Initially, no txn_id because no queries executed. @@ -190,7 +190,6 @@ export class WorkflowContextImpl extends DBOSContextImpl implements WorkflowCont values.push(this.workflowUUID, funcID, JSON.stringify(output), JSON.stringify(null), txnSnapshot, createdAt); } this.logger.debug(sqlStmt); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument await this.#dbosExec.userDatabase.queryWithClient(client, sqlStmt, ...values); } catch (error) { if (this.#dbosExec.userDatabase.isKeyConflictError(error)) { @@ -243,19 +242,19 @@ export class WorkflowContextImpl extends DBOSContextImpl implements WorkflowCont * We pass in itself as a parent context and assign the child workflow with a deterministic UUID "this.workflowUUID-functionID". * We also pass in its own workflowUUID and function ID so the invoked handle is deterministic. */ - async startChildWorkflow(wf: Workflow, ...args: T): Promise> { + async startChildWorkflow(wf: Workflow, ...args: unknown[]): Promise> { // Note: cannot use invoke for childWorkflow because of potential recursive types on the workflow itself. const funcId = this.functionIDGetIncrement(); const childUUID: string = this.workflowUUID + "-" + funcId; return this.#dbosExec.internalWorkflow(wf, { parentCtx: this, workflowUUID: childUUID }, this.workflowUUID, funcId, ...args); } - async invokeChildWorkflow(wf: Workflow, ...args: T): Promise { + async invokeChildWorkflow(wf: Workflow, ...args: unknown[]): Promise { return this.startChildWorkflow(wf, ...args).then((handle) => handle.getResult()); } // Deprecated - async childWorkflow(wf: Workflow, ...args: T): Promise> { + async childWorkflow(wf: Workflow, ...args: unknown[]): Promise> { return this.startChildWorkflow(wf, ...args); } @@ -265,7 +264,7 @@ export class WorkflowContextImpl extends DBOSContextImpl implements WorkflowCont * If the transaction encounters a Postgres serialization error, retry it. * If it encounters any other error, throw it. */ - async transaction(txn: Transaction, ...args: T): Promise { + async transaction(txn: Transaction, ...args: unknown[]): Promise { const txnInfo = this.#dbosExec.transactionInfoMap.get(txn.name); if (txnInfo === undefined) { throw new DBOSNotRegisteredError(txn.name); @@ -376,7 +375,7 @@ export class WorkflowContextImpl extends DBOSContextImpl implements WorkflowCont * If it encounters any error, retry according to its configured retry policy until the maximum number of attempts is reached, then throw an DBOSError. * The communicator may execute many times, but once it is complete, it will not re-execute. */ - async external(commFn: Communicator, ...args: T): Promise { + async external(commFn: Communicator, ...args: unknown[]): Promise { const commInfo = this.#dbosExec.communicatorInfoMap.get(commFn.name); if (commInfo === undefined) { throw new DBOSNotRegisteredError(commFn.name); @@ -524,11 +523,9 @@ export class WorkflowContextImpl extends DBOSContextImpl implements WorkflowCont for (const op of ops) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access proxy[op.name] = op.txnConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => this.transaction(op.registeredFunction as Transaction, ...args) + ? (...args: unknown[]) => this.transaction(op.registeredFunction as Transaction, ...args) : op.commConfig - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - ? (...args: any[]) => this.external(op.registeredFunction as Communicator, ...args) + ? (...args: unknown[]) => this.external(op.registeredFunction as Communicator, ...args) : undefined; } return proxy as WFInvokeFuncs;