speedly 2.0.37 → 2.0.42
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/README.md +470 -171
- package/dist/cjs/config/init.js +20 -5
- package/dist/cjs/document/document.js +1 -1
- package/dist/cjs/kit/db/db.js +16 -0
- package/dist/cjs/model/translation.d.ts +37 -25
- package/dist/cjs/util/translator.d.ts +1 -1
- package/dist/config/init.d.ts +23 -0
- package/dist/config/init.js +93 -0
- package/dist/document/document.d.ts +5 -0
- package/dist/document/document.js +270 -0
- package/dist/document/index.d.ts +2 -0
- package/dist/document/index.js +7 -0
- package/dist/document/parser.d.ts +1 -0
- package/dist/document/parser.js +11 -0
- package/dist/esm/config/init.js +20 -5
- package/dist/esm/document/document.js +1 -1
- package/dist/esm/kit/db/db.js +16 -0
- package/dist/esm/model/translation.d.ts +37 -25
- package/dist/esm/util/translator.d.ts +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -0
- package/dist/{cjs → kit}/auth/auth.js +1 -1
- package/dist/{cjs → kit}/db/db.d.ts +15 -0
- package/dist/{cjs → kit}/db/db.js +44 -19
- package/dist/kit/index.d.ts +5 -0
- package/dist/kit/index.js +14 -0
- package/dist/{cjs → kit}/uploader/uploader.d.ts +2 -2
- package/dist/{esm → kit}/uploader/uploader.js +22 -17
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.js +8 -0
- package/dist/model/translation.d.ts +71 -0
- package/dist/model/translation.js +13 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +8 -0
- package/dist/modules/translation/translation.routes.d.ts +2 -0
- package/dist/modules/translation/translation.routes.js +24 -0
- package/dist/modules/translation/translation.validator.d.ts +15 -0
- package/dist/modules/translation/translation.validator.js +22 -0
- package/dist/util/getConfig.d.ts +4 -0
- package/dist/util/getConfig.js +40 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +8 -0
- package/dist/util/makeOptional.d.ts +10 -0
- package/dist/util/makeOptional.js +47 -0
- package/dist/util/strToObj.d.ts +2 -0
- package/dist/util/strToObj.js +9 -0
- package/dist/util/translator.d.ts +2 -0
- package/dist/util/translator.js +74 -0
- package/examples/blog-routes/blog/blog.routes.js +15 -0
- package/examples/blog-routes/blog/blog.validator.js +35 -0
- package/examples/blog-routes/role/role.routes.js +14 -0
- package/examples/blog-routes/role/role.validator.js +28 -0
- package/examples/blog-routes/user/user.controller.js +97 -0
- package/examples/blog-routes/user/user.routes.js +18 -0
- package/examples/blog-routes/user/user.validator.js +53 -0
- package/package.json +65 -66
- package/dist/cjs/auth/auth2.d.ts +0 -18
- package/dist/cjs/auth/auth2.js +0 -93
- package/dist/cjs/uploader/uploader.js +0 -145
- package/dist/cjs/yup.config.d.ts +0 -2
- package/dist/cjs/yup.config.js +0 -24
- package/dist/esm/auth/auth.d.ts +0 -3
- package/dist/esm/auth/auth.js +0 -38
- package/dist/esm/auth/types.d.ts +0 -19
- package/dist/esm/auth/types.js +0 -2
- package/dist/esm/db/db.d.ts +0 -182
- package/dist/esm/db/db.js +0 -594
- package/dist/esm/db/utils.d.ts +0 -3
- package/dist/esm/db/utils.js +0 -15
- package/dist/esm/uploader/uploader.d.ts +0 -24
- package/dist/esm/validator/validator.d.ts +0 -9
- package/dist/esm/validator/validator.js +0 -36
- /package/dist/{cjs → kit}/auth/auth.d.ts +0 -0
- /package/dist/{cjs → kit}/auth/types.d.ts +0 -0
- /package/dist/{cjs → kit}/auth/types.js +0 -0
- /package/dist/{cjs → kit}/db/utils.d.ts +0 -0
- /package/dist/{cjs → kit}/db/utils.js +0 -0
- /package/dist/{cjs → kit}/validator/validator.d.ts +0 -0
- /package/dist/{cjs → kit}/validator/validator.js +0 -0
package/dist/cjs/auth/auth2.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from "express";
|
|
2
|
-
type Handler = (req: Request, res: Response, next: (errorMessage?: string) => unknown) => unknown;
|
|
3
|
-
type UseAuth = (req: Request, res: Response, next: NextFunction) => UseAuth | {
|
|
4
|
-
user?: (...handlers: Handler[]) => unknown;
|
|
5
|
-
admin?: (...handlers: [{
|
|
6
|
-
permission: string;
|
|
7
|
-
}, ...Handler[]] | Handler[]) => unknown;
|
|
8
|
-
any?: (...handlers: Handler[]) => unknown;
|
|
9
|
-
};
|
|
10
|
-
declare const auth: (config?: {
|
|
11
|
-
admin: {
|
|
12
|
-
role: string;
|
|
13
|
-
model: string;
|
|
14
|
-
};
|
|
15
|
-
jwtSecretEnv: string;
|
|
16
|
-
customValidator: (req: Request, key: string) => boolean;
|
|
17
|
-
}) => UseAuth;
|
|
18
|
-
export default auth;
|
package/dist/cjs/auth/auth2.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
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
|
-
const getConfig_1 = __importDefault(require("../util/getConfig"));
|
|
7
|
-
const gConfig = {
|
|
8
|
-
admin: { role: "ADMIN", model: "../models/admin" },
|
|
9
|
-
jwtSecretEnv: "JWT_KEY",
|
|
10
|
-
customValidator: (req, key) => {
|
|
11
|
-
return true;
|
|
12
|
-
},
|
|
13
|
-
...(0, getConfig_1.default)("auth"),
|
|
14
|
-
};
|
|
15
|
-
const holders = {};
|
|
16
|
-
const auth = (config = gConfig) => {
|
|
17
|
-
// const adminModel = require('../models/admin')
|
|
18
|
-
let handlerState = {};
|
|
19
|
-
let useAuth = async (req, res, next) => {
|
|
20
|
-
try {
|
|
21
|
-
const nextFunc = (handlers, index = 0) => (errorMessage = "") => {
|
|
22
|
-
if (errorMessage)
|
|
23
|
-
return next(errorMessage);
|
|
24
|
-
if (!handlers.length || !handlers[index + 1])
|
|
25
|
-
return next();
|
|
26
|
-
handlers[index + 1](req, res, nextFunc(handlers, index + 1));
|
|
27
|
-
};
|
|
28
|
-
const keys = Object.keys(handlerState);
|
|
29
|
-
for (let i = 0; i < keys.length; i++) {
|
|
30
|
-
const key = keys[i];
|
|
31
|
-
if (!handlerState[key]?.handlers?.length)
|
|
32
|
-
continue;
|
|
33
|
-
if (await gConfig?.customValidator?.(req, key)) {
|
|
34
|
-
return await handlerState[key].handlers[0](req, res, nextFunc(handlerState[key].handlers));
|
|
35
|
-
}
|
|
36
|
-
else if ((await gConfig?.customValidator?.(req, key)) == null) {
|
|
37
|
-
return next({ status: 401, json: { message: "unauthorized" } });
|
|
38
|
-
}
|
|
39
|
-
else if (i === keys.length - 1) {
|
|
40
|
-
next({
|
|
41
|
-
status: 405,
|
|
42
|
-
json: { message: "you don't have access to this section" },
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
else
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
console.log("auth", 42, error);
|
|
51
|
-
next({
|
|
52
|
-
status: 403,
|
|
53
|
-
json: {
|
|
54
|
-
message: error instanceof Error
|
|
55
|
-
? error.message
|
|
56
|
-
: "error on authentication please login again",
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
holders.admin = (...handlers) => {
|
|
62
|
-
if (!Array.isArray(handlers))
|
|
63
|
-
throw new Error("handlers must be an array");
|
|
64
|
-
const hasConfig = typeof handlers[0] === "object" && "permission" in handlers[0];
|
|
65
|
-
const configObj = hasConfig
|
|
66
|
-
? handlers[0]
|
|
67
|
-
: undefined;
|
|
68
|
-
const handlerFns = hasConfig
|
|
69
|
-
? handlers.slice(1)
|
|
70
|
-
: handlers;
|
|
71
|
-
handlerState[`admin${configObj?.permission ? `:${configObj.permission}` : ""}`] = {
|
|
72
|
-
...(configObj ? { config: configObj } : {}),
|
|
73
|
-
handlers: handlerFns,
|
|
74
|
-
};
|
|
75
|
-
return useAuth;
|
|
76
|
-
};
|
|
77
|
-
holders.user = (...handlers) => {
|
|
78
|
-
if (!Array.isArray(handlers))
|
|
79
|
-
throw new Error("handlers must be an array");
|
|
80
|
-
handlerState.user = { handlers };
|
|
81
|
-
return useAuth;
|
|
82
|
-
};
|
|
83
|
-
holders.any = (...handlers) => {
|
|
84
|
-
if (!Array.isArray(handlers))
|
|
85
|
-
throw new Error("handlers must be an array");
|
|
86
|
-
handlerState.any = { handlers };
|
|
87
|
-
return useAuth;
|
|
88
|
-
};
|
|
89
|
-
useAuth = Object.assign(useAuth, holders);
|
|
90
|
-
return useAuth;
|
|
91
|
-
};
|
|
92
|
-
console.log("auth", 81, typeof auth);
|
|
93
|
-
exports.default = auth;
|
|
@@ -1,145 +0,0 @@
|
|
|
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
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const multer_1 = __importDefault(require("multer"));
|
|
9
|
-
const mongoose_1 = __importDefault(require("mongoose"));
|
|
10
|
-
const getConfig_1 = __importDefault(require("../util/getConfig"));
|
|
11
|
-
let configs = {
|
|
12
|
-
saveInDb: false,
|
|
13
|
-
prefix: "",
|
|
14
|
-
limit: 5,
|
|
15
|
-
format: /png|jpg|webp|jpeg/i,
|
|
16
|
-
path: '../../../public',
|
|
17
|
-
...(0, getConfig_1.default)("uploader")
|
|
18
|
-
};
|
|
19
|
-
exports.default = (destination = "/image", config = configs) => {
|
|
20
|
-
let dest;
|
|
21
|
-
try {
|
|
22
|
-
Object.entries(config).forEach(([key, val]) => {
|
|
23
|
-
configs[key] = val;
|
|
24
|
-
});
|
|
25
|
-
const storage = multer_1.default.diskStorage({
|
|
26
|
-
destination: function (req, file, cb) {
|
|
27
|
-
try {
|
|
28
|
-
dest = typeof destination === "function"
|
|
29
|
-
? destination(req, file)
|
|
30
|
-
: destination;
|
|
31
|
-
const splitPath = dest.split("/");
|
|
32
|
-
let currentPath = path_1.default.join(configs.path);
|
|
33
|
-
splitPath.forEach(folder => {
|
|
34
|
-
currentPath = path_1.default.join(currentPath, folder);
|
|
35
|
-
if (!fs_1.default.existsSync(currentPath)) {
|
|
36
|
-
fs_1.default.mkdirSync(currentPath);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
cb(null, path_1.default.join(configs.path, dest));
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
cb(err, "");
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
filename: function (req, file, cb) {
|
|
46
|
-
try {
|
|
47
|
-
const ext = path_1.default.extname(file.originalname);
|
|
48
|
-
if (!ext.slice(1).match(configs.format)) {
|
|
49
|
-
return cb(new Error("File format not acceptable"), '');
|
|
50
|
-
}
|
|
51
|
-
const originalName = Buffer.from(file.originalname, "latin1").toString("utf8");
|
|
52
|
-
const fileName = (configs.prefix ? configs.prefix + "-" : "") +
|
|
53
|
-
originalName.replace(/\.\w+$/, "") + ext;
|
|
54
|
-
const filePath = path_1.default.join(configs.path, dest, fileName);
|
|
55
|
-
try {
|
|
56
|
-
fs_1.default.existsSync(filePath);
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
}
|
|
60
|
-
if (fs_1.default.existsSync(filePath)) {
|
|
61
|
-
return cb(new Error("File already exists in the destination folder"), '');
|
|
62
|
-
}
|
|
63
|
-
cb(null, fileName);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
cb(err, '');
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
const uploader = (0, multer_1.default)({
|
|
71
|
-
storage,
|
|
72
|
-
limits: { fileSize: (configs.limit || 5) * 1024 * 1024 }, // MB
|
|
73
|
-
});
|
|
74
|
-
return {
|
|
75
|
-
single: (fieldName) => (req, res, next) => {
|
|
76
|
-
uploader.single(fieldName)(req, res, async (err) => {
|
|
77
|
-
if (err) {
|
|
78
|
-
console.log('uploader', 85, err);
|
|
79
|
-
return next({ status: 405, json: { message: err.message } });
|
|
80
|
-
}
|
|
81
|
-
if (req.file) {
|
|
82
|
-
if (configs.saveInDb) {
|
|
83
|
-
const db = mongoose_1.default.connection;
|
|
84
|
-
const collection = db.collection("media");
|
|
85
|
-
const duplicate = await collection.findOne({ alt: req.body.alt });
|
|
86
|
-
if (duplicate) {
|
|
87
|
-
fs_1.default.rmSync(req.file.path);
|
|
88
|
-
return res.status(405).json({ message: "alt is repetitive" });
|
|
89
|
-
}
|
|
90
|
-
const mediaDoc = await collection.insertOne({
|
|
91
|
-
type: req.file.mimetype.split("/")[0],
|
|
92
|
-
name: req.file.filename,
|
|
93
|
-
dirPath: dest + "/",
|
|
94
|
-
alt: req.body.alt,
|
|
95
|
-
desc: req.body.desc,
|
|
96
|
-
url: "/static/" + dest + "/" + req.file.filename,
|
|
97
|
-
});
|
|
98
|
-
req.mediaId = mediaDoc.insertedId;
|
|
99
|
-
}
|
|
100
|
-
req.body[fieldName] = path_1.default
|
|
101
|
-
.join("/static", path_1.default.relative(path_1.default.join(configs.path), req.file.path))
|
|
102
|
-
.replaceAll(/\\/g, "/");
|
|
103
|
-
}
|
|
104
|
-
next();
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
array: (fieldName, maxCount = Infinity) => (req, res, next) => {
|
|
108
|
-
uploader.array(fieldName, maxCount)(req, res, (err) => {
|
|
109
|
-
if (err)
|
|
110
|
-
return res.status(405).json({ message: err.message });
|
|
111
|
-
if (req.files && Array.isArray(req.files) && req.files.length) {
|
|
112
|
-
req.body[fieldName] = req.files.map(file => path_1.default
|
|
113
|
-
.join("/static", path_1.default.relative(path_1.default.join(configs.path), file.path))
|
|
114
|
-
.replaceAll(/\\/g, "/"));
|
|
115
|
-
}
|
|
116
|
-
next();
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
fields: (fields) => (req, res, next) => {
|
|
120
|
-
uploader.fields(fields)(req, res, (err) => {
|
|
121
|
-
if (err)
|
|
122
|
-
return res.status(405).json({ message: err.message });
|
|
123
|
-
next();
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
any: () => (req, res, next) => {
|
|
127
|
-
uploader.any()(req, res, (err) => {
|
|
128
|
-
if (err)
|
|
129
|
-
return res.status(405).json({ message: err.message });
|
|
130
|
-
next();
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
none: () => (req, res, next) => {
|
|
134
|
-
uploader.none()(req, res, (err) => {
|
|
135
|
-
if (err)
|
|
136
|
-
return res.status(405).json({ message: err.message });
|
|
137
|
-
next();
|
|
138
|
-
});
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
console.log("uploader init error", error);
|
|
144
|
-
}
|
|
145
|
-
};
|
package/dist/cjs/yup.config.d.ts
DELETED
package/dist/cjs/yup.config.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
const mongoose_1 = require("mongoose");
|
|
7
|
-
const yup_1 = __importDefault(require("yup"));
|
|
8
|
-
yup_1.default.addMethod(yup_1.default.string, "oid", function (errorMessage = "آیدی درست نیست") {
|
|
9
|
-
return this.test({
|
|
10
|
-
name: "oid",
|
|
11
|
-
message: errorMessage,
|
|
12
|
-
test(value) {
|
|
13
|
-
if (!value)
|
|
14
|
-
return true;
|
|
15
|
-
if (value == "$$REMOVE")
|
|
16
|
-
return true;
|
|
17
|
-
if (!value || !(0, mongoose_1.isValidObjectId)(value)) {
|
|
18
|
-
return false; // Invalid ObjectId
|
|
19
|
-
}
|
|
20
|
-
return true; // Valid ObjectId
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
exports.default = yup_1.default;
|
package/dist/esm/auth/auth.d.ts
DELETED
package/dist/esm/auth/auth.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
const getConfig_1 = __importDefault(require("../util/getConfig"));
|
|
7
|
-
const gConfig = {
|
|
8
|
-
admin: { role: "ADMIN", model: "../models/admin" },
|
|
9
|
-
jwtSecretEnv: "JWT_KEY",
|
|
10
|
-
customValidator: (req, key) => {
|
|
11
|
-
return true;
|
|
12
|
-
},
|
|
13
|
-
...(0, getConfig_1.default)("auth"),
|
|
14
|
-
};
|
|
15
|
-
const executer = (authType) => {
|
|
16
|
-
const mw = async (req, res, next) => {
|
|
17
|
-
const accessResult = await gConfig?.customValidator?.(req, authType);
|
|
18
|
-
if (accessResult == null)
|
|
19
|
-
return next({ status: 401, json: { message: "Unauthorized" } });
|
|
20
|
-
if (!accessResult)
|
|
21
|
-
return next({ status: 403, json: { message: "Forbidden" } });
|
|
22
|
-
return next();
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(mw, "name", { value: `auth:${authType}` });
|
|
25
|
-
return mw;
|
|
26
|
-
};
|
|
27
|
-
const auth = {
|
|
28
|
-
user: () => {
|
|
29
|
-
return executer("user");
|
|
30
|
-
},
|
|
31
|
-
admin: (config) => {
|
|
32
|
-
return executer(`admin${config?.permission ? `:${config.permission}` : ""}`);
|
|
33
|
-
},
|
|
34
|
-
any: () => {
|
|
35
|
-
return executer("any");
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
exports.default = auth;
|
package/dist/esm/auth/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
type Handler = (req: Request, res: Response, next: (errorMessage?: string) => unknown) => unknown;
|
|
3
|
-
type Executer = (authField: string) => (req: Request, res: Response, next: NextFunction) => unknown;
|
|
4
|
-
type Auth = {
|
|
5
|
-
user: () => Handler;
|
|
6
|
-
admin: (config?: {
|
|
7
|
-
permission: string;
|
|
8
|
-
}) => Handler;
|
|
9
|
-
any: () => Handler;
|
|
10
|
-
};
|
|
11
|
-
type ConfigType = {
|
|
12
|
-
customValidator?: (req: Request, key: string) => Promise<boolean | null>;
|
|
13
|
-
jwtSecretEnv?: string;
|
|
14
|
-
admin?: {
|
|
15
|
-
role: string;
|
|
16
|
-
model: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export { Handler, Executer, Auth, ConfigType };
|
package/dist/esm/auth/types.js
DELETED
package/dist/esm/db/db.d.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from "express";
|
|
2
|
-
declare module "express-serve-static-core" {
|
|
3
|
-
interface Request {
|
|
4
|
-
document?: any;
|
|
5
|
-
user?: any;
|
|
6
|
-
}
|
|
7
|
-
interface Response {
|
|
8
|
-
logger?: (message: string, details?: any) => void;
|
|
9
|
-
success?: (statusCode: number, body: any) => void;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
type ConfigsType = {
|
|
13
|
-
dbType?: string;
|
|
14
|
-
path?: string;
|
|
15
|
-
dbEnv?: string;
|
|
16
|
-
type: "internal" | "external";
|
|
17
|
-
pagination?: {
|
|
18
|
-
quantity?: number;
|
|
19
|
-
detailed?: boolean;
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
};
|
|
24
|
-
declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
25
|
-
find: (match?: {}) => {
|
|
26
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
27
|
-
select(value: string | {
|
|
28
|
-
[key: string]: -1 | 1;
|
|
29
|
-
}): /*elided*/ any;
|
|
30
|
-
sort(value: string | {
|
|
31
|
-
[key: string]: -1 | 1;
|
|
32
|
-
}): /*elided*/ any;
|
|
33
|
-
skip(value: number): /*elided*/ any;
|
|
34
|
-
limit(value: number): /*elided*/ any;
|
|
35
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
36
|
-
};
|
|
37
|
-
create: (body?: {}) => {
|
|
38
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
39
|
-
select(value: string | {
|
|
40
|
-
[key: string]: -1 | 1;
|
|
41
|
-
}): /*elided*/ any;
|
|
42
|
-
sort(value: string | {
|
|
43
|
-
[key: string]: -1 | 1;
|
|
44
|
-
}): /*elided*/ any;
|
|
45
|
-
skip(value: number): /*elided*/ any;
|
|
46
|
-
limit(value: number): /*elided*/ any;
|
|
47
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
48
|
-
};
|
|
49
|
-
updateOne: (match?: {}, body?: {}) => {
|
|
50
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
51
|
-
select(value: string | {
|
|
52
|
-
[key: string]: -1 | 1;
|
|
53
|
-
}): /*elided*/ any;
|
|
54
|
-
sort(value: string | {
|
|
55
|
-
[key: string]: -1 | 1;
|
|
56
|
-
}): /*elided*/ any;
|
|
57
|
-
skip(value: number): /*elided*/ any;
|
|
58
|
-
limit(value: number): /*elided*/ any;
|
|
59
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
60
|
-
};
|
|
61
|
-
updateMany: (match?: {}, body?: {}) => {
|
|
62
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
63
|
-
select(value: string | {
|
|
64
|
-
[key: string]: -1 | 1;
|
|
65
|
-
}): /*elided*/ any;
|
|
66
|
-
sort(value: string | {
|
|
67
|
-
[key: string]: -1 | 1;
|
|
68
|
-
}): /*elided*/ any;
|
|
69
|
-
skip(value: number): /*elided*/ any;
|
|
70
|
-
limit(value: number): /*elided*/ any;
|
|
71
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
72
|
-
};
|
|
73
|
-
deleteOne: (match?: {}) => {
|
|
74
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
75
|
-
select(value: string | {
|
|
76
|
-
[key: string]: -1 | 1;
|
|
77
|
-
}): /*elided*/ any;
|
|
78
|
-
sort(value: string | {
|
|
79
|
-
[key: string]: -1 | 1;
|
|
80
|
-
}): /*elided*/ any;
|
|
81
|
-
skip(value: number): /*elided*/ any;
|
|
82
|
-
limit(value: number): /*elided*/ any;
|
|
83
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
84
|
-
};
|
|
85
|
-
deleteMany: (match?: {}) => {
|
|
86
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
87
|
-
select(value: string | {
|
|
88
|
-
[key: string]: -1 | 1;
|
|
89
|
-
}): /*elided*/ any;
|
|
90
|
-
sort(value: string | {
|
|
91
|
-
[key: string]: -1 | 1;
|
|
92
|
-
}): /*elided*/ any;
|
|
93
|
-
skip(value: number): /*elided*/ any;
|
|
94
|
-
limit(value: number): /*elided*/ any;
|
|
95
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
96
|
-
};
|
|
97
|
-
findOne: (match?: {}) => {
|
|
98
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
99
|
-
select(value: string | {
|
|
100
|
-
[key: string]: -1 | 1;
|
|
101
|
-
}): /*elided*/ any;
|
|
102
|
-
sort(value: string | {
|
|
103
|
-
[key: string]: -1 | 1;
|
|
104
|
-
}): /*elided*/ any;
|
|
105
|
-
skip(value: number): /*elided*/ any;
|
|
106
|
-
limit(value: number): /*elided*/ any;
|
|
107
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
108
|
-
};
|
|
109
|
-
findOneAndUpdate: (match?: {}, body?: {}) => {
|
|
110
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
111
|
-
select(value: string | {
|
|
112
|
-
[key: string]: -1 | 1;
|
|
113
|
-
}): /*elided*/ any;
|
|
114
|
-
sort(value: string | {
|
|
115
|
-
[key: string]: -1 | 1;
|
|
116
|
-
}): /*elided*/ any;
|
|
117
|
-
skip(value: number): /*elided*/ any;
|
|
118
|
-
limit(value: number): /*elided*/ any;
|
|
119
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
120
|
-
};
|
|
121
|
-
aggregate: (pipeline?: never[]) => {
|
|
122
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
123
|
-
select(value: string | {
|
|
124
|
-
[key: string]: -1 | 1;
|
|
125
|
-
}): /*elided*/ any;
|
|
126
|
-
sort(value: string | {
|
|
127
|
-
[key: string]: -1 | 1;
|
|
128
|
-
}): /*elided*/ any;
|
|
129
|
-
skip(value: number): /*elided*/ any;
|
|
130
|
-
limit(value: number): /*elided*/ any;
|
|
131
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
132
|
-
};
|
|
133
|
-
findOneAndDelete: (match?: {}) => {
|
|
134
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
135
|
-
select(value: string | {
|
|
136
|
-
[key: string]: -1 | 1;
|
|
137
|
-
}): /*elided*/ any;
|
|
138
|
-
sort(value: string | {
|
|
139
|
-
[key: string]: -1 | 1;
|
|
140
|
-
}): /*elided*/ any;
|
|
141
|
-
skip(value: number): /*elided*/ any;
|
|
142
|
-
limit(value: number): /*elided*/ any;
|
|
143
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
144
|
-
};
|
|
145
|
-
findById: (id?: string) => {
|
|
146
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
147
|
-
select(value: string | {
|
|
148
|
-
[key: string]: -1 | 1;
|
|
149
|
-
}): /*elided*/ any;
|
|
150
|
-
sort(value: string | {
|
|
151
|
-
[key: string]: -1 | 1;
|
|
152
|
-
}): /*elided*/ any;
|
|
153
|
-
skip(value: number): /*elided*/ any;
|
|
154
|
-
limit(value: number): /*elided*/ any;
|
|
155
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
156
|
-
};
|
|
157
|
-
findByIdAndUpdate: (id?: string, body?: {}) => {
|
|
158
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
159
|
-
select(value: string | {
|
|
160
|
-
[key: string]: -1 | 1;
|
|
161
|
-
}): /*elided*/ any;
|
|
162
|
-
sort(value: string | {
|
|
163
|
-
[key: string]: -1 | 1;
|
|
164
|
-
}): /*elided*/ any;
|
|
165
|
-
skip(value: number): /*elided*/ any;
|
|
166
|
-
limit(value: number): /*elided*/ any;
|
|
167
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
168
|
-
};
|
|
169
|
-
findByIdAndDelete: (id?: string) => {
|
|
170
|
-
(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
171
|
-
select(value: string | {
|
|
172
|
-
[key: string]: -1 | 1;
|
|
173
|
-
}): /*elided*/ any;
|
|
174
|
-
sort(value: string | {
|
|
175
|
-
[key: string]: -1 | 1;
|
|
176
|
-
}): /*elided*/ any;
|
|
177
|
-
skip(value: number): /*elided*/ any;
|
|
178
|
-
limit(value: number): /*elided*/ any;
|
|
179
|
-
populate(value: string | object | (string | object)[]): /*elided*/ any;
|
|
180
|
-
};
|
|
181
|
-
} | undefined;
|
|
182
|
-
export default db;
|