@common-stack/rollup-vite-utils 6.0.6-alpha.50 → 6.0.6-alpha.52
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/generators/utils/resourceParams.cjs +10 -2
- package/lib/vite-wrappers/generators/utils/resourceParams.cjs.map +1 -1
- package/lib/vite-wrappers/generators/utils/resourceParams.d.ts +4 -1
- package/lib/vite-wrappers/generators/utils/resourceParams.js +10 -2
- package/lib/vite-wrappers/generators/utils/resourceParams.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use strict';/**
|
|
2
2
|
* Recursively process the resourceParams object and replace any placeholder values starting with `$params.`.
|
|
3
|
+
* If the `path` is empty or matches `IConfigCollectionName.Organization`, ensure it provides a default query
|
|
4
|
+
* with `{ name: $params.orgName }`.
|
|
3
5
|
*
|
|
4
6
|
* @param resourceParams - The nested resourceParams object containing placeholders.
|
|
5
7
|
* @param params - The params object from which values are extracted.
|
|
8
|
+
* @param defaultPath - Optional default path to be assigned when `path` is empty or a specific condition is met.
|
|
6
9
|
* @returns The processed resourceParams object with replaced values.
|
|
7
10
|
*/
|
|
8
|
-
function resolveResourceParamsPlaceholders(resourceParams, params) {
|
|
11
|
+
function resolveResourceParamsPlaceholders(resourceParams, params, defaultPath = 'IConfigCollectionName.Organization') {
|
|
9
12
|
if (!resourceParams || typeof resourceParams !== 'object')
|
|
10
13
|
return resourceParams;
|
|
11
14
|
const resolvedParams = {};
|
|
@@ -17,12 +20,17 @@ function resolveResourceParamsPlaceholders(resourceParams, params) {
|
|
|
17
20
|
}
|
|
18
21
|
else if (typeof value === 'object' && value !== null) {
|
|
19
22
|
// Recursively resolve nested objects
|
|
20
|
-
resolvedParams[key] = resolveResourceParamsPlaceholders(value, params);
|
|
23
|
+
resolvedParams[key] = resolveResourceParamsPlaceholders(value, params, defaultPath);
|
|
21
24
|
}
|
|
22
25
|
else {
|
|
23
26
|
// Direct assignment for other values
|
|
24
27
|
resolvedParams[key] = value;
|
|
25
28
|
}
|
|
26
29
|
});
|
|
30
|
+
// If the path is missing or matches `IConfigCollectionName.Organization`, ensure query is set
|
|
31
|
+
if (!resolvedParams.path || resolvedParams.path === defaultPath) {
|
|
32
|
+
resolvedParams.path = defaultPath;
|
|
33
|
+
resolvedParams.query = { name: params.orgName }; // Assuming `orgName` exists in params
|
|
34
|
+
}
|
|
27
35
|
return resolvedParams;
|
|
28
36
|
}exports.resolveResourceParamsPlaceholders=resolveResourceParamsPlaceholders;//# sourceMappingURL=resourceParams.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceParams.cjs","sources":["../../../../src/vite-wrappers/generators/utils/resourceParams.ts"],"sourcesContent":[null],"names":[],"mappings":"aAAA
|
|
1
|
+
{"version":3,"file":"resourceParams.cjs","sources":["../../../../src/vite-wrappers/generators/utils/resourceParams.ts"],"sourcesContent":[null],"names":[],"mappings":"aAAA;;;;;;;;;AASG;AACG,SAAU,iCAAiC,CAC7C,cAAmC,EACnC,MAA2B,EAC3B,cAAsB,oCAAoC,EAAA;AAE1D,IAAA,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ;AAAE,QAAA,OAAO,cAAc,CAAC;IAEjF,MAAM,cAAc,GAAwB,EAAE,CAAC;AAE/C,IAAA,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AACpD,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;;YAE3D,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;SAC1C;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;;AAEpD,YAAA,cAAc,CAAC,GAAG,CAAC,GAAG,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SACvF;aAAM;;AAEH,YAAA,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAC/B;AACL,KAAC,CAAC,CAAC;;IAGH,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,cAAc,CAAC,IAAI,KAAK,WAAW,EAAE;AAC7D,QAAA,cAAc,CAAC,IAAI,GAAG,WAAW,CAAC;AAClC,QAAA,cAAc,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;KACnD;AAED,IAAA,OAAO,cAAc,CAAC;AAC1B"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Recursively process the resourceParams object and replace any placeholder values starting with `$params.`.
|
|
3
|
+
* If the `path` is empty or matches `IConfigCollectionName.Organization`, ensure it provides a default query
|
|
4
|
+
* with `{ name: $params.orgName }`.
|
|
3
5
|
*
|
|
4
6
|
* @param resourceParams - The nested resourceParams object containing placeholders.
|
|
5
7
|
* @param params - The params object from which values are extracted.
|
|
8
|
+
* @param defaultPath - Optional default path to be assigned when `path` is empty or a specific condition is met.
|
|
6
9
|
* @returns The processed resourceParams object with replaced values.
|
|
7
10
|
*/
|
|
8
|
-
export declare function resolveResourceParamsPlaceholders(resourceParams: Record<string, any>, params: Record<string, any
|
|
11
|
+
export declare function resolveResourceParamsPlaceholders(resourceParams: Record<string, any>, params: Record<string, any>, defaultPath?: string): Record<string, any>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Recursively process the resourceParams object and replace any placeholder values starting with `$params.`.
|
|
3
|
+
* If the `path` is empty or matches `IConfigCollectionName.Organization`, ensure it provides a default query
|
|
4
|
+
* with `{ name: $params.orgName }`.
|
|
3
5
|
*
|
|
4
6
|
* @param resourceParams - The nested resourceParams object containing placeholders.
|
|
5
7
|
* @param params - The params object from which values are extracted.
|
|
8
|
+
* @param defaultPath - Optional default path to be assigned when `path` is empty or a specific condition is met.
|
|
6
9
|
* @returns The processed resourceParams object with replaced values.
|
|
7
10
|
*/
|
|
8
|
-
function resolveResourceParamsPlaceholders(resourceParams, params) {
|
|
11
|
+
function resolveResourceParamsPlaceholders(resourceParams, params, defaultPath = 'IConfigCollectionName.Organization') {
|
|
9
12
|
if (!resourceParams || typeof resourceParams !== 'object')
|
|
10
13
|
return resourceParams;
|
|
11
14
|
const resolvedParams = {};
|
|
@@ -17,12 +20,17 @@ function resolveResourceParamsPlaceholders(resourceParams, params) {
|
|
|
17
20
|
}
|
|
18
21
|
else if (typeof value === 'object' && value !== null) {
|
|
19
22
|
// Recursively resolve nested objects
|
|
20
|
-
resolvedParams[key] = resolveResourceParamsPlaceholders(value, params);
|
|
23
|
+
resolvedParams[key] = resolveResourceParamsPlaceholders(value, params, defaultPath);
|
|
21
24
|
}
|
|
22
25
|
else {
|
|
23
26
|
// Direct assignment for other values
|
|
24
27
|
resolvedParams[key] = value;
|
|
25
28
|
}
|
|
26
29
|
});
|
|
30
|
+
// If the path is missing or matches `IConfigCollectionName.Organization`, ensure query is set
|
|
31
|
+
if (!resolvedParams.path || resolvedParams.path === defaultPath) {
|
|
32
|
+
resolvedParams.path = defaultPath;
|
|
33
|
+
resolvedParams.query = { name: params.orgName }; // Assuming `orgName` exists in params
|
|
34
|
+
}
|
|
27
35
|
return resolvedParams;
|
|
28
36
|
}export{resolveResourceParamsPlaceholders};//# sourceMappingURL=resourceParams.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceParams.js","sources":["../../../../src/vite-wrappers/generators/utils/resourceParams.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resourceParams.js","sources":["../../../../src/vite-wrappers/generators/utils/resourceParams.ts"],"sourcesContent":[null],"names":[],"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.0.6-alpha.
|
|
3
|
+
"version": "6.0.6-alpha.52",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"typescript": {
|
|
60
60
|
"definition": "lib/index.d.ts"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1d829a89bea5b73190db400987ec7269db9379ba"
|
|
63
63
|
}
|