@6thbridge/utils 1.1.8-1 → 1.2.0-1
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/lib/database/MongoDBRepository.d.ts +3 -56
- package/lib/database/MongoDBRepository.js +6 -77
- package/lib/database/MongoDBRepository.js.map +1 -1
- package/lib/database/MongoDBTypeRepository.d.ts +103 -0
- package/lib/database/MongoDBTypeRepository.js +90 -0
- package/lib/database/MongoDBTypeRepository.js.map +1 -0
- package/lib/database/index.d.ts +1 -0
- package/lib/database/index.js +1 -0
- package/lib/database/index.js.map +1 -1
- package/lib/database/meta.entity.d.ts +10 -0
- package/lib/database/meta.entity.js +7 -0
- package/lib/database/meta.entity.js.map +1 -0
- package/lib/database/meta.model.d.ts +37 -0
- package/lib/database/meta.model.js +50 -0
- package/lib/database/meta.model.js.map +1 -0
- package/lib/database/meta.repository.d.ts +7 -0
- package/lib/database/meta.repository.js +16 -0
- package/lib/database/meta.repository.js.map +1 -0
- package/lib/logger/logger.d.ts +2 -2
- package/lib/middlewares/common.js +1 -1
- package/lib/middlewares/common.js.map +1 -1
- package/lib/monitoring/index.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +3 -1
- package/lib/types/index.js.map +1 -1
- package/lib/utils/database.js +11 -11
- package/lib/utils/database.js.map +1 -1
- package/package.json +21 -23
|
@@ -1,58 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/session" />
|
|
19
|
-
/// <reference types="mongoose/types/types" />
|
|
20
|
-
/// <reference types="mongoose/types/utility" />
|
|
21
|
-
/// <reference types="mongoose/types/validation" />
|
|
22
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
24
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
-
/// <reference types="mongoose-paginate-v2" />
|
|
27
|
-
import { ClientSession, CreateOptions, ProjectionType, QueryOptions, PaginateResult, PaginateModel, Model, InsertManyOptions } from 'mongoose';
|
|
28
|
-
export declare class MongooseOptions {
|
|
29
|
-
session?: ClientSession | null;
|
|
30
|
-
[x: string]: any;
|
|
31
|
-
}
|
|
32
|
-
export declare class FindOptions extends MongooseOptions {
|
|
33
|
-
[x: string]: any;
|
|
34
|
-
page?: number;
|
|
35
|
-
limit?: number;
|
|
36
|
-
lean?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export type TypedModel<T> = PaginateModel<T> | Model<T>;
|
|
39
|
-
export declare class MongoDBRepository {
|
|
40
|
-
private readonly Model;
|
|
1
|
+
import { FindOptions, MongoDBTypeRepository, MongooseOptions, TypedModel } from './MongoDBTypeRepository';
|
|
2
|
+
export { FindOptions, MongooseOptions, TypedModel, };
|
|
3
|
+
export declare class MongoDBRepository<TEntity = any> extends MongoDBTypeRepository<TEntity> {
|
|
41
4
|
constructor(Model: TypedModel<any>);
|
|
42
|
-
getModel(): TypedModel<any>;
|
|
43
|
-
create(payload: Record<string, any>, options?: CreateOptions): Promise<any>;
|
|
44
|
-
findById(id: string, projection?: ProjectionType<any>, options?: QueryOptions): import("mongoose").Query<any, any, {}, any, "findOne", {}>;
|
|
45
|
-
findOne(condition?: Record<string, any>, sort?: Record<string, number>, options?: FindOptions): import("mongoose").Query<any, any, {}, any, "findOne", {}>;
|
|
46
|
-
find(condition: Record<string, any>, sort?: Record<string, any>, options?: FindOptions): import("mongoose").Query<any[], any, {}, any, "find", {}>;
|
|
47
|
-
paginate(condition: Record<string, any>, sort?: Record<string, any>, options?: FindOptions): Promise<PaginateResult<any>>;
|
|
48
|
-
deleteMany(condition?: Record<string, any>, options?: MongooseOptions): import("mongoose").Query<import("mongodb").DeleteResult, any, {}, any, "deleteMany", {}>;
|
|
49
|
-
insertMany(data: any[] | undefined, options: InsertManyOptions & {
|
|
50
|
-
lean: true;
|
|
51
|
-
}): never[] | Promise<any[]>;
|
|
52
|
-
countDocuments(condition?: Record<string, any>, options?: MongooseOptions): import("mongoose").Query<number, any, {}, any, "countDocuments", {}>;
|
|
53
|
-
updateOne(query?: Record<string, any>, update?: Record<string, any>, options?: MongooseOptions): import("mongoose").Query<import("mongoose").UpdateWriteOpResult, any, {}, any, "updateOne", {}>;
|
|
54
|
-
updateMany(query?: Record<string, any>, update?: Record<string, any>, options?: MongooseOptions): import("mongoose").Query<import("mongoose").UpdateWriteOpResult, any, {}, any, "updateMany", {}>;
|
|
55
|
-
upsert(query?: Record<string, any>, update?: any, options?: MongooseOptions): import("mongoose").Query<import("mongoose").UpdateWriteOpResult, any, {}, any, "updateOne", {}>;
|
|
56
|
-
findOneAndUpdate(filter: any, update: any, options?: MongooseOptions): import("mongoose").Query<any, any, {}, any, "findOneAndUpdate", {}>;
|
|
57
|
-
bulkWrite(bulkWritePayload: any): Promise<import("mongoose").MongooseBulkWriteResult>;
|
|
58
5
|
}
|
|
@@ -1,83 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MongoDBRepository = exports.
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
exports
|
|
7
|
-
class
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.limit = 100;
|
|
11
|
-
this.lean = false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.FindOptions = FindOptions;
|
|
15
|
-
class MongoDBRepository {
|
|
3
|
+
exports.MongoDBRepository = exports.MongooseOptions = exports.FindOptions = void 0;
|
|
4
|
+
const MongoDBTypeRepository_1 = require("./MongoDBTypeRepository");
|
|
5
|
+
Object.defineProperty(exports, "FindOptions", { enumerable: true, get: function () { return MongoDBTypeRepository_1.FindOptions; } });
|
|
6
|
+
Object.defineProperty(exports, "MongooseOptions", { enumerable: true, get: function () { return MongoDBTypeRepository_1.MongooseOptions; } });
|
|
7
|
+
class MongoDBRepository extends MongoDBTypeRepository_1.MongoDBTypeRepository {
|
|
16
8
|
constructor(Model) {
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
getModel() {
|
|
20
|
-
return this.Model;
|
|
21
|
-
}
|
|
22
|
-
create(payload, options) {
|
|
23
|
-
return this.Model.create(payload, options);
|
|
24
|
-
}
|
|
25
|
-
findById(id, projection, options) {
|
|
26
|
-
return this.Model.findOne({ _id: id }, projection, options);
|
|
27
|
-
}
|
|
28
|
-
findOne(condition = {}, sort, options) {
|
|
29
|
-
const result = this.Model.findOne(condition).sort(sort);
|
|
30
|
-
if (options === null || options === void 0 ? void 0 : options.lean)
|
|
31
|
-
return result.lean();
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
find(condition, sort, options) {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
if (options === null || options === void 0 ? void 0 : options.lean)
|
|
37
|
-
return this.Model.find(condition).sort(sort).lean().session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
38
|
-
return this.Model.find(condition).sort(sort).session((_b = options === null || options === void 0 ? void 0 : options.session) !== null && _b !== void 0 ? _b : null);
|
|
39
|
-
}
|
|
40
|
-
paginate(condition, sort, options) {
|
|
41
|
-
return this.Model.paginate(condition, {
|
|
42
|
-
sort,
|
|
43
|
-
page: options === null || options === void 0 ? void 0 : options.page,
|
|
44
|
-
limit: options === null || options === void 0 ? void 0 : options.limit,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
deleteMany(condition = {}, options) {
|
|
48
|
-
var _a;
|
|
49
|
-
return this.Model.deleteMany(condition).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
50
|
-
}
|
|
51
|
-
insertMany(data = [], options) {
|
|
52
|
-
if (data.length === 0)
|
|
53
|
-
return [];
|
|
54
|
-
return this.Model.insertMany(data, options);
|
|
55
|
-
}
|
|
56
|
-
countDocuments(condition = {}, options) {
|
|
57
|
-
var _a;
|
|
58
|
-
return this.Model.countDocuments(condition).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
59
|
-
}
|
|
60
|
-
updateOne(query = {}, update = {}, options) {
|
|
61
|
-
var _a;
|
|
62
|
-
return this.Model.updateOne(query, update).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
63
|
-
}
|
|
64
|
-
updateMany(query = {}, update = {}, options) {
|
|
65
|
-
var _a;
|
|
66
|
-
return this.Model.updateMany(query, update).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
67
|
-
}
|
|
68
|
-
upsert(query = {}, update = {}, options) {
|
|
69
|
-
var _a;
|
|
70
|
-
return this.Model.updateOne(query, update, {
|
|
71
|
-
upsert: true,
|
|
72
|
-
setDefaultsOnInsert: true,
|
|
73
|
-
}).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
74
|
-
}
|
|
75
|
-
findOneAndUpdate(filter, update, options) {
|
|
76
|
-
var _a;
|
|
77
|
-
return this.Model.findOneAndUpdate(filter, update, Object.assign({ new: true }, options)).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
78
|
-
}
|
|
79
|
-
bulkWrite(bulkWritePayload) {
|
|
80
|
-
return this.Model.bulkWrite(bulkWritePayload);
|
|
9
|
+
super(Model);
|
|
81
10
|
}
|
|
82
11
|
}
|
|
83
12
|
exports.MongoDBRepository = MongoDBRepository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoDBRepository.js","sourceRoot":"","sources":["../../src/database/MongoDBRepository.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"MongoDBRepository.js","sourceRoot":"","sources":["../../src/database/MongoDBRepository.ts"],"names":[],"mappings":";;;AAAA,mEAKiC;AAG/B,4FAPA,mCAAW,OAOA;AACX,gGANA,uCAAe,OAMA;AAIjB,MAAa,iBAAiC,SAAQ,6CAA8B;IAClF,YAAY,KAAsB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAJD,8CAIC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/session" />
|
|
19
|
+
/// <reference types="mongoose/types/types" />
|
|
20
|
+
/// <reference types="mongoose/types/utility" />
|
|
21
|
+
/// <reference types="mongoose/types/validation" />
|
|
22
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferhydrateddoctype" />
|
|
26
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
27
|
+
/// <reference types="mongoose-paginate-v2" />
|
|
28
|
+
import { ClientSession, CreateOptions, Document, FlattenMaps, HydratedDocument, InsertManyOptions, Model, PaginateModel, PaginateResult, ProjectionType, QueryOptions, SortOrder, UpdateQuery } from 'mongoose';
|
|
29
|
+
export declare class MongooseOptions {
|
|
30
|
+
session?: ClientSession | null;
|
|
31
|
+
[x: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export declare class FindOptions extends MongooseOptions {
|
|
34
|
+
[x: string]: any;
|
|
35
|
+
page?: number;
|
|
36
|
+
limit?: number;
|
|
37
|
+
lean?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export type TypedModel<T> = PaginateModel<T> | Model<T>;
|
|
40
|
+
export type RepositoryDocument<TEntity> = TEntity extends Document ? TEntity : HydratedDocument<TEntity>;
|
|
41
|
+
export type LeanRepositoryDocument<TEntity> = FlattenMaps<TEntity>;
|
|
42
|
+
export type RepositoryModel<TEntity> = TypedModel<TEntity>;
|
|
43
|
+
type RepositoryFilter<TEntity> = Partial<TEntity> & Record<string, any>;
|
|
44
|
+
type RepositorySort<TEntity> = Partial<Record<Extract<keyof TEntity, string>, SortOrder>> & Record<string, any>;
|
|
45
|
+
type RepositoryPayload<TEntity> = Partial<TEntity> & Record<string, any>;
|
|
46
|
+
type RepositoryUpdate<TEntity> = UpdateQuery<TEntity> | Record<string, any>;
|
|
47
|
+
export declare class MongoDBTypeRepository<TEntity = any> {
|
|
48
|
+
private readonly Model;
|
|
49
|
+
private readonly model;
|
|
50
|
+
private readonly paginateModel;
|
|
51
|
+
constructor(Model: RepositoryModel<TEntity>);
|
|
52
|
+
getModel(): RepositoryModel<TEntity>;
|
|
53
|
+
create(payload: RepositoryPayload<TEntity>, options?: CreateOptions): Promise<RepositoryDocument<TEntity>>;
|
|
54
|
+
findById(id: string, projection?: ProjectionType<TEntity>, options?: QueryOptions<TEntity>): import("mongoose").Query<import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
55
|
+
__v: number;
|
|
56
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>> | null, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
57
|
+
__v: number;
|
|
58
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "findOne", {}>;
|
|
59
|
+
findOne(condition?: RepositoryFilter<TEntity>, sort?: RepositorySort<TEntity>, options?: FindOptions): import("mongoose").Query<import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
60
|
+
__v: number;
|
|
61
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>> | null, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
62
|
+
__v: number;
|
|
63
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "findOne", {}> | import("mongoose").Query<FlattenMaps<TEntity> | (import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
64
|
+
__v: number;
|
|
65
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>> extends infer T ? T extends import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
66
|
+
__v: number;
|
|
67
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>> ? T extends null ? FlattenMaps<TEntity> | null : FlattenMaps<TEntity> : never : never) | null, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
68
|
+
__v: number;
|
|
69
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "findOne", {}>;
|
|
70
|
+
find(condition: RepositoryFilter<TEntity>, sort?: RepositorySort<TEntity>, options?: FindOptions): import("mongoose").Query<import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
71
|
+
__v: number;
|
|
72
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>[], import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
73
|
+
__v: number;
|
|
74
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "find", {}> | import("mongoose").Query<FlattenMaps<TEntity>, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
75
|
+
__v: number;
|
|
76
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "find", {}>;
|
|
77
|
+
paginate(condition: RepositoryFilter<TEntity>, sort?: RepositorySort<TEntity>, options?: FindOptions): Promise<PaginateResult<RepositoryDocument<TEntity>>>;
|
|
78
|
+
deleteMany(condition?: RepositoryFilter<TEntity>, options?: MongooseOptions): import("mongoose").Query<import("mongodb").DeleteResult, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
79
|
+
__v: number;
|
|
80
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "deleteMany", {}>;
|
|
81
|
+
insertMany(data?: RepositoryPayload<TEntity>[], options?: InsertManyOptions & {
|
|
82
|
+
lean?: boolean;
|
|
83
|
+
}): never[] | Promise<RepositoryDocument<TEntity>[]>;
|
|
84
|
+
countDocuments(condition?: RepositoryFilter<TEntity>, options?: MongooseOptions): import("mongoose").Query<number, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
85
|
+
__v: number;
|
|
86
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "countDocuments", {}>;
|
|
87
|
+
updateOne(query?: RepositoryFilter<TEntity>, update?: RepositoryUpdate<TEntity>, options?: MongooseOptions): import("mongoose").Query<import("mongoose").UpdateWriteOpResult, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
88
|
+
__v: number;
|
|
89
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "updateOne", {}>;
|
|
90
|
+
updateMany(query?: RepositoryFilter<TEntity>, update?: RepositoryUpdate<TEntity>, options?: MongooseOptions): import("mongoose").Query<import("mongoose").UpdateWriteOpResult, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
91
|
+
__v: number;
|
|
92
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "updateMany", {}>;
|
|
93
|
+
upsert(query?: RepositoryFilter<TEntity>, update?: RepositoryUpdate<TEntity>, options?: MongooseOptions): import("mongoose").Query<import("mongoose").UpdateWriteOpResult, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
94
|
+
__v: number;
|
|
95
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "updateOne", {}>;
|
|
96
|
+
findOneAndUpdate(filter: RepositoryFilter<TEntity>, update: RepositoryUpdate<TEntity>, options?: MongooseOptions & QueryOptions<TEntity>): import("mongoose").Query<import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
97
|
+
__v: number;
|
|
98
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>> | null, import("mongoose").IfAny<TEntity, any, Document<unknown, {}, TEntity, {}, import("mongoose").DefaultSchemaOptions> & import("mongoose").Require_id<TEntity> & {
|
|
99
|
+
__v: number;
|
|
100
|
+
} & import("mongoose").AddDefaultId<TEntity, {}, import("mongoose").DefaultSchemaOptions>>, {}, TEntity, "findOneAndUpdate", {}>;
|
|
101
|
+
bulkWrite(bulkWritePayload: Parameters<Model<TEntity>['bulkWrite']>[0]): Promise<import("mongodb").BulkWriteResult>;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MongoDBTypeRepository = exports.FindOptions = exports.MongooseOptions = void 0;
|
|
4
|
+
class MongooseOptions {
|
|
5
|
+
}
|
|
6
|
+
exports.MongooseOptions = MongooseOptions;
|
|
7
|
+
class FindOptions extends MongooseOptions {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.limit = 100;
|
|
11
|
+
this.lean = false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.FindOptions = FindOptions;
|
|
15
|
+
class MongoDBTypeRepository {
|
|
16
|
+
constructor(Model) {
|
|
17
|
+
this.Model = Model;
|
|
18
|
+
this.model = Model;
|
|
19
|
+
this.paginateModel = Model;
|
|
20
|
+
}
|
|
21
|
+
getModel() {
|
|
22
|
+
return this.Model;
|
|
23
|
+
}
|
|
24
|
+
create(payload, options) {
|
|
25
|
+
return this.model.create(payload, options);
|
|
26
|
+
}
|
|
27
|
+
findById(id, projection, options) {
|
|
28
|
+
return this.model.findOne({ _id: id }, projection, options);
|
|
29
|
+
}
|
|
30
|
+
findOne(condition = {}, sort, options) {
|
|
31
|
+
const result = this.model.findOne(condition).sort(sort);
|
|
32
|
+
if (options === null || options === void 0 ? void 0 : options.lean)
|
|
33
|
+
return result.lean();
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
find(condition, sort, options) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
if (options === null || options === void 0 ? void 0 : options.lean)
|
|
39
|
+
return this.model.find(condition).sort(sort).lean().session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
40
|
+
return this.model.find(condition).sort(sort).session((_b = options === null || options === void 0 ? void 0 : options.session) !== null && _b !== void 0 ? _b : null);
|
|
41
|
+
}
|
|
42
|
+
paginate(condition, sort, options) {
|
|
43
|
+
return this.paginateModel.paginate(condition, {
|
|
44
|
+
sort,
|
|
45
|
+
page: options === null || options === void 0 ? void 0 : options.page,
|
|
46
|
+
limit: options === null || options === void 0 ? void 0 : options.limit,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
deleteMany(condition = {}, options) {
|
|
50
|
+
var _a;
|
|
51
|
+
return this.model.deleteMany(condition).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
52
|
+
}
|
|
53
|
+
insertMany(data = [], options) {
|
|
54
|
+
if (data.length === 0)
|
|
55
|
+
return [];
|
|
56
|
+
const model = this.model;
|
|
57
|
+
if (!options) {
|
|
58
|
+
return model.insertMany(data);
|
|
59
|
+
}
|
|
60
|
+
return model.insertMany(data, options);
|
|
61
|
+
}
|
|
62
|
+
countDocuments(condition = {}, options) {
|
|
63
|
+
var _a;
|
|
64
|
+
return this.model.countDocuments(condition).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
65
|
+
}
|
|
66
|
+
updateOne(query = {}, update = {}, options) {
|
|
67
|
+
var _a;
|
|
68
|
+
return this.model.updateOne(query, update).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
69
|
+
}
|
|
70
|
+
updateMany(query = {}, update = {}, options) {
|
|
71
|
+
var _a;
|
|
72
|
+
return this.model.updateMany(query, update).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
73
|
+
}
|
|
74
|
+
upsert(query = {}, update = {}, options) {
|
|
75
|
+
var _a;
|
|
76
|
+
return this.model.updateOne(query, update, {
|
|
77
|
+
upsert: true,
|
|
78
|
+
setDefaultsOnInsert: true,
|
|
79
|
+
}).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
80
|
+
}
|
|
81
|
+
findOneAndUpdate(filter, update, options) {
|
|
82
|
+
var _a;
|
|
83
|
+
return this.model.findOneAndUpdate(filter, update, Object.assign({ new: true }, options)).session((_a = options === null || options === void 0 ? void 0 : options.session) !== null && _a !== void 0 ? _a : null);
|
|
84
|
+
}
|
|
85
|
+
bulkWrite(bulkWritePayload) {
|
|
86
|
+
return this.model.bulkWrite(bulkWritePayload);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.MongoDBTypeRepository = MongoDBTypeRepository;
|
|
90
|
+
//# sourceMappingURL=MongoDBTypeRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoDBTypeRepository.js","sourceRoot":"","sources":["../../src/database/MongoDBTypeRepository.ts"],"names":[],"mappings":";;;AAgBA,MAAa,eAAe;CAG3B;AAHD,0CAGC;AAED,MAAa,WAAY,SAAQ,eAAe;IAAhD;;QAIE,UAAK,GAAY,GAAG,CAAC;QACrB,SAAI,GAAa,KAAK,CAAC;IACzB,CAAC;CAAA;AAND,kCAMC;AAYD,MAAa,qBAAqB;IAIhC,YAA6B,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;QAC1D,IAAI,CAAC,KAAK,GAAG,KAAuB,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,KAA+B,CAAC;IACvD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,OAAmC,EAAE,OAAuB;QACjE,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAc,EAAE,OAAO,CAAyC,CAAC;IAC5F,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,UAAoC,EAAE,OAA+B;QACxF,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,YAAuC,EAAE,EAAE,IAA8B,EAAE,OAAqB;QACtG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI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,mCAAI,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,gBAAgB,CAAC,MAAiC,EAAE,MAAiC,EAAE,OAAiD;;QACtI,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,kBAC/C,GAAG,EAAE,IAAI,IACN,OAAO,EACV,CAAC,OAAO,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,SAAS,CAAC,gBAA4D;QACpE,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,gBAAuB,CAAC,CAAC;IACvD,CAAC;CACF;AAtFD,sDAsFC"}
|
package/lib/database/index.d.ts
CHANGED
package/lib/database/index.js
CHANGED
|
@@ -21,6 +21,7 @@ exports.MongoDB = exports.mongoosePaginate = void 0;
|
|
|
21
21
|
const mongoose_paginate_v2_1 = __importDefault(require("mongoose-paginate-v2"));
|
|
22
22
|
exports.mongoosePaginate = mongoose_paginate_v2_1.default;
|
|
23
23
|
__exportStar(require("./MongoDBRepository"), exports);
|
|
24
|
+
__exportStar(require("./MongoDBTypeRepository"), exports);
|
|
24
25
|
class MongoDB {
|
|
25
26
|
}
|
|
26
27
|
exports.MongoDB = MongoDB;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,gFAAoD;AAC3C,2BADF,8BAAgB,CACE;AACzB,sDAAoC;AACpC,MAAa,OAAO;CAMnB;AAND,0BAMC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,gFAAoD;AAC3C,2BADF,8BAAgB,CACE;AACzB,sDAAoC;AACpC,0DAAwC;AACxC,MAAa,OAAO;CAMnB;AAND,0BAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.entity.js","sourceRoot":"","sources":["../../src/database/meta.entity.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;CAStB;AATD,gCASC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/session" />
|
|
19
|
+
/// <reference types="mongoose/types/types" />
|
|
20
|
+
/// <reference types="mongoose/types/utility" />
|
|
21
|
+
/// <reference types="mongoose/types/validation" />
|
|
22
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
+
/// <reference types="mongoose" />
|
|
24
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
25
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
+
/// <reference types="mongoose/types/inferhydrateddoctype" />
|
|
27
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
28
|
+
/// <reference types="mongoose-paginate-v2" />
|
|
29
|
+
import { MetaEntity } from "./meta.entity";
|
|
30
|
+
declare const _default: import("mongoose").Model<MetaEntity, {}, {}, {}, import("mongoose").Document<unknown, {}, MetaEntity, {}, import("mongoose").DefaultSchemaOptions> & MetaEntity & {
|
|
31
|
+
_id: import("mongoose").Types.ObjectId;
|
|
32
|
+
} & {
|
|
33
|
+
__v: number;
|
|
34
|
+
} & {
|
|
35
|
+
id: string;
|
|
36
|
+
}, any, MetaEntity>;
|
|
37
|
+
export = _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use string';
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const schema = new mongoose_1.Schema({
|
|
5
|
+
clientId: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
allowNull: false,
|
|
9
|
+
},
|
|
10
|
+
reference: {
|
|
11
|
+
type: String,
|
|
12
|
+
},
|
|
13
|
+
label: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
type: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
data: {
|
|
20
|
+
type: JSON,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
}, {
|
|
24
|
+
toJSON: {
|
|
25
|
+
transform: function (_doc, ret) {
|
|
26
|
+
ret.id = ret._id;
|
|
27
|
+
delete ret.__v;
|
|
28
|
+
delete ret._id;
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
timestamps: true,
|
|
32
|
+
strict: false,
|
|
33
|
+
});
|
|
34
|
+
// schema.index({ "$**": "text" });
|
|
35
|
+
schema.index({
|
|
36
|
+
clientId: 1,
|
|
37
|
+
type: 1,
|
|
38
|
+
'data.email': 1,
|
|
39
|
+
}, {
|
|
40
|
+
name: 'metadata_index',
|
|
41
|
+
});
|
|
42
|
+
schema.index({
|
|
43
|
+
clientId: 1,
|
|
44
|
+
type: 1,
|
|
45
|
+
'data.phoneNumber': 1,
|
|
46
|
+
}, {
|
|
47
|
+
name: 'metadata_phone_unique_index',
|
|
48
|
+
});
|
|
49
|
+
module.exports = (0, mongoose_1.model)('metadata', schema);
|
|
50
|
+
//# sourceMappingURL=meta.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.model.js","sourceRoot":"","sources":["../../src/database/meta.model.ts"],"names":[],"mappings":";AAEA,YAAY,CAAC;AACb,uCAAyC;AAEzC,MAAM,MAAM,GAAG,IAAI,iBAAM,CACvB;IACE,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;KACjB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACf;CACF,EACD;IACE,MAAM,EAAE;QACN,SAAS,EAAE,UAAU,IAAI,EAAE,GAAwB;YACjD,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC;YACjB,OAAO,GAAG,CAAC,GAAG,CAAC;YACf,OAAO,GAAG,CAAC,GAAG,CAAC;QACjB,CAAC;KACF;IACD,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,KAAK;CACd,CACF,CAAC;AAEF,mCAAmC;AACnC,MAAM,CAAC,KAAK,CACV;IACE,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,YAAY,EAAE,CAAC;CAChB,EACD;IACE,IAAI,EAAE,gBAAgB;CACvB,CACF,CAAC;AACF,MAAM,CAAC,KAAK,CACV;IACE,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,kBAAkB,EAAE,CAAC;CACtB,EACD;IACE,IAAI,EAAE,6BAA6B;CACpC,CACF,CAAC;AACF,iBAAS,IAAA,gBAAK,EAAa,UAAU,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MongoDBRepository } from './MongoDBRepository';
|
|
2
|
+
import { MetaEntity } from "./meta.entity";
|
|
3
|
+
export declare class MetaRepository extends MongoDBRepository<MetaEntity> {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
declare const _default: MetaRepository;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MetaRepository = void 0;
|
|
7
|
+
const meta_model_1 = __importDefault(require("./meta.model"));
|
|
8
|
+
const MongoDBRepository_1 = require("./MongoDBRepository");
|
|
9
|
+
class MetaRepository extends MongoDBRepository_1.MongoDBRepository {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(meta_model_1.default);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.MetaRepository = MetaRepository;
|
|
15
|
+
exports.default = new MetaRepository();
|
|
16
|
+
//# sourceMappingURL=meta.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.repository.js","sourceRoot":"","sources":["../../src/database/meta.repository.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAIb,8DAAiC;AACjC,2DAAwD;AAIxD,MAAa,cAAe,SAAQ,qCAA6B;IAC/D;QACE,KAAK,CAAC,oBAAK,CAAC,CAAC;IACf,CAAC;CACF;AAJD,wCAIC;AAED,kBAAe,IAAI,cAAc,EAAE,CAAC"}
|
package/lib/logger/logger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LOG_LEVEL, LoggerInterface } from './index';
|
|
2
|
-
import
|
|
2
|
+
import Rollbar from 'rollbar';
|
|
3
3
|
import { RabbitMQClient } from '../data';
|
|
4
4
|
export declare class LoggerProps {
|
|
5
5
|
service?: string;
|
|
@@ -30,6 +30,6 @@ export declare class Logger implements LoggerInterface {
|
|
|
30
30
|
critical(message: string, meta?: any, trace?: string): string;
|
|
31
31
|
exception(error: Error, meta?: any): string;
|
|
32
32
|
out(...args: any): void;
|
|
33
|
-
logToRollbar(payload: Record<string, any>): string | LogResult;
|
|
33
|
+
logToRollbar(payload: Record<string, any>): string | Rollbar.LogResult;
|
|
34
34
|
}
|
|
35
35
|
export declare const logger: Logger;
|
|
@@ -39,7 +39,7 @@ function unless(middlewareName, paths, middleware) {
|
|
|
39
39
|
const pathsAsRegex = paths.map((path) => (0, path_to_regexp_1.pathToRegexp)(path));
|
|
40
40
|
return function (req, res, next) {
|
|
41
41
|
for (let path of pathsAsRegex) {
|
|
42
|
-
if (path.test(req.path)) {
|
|
42
|
+
if (path.regexp.test(req.path)) {
|
|
43
43
|
logger_1.logger.debug(`unless: skipping middleware "${middlewareName}" for path "${req.path}"`);
|
|
44
44
|
return next();
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/middlewares/common.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAkG;AAElG,mCAAiC;AACjC,sCAAmC;AACnC,mDAA8C;AAE9C,oCAAkC;AAIlC,MAAM,MAAM,GAAkB,gBAAQ,CAAC,gBAAgB,CAAC;IACtD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,qBAAqB;IAC9D,OAAO,EAAE;QACP,MAAM,EAAE,UAAU;KACnB;CACF,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG;IAClC,SAAS,EAAE,WAAW;IACtB,aAAa,EAAE,eAAe;IAC9B,GAAG,EAAE,KAAK;CACX,CAAC;AAEF,SAAgB,eAAe,CAAC,GAAQ,EAAE,GAAQ,EAAE,IAAS;IAC3D,eAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAClD,OAAO,IAAI,EA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AAC,MAAM,CAAC,QAAQ,CAAC;oBACtB,MAAM,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,MAAM;iBAC9B,CAAC,CAAC;gBAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;YAC3B,CAAC;YACD,OAAO,CAA2B,EAAE,CAAC;gBACnC,MAAM,UAAU,GAAG,gBAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACjD,eAAM,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAChC,eAAM,CAAC,GAAG,CAAC,mCAAmC,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,QAAQ,0CAAE,IAAI,CAAC,CAAC;gBAEjF,OAAO;oBACL,KAAK,EAAE,CAAA,MAAA,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,QAAQ,0CAAE,IAAI,0CAAE,KAAK,KAAI,mDAAmD;oBACtF,UAAU,EAAE,GAAG;oBACf,SAAS,EAAE,WAAW;iBACvB,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAhKD,4CAgKC"}
|
|
@@ -6,7 +6,7 @@ type MonitoredAxiosOptions = {
|
|
|
6
6
|
export declare function getMonitoredAxios(options: MonitoredAxiosOptions): AxiosInstance;
|
|
7
7
|
export declare function reportAxiosError(error: any): Promise<void>;
|
|
8
8
|
export declare class Monitoring {
|
|
9
|
-
static rollbar: import("rollbar") | null;
|
|
9
|
+
static rollbar: import("rollbar").default | null;
|
|
10
10
|
static getRollbarInstance: typeof RollbarUtil.getRollbarInstance;
|
|
11
11
|
static getMonitoredAxios(options: MonitoredAxiosOptions): AxiosInstance;
|
|
12
12
|
}
|