@omegup/msync 0.1.61 → 0.1.62
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.d.ts +13 -847
- package/index.esm.js +1986 -2233
- package/index.esm.js.map +1 -0
- package/index.js +1992 -2244
- package/index.js.map +1 -0
- package/lib/aggregate/$merge.d.ts +9 -9
- package/lib/aggregate/$upsert.d.ts +6 -6
- package/lib/aggregate/group/$group-merge.d.ts +9 -10
- package/lib/aggregate/group/utils/sub-group.d.ts +1 -1
- package/lib/aggregate/group/utils/sub-merge.d.ts +27 -4
- package/lib/aggregate/lookup/$lookup-delta.d.ts +2 -2
- package/lib/aggregate/lookup/$lookup-raw.d.ts +3 -3
- package/lib/aggregate/mongo-stages.d.ts +3 -2
- package/lib/aggregate/prefix.d.ts +5 -5
- package/lib/aggregate/raws.d.ts +1 -1
- package/lib/aggregate/set/$replace-with-each.d.ts +5 -5
- package/lib/aggregate/set/$set.d.ts +1 -1
- package/lib/aggregate/unwind/$unwind-delta.d.ts +1 -1
- package/lib/aggregate/unwind/index.d.ts +2 -2
- package/lib/boot/boot-simpl.d.ts +1 -1
- package/lib/boot/boot-utils.d.ts +1 -1
- package/lib/expression/concat.d.ts +4 -4
- package/lib/expression/date.d.ts +3 -3
- package/lib/expression/expr-base.d.ts +2 -2
- package/lib/expression/logic.d.ts +1 -1
- package/lib/expression/range.d.ts +2 -2
- package/lib/expression/val.d.ts +2 -2
- package/lib/field/field.d.ts +1 -1
- package/lib/predicate/$eq.d.ts +2 -2
- package/lib/types/accumulator.d.ts +2 -2
- package/lib/update/updater.d.ts +1 -1
- package/lib/utils/coll.d.ts +2 -2
- package/lib/utils/db-indexes.d.ts +1 -1
- package/lib/utils/guard.d.ts +2 -12
- package/lib/utils/json.d.ts +1 -0
- package/lib/utils/map-object.d.ts +1 -1
- package/package.json +22 -22
- package/types/global.d.ts +2 -0
- package/types/json.d.ts +1 -0
package/index.d.ts
CHANGED
|
@@ -1,847 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare const object: unique symbol;
|
|
15
|
-
declare const array$1: unique symbol;
|
|
16
|
-
type A$1 = {
|
|
17
|
-
[Type]: typeof array$1;
|
|
18
|
-
};
|
|
19
|
-
type Arr<T, N extends number = number> = A$1 & {
|
|
20
|
-
readonly [_ in N]: T;
|
|
21
|
-
};
|
|
22
|
-
type Obj = {
|
|
23
|
-
[Type]: typeof object;
|
|
24
|
-
};
|
|
25
|
-
type O<T = unknown> = Obj & T;
|
|
26
|
-
type RORec<K extends keyof never, T = unknown> = {
|
|
27
|
-
readonly [P in K]: T;
|
|
28
|
-
};
|
|
29
|
-
type PRRec<K extends keyof never, T = unknown> = {
|
|
30
|
-
[P in K]?: T;
|
|
31
|
-
};
|
|
32
|
-
type Par$1<K extends string, V extends Rec<K, jsonItem>> = {
|
|
33
|
-
readonly [k in K]?: V[k] | N;
|
|
34
|
-
};
|
|
35
|
-
type Rec<K extends string, T = unknown> = O<RORec<K, T>>;
|
|
36
|
-
type O2 = readonly [O, O];
|
|
37
|
-
type O3 = readonly [O, O, O];
|
|
38
|
-
type ID = {
|
|
39
|
-
readonly _id: string;
|
|
40
|
-
};
|
|
41
|
-
type doc = O & ID;
|
|
42
|
-
interface RawObj {
|
|
43
|
-
readonly [_: string]: rawItem | U;
|
|
44
|
-
}
|
|
45
|
-
type raw = readonly rawItem[] | RawObj;
|
|
46
|
-
type StrKey<T> = string & keyof T;
|
|
47
|
-
type Replace<R, V> = Omit<R, StrKey<V>> & V & O;
|
|
48
|
-
type ReplaceQ<R extends Q, VV, Q extends O> = Omit<R, StrKey<VV>> & Omit<VV, StrKey<Q>> & Q;
|
|
49
|
-
type AsLiteral<T extends keyof any | boolean | N, V = NoUnion<T>> = T extends keyof any ? {} extends {
|
|
50
|
-
[K in T]: 1;
|
|
51
|
-
} ? never : V : V;
|
|
52
|
-
type NoUnion<T, V = T> = T extends T ? ([V] extends [T] ? T : never) : never;
|
|
53
|
-
|
|
54
|
-
type HasJob = {
|
|
55
|
-
job: object | undefined;
|
|
56
|
-
};
|
|
57
|
-
type Runner<T, Info extends HasJob> = Iterator<T, Info>;
|
|
58
|
-
type NextFrame<T, Info> = PromiseLike<Frame<T, Info>>;
|
|
59
|
-
type Frame<T, Info> = {
|
|
60
|
-
data: T;
|
|
61
|
-
info: Info;
|
|
62
|
-
cont: Iterator<T, Info>;
|
|
63
|
-
};
|
|
64
|
-
type IteratorResult<out T, out Info> = {
|
|
65
|
-
next: NextFrame<T, Info>;
|
|
66
|
-
stop: Iterator<T, Info>;
|
|
67
|
-
clear: () => Promise<unknown>;
|
|
68
|
-
};
|
|
69
|
-
type Iterator<out T, out Info> = () => IteratorResult<T, Info>;
|
|
70
|
-
|
|
71
|
-
declare const PredicateRaw: unique symbol;
|
|
72
|
-
type PredicateRaw = RawObj & {
|
|
73
|
-
[Type]?(x: typeof PredicateRaw): void;
|
|
74
|
-
};
|
|
75
|
-
declare const Predicate: unique symbol;
|
|
76
|
-
interface Predicate<in V> {
|
|
77
|
-
[Type]?(x: typeof Predicate, _: V): void;
|
|
78
|
-
raw: PredicateRaw;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
declare class Field<in R, out V, in C = unknown> {
|
|
82
|
-
private field;
|
|
83
|
-
private raw;
|
|
84
|
-
private concat;
|
|
85
|
-
has<R extends O>(this: Field<R, V>, p: Predicate<V>): Query<R, C>;
|
|
86
|
-
has<R extends O, V>(this: Field<R, Arr<V>>, p: Predicate<V>): Query<R, C>;
|
|
87
|
-
private constructor();
|
|
88
|
-
static root: <T extends O>() => Field<T, T, unknown>;
|
|
89
|
-
static ctx: <T>() => <K extends string>(k: K) => Field<unknown, T, RORec<K, T>>;
|
|
90
|
-
of<V, K extends keyof V, _ extends 0 = 0>(this: Field<R, Arr<V>, C>, k: AsLiteral<K>): Field<R, Arr<V[K]>, C>;
|
|
91
|
-
of<V, K extends keyof V, _ extends 1 = 1>(this: Field<R, O<V>, C>, k: K): Field<R, V[K], C>;
|
|
92
|
-
of<V, K extends keyof V, I extends N = never, _ extends 2 = 2>(this: Field<R, Arr<V> | Undef<I>, C>, k: K): Field<R, Arr<V[K]> | I, C>;
|
|
93
|
-
of<V, K extends keyof V, I extends N = never, _ extends 3 = 3>(this: Field<R, O<V> | Undef<I>, C>, k: K): Field<R, V[K] | I, C>;
|
|
94
|
-
with<V, W, C2 = unknown, _ extends 0 = 0>(this: Field<R, O<V>, C>, k: Field<O<V>, W, C2>): Field<R, W, C & C2>;
|
|
95
|
-
with<V, W, C2 = unknown, _ extends 1 = 1>(this: Field<R, Arr<V>, C>, k: Field<O<V>, Arr<W> | O<W>, C2>): Field<R, Arr<W>, C & C2>;
|
|
96
|
-
with<V, W, I extends N = never, C2 = unknown, _ extends 2 = 2>(this: Field<R, O<V> | Undef<I>, C>, k: Field<O<V>, W, C2>): Field<R, W | I, C & C2>;
|
|
97
|
-
with<V, W, I extends N = never, C2 = unknown, _ extends 3 = 3>(this: Field<R, Arr<V> | Undef<I>, C>, k: Field<O<V>, Arr<W> | O<W>, C2>): Field<R, Arr<W> | I, C & C2>;
|
|
98
|
-
str(this: Field<R, V>): string;
|
|
99
|
-
private exprRaw;
|
|
100
|
-
expr<R, V, C = unknown>(this: Field<R, V, C>): Expr<V, R, C>;
|
|
101
|
-
}
|
|
102
|
-
declare const root: <T extends O>() => Field<T, T, unknown>;
|
|
103
|
-
declare const ctx: <T>() => <K extends string>(k: K) => Field<unknown, T, RORec<K, T>>;
|
|
104
|
-
|
|
105
|
-
declare const QueryRaw: unique symbol;
|
|
106
|
-
type QueryRaw<T, C = unknown> = RawObj & {
|
|
107
|
-
[Type]?(x: typeof QueryRaw, y: T, c: C): void;
|
|
108
|
-
};
|
|
109
|
-
declare const Query: unique symbol;
|
|
110
|
-
type Query<in T extends O, in C = unknown> = {
|
|
111
|
-
[Type]?(x: typeof Query, y: T, c: C): void;
|
|
112
|
-
raw: <DeltaT extends O>(f: Field<DeltaT, T>) => QueryRaw<DeltaT, C>;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
declare const RawStage$1: unique symbol;
|
|
116
|
-
type RawArr = readonly RawObj[];
|
|
117
|
-
interface RawStages<out Q, in S extends Q, out R extends Q, in C = unknown, out M = number> extends RawArr {
|
|
118
|
-
[Type]?(_: typeof RawStage$1, source: S, ctx: C, q: Q): readonly [typeof RawStage$1, R, M, Q];
|
|
119
|
-
}
|
|
120
|
-
type FRawStages<out Q, in S extends Q & O, out R extends Q & O, in C = unknown, out M extends number = number> = <F extends HKT<O, O>>(f: <T extends O>() => Field<App<F, T>, T>) => RawStages<App<F, Q & O>, App<F, S>, App<F, R>, C, M>;
|
|
121
|
-
type DeltaStages<out Q, in S extends Q & O, out R extends Q & O, in C = unknown> = {
|
|
122
|
-
delta: RawStages<unknown, Delta<S>, Delta<R>, C>;
|
|
123
|
-
raw: FRawStages<Q, S, R, C>;
|
|
124
|
-
};
|
|
125
|
-
type LinStages<out Q, in S extends Q, out R extends Q, in C = unknown> = {
|
|
126
|
-
lin: RawStages<Q, S, R, C, 1>;
|
|
127
|
-
};
|
|
128
|
-
type TStages<in out S, out Q, in out B extends Q, out R extends Q, M extends number = number> = {
|
|
129
|
-
coll: ReadonlyCollection<S>;
|
|
130
|
-
input: RawStages<unknown, S, S & B, unknown, M>;
|
|
131
|
-
exec: RawStages<Q, B, R, unknown, M>;
|
|
132
|
-
};
|
|
133
|
-
type Stages<out Q, out R extends Q, out SDom> = <E>(consume: <S extends SDom, B extends Q>(value: TStages<S, Q, B, R>) => E) => E;
|
|
134
|
-
type Actions<W> = {
|
|
135
|
-
updateMany: [Filter<W>, UpdateFilter<W> | BSON.Document[]];
|
|
136
|
-
deleteMany: [Filter<W>];
|
|
137
|
-
};
|
|
138
|
-
type TeardownRecord<W, M extends keyof Actions<W>> = {
|
|
139
|
-
collection: WriteonlyCollection<W>;
|
|
140
|
-
method: M;
|
|
141
|
-
params: Actions<W>[M];
|
|
142
|
-
};
|
|
143
|
-
type StreamRunnerParam<in V, out Result> = {
|
|
144
|
-
raw: (first: boolean) => RawStages<unknown, V, Result>;
|
|
145
|
-
teardown: <R>(consume: <W, M extends keyof Actions<W>>(x: TeardownRecord<W, M>) => R) => R;
|
|
146
|
-
};
|
|
147
|
-
type StreamRunner<out V> = <Result>(input: StreamRunnerParam<V, Result>, setup?: () => Promise<void>) => Runner<readonly Result[], HasJob>;
|
|
148
|
-
type SimpleStreamExecutionResult<out Q, out V extends Q> = {
|
|
149
|
-
readonly out: StreamRunner<V>;
|
|
150
|
-
};
|
|
151
|
-
type SnapshotStreamExecutionResult<out Q, out V extends Q> = {
|
|
152
|
-
readonly out: StreamRunner<Delta<V>>;
|
|
153
|
-
readonly stages: Stages<Before<Q>, Before<V>, UBefore<Q>>;
|
|
154
|
-
};
|
|
155
|
-
type Stream<out Q extends O, in out T extends Q, in out F extends HKT<[O, O]>, in out G extends HKT<[O, O, O]>> = <Q2 extends O, Result extends Q2>(input: App<G, [Q2 | T, T, Result]>) => App<F, [Q | Q2, Result]>;
|
|
156
|
-
type TS = {
|
|
157
|
-
readonly touchedAt: Timestamp;
|
|
158
|
-
};
|
|
159
|
-
type IsDeleted = {
|
|
160
|
-
readonly deletedAt: Timestamp;
|
|
161
|
-
};
|
|
162
|
-
type DDel = IsDeleted & ID & TS;
|
|
163
|
-
type Del = O<DDel>;
|
|
164
|
-
type DeletedAt = {
|
|
165
|
-
readonly deletedAt?: Timestamp | null | undefined;
|
|
166
|
-
};
|
|
167
|
-
type D = O<DeletedAt & ID>;
|
|
168
|
-
type Model = D & TS;
|
|
169
|
-
type BA = 'before' | 'after';
|
|
170
|
-
type PreDelta<T, K extends BA = BA, E = unknown> = Rec<K, T> & E;
|
|
171
|
-
type NTrue = true | N;
|
|
172
|
-
type DeletedFlags = Rec<BA, NTrue>;
|
|
173
|
-
type Deleted = {
|
|
174
|
-
readonly deleted?: DeletedFlags;
|
|
175
|
-
};
|
|
176
|
-
type Delta<T, K extends BA = BA, E = ID & Deleted> = PreDelta<T | null, K, E> & ({
|
|
177
|
-
after: T;
|
|
178
|
-
} | {
|
|
179
|
-
before: T;
|
|
180
|
-
});
|
|
181
|
-
type Before<T> = PreDelta<T, 'before'>;
|
|
182
|
-
type UBefore<T> = O & {
|
|
183
|
-
readonly before?: T | null;
|
|
184
|
-
};
|
|
185
|
-
type SnapshotStream<out Q extends O, in out T extends Q> = <Q2 extends O, Result extends Q2>(input: DeltaStages<Q2 | T, T, Result>) => SnapshotStreamExecutionResult<Q | Q2, Result>;
|
|
186
|
-
|
|
187
|
-
declare const ExprRaw: unique symbol;
|
|
188
|
-
type ExprRaw<out T, in Doc, in Ctx = unknown> = {
|
|
189
|
-
[Type]?(x: typeof ExprRaw): void;
|
|
190
|
-
[ExprRaw]?(doc: Doc, ctx: Ctx): T;
|
|
191
|
-
get: () => rawItem;
|
|
192
|
-
};
|
|
193
|
-
declare const Expr: unique symbol;
|
|
194
|
-
type Expr<out T, in Doc, in Ctx = unknown> = {
|
|
195
|
-
[Type]?(x: typeof Expr): void;
|
|
196
|
-
[Expr]?(doc: Doc, ctx: Ctx): T;
|
|
197
|
-
raw: {
|
|
198
|
-
<DeltaD extends O, I extends U, C = unknown>(f: Field<DeltaD, Doc | Undef<I>, C>): ExprRaw<T | I, DeltaD, Ctx & C>;
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
type BoolExpr<in D1, in D2, in Ctx = unknown> = {
|
|
202
|
-
[Type]?(x: typeof Expr): void;
|
|
203
|
-
[Expr](doc: D1, ctx: Ctx): true;
|
|
204
|
-
[Expr](doc: D2, ctx: Ctx): false;
|
|
205
|
-
raw: {
|
|
206
|
-
<DeltaD extends O, I extends U, C = unknown>(f: Field<DeltaD, D1 | D2 | Undef<I>, C>): ExprRaw<boolean, DeltaD, Ctx & C>;
|
|
207
|
-
<DeltaD extends O, I extends U, C = unknown>(f: Field<DeltaD, D1 | Undef<I>, C>): ExprRaw<true, DeltaD, Ctx & C>;
|
|
208
|
-
<DeltaD extends O, I extends U, C = unknown>(f: Field<DeltaD, D2 | Undef<I>, C>): ExprRaw<false, DeltaD, Ctx & C>;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
declare const map: <T, K extends string & keyof T, V extends RORec<K, unknown>>(x: Pick<T, K>, f: <P extends K>(v: T[P], k: P) => V[P]) => V;
|
|
213
|
-
type ExactPart<T, F extends HKT<T[StrKey<T>]>> = MapOPart<T, MappedHKT<T, F>>;
|
|
214
|
-
type ExactPart1<T, F extends HKT<StrKey<T>>> = {
|
|
215
|
-
readonly [K in StrKey<T>]: App<F, K>;
|
|
216
|
-
};
|
|
217
|
-
type s$3 = string;
|
|
218
|
-
type MapKDom<RK extends MapKDom<RK, F>, F extends HKT<StrKey<RK>>> = MapO<RK, F> & {
|
|
219
|
-
readonly [P in s$3]?: readonly [keyof RK, unknown];
|
|
220
|
-
};
|
|
221
|
-
type ExactKeys<K extends string> = Exact<RORec<K, 1>, IdHKT>;
|
|
222
|
-
type MapO<T, F extends HKT<K>, K extends StrKey<T> = StrKey<T>> = MapOPart<T, F, K> & {
|
|
223
|
-
readonly [P: string]: readonly [K, unknown];
|
|
224
|
-
};
|
|
225
|
-
type MapK<K extends s$3, F extends HKT<K>> = MapO<RORec<K>, F>;
|
|
226
|
-
type MapOPart<T, F extends HKT<K>, K extends keyof T = StrKey<T>> = {
|
|
227
|
-
readonly [P in K]: readonly [P, App<F, P & string>];
|
|
228
|
-
};
|
|
229
|
-
type MapKPart1<T, F extends HKT<K>, K extends StrKey<T> = StrKey<T>> = {
|
|
230
|
-
readonly [P in K]: App<F, P>;
|
|
231
|
-
};
|
|
232
|
-
type Exact<T, F extends HKT<T[StrKey<T>]>> = MapO<T, MappedHKT<T, F>>;
|
|
233
|
-
interface MappedHKT<T, F extends HKT<T[StrKey<T>]>> extends HKT<StrKey<T>> {
|
|
234
|
-
readonly out: App<F, T[I<StrKey<T>, this>]>;
|
|
235
|
-
}
|
|
236
|
-
declare const mapExactToObject0: <T, F extends HKT<K>, G extends HKT<K>, K extends StrKey<T> = StrKey<T>>(x: MapO<T, F, K>, f: <P extends K>(v: App<F, P>, k: P) => App<G, P>) => MapKPart1<T, G, K>;
|
|
237
|
-
declare const mapExactToObject1: <K extends string, F extends HKT<K>, G extends HKT<K>>(x: MapK<K, F>, f: <P extends K>(v: App<F, P>, k: P) => App<G, P>) => MapKPart1<RORec<K>, G>;
|
|
238
|
-
interface WithKey1<K extends string, G extends HKT<K>> extends HKT<K> {
|
|
239
|
-
readonly out: readonly [I<K, this>, App<G, I<K, this>>];
|
|
240
|
-
}
|
|
241
|
-
declare const mapExact0: <T, F extends HKT<StrKey<T>>, G extends HKT<StrKey<T>>>(x: MapO<T, F>, f: <P extends StrKey<T>>(v: App<F, P>, k: P) => App<G, P>) => MapO<T, G>;
|
|
242
|
-
declare const mapExact1: <K extends s$3, F extends HKT<K>, G extends HKT<K>>(x: MapK<K, F>, f: <P extends K>(v: App<F, P>, k: P) => App<G, P>) => MapK<K, G>;
|
|
243
|
-
declare const mapExactToObject: <T, F extends HKT<T[StrKey<T>]>, G extends HKT<StrKey<T>>>(x: Exact<T, F>, f: <P extends StrKey<T>>(v: App<F, T[P]>, k: P) => App<G, P>) => ExactPart1<T, G>;
|
|
244
|
-
declare const mapExact: <T, F extends HKT<T[StrKey<T>]>, G extends HKT<T[StrKey<T>]>>(x: Exact<T, F>, f: <P extends StrKey<T>>(v: App<F, T[P]>, k: P) => App<G, T[P]>) => Exact<T, G>;
|
|
245
|
-
type Dom$1<T, V> = HKT<T[StrKey<T>] | V[StrKey<V>]>;
|
|
246
|
-
declare const spread: <T, V, F extends Dom$1<T, V>, EK extends symbol = never, EE = unknown, No extends keyof V = never>(a: Exact<Omit<T, No>, F>, b: Exact<V, F>) => Exact<V & Omit<T, keyof V> & Record<EK, EE>, F>;
|
|
247
|
-
interface MergeHKT<T, V, F1 extends HKT<StrKey<Omit<T, No>>>, F2 extends HKT<StrKey<V>>, No extends keyof V = never> extends HKT<StrKey<V & Omit<T, No>>> {
|
|
248
|
-
readonly out: I<StrKey<V & Omit<T, No>>, this> extends StrKey<V> ? App<F2, I<StrKey<V>, this>> : App<F1, I<StrKey<Omit<T, No>>, this>>;
|
|
249
|
-
}
|
|
250
|
-
declare const spread0: <T, V, F1 extends HKT<StrKey<Omit<T, No>>>, F2 extends HKT<StrKey<V>>, E = unknown, No extends keyof V = never>(a: MapO<Omit<T, No>, F1>, b: MapO<V, F2>) => MapO<V & Omit<T, No> & Pick<E, symbol & keyof E>, MergeHKT<T, V, F1, F2, No>>;
|
|
251
|
-
|
|
252
|
-
declare const AccumulatorRaw: unique symbol;
|
|
253
|
-
interface AccumulatorRaw<in Doc, out T, in C = unknown> extends RawObj {
|
|
254
|
-
[Type](_: typeof AccumulatorRaw, source: Doc, ctx: C): readonly [typeof AccumulatorRaw, T];
|
|
255
|
-
}
|
|
256
|
-
interface AccumulatorHKT<T, C = unknown> extends HKT<unknown> {
|
|
257
|
-
readonly out: Accumulator<T, I<unknown, this>, C>;
|
|
258
|
-
}
|
|
259
|
-
type Accumulators<T, V extends RORec<string, jsonItem>, C = unknown> = Exact<V, AccumulatorHKT<T, C>>;
|
|
260
|
-
interface DeltaAccumulatorHKT<T, C = unknown> extends HKT<unknown> {
|
|
261
|
-
readonly out: DeltaAccumulator<T, I<unknown, this>, C>;
|
|
262
|
-
}
|
|
263
|
-
type DeltaAccumulators<T, V extends RORec<string, jsonItem>, C = unknown> = Exact<V, DeltaAccumulatorHKT<T, C>>;
|
|
264
|
-
declare const Accumulator: unique symbol;
|
|
265
|
-
type Accumulator<in Doc, out T, in Ctx = unknown> = {
|
|
266
|
-
[Type]?(_: typeof Accumulator): typeof Accumulator;
|
|
267
|
-
raw: {
|
|
268
|
-
<DeltaD extends O, I extends U>(f: Field<DeltaD, Doc | Undef<I>>): AccumulatorRaw<T | I, DeltaD, Ctx>;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
type Part<Doc> = Rec<'v', Doc> & RORec<'old', boolean> & {
|
|
272
|
-
readonly deleted?: true | N;
|
|
273
|
-
};
|
|
274
|
-
type DeltaAccumulator<in out Doc, in out T, in out Ctx = unknown> = {
|
|
275
|
-
group: Accumulator<Part<Doc>, T, Ctx>;
|
|
276
|
-
merge: <D, C = Ctx>(a: Expr<T | N, D, C>, b: Expr<T, D, C>) => Expr<T, D, C>;
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
declare const concat: {
|
|
280
|
-
<D, C>(...expr: Expr<string, D, C>[]): Expr<string, D, C>;
|
|
281
|
-
<D, C>(...expr: Expr<string | N, D, C>[]): Expr<string | N, D, C>;
|
|
282
|
-
};
|
|
283
|
-
declare const $substr: <D, C>(expr: Expr<string, D, C>, start: Expr<number, D, C>, length: Expr<number, D, C>) => Expr<string, D, C>;
|
|
284
|
-
declare const padLeft: <D, C>(expr: Expr<string, D, C>, pad: string) => Expr<string, D, C>;
|
|
285
|
-
declare const regex: <D, C>(expr: Expr<string, D, C>, regex: Expr<string, D, C>, options?: Expr<string, D, C>) => Expr<boolean, D, C>;
|
|
286
|
-
declare const str: <D, C>(expr: Expr<unknown, D, C>) => Expr<string, D, C>;
|
|
287
|
-
declare const toInt: <D, C>(expr: Expr<unknown, D, C>) => Expr<number, D, C>;
|
|
288
|
-
declare const fieldM: <M extends RORec<Dom, Ref>, T extends RORec<Ref, unknown>, D, Dom extends string = StrKey<M>, Ref extends string = StrKey<T>, C = unknown>(expr: { readonly [K in Ref]: Expr<T[K], D, C>; }, m: Pick<M, Dom>) => Expr<O<{ readonly [K in Dom]: T[M[K]]; }>, D, C>;
|
|
289
|
-
type Exprs<out T, in D, in C = unknown> = {
|
|
290
|
-
readonly [K in StrKey<T>]: Expr<T[K], D, C>;
|
|
291
|
-
};
|
|
292
|
-
declare const mergeExact: <T1, T2, F extends HKT<T1[StrKey<T1>] | T2[StrKey<T2>]>, EK extends symbol = never, EE = unknown>(exprsExact1: Exact<Omit<T1, keyof T2>, F>, exprsExact2: Exact<T2, F>) => Exact<T2 & Omit<T1, keyof T2> & Record<EK, EE>, F>;
|
|
293
|
-
type MergeMapOArgs<T1, T2, F1 extends HKT<StrKey<Omit<T1, StrKey<T2>>>>, F2 extends HKT<StrKey<T2>>> = readonly [MapO<Omit<T1, StrKey<T2>>, F1>, MapO<T2, F2>];
|
|
294
|
-
declare const mergeExact0: <T1, T2, F1 extends HKT<StrKey<Omit<T1, StrKey<T2>>>>, F2 extends HKT<StrKey<T2>>, E = unknown>(exprsExact1: MapO<Omit<T1, StrKey<T2>>, F1>, exprsExact2: MapO<T2, F2>) => MapO<T2 & Omit<T1, StrKey<T2>> & Pick<E, symbol & keyof E>, MergeHKT<T1, T2, F1, F2, StrKey<T2>>>;
|
|
295
|
-
declare const mergeExpr: <T1, T2, D, C = unknown, EK extends symbol = never, EE = unknown>(exprs_0: Exact<Omit<T1, keyof T2>, ExprHKT<D, C, IdHKT<unknown>>>, exprs_1: Exact<T2, ExprHKT<D, C, IdHKT<unknown>>>) => ExprsExact<T2 & Omit<T1, keyof T2> & Record<EK, EE>, D, C>;
|
|
296
|
-
type ExprsPart<T, D, C> = ExactPart<T, ExprHKT<D, C>>;
|
|
297
|
-
interface ExprHKT<D, C = unknown, F extends HKT = IdHKT> extends HKT<unknown> {
|
|
298
|
-
readonly out: Expr<App<F, I<unknown, this>>, D, C>;
|
|
299
|
-
}
|
|
300
|
-
type ExprsExact<T, D, C = unknown, F extends HKT = IdHKT> = Exact<T, ExprHKT<D, C, F>>;
|
|
301
|
-
interface ExprsExactHKT<E, D, C = unknown, F extends HKT = IdHKT> extends HKT {
|
|
302
|
-
readonly out: ExprsExact<E & I<unknown, this>, D, C, F>;
|
|
303
|
-
}
|
|
304
|
-
declare const fieldF: <F extends HKT>() => <T extends object, D, C = unknown>(exprs: ExprsExact<T, D, C, F>) => Expr<O<{ [K in keyof T]: App<F, T[K]>; }>, D, C>;
|
|
305
|
-
declare const field: <T extends object, D, C = unknown>(exprs: ExprsExact<T, D, C>) => Expr<O<T>, D, C>;
|
|
306
|
-
|
|
307
|
-
interface HKT<in Dom = unknown, out Im = unknown> {
|
|
308
|
-
readonly in: (x: Dom) => void;
|
|
309
|
-
readonly out: Im;
|
|
310
|
-
}
|
|
311
|
-
type App<F extends HKT<X>, X> = (F & {
|
|
312
|
-
readonly in: (x: X) => void;
|
|
313
|
-
})['out'];
|
|
314
|
-
type I<Dom, F extends HKT<Dom>> = F['in'] extends (x: infer X extends Dom) => void ? X : never;
|
|
315
|
-
interface ArrHKT<Dom = unknown> extends HKT<Dom> {
|
|
316
|
-
readonly out: readonly I<Dom, this>[];
|
|
317
|
-
}
|
|
318
|
-
interface IdHKT<Dom = unknown> extends HKT<Dom> {
|
|
319
|
-
readonly out: I<Dom, this>;
|
|
320
|
-
}
|
|
321
|
-
interface RConstHKT<Im, Dom = Im> extends HKT<Im, HKT<Dom, Im>> {
|
|
322
|
-
readonly out: ConstHKT<I<Im, this>, Dom>;
|
|
323
|
-
}
|
|
324
|
-
interface ConstHKT<Im, Dom = unknown> extends HKT<Dom, Im> {
|
|
325
|
-
readonly out: Im;
|
|
326
|
-
}
|
|
327
|
-
type ApplyF<Dom, Im, T extends [Dom, HKT<Dom, Im>]> = App<T[1], T[0]>;
|
|
328
|
-
interface ApplyHKT<Dom, Im> extends HKT<[Dom, HKT<Dom, Im>], Im> {
|
|
329
|
-
readonly out: ApplyF<Dom, Im, I<[Dom, HKT<Dom, Im>], this>>;
|
|
330
|
-
}
|
|
331
|
-
interface µ<X extends [HKT<A, B>, HKT<B, C>], A = unknown, B = unknown, C = unknown> extends HKT<A, C> {
|
|
332
|
-
readonly out: App<X[1], App<X[0], I<A, this>>>;
|
|
333
|
-
}
|
|
334
|
-
type AppMap<F extends HKT<Dom>, X extends readonly Dom[], Dom = unknown> = readonly App<F, Dom>[] & {
|
|
335
|
-
[I in keyof X]: App<F, X[I]>;
|
|
336
|
-
};
|
|
337
|
-
type AppMapRW<F extends HKT<Dom>, X extends readonly Dom[], Dom = unknown> = App<F, Dom>[] & {
|
|
338
|
-
[I in keyof X]: App<F, X[I]>;
|
|
339
|
-
};
|
|
340
|
-
interface PromiseHKT<Dom = unknown> extends HKT<Dom> {
|
|
341
|
-
readonly out: PromiseLike<I<Dom, this>>;
|
|
342
|
-
}
|
|
343
|
-
interface DeepFieldHKT<R, T, K extends keyof T, F extends HKT<R, T>> extends HKT<R, T[K]> {
|
|
344
|
-
readonly out: App<F, I<R, this>>[K];
|
|
345
|
-
}
|
|
346
|
-
interface FieldHKT<K extends string> extends DeepFieldHKT<Record<K, unknown>, Record<K, unknown>, K, IdHKT<Record<K, unknown>>> {
|
|
347
|
-
}
|
|
348
|
-
interface RecordHKT<K extends string, Dom = unknown> extends HKT<Dom, Record<K, Dom>> {
|
|
349
|
-
readonly out: Record<K, I<Dom, this>>;
|
|
350
|
-
}
|
|
351
|
-
interface RecHKT<K extends string, Dom = unknown, E = unknown> extends HKT<Dom, Rec<K, Dom>> {
|
|
352
|
-
readonly out: Rec<K, I<Dom, this>> & E;
|
|
353
|
-
}
|
|
354
|
-
interface UBeforeHKT<Dom = unknown> extends HKT<Dom, UBefore<Dom>> {
|
|
355
|
-
readonly out: UBefore<I<Dom, this>>;
|
|
356
|
-
}
|
|
357
|
-
interface And<E> extends HKT {
|
|
358
|
-
readonly out: E & I<unknown, this>;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
declare const RawStage: unique symbol;
|
|
362
|
-
declare module 'mongodb' {
|
|
363
|
-
interface Collection<TSchema extends BSON.Document = BSON.Document> {
|
|
364
|
-
[RawStage]: {
|
|
365
|
-
(_: 2): TSchema;
|
|
366
|
-
(_: 1, x: TSchema): TSchema;
|
|
367
|
-
};
|
|
368
|
-
s: {
|
|
369
|
-
db: Db;
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
interface Db {
|
|
373
|
-
s: {
|
|
374
|
-
client?: MongoClient;
|
|
375
|
-
};
|
|
376
|
-
client: MongoClient;
|
|
377
|
-
}
|
|
378
|
-
interface Timestamp {
|
|
379
|
-
toExtendedJSON(): BSON.TimestampExtended;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
interface CommonCollection {
|
|
384
|
-
readonly s: {
|
|
385
|
-
readonly db: Db;
|
|
386
|
-
};
|
|
387
|
-
collectionName: string;
|
|
388
|
-
namespace: string;
|
|
389
|
-
dbName: string;
|
|
390
|
-
createIndex: Collection['createIndex'];
|
|
391
|
-
}
|
|
392
|
-
interface ReadonlyCollection<out Out> extends CommonCollection {
|
|
393
|
-
[RawStage](_: 2): Out;
|
|
394
|
-
}
|
|
395
|
-
interface WriteonlyCollection<in R> extends CommonCollection {
|
|
396
|
-
[RawStage]: {
|
|
397
|
-
(_: 1, x: R): unknown;
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
interface RWCollection<in R extends O, out Out extends O = R> extends CommonCollection {
|
|
401
|
-
[RawStage](_: 2): Out;
|
|
402
|
-
[RawStage](_: 1, x: R): unknown;
|
|
403
|
-
}
|
|
404
|
-
type OPick<V, K extends StrKey<V>, E extends StrKey<V> = never> = O & Pick<V, K | E>;
|
|
405
|
-
type OPickD<V extends Model, K extends StrKey<V>> = OPick<V, K, 'deletedAt' | '_id'>;
|
|
406
|
-
type View<V extends Model, K extends StrKey<V>> = {
|
|
407
|
-
collection: ReadonlyCollection<V | Del>;
|
|
408
|
-
projection: ExactKeys<K> | null;
|
|
409
|
-
match?: Expr<boolean, OPickD<V, K>>;
|
|
410
|
-
hardMatch?: Query<V>;
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
declare const val: <T extends rawItem>(val: T) => Expr<T, unknown>;
|
|
414
|
-
declare const current: Expr<Timestamp, unknown>;
|
|
415
|
-
declare const $let: <T, D, C, V extends RORec<string, jsonItem>>(vars: ExprsExact<V, D, C>, inExpr: Expr<T, D, C & V>) => Expr<T, D, C>;
|
|
416
|
-
declare const nil: Expr<null, unknown>;
|
|
417
|
-
declare const $getField: {
|
|
418
|
-
<T, K extends StrKey<T>, D, C = unknown>(expr: Expr<T, D, C>, field: K): Expr<T[K], D, C>;
|
|
419
|
-
<T, K extends StrKey<T>, D, C = unknown>(expr: Expr<T | N, D, C>, field: K): Expr<T[K] | null, D, C>;
|
|
420
|
-
};
|
|
421
|
-
type AddO<T> = T extends notObj ? T : T extends Array<infer U> ? Arr<AddO<U>> : O<{
|
|
422
|
-
[K in keyof T]: AddO<T[K]>;
|
|
423
|
-
}>;
|
|
424
|
-
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>;
|
|
425
|
-
declare const rand: () => string;
|
|
426
|
-
declare const $rand: Expr<string, unknown, unknown>;
|
|
427
|
-
|
|
428
|
-
type AddOs<A extends readonly unknown[]> = {
|
|
429
|
-
[K in keyof A]: AddO<A[K]>;
|
|
430
|
-
};
|
|
431
|
-
type PushSides<V> = {
|
|
432
|
-
0: V[];
|
|
433
|
-
1: V[];
|
|
434
|
-
};
|
|
435
|
-
type PushDict<V> = PRRec<string, PushSides<V>>;
|
|
436
|
-
declare const $sum: <D extends O, C = unknown>(expr: Expr<number | N, D, C>) => DeltaAccumulator<D, number, C>;
|
|
437
|
-
declare const $accumulator: <D, T, Ctx, A extends readonly unknown[]>(init: () => T, accumulateArgs: AppMap<ExprHKT<Part<D>, Ctx>, AddOs<A>>, accumulate: (a: T, ...args: A) => T, merge: (...args: [T | N, T]) => T) => DeltaAccumulator<D, AddO<T>, Ctx>;
|
|
438
|
-
declare const $countDict: <D extends O, K extends string = string, C = unknown>(expr: Expr<AddO<K>, D, C>) => DeltaAccumulator<D, AddO<PRRec<K, number>>, C>;
|
|
439
|
-
declare const $countDictArray: <D extends O, K extends string = string, C = unknown>(expr: Expr<AddO<K[]>, D, C>) => DeltaAccumulator<D, AddO<PRRec<K, number>>, C>;
|
|
440
|
-
declare const $pushDict: <D extends O, V, C = unknown>(key: Expr<string, D, C>, value: Expr<AddO<V>, D, C>) => DeltaAccumulator<D, O<{
|
|
441
|
-
[x: string]: O<{
|
|
442
|
-
0: Arr<AddO<V>>;
|
|
443
|
-
1: Arr<AddO<V>>;
|
|
444
|
-
}> | undefined;
|
|
445
|
-
}>, C>;
|
|
446
|
-
declare const $keys: <D extends O, K extends string = string, C = unknown>(expr: Expr<AddO<PRRec<K, number>>, D, C>) => Expr<AddO<K[]>, D, C>;
|
|
447
|
-
declare const $entries: <D extends O, V, C = unknown>(expr: Expr<AddO<PushDict<V>>, D, C>) => Expr<AddO<{
|
|
448
|
-
k: string;
|
|
449
|
-
v: V;
|
|
450
|
-
}[]>, D, C>;
|
|
451
|
-
|
|
452
|
-
type Equal<Dom, T extends Dom, V extends Dom> = {
|
|
453
|
-
forward: <F extends HKT<Dom>>(x: App<F, T>) => App<F, V>;
|
|
454
|
-
forward1: (x: T) => V;
|
|
455
|
-
backward: <F extends HKT<Dom>>(x: App<F, V>) => App<F, T>;
|
|
456
|
-
backward1: (x: V) => T;
|
|
457
|
-
};
|
|
458
|
-
declare const sym: <Dom, T extends Dom, V extends Dom>(eq: Equal<Dom, T, V>) => Equal<Dom, V, T>;
|
|
459
|
-
declare const reflex: <Dom, T extends Dom>() => Equal<Dom, T, T>;
|
|
460
|
-
declare const eqExtends: <Im, T, U, F extends HKT<T, Im>, G extends HKT<T, Im>, H extends HKT<T, Im>, M extends Im>(_1: Equal<Im, App<F, T & U>, M | App<G, T & U>>, _2: Equal<Im, App<F, Exclude<T, U>>, M | App<H, Exclude<T, U>>>) => Equal<Im, App<F, T>, M | (T extends U ? App<G, T> : App<H, T>)>;
|
|
461
|
-
declare const fromEq: <Dom, T extends Dom, V extends Dom>(eq: Pick<Equal<Dom, T, V>, "forward" | "backward">) => Equal<Dom, T, V>;
|
|
462
|
-
declare const literalsEqaul: <T extends keyof any | boolean | N, V extends T>(_: AsLiteral<T> & V) => Equal<T, T, V>;
|
|
463
|
-
declare const omitRORec: <K extends string, E extends string, R extends string, T extends unknown>() => Equal<unknown, RORec<Exclude<K, E | R>, T>, Omit<RORec<Exclude<K, E | R>, T>, R>>;
|
|
464
|
-
type s$2 = keyof any;
|
|
465
|
-
declare const omitPick: <K extends s$2, E extends s$2, R extends s$2, T extends RORec<Exclude<K, E | R>, unknown>>() => Equal<unknown, Pick<T, Exclude<K, E | R>>, Omit<Pick<T, Exclude<K, E | R>>, R>>;
|
|
466
|
-
declare const omitExclude: <K extends s$2, E extends s$2, R extends s$2, T extends RORec<Exclude<K, E | R>, unknown>>() => Equal<unknown, Omit<T, E & Exclude<K, keyof T>>, Omit<Pick<T, Exclude<K, E | R>>, R>>;
|
|
467
|
-
declare const renamedFields: <K extends s$2, F extends HKT<K, s$2>, G extends HKT<App<F, K>>>() => Equal<string | number | symbol, keyof { [P in K as App<F, P>]: App<G, P>; }, App<F, K>>;
|
|
468
|
-
declare const translateOmit: <T, K extends string, Q extends string, P extends string>() => Equal<unknown, Omit<Omit<T, K | Q>, P>, Omit<Omit<T, K | Q>, Q | P>>;
|
|
469
|
-
declare const excludeIdem: <K extends s$2, E extends s$2, S extends E = E>() => Equal<Exclude<K, E>, Exclude<K, E>, Exclude<Exclude<K, E>, S>>;
|
|
470
|
-
declare const eqPar: <K extends string, T extends Rec<K, jsonItem>, K2 extends K>() => Equal<unknown, Par$1<K2, T>, Par$1<K, T>>;
|
|
471
|
-
|
|
472
|
-
type DeltaPipe<Q extends O, T extends Q, F extends HKT<O2>, G extends HKT<O3>> = {
|
|
473
|
-
with: <Q2 extends O, V extends Q2>(map: (a: Stream<Q, T, F, G>) => Stream<Q | Q2, V, F, G>) => DeltaPipe<Q | Q2, V, F, G>;
|
|
474
|
-
then: <Q2 extends O, V extends Q2>(next: App<G, [Q2 | T, T, V]>) => DeltaPipe<Q | Q2, V, F, G>;
|
|
475
|
-
get: () => App<F, [Q, T]>;
|
|
476
|
-
};
|
|
477
|
-
declare const emptyDelta: <T extends O>() => {
|
|
478
|
-
delta: RawStages<Delta<T>, Delta<T>, Delta<T>, unknown, number>;
|
|
479
|
-
raw: <F extends HKT<O>>() => RawStages<App<F, T>, App<F, T>, App<F, T>, unknown, number>;
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
type MergeInto<T extends O, Out extends O, E = unknown> = {
|
|
483
|
-
whenNotMatched: 'insert';
|
|
484
|
-
into: RWCollection<T, Out> & E;
|
|
485
|
-
} | {
|
|
486
|
-
whenNotMatched: 'discard' | 'fail';
|
|
487
|
-
into: ReadonlyCollection<Out> & E;
|
|
488
|
-
};
|
|
489
|
-
type MergeArgs<T extends O, Out extends O, Ctx, In extends O> = {
|
|
490
|
-
on: Field<T, jsonItem> & Field<Out, jsonItem>;
|
|
491
|
-
} & MergeInto<T, Out> & (({
|
|
492
|
-
stages?: never;
|
|
493
|
-
} & ({
|
|
494
|
-
whenMatched: 'keepExisting' | 'fail';
|
|
495
|
-
} | {
|
|
496
|
-
whenMatched: 'replace';
|
|
497
|
-
into: RWCollection<T, Out>;
|
|
498
|
-
} | {
|
|
499
|
-
whenMatched: 'merge';
|
|
500
|
-
into: RWCollection<Replace<Out, T>, Out>;
|
|
501
|
-
})) | {
|
|
502
|
-
stages: true;
|
|
503
|
-
into: RWCollection<In, Out>;
|
|
504
|
-
whenMatched: RawStages<unknown, Out, In, {
|
|
505
|
-
new: T;
|
|
506
|
-
}>;
|
|
507
|
-
} | {
|
|
508
|
-
stages: 'ctx';
|
|
509
|
-
vars: ExprsExact<Ctx, T>;
|
|
510
|
-
into: RWCollection<In, Out>;
|
|
511
|
-
whenMatched: RawStages<unknown, Out, In, Ctx>;
|
|
512
|
-
});
|
|
513
|
-
declare const $merge_: <T extends O, Out extends O = T, Ctx = unknown, In extends O = Out>({ into, on, whenNotMatched, ...notMatched }: MergeArgs<T, Out, Ctx, In>) => RawStages<unknown, T, "out", unknown, number>;
|
|
514
|
-
declare const $merge2: <T extends O, Out extends O = T, Ctx = unknown, In extends O = Out>(args: MergeArgs<T, Out, Ctx, In>) => RawStages<unknown, T, "out", unknown, number>;
|
|
515
|
-
|
|
516
|
-
type GI$1<GG> = Exclude<GG, keyof TS>;
|
|
517
|
-
type IdAndTsKeys = keyof (TS & ID);
|
|
518
|
-
type V$1<VV, GG extends string> = Omit<VV, IdAndTsKeys | GI$1<GG>>;
|
|
519
|
-
type Prepare<Grp, GG extends string> = TS & ID & Rec<GI$1<GG>, Grp>;
|
|
520
|
-
type Par<T> = {
|
|
521
|
-
[P in keyof T]?: T[P] | null;
|
|
522
|
-
};
|
|
523
|
-
type Loose<Grp, VV, GG extends string> = Prepare<Grp, GG> & Par<V$1<VV, GG>>;
|
|
524
|
-
type Strict<Grp, VV, GG extends string, EE> = Prepare<Grp, GG> & V$1<VV, GG> & Omit<EE, IdAndTsKeys | GI$1<GG> | keyof V$1<VV, GG>>;
|
|
525
|
-
type V_Grp<VV, GG extends string, Grp> = Rec<GI$1<GG>, Grp> & V$1<VV, GG>;
|
|
526
|
-
type Extra<EE, VV, GG extends string> = Omit<EE, IdAndTsKeys | GI$1<GG> | keyof V$1<VV, GG>>;
|
|
527
|
-
type OrReplace<T, V> = T | Replace<T, V>;
|
|
528
|
-
type MergedInput<Out, VV, Grp, GG extends string, EE> = OrReplace<Replace<Replace<Out, V$1<VV, GG>>, Extra<EE, VV, GG>> & Model, TS & ID & V_Grp<VV, GG, Grp> & Extra<EE, VV, GG>>;
|
|
529
|
-
|
|
530
|
-
type Denied<GID = never> = keyof (TS & ID) | GID;
|
|
531
|
-
type GI<GG> = Exclude<GG, keyof TS>;
|
|
532
|
-
type GroupMergeOut<Grp extends notArr, V extends O, GG extends string, EE = {}, Out extends Loose<Grp, V, GG> = Loose<Grp, V, GG>> = MergeInto<Strict<Grp, V, GG, EE>, Out, WriteonlyCollection<MergedInput<Out, V, Grp, GG, EE>>>;
|
|
533
|
-
type GroupMergeCollection<WhenNotMatched extends MergeInto<never, never>['whenNotMatched'], Grp extends notArr, V extends O, GG extends string, EE = {}, Out extends Loose<Grp, V, GG> = Loose<Grp, V, GG>> = (GroupMergeOut<Grp, V, GG, EE, Out> & {
|
|
534
|
-
whenNotMatched: WhenNotMatched;
|
|
535
|
-
})['into'];
|
|
536
|
-
declare const $groupMerge: <T extends O, Grp extends notArr, V extends O, GG extends string, EE = {}, Out extends Loose<Grp, V, GG> = Loose<Grp, V, GG>>(id: Expr<Grp, T>, args: DeltaAccumulators<T, O & Omit<V, Denied<GI<GG>>>>, out: GroupMergeOut<Grp, V, GG, EE, Out>, gid: AsLiteral<GI<GG>>, extra: ExprsExact<Extra<EE, V, GG>, V_Grp<V, GG, Grp>>, idPrefix?: string) => StreamRunnerParam<Delta<T>, "out">;
|
|
537
|
-
type GroupIdCollection<V extends O, EE = {}, Out extends Loose<string, V, '_id'> = Loose<string, V, '_id'>> = RWCollection<MergedInput<Out, V, string, '_id', EE>, Out>;
|
|
538
|
-
declare const $groupId: <T extends O, V extends O, EE = {}, Out extends Loose<string, V, "_id"> = Loose<string, V, "_id">>(id: Expr<string, T>, args: DeltaAccumulators<T, O & Omit<V, Denied>>, out: GroupIdCollection<V, EE, Out>, extra: ExprsExact<Omit<EE, IdAndTsKeys | keyof Omit<V, IdAndTsKeys>>, doc & Omit<V, IdAndTsKeys>>) => StreamRunnerParam<Delta<T>, "out">;
|
|
539
|
-
type GroupCollection<Grp extends notArr, V extends O, EE = {}, Out extends Loose<Grp, V, '_grp'> = Loose<Grp, V, '_grp'>> = RWCollection<MergedInput<Out, V, Grp, '_grp', EE> | Strict<Grp, V, '_grp', EE>, Out>;
|
|
540
|
-
declare const $group: <T extends O, Grp extends notArr, V extends O, EE = {}, Out extends Loose<Grp, V, "_grp"> = Loose<Grp, V, "_grp">>(id: Expr<Grp, T>, args: DeltaAccumulators<T, O & Omit<V, Denied<"_grp">>>, out: GroupCollection<Grp, V, EE, Out>, extra: ExprsExact<Omit<EE, IdAndTsKeys | "_grp" | Exclude<keyof V, IdAndTsKeys | "_grp">>, Rec<"_grp", Grp> & Omit<V, IdAndTsKeys | "_grp">>, idPrefix?: string) => StreamRunnerParam<Delta<T>, "out">;
|
|
541
|
-
|
|
542
|
-
type Params<As extends string, LQ extends O, RQ extends O, RE extends RQ, S extends notArr> = {
|
|
543
|
-
from: SnapshotStreamExecutionResult<RQ, RE>;
|
|
544
|
-
as: AsLiteral<As>;
|
|
545
|
-
} & ({
|
|
546
|
-
to: 'one';
|
|
547
|
-
localField: Field<LQ, string | N>;
|
|
548
|
-
foreignField?: never;
|
|
549
|
-
middle?: never;
|
|
550
|
-
} | {
|
|
551
|
-
to: 'many';
|
|
552
|
-
middle: string;
|
|
553
|
-
localField: Field<LQ, S | Arr<S>>;
|
|
554
|
-
foreignField: Field<RQ, S | Arr<S>>;
|
|
555
|
-
});
|
|
556
|
-
declare const $lookup: <As extends string, LQ extends doc, RQ extends doc, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE>>;
|
|
557
|
-
declare const $outerLookup: <As extends string, LQ extends doc, RQ extends doc, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | null>>;
|
|
558
|
-
|
|
559
|
-
declare const $matchDelta: <T extends doc>(query: Expr<boolean, T>) => RawStages<unknown, Delta<T>, Delta<T>, unknown, number>;
|
|
560
|
-
declare const matchDelta: <D>() => RawStages<unknown, Delta<D | null>, Delta<D>>;
|
|
561
|
-
|
|
562
|
-
declare const $match: <T extends doc>(query: Expr<boolean, T>) => DeltaStages<T, T, T>;
|
|
563
|
-
|
|
564
|
-
type Omit$1<T, K extends keyof any> = T extends T ? Pick<T, Exclude<keyof T, K>> : never;
|
|
565
|
-
declare const Updater: unique symbol;
|
|
566
|
-
type Updater<in R, in T, out V, in C = unknown> = {
|
|
567
|
-
[Type]?(x: typeof Updater, r: R, t: T, c: C): V;
|
|
568
|
-
readonly raw: <D extends O>(f: Field<D, R | N>) => readonly (readonly [string, rawItem])[];
|
|
569
|
-
};
|
|
570
|
-
interface UpdaterHKT<R, Old, V, C, K extends keyof Old = keyof Old, V2 extends V = V> extends UpdaterQHKT<R, Old, V2, StrKey<V>, C, K> {
|
|
571
|
-
}
|
|
572
|
-
interface UpdaterQHKT<R, Old, V, KV extends StrKey<V>, C, K extends keyof Old = keyof Old> extends HKT<KV> {
|
|
573
|
-
readonly out: Updater<R, Get<Old, I<KV, this>, K>, V[I<KV, this>], C>;
|
|
574
|
-
}
|
|
575
|
-
type Get<T, P extends string, K extends keyof T = never> = P extends K ? T[P] : P extends keyof T ? T[P] : undefined;
|
|
576
|
-
declare const set: <V>() => <R, Old extends notArr, C = unknown, K extends keyof Old = never>(fields: MapO<V, UpdaterHKT<R, Old, V, C, K>>) => Updater<R, Old, O & Omit$1<Old, StrKey<V>> & V, C> & Updater<R, Arr<Old>, Arr<Omit$1<Old, StrKey<V>> & V>, C>;
|
|
577
|
-
declare const to: <R, V, C = unknown, T = unknown>(expr: Expr<V, R, C>) => Updater<R, T, V, C>;
|
|
578
|
-
|
|
579
|
-
type V<VV, Q> = Exclude<StrKey<VV>, StrKey<Q>>;
|
|
580
|
-
type $Set<VV extends O, Q extends O> = <R extends Q, C = unknown>(fields: MapO<Omit<VV, StrKey<Q>>, UpdaterQHKT<R, R, VV, V<VV, Q>, C>, V<VV, Q>>) => DeltaStages<Q, R, Q & ReplaceQ<R, VV, Q>, C> & LinStages<Q, R, Q & ReplaceQ<R, VV, Q>, C>;
|
|
581
|
-
declare const $set: <VV extends O, Q extends O = O>() => $Set<VV, Q>;
|
|
582
|
-
declare const $replaceWith: <T extends O, V extends O>(expr: Expr<V, T>) => DeltaStages<O, T, V> & LinStages<O, T, V>;
|
|
583
|
-
|
|
584
|
-
type s$1 = string;
|
|
585
|
-
type JoinId<K1 extends s$1, K2 extends s$1> = K1 | K2 | readonly [K1, middle: s$1, K2] | readonly [K2, middle: s$1, K1];
|
|
586
|
-
declare const joinIdOf: <K1 extends s$1, K2 extends s$1, D, C = unknown>(k: JoinId<K1, K2>, k1: K1, k1Id: Expr<s$1, D, C>, k2Id: Expr<s$1, D, C>) => Expr<s$1, D, C>;
|
|
587
|
-
declare const $unwindDelta: <K1 extends s$1, T extends doc, KK2 extends s$1, U extends doc, N1 extends null = never, N2 extends null = never>(k1: AsLiteral<K1>, k2: AsLiteral<Exclude<KK2, K1 | BA>>, k: JoinId<K1, Exclude<KK2, K1 | BA>>, includeNull1?: N1, includeNull2?: N2) => RawStages<unknown, Delta<Rec<K1, T | N1> & Rec<Exclude<KK2, K1 | BA>, Arr<U>>>, Delta<Rec<K1, T | N1> & Rec<Exclude<KK2, K1 | BA>, U | N2> & ID>>;
|
|
588
|
-
|
|
589
|
-
type s = string;
|
|
590
|
-
type TOf<TT, K extends string> = doc & Omit<TT, K>;
|
|
591
|
-
declare const $unwind: <TT extends O, K extends s, U extends doc>(k: AsLiteral<K>, dict: RORec<K, "key"> & RORec<"_id", "id">, middle?: string) => DeltaStages<O, TOf<TT, K> & Rec<K, Arr<U>>, TOf<TT, K> & Rec<K, U>>;
|
|
592
|
-
|
|
593
|
-
type OutInputE<T, E, A = T | null> = ID & Rec<'after', A> & E;
|
|
594
|
-
type Allowed$2<K extends string> = Exclude<K, keyof (TS & ID)>;
|
|
595
|
-
type Patch<V, KK extends StrKey<V> = StrKey<V>> = ((OPick<V, Allowed$2<KK>> & ID) | (Rec<Allowed$2<KK>, N> & ID)) & TS;
|
|
596
|
-
type TakeDoc<V, E = ID, KK extends StrKey<V> = StrKey<V>> = OPick<V, Allowed$2<KK>> & E;
|
|
597
|
-
type ND$1 = {
|
|
598
|
-
readonly deletedAt?: null;
|
|
599
|
-
};
|
|
600
|
-
type SafeE$1<E> = Omit<E, `$${string}` | keyof ID>;
|
|
601
|
-
type Args<P, Out> = [added: Expr<P, unknown, {
|
|
602
|
-
new: P;
|
|
603
|
-
}>, old: Expr<Out, Out>];
|
|
604
|
-
type Result<P> = Expr<P, unknown, {
|
|
605
|
-
new: P;
|
|
606
|
-
}>;
|
|
607
|
-
type Update$1<P, Out> = (...args: Args<P, Out>) => Result<P>;
|
|
608
|
-
type UpdateF<P, Out> = <K extends keyof IsDeleted>(...args: Args<Replace<P, RORec<K, Timestamp>>, Out>) => Result<Replace<P, RORec<K, Timestamp>>>;
|
|
609
|
-
declare const getSubsetMatchForExt: <Out extends Model, P extends Model, E extends Record<keyof E, rawItem>>(ext: Exact<E, IdHKT>) => null | Expr<boolean, Rec<"old" | "merged", Out | Replace<Out, P>>>;
|
|
610
|
-
declare const getWhenMatchedForMerge: <Out extends Model, P extends Model, K extends keyof IsDeleted>(whenNotMatched: "discard" | "fail" | "insert", update: Update$1<Replace<P, RORec<K, Timestamp>>, Out>, canWrite: Expr<boolean, Rec<"old" | "merged", Out | Replace<Out, P>>> | null) => RawStages<O, Out, Out | Replace<Out, P>, RORec<"new", Replace<P, RORec<K, Timestamp>>>>;
|
|
611
|
-
declare const getWhenMatched: <Out extends Model, P extends Model>(whenNotMatched: "discard" | "fail" | "insert", canWrite: Expr<boolean, Rec<"old" | "merged", Out | Replace<Out, P>>> | null) => RawStages<O, Rec<"old" | "merged", Out | Replace<Out, P>>, Out | Replace<Out, P>>;
|
|
612
|
-
type MergeCollection<V extends O, Out extends Model> = {
|
|
613
|
-
coll: RWCollection<Out | Replace<Out, Patch<V>> | Replace<Patch<V>, IsDeleted>, Out>;
|
|
614
|
-
whenNotMatched: 'discard';
|
|
615
|
-
} | {
|
|
616
|
-
coll: RWCollection<Out | Replace<Out, Patch<V>>, Out>;
|
|
617
|
-
whenNotMatched: 'fail';
|
|
618
|
-
};
|
|
619
|
-
type MergeUpdate<V, Out> = UpdateF<((OPick<V, Allowed$2<StrKey<V>>> & ID) | (Rec<Allowed$2<StrKey<V>>, N> & ID)) & TS, Out>;
|
|
620
|
-
declare const $mergeId: <V extends O>() => <SourcePart extends doc, Out extends Model, E = unknown, EEE extends RORec<string, rawItem> = {}>(out: MergeCollection<V, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, id: Expr<string, OutInputE<TakeDoc<V>, E, null>>, ext: Exact<Omit<SafeE$1<EEE>, keyof (ND$1 & TS)>, IdHKT>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<OutInputE<SourcePart, E>, "out">;
|
|
621
|
-
declare const $simpleMergePart: <V extends O>() => <Source extends doc, Out extends Model, EEE extends RORec<string, rawItem>>(out: MergeCollection<V, Out>, keys: ExprsExact<TakeDoc<V, unknown>, Source>, ext: Exact<Omit<SafeE$1<EEE>, keyof (ND$1 & TS)>, IdHKT>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<Source, "out">;
|
|
622
|
-
declare const $simpleMerge: <V extends O>() => <Source extends doc, Out extends Model>(out: RWCollection<Out | Replace<Out, Patch<V>> | Replace<Patch<V>, IsDeleted>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, Source>, whenNotMatched?: "fail" | "discard", update?: MergeUpdate<V, Out>) => StreamRunnerParam<Source, "out">;
|
|
623
|
-
declare const $mergePart: <V extends O>() => <Out extends Model, SourcePart extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, ext: Exact<Omit<SafeE$1<EEE>, keyof (ND$1 & TS)>, IdHKT>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<Delta<SourcePart>, "out">;
|
|
624
|
-
declare const $merge: <V extends O>() => <Out extends Model, SourcePart extends doc>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<Delta<SourcePart>, "out">;
|
|
625
|
-
|
|
626
|
-
type ND = {
|
|
627
|
-
readonly deletedAt?: null;
|
|
628
|
-
};
|
|
629
|
-
type SafeE<E> = Omit<E, `$${string}` | keyof ID>;
|
|
630
|
-
type Merge<T extends doc, E> = Omit<SafeE<E>, keyof (ND & TS)> & ((T & ND & TS) | Del);
|
|
631
|
-
type ExprP<P> = Expr<P, unknown, {
|
|
632
|
-
new: P;
|
|
633
|
-
}>;
|
|
634
|
-
type Update<P, Out> = (added: ExprP<P>, old: Expr<Out, Out>) => ExprP<P>;
|
|
635
|
-
declare const $insertX: <T extends doc, D extends O, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, expr: Expr<T, D>, map: (x: Expr<T & ND & TS & Omit<SafeE<EEE>, keyof (ND & TS)>, D>) => Expr<Merge<T, EEE>, D>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>, extExpr: ExprsExact<Omit<SafeE<EEE>, keyof (ND & TS)>, unknown>, update?: Update<Replace<Merge<T, EEE>, {}>, Merge<T, EEE>>) => StreamRunnerParam<D, "out">;
|
|
636
|
-
declare const $simpleInsert: <T extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>) => StreamRunnerParam<T, "out">;
|
|
637
|
-
declare const $insertPart: <T extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>) => StreamRunnerParam<Delta<T>, "out">;
|
|
638
|
-
declare const $insert: <T extends doc>(out: RWCollection<Merge<T, {}>>) => StreamRunnerParam<Delta<T>, "out">;
|
|
639
|
-
|
|
640
|
-
declare const log: (...args: unknown[]) => void;
|
|
641
|
-
|
|
642
|
-
declare const createIndex: (collection: {
|
|
643
|
-
readonly createIndex: Collection["createIndex"];
|
|
644
|
-
collectionName: string;
|
|
645
|
-
}, indexSpec: IndexSpecification, op?: CreateIndexesOptions) => Promise<void>;
|
|
646
|
-
|
|
647
|
-
declare const noop: () => void;
|
|
648
|
-
declare const map1: <K extends string, Im>(k: AsLiteral<K>, to: Im) => { readonly [P in K]: [P, Im]; } & {
|
|
649
|
-
readonly [_: string]: [K, Im];
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
declare const $group_: <V extends O>() => <ID, T extends O, C = unknown>(id: Expr<ID, T, C>, args: Accumulators<T, V, C>) => RawStages<O, T, Rec<"_id", ID> & V, C, 1>;
|
|
653
|
-
|
|
654
|
-
type AllowedPick$1<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed$1<K>>;
|
|
655
|
-
type Allowed$1<K> = Exclude<K, 'deletedAt' | '_id'>;
|
|
656
|
-
|
|
657
|
-
interface SnapshotStreamHKT extends HKT<O2> {
|
|
658
|
-
readonly out: SnapshotStreamExecutionResult<I<O2, this>[0], I<O2, this>[1]>;
|
|
659
|
-
}
|
|
660
|
-
interface DeltaHKT extends HKT<O3> {
|
|
661
|
-
readonly out: DeltaStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2]>;
|
|
662
|
-
}
|
|
663
|
-
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>> & {
|
|
664
|
-
needs?: Partial<Record<KK, 0 | 1>>;
|
|
665
|
-
}, streamName: string, skip?: boolean, after?: () => Promise<void>) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
|
|
666
|
-
|
|
667
|
-
type Allowed<K> = Exclude<K, 'deletedAt' | '_id'>;
|
|
668
|
-
type AllowedPick<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed<K>>;
|
|
669
|
-
interface StreamRunnerHKT extends HKT<O2> {
|
|
670
|
-
readonly out: SimpleStreamExecutionResult<I<O2, this>[0], I<O2, this>[1]>;
|
|
671
|
-
}
|
|
672
|
-
interface StagesHKT extends HKT<O3> {
|
|
673
|
-
readonly out: RORec<'lin', RawStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2], unknown, 1>>;
|
|
674
|
-
}
|
|
675
|
-
declare const from: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed<KK>>, streamName: string, needs?: Partial<Record<KK, 0 | 1>>) => DeltaPipe<AllowedPick<V, KK>, AllowedPick<V, KK>, StreamRunnerHKT, StagesHKT>;
|
|
676
|
-
|
|
677
|
-
type SingleResult<out Result> = <Result2>(finalInput: RawStages<unknown, Result, Result2>) => Stages<unknown, Result2, unknown>;
|
|
678
|
-
interface SnapshotStreamHKT2 extends HKT<O2> {
|
|
679
|
-
readonly out: SingleResult<I<O2, this>[1]>;
|
|
680
|
-
}
|
|
681
|
-
declare const single: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, needs?: Partial<Record<KK, 0 | 1>>) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT2, DeltaHKT>;
|
|
682
|
-
|
|
683
|
-
declare const max: <D, C>(...expr: Expr<number, D, C>[]) => Expr<number, D, C>;
|
|
684
|
-
declare const min: <D, C>(...expr: Expr<number, D, C>[]) => Expr<number, D, C>;
|
|
685
|
-
declare const lt: {
|
|
686
|
-
<D, C>(...expr: [Expr<Date, D, C>, Expr<Date, D, C>]): Expr<boolean, D, C>;
|
|
687
|
-
<D, C>(...expr: [Expr<number, D, C>, Expr<number, D, C>]): Expr<boolean, D, C>;
|
|
688
|
-
};
|
|
689
|
-
declare const gt: {
|
|
690
|
-
<D, C>(...expr: [Expr<Date, D, C>, Expr<Date, D, C>]): Expr<boolean, D, C>;
|
|
691
|
-
<D, C>(...expr: [Expr<number, D, C>, Expr<number, D, C>]): Expr<boolean, D, C>;
|
|
692
|
-
};
|
|
693
|
-
declare const lte: {
|
|
694
|
-
<D, C>(...expr: [Expr<Date | N, D, C>, Expr<Date | N, D, C>]): Expr<boolean, D, C>;
|
|
695
|
-
<D, C>(...expr: [Expr<number | N, D, C>, Expr<number | N, D, C>]): Expr<boolean, D, C>;
|
|
696
|
-
};
|
|
697
|
-
declare const gte: {
|
|
698
|
-
<D, C>(...expr: [Expr<Date | N, D, C>, Expr<Date | N, D, C>]): Expr<boolean, D, C>;
|
|
699
|
-
<D, C>(...expr: [Expr<number | N, D, C>, Expr<number | N, D, C>]): Expr<boolean, D, C>;
|
|
700
|
-
};
|
|
701
|
-
type Num = number | null | undefined;
|
|
702
|
-
declare function subtract<D, C>(...expr: [Expr<number, D, C>, Expr<number, D, C>]): Expr<number, D, C>;
|
|
703
|
-
declare function subtract<D, C>(...expr: [Expr<Num, D, C>, Expr<Num, D, C>]): Expr<Num, D, C>;
|
|
704
|
-
declare function add<D, C>(...expr: [Expr<number, D, C>, Expr<number, D, C>]): Expr<number, D, C>;
|
|
705
|
-
declare function add<D, C>(...expr: [Expr<Num, D, C>, Expr<Num, D, C>]): Expr<Num, D, C>;
|
|
706
|
-
declare function divide<D, C>(...expr: [Expr<number, D, C>, Expr<number, D, C>]): Expr<number, D, C>;
|
|
707
|
-
declare function divide<D, C>(...expr: [Expr<Num, D, C>, Expr<Num, D, C>]): Expr<Num, D, C>;
|
|
708
|
-
declare function multiply<D, C>(...expr: [Expr<number, D, C>, Expr<number, D, C>]): Expr<number, D, C>;
|
|
709
|
-
declare function multiply<D, C>(...expr: [Expr<Num, D, C>, Expr<Num, D, C>]): Expr<Num, D, C>;
|
|
710
|
-
declare function floor<D, C>(expr: Expr<number, D, C>): Expr<number, D, C>;
|
|
711
|
-
declare function floor<D, C>(expr: Expr<Num, D, C>): Expr<Num, D, C>;
|
|
712
|
-
declare function ceil<D, C>(expr: Expr<number, D, C>): Expr<number, D, C>;
|
|
713
|
-
declare function ceil<D, C>(expr: Expr<Num, D, C>): Expr<Num, D, C>;
|
|
714
|
-
|
|
715
|
-
declare const size: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<number, D, C>;
|
|
716
|
-
declare const filterDefined: <T, D, C = unknown>(expr: Expr<Arr<T | N>, D, C>) => Expr<Arr<T>, D, C>;
|
|
717
|
-
declare const filter: <T, D, K extends string, C = unknown>({ as, cond, expr, limit, }: {
|
|
718
|
-
expr: Expr<Arr<T>, D, C>;
|
|
719
|
-
as: K;
|
|
720
|
-
cond: Expr<unknown, D, C & RORec<K, T>>;
|
|
721
|
-
limit?: Expr<number, D, C>;
|
|
722
|
-
}) => Expr<Arr<T>, D, C>;
|
|
723
|
-
declare const sortArray: <T, D, C, K extends keyof T>({ sortBy, expr, order, }: {
|
|
724
|
-
expr: Expr<Arr<T>, D, C>;
|
|
725
|
-
sortBy: K;
|
|
726
|
-
order?: 1 | -1;
|
|
727
|
-
}) => Expr<Arr<T>, D, C>;
|
|
728
|
-
declare const isArray: <T extends notArr, D, C, F extends HKT<T | Arr<T>>>(expr: Expr<T | Arr<T>, D & (App<F, T> | App<F, Arr<T>>), C>) => BoolExpr<D & App<F, Arr<T>>, D & App<F, T>, C>;
|
|
729
|
-
declare const inArray: <T, D, C>(item: Expr<T, D, C>, expr: Expr<Arr<T>, D, C>) => Expr<boolean, D, C>;
|
|
730
|
-
declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
731
|
-
declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
732
|
-
declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
733
|
-
declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
|
|
734
|
-
declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
735
|
-
type NullToOBJ<N extends null> = N extends null ? O : N;
|
|
736
|
-
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>;
|
|
737
|
-
declare const anyElementTrue: <D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
|
|
738
|
-
type Reduce<T, V> = RORec<'value', V> & RORec<'this', T>;
|
|
739
|
-
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>;
|
|
740
|
-
declare const slice: <T, D, C>(array: Expr<Arr<T>, D, C>, start: Expr<number, D, C>, end: Expr<number, D, C>) => Expr<Arr<T>, D, C>;
|
|
741
|
-
declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
|
|
742
|
-
|
|
743
|
-
declare const dayAndMonthPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
|
|
744
|
-
declare const now: <D, C>() => Expr<Date, D, C>;
|
|
745
|
-
declare const monthPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
|
|
746
|
-
declare const weekPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
|
|
747
|
-
declare const year: <D, C>(date: Expr<Date, D, C>) => Expr<number, D, C>;
|
|
748
|
-
declare const dateAdd: <D, C>(date: Expr<Date, D, C>, amount: Expr<number, D, C>, unit: Expr<"year" | "week" | "month" | "day" | "hour" | "minute" | "second", D, C>) => Expr<Date, D, C>;
|
|
749
|
-
declare const maxDate: <D, C>(expr: Expr<Arr<Date>, D, C>) => Expr<Date, D, C>;
|
|
750
|
-
declare const minDate: <D, C>(expr: Expr<Arr<Date>, D, C>) => Expr<Date, D, C>;
|
|
751
|
-
declare const datePart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
|
|
752
|
-
declare const startOf: <D, C>(startDate: Expr<Date, D, C>, freq: Expr<"week" | "day" | "month" | "year", D, C>, offset: Expr<number, D, C>) => Expr<Date, D, C>;
|
|
753
|
-
declare const dateDiff: <D, C>({ end, unit, start, }: {
|
|
754
|
-
start: Expr<Date, D, C>;
|
|
755
|
-
end: Expr<Date, D, C>;
|
|
756
|
-
unit: Expr<"week" | "day" | "month" | "year", D, C>;
|
|
757
|
-
}) => Expr<number, D, C>;
|
|
758
|
-
declare const mapFromPlainDateTime: <D, C>({ plainDate, timezone, }: {
|
|
759
|
-
plainDate: Expr<Date, D, C>;
|
|
760
|
-
timezone: Expr<string, D, C>;
|
|
761
|
-
}) => Expr<Date, D, C>;
|
|
762
|
-
declare const mapToPlainDateTime: <D, C>(date: Expr<Date, D, C>, timezone: Expr<string, D, C>) => Expr<Date, D, C>;
|
|
763
|
-
|
|
764
|
-
declare const ite: {
|
|
765
|
-
<T, D, C = unknown>(cond: Expr<unknown, D, C>, then: Expr<T, D, C>, orelse: Expr<T, D, C>): Expr<T, D, C>;
|
|
766
|
-
<T, R1, R2, F extends HKT<R1 | R2>, C = unknown>(cond: BoolExpr<App<F, R1>, App<F, R2>, C>, then: Expr<T, App<F, R1>, C>, orelse: Expr<T, App<F, R2>, C>): Expr<T, App<F, R1 | R2>, C>;
|
|
767
|
-
};
|
|
768
|
-
declare const and: <D, C = unknown>(...expr: Expr<boolean, D, C>[]) => Expr<boolean, D, C>;
|
|
769
|
-
declare const or: <D, C = unknown>(...expr: Expr<boolean, D, C>[]) => Expr<boolean, D, C>;
|
|
770
|
-
declare const not: <D, C = unknown>(expr: Expr<boolean, D, C>) => Expr<boolean, D, C>;
|
|
771
|
-
declare const eq: <T, D, C = unknown>(a: Expr<T, D, C>) => (b: Expr<T, D, C>) => Expr<boolean, D, C>;
|
|
772
|
-
declare const sub: <T, D, Ctx, P extends O>(a: Expr<T, D, Ctx>, f: Field<P, D, Ctx>) => Expr<T, P, Ctx>;
|
|
773
|
-
declare const eqTyped: <T1 extends Dom, T2 extends Dom, F extends HKT<Dom>, C = unknown, Dom = unknown>(a: Expr<T1 | T2, App<F, T1 | T2>, C>, b: Expr<T1, App<F, T1 | T2>, C>) => BoolExpr<App<F, T1>, App<F, T2>, C>;
|
|
774
|
-
declare const ne: <T, D, C = unknown>(a: Expr<T, D, C>) => <K>(b: Expr<K, D, C>) => Expr<boolean, D, C>;
|
|
775
|
-
declare const notNull: <T, D, C>(a: Expr<T, D, C>) => Expr<boolean, D, C>;
|
|
776
|
-
declare const $ifNull: {
|
|
777
|
-
<R, D, C = unknown>(...expr: [...Expr<R | null | undefined, D, C>[], Expr<R, D, C>]): Expr<R, D, C>;
|
|
778
|
-
<R, D, C = unknown>(...expr: [Expr<R, D, C>, ...Expr<R | null | undefined, D, C>[]]): Expr<R, D, C>;
|
|
779
|
-
};
|
|
780
|
-
declare const exprMapVal: <K extends string, T extends Partial<Record<K, rawItem>>, D, C>(expr: Expr<K, D, C>, map: { readonly [P in K]: Expr<T[P], D, C>; }, or?: Expr<T[K], D, C>) => Expr<T[K & keyof T], D, C>;
|
|
781
|
-
declare const mapVal: <K extends string, T extends Partial<Record<K, rawItem>>, D, C>(expr: Expr<K, D, C>, map: T, or: T[K & keyof T]) => Expr<T[K & keyof T], D, C>;
|
|
782
|
-
declare const setField: <K extends string, T, V, D, C>({ field, input, value, }: {
|
|
783
|
-
field: Expr<K, D, C>;
|
|
784
|
-
input: Expr<T, D, C>;
|
|
785
|
-
value: Expr<V, D, C>;
|
|
786
|
-
}) => Expr<T & Record<K, V>, D, C>;
|
|
787
|
-
|
|
788
|
-
declare const range: <D, C>(start: Expr<number, D, C>, end: Expr<number, D, C>, step?: Expr<number, D, C>) => Expr<Arr<number>, D, C>;
|
|
789
|
-
declare const $map0: <K extends string, T, R, D, C>({ as, expr, input, }: {
|
|
790
|
-
input: Expr<Arr<T>, D, C>;
|
|
791
|
-
as: K;
|
|
792
|
-
expr: Expr<R, D, RORec<K, T> & C>;
|
|
793
|
-
}) => Expr<Arr<R>, D, C>;
|
|
794
|
-
declare const $map1: <T, R, D, C>(ex: Expr<Arr<T>, D, C>, map: (i: Field<unknown, T, RORec<"item", T>>) => Expr<R, D, RORec<"item", T> & C>) => Expr<Arr<R>, D, C>;
|
|
795
|
-
declare const $map: <T, R, D, C = unknown>(ex: Expr<Arr<T>, D, C>, map: (i: Expr<T, D, RORec<"item", T>>) => Expr<R, D, RORec<"item", T> & C>) => Expr<Arr<R>, D, C>;
|
|
796
|
-
|
|
797
|
-
declare class Machine<Result = unknown> {
|
|
798
|
-
private sources;
|
|
799
|
-
constructor(root?: Iterator<Result, HasJob>);
|
|
800
|
-
add(x: Iterator<Result, HasJob>): void;
|
|
801
|
-
runner(): Iterator<Result, HasJob>;
|
|
802
|
-
start(cb?: (info: HasJob) => void | boolean): Promise<never>;
|
|
803
|
-
}
|
|
804
|
-
declare const wrap: <Result>(root: Machine<Result>) => Machine<Result>;
|
|
805
|
-
|
|
806
|
-
declare const $eq: <T extends unknown>(operand: rawItem & T) => Predicate<T>;
|
|
807
|
-
declare const $ne: <T extends unknown>(operand: rawItem & T) => Predicate<T>;
|
|
808
|
-
type Numeric = number | Timestamp | Date;
|
|
809
|
-
declare const comp: <D2 extends Numeric = Numeric>(op: "$gt" | "$gte" | "$lt" | "$lte") => <T extends Numeric>(operand: rawItem & D2) => Predicate<D2>;
|
|
810
|
-
declare const $gt: <T extends Numeric>(operand: rawItem & Numeric) => Predicate<Numeric>;
|
|
811
|
-
declare const $gtTs: <T extends Numeric>(operand: rawItem & Timestamp) => Predicate<Timestamp>;
|
|
812
|
-
declare const $gteTs: <T extends Numeric>(operand: rawItem & Timestamp) => Predicate<Timestamp>;
|
|
813
|
-
declare const $lt: <T extends Numeric>(operand: rawItem & number) => Predicate<number>;
|
|
814
|
-
declare const dateLt: <T extends Numeric>(operand: rawItem & Date) => Predicate<Date>;
|
|
815
|
-
declare const $gte: <T extends Numeric>(operand: rawItem & number) => Predicate<number>;
|
|
816
|
-
declare const $lte: <T extends Numeric>(operand: rawItem & number) => Predicate<number>;
|
|
817
|
-
type MongoTypes = {
|
|
818
|
-
number: number;
|
|
819
|
-
array: Arr<rawItem>;
|
|
820
|
-
string: string;
|
|
821
|
-
object: RawObj;
|
|
822
|
-
[i: number]: unknown;
|
|
823
|
-
};
|
|
824
|
-
type MongoTypeNames = keyof MongoTypes;
|
|
825
|
-
declare const $type: <T extends keyof MongoTypes>(operand: rawItem & readonly T[]) => Predicate<N | MongoTypes[T]>;
|
|
826
|
-
declare const $exists: <T extends keyof MongoTypes>(operand: rawItem & boolean) => Predicate<unknown>;
|
|
827
|
-
|
|
828
|
-
declare const $expr: <D extends O, C>(expr: Expr<boolean, D, C>) => Query<D, C>;
|
|
829
|
-
|
|
830
|
-
declare const $in: <T extends unknown>(operand: rawItem & readonly T[]) => Predicate<T>;
|
|
831
|
-
declare const $nin: <T extends unknown>(operand: rawItem & readonly T[]) => Predicate<T>;
|
|
832
|
-
|
|
833
|
-
type Many<T> = readonly (T | N)[];
|
|
834
|
-
type Combiner = {
|
|
835
|
-
<T extends O, C = unknown>(first: Query<T, C>, ...args: Many<Query<T, C>>): Query<T, C>;
|
|
836
|
-
<T extends O, C = unknown>(...args: Many<Query<T, C>>): Query<T, C> | undefined;
|
|
837
|
-
};
|
|
838
|
-
declare const $and: Combiner;
|
|
839
|
-
declare const $nor: Combiner;
|
|
840
|
-
declare const $or: Combiner;
|
|
841
|
-
|
|
842
|
-
declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Promise<Document>;
|
|
843
|
-
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
844
|
-
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
845
|
-
|
|
846
|
-
export { $accumulator, $and, $countDict, $countDictArray, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $mergeId, $mergePart, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $substr, $sum, $type, $unwind, $unwindDelta, Expr, Field, Machine, Type, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, emptyDelta, enablePreAndPostImages, eq, eqExtends, eqPar, eqTyped, except, excludeIdem, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, fromEq, func, getSubsetMatchForExt, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, joinIdOf, last, literalsEqaul, log, lt, lte, makeCol, map, map1, mapExact, mapExact0, mapExact1, mapExactToObject, mapExactToObject0, mapExactToObject1, mapFromPlainDateTime, mapToPlainDateTime, mapVal, matchDelta, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, min, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, omitExclude, omitPick, omitRORec, or, padLeft, prepare, rand, range, reflex, regex, renamedFields, root, set, setField, single, size, slice, sortArray, spread, spread0, staging, startOf, str, sub, subtract, sym, to, toInt, translateOmit, val, weekPart, wrap, year };
|
|
847
|
-
export type { Accumulators, AddO, And, App, AppMap, AppMapRW, ApplyHKT, Arr, ArrHKT, AsLiteral, ConstHKT, DeepFieldHKT, Delta, DeltaAccumulator, DeltaAccumulatorHKT, DeltaAccumulators, DeltaStages, Equal, Exact, ExactKeys, ExactPart, ExactPart1, ExprHKT, Exprs, ExprsExact, ExprsExactHKT, ExprsPart, FieldHKT, GroupCollection, GroupIdCollection, GroupMergeCollection, GroupMergeOut, HKT, I, ID, IdHKT, JoinId, Loose, MapK, MapKDom, MapKPart1, MapO, MapOPart, MappedHKT, Merge, MergeArgs, MergeHKT, MergeInto, MergeMapOArgs, MergedInput, Model, MongoTypeNames, N, NullToOBJ, O, OPick, OPickD, Patch, PromiseHKT, RConstHKT, RORec, RWCollection, RawStages, Rec, RecHKT, RecordHKT, Replace, SnapshotStreamExecutionResult, StrKey, Strict, TS, UBeforeHKT, WithKey1, WriteonlyCollection, doc, jsonPrim, notArr, µ };
|
|
1
|
+
export * from './lib/accumulators';
|
|
2
|
+
export * from './lib/aggregate';
|
|
3
|
+
export * from './lib/boot';
|
|
4
|
+
export * from './lib/expression';
|
|
5
|
+
export * from './lib/field';
|
|
6
|
+
export * from './lib/update';
|
|
7
|
+
export * from './lib/machine';
|
|
8
|
+
export * from './lib/predicate';
|
|
9
|
+
export * from './lib/query';
|
|
10
|
+
export * from './lib/utils';
|
|
11
|
+
export * from './lib/types/extern';
|
|
12
|
+
export * from './types/extern';
|
|
13
|
+
export { enablePreAndPostImages, prepare, makeCol } from './test/mongodb';
|