(
operation: Operation,
keyedData: Record<string, unknown>,
context: Record<string, unknown> = {},
)
| 504 | } |
| 505 | |
| 506 | private async executeOperation( |
| 507 | operation: Operation, |
| 508 | keyedData: Record<string, unknown>, |
| 509 | context: Record<string, unknown> = {}, |
| 510 | ): Promise<{ |
| 511 | successor: Operation | null; |
| 512 | status: 'resolve' | 'reject' | 'unknown'; |
| 513 | data: unknown; |
| 514 | options: Record<string, any> | null; |
| 515 | }> { |
| 516 | const logger = useLogger(); |
| 517 | |
| 518 | if (!this.operations.has(operation.type)) { |
| 519 | logger.warn(`Couldn't find operation ${operation.type}`); |
| 520 | |
| 521 | return { successor: null, status: 'unknown', data: null, options: null }; |
| 522 | } |
| 523 | |
| 524 | const handler = this.operations.get(operation.type)!; |
| 525 | |
| 526 | let optionData = keyedData; |
| 527 | |
| 528 | if (operation.type === 'log') { |
| 529 | optionData = redactObject( |
| 530 | keyedData, |
| 531 | { |
| 532 | keys: [ |
| 533 | ['**', 'headers', 'authorization'], |
| 534 | ['**', 'headers', 'cookie'], |
| 535 | ['**', 'query', 'access_token'], |
| 536 | ['**', 'payload', 'password'], |
| 537 | ['**', 'payload', 'token'], |
| 538 | ['**', 'payload', 'tfa_secret'], |
| 539 | ['**', 'payload', 'external_identifier'], |
| 540 | ['**', 'payload', 'auth_data'], |
| 541 | ['**', 'payload', 'credentials'], |
| 542 | ['**', 'payload', 'ai_openai_api_key'], |
| 543 | ['**', 'payload', 'ai_anthropic_api_key'], |
| 544 | ['**', 'payload', 'ai_google_api_key'], |
| 545 | ['**', 'payload', 'ai_openai_compatible_api_key'], |
| 546 | ], |
| 547 | }, |
| 548 | getRedactedString, |
| 549 | ); |
| 550 | } |
| 551 | |
| 552 | let options = operation.options; |
| 553 | |
| 554 | try { |
| 555 | options = applyOptionsData(options, optionData); |
| 556 | |
| 557 | let result = await handler(options, { |
| 558 | services, |
| 559 | env: useEnv(), |
| 560 | database: getDatabase(), |
| 561 | logger, |
| 562 | getSchema, |
| 563 | data: keyedData, |
no test coverage detected