@quvel-kit/core 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +670 -0
- package/dist/auth/boot/defineAuthGuard.d.ts +54 -0
- package/dist/auth/boot/defineAuthGuard.d.ts.map +1 -0
- package/dist/auth/boot/defineAuthGuard.js +72 -0
- package/dist/auth/enums/AuthStatusEnum.d.ts +13 -0
- package/dist/auth/enums/AuthStatusEnum.d.ts.map +1 -0
- package/dist/auth/enums/AuthStatusEnum.js +13 -0
- package/dist/auth/index.d.ts +13 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/services/AuthGuard.d.ts +58 -0
- package/dist/auth/services/AuthGuard.d.ts.map +1 -0
- package/dist/auth/services/AuthGuard.js +51 -0
- package/dist/auth/services/AuthService.d.ts +52 -0
- package/dist/auth/services/AuthService.d.ts.map +1 -0
- package/dist/auth/services/AuthService.js +67 -0
- package/dist/auth/services/PasswordResetService.d.ts +34 -0
- package/dist/auth/services/PasswordResetService.d.ts.map +1 -0
- package/dist/auth/services/PasswordResetService.js +45 -0
- package/dist/auth/services/TwoFactorChallengeService.d.ts +22 -0
- package/dist/auth/services/TwoFactorChallengeService.d.ts.map +1 -0
- package/dist/auth/services/TwoFactorChallengeService.js +29 -0
- package/dist/auth/services/TwoFactorService.d.ts +64 -0
- package/dist/auth/services/TwoFactorService.d.ts.map +1 -0
- package/dist/auth/services/TwoFactorService.js +68 -0
- package/dist/auth/services/index.d.ts +8 -0
- package/dist/auth/services/index.d.ts.map +1 -0
- package/dist/auth/services/index.js +5 -0
- package/dist/auth/types/auth-meta.d.ts +54 -0
- package/dist/auth/types/auth-meta.d.ts.map +1 -0
- package/dist/auth/types/auth-meta.js +6 -0
- package/dist/auth/types/index.d.ts +5 -0
- package/dist/auth/types/index.d.ts.map +1 -0
- package/dist/auth/types/index.js +4 -0
- package/dist/auth/utils/auth-meta.d.ts +75 -0
- package/dist/auth/utils/auth-meta.d.ts.map +1 -0
- package/dist/auth/utils/auth-meta.js +93 -0
- package/dist/boot/quvel.d.ts +26 -0
- package/dist/boot/quvel.d.ts.map +1 -0
- package/dist/boot/quvel.js +38 -0
- package/dist/build/index.d.ts +9 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +8 -0
- package/dist/build/loadEnv.d.ts +14 -0
- package/dist/build/loadEnv.d.ts.map +1 -0
- package/dist/build/loadEnv.js +33 -0
- package/dist/build/quasarConfig.d.ts +67 -0
- package/dist/build/quasarConfig.d.ts.map +1 -0
- package/dist/build/quasarConfig.js +126 -0
- package/dist/components/Common/TaskErrors.vue +47 -0
- package/dist/components/Inputs/BaseInput.vue +88 -0
- package/dist/components/Misc/ClientOnly.vue +22 -0
- package/dist/components/Transitions/FadeInOut.vue +9 -0
- package/dist/components/Transitions/SlowExpand.vue +13 -0
- package/dist/components/WebSocketChannelManager.vue +634 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +16 -0
- package/dist/composables/index.d.ts +19 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/index.js +16 -0
- package/dist/composables/useClient.d.ts +16 -0
- package/dist/composables/useClient.d.ts.map +1 -0
- package/dist/composables/useClient.js +28 -0
- package/dist/composables/useMetaConfig.d.ts +14 -0
- package/dist/composables/useMetaConfig.d.ts.map +1 -0
- package/dist/composables/useMetaConfig.js +77 -0
- package/dist/composables/useQueryMessageHandler.d.ts +44 -0
- package/dist/composables/useQueryMessageHandler.d.ts.map +1 -0
- package/dist/composables/useQueryMessageHandler.js +74 -0
- package/dist/composables/useQuvel.d.ts +15 -0
- package/dist/composables/useQuvel.d.ts.map +1 -0
- package/dist/composables/useQuvel.js +38 -0
- package/dist/composables/useRecaptcha.d.ts +35 -0
- package/dist/composables/useRecaptcha.d.ts.map +1 -0
- package/dist/composables/useRecaptcha.js +87 -0
- package/dist/composables/useScopedService.d.ts +18 -0
- package/dist/composables/useScopedService.d.ts.map +1 -0
- package/dist/composables/useScopedService.js +25 -0
- package/dist/composables/useScript.d.ts +25 -0
- package/dist/composables/useScript.d.ts.map +1 -0
- package/dist/composables/useScript.js +106 -0
- package/dist/composables/useUrlQueryHandler.d.ts +38 -0
- package/dist/composables/useUrlQueryHandler.d.ts.map +1 -0
- package/dist/composables/useUrlQueryHandler.js +76 -0
- package/dist/composables/useWebSockets.d.ts +18 -0
- package/dist/composables/useWebSockets.d.ts.map +1 -0
- package/dist/composables/useWebSockets.js +55 -0
- package/dist/composables/useWindowEvent.d.ts +16 -0
- package/dist/composables/useWindowEvent.d.ts.map +1 -0
- package/dist/composables/useWindowEvent.js +27 -0
- package/dist/composables/useXsrf.d.ts +29 -0
- package/dist/composables/useXsrf.d.ts.map +1 -0
- package/dist/composables/useXsrf.js +59 -0
- package/dist/config/QuasarConfigBuilder.d.ts +100 -0
- package/dist/config/QuasarConfigBuilder.d.ts.map +1 -0
- package/dist/config/QuasarConfigBuilder.js +98 -0
- package/dist/config/i18n.d.ts +23 -0
- package/dist/config/i18n.d.ts.map +1 -0
- package/dist/config/i18n.js +43 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/moduleTransformer.d.ts +18 -0
- package/dist/config/moduleTransformer.d.ts.map +1 -0
- package/dist/config/moduleTransformer.js +76 -0
- package/dist/config/quvel.d.ts +40 -0
- package/dist/config/quvel.d.ts.map +1 -0
- package/dist/config/quvel.js +59 -0
- package/dist/config/quvel.types.d.ts +59 -0
- package/dist/config/quvel.types.d.ts.map +1 -0
- package/dist/config/quvel.types.js +6 -0
- package/dist/container/ServiceContainer.d.ts +107 -0
- package/dist/container/ServiceContainer.d.ts.map +1 -0
- package/dist/container/ServiceContainer.js +201 -0
- package/dist/container/types/vue.d.ts +9 -0
- package/dist/container/types.d.ts +81 -0
- package/dist/container/types.d.ts.map +1 -0
- package/dist/container/types.js +1 -0
- package/dist/i18n/en-US/common.d.ts +19 -0
- package/dist/i18n/en-US/common.d.ts.map +1 -0
- package/dist/i18n/en-US/common.js +17 -0
- package/dist/i18n/en-US/index.d.ts +21 -0
- package/dist/i18n/en-US/index.d.ts.map +1 -0
- package/dist/i18n/en-US/index.js +4 -0
- package/dist/i18n/es-MX/common.d.ts +19 -0
- package/dist/i18n/es-MX/common.d.ts.map +1 -0
- package/dist/i18n/es-MX/common.js +17 -0
- package/dist/i18n/es-MX/index.d.ts +21 -0
- package/dist/i18n/es-MX/index.d.ts.map +1 -0
- package/dist/i18n/es-MX/index.js +4 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/models/User.d.ts +32 -0
- package/dist/models/User.d.ts.map +1 -0
- package/dist/models/User.js +48 -0
- package/dist/module.d.ts +21 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +45 -0
- package/dist/modules/helpers.d.ts +30 -0
- package/dist/modules/helpers.d.ts.map +1 -0
- package/dist/modules/helpers.js +45 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +6 -0
- package/dist/modules/types.d.ts +141 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +7 -0
- package/dist/pages/ErrorNotFound.vue +300 -0
- package/dist/pages/index.d.ts +7 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +6 -0
- package/dist/services/ApiService.d.ts +90 -0
- package/dist/services/ApiService.d.ts.map +1 -0
- package/dist/services/ApiService.js +159 -0
- package/dist/services/I18nService.d.ts +67 -0
- package/dist/services/I18nService.d.ts.map +1 -0
- package/dist/services/I18nService.js +92 -0
- package/dist/services/LogService.d.ts +31 -0
- package/dist/services/LogService.d.ts.map +1 -0
- package/dist/services/LogService.js +49 -0
- package/dist/services/Service.d.ts +10 -0
- package/dist/services/Service.d.ts.map +1 -0
- package/dist/services/Service.js +8 -0
- package/dist/services/TaskService.d.ts +64 -0
- package/dist/services/TaskService.d.ts.map +1 -0
- package/dist/services/TaskService.js +188 -0
- package/dist/services/ThemeService.d.ts +28 -0
- package/dist/services/ThemeService.d.ts.map +1 -0
- package/dist/services/ThemeService.js +77 -0
- package/dist/services/ValidationService.d.ts +55 -0
- package/dist/services/ValidationService.d.ts.map +1 -0
- package/dist/services/ValidationService.js +81 -0
- package/dist/services/WebSocketService.d.ts +59 -0
- package/dist/services/WebSocketService.d.ts.map +1 -0
- package/dist/services/WebSocketService.js +148 -0
- package/dist/services/logger/BaseLogger.d.ts +35 -0
- package/dist/services/logger/BaseLogger.d.ts.map +1 -0
- package/dist/services/logger/BaseLogger.js +66 -0
- package/dist/services/logger/ConsoleLogger.d.ts +21 -0
- package/dist/services/logger/ConsoleLogger.d.ts.map +1 -0
- package/dist/services/logger/ConsoleLogger.js +60 -0
- package/dist/services/logger/NullLogger.d.ts +10 -0
- package/dist/services/logger/NullLogger.d.ts.map +1 -0
- package/dist/services/logger/NullLogger.js +10 -0
- package/dist/stores/plugins/serviceContainer.d.ts +10 -0
- package/dist/stores/plugins/serviceContainer.d.ts.map +1 -0
- package/dist/stores/plugins/serviceContainer.js +14 -0
- package/dist/stores/sessionStore.d.ts +71 -0
- package/dist/stores/sessionStore.d.ts.map +1 -0
- package/dist/stores/sessionStore.js +125 -0
- package/dist/types/app.types.d.ts +202 -0
- package/dist/types/app.types.d.ts.map +1 -0
- package/dist/types/app.types.js +6 -0
- package/dist/types/config.types.d.ts +2 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +1 -0
- package/dist/types/global.d.ts +33 -0
- package/dist/types/i18n.types.d.ts +21 -0
- package/dist/types/i18n.types.d.ts.map +1 -0
- package/dist/types/i18n.types.js +6 -0
- package/dist/types/laravel.types.d.ts +167 -0
- package/dist/types/laravel.types.d.ts.map +1 -0
- package/dist/types/laravel.types.js +6 -0
- package/dist/types/logging.types.d.ts +81 -0
- package/dist/types/logging.types.d.ts.map +1 -0
- package/dist/types/logging.types.js +22 -0
- package/dist/types/pinia.d.ts +24 -0
- package/dist/types/scripts.types.d.ts +31 -0
- package/dist/types/scripts.types.d.ts.map +1 -0
- package/dist/types/scripts.types.js +6 -0
- package/dist/types/ssr.d.ts +11 -0
- package/dist/types/task.types.d.ts +121 -0
- package/dist/types/task.types.d.ts.map +1 -0
- package/dist/types/task.types.js +7 -0
- package/dist/types/theme.types.d.ts +13 -0
- package/dist/types/theme.types.d.ts.map +1 -0
- package/dist/types/theme.types.js +17 -0
- package/dist/types/user.types.d.ts +24 -0
- package/dist/types/user.types.d.ts.map +1 -0
- package/dist/types/user.types.js +1 -0
- package/dist/types/vue-shim.d.ts +11 -0
- package/dist/types/websocket.types.d.ts +62 -0
- package/dist/types/websocket.types.d.ts.map +1 -0
- package/dist/types/websocket.types.js +6 -0
- package/dist/utils/apiInterceptors.d.ts +76 -0
- package/dist/utils/apiInterceptors.d.ts.map +1 -0
- package/dist/utils/apiInterceptors.js +149 -0
- package/dist/utils/assets.d.ts +40 -0
- package/dist/utils/assets.d.ts.map +1 -0
- package/dist/utils/assets.js +340 -0
- package/dist/utils/axios.d.ts +19 -0
- package/dist/utils/axios.d.ts.map +1 -0
- package/dist/utils/axios.js +113 -0
- package/dist/utils/config.d.ts +16 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +48 -0
- package/dist/utils/container.d.ts +12 -0
- package/dist/utils/container.d.ts.map +1 -0
- package/dist/utils/container.js +11 -0
- package/dist/utils/deepMerge.d.ts +28 -0
- package/dist/utils/deepMerge.d.ts.map +1 -0
- package/dist/utils/deepMerge.js +59 -0
- package/dist/utils/envConfig.d.ts +73 -0
- package/dist/utils/envConfig.d.ts.map +1 -0
- package/dist/utils/envConfig.js +161 -0
- package/dist/utils/error.d.ts +44 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +67 -0
- package/dist/utils/headers.d.ts +36 -0
- package/dist/utils/headers.d.ts.map +1 -0
- package/dist/utils/headers.js +54 -0
- package/dist/utils/i18n.d.ts +26 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +56 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/loading.d.ts +29 -0
- package/dist/utils/loading.d.ts.map +1 -0
- package/dist/utils/loading.js +46 -0
- package/dist/utils/logging.d.ts +20 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +54 -0
- package/dist/utils/notify.d.ts +15 -0
- package/dist/utils/notify.d.ts.map +1 -0
- package/dist/utils/notify.js +30 -0
- package/dist/utils/object.d.ts +28 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +48 -0
- package/dist/utils/pagination.d.ts +60 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +252 -0
- package/dist/utils/paths.d.ts +54 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +48 -0
- package/dist/utils/platform.d.ts +25 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +64 -0
- package/dist/utils/scripts.d.ts +20 -0
- package/dist/utils/scripts.d.ts.map +1 -0
- package/dist/utils/scripts.js +39 -0
- package/global.d.ts +29 -0
- package/package.json +119 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log levels (RFC 5424 severity levels)
|
|
3
|
+
*/
|
|
4
|
+
export var LogLevel;
|
|
5
|
+
(function (LogLevel) {
|
|
6
|
+
LogLevel["EMERGENCY"] = "emergency";
|
|
7
|
+
LogLevel["ALERT"] = "alert";
|
|
8
|
+
LogLevel["CRITICAL"] = "critical";
|
|
9
|
+
LogLevel["ERROR"] = "error";
|
|
10
|
+
LogLevel["WARNING"] = "warning";
|
|
11
|
+
LogLevel["NOTICE"] = "notice";
|
|
12
|
+
LogLevel["INFO"] = "info";
|
|
13
|
+
LogLevel["DEBUG"] = "debug";
|
|
14
|
+
})(LogLevel || (LogLevel = {}));
|
|
15
|
+
/**
|
|
16
|
+
* Logger implementation types
|
|
17
|
+
*/
|
|
18
|
+
export var LoggerType;
|
|
19
|
+
(function (LoggerType) {
|
|
20
|
+
LoggerType["CONSOLE"] = "console";
|
|
21
|
+
LoggerType["NULL"] = "null";
|
|
22
|
+
})(LoggerType || (LoggerType = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pinia Type Extensions
|
|
3
|
+
*
|
|
4
|
+
* Extends Pinia store types to include custom properties added by plugins.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import 'pinia';
|
|
8
|
+
import type { ServiceContainer } from '../container/ServiceContainer';
|
|
9
|
+
|
|
10
|
+
declare module 'pinia' {
|
|
11
|
+
/**
|
|
12
|
+
* Extend PiniaCustomProperties to add $quvel to all stores
|
|
13
|
+
*/
|
|
14
|
+
export interface PiniaCustomProperties {
|
|
15
|
+
/**
|
|
16
|
+
* Quvel Service Container instance
|
|
17
|
+
*
|
|
18
|
+
* Injected by serviceContainerPlugin, provides access to all registered services.
|
|
19
|
+
*/
|
|
20
|
+
$quvel: ServiceContainer;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script Loading Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for dynamic script loading
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Interface for script loading options
|
|
8
|
+
*/
|
|
9
|
+
export interface ScriptOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Auto-load the script on component mount
|
|
12
|
+
*/
|
|
13
|
+
autoLoad?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Auto-unload the script on component unmount
|
|
16
|
+
*/
|
|
17
|
+
autoUnload?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback function to execute after script is loaded
|
|
20
|
+
*/
|
|
21
|
+
onLoad?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function to execute after script is unloaded
|
|
24
|
+
*/
|
|
25
|
+
onUnload?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback function to execute if script loading fails
|
|
28
|
+
*/
|
|
29
|
+
onError?: (error: Error) => void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=scripts.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts.types.d.ts","sourceRoot":"","sources":["../../src/types/scripts.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Service Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the TaskService - manages async operations with
|
|
5
|
+
* built-in error handling, notifications, and loading indicators.
|
|
6
|
+
*/
|
|
7
|
+
import type { AxiosError } from 'axios';
|
|
8
|
+
import type { ErrorBag, LaravelErrorResponse } from './laravel.types.js';
|
|
9
|
+
import type { ErrorHandler, ErrorHandlerContext } from '../utils/error.js';
|
|
10
|
+
import type { Resolvable } from '../utils/object.js';
|
|
11
|
+
/**
|
|
12
|
+
* Represents the state of a task
|
|
13
|
+
*/
|
|
14
|
+
export type TaskState = 'fresh' | 'active' | 'success' | 'error';
|
|
15
|
+
/**
|
|
16
|
+
* Context for success handlers
|
|
17
|
+
* @template Result The result type of the task
|
|
18
|
+
*/
|
|
19
|
+
export interface SuccessHandlerContext<Result = unknown> {
|
|
20
|
+
result: Result;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Base interface for handlers, supporting conditional execution via `matcher`
|
|
24
|
+
* @template Payload The payload type of the task
|
|
25
|
+
*/
|
|
26
|
+
export interface Handler<Payload = unknown> {
|
|
27
|
+
key?: string;
|
|
28
|
+
matcher?: (payload: Payload) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Defines a success handler that processes successful task execution
|
|
32
|
+
* @template Result The result type of the task
|
|
33
|
+
* @template Payload The payload type of the task
|
|
34
|
+
*/
|
|
35
|
+
export interface SuccessHandler<Result = unknown, Payload = unknown> extends Handler<Payload> {
|
|
36
|
+
callback: (payload: Payload, context: SuccessHandlerContext<Result>) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Allows defining a success callback or a list of success handlers
|
|
40
|
+
* @template Result The result type of the task
|
|
41
|
+
* @template Payload The payload type of the task
|
|
42
|
+
*/
|
|
43
|
+
export type SuccessCallbackOrValue<Result = unknown, Payload = unknown> = Array<SuccessHandler<Result, Payload>> | ((result: Result) => unknown);
|
|
44
|
+
/**
|
|
45
|
+
* Allows defining an error callback or a list of error handlers
|
|
46
|
+
* @template Err The error type of the task
|
|
47
|
+
*/
|
|
48
|
+
export type ErrorCallbackOrValue<Err = unknown> = Array<ErrorHandler<Err>> | ((error: Err, context: ErrorHandlerContext<Err>) => unknown);
|
|
49
|
+
/**
|
|
50
|
+
* Callback for Laravel error handler
|
|
51
|
+
*/
|
|
52
|
+
export type ErrorHandlerCallback = (err: AxiosError, context: ErrorHandlerContext<LaravelErrorResponse>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Defines the options available when creating a new task
|
|
55
|
+
*
|
|
56
|
+
* @template Result The result type of the task
|
|
57
|
+
* @template Payload The payload type of the task
|
|
58
|
+
*/
|
|
59
|
+
export interface TaskOptions<Result = unknown, Payload = unknown> {
|
|
60
|
+
/**
|
|
61
|
+
* The primary function executed when the task runs
|
|
62
|
+
*
|
|
63
|
+
* @returns The result of the task function
|
|
64
|
+
*/
|
|
65
|
+
task: ((payload?: Payload) => Result) | ((payload?: Payload) => Promise<Result>);
|
|
66
|
+
/**
|
|
67
|
+
* Optional payload resolver for the task function.
|
|
68
|
+
* Can be a direct value, a sync or async function.
|
|
69
|
+
*/
|
|
70
|
+
taskPayload?: Payload | (() => Payload) | (() => Promise<Payload>);
|
|
71
|
+
/**
|
|
72
|
+
* Function executed at the end of the task, regardless of success or failure
|
|
73
|
+
*/
|
|
74
|
+
always?: () => void | Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Defines whether to show toast notifications
|
|
77
|
+
*
|
|
78
|
+
* Does nothing on SSR.
|
|
79
|
+
*
|
|
80
|
+
* If true, gets a message from a task result or the default message.
|
|
81
|
+
* If a string, uses the string as the message.
|
|
82
|
+
* If false, does nothing.
|
|
83
|
+
*/
|
|
84
|
+
showNotification?: {
|
|
85
|
+
success?: Resolvable<boolean | string>;
|
|
86
|
+
error?: Resolvable<boolean | string>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Defines whether to show a loading indicator
|
|
90
|
+
*
|
|
91
|
+
* Does nothing on SSR.
|
|
92
|
+
*/
|
|
93
|
+
showLoading?: Resolvable<boolean>;
|
|
94
|
+
/**
|
|
95
|
+
* Configuration options for loading indicator
|
|
96
|
+
*
|
|
97
|
+
* Does nothing on SSR.
|
|
98
|
+
*/
|
|
99
|
+
loadingOptions?: object;
|
|
100
|
+
/**
|
|
101
|
+
* Controls whether the task should execute
|
|
102
|
+
*/
|
|
103
|
+
shouldRun?: Resolvable<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* Handlers executed on successful task execution
|
|
106
|
+
*/
|
|
107
|
+
successHandlers?: SuccessCallbackOrValue<Result>;
|
|
108
|
+
/**
|
|
109
|
+
* Handlers executed when an error occurs
|
|
110
|
+
*/
|
|
111
|
+
errorHandlers?: ErrorCallbackOrValue;
|
|
112
|
+
/**
|
|
113
|
+
* Whether to handle Laravel errors automatically
|
|
114
|
+
*/
|
|
115
|
+
handleLaravelError?: boolean | {
|
|
116
|
+
translate?: boolean;
|
|
117
|
+
userCallBack?: ErrorHandlerCallback;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export type { ErrorBag, ErrorHandler, ErrorHandlerContext, Resolvable };
|
|
121
|
+
//# sourceMappingURL=task.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.types.d.ts","sourceRoot":"","sources":["../../src/types/task.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Types and Constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const THEME_COOKIE_NAME: string;
|
|
5
|
+
/**
|
|
6
|
+
* Define the theme options
|
|
7
|
+
*/
|
|
8
|
+
export declare const themeOptions: readonly ["light", "dark"];
|
|
9
|
+
/**
|
|
10
|
+
* Type definition for the theme options
|
|
11
|
+
*/
|
|
12
|
+
export type ThemeOptions = (typeof themeOptions)[number];
|
|
13
|
+
//# sourceMappingURL=theme.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../src/types/theme.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,eAAO,MAAM,iBAAiB,QAAuB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,YAAY,4BAA6B,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Types and Constants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Get the theme cookie name from env or use default
|
|
6
|
+
*/
|
|
7
|
+
function getThemeCookieName() {
|
|
8
|
+
const env = (typeof import.meta !== 'undefined' && import.meta.env)
|
|
9
|
+
? import.meta.env
|
|
10
|
+
: (typeof process !== 'undefined' ? process.env : {});
|
|
11
|
+
return env.VITE_THEME_COOKIE || 'user-theme';
|
|
12
|
+
}
|
|
13
|
+
export const THEME_COOKIE_NAME = getThemeCookieName();
|
|
14
|
+
/**
|
|
15
|
+
* Define the theme options
|
|
16
|
+
*/
|
|
17
|
+
export const themeOptions = ['light', 'dark'];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base User Interface
|
|
3
|
+
*
|
|
4
|
+
* Core user properties that all user implementations should have.
|
|
5
|
+
* Applications can extend this interface for custom user models.
|
|
6
|
+
*/
|
|
7
|
+
export interface IUser {
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
email_verified_at: string | null;
|
|
12
|
+
two_factor_enabled?: boolean;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
avatarUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* User Factory Function Type
|
|
19
|
+
*
|
|
20
|
+
* Factory function that creates user instances from API data.
|
|
21
|
+
* Users can provide their own factory to create custom user models.
|
|
22
|
+
*/
|
|
23
|
+
export type UserFactory<T extends IUser = IUser> = (data: IUser) => T;
|
|
24
|
+
//# sourceMappingURL=user.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.types.d.ts","sourceRoot":"","sources":["../../src/types/user.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,GAAC,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Laravel Echo WebSocket connections
|
|
5
|
+
*/
|
|
6
|
+
import Echo from 'laravel-echo';
|
|
7
|
+
/**
|
|
8
|
+
* Handlers for presence channel events
|
|
9
|
+
*/
|
|
10
|
+
export interface PresenceHandlers {
|
|
11
|
+
/**
|
|
12
|
+
* Callback when the channel is first connected
|
|
13
|
+
*/
|
|
14
|
+
onListening?: {
|
|
15
|
+
event: string;
|
|
16
|
+
callback: () => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Callback when the channel is first connected with current members
|
|
20
|
+
*/
|
|
21
|
+
onHere?: (members: Record<string, unknown>) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when a new member joins the channel
|
|
24
|
+
*/
|
|
25
|
+
onJoining?: (member: Record<string, unknown>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback when a member leaves the channel
|
|
28
|
+
*/
|
|
29
|
+
onLeaving?: (member: Record<string, unknown>) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* WebSocket channel types
|
|
33
|
+
*/
|
|
34
|
+
export type WebSocketChannelType = 'public' | 'private' | 'presence' | 'encrypted' | 'privateNotification' | 'publicNotification';
|
|
35
|
+
/**
|
|
36
|
+
* Options for subscribing to a channel
|
|
37
|
+
*/
|
|
38
|
+
export interface SubscribeOptions<T = unknown> {
|
|
39
|
+
channelName: string;
|
|
40
|
+
type: WebSocketChannelType;
|
|
41
|
+
event?: string;
|
|
42
|
+
callback: (data: T) => unknown;
|
|
43
|
+
presenceHandlers?: PresenceHandlers;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Channel type aliases from Laravel Echo
|
|
47
|
+
*/
|
|
48
|
+
export type PublicChannelType = ReturnType<Echo<'pusher'>['channel']>;
|
|
49
|
+
export type PrivateChannelType = ReturnType<Echo<'pusher'>['private']>;
|
|
50
|
+
export type PresenceChannelType = ReturnType<Echo<'pusher'>['join']>;
|
|
51
|
+
export type EncryptedChannelType = ReturnType<Echo<'pusher'>['encryptedPrivate']>;
|
|
52
|
+
/**
|
|
53
|
+
* Union of all channel types
|
|
54
|
+
*/
|
|
55
|
+
export type AnyChannel = PublicChannelType | PrivateChannelType | PresenceChannelType | EncryptedChannelType;
|
|
56
|
+
/**
|
|
57
|
+
* Unsubscribe function
|
|
58
|
+
*/
|
|
59
|
+
export type UnsubscribeFn = {
|
|
60
|
+
unsubscribe: () => void;
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=websocket.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.types.d.ts","sourceRoot":"","sources":["../../src/types/websocket.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,IAAI,CAAC;KACtB,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAEpD;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAEtD;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,SAAS,GACT,UAAU,GACV,WAAW,GACX,qBAAqB,GACrB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACrE,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Interceptors
|
|
3
|
+
*
|
|
4
|
+
* Optional debugging interceptors for Axios instance.
|
|
5
|
+
* Import and use these in your application to add logging for API requests/responses.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createDebugInterceptors } from '@quvel/core';
|
|
10
|
+
*
|
|
11
|
+
* // In your boot file or app initialization:
|
|
12
|
+
* const interceptors = createDebugInterceptors(container.log, container.config);
|
|
13
|
+
* container.api.instance.interceptors.request.use(
|
|
14
|
+
* interceptors.request.onFulfilled,
|
|
15
|
+
* interceptors.request.onRejected
|
|
16
|
+
* );
|
|
17
|
+
* container.api.instance.interceptors.response.use(
|
|
18
|
+
* interceptors.response.onFulfilled,
|
|
19
|
+
* interceptors.response.onRejected
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example With hooks
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const interceptors = createDebugInterceptors(container.log, container.config, {
|
|
26
|
+
* onRequest: (config) => {
|
|
27
|
+
* console.log('Custom request logic', config.url);
|
|
28
|
+
* },
|
|
29
|
+
* onResponse: (response) => {
|
|
30
|
+
* console.log('Custom response logic', response.status);
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
import type { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
|
36
|
+
import type { LogService } from '../services/LogService.js';
|
|
37
|
+
import type { AppConfig } from '../types/app.types.js';
|
|
38
|
+
/**
|
|
39
|
+
* Options for creating debug interceptors
|
|
40
|
+
*/
|
|
41
|
+
export interface DebugInterceptorOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Optional hook called after request is processed but before it's sent
|
|
44
|
+
* Use this to add custom request logic or logging
|
|
45
|
+
*/
|
|
46
|
+
onRequest?: (config: InternalAxiosRequestConfig) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Optional hook called after response is received
|
|
49
|
+
* Use this to add custom response logic or logging
|
|
50
|
+
*/
|
|
51
|
+
onResponse?: (response: AxiosResponse) => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create debugging interceptors for Axios
|
|
55
|
+
*
|
|
56
|
+
* These interceptors will:
|
|
57
|
+
* - Add trace ID, tenant ID, and platform headers to requests
|
|
58
|
+
* - Log request/response details via LogService
|
|
59
|
+
* - Track request timing
|
|
60
|
+
*
|
|
61
|
+
* @param log - LogService instance for logging
|
|
62
|
+
* @param config - AppConfig for header configuration
|
|
63
|
+
* @param options - Optional hooks for custom logic
|
|
64
|
+
* @returns Object with request and response interceptor handlers
|
|
65
|
+
*/
|
|
66
|
+
export declare function createDebugInterceptors(log: LogService, config: Readonly<AppConfig>, options?: DebugInterceptorOptions): {
|
|
67
|
+
request: {
|
|
68
|
+
onFulfilled: (requestConfig: InternalAxiosRequestConfig) => InternalAxiosRequestConfig<any>;
|
|
69
|
+
onRejected: (error: Error) => Promise<never>;
|
|
70
|
+
};
|
|
71
|
+
response: {
|
|
72
|
+
onFulfilled: (response: AxiosResponse) => AxiosResponse<any, any, {}>;
|
|
73
|
+
onRejected: (error: unknown) => Promise<never>;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=apiInterceptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiInterceptors.d.ts","sourceRoot":"","sources":["../../src/utils/apiInterceptors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAEzD;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;CAChD;AAoCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,EAC3B,OAAO,CAAC,EAAE,uBAAuB;;qCAIA,0BAA0B;4BAkCnC,KAAK;;;gCAMD,aAAa;4BAiBjB,OAAO;;EAsBhC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Interceptors
|
|
3
|
+
*
|
|
4
|
+
* Optional debugging interceptors for Axios instance.
|
|
5
|
+
* Import and use these in your application to add logging for API requests/responses.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createDebugInterceptors } from '@quvel/core';
|
|
10
|
+
*
|
|
11
|
+
* // In your boot file or app initialization:
|
|
12
|
+
* const interceptors = createDebugInterceptors(container.log, container.config);
|
|
13
|
+
* container.api.instance.interceptors.request.use(
|
|
14
|
+
* interceptors.request.onFulfilled,
|
|
15
|
+
* interceptors.request.onRejected
|
|
16
|
+
* );
|
|
17
|
+
* container.api.instance.interceptors.response.use(
|
|
18
|
+
* interceptors.response.onFulfilled,
|
|
19
|
+
* interceptors.response.onRejected
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example With hooks
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const interceptors = createDebugInterceptors(container.log, container.config, {
|
|
26
|
+
* onRequest: (config) => {
|
|
27
|
+
* console.log('Custom request logic', config.url);
|
|
28
|
+
* },
|
|
29
|
+
* onResponse: (response) => {
|
|
30
|
+
* console.log('Custom response logic', response.status);
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
import { getTraceIdHeader, getTenantIdHeader, getAcceptLanguageHeader, getPlatformHeader } from './headers.js';
|
|
36
|
+
import { detectPlatformTags } from './platform.js';
|
|
37
|
+
/**
|
|
38
|
+
* Sanitize headers to avoid logging sensitive data
|
|
39
|
+
*/
|
|
40
|
+
function sanitizeHeaders(headers, config) {
|
|
41
|
+
const allowedHeaders = [
|
|
42
|
+
getTraceIdHeader(config),
|
|
43
|
+
getTenantIdHeader(config),
|
|
44
|
+
getAcceptLanguageHeader(config),
|
|
45
|
+
getPlatformHeader(config),
|
|
46
|
+
];
|
|
47
|
+
const sanitized = {};
|
|
48
|
+
for (const header of allowedHeaders) {
|
|
49
|
+
if (headers[header]) {
|
|
50
|
+
sanitized[header] = headers[header];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Sanitize sensitive headers
|
|
54
|
+
if (headers['Cookie']) {
|
|
55
|
+
sanitized['Cookie'] = '[REDACTED]';
|
|
56
|
+
}
|
|
57
|
+
return sanitized;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Calculate response time from request metadata
|
|
61
|
+
*/
|
|
62
|
+
function getResponseTime(response) {
|
|
63
|
+
const startTime = response.config.metadata?.startTime;
|
|
64
|
+
return startTime ? Date.now() - startTime : undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create debugging interceptors for Axios
|
|
68
|
+
*
|
|
69
|
+
* These interceptors will:
|
|
70
|
+
* - Add trace ID, tenant ID, and platform headers to requests
|
|
71
|
+
* - Log request/response details via LogService
|
|
72
|
+
* - Track request timing
|
|
73
|
+
*
|
|
74
|
+
* @param log - LogService instance for logging
|
|
75
|
+
* @param config - AppConfig for header configuration
|
|
76
|
+
* @param options - Optional hooks for custom logic
|
|
77
|
+
* @returns Object with request and response interceptor handlers
|
|
78
|
+
*/
|
|
79
|
+
export function createDebugInterceptors(log, config, options) {
|
|
80
|
+
return {
|
|
81
|
+
request: {
|
|
82
|
+
onFulfilled: (requestConfig) => {
|
|
83
|
+
const method = requestConfig.method?.toUpperCase() || 'UNKNOWN';
|
|
84
|
+
const url = requestConfig.url || 'unknown-url';
|
|
85
|
+
const traceInfo = log.getLogger().getTraceInfo();
|
|
86
|
+
const traceIdHeader = getTraceIdHeader(config);
|
|
87
|
+
const tenantIdHeader = getTenantIdHeader(config);
|
|
88
|
+
const platformHeader = getPlatformHeader(config);
|
|
89
|
+
requestConfig.headers.set(traceIdHeader, traceInfo.id);
|
|
90
|
+
if (traceInfo.tenant) {
|
|
91
|
+
requestConfig.headers.set(tenantIdHeader, traceInfo.tenant);
|
|
92
|
+
}
|
|
93
|
+
const platformTags = detectPlatformTags();
|
|
94
|
+
if (platformTags) {
|
|
95
|
+
requestConfig.headers.set(platformHeader, platformTags);
|
|
96
|
+
}
|
|
97
|
+
log.debug(`API Request: ${method} ${url}`, {
|
|
98
|
+
method,
|
|
99
|
+
url,
|
|
100
|
+
baseURL: requestConfig.baseURL,
|
|
101
|
+
headers: sanitizeHeaders(requestConfig.headers, config),
|
|
102
|
+
});
|
|
103
|
+
// Add timing metadata
|
|
104
|
+
requestConfig.metadata = { startTime: Date.now() };
|
|
105
|
+
// Call custom hook if provided
|
|
106
|
+
options?.onRequest?.(requestConfig);
|
|
107
|
+
return requestConfig;
|
|
108
|
+
},
|
|
109
|
+
onRejected: (error) => {
|
|
110
|
+
log.error('API Request Error', { error: error.message });
|
|
111
|
+
return Promise.reject(error);
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
response: {
|
|
115
|
+
onFulfilled: (response) => {
|
|
116
|
+
const method = response.config.method?.toUpperCase() || 'UNKNOWN';
|
|
117
|
+
const url = response.config.url || 'unknown-url';
|
|
118
|
+
log.debug(`API Response: ${method} ${url} ${response.status}`, {
|
|
119
|
+
method,
|
|
120
|
+
url,
|
|
121
|
+
status: response.status,
|
|
122
|
+
statusText: response.statusText,
|
|
123
|
+
responseTimeMs: getResponseTime(response),
|
|
124
|
+
});
|
|
125
|
+
// Call custom hook if provided
|
|
126
|
+
options?.onResponse?.(response);
|
|
127
|
+
return response;
|
|
128
|
+
},
|
|
129
|
+
onRejected: (error) => {
|
|
130
|
+
const config = error.config || {};
|
|
131
|
+
const method = config.method?.toString().toUpperCase() || 'UNKNOWN';
|
|
132
|
+
const url = config.url?.toString() || 'unknown-url';
|
|
133
|
+
const response = error.response;
|
|
134
|
+
const status = response?.status || 0;
|
|
135
|
+
log.error(`API Error: ${method} ${url} ${status}`, {
|
|
136
|
+
method,
|
|
137
|
+
url,
|
|
138
|
+
status,
|
|
139
|
+
statusText: response?.statusText,
|
|
140
|
+
responseTimeMs: config.metadata
|
|
141
|
+
? Date.now() - config.metadata.startTime
|
|
142
|
+
: undefined,
|
|
143
|
+
message: error.message,
|
|
144
|
+
});
|
|
145
|
+
return Promise.reject(error);
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asset Loading Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for dynamically loading CSS and JS assets
|
|
5
|
+
* Support both client-side and SSR asset injection
|
|
6
|
+
*/
|
|
7
|
+
import type { CSSAssetConfig, JSAssetConfig, AppAssets } from '../types/app.types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Validates if a URL is safe to load as an asset
|
|
10
|
+
* Prevents loading from potentially malicious sources
|
|
11
|
+
*/
|
|
12
|
+
export declare function isValidAssetUrl(url: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Sanitizes inline content to prevent XSS attacks
|
|
15
|
+
* Basic implementation - consider using DOMPurify for more robust protection
|
|
16
|
+
*/
|
|
17
|
+
export declare function sanitizeInlineContent(content: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a CSS link or style element from configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare function createCSSElement(config: CSSAssetConfig): HTMLLinkElement | HTMLStyleElement | null;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a JavaScript script element from configuration
|
|
24
|
+
*/
|
|
25
|
+
export declare function createJSElement(config: JSAssetConfig): HTMLScriptElement | null;
|
|
26
|
+
/**
|
|
27
|
+
* Injects app assets into the document
|
|
28
|
+
* Used by client-side asset loading (non-SSR modes)
|
|
29
|
+
*/
|
|
30
|
+
export declare function injectAssets(assets: AppAssets): void;
|
|
31
|
+
/**
|
|
32
|
+
* Generates HTML strings for server-side asset injection
|
|
33
|
+
* Used by SSR asset injection
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateAssetHTML(assets: AppAssets): {
|
|
36
|
+
headHTML: string;
|
|
37
|
+
bodyStartHTML: string;
|
|
38
|
+
bodyEndHTML: string;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/utils/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEtF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAuBpD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,GACrB,eAAe,GAAG,gBAAgB,GAAG,IAAI,CAkD3C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB,GAAG,IAAI,CAgD/E;AA2BD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiEpD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CA0GA"}
|