quidproquo-actionprocessor-awslambda 0.0.263 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/awsNamingUtils.d.ts +1 -0
- package/lib/commonjs/awsNamingUtils.js +12 -1
- package/lib/commonjs/getActionProcessor/core/ai/aiModelMap.js +9 -9
- package/lib/commonjs/getActionProcessor/core/ai/getAiPromptActionProcessor.js +8 -41
- package/lib/commonjs/getActionProcessor/core/ai/getAiPromptStreamActionProcessor.js +14 -50
- package/lib/commonjs/getActionProcessor/core/ai/logic/aiStreamPartMappers.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/aiStreamPartMappers.js +57 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/index.d.ts +32 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/index.js +48 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamAbort.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamAbort.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamCustom.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamCustom.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamError.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamError.js +10 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamFilePart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamFilePart.js +12 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamFinish.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamFinish.js +11 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamFinishStep.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamFinishStep.js +11 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamPart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamPart.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamRaw.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamRaw.js +8 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningDelta.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningDelta.js +10 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningEnd.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningEnd.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningFilePart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningFilePart.js +12 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningStart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamReasoningStart.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamSourcePart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamSourcePart.js +16 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamStart.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamStart.js +8 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamStartStep.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamStartStep.js +8 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamTextDelta.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamTextDelta.js +10 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamTextEnd.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamTextEnd.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamTextStart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamTextStart.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalRequest.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalRequest.js +12 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalResponse.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalResponse.js +13 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolCall.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolCall.js +11 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolError.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolError.js +13 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolInputDelta.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolInputDelta.js +10 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolInputEnd.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolInputEnd.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolInputStart.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolInputStart.js +10 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolOutputDenied.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolOutputDenied.js +10 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolResult.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/mapAiStreamToolResult.js +12 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/prepareAiPromptCall.d.ts +19 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/prepareAiPromptCall.js +53 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/toAiStreamUsage.d.ts +6 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/toAiStreamUsage.js +9 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/toErrorMessage.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/toErrorMessage.js +11 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/toSdkMessages.d.ts +3 -0
- package/lib/commonjs/getActionProcessor/core/ai/logic/toSdkMessages.js +82 -0
- package/lib/commonjs/getActionProcessor/core/ai/types/aiSdkStreamPart.d.ts +5 -0
- package/lib/commonjs/getActionProcessor/core/ai/types/aiSdkStreamPart.js +2 -0
- package/lib/commonjs/getActionProcessor/core/ai/types/index.d.ts +1 -0
- package/lib/commonjs/getActionProcessor/core/ai/types/index.js +17 -0
- package/lib/commonjs/getActionProcessor/core/apiKeyValidation/getApiKeyValidationValidateActionProcessor.js +13 -2
- package/lib/commonjs/getActionProcessor/core/config/getConfigGetSecretActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/config/getConfigSetParameterActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/config/index.js +1 -2
- package/lib/commonjs/getActionProcessor/core/eventBus/getEventBusSendMessagesActionProcessor.js +15 -5
- package/lib/commonjs/getActionProcessor/core/file/getFileDeleteActionProcessor.js +17 -9
- package/lib/commonjs/getActionProcessor/core/file/getFileExistsActionProcessor.js +9 -1
- package/lib/commonjs/getActionProcessor/core/file/getFileGenerateTemporarySecureUrlActionProcessor.js +5 -0
- package/lib/commonjs/getActionProcessor/core/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +5 -0
- package/lib/commonjs/getActionProcessor/core/file/getFileIsColdStorageActionProcessor.js +13 -2
- package/lib/commonjs/getActionProcessor/core/file/getFileListDirectoryActionProcessor.js +16 -7
- package/lib/commonjs/getActionProcessor/core/file/getFileReadBinaryContentsActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/file/getFileStreamOpenActionProcessor.js +7 -2
- package/lib/commonjs/getActionProcessor/core/file/getFileWriteBinaryContentsActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/file/getFileWriteObjectJsonActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/file/getFileWriteTextContentsActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreDeleteActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreGetActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreGetAllActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreScanActionProcessor.js +12 -3
- package/lib/commonjs/getActionProcessor/core/keyValueStore/getKeyValueStoreUpdateActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/queue/getQueueSendMessageActionProcessor.js +16 -6
- package/lib/commonjs/getActionProcessor/core/system/getSystemExecuteStoryActionProcessor.js +5 -4
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryAssociateSoftwareTokenActionProcessor.d.ts +2 -0
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryAssociateSoftwareTokenActionProcessor.js +28 -0
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryChangePasswordActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryConfirmEmailVerificationActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryConfirmForgotPasswordActionProcessor.js +12 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryCreateUserActionProcessor.js +12 -3
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryDecodeAccessTokenActionProcessor.js +1 -1
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryForgotPasswordActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryGetUserAttributesByUserIdActionProcessor.js +9 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryGetUsersActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryGetUsersByAttributeActionProcessor.js +10 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryRefreshTokenActionProcessor.js +17 -3
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryRequestEmailVerificationActionProcessor.js +11 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectoryRespondToAuthChallengeActionProcessor.js +34 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectorySetPasswordActionProcessor.js +12 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/getUserDirectorySetUserAttributesActionProcessor.js +13 -2
- package/lib/commonjs/getActionProcessor/core/userDirectory/index.js +2 -1
- package/lib/commonjs/getActionProcessor/webserver/serviceFunction/getServiceFunctionExecuteActionProcessor.js +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +3 -0
- package/lib/commonjs/lambdaExtensions/getLogExtensionLayerPath.d.ts +10 -0
- package/lib/commonjs/lambdaExtensions/getLogExtensionLayerPath.js +20 -0
- package/lib/commonjs/lambdaExtensions/logExtensionPort.d.ts +1 -0
- package/lib/commonjs/lambdaExtensions/logExtensionPort.js +7 -0
- package/lib/commonjs/lambdaHandlers/getApiGatewayEventHandler.js +4 -8
- package/lib/commonjs/lambdaHandlers/getApiGatewayEventHandler_redirect.js +0 -2
- package/lib/commonjs/lambdaHandlers/helpers/getQpqLambdaRuntimeForEvent.js +2 -2
- package/lib/commonjs/lambdaHandlers/helpers/logger.d.ts +4 -1
- package/lib/commonjs/lambdaHandlers/helpers/logger.js +94 -36
- package/lib/commonjs/logic/cognito/associateSoftwareToken.d.ts +2 -0
- package/lib/commonjs/logic/cognito/associateSoftwareToken.js +28 -0
- package/lib/commonjs/logic/cognito/decodeValidJwt.js +2 -1
- package/lib/commonjs/logic/cognito/getUserAttributesBySub.d.ts +4 -0
- package/lib/commonjs/logic/cognito/getUserAttributesBySub.js +12 -2
- package/lib/commonjs/logic/cognito/utils/transformCognitoResponse.js +2 -0
- package/lib/commonjs/logic/cognito/verifySoftwareToken.d.ts +1 -0
- package/lib/commonjs/logic/cognito/verifySoftwareToken.js +28 -0
- package/lib/commonjs/logic/dynamo/qpqDynamoOrm/getDynamoTableIndexByConfigAndQuery.js +8 -2
- package/lib/commonjs/logic/s3/generatePresignedUploadUrl.js +8 -1
- package/lib/commonjs/logic/s3/objectExists.js +9 -3
- package/lib/esm/awsNamingUtils.d.ts +1 -0
- package/lib/esm/awsNamingUtils.js +10 -0
- package/lib/esm/getActionProcessor/core/ai/aiModelMap.js +9 -9
- package/lib/esm/getActionProcessor/core/ai/getAiPromptActionProcessor.js +12 -39
- package/lib/esm/getActionProcessor/core/ai/getAiPromptStreamActionProcessor.js +18 -47
- package/lib/esm/getActionProcessor/core/ai/logic/aiStreamPartMappers.d.ts +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/aiStreamPartMappers.js +54 -0
- package/lib/esm/getActionProcessor/core/ai/logic/index.d.ts +32 -0
- package/lib/esm/getActionProcessor/core/ai/logic/index.js +32 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamAbort.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamAbort.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamCustom.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamCustom.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamError.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamError.js +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamFilePart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamFilePart.js +8 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamFinish.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamFinish.js +7 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamFinishStep.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamFinishStep.js +7 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamPart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamPart.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamRaw.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamRaw.js +4 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningDelta.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningDelta.js +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningEnd.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningEnd.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningFilePart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningFilePart.js +8 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningStart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamReasoningStart.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamSourcePart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamSourcePart.js +12 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamStart.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamStart.js +4 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamStartStep.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamStartStep.js +4 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamTextDelta.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamTextDelta.js +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamTextEnd.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamTextEnd.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamTextStart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamTextStart.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalRequest.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalRequest.js +8 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalResponse.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolApprovalResponse.js +9 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolCall.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolCall.js +7 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolError.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolError.js +9 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolInputDelta.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolInputDelta.js +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolInputEnd.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolInputEnd.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolInputStart.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolInputStart.js +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolOutputDenied.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolOutputDenied.js +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolResult.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/mapAiStreamToolResult.js +8 -0
- package/lib/esm/getActionProcessor/core/ai/logic/prepareAiPromptCall.d.ts +19 -0
- package/lib/esm/getActionProcessor/core/ai/logic/prepareAiPromptCall.js +40 -0
- package/lib/esm/getActionProcessor/core/ai/logic/toAiStreamUsage.d.ts +6 -0
- package/lib/esm/getActionProcessor/core/ai/logic/toAiStreamUsage.js +5 -0
- package/lib/esm/getActionProcessor/core/ai/logic/toErrorMessage.d.ts +1 -0
- package/lib/esm/getActionProcessor/core/ai/logic/toErrorMessage.js +7 -0
- package/lib/esm/getActionProcessor/core/ai/logic/toSdkMessages.d.ts +3 -0
- package/lib/esm/getActionProcessor/core/ai/logic/toSdkMessages.js +78 -0
- package/lib/esm/getActionProcessor/core/ai/types/aiSdkStreamPart.d.ts +5 -0
- package/lib/esm/getActionProcessor/core/ai/types/aiSdkStreamPart.js +1 -0
- package/lib/esm/getActionProcessor/core/ai/types/index.d.ts +1 -0
- package/lib/esm/getActionProcessor/core/ai/types/index.js +1 -0
- package/lib/esm/getActionProcessor/core/apiKeyValidation/getApiKeyValidationValidateActionProcessor.js +13 -2
- package/lib/esm/getActionProcessor/core/config/getConfigGetSecretActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/config/getConfigSetParameterActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/config/index.js +0 -2
- package/lib/esm/getActionProcessor/core/eventBus/getEventBusSendMessagesActionProcessor.js +19 -9
- package/lib/esm/getActionProcessor/core/file/getFileDeleteActionProcessor.js +18 -10
- package/lib/esm/getActionProcessor/core/file/getFileExistsActionProcessor.js +10 -2
- package/lib/esm/getActionProcessor/core/file/getFileGenerateTemporarySecureUrlActionProcessor.js +6 -1
- package/lib/esm/getActionProcessor/core/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +6 -1
- package/lib/esm/getActionProcessor/core/file/getFileIsColdStorageActionProcessor.js +14 -3
- package/lib/esm/getActionProcessor/core/file/getFileListDirectoryActionProcessor.js +20 -11
- package/lib/esm/getActionProcessor/core/file/getFileReadBinaryContentsActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/file/getFileStreamOpenActionProcessor.js +8 -3
- package/lib/esm/getActionProcessor/core/file/getFileWriteBinaryContentsActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/file/getFileWriteObjectJsonActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/file/getFileWriteTextContentsActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreDeleteActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreGetActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreGetAllActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreQueryActionProcessor.js +12 -4
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreScanActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/keyValueStore/getKeyValueStoreUpdateActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/queue/getQueueSendMessageActionProcessor.js +20 -10
- package/lib/esm/getActionProcessor/core/system/getSystemExecuteStoryActionProcessor.js +1 -0
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryAssociateSoftwareTokenActionProcessor.d.ts +2 -0
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryAssociateSoftwareTokenActionProcessor.js +13 -0
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryChangePasswordActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryConfirmEmailVerificationActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryConfirmForgotPasswordActionProcessor.js +13 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryCreateUserActionProcessor.js +13 -4
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryDecodeAccessTokenActionProcessor.js +2 -2
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryForgotPasswordActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryGetUserAttributesByUserIdActionProcessor.js +10 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryGetUsersActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryGetUsersByAttributeActionProcessor.js +11 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryRefreshTokenActionProcessor.js +18 -4
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryRequestEmailVerificationActionProcessor.js +12 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryRespondToAuthChallengeActionProcessor.js +35 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectorySetPasswordActionProcessor.js +13 -3
- package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectorySetUserAttributesActionProcessor.js +14 -3
- package/lib/esm/getActionProcessor/core/userDirectory/index.js +2 -0
- package/lib/esm/getActionProcessor/webserver/serviceFunction/getServiceFunctionExecuteActionProcessor.js +2 -2
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/lambdaExtensions/getLogExtensionLayerPath.d.ts +10 -0
- package/lib/esm/lambdaExtensions/getLogExtensionLayerPath.js +13 -0
- package/lib/esm/lambdaExtensions/logExtensionPort.d.ts +1 -0
- package/lib/esm/lambdaExtensions/logExtensionPort.js +4 -0
- package/lib/esm/lambdaHandlers/getApiGatewayEventHandler.js +4 -8
- package/lib/esm/lambdaHandlers/getApiGatewayEventHandler_redirect.js +0 -2
- package/lib/esm/lambdaHandlers/helpers/getQpqLambdaRuntimeForEvent.js +1 -1
- package/lib/esm/lambdaHandlers/helpers/logger.d.ts +4 -1
- package/lib/esm/lambdaHandlers/helpers/logger.js +94 -38
- package/lib/esm/logic/cognito/associateSoftwareToken.d.ts +2 -0
- package/lib/esm/logic/cognito/associateSoftwareToken.js +15 -0
- package/lib/esm/logic/cognito/decodeValidJwt.js +2 -1
- package/lib/esm/logic/cognito/getUserAttributesBySub.d.ts +4 -0
- package/lib/esm/logic/cognito/getUserAttributesBySub.js +10 -1
- package/lib/esm/logic/cognito/utils/transformCognitoResponse.js +2 -0
- package/lib/esm/logic/cognito/verifySoftwareToken.d.ts +1 -0
- package/lib/esm/logic/cognito/verifySoftwareToken.js +15 -0
- package/lib/esm/logic/dynamo/qpqDynamoOrm/getDynamoTableIndexByConfigAndQuery.js +7 -2
- package/lib/esm/logic/s3/generatePresignedUploadUrl.js +8 -1
- package/lib/esm/logic/s3/objectExists.js +8 -3
- package/lib/extension-layer/extensions/qpq-log-extension +2 -0
- package/lib/extension-layer/qpq-log-extension/index.js +58 -0
- package/package.json +10 -7
- package/lib/commonjs/getActionProcessor/core/config/getConfigGetGlobalActionProcessor.d.ts +0 -2
- package/lib/commonjs/getActionProcessor/core/config/getConfigGetGlobalActionProcessor.js +0 -25
- package/lib/esm/getActionProcessor/core/config/getConfigGetGlobalActionProcessor.d.ts +0 -2
- package/lib/esm/getActionProcessor/core/config/getConfigGetGlobalActionProcessor.js +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectoryGetUserAttributesByUserIdErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { getUserAttributesBySub } from '../../../logic/cognito/getUserAttributesBySub';
|
|
@@ -7,8 +7,15 @@ const getProcessGetUserAttributesByUserId = (qpqConfig) => {
|
|
|
7
7
|
return async ({ userDirectoryName, userId }, session) => {
|
|
8
8
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
9
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
try {
|
|
11
|
+
const userAttributes = await getUserAttributesBySub(userPoolId, region, userId);
|
|
12
|
+
return actionResult(userAttributes);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return actionResultErrorFromCaughtError(error, {
|
|
16
|
+
USER_NOT_FOUND: () => actionResultError(UserDirectoryGetUserAttributesByUserIdErrorTypeEnum.UserNotFound, 'No user found for this userId'),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
12
19
|
};
|
|
13
20
|
};
|
|
14
21
|
export const getUserDirectoryGetUserAttributesByUserIdActionProcessor = async (qpqConfig) => ({
|
package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryGetUsersActionProcessor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectoryGetUsersErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { listPagedUsers } from '../../../logic/cognito/listPagedUsers';
|
|
@@ -7,8 +7,16 @@ const getProcessGetUsers = (qpqConfig) => {
|
|
|
7
7
|
return async ({ userDirectoryName, nextPageKey }, session) => {
|
|
8
8
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
9
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
try {
|
|
11
|
+
const userAttributes = await listPagedUsers(userPoolId, region, nextPageKey);
|
|
12
|
+
return actionResult(userAttributes);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return actionResultErrorFromCaughtError(error, {
|
|
16
|
+
InvalidParameterException: () => actionResultError(UserDirectoryGetUsersErrorTypeEnum.InvalidPageKey, 'The supplied page key is invalid'),
|
|
17
|
+
TooManyRequestsException: () => actionResultError(UserDirectoryGetUsersErrorTypeEnum.LimitExceeded, 'Too many requests, please try again later'),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
12
20
|
};
|
|
13
21
|
};
|
|
14
22
|
export const getUserDirectoryGetUsersActionProcessor = async (qpqConfig) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectoryGetUsersByAttributeErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { listPagedUsersByAttribute } from '../../../logic/cognito/listPagedUsersByAttribute';
|
|
@@ -7,8 +7,16 @@ const getProcessGetUsersByAttribute = (qpqConfig) => {
|
|
|
7
7
|
return async ({ userDirectoryName, attribueName, attribueValue, limit, nextPageKey }, _session) => {
|
|
8
8
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
9
9
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
try {
|
|
11
|
+
const userAttributes = await listPagedUsersByAttribute(userPoolId, region, attribueName, attribueValue, limit, nextPageKey);
|
|
12
|
+
return actionResult(userAttributes);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return actionResultErrorFromCaughtError(error, {
|
|
16
|
+
InvalidParameterException: () => actionResultError(UserDirectoryGetUsersByAttributeErrorTypeEnum.InvalidSearchParameters, 'The search attribute, value, limit, or page key is invalid'),
|
|
17
|
+
TooManyRequestsException: () => actionResultError(UserDirectoryGetUsersByAttributeErrorTypeEnum.LimitExceeded, 'Too many requests, please try again later'),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
12
20
|
};
|
|
13
21
|
};
|
|
14
22
|
export const getUserDirectoryGetUsersByAttributeActionProcessor = async (qpqConfig) => ({
|
package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectoryRefreshTokenActionProcessor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, actionResultError,
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectoryRefreshTokenErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolClientIdFromConfig, getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { refreshToken as cognitoRefreshToken } from '../../../logic/cognito/refreshToken';
|
|
@@ -9,10 +9,24 @@ const getProcessRefreshToken = (qpqConfig) => {
|
|
|
9
9
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
10
10
|
const userPoolClientId = await getExportedValue(getCFExportNameUserPoolClientIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
11
11
|
if (!session.decodedAccessToken || !session.decodedAccessToken.username) {
|
|
12
|
-
return actionResultError(
|
|
12
|
+
return actionResultError(UserDirectoryRefreshTokenErrorTypeEnum.Unauthorized, 'Invalid accessToken');
|
|
13
|
+
}
|
|
14
|
+
// NOTE: we intentionally do NOT gate on decodedAccessToken.wasValid here.
|
|
15
|
+
// Refresh must accept a signature-valid-but-expired access token (that's the
|
|
16
|
+
// point of refreshing), and wasValid folds in the expiry check. The trust
|
|
17
|
+
// anchor for this operation is the refreshToken itself: Cognito's
|
|
18
|
+
// REFRESH_TOKEN_AUTH validates it and the SECRET_HASH binds it to `username`,
|
|
19
|
+
// so a forged/unverified username cannot mint tokens for another user.
|
|
20
|
+
try {
|
|
21
|
+
const authResponse = await cognitoRefreshToken(userPoolId, userPoolClientId, qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig), session.decodedAccessToken.username, refreshToken);
|
|
22
|
+
return actionResult(authResponse);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return actionResultErrorFromCaughtError(error, {
|
|
26
|
+
NotAuthorizedException: () => actionResultError(UserDirectoryRefreshTokenErrorTypeEnum.Unauthorized, 'Refresh token is invalid or has expired'),
|
|
27
|
+
TooManyRequestsException: () => actionResultError(UserDirectoryRefreshTokenErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
28
|
+
});
|
|
13
29
|
}
|
|
14
|
-
const authResponse = await cognitoRefreshToken(userPoolId, userPoolClientId, qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig), session.decodedAccessToken.username, refreshToken);
|
|
15
|
-
return actionResult(authResponse);
|
|
16
30
|
};
|
|
17
31
|
};
|
|
18
32
|
export const getUserDirectoryRefreshTokenActionProcessor = async (qpqConfig) => ({
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectoryRequestEmailVerificationErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { requestEmailVerificationCode } from '../../../logic/cognito/requestEmailVerificationCode';
|
|
4
4
|
const getProcessRequestEmailVerification = (qpqConfig) => {
|
|
5
5
|
return async ({ userDirectoryName, accessToken }) => {
|
|
6
6
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
try {
|
|
8
|
+
await requestEmailVerificationCode(region, accessToken);
|
|
9
|
+
return actionResult(void 0);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
return actionResultErrorFromCaughtError(error, {
|
|
13
|
+
NotAuthorizedException: () => actionResultError(UserDirectoryRequestEmailVerificationErrorTypeEnum.Unauthorized, 'Access token is invalid or has expired'),
|
|
14
|
+
LimitExceededException: () => actionResultError(UserDirectoryRequestEmailVerificationErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
15
|
+
CodeDeliveryFailureException: () => actionResultError(UserDirectoryRequestEmailVerificationErrorTypeEnum.CodeDeliveryFailed, 'Could not deliver the verification code'),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
9
18
|
};
|
|
10
19
|
};
|
|
11
20
|
export const getUserDirectoryRequestEmailVerificationActionProcessor = async (qpqConfig) => ({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, AuthenticateUserChallenge, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, AuthenticateUserChallenge, UserDirectoryActionType, UserDirectoryRespondToAuthChallengeErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { ChallengeNameType } from '@aws-sdk/client-cognito-identity-provider';
|
|
4
4
|
import { getCFExportNameUserPoolClientIdFromConfig, getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
5
5
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
6
6
|
import { respondToAuthChallengeChallenge } from '../../../logic/cognito/respondToAuthChallengeChallenge';
|
|
7
|
+
import { verifySoftwareToken } from '../../../logic/cognito/verifySoftwareToken';
|
|
7
8
|
const anyAuthChallengeToCognitoAttributes = (authChallenge) => {
|
|
8
9
|
switch (authChallenge.challenge) {
|
|
9
10
|
case AuthenticateUserChallenge.NEW_PASSWORD_REQUIRED:
|
|
@@ -14,6 +15,14 @@ const anyAuthChallengeToCognitoAttributes = (authChallenge) => {
|
|
|
14
15
|
return {
|
|
15
16
|
ANSWER: JSON.stringify(authChallenge.challengeAnswer),
|
|
16
17
|
};
|
|
18
|
+
case AuthenticateUserChallenge.SOFTWARE_TOKEN_MFA:
|
|
19
|
+
return {
|
|
20
|
+
SOFTWARE_TOKEN_MFA_CODE: authChallenge.mfaCode,
|
|
21
|
+
};
|
|
22
|
+
// MFA_SETUP completes with just USERNAME/SESSION — the TOTP code is consumed
|
|
23
|
+
// by the preceding VerifySoftwareToken call, not by RespondToAuthChallenge.
|
|
24
|
+
case AuthenticateUserChallenge.MFA_SETUP:
|
|
25
|
+
return {};
|
|
17
26
|
default:
|
|
18
27
|
return {};
|
|
19
28
|
}
|
|
@@ -24,6 +33,10 @@ const anyAuthChallengeToCognitoChallengeName = (authChallenge) => {
|
|
|
24
33
|
return ChallengeNameType.NEW_PASSWORD_REQUIRED;
|
|
25
34
|
case AuthenticateUserChallenge.CUSTOM_CHALLENGE:
|
|
26
35
|
return ChallengeNameType.CUSTOM_CHALLENGE;
|
|
36
|
+
case AuthenticateUserChallenge.SOFTWARE_TOKEN_MFA:
|
|
37
|
+
return ChallengeNameType.SOFTWARE_TOKEN_MFA;
|
|
38
|
+
case AuthenticateUserChallenge.MFA_SETUP:
|
|
39
|
+
return ChallengeNameType.MFA_SETUP;
|
|
27
40
|
default:
|
|
28
41
|
throw new Error(`Unknown challenge`);
|
|
29
42
|
}
|
|
@@ -33,8 +46,27 @@ const getProcessRespondToAuthChallenge = (qpqConfig) => {
|
|
|
33
46
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
34
47
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
35
48
|
const userPoolClientId = await getExportedValue(getCFExportNameUserPoolClientIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
// MFA_SETUP must verify the TOTP code first; Cognito returns a fresh session
|
|
50
|
+
// that is then used to complete the challenge and issue tokens.
|
|
51
|
+
let session = authChallenge.session;
|
|
52
|
+
try {
|
|
53
|
+
if (authChallenge.challenge === AuthenticateUserChallenge.MFA_SETUP) {
|
|
54
|
+
session = await verifySoftwareToken(region, session, authChallenge.mfaCode);
|
|
55
|
+
}
|
|
56
|
+
const response = await respondToAuthChallengeChallenge(userPoolId, userPoolClientId, region, authChallenge.username, session, anyAuthChallengeToCognitoChallengeName(authChallenge), anyAuthChallengeToCognitoAttributes(authChallenge));
|
|
57
|
+
return actionResult(response);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return actionResultErrorFromCaughtError(error, {
|
|
61
|
+
CodeMismatchException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.InvalidCode, 'The supplied code is incorrect'),
|
|
62
|
+
EnableSoftwareTokenMFAException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.InvalidCode, 'The supplied code is incorrect'),
|
|
63
|
+
ExpiredCodeException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.ExpiredCode, 'The supplied code has expired'),
|
|
64
|
+
InvalidPasswordException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.InvalidNewPassword, 'New password does not meet the password policy'),
|
|
65
|
+
NotAuthorizedException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.Unauthorized, 'The challenge session is invalid or has expired'),
|
|
66
|
+
LimitExceededException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
67
|
+
TooManyRequestsException: () => actionResultError(UserDirectoryRespondToAuthChallengeErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
38
70
|
};
|
|
39
71
|
};
|
|
40
72
|
export const getUserDirectoryRespondToAuthChallengeActionProcessor = async (qpqConfig) => ({
|
package/lib/esm/getActionProcessor/core/userDirectory/getUserDirectorySetPasswordActionProcessor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectorySetPasswordErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
@@ -9,8 +9,18 @@ const getProcessSetPassword = (qpqConfig) => {
|
|
|
9
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
10
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
11
11
|
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
try {
|
|
13
|
+
await setUserPassword(region, userPoolId, resolvedUsername, newPassword);
|
|
14
|
+
return actionResult(void 0);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return actionResultErrorFromCaughtError(error, {
|
|
18
|
+
UserNotFoundException: () => actionResultError(UserDirectorySetPasswordErrorTypeEnum.UserNotFound, 'No account found for this user'),
|
|
19
|
+
InvalidPasswordException: () => actionResultError(UserDirectorySetPasswordErrorTypeEnum.InvalidNewPassword, 'Password does not meet the password policy'),
|
|
20
|
+
LimitExceededException: () => actionResultError(UserDirectorySetPasswordErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
21
|
+
TooManyRequestsException: () => actionResultError(UserDirectorySetPasswordErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
14
24
|
};
|
|
15
25
|
};
|
|
16
26
|
export const getUserDirectorySetPasswordActionProcessor = async (qpqConfig) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, UserDirectoryActionType, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, UserDirectoryActionType, UserDirectorySetUserAttributesErrorTypeEnum, } from 'quidproquo-core';
|
|
3
3
|
import { getCFExportNameUserPoolIdFromConfig } from '../../../awsNamingUtils';
|
|
4
4
|
import { getExportedValue } from '../../../logic/cloudformation/getExportedValue';
|
|
5
5
|
import { resolveUsernameByPreferredUsername } from '../../../logic/cognito/resolveUsernameByPreferredUsername';
|
|
@@ -9,8 +9,19 @@ const getProcessSetUserAttributes = (qpqConfig) => {
|
|
|
9
9
|
const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
10
10
|
const userPoolId = await getExportedValue(getCFExportNameUserPoolIdFromConfig(userDirectoryName, qpqConfig), region);
|
|
11
11
|
const resolvedUsername = await resolveUsernameByPreferredUsername(userPoolId, region, username);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
try {
|
|
13
|
+
await setUserAttributes(userPoolId, region, resolvedUsername, userAttributes);
|
|
14
|
+
return actionResult(void 0);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return actionResultErrorFromCaughtError(error, {
|
|
18
|
+
UserNotFoundException: () => actionResultError(UserDirectorySetUserAttributesErrorTypeEnum.UserNotFound, 'No account found for this user'),
|
|
19
|
+
InvalidParameterException: () => actionResultError(UserDirectorySetUserAttributesErrorTypeEnum.InvalidAttributes, 'One or more attributes are invalid'),
|
|
20
|
+
AliasExistsException: () => actionResultError(UserDirectorySetUserAttributesErrorTypeEnum.AliasExists, 'That email or phone number is already in use'),
|
|
21
|
+
LimitExceededException: () => actionResultError(UserDirectorySetUserAttributesErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
22
|
+
TooManyRequestsException: () => actionResultError(UserDirectorySetUserAttributesErrorTypeEnum.LimitExceeded, 'Too many attempts, please try again later'),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
14
25
|
};
|
|
15
26
|
};
|
|
16
27
|
export const getUserDirectorySetUserAttributesActionProcessor = async (qpqConfig) => ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getUserDirectoryAssociateSoftwareTokenActionProcessor } from './getUserDirectoryAssociateSoftwareTokenActionProcessor';
|
|
1
2
|
import { getUserDirectoryAuthenticateUserActionProcessor } from './getUserDirectoryAuthenticateUserActionProcessor';
|
|
2
3
|
import { getUserDirectoryChangePasswordActionProcessor } from './getUserDirectoryChangePasswordActionProcessor';
|
|
3
4
|
import { getUserDirectoryConfirmEmailVerificationActionProcessor } from './getUserDirectoryConfirmEmailVerificationActionProcessor';
|
|
@@ -17,6 +18,7 @@ import { getUserDirectorySetAccessTokenActionProcessor } from './getUserDirector
|
|
|
17
18
|
import { getUserDirectorySetPasswordActionProcessor } from './getUserDirectorySetPasswordActionProcessor';
|
|
18
19
|
import { getUserDirectorySetUserAttributesActionProcessor } from './getUserDirectorySetUserAttributesActionProcessor';
|
|
19
20
|
export const getUserDirectoryActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
21
|
+
...(await getUserDirectoryAssociateSoftwareTokenActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
20
22
|
...(await getUserDirectoryAuthenticateUserActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
21
23
|
...(await getUserDirectoryChangePasswordActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
22
24
|
...(await getUserDirectoryConfirmEmailVerificationActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { qpqConfigAwsUtils } from 'quidproquo-config-aws';
|
|
2
|
-
import { actionResult, actionResultError, qpqCoreUtils, } from 'quidproquo-core';
|
|
2
|
+
import { actionResult, actionResultError, qpqCoreUtils, toCrossServiceSession, } from 'quidproquo-core';
|
|
3
3
|
import { ServiceFunctionActionType } from 'quidproquo-webserver';
|
|
4
4
|
import { getConfigRuntimeResourceName } from '../../../awsNamingUtils';
|
|
5
5
|
import { executeLambdaByName } from '../../../logic/lambda/executeLambdaByName';
|
|
@@ -13,7 +13,7 @@ const getProcessExecute = (qpqConfig) => {
|
|
|
13
13
|
const serviceFunctionEvent = {
|
|
14
14
|
functionName: functionName,
|
|
15
15
|
payload: payload,
|
|
16
|
-
storySession: session,
|
|
16
|
+
storySession: toCrossServiceSession(session),
|
|
17
17
|
};
|
|
18
18
|
const result = await executeLambdaByName(awsFunctionName, region, serviceFunctionEvent, isAsync);
|
|
19
19
|
if (!result) {
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
|
@@ -9,3 +9,6 @@ export * from './logic';
|
|
|
9
9
|
export * from './logic/cache/memoFunc';
|
|
10
10
|
export * from './logic/parametersManager/getParameter';
|
|
11
11
|
export * from './logic/parametersManager/getParameters';
|
|
12
|
+
// Log extension layer path + handler port. NOTE: never export the extension
|
|
13
|
+
// entry (./lambdaExtensions/qpqLogExtension) -- it self-executes on import.
|
|
14
|
+
export * from './lambdaExtensions/getLogExtensionLayerPath';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute path to the built qpq-log-extension layer directory (contains the
|
|
3
|
+
* `extensions/` folder). Produced by scripts/buildLogExtensionLayer.mjs and
|
|
4
|
+
* shipped under lib/extension-layer. Used by the CDK layer construct as the
|
|
5
|
+
* LayerVersion asset source.
|
|
6
|
+
*
|
|
7
|
+
* Resolved relative to this compiled file: lib/<format>/lambdaExtensions/<this>
|
|
8
|
+
* -> ../../extension-layer.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getLogExtensionLayerPath: () => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Absolute path to the built qpq-log-extension layer directory (contains the
|
|
4
|
+
* `extensions/` folder). Produced by scripts/buildLogExtensionLayer.mjs and
|
|
5
|
+
* shipped under lib/extension-layer. Used by the CDK layer construct as the
|
|
6
|
+
* LayerVersion asset source.
|
|
7
|
+
*
|
|
8
|
+
* Resolved relative to this compiled file: lib/<format>/lambdaExtensions/<this>
|
|
9
|
+
* -> ../../extension-layer.
|
|
10
|
+
*/
|
|
11
|
+
export const getLogExtensionLayerPath = () => {
|
|
12
|
+
return path.resolve(__dirname, '..', '..', 'extension-layer');
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOG_EXTENSION_PORT = 9009;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { QpqRuntimeType } from 'quidproquo-core';
|
|
2
2
|
import { getApiGatewayApiEventEventProcessor } from '../getActionProcessor';
|
|
3
3
|
import { getQpqLambdaRuntimeForEvent } from './helpers/getQpqLambdaRuntimeForEvent';
|
|
4
|
-
export const getApiGatewayEventHandler = (dynamicModuleLoader, qpqConfig) => getQpqLambdaRuntimeForEvent(QpqRuntimeType.API, (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
depth: 0,
|
|
9
|
-
context: {},
|
|
10
|
-
};
|
|
11
|
-
}, getApiGatewayApiEventEventProcessor, dynamicModuleLoader, qpqConfig);
|
|
4
|
+
export const getApiGatewayEventHandler = (dynamicModuleLoader, qpqConfig) => getQpqLambdaRuntimeForEvent(QpqRuntimeType.API, () => ({
|
|
5
|
+
depth: 0,
|
|
6
|
+
context: {},
|
|
7
|
+
}), getApiGatewayApiEventEventProcessor, dynamicModuleLoader, qpqConfig);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const apiGatewayEventHandler_redirect = async (event, context) => {
|
|
2
|
-
console.log('event: ', JSON.stringify(event, null, 2));
|
|
3
|
-
console.log('process.env: ', JSON.stringify(process.env, null, 2));
|
|
4
2
|
const redirectConfig = JSON.parse(process.env.redirectConfig);
|
|
5
3
|
// For direct urls ~ Go straight to the url
|
|
6
4
|
let redirectUrl = redirectConfig.redirectUrl;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCustomActionActionProcessor } from 'quidproquo-actionprocessor-
|
|
1
|
+
import { getCustomActionActionProcessor } from 'quidproquo-actionprocessor-js';
|
|
2
2
|
import { askProcessEvent, createRuntime, } from 'quidproquo-core';
|
|
3
3
|
import { getAwsActionProcessors } from '../../getActionProcessor';
|
|
4
4
|
import { dynamicModuleLoaderWarmer } from './dynamicModuleLoaderWarmer';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { QPQConfig, QpqLogger, StoryResult } from 'quidproquo-core';
|
|
2
|
-
|
|
2
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
3
|
+
export declare const storyLogger: (result: StoryResult<any>, bucketName: string, s3Client: S3Client) => Promise<void>;
|
|
3
4
|
export declare const storyLoggerFs: (result: StoryResult<any>) => Promise<void>;
|
|
4
5
|
export declare const moveLogsToPerminateStorage: (bucketName: string, region: string) => Promise<void>;
|
|
6
|
+
export declare const getS3Logger: (qpqConfig: QPQConfig) => QpqLogger;
|
|
7
|
+
export declare const getS3LoggerViaExtension: (qpqConfig: QPQConfig) => QpqLogger;
|
|
5
8
|
export declare const getLogger: (qpqConfig: QPQConfig) => QpqLogger;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { LogActionType, qpqCoreUtils } from 'quidproquo-core';
|
|
1
|
+
import { LogActionType, QPQ_LOGS_STORAGE_DRIVE_NAME, qpqCoreUtils } from 'quidproquo-core';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
|
5
5
|
import { getConfigRuntimeResourceName } from '../../awsNamingUtils';
|
|
6
|
+
import { LOG_EXTENSION_PORT } from '../../lambdaExtensions/logExtensionPort';
|
|
6
7
|
const tempDirectory = '/tmp/qpqlogs';
|
|
7
8
|
import { getAwsServiceAccountInfoByDeploymentInfo, getAwsServiceAccountInfoConfig } from 'quidproquo-config-aws';
|
|
8
9
|
import { filterLogHistoryByActionTypes } from 'quidproquo-core';
|
|
9
|
-
export const storyLogger = async (result, bucketName,
|
|
10
|
+
export const storyLogger = async (result, bucketName, s3Client) => {
|
|
10
11
|
try {
|
|
11
|
-
const s3Client = new S3Client({ region });
|
|
12
12
|
const commandParams = {
|
|
13
13
|
Key: `${result.correlation}.json`,
|
|
14
14
|
Bucket: bucketName,
|
|
@@ -37,11 +37,12 @@ export const moveLogsToPerminateStorage = async (bucketName, region) => {
|
|
|
37
37
|
try {
|
|
38
38
|
await fs.promises.mkdir(tempDirectory, { recursive: true });
|
|
39
39
|
const files = await fs.promises.readdir(tempDirectory);
|
|
40
|
+
const s3Client = new S3Client({ region });
|
|
40
41
|
for (const file of files) {
|
|
41
42
|
const filePath = path.join(tempDirectory, file);
|
|
42
43
|
const data = await fs.promises.readFile(filePath, 'utf-8');
|
|
43
44
|
const result = JSON.parse(data);
|
|
44
|
-
await storyLogger(result, bucketName,
|
|
45
|
+
await storyLogger(result, bucketName, s3Client);
|
|
45
46
|
await fs.promises.unlink(filePath);
|
|
46
47
|
console.log(`Moved log file [${file}] to S3 and deleted from temporary directory`);
|
|
47
48
|
}
|
|
@@ -51,49 +52,51 @@ export const moveLogsToPerminateStorage = async (bucketName, region) => {
|
|
|
51
52
|
console.error(error);
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const service = awsSettings.logServiceName;
|
|
55
|
+
const noopLogger = {
|
|
56
|
+
enableLogs: async () => { },
|
|
57
|
+
log: () => { },
|
|
58
|
+
waitToFinishWriting: async () => { },
|
|
59
|
+
moveToPermanentStorage: async () => { },
|
|
60
|
+
};
|
|
61
|
+
// Resolves which S3 bucket (and its region) story logs go to for this config.
|
|
62
|
+
const resolveLogTarget = (qpqConfig) => {
|
|
63
|
+
const service = getAwsServiceAccountInfoConfig(qpqConfig).logServiceName;
|
|
66
64
|
const application = qpqCoreUtils.getApplicationName(qpqConfig);
|
|
67
65
|
const environment = qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig);
|
|
68
66
|
const feature = qpqCoreUtils.getApplicationModuleFeature(qpqConfig);
|
|
69
|
-
|
|
70
|
-
const bucketName = getConfigRuntimeResourceName('qpq-logs', application, service, environment, feature);
|
|
71
|
-
// Where is this bucket?
|
|
67
|
+
const bucketName = getConfigRuntimeResourceName(QPQ_LOGS_STORAGE_DRIVE_NAME, application, service, environment, feature);
|
|
72
68
|
const regionForBucket = getAwsServiceAccountInfoByDeploymentInfo(qpqConfig, service, environment, feature, application).awsRegion;
|
|
69
|
+
return { bucketName, regionForBucket };
|
|
70
|
+
};
|
|
71
|
+
// Shared plumbing for both loggers: defers each log to a microtask, applies the
|
|
72
|
+
// disabled-correlation history filter, and tracks the promises so
|
|
73
|
+
// waitToFinishWriting can await them. Only `ship` (how a log reaches S3) differs.
|
|
74
|
+
const createBufferedLogger = (bucketName, regionForBucket, ship) => {
|
|
73
75
|
const logs = [];
|
|
74
76
|
let disabledLogCorrelations = [];
|
|
75
77
|
return {
|
|
76
78
|
enableLogs: async (enable, reason, correlation) => {
|
|
77
|
-
|
|
78
|
-
disabledLogCorrelations
|
|
79
|
-
|
|
80
|
-
else {
|
|
81
|
-
disabledLogCorrelations = disabledLogCorrelations.filter((dlc) => dlc !== correlation);
|
|
82
|
-
}
|
|
79
|
+
disabledLogCorrelations = enable
|
|
80
|
+
? disabledLogCorrelations.filter((dlc) => dlc !== correlation)
|
|
81
|
+
: [...disabledLogCorrelations, correlation];
|
|
83
82
|
},
|
|
84
|
-
log:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
log: (result) => {
|
|
84
|
+
// Defer all work (including JSON.stringify) to a microtask so the caller is not blocked.
|
|
85
|
+
const promise = Promise.resolve()
|
|
86
|
+
.then(() => {
|
|
87
|
+
const modifyableResult = !disabledLogCorrelations.includes(result.correlation)
|
|
88
|
+
? result
|
|
89
|
+
: {
|
|
90
|
+
...result,
|
|
91
|
+
history: filterLogHistoryByActionTypes(result.history, [
|
|
92
|
+
LogActionType.Create,
|
|
93
|
+
LogActionType.TemplateLiteral,
|
|
94
|
+
LogActionType.DisableEventHistory,
|
|
95
|
+
]),
|
|
96
|
+
};
|
|
97
|
+
return ship(modifyableResult);
|
|
98
|
+
})
|
|
99
|
+
.catch((e) => {
|
|
97
100
|
console.log('Failed to log story result to S3', JSON.stringify(e, null, 2));
|
|
98
101
|
});
|
|
99
102
|
logs.push(promise);
|
|
@@ -106,3 +109,56 @@ export const getLogger = (qpqConfig) => {
|
|
|
106
109
|
},
|
|
107
110
|
};
|
|
108
111
|
};
|
|
112
|
+
// Logs straight to S3: the handler awaits the PutObject itself. Simple and fully
|
|
113
|
+
// durable, but the invoke waits on S3. No extension required.
|
|
114
|
+
export const getS3Logger = (qpqConfig) => {
|
|
115
|
+
const { bucketName, regionForBucket } = resolveLogTarget(qpqConfig);
|
|
116
|
+
const s3Client = new S3Client({ region: regionForBucket });
|
|
117
|
+
return createBufferedLogger(bucketName, regionForBucket, (result) => storyLogger(result, bucketName, s3Client));
|
|
118
|
+
};
|
|
119
|
+
// Logs via the qpq-log-extension: a fast local HTTP POST hands the log off so the
|
|
120
|
+
// response is not blocked on S3. Falls back to a direct S3 write if the extension
|
|
121
|
+
// is unreachable, so a log is never silently dropped.
|
|
122
|
+
export const getS3LoggerViaExtension = (qpqConfig) => {
|
|
123
|
+
const { bucketName, regionForBucket } = resolveLogTarget(qpqConfig);
|
|
124
|
+
const s3Client = new S3Client({ region: regionForBucket });
|
|
125
|
+
const sendToExtension = async (result) => {
|
|
126
|
+
const res = await fetch(`http://127.0.0.1:${LOG_EXTENSION_PORT}/log`, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: { 'Content-Type': 'application/json' },
|
|
129
|
+
body: JSON.stringify({
|
|
130
|
+
bucketName,
|
|
131
|
+
region: regionForBucket,
|
|
132
|
+
key: `${result.correlation}.json`,
|
|
133
|
+
body: JSON.stringify(result),
|
|
134
|
+
storageClass: 'INTELLIGENT_TIERING',
|
|
135
|
+
}),
|
|
136
|
+
});
|
|
137
|
+
if (!res.ok) {
|
|
138
|
+
throw new Error(`extension responded ${res.status}`);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
return createBufferedLogger(bucketName, regionForBucket, async (result) => {
|
|
142
|
+
try {
|
|
143
|
+
await sendToExtension(result);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
console.log(`qpq-log-extension unreachable, writing [${result.correlation}] to S3 directly:`, error);
|
|
147
|
+
await storyLogger(result, bucketName, s3Client);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
export const getLogger = (qpqConfig) => {
|
|
152
|
+
const awsSettings = getAwsServiceAccountInfoConfig(qpqConfig);
|
|
153
|
+
// If we have no log service, just return nothing.
|
|
154
|
+
if (!awsSettings.logServiceName || awsSettings.disableLogs || process.env.storageDriveName === QPQ_LOGS_STORAGE_DRIVE_NAME) {
|
|
155
|
+
return noopLogger;
|
|
156
|
+
}
|
|
157
|
+
// instantLogs forces the synchronous direct-to-S3 path, bypassing the extension.
|
|
158
|
+
if (awsSettings.instantLogs) {
|
|
159
|
+
return getS3Logger(qpqConfig);
|
|
160
|
+
}
|
|
161
|
+
// Use the off-response-path extension when running inside a real Lambda (where it
|
|
162
|
+
// is always attached); otherwise log directly to S3.
|
|
163
|
+
return process.env.AWS_LAMBDA_RUNTIME_API ? getS3LoggerViaExtension(qpqConfig) : getS3Logger(qpqConfig);
|
|
164
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AssociateSoftwareTokenCommand, CognitoIdentityProviderClient } from '@aws-sdk/client-cognito-identity-provider';
|
|
2
|
+
import { createAwsClient } from '../createAwsClient';
|
|
3
|
+
// Begins TOTP enrollment for the MFA_SETUP challenge. Cognito returns the
|
|
4
|
+
// shared secret to seed the authenticator app and a refreshed session that must
|
|
5
|
+
// be used for the subsequent VerifySoftwareToken / RespondToAuthChallenge calls.
|
|
6
|
+
export const associateSoftwareToken = async (region, session) => {
|
|
7
|
+
const cognitoClient = createAwsClient(CognitoIdentityProviderClient, {
|
|
8
|
+
region,
|
|
9
|
+
});
|
|
10
|
+
const response = await cognitoClient.send(new AssociateSoftwareTokenCommand({ Session: session }));
|
|
11
|
+
return {
|
|
12
|
+
secretCode: response.SecretCode || '',
|
|
13
|
+
session: response.Session || '',
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -27,7 +27,8 @@ export const decodeValidJwt = async (userPoolId, region, ignoreExpiration, acces
|
|
|
27
27
|
return decodedAccessToken;
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
|
-
|
|
30
|
+
const summary = e instanceof Error ? `${e.name}: ${e.message}` : 'unknown error';
|
|
31
|
+
console.log('Failed to decode jwt token:', summary);
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
33
34
|
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { UserAttributes } from 'quidproquo-core';
|
|
2
|
+
export declare class UserNotFoundError extends Error {
|
|
3
|
+
readonly code = "USER_NOT_FOUND";
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
2
6
|
export declare const getUserAttributesBySub: (userPoolId: string, region: string, sub: string) => Promise<UserAttributes>;
|