@buildery/ts-api-kit 6.2.1 → 7.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/dist/Api.d.ts +21 -21
- package/dist/Api.js +38 -42
- package/dist/Api.js.map +1 -1
- package/dist/ApiConfigs.js +12 -16
- package/dist/ApiConfigs.js.map +1 -1
- package/dist/compose/index.d.ts +1 -1
- package/dist/compose/index.js +1 -17
- package/dist/compose/index.js.map +1 -1
- package/dist/compose/useSingleton.d.ts +1 -1
- package/dist/compose/useSingleton.js +6 -10
- package/dist/compose/useSingleton.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +8 -11
- package/dist/constants.js.map +1 -1
- package/dist/features/api/AbstractApi.d.ts +1 -1
- package/dist/features/api/AbstractApi.js +4 -9
- package/dist/features/api/AbstractApi.js.map +1 -1
- package/dist/features/api/index.d.ts +1 -1
- package/dist/features/api/index.js +1 -17
- package/dist/features/api/index.js.map +1 -1
- package/dist/features/auth/errors/AuthError.js +1 -5
- package/dist/features/auth/errors/AuthError.js.map +1 -1
- package/dist/features/auth/errors/index.d.ts +1 -1
- package/dist/features/auth/errors/index.js +1 -17
- package/dist/features/auth/errors/index.js.map +1 -1
- package/dist/features/auth/index.d.ts +3 -3
- package/dist/features/auth/index.js +3 -19
- package/dist/features/auth/index.js.map +1 -1
- package/dist/features/auth/services/AuthAxiosService.js +10 -15
- package/dist/features/auth/services/AuthAxiosService.js.map +1 -1
- package/dist/features/auth/services/AuthService.d.ts +2 -2
- package/dist/features/auth/services/AuthService.js +5 -9
- package/dist/features/auth/services/AuthService.js.map +1 -1
- package/dist/features/auth/services/AuthTokensService.d.ts +5 -5
- package/dist/features/auth/services/AuthTokensService.js +14 -18
- package/dist/features/auth/services/AuthTokensService.js.map +1 -1
- package/dist/features/auth/services/index.d.ts +3 -3
- package/dist/features/auth/services/index.js +3 -19
- package/dist/features/auth/services/index.js.map +1 -1
- package/dist/features/auth/types/AuthActivateUser.js +1 -2
- package/dist/features/auth/types/AuthApiTokens.js +1 -2
- package/dist/features/auth/types/AuthChangePassword.js +1 -2
- package/dist/features/auth/types/AuthCode.js +1 -2
- package/dist/features/auth/types/AuthConfirmResetPassword.js +1 -2
- package/dist/features/auth/types/AuthSignIn.js +1 -2
- package/dist/features/auth/types/AuthUserJWT.js +1 -2
- package/dist/features/auth/types/index.d.ts +7 -7
- package/dist/features/auth/types/index.js +7 -23
- package/dist/features/auth/types/index.js.map +1 -1
- package/dist/features/callout/Callout.d.ts +2 -2
- package/dist/features/callout/Callout.js +11 -14
- package/dist/features/callout/Callout.js.map +1 -1
- package/dist/features/callout/CalloutMiddlewareService.d.ts +2 -2
- package/dist/features/callout/CalloutMiddlewareService.js +6 -10
- package/dist/features/callout/CalloutMiddlewareService.js.map +1 -1
- package/dist/features/callout/CalloutMiddlewares.d.ts +1 -1
- package/dist/features/callout/CalloutMiddlewares.js +9 -13
- package/dist/features/callout/CalloutMiddlewares.js.map +1 -1
- package/dist/features/callout/Calloutable.d.ts +2 -2
- package/dist/features/callout/Calloutable.js +6 -10
- package/dist/features/callout/Calloutable.js.map +1 -1
- package/dist/features/callout/index.d.ts +5 -5
- package/dist/features/callout/index.js +5 -21
- package/dist/features/callout/index.js.map +1 -1
- package/dist/features/callout/types.d.ts +2 -2
- package/dist/features/callout/types.js +1 -2
- package/dist/features/crud/index.d.ts +2 -2
- package/dist/features/crud/index.js +2 -18
- package/dist/features/crud/index.js.map +1 -1
- package/dist/features/crud/operations/abstract/AbstractCRUDApi.d.ts +2 -2
- package/dist/features/crud/operations/abstract/AbstractCRUDApi.js +3 -6
- package/dist/features/crud/operations/abstract/AbstractCRUDApi.js.map +1 -1
- package/dist/features/crud/operations/abstract/index.d.ts +1 -1
- package/dist/features/crud/operations/abstract/index.js +1 -17
- package/dist/features/crud/operations/abstract/index.js.map +1 -1
- package/dist/features/crud/operations/index.d.ts +2 -2
- package/dist/features/crud/operations/index.js +2 -18
- package/dist/features/crud/operations/index.js.map +1 -1
- package/dist/features/crud/operations/operations/Create.d.ts +1 -1
- package/dist/features/crud/operations/operations/Create.js +5 -10
- package/dist/features/crud/operations/operations/Create.js.map +1 -1
- package/dist/features/crud/operations/operations/CreateBulk.d.ts +1 -1
- package/dist/features/crud/operations/operations/CreateBulk.js +5 -9
- package/dist/features/crud/operations/operations/CreateBulk.js.map +1 -1
- package/dist/features/crud/operations/operations/DeleteByFilters.d.ts +1 -1
- package/dist/features/crud/operations/operations/DeleteByFilters.js +5 -9
- package/dist/features/crud/operations/operations/DeleteByFilters.js.map +1 -1
- package/dist/features/crud/operations/operations/DeleteById.d.ts +1 -1
- package/dist/features/crud/operations/operations/DeleteById.js +6 -10
- package/dist/features/crud/operations/operations/DeleteById.js.map +1 -1
- package/dist/features/crud/operations/operations/DeleteByIds.d.ts +1 -1
- package/dist/features/crud/operations/operations/DeleteByIds.js +7 -11
- package/dist/features/crud/operations/operations/DeleteByIds.js.map +1 -1
- package/dist/features/crud/operations/operations/GetAll.d.ts +1 -1
- package/dist/features/crud/operations/operations/GetAll.js +6 -10
- package/dist/features/crud/operations/operations/GetAll.js.map +1 -1
- package/dist/features/crud/operations/operations/GetByFilters.d.ts +2 -2
- package/dist/features/crud/operations/operations/GetByFilters.js +6 -10
- package/dist/features/crud/operations/operations/GetByFilters.js.map +1 -1
- package/dist/features/crud/operations/operations/GetById.d.ts +1 -1
- package/dist/features/crud/operations/operations/GetById.js +6 -10
- package/dist/features/crud/operations/operations/GetById.js.map +1 -1
- package/dist/features/crud/operations/operations/GetByIds.d.ts +1 -1
- package/dist/features/crud/operations/operations/GetByIds.js +6 -10
- package/dist/features/crud/operations/operations/GetByIds.js.map +1 -1
- package/dist/features/crud/operations/operations/Update.d.ts +1 -1
- package/dist/features/crud/operations/operations/Update.js +6 -10
- package/dist/features/crud/operations/operations/Update.js.map +1 -1
- package/dist/features/crud/operations/operations/UpdateBulk.d.ts +1 -1
- package/dist/features/crud/operations/operations/UpdateBulk.js +6 -10
- package/dist/features/crud/operations/operations/UpdateBulk.js.map +1 -1
- package/dist/features/crud/operations/operations/Upsert.d.ts +1 -1
- package/dist/features/crud/operations/operations/Upsert.js +6 -10
- package/dist/features/crud/operations/operations/Upsert.js.map +1 -1
- package/dist/features/crud/operations/operations/UpsertBulk.d.ts +1 -1
- package/dist/features/crud/operations/operations/UpsertBulk.js +6 -10
- package/dist/features/crud/operations/operations/UpsertBulk.js.map +1 -1
- package/dist/features/crud/operations/operations/index.d.ts +13 -13
- package/dist/features/crud/operations/operations/index.js +13 -29
- package/dist/features/crud/operations/operations/index.js.map +1 -1
- package/dist/features/crud/sync/compose/index.d.ts +1 -1
- package/dist/features/crud/sync/compose/index.js +1 -17
- package/dist/features/crud/sync/compose/index.js.map +1 -1
- package/dist/features/crud/sync/compose/useCrudSync.d.ts +4 -4
- package/dist/features/crud/sync/compose/useCrudSync.js +34 -33
- package/dist/features/crud/sync/compose/useCrudSync.js.map +1 -1
- package/dist/features/crud/sync/constants/CrudSyncAction.js +2 -5
- package/dist/features/crud/sync/constants/CrudSyncAction.js.map +1 -1
- package/dist/features/crud/sync/constants/CrudSyncConstants.js +1 -4
- package/dist/features/crud/sync/constants/CrudSyncConstants.js.map +1 -1
- package/dist/features/crud/sync/constants/index.d.ts +2 -2
- package/dist/features/crud/sync/constants/index.js +2 -18
- package/dist/features/crud/sync/constants/index.js.map +1 -1
- package/dist/features/crud/sync/error/CrudSyncError.js +1 -5
- package/dist/features/crud/sync/error/CrudSyncError.js.map +1 -1
- package/dist/features/crud/sync/error/index.d.ts +1 -1
- package/dist/features/crud/sync/error/index.js +1 -17
- package/dist/features/crud/sync/error/index.js.map +1 -1
- package/dist/features/crud/sync/index.d.ts +6 -6
- package/dist/features/crud/sync/index.js +6 -22
- package/dist/features/crud/sync/index.js.map +1 -1
- package/dist/features/crud/sync/middlewares/PushCrudEvent.d.ts +3 -3
- package/dist/features/crud/sync/middlewares/PushCrudEvent.js +6 -10
- package/dist/features/crud/sync/middlewares/PushCrudEvent.js.map +1 -1
- package/dist/features/crud/sync/middlewares/index.d.ts +1 -1
- package/dist/features/crud/sync/middlewares/index.js +1 -17
- package/dist/features/crud/sync/middlewares/index.js.map +1 -1
- package/dist/features/crud/sync/services/CrudSyncService.d.ts +1 -1
- package/dist/features/crud/sync/services/CrudSyncService.js +3 -7
- package/dist/features/crud/sync/services/CrudSyncService.js.map +1 -1
- package/dist/features/crud/sync/services/index.d.ts +1 -1
- package/dist/features/crud/sync/services/index.js +1 -17
- package/dist/features/crud/sync/services/index.js.map +1 -1
- package/dist/features/crud/sync/sync/CrudSyncCreate.d.ts +2 -2
- package/dist/features/crud/sync/sync/CrudSyncCreate.js +6 -10
- package/dist/features/crud/sync/sync/CrudSyncCreate.js.map +1 -1
- package/dist/features/crud/sync/sync/CrudSyncDelete.d.ts +2 -2
- package/dist/features/crud/sync/sync/CrudSyncDelete.js +6 -10
- package/dist/features/crud/sync/sync/CrudSyncDelete.js.map +1 -1
- package/dist/features/crud/sync/sync/CrudSyncUpdate.d.ts +2 -2
- package/dist/features/crud/sync/sync/CrudSyncUpdate.js +6 -10
- package/dist/features/crud/sync/sync/CrudSyncUpdate.js.map +1 -1
- package/dist/features/crud/sync/sync/CrudSyncUpsert.d.ts +2 -2
- package/dist/features/crud/sync/sync/CrudSyncUpsert.js +5 -9
- package/dist/features/crud/sync/sync/CrudSyncUpsert.js.map +1 -1
- package/dist/features/crud/sync/sync/abstract/AbstractCrudSync.d.ts +1 -1
- package/dist/features/crud/sync/sync/abstract/AbstractCrudSync.js +4 -8
- package/dist/features/crud/sync/sync/abstract/AbstractCrudSync.js.map +1 -1
- package/dist/features/crud/sync/sync/abstract/index.d.ts +1 -1
- package/dist/features/crud/sync/sync/abstract/index.js +1 -17
- package/dist/features/crud/sync/sync/abstract/index.js.map +1 -1
- package/dist/features/crud/sync/sync/index.d.ts +5 -5
- package/dist/features/crud/sync/sync/index.js +5 -21
- package/dist/features/crud/sync/sync/index.js.map +1 -1
- package/dist/features/index.d.ts +4 -4
- package/dist/features/index.js +4 -20
- package/dist/features/index.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +14 -33
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +1 -0
- package/dist/micro/auth/AuthApi.d.ts +1 -1
- package/dist/micro/auth/AuthApi.js +20 -24
- package/dist/micro/auth/AuthApi.js.map +1 -1
- package/dist/micro/auth/WorkspaceApi.d.ts +1 -1
- package/dist/micro/auth/WorkspaceApi.js +6 -10
- package/dist/micro/auth/WorkspaceApi.js.map +1 -1
- package/dist/micro/auth/index.d.ts +2 -2
- package/dist/micro/auth/index.js +2 -18
- package/dist/micro/auth/index.js.map +1 -1
- package/dist/micro/auth/types/InitWorkspace.d.ts +1 -1
- package/dist/micro/auth/types/InitWorkspace.js +1 -2
- package/dist/micro/auth/types/index.d.ts +1 -1
- package/dist/micro/auth/types/index.js +1 -17
- package/dist/micro/auth/types/index.js.map +1 -1
- package/dist/micro/blueprint/types.js +1 -2
- package/dist/micro/index.d.ts +4 -4
- package/dist/micro/index.js +4 -20
- package/dist/micro/index.js.map +1 -1
- package/dist/micro/query/FieldApi.d.ts +2 -2
- package/dist/micro/query/FieldApi.js +7 -11
- package/dist/micro/query/FieldApi.js.map +1 -1
- package/dist/micro/query/SObjectApi.d.ts +1 -1
- package/dist/micro/query/SObjectApi.js +4 -8
- package/dist/micro/query/SObjectApi.js.map +1 -1
- package/dist/micro/query/error/ObjectApiError.js +1 -5
- package/dist/micro/query/error/ObjectApiError.js.map +1 -1
- package/dist/micro/query/error/index.d.ts +1 -1
- package/dist/micro/query/error/index.js +1 -17
- package/dist/micro/query/error/index.js.map +1 -1
- package/dist/micro/query/index.d.ts +4 -4
- package/dist/micro/query/index.js +4 -20
- package/dist/micro/query/index.js.map +1 -1
- package/dist/micro/query/types/FieldType.js +2 -5
- package/dist/micro/query/types/FieldType.js.map +1 -1
- package/dist/micro/query/types/PicklistValue.js +1 -2
- package/dist/micro/query/types/SObject.d.ts +1 -1
- package/dist/micro/query/types/SObject.js +1 -2
- package/dist/micro/query/types/SObjectField.d.ts +3 -3
- package/dist/micro/query/types/SObjectField.js +1 -2
- package/dist/micro/query/types/index.d.ts +4 -4
- package/dist/micro/query/types/index.js +4 -20
- package/dist/micro/query/types/index.js.map +1 -1
- package/dist/micro/security/PermissionApi.d.ts +2 -2
- package/dist/micro/security/PermissionApi.js +7 -11
- package/dist/micro/security/PermissionApi.js.map +1 -1
- package/dist/micro/security/PermissionCategoryApi.d.ts +1 -1
- package/dist/micro/security/PermissionCategoryApi.js +4 -8
- package/dist/micro/security/PermissionCategoryApi.js.map +1 -1
- package/dist/micro/security/PermissionSetApi.d.ts +2 -2
- package/dist/micro/security/PermissionSetApi.js +6 -10
- package/dist/micro/security/PermissionSetApi.js.map +1 -1
- package/dist/micro/security/TeamApi.d.ts +2 -2
- package/dist/micro/security/TeamApi.js +6 -10
- package/dist/micro/security/TeamApi.js.map +1 -1
- package/dist/micro/security/index.d.ts +5 -5
- package/dist/micro/security/index.js +5 -21
- package/dist/micro/security/index.js.map +1 -1
- package/dist/micro/security/types/CalculatedPermissionAssignment.js +1 -2
- package/dist/micro/security/types/Permission.js +1 -2
- package/dist/micro/security/types/PermissionAssignment.js +1 -2
- package/dist/micro/security/types/PermissionCategory.js +1 -2
- package/dist/micro/security/types/PermissionDefinition.js +1 -2
- package/dist/micro/security/types/PermissionGroup.js +1 -2
- package/dist/micro/security/types/PermissionSet.d.ts +1 -1
- package/dist/micro/security/types/PermissionSet.js +1 -2
- package/dist/micro/security/types/PermissionSetAssignment.js +1 -2
- package/dist/micro/security/types/Team.d.ts +1 -1
- package/dist/micro/security/types/Team.js +1 -2
- package/dist/micro/security/types/TeamAssignment.js +1 -2
- package/dist/micro/security/types/index.d.ts +10 -10
- package/dist/micro/security/types/index.js +10 -26
- package/dist/micro/security/types/index.js.map +1 -1
- package/dist/micro/workspace/ModuleApi.d.ts +2 -2
- package/dist/micro/workspace/ModuleApi.js +7 -11
- package/dist/micro/workspace/ModuleApi.js.map +1 -1
- package/dist/micro/workspace/index.d.ts +2 -2
- package/dist/micro/workspace/index.js +2 -18
- package/dist/micro/workspace/index.js.map +1 -1
- package/dist/micro/workspace/types/CreateUser.js +1 -2
- package/dist/micro/workspace/types/EUserStatus.js +2 -5
- package/dist/micro/workspace/types/EUserStatus.js.map +1 -1
- package/dist/micro/workspace/types/Module.d.ts +1 -1
- package/dist/micro/workspace/types/Module.js +1 -2
- package/dist/micro/workspace/types/ModuleAction.js +1 -2
- package/dist/micro/workspace/types/User.d.ts +3 -3
- package/dist/micro/workspace/types/User.js +1 -2
- package/dist/micro/workspace/types/index.d.ts +5 -5
- package/dist/micro/workspace/types/index.js +5 -21
- package/dist/micro/workspace/types/index.js.map +1 -1
- package/dist/services/MapService.js +2 -6
- package/dist/services/MapService.js.map +1 -1
- package/dist/services/ResponseService.d.ts +1 -1
- package/dist/services/ResponseService.js +5 -12
- package/dist/services/ResponseService.js.map +1 -1
- package/dist/services/UrlService.d.ts +1 -1
- package/dist/services/UrlService.js +5 -10
- package/dist/services/UrlService.js.map +1 -1
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js +3 -19
- package/dist/services/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +4 -7
- package/dist/types.js.map +1 -1
- package/package.json +15 -12
- package/dist/features/callout/decorators/Calloutable.d.ts +0 -3
- package/dist/features/callout/decorators/Calloutable.js +0 -20
- package/dist/features/callout/decorators/Calloutable.js.map +0 -1
- package/dist/features/callout/decorators/index.d.ts +0 -1
- package/dist/features/callout/decorators/index.js +0 -18
- package/dist/features/callout/decorators/index.js.map +0 -1
- package/dist/features/callout/types/ApiCalloutMiddleware.d.ts +0 -2
- package/dist/features/callout/types/ApiCalloutMiddleware.js +0 -3
- package/dist/features/callout/types/ApiCalloutMiddleware.js.map +0 -1
- package/dist/features/callout/types/index.d.ts +0 -1
- package/dist/features/callout/types/index.js +0 -18
- package/dist/features/callout/types/index.js.map +0 -1
- package/dist/micro/security/types/IPermission.d.ts +0 -10
- package/dist/micro/security/types/IPermission.js +0 -3
- package/dist/micro/security/types/IPermission.js.map +0 -1
- package/dist/micro/security/types/IPermissionAssignment.d.ts +0 -6
- package/dist/micro/security/types/IPermissionAssignment.js +0 -3
- package/dist/micro/security/types/IPermissionAssignment.js.map +0 -1
- package/dist/micro/security/types/IPermissionCategory.d.ts +0 -5
- package/dist/micro/security/types/IPermissionCategory.js +0 -3
- package/dist/micro/security/types/IPermissionCategory.js.map +0 -1
- package/dist/micro/security/types/IPermissionDefinition.d.ts +0 -6
- package/dist/micro/security/types/IPermissionDefinition.js +0 -3
- package/dist/micro/security/types/IPermissionDefinition.js.map +0 -1
- package/dist/micro/security/types/IPermissionGroup.d.ts +0 -4
- package/dist/micro/security/types/IPermissionGroup.js +0 -3
- package/dist/micro/security/types/IPermissionGroup.js.map +0 -1
- package/dist/micro/security/types/IPermissionSet.d.ts +0 -6
- package/dist/micro/security/types/IPermissionSet.js +0 -3
- package/dist/micro/security/types/IPermissionSet.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/ApiQueryOptions.d.ts +0 -14
- package/dist/types/ApiQueryOptions.js +0 -3
- package/dist/types/ApiQueryOptions.js.map +0 -1
- package/dist/types/Constructable.d.ts +0 -3
- package/dist/types/Constructable.js +0 -3
- package/dist/types/Constructable.js.map +0 -1
- package/dist/types/Constructor.d.ts +0 -1
- package/dist/types/Constructor.js +0 -3
- package/dist/types/Constructor.js.map +0 -1
- package/dist/types/HasApiName.d.ts +0 -3
- package/dist/types/HasApiName.js +0 -3
- package/dist/types/HasApiName.js.map +0 -1
- package/dist/types/HasCallouts.d.ts +0 -4
- package/dist/types/HasCallouts.js +0 -3
- package/dist/types/HasCallouts.js.map +0 -1
- package/dist/types/HasDBId.d.ts +0 -3
- package/dist/types/HasDBId.js +0 -3
- package/dist/types/HasDBId.js.map +0 -1
- package/dist/types/HasDescription.d.ts +0 -3
- package/dist/types/HasDescription.js +0 -3
- package/dist/types/HasDescription.js.map +0 -1
- package/dist/types/HasEmail.d.ts +0 -3
- package/dist/types/HasEmail.js +0 -3
- package/dist/types/HasEmail.js.map +0 -1
- package/dist/types/HasId.d.ts +0 -3
- package/dist/types/HasId.js +0 -3
- package/dist/types/HasId.js.map +0 -1
- package/dist/types/HasLabel.d.ts +0 -3
- package/dist/types/HasLabel.js +0 -3
- package/dist/types/HasLabel.js.map +0 -1
- package/dist/types/HasMode.d.ts +0 -3
- package/dist/types/HasMode.js +0 -3
- package/dist/types/HasMode.js.map +0 -1
- package/dist/types/HasNamespace.d.ts +0 -3
- package/dist/types/HasNamespace.js +0 -3
- package/dist/types/HasNamespace.js.map +0 -1
- package/dist/types/HasOrder.d.ts +0 -3
- package/dist/types/HasOrder.js +0 -3
- package/dist/types/HasOrder.js.map +0 -1
- package/dist/types/index.d.ts +0 -11
- package/dist/types/index.js +0 -28
- package/dist/types/index.js.map +0 -1
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const AuthTokensService_1 = require("./AuthTokensService");
|
|
6
|
-
const AuthService_1 = require("./AuthService");
|
|
7
|
-
class AuthAxiosService {
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { AuthTokensService } from "./AuthTokensService.js";
|
|
3
|
+
import { AuthService } from "./AuthService.js";
|
|
4
|
+
export class AuthAxiosService {
|
|
8
5
|
static getAxiosInstance() {
|
|
9
|
-
const instance =
|
|
6
|
+
const instance = axios.create();
|
|
10
7
|
if (typeof window !== "undefined") {
|
|
11
8
|
instance.interceptors.request.use(AuthAxiosService.setTokenHeader, error => Promise.reject(error));
|
|
12
9
|
instance.interceptors.response.use(response => response, AuthAxiosService.refreshTokens);
|
|
@@ -14,22 +11,21 @@ class AuthAxiosService {
|
|
|
14
11
|
return instance;
|
|
15
12
|
}
|
|
16
13
|
static setTokenHeader(config) {
|
|
17
|
-
const accessToken =
|
|
14
|
+
const accessToken = AuthTokensService.getAccessToken();
|
|
18
15
|
if (!accessToken)
|
|
19
16
|
return config;
|
|
20
17
|
config.headers.Authorization = config ? `Bearer ${accessToken}` : '';
|
|
21
18
|
return config;
|
|
22
19
|
}
|
|
23
20
|
static async refreshTokens(error) {
|
|
24
|
-
|
|
25
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== 401)
|
|
21
|
+
if (error.response?.status !== 401)
|
|
26
22
|
return Promise.reject(error);
|
|
27
|
-
await
|
|
28
|
-
if (!
|
|
23
|
+
await AuthService.refresh();
|
|
24
|
+
if (!AuthTokensService.isTokensExists()) {
|
|
29
25
|
AuthAxiosService.redirectToSignIn();
|
|
30
26
|
return error;
|
|
31
27
|
}
|
|
32
|
-
return (
|
|
28
|
+
return axios(error.config);
|
|
33
29
|
}
|
|
34
30
|
static redirectToSignIn() {
|
|
35
31
|
const loginURL = `http://auth.localhost`;
|
|
@@ -38,5 +34,4 @@ class AuthAxiosService {
|
|
|
38
34
|
window.location.replace(url);
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
|
-
exports.AuthAxiosService = AuthAxiosService;
|
|
42
37
|
//# sourceMappingURL=AuthAxiosService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthAxiosService.js","sourceRoot":"","sources":["../../../../src/features/auth/services/AuthAxiosService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthAxiosService.js","sourceRoot":"","sources":["../../../../src/features/auth/services/AuthAxiosService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,OAAO,gBAAgB;IAC1B,MAAM,CAAC,gBAAgB;QACtB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAEhC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACnG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;QAC7F,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,MAAkC;QACtD,MAAM,WAAW,GAAG,iBAAiB,CAAC,cAAc,EAAE,CAAC;QAEvD,IAAI,CAAC,WAAW;YAAE,OAAO,MAAM,CAAC;QAEhC,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAErE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAU;QACnC,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEjE,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QAE5B,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC;YACxC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC;YAEpC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,gBAAgB;QACpB,MAAM,QAAQ,GAAG,uBAAuB,CAAC;QACzC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAEzC,MAAM,GAAG,GAAG,GAAG,QAAQ,aAAa,WAAW,EAAE,CAAC;QAElD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;CAEF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare class AuthService {
|
|
2
|
-
static signInByCode(code: string): Promise<import("
|
|
3
|
-
static refresh(): Promise<
|
|
2
|
+
static signInByCode(code: string): Promise<import("../index.js").AuthApiTokens | undefined>;
|
|
3
|
+
static refresh(): Promise<null | undefined>;
|
|
4
4
|
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AuthService = void 0;
|
|
4
|
-
const AuthTokensService_1 = require("./AuthTokensService");
|
|
5
|
-
class AuthService {
|
|
1
|
+
import { AuthTokensService } from "./AuthTokensService.js";
|
|
2
|
+
export class AuthService {
|
|
6
3
|
static async signInByCode(code) {
|
|
7
4
|
if (!code)
|
|
8
5
|
return;
|
|
9
6
|
const tokens = null;
|
|
10
|
-
return
|
|
7
|
+
return AuthTokensService.setTokens(tokens);
|
|
11
8
|
}
|
|
12
9
|
static async refresh() {
|
|
13
|
-
const refreshToken =
|
|
10
|
+
const refreshToken = AuthTokensService.getRefreshToken();
|
|
14
11
|
if (!refreshToken)
|
|
15
12
|
return;
|
|
16
13
|
const tokens = null;
|
|
17
|
-
|
|
14
|
+
AuthTokensService.setTokens(tokens);
|
|
18
15
|
return tokens;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
exports.AuthService = AuthService;
|
|
22
18
|
//# sourceMappingURL=AuthService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../../src/features/auth/services/AuthService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../../src/features/auth/services/AuthService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAGzD,MAAM,OAAO,WAAW;IAKtB,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAY;QACpC,IAAI,CAAC,IAAI;YAAE,OAAO;QAGlB,MAAM,MAAM,GAAG,IAAI,CAAA;QAGnB,OAAO,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO;QAClB,MAAM,YAAY,GAAG,iBAAiB,CAAC,eAAe,EAAE,CAAC;QAEzD,IAAI,CAAC,YAAY;YAAE,OAAO;QAG1B,MAAM,MAAM,GAAG,IAAI,CAAA;QAGnB,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAEpC,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AuthApiTokens, AuthUserJWT } from "../types";
|
|
1
|
+
import { AuthApiTokens, AuthUserJWT } from "../types/index.js";
|
|
2
2
|
export declare const ACCESS_TOKEN_KEY = "access_token";
|
|
3
3
|
export declare const REFRESH_TOKEN_KEY = "refresh_token";
|
|
4
4
|
export declare const ACCESS_TOKEN_DECODED_KEY = "access_token_decoded";
|
|
5
5
|
export declare class AuthTokensService {
|
|
6
|
-
static getAccessToken(): string;
|
|
6
|
+
static getAccessToken(): string | null;
|
|
7
7
|
static getDecodedAccessToken(): AuthUserJWT;
|
|
8
8
|
static setAccessToken(token: string): void;
|
|
9
|
-
static getRefreshToken(): string;
|
|
9
|
+
static getRefreshToken(): string | null;
|
|
10
10
|
static setRefreshToken(token: string): void;
|
|
11
|
-
static setTokens(tokens: AuthApiTokens | undefined): AuthApiTokens;
|
|
12
|
-
static isTokensExists(): string;
|
|
11
|
+
static setTokens(tokens: AuthApiTokens | undefined): AuthApiTokens | undefined;
|
|
12
|
+
static isTokensExists(): string | null;
|
|
13
13
|
}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
exports.REFRESH_TOKEN_KEY = 'refresh_token';
|
|
8
|
-
exports.ACCESS_TOKEN_DECODED_KEY = 'access_token_decoded';
|
|
9
|
-
class AuthTokensService {
|
|
1
|
+
import { AuthError } from "../errors/index.js";
|
|
2
|
+
import { jwtDecode } from "jwt-decode";
|
|
3
|
+
export const ACCESS_TOKEN_KEY = 'access_token';
|
|
4
|
+
export const REFRESH_TOKEN_KEY = 'refresh_token';
|
|
5
|
+
export const ACCESS_TOKEN_DECODED_KEY = 'access_token_decoded';
|
|
6
|
+
export class AuthTokensService {
|
|
10
7
|
static getAccessToken() {
|
|
11
|
-
return localStorage.getItem(
|
|
8
|
+
return localStorage.getItem(ACCESS_TOKEN_KEY);
|
|
12
9
|
}
|
|
13
10
|
static getDecodedAccessToken() {
|
|
14
|
-
return JSON.parse(localStorage.getItem(
|
|
11
|
+
return JSON.parse(localStorage.getItem(ACCESS_TOKEN_DECODED_KEY));
|
|
15
12
|
}
|
|
16
13
|
static setAccessToken(token) {
|
|
17
14
|
if (!token)
|
|
18
|
-
throw new
|
|
19
|
-
localStorage.setItem(
|
|
20
|
-
localStorage.setItem(
|
|
15
|
+
throw new AuthError('Access token is not defined during saving');
|
|
16
|
+
localStorage.setItem(ACCESS_TOKEN_KEY, token);
|
|
17
|
+
localStorage.setItem(ACCESS_TOKEN_DECODED_KEY, JSON.stringify(jwtDecode(token)));
|
|
21
18
|
}
|
|
22
19
|
static getRefreshToken() {
|
|
23
|
-
return localStorage.getItem(
|
|
20
|
+
return localStorage.getItem(REFRESH_TOKEN_KEY);
|
|
24
21
|
}
|
|
25
22
|
static setRefreshToken(token) {
|
|
26
23
|
if (!token)
|
|
27
|
-
throw new
|
|
28
|
-
localStorage.setItem(
|
|
24
|
+
throw new AuthError('Refresh token is not defined during saving');
|
|
25
|
+
localStorage.setItem(REFRESH_TOKEN_KEY, token);
|
|
29
26
|
}
|
|
30
27
|
static setTokens(tokens) {
|
|
31
28
|
if (!tokens)
|
|
@@ -38,5 +35,4 @@ class AuthTokensService {
|
|
|
38
35
|
return AuthTokensService.getAccessToken() && AuthTokensService.getRefreshToken();
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
exports.AuthTokensService = AuthTokensService;
|
|
42
38
|
//# sourceMappingURL=AuthTokensService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthTokensService.js","sourceRoot":"","sources":["../../../../src/features/auth/services/AuthTokensService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthTokensService.js","sourceRoot":"","sources":["../../../../src/features/auth/services/AuthTokensService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D,MAAM,OAAO,iBAAiB;IAE5B,MAAM,CAAC,cAAc;QACnB,OAAO,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,qBAAqB;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,wBAAwB,CAAW,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,KAAa;QACjC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAC;QAE7E,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QAC9C,YAAY,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,CAAC,eAAe;QACpB,OAAO,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,KAAa;QAClC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;QAE9E,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAAiC;QAChD,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACxC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAE1C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,cAAc;QACnB,OAAO,iBAAiB,CAAC,cAAc,EAAE,IAAI,iBAAiB,CAAC,eAAe,EAAE,CAAC;IACnF,CAAC;CACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './AuthTokensService';
|
|
2
|
-
export * from './AuthService';
|
|
3
|
-
export * from './AuthAxiosService';
|
|
1
|
+
export * from './AuthTokensService.js';
|
|
2
|
+
export * from './AuthService.js';
|
|
3
|
+
export * from './AuthAxiosService.js';
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./AuthTokensService"), exports);
|
|
18
|
-
__exportStar(require("./AuthService"), exports);
|
|
19
|
-
__exportStar(require("./AuthAxiosService"), exports);
|
|
1
|
+
export * from './AuthTokensService.js';
|
|
2
|
+
export * from './AuthService.js';
|
|
3
|
+
export * from './AuthAxiosService.js';
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/auth/services/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/auth/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './AuthUserJWT';
|
|
2
|
-
export * from './AuthApiTokens';
|
|
3
|
-
export * from './AuthActivateUser';
|
|
4
|
-
export * from './AuthChangePassword';
|
|
5
|
-
export * from './AuthSignIn';
|
|
6
|
-
export * from './AuthCode';
|
|
7
|
-
export * from './AuthConfirmResetPassword';
|
|
1
|
+
export * from './AuthUserJWT.js';
|
|
2
|
+
export * from './AuthApiTokens.js';
|
|
3
|
+
export * from './AuthActivateUser.js';
|
|
4
|
+
export * from './AuthChangePassword.js';
|
|
5
|
+
export * from './AuthSignIn.js';
|
|
6
|
+
export * from './AuthCode.js';
|
|
7
|
+
export * from './AuthConfirmResetPassword.js';
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./AuthUserJWT"), exports);
|
|
18
|
-
__exportStar(require("./AuthApiTokens"), exports);
|
|
19
|
-
__exportStar(require("./AuthActivateUser"), exports);
|
|
20
|
-
__exportStar(require("./AuthChangePassword"), exports);
|
|
21
|
-
__exportStar(require("./AuthSignIn"), exports);
|
|
22
|
-
__exportStar(require("./AuthCode"), exports);
|
|
23
|
-
__exportStar(require("./AuthConfirmResetPassword"), exports);
|
|
1
|
+
export * from './AuthUserJWT.js';
|
|
2
|
+
export * from './AuthApiTokens.js';
|
|
3
|
+
export * from './AuthActivateUser.js';
|
|
4
|
+
export * from './AuthChangePassword.js';
|
|
5
|
+
export * from './AuthSignIn.js';
|
|
6
|
+
export * from './AuthCode.js';
|
|
7
|
+
export * from './AuthConfirmResetPassword.js';
|
|
24
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/auth/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/auth/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
-
import { CalloutMiddleware, CalloutState } from "./types";
|
|
2
|
+
import { CalloutMiddleware, CalloutState } from "./types.js";
|
|
3
3
|
export declare class Callout<Params extends any[], ResponseType> {
|
|
4
4
|
private readonly _axiosInstance;
|
|
5
5
|
private readonly _configFunction;
|
|
@@ -8,7 +8,7 @@ export declare class Callout<Params extends any[], ResponseType> {
|
|
|
8
8
|
private _message;
|
|
9
9
|
get getState(): CalloutState;
|
|
10
10
|
get isLoading(): boolean;
|
|
11
|
-
get getMessage(): string;
|
|
11
|
+
get getMessage(): string | null | undefined;
|
|
12
12
|
get getConfigFunction(): (...params: Params) => AxiosRequestConfig;
|
|
13
13
|
constructor(configFunction: () => AxiosRequestConfig, axiosInstance?: AxiosInstance | null);
|
|
14
14
|
setMessage(message: string | undefined): this;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export class Callout {
|
|
3
|
+
_axiosInstance = axios;
|
|
4
|
+
_configFunction;
|
|
5
|
+
_state = { isLoading: false, message: null };
|
|
6
|
+
_middlewares = [];
|
|
7
|
+
_message = 'Loading...';
|
|
6
8
|
get getState() { return this._state; }
|
|
7
|
-
get isLoading() { return this._state.isLoading; }
|
|
9
|
+
get isLoading() { return Boolean(this._state.isLoading); }
|
|
8
10
|
get getMessage() { return this._state.message; }
|
|
9
11
|
get getConfigFunction() { return this._configFunction; }
|
|
10
12
|
constructor(configFunction, axiosInstance = null) {
|
|
11
|
-
this._axiosInstance = axios_1.default;
|
|
12
|
-
this._state = { isLoading: false, message: null };
|
|
13
|
-
this._middlewares = [];
|
|
14
|
-
this._message = 'Loading...';
|
|
15
13
|
this._configFunction = configFunction;
|
|
16
|
-
this._axiosInstance = axiosInstance
|
|
14
|
+
this._axiosInstance = axiosInstance ?? this._getAxiosInstance();
|
|
17
15
|
}
|
|
18
16
|
setMessage(message) {
|
|
19
17
|
this._message = message;
|
|
@@ -28,7 +26,7 @@ class Callout {
|
|
|
28
26
|
response = await this._axiosInstance(config);
|
|
29
27
|
}
|
|
30
28
|
catch (e) {
|
|
31
|
-
response = e
|
|
29
|
+
response = e?.response;
|
|
32
30
|
error = e;
|
|
33
31
|
}
|
|
34
32
|
await this._invokeMiddlewares(response, params, error);
|
|
@@ -45,7 +43,7 @@ class Callout {
|
|
|
45
43
|
this._middlewares.splice(index, 1);
|
|
46
44
|
}
|
|
47
45
|
_getAxiosInstance() {
|
|
48
|
-
return
|
|
46
|
+
return axios.create();
|
|
49
47
|
}
|
|
50
48
|
_invokeStart() {
|
|
51
49
|
this._state.isLoading = true;
|
|
@@ -62,5 +60,4 @@ class Callout {
|
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
|
-
exports.Callout = Callout;
|
|
66
63
|
//# sourceMappingURL=Callout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Callout.js","sourceRoot":"","sources":["../../../src/features/callout/Callout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Callout.js","sourceRoot":"","sources":["../../../src/features/callout/Callout.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosResponse } from "axios";
|
|
2
|
-
import { CalloutMiddlewareConditions } from "./types";
|
|
2
|
+
import { CalloutMiddlewareConditions } from "./types.js";
|
|
3
3
|
export declare class CalloutMiddlewareService {
|
|
4
|
-
static isMeetConditions(response
|
|
4
|
+
static isMeetConditions(response?: AxiosResponse, conditions?: CalloutMiddlewareConditions): boolean;
|
|
5
5
|
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CalloutMiddlewareService = void 0;
|
|
4
|
-
const services_1 = require("../../services");
|
|
5
|
-
class CalloutMiddlewareService {
|
|
1
|
+
import { ResponseService } from "../../services/index.js";
|
|
2
|
+
export class CalloutMiddlewareService {
|
|
6
3
|
static isMeetConditions(response, conditions) {
|
|
7
4
|
if (!conditions)
|
|
8
5
|
return true;
|
|
9
|
-
const isHTTPIncludeMeet = !conditions.forHTTPCodes ||
|
|
10
|
-
const isHTTPExcludeMeet = !conditions.excludeHTTPCodes || !
|
|
11
|
-
const isServerIncludeMeet = !conditions.forServerCodes ||
|
|
12
|
-
const isServerExcludeMeet = !conditions.excludeServerCodes || !
|
|
6
|
+
const isHTTPIncludeMeet = !conditions.forHTTPCodes || ResponseService.isInHttpCodeRange(response, conditions.forHTTPCodes);
|
|
7
|
+
const isHTTPExcludeMeet = !conditions.excludeHTTPCodes || !ResponseService.isInHttpCodeRange(response, conditions.excludeHTTPCodes);
|
|
8
|
+
const isServerIncludeMeet = !conditions.forServerCodes || ResponseService.isInServerCodeRange(response, conditions.forServerCodes);
|
|
9
|
+
const isServerExcludeMeet = !conditions.excludeServerCodes || !ResponseService.isInServerCodeRange(response, conditions.excludeServerCodes);
|
|
13
10
|
return isHTTPIncludeMeet && isHTTPExcludeMeet && isServerIncludeMeet && isServerExcludeMeet;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.CalloutMiddlewareService = CalloutMiddlewareService;
|
|
17
13
|
//# sourceMappingURL=CalloutMiddlewareService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalloutMiddlewareService.js","sourceRoot":"","sources":["../../../src/features/callout/CalloutMiddlewareService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CalloutMiddlewareService.js","sourceRoot":"","sources":["../../../src/features/callout/CalloutMiddlewareService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAExD,MAAM,OAAO,wBAAwB;IACjC,MAAM,CAAC,gBAAgB,CAAC,QAAwB,EAAE,UAAwC;QACtF,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QAE7B,MAAM,iBAAiB,GAAG,CAAC,UAAU,CAAC,YAAY,IAAI,eAAe,CAAC,iBAAiB,CAAC,QAAiB,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QACpI,MAAM,iBAAiB,GAAG,CAAC,UAAU,CAAC,gBAAgB,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,QAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAE7I,MAAM,mBAAmB,GAAG,CAAC,UAAU,CAAC,cAAc,IAAI,eAAe,CAAC,mBAAmB,CAAC,QAAiB,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;QAC5I,MAAM,mBAAmB,GAAG,CAAC,UAAU,CAAC,kBAAkB,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,QAAiB,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;QAErJ,OAAO,iBAAiB,IAAI,iBAAiB,IAAI,mBAAmB,IAAI,mBAAmB,CAAC;IAChG,CAAC;CAEJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalloutMiddleware, CalloutMiddlewareConditions } from "./types";
|
|
1
|
+
import { CalloutMiddleware, CalloutMiddlewareConditions } from "./types.js";
|
|
2
2
|
export declare class CalloutMiddlewares {
|
|
3
3
|
static throwException: (message?: string, conditions?: CalloutMiddlewareConditions) => CalloutMiddleware<any, any>;
|
|
4
4
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CalloutMiddlewareService } from "./CalloutMiddlewareService.js";
|
|
2
|
+
export class CalloutMiddlewares {
|
|
3
|
+
static throwException = (message, conditions) => ({ callout, response, error }) => {
|
|
4
|
+
if (!CalloutMiddlewareService.isMeetConditions(response, conditions))
|
|
5
|
+
return;
|
|
6
|
+
callout.getState.isLoading = false;
|
|
7
|
+
callout.getState.message = undefined;
|
|
8
|
+
throw new Error(message ?? `${error?.name}: ${error?.message}`);
|
|
9
|
+
};
|
|
6
10
|
}
|
|
7
|
-
exports.CalloutMiddlewares = CalloutMiddlewares;
|
|
8
|
-
CalloutMiddlewares.throwException = (message, conditions) => ({ callout, response, error }) => {
|
|
9
|
-
if (!CalloutMiddlewareService_1.CalloutMiddlewareService.isMeetConditions(response, conditions))
|
|
10
|
-
return;
|
|
11
|
-
callout.getState.isLoading = false;
|
|
12
|
-
callout.getState.message = undefined;
|
|
13
|
-
throw new Error(message !== null && message !== void 0 ? message : `${error === null || error === void 0 ? void 0 : error.name}: ${error === null || error === void 0 ? void 0 : error.message}`);
|
|
14
|
-
};
|
|
15
11
|
//# sourceMappingURL=CalloutMiddlewares.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalloutMiddlewares.js","sourceRoot":"","sources":["../../../src/features/callout/CalloutMiddlewares.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CalloutMiddlewares.js","sourceRoot":"","sources":["../../../src/features/callout/CalloutMiddlewares.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAEvE,MAAM,OAAO,kBAAkB;IACpB,MAAM,CAAC,cAAc,GAAG,CAAC,OAAgB,EAAE,UAAwC,EAA+B,EAAE,CAAC,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAC,EAAE,EAAE;QACvJ,IAAI,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC;YAAE,OAAO;QAE7E,OAAO,CAAC,QAAQ,CAAC,SAAS,GAAG,KAAK,CAAC;QACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;QAErC,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,GAAG,KAAK,EAAE,IAAI,KAAK,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ApiCalloutMiddleware } from "./types";
|
|
2
|
-
import type { AbstractCRUDApi } from "../crud";
|
|
1
|
+
import { ApiCalloutMiddleware } from "./types.js";
|
|
2
|
+
import type { AbstractCRUDApi } from "../crud/index.js";
|
|
3
3
|
export declare const Calloutable: (...apiMiddlewares: Array<ApiCalloutMiddleware<AbstractCRUDApi>>) => (target: any, method: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const auth_1 = require("../auth");
|
|
5
|
-
const Callout_1 = require("./Callout");
|
|
6
|
-
const Calloutable = (...apiMiddlewares) => (target, method, descriptor) => {
|
|
1
|
+
import { AuthAxiosService } from "../auth/index.js";
|
|
2
|
+
import { Callout } from "./Callout.js";
|
|
3
|
+
export const Calloutable = (...apiMiddlewares) => (target, method, descriptor) => {
|
|
7
4
|
target[`${method}Callout`] = function () {
|
|
8
|
-
const callout = new
|
|
9
|
-
apiMiddlewares
|
|
10
|
-
const calloutMiddleware = apiMiddleware
|
|
5
|
+
const callout = new Callout(descriptor.value.bind(this), AuthAxiosService.getAxiosInstance());
|
|
6
|
+
apiMiddlewares?.map(apiMiddleware => {
|
|
7
|
+
const calloutMiddleware = apiMiddleware?.(this);
|
|
11
8
|
if (!calloutMiddleware)
|
|
12
9
|
return;
|
|
13
10
|
callout.addMiddleware(calloutMiddleware);
|
|
@@ -16,5 +13,4 @@ const Calloutable = (...apiMiddlewares) => (target, method, descriptor) => {
|
|
|
16
13
|
};
|
|
17
14
|
return descriptor;
|
|
18
15
|
};
|
|
19
|
-
exports.Calloutable = Calloutable;
|
|
20
16
|
//# sourceMappingURL=Calloutable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calloutable.js","sourceRoot":"","sources":["../../../src/features/callout/Calloutable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Calloutable.js","sourceRoot":"","sources":["../../../src/features/callout/Calloutable.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,cAA4D,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,MAAc,EAAE,UAA8B,EAAE,EAAE;IAC9J,MAAM,CAAC,GAAG,MAAM,SAAS,CAAC,GAAG;QAG3B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAE9F,cAAc,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE;YAClC,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC;YAEhD,IAAI,CAAC,iBAAiB;gBAAE,OAAO;YAE/B,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './Callout';
|
|
3
|
-
export * from './Calloutable';
|
|
4
|
-
export * from './CalloutMiddlewareService';
|
|
5
|
-
export * from './CalloutMiddlewares';
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './Callout.js';
|
|
3
|
+
export * from './Calloutable.js';
|
|
4
|
+
export * from './CalloutMiddlewareService.js';
|
|
5
|
+
export * from './CalloutMiddlewares.js';
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./Callout"), exports);
|
|
19
|
-
__exportStar(require("./Calloutable"), exports);
|
|
20
|
-
__exportStar(require("./CalloutMiddlewareService"), exports);
|
|
21
|
-
__exportStar(require("./CalloutMiddlewares"), exports);
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './Callout.js';
|
|
3
|
+
export * from './Calloutable.js';
|
|
4
|
+
export * from './CalloutMiddlewareService.js';
|
|
5
|
+
export * from './CalloutMiddlewares.js';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/callout/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/callout/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { Callout } from "./Callout";
|
|
2
|
+
import { Callout } from "./Callout.js";
|
|
3
3
|
export type ApiCalloutMiddleware<T> = (apiInstance: T) => CalloutMiddleware<any, any>;
|
|
4
4
|
export type CalloutMiddleware<P extends Array<any>, T> = (params: CalloutMiddlewareParams<P, T>) => any;
|
|
5
5
|
export type CalloutMiddlewareParams<Params extends any[], ResponseType> = {
|
|
@@ -11,7 +11,7 @@ export type CalloutMiddlewareParams<Params extends any[], ResponseType> = {
|
|
|
11
11
|
};
|
|
12
12
|
export type CalloutState = {
|
|
13
13
|
isLoading: boolean | undefined;
|
|
14
|
-
message: string | undefined;
|
|
14
|
+
message: string | null | undefined;
|
|
15
15
|
};
|
|
16
16
|
export type CalloutMiddlewareConditions = {
|
|
17
17
|
forHTTPCodes?: Array<number>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './operations';
|
|
2
|
-
export * from './sync';
|
|
1
|
+
export * from './operations/index.js';
|
|
2
|
+
export * from './sync/index.js';
|