@common-stack/rollup-vite-utils 6.0.8-alpha.37 → 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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPreferences } from './generated/generated-models';
|
|
2
|
-
import {
|
|
2
|
+
import { FlattenKeys } from './types';
|
|
3
3
|
|
|
4
4
|
export const enum ConfigurationTarget {
|
|
5
5
|
/**
|
|
@@ -34,4 +34,4 @@ export const enum ConfigurationTarget {
|
|
|
34
34
|
MACHINE_OVERRIDABLE,
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export type IConfigurationsFlattenedKeys =
|
|
37
|
+
export type IConfigurationsFlattenedKeys = FlattenKeys<IPreferences>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
export type GetFlattenedValue<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
: never;
|
|
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;
|
|
11
10
|
|
|
12
11
|
// Utility to limit recursion depth
|
|
13
12
|
export type Flatten<T, Prefix extends string = '', Depth extends number = 30> = [Depth] extends [never] // Check if depth limit is reached
|
|
@@ -26,3 +25,18 @@ export type FlattenWithFinite<T, Depth extends number = 10, Prefix extends strin
|
|
|
26
25
|
? FlattenWithFinite<T[K], Depth extends 1 ? never : Depth extends 2 ? 1 : 2, `${Prefix}${K}.`>
|
|
27
26
|
: `${Prefix}${K}`;
|
|
28
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
|
}
|