@omegup/msync 0.1.67 → 0.1.68
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/index.esm.js +147 -148
- package/index.esm.js.map +1 -1
- package/index.js +148 -147
- package/index.js.map +1 -1
- package/lib/expression/array.d.ts +3 -1
- package/lib/expression/val.d.ts +2 -2
- package/package.json +1 -1
- package/types/json.d.ts +6 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { App, Arr, HKT, N, O, RORec, notArr } from '../../types';
|
|
1
|
+
import type { App, Arr, HKT, KVEntry, N, O, RORec, notArr } from '../../types';
|
|
2
2
|
import type { Expr } from '../types';
|
|
3
3
|
export declare const size: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<number, D, C>;
|
|
4
4
|
export declare const filterDefined: <T, D, C = unknown>(expr: Expr<Arr<T | N>, D, C>) => Expr<Arr<T>, D, C>;
|
|
@@ -17,11 +17,13 @@ export declare const isArray: <T extends notArr, D, C, F extends HKT<T | Arr<T>>
|
|
|
17
17
|
export declare const inArray: <T, D, C>(item: Expr<T, D, C>, expr: Expr<Arr<T>, D, C>) => Expr<boolean, D, C>;
|
|
18
18
|
export declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
19
19
|
export declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
20
|
+
export declare const $setUnion: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
20
21
|
export declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
21
22
|
export declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
|
|
22
23
|
export declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
23
24
|
export type NullToOBJ<N extends null> = N extends null ? O : N;
|
|
24
25
|
export declare const mergeObjects: <T1, T2, D, C = unknown, N extends null = never>(...exprs: readonly [Expr<T1 | N, D, C>, ...[...Expr<T1 | T2 | N, D, C>[], Expr<T2, D, C>]]) => Expr<(T1 | NullToOBJ<N>) & T2, D, C>;
|
|
26
|
+
export declare const $objectToArray: <T extends O, D, C>(expr: Expr<T, D, C>) => Expr<Arr<KVEntry<T>>, D, C>;
|
|
25
27
|
export declare const anyElementTrue: <D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
|
|
26
28
|
type Reduce<T, V> = RORec<'value', V> & RORec<'this', T>;
|
|
27
29
|
export declare const $reduce: <T, V, D, C>(input: Expr<Arr<T>, D, C>, initialValue: Expr<V, D, C>, inExpr: Expr<V, D, C & Reduce<T, V>>) => Expr<V, D, C>;
|
package/lib/expression/val.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type { Expr } from '../types';
|
|
|
4
4
|
import type { ExprsExact } from './concat';
|
|
5
5
|
export declare const val: <T extends rawItem>(val: T) => Expr<T, unknown>;
|
|
6
6
|
export declare const current: Expr<Timestamp, unknown>;
|
|
7
|
+
export declare const $rand: Expr<number, unknown>;
|
|
8
|
+
export declare const rand: Expr<string, unknown, unknown>;
|
|
7
9
|
export declare const $let: <T, D, C, V extends object>(vars: ExprsExact<V, D, C>, inExpr: Expr<T, D, C & V>) => Expr<T, D, C>;
|
|
8
10
|
export declare const nil: Expr<null, unknown>;
|
|
9
11
|
export declare const $getField: {
|
|
@@ -14,5 +16,3 @@ export type AddO<T> = T extends notObj ? T : T extends Array<infer U> ? Arr<AddO
|
|
|
14
16
|
[K in keyof T]: AddO<T[K]>;
|
|
15
17
|
}>;
|
|
16
18
|
export declare const func: <T extends jsonItem, A extends readonly jsonItem[], D, C = unknown>(f: (...args: A) => T, ...args: { [X in keyof A]: Expr<AddO<A[X]>, D, C>; }) => Expr<AddO<T>, D, C>;
|
|
17
|
-
export declare const rand: () => string;
|
|
18
|
-
export declare const $rand: Expr<string, unknown, unknown>;
|
package/package.json
CHANGED
package/types/json.d.ts
CHANGED
|
@@ -61,3 +61,9 @@ export type AsLiteral<T extends keyof any | boolean | N, V = NoUnion<T>> = T ext
|
|
|
61
61
|
[K in T]: 1;
|
|
62
62
|
} ? never : V : V;
|
|
63
63
|
type NoUnion<T, V = T> = T extends T ? ([V] extends [T] ? T : never) : never;
|
|
64
|
+
export type KVEntry<T> = O<{
|
|
65
|
+
[K in StrKey<T>]: {
|
|
66
|
+
readonly k: K;
|
|
67
|
+
readonly v: T[K];
|
|
68
|
+
};
|
|
69
|
+
}[StrKey<T>]>;
|