blixify-server 0.2.15 → 0.2.17
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/dist/apis/authWrapper.d.ts +4 -2
- package/dist/apis/authWrapper.d.ts.map +1 -1
- package/dist/apis/authWrapper.js +67 -2
- package/dist/apis/mongoWrapper.d.ts.map +1 -1
- package/dist/apis/mongoWrapper.js +40 -1
- package/dist/model/QueryModel.d.ts +6 -0
- package/dist/model/QueryModel.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9,10 +9,12 @@ export declare class AuthWrapper {
|
|
|
9
9
|
lib: WrapperLib;
|
|
10
10
|
constructor(fbAdmin: any, isProd: boolean, lib: WrapperLib);
|
|
11
11
|
initCheckAuthMethod: (req: any, res: any) => Promise<void>;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
initCreateAccount: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
13
|
+
initDisableAccount: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
14
|
+
initUpdatePassword: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
14
15
|
initUpdateEmail: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
15
16
|
initUpdateMobileNo: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
17
|
+
initDeleteAccount: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
16
18
|
init: () => any;
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=authWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/authWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,EAAE,GAAG,CAAM;IAClB,MAAM,UAAS;IACf,GAAG,EAAE,UAAU,CAAC;gBAEJ,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU;IAM1D,mBAAmB,QAAe,GAAG,OAAO,GAAG,mBAyB7C;IAEF,kBAAkB,
|
|
1
|
+
{"version":3,"file":"authWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/authWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,EAAE,GAAG,CAAM;IAClB,MAAM,UAAS;IACf,GAAG,EAAE,UAAU,CAAC;gBAEJ,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU;IAM1D,mBAAmB,QAAe,GAAG,OAAO,GAAG,mBAyB7C;IAEF,iBAAiB,QACV,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAwB7B;IAEF,kBAAkB,QACX,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,kBAAkB,QACX,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,eAAe,QACR,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAiB7B;IAEF,kBAAkB,QACX,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,iBAAiB,QACV,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAY7B;IAEF,IAAI,YAsEF;CACH"}
|
package/dist/apis/authWrapper.js
CHANGED
|
@@ -47,7 +47,34 @@ class AuthWrapper {
|
|
|
47
47
|
res.status(400).json({ err: err });
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
this.
|
|
50
|
+
this.initCreateAccount = (req, res, workflow) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const adminAuth = this.fbAdmin.auth();
|
|
52
|
+
try {
|
|
53
|
+
const userId = req.body.userId;
|
|
54
|
+
const phoneNumber = req.body.phoneNumber;
|
|
55
|
+
const email = req.body.email;
|
|
56
|
+
const password = req.body.password;
|
|
57
|
+
if (!userId)
|
|
58
|
+
throw "Invalid Configuration";
|
|
59
|
+
const userData = {
|
|
60
|
+
uid: userId,
|
|
61
|
+
};
|
|
62
|
+
if (phoneNumber)
|
|
63
|
+
userData["phoneNumber"] = phoneNumber;
|
|
64
|
+
if (email)
|
|
65
|
+
userData["email"] = email;
|
|
66
|
+
if (password)
|
|
67
|
+
userData["password"] = password;
|
|
68
|
+
const createdCredentials = yield adminAuth.createUser(userData);
|
|
69
|
+
if (workflow)
|
|
70
|
+
yield workflow();
|
|
71
|
+
res.send({ success: createdCredentials.uid });
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
res.status(400).json({ err: err });
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
this.initDisableAccount = (req, res, workflow) => __awaiter(this, void 0, void 0, function* () {
|
|
51
78
|
const adminAuth = this.fbAdmin.auth();
|
|
52
79
|
try {
|
|
53
80
|
const userId = req.body.userId;
|
|
@@ -55,13 +82,15 @@ class AuthWrapper {
|
|
|
55
82
|
if (!userId)
|
|
56
83
|
throw "Invalid Configuration";
|
|
57
84
|
yield adminAuth.updateUser(userId, { disabled: disable ? true : false });
|
|
85
|
+
if (workflow)
|
|
86
|
+
yield workflow();
|
|
58
87
|
res.send({ success: true });
|
|
59
88
|
}
|
|
60
89
|
catch (err) {
|
|
61
90
|
res.status(400).json({ err: err });
|
|
62
91
|
}
|
|
63
92
|
});
|
|
64
|
-
this.initUpdatePassword = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
this.initUpdatePassword = (req, res, workflow) => __awaiter(this, void 0, void 0, function* () {
|
|
65
94
|
const adminAuth = this.fbAdmin.auth();
|
|
66
95
|
try {
|
|
67
96
|
const userId = req.body.userId;
|
|
@@ -69,6 +98,8 @@ class AuthWrapper {
|
|
|
69
98
|
if (!userId || !password)
|
|
70
99
|
throw "Invalid Configuration";
|
|
71
100
|
yield adminAuth.updateUser(userId, { password: password });
|
|
101
|
+
if (workflow)
|
|
102
|
+
yield workflow();
|
|
72
103
|
res.send({ success: true });
|
|
73
104
|
}
|
|
74
105
|
catch (err) {
|
|
@@ -111,6 +142,21 @@ class AuthWrapper {
|
|
|
111
142
|
res.status(400).json({ err: err });
|
|
112
143
|
}
|
|
113
144
|
});
|
|
145
|
+
this.initDeleteAccount = (req, res, workflow) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const adminAuth = this.fbAdmin.auth();
|
|
147
|
+
try {
|
|
148
|
+
const userId = req.body.userId;
|
|
149
|
+
if (!userId)
|
|
150
|
+
throw "Invalid Configuration";
|
|
151
|
+
yield adminAuth.deleteUser(userId);
|
|
152
|
+
if (workflow)
|
|
153
|
+
yield workflow();
|
|
154
|
+
res.send({ success: true });
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
res.status(400).json({ err: err });
|
|
158
|
+
}
|
|
159
|
+
});
|
|
114
160
|
this.init = () => {
|
|
115
161
|
const router = this.lib.express.Router();
|
|
116
162
|
/**
|
|
@@ -128,6 +174,17 @@ class AuthWrapper {
|
|
|
128
174
|
router.post("/method", (req, res) => {
|
|
129
175
|
this.initCheckAuthMethod(req, res);
|
|
130
176
|
});
|
|
177
|
+
/**
|
|
178
|
+
* @Input
|
|
179
|
+
* userId - string
|
|
180
|
+
* phoneNumber? - string
|
|
181
|
+
* email? - string
|
|
182
|
+
* password? - string
|
|
183
|
+
*
|
|
184
|
+
*/
|
|
185
|
+
router.post("/create", (req, res) => {
|
|
186
|
+
this.initCreateAccount(req, res);
|
|
187
|
+
});
|
|
131
188
|
/**
|
|
132
189
|
* @Input
|
|
133
190
|
* userId - string
|
|
@@ -153,6 +210,14 @@ class AuthWrapper {
|
|
|
153
210
|
router.post("/mobile", (req, res) => {
|
|
154
211
|
this.initUpdateMobileNo(req, res);
|
|
155
212
|
});
|
|
213
|
+
/**
|
|
214
|
+
* @Input
|
|
215
|
+
* userId - string
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
218
|
+
router.post("/delete", (req, res) => {
|
|
219
|
+
this.initDeleteAccount(req, res);
|
|
220
|
+
});
|
|
156
221
|
return router;
|
|
157
222
|
};
|
|
158
223
|
this.fbAdmin = fbAdmin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mongoWrapper.ts"],"names":[],"mappings":"AASA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"mongoWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mongoWrapper.ts"],"names":[],"mappings":"AASA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAiID;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,GAAG,CAAM;IAClB,UAAU,SAAM;IAChB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,SAAM;IACb,KAAK,SAAM;IACX,WAAW,EAAE,GAAG,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;IAEX,YAAY,QAAS,GAAG,aAEtB;gBAGA,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,GAAG,EAAE,UAAU,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EACzC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI;IAe3D,UAAU,SAAU,GAAG,SAIrB;IAEF,aAAa,YACF,GAAG,QACN,QAAQ,GAAG,QAAQ,GAAG,QAAQ,OAC/B,GAAG,UACA;QACN,GAAG,CAAC,EAAE,GAAG,CAAC;QACV,GAAG,CAAC,EAAE,GAAG,CAAC;KACX,mBA8CD;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC;;mBAyE5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAkDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG;;mBAuCjC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAgKtC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAqGtC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC;;mBA0I5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAwCtC;IAEF,mBAAmB,CAAC,GAAG,EAAE,GAAG;IAsM5B,QAAQ,QAAe,GAAG,OAAO,GAAG;;;;;mBAgQlC;IAEF,IAAI,YA+EF;CACH"}
|
|
@@ -22,7 +22,7 @@ const handleParseQueryFilter = (queryList, prefix) => {
|
|
|
22
22
|
const queryGroupValues = {};
|
|
23
23
|
if (queryList && queryList.length > 0) {
|
|
24
24
|
queryList.map((eachQuery) => {
|
|
25
|
-
var _a;
|
|
25
|
+
var _a, _b;
|
|
26
26
|
let queryId = (_a = eachQuery.queryId) !== null && _a !== void 0 ? _a : "";
|
|
27
27
|
if (prefix)
|
|
28
28
|
queryId = `${prefix}.${queryId}`;
|
|
@@ -40,6 +40,25 @@ const handleParseQueryFilter = (queryList, prefix) => {
|
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
if (eachQuery.foreign && eachQuery.foreign.length > 0) {
|
|
44
|
+
(_b = eachQuery === null || eachQuery === void 0 ? void 0 : eachQuery.foreign) === null || _b === void 0 ? void 0 : _b.forEach((foreignLookup) => {
|
|
45
|
+
let foreignAlias = foreignLookup.alias;
|
|
46
|
+
if (prefix) {
|
|
47
|
+
foreignAlias = `${prefix}.${foreignAlias}`;
|
|
48
|
+
}
|
|
49
|
+
if (foreignLookup.searchFields &&
|
|
50
|
+
foreignLookup.searchFields.length > 0) {
|
|
51
|
+
foreignLookup.searchFields.forEach((foreignField) => {
|
|
52
|
+
queryValues[`${foreignAlias}.${foreignField}`] = {
|
|
53
|
+
$regex: eachQuery.value
|
|
54
|
+
.toString()
|
|
55
|
+
.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
|
|
56
|
+
$options: "i",
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
43
62
|
break;
|
|
44
63
|
case "=":
|
|
45
64
|
queryValues[queryId] = value;
|
|
@@ -1153,6 +1172,26 @@ class MongoWrapper {
|
|
|
1153
1172
|
}
|
|
1154
1173
|
});
|
|
1155
1174
|
}
|
|
1175
|
+
if (query && query.length > 0) {
|
|
1176
|
+
query.forEach((q) => {
|
|
1177
|
+
if (q.foreign && Array.isArray(q.foreign)) {
|
|
1178
|
+
q.foreign.forEach((foreignLookup) => {
|
|
1179
|
+
const alias = foreignLookup.alias;
|
|
1180
|
+
if (!addedForeignLookups.has(alias)) {
|
|
1181
|
+
pipelineList.push({
|
|
1182
|
+
$lookup: {
|
|
1183
|
+
from: foreignLookup.collection,
|
|
1184
|
+
localField: "_id",
|
|
1185
|
+
foreignField: foreignLookup.foreignField,
|
|
1186
|
+
as: alias,
|
|
1187
|
+
},
|
|
1188
|
+
});
|
|
1189
|
+
addedForeignLookups.set(alias, true);
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1156
1195
|
if (query && query.length > 0) {
|
|
1157
1196
|
const filter = handleParseQueryFilter(query);
|
|
1158
1197
|
pipelineList.push({ $match: filter });
|
|
@@ -17,6 +17,12 @@ export interface Query {
|
|
|
17
17
|
searchIds?: string[];
|
|
18
18
|
orQuery?: boolean;
|
|
19
19
|
orQueryGroupId?: string;
|
|
20
|
+
foreign?: {
|
|
21
|
+
collection: string;
|
|
22
|
+
foreignField: string;
|
|
23
|
+
searchFields: string[];
|
|
24
|
+
alias: string;
|
|
25
|
+
}[];
|
|
20
26
|
}
|
|
21
27
|
interface PipelineCondition {
|
|
22
28
|
type: "=" | "!=" | ">" | "<" | "><" | "in" | "!in";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryModel.d.ts","sourceRoot":"","sources":["../../src/model/QueryModel.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,QAAQ,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAC;IACzE,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"QueryModel.d.ts","sourceRoot":"","sources":["../../src/model/QueryModel.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,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