@cratis/arc 18.0.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/GetHttpHeaders.ts +7 -0
- package/Globals.ts +14 -0
- package/ICanBeConfigured.ts +33 -0
- package/README.md +65 -0
- package/UrlHelpers.ts +71 -0
- package/commands/Command.ts +209 -0
- package/commands/CommandResult.ts +203 -0
- package/commands/CommandResults.ts +105 -0
- package/commands/CommandValidator.ts +17 -0
- package/commands/ICommand.ts +82 -0
- package/commands/ICommandResult.ts +60 -0
- package/commands/for_Command/CommandWithRouteParams.ts +34 -0
- package/commands/for_Command/SomeCommand.ts +34 -0
- package/commands/for_Command/given/a_command.ts +18 -0
- package/commands/for_Command/when_clearing_the_command.ts +17 -0
- package/commands/for_Command/when_executing/and_command_route_not_found.ts +26 -0
- package/commands/for_Command/when_executing/and_fetch_throws_exception.ts +24 -0
- package/commands/for_Command/when_executing/with_command_properties.ts +40 -0
- package/commands/for_Command/when_executing/with_custom_http_headers.ts +60 -0
- package/commands/for_Command/when_executing/with_microservice_header.ts +55 -0
- package/commands/for_Command/when_executing/with_origin_and_api_base_path.ts +51 -0
- package/commands/for_Command/when_executing/with_route_parameters.ts +58 -0
- package/commands/for_Command/when_executing/with_successful_response.ts +51 -0
- package/commands/for_Command/when_property_changed_value_that_is_different_from_initial_value.ts +16 -0
- package/commands/for_Command/when_property_changed_value_that_is_same_as_initial_value.ts +16 -0
- package/commands/for_Command/when_property_changes_and_initial_value_is_undefined.ts +12 -0
- package/commands/for_Command/when_property_changes_and_there_is_a_callback.ts +15 -0
- package/commands/for_Command/when_property_has_changed_and_we_revert.ts +15 -0
- package/commands/for_Command/when_setting_initial_values_after_property_changed.ts +17 -0
- package/commands/for_Command/when_validating/and_fetch_throws_exception.ts +24 -0
- package/commands/for_Command/when_validating/and_validation_endpoint_not_found.ts +26 -0
- package/commands/for_Command/when_validating/does_not_update_initial_values.ts +39 -0
- package/commands/for_Command/when_validating/with_successful_response.ts +47 -0
- package/commands/for_Command/when_validating/with_validation_errors.ts +45 -0
- package/commands/for_CommandResult/when_chaining_callbacks/and_result_has_exceptions.ts +54 -0
- package/commands/for_CommandResult/when_chaining_callbacks/and_result_is_invalid.ts +53 -0
- package/commands/for_CommandResult/when_chaining_callbacks/and_result_is_successful.ts +42 -0
- package/commands/for_CommandResult/when_chaining_callbacks/and_result_is_unauthorized.ts +43 -0
- package/commands/index.ts +9 -0
- package/deepEqual.ts +23 -0
- package/dist/cjs/GetHttpHeaders.d.ts +2 -0
- package/dist/cjs/GetHttpHeaders.d.ts.map +1 -0
- package/dist/cjs/Globals.d.ts +7 -0
- package/dist/cjs/Globals.d.ts.map +1 -0
- package/dist/cjs/Globals.js +10 -0
- package/dist/cjs/Globals.js.map +1 -0
- package/dist/cjs/ICanBeConfigured.d.ts +8 -0
- package/dist/cjs/ICanBeConfigured.d.ts.map +1 -0
- package/dist/cjs/UrlHelpers.d.ts +9 -0
- package/dist/cjs/UrlHelpers.d.ts.map +1 -0
- package/dist/cjs/UrlHelpers.js +43 -0
- package/dist/cjs/UrlHelpers.js.map +1 -0
- package/dist/cjs/commands/Command.d.ts +41 -0
- package/dist/cjs/commands/Command.d.ts.map +1 -0
- package/dist/cjs/commands/Command.js +151 -0
- package/dist/cjs/commands/Command.js.map +1 -0
- package/dist/cjs/commands/CommandResult.d.ts +48 -0
- package/dist/cjs/commands/CommandResult.d.ts.map +1 -0
- package/dist/cjs/commands/CommandResult.js +95 -0
- package/dist/cjs/commands/CommandResult.js.map +1 -0
- package/dist/cjs/commands/CommandResults.d.ts +23 -0
- package/dist/cjs/commands/CommandResults.d.ts.map +1 -0
- package/dist/cjs/commands/CommandResults.js +72 -0
- package/dist/cjs/commands/CommandResults.js.map +1 -0
- package/dist/cjs/commands/CommandValidator.d.ts +9 -0
- package/dist/cjs/commands/CommandValidator.d.ts.map +1 -0
- package/dist/cjs/commands/CommandValidator.js +10 -0
- package/dist/cjs/commands/CommandValidator.js.map +1 -0
- package/dist/cjs/commands/ICommand.d.ts +18 -0
- package/dist/cjs/commands/ICommand.d.ts.map +1 -0
- package/dist/cjs/commands/ICommandResult.d.ts +15 -0
- package/dist/cjs/commands/ICommandResult.d.ts.map +1 -0
- package/dist/cjs/commands/index.d.ts +7 -0
- package/dist/cjs/commands/index.d.ts.map +1 -0
- package/dist/cjs/commands/index.js +14 -0
- package/dist/cjs/commands/index.js.map +1 -0
- package/dist/cjs/deepEqual.d.ts +2 -0
- package/dist/cjs/deepEqual.d.ts.map +1 -0
- package/dist/cjs/deepEqual.js +22 -0
- package/dist/cjs/deepEqual.js.map +1 -0
- package/dist/cjs/given.d.ts +5 -0
- package/dist/cjs/given.d.ts.map +1 -0
- package/dist/cjs/identity/IIdentity.d.ts +8 -0
- package/dist/cjs/identity/IIdentity.d.ts.map +1 -0
- package/dist/cjs/identity/IIdentityProvider.d.ts +5 -0
- package/dist/cjs/identity/IIdentityProvider.d.ts.map +1 -0
- package/dist/cjs/identity/IIdentityProvider.js +7 -0
- package/dist/cjs/identity/IIdentityProvider.js.map +1 -0
- package/dist/cjs/identity/IdentityProvider.d.ts +14 -0
- package/dist/cjs/identity/IdentityProvider.d.ts.map +1 -0
- package/dist/cjs/identity/IdentityProvider.js +63 -0
- package/dist/cjs/identity/IdentityProvider.js.map +1 -0
- package/dist/cjs/identity/IdentityProviderResult.d.ts +6 -0
- package/dist/cjs/identity/IdentityProviderResult.d.ts.map +1 -0
- package/dist/cjs/identity/index.d.ts +5 -0
- package/dist/cjs/identity/index.d.ts.map +1 -0
- package/dist/cjs/identity/index.js +10 -0
- package/dist/cjs/identity/index.js.map +1 -0
- package/dist/cjs/index.d.ts +12 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/joinPaths.d.ts +2 -0
- package/dist/cjs/joinPaths.d.ts.map +1 -0
- package/dist/cjs/joinPaths.js +9 -0
- package/dist/cjs/joinPaths.js.map +1 -0
- package/dist/cjs/queries/IObservableQueryConnection.d.ts +6 -0
- package/dist/cjs/queries/IObservableQueryConnection.d.ts.map +1 -0
- package/dist/cjs/queries/IObservableQueryFor.d.ts +13 -0
- package/dist/cjs/queries/IObservableQueryFor.d.ts.map +1 -0
- package/dist/cjs/queries/IQuery.d.ts +10 -0
- package/dist/cjs/queries/IQuery.d.ts.map +1 -0
- package/dist/cjs/queries/IQueryFor.d.ts +12 -0
- package/dist/cjs/queries/IQueryFor.d.ts.map +1 -0
- package/dist/cjs/queries/IQueryProvider.d.ts +6 -0
- package/dist/cjs/queries/IQueryProvider.d.ts.map +1 -0
- package/dist/cjs/queries/IQueryProvider.js +7 -0
- package/dist/cjs/queries/IQueryProvider.js.map +1 -0
- package/dist/cjs/queries/IQueryResult.d.ts +15 -0
- package/dist/cjs/queries/IQueryResult.d.ts.map +1 -0
- package/dist/cjs/queries/NullObservableQueryConnection.d.ts +9 -0
- package/dist/cjs/queries/NullObservableQueryConnection.d.ts.map +1 -0
- package/dist/cjs/queries/NullObservableQueryConnection.js +18 -0
- package/dist/cjs/queries/NullObservableQueryConnection.js.map +1 -0
- package/dist/cjs/queries/ObservableQueryConnection.d.ts +14 -0
- package/dist/cjs/queries/ObservableQueryConnection.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQueryConnection.js +101 -0
- package/dist/cjs/queries/ObservableQueryConnection.js.map +1 -0
- package/dist/cjs/queries/ObservableQueryFor.d.ts +37 -0
- package/dist/cjs/queries/ObservableQueryFor.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQueryFor.js +176 -0
- package/dist/cjs/queries/ObservableQueryFor.js.map +1 -0
- package/dist/cjs/queries/ObservableQuerySubscription.d.ts +7 -0
- package/dist/cjs/queries/ObservableQuerySubscription.d.ts.map +1 -0
- package/dist/cjs/queries/ObservableQuerySubscription.js +17 -0
- package/dist/cjs/queries/ObservableQuerySubscription.js.map +1 -0
- package/dist/cjs/queries/Paging.d.ts +8 -0
- package/dist/cjs/queries/Paging.d.ts.map +1 -0
- package/dist/cjs/queries/Paging.js +17 -0
- package/dist/cjs/queries/Paging.js.map +1 -0
- package/dist/cjs/queries/PagingInfo.d.ts +9 -0
- package/dist/cjs/queries/PagingInfo.d.ts.map +1 -0
- package/dist/cjs/queries/PagingInfo.js +18 -0
- package/dist/cjs/queries/PagingInfo.js.map +1 -0
- package/dist/cjs/queries/QueryFor.d.ts +30 -0
- package/dist/cjs/queries/QueryFor.d.ts.map +1 -0
- package/dist/cjs/queries/QueryFor.js +101 -0
- package/dist/cjs/queries/QueryFor.js.map +1 -0
- package/dist/cjs/queries/QueryProvider.d.ts +13 -0
- package/dist/cjs/queries/QueryProvider.d.ts.map +1 -0
- package/dist/cjs/queries/QueryProvider.js +25 -0
- package/dist/cjs/queries/QueryProvider.js.map +1 -0
- package/dist/cjs/queries/QueryResult.d.ts +44 -0
- package/dist/cjs/queries/QueryResult.d.ts.map +1 -0
- package/dist/cjs/queries/QueryResult.js +95 -0
- package/dist/cjs/queries/QueryResult.js.map +1 -0
- package/dist/cjs/queries/QueryResultWithState.d.ts +22 -0
- package/dist/cjs/queries/QueryResultWithState.d.ts.map +1 -0
- package/dist/cjs/queries/QueryResultWithState.js +46 -0
- package/dist/cjs/queries/QueryResultWithState.js.map +1 -0
- package/dist/cjs/queries/SortDirection.d.ts +6 -0
- package/dist/cjs/queries/SortDirection.d.ts.map +1 -0
- package/dist/cjs/queries/SortDirection.js +9 -0
- package/dist/cjs/queries/SortDirection.js.map +1 -0
- package/dist/cjs/queries/Sorting.d.ts +9 -0
- package/dist/cjs/queries/Sorting.d.ts.map +1 -0
- package/dist/cjs/queries/Sorting.js +19 -0
- package/dist/cjs/queries/Sorting.js.map +1 -0
- package/dist/cjs/queries/SortingActions.d.ts +10 -0
- package/dist/cjs/queries/SortingActions.d.ts.map +1 -0
- package/dist/cjs/queries/SortingActions.js +24 -0
- package/dist/cjs/queries/SortingActions.js.map +1 -0
- package/dist/cjs/queries/SortingActionsForObservableQuery.d.ts +10 -0
- package/dist/cjs/queries/SortingActionsForObservableQuery.d.ts.map +1 -0
- package/dist/cjs/queries/SortingActionsForObservableQuery.js +24 -0
- package/dist/cjs/queries/SortingActionsForObservableQuery.js.map +1 -0
- package/dist/cjs/queries/SortingActionsForQuery.d.ts +10 -0
- package/dist/cjs/queries/SortingActionsForQuery.d.ts.map +1 -0
- package/dist/cjs/queries/SortingActionsForQuery.js +24 -0
- package/dist/cjs/queries/SortingActionsForQuery.js.map +1 -0
- package/dist/cjs/queries/ValidateRequestArguments.d.ts +2 -0
- package/dist/cjs/queries/ValidateRequestArguments.d.ts.map +1 -0
- package/dist/cjs/queries/ValidateRequestArguments.js +29 -0
- package/dist/cjs/queries/ValidateRequestArguments.js.map +1 -0
- package/dist/cjs/queries/index.d.ts +19 -0
- package/dist/cjs/queries/index.d.ts.map +1 -0
- package/dist/cjs/queries/index.js +37 -0
- package/dist/cjs/queries/index.js.map +1 -0
- package/dist/cjs/reflection/IHaveParameters.d.ts +5 -0
- package/dist/cjs/reflection/IHaveParameters.d.ts.map +1 -0
- package/dist/cjs/reflection/ParameterDescriptor.d.ts +7 -0
- package/dist/cjs/reflection/ParameterDescriptor.d.ts.map +1 -0
- package/dist/cjs/reflection/ParameterDescriptor.js +13 -0
- package/dist/cjs/reflection/ParameterDescriptor.js.map +1 -0
- package/dist/cjs/reflection/ParametersHelper.d.ts +5 -0
- package/dist/cjs/reflection/ParametersHelper.d.ts.map +1 -0
- package/dist/cjs/reflection/ParametersHelper.js +17 -0
- package/dist/cjs/reflection/ParametersHelper.js.map +1 -0
- package/dist/cjs/reflection/PropertyDescriptor.d.ts +7 -0
- package/dist/cjs/reflection/PropertyDescriptor.d.ts.map +1 -0
- package/dist/cjs/reflection/PropertyDescriptor.js +13 -0
- package/dist/cjs/reflection/PropertyDescriptor.js.map +1 -0
- package/dist/cjs/reflection/index.d.ts +5 -0
- package/dist/cjs/reflection/index.d.ts.map +1 -0
- package/dist/cjs/reflection/index.js +12 -0
- package/dist/cjs/reflection/index.js.map +1 -0
- package/dist/cjs/validation/ValidationResult.d.ts +9 -0
- package/dist/cjs/validation/ValidationResult.d.ts.map +1 -0
- package/dist/cjs/validation/ValidationResult.js +17 -0
- package/dist/cjs/validation/ValidationResult.js.map +1 -0
- package/dist/cjs/validation/ValidationResultSeverity.d.ts +7 -0
- package/dist/cjs/validation/ValidationResultSeverity.d.ts.map +1 -0
- package/dist/cjs/validation/Validator.d.ts +4 -0
- package/dist/cjs/validation/Validator.d.ts.map +1 -0
- package/dist/cjs/validation/Validator.js +10 -0
- package/dist/cjs/validation/Validator.js.map +1 -0
- package/dist/cjs/validation/index.d.ts +3 -0
- package/dist/cjs/validation/index.d.ts.map +1 -0
- package/dist/cjs/validation/index.js +10 -0
- package/dist/cjs/validation/index.js.map +1 -0
- package/dist/esm/GetHttpHeaders.d.ts +2 -0
- package/dist/esm/GetHttpHeaders.d.ts.map +1 -0
- package/dist/esm/GetHttpHeaders.js +2 -0
- package/dist/esm/GetHttpHeaders.js.map +1 -0
- package/dist/esm/Globals.d.ts +7 -0
- package/dist/esm/Globals.d.ts.map +1 -0
- package/dist/esm/Globals.js +8 -0
- package/dist/esm/Globals.js.map +1 -0
- package/dist/esm/ICanBeConfigured.d.ts +8 -0
- package/dist/esm/ICanBeConfigured.d.ts.map +1 -0
- package/dist/esm/ICanBeConfigured.js +2 -0
- package/dist/esm/ICanBeConfigured.js.map +1 -0
- package/dist/esm/UrlHelpers.d.ts +9 -0
- package/dist/esm/UrlHelpers.d.ts.map +1 -0
- package/dist/esm/UrlHelpers.js +41 -0
- package/dist/esm/UrlHelpers.js.map +1 -0
- package/dist/esm/commands/Command.d.ts +41 -0
- package/dist/esm/commands/Command.d.ts.map +1 -0
- package/dist/esm/commands/Command.js +149 -0
- package/dist/esm/commands/Command.js.map +1 -0
- package/dist/esm/commands/CommandResult.d.ts +48 -0
- package/dist/esm/commands/CommandResult.d.ts.map +1 -0
- package/dist/esm/commands/CommandResult.js +93 -0
- package/dist/esm/commands/CommandResult.js.map +1 -0
- package/dist/esm/commands/CommandResults.d.ts +23 -0
- package/dist/esm/commands/CommandResults.d.ts.map +1 -0
- package/dist/esm/commands/CommandResults.js +70 -0
- package/dist/esm/commands/CommandResults.js.map +1 -0
- package/dist/esm/commands/CommandValidator.d.ts +9 -0
- package/dist/esm/commands/CommandValidator.d.ts.map +1 -0
- package/dist/esm/commands/CommandValidator.js +8 -0
- package/dist/esm/commands/CommandValidator.js.map +1 -0
- package/dist/esm/commands/ICommand.d.ts +18 -0
- package/dist/esm/commands/ICommand.d.ts.map +1 -0
- package/dist/esm/commands/ICommand.js +2 -0
- package/dist/esm/commands/ICommand.js.map +1 -0
- package/dist/esm/commands/ICommandResult.d.ts +15 -0
- package/dist/esm/commands/ICommandResult.d.ts.map +1 -0
- package/dist/esm/commands/ICommandResult.js +2 -0
- package/dist/esm/commands/ICommandResult.js.map +1 -0
- package/dist/esm/commands/index.d.ts +7 -0
- package/dist/esm/commands/index.d.ts.map +1 -0
- package/dist/esm/commands/index.js +5 -0
- package/dist/esm/commands/index.js.map +1 -0
- package/dist/esm/deepEqual.d.ts +2 -0
- package/dist/esm/deepEqual.d.ts.map +1 -0
- package/dist/esm/deepEqual.js +20 -0
- package/dist/esm/deepEqual.js.map +1 -0
- package/dist/esm/given.d.ts +5 -0
- package/dist/esm/given.d.ts.map +1 -0
- package/dist/esm/given.js +7 -0
- package/dist/esm/given.js.map +1 -0
- package/dist/esm/identity/IIdentity.d.ts +8 -0
- package/dist/esm/identity/IIdentity.d.ts.map +1 -0
- package/dist/esm/identity/IIdentity.js +2 -0
- package/dist/esm/identity/IIdentity.js.map +1 -0
- package/dist/esm/identity/IIdentityProvider.d.ts +5 -0
- package/dist/esm/identity/IIdentityProvider.d.ts.map +1 -0
- package/dist/esm/identity/IIdentityProvider.js +5 -0
- package/dist/esm/identity/IIdentityProvider.js.map +1 -0
- package/dist/esm/identity/IdentityProvider.d.ts +14 -0
- package/dist/esm/identity/IdentityProvider.d.ts.map +1 -0
- package/dist/esm/identity/IdentityProvider.js +61 -0
- package/dist/esm/identity/IdentityProvider.js.map +1 -0
- package/dist/esm/identity/IdentityProviderResult.d.ts +6 -0
- package/dist/esm/identity/IdentityProviderResult.d.ts.map +1 -0
- package/dist/esm/identity/IdentityProviderResult.js +2 -0
- package/dist/esm/identity/IdentityProviderResult.js.map +1 -0
- package/dist/esm/identity/index.d.ts +5 -0
- package/dist/esm/identity/index.d.ts.map +1 -0
- package/dist/esm/identity/index.js +3 -0
- package/dist/esm/identity/index.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/joinPaths.d.ts +2 -0
- package/dist/esm/joinPaths.d.ts.map +1 -0
- package/dist/esm/joinPaths.js +7 -0
- package/dist/esm/joinPaths.js.map +1 -0
- package/dist/esm/queries/IObservableQueryConnection.d.ts +6 -0
- package/dist/esm/queries/IObservableQueryConnection.d.ts.map +1 -0
- package/dist/esm/queries/IObservableQueryConnection.js +2 -0
- package/dist/esm/queries/IObservableQueryConnection.js.map +1 -0
- package/dist/esm/queries/IObservableQueryFor.d.ts +13 -0
- package/dist/esm/queries/IObservableQueryFor.d.ts.map +1 -0
- package/dist/esm/queries/IObservableQueryFor.js +2 -0
- package/dist/esm/queries/IObservableQueryFor.js.map +1 -0
- package/dist/esm/queries/IQuery.d.ts +10 -0
- package/dist/esm/queries/IQuery.d.ts.map +1 -0
- package/dist/esm/queries/IQuery.js +2 -0
- package/dist/esm/queries/IQuery.js.map +1 -0
- package/dist/esm/queries/IQueryFor.d.ts +12 -0
- package/dist/esm/queries/IQueryFor.d.ts.map +1 -0
- package/dist/esm/queries/IQueryFor.js +2 -0
- package/dist/esm/queries/IQueryFor.js.map +1 -0
- package/dist/esm/queries/IQueryProvider.d.ts +6 -0
- package/dist/esm/queries/IQueryProvider.d.ts.map +1 -0
- package/dist/esm/queries/IQueryProvider.js +5 -0
- package/dist/esm/queries/IQueryProvider.js.map +1 -0
- package/dist/esm/queries/IQueryResult.d.ts +15 -0
- package/dist/esm/queries/IQueryResult.d.ts.map +1 -0
- package/dist/esm/queries/IQueryResult.js +2 -0
- package/dist/esm/queries/IQueryResult.js.map +1 -0
- package/dist/esm/queries/NullObservableQueryConnection.d.ts +9 -0
- package/dist/esm/queries/NullObservableQueryConnection.d.ts.map +1 -0
- package/dist/esm/queries/NullObservableQueryConnection.js +16 -0
- package/dist/esm/queries/NullObservableQueryConnection.js.map +1 -0
- package/dist/esm/queries/ObservableQueryConnection.d.ts +14 -0
- package/dist/esm/queries/ObservableQueryConnection.d.ts.map +1 -0
- package/dist/esm/queries/ObservableQueryConnection.js +99 -0
- package/dist/esm/queries/ObservableQueryConnection.js.map +1 -0
- package/dist/esm/queries/ObservableQueryFor.d.ts +37 -0
- package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -0
- package/dist/esm/queries/ObservableQueryFor.js +174 -0
- package/dist/esm/queries/ObservableQueryFor.js.map +1 -0
- package/dist/esm/queries/ObservableQuerySubscription.d.ts +7 -0
- package/dist/esm/queries/ObservableQuerySubscription.d.ts.map +1 -0
- package/dist/esm/queries/ObservableQuerySubscription.js +15 -0
- package/dist/esm/queries/ObservableQuerySubscription.js.map +1 -0
- package/dist/esm/queries/Paging.d.ts +8 -0
- package/dist/esm/queries/Paging.d.ts.map +1 -0
- package/dist/esm/queries/Paging.js +15 -0
- package/dist/esm/queries/Paging.js.map +1 -0
- package/dist/esm/queries/PagingInfo.d.ts +9 -0
- package/dist/esm/queries/PagingInfo.d.ts.map +1 -0
- package/dist/esm/queries/PagingInfo.js +16 -0
- package/dist/esm/queries/PagingInfo.js.map +1 -0
- package/dist/esm/queries/QueryFor.d.ts +30 -0
- package/dist/esm/queries/QueryFor.d.ts.map +1 -0
- package/dist/esm/queries/QueryFor.js +99 -0
- package/dist/esm/queries/QueryFor.js.map +1 -0
- package/dist/esm/queries/QueryProvider.d.ts +13 -0
- package/dist/esm/queries/QueryProvider.d.ts.map +1 -0
- package/dist/esm/queries/QueryProvider.js +23 -0
- package/dist/esm/queries/QueryProvider.js.map +1 -0
- package/dist/esm/queries/QueryResult.d.ts +44 -0
- package/dist/esm/queries/QueryResult.d.ts.map +1 -0
- package/dist/esm/queries/QueryResult.js +93 -0
- package/dist/esm/queries/QueryResult.js.map +1 -0
- package/dist/esm/queries/QueryResultWithState.d.ts +22 -0
- package/dist/esm/queries/QueryResultWithState.d.ts.map +1 -0
- package/dist/esm/queries/QueryResultWithState.js +44 -0
- package/dist/esm/queries/QueryResultWithState.js.map +1 -0
- package/dist/esm/queries/SortDirection.d.ts +6 -0
- package/dist/esm/queries/SortDirection.d.ts.map +1 -0
- package/dist/esm/queries/SortDirection.js +9 -0
- package/dist/esm/queries/SortDirection.js.map +1 -0
- package/dist/esm/queries/Sorting.d.ts +9 -0
- package/dist/esm/queries/Sorting.d.ts.map +1 -0
- package/dist/esm/queries/Sorting.js +17 -0
- package/dist/esm/queries/Sorting.js.map +1 -0
- package/dist/esm/queries/SortingActions.d.ts +10 -0
- package/dist/esm/queries/SortingActions.d.ts.map +1 -0
- package/dist/esm/queries/SortingActions.js +22 -0
- package/dist/esm/queries/SortingActions.js.map +1 -0
- package/dist/esm/queries/SortingActionsForObservableQuery.d.ts +10 -0
- package/dist/esm/queries/SortingActionsForObservableQuery.d.ts.map +1 -0
- package/dist/esm/queries/SortingActionsForObservableQuery.js +22 -0
- package/dist/esm/queries/SortingActionsForObservableQuery.js.map +1 -0
- package/dist/esm/queries/SortingActionsForQuery.d.ts +10 -0
- package/dist/esm/queries/SortingActionsForQuery.d.ts.map +1 -0
- package/dist/esm/queries/SortingActionsForQuery.js +22 -0
- package/dist/esm/queries/SortingActionsForQuery.js.map +1 -0
- package/dist/esm/queries/ValidateRequestArguments.d.ts +2 -0
- package/dist/esm/queries/ValidateRequestArguments.d.ts.map +1 -0
- package/dist/esm/queries/ValidateRequestArguments.js +27 -0
- package/dist/esm/queries/ValidateRequestArguments.js.map +1 -0
- package/dist/esm/queries/index.d.ts +19 -0
- package/dist/esm/queries/index.d.ts.map +1 -0
- package/dist/esm/queries/index.js +15 -0
- package/dist/esm/queries/index.js.map +1 -0
- package/dist/esm/reflection/IHaveParameters.d.ts +5 -0
- package/dist/esm/reflection/IHaveParameters.d.ts.map +1 -0
- package/dist/esm/reflection/IHaveParameters.js +2 -0
- package/dist/esm/reflection/IHaveParameters.js.map +1 -0
- package/dist/esm/reflection/ParameterDescriptor.d.ts +7 -0
- package/dist/esm/reflection/ParameterDescriptor.d.ts.map +1 -0
- package/dist/esm/reflection/ParameterDescriptor.js +11 -0
- package/dist/esm/reflection/ParameterDescriptor.js.map +1 -0
- package/dist/esm/reflection/ParametersHelper.d.ts +5 -0
- package/dist/esm/reflection/ParametersHelper.d.ts.map +1 -0
- package/dist/esm/reflection/ParametersHelper.js +15 -0
- package/dist/esm/reflection/ParametersHelper.js.map +1 -0
- package/dist/esm/reflection/PropertyDescriptor.d.ts +7 -0
- package/dist/esm/reflection/PropertyDescriptor.d.ts.map +1 -0
- package/dist/esm/reflection/PropertyDescriptor.js +11 -0
- package/dist/esm/reflection/PropertyDescriptor.js.map +1 -0
- package/dist/esm/reflection/index.d.ts +5 -0
- package/dist/esm/reflection/index.d.ts.map +1 -0
- package/dist/esm/reflection/index.js +4 -0
- package/dist/esm/reflection/index.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/validation/ValidationResult.d.ts +9 -0
- package/dist/esm/validation/ValidationResult.d.ts.map +1 -0
- package/dist/esm/validation/ValidationResult.js +15 -0
- package/dist/esm/validation/ValidationResult.js.map +1 -0
- package/dist/esm/validation/ValidationResultSeverity.d.ts +7 -0
- package/dist/esm/validation/ValidationResultSeverity.d.ts.map +1 -0
- package/dist/esm/validation/ValidationResultSeverity.js +8 -0
- package/dist/esm/validation/ValidationResultSeverity.js.map +1 -0
- package/dist/esm/validation/Validator.d.ts +4 -0
- package/dist/esm/validation/Validator.d.ts.map +1 -0
- package/dist/esm/validation/Validator.js +8 -0
- package/dist/esm/validation/Validator.js.map +1 -0
- package/dist/esm/validation/index.d.ts +3 -0
- package/dist/esm/validation/index.d.ts.map +1 -0
- package/dist/esm/validation/index.js +3 -0
- package/dist/esm/validation/index.js.map +1 -0
- package/for_UrlHelpers/when_building_query_params/with_additional_parameters.ts +23 -0
- package/for_UrlHelpers/when_building_query_params/with_empty_parameters.ts +16 -0
- package/for_UrlHelpers/when_building_query_params/with_null_and_undefined_values.ts +22 -0
- package/for_UrlHelpers/when_building_query_params/with_unused_parameters_only.ts +21 -0
- package/for_UrlHelpers/when_creating_url_from/with_base_path_ending_with_slash.ts +32 -0
- package/for_UrlHelpers/when_creating_url_from/with_empty_origin.ts +45 -0
- package/for_UrlHelpers/when_creating_url_from/with_null_or_undefined_origin.ts +53 -0
- package/for_UrlHelpers/when_creating_url_from/with_relative_route.ts +32 -0
- package/for_UrlHelpers/when_creating_url_from/with_valid_parameters.ts +32 -0
- package/for_UrlHelpers/when_creating_url_from/without_document_object.ts +34 -0
- package/for_UrlHelpers/when_replacing_route_parameters/with_all_parameters_used_in_route.ts +21 -0
- package/for_UrlHelpers/when_replacing_route_parameters/with_no_parameters.ts +19 -0
- package/for_UrlHelpers/when_replacing_route_parameters/with_unused_parameters.ts +23 -0
- package/for_UrlHelpers/when_replacing_route_parameters/with_url_encoded_values.ts +20 -0
- package/given.ts +14 -0
- package/identity/IIdentity.ts +33 -0
- package/identity/IIdentityProvider.ts +16 -0
- package/identity/IdentityProvider.ts +85 -0
- package/identity/IdentityProviderResult.ts +8 -0
- package/identity/index.ts +7 -0
- package/index.ts +21 -0
- package/joinPaths.ts +7 -0
- package/package.json +70 -0
- package/queries/IObservableQueryConnection.ts +21 -0
- package/queries/IObservableQueryFor.ts +38 -0
- package/queries/IQuery.ts +31 -0
- package/queries/IQueryFor.ts +36 -0
- package/queries/IQueryProvider.ts +17 -0
- package/queries/IQueryResult.ts +60 -0
- package/queries/NullObservableQueryConnection.ts +29 -0
- package/queries/ObservableQueryConnection.ts +118 -0
- package/queries/ObservableQueryFor.ts +230 -0
- package/queries/ObservableQuerySubscription.ts +27 -0
- package/queries/Paging.ts +38 -0
- package/queries/PagingInfo.ts +43 -0
- package/queries/QueryFor.ts +138 -0
- package/queries/QueryProvider.ts +36 -0
- package/queries/QueryResult.ts +157 -0
- package/queries/QueryResultWithState.ts +95 -0
- package/queries/SortDirection.ts +22 -0
- package/queries/Sorting.ts +30 -0
- package/queries/SortingActions.ts +36 -0
- package/queries/SortingActionsForObservableQuery.ts +36 -0
- package/queries/SortingActionsForQuery.ts +36 -0
- package/queries/ValidateRequestArguments.ts +36 -0
- package/queries/for_ObservableQueryFor/given/TestQueries.ts +58 -0
- package/queries/for_ObservableQueryFor/given/an_observable_query_for.ts +16 -0
- package/queries/for_ObservableQueryFor/when_constructing.ts +32 -0
- package/queries/for_ObservableQueryFor/when_constructing_enumerable.ts +18 -0
- package/queries/for_ObservableQueryFor/when_disposing.ts +28 -0
- package/queries/for_ObservableQueryFor/when_performing/with_enumerable_query.ts +61 -0
- package/queries/for_ObservableQueryFor/when_performing/with_invalid_arguments.ts +22 -0
- package/queries/for_ObservableQueryFor/when_performing/with_paging.ts +55 -0
- package/queries/for_ObservableQueryFor/when_performing/with_parameter_descriptor_values.ts +68 -0
- package/queries/for_ObservableQueryFor/when_performing/with_partial_parameter_descriptor_values.ts +67 -0
- package/queries/for_ObservableQueryFor/when_performing/with_route_parameters_and_unused_parameters.ts +71 -0
- package/queries/for_ObservableQueryFor/when_performing/with_sorting.ts +56 -0
- package/queries/for_ObservableQueryFor/when_performing/with_valid_arguments.ts +79 -0
- package/queries/for_ObservableQueryFor/when_setting_api_base_path.ts +17 -0
- package/queries/for_ObservableQueryFor/when_setting_microservice.ts +17 -0
- package/queries/for_ObservableQueryFor/when_setting_origin.ts +17 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_enumerable_query.ts +34 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_invalid_arguments.ts +40 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_paging.ts +36 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_sorting.ts +37 -0
- package/queries/for_ObservableQueryFor/when_subscribing/with_valid_arguments.ts +35 -0
- package/queries/for_QueryFor/given/TestQueries.ts +72 -0
- package/queries/for_QueryFor/given/a_query_for.ts +18 -0
- package/queries/for_QueryFor/when_constructing.ts +31 -0
- package/queries/for_QueryFor/when_constructing_enumerable.ts +17 -0
- package/queries/for_QueryFor/when_performing/with_abort_controller.ts +71 -0
- package/queries/for_QueryFor/when_performing/with_enumerable_query.ts +62 -0
- package/queries/for_QueryFor/when_performing/with_fetch_error.ts +47 -0
- package/queries/for_QueryFor/when_performing/with_invalid_arguments.ts +29 -0
- package/queries/for_QueryFor/when_performing/with_json_parse_error.ts +45 -0
- package/queries/for_QueryFor/when_performing/with_paging.ts +62 -0
- package/queries/for_QueryFor/when_performing/with_parameter_descriptor_values.ts +68 -0
- package/queries/for_QueryFor/when_performing/with_partial_parameter_descriptor_values.ts +67 -0
- package/queries/for_QueryFor/when_performing/with_query_without_required_parameters.ts +58 -0
- package/queries/for_QueryFor/when_performing/with_route_parameters_and_unused_parameters.ts +71 -0
- package/queries/for_QueryFor/when_performing/with_sorting.ts +99 -0
- package/queries/for_QueryFor/when_performing/with_valid_arguments.ts +87 -0
- package/queries/for_QueryFor/when_setting_api_base_path.ts +19 -0
- package/queries/for_QueryFor/when_setting_microservice.ts +19 -0
- package/queries/for_QueryFor/when_setting_origin.ts +19 -0
- package/queries/for_QueryResult/when_asking_has_data/and_it_an_array_with_items.ts +27 -0
- package/queries/for_QueryResult/when_asking_has_data/and_it_is_defined_instance.ts +27 -0
- package/queries/for_QueryResult/when_asking_has_data/and_it_is_empty_array.ts +27 -0
- package/queries/for_QueryResult/when_asking_has_data/and_it_is_undefined.ts +27 -0
- package/queries/index.ts +21 -0
- package/reflection/IHaveParameters.ts +11 -0
- package/reflection/ParameterDescriptor.ts +17 -0
- package/reflection/ParametersHelper.ts +25 -0
- package/reflection/PropertyDescriptor.ts +17 -0
- package/reflection/index.ts +7 -0
- package/validation/ValidationResult.ts +16 -0
- package/validation/ValidationResultSeverity.ts +28 -0
- package/validation/Validator.ts +15 -0
- package/validation/index.ts +5 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValidationResultSeverity } from './ValidationResultSeverity';
|
|
2
|
+
export declare class ValidationResult {
|
|
3
|
+
readonly severity: ValidationResultSeverity;
|
|
4
|
+
readonly message: string;
|
|
5
|
+
readonly members: string[];
|
|
6
|
+
readonly state: any;
|
|
7
|
+
constructor(severity: ValidationResultSeverity, message: string, members: string[], state: any);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ValidationResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationResult.d.ts","sourceRoot":"","sources":["../../../validation/ValidationResult.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAOtE,qBAAa,gBAAgB;IACb,QAAQ,CAAC,QAAQ,EAAE,wBAAwB;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,GAAG;gBAA7G,QAAQ,EAAE,wBAAwB,EAAW,OAAO,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM,EAAE,EAAW,KAAK,EAAE,GAAG;CAErI"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class ValidationResult {
|
|
2
|
+
severity;
|
|
3
|
+
message;
|
|
4
|
+
members;
|
|
5
|
+
state;
|
|
6
|
+
constructor(severity, message, members, state) {
|
|
7
|
+
this.severity = severity;
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.members = members;
|
|
10
|
+
this.state = state;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { ValidationResult };
|
|
15
|
+
//# sourceMappingURL=ValidationResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationResult.js","sources":["../../../validation/ValidationResult.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ValidationResultSeverity } from './ValidationResultSeverity';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Represents a validation error with a message for one or more members.\n */\nexport class ValidationResult {\n constructor(readonly severity: ValidationResultSeverity, readonly message: string, readonly members: string[], readonly state: any) {\n }\n}\n\n\n"],"names":[],"mappings":"MAUa,gBAAgB,CAAA;AACJ,IAAA,QAAA;AAA6C,IAAA,OAAA;AAA0B,IAAA,OAAA;AAA4B,IAAA,KAAA;AAAxH,IAAA,WAAA,CAAqB,QAAkC,EAAW,OAAe,EAAW,OAAiB,EAAW,KAAU,EAAA;QAA7G,IAAA,CAAA,QAAQ,GAAR,QAAQ;QAAqC,IAAA,CAAA,OAAO,GAAP,OAAO;QAAmB,IAAA,CAAA,OAAO,GAAP,OAAO;QAAqB,IAAA,CAAA,KAAK,GAAL,KAAK;IAC7H;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationResultSeverity.d.ts","sourceRoot":"","sources":["../../../validation/ValidationResultSeverity.ts"],"names":[],"mappings":"AAMA,oBAAY,wBAAwB;IAKhC,OAAO,IAAI;IAKX,WAAW,IAAI;IAKf,OAAO,IAAI;IAKX,KAAK,IAAI;CACZ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var ValidationResultSeverity;
|
|
2
|
+
(function (ValidationResultSeverity) {
|
|
3
|
+
ValidationResultSeverity[ValidationResultSeverity["Unknown"] = 0] = "Unknown";
|
|
4
|
+
ValidationResultSeverity[ValidationResultSeverity["Information"] = 1] = "Information";
|
|
5
|
+
ValidationResultSeverity[ValidationResultSeverity["Warning"] = 2] = "Warning";
|
|
6
|
+
ValidationResultSeverity[ValidationResultSeverity["Error"] = 3] = "Error";
|
|
7
|
+
})(ValidationResultSeverity || (ValidationResultSeverity = {}));
|
|
8
|
+
//# sourceMappingURL=ValidationResultSeverity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationResultSeverity.js","sourceRoot":"","sources":["../../../validation/ValidationResultSeverity.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,wBAqBX;AArBD,WAAY,wBAAwB;IAKhC,6EAAW,CAAA;IAKX,qFAAe,CAAA;IAKf,6EAAW,CAAA;IAKX,yEAAS,CAAA;AACb,CAAC,EArBW,wBAAwB,KAAxB,wBAAwB,QAqBnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../../validation/Validator.ts"],"names":[],"mappings":"AAMA,qBAAa,SAAS;IAKlB,IAAI,OAAO,YAEV;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validator.js","sources":["../../../validation/Validator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Represents a validator.\n */\nexport class Validator {\n\n /**\n * Gets whether or not is valid.\n */\n get isValid() {\n return true;\n }\n}\n"],"names":[],"mappings":"MAMa,SAAS,CAAA;AAKlB,IAAA,IAAI,OAAO,GAAA;AACP,QAAA,OAAO,IAAI;IACf;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../validation/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when building query params with additional parameters', () => {
|
|
8
|
+
let unusedParameters: object;
|
|
9
|
+
let additionalParams: Record<string, string | number>;
|
|
10
|
+
let result: URLSearchParams;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
unusedParameters = { filter: 'active' };
|
|
14
|
+
additionalParams = { page: 1, pageSize: 25 };
|
|
15
|
+
|
|
16
|
+
result = UrlHelpers.buildQueryParams(unusedParameters, additionalParams);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should contain filter parameter', () => result.get('filter')!.should.equal('active'));
|
|
20
|
+
it('should contain page parameter', () => result.get('page')!.should.equal('1'));
|
|
21
|
+
it('should contain pageSize parameter', () => result.get('pageSize')!.should.equal('25'));
|
|
22
|
+
it('should have three parameters', () => Array.from(result.keys()).length.should.equal(3));
|
|
23
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when building query params with empty parameters', () => {
|
|
8
|
+
let result: URLSearchParams;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
result = UrlHelpers.buildQueryParams({});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return empty search params', () => result.toString().should.equal(''));
|
|
15
|
+
it('should have no parameters', () => Array.from(result.keys()).length.should.equal(0));
|
|
16
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when building query params with null and undefined values', () => {
|
|
8
|
+
let unusedParameters: object;
|
|
9
|
+
let result: URLSearchParams;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
unusedParameters = { filter: 'active', nullValue: null, undefinedValue: undefined, search: 'test' };
|
|
13
|
+
|
|
14
|
+
result = UrlHelpers.buildQueryParams(unusedParameters);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should contain filter parameter', () => result.get('filter')!.should.equal('active'));
|
|
18
|
+
it('should contain search parameter', () => result.get('search')!.should.equal('test'));
|
|
19
|
+
it('should not contain null value', () => (result.get('nullValue') === null).should.be.true);
|
|
20
|
+
it('should not contain undefined value', () => (result.get('undefinedValue') === null).should.be.true);
|
|
21
|
+
it('should have two parameters', () => Array.from(result.keys()).length.should.equal(2));
|
|
22
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when building query params with unused parameters only', () => {
|
|
8
|
+
let unusedParameters: object;
|
|
9
|
+
let result: URLSearchParams;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
unusedParameters = { filter: 'active', search: 'test', limit: 10 };
|
|
13
|
+
|
|
14
|
+
result = UrlHelpers.buildQueryParams(unusedParameters);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should contain filter parameter', () => result.get('filter')!.should.equal('active'));
|
|
18
|
+
it('should contain search parameter', () => result.get('search')!.should.equal('test'));
|
|
19
|
+
it('should contain limit parameter', () => result.get('limit')!.should.equal('10'));
|
|
20
|
+
it('should have three parameters', () => Array.from(result.keys()).length.should.equal(3));
|
|
21
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe("with_base_path_ending_with_slash", () => {
|
|
8
|
+
let origin: string;
|
|
9
|
+
let apiBasePath: string;
|
|
10
|
+
let route: string;
|
|
11
|
+
let result: URL;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
origin = 'https://example.com';
|
|
15
|
+
apiBasePath = '/api/v1/'; // base path ending with slash
|
|
16
|
+
route = 'users/123'; // relative route
|
|
17
|
+
|
|
18
|
+
result = UrlHelpers.createUrlFrom(origin, apiBasePath, route);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should_create_correct_url", () => {
|
|
22
|
+
result.href.should.equal('https://example.com/api/v1/users/123');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should_have_correct_origin", () => {
|
|
26
|
+
result.origin.should.equal('https://example.com');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should_have_correct_pathname", () => {
|
|
30
|
+
result.pathname.should.equal('/api/v1/users/123');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe("with_empty_origin", () => {
|
|
8
|
+
let origin: string;
|
|
9
|
+
let apiBasePath: string;
|
|
10
|
+
let route: string;
|
|
11
|
+
let result: URL;
|
|
12
|
+
let originalDocument: Document | undefined;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
// Mock document.location.origin
|
|
16
|
+
originalDocument = global.document;
|
|
17
|
+
global.document = {
|
|
18
|
+
location: {
|
|
19
|
+
origin: 'https://mocked-origin.com'
|
|
20
|
+
}
|
|
21
|
+
} as unknown as Document;
|
|
22
|
+
|
|
23
|
+
origin = '';
|
|
24
|
+
apiBasePath = '/api/v1';
|
|
25
|
+
route = '/users/123';
|
|
26
|
+
|
|
27
|
+
result = UrlHelpers.createUrlFrom(origin, apiBasePath, route);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
if (originalDocument) {
|
|
32
|
+
global.document = originalDocument;
|
|
33
|
+
} else {
|
|
34
|
+
delete (global as { document?: Document }).document;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should_use_document_location_origin", () => {
|
|
39
|
+
result.origin.should.equal('https://mocked-origin.com');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should_create_correct_url_with_document_origin", () => {
|
|
43
|
+
result.href.should.equal('https://mocked-origin.com/users/123');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe("with_null_or_undefined_origin", () => {
|
|
8
|
+
let apiBasePath: string;
|
|
9
|
+
let route: string;
|
|
10
|
+
let result: URL;
|
|
11
|
+
let originalDocument: Document | undefined;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
// Mock document.location.origin
|
|
15
|
+
originalDocument = global.document;
|
|
16
|
+
global.document = {
|
|
17
|
+
location: {
|
|
18
|
+
origin: 'https://fallback-origin.com'
|
|
19
|
+
}
|
|
20
|
+
} as unknown as Document;
|
|
21
|
+
|
|
22
|
+
apiBasePath = '/api/v1';
|
|
23
|
+
route = '/users/123';
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
if (originalDocument) {
|
|
28
|
+
global.document = originalDocument;
|
|
29
|
+
} else {
|
|
30
|
+
delete (global as { document?: Document }).document;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should_use_document_location_origin_when_null", () => {
|
|
35
|
+
result = UrlHelpers.createUrlFrom(null as unknown as string, apiBasePath, route);
|
|
36
|
+
result.origin.should.equal('https://fallback-origin.com');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should_use_document_location_origin_when_undefined", () => {
|
|
40
|
+
result = UrlHelpers.createUrlFrom(undefined as unknown as string, apiBasePath, route);
|
|
41
|
+
result.origin.should.equal('https://fallback-origin.com');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("should_create_correct_url_with_document_origin_when_null", () => {
|
|
45
|
+
result = UrlHelpers.createUrlFrom(null as unknown as string, apiBasePath, route);
|
|
46
|
+
result.href.should.equal('https://fallback-origin.com/users/123');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("should_create_correct_url_with_document_origin_when_undefined", () => {
|
|
50
|
+
result = UrlHelpers.createUrlFrom(undefined as unknown as string, apiBasePath, route);
|
|
51
|
+
result.href.should.equal('https://fallback-origin.com/users/123');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe("with_relative_route", () => {
|
|
8
|
+
let origin: string;
|
|
9
|
+
let apiBasePath: string;
|
|
10
|
+
let route: string;
|
|
11
|
+
let result: URL;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
origin = 'https://example.com';
|
|
15
|
+
apiBasePath = '/api/v1';
|
|
16
|
+
route = 'users/123'; // relative route without leading slash
|
|
17
|
+
|
|
18
|
+
result = UrlHelpers.createUrlFrom(origin, apiBasePath, route);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should_create_correct_url_with_relative_route", () => {
|
|
22
|
+
result.href.should.equal('https://example.com/api/users/123');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should_have_correct_origin", () => {
|
|
26
|
+
result.origin.should.equal('https://example.com');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should_have_correct_pathname", () => {
|
|
30
|
+
result.pathname.should.equal('/api/users/123');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe("with_valid_parameters", () => {
|
|
8
|
+
let origin: string;
|
|
9
|
+
let apiBasePath: string;
|
|
10
|
+
let route: string;
|
|
11
|
+
let result: URL;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
origin = 'https://example.com';
|
|
15
|
+
apiBasePath = '/api/v1';
|
|
16
|
+
route = '/users/123';
|
|
17
|
+
|
|
18
|
+
result = UrlHelpers.createUrlFrom(origin, apiBasePath, route);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should_create_correct_url", () => {
|
|
22
|
+
result.href.should.equal('https://example.com/users/123');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should_have_correct_origin", () => {
|
|
26
|
+
result.origin.should.equal('https://example.com');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should_have_correct_pathname", () => {
|
|
30
|
+
result.pathname.should.equal('/users/123');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe("without_document_object", () => {
|
|
8
|
+
let origin: string;
|
|
9
|
+
let apiBasePath: string;
|
|
10
|
+
let route: string;
|
|
11
|
+
let originalDocument: Document | undefined;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
// Mock document to be undefined
|
|
15
|
+
originalDocument = global.document;
|
|
16
|
+
(global as { document?: Document }).document = undefined;
|
|
17
|
+
|
|
18
|
+
origin = '';
|
|
19
|
+
apiBasePath = '/api/v1';
|
|
20
|
+
route = '/users/123';
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
if (originalDocument) {
|
|
25
|
+
global.document = originalDocument;
|
|
26
|
+
} else {
|
|
27
|
+
delete (global as { document?: Document }).document;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should_throw_invalid_url_error", () => {
|
|
32
|
+
(() => UrlHelpers.createUrlFrom(origin, apiBasePath, route)).should.throw('Invalid URL');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when replacing route parameters with all parameters used in route', () => {
|
|
8
|
+
let route: string;
|
|
9
|
+
let parameters: object;
|
|
10
|
+
let result: { route: string; unusedParameters: object };
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
route = '/api/items/{id}/details/{type}';
|
|
14
|
+
parameters = { id: '123', type: 'full' };
|
|
15
|
+
|
|
16
|
+
result = UrlHelpers.replaceRouteParameters(route, parameters);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should replace all route parameters', () => result.route.should.equal('/api/items/123/details/full'));
|
|
20
|
+
it('should have empty unused parameters', () => Object.keys(result.unusedParameters).length.should.equal(0));
|
|
21
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when replacing route parameters with no parameters', () => {
|
|
8
|
+
let route: string;
|
|
9
|
+
let result: { route: string; unusedParameters: object };
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
route = '/api/items/{id}';
|
|
13
|
+
|
|
14
|
+
result = UrlHelpers.replaceRouteParameters(route);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should return original route', () => result.route.should.equal('/api/items/{id}'));
|
|
18
|
+
it('should have empty unused parameters', () => Object.keys(result.unusedParameters).length.should.equal(0));
|
|
19
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when replacing route parameters with unused parameters', () => {
|
|
8
|
+
let route: string;
|
|
9
|
+
let parameters: object;
|
|
10
|
+
let result: { route: string; unusedParameters: object };
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
route = '/api/items/{id}';
|
|
14
|
+
parameters = { id: '123', filter: 'active', search: 'test' };
|
|
15
|
+
|
|
16
|
+
result = UrlHelpers.replaceRouteParameters(route, parameters);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should replace route parameter', () => result.route.should.equal('/api/items/123'));
|
|
20
|
+
it('should have unused parameters', () => Object.keys(result.unusedParameters).length.should.equal(2));
|
|
21
|
+
it('should contain filter in unused parameters', () => result.unusedParameters.should.have.property('filter', 'active'));
|
|
22
|
+
it('should contain search in unused parameters', () => result.unusedParameters.should.have.property('search', 'test'));
|
|
23
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, it, beforeEach } from 'vitest';
|
|
5
|
+
import { UrlHelpers } from '../../UrlHelpers';
|
|
6
|
+
|
|
7
|
+
describe('when replacing route parameters with url encoded values', () => {
|
|
8
|
+
let route: string;
|
|
9
|
+
let parameters: object;
|
|
10
|
+
let result: { route: string; unusedParameters: object };
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
route = '/api/items/{id}';
|
|
14
|
+
parameters = { id: 'test value/with special&chars' };
|
|
15
|
+
|
|
16
|
+
result = UrlHelpers.replaceRouteParameters(route, parameters);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should replace and encode route parameter', () => result.route.should.equal('/api/items/test%20value%2Fwith%20special%26chars'));
|
|
20
|
+
});
|
package/given.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { Constructor } from '@cratis/fundamentals';
|
|
5
|
+
import { Suite } from 'mocha';
|
|
6
|
+
|
|
7
|
+
export type ContextForSuite<TContext extends object> = (this: Suite, context: TContext) => void;
|
|
8
|
+
|
|
9
|
+
export function given<TContext extends object>(contextType: Constructor<TContext>, callback: ContextForSuite<TContext>) {
|
|
10
|
+
return function (this: Suite) {
|
|
11
|
+
const context = new contextType(this);
|
|
12
|
+
callback.call(this, context);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Defines the context for identity.
|
|
6
|
+
*/
|
|
7
|
+
export interface IIdentity<TDetails = object> {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The id of the identity.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The name of the identity.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The application specific details for the identity.
|
|
21
|
+
*/
|
|
22
|
+
details: TDetails;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Whether the details are set.
|
|
26
|
+
*/
|
|
27
|
+
isSet: boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Refreshes the identity context.
|
|
31
|
+
*/
|
|
32
|
+
refresh(): Promise<IIdentity<TDetails>>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { IIdentity } from './IIdentity';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Defines the identity provider.
|
|
8
|
+
*/
|
|
9
|
+
export abstract class IIdentityProvider {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Gets the current identity by optionally specifying the details type.
|
|
13
|
+
* @returns The current identity as {@link IIdentity}.
|
|
14
|
+
*/
|
|
15
|
+
abstract getCurrent<TDetails = object>(): Promise<IIdentity<TDetails>>;
|
|
16
|
+
}
|