@common-stack/rollup-vite-utils 6.0.8-alpha.33 → 6.0.8-alpha.38
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/tools/codegen/templates/common/src/configuration.ts.template +5 -0
- package/lib/tools/codegen/templates/common/src/index.ts.template +2 -0
- package/lib/tools/codegen/templates/common/src/permissions.ts.template +5 -0
- package/lib/tools/codegen/templates/common/src/types.ts.template +42 -0
- package/package.json +2 -2
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { IPreferences } from './generated/generated-models';
|
|
2
|
+
import { FlattenKeys } from './types';
|
|
3
|
+
|
|
1
4
|
export const enum ConfigurationTarget {
|
|
2
5
|
/**
|
|
3
6
|
* Targets the user/application configuraton file for writing.
|
|
@@ -30,3 +33,5 @@ export const enum ConfigurationTarget {
|
|
|
30
33
|
*/
|
|
31
34
|
MACHINE_OVERRIDABLE,
|
|
32
35
|
}
|
|
36
|
+
|
|
37
|
+
export type IConfigurationsFlattenedKeys = FlattenKeys<IPreferences>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type GetFlattenedValue<T, K extends string> = K extends ''
|
|
2
|
+
? T
|
|
3
|
+
: K extends `${infer Prop}.${infer Rest}`
|
|
4
|
+
? Prop extends keyof T
|
|
5
|
+
? GetFlattenedValue<T[Prop], Rest>
|
|
6
|
+
: never
|
|
7
|
+
: K extends keyof T
|
|
8
|
+
? T[K]
|
|
9
|
+
: never;
|
|
10
|
+
|
|
11
|
+
// Utility to limit recursion depth
|
|
12
|
+
export type Flatten<T, Prefix extends string = '', Depth extends number = 30> = [Depth] extends [never] // Check if depth limit is reached
|
|
13
|
+
? never
|
|
14
|
+
: {
|
|
15
|
+
[K in keyof T & (string | number)]: T[K] extends object
|
|
16
|
+
? Flatten<T[K], `${Prefix}${K}.`, Depth extends infer R ? R : never>
|
|
17
|
+
: `${Prefix}${K}`;
|
|
18
|
+
}[keyof T & (string | number)];
|
|
19
|
+
|
|
20
|
+
// Recursive type to flatten object keys with recursion depth limit
|
|
21
|
+
export type FlattenWithFinite<T, Depth extends number = 10, Prefix extends string = ''> = [Depth] extends [never]
|
|
22
|
+
? never
|
|
23
|
+
: {
|
|
24
|
+
[K in keyof T & (string | number)]: T[K] extends object
|
|
25
|
+
? FlattenWithFinite<T[K], Depth extends 1 ? never : Depth extends 2 ? 1 : 2, `${Prefix}${K}.`>
|
|
26
|
+
: `${Prefix}${K}`;
|
|
27
|
+
}[keyof T & (string | number)];
|
|
28
|
+
|
|
29
|
+
// Update the FlattenKeys type to handle circular references and add the empty key to return the entire preferences.
|
|
30
|
+
export type FlattenKeys<T> =
|
|
31
|
+
| ''
|
|
32
|
+
| (T extends object
|
|
33
|
+
? {
|
|
34
|
+
[K in keyof T]: T[K] extends object
|
|
35
|
+
? K extends string
|
|
36
|
+
? `${K}` | `${K}.${FlattenKeys<Omit<T[K], 'overrideOf'>>}`
|
|
37
|
+
: never
|
|
38
|
+
: K extends string
|
|
39
|
+
? `${K}`
|
|
40
|
+
: never;
|
|
41
|
+
}[keyof T]
|
|
42
|
+
: never);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/rollup-vite-utils",
|
|
3
|
-
"version": "6.0.8-alpha.
|
|
3
|
+
"version": "6.0.8-alpha.38",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "b5923dcd0bc3020fe2f6f4cbb0a49e61f277fa6e",
|
|
60
60
|
"typescript": {
|
|
61
61
|
"definition": "lib/index.d.ts"
|
|
62
62
|
}
|