@tstdl/base 0.93.73 → 0.93.74
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/package.json +4 -4
- package/types/types.d.ts +1 -3
- package/utils/helpers.d.ts +4 -2
- package/utils/helpers.js +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.93.
|
|
3
|
+
"version": "0.93.74",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"type-fest": "^5.3"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
|
-
"@genkit-ai/google-genai": "^1.
|
|
143
|
+
"@genkit-ai/google-genai": "^1.27",
|
|
144
144
|
"@google-cloud/storage": "^7.18",
|
|
145
145
|
"@google/genai": "^1.34",
|
|
146
146
|
"@toon-format/toon": "^2.1.0",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"@zxcvbn-ts/language-en": "^3.0",
|
|
152
152
|
"drizzle-orm": "^0.45",
|
|
153
153
|
"file-type": "^21.1",
|
|
154
|
-
"genkit": "^1.
|
|
154
|
+
"genkit": "^1.27",
|
|
155
155
|
"handlebars": "^4.7",
|
|
156
156
|
"minio": "^8.0",
|
|
157
157
|
"mjml": "^4.18",
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
"typedoc-plugin-markdown": "4.9",
|
|
188
188
|
"typedoc-plugin-missing-exports": "4.1",
|
|
189
189
|
"typescript": "5.9",
|
|
190
|
-
"typescript-eslint": "8.
|
|
190
|
+
"typescript-eslint": "8.50"
|
|
191
191
|
},
|
|
192
192
|
"overrides": {
|
|
193
193
|
"drizzle-kit": {
|
package/types/types.d.ts
CHANGED
|
@@ -190,11 +190,9 @@ export type DeepFlatten<T> = T extends readonly (infer R)[] ? DeepFlatten<R> : T
|
|
|
190
190
|
[P in keyof T]: DeepFlatten<T[P]>;
|
|
191
191
|
} : T;
|
|
192
192
|
export type DeepArray<T> = (T | DeepArray<T>)[];
|
|
193
|
-
export type DeepReadonly<T> = T extends BuiltIn ? T :
|
|
194
|
-
export type DeepReadonlyObject<T> = {
|
|
193
|
+
export type DeepReadonly<T> = T extends BuiltIn ? T : {
|
|
195
194
|
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
196
195
|
};
|
|
197
|
-
export type DeepReadonlyArray<T> = readonly DeepReadonly<T>[];
|
|
198
196
|
export type ReplaceKey<T, K extends keyof T, U> = SimplifyObject<{
|
|
199
197
|
[P in keyof T]: P extends K ? U : T[P];
|
|
200
198
|
}>;
|
package/utils/helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeepArray, Record } from '../types/index.js';
|
|
1
|
+
import type { DeepArray, DeepReadonly, Record } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Create an structured clone of an value using Notification if available, otherwise history state (may alters history)
|
|
4
4
|
*
|
|
@@ -17,7 +17,9 @@ export declare function structuredClone<T>(value: T): T;
|
|
|
17
17
|
export declare function structuredCloneAsync<T>(value: T, options?: {
|
|
18
18
|
transfer?: any[];
|
|
19
19
|
}): Promise<T>;
|
|
20
|
-
export declare function valueOfType<T>(value: T): T;
|
|
20
|
+
export declare function valueOfType<const T>(value: T): T;
|
|
21
|
+
export declare function frozenValueOfType<const T>(value: T): Readonly<T>;
|
|
22
|
+
export declare function deepFrozenValueOfType<const T>(value: T): DeepReadonly<T>;
|
|
21
23
|
export declare function flatten<T>(array: DeepArray<T>): T[];
|
|
22
24
|
export declare function toError(obj: any): Error;
|
|
23
25
|
export declare function select<T extends Record, K extends keyof T>(key: K): (item: T) => T[K];
|
package/utils/helpers.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DetailsError } from '../errors/details.error.js';
|
|
2
2
|
import { supportsNotification } from '../supports.js';
|
|
3
3
|
import { decycle } from './object/decycle.js';
|
|
4
|
-
import {
|
|
4
|
+
import { mapObjectValues } from './object/object.js';
|
|
5
|
+
import { isArray, isObject } from './type-guards.js';
|
|
5
6
|
/**
|
|
6
7
|
* Create an structured clone of an value using Notification if available, otherwise history state (may alters history)
|
|
7
8
|
*
|
|
@@ -35,6 +36,17 @@ export async function structuredCloneAsync(value, options) {
|
|
|
35
36
|
export function valueOfType(value) {
|
|
36
37
|
return value;
|
|
37
38
|
}
|
|
39
|
+
export function frozenValueOfType(value) {
|
|
40
|
+
return Object.freeze(value);
|
|
41
|
+
}
|
|
42
|
+
export function deepFrozenValueOfType(value) {
|
|
43
|
+
const valueToFreeze = isArray(value)
|
|
44
|
+
? value.map(deepFrozenValueOfType)
|
|
45
|
+
: isObject(value)
|
|
46
|
+
? mapObjectValues(value, deepFrozenValueOfType)
|
|
47
|
+
: value;
|
|
48
|
+
return Object.freeze(valueToFreeze);
|
|
49
|
+
}
|
|
38
50
|
export function flatten(array) {
|
|
39
51
|
return array.reduce((acc, item) => (isArray(item) ? [...(acc), ...flatten(item)] : [...(acc), item]), []);
|
|
40
52
|
}
|