@omegup/msync 0.0.44 → 0.0.46

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.
Files changed (88) hide show
  1. package/index.esm.js +18 -12
  2. package/index.js +18 -12
  3. package/package.json +1 -1
  4. package/lib/accumulators/index.d.ts +0 -10
  5. package/lib/aggregate/$merge.d.ts +0 -10
  6. package/lib/aggregate/$upsert.d.ts +0 -11
  7. package/lib/aggregate/group/$group-merge.d.ts +0 -12
  8. package/lib/aggregate/group/index.d.ts +0 -2
  9. package/lib/aggregate/group/utils/sub-group.d.ts +0 -6
  10. package/lib/aggregate/group/utils/sub-merge.d.ts +0 -15
  11. package/lib/aggregate/index.d.ts +0 -8
  12. package/lib/aggregate/lookup/$lookup-delta.d.ts +0 -10
  13. package/lib/aggregate/lookup/$lookup-raw.d.ts +0 -9
  14. package/lib/aggregate/lookup/index.d.ts +0 -16
  15. package/lib/aggregate/match/$match-delta.d.ts +0 -3
  16. package/lib/aggregate/match/$match.d.ts +0 -3
  17. package/lib/aggregate/match/index.d.ts +0 -2
  18. package/lib/aggregate/mongo-stages.d.ts +0 -13
  19. package/lib/aggregate/out.d.ts +0 -34
  20. package/lib/aggregate/prefix.d.ts +0 -33
  21. package/lib/aggregate/raws.d.ts +0 -17
  22. package/lib/aggregate/set/$replace-with-each.d.ts +0 -12
  23. package/lib/aggregate/set/$set-delta.d.ts +0 -5
  24. package/lib/aggregate/set/$set.d.ts +0 -6
  25. package/lib/aggregate/set/index.d.ts +0 -1
  26. package/lib/aggregate/unwind/$unwind-delta.d.ts +0 -5
  27. package/lib/aggregate/unwind/index.d.ts +0 -5
  28. package/lib/boot/boot-simpl.d.ts +0 -14
  29. package/lib/boot/boot.d.ts +0 -36
  30. package/lib/boot/index.d.ts +0 -2
  31. package/lib/expression/arith.d.ts +0 -26
  32. package/lib/expression/array.d.ts +0 -26
  33. package/lib/expression/concat.d.ts +0 -30
  34. package/lib/expression/date.d.ts +0 -17
  35. package/lib/expression/expr-base.d.ts +0 -5
  36. package/lib/expression/index.d.ts +0 -7
  37. package/lib/expression/logic.d.ts +0 -22
  38. package/lib/expression/range.d.ts +0 -6
  39. package/lib/expression/val.d.ts +0 -25
  40. package/lib/field/field.d.ts +0 -25
  41. package/lib/field/index.d.ts +0 -1
  42. package/lib/machine.d.ts +0 -9
  43. package/lib/predicate/$eq.d.ts +0 -13
  44. package/lib/predicate/$expr.d.ts +0 -3
  45. package/lib/predicate/$in.d.ts +0 -2
  46. package/lib/predicate/index.d.ts +0 -3
  47. package/lib/predicate/utils.d.ts +0 -5
  48. package/lib/query/index.d.ts +0 -1
  49. package/lib/query/logic.d.ts +0 -11
  50. package/lib/stream/aggregate.d.ts +0 -7
  51. package/lib/types/accumulator.d.ts +0 -30
  52. package/lib/types/aggregate.d.ts +0 -9
  53. package/lib/types/expr.d.ts +0 -27
  54. package/lib/types/extern.d.ts +0 -3
  55. package/lib/types/index.d.ts +0 -8
  56. package/lib/types/lookup.d.ts +0 -19
  57. package/lib/types/machine.d.ts +0 -17
  58. package/lib/types/predicate.d.ts +0 -14
  59. package/lib/types/query.d.ts +0 -12
  60. package/lib/types/stream.d.ts +0 -67
  61. package/lib/update/index.d.ts +0 -1
  62. package/lib/update/updater.d.ts +0 -19
  63. package/lib/utils/before.d.ts +0 -3
  64. package/lib/utils/coll.d.ts +0 -5
  65. package/lib/utils/db-indexes.d.ts +0 -4
  66. package/lib/utils/guard.d.ts +0 -18
  67. package/lib/utils/index.d.ts +0 -3
  68. package/lib/utils/json.d.ts +0 -9
  69. package/lib/utils/log.d.ts +0 -1
  70. package/lib/utils/map-object.d.ts +0 -41
  71. package/lib/utils/merge/combiners.d.ts +0 -6
  72. package/lib/utils/merge/index.d.ts +0 -2
  73. package/lib/utils/merge/merge.d.ts +0 -7
  74. package/lib/utils/merge/next-winner.d.ts +0 -3
  75. package/lib/utils/merge/types.d.ts +0 -19
  76. package/lib/utils/merge/utils.d.ts +0 -4
  77. package/lib/utils/tear-down.d.ts +0 -2
  78. package/lib/watch.d.ts +0 -15
  79. package/test/mongodb.d.ts +0 -9
  80. package/test/uri.d.ts +0 -1
  81. package/types/class.d.ts +0 -1
  82. package/types/extern.d.ts +0 -3
  83. package/types/global.d.ts +0 -50
  84. package/types/hkt.d.ts +0 -56
  85. package/types/index.d.ts +0 -6
  86. package/types/json.d.ts +0 -54
  87. package/types/mongo.d.ts +0 -24
  88. package/types/view.d.ts +0 -35
package/lib/watch.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import type { BSON, Db, Timestamp } from 'mongodb';
2
- import type { O, StrKey, View } from '../types';
3
- import { type Field } from './field';
4
- import type { Model, Query } from './types';
5
- export declare const changeKeys: readonly ["fullDocument", "fullDocumentBeforeChange"];
6
- export type ChangeKey = (typeof changeKeys)[number];
7
- export type Change<T extends Model> = O<{
8
- readonly fullDocument: T;
9
- readonly fullDocumentBeforeChange: T;
10
- }>;
11
- export declare const subQ: <D extends O, C, DeltaD extends O>(a: Query<D, C>, f: Field<DeltaD, D>) => Query<DeltaD, C>;
12
- export declare const makeWatchStream: <V extends Model, K extends StrKey<V>>(db: Db, { collection, projection: p, hardMatch: m }: View<V, K>, startAt: Timestamp, streamName: string) => {
13
- tryNext: () => Promise<import("mongodb").ChangeStreamDocument<BSON.Document> | null>;
14
- close: () => Promise<void>;
15
- };
package/test/mongodb.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { Collection, MongoClient } from 'mongodb';
2
- import type { AsynIter, Iterator } from '../lib/types';
3
- import type { ID, doc } from '../types';
4
- import type { Db, OptionalUnlessRequiredId } from 'mongodb';
5
- export declare const run: <T, Info>(cont: Iterator<T, Info>) => Promise<never>;
6
- export declare const iterate: <T>([, next]: AsynIter<T>) => PromiseLike<never>;
7
- export declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Promise<import("mongodb").Document>;
8
- export declare const prepare: (testName?: string) => Promise<MongoClient>;
9
- export declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
package/test/uri.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const uri: string;
package/types/class.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const Type: unique symbol;
package/types/extern.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export type { Type } from './class';
2
- export type { Arr, ID, N, O, Rec, StrKey, doc, OPick, OPickD, RORec, Replace } from './index';
3
- export type { AsLiteral, notArr, WriteonlyCollection, Collection, Timestamp } from './index';
package/types/global.d.ts DELETED
@@ -1,50 +0,0 @@
1
- import type { App, AppMap, AppMapRW, HKT, PromiseHKT } from './hkt';
2
- import type { RORec, StrKey } from './json';
3
- export type AsNum<R> = R extends `${infer A extends number}` ? A : never;
4
- export type GetDom<Dom = unknown> = readonly [readonly Dom[], keyof any];
5
- declare global {
6
- type Entry<T, K extends keyof T = keyof T> = readonly [string, T[string & K]] & {
7
- [k in K]: readonly [string & k, T[k]];
8
- }[K];
9
- interface ObjectConstructor {
10
- entries<T, _ = 0>(object?: T): readonly Entry<T>[];
11
- fromEntries<T, _ = 0>(entries: readonly Entry<T>[]): T;
12
- keys<T, _ extends 1>(obj: T): readonly StrKey<T>[];
13
- }
14
- interface ReadonlyArray<T> {
15
- includes<T, V extends T>(this: ReadonlyArray<V>, item: T, fromIndex?: number): item is V;
16
- map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
17
- map<K extends string, T extends RORec<K>, U extends RORec<K>, _ extends 2 = 2>(this: readonly Entry<T, K>[], callbackfn: <P extends K>(value: [P, T[P]], index: number, array: this) => readonly [P, U[P]], thisArg?: any): readonly Entry<U, K>[];
18
- map<V extends ReadonlyArray<unknown>, F extends HKT<unknown>, G extends HKT<unknown>, _ extends 1 = 1>(this: AppMap<F, V>, callbackfn: <I extends keyof V>(value: App<F, V[I]>, index: AsNum<I>, array: V) => App<G, V[I]>, thisArg?: any): AppMapRW<G, V>;
19
- reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
20
- reduce<V extends ReadonlyArray<unknown>, F extends HKT, U>(this: AppMap<F, V>, callbackfn: <I extends keyof V>(previousValue: U, currentValue: App<F, V[I]>, currentIndex: AsNum<I>, array: V) => U, initialValue: U): U;
21
- map<V extends ReadonlyArray<Dom>, F extends HKT<Dom>, G extends HKT<GetDom<Dom>>, Dom = unknown, _ extends 0 = 0>(this: AppMap<F, V, Dom>, callbackfn: <I extends keyof V>(value: App<F, V[I] & Dom>, index: AsNum<I>, array: V) => App<G, [V, I]>, thisArg?: any): AppMapRW<G, {
22
- [I in keyof V]: [V, I];
23
- }, GetDom<Dom>>;
24
- }
25
- interface Array<T> extends ReadonlyArray<T> {
26
- includes<T, V extends T>(this: ReadonlyArray<V>, item: T, fromIndex?: number): item is V;
27
- map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
28
- map<K extends string, T extends RORec<K>, U extends RORec<K>, _ extends 2 = 2>(this: readonly Entry<T, K>[], callbackfn: <P extends K>(value: [P, T[P]], index: number, array: this) => readonly [P, U[P]], thisArg?: any): readonly Entry<U, K>[];
29
- map<V extends ReadonlyArray<unknown>, F extends HKT<unknown>, G extends HKT<unknown>, _ extends 1 = 1>(this: AppMap<F, V>, callbackfn: <I extends keyof V>(value: App<F, V[I]>, index: AsNum<I>, array: V) => App<G, V[I]>, thisArg?: any): AppMapRW<G, V>;
30
- reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
31
- reduce<V extends ReadonlyArray<unknown>, F extends HKT, U>(this: AppMap<F, V>, callbackfn: <I extends keyof V>(previousValue: U, currentValue: App<F, V[I]>, currentIndex: AsNum<I>, array: V) => U, initialValue: U): U;
32
- map<V extends ReadonlyArray<Dom>, F extends HKT<Dom>, G extends HKT<GetDom<Dom>>, Dom = unknown, _ extends 0 = 0>(this: AppMap<F, V, Dom>, callbackfn: <I extends keyof V>(value: App<F, V[I] & Dom>, index: AsNum<I>, array: V) => App<G, [V, I]>, thisArg?: any): AppMapRW<G, {
33
- [I in keyof V]: [V, I];
34
- }, GetDom<Dom>>;
35
- }
36
- interface PromiseConstructor {
37
- all<T extends readonly unknown[] | []>(values: AppMap<PromiseHKT, T>): Promise<T>;
38
- race<T extends readonly unknown[] | [], _ extends 0 = 0>(values: AppMap<PromiseHKT, T>): Promise<T[number]>;
39
- all<T extends readonly unknown[] | []>(values: T): Promise<{
40
- -readonly [P in keyof T]: Awaited<T[P]>;
41
- }>;
42
- race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
43
- }
44
- }
45
- declare module 'synchronous-promise' {
46
- interface SynchronousPromiseConstructor {
47
- any<T extends readonly unknown[] | [], _ extends 0 = 0>(values: AppMap<PromiseHKT, T>): SynchronousPromise<T[number]>;
48
- any<T extends readonly unknown[] | []>(values: T): SynchronousPromise<Awaited<T[number]>>;
49
- }
50
- }
package/types/hkt.d.ts DELETED
@@ -1,56 +0,0 @@
1
- import type { UBefore } from "../lib/types";
2
- import type { Rec } from "./json";
3
- export interface HKT<in Dom = unknown, out Im = unknown> {
4
- readonly in: (x: Dom) => void;
5
- readonly out: Im;
6
- }
7
- export type App<F extends HKT<X>, X> = (F & {
8
- readonly in: (x: X) => void;
9
- })['out'];
10
- export type I<Dom, F extends HKT<Dom>> = F['in'] extends (x: infer X extends Dom) => void ? X : never;
11
- export interface ArrHKT<Dom = unknown> extends HKT<Dom> {
12
- readonly out: readonly I<Dom, this>[];
13
- }
14
- export interface IdHKT<Dom = unknown> extends HKT<Dom> {
15
- readonly out: I<Dom, this>;
16
- }
17
- export interface RConstHKT<Im, Dom = Im> extends HKT<Im, HKT<Dom, Im>> {
18
- readonly out: ConstHKT<I<Im, this>, Dom>;
19
- }
20
- export interface ConstHKT<Im, Dom = unknown> extends HKT<Dom, Im> {
21
- readonly out: Im;
22
- }
23
- type ApplyF<Dom, Im, T extends [Dom, HKT<Dom, Im>]> = App<T[1], T[0]>;
24
- export interface ApplyHKT<Dom, Im> extends HKT<[Dom, HKT<Dom, Im>], Im> {
25
- readonly out: ApplyF<Dom, Im, I<[Dom, HKT<Dom, Im>], this>>;
26
- }
27
- export interface µ<X extends [HKT<A, B>, HKT<B, C>], A = unknown, B = unknown, C = unknown> extends HKT<A, C> {
28
- readonly out: App<X[1], App<X[0], I<A, this>>>;
29
- }
30
- export type AppMap<F extends HKT<Dom>, X extends readonly Dom[], Dom = unknown> = readonly App<F, Dom>[] & {
31
- [I in keyof X]: App<F, X[I]>;
32
- };
33
- export type AppMapRW<F extends HKT<Dom>, X extends readonly Dom[], Dom = unknown> = App<F, Dom>[] & {
34
- [I in keyof X]: App<F, X[I]>;
35
- };
36
- export interface PromiseHKT<Dom = unknown> extends HKT<Dom> {
37
- readonly out: PromiseLike<I<Dom, this>>;
38
- }
39
- export interface DeepFieldHKT<R, T, K extends keyof T, F extends HKT<R, T>> extends HKT<R, T[K]> {
40
- readonly out: App<F, I<R, this>>[K];
41
- }
42
- export interface FieldHKT<K extends string> extends DeepFieldHKT<Record<K, unknown>, Record<K, unknown>, K, IdHKT<Record<K, unknown>>> {
43
- }
44
- export interface RecordHKT<K extends string, Dom = unknown> extends HKT<Dom, Record<K, Dom>> {
45
- readonly out: Record<K, I<Dom, this>>;
46
- }
47
- export interface RecHKT<K extends string, Dom = unknown, E = unknown> extends HKT<Dom, Rec<K, Dom>> {
48
- readonly out: Rec<K, I<Dom, this>> & E;
49
- }
50
- export interface UBeforeHKT<Dom = unknown> extends HKT<Dom, UBefore<Dom>> {
51
- readonly out: UBefore<I<Dom, this>>;
52
- }
53
- export interface And<E> extends HKT {
54
- readonly out: E & I<unknown, this>;
55
- }
56
- export {};
package/types/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from './global';
2
- export * from './json';
3
- export * from './hkt';
4
- export * from './class';
5
- export * from './view';
6
- export * from './mongo';
package/types/json.d.ts DELETED
@@ -1,54 +0,0 @@
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 DELETED
@@ -1,24 +0,0 @@
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 DELETED
@@ -1,35 +0,0 @@
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 {};