@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 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAyB,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,GAC3B,eAAe,CAmBjB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CASvD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAQtC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,eAAe,GAAE,QAAwB,GAAG,OAAO,CAE7F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ConsoleLogger } from '../services/logger/ConsoleLogger.js';
|
|
2
|
+
import { NullLogger } from '../services/logger/NullLogger.js';
|
|
3
|
+
import { LogLevel as LogLevelEnum, LoggerType as LoggerTypeEnum } from '../types/logging.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create a logger instance based on configuration
|
|
6
|
+
*/
|
|
7
|
+
export function createLogger(config) {
|
|
8
|
+
const loggerType = import.meta.env.VITE_LOGGER || LoggerTypeEnum.NULL;
|
|
9
|
+
const logLevel = getLogLevel();
|
|
10
|
+
const traceInfo = config?.trace ?? {
|
|
11
|
+
id: '',
|
|
12
|
+
timestamp: new Date().toISOString(),
|
|
13
|
+
environment: import.meta.env.MODE || 'development',
|
|
14
|
+
tenant: null,
|
|
15
|
+
runtime: 'client',
|
|
16
|
+
};
|
|
17
|
+
switch (loggerType.toLowerCase()) {
|
|
18
|
+
case LoggerTypeEnum.CONSOLE:
|
|
19
|
+
return new ConsoleLogger(traceInfo, logLevel);
|
|
20
|
+
case LoggerTypeEnum.NULL:
|
|
21
|
+
default:
|
|
22
|
+
return new NullLogger(traceInfo);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Log level priority mapping (higher number = higher priority)
|
|
27
|
+
*/
|
|
28
|
+
export const LOG_LEVEL_PRIORITY = {
|
|
29
|
+
[LogLevelEnum.EMERGENCY]: 8,
|
|
30
|
+
[LogLevelEnum.ALERT]: 7,
|
|
31
|
+
[LogLevelEnum.CRITICAL]: 6,
|
|
32
|
+
[LogLevelEnum.ERROR]: 5,
|
|
33
|
+
[LogLevelEnum.WARNING]: 4,
|
|
34
|
+
[LogLevelEnum.NOTICE]: 3,
|
|
35
|
+
[LogLevelEnum.INFO]: 2,
|
|
36
|
+
[LogLevelEnum.DEBUG]: 1,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Get the current log level from environment variables
|
|
40
|
+
* Defaults to INFO if not specified or invalid
|
|
41
|
+
*/
|
|
42
|
+
export function getLogLevel() {
|
|
43
|
+
const configLevel = import.meta.env.VITE_LOG_LEVEL?.toLowerCase();
|
|
44
|
+
if (configLevel && Object.values(LogLevelEnum).includes(configLevel)) {
|
|
45
|
+
return configLevel;
|
|
46
|
+
}
|
|
47
|
+
return LogLevelEnum.INFO;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Determine if a log level should be displayed based on the configured level
|
|
51
|
+
*/
|
|
52
|
+
export function shouldLog(level, configuredLevel = getLogLevel()) {
|
|
53
|
+
return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[configuredLevel];
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Utility
|
|
3
|
+
*
|
|
4
|
+
* Wrapper for Quasars Notify plugin with standardized behavior
|
|
5
|
+
*/
|
|
6
|
+
import { QNotifyCreateOptions } from 'quasar';
|
|
7
|
+
/**
|
|
8
|
+
* Show a standardized notification
|
|
9
|
+
*
|
|
10
|
+
* @param type - Notification type
|
|
11
|
+
* @param message - Message to display
|
|
12
|
+
* @param options - Additional Quasar notify options
|
|
13
|
+
*/
|
|
14
|
+
export declare function showNotification(type: 'negative' | 'warning' | 'positive' | 'info', message: string, options?: QNotifyCreateOptions): void;
|
|
15
|
+
//# sourceMappingURL=notify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../src/utils/notify.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAU,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,EAClD,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,IAAI,CAkBN"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Utility
|
|
3
|
+
*
|
|
4
|
+
* Wrapper for Quasars Notify plugin with standardized behavior
|
|
5
|
+
*/
|
|
6
|
+
import { Notify } from 'quasar';
|
|
7
|
+
/**
|
|
8
|
+
* Show a standardized notification
|
|
9
|
+
*
|
|
10
|
+
* @param type - Notification type
|
|
11
|
+
* @param message - Message to display
|
|
12
|
+
* @param options - Additional Quasar notify options
|
|
13
|
+
*/
|
|
14
|
+
export function showNotification(type, message, options = {}) {
|
|
15
|
+
if (typeof window === 'undefined') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const iconMap = {
|
|
19
|
+
negative: 'error',
|
|
20
|
+
warning: 'warning',
|
|
21
|
+
positive: 'check_circle',
|
|
22
|
+
info: 'info',
|
|
23
|
+
};
|
|
24
|
+
Notify.create({
|
|
25
|
+
...options,
|
|
26
|
+
icon: iconMap[type] || 'info',
|
|
27
|
+
type,
|
|
28
|
+
message,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object Utility Functions
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for working with objects and resolvable values
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A value that can be a direct value or a function returning a value
|
|
8
|
+
*/
|
|
9
|
+
export type Resolvable<T = unknown> = T | (() => T) | (() => Promise<T>);
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a value that could be:
|
|
12
|
+
* - A primitive (returned directly)
|
|
13
|
+
* - A synchronous function (executed and its result returned)
|
|
14
|
+
* - An asynchronous function (awaited and its result returned)
|
|
15
|
+
*
|
|
16
|
+
* @param value - The value to resolve
|
|
17
|
+
* @returns A promise that resolves to the resolved value
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveValue<T>(value: Resolvable<T>): Promise<T | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Safely retrieve a nested value from an object using dot notation
|
|
22
|
+
*
|
|
23
|
+
* @param obj - The object to retrieve the value from
|
|
24
|
+
* @param path - The path in dot notation (e.g., "a.b.c")
|
|
25
|
+
* @returns The value at the specified path or undefined if not found
|
|
26
|
+
*/
|
|
27
|
+
export declare function getSafe<T = unknown>(obj: unknown, path: string): T | undefined;
|
|
28
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAUlF;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAc9E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object Utility Functions
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for working with objects and resolvable values
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a value that could be:
|
|
8
|
+
* - A primitive (returned directly)
|
|
9
|
+
* - A synchronous function (executed and its result returned)
|
|
10
|
+
* - An asynchronous function (awaited and its result returned)
|
|
11
|
+
*
|
|
12
|
+
* @param value - The value to resolve
|
|
13
|
+
* @returns A promise that resolves to the resolved value
|
|
14
|
+
*/
|
|
15
|
+
export async function resolveValue(value) {
|
|
16
|
+
try {
|
|
17
|
+
if (typeof value === 'function') {
|
|
18
|
+
const result = value();
|
|
19
|
+
return result instanceof Promise ? await result : result;
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Safely retrieve a nested value from an object using dot notation
|
|
29
|
+
*
|
|
30
|
+
* @param obj - The object to retrieve the value from
|
|
31
|
+
* @param path - The path in dot notation (e.g., "a.b.c")
|
|
32
|
+
* @returns The value at the specified path or undefined if not found
|
|
33
|
+
*/
|
|
34
|
+
export function getSafe(obj, path) {
|
|
35
|
+
try {
|
|
36
|
+
if (path === '')
|
|
37
|
+
return obj;
|
|
38
|
+
return path.split('.').reduce((acc, key) => {
|
|
39
|
+
if (acc !== null && typeof acc === 'object' && key in acc) {
|
|
40
|
+
return acc[key];
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}, obj);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { CursorPaginatorResponse, CursorState, LengthAwarePaginatorResponse, LengthAwareState, PaginatedModuleState, PaginationActions, PaginationGetters, PaginationOptions, SimplePaginatorResponse, SimpleState, CursorMeta, LengthAwareMeta, SimpleMeta } from '../types/laravel.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if an object is a cursor paginator
|
|
4
|
+
*/
|
|
5
|
+
export declare function isCursorPagination(meta: unknown): meta is CursorMeta;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if an object is a length-aware paginator
|
|
8
|
+
*/
|
|
9
|
+
export declare function isLengthAwarePagination(meta: unknown): meta is LengthAwareMeta;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if an object is a simple paginator
|
|
12
|
+
*/
|
|
13
|
+
export declare function isSimplePagination(meta: unknown): meta is SimpleMeta;
|
|
14
|
+
/**
|
|
15
|
+
* Creates pagination getters for Pinia stores
|
|
16
|
+
*/
|
|
17
|
+
export declare function createPaginationGetters<Key extends string, Model, State extends PaginatedModuleState<Model>>(key: Key): PaginationGetters<Key, Model, State>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates generic pagination actions for Pinia stores
|
|
20
|
+
*/
|
|
21
|
+
export declare function createPaginationActions<Key extends string, Response, State extends PaginatedModuleState<unknown>>(options: PaginationOptions<Key, Response, State> & {
|
|
22
|
+
transform: (state: State, response: Response) => void;
|
|
23
|
+
}): PaginationActions<Key, State>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates initial state for length-aware pagination
|
|
26
|
+
*/
|
|
27
|
+
export declare function createLengthAwareState<T>(): LengthAwareState<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Creates pagination actions for length-aware paginator
|
|
30
|
+
*/
|
|
31
|
+
export declare function createLengthAwareActions<Key extends string, Model = unknown>(options: PaginationOptions<Key, LengthAwarePaginatorResponse<Model>, LengthAwareState<Model>>): PaginationActions<Key, LengthAwareState<Model>>;
|
|
32
|
+
/**
|
|
33
|
+
* Creates pagination getters for length-aware paginator
|
|
34
|
+
*/
|
|
35
|
+
export declare function createLengthAwareGetters<Key extends string, Model>(key: Key): PaginationGetters<Key, Model, LengthAwareState<Model>>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates initial state for simple pagination
|
|
38
|
+
*/
|
|
39
|
+
export declare function createSimpleState<T>(): SimpleState<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates pagination actions for a simple paginator
|
|
42
|
+
*/
|
|
43
|
+
export declare function createSimpleActions<Key extends string, Model = unknown>(options: PaginationOptions<Key, SimplePaginatorResponse<Model>, SimpleState<Model>>): PaginationActions<Key, SimpleState<Model>>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates pagination getters for simple paginator
|
|
46
|
+
*/
|
|
47
|
+
export declare function createSimpleGetters<Key extends string, Model>(key: Key): PaginationGetters<Key, Model, SimpleState<Model>>;
|
|
48
|
+
/**
|
|
49
|
+
* Creates initial state for cursor pagination
|
|
50
|
+
*/
|
|
51
|
+
export declare function createCursorState<T>(): CursorState<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates pagination actions for cursor paginator
|
|
54
|
+
*/
|
|
55
|
+
export declare function createCursorActions<Key extends string, Model = unknown>(options: PaginationOptions<Key, CursorPaginatorResponse<Model>, CursorState<Model>>): PaginationActions<Key, CursorState<Model>>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates pagination getters for cursor paginator
|
|
58
|
+
*/
|
|
59
|
+
export declare function createCursorGetters<Key extends string, Model>(key: Key): PaginationGetters<Key, Model, CursorState<Model>>;
|
|
60
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { capitalize } from 'vue';
|
|
2
|
+
/* -----------------------------------
|
|
3
|
+
* Type Guards
|
|
4
|
+
* ----------------------------------- */
|
|
5
|
+
/**
|
|
6
|
+
* Checks if an object is a cursor paginator
|
|
7
|
+
*/
|
|
8
|
+
export function isCursorPagination(meta) {
|
|
9
|
+
return !!meta && typeof meta === 'object' && 'next_cursor' in meta && 'prev_cursor' in meta;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Checks if an object is a length-aware paginator
|
|
13
|
+
*/
|
|
14
|
+
export function isLengthAwarePagination(meta) {
|
|
15
|
+
return !!meta && typeof meta === 'object' && 'total' in meta && 'last_page' in meta;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks if an object is a simple paginator
|
|
19
|
+
*/
|
|
20
|
+
export function isSimplePagination(meta) {
|
|
21
|
+
return (!!meta &&
|
|
22
|
+
typeof meta === 'object' &&
|
|
23
|
+
'current_page' in meta &&
|
|
24
|
+
!('total' in meta) &&
|
|
25
|
+
!('next_cursor' in meta));
|
|
26
|
+
}
|
|
27
|
+
/* -----------------------------------
|
|
28
|
+
* Pagination Getters Factory
|
|
29
|
+
* ----------------------------------- */
|
|
30
|
+
/**
|
|
31
|
+
* Creates pagination getters for Pinia stores
|
|
32
|
+
*/
|
|
33
|
+
export function createPaginationGetters(key) {
|
|
34
|
+
const capitalizedKey = capitalize(key);
|
|
35
|
+
return {
|
|
36
|
+
[`get${capitalizedKey}`]: (state) => state[key].data,
|
|
37
|
+
[`has${capitalizedKey}`]: (state) => state[key].data.length > 0,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/* -----------------------------------
|
|
41
|
+
* Generic Pagination Action Factory
|
|
42
|
+
* ----------------------------------- */
|
|
43
|
+
/**
|
|
44
|
+
* Creates generic pagination actions for Pinia stores
|
|
45
|
+
*/
|
|
46
|
+
export function createPaginationActions(options) {
|
|
47
|
+
const { stateKey, fetcher, transform } = options;
|
|
48
|
+
const fetchKey = `${stateKey}Fetch`;
|
|
49
|
+
const nextKey = `${stateKey}Next`;
|
|
50
|
+
const prevKey = `${stateKey}Previous`;
|
|
51
|
+
const reloadKey = `${stateKey}Reload`;
|
|
52
|
+
return {
|
|
53
|
+
async [fetchKey](options = {}, clearPrevious = true) {
|
|
54
|
+
const state = this[stateKey];
|
|
55
|
+
if (clearPrevious)
|
|
56
|
+
state.data = [];
|
|
57
|
+
state.isLoadingMore = true;
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetcher.call(this, options);
|
|
60
|
+
if (!response) {
|
|
61
|
+
throw new Error('Failed to fetch data');
|
|
62
|
+
}
|
|
63
|
+
state.hasLoaded = true;
|
|
64
|
+
transform(state, response);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
if (clearPrevious) {
|
|
68
|
+
state.data = [];
|
|
69
|
+
if (state.meta) {
|
|
70
|
+
state.meta = {
|
|
71
|
+
current_page: 1,
|
|
72
|
+
from: null,
|
|
73
|
+
last_page: 1,
|
|
74
|
+
links: [],
|
|
75
|
+
path: '',
|
|
76
|
+
per_page: 10,
|
|
77
|
+
to: null,
|
|
78
|
+
total: 0,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
state.isLoadingMore = false;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
async [nextKey]() {
|
|
88
|
+
const state = this[stateKey];
|
|
89
|
+
if (!state.hasMore || state.isLoadingMore)
|
|
90
|
+
return;
|
|
91
|
+
await this[fetchKey]({ page: state.currentPage + 1 }, false);
|
|
92
|
+
},
|
|
93
|
+
async [prevKey]() {
|
|
94
|
+
const state = this[stateKey];
|
|
95
|
+
if (state.currentPage <= 1)
|
|
96
|
+
return;
|
|
97
|
+
await this[fetchKey]({ page: state.currentPage - 1 }, false);
|
|
98
|
+
},
|
|
99
|
+
async [reloadKey]() {
|
|
100
|
+
await this[fetchKey]({ page: 1 });
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/* -----------------------------------
|
|
105
|
+
* Length-Aware Pagination
|
|
106
|
+
* ----------------------------------- */
|
|
107
|
+
/**
|
|
108
|
+
* Creates initial state for length-aware pagination
|
|
109
|
+
*/
|
|
110
|
+
export function createLengthAwareState() {
|
|
111
|
+
return {
|
|
112
|
+
data: [],
|
|
113
|
+
currentPage: 1,
|
|
114
|
+
hasMore: true,
|
|
115
|
+
isLoadingMore: false,
|
|
116
|
+
hasLoaded: false,
|
|
117
|
+
meta: {
|
|
118
|
+
current_page: 1,
|
|
119
|
+
from: 1,
|
|
120
|
+
last_page: 1,
|
|
121
|
+
per_page: 10,
|
|
122
|
+
to: 1,
|
|
123
|
+
total: 1,
|
|
124
|
+
links: [],
|
|
125
|
+
path: '',
|
|
126
|
+
},
|
|
127
|
+
links: {
|
|
128
|
+
first: null,
|
|
129
|
+
last: null,
|
|
130
|
+
prev: null,
|
|
131
|
+
next: null,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Creates pagination actions for length-aware paginator
|
|
137
|
+
*/
|
|
138
|
+
export function createLengthAwareActions(options) {
|
|
139
|
+
return createPaginationActions({
|
|
140
|
+
...options,
|
|
141
|
+
transform: (state, res) => {
|
|
142
|
+
state.data = res.data;
|
|
143
|
+
state.meta = res.meta;
|
|
144
|
+
state.links = res.links;
|
|
145
|
+
state.currentPage = res.meta.current_page;
|
|
146
|
+
state.hasMore = res.meta.current_page < res.meta.last_page;
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Creates pagination getters for length-aware paginator
|
|
152
|
+
*/
|
|
153
|
+
export function createLengthAwareGetters(key) {
|
|
154
|
+
return createPaginationGetters(key);
|
|
155
|
+
}
|
|
156
|
+
/* -----------------------------------
|
|
157
|
+
* Simple Pagination
|
|
158
|
+
* ----------------------------------- */
|
|
159
|
+
/**
|
|
160
|
+
* Creates initial state for simple pagination
|
|
161
|
+
*/
|
|
162
|
+
export function createSimpleState() {
|
|
163
|
+
return {
|
|
164
|
+
data: [],
|
|
165
|
+
currentPage: 1,
|
|
166
|
+
hasMore: true,
|
|
167
|
+
isLoadingMore: false,
|
|
168
|
+
hasLoaded: false,
|
|
169
|
+
meta: {
|
|
170
|
+
current_page: 1,
|
|
171
|
+
from: null,
|
|
172
|
+
path: '',
|
|
173
|
+
per_page: 10,
|
|
174
|
+
to: null,
|
|
175
|
+
},
|
|
176
|
+
links: {
|
|
177
|
+
first: null,
|
|
178
|
+
last: null,
|
|
179
|
+
prev: null,
|
|
180
|
+
next: null,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Creates pagination actions for a simple paginator
|
|
186
|
+
*/
|
|
187
|
+
export function createSimpleActions(options) {
|
|
188
|
+
return createPaginationActions({
|
|
189
|
+
...options,
|
|
190
|
+
transform: (state, res) => {
|
|
191
|
+
state.data = res.data;
|
|
192
|
+
state.meta = res.meta;
|
|
193
|
+
state.links = res.links;
|
|
194
|
+
state.currentPage = res.meta.current_page;
|
|
195
|
+
state.hasMore = true;
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Creates pagination getters for simple paginator
|
|
201
|
+
*/
|
|
202
|
+
export function createSimpleGetters(key) {
|
|
203
|
+
return createPaginationGetters(key);
|
|
204
|
+
}
|
|
205
|
+
/* -----------------------------------
|
|
206
|
+
* Cursor Pagination
|
|
207
|
+
* ----------------------------------- */
|
|
208
|
+
/**
|
|
209
|
+
* Creates initial state for cursor pagination
|
|
210
|
+
*/
|
|
211
|
+
export function createCursorState() {
|
|
212
|
+
return {
|
|
213
|
+
data: [],
|
|
214
|
+
currentPage: 1,
|
|
215
|
+
hasMore: true,
|
|
216
|
+
isLoadingMore: false,
|
|
217
|
+
hasLoaded: false,
|
|
218
|
+
meta: {
|
|
219
|
+
path: '',
|
|
220
|
+
per_page: 10,
|
|
221
|
+
next_cursor: null,
|
|
222
|
+
prev_cursor: null,
|
|
223
|
+
},
|
|
224
|
+
links: {
|
|
225
|
+
first: null,
|
|
226
|
+
last: null,
|
|
227
|
+
prev: null,
|
|
228
|
+
next: null,
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Creates pagination actions for cursor paginator
|
|
234
|
+
*/
|
|
235
|
+
export function createCursorActions(options) {
|
|
236
|
+
return createPaginationActions({
|
|
237
|
+
...options,
|
|
238
|
+
transform: (state, res) => {
|
|
239
|
+
state.data = res.data;
|
|
240
|
+
state.meta = res.meta;
|
|
241
|
+
state.links = res.links;
|
|
242
|
+
state.currentPage++;
|
|
243
|
+
state.hasMore = !!res.meta.next_cursor;
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Creates pagination getters for cursor paginator
|
|
249
|
+
*/
|
|
250
|
+
export function createCursorGetters(key) {
|
|
251
|
+
return createPaginationGetters(key);
|
|
252
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path Utilities for Module Resource Resolution
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent path generation for module resources
|
|
5
|
+
* used by Quasar build system (boot files, CSS, etc.)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Options for module resource path generation
|
|
9
|
+
*/
|
|
10
|
+
export interface ModuleResourceOptions {
|
|
11
|
+
/** Base modules directory (default: 'modules') */
|
|
12
|
+
modulesDir?: string;
|
|
13
|
+
/** Prefix for the path (default: '..') - relative from src/boot/ */
|
|
14
|
+
prefix?: string;
|
|
15
|
+
/** File extension to append */
|
|
16
|
+
extension?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates the correct relative path for module resources
|
|
20
|
+
*
|
|
21
|
+
* Quasar requires specific relative paths for boot files and CSS imports.
|
|
22
|
+
* This helper ensures consistent path generation across all modules.
|
|
23
|
+
*
|
|
24
|
+
* @param moduleName - Name of the module (e.g., 'Core', 'Auth')
|
|
25
|
+
* @param resourcePath - Path within the module (e.g., 'boot/setup', 'css/styles.scss')
|
|
26
|
+
* @param options - Path generation options
|
|
27
|
+
* @returns Properly formatted relative path for Quasar
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* moduleResource('core', 'boot/container')
|
|
32
|
+
* // Returns: '../modules/core/boot/container'
|
|
33
|
+
*
|
|
34
|
+
* moduleResource('auth', 'css/auth.scss')
|
|
35
|
+
* // Returns: '../modules/auth/css/auth.scss'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function moduleResource(moduleName: string, resourcePath: string, options?: ModuleResourceOptions): string;
|
|
39
|
+
/**
|
|
40
|
+
* Generates paths for multiple resources from the same module
|
|
41
|
+
*
|
|
42
|
+
* @param moduleName - Name of the module
|
|
43
|
+
* @param resourcePaths - Array of resource paths within the module
|
|
44
|
+
* @param options - Path generation options
|
|
45
|
+
* @returns Array of properly formatted relative paths
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* moduleResources('core', ['boot/container', 'boot/app-config'])
|
|
50
|
+
* // Returns: ['../modules/core/boot/container', '../modules/core/boot/app-config']
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function moduleResources(moduleName: string, resourcePaths: string[], options?: ModuleResourceOptions): string[];
|
|
54
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAUR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,MAAM,EAAE,CAEV"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path Utilities for Module Resource Resolution
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent path generation for module resources
|
|
5
|
+
* used by Quasar build system (boot files, CSS, etc.)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Generates the correct relative path for module resources
|
|
9
|
+
*
|
|
10
|
+
* Quasar requires specific relative paths for boot files and CSS imports.
|
|
11
|
+
* This helper ensures consistent path generation across all modules.
|
|
12
|
+
*
|
|
13
|
+
* @param moduleName - Name of the module (e.g., 'Core', 'Auth')
|
|
14
|
+
* @param resourcePath - Path within the module (e.g., 'boot/setup', 'css/styles.scss')
|
|
15
|
+
* @param options - Path generation options
|
|
16
|
+
* @returns Properly formatted relative path for Quasar
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* moduleResource('core', 'boot/container')
|
|
21
|
+
* // Returns: '../modules/core/boot/container'
|
|
22
|
+
*
|
|
23
|
+
* moduleResource('auth', 'css/auth.scss')
|
|
24
|
+
* // Returns: '../modules/auth/css/auth.scss'
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function moduleResource(moduleName, resourcePath, options = {}) {
|
|
28
|
+
const { modulesDir = 'modules', prefix = '..', extension, } = options;
|
|
29
|
+
const basePath = `${prefix}/${modulesDir}/${moduleName}/${resourcePath}`;
|
|
30
|
+
return extension ? `${basePath}.${extension}` : basePath;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Generates paths for multiple resources from the same module
|
|
34
|
+
*
|
|
35
|
+
* @param moduleName - Name of the module
|
|
36
|
+
* @param resourcePaths - Array of resource paths within the module
|
|
37
|
+
* @param options - Path generation options
|
|
38
|
+
* @returns Array of properly formatted relative paths
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* moduleResources('core', ['boot/container', 'boot/app-config'])
|
|
43
|
+
* // Returns: ['../modules/core/boot/container', '../modules/core/boot/app-config']
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function moduleResources(moduleName, resourcePaths, options) {
|
|
47
|
+
return resourcePaths.map((path) => moduleResource(moduleName, path, options));
|
|
48
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Detection Utilities
|
|
3
|
+
*
|
|
4
|
+
* Detects platform tags from Quasar Platform and Screen APIs
|
|
5
|
+
* and formats them for the X-Platform header.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Detect all platform tags and return as comma-separated string
|
|
9
|
+
*
|
|
10
|
+
* @returns Comma-separated platform tags (e.g., "capacitor,ios,mobile,screen:sm")
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // iPhone in Capacitor
|
|
15
|
+
* detectPlatformTags() // "capacitor,ios,mobile,screen:sm"
|
|
16
|
+
*
|
|
17
|
+
* // iPad in Safari
|
|
18
|
+
* detectPlatformTags() // "web,ios,tablet,screen:lg"
|
|
19
|
+
*
|
|
20
|
+
* // Electron on macOS
|
|
21
|
+
* detectPlatformTags() // "electron,macos,desktop,screen:xl"
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function detectPlatformTags(): string;
|
|
25
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/utils/platform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAiC3C"}
|