@resolveio/server-lib 12.2.4 → 12.2.6

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { AggregateOptions, AggregationCursor, BulkWriteOptions, ChangeStream, ChangeStreamOptions, CollStats, CollStatsOptions, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, RenameOptions, ReplaceOptions, UpdateOptions, Collection } from 'mongodb';
2
+ import { AggregateOptions, AggregationCursor, BulkWriteOptions, ChangeStream, ChangeStreamOptions, CollStats, CollStatsOptions, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, Filter, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, RenameOptions, ReplaceOptions, UpdateOptions, Collection, IndexSpecification, UpdateFilter } from 'mongodb';
3
3
  import { LookupTables } from '../models/report-builder.model';
4
4
  import { UserModel } from '../models/user.model';
5
5
  import { CollectionDocument, Document } from '../models/collection-document.model';
@@ -17,59 +17,6 @@ interface MongoQueueModel {
17
17
  cacheId: number;
18
18
  invalidateFlag: boolean;
19
19
  }
20
- export declare interface MongoManagerFilterParamaterOperators<P> {
21
- $eq?: P;
22
- $gt?: P;
23
- $gte?: P;
24
- $in?: P extends Array<any> ? P : P[];
25
- $lt?: P;
26
- $lte?: P;
27
- $ne?: P;
28
- $nin?: P extends Array<any> ? P : P[];
29
- $not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;
30
- $exists?: boolean;
31
- $expr?: any[];
32
- $regex?: P extends string ? RegExpConstructor | string : never;
33
- $options?: P extends string ? string : never;
34
- $geoIntersects?: {
35
- $geometry: Document;
36
- };
37
- $geoWithin?: Document;
38
- $near?: Document;
39
- $nearSphere?: Document;
40
- $maxDistance?: number;
41
- $all?: any[];
42
- $elemMatch?: Document;
43
- $size?: P extends any[] ? number : never;
44
- }
45
- export declare interface MongoManagerFilterOperators<T> extends Document {
46
- $and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;
47
- $nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;
48
- $or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;
49
- $text?: {
50
- $search: string;
51
- $language?: string;
52
- $caseSensitive?: boolean;
53
- $diacriticSensitive?: boolean;
54
- };
55
- $where?: string | ((this: T) => boolean);
56
- $comment?: string | Document;
57
- }
58
- export declare type MongoManagerFilter<T> = {
59
- [P in keyof T]?: T[P] | MongoManagerFilterParamaterOperators<T[P]>;
60
- };
61
- export declare type MongoManagerUnsetFilter<T> = {
62
- [P in keyof T]?: number | boolean;
63
- };
64
- export declare type MongoManagerIncFilter<T> = {
65
- [P in keyof T]?: number;
66
- };
67
- export declare type MongoManagerUpdateFilter<T> = {
68
- $inc?: MongoManagerIncFilter<T> | Document;
69
- $set?: MongoManagerFilter<T> | Document;
70
- $setOnInsert?: MongoManagerFilter<T> | Document;
71
- $unset?: MongoManagerUnsetFilter<T> | Document;
72
- };
73
20
  export declare class MongoManager {
74
21
  private _collections;
75
22
  private _mongoQueue;
@@ -126,35 +73,35 @@ export declare class MongoManagerCollection<T extends CollectionDocument> {
126
73
  aggregateCount(pipeline: object[], options?: AggregateOptions): Promise<number>;
127
74
  aggregateCursor(pipeline: object[], options?: AggregateOptions): AggregationCursor;
128
75
  aggregateStream(pipeline: object[], options?: AggregateOptions, streamOptions?: CursorStreamOptions): import("stream").Readable;
129
- countDocuments(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: CountDocumentsOptions): Promise<number>;
76
+ countDocuments(filter?: Filter<T>, options?: CountDocumentsOptions): Promise<number>;
130
77
  create(f_docs: T | T[], options?: InsertOneOptions | BulkWriteOptions): Promise<T | T[]>;
131
- createIndex(fieldOrSpec: any, options?: CreateIndexesOptions): Promise<string>;
78
+ createIndex(fieldOrSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
132
79
  createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]>;
133
- deleteMany(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: DeleteOptions, bypassLogs?: boolean): Promise<number>;
134
- deleteOne(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<number>;
135
- distinct(key: string, filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: CommandOperationOptions): Promise<T[]>;
80
+ deleteMany(filter?: Filter<T>, options?: DeleteOptions, bypassLogs?: boolean): Promise<number>;
81
+ deleteOne(filter?: Filter<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<number>;
82
+ distinct(key: string, filter?: Filter<T>, options?: CommandOperationOptions): Promise<T[]>;
136
83
  drop(options?: CommandOperationOptions): Promise<boolean>;
137
84
  dropIndex(indexName: string, options?: CommandOperationOptions): Promise<Document>;
138
85
  dropIndexes(options?: CommandOperationOptions): Promise<Document>;
139
- find(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T[]>;
86
+ find(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T[]>;
140
87
  findById(id: string, options?: FindOptions<T>): Promise<T>;
141
- findCount(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: FindOptions<T>): Promise<Number>;
142
- findCursor(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: FindOptions<T>): FindCursor;
143
- findStream(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: FindOptions<T>, streamOptions?: CursorStreamOptions): import("stream").Readable;
144
- findOne(filter?: MongoManagerFilter<T> | MongoManagerFilterOperators<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T>;
145
- findOneAndDelete(filter?: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<T>;
146
- findOneAndReplace(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
147
- findOneAndUpdate(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: FindOneAndUpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
88
+ findCount(filter?: Filter<T>, options?: FindOptions<T>): Promise<Number>;
89
+ findCursor(filter?: Filter<T>, options?: FindOptions<T>): FindCursor;
90
+ findStream(filter?: Filter<T>, options?: FindOptions<T>, streamOptions?: CursorStreamOptions): import("stream").Readable;
91
+ findOne(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T>;
92
+ findOneAndDelete(filter?: Filter<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<T>;
93
+ findOneAndReplace(filter: Filter<T>, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
94
+ findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options?: FindOneAndUpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
148
95
  indexes(options: IndexInformationOptions): Promise<any[]>;
149
96
  indexExists(indexes: string | string[], options?: IndexInformationOptions): Promise<boolean>;
150
97
  insertMany(docs: T[], options?: BulkWriteOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T[]>;
151
98
  insertOne(doc: T, options?: InsertOneOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
152
99
  listIndexes(options?: ListIndexesOptions): ListIndexesCursor;
153
100
  rename(newName: string, options?: RenameOptions): Promise<Collection<Document>>;
154
- replaceOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, replacement: T, options?: ReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean, doc?: T): Promise<number>;
101
+ replaceOne(filter: Filter<T>, replacement: T, options?: ReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean, doc?: T): Promise<number>;
155
102
  stats(options?: CollStatsOptions): Promise<CollStats>;
156
- updateMany(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean, bypassVersions?: boolean): Promise<number>;
157
- updateOne(filter: MongoManagerFilter<T> & MongoManagerFilterOperators<T>, update: MongoManagerUpdateFilter<T>, options?: UpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<number>;
103
+ updateMany(filter: Filter<T>, update: UpdateFilter<T>, options?: UpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean, bypassVersions?: boolean): Promise<number>;
104
+ updateOne(filter: Filter<T>, update: UpdateFilter<T>, options?: UpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<number>;
158
105
  watchCollection(pipeline?: any[], options?: ChangeStreamOptions): ChangeStream<T>;
159
106
  watchCollectionWithAggregate(pipeline?: any[], options?: ChangeStreamOptions): ChangeStream<T>;
160
107
  }
@@ -70,6 +70,79 @@ var monitor_manager_1 = require("./monitor.manager");
70
70
  var os_1 = require("os");
71
71
  var numCPUs = os_1.cpus().length;
72
72
  var v8 = require('v8');
73
+ // export declare interface MongoManagerFilterOperators<T> extends Document {
74
+ // export declare interface MongoManagerFilterParamaterOperators<P> {
75
+ // $eq?: P;
76
+ // $gt?: P;
77
+ // $gte?: P;
78
+ // $in?: P extends Array<any> ? P : P[];
79
+ // $lt?: P;
80
+ // $lte?: P;
81
+ // $ne?: P;
82
+ // $nin?: P extends Array<any> ? P : P[];
83
+ // $not?: P extends string ? MongoManagerFilterParamaterOperators<P> | RegExpConstructor : MongoManagerFilterParamaterOperators<P>;
84
+ // $exists?: boolean;
85
+ // $expr?: any[]
86
+ // $regex?: P extends string ? RegExpConstructor | string : never;
87
+ // $options?: P extends string ? string : never;
88
+ // $geoIntersects?: {
89
+ // $geometry: Document;
90
+ // };
91
+ // $geoWithin?: Document;
92
+ // $near?: Document;
93
+ // $nearSphere?: Document;
94
+ // $maxDistance?: number;
95
+ // $all?: any[];
96
+ // $elemMatch?: Document;
97
+ // $size?: P extends any[] ? number : never;
98
+ // }
99
+ // export declare interface MongoManagerFilterOperators<T> extends Document { //TODO: Remove extends document when I get answer on S.O.
100
+ // $and?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;
101
+ // $nor?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;
102
+ // $or?: MongoManagerFilter<T>[] | MongoManagerFilterOperators<T>;
103
+ // $text?: {
104
+ // $search: string;
105
+ // $language?: string;
106
+ // $caseSensitive?: boolean;
107
+ // $diacriticSensitive?: boolean;
108
+ // };
109
+ // $where?: string | ((this: T) => boolean);
110
+ // $comment?: string | Document;
111
+ // }
112
+ // // function isDotStringRegExp(obj: Object, dotKey: string): boolean {
113
+ // // let keyData = dotKey.split('.');
114
+ // // let objData = obj;
115
+ // // for (let i = 0; i < keyData.length; i++) {
116
+ // // let key = keyData[i];
117
+ // // if (objData.hasOwnProperty(key)) {
118
+ // // objData = objData[key];
119
+ // // if (i === keyData.length - 1) {
120
+ // // return true;
121
+ // // }
122
+ // // }
123
+ // // else {
124
+ // // return false;
125
+ // // }
126
+ // // }
127
+ // // }
128
+ // // export declare type MongoManagerDotStringFilter<T> = {
129
+ // // [key: string]: (isDotStringRegExp(T, key) ? any : never);
130
+ // // };
131
+ // export declare type MongoManagerFilter<T> = {
132
+ // [P in keyof T]?: T[P] | MongoManagerFilterParamaterOperators<T[P]>;
133
+ // };
134
+ // export declare type MongoManagerUnsetFilter<T> = {
135
+ // [P in keyof T]?: number | boolean;
136
+ // };
137
+ // export declare type MongoManagerIncFilter<T> = {
138
+ // [P in keyof T]?: number;
139
+ // };
140
+ // export declare type MongoManagerUpdateFilter<T> = {
141
+ // $inc?: MongoManagerIncFilter<T> | Document;
142
+ // $set?: MongoManagerFilter<T> | Document;
143
+ // $setOnInsert?: MongoManagerFilter<T> | Document;
144
+ // $unset?: MongoManagerUnsetFilter<T> | Document;
145
+ // };
73
146
  var MongoManager = /** @class */ (function () {
74
147
  function MongoManager() {
75
148
  var _this = this;
@@ -1516,7 +1589,7 @@ var MongoManagerCollection = /** @class */ (function () {
1516
1589
  return __generator(this, function (_a) {
1517
1590
  switch (_a.label) {
1518
1591
  case 0:
1519
- if ((!update.$inc || update.$inc === {}) && (!update.$set || update.$set === {}) && (!update.$setOnInsert || update.$setOnInsert === {}) && (!update.$unset || update.$unset === {})) {
1592
+ if ((!update.$inc || update.$inc === {}) && (!update.$set) && (!update.$setOnInsert) && (!update.$unset || update.$unset === {})) {
1520
1593
  resolve(1);
1521
1594
  return [2 /*return*/];
1522
1595
  }
@@ -1618,7 +1691,7 @@ var MongoManagerCollection = /** @class */ (function () {
1618
1691
  return [2 /*return*/];
1619
1692
  }
1620
1693
  }
1621
- if ((!update.$inc || update.$inc === {}) && (!update.$set || update.$set === {}) && (!update.$setOnInsert || update.$setOnInsert === {}) && (!update.$unset || update.$unset === {})) {
1694
+ if ((!update.$inc || update.$inc === {}) && (!update.$set) && (!update.$setOnInsert) && (!update.$unset || update.$unset === {})) {
1622
1695
  resolve(1);
1623
1696
  return [2 /*return*/];
1624
1697
  }