@omegup/msync 0.0.4 → 0.0.5
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 +3 -1
- package/index.js +3 -1
- package/lib/accumulators/index.d.ts +10 -0
- package/lib/aggregate/$merge.d.ts +8 -0
- package/lib/aggregate/$upsert.d.ts +9 -0
- package/lib/aggregate/group/$group-merge.d.ts +12 -0
- package/lib/aggregate/group/index.d.ts +2 -0
- package/lib/aggregate/group/utils/sub-group.d.ts +6 -0
- package/lib/aggregate/group/utils/sub-merge.d.ts +15 -0
- package/lib/aggregate/index.d.ts +8 -0
- package/lib/aggregate/lookup/$lookup-delta.d.ts +10 -0
- package/lib/aggregate/lookup/$lookup-raw.d.ts +9 -0
- package/lib/aggregate/lookup/index.d.ts +11 -0
- package/lib/aggregate/match/$match-delta.d.ts +3 -0
- package/lib/aggregate/match/$match.d.ts +3 -0
- package/lib/aggregate/match/index.d.ts +2 -0
- package/lib/aggregate/mongo-stages.d.ts +13 -0
- package/lib/aggregate/out.d.ts +34 -0
- package/lib/aggregate/prefix.d.ts +33 -0
- package/lib/aggregate/raws.d.ts +17 -0
- package/lib/aggregate/set/$replace-with-each.d.ts +12 -0
- package/lib/aggregate/set/$set-delta.d.ts +5 -0
- package/lib/aggregate/set/$set.d.ts +6 -0
- package/lib/aggregate/set/index.d.ts +1 -0
- package/lib/aggregate/unwind/$unwind-delta.d.ts +5 -0
- package/lib/aggregate/unwind/index.d.ts +5 -0
- package/lib/boot/boot-simpl.d.ts +14 -0
- package/lib/boot/boot.d.ts +16 -0
- package/lib/boot/index.d.ts +2 -0
- package/lib/expression/arith.d.ts +26 -0
- package/lib/expression/array.d.ts +25 -0
- package/lib/expression/concat.d.ts +30 -0
- package/lib/expression/date.d.ts +16 -0
- package/lib/expression/expr-base.d.ts +5 -0
- package/lib/expression/index.d.ts +7 -0
- package/lib/expression/logic.d.ts +21 -0
- package/lib/expression/range.d.ts +6 -0
- package/lib/expression/val.d.ts +25 -0
- package/lib/field/field.d.ts +25 -0
- package/lib/field/index.d.ts +1 -0
- package/lib/machine.d.ts +9 -0
- package/lib/predicate/$eq.d.ts +13 -0
- package/lib/predicate/$expr.d.ts +3 -0
- package/lib/predicate/$in.d.ts +2 -0
- package/lib/predicate/index.d.ts +3 -0
- package/lib/predicate/utils.d.ts +5 -0
- package/lib/query/index.d.ts +1 -0
- package/lib/query/logic.d.ts +11 -0
- package/lib/stream/aggregate.d.ts +7 -0
- package/lib/types/accumulator.d.ts +30 -0
- package/lib/types/aggregate.d.ts +9 -0
- package/lib/types/expr.d.ts +27 -0
- package/lib/types/extern.d.ts +3 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/lookup.d.ts +19 -0
- package/lib/types/machine.d.ts +17 -0
- package/lib/types/predicate.d.ts +14 -0
- package/lib/types/query.d.ts +12 -0
- package/lib/types/stream.d.ts +55 -0
- package/lib/update/index.d.ts +1 -0
- package/lib/update/updater.d.ts +19 -0
- package/lib/utils/before.d.ts +3 -0
- package/lib/utils/coll.d.ts +5 -0
- package/lib/utils/db-indexes.d.ts +4 -0
- package/lib/utils/guard.d.ts +18 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/json.d.ts +9 -0
- package/lib/utils/log.d.ts +1 -0
- package/lib/utils/map-object.d.ts +41 -0
- package/lib/utils/merge/combiners.d.ts +6 -0
- package/lib/utils/merge/index.d.ts +2 -0
- package/lib/utils/merge/merge.d.ts +7 -0
- package/lib/utils/merge/next-winner.d.ts +3 -0
- package/lib/utils/merge/types.d.ts +19 -0
- package/lib/utils/merge/utils.d.ts +4 -0
- package/lib/utils/tear-down.d.ts +2 -0
- package/lib/watch.d.ts +15 -0
- package/package.json +1 -1
- package/test/mongodb.d.ts +9 -0
- package/test/uri.d.ts +1 -0
- package/types/class.d.ts +1 -0
- package/types/extern.d.ts +3 -0
- package/types/global.d.ts +44 -0
- package/types/hkt.d.ts +56 -0
- package/types/index.d.ts +6 -0
- package/types/json.d.ts +54 -0
- package/types/mongo.d.ts +24 -0
- package/types/view.d.ts +35 -0
package/types/json.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Timestamp } from 'mongodb';
|
|
2
|
+
import { Type } from './class';
|
|
3
|
+
export { Type } from './class';
|
|
4
|
+
export type U = undefined;
|
|
5
|
+
export type N = null | U;
|
|
6
|
+
export type jsonPrim = number | null | string | boolean | Timestamp | Date;
|
|
7
|
+
export type notObj = jsonPrim | U;
|
|
8
|
+
export type notArr = notObj | O;
|
|
9
|
+
export type jsonItem = unknown;
|
|
10
|
+
export type rawItem = jsonPrim | raw | U;
|
|
11
|
+
export type Undef<I extends N> = I | (I extends never ? I : notObj);
|
|
12
|
+
export declare const object: unique symbol;
|
|
13
|
+
export declare const array: unique symbol;
|
|
14
|
+
export interface JsonArr {
|
|
15
|
+
[Type]: typeof array;
|
|
16
|
+
readonly [_: number]: jsonItem | U;
|
|
17
|
+
}
|
|
18
|
+
export type A = {
|
|
19
|
+
[Type]: typeof array;
|
|
20
|
+
};
|
|
21
|
+
export type Arr<T, N extends number = number> = A & {
|
|
22
|
+
readonly [_ in N]: T;
|
|
23
|
+
};
|
|
24
|
+
type Obj = {
|
|
25
|
+
[Type]: typeof object;
|
|
26
|
+
};
|
|
27
|
+
export type O<T = unknown> = Obj & T;
|
|
28
|
+
export type RORec<K extends keyof never, T = unknown> = {
|
|
29
|
+
readonly [P in K]: T;
|
|
30
|
+
};
|
|
31
|
+
export type Par<K extends string, V extends Rec<K, jsonItem>> = {
|
|
32
|
+
readonly [k in K]?: V[k] | N;
|
|
33
|
+
};
|
|
34
|
+
export type Rec<K extends string, T = unknown> = O<RORec<K, T>>;
|
|
35
|
+
export type O2 = readonly [O, O];
|
|
36
|
+
export type O3 = readonly [O, O, O];
|
|
37
|
+
export type ID = {
|
|
38
|
+
readonly _id: string;
|
|
39
|
+
};
|
|
40
|
+
export type doc = O & ID;
|
|
41
|
+
export interface RawObj {
|
|
42
|
+
readonly [_: string]: rawItem | U;
|
|
43
|
+
}
|
|
44
|
+
export type raw = readonly rawItem[] | RawObj;
|
|
45
|
+
export type StrKey<T> = string & keyof T;
|
|
46
|
+
export type Replace<R, V> = Omit<R, StrKey<V>> & V & O;
|
|
47
|
+
export type AsLiteral<T extends keyof any | boolean, V = NoUnion<T>> = T extends keyof any ? {} extends {
|
|
48
|
+
[K in T]: 1;
|
|
49
|
+
} ? never : V : V;
|
|
50
|
+
type NoUnion<T, V = T> = T extends unknown ? ([V] extends [T] ? T : never) : never;
|
|
51
|
+
export type Literal<K> = string extends K ? never : K;
|
|
52
|
+
export type RemoveSignature<T> = {
|
|
53
|
+
[K in keyof T as Literal<K>]: T[K];
|
|
54
|
+
};
|
package/types/mongo.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'mongodb';
|
|
2
|
+
import { BSON } from 'mongodb';
|
|
3
|
+
export declare const RawStage: unique symbol;
|
|
4
|
+
declare module 'mongodb' {
|
|
5
|
+
interface Collection<TSchema extends BSON.Document = BSON.Document> {
|
|
6
|
+
[RawStage]: {
|
|
7
|
+
(_: 2): TSchema;
|
|
8
|
+
(_: 1, x: TSchema): TSchema;
|
|
9
|
+
};
|
|
10
|
+
s: {
|
|
11
|
+
db: Db;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface Db {
|
|
15
|
+
s: {
|
|
16
|
+
client?: MongoClient;
|
|
17
|
+
};
|
|
18
|
+
client: MongoClient;
|
|
19
|
+
}
|
|
20
|
+
interface Timestamp {
|
|
21
|
+
toExtendedJSON(): BSON.TimestampExtended;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export * from 'mongodb';
|
package/types/view.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Collection, Db } from 'mongodb';
|
|
2
|
+
import type { Del, Expr, Model, Query } from '../lib/types';
|
|
3
|
+
import type { ExactKeys } from '../lib/utils/map-object';
|
|
4
|
+
import type { O, StrKey } from './json';
|
|
5
|
+
import type { RawStage } from './mongo';
|
|
6
|
+
interface CommonCollection {
|
|
7
|
+
readonly s: {
|
|
8
|
+
readonly db: Db;
|
|
9
|
+
};
|
|
10
|
+
collectionName: string;
|
|
11
|
+
namespace: string;
|
|
12
|
+
dbName: string;
|
|
13
|
+
createIndex: Collection['createIndex'];
|
|
14
|
+
}
|
|
15
|
+
export interface ReadonlyCollection<out Out> extends CommonCollection {
|
|
16
|
+
[RawStage](_: 2): Out;
|
|
17
|
+
}
|
|
18
|
+
export interface WriteonlyCollection<in R> extends CommonCollection {
|
|
19
|
+
[RawStage]: {
|
|
20
|
+
(_: 1, x: R): unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface RWCollection<in R extends O, out Out extends O = R> extends CommonCollection {
|
|
24
|
+
[RawStage](_: 2): Out;
|
|
25
|
+
[RawStage](_: 1, x: R): unknown;
|
|
26
|
+
}
|
|
27
|
+
export type OPick<V, K extends StrKey<V>, E extends StrKey<V> = never> = O & Pick<V, K | E>;
|
|
28
|
+
export type OPickD<V extends Model, K extends StrKey<V>> = OPick<V, K, 'deletedAt' | '_id'>;
|
|
29
|
+
export type View<V extends Model, K extends StrKey<V>> = {
|
|
30
|
+
collection: ReadonlyCollection<V | Del>;
|
|
31
|
+
projection: ExactKeys<K>;
|
|
32
|
+
match?: Expr<boolean, OPickD<V, K>>;
|
|
33
|
+
hardMatch?: Query<V>;
|
|
34
|
+
};
|
|
35
|
+
export {};
|