@kravc/dos 1.12.5 → 2.0.0-alpha.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/README.md +31 -994
- package/dist/Component/Component.d.ts +43 -0
- package/dist/Component/Component.d.ts.map +1 -0
- package/dist/Component/Component.js +99 -0
- package/dist/Component/Component.js.map +1 -0
- package/dist/Component/index.d.ts +4 -0
- package/dist/Component/index.d.ts.map +1 -0
- package/dist/Component/index.js +10 -0
- package/dist/Component/index.js.map +1 -0
- package/dist/Context/Context.d.ts +86 -0
- package/dist/Context/Context.d.ts.map +1 -0
- package/dist/Context/Context.js +148 -0
- package/dist/Context/Context.js.map +1 -0
- package/dist/Context/Request.d.ts +35 -0
- package/dist/Context/Request.d.ts.map +1 -0
- package/dist/Context/Request.js +3 -0
- package/dist/Context/Request.js.map +1 -0
- package/dist/Context/__tests__/__helpers.d.ts +14 -0
- package/dist/Context/__tests__/__helpers.d.ts.map +1 -0
- package/dist/Context/__tests__/__helpers.js +69 -0
- package/dist/Context/__tests__/__helpers.js.map +1 -0
- package/dist/Context/getHttpMethod.d.ts +6 -0
- package/dist/Context/getHttpMethod.d.ts.map +1 -0
- package/dist/Context/getHttpMethod.js +16 -0
- package/dist/Context/getHttpMethod.js.map +1 -0
- package/dist/Context/getHttpPath.d.ts +6 -0
- package/dist/Context/getHttpPath.d.ts.map +1 -0
- package/dist/Context/getHttpPath.js +25 -0
- package/dist/Context/getHttpPath.js.map +1 -0
- package/dist/Context/getMutationParameters.d.ts +8 -0
- package/dist/Context/getMutationParameters.d.ts.map +1 -0
- package/dist/Context/getMutationParameters.js +25 -0
- package/dist/Context/getMutationParameters.js.map +1 -0
- package/dist/Context/getOperationId.d.ts +6 -0
- package/dist/Context/getOperationId.d.ts.map +1 -0
- package/dist/Context/getOperationId.js +21 -0
- package/dist/Context/getOperationId.js.map +1 -0
- package/dist/Context/getQueryParameters.d.ts +5 -0
- package/dist/Context/getQueryParameters.d.ts.map +1 -0
- package/dist/Context/getQueryParameters.js +33 -0
- package/dist/Context/getQueryParameters.js.map +1 -0
- package/dist/Context/index.d.ts +7 -0
- package/dist/Context/index.d.ts.map +1 -0
- package/dist/Context/index.js +12 -0
- package/dist/Context/index.js.map +1 -0
- package/dist/Context/withSafeAttributes.d.ts +23 -0
- package/dist/Context/withSafeAttributes.d.ts.map +1 -0
- package/dist/Context/withSafeAttributes.js +39 -0
- package/dist/Context/withSafeAttributes.js.map +1 -0
- package/dist/Document/Document.d.ts +114 -0
- package/dist/Document/Document.d.ts.map +1 -0
- package/dist/Document/Document.js +285 -0
- package/dist/Document/Document.js.map +1 -0
- package/dist/Document/MemoryDocument.d.ts +34 -0
- package/dist/Document/MemoryDocument.d.ts.map +1 -0
- package/dist/Document/MemoryDocument.js +103 -0
- package/dist/Document/MemoryDocument.js.map +1 -0
- package/dist/Document/__tests__/__helpers.d.ts +18 -0
- package/dist/Document/__tests__/__helpers.d.ts.map +1 -0
- package/dist/Document/__tests__/__helpers.js +28 -0
- package/dist/Document/__tests__/__helpers.js.map +1 -0
- package/dist/Document/index.d.ts +5 -0
- package/dist/Document/index.d.ts.map +1 -0
- package/dist/Document/index.js +11 -0
- package/dist/Document/index.js.map +1 -0
- package/dist/Operation/Operation.d.ts +95 -0
- package/dist/Operation/Operation.d.ts.map +1 -0
- package/dist/Operation/Operation.js +301 -0
- package/dist/Operation/Operation.js.map +1 -0
- package/dist/Operation/errors/AccessDeniedError.d.ts +22 -0
- package/dist/Operation/errors/AccessDeniedError.d.ts.map +1 -0
- package/dist/Operation/errors/AccessDeniedError.js +29 -0
- package/dist/Operation/errors/AccessDeniedError.js.map +1 -0
- package/dist/Operation/errors/CommonError.d.ts +30 -0
- package/dist/Operation/errors/CommonError.d.ts.map +1 -0
- package/dist/Operation/errors/CommonError.js +39 -0
- package/dist/Operation/errors/CommonError.js.map +1 -0
- package/dist/Operation/errors/DocumentExistsError.d.ts +27 -0
- package/dist/Operation/errors/DocumentExistsError.d.ts.map +1 -0
- package/dist/Operation/errors/DocumentExistsError.js +35 -0
- package/dist/Operation/errors/DocumentExistsError.js.map +1 -0
- package/dist/Operation/errors/DocumentNotFoundError.d.ts +28 -0
- package/dist/Operation/errors/DocumentNotFoundError.d.ts.map +1 -0
- package/dist/Operation/errors/DocumentNotFoundError.js +36 -0
- package/dist/Operation/errors/DocumentNotFoundError.js.map +1 -0
- package/dist/Operation/errors/InvalidParametersError.d.ts +27 -0
- package/dist/Operation/errors/InvalidParametersError.d.ts.map +1 -0
- package/dist/Operation/errors/InvalidParametersError.js +34 -0
- package/dist/Operation/errors/InvalidParametersError.js.map +1 -0
- package/dist/Operation/errors/UnauthorizedError.d.ts +25 -0
- package/dist/Operation/errors/UnauthorizedError.d.ts.map +1 -0
- package/dist/Operation/errors/UnauthorizedError.js +32 -0
- package/dist/Operation/errors/UnauthorizedError.js.map +1 -0
- package/dist/Operation/errors/UnprocessibleConditionError.d.ts +29 -0
- package/dist/Operation/errors/UnprocessibleConditionError.d.ts.map +1 -0
- package/dist/Operation/errors/UnprocessibleConditionError.js +36 -0
- package/dist/Operation/errors/UnprocessibleConditionError.js.map +1 -0
- package/dist/Operation/errors/index.d.ts +9 -0
- package/dist/Operation/errors/index.d.ts.map +1 -0
- package/dist/Operation/errors/index.js +21 -0
- package/dist/Operation/errors/index.js.map +1 -0
- package/dist/Operation/helpers/index.d.ts +4 -0
- package/dist/Operation/helpers/index.d.ts.map +1 -0
- package/dist/Operation/helpers/index.js +9 -0
- package/dist/Operation/helpers/index.js.map +1 -0
- package/dist/Operation/helpers/withActivity.d.ts +16 -0
- package/dist/Operation/helpers/withActivity.d.ts.map +1 -0
- package/dist/Operation/helpers/withActivity.js +23 -0
- package/dist/Operation/helpers/withActivity.js.map +1 -0
- package/dist/Operation/index.d.ts +14 -0
- package/dist/Operation/index.d.ts.map +1 -0
- package/dist/Operation/index.js +40 -0
- package/dist/Operation/index.js.map +1 -0
- package/dist/Operation/operations/Create.d.ts +5 -0
- package/dist/Operation/operations/Create.d.ts.map +1 -0
- package/dist/Operation/operations/Create.js +44 -0
- package/dist/Operation/operations/Create.js.map +1 -0
- package/dist/Operation/operations/Delete.d.ts +5 -0
- package/dist/Operation/operations/Delete.d.ts.map +1 -0
- package/dist/Operation/operations/Delete.js +58 -0
- package/dist/Operation/operations/Delete.js.map +1 -0
- package/dist/Operation/operations/Index.d.ts +11 -0
- package/dist/Operation/operations/Index.d.ts.map +1 -0
- package/dist/Operation/operations/Index.js +128 -0
- package/dist/Operation/operations/Index.js.map +1 -0
- package/dist/Operation/operations/List.d.ts +5 -0
- package/dist/Operation/operations/List.d.ts.map +1 -0
- package/dist/Operation/operations/List.js +48 -0
- package/dist/Operation/operations/List.js.map +1 -0
- package/dist/Operation/operations/Read.d.ts +5 -0
- package/dist/Operation/operations/Read.d.ts.map +1 -0
- package/dist/Operation/operations/Read.js +50 -0
- package/dist/Operation/operations/Read.js.map +1 -0
- package/dist/Operation/operations/Update.d.ts +5 -0
- package/dist/Operation/operations/Update.d.ts.map +1 -0
- package/dist/Operation/operations/Update.js +54 -0
- package/dist/Operation/operations/Update.js.map +1 -0
- package/dist/Operation/security/JwtAuthorization.d.ts +67 -0
- package/dist/Operation/security/JwtAuthorization.d.ts.map +1 -0
- package/dist/Operation/security/JwtAuthorization.js +148 -0
- package/dist/Operation/security/JwtAuthorization.js.map +1 -0
- package/dist/Operation/security/LambdaAuthorization.d.ts +30 -0
- package/dist/Operation/security/LambdaAuthorization.d.ts.map +1 -0
- package/dist/Operation/security/LambdaAuthorization.js +77 -0
- package/dist/Operation/security/LambdaAuthorization.js.map +1 -0
- package/dist/Operation/security/index.d.ts +8 -0
- package/dist/Operation/security/index.d.ts.map +1 -0
- package/dist/Operation/security/index.js +17 -0
- package/dist/Operation/security/index.js.map +1 -0
- package/dist/Operation/security/systemAuthorization.d.ts +5 -0
- package/dist/Operation/security/systemAuthorization.d.ts.map +1 -0
- package/dist/Operation/security/systemAuthorization.js +24 -0
- package/dist/Operation/security/systemAuthorization.js.map +1 -0
- package/dist/Operation/security/userAuthorization.d.ts +11 -0
- package/dist/Operation/security/userAuthorization.d.ts.map +1 -0
- package/dist/Operation/security/userAuthorization.js +36 -0
- package/dist/Operation/security/userAuthorization.js.map +1 -0
- package/dist/Operation/security/verifyToken.d.ts +6 -0
- package/dist/Operation/security/verifyToken.d.ts.map +1 -0
- package/dist/Operation/security/verifyToken.js +15 -0
- package/dist/Operation/security/verifyToken.js.map +1 -0
- package/dist/Service/Service.d.ts +62 -0
- package/dist/Service/Service.d.ts.map +1 -0
- package/dist/Service/Service.js +213 -0
- package/dist/Service/Service.js.map +1 -0
- package/dist/Service/authorize.d.ts +26 -0
- package/dist/Service/authorize.d.ts.map +1 -0
- package/dist/Service/authorize.js +40 -0
- package/dist/Service/authorize.js.map +1 -0
- package/dist/Service/errors/InvalidInputError.d.ts +29 -0
- package/dist/Service/errors/InvalidInputError.d.ts.map +1 -0
- package/dist/Service/errors/InvalidInputError.js +36 -0
- package/dist/Service/errors/InvalidInputError.js.map +1 -0
- package/dist/Service/errors/InvalidOutputError.d.ts +29 -0
- package/dist/Service/errors/InvalidOutputError.d.ts.map +1 -0
- package/dist/Service/errors/InvalidOutputError.js +36 -0
- package/dist/Service/errors/InvalidOutputError.js.map +1 -0
- package/dist/Service/errors/OperationError.d.ts +30 -0
- package/dist/Service/errors/OperationError.d.ts.map +1 -0
- package/dist/Service/errors/OperationError.js +61 -0
- package/dist/Service/errors/OperationError.js.map +1 -0
- package/dist/Service/errors/OperationNotFoundError.d.ts +38 -0
- package/dist/Service/errors/OperationNotFoundError.d.ts.map +1 -0
- package/dist/Service/errors/OperationNotFoundError.js +45 -0
- package/dist/Service/errors/OperationNotFoundError.js.map +1 -0
- package/dist/Service/errors/index.d.ts +8 -0
- package/dist/Service/errors/index.d.ts.map +1 -0
- package/dist/Service/errors/index.js +15 -0
- package/dist/Service/errors/index.js.map +1 -0
- package/dist/Service/errors/logOperationError.d.ts +35 -0
- package/dist/Service/errors/logOperationError.d.ts.map +1 -0
- package/dist/Service/errors/logOperationError.js +47 -0
- package/dist/Service/errors/logOperationError.js.map +1 -0
- package/dist/Service/errors/maskSecrets.d.ts +13 -0
- package/dist/Service/errors/maskSecrets.d.ts.map +1 -0
- package/dist/Service/errors/maskSecrets.js +57 -0
- package/dist/Service/errors/maskSecrets.js.map +1 -0
- package/dist/Service/index.d.ts +5 -0
- package/dist/Service/index.d.ts.map +1 -0
- package/dist/Service/index.js +25 -0
- package/dist/Service/index.js.map +1 -0
- package/dist/Service/logRequest.d.ts +5 -0
- package/dist/Service/logRequest.d.ts.map +1 -0
- package/dist/Service/logRequest.js +26 -0
- package/dist/Service/logRequest.js.map +1 -0
- package/dist/Service/spec/createSpec.d.ts +7 -0
- package/dist/Service/spec/createSpec.d.ts.map +1 -0
- package/dist/Service/spec/createSpec.js +56 -0
- package/dist/Service/spec/createSpec.js.map +1 -0
- package/dist/Service/spec/getErrorResponseDescription.d.ts +8 -0
- package/dist/Service/spec/getErrorResponseDescription.d.ts.map +1 -0
- package/dist/Service/spec/getErrorResponseDescription.js +15 -0
- package/dist/Service/spec/getErrorResponseDescription.js.map +1 -0
- package/dist/Service/spec/getHttpMethod.d.ts +4 -0
- package/dist/Service/spec/getHttpMethod.d.ts.map +1 -0
- package/dist/Service/spec/getHttpMethod.js +21 -0
- package/dist/Service/spec/getHttpMethod.js.map +1 -0
- package/dist/Service/spec/getOperation.d.ts +6 -0
- package/dist/Service/spec/getOperation.d.ts.map +1 -0
- package/dist/Service/spec/getOperation.js +71 -0
- package/dist/Service/spec/getOperation.js.map +1 -0
- package/dist/Service/spec/getOperationParameters.d.ts +6 -0
- package/dist/Service/spec/getOperationParameters.d.ts.map +1 -0
- package/dist/Service/spec/getOperationParameters.js +32 -0
- package/dist/Service/spec/getOperationParameters.js.map +1 -0
- package/dist/Service/spec/getServiceDefinitions.d.ts +6 -0
- package/dist/Service/spec/getServiceDefinitions.d.ts.map +1 -0
- package/dist/Service/spec/getServiceDefinitions.js +18 -0
- package/dist/Service/spec/getServiceDefinitions.js.map +1 -0
- package/dist/Service/spec/getServiceInfo.d.ts +7 -0
- package/dist/Service/spec/getServiceInfo.d.ts.map +1 -0
- package/dist/Service/spec/getServiceInfo.js +15 -0
- package/dist/Service/spec/getServiceInfo.js.map +1 -0
- package/dist/Service/spec/getServiceSecurityDefinitions.d.ts +6 -0
- package/dist/Service/spec/getServiceSecurityDefinitions.d.ts.map +1 -0
- package/dist/Service/spec/getServiceSecurityDefinitions.js +21 -0
- package/dist/Service/spec/getServiceSecurityDefinitions.js.map +1 -0
- package/dist/Service/spec/getServiceTags.d.ts +7 -0
- package/dist/Service/spec/getServiceTags.d.ts.map +1 -0
- package/dist/Service/spec/getServiceTags.js +19 -0
- package/dist/Service/spec/getServiceTags.js.map +1 -0
- package/dist/Service/spec/getSuccessStatusCode.d.ts +4 -0
- package/dist/Service/spec/getSuccessStatusCode.d.ts.map +1 -0
- package/dist/Service/spec/getSuccessStatusCode.js +14 -0
- package/dist/Service/spec/getSuccessStatusCode.js.map +1 -0
- package/dist/Service/spec/index.d.ts +3 -0
- package/dist/Service/spec/index.d.ts.map +1 -0
- package/dist/Service/spec/index.js +9 -0
- package/dist/Service/spec/index.js.map +1 -0
- package/dist/Service/spec/validateSpec.d.ts +5 -0
- package/dist/Service/spec/validateSpec.d.ts.map +1 -0
- package/dist/Service/spec/validateSpec.js +21 -0
- package/dist/Service/spec/validateSpec.js.map +1 -0
- package/dist/Service/test/createAccessToken.d.ts +9 -0
- package/dist/Service/test/createAccessToken.d.ts.map +1 -0
- package/dist/Service/test/createAccessToken.js +16 -0
- package/dist/Service/test/createAccessToken.js.map +1 -0
- package/dist/Service/test/ensureItem.d.ts +5 -0
- package/dist/Service/test/ensureItem.d.ts.map +1 -0
- package/dist/Service/test/ensureItem.js +13 -0
- package/dist/Service/test/ensureItem.js.map +1 -0
- package/dist/Service/test/ensureNoItem.d.ts +5 -0
- package/dist/Service/test/ensureNoItem.d.ts.map +1 -0
- package/dist/Service/test/ensureNoItem.js +13 -0
- package/dist/Service/test/ensureNoItem.js.map +1 -0
- package/dist/Service/test/execute.d.ts +44 -0
- package/dist/Service/test/execute.d.ts.map +1 -0
- package/dist/Service/test/execute.js +65 -0
- package/dist/Service/test/execute.js.map +1 -0
- package/dist/Service/test/findItem.d.ts +7 -0
- package/dist/Service/test/findItem.d.ts.map +1 -0
- package/dist/Service/test/findItem.js +16 -0
- package/dist/Service/test/findItem.js.map +1 -0
- package/dist/Service/test/firstItemGet.d.ts +5 -0
- package/dist/Service/test/firstItemGet.d.ts.map +1 -0
- package/dist/Service/test/firstItemGet.js +15 -0
- package/dist/Service/test/firstItemGet.js.map +1 -0
- package/dist/Service/test/index.d.ts +10 -0
- package/dist/Service/test/index.d.ts.map +1 -0
- package/dist/Service/test/index.js +36 -0
- package/dist/Service/test/index.js.map +1 -0
- package/dist/Service/test/keys.d.ts +5 -0
- package/dist/Service/test/keys.d.ts.map +1 -0
- package/dist/Service/test/keys.js +74 -0
- package/dist/Service/test/keys.js.map +1 -0
- package/dist/Service/test/wait.d.ts +4 -0
- package/dist/Service/test/wait.d.ts.map +1 -0
- package/dist/Service/test/wait.js +6 -0
- package/dist/Service/test/wait.js.map +1 -0
- package/dist/Service/useComposerMiddleware.d.ts +11 -0
- package/dist/Service/useComposerMiddleware.d.ts.map +1 -0
- package/dist/Service/useComposerMiddleware.js +41 -0
- package/dist/Service/useComposerMiddleware.js.map +1 -0
- package/dist/Service/useOasMiddleware.d.ts +16 -0
- package/dist/Service/useOasMiddleware.d.ts.map +1 -0
- package/dist/Service/useOasMiddleware.js +53 -0
- package/dist/Service/useOasMiddleware.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.mjs +32 -52
- package/example/documents/Profile/Profile.ts +8 -0
- package/example/documents/Profile/Profile.yaml +6 -0
- package/example/documents/Profile/ProfileAttributes.d.ts +5 -0
- package/example/documents/Profile/index.ts +3 -0
- package/example/documents/index.ts +5 -0
- package/example/index.ts +38 -0
- package/example/lib/createActivity.ts +28 -0
- package/example/lib/index.ts +24 -0
- package/example/operations/Profile/CreateProfile.ts +9 -0
- package/example/operations/Profile/DeleteProfile.ts +9 -0
- package/example/operations/Profile/IndexProfiles.ts +9 -0
- package/example/operations/Profile/ReadProfile.ts +9 -0
- package/example/operations/Profile/ReadProfileSystem.ts +9 -0
- package/example/operations/Profile/UpdateProfile.ts +9 -0
- package/example/operations/Service/Health.ts +11 -0
- package/example/operations/index.ts +22 -0
- package/example/security/index.ts +25 -0
- package/jest.config.mjs +7 -0
- package/package.json +34 -24
- package/src/Component/Component.ts +120 -0
- package/src/Component/__tests__/Component.test.ts +161 -0
- package/src/Component/index.ts +7 -0
- package/src/Context/Context.ts +217 -0
- package/src/Context/Request.ts +41 -0
- package/src/Context/__tests__/Context.test.ts +271 -0
- package/src/Context/__tests__/__helpers.ts +86 -0
- package/src/Context/getHttpMethod.ts +21 -0
- package/src/Context/getHttpPath.ts +34 -0
- package/src/Context/getMutationParameters.ts +35 -0
- package/src/Context/getOperationId.ts +23 -0
- package/src/Context/getQueryParameters.ts +45 -0
- package/src/Context/index.ts +12 -0
- package/src/Context/withSafeAttributes.ts +39 -0
- package/src/Document/Document.ts +448 -0
- package/src/Document/MemoryDocument.ts +152 -0
- package/src/Document/__tests__/MemoryDocument.test.ts +406 -0
- package/src/Document/__tests__/__helpers.ts +40 -0
- package/src/Document/index.ts +11 -0
- package/src/Operation/Operation.ts +401 -0
- package/src/Operation/__tests__/Operation.test.ts +142 -0
- package/src/Operation/errors/AccessDeniedError.ts +25 -0
- package/src/Operation/errors/CommonError.ts +41 -0
- package/src/Operation/errors/DocumentExistsError.ts +33 -0
- package/src/Operation/errors/DocumentNotFoundError.ts +34 -0
- package/src/Operation/errors/InvalidParametersError.ts +30 -0
- package/src/Operation/errors/UnauthorizedError.ts +28 -0
- package/src/Operation/errors/UnprocessibleConditionError.ts +32 -0
- package/src/Operation/errors/__tests__/InvalidParametersError.test.ts +20 -0
- package/src/Operation/errors/__tests__/UnprocessibleConditionError.test.ts +20 -0
- package/src/Operation/errors/index.ts +17 -0
- package/src/Operation/helpers/index.ts +9 -0
- package/src/Operation/helpers/withActivity.ts +43 -0
- package/src/Operation/index.ts +29 -0
- package/src/Operation/operations/Create.ts +49 -0
- package/src/Operation/operations/Delete.ts +65 -0
- package/src/Operation/operations/Index.ts +164 -0
- package/src/Operation/operations/List.ts +62 -0
- package/src/Operation/operations/Read.ts +55 -0
- package/src/Operation/operations/Update.ts +60 -0
- package/src/Operation/operations/__tests__/Create.test.ts +153 -0
- package/src/Operation/operations/__tests__/Delete.test.ts +163 -0
- package/src/Operation/operations/__tests__/Index.test.ts +209 -0
- package/src/Operation/operations/__tests__/List.test.ts +146 -0
- package/src/Operation/operations/__tests__/Read.test.ts +152 -0
- package/src/Operation/operations/__tests__/Update.test.ts +158 -0
- package/src/Operation/security/JwtAuthorization.ts +247 -0
- package/src/Operation/security/LambdaAuthorization.ts +103 -0
- package/src/Operation/security/__tests__/JwtAuthorization.test.ts +230 -0
- package/src/Operation/security/__tests__/LambdaAuthorization.test.ts +63 -0
- package/src/Operation/security/__tests__/userAuthorization.test.ts +42 -0
- package/src/Operation/security/index.ts +15 -0
- package/src/Operation/security/systemAuthorization.ts +23 -0
- package/src/Operation/security/userAuthorization.ts +47 -0
- package/src/Operation/security/verifyToken.ts +22 -0
- package/src/Service/Service.ts +317 -0
- package/src/Service/__tests__/Service.test.ts +229 -0
- package/src/Service/authorize.ts +80 -0
- package/src/Service/errors/InvalidInputError.ts +40 -0
- package/src/Service/errors/InvalidOutputError.ts +40 -0
- package/src/Service/errors/OperationError.ts +74 -0
- package/src/{errors → Service/errors}/OperationError.yaml +7 -10
- package/src/Service/errors/OperationErrorAttributes.d.ts +12 -0
- package/src/Service/errors/OperationNotFoundError.ts +45 -0
- package/src/Service/errors/__tests__/OperationError.test.ts +17 -0
- package/src/Service/errors/__tests__/maskSecrets.test.ts +92 -0
- package/src/Service/errors/index.ts +18 -0
- package/src/Service/errors/logOperationError.ts +72 -0
- package/src/Service/errors/maskSecrets.ts +65 -0
- package/src/Service/index.ts +9 -0
- package/src/Service/logRequest.ts +50 -0
- package/src/Service/spec/__tests__/validateSpec.test.ts +10 -0
- package/src/Service/spec/createSpec.ts +68 -0
- package/src/Service/spec/getErrorResponseDescription.ts +20 -0
- package/src/Service/spec/getHttpMethod.ts +20 -0
- package/src/Service/spec/getOperation.ts +99 -0
- package/src/Service/spec/getOperationParameters.ts +43 -0
- package/src/Service/spec/getServiceDefinitions.ts +23 -0
- package/src/Service/spec/getServiceInfo.ts +18 -0
- package/src/Service/spec/getServiceSecurityDefinitions.ts +26 -0
- package/src/Service/spec/getServiceTags.ts +23 -0
- package/src/Service/spec/getSuccessStatusCode.ts +15 -0
- package/src/Service/spec/index.ts +5 -0
- package/src/Service/spec/validateSpec.ts +22 -0
- package/src/Service/test/__tests__/createAccessToken.test.ts +104 -0
- package/src/Service/test/__tests__/ensureItem.test.ts +41 -0
- package/src/Service/test/__tests__/ensureNoItem.test.ts +49 -0
- package/src/Service/test/__tests__/execute.test.ts +125 -0
- package/src/Service/test/__tests__/findItem.test.ts +45 -0
- package/src/Service/test/__tests__/firstItemGet.test.ts +50 -0
- package/src/Service/test/__tests__/wait.test.ts +66 -0
- package/src/Service/test/createAccessToken.ts +28 -0
- package/src/Service/test/ensureItem.ts +9 -0
- package/src/Service/test/ensureNoItem.ts +9 -0
- package/src/Service/test/execute.ts +112 -0
- package/src/Service/test/findItem.ts +22 -0
- package/src/Service/test/firstItemGet.ts +18 -0
- package/src/Service/test/index.ts +19 -0
- package/src/Service/test/keys.ts +75 -0
- package/src/Service/test/wait.ts +5 -0
- package/src/Service/useComposerMiddleware.ts +56 -0
- package/src/Service/useOasMiddleware.ts +69 -0
- package/src/index.ts +12 -0
- package/tsconfig.json +26 -0
- package/examples/CreateProfile.js +0 -40
- package/examples/DeleteProfile.js +0 -6
- package/examples/Health.js +0 -8
- package/examples/IndexProfiles.js +0 -6
- package/examples/Profile.js +0 -8
- package/examples/Profile.yaml +0 -4
- package/examples/ReadProfile.js +0 -18
- package/examples/UpdateProfile.js +0 -25
- package/examples/index.js +0 -29
- package/src/Component.js +0 -59
- package/src/Component.spec.js +0 -65
- package/src/Document.js +0 -310
- package/src/Document.spec.js +0 -331
- package/src/Operation.js +0 -258
- package/src/Operation.spec.js +0 -474
- package/src/Service.js +0 -207
- package/src/Service.spec.js +0 -388
- package/src/errors/AccessDeniedError.js +0 -11
- package/src/errors/CommonError.js +0 -19
- package/src/errors/DocumentExistsError.js +0 -15
- package/src/errors/DocumentNotFoundError.js +0 -15
- package/src/errors/InvalidInputError.js +0 -19
- package/src/errors/InvalidOutputError.js +0 -20
- package/src/errors/InvalidParametersError.js +0 -11
- package/src/errors/OperationError.js +0 -44
- package/src/errors/OperationNotFoundError.js +0 -16
- package/src/errors/UnauthorizedError.js +0 -11
- package/src/errors/UnprocessibleConditionError.js +0 -11
- package/src/errors/index.js +0 -11
- package/src/helpers/asSafeClass.js +0 -22
- package/src/helpers/authorize.js +0 -44
- package/src/helpers/createContext.js +0 -96
- package/src/helpers/createSchemasMap.js +0 -37
- package/src/helpers/createSpec.js +0 -196
- package/src/helpers/defaultId.js +0 -30
- package/src/helpers/defaultSummary.js +0 -15
- package/src/helpers/defaultTags.js +0 -16
- package/src/helpers/getComponentTitle.js +0 -22
- package/src/helpers/getDefaultSchemaAttributes.js +0 -32
- package/src/helpers/getHttpMethod.js +0 -19
- package/src/helpers/getIdPrefix.js +0 -7
- package/src/helpers/getOrFail.js +0 -24
- package/src/helpers/getOrFail.spec.js +0 -17
- package/src/helpers/getSuccessStatusCode.js +0 -15
- package/src/helpers/handler.js +0 -21
- package/src/helpers/loadSync.js +0 -14
- package/src/helpers/logError.js +0 -33
- package/src/helpers/logRequest.js +0 -36
- package/src/helpers/maskSecrets.js +0 -42
- package/src/helpers/specMiddleware.js +0 -81
- package/src/index.d.ts +0 -350
- package/src/index.js +0 -35
- package/src/operations/Create.js +0 -39
- package/src/operations/Delete.js +0 -54
- package/src/operations/Index.js +0 -107
- package/src/operations/Read.js +0 -46
- package/src/operations/Update.js +0 -50
- package/src/security/JwtAuthorization.js +0 -125
- package/src/security/SystemAuthorization.js +0 -73
- package/src/security/index.js +0 -9
- package/src/security/verifyToken.js +0 -17
- package/src/test/createAccessToken.js +0 -23
- package/src/test/execute.js +0 -84
- package/src/test/index.js +0 -11
- package/src/test/keys.js +0 -39
- package/src/test/wait.js +0 -5
- /package/{specs → .composer}/Documents.yaml +0 -0
- /package/{specs → .composer}/Enums.yaml +0 -0
- /package/{specs → .composer}/Operations.yaml +0 -0
- /package/{specs → .composer}/Parameters.yaml +0 -0
- /package/{specs → .composer}/Scenarios.yaml +0 -0
- /package/{specs → .composer}/Schemas.yaml +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_fs_1 = require("node:fs");
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const ROOT_PATH = process.cwd();
|
|
6
|
+
/** Returns service info attributes. */
|
|
7
|
+
const getServiceInfo = () => {
|
|
8
|
+
const { name: title, version } = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(ROOT_PATH, 'package.json'), 'utf-8'));
|
|
9
|
+
return {
|
|
10
|
+
title,
|
|
11
|
+
version,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports.default = getServiceInfo;
|
|
15
|
+
//# sourceMappingURL=getServiceInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getServiceInfo.js","sourceRoot":"","sources":["../../../src/Service/spec/getServiceInfo.ts"],"names":[],"mappings":";;AAAA,qCAAuC;AACvC,yCAAiC;AAEjC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAEhC,uCAAuC;AACvC,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CACzC,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAClB,CAAC;IAEvC,OAAO;QACL,KAAK;QACL,OAAO;KACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Operation from '../../Operation';
|
|
2
|
+
import { OpenAPIV2 } from 'openapi-types';
|
|
3
|
+
/** Returns security definitions for service operations. */
|
|
4
|
+
declare const getServiceSecurityDefinitions: (operations: (typeof Operation)[]) => OpenAPIV2.SecurityDefinitionsObject;
|
|
5
|
+
export default getServiceSecurityDefinitions;
|
|
6
|
+
//# sourceMappingURL=getServiceSecurityDefinitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getServiceSecurityDefinitions.d.ts","sourceRoot":"","sources":["../../../src/Service/spec/getServiceSecurityDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,2DAA2D;AAC3D,QAAA,MAAM,6BAA6B,GAAI,YAAY,CAAC,OAAO,SAAS,CAAC,EAAE,wCAmBtE,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/** Returns security definitions for service operations. */
|
|
4
|
+
const getServiceSecurityDefinitions = (operations) => {
|
|
5
|
+
const securityDefinitions = {};
|
|
6
|
+
for (const OperationClass of operations) {
|
|
7
|
+
const { security } = OperationClass;
|
|
8
|
+
const hasSecurityRequirements = security.length > 0;
|
|
9
|
+
if (hasSecurityRequirements) {
|
|
10
|
+
for (const requirements of security) {
|
|
11
|
+
for (const name in requirements) {
|
|
12
|
+
const { definition } = requirements[name];
|
|
13
|
+
securityDefinitions[name] = definition;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return securityDefinitions;
|
|
19
|
+
};
|
|
20
|
+
exports.default = getServiceSecurityDefinitions;
|
|
21
|
+
//# sourceMappingURL=getServiceSecurityDefinitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getServiceSecurityDefinitions.js","sourceRoot":"","sources":["../../../src/Service/spec/getServiceSecurityDefinitions.ts"],"names":[],"mappings":";;AAGA,2DAA2D;AAC3D,MAAM,6BAA6B,GAAG,CAAC,UAAgC,EAAG,EAAE;IAC1E,MAAM,mBAAmB,GAAG,EAAyC,CAAC;IAEtE,KAAK,MAAM,cAAc,IAAI,UAAU,EAAE,CAAC;QACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QACpC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAEpD,IAAI,uBAAuB,EAAE,CAAC;YAC5B,KAAK,MAAM,YAAY,IAAI,QAAQ,EAAE,CAAC;gBACpC,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;oBAChC,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;oBAE1C,mBAAoB,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;gBAC1C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AAEF,kBAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getServiceTags.d.ts","sourceRoot":"","sources":["../../../src/Service/spec/getServiceTags.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,4CAA4C;AAC5C,QAAA,MAAM,cAAc,GAAI,YAAY,CAAC,OAAO,SAAS,CAAC,EAAE;;GAgBvD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
/** Returns service tags from operations. */
|
|
5
|
+
const getServiceTags = (operations) => {
|
|
6
|
+
let serviceTags = [];
|
|
7
|
+
for (const OperationClass of operations) {
|
|
8
|
+
const { tags } = OperationClass;
|
|
9
|
+
serviceTags = serviceTags.concat(tags);
|
|
10
|
+
}
|
|
11
|
+
serviceTags = (0, lodash_1.sortBy)((0, lodash_1.uniq)(serviceTags), [
|
|
12
|
+
(tag) => !/^[A-Z]/.test(tag),
|
|
13
|
+
(tag) => tag,
|
|
14
|
+
]);
|
|
15
|
+
const tags = serviceTags.map(name => ({ name }));
|
|
16
|
+
return tags;
|
|
17
|
+
};
|
|
18
|
+
exports.default = getServiceTags;
|
|
19
|
+
//# sourceMappingURL=getServiceTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getServiceTags.js","sourceRoot":"","sources":["../../../src/Service/spec/getServiceTags.ts"],"names":[],"mappings":";;AAAA,mCAAsC;AAGtC,4CAA4C;AAC5C,MAAM,cAAc,GAAG,CAAC,UAAgC,EAAG,EAAE;IAC3D,IAAI,WAAW,GAAG,EAAc,CAAC;IAEjC,KAAK,MAAM,cAAc,IAAI,UAAU,EAAE,CAAC;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC;QAChC,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,WAAW,GAAG,IAAA,eAAM,EAAC,IAAA,aAAI,EAAC,WAAW,CAAC,EAAE;QACtC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAC5B,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;KACb,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEjD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Returns HTTP success status code for an operation type and output schema. */
|
|
2
|
+
declare const getSuccessStatusCode: (isCreate: boolean, hasOutput: boolean) => "204" | "201" | "200";
|
|
3
|
+
export default getSuccessStatusCode;
|
|
4
|
+
//# sourceMappingURL=getSuccessStatusCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuccessStatusCode.d.ts","sourceRoot":"","sources":["../../../src/Service/spec/getSuccessStatusCode.ts"],"names":[],"mappings":"AACA,gFAAgF;AAChF,QAAA,MAAM,oBAAoB,GAAI,UAAU,OAAO,EAAE,WAAW,OAAO,0BAUlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/** Returns HTTP success status code for an operation type and output schema. */
|
|
4
|
+
const getSuccessStatusCode = (isCreate, hasOutput) => {
|
|
5
|
+
if (!hasOutput) {
|
|
6
|
+
return '204';
|
|
7
|
+
}
|
|
8
|
+
if (isCreate) {
|
|
9
|
+
return '201';
|
|
10
|
+
}
|
|
11
|
+
return '200';
|
|
12
|
+
};
|
|
13
|
+
exports.default = getSuccessStatusCode;
|
|
14
|
+
//# sourceMappingURL=getSuccessStatusCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSuccessStatusCode.js","sourceRoot":"","sources":["../../../src/Service/spec/getSuccessStatusCode.ts"],"names":[],"mappings":";;AACA,gFAAgF;AAChF,MAAM,oBAAoB,GAAG,CAAC,QAAiB,EAAE,SAAkB,EAAE,EAAE;IACrE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Service/spec/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EACL,UAAU,EACX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createSpec = void 0;
|
|
7
|
+
const createSpec_1 = __importDefault(require("./createSpec"));
|
|
8
|
+
exports.createSpec = createSpec_1.default;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Service/spec/index.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAsC;AAGpC,qBAHK,oBAAU,CAGL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSpec.d.ts","sourceRoot":"","sources":["../../../src/Service/spec/validateSpec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,mDAAmD;AACnD,QAAA,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,SAAS,CAAC,QAclD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const z_schema_1 = __importDefault(require("z-schema"));
|
|
7
|
+
const oas2_json_1 = __importDefault(require("../../../assets/schemas/oas2.json"));
|
|
8
|
+
/** Validates service specification JSON schema. */
|
|
9
|
+
const validateSpec = (specJson) => {
|
|
10
|
+
const spec = JSON.parse(specJson);
|
|
11
|
+
const validator = new z_schema_1.default({ ignoreUnknownFormats: true });
|
|
12
|
+
const isValid = validator.validate(spec, { ...oas2_json_1.default, id: 'Spec' });
|
|
13
|
+
if (isValid) {
|
|
14
|
+
return spec;
|
|
15
|
+
}
|
|
16
|
+
const validationErrors = validator.getLastErrors();
|
|
17
|
+
const errorsJson = JSON.stringify(validationErrors, null, 2);
|
|
18
|
+
throw new Error(`Service spec validation failed: ${errorsJson}\nService spec: ${specJson}`);
|
|
19
|
+
};
|
|
20
|
+
exports.default = validateSpec;
|
|
21
|
+
//# sourceMappingURL=validateSpec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSpec.js","sourceRoot":"","sources":["../../../src/Service/spec/validateSpec.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+B;AAC/B,kFAA2D;AAG3D,mDAAmD;AACnD,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAsB,EAAE;IAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAElC,MAAM,SAAS,GAAG,IAAI,kBAAO,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,GAAG,mBAAU,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAExE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,gBAAgB,GAAG,SAAS,CAAC,aAAa,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAE7D,MAAM,IAAI,KAAK,CAAC,mCAAmC,UAAU,mBAAmB,QAAQ,EAAE,CAAC,CAAC;AAC9F,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SignOptions } from 'jsonwebtoken';
|
|
2
|
+
interface Options extends SignOptions {
|
|
3
|
+
exp?: string;
|
|
4
|
+
privateKey?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Creates access token. */
|
|
7
|
+
declare const createAccessToken: (options: Options, claims: Record<string, unknown>) => string;
|
|
8
|
+
export default createAccessToken;
|
|
9
|
+
//# sourceMappingURL=createAccessToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAccessToken.d.ts","sourceRoot":"","sources":["../../../src/Service/test/createAccessToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtD,UAAU,OAAQ,SAAQ,WAAW;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,4BAA4B;AAC5B,QAAA,MAAM,iBAAiB,GAAI,SAAS,OAAO,EAAE,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAgB3E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsonwebtoken_1 = require("jsonwebtoken");
|
|
4
|
+
const keys_1 = require("./keys");
|
|
5
|
+
/** Creates access token. */
|
|
6
|
+
const createAccessToken = (options, claims) => {
|
|
7
|
+
const { issuer = keys_1.TEST_ISSUER, algorithm = 'RS256', privateKey = keys_1.TEST_PRIVATE_KEY, ...signOptions } = options;
|
|
8
|
+
const payload = {
|
|
9
|
+
sub: 'TEST_USER_ID',
|
|
10
|
+
...claims
|
|
11
|
+
};
|
|
12
|
+
const token = (0, jsonwebtoken_1.sign)(payload, privateKey, { algorithm, issuer, ...signOptions });
|
|
13
|
+
return `Bearer ${token}`;
|
|
14
|
+
};
|
|
15
|
+
exports.default = createAccessToken;
|
|
16
|
+
//# sourceMappingURL=createAccessToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAccessToken.js","sourceRoot":"","sources":["../../../src/Service/test/createAccessToken.ts"],"names":[],"mappings":";;AAAA,+CAAsD;AACtD,iCAAuD;AAOvD,4BAA4B;AAC5B,MAAM,iBAAiB,GAAG,CAAC,OAAgB,EAAE,MAA+B,EAAE,EAAE;IAC9E,MAAM,EACJ,MAAM,GAAG,kBAAW,EACpB,SAAS,GAAG,OAAO,EACnB,UAAU,GAAG,uBAAgB,EAC7B,GAAG,WAAW,EACf,GAAG,OAAO,CAAC;IAEZ,MAAM,OAAO,GAAG;QACd,GAAG,EAAE,cAAc;QACnB,GAAG,MAAM;KACV,CAAC;IAEF,MAAM,KAAK,GAAG,IAAA,mBAAI,EAAC,OAAO,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;IAE/E,OAAO,UAAU,KAAK,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/ensureItem.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE9D,4DAA4D;AAC5D,QAAA,MAAM,UAAU,GAAI,OAAO,KAAK,EAAE,OAAO,KAAK,SAG7C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const findItem_1 = __importDefault(require("./findItem"));
|
|
7
|
+
/** Ensures item to exists in a list for specified query. */
|
|
8
|
+
const ensureItem = (items, query) => {
|
|
9
|
+
const item = (0, findItem_1.default)(items, query);
|
|
10
|
+
expect(item).toBeDefined();
|
|
11
|
+
};
|
|
12
|
+
exports.default = ensureItem;
|
|
13
|
+
//# sourceMappingURL=ensureItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureItem.js","sourceRoot":"","sources":["../../../src/Service/test/ensureItem.ts"],"names":[],"mappings":";;;;;AAAA,0DAA8D;AAE9D,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,KAAY,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureNoItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/ensureNoItem.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE9D,iEAAiE;AACjE,QAAA,MAAM,YAAY,GAAI,MAAM,KAAK,EAAE,OAAO,KAAK,SAG9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const findItem_1 = __importDefault(require("./findItem"));
|
|
7
|
+
/** Ensures item does not exist in a list for specified query. */
|
|
8
|
+
const ensureNoItem = (data, query) => {
|
|
9
|
+
const item = (0, findItem_1.default)(data, query);
|
|
10
|
+
expect(item).toBeUndefined();
|
|
11
|
+
};
|
|
12
|
+
exports.default = ensureNoItem;
|
|
13
|
+
//# sourceMappingURL=ensureNoItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureNoItem.js","sourceRoot":"","sources":["../../../src/Service/test/ensureNoItem.ts"],"names":[],"mappings":";;;;;AAAA,0DAA8D;AAE9D,iEAAiE;AACjE,MAAM,YAAY,GAAG,CAAC,IAAW,EAAE,KAAY,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Service from '../Service';
|
|
2
|
+
import { type ErrorAttributes } from '../errors';
|
|
3
|
+
import type { Headers, MutationMap, Logger } from '../../Context';
|
|
4
|
+
type Parameters = {
|
|
5
|
+
mutation?: MutationMap;
|
|
6
|
+
[index: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
type SuccessResult = {
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
type ErrorResult = {
|
|
12
|
+
error: ErrorAttributes;
|
|
13
|
+
};
|
|
14
|
+
type Result = SuccessResult | ErrorResult;
|
|
15
|
+
type Options = {
|
|
16
|
+
logger?: Logger;
|
|
17
|
+
};
|
|
18
|
+
/** Returns helpers to process requests successfully or expect an error. */
|
|
19
|
+
declare const execute: (service: Service, options?: Options) => {
|
|
20
|
+
exec: (operationId: string, parameters?: Parameters, headers?: Headers) => Promise<{
|
|
21
|
+
result: Result | undefined;
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': string;
|
|
24
|
+
};
|
|
25
|
+
statusCode: number;
|
|
26
|
+
body: string;
|
|
27
|
+
} | {
|
|
28
|
+
result: Result | undefined;
|
|
29
|
+
headers: {};
|
|
30
|
+
statusCode: number;
|
|
31
|
+
multiValueHeaders: {};
|
|
32
|
+
body?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
result: Result | undefined;
|
|
35
|
+
body: string;
|
|
36
|
+
headers: {};
|
|
37
|
+
statusCode: number;
|
|
38
|
+
multiValueHeaders: {};
|
|
39
|
+
}>;
|
|
40
|
+
request: (operationId: string, parameters?: Parameters, headers?: Headers) => Promise<Record<string, unknown> | undefined>;
|
|
41
|
+
expectError: (errorCode: string, operationId: string, parameters?: Parameters, headers?: Headers) => Promise<ErrorAttributes>;
|
|
42
|
+
};
|
|
43
|
+
export default execute;
|
|
44
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/Service/test/execute.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAKjF,KAAK,UAAU,GAAG;IAChB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAA;AAED,KAAK,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAAE,CAAC;AACxD,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,eAAe,CAAC;CAAE,CAAC;AAC/C,KAAK,MAAM,GAAG,aAAa,GAAG,WAAW,CAAC;AAE1C,KAAK,OAAO,GAAG;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC;AAEF,2EAA2E;AAC3E,QAAA,MAAM,OAAO,GAAI,SAAS,OAAO,EAAE,UAAS,OAAY;wBAIrB,MAAM,eAAc,UAAU,YAAgB,OAAO;;;;;;;;;;;;;;;;;;;;2BAsBlD,MAAM,eAAc,UAAU,YAAgB,OAAO;6BA6BnD,MAAM,eAAe,MAAM,eAAc,UAAU,YAAgB,OAAO;CAiCjH,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const SUCCESS_HTTP_CODES = [200, 201, 204];
|
|
4
|
+
const NO_RESPONSE_HTTP_CODE = 204;
|
|
5
|
+
/** Returns helpers to process requests successfully or expect an error. */
|
|
6
|
+
const execute = (service, options = {}) => {
|
|
7
|
+
const { logger = console } = options;
|
|
8
|
+
/** Processes an operation parameters via service. */
|
|
9
|
+
const exec = async (operationId, parameters = {}, headers = {}) => {
|
|
10
|
+
const { mutation: body, ...queryStringParameters } = parameters;
|
|
11
|
+
const request = {
|
|
12
|
+
body,
|
|
13
|
+
headers,
|
|
14
|
+
operationId,
|
|
15
|
+
queryStringParameters
|
|
16
|
+
};
|
|
17
|
+
const response = await service.process(request);
|
|
18
|
+
let result;
|
|
19
|
+
if (response.body) {
|
|
20
|
+
result = JSON.parse(response.body);
|
|
21
|
+
}
|
|
22
|
+
return { ...response, result };
|
|
23
|
+
};
|
|
24
|
+
/** Processes an operation parameters via service, expects successfull response. */
|
|
25
|
+
const request = async (operationId, parameters = {}, headers = {}) => {
|
|
26
|
+
const { result, statusCode, } = await exec(operationId, parameters, headers);
|
|
27
|
+
let data;
|
|
28
|
+
const isResultExpected = statusCode !== NO_RESPONSE_HTTP_CODE;
|
|
29
|
+
if (isResultExpected) {
|
|
30
|
+
data = result.data;
|
|
31
|
+
}
|
|
32
|
+
const isSuccess = SUCCESS_HTTP_CODES.includes(statusCode);
|
|
33
|
+
if (!isSuccess) {
|
|
34
|
+
const { error } = result;
|
|
35
|
+
logger.error(`\x1b[31mRequestError for "${operationId}"\x1b[37m`);
|
|
36
|
+
logger.dir({ operationId, parameters, error }, { depth: null });
|
|
37
|
+
throw Error(`RequestError for "${operationId}"`);
|
|
38
|
+
}
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
/** Processes an operation parameters via service, expects an error with a specific code. */
|
|
42
|
+
const expectError = async (errorCode, operationId, parameters = {}, headers = {}) => {
|
|
43
|
+
const { result, statusCode, } = await exec(operationId, parameters, headers);
|
|
44
|
+
const isSuccess = SUCCESS_HTTP_CODES.includes(statusCode);
|
|
45
|
+
if (isSuccess) {
|
|
46
|
+
const { data } = result;
|
|
47
|
+
logger.error(`\x1b[31mSuccess NOT expected for "${operationId}"\x1b[37m`);
|
|
48
|
+
logger.dir({ operationId, statusCode, parameters, data }, { depth: null });
|
|
49
|
+
throw Error(`Success NOT expected for "${operationId}"`);
|
|
50
|
+
}
|
|
51
|
+
const { error } = result;
|
|
52
|
+
const isExpectedCode = error.code === errorCode;
|
|
53
|
+
if (!isExpectedCode) {
|
|
54
|
+
throw Error(`Unexpected error code received "${error.code}", expected "${errorCode}"`);
|
|
55
|
+
}
|
|
56
|
+
return error;
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
exec,
|
|
60
|
+
request,
|
|
61
|
+
expectError,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
exports.default = execute;
|
|
65
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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K,CAAC,IAAI,KAAK,SAAS,CAAC;QAEhD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,KAAK,CAAC,mCAAmC,KAAK,CAAC,IAAI,gBAAgB,SAAS,GAAG,CAAC,CAAC;QACzF,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,OAAO;QACP,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Item = Record<string, unknown>;
|
|
2
|
+
export type Items = Item[];
|
|
3
|
+
export type Query = Record<string, unknown>;
|
|
4
|
+
/** Finds item in a list using query. */
|
|
5
|
+
declare const findItem: (items: Items, query: Query) => Item | undefined;
|
|
6
|
+
export default findItem;
|
|
7
|
+
//# sourceMappingURL=findItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/findItem.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,MAAM,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;AAC3B,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5C,wCAAwC;AACxC,QAAA,MAAM,QAAQ,GAAI,OAAO,KAAK,EAAE,OAAO,KAAK,KAAG,IAAI,GAAG,SAclD,CAAC;AAEL,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/** Finds item in a list using query. */
|
|
4
|
+
const findItem = (items, query) => items.find(item => {
|
|
5
|
+
for (const key in query) {
|
|
6
|
+
const queryValue = query[key];
|
|
7
|
+
const itemValue = item[key];
|
|
8
|
+
const isMatch = itemValue === queryValue;
|
|
9
|
+
if (!isMatch) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
});
|
|
15
|
+
exports.default = findItem;
|
|
16
|
+
//# sourceMappingURL=findItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findItem.js","sourceRoot":"","sources":["../../../src/Service/test/findItem.ts"],"names":[],"mappings":";;AAIA,wCAAwC;AACxC,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAE,KAAY,EAAoB,EAAE,CAChE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;IAChB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5B,MAAM,OAAO,GAAG,SAAS,KAAK,UAAU,CAAC;QAEzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC;AAEL,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Items } from './findItem';
|
|
2
|
+
/** Returns value or ensures specified attribute exists for the first item from the list. */
|
|
3
|
+
declare const firstItemGet: (items: Items, attributeName: string, isUndefinedExpected?: boolean) => unknown;
|
|
4
|
+
export default firstItemGet;
|
|
5
|
+
//# sourceMappingURL=firstItemGet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstItemGet.d.ts","sourceRoot":"","sources":["../../../src/Service/test/firstItemGet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,4FAA4F;AAC5F,QAAA,MAAM,YAAY,GAAI,OAAO,KAAK,EAAE,eAAe,MAAM,EAAE,sBAAqB,OAAe,YAU9F,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
const schema_1 = require("@kravc/schema");
|
|
5
|
+
/** Returns value or ensures specified attribute exists for the first item from the list. */
|
|
6
|
+
const firstItemGet = (items, attributeName, isUndefinedExpected = false) => {
|
|
7
|
+
const [firstItem] = items;
|
|
8
|
+
if (isUndefinedExpected) {
|
|
9
|
+
return (0, lodash_1.get)(firstItem || {}, attributeName);
|
|
10
|
+
}
|
|
11
|
+
expect(firstItem).toBeDefined();
|
|
12
|
+
return (0, schema_1.got)(firstItem, attributeName);
|
|
13
|
+
};
|
|
14
|
+
exports.default = firstItemGet;
|
|
15
|
+
//# sourceMappingURL=firstItemGet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstItemGet.js","sourceRoot":"","sources":["../../../src/Service/test/firstItemGet.ts"],"names":[],"mappings":";;AAAA,mCAA6B;AAC7B,0CAAoC;AAGpC,4FAA4F;AAC5F,MAAM,YAAY,GAAG,CAAC,KAAY,EAAE,aAAqB,EAAE,sBAA+B,KAAK,EAAE,EAAE;IACjG,MAAM,CAAE,SAAS,CAAE,GAAG,KAAK,CAAC;IAE5B,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,IAAA,YAAG,EAAC,SAAS,IAAI,EAAE,EAAE,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;IAEhC,OAAO,IAAA,YAAG,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import wait from './wait';
|
|
2
|
+
import execute from './execute';
|
|
3
|
+
import findItem from './findItem';
|
|
4
|
+
import ensureItem from './ensureItem';
|
|
5
|
+
import ensureNoItem from './ensureNoItem';
|
|
6
|
+
import firstItemGet from './firstItemGet';
|
|
7
|
+
import createAccessToken from './createAccessToken';
|
|
8
|
+
export { wait, execute, findItem, ensureItem, ensureNoItem, firstItemGet, createAccessToken };
|
|
9
|
+
export * from './keys';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Service/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EAClB,CAAC;AAEF,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.createAccessToken = exports.firstItemGet = exports.ensureNoItem = exports.ensureItem = exports.findItem = exports.execute = exports.wait = void 0;
|
|
21
|
+
const wait_1 = __importDefault(require("./wait"));
|
|
22
|
+
exports.wait = wait_1.default;
|
|
23
|
+
const execute_1 = __importDefault(require("./execute"));
|
|
24
|
+
exports.execute = execute_1.default;
|
|
25
|
+
const findItem_1 = __importDefault(require("./findItem"));
|
|
26
|
+
exports.findItem = findItem_1.default;
|
|
27
|
+
const ensureItem_1 = __importDefault(require("./ensureItem"));
|
|
28
|
+
exports.ensureItem = ensureItem_1.default;
|
|
29
|
+
const ensureNoItem_1 = __importDefault(require("./ensureNoItem"));
|
|
30
|
+
exports.ensureNoItem = ensureNoItem_1.default;
|
|
31
|
+
const firstItemGet_1 = __importDefault(require("./firstItemGet"));
|
|
32
|
+
exports.firstItemGet = firstItemGet_1.default;
|
|
33
|
+
const createAccessToken_1 = __importDefault(require("./createAccessToken"));
|
|
34
|
+
exports.createAccessToken = createAccessToken_1.default;
|
|
35
|
+
__exportStar(require("./keys"), exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Service/test/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AASxB,eATK,cAAI,CASL;AARN,wDAAgC;AAS9B,kBATK,iBAAO,CASL;AART,0DAAkC;AAShC,mBATK,kBAAQ,CASL;AARV,8DAAsC;AASpC,qBATK,oBAAU,CASL;AARZ,kEAA0C;AASxC,uBATK,sBAAY,CASL;AARd,kEAA0C;AASxC,uBATK,sBAAY,CASL;AARd,4EAAoD;AASlD,4BATK,2BAAiB,CASL;AAGnB,yCAAuB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const TEST_ISSUER = "http://localhost:3000";
|
|
2
|
+
declare const TEST_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA8+PZ2JWhsb9kwI4gdEhr\nxaRimI6p/zYgYY9pb16wmiR5T2JaStWJU0Whbd8SImqgNPpNUkBhjMU1gY2rdYDr\nK1vLyYcOrF6dZs50LzTZkxr6siWARYIOfgKKm+zfESNR2LhT+846pAwgjyzTfIri\nE5astLrUtrHoDCH0kvUEBgWREDwNpOsDcuWdt/9J50rVKlIar5XhfPxN0ZPqkb4F\nUnZXOwbE4yHEUcafXwnEAJ+e7nRMSAkTUQahN722xdZKYSeATSvANIAr64CH3Cxv\nvHWDt7ZJUJ1wgRWmkyqOkJu+NwnNhVBLt/6KacMkdXLDJhq7KnOFOmGLqUIPEY2F\nyFGahicWYoZiYCLli/XknzZRtmKjXrwvbIE6tx5lF/+RwD75Y4j057SHwDkvA/G7\naBMvcCBYMnRRuJnsnGf8hXwjbdjvbjx3S3NQU/nOumEuPEjSmm92WrnLXLfmVVrv\nAImtxiAZWQi/EKVion96g3rTpirbbpp11+8JIlcy0cKZFNN3Vwfw2JmsG5srBEqz\n0S7s7ybuMPiRpD+NcxmSzbZt4qpgBDKJe71J0P6tzeca2SS7JuhUYwVdakiLKQT6\nMKZT4sNBcn2mY/lYRNn3iw5Tc1mZ8Ou3EWwzR4uJUyyp1EUjvDjAT7vWauFrz1gW\neknx7j5GYy4QAZMQXsXCS80CAwEAAQ==\n-----END PUBLIC KEY-----";
|
|
3
|
+
declare const TEST_PRIVATE_KEY = "-----BEGIN PRIVATE KEY-----\nMIIJQwIBADANBgkqhkiG9w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kykHMReK+D02pckJVfJcY8=\n-----END PRIVATE KEY-----";
|
|
4
|
+
export { TEST_ISSUER, TEST_PUBLIC_KEY, TEST_PRIVATE_KEY, };
|
|
5
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/Service/test/keys.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW,0BAA0B,CAAC;AAE5C,QAAA,MAAM,eAAe,izBAaI,CAAC;AAE1B,QAAA,MAAM,gBAAgB,+vGAmDI,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,GACjB,CAAC"}
|