@common-stack/rollup-vite-utils 6.0.6-alpha.26 → 6.0.6-alpha.28
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/lib/vite-wrappers/json-wrappers.cjs +78 -3
- package/lib/vite-wrappers/json-wrappers.cjs.map +1 -1
- package/lib/vite-wrappers/json-wrappers.d.ts +24 -0
- package/lib/vite-wrappers/json-wrappers.js +78 -3
- package/lib/vite-wrappers/json-wrappers.js.map +1 -1
- package/lib/vite-wrappers/loaderGenerator.cjs +51 -10
- package/lib/vite-wrappers/loaderGenerator.cjs.map +1 -1
- package/lib/vite-wrappers/loaderGenerator.d.ts +44 -2
- package/lib/vite-wrappers/loaderGenerator.js +51 -10
- package/lib/vite-wrappers/loaderGenerator.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
'use strict';var getRoutes_js=require('@common-stack/client-react/lib/route/get-routes.js'),fs=require('fs'),globAll=require('glob-all'),lodashEs=require('lodash-es'),node_crypto=require('node:crypto'),wrapperComponent=require('./wrapperComponent.cjs'),dialogWrapper=require('./dialog-wrapper.cjs'),iconSwitch=require('./icon-switch.cjs');/* eslint-disable array-callback-return */
|
|
2
|
+
/**
|
|
3
|
+
* Generates a hash from the source string.
|
|
4
|
+
* Used to create unique route suffixes.
|
|
5
|
+
*
|
|
6
|
+
* @param source - The source string to hash.
|
|
7
|
+
* @param maxLength - The maximum length of the hash. Default is 8.
|
|
8
|
+
* @returns A substring of the generated SHA256 hash.
|
|
9
|
+
*/
|
|
2
10
|
const getHash = (source, maxLength = 8) => {
|
|
3
11
|
const hash = node_crypto.createHash('sha256').update(source).digest('hex');
|
|
4
12
|
return typeof maxLength === 'number' ? hash.slice(0, maxLength) : hash;
|
|
5
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the directories containing files from specified packages.
|
|
16
|
+
* Searches for a specific file in the node_modules directories of the provided packages.
|
|
17
|
+
*
|
|
18
|
+
* @param packages - The list of package names to search in.
|
|
19
|
+
* @param fileName - The name of the file to search for.
|
|
20
|
+
* @param rootPath - Optional root path to start the search. Defaults to project root.
|
|
21
|
+
* @returns An array of directories where the specified file is found.
|
|
22
|
+
*/
|
|
6
23
|
function resolvePathsUsingPackages(packages, fileName, rootPath) {
|
|
7
24
|
const basePath = rootPath || wrapperComponent.getRootPath();
|
|
8
25
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
@@ -16,11 +33,26 @@ function resolvePathsUsingPackages(packages, fileName, rootPath) {
|
|
|
16
33
|
}, []);
|
|
17
34
|
return localesDirs;
|
|
18
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Custom merge function used to concatenate arrays when merging objects.
|
|
38
|
+
* Used when merging routes configurations.
|
|
39
|
+
*
|
|
40
|
+
* @param objValue - The existing value.
|
|
41
|
+
* @param srcValue - The new value to merge.
|
|
42
|
+
* @returns Concatenated array if objValue is an array, otherwise undefined.
|
|
43
|
+
*/
|
|
19
44
|
function customizer(objValue, srcValue) {
|
|
20
45
|
if (lodashEs.isArray(objValue)) {
|
|
21
46
|
return objValue.concat(srcValue);
|
|
22
47
|
}
|
|
23
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Loads the routes configuration from the specified packages and merges them.
|
|
51
|
+
* Returns the sorted and merged route configuration.
|
|
52
|
+
*
|
|
53
|
+
* @param options - The options containing package names and root path for route resolution.
|
|
54
|
+
* @returns The sorted routes configuration or null if no configuration is found.
|
|
55
|
+
*/
|
|
24
56
|
function loadRoutesConfig(options) {
|
|
25
57
|
const fileName = options.routesFileName || 'route.json';
|
|
26
58
|
const directories = resolvePathsUsingPackages(options.packages, fileName, options.rootPath);
|
|
@@ -36,15 +68,45 @@ function loadRoutesConfig(options) {
|
|
|
36
68
|
const result = content.length ? getRoutes_js.getSortedRoutes('/', Object.assign({}, ...content)) : null;
|
|
37
69
|
return result;
|
|
38
70
|
}
|
|
71
|
+
// Global variables to store dialog paths, icon names, and icon files.
|
|
39
72
|
let dialogPaths = [];
|
|
40
73
|
let iconNames = [];
|
|
41
74
|
let iconSvgPaths = [];
|
|
42
75
|
const iconFiles = [];
|
|
76
|
+
/**
|
|
77
|
+
* Adds a unique icon name to the global iconNames array.
|
|
78
|
+
*
|
|
79
|
+
* @param icon - The icon name to add.
|
|
80
|
+
* @returns Null if the icon name is already in the array, otherwise adds the name.
|
|
81
|
+
*/
|
|
43
82
|
const addIconName = (icon) => (!iconNames.includes(icon) ? iconNames.push(icon) : null);
|
|
83
|
+
/**
|
|
84
|
+
* Adds a unique SVG path to the global iconSvgPaths array.
|
|
85
|
+
*
|
|
86
|
+
* @param icon - The SVG path to add.
|
|
87
|
+
* @returns Null if the SVG path is already in the array, otherwise adds the path.
|
|
88
|
+
*/
|
|
44
89
|
const addIconSvgPath = (icon) => (!iconSvgPaths.includes(icon) ? iconSvgPaths.push(icon) : null);
|
|
90
|
+
/**
|
|
91
|
+
* Adds a unique icon file path to the global iconFiles array.
|
|
92
|
+
*
|
|
93
|
+
* @param icon - The file path to add.
|
|
94
|
+
* @returns Null if the file path is already in the array, otherwise adds the path.
|
|
95
|
+
*/
|
|
45
96
|
const addIconFile = (icon) => (!iconFiles.includes(icon) ? iconFiles.push(icon) : null);
|
|
97
|
+
/**
|
|
98
|
+
* Defines a route and its associated settings based on the route configuration.
|
|
99
|
+
* Wraps the component with necessary middleware, permission, and client wrappers.
|
|
100
|
+
*
|
|
101
|
+
* @param routeFn - The route function to define a new route.
|
|
102
|
+
* @param jsonRoute - The JSON route configuration.
|
|
103
|
+
* @param metaJson - Metadata related to the route.
|
|
104
|
+
* @param settings - The application settings.
|
|
105
|
+
* @param paths - The paths configuration for various modules and components.
|
|
106
|
+
*/
|
|
46
107
|
function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
47
108
|
const { routes = null, relativePath: path, componentPath, clientOnly, dialogPath, isResourceRoute, auth = 'optional', hasServerCode = false, hasLoader = false, hasAction = false, hasClientLoader = false, hasClientAction = false, hasComponent = false, hasErrorBoundary = false, hasLinks = false, hasMeta = false, hasHydrateFallback = false, hasShouldRevalidate = false, queryParamsGenerator = false, hasHandle = false, hasHeaders = false, wrapperPaths = [], middlewares = [], authority = [], extraPermissions = [], extraIcons = [], extraLink = [], extraProps = {}, loaderReturnInfo = {}, queries = {}, clientMiddlewares = [], configurations = [], resourceUri, icon, ...rest } = jsonRoute;
|
|
109
|
+
// Handle icons
|
|
48
110
|
if (icon) {
|
|
49
111
|
if (typeof icon === 'object') {
|
|
50
112
|
if (typeof icon.svgPath === 'string') {
|
|
@@ -61,6 +123,7 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
61
123
|
addIconName(icon);
|
|
62
124
|
}
|
|
63
125
|
}
|
|
126
|
+
// Handle extra icons if any
|
|
64
127
|
if (extraIcons?.length > 0) {
|
|
65
128
|
extraIcons?.map((icon) => {
|
|
66
129
|
if (typeof icon === 'string') {
|
|
@@ -71,19 +134,20 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
71
134
|
}
|
|
72
135
|
});
|
|
73
136
|
}
|
|
137
|
+
// Handle dialog paths and component routes
|
|
74
138
|
if (dialogPath && !dialogPaths.includes(dialogPath)) {
|
|
75
139
|
dialogWrapper.dialogWrapperUtility(dialogPath, { path: rest.path });
|
|
76
140
|
dialogPaths.push(dialogPath);
|
|
77
141
|
}
|
|
78
142
|
else if (componentPath) {
|
|
79
143
|
if (clientOnly) {
|
|
80
|
-
wrapperPaths.push('$clientOnlyWrapper'); // Add a placeholder for
|
|
144
|
+
wrapperPaths.push('$clientOnlyWrapper'); // Add a placeholder for client-only wrapper
|
|
81
145
|
}
|
|
82
146
|
if (authority.length > 0) {
|
|
83
|
-
wrapperPaths.push('$permissionWrapper'); // Add a placeholder for
|
|
147
|
+
wrapperPaths.push('$permissionWrapper'); // Add a placeholder for permission wrapper
|
|
84
148
|
}
|
|
85
149
|
if (configurations.length > 0 && resourceUri) {
|
|
86
|
-
wrapperPaths.push('$configurationWrapper'); // Add a placeholder for
|
|
150
|
+
wrapperPaths.push('$configurationWrapper'); // Add a placeholder for configuration wrapper
|
|
87
151
|
}
|
|
88
152
|
const requireAuth = !!auth;
|
|
89
153
|
const options = {
|
|
@@ -131,17 +195,28 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
131
195
|
}
|
|
132
196
|
}
|
|
133
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Defines the routes configuration for the application.
|
|
200
|
+
* Loads and defines routes based on the provided options and meta data.
|
|
201
|
+
*
|
|
202
|
+
* @param routeFn - The route function to define the route.
|
|
203
|
+
* @param options - The options containing route configurations, settings, and paths.
|
|
204
|
+
* @param metaJson - Optional metadata JSON for additional configurations.
|
|
205
|
+
*/
|
|
134
206
|
function defineRoutesConfig(routeFn, options, metaJson = null) {
|
|
135
207
|
const jsonRoute = loadRoutesConfig(options);
|
|
136
208
|
const settings = options.settings || {};
|
|
137
209
|
const paths = options.paths || {};
|
|
138
210
|
const iconsRepository = options.iconsRepository || {};
|
|
211
|
+
// Reset dialog paths and icon-related variables
|
|
139
212
|
dialogPaths = [];
|
|
140
213
|
iconNames = [];
|
|
141
214
|
iconSvgPaths = [];
|
|
215
|
+
// Define each route
|
|
142
216
|
jsonRoute.forEach((item) => {
|
|
143
217
|
defineRoute(routeFn, item, { metaJson, settings, paths });
|
|
144
218
|
});
|
|
219
|
+
// Write the dialogs and icons configuration
|
|
145
220
|
dialogWrapper.writeDialogsSwitch(dialogPaths);
|
|
146
221
|
iconSwitch.writeIconsSwitch(iconNames, iconSvgPaths, iconFiles, iconsRepository);
|
|
147
222
|
}exports.defineRoutesConfig=defineRoutesConfig;exports.loadRoutesConfig=loadRoutesConfig;exports.resolvePathsUsingPackages=resolvePathsUsingPackages;//# sourceMappingURL=json-wrappers.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-wrappers.cjs","sources":["../../src/vite-wrappers/json-wrappers.ts"],"sourcesContent":[null],"names":["createHash","getRootPath","isArray","mergeWith","getSortedRoutes","dialogWrapperUtility","wrapRouteComponent","writeDialogsSwitch","writeIconsSwitch"],"mappings":"mVAAA;AAWA,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,SAAS,GAAG,CAAC,KAAY;AACtD,IAAA,MAAM,IAAI,GAAGA,sBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;AAC3E,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"json-wrappers.cjs","sources":["../../src/vite-wrappers/json-wrappers.ts"],"sourcesContent":[null],"names":["createHash","getRootPath","isArray","mergeWith","getSortedRoutes","dialogWrapperUtility","wrapRouteComponent","writeDialogsSwitch","writeIconsSwitch"],"mappings":"mVAAA;AAWA;;;;;;;AAOG;AACH,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,SAAS,GAAG,CAAC,KAAY;AACtD,IAAA,MAAM,IAAI,GAAGA,sBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;AAC3E,CAAC,CAAC;AAEF;;;;;;;;AAQG;SACa,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAA;AAClE,IAAA,MAAM,QAAQ,GAAG,QAAQ,IAAIC,4BAAW,EAAE,CAAC;;IAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,KA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AAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAClF,aAAC,CAAC,CAAC;SACN;aAAM;AACH,YAAA,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;SAC7B;KACJ;AACL,CAAC;AAED;;;;;;;AAOG;AACG,SAAU,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,EAAA;AAChE,IAAA,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC5C,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;AACxC,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;AAClC,IAAA,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;;IAGtD,WAAW,GAAG,EAAE,CAAC;IACjB,SAAS,GAAG,EAAE,CAAC;IACf,YAAY,GAAG,EAAE,CAAC;;AAGlB,IAAA,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AACvB,QAAA,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9D,KAAC,CAAC,CAAC;;IAGHC,gCAAkB,CAAC,WAAW,CAAC,CAAC;IAChCC,2BAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AAC1E"}
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the directories containing files from specified packages.
|
|
3
|
+
* Searches for a specific file in the node_modules directories of the provided packages.
|
|
4
|
+
*
|
|
5
|
+
* @param packages - The list of package names to search in.
|
|
6
|
+
* @param fileName - The name of the file to search for.
|
|
7
|
+
* @param rootPath - Optional root path to start the search. Defaults to project root.
|
|
8
|
+
* @returns An array of directories where the specified file is found.
|
|
9
|
+
*/
|
|
1
10
|
export declare function resolvePathsUsingPackages(packages: any, fileName: any, rootPath: any): any;
|
|
11
|
+
/**
|
|
12
|
+
* Loads the routes configuration from the specified packages and merges them.
|
|
13
|
+
* Returns the sorted and merged route configuration.
|
|
14
|
+
*
|
|
15
|
+
* @param options - The options containing package names and root path for route resolution.
|
|
16
|
+
* @returns The sorted routes configuration or null if no configuration is found.
|
|
17
|
+
*/
|
|
2
18
|
export declare function loadRoutesConfig(options: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* Defines the routes configuration for the application.
|
|
21
|
+
* Loads and defines routes based on the provided options and meta data.
|
|
22
|
+
*
|
|
23
|
+
* @param routeFn - The route function to define the route.
|
|
24
|
+
* @param options - The options containing route configurations, settings, and paths.
|
|
25
|
+
* @param metaJson - Optional metadata JSON for additional configurations.
|
|
26
|
+
*/
|
|
3
27
|
export declare function defineRoutesConfig(routeFn: any, options: any, metaJson?: any): void;
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import {getSortedRoutes}from'@common-stack/client-react/lib/route/get-routes.js';import fs__default from'fs';import globAll from'glob-all';import {mergeWith,isArray}from'lodash-es';import {createHash}from'node:crypto';import {getRootPath,wrapRouteComponent}from'./wrapperComponent.js';import {writeDialogsSwitch,dialogWrapperUtility}from'./dialog-wrapper.js';import {writeIconsSwitch}from'./icon-switch.js';/* eslint-disable array-callback-return */
|
|
2
|
+
/**
|
|
3
|
+
* Generates a hash from the source string.
|
|
4
|
+
* Used to create unique route suffixes.
|
|
5
|
+
*
|
|
6
|
+
* @param source - The source string to hash.
|
|
7
|
+
* @param maxLength - The maximum length of the hash. Default is 8.
|
|
8
|
+
* @returns A substring of the generated SHA256 hash.
|
|
9
|
+
*/
|
|
2
10
|
const getHash = (source, maxLength = 8) => {
|
|
3
11
|
const hash = createHash('sha256').update(source).digest('hex');
|
|
4
12
|
return typeof maxLength === 'number' ? hash.slice(0, maxLength) : hash;
|
|
5
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the directories containing files from specified packages.
|
|
16
|
+
* Searches for a specific file in the node_modules directories of the provided packages.
|
|
17
|
+
*
|
|
18
|
+
* @param packages - The list of package names to search in.
|
|
19
|
+
* @param fileName - The name of the file to search for.
|
|
20
|
+
* @param rootPath - Optional root path to start the search. Defaults to project root.
|
|
21
|
+
* @returns An array of directories where the specified file is found.
|
|
22
|
+
*/
|
|
6
23
|
function resolvePathsUsingPackages(packages, fileName, rootPath) {
|
|
7
24
|
const basePath = rootPath || getRootPath();
|
|
8
25
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
@@ -16,11 +33,26 @@ function resolvePathsUsingPackages(packages, fileName, rootPath) {
|
|
|
16
33
|
}, []);
|
|
17
34
|
return localesDirs;
|
|
18
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Custom merge function used to concatenate arrays when merging objects.
|
|
38
|
+
* Used when merging routes configurations.
|
|
39
|
+
*
|
|
40
|
+
* @param objValue - The existing value.
|
|
41
|
+
* @param srcValue - The new value to merge.
|
|
42
|
+
* @returns Concatenated array if objValue is an array, otherwise undefined.
|
|
43
|
+
*/
|
|
19
44
|
function customizer(objValue, srcValue) {
|
|
20
45
|
if (isArray(objValue)) {
|
|
21
46
|
return objValue.concat(srcValue);
|
|
22
47
|
}
|
|
23
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Loads the routes configuration from the specified packages and merges them.
|
|
51
|
+
* Returns the sorted and merged route configuration.
|
|
52
|
+
*
|
|
53
|
+
* @param options - The options containing package names and root path for route resolution.
|
|
54
|
+
* @returns The sorted routes configuration or null if no configuration is found.
|
|
55
|
+
*/
|
|
24
56
|
function loadRoutesConfig(options) {
|
|
25
57
|
const fileName = options.routesFileName || 'route.json';
|
|
26
58
|
const directories = resolvePathsUsingPackages(options.packages, fileName, options.rootPath);
|
|
@@ -36,15 +68,45 @@ function loadRoutesConfig(options) {
|
|
|
36
68
|
const result = content.length ? getSortedRoutes('/', Object.assign({}, ...content)) : null;
|
|
37
69
|
return result;
|
|
38
70
|
}
|
|
71
|
+
// Global variables to store dialog paths, icon names, and icon files.
|
|
39
72
|
let dialogPaths = [];
|
|
40
73
|
let iconNames = [];
|
|
41
74
|
let iconSvgPaths = [];
|
|
42
75
|
const iconFiles = [];
|
|
76
|
+
/**
|
|
77
|
+
* Adds a unique icon name to the global iconNames array.
|
|
78
|
+
*
|
|
79
|
+
* @param icon - The icon name to add.
|
|
80
|
+
* @returns Null if the icon name is already in the array, otherwise adds the name.
|
|
81
|
+
*/
|
|
43
82
|
const addIconName = (icon) => (!iconNames.includes(icon) ? iconNames.push(icon) : null);
|
|
83
|
+
/**
|
|
84
|
+
* Adds a unique SVG path to the global iconSvgPaths array.
|
|
85
|
+
*
|
|
86
|
+
* @param icon - The SVG path to add.
|
|
87
|
+
* @returns Null if the SVG path is already in the array, otherwise adds the path.
|
|
88
|
+
*/
|
|
44
89
|
const addIconSvgPath = (icon) => (!iconSvgPaths.includes(icon) ? iconSvgPaths.push(icon) : null);
|
|
90
|
+
/**
|
|
91
|
+
* Adds a unique icon file path to the global iconFiles array.
|
|
92
|
+
*
|
|
93
|
+
* @param icon - The file path to add.
|
|
94
|
+
* @returns Null if the file path is already in the array, otherwise adds the path.
|
|
95
|
+
*/
|
|
45
96
|
const addIconFile = (icon) => (!iconFiles.includes(icon) ? iconFiles.push(icon) : null);
|
|
97
|
+
/**
|
|
98
|
+
* Defines a route and its associated settings based on the route configuration.
|
|
99
|
+
* Wraps the component with necessary middleware, permission, and client wrappers.
|
|
100
|
+
*
|
|
101
|
+
* @param routeFn - The route function to define a new route.
|
|
102
|
+
* @param jsonRoute - The JSON route configuration.
|
|
103
|
+
* @param metaJson - Metadata related to the route.
|
|
104
|
+
* @param settings - The application settings.
|
|
105
|
+
* @param paths - The paths configuration for various modules and components.
|
|
106
|
+
*/
|
|
46
107
|
function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
47
108
|
const { routes = null, relativePath: path, componentPath, clientOnly, dialogPath, isResourceRoute, auth = 'optional', hasServerCode = false, hasLoader = false, hasAction = false, hasClientLoader = false, hasClientAction = false, hasComponent = false, hasErrorBoundary = false, hasLinks = false, hasMeta = false, hasHydrateFallback = false, hasShouldRevalidate = false, queryParamsGenerator = false, hasHandle = false, hasHeaders = false, wrapperPaths = [], middlewares = [], authority = [], extraPermissions = [], extraIcons = [], extraLink = [], extraProps = {}, loaderReturnInfo = {}, queries = {}, clientMiddlewares = [], configurations = [], resourceUri, icon, ...rest } = jsonRoute;
|
|
109
|
+
// Handle icons
|
|
48
110
|
if (icon) {
|
|
49
111
|
if (typeof icon === 'object') {
|
|
50
112
|
if (typeof icon.svgPath === 'string') {
|
|
@@ -61,6 +123,7 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
61
123
|
addIconName(icon);
|
|
62
124
|
}
|
|
63
125
|
}
|
|
126
|
+
// Handle extra icons if any
|
|
64
127
|
if (extraIcons?.length > 0) {
|
|
65
128
|
extraIcons?.map((icon) => {
|
|
66
129
|
if (typeof icon === 'string') {
|
|
@@ -71,19 +134,20 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
71
134
|
}
|
|
72
135
|
});
|
|
73
136
|
}
|
|
137
|
+
// Handle dialog paths and component routes
|
|
74
138
|
if (dialogPath && !dialogPaths.includes(dialogPath)) {
|
|
75
139
|
dialogWrapperUtility(dialogPath, { path: rest.path });
|
|
76
140
|
dialogPaths.push(dialogPath);
|
|
77
141
|
}
|
|
78
142
|
else if (componentPath) {
|
|
79
143
|
if (clientOnly) {
|
|
80
|
-
wrapperPaths.push('$clientOnlyWrapper'); // Add a placeholder for
|
|
144
|
+
wrapperPaths.push('$clientOnlyWrapper'); // Add a placeholder for client-only wrapper
|
|
81
145
|
}
|
|
82
146
|
if (authority.length > 0) {
|
|
83
|
-
wrapperPaths.push('$permissionWrapper'); // Add a placeholder for
|
|
147
|
+
wrapperPaths.push('$permissionWrapper'); // Add a placeholder for permission wrapper
|
|
84
148
|
}
|
|
85
149
|
if (configurations.length > 0 && resourceUri) {
|
|
86
|
-
wrapperPaths.push('$configurationWrapper'); // Add a placeholder for
|
|
150
|
+
wrapperPaths.push('$configurationWrapper'); // Add a placeholder for configuration wrapper
|
|
87
151
|
}
|
|
88
152
|
const requireAuth = !!auth;
|
|
89
153
|
const options = {
|
|
@@ -131,17 +195,28 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
131
195
|
}
|
|
132
196
|
}
|
|
133
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Defines the routes configuration for the application.
|
|
200
|
+
* Loads and defines routes based on the provided options and meta data.
|
|
201
|
+
*
|
|
202
|
+
* @param routeFn - The route function to define the route.
|
|
203
|
+
* @param options - The options containing route configurations, settings, and paths.
|
|
204
|
+
* @param metaJson - Optional metadata JSON for additional configurations.
|
|
205
|
+
*/
|
|
134
206
|
function defineRoutesConfig(routeFn, options, metaJson = null) {
|
|
135
207
|
const jsonRoute = loadRoutesConfig(options);
|
|
136
208
|
const settings = options.settings || {};
|
|
137
209
|
const paths = options.paths || {};
|
|
138
210
|
const iconsRepository = options.iconsRepository || {};
|
|
211
|
+
// Reset dialog paths and icon-related variables
|
|
139
212
|
dialogPaths = [];
|
|
140
213
|
iconNames = [];
|
|
141
214
|
iconSvgPaths = [];
|
|
215
|
+
// Define each route
|
|
142
216
|
jsonRoute.forEach((item) => {
|
|
143
217
|
defineRoute(routeFn, item, { metaJson, settings, paths });
|
|
144
218
|
});
|
|
219
|
+
// Write the dialogs and icons configuration
|
|
145
220
|
writeDialogsSwitch(dialogPaths);
|
|
146
221
|
writeIconsSwitch(iconNames, iconSvgPaths, iconFiles, iconsRepository);
|
|
147
222
|
}export{defineRoutesConfig,loadRoutesConfig,resolvePathsUsingPackages};//# sourceMappingURL=json-wrappers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-wrappers.js","sources":["../../src/vite-wrappers/json-wrappers.ts"],"sourcesContent":[null],"names":["fs"],"mappings":"uZAAA;AAWA,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,SAAS,GAAG,CAAC,KAAY;AACtD,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;AAC3E,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"json-wrappers.js","sources":["../../src/vite-wrappers/json-wrappers.ts"],"sourcesContent":[null],"names":["fs"],"mappings":"uZAAA;AAWA;;;;;;;AAOG;AACH,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,SAAS,GAAG,CAAC,KAAY;AACtD,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;AAC3E,CAAC,CAAC;AAEF;;;;;;;;AAQG;SACa,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAA;AAClE,IAAA,MAAM,QAAQ,GAAG,QAAQ,IAAI,WAAW,EAAE,CAAC;;IAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAG,EAAA,QAAQ,iBAAiB,IAAI,CAAA,CAAE,CAAC,CAAC,CAAC;IACzF,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC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AAC,CAAC;AAClF,aAAC,CAAC,CAAC;SACN;aAAM;AACH,YAAA,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;SAC7B;KACJ;AACL,CAAC;AAED;;;;;;;AAOG;AACG,SAAU,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,EAAA;AAChE,IAAA,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC5C,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;AACxC,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;AAClC,IAAA,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;;IAGtD,WAAW,GAAG,EAAE,CAAC;IACjB,SAAS,GAAG,EAAE,CAAC;IACf,YAAY,GAAG,EAAE,CAAC;;AAGlB,IAAA,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AACvB,QAAA,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9D,KAAC,CAAC,CAAC;;IAGH,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChC,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AAC1E"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
'use strict';var lodashEs=require('lodash-es')
|
|
1
|
+
'use strict';var lodashEs=require('lodash-es');// Utility to generate a key for the query, converting its format for use in client-side and server-side loaders
|
|
2
|
+
const generateDeferKey = (key) => lodashEs.camelCase(key.replace('Get', '')).replace('Document', 'Query');
|
|
3
|
+
/**
|
|
4
|
+
* Generates the server-side loader function for handling GraphQL queries.
|
|
5
|
+
* It creates the default server loader for fetching data based on provided queries in the options.
|
|
6
|
+
*
|
|
7
|
+
* @param queries - The list of queries to be used for data fetching.
|
|
8
|
+
* @returns The generated server loader function string.
|
|
9
|
+
*/
|
|
2
10
|
const generateServerLoader = ({ queries }) => {
|
|
3
11
|
if (Object.keys(queries ?? {}).length === 0) {
|
|
4
12
|
return '';
|
|
@@ -53,13 +61,22 @@ ${deferredAssignments}
|
|
|
53
61
|
* If options.queries is not empty, return an object with wrapped with `defer`. Include middleware if it exists. Include respondOptions if it exists.
|
|
54
62
|
* if loaderReturnInfo.keys is empty and hasMiddleware is true or false, but has options.queries objects then return defaultLoaderData
|
|
55
63
|
* if its a resource route and isResourceRoute is true then return an object with the keys and values from loaderData wrapped around `json`.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
64
|
+
*
|
|
65
|
+
* Generates the return statement based on loader, middleware, and options configurations.
|
|
66
|
+
* Handles whether to wrap data with `defer`, `json`, or just return raw data based on options.
|
|
67
|
+
*
|
|
68
|
+
* @param options - Configuration options containing loader info and queries.
|
|
69
|
+
* @param hasMiddleware - A boolean flag indicating if middleware is being applied.
|
|
70
|
+
* @returns The return statement string for the loader function.
|
|
58
71
|
*/
|
|
59
72
|
function generateReturnStatement(options, hasMiddleware) {
|
|
60
73
|
const { loaderReturnInfo, isResourceRoute, queries, hasLoader } = options;
|
|
61
74
|
const hasQueries = Object.keys(queries ?? {}).length > 0;
|
|
62
|
-
const responseKey = isResourceRoute
|
|
75
|
+
const responseKey = isResourceRoute
|
|
76
|
+
? 'json'
|
|
77
|
+
: loaderReturnInfo?.keys?.length > 0 || hasQueries
|
|
78
|
+
? 'defer'
|
|
79
|
+
: loaderReturnInfo?.returnType || '';
|
|
63
80
|
const defaultLoaderData = hasQueries ? 'defaultLoaderData' : '{}';
|
|
64
81
|
const middlewareData = hasMiddleware ? '{ permissions, dataContext: rest, configurations }' : '{}';
|
|
65
82
|
const respondOptions = loaderReturnInfo?.hasOptions ? 'respondOptions' : '';
|
|
@@ -87,13 +104,19 @@ function generateMiddlewarePushes(options) {
|
|
|
87
104
|
?.map((_, index) => `middlewareStack.push({ name: "middleware${index + 1}", func: middleware${index + 1} });`)
|
|
88
105
|
.join('\n');
|
|
89
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Generates the permission-check logic for loaders, filtering permissions based on authority keys.
|
|
109
|
+
*
|
|
110
|
+
* @param options - The options containing the authority and extraPermissions to check.
|
|
111
|
+
* @param isClient - A flag to specify if it's for client-side loading (default: false).
|
|
112
|
+
* @returns The permission-check logic string.
|
|
113
|
+
*/
|
|
90
114
|
function generateHasPermission(options, isClient = false) {
|
|
91
115
|
const hasLoader = isClient ? options.hasClientLoader : options.hasLoader;
|
|
92
116
|
let generates = '';
|
|
93
117
|
if (options.authority?.length > 0 || options.extraPermissions?.length > 0) {
|
|
94
118
|
generates = `
|
|
95
119
|
if (permissions !== null) {
|
|
96
|
-
// Filter permissions based on authority keys
|
|
97
120
|
const permissionKeys = ${JSON.stringify(options.authority)} || [];
|
|
98
121
|
let extraPermissions = ${JSON.stringify(options.extraPermissions)} || [];
|
|
99
122
|
extraPermissions = permissionKeys.concat(extraPermissions);
|
|
@@ -110,10 +133,19 @@ function generateHasPermission(options, isClient = false) {
|
|
|
110
133
|
}
|
|
111
134
|
return generates;
|
|
112
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Generates the export functions for loaders and actions based on the provided options.
|
|
138
|
+
* Handles middleware and permission checks if present.
|
|
139
|
+
*
|
|
140
|
+
* @param sourceExport - The source export string to append additional exports.
|
|
141
|
+
* @param options - The configuration options including middleware, queries, etc.
|
|
142
|
+
* @param hasMiddleware - A flag indicating if middleware exists.
|
|
143
|
+
* @param hasQueries - A flag indicating if GraphQL queries are present.
|
|
144
|
+
* @returns The updated export string.
|
|
145
|
+
*/
|
|
113
146
|
function generateLoaderExports(sourceExport = '', options, hasMiddleware = false, hasQueries = false) {
|
|
114
147
|
if (hasQueries) {
|
|
115
148
|
sourceExport += generateServerLoader(options);
|
|
116
|
-
// options = internalOptions(options); // Mutating the options object to add the loaderReturnInfo object
|
|
117
149
|
}
|
|
118
150
|
const getMiddlewareOptions = () => {
|
|
119
151
|
if (options.requireAuth) {
|
|
@@ -129,8 +161,9 @@ function generateLoaderExports(sourceExport = '', options, hasMiddleware = false
|
|
|
129
161
|
const middlewareOptions = ${getMiddlewareOptions()}
|
|
130
162
|
${options.requireAuth ? 'middlewareStack.push({ name: "auth", func: authMiddleware });' : ''}
|
|
131
163
|
${generateMiddlewarePushes(options)}
|
|
132
|
-
${
|
|
133
|
-
'middlewareStack.push({ name: "lifecycle", func: lifecycleMiddleware });\n'
|
|
164
|
+
${options.authority?.length > 0 || options.extraPermissions?.length > 0
|
|
165
|
+
? 'middlewareStack.push({ name: "lifecycle", func: lifecycleMiddleware });\n'
|
|
166
|
+
: ''}
|
|
134
167
|
${options.authority?.length > 0 ? 'middlewareStack.push({ name: "permission", func: permissionMiddleware });\n' : ''}
|
|
135
168
|
${options.resourceUri ? 'middlewareStack.push({ name: "configurations", func: configurationMiddleware });\n' : ''}
|
|
136
169
|
const paramsFromOptions = ${options.resourceUri
|
|
@@ -146,8 +179,10 @@ function generateLoaderExports(sourceExport = '', options, hasMiddleware = false
|
|
|
146
179
|
let hasPermissions = true;
|
|
147
180
|
let loaderErrors = [];
|
|
148
181
|
${generateHasPermission(options)}
|
|
149
|
-
const defaultLoaderResult = ${hasQueries
|
|
150
|
-
|
|
182
|
+
const defaultLoaderResult = ${hasQueries
|
|
183
|
+
? `hasPermissions ? await withErrorHandler(defaultServerLoader, params) : { data: {}, errors: [] };\n
|
|
184
|
+
loaderErrors = defaultLoaderResult.errors`
|
|
185
|
+
: '{ data: {}, errors: [] }'};
|
|
151
186
|
const defaultLoaderData = defaultLoaderResult.data;
|
|
152
187
|
${options.requireAuth
|
|
153
188
|
? 'if (middlewareData.userId) { params.context = params.context || {}; params.context.userId = middlewareData.userId; }\n'
|
|
@@ -168,6 +203,12 @@ function generateLoaderExports(sourceExport = '', options, hasMiddleware = false
|
|
|
168
203
|
}`;
|
|
169
204
|
return sourceExport;
|
|
170
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Generates the client-side loader logic for fetching data on the client-side, including caching mechanisms.
|
|
208
|
+
*
|
|
209
|
+
* @param queries - The GraphQL queries to fetch on the client-side.
|
|
210
|
+
* @returns The generated client loader function string.
|
|
211
|
+
*/
|
|
171
212
|
const generateClientLoader = ({ queries }) => {
|
|
172
213
|
if (Object.keys(queries ?? {}).length === 0) {
|
|
173
214
|
return '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderGenerator.cjs","sources":["../../src/vite-wrappers/loaderGenerator.ts"],"sourcesContent":[null],"names":["camelCase"],"mappings":"+CAGA,MAAM,gBAAgB,GAAG,CAAC,GAAW,KAAKA,kBAAS,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"loaderGenerator.cjs","sources":["../../src/vite-wrappers/loaderGenerator.ts"],"sourcesContent":[null],"names":["camelCase"],"mappings":"+CAGA;AACA,MAAM,gBAAgB,GAAG,CAAC,GAAW,KAAKA,kBAAS,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAmBzG;;;;;;AAMG;MACU,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAA6B,KAAI;AAC3E,IAAA,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;AACzC,QAAA,OAAO,EAAE,CAAC;KACb;IACD,OAAO,CAAA;;;AAGW,oBAAA,EAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,KAAI;AAC1E,QAAA,MAAM,cAAc,GAAG,KAAK,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GAAG,GAAG,GAAG,GAAG,CAAA,CAAE,CAAC;KACnG,EAAE,GAAG,CAAC,CAAA;;AAEwB,qCAAA,EAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;SAC9C,GAAG,CAAC,CAAC,GAAG,KAAKA,kBAAS,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;SAC5E,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,CAAG,CAAC,CAAA;;;;AAI3B,QAAA,EAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AACjB,SAAA,GAAG,CACA,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAA;;yBAEZ,QAAQ,CAAA;sCACK,QAAQ,CAAA;;gCAEd,QAAQ,CAAA;;;;;oCAKJ,KAAK,CAAA;;UAE/B,CACG;SACA,IAAI,CAAC,EAAE,CAAC,CAAA;;;;;;;;;;;;;AAaX,QAAA,EAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AACjB,SAAA,GAAG,CACA,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAA;mCACF,KAAK,CAAA;;;;;;iCAMP,QAAQ,CAAA;8CACK,QAAQ,CAAA;;;;aAIzC,CACA;SACA,IAAI,CAAC,EAAE,CAAC,CAAA;;;;;;EAMnB,CAAC;AACH"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { IOptions } from '../interfaces/types';
|
|
2
|
+
/**
|
|
3
|
+
* Internal function to update the options with default loader configurations.
|
|
4
|
+
* Adds a loaderReturnInfo object to the options, which will be used to handle deferred data loading.
|
|
5
|
+
*
|
|
6
|
+
* @param options - The options object which will be modified to include loader-related configurations.
|
|
7
|
+
* @returns The updated options object.
|
|
8
|
+
*/
|
|
2
9
|
export declare function internalOptions(options: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* Generates the server-side loader function for handling GraphQL queries.
|
|
12
|
+
* It creates the default server loader for fetching data based on provided queries in the options.
|
|
13
|
+
*
|
|
14
|
+
* @param queries - The list of queries to be used for data fetching.
|
|
15
|
+
* @returns The generated server loader function string.
|
|
16
|
+
*/
|
|
3
17
|
export declare const generateServerLoader: ({ queries }: Pick<IOptions, "queries">) => string;
|
|
4
18
|
/**
|
|
5
19
|
* if loaderReturnInfo.keys is empty and hasMiddleware is false, return loaderData otherwise
|
|
@@ -9,10 +23,38 @@ export declare const generateServerLoader: ({ queries }: Pick<IOptions, "queries
|
|
|
9
23
|
* If options.queries is not empty, return an object with wrapped with `defer`. Include middleware if it exists. Include respondOptions if it exists.
|
|
10
24
|
* if loaderReturnInfo.keys is empty and hasMiddleware is true or false, but has options.queries objects then return defaultLoaderData
|
|
11
25
|
* if its a resource route and isResourceRoute is true then return an object with the keys and values from loaderData wrapped around `json`.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* Generates the return statement based on loader, middleware, and options configurations.
|
|
28
|
+
* Handles whether to wrap data with `defer`, `json`, or just return raw data based on options.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Configuration options containing loader info and queries.
|
|
31
|
+
* @param hasMiddleware - A boolean flag indicating if middleware is being applied.
|
|
32
|
+
* @returns The return statement string for the loader function.
|
|
14
33
|
*/
|
|
15
34
|
export declare function generateReturnStatement(options: IOptions, hasMiddleware: boolean): string;
|
|
35
|
+
/**
|
|
36
|
+
* Generates the permission-check logic for loaders, filtering permissions based on authority keys.
|
|
37
|
+
*
|
|
38
|
+
* @param options - The options containing the authority and extraPermissions to check.
|
|
39
|
+
* @param isClient - A flag to specify if it's for client-side loading (default: false).
|
|
40
|
+
* @returns The permission-check logic string.
|
|
41
|
+
*/
|
|
16
42
|
export declare function generateHasPermission(options: IOptions, isClient?: boolean): string;
|
|
43
|
+
/**
|
|
44
|
+
* Generates the export functions for loaders and actions based on the provided options.
|
|
45
|
+
* Handles middleware and permission checks if present.
|
|
46
|
+
*
|
|
47
|
+
* @param sourceExport - The source export string to append additional exports.
|
|
48
|
+
* @param options - The configuration options including middleware, queries, etc.
|
|
49
|
+
* @param hasMiddleware - A flag indicating if middleware exists.
|
|
50
|
+
* @param hasQueries - A flag indicating if GraphQL queries are present.
|
|
51
|
+
* @returns The updated export string.
|
|
52
|
+
*/
|
|
17
53
|
export declare function generateLoaderExports(sourceExport: string, options: IOptions, hasMiddleware?: boolean, hasQueries?: boolean): string;
|
|
54
|
+
/**
|
|
55
|
+
* Generates the client-side loader logic for fetching data on the client-side, including caching mechanisms.
|
|
56
|
+
*
|
|
57
|
+
* @param queries - The GraphQL queries to fetch on the client-side.
|
|
58
|
+
* @returns The generated client loader function string.
|
|
59
|
+
*/
|
|
18
60
|
export declare const generateClientLoader: ({ queries }: Pick<IOptions, "queries">) => string;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {camelCase}from'lodash-es'
|
|
1
|
+
import {camelCase}from'lodash-es';// Utility to generate a key for the query, converting its format for use in client-side and server-side loaders
|
|
2
|
+
const generateDeferKey = (key) => camelCase(key.replace('Get', '')).replace('Document', 'Query');
|
|
3
|
+
/**
|
|
4
|
+
* Generates the server-side loader function for handling GraphQL queries.
|
|
5
|
+
* It creates the default server loader for fetching data based on provided queries in the options.
|
|
6
|
+
*
|
|
7
|
+
* @param queries - The list of queries to be used for data fetching.
|
|
8
|
+
* @returns The generated server loader function string.
|
|
9
|
+
*/
|
|
2
10
|
const generateServerLoader = ({ queries }) => {
|
|
3
11
|
if (Object.keys(queries ?? {}).length === 0) {
|
|
4
12
|
return '';
|
|
@@ -53,13 +61,22 @@ ${deferredAssignments}
|
|
|
53
61
|
* If options.queries is not empty, return an object with wrapped with `defer`. Include middleware if it exists. Include respondOptions if it exists.
|
|
54
62
|
* if loaderReturnInfo.keys is empty and hasMiddleware is true or false, but has options.queries objects then return defaultLoaderData
|
|
55
63
|
* if its a resource route and isResourceRoute is true then return an object with the keys and values from loaderData wrapped around `json`.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
64
|
+
*
|
|
65
|
+
* Generates the return statement based on loader, middleware, and options configurations.
|
|
66
|
+
* Handles whether to wrap data with `defer`, `json`, or just return raw data based on options.
|
|
67
|
+
*
|
|
68
|
+
* @param options - Configuration options containing loader info and queries.
|
|
69
|
+
* @param hasMiddleware - A boolean flag indicating if middleware is being applied.
|
|
70
|
+
* @returns The return statement string for the loader function.
|
|
58
71
|
*/
|
|
59
72
|
function generateReturnStatement(options, hasMiddleware) {
|
|
60
73
|
const { loaderReturnInfo, isResourceRoute, queries, hasLoader } = options;
|
|
61
74
|
const hasQueries = Object.keys(queries ?? {}).length > 0;
|
|
62
|
-
const responseKey = isResourceRoute
|
|
75
|
+
const responseKey = isResourceRoute
|
|
76
|
+
? 'json'
|
|
77
|
+
: loaderReturnInfo?.keys?.length > 0 || hasQueries
|
|
78
|
+
? 'defer'
|
|
79
|
+
: loaderReturnInfo?.returnType || '';
|
|
63
80
|
const defaultLoaderData = hasQueries ? 'defaultLoaderData' : '{}';
|
|
64
81
|
const middlewareData = hasMiddleware ? '{ permissions, dataContext: rest, configurations }' : '{}';
|
|
65
82
|
const respondOptions = loaderReturnInfo?.hasOptions ? 'respondOptions' : '';
|
|
@@ -87,13 +104,19 @@ function generateMiddlewarePushes(options) {
|
|
|
87
104
|
?.map((_, index) => `middlewareStack.push({ name: "middleware${index + 1}", func: middleware${index + 1} });`)
|
|
88
105
|
.join('\n');
|
|
89
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Generates the permission-check logic for loaders, filtering permissions based on authority keys.
|
|
109
|
+
*
|
|
110
|
+
* @param options - The options containing the authority and extraPermissions to check.
|
|
111
|
+
* @param isClient - A flag to specify if it's for client-side loading (default: false).
|
|
112
|
+
* @returns The permission-check logic string.
|
|
113
|
+
*/
|
|
90
114
|
function generateHasPermission(options, isClient = false) {
|
|
91
115
|
const hasLoader = isClient ? options.hasClientLoader : options.hasLoader;
|
|
92
116
|
let generates = '';
|
|
93
117
|
if (options.authority?.length > 0 || options.extraPermissions?.length > 0) {
|
|
94
118
|
generates = `
|
|
95
119
|
if (permissions !== null) {
|
|
96
|
-
// Filter permissions based on authority keys
|
|
97
120
|
const permissionKeys = ${JSON.stringify(options.authority)} || [];
|
|
98
121
|
let extraPermissions = ${JSON.stringify(options.extraPermissions)} || [];
|
|
99
122
|
extraPermissions = permissionKeys.concat(extraPermissions);
|
|
@@ -110,10 +133,19 @@ function generateHasPermission(options, isClient = false) {
|
|
|
110
133
|
}
|
|
111
134
|
return generates;
|
|
112
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Generates the export functions for loaders and actions based on the provided options.
|
|
138
|
+
* Handles middleware and permission checks if present.
|
|
139
|
+
*
|
|
140
|
+
* @param sourceExport - The source export string to append additional exports.
|
|
141
|
+
* @param options - The configuration options including middleware, queries, etc.
|
|
142
|
+
* @param hasMiddleware - A flag indicating if middleware exists.
|
|
143
|
+
* @param hasQueries - A flag indicating if GraphQL queries are present.
|
|
144
|
+
* @returns The updated export string.
|
|
145
|
+
*/
|
|
113
146
|
function generateLoaderExports(sourceExport = '', options, hasMiddleware = false, hasQueries = false) {
|
|
114
147
|
if (hasQueries) {
|
|
115
148
|
sourceExport += generateServerLoader(options);
|
|
116
|
-
// options = internalOptions(options); // Mutating the options object to add the loaderReturnInfo object
|
|
117
149
|
}
|
|
118
150
|
const getMiddlewareOptions = () => {
|
|
119
151
|
if (options.requireAuth) {
|
|
@@ -129,8 +161,9 @@ function generateLoaderExports(sourceExport = '', options, hasMiddleware = false
|
|
|
129
161
|
const middlewareOptions = ${getMiddlewareOptions()}
|
|
130
162
|
${options.requireAuth ? 'middlewareStack.push({ name: "auth", func: authMiddleware });' : ''}
|
|
131
163
|
${generateMiddlewarePushes(options)}
|
|
132
|
-
${
|
|
133
|
-
'middlewareStack.push({ name: "lifecycle", func: lifecycleMiddleware });\n'
|
|
164
|
+
${options.authority?.length > 0 || options.extraPermissions?.length > 0
|
|
165
|
+
? 'middlewareStack.push({ name: "lifecycle", func: lifecycleMiddleware });\n'
|
|
166
|
+
: ''}
|
|
134
167
|
${options.authority?.length > 0 ? 'middlewareStack.push({ name: "permission", func: permissionMiddleware });\n' : ''}
|
|
135
168
|
${options.resourceUri ? 'middlewareStack.push({ name: "configurations", func: configurationMiddleware });\n' : ''}
|
|
136
169
|
const paramsFromOptions = ${options.resourceUri
|
|
@@ -146,8 +179,10 @@ function generateLoaderExports(sourceExport = '', options, hasMiddleware = false
|
|
|
146
179
|
let hasPermissions = true;
|
|
147
180
|
let loaderErrors = [];
|
|
148
181
|
${generateHasPermission(options)}
|
|
149
|
-
const defaultLoaderResult = ${hasQueries
|
|
150
|
-
|
|
182
|
+
const defaultLoaderResult = ${hasQueries
|
|
183
|
+
? `hasPermissions ? await withErrorHandler(defaultServerLoader, params) : { data: {}, errors: [] };\n
|
|
184
|
+
loaderErrors = defaultLoaderResult.errors`
|
|
185
|
+
: '{ data: {}, errors: [] }'};
|
|
151
186
|
const defaultLoaderData = defaultLoaderResult.data;
|
|
152
187
|
${options.requireAuth
|
|
153
188
|
? 'if (middlewareData.userId) { params.context = params.context || {}; params.context.userId = middlewareData.userId; }\n'
|
|
@@ -168,6 +203,12 @@ function generateLoaderExports(sourceExport = '', options, hasMiddleware = false
|
|
|
168
203
|
}`;
|
|
169
204
|
return sourceExport;
|
|
170
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Generates the client-side loader logic for fetching data on the client-side, including caching mechanisms.
|
|
208
|
+
*
|
|
209
|
+
* @param queries - The GraphQL queries to fetch on the client-side.
|
|
210
|
+
* @returns The generated client loader function string.
|
|
211
|
+
*/
|
|
171
212
|
const generateClientLoader = ({ queries }) => {
|
|
172
213
|
if (Object.keys(queries ?? {}).length === 0) {
|
|
173
214
|
return '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderGenerator.js","sources":["../../src/vite-wrappers/loaderGenerator.ts"],"sourcesContent":[null],"names":[],"mappings":"kCAG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AAC,OAAO,CAAC;AACjB,SAAA,GAAG,CACA,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAA;;yBAEZ,QAAQ,CAAA;sCACK,QAAQ,CAAA;;gCAEd,QAAQ,CAAA;;;;;oCAKJ,KAAK,CAAA;;UAE/B,CACG;SACA,IAAI,CAAC,EAAE,CAAC,CAAA;;;;;;;;;;;;;AAaX,QAAA,EAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AACjB,SAAA,GAAG,CACA,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAA;mCACF,KAAK,CAAA;;;;;;iCAMP,QAAQ,CAAA;8CACK,QAAQ,CAAA;;;;aAIzC,CACA;SACA,IAAI,CAAC,EAAE,CAAC,CAAA;;;;;;EAMnB,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/rollup-vite-utils",
|
|
3
|
-
"version": "6.0.6-alpha.
|
|
3
|
+
"version": "6.0.6-alpha.28",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"typescript": {
|
|
59
59
|
"definition": "lib/index.d.ts"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2dd620119d8418825998eec5736f462092bea01b"
|
|
62
62
|
}
|