@blueprint-ts/core 4.1.0-beta.1 → 4.1.0-beta.3
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/dist/bulkRequests/BulkRequestEvent.enum.d.ts +4 -0
- package/dist/bulkRequests/BulkRequestEvent.enum.js +5 -0
- package/dist/bulkRequests/BulkRequestSender.d.ts +31 -0
- package/dist/bulkRequests/BulkRequestSender.js +161 -0
- package/dist/bulkRequests/BulkRequestWrapper.d.ts +15 -0
- package/dist/bulkRequests/BulkRequestWrapper.js +50 -0
- package/dist/bulkRequests/index.d.ts +5 -0
- package/dist/bulkRequests/index.js +5 -0
- package/{src/laravel/pagination/contracts/PaginationResponseBodyContract.ts → dist/laravel/pagination/contracts/PaginationResponseBodyContract.d.ts} +4 -4
- package/dist/laravel/pagination/contracts/PaginationResponseBodyContract.js +1 -0
- package/dist/laravel/pagination/dataDrivers/RequestDriver.d.ts +10 -0
- package/dist/laravel/pagination/dataDrivers/RequestDriver.js +18 -0
- package/dist/laravel/pagination/index.d.ts +4 -0
- package/dist/laravel/pagination/index.js +2 -0
- package/dist/laravel/requests/JsonBaseRequest.d.ts +14 -0
- package/dist/laravel/requests/JsonBaseRequest.js +15 -0
- package/dist/laravel/requests/PaginationJsonBaseRequest.d.ts +8 -0
- package/dist/laravel/requests/PaginationJsonBaseRequest.js +13 -0
- package/dist/laravel/requests/index.d.ts +7 -0
- package/dist/laravel/requests/index.js +5 -0
- package/dist/laravel/requests/responses/JsonResponse.d.ts +5 -0
- package/dist/laravel/requests/responses/JsonResponse.js +6 -0
- package/dist/laravel/requests/responses/PaginationResponse.d.ts +7 -0
- package/dist/laravel/requests/responses/PaginationResponse.js +9 -0
- package/dist/pagination/BasePaginator.d.ts +19 -0
- package/dist/pagination/BasePaginator.js +65 -0
- package/dist/pagination/InfiniteScroller.d.ts +6 -0
- package/dist/pagination/InfiniteScroller.js +17 -0
- package/dist/pagination/PageAwarePaginator.d.ts +32 -0
- package/dist/pagination/PageAwarePaginator.js +86 -0
- package/dist/pagination/StatePaginator.d.ts +25 -0
- package/dist/pagination/StatePaginator.js +55 -0
- package/dist/pagination/contracts/BaseViewDriverContract.d.ts +6 -0
- package/dist/pagination/contracts/BaseViewDriverContract.js +1 -0
- package/{src/pagination/contracts/BaseViewDriverFactoryContract.ts → dist/pagination/contracts/BaseViewDriverFactoryContract.d.ts} +2 -3
- package/dist/pagination/contracts/BaseViewDriverFactoryContract.js +1 -0
- package/dist/pagination/contracts/PaginateableRequestContract.d.ts +4 -0
- package/dist/pagination/contracts/PaginateableRequestContract.js +1 -0
- package/dist/pagination/contracts/PaginationDataDriverContract.d.ts +4 -0
- package/dist/pagination/contracts/PaginationDataDriverContract.js +1 -0
- package/{src/pagination/contracts/PaginationResponseContract.ts → dist/pagination/contracts/PaginationResponseContract.d.ts} +3 -5
- package/dist/pagination/contracts/PaginationResponseContract.js +1 -0
- package/{src/pagination/contracts/PaginatorLoadDataOptions.ts → dist/pagination/contracts/PaginatorLoadDataOptions.d.ts} +2 -2
- package/dist/pagination/contracts/PaginatorLoadDataOptions.js +1 -0
- package/{src/pagination/contracts/StatePaginationDataDriverContract.ts → dist/pagination/contracts/StatePaginationDataDriverContract.d.ts} +2 -3
- package/dist/pagination/contracts/StatePaginationDataDriverContract.js +1 -0
- package/dist/pagination/contracts/ViewDriverContract.d.ts +9 -0
- package/dist/pagination/contracts/ViewDriverContract.js +1 -0
- package/dist/pagination/contracts/ViewDriverFactoryContract.d.ts +4 -0
- package/dist/pagination/contracts/ViewDriverFactoryContract.js +1 -0
- package/dist/pagination/dataDrivers/ArrayDriver.d.ts +9 -0
- package/dist/pagination/dataDrivers/ArrayDriver.js +20 -0
- package/dist/pagination/dtos/PaginationDataDto.d.ts +7 -0
- package/dist/pagination/dtos/PaginationDataDto.js +12 -0
- package/dist/pagination/dtos/StatePaginationDataDto.d.ts +7 -0
- package/dist/pagination/dtos/StatePaginationDataDto.js +13 -0
- package/dist/pagination/factories/VueBaseViewDriverFactory.d.ts +5 -0
- package/dist/pagination/factories/VueBaseViewDriverFactory.js +6 -0
- package/dist/pagination/factories/VuePaginationDriverFactory.d.ts +5 -0
- package/dist/pagination/factories/VuePaginationDriverFactory.js +6 -0
- package/dist/pagination/frontendDrivers/VueBaseViewDriver.d.ts +11 -0
- package/dist/pagination/frontendDrivers/VueBaseViewDriver.js +19 -0
- package/dist/pagination/frontendDrivers/VuePaginationDriver.d.ts +21 -0
- package/dist/pagination/frontendDrivers/VuePaginationDriver.js +41 -0
- package/dist/pagination/index.d.ts +22 -0
- package/dist/pagination/index.js +13 -0
- package/dist/persistenceDrivers/LocalStorageDriver.d.ts +9 -0
- package/dist/persistenceDrivers/LocalStorageDriver.js +18 -0
- package/dist/persistenceDrivers/NonPersistentDriver.d.ts +7 -0
- package/dist/persistenceDrivers/NonPersistentDriver.js +8 -0
- package/dist/persistenceDrivers/SessionStorageDriver.d.ts +9 -0
- package/dist/persistenceDrivers/SessionStorageDriver.js +18 -0
- package/dist/persistenceDrivers/index.d.ts +6 -0
- package/dist/persistenceDrivers/index.js +4 -0
- package/dist/persistenceDrivers/types/PersistenceDriver.d.ts +5 -0
- package/dist/persistenceDrivers/types/PersistenceDriver.js +1 -0
- package/dist/requests/BaseRequest.d.ts +62 -0
- package/dist/requests/BaseRequest.js +224 -0
- package/dist/requests/ErrorHandler.d.ts +11 -0
- package/dist/requests/ErrorHandler.js +127 -0
- package/dist/requests/RequestConcurrencyMode.enum.d.ts +6 -0
- package/dist/requests/RequestConcurrencyMode.enum.js +7 -0
- package/dist/requests/RequestErrorRouter.d.ts +38 -0
- package/dist/requests/RequestErrorRouter.js +38 -0
- package/dist/requests/RequestEvents.enum.d.ts +4 -0
- package/dist/requests/RequestEvents.enum.js +5 -0
- package/dist/requests/RequestMethod.enum.d.ts +8 -0
- package/dist/requests/RequestMethod.enum.js +9 -0
- package/dist/requests/bodies/BinaryBody.d.ts +10 -0
- package/dist/requests/bodies/BinaryBody.js +22 -0
- package/dist/requests/bodies/FormDataBody.d.ts +14 -0
- package/dist/requests/bodies/FormDataBody.js +60 -0
- package/dist/requests/bodies/JsonBody.d.ts +8 -0
- package/dist/requests/bodies/JsonBody.js +13 -0
- package/{src/requests/contracts/AbortableRequestContract.ts → dist/requests/contracts/AbortableRequestContract.d.ts} +1 -1
- package/dist/requests/contracts/AbortableRequestContract.js +1 -0
- package/dist/requests/contracts/BaseRequestContract.d.ts +23 -0
- package/dist/requests/contracts/BaseRequestContract.js +1 -0
- package/dist/requests/contracts/BodyContract.d.ts +6 -0
- package/dist/requests/contracts/BodyContract.js +1 -0
- package/dist/requests/contracts/BodyFactoryContract.d.ts +4 -0
- package/dist/requests/contracts/BodyFactoryContract.js +1 -0
- package/dist/requests/contracts/DriverConfigContract.d.ts +8 -0
- package/dist/requests/contracts/DriverConfigContract.js +1 -0
- package/dist/requests/contracts/HeadersContract.d.ts +7 -0
- package/dist/requests/contracts/HeadersContract.js +1 -0
- package/dist/requests/contracts/RequestDriverContract.d.ts +8 -0
- package/dist/requests/contracts/RequestDriverContract.js +1 -0
- package/dist/requests/contracts/RequestLoaderContract.d.ts +4 -0
- package/dist/requests/contracts/RequestLoaderContract.js +1 -0
- package/{src/requests/contracts/RequestLoaderFactoryContract.ts → dist/requests/contracts/RequestLoaderFactoryContract.d.ts} +2 -3
- package/dist/requests/contracts/RequestLoaderFactoryContract.js +1 -0
- package/dist/requests/contracts/ResponseContract.d.ts +5 -0
- package/dist/requests/contracts/ResponseContract.js +1 -0
- package/dist/requests/drivers/contracts/ResponseHandlerContract.d.ts +9 -0
- package/dist/requests/drivers/contracts/ResponseHandlerContract.js +1 -0
- package/dist/requests/drivers/fetch/FetchDriver.d.ts +26 -0
- package/dist/requests/drivers/fetch/FetchDriver.js +73 -0
- package/dist/requests/drivers/fetch/FetchResponse.d.ts +12 -0
- package/dist/requests/drivers/fetch/FetchResponse.js +38 -0
- package/dist/requests/drivers/xhr/XMLHttpRequestDriver.d.ts +13 -0
- package/dist/requests/drivers/xhr/XMLHttpRequestDriver.js +107 -0
- package/dist/requests/drivers/xhr/XMLHttpRequestResponse.d.ts +17 -0
- package/dist/requests/drivers/xhr/XMLHttpRequestResponse.js +84 -0
- package/dist/requests/exceptions/BadGatewayException.d.ts +3 -0
- package/dist/requests/exceptions/BadGatewayException.js +3 -0
- package/dist/requests/exceptions/BadRequestException.d.ts +3 -0
- package/dist/requests/exceptions/BadRequestException.js +3 -0
- package/dist/requests/exceptions/ConflictException.d.ts +3 -0
- package/dist/requests/exceptions/ConflictException.js +3 -0
- package/dist/requests/exceptions/ForbiddenException.d.ts +3 -0
- package/dist/requests/exceptions/ForbiddenException.js +3 -0
- package/dist/requests/exceptions/GatewayTimeoutException.d.ts +3 -0
- package/dist/requests/exceptions/GatewayTimeoutException.js +3 -0
- package/dist/requests/exceptions/GoneException.d.ts +3 -0
- package/dist/requests/exceptions/GoneException.js +3 -0
- package/dist/requests/exceptions/InvalidJsonException.d.ts +7 -0
- package/dist/requests/exceptions/InvalidJsonException.js +10 -0
- package/dist/requests/exceptions/LockedException.d.ts +3 -0
- package/dist/requests/exceptions/LockedException.js +3 -0
- package/dist/requests/exceptions/MethodNotAllowedException.d.ts +3 -0
- package/dist/requests/exceptions/MethodNotAllowedException.js +3 -0
- package/dist/requests/exceptions/NoResponseReceivedException.d.ts +3 -0
- package/{src/requests/exceptions/NoResponseReceivedException.ts → dist/requests/exceptions/NoResponseReceivedException.js} +3 -3
- package/dist/requests/exceptions/NotFoundException.d.ts +3 -0
- package/dist/requests/exceptions/NotFoundException.js +3 -0
- package/dist/requests/exceptions/NotImplementedException.d.ts +3 -0
- package/dist/requests/exceptions/NotImplementedException.js +3 -0
- package/dist/requests/exceptions/PageExpiredException.d.ts +3 -0
- package/dist/requests/exceptions/PageExpiredException.js +3 -0
- package/dist/requests/exceptions/PayloadTooLargeException.d.ts +3 -0
- package/dist/requests/exceptions/PayloadTooLargeException.js +3 -0
- package/dist/requests/exceptions/PreconditionFailedException.d.ts +3 -0
- package/dist/requests/exceptions/PreconditionFailedException.js +3 -0
- package/dist/requests/exceptions/RequestTimeoutException.d.ts +3 -0
- package/dist/requests/exceptions/RequestTimeoutException.js +3 -0
- package/dist/requests/exceptions/ResponseBodyException.d.ts +7 -0
- package/dist/requests/exceptions/ResponseBodyException.js +10 -0
- package/dist/requests/exceptions/ResponseException.d.ts +6 -0
- package/dist/requests/exceptions/ResponseException.js +9 -0
- package/dist/requests/exceptions/ServerErrorException.d.ts +3 -0
- package/dist/requests/exceptions/ServerErrorException.js +3 -0
- package/dist/requests/exceptions/ServiceUnavailableException.d.ts +3 -0
- package/dist/requests/exceptions/ServiceUnavailableException.js +3 -0
- package/dist/requests/exceptions/StaleResponseException.d.ts +5 -0
- package/dist/requests/exceptions/StaleResponseException.js +10 -0
- package/dist/requests/exceptions/TooManyRequestsException.d.ts +3 -0
- package/dist/requests/exceptions/TooManyRequestsException.js +3 -0
- package/dist/requests/exceptions/UnauthorizedException.d.ts +3 -0
- package/dist/requests/exceptions/UnauthorizedException.js +3 -0
- package/dist/requests/exceptions/UnsupportedMediaTypeException.d.ts +3 -0
- package/dist/requests/exceptions/UnsupportedMediaTypeException.js +3 -0
- package/dist/requests/exceptions/ValidationException.d.ts +3 -0
- package/dist/requests/exceptions/ValidationException.js +3 -0
- package/dist/requests/exceptions/index.d.ts +25 -0
- package/dist/requests/exceptions/index.js +25 -0
- package/dist/requests/factories/BinaryBodyFactory.d.ts +8 -0
- package/dist/requests/factories/BinaryBodyFactory.js +9 -0
- package/dist/requests/factories/FormDataFactory.d.ts +12 -0
- package/dist/requests/factories/FormDataFactory.js +6 -0
- package/dist/requests/factories/JsonBodyFactory.d.ts +5 -0
- package/dist/requests/factories/JsonBodyFactory.js +6 -0
- package/dist/requests/index.d.ts +31 -0
- package/dist/requests/index.js +19 -0
- package/dist/requests/responses/BaseResponse.d.ts +14 -0
- package/dist/requests/responses/BaseResponse.js +36 -0
- package/dist/requests/responses/BlobResponse.d.ts +7 -0
- package/dist/requests/responses/BlobResponse.js +16 -0
- package/dist/requests/responses/JsonResponse.d.ts +5 -0
- package/dist/requests/responses/JsonResponse.js +12 -0
- package/dist/requests/responses/PlainTextResponse.d.ts +5 -0
- package/dist/requests/responses/PlainTextResponse.js +12 -0
- package/{src/requests/types/RequestConcurrencyOptions.ts → dist/requests/types/RequestConcurrencyOptions.d.ts} +4 -5
- package/dist/requests/types/RequestConcurrencyOptions.js +1 -0
- package/dist/requests/types/RequestUploadProgress.d.ts +6 -0
- package/dist/requests/types/RequestUploadProgress.js +1 -0
- package/dist/support/DeferredPromise.d.ts +37 -0
- package/dist/support/DeferredPromise.js +55 -0
- package/dist/support/helpers.d.ts +5 -0
- package/dist/support/helpers.js +69 -0
- package/{src/support/index.ts → dist/support/index.d.ts} +3 -4
- package/dist/support/index.js +3 -0
- package/dist/vue/composables/useConfirmDialog.d.ts +20 -0
- package/dist/vue/composables/useConfirmDialog.js +52 -0
- package/dist/vue/composables/useGlobalCheckbox.d.ts +13 -0
- package/dist/vue/composables/useGlobalCheckbox.js +123 -0
- package/dist/vue/composables/useIsEmpty.d.ts +4 -0
- package/dist/vue/composables/useIsEmpty.js +27 -0
- package/dist/vue/composables/useIsOpen.d.ts +5 -0
- package/dist/vue/composables/useIsOpen.js +25 -0
- package/dist/vue/composables/useIsOpenFromVar.d.ts +6 -0
- package/dist/vue/composables/useIsOpenFromVar.js +45 -0
- package/dist/vue/composables/useModelWrapper.d.ts +9 -0
- package/dist/vue/composables/useModelWrapper.js +18 -0
- package/dist/vue/composables/useOnOpen.d.ts +7 -0
- package/dist/vue/composables/useOnOpen.js +25 -0
- package/{src/vue/contracts/ModelValueOptions.ts → dist/vue/contracts/ModelValueOptions.d.ts} +1 -1
- package/dist/vue/contracts/ModelValueOptions.js +1 -0
- package/dist/vue/contracts/ModelValueProps.d.ts +3 -0
- package/dist/vue/contracts/ModelValueProps.js +1 -0
- package/dist/vue/forms/BaseForm.d.ts +162 -0
- package/dist/vue/forms/BaseForm.js +997 -0
- package/dist/vue/forms/PropertyAwareArray.d.ts +53 -0
- package/dist/vue/forms/PropertyAwareArray.js +54 -0
- package/{src/vue/forms/index.ts → dist/vue/forms/index.d.ts} +9 -11
- package/dist/vue/forms/index.js +6 -0
- package/dist/vue/forms/types/PersistedForm.d.ts +6 -0
- package/dist/vue/forms/types/PersistedForm.js +1 -0
- package/dist/vue/forms/validation/ValidationMode.enum.d.ts +11 -0
- package/dist/vue/forms/validation/ValidationMode.enum.js +14 -0
- package/dist/vue/forms/validation/index.d.ts +12 -0
- package/dist/vue/forms/validation/index.js +9 -0
- package/dist/vue/forms/validation/rules/BaseRule.d.ts +5 -0
- package/dist/vue/forms/validation/rules/BaseRule.js +5 -0
- package/dist/vue/forms/validation/rules/ConfirmedRule.d.ts +10 -0
- package/dist/vue/forms/validation/rules/ConfirmedRule.js +26 -0
- package/dist/vue/forms/validation/rules/EmailRule.d.ts +7 -0
- package/dist/vue/forms/validation/rules/EmailRule.js +19 -0
- package/dist/vue/forms/validation/rules/JsonRule.d.ts +7 -0
- package/dist/vue/forms/validation/rules/JsonRule.js +25 -0
- package/dist/vue/forms/validation/rules/MinRule.d.ts +26 -0
- package/dist/vue/forms/validation/rules/MinRule.js +52 -0
- package/dist/vue/forms/validation/rules/RequiredRule.d.ts +7 -0
- package/dist/vue/forms/validation/rules/RequiredRule.js +16 -0
- package/dist/vue/forms/validation/rules/UrlRule.d.ts +7 -0
- package/dist/vue/forms/validation/rules/UrlRule.js +22 -0
- package/{src/vue/forms/validation/types/BidirectionalRule.ts → dist/vue/forms/validation/types/BidirectionalRule.d.ts} +4 -4
- package/dist/vue/forms/validation/types/BidirectionalRule.js +1 -0
- package/dist/vue/forms/validation/types/ValidationRules.d.ts +11 -0
- package/dist/vue/forms/validation/types/ValidationRules.js +1 -0
- package/dist/vue/index.d.ts +11 -0
- package/dist/vue/index.js +10 -0
- package/dist/vue/requests/factories/VueRequestLoaderFactory.d.ts +6 -0
- package/dist/vue/requests/factories/VueRequestLoaderFactory.js +6 -0
- package/{src/vue/requests/index.ts → dist/vue/requests/index.d.ts} +4 -5
- package/dist/vue/requests/index.js +4 -0
- package/dist/vue/requests/loaders/VueRequestBatchLoader.d.ts +12 -0
- package/dist/vue/requests/loaders/VueRequestBatchLoader.js +29 -0
- package/dist/vue/requests/loaders/VueRequestLoader.d.ts +8 -0
- package/dist/vue/requests/loaders/VueRequestLoader.js +12 -0
- package/dist/vue/router/routeResourceBinding/RouteResourceBoundView.d.ts +57 -0
- package/dist/vue/router/routeResourceBinding/RouteResourceBoundView.js +135 -0
- package/dist/vue/router/routeResourceBinding/RouteResourceRequestResolver.d.ts +6 -0
- package/dist/vue/router/routeResourceBinding/RouteResourceRequestResolver.js +20 -0
- package/dist/vue/router/routeResourceBinding/defineRoute.d.ts +23 -0
- package/dist/vue/router/routeResourceBinding/defineRoute.js +42 -0
- package/dist/vue/router/routeResourceBinding/index.d.ts +8 -0
- package/dist/vue/router/routeResourceBinding/index.js +6 -0
- package/dist/vue/router/routeResourceBinding/installRouteInjection.d.ts +14 -0
- package/dist/vue/router/routeResourceBinding/installRouteInjection.js +133 -0
- package/dist/vue/router/routeResourceBinding/types.d.ts +55 -0
- package/dist/vue/router/routeResourceBinding/types.js +1 -0
- package/dist/vue/router/routeResourceBinding/useRouteResource.d.ts +8 -0
- package/dist/vue/router/routeResourceBinding/useRouteResource.js +29 -0
- package/dist/vue/state/State.d.ts +75 -0
- package/dist/vue/state/State.js +267 -0
- package/dist/vue/state/index.d.ts +2 -0
- package/dist/vue/state/index.js +2 -0
- package/package.json +81 -23
- package/.editorconfig +0 -508
- package/.eslintrc.cjs +0 -15
- package/.prettierrc.json +0 -8
- package/CHANGELOG.md +0 -213
- package/docker-compose.yaml +0 -8
- package/docs/.vitepress/config.ts +0 -124
- package/docs/index.md +0 -13
- package/docs/laravel/pagination.md +0 -67
- package/docs/laravel/requests.md +0 -62
- package/docs/services/pagination/index.md +0 -46
- package/docs/services/pagination/infinite-scroller.md +0 -20
- package/docs/services/pagination/page-aware.md +0 -51
- package/docs/services/pagination/state-pagination.md +0 -77
- package/docs/services/pagination/updating-rows.md +0 -52
- package/docs/services/persistence/index.md +0 -46
- package/docs/services/requests/abort-requests.md +0 -29
- package/docs/services/requests/bulk-requests.md +0 -70
- package/docs/services/requests/concurrency.md +0 -58
- package/docs/services/requests/drivers.md +0 -115
- package/docs/services/requests/error-handling.md +0 -153
- package/docs/services/requests/events.md +0 -53
- package/docs/services/requests/file-uploads.md +0 -105
- package/docs/services/requests/getting-started.md +0 -201
- package/docs/services/requests/headers.md +0 -40
- package/docs/services/requests/loading.md +0 -63
- package/docs/services/requests/request-bodies.md +0 -61
- package/docs/services/requests/responses.md +0 -34
- package/docs/services/support/deferred-promise.md +0 -63
- package/docs/services/support/helpers.md +0 -77
- package/docs/services/support/index.md +0 -6
- package/docs/upgrading/v1-to-v2.md +0 -64
- package/docs/upgrading/v2-to-v3.md +0 -52
- package/docs/upgrading/v3-to-v4.md +0 -214
- package/docs/upgrading.md +0 -0
- package/docs/vue/composables/use-confirm-dialog.md +0 -96
- package/docs/vue/composables/use-global-checkbox.md +0 -73
- package/docs/vue/composables/use-is-empty.md +0 -26
- package/docs/vue/composables/use-is-open-from-var.md +0 -32
- package/docs/vue/composables/use-is-open.md +0 -28
- package/docs/vue/composables/use-model-wrapper.md +0 -29
- package/docs/vue/composables/use-on-open.md +0 -26
- package/docs/vue/forms/arrays.md +0 -102
- package/docs/vue/forms/errors.md +0 -52
- package/docs/vue/forms/index.md +0 -99
- package/docs/vue/forms/payloads.md +0 -99
- package/docs/vue/forms/persistence.md +0 -19
- package/docs/vue/forms/state-and-properties.md +0 -26
- package/docs/vue/forms/utilities.md +0 -27
- package/docs/vue/forms/validation.md +0 -189
- package/docs/vue/requests/loading.md +0 -51
- package/docs/vue/router/route-resource-binding.md +0 -240
- package/docs/vue/state.md +0 -309
- package/env.d.ts +0 -1
- package/eslint.config.js +0 -15
- package/release-tool.json +0 -26
- package/src/bulkRequests/BulkRequestEvent.enum.ts +0 -4
- package/src/bulkRequests/BulkRequestSender.ts +0 -196
- package/src/bulkRequests/BulkRequestWrapper.ts +0 -49
- package/src/bulkRequests/index.ts +0 -6
- package/src/laravel/pagination/dataDrivers/RequestDriver.ts +0 -30
- package/src/laravel/pagination/index.ts +0 -6
- package/src/laravel/requests/JsonBaseRequest.ts +0 -35
- package/src/laravel/requests/PaginationJsonBaseRequest.ts +0 -29
- package/src/laravel/requests/index.ts +0 -9
- package/src/laravel/requests/responses/JsonResponse.ts +0 -8
- package/src/laravel/requests/responses/PaginationResponse.ts +0 -16
- package/src/pagination/BasePaginator.ts +0 -94
- package/src/pagination/InfiniteScroller.ts +0 -22
- package/src/pagination/PageAwarePaginator.ts +0 -132
- package/src/pagination/StatePaginator.ts +0 -86
- package/src/pagination/contracts/BaseViewDriverContract.ts +0 -6
- package/src/pagination/contracts/PaginateableRequestContract.ts +0 -13
- package/src/pagination/contracts/PaginationDataDriverContract.ts +0 -5
- package/src/pagination/contracts/ViewDriverContract.ts +0 -10
- package/src/pagination/contracts/ViewDriverFactoryContract.ts +0 -5
- package/src/pagination/dataDrivers/ArrayDriver.ts +0 -28
- package/src/pagination/dtos/PaginationDataDto.ts +0 -14
- package/src/pagination/dtos/StatePaginationDataDto.ts +0 -19
- package/src/pagination/factories/VueBaseViewDriverFactory.ts +0 -9
- package/src/pagination/factories/VuePaginationDriverFactory.ts +0 -9
- package/src/pagination/frontendDrivers/VueBaseViewDriver.ts +0 -28
- package/src/pagination/frontendDrivers/VuePaginationDriver.ts +0 -61
- package/src/pagination/index.ts +0 -46
- package/src/persistenceDrivers/LocalStorageDriver.ts +0 -22
- package/src/persistenceDrivers/NonPersistentDriver.ts +0 -12
- package/src/persistenceDrivers/SessionStorageDriver.ts +0 -22
- package/src/persistenceDrivers/index.ts +0 -8
- package/src/persistenceDrivers/types/PersistenceDriver.ts +0 -5
- package/src/requests/BaseRequest.ts +0 -321
- package/src/requests/ErrorHandler.ts +0 -144
- package/src/requests/RequestConcurrencyMode.enum.ts +0 -6
- package/src/requests/RequestErrorRouter.ts +0 -89
- package/src/requests/RequestEvents.enum.ts +0 -4
- package/src/requests/RequestMethod.enum.ts +0 -8
- package/src/requests/bodies/FormDataBody.ts +0 -81
- package/src/requests/bodies/JsonBody.ts +0 -16
- package/src/requests/contracts/BaseRequestContract.ts +0 -39
- package/src/requests/contracts/BodyContract.ts +0 -7
- package/src/requests/contracts/BodyFactoryContract.ts +0 -5
- package/src/requests/contracts/DriverConfigContract.ts +0 -9
- package/src/requests/contracts/HeadersContract.ts +0 -5
- package/src/requests/contracts/RequestDriverContract.ts +0 -15
- package/src/requests/contracts/RequestLoaderContract.ts +0 -5
- package/src/requests/contracts/ResponseContract.ts +0 -7
- package/src/requests/drivers/contracts/ResponseHandlerContract.ts +0 -10
- package/src/requests/drivers/fetch/FetchDriver.ts +0 -115
- package/src/requests/drivers/fetch/FetchResponse.ts +0 -30
- package/src/requests/drivers/xhr/XMLHttpRequestDriver.ts +0 -138
- package/src/requests/drivers/xhr/XMLHttpRequestResponse.ts +0 -95
- package/src/requests/exceptions/BadGatewayException.ts +0 -3
- package/src/requests/exceptions/BadRequestException.ts +0 -3
- package/src/requests/exceptions/ConflictException.ts +0 -3
- package/src/requests/exceptions/ForbiddenException.ts +0 -3
- package/src/requests/exceptions/GatewayTimeoutException.ts +0 -3
- package/src/requests/exceptions/GoneException.ts +0 -3
- package/src/requests/exceptions/InvalidJsonException.ts +0 -15
- package/src/requests/exceptions/LockedException.ts +0 -3
- package/src/requests/exceptions/MethodNotAllowedException.ts +0 -3
- package/src/requests/exceptions/NotFoundException.ts +0 -3
- package/src/requests/exceptions/NotImplementedException.ts +0 -3
- package/src/requests/exceptions/PageExpiredException.ts +0 -3
- package/src/requests/exceptions/PayloadTooLargeException.ts +0 -3
- package/src/requests/exceptions/PreconditionFailedException.ts +0 -3
- package/src/requests/exceptions/RequestTimeoutException.ts +0 -3
- package/src/requests/exceptions/ResponseBodyException.ts +0 -15
- package/src/requests/exceptions/ResponseException.ts +0 -11
- package/src/requests/exceptions/ServerErrorException.ts +0 -3
- package/src/requests/exceptions/ServiceUnavailableException.ts +0 -3
- package/src/requests/exceptions/StaleResponseException.ts +0 -13
- package/src/requests/exceptions/TooManyRequestsException.ts +0 -3
- package/src/requests/exceptions/UnauthorizedException.ts +0 -3
- package/src/requests/exceptions/UnsupportedMediaTypeException.ts +0 -3
- package/src/requests/exceptions/ValidationException.ts +0 -3
- package/src/requests/exceptions/index.ts +0 -51
- package/src/requests/factories/FormDataFactory.ts +0 -17
- package/src/requests/factories/JsonBodyFactory.ts +0 -9
- package/src/requests/index.ts +0 -61
- package/src/requests/responses/BaseResponse.ts +0 -41
- package/src/requests/responses/BlobResponse.ts +0 -19
- package/src/requests/responses/JsonResponse.ts +0 -15
- package/src/requests/responses/PlainTextResponse.ts +0 -15
- package/src/requests/types/RequestUploadProgress.ts +0 -6
- package/src/support/DeferredPromise.ts +0 -67
- package/src/support/helpers.ts +0 -78
- package/src/vue/composables/useConfirmDialog.ts +0 -63
- package/src/vue/composables/useGlobalCheckbox.ts +0 -145
- package/src/vue/composables/useIsEmpty.ts +0 -34
- package/src/vue/composables/useIsOpen.ts +0 -37
- package/src/vue/composables/useIsOpenFromVar.ts +0 -61
- package/src/vue/composables/useModelWrapper.ts +0 -27
- package/src/vue/composables/useOnOpen.ts +0 -34
- package/src/vue/contracts/ModelValueProps.ts +0 -3
- package/src/vue/forms/BaseForm.ts +0 -1192
- package/src/vue/forms/PropertyAwareArray.ts +0 -81
- package/src/vue/forms/types/PersistedForm.ts +0 -6
- package/src/vue/forms/validation/ValidationMode.enum.ts +0 -14
- package/src/vue/forms/validation/index.ts +0 -15
- package/src/vue/forms/validation/rules/BaseRule.ts +0 -7
- package/src/vue/forms/validation/rules/ConfirmedRule.ts +0 -39
- package/src/vue/forms/validation/rules/EmailRule.ts +0 -23
- package/src/vue/forms/validation/rules/JsonRule.ts +0 -28
- package/src/vue/forms/validation/rules/MinRule.ts +0 -61
- package/src/vue/forms/validation/rules/RequiredRule.ts +0 -19
- package/src/vue/forms/validation/rules/UrlRule.ts +0 -24
- package/src/vue/forms/validation/types/ValidationRules.ts +0 -15
- package/src/vue/index.ts +0 -14
- package/src/vue/requests/factories/VueRequestLoaderFactory.ts +0 -10
- package/src/vue/requests/loaders/VueRequestBatchLoader.ts +0 -35
- package/src/vue/requests/loaders/VueRequestLoader.ts +0 -18
- package/src/vue/router/routeResourceBinding/RouteResourceBoundView.ts +0 -145
- package/src/vue/router/routeResourceBinding/RouteResourceRequestResolver.ts +0 -11
- package/src/vue/router/routeResourceBinding/defineRoute.ts +0 -59
- package/src/vue/router/routeResourceBinding/index.ts +0 -11
- package/src/vue/router/routeResourceBinding/installRouteInjection.ts +0 -164
- package/src/vue/router/routeResourceBinding/types.ts +0 -53
- package/src/vue/router/routeResourceBinding/useRouteResource.ts +0 -24
- package/src/vue/state/State.ts +0 -380
- package/src/vue/state/index.ts +0 -3
- package/tests/service/bulkRequests/BulkRequestSender.test.ts +0 -76
- package/tests/service/bulkRequests/BulkRequestWrapper.test.ts +0 -51
- package/tests/service/helpers/mergeDeep.test.ts +0 -53
- package/tests/service/laravel/pagination/dataDrivers/RequestDriver.test.ts +0 -84
- package/tests/service/laravel/requests/JsonBaseRequest.test.ts +0 -43
- package/tests/service/laravel/requests/PaginationJsonBaseRequest.test.ts +0 -58
- package/tests/service/laravel/requests/responses/JsonResponse.test.ts +0 -59
- package/tests/service/laravel/requests/responses/PaginationResponse.test.ts +0 -127
- package/tests/service/pagination/BasePaginator.test.ts +0 -100
- package/tests/service/pagination/InfiniteScroller.test.ts +0 -101
- package/tests/service/pagination/PageAwarePaginator.test.ts +0 -133
- package/tests/service/pagination/StatePaginator.test.ts +0 -76
- package/tests/service/pagination/VueViewDrivers.test.ts +0 -46
- package/tests/service/pagination/dtos/PaginationDataDto.test.ts +0 -35
- package/tests/service/pagination/dtos/StatePaginationDataDto.test.ts +0 -14
- package/tests/service/pagination/factories/VuePaginationDriverFactory.test.ts +0 -32
- package/tests/service/pagination/frontendDrivers/VuePaginationDriver.test.ts +0 -66
- package/tests/service/persistenceDrivers/PersistenceDrivers.test.ts +0 -56
- package/tests/service/requests/BaseRequest.test.ts +0 -250
- package/tests/service/requests/BodiesAndFactories.test.ts +0 -28
- package/tests/service/requests/Enums.test.ts +0 -20
- package/tests/service/requests/ErrorHandler.test.ts +0 -188
- package/tests/service/requests/FormDataBody.test.ts +0 -63
- package/tests/service/requests/RequestErrorRouter.test.ts +0 -44
- package/tests/service/requests/Responses.test.ts +0 -83
- package/tests/service/requests/exceptions/Exceptions.test.ts +0 -43
- package/tests/service/requests/fetch/FetchDriver.test.ts +0 -76
- package/tests/service/requests/fetch/FetchResponse.test.ts +0 -21
- package/tests/service/requests/xhr/XMLHttpRequestDriver.test.ts +0 -178
- package/tests/service/support/DeferredPromise.test.ts +0 -40
- package/tests/service/support/helpers.test.ts +0 -37
- package/tests/vue/composables/useConfirmDialog.test.ts +0 -77
- package/tests/vue/composables/useGlobalCheckbox.test.ts +0 -126
- package/tests/vue/composables/useIsEmpty.test.ts +0 -18
- package/tests/vue/composables/useIsOpen.test.ts +0 -25
- package/tests/vue/composables/useIsOpenFromVar.test.ts +0 -22
- package/tests/vue/composables/useModelWrapper.test.ts +0 -30
- package/tests/vue/composables/useOnOpen.test.ts +0 -26
- package/tests/vue/forms/BaseForm.behavior.test.ts +0 -98
- package/tests/vue/forms/BaseForm.transformers.test.ts +0 -109
- package/tests/vue/forms/PropertyAwareArray.test.ts +0 -30
- package/tests/vue/forms/validation/ValidationRules.test.ts +0 -79
- package/tests/vue/requests/VueRequestLoaders.test.ts +0 -48
- package/tests/vue/router/routeResourceBinding/RouteResourceBoundView.test.ts +0 -344
- package/tests/vue/router/routeResourceBinding/RouteResourceUtils.test.ts +0 -70
- package/tests/vue/router/routeResourceBinding/installRouteInjection.test.ts +0 -450
- package/tests/vue/state/State.test.ts +0 -151
- package/tsconfig.json +0 -114
- package/vite.config.ts +0 -34
- package/vitest.config.ts +0 -23
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { RequestEvents } from './RequestEvents.enum';
|
|
2
|
+
import { RequestMethodEnum } from './RequestMethod.enum';
|
|
3
|
+
import { BaseResponse } from './responses/BaseResponse';
|
|
4
|
+
import { type DriverConfigContract } from './contracts/DriverConfigContract';
|
|
5
|
+
import { type BodyFactoryContract } from './contracts/BodyFactoryContract';
|
|
6
|
+
import { type BodyContract } from './contracts/BodyContract';
|
|
7
|
+
import { type RequestLoaderContract } from './contracts/RequestLoaderContract';
|
|
8
|
+
import { type RequestDriverContract } from './contracts/RequestDriverContract';
|
|
9
|
+
import { type RequestLoaderFactoryContract } from './contracts/RequestLoaderFactoryContract';
|
|
10
|
+
import { type BaseRequestContract, type EventHandlerCallback } from './contracts/BaseRequestContract';
|
|
11
|
+
import { type HeadersContract } from './contracts/HeadersContract';
|
|
12
|
+
import { type ResponseContract } from './contracts/ResponseContract';
|
|
13
|
+
import { type RequestConcurrencyOptions } from './types/RequestConcurrencyOptions';
|
|
14
|
+
export declare abstract class BaseRequest<RequestLoaderLoadingType, ResponseErrorBody, ResponseBodyInterface = undefined, ResponseClass extends ResponseContract<ResponseBodyInterface> = BaseResponse<ResponseBodyInterface>, RequestBodyInterface = undefined, RequestParamsInterface extends object = object> implements BaseRequestContract<RequestLoaderLoadingType, RequestBodyInterface, ResponseClass, RequestParamsInterface> {
|
|
15
|
+
protected requestId: string;
|
|
16
|
+
protected params: RequestParamsInterface | undefined;
|
|
17
|
+
protected requestBody: RequestBodyInterface | undefined;
|
|
18
|
+
protected requestLoader: RequestLoaderContract<RequestLoaderLoadingType> | undefined;
|
|
19
|
+
protected abortSignal: AbortSignal | undefined;
|
|
20
|
+
protected concurrencyOptions: RequestConcurrencyOptions | undefined;
|
|
21
|
+
protected events: {
|
|
22
|
+
[key in RequestEvents]?: EventHandlerCallback[];
|
|
23
|
+
};
|
|
24
|
+
protected static defaultBaseUrl: string;
|
|
25
|
+
protected static requestDriver: RequestDriverContract;
|
|
26
|
+
protected static requestLoaderFactory: RequestLoaderFactoryContract<unknown>;
|
|
27
|
+
protected static concurrencySequenceByKey: Map<string, number>;
|
|
28
|
+
protected static concurrencyAbortControllerByKey: Map<string, AbortController>;
|
|
29
|
+
protected static concurrencyInFlightByKey: Map<string, number>;
|
|
30
|
+
constructor();
|
|
31
|
+
static setRequestDriver(driver: RequestDriverContract): void;
|
|
32
|
+
static setRequestLoaderFactory<T>(factory: RequestLoaderFactoryContract<T>): void;
|
|
33
|
+
static setDefaultBaseUrl(url: string): void;
|
|
34
|
+
setRequestLoader(loader: RequestLoaderContract<RequestLoaderLoadingType>): this;
|
|
35
|
+
setConcurrency(options?: RequestConcurrencyOptions): this;
|
|
36
|
+
getRequestId(): string;
|
|
37
|
+
abstract method(): RequestMethodEnum;
|
|
38
|
+
abstract url(): URL | string;
|
|
39
|
+
setParams(params?: RequestParamsInterface): this;
|
|
40
|
+
withParams(params: RequestParamsInterface): this;
|
|
41
|
+
getParams(): RequestParamsInterface | undefined;
|
|
42
|
+
setBody(requestBody: RequestBodyInterface): this;
|
|
43
|
+
getBody(): RequestBodyInterface | undefined;
|
|
44
|
+
requestHeaders(): HeadersContract;
|
|
45
|
+
buildUrl(): URL;
|
|
46
|
+
on<T>(event: RequestEvents, handler: EventHandlerCallback<T>): this;
|
|
47
|
+
protected dispatch<T>(event: RequestEvents, value: T): void;
|
|
48
|
+
send(): Promise<ResponseClass>;
|
|
49
|
+
isLoading(): RequestLoaderLoadingType;
|
|
50
|
+
abstract getResponse(): ResponseClass;
|
|
51
|
+
getRequestBodyFactory(): BodyFactoryContract<RequestBodyInterface | undefined> | undefined;
|
|
52
|
+
setAbortSignal(signal: AbortSignal): this;
|
|
53
|
+
protected bumpConcurrencySequence(key: string): number;
|
|
54
|
+
protected isLatestSequence(key: string, sequence: number): boolean;
|
|
55
|
+
protected incrementConcurrencyInFlight(key: string): void;
|
|
56
|
+
protected decrementConcurrencyInFlight(key: string): void;
|
|
57
|
+
protected baseUrl(): undefined;
|
|
58
|
+
protected buildRequestConfig(requestBody: BodyContract | undefined, concurrencyKey: string, sequence: number, useLatest: boolean): DriverConfigContract;
|
|
59
|
+
protected getConfig(): DriverConfigContract | undefined;
|
|
60
|
+
protected resolveRequestDriver(): RequestDriverContract;
|
|
61
|
+
protected getRequestDriver(): RequestDriverContract | undefined;
|
|
62
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import qs from 'qs';
|
|
11
|
+
import { ErrorHandler } from './ErrorHandler';
|
|
12
|
+
import { RequestEvents } from './RequestEvents.enum';
|
|
13
|
+
import { ResponseException } from './exceptions/ResponseException';
|
|
14
|
+
import { StaleResponseException } from './exceptions/StaleResponseException';
|
|
15
|
+
import { RequestConcurrencyMode } from './RequestConcurrencyMode.enum';
|
|
16
|
+
import { mergeDeep } from '../support/helpers';
|
|
17
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
18
|
+
export class BaseRequest {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.requestId = uuidv4();
|
|
21
|
+
this.params = undefined;
|
|
22
|
+
this.requestBody = undefined;
|
|
23
|
+
this.requestLoader = undefined;
|
|
24
|
+
this.abortSignal = undefined;
|
|
25
|
+
this.concurrencyOptions = undefined;
|
|
26
|
+
/* @ts-expect-error Ignore generics */
|
|
27
|
+
this.events = {};
|
|
28
|
+
if (BaseRequest.requestLoaderFactory !== undefined) {
|
|
29
|
+
this.requestLoader = BaseRequest.requestLoaderFactory.make();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
static setRequestDriver(driver) {
|
|
33
|
+
this.requestDriver = driver;
|
|
34
|
+
}
|
|
35
|
+
static setRequestLoaderFactory(factory) {
|
|
36
|
+
this.requestLoaderFactory = factory;
|
|
37
|
+
}
|
|
38
|
+
static setDefaultBaseUrl(url) {
|
|
39
|
+
this.defaultBaseUrl = url;
|
|
40
|
+
}
|
|
41
|
+
setRequestLoader(loader) {
|
|
42
|
+
this.requestLoader = loader;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
setConcurrency(options) {
|
|
46
|
+
this.concurrencyOptions = options;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
getRequestId() {
|
|
50
|
+
return this.requestId;
|
|
51
|
+
}
|
|
52
|
+
setParams(params) {
|
|
53
|
+
this.params = params;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
withParams(params) {
|
|
57
|
+
this.params = this.params === undefined ? params : mergeDeep({}, this.params, params);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
getParams() {
|
|
61
|
+
return this.params;
|
|
62
|
+
}
|
|
63
|
+
setBody(requestBody) {
|
|
64
|
+
this.requestBody = requestBody;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
getBody() {
|
|
68
|
+
return this.requestBody;
|
|
69
|
+
}
|
|
70
|
+
requestHeaders() {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
buildUrl() {
|
|
74
|
+
var _a;
|
|
75
|
+
const hasParams = this.params !== undefined && Object.keys(this.params).length > 0;
|
|
76
|
+
const url = hasParams ? this.url() + '?' + qs.stringify(this.params) : this.url();
|
|
77
|
+
return new URL(url, (_a = this.baseUrl()) !== null && _a !== void 0 ? _a : BaseRequest.defaultBaseUrl);
|
|
78
|
+
}
|
|
79
|
+
on(event, handler) {
|
|
80
|
+
if (!this.events[event]) {
|
|
81
|
+
this.events[event] = [];
|
|
82
|
+
}
|
|
83
|
+
this.events[event].push(handler);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
dispatch(event, value) {
|
|
87
|
+
if (!this.events[event]) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.events[event].forEach((handler) => handler(value));
|
|
91
|
+
}
|
|
92
|
+
send() {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
var _a, _b, _c, _d, _e, _f;
|
|
95
|
+
const concurrencyMode = (_b = (_a = this.concurrencyOptions) === null || _a === void 0 ? void 0 : _a.mode) !== null && _b !== void 0 ? _b : RequestConcurrencyMode.ALLOW;
|
|
96
|
+
const concurrencyKey = (_d = (_c = this.concurrencyOptions) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : this.requestId;
|
|
97
|
+
const useReplace = concurrencyMode === RequestConcurrencyMode.REPLACE || concurrencyMode === RequestConcurrencyMode.REPLACE_LATEST;
|
|
98
|
+
const useLatest = concurrencyMode === RequestConcurrencyMode.LATEST || concurrencyMode === RequestConcurrencyMode.REPLACE_LATEST;
|
|
99
|
+
const sequence = this.bumpConcurrencySequence(concurrencyKey);
|
|
100
|
+
this.incrementConcurrencyInFlight(concurrencyKey);
|
|
101
|
+
if (useReplace) {
|
|
102
|
+
const previousController = BaseRequest.concurrencyAbortControllerByKey.get(concurrencyKey);
|
|
103
|
+
if (previousController) {
|
|
104
|
+
previousController.abort();
|
|
105
|
+
}
|
|
106
|
+
const controller = new AbortController();
|
|
107
|
+
BaseRequest.concurrencyAbortControllerByKey.set(concurrencyKey, controller);
|
|
108
|
+
this.setAbortSignal(controller.signal);
|
|
109
|
+
}
|
|
110
|
+
this.dispatch(RequestEvents.LOADING, true);
|
|
111
|
+
(_e = this.requestLoader) === null || _e === void 0 ? void 0 : _e.setLoading(true);
|
|
112
|
+
const responseSkeleton = this.getResponse();
|
|
113
|
+
const requestBody = this.requestBody === undefined ? undefined : (_f = this.getRequestBodyFactory()) === null || _f === void 0 ? void 0 : _f.make(this.requestBody);
|
|
114
|
+
const requestConfig = this.buildRequestConfig(requestBody, concurrencyKey, sequence, useLatest);
|
|
115
|
+
return this.resolveRequestDriver()
|
|
116
|
+
.send(this.buildUrl(), this.method(), Object.assign({ Accept: responseSkeleton.getAcceptHeader() }, this.requestHeaders()), requestBody, requestConfig)
|
|
117
|
+
.then((responseHandler) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
if (useLatest && !this.isLatestSequence(concurrencyKey, sequence)) {
|
|
119
|
+
throw new StaleResponseException();
|
|
120
|
+
}
|
|
121
|
+
yield responseSkeleton.setResponse(responseHandler);
|
|
122
|
+
return responseSkeleton;
|
|
123
|
+
}))
|
|
124
|
+
.catch((error) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
if (useLatest && !this.isLatestSequence(concurrencyKey, sequence)) {
|
|
126
|
+
throw new StaleResponseException('Stale response ignored', error);
|
|
127
|
+
}
|
|
128
|
+
if (error instanceof StaleResponseException) {
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
if (error instanceof ResponseException) {
|
|
132
|
+
const handler = new ErrorHandler(error.getResponse());
|
|
133
|
+
yield handler.handle();
|
|
134
|
+
}
|
|
135
|
+
console.error('@blueprint-ts/core: Unknown error received.', error);
|
|
136
|
+
throw error;
|
|
137
|
+
}))
|
|
138
|
+
.finally(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
const isStale = useLatest && !this.isLatestSequence(concurrencyKey, sequence);
|
|
141
|
+
if (!isStale) {
|
|
142
|
+
this.dispatch(RequestEvents.LOADING, false);
|
|
143
|
+
(_a = this.requestLoader) === null || _a === void 0 ? void 0 : _a.setLoading(false);
|
|
144
|
+
}
|
|
145
|
+
this.decrementConcurrencyInFlight(concurrencyKey);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
isLoading() {
|
|
150
|
+
if (!this.requestLoader) {
|
|
151
|
+
throw new Error('Request loader is not set.');
|
|
152
|
+
}
|
|
153
|
+
return this.requestLoader.isLoading();
|
|
154
|
+
}
|
|
155
|
+
getRequestBodyFactory() {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
setAbortSignal(signal) {
|
|
159
|
+
this.abortSignal = signal;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
bumpConcurrencySequence(key) {
|
|
163
|
+
var _a;
|
|
164
|
+
const next = ((_a = BaseRequest.concurrencySequenceByKey.get(key)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
165
|
+
BaseRequest.concurrencySequenceByKey.set(key, next);
|
|
166
|
+
return next;
|
|
167
|
+
}
|
|
168
|
+
isLatestSequence(key, sequence) {
|
|
169
|
+
var _a;
|
|
170
|
+
return ((_a = BaseRequest.concurrencySequenceByKey.get(key)) !== null && _a !== void 0 ? _a : 0) === sequence;
|
|
171
|
+
}
|
|
172
|
+
incrementConcurrencyInFlight(key) {
|
|
173
|
+
var _a;
|
|
174
|
+
const next = ((_a = BaseRequest.concurrencyInFlightByKey.get(key)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
175
|
+
BaseRequest.concurrencyInFlightByKey.set(key, next);
|
|
176
|
+
}
|
|
177
|
+
decrementConcurrencyInFlight(key) {
|
|
178
|
+
const current = BaseRequest.concurrencyInFlightByKey.get(key);
|
|
179
|
+
if (current === undefined) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const next = current - 1;
|
|
183
|
+
if (next <= 0) {
|
|
184
|
+
BaseRequest.concurrencyInFlightByKey.delete(key);
|
|
185
|
+
BaseRequest.concurrencySequenceByKey.delete(key);
|
|
186
|
+
BaseRequest.concurrencyAbortControllerByKey.delete(key);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
BaseRequest.concurrencyInFlightByKey.set(key, next);
|
|
190
|
+
}
|
|
191
|
+
baseUrl() {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
buildRequestConfig(requestBody, concurrencyKey, sequence, useLatest) {
|
|
195
|
+
var _a;
|
|
196
|
+
const config = (_a = this.getConfig()) !== null && _a !== void 0 ? _a : {};
|
|
197
|
+
const onUploadProgress = config.onUploadProgress;
|
|
198
|
+
if (requestBody === undefined) {
|
|
199
|
+
return config;
|
|
200
|
+
}
|
|
201
|
+
return Object.assign(Object.assign({}, config), { onUploadProgress: (progress) => {
|
|
202
|
+
onUploadProgress === null || onUploadProgress === void 0 ? void 0 : onUploadProgress(progress);
|
|
203
|
+
if (useLatest && !this.isLatestSequence(concurrencyKey, sequence)) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this.dispatch(RequestEvents.UPLOAD_PROGRESS, progress);
|
|
207
|
+
} });
|
|
208
|
+
}
|
|
209
|
+
getConfig() {
|
|
210
|
+
return {
|
|
211
|
+
abortSignal: this.abortSignal
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
resolveRequestDriver() {
|
|
215
|
+
var _a;
|
|
216
|
+
return (_a = this.getRequestDriver()) !== null && _a !== void 0 ? _a : BaseRequest.requestDriver;
|
|
217
|
+
}
|
|
218
|
+
getRequestDriver() {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
BaseRequest.concurrencySequenceByKey = new Map();
|
|
223
|
+
BaseRequest.concurrencyAbortControllerByKey = new Map();
|
|
224
|
+
BaseRequest.concurrencyInFlightByKey = new Map();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ResponseHandlerContract } from './drivers/contracts/ResponseHandlerContract';
|
|
2
|
+
export type ErrorHandlerCallback = ((response: ResponseHandlerContract) => boolean | void) | undefined;
|
|
3
|
+
export declare class ErrorHandler<ResponseErrorBody> {
|
|
4
|
+
protected response: ResponseHandlerContract;
|
|
5
|
+
protected body: ResponseErrorBody | undefined;
|
|
6
|
+
protected static handler: ErrorHandlerCallback;
|
|
7
|
+
constructor(response: ResponseHandlerContract);
|
|
8
|
+
handle(): Promise<void>;
|
|
9
|
+
static registerHandler(callback: ErrorHandlerCallback): void;
|
|
10
|
+
protected handleResponseError(response: ResponseHandlerContract, body: ResponseErrorBody): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { PageExpiredException } from './exceptions/PageExpiredException';
|
|
11
|
+
import { NotFoundException } from './exceptions/NotFoundException';
|
|
12
|
+
import { UnauthorizedException } from './exceptions/UnauthorizedException';
|
|
13
|
+
import { ValidationException } from './exceptions/ValidationException';
|
|
14
|
+
import { ResponseException } from './exceptions/ResponseException';
|
|
15
|
+
import { NoResponseReceivedException } from './exceptions/NoResponseReceivedException';
|
|
16
|
+
import { ServerErrorException } from './exceptions/ServerErrorException';
|
|
17
|
+
import { ForbiddenException } from './exceptions/ForbiddenException';
|
|
18
|
+
import { TooManyRequestsException } from './exceptions/TooManyRequestsException';
|
|
19
|
+
import { LockedException } from './exceptions/LockedException';
|
|
20
|
+
import { NotImplementedException } from './exceptions/NotImplementedException';
|
|
21
|
+
import { ServiceUnavailableException } from './exceptions/ServiceUnavailableException';
|
|
22
|
+
import { MethodNotAllowedException } from './exceptions/MethodNotAllowedException';
|
|
23
|
+
import { RequestTimeoutException } from './exceptions/RequestTimeoutException';
|
|
24
|
+
import { ConflictException } from './exceptions/ConflictException';
|
|
25
|
+
import { GoneException } from './exceptions/GoneException';
|
|
26
|
+
import { PreconditionFailedException } from './exceptions/PreconditionFailedException';
|
|
27
|
+
import { PayloadTooLargeException } from './exceptions/PayloadTooLargeException';
|
|
28
|
+
import { UnsupportedMediaTypeException } from './exceptions/UnsupportedMediaTypeException';
|
|
29
|
+
import { BadGatewayException } from './exceptions/BadGatewayException';
|
|
30
|
+
import { GatewayTimeoutException } from './exceptions/GatewayTimeoutException';
|
|
31
|
+
import { BadRequestException } from './exceptions/BadRequestException';
|
|
32
|
+
import { InvalidJsonException } from './exceptions/InvalidJsonException';
|
|
33
|
+
export class ErrorHandler {
|
|
34
|
+
constructor(response) {
|
|
35
|
+
this.response = response;
|
|
36
|
+
this.body = undefined;
|
|
37
|
+
}
|
|
38
|
+
handle() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
// Check if there is a global error handler set
|
|
41
|
+
if (ErrorHandler.handler !== undefined) {
|
|
42
|
+
// If handler returns false, we don't process the error further
|
|
43
|
+
if (ErrorHandler.handler(this.response) === false) {
|
|
44
|
+
console.debug('Skipping further error handling due to global handler returning false.');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
this.body = yield this.response.json();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw new InvalidJsonException(this.response, error);
|
|
53
|
+
}
|
|
54
|
+
if (this.body === undefined) {
|
|
55
|
+
throw new NoResponseReceivedException(this.response);
|
|
56
|
+
}
|
|
57
|
+
this.handleResponseError(this.response, this.body);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static registerHandler(callback) {
|
|
61
|
+
ErrorHandler.handler = callback;
|
|
62
|
+
}
|
|
63
|
+
handleResponseError(response, body) {
|
|
64
|
+
if (response.getStatusCode() === 400) {
|
|
65
|
+
throw new BadRequestException(response, body);
|
|
66
|
+
}
|
|
67
|
+
if (response.getStatusCode() === 401) {
|
|
68
|
+
throw new UnauthorizedException(response, body);
|
|
69
|
+
}
|
|
70
|
+
if (response.getStatusCode() === 403) {
|
|
71
|
+
throw new ForbiddenException(response, body);
|
|
72
|
+
}
|
|
73
|
+
if (response.getStatusCode() === 404) {
|
|
74
|
+
throw new NotFoundException(response, body);
|
|
75
|
+
}
|
|
76
|
+
if (response.getStatusCode() === 405) {
|
|
77
|
+
throw new MethodNotAllowedException(response, body);
|
|
78
|
+
}
|
|
79
|
+
if (response.getStatusCode() === 408) {
|
|
80
|
+
throw new RequestTimeoutException(response, body);
|
|
81
|
+
}
|
|
82
|
+
if (response.getStatusCode() === 409) {
|
|
83
|
+
throw new ConflictException(response, body);
|
|
84
|
+
}
|
|
85
|
+
if (response.getStatusCode() === 410) {
|
|
86
|
+
throw new GoneException(response, body);
|
|
87
|
+
}
|
|
88
|
+
if (response.getStatusCode() === 412) {
|
|
89
|
+
throw new PreconditionFailedException(response, body);
|
|
90
|
+
}
|
|
91
|
+
if (response.getStatusCode() === 413) {
|
|
92
|
+
throw new PayloadTooLargeException(response, body);
|
|
93
|
+
}
|
|
94
|
+
if (response.getStatusCode() === 415) {
|
|
95
|
+
throw new UnsupportedMediaTypeException(response, body);
|
|
96
|
+
}
|
|
97
|
+
if (response.getStatusCode() === 419) {
|
|
98
|
+
throw new PageExpiredException(response, body);
|
|
99
|
+
}
|
|
100
|
+
if (response.getStatusCode() === 422) {
|
|
101
|
+
throw new ValidationException(response, body);
|
|
102
|
+
}
|
|
103
|
+
if (response.getStatusCode() === 423) {
|
|
104
|
+
throw new LockedException(response, body);
|
|
105
|
+
}
|
|
106
|
+
if (response.getStatusCode() === 429) {
|
|
107
|
+
throw new TooManyRequestsException(response, body);
|
|
108
|
+
}
|
|
109
|
+
if (response.getStatusCode() === 500) {
|
|
110
|
+
throw new ServerErrorException(response, body);
|
|
111
|
+
}
|
|
112
|
+
if (response.getStatusCode() === 501) {
|
|
113
|
+
throw new NotImplementedException(response, body);
|
|
114
|
+
}
|
|
115
|
+
if (response.getStatusCode() === 502) {
|
|
116
|
+
throw new BadGatewayException(response, body);
|
|
117
|
+
}
|
|
118
|
+
if (response.getStatusCode() === 503) {
|
|
119
|
+
throw new ServiceUnavailableException(response, body);
|
|
120
|
+
}
|
|
121
|
+
if (response.getStatusCode() === 504) {
|
|
122
|
+
throw new GatewayTimeoutException(response, body);
|
|
123
|
+
}
|
|
124
|
+
throw new ResponseException(response);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
ErrorHandler.handler = undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var RequestConcurrencyMode;
|
|
2
|
+
(function (RequestConcurrencyMode) {
|
|
3
|
+
RequestConcurrencyMode["ALLOW"] = "allow";
|
|
4
|
+
RequestConcurrencyMode["REPLACE"] = "replace";
|
|
5
|
+
RequestConcurrencyMode["LATEST"] = "latest";
|
|
6
|
+
RequestConcurrencyMode["REPLACE_LATEST"] = "replace-latest";
|
|
7
|
+
})(RequestConcurrencyMode || (RequestConcurrencyMode = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BadRequestException } from './exceptions/BadRequestException';
|
|
2
|
+
import { MethodNotAllowedException } from './exceptions/MethodNotAllowedException';
|
|
3
|
+
import { RequestTimeoutException } from './exceptions/RequestTimeoutException';
|
|
4
|
+
import { ConflictException } from './exceptions/ConflictException';
|
|
5
|
+
import { GoneException } from './exceptions/GoneException';
|
|
6
|
+
import { PreconditionFailedException } from './exceptions/PreconditionFailedException';
|
|
7
|
+
import { PayloadTooLargeException } from './exceptions/PayloadTooLargeException';
|
|
8
|
+
import { UnsupportedMediaTypeException } from './exceptions/UnsupportedMediaTypeException';
|
|
9
|
+
import { ForbiddenException } from './exceptions/ForbiddenException';
|
|
10
|
+
import { LockedException } from './exceptions/LockedException';
|
|
11
|
+
import { NoResponseReceivedException } from './exceptions/NoResponseReceivedException';
|
|
12
|
+
import { NotFoundException } from './exceptions/NotFoundException';
|
|
13
|
+
import { NotImplementedException } from './exceptions/NotImplementedException';
|
|
14
|
+
import { BadGatewayException } from './exceptions/BadGatewayException';
|
|
15
|
+
import { PageExpiredException } from './exceptions/PageExpiredException';
|
|
16
|
+
import { ResponseBodyException } from './exceptions/ResponseBodyException';
|
|
17
|
+
import { ResponseException } from './exceptions/ResponseException';
|
|
18
|
+
import { ServerErrorException } from './exceptions/ServerErrorException';
|
|
19
|
+
import { ServiceUnavailableException } from './exceptions/ServiceUnavailableException';
|
|
20
|
+
import { GatewayTimeoutException } from './exceptions/GatewayTimeoutException';
|
|
21
|
+
import { TooManyRequestsException } from './exceptions/TooManyRequestsException';
|
|
22
|
+
import { UnauthorizedException } from './exceptions/UnauthorizedException';
|
|
23
|
+
import { ValidationException } from './exceptions/ValidationException';
|
|
24
|
+
import { InvalidJsonException } from './exceptions/InvalidJsonException';
|
|
25
|
+
type RequestExceptionConstructor = typeof BadRequestException | typeof MethodNotAllowedException | typeof RequestTimeoutException | typeof ConflictException | typeof GoneException | typeof PreconditionFailedException | typeof PayloadTooLargeException | typeof UnsupportedMediaTypeException | typeof UnauthorizedException | typeof ForbiddenException | typeof NotFoundException | typeof PageExpiredException | typeof ValidationException | typeof LockedException | typeof TooManyRequestsException | typeof ServerErrorException | typeof NotImplementedException | typeof BadGatewayException | typeof ServiceUnavailableException | typeof GatewayTimeoutException | typeof NoResponseReceivedException | typeof InvalidJsonException | typeof ResponseBodyException | typeof ResponseException;
|
|
26
|
+
type ErrorHandlerCallback<T extends Error> = (error: T) => void | Promise<void>;
|
|
27
|
+
type UnknownErrorHandlerCallback = (error: unknown) => void | Promise<void>;
|
|
28
|
+
export declare class RequestErrorRouter {
|
|
29
|
+
protected handlers: Array<{
|
|
30
|
+
ctor: RequestExceptionConstructor;
|
|
31
|
+
handler: ErrorHandlerCallback<Error>;
|
|
32
|
+
}>;
|
|
33
|
+
protected defaultHandler: UnknownErrorHandlerCallback | undefined;
|
|
34
|
+
on<C extends RequestExceptionConstructor>(ctor: C, handler: ErrorHandlerCallback<InstanceType<C>>): this;
|
|
35
|
+
otherwise(handler: UnknownErrorHandlerCallback): this;
|
|
36
|
+
handle(error: unknown): Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export class RequestErrorRouter {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.handlers = [];
|
|
13
|
+
this.defaultHandler = undefined;
|
|
14
|
+
}
|
|
15
|
+
on(ctor, handler) {
|
|
16
|
+
this.handlers.push({ ctor, handler: handler });
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
otherwise(handler) {
|
|
20
|
+
this.defaultHandler = handler;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
handle(error) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
for (const entry of this.handlers) {
|
|
26
|
+
if (error instanceof entry.ctor) {
|
|
27
|
+
yield entry.handler(error);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (this.defaultHandler !== undefined) {
|
|
32
|
+
yield this.defaultHandler(error);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var RequestMethodEnum;
|
|
2
|
+
(function (RequestMethodEnum) {
|
|
3
|
+
RequestMethodEnum["GET"] = "GET";
|
|
4
|
+
RequestMethodEnum["HEAD"] = "HEAD";
|
|
5
|
+
RequestMethodEnum["PATCH"] = "PATCH";
|
|
6
|
+
RequestMethodEnum["POST"] = "POST";
|
|
7
|
+
RequestMethodEnum["PUT"] = "PUT";
|
|
8
|
+
RequestMethodEnum["DELETE"] = "DELETE";
|
|
9
|
+
})(RequestMethodEnum || (RequestMethodEnum = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type BodyContent, type BodyContract } from '../contracts/BodyContract';
|
|
2
|
+
import { type HeadersContract } from '../contracts/HeadersContract';
|
|
3
|
+
export declare class BinaryBody<RequestBody extends Exclude<BodyContent, string | FormData>> implements BodyContract {
|
|
4
|
+
protected data: RequestBody;
|
|
5
|
+
protected contentType?: string | undefined;
|
|
6
|
+
constructor(data: RequestBody, contentType?: string | undefined);
|
|
7
|
+
getHeaders(): HeadersContract;
|
|
8
|
+
getContent(): RequestBody;
|
|
9
|
+
protected resolveContentType(): string | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class BinaryBody {
|
|
2
|
+
constructor(data, contentType) {
|
|
3
|
+
this.data = data;
|
|
4
|
+
this.contentType = contentType;
|
|
5
|
+
}
|
|
6
|
+
getHeaders() {
|
|
7
|
+
const contentType = this.resolveContentType();
|
|
8
|
+
return contentType === undefined ? {} : { 'Content-Type': contentType };
|
|
9
|
+
}
|
|
10
|
+
getContent() {
|
|
11
|
+
return this.data;
|
|
12
|
+
}
|
|
13
|
+
resolveContentType() {
|
|
14
|
+
if (this.contentType !== undefined) {
|
|
15
|
+
return this.contentType;
|
|
16
|
+
}
|
|
17
|
+
if (typeof Blob !== 'undefined' && this.data instanceof Blob && this.data.type !== '') {
|
|
18
|
+
return this.data.type;
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type BodyContract } from '../contracts/BodyContract';
|
|
2
|
+
import { type HeadersContract } from '../contracts/HeadersContract';
|
|
3
|
+
type FormDataPrimitive = string | number | boolean | null | Date | Blob;
|
|
4
|
+
type FormDataValue = FormDataPrimitive | FormDataValue[] | {
|
|
5
|
+
[key: string]: FormDataValue;
|
|
6
|
+
};
|
|
7
|
+
export declare class FormDataBody<RequestBody extends Record<string, FormDataValue | undefined>> implements BodyContract {
|
|
8
|
+
protected data: FormData;
|
|
9
|
+
constructor(data: RequestBody);
|
|
10
|
+
getContent(): FormData;
|
|
11
|
+
getHeaders(): HeadersContract;
|
|
12
|
+
protected toFormData(data: Record<string, FormDataValue | undefined>, form?: FormData, namespace?: string | null): FormData;
|
|
13
|
+
}
|
|
14
|
+
export {};
|