speedly 1.2.40 → 1.2.43
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/cjs/db/db.js +2 -1
- package/dist/cjs/document/document.d.ts +2 -0
- package/dist/cjs/document/document.js +185 -0
- package/dist/cjs/index.d.ts +6 -5
- package/dist/cjs/index.js +4 -2
- package/dist/esm/db/db.js +2 -1
- package/dist/esm/document/document.d.ts +2 -0
- package/dist/esm/document/document.js +185 -0
- package/dist/esm/index.d.ts +6 -5
- package/dist/esm/index.js +4 -2
- package/package.json +5 -2
package/dist/cjs/db/db.js
CHANGED
|
@@ -523,7 +523,8 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
523
523
|
return next({
|
|
524
524
|
status: 500,
|
|
525
525
|
json: {
|
|
526
|
-
message:
|
|
526
|
+
message: (err instanceof Error ? err.message : String(err)) ||
|
|
527
|
+
"internal server error",
|
|
527
528
|
},
|
|
528
529
|
});
|
|
529
530
|
}
|
|
@@ -0,0 +1,185 @@
|
|
|
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.default = swaggerLoader;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
|
|
10
|
+
const swagger_themes_1 = require("swagger-themes");
|
|
11
|
+
const METHODS_WITH_BODY = ["post", "put", "patch"];
|
|
12
|
+
/* ===================== HELPERS ======================= */
|
|
13
|
+
function extractPath(layer) {
|
|
14
|
+
if (layer.regexp && layer.regexp.source !== "^\\/?$") {
|
|
15
|
+
return layer.regexp.source
|
|
16
|
+
.replace("^\\/", "/")
|
|
17
|
+
.replace("\\/?(?=\\/|$)", "")
|
|
18
|
+
.replace(/\\\//g, "/");
|
|
19
|
+
}
|
|
20
|
+
return "";
|
|
21
|
+
}
|
|
22
|
+
function splitRouteByMethod(route) {
|
|
23
|
+
const result = {};
|
|
24
|
+
route.stack.forEach((layer, idx) => {
|
|
25
|
+
if (layer.method) {
|
|
26
|
+
const method = layer.method.toLowerCase();
|
|
27
|
+
const middlewares = [];
|
|
28
|
+
for (let i = 0; i < idx; i++) {
|
|
29
|
+
if (route.stack[i].name !== "bound dispatch")
|
|
30
|
+
middlewares.push(route.stack[i]);
|
|
31
|
+
}
|
|
32
|
+
result[method] = { middlewares, handler: layer };
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/* ================== YUP → OPENAPI ==================== */
|
|
38
|
+
function resolveYupSchema(schema) {
|
|
39
|
+
if (!schema)
|
|
40
|
+
return null;
|
|
41
|
+
if (schema?.type === "lazy" && typeof schema._resolve === "function") {
|
|
42
|
+
return schema._resolve({});
|
|
43
|
+
}
|
|
44
|
+
return schema;
|
|
45
|
+
}
|
|
46
|
+
function translateField(field) {
|
|
47
|
+
if (!field)
|
|
48
|
+
return { type: "string" };
|
|
49
|
+
return {
|
|
50
|
+
type: field.type === "array" ? "array" : field.type || "string",
|
|
51
|
+
nullable: field.nullable || false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function translateYupSchema(schema) {
|
|
55
|
+
schema = resolveYupSchema(schema);
|
|
56
|
+
if (!schema)
|
|
57
|
+
return null;
|
|
58
|
+
const described = schema.describe();
|
|
59
|
+
const properties = Object.entries(described.fields ?? {}).reduce((acc, [name, field]) => {
|
|
60
|
+
acc[name] = translateField(field);
|
|
61
|
+
return acc;
|
|
62
|
+
}, {});
|
|
63
|
+
return {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties,
|
|
66
|
+
required: Object.entries(described.fields ?? {})
|
|
67
|
+
.filter(([_, f]) => !(f.optional || f.nullable))
|
|
68
|
+
.map(([name]) => name),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getAuthStatus(middlewares) {
|
|
72
|
+
for (const mw of middlewares) {
|
|
73
|
+
if (!mw.name)
|
|
74
|
+
continue;
|
|
75
|
+
if (mw.name.startsWith("auth")) {
|
|
76
|
+
const parts = mw.name.split(":");
|
|
77
|
+
if (parts[1] === "any")
|
|
78
|
+
return { type: "any", raw: mw.name };
|
|
79
|
+
return { type: "required", raw: mw.name };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { type: "none", raw: null };
|
|
83
|
+
}
|
|
84
|
+
/* ==================== ROUTER SCANNER ==================== */
|
|
85
|
+
function scanRouter(router, base = "") {
|
|
86
|
+
const routes = [];
|
|
87
|
+
router.stack.forEach((layer) => {
|
|
88
|
+
if (layer.route) {
|
|
89
|
+
routes.push({
|
|
90
|
+
path: base + layer.route.path,
|
|
91
|
+
methods: splitRouteByMethod(layer.route),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else if (layer.name === "router" && layer.handle?.stack) {
|
|
95
|
+
routes.push(...scanRouter(layer.handle, base + extractPath(layer)));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return routes;
|
|
99
|
+
}
|
|
100
|
+
/* ================== MAIN ANALYZER ===================== */
|
|
101
|
+
function routeAnalyzer(route, routerName) {
|
|
102
|
+
const routerDetails = {};
|
|
103
|
+
const scanned = scanRouter(route);
|
|
104
|
+
const paramsRegex = /:[^/]+/g;
|
|
105
|
+
scanned.forEach((route) => {
|
|
106
|
+
const fullPath = `/${routerName}${route.path
|
|
107
|
+
.replace(/^\/$/, "")
|
|
108
|
+
.replaceAll(paramsRegex, (r) => `{${r.slice(1)}}`)}`;
|
|
109
|
+
routerDetails[fullPath] = {};
|
|
110
|
+
Object.entries(route.methods).forEach(([method, detail]) => {
|
|
111
|
+
const doc = {
|
|
112
|
+
tags: [routerName.replace("_", " ")],
|
|
113
|
+
description: "Public route",
|
|
114
|
+
};
|
|
115
|
+
const validation = detail.middlewares.find((mw) => mw.handle?.__validationSchema)?.handle.__validationSchema;
|
|
116
|
+
// If body exists
|
|
117
|
+
if (METHODS_WITH_BODY.includes(method)) {
|
|
118
|
+
if (validation?.body) {
|
|
119
|
+
doc.requestBody = {
|
|
120
|
+
required: true,
|
|
121
|
+
content: {
|
|
122
|
+
"application/json": {
|
|
123
|
+
schema: translateYupSchema(validation.body),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Auth
|
|
130
|
+
const auth = getAuthStatus(detail.middlewares);
|
|
131
|
+
if (auth.type === "required") {
|
|
132
|
+
doc.security = [{ bearerAuth: [] }];
|
|
133
|
+
doc.description = `Requires authentication (${auth.raw})`;
|
|
134
|
+
}
|
|
135
|
+
else if (auth.type === "any") {
|
|
136
|
+
doc.description = "Optional login route";
|
|
137
|
+
}
|
|
138
|
+
routerDetails[fullPath][method] = doc;
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
return routerDetails;
|
|
142
|
+
}
|
|
143
|
+
/* =================== LOAD MODULES ==================== */
|
|
144
|
+
function RouterFetcher(baseDir) {
|
|
145
|
+
const modules = fs_1.default.readdirSync(baseDir);
|
|
146
|
+
let paths = {};
|
|
147
|
+
const tags = [];
|
|
148
|
+
modules.forEach((mf) => {
|
|
149
|
+
const routerPath = path_1.default.join(baseDir, mf, `${mf}.routes.js`);
|
|
150
|
+
try {
|
|
151
|
+
const router = require(routerPath);
|
|
152
|
+
paths = { ...paths, ...routeAnalyzer(router, mf) };
|
|
153
|
+
tags.push({
|
|
154
|
+
name: mf.replace("_", " "),
|
|
155
|
+
description: `${mf} operations`,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
console.error("Swagger loading error:", err.message);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
openapi: "3.0.3",
|
|
164
|
+
info: {
|
|
165
|
+
title: `${require(path_1.default.join(process.cwd(), "package.json")).name} APIs`,
|
|
166
|
+
version: "1.0.0",
|
|
167
|
+
},
|
|
168
|
+
servers: [{ url: "/api/v1" }],
|
|
169
|
+
paths,
|
|
170
|
+
tags,
|
|
171
|
+
components: {
|
|
172
|
+
securitySchemes: {
|
|
173
|
+
bearerAuth: { type: "http", scheme: "bearer", bearerFormat: "JWT" },
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/* ==================== EXPORT HOOK ==================== */
|
|
179
|
+
function swaggerLoader(app, baseDir = path_1.default.join(process.cwd(), "src/module")) {
|
|
180
|
+
const doc = RouterFetcher(baseDir);
|
|
181
|
+
const theme = new swagger_themes_1.SwaggerTheme();
|
|
182
|
+
app.use("/docs", swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(doc, {
|
|
183
|
+
customCss: theme.getBuffer(swagger_themes_1.SwaggerThemeNameEnum.DARK),
|
|
184
|
+
}));
|
|
185
|
+
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import auth from
|
|
2
|
-
import db from
|
|
3
|
-
import uploader from
|
|
4
|
-
import validator from
|
|
1
|
+
import auth from "./auth/auth";
|
|
2
|
+
import db from "./db/db";
|
|
3
|
+
import uploader from "./uploader/uploader";
|
|
4
|
+
import validator from "./validator/validator";
|
|
5
|
+
import document from "./document/document";
|
|
5
6
|
declare const utils: {
|
|
6
7
|
translator: (text?: string, lang?: string) => Promise<unknown>;
|
|
7
8
|
};
|
|
@@ -67,4 +68,4 @@ declare const models: {
|
|
|
67
68
|
declare const modules: {
|
|
68
69
|
translation: import("express-serve-static-core").Router;
|
|
69
70
|
};
|
|
70
|
-
export { auth, db, uploader, validator, models, modules, utils };
|
|
71
|
+
export { auth, db, uploader, validator, models, modules, utils, document };
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.utils = exports.modules = exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
|
|
6
|
+
exports.document = exports.utils = exports.modules = exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
|
|
7
7
|
const auth_1 = __importDefault(require("./auth/auth"));
|
|
8
8
|
exports.auth = auth_1.default;
|
|
9
9
|
const db_1 = __importDefault(require("./db/db"));
|
|
@@ -14,9 +14,11 @@ const validator_1 = __importDefault(require("./validator/validator"));
|
|
|
14
14
|
exports.validator = validator_1.default;
|
|
15
15
|
const translation_1 = __importDefault(require("./model/translation"));
|
|
16
16
|
const translation_routes_1 = __importDefault(require("./modules/translation/translation.routes"));
|
|
17
|
+
const document_1 = __importDefault(require("./document/document"));
|
|
18
|
+
exports.document = document_1.default;
|
|
17
19
|
const translator_1 = __importDefault(require("./util/translator"));
|
|
18
20
|
const utils = {
|
|
19
|
-
translator: translator_1.default
|
|
21
|
+
translator: translator_1.default,
|
|
20
22
|
};
|
|
21
23
|
exports.utils = utils;
|
|
22
24
|
const models = { translation: translation_1.default };
|
package/dist/esm/db/db.js
CHANGED
|
@@ -523,7 +523,8 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
523
523
|
return next({
|
|
524
524
|
status: 500,
|
|
525
525
|
json: {
|
|
526
|
-
message:
|
|
526
|
+
message: (err instanceof Error ? err.message : String(err)) ||
|
|
527
|
+
"internal server error",
|
|
527
528
|
},
|
|
528
529
|
});
|
|
529
530
|
}
|
|
@@ -0,0 +1,185 @@
|
|
|
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.default = swaggerLoader;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
|
|
10
|
+
const swagger_themes_1 = require("swagger-themes");
|
|
11
|
+
const METHODS_WITH_BODY = ["post", "put", "patch"];
|
|
12
|
+
/* ===================== HELPERS ======================= */
|
|
13
|
+
function extractPath(layer) {
|
|
14
|
+
if (layer.regexp && layer.regexp.source !== "^\\/?$") {
|
|
15
|
+
return layer.regexp.source
|
|
16
|
+
.replace("^\\/", "/")
|
|
17
|
+
.replace("\\/?(?=\\/|$)", "")
|
|
18
|
+
.replace(/\\\//g, "/");
|
|
19
|
+
}
|
|
20
|
+
return "";
|
|
21
|
+
}
|
|
22
|
+
function splitRouteByMethod(route) {
|
|
23
|
+
const result = {};
|
|
24
|
+
route.stack.forEach((layer, idx) => {
|
|
25
|
+
if (layer.method) {
|
|
26
|
+
const method = layer.method.toLowerCase();
|
|
27
|
+
const middlewares = [];
|
|
28
|
+
for (let i = 0; i < idx; i++) {
|
|
29
|
+
if (route.stack[i].name !== "bound dispatch")
|
|
30
|
+
middlewares.push(route.stack[i]);
|
|
31
|
+
}
|
|
32
|
+
result[method] = { middlewares, handler: layer };
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/* ================== YUP → OPENAPI ==================== */
|
|
38
|
+
function resolveYupSchema(schema) {
|
|
39
|
+
if (!schema)
|
|
40
|
+
return null;
|
|
41
|
+
if (schema?.type === "lazy" && typeof schema._resolve === "function") {
|
|
42
|
+
return schema._resolve({});
|
|
43
|
+
}
|
|
44
|
+
return schema;
|
|
45
|
+
}
|
|
46
|
+
function translateField(field) {
|
|
47
|
+
if (!field)
|
|
48
|
+
return { type: "string" };
|
|
49
|
+
return {
|
|
50
|
+
type: field.type === "array" ? "array" : field.type || "string",
|
|
51
|
+
nullable: field.nullable || false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function translateYupSchema(schema) {
|
|
55
|
+
schema = resolveYupSchema(schema);
|
|
56
|
+
if (!schema)
|
|
57
|
+
return null;
|
|
58
|
+
const described = schema.describe();
|
|
59
|
+
const properties = Object.entries(described.fields ?? {}).reduce((acc, [name, field]) => {
|
|
60
|
+
acc[name] = translateField(field);
|
|
61
|
+
return acc;
|
|
62
|
+
}, {});
|
|
63
|
+
return {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties,
|
|
66
|
+
required: Object.entries(described.fields ?? {})
|
|
67
|
+
.filter(([_, f]) => !(f.optional || f.nullable))
|
|
68
|
+
.map(([name]) => name),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getAuthStatus(middlewares) {
|
|
72
|
+
for (const mw of middlewares) {
|
|
73
|
+
if (!mw.name)
|
|
74
|
+
continue;
|
|
75
|
+
if (mw.name.startsWith("auth")) {
|
|
76
|
+
const parts = mw.name.split(":");
|
|
77
|
+
if (parts[1] === "any")
|
|
78
|
+
return { type: "any", raw: mw.name };
|
|
79
|
+
return { type: "required", raw: mw.name };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { type: "none", raw: null };
|
|
83
|
+
}
|
|
84
|
+
/* ==================== ROUTER SCANNER ==================== */
|
|
85
|
+
function scanRouter(router, base = "") {
|
|
86
|
+
const routes = [];
|
|
87
|
+
router.stack.forEach((layer) => {
|
|
88
|
+
if (layer.route) {
|
|
89
|
+
routes.push({
|
|
90
|
+
path: base + layer.route.path,
|
|
91
|
+
methods: splitRouteByMethod(layer.route),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else if (layer.name === "router" && layer.handle?.stack) {
|
|
95
|
+
routes.push(...scanRouter(layer.handle, base + extractPath(layer)));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return routes;
|
|
99
|
+
}
|
|
100
|
+
/* ================== MAIN ANALYZER ===================== */
|
|
101
|
+
function routeAnalyzer(route, routerName) {
|
|
102
|
+
const routerDetails = {};
|
|
103
|
+
const scanned = scanRouter(route);
|
|
104
|
+
const paramsRegex = /:[^/]+/g;
|
|
105
|
+
scanned.forEach((route) => {
|
|
106
|
+
const fullPath = `/${routerName}${route.path
|
|
107
|
+
.replace(/^\/$/, "")
|
|
108
|
+
.replaceAll(paramsRegex, (r) => `{${r.slice(1)}}`)}`;
|
|
109
|
+
routerDetails[fullPath] = {};
|
|
110
|
+
Object.entries(route.methods).forEach(([method, detail]) => {
|
|
111
|
+
const doc = {
|
|
112
|
+
tags: [routerName.replace("_", " ")],
|
|
113
|
+
description: "Public route",
|
|
114
|
+
};
|
|
115
|
+
const validation = detail.middlewares.find((mw) => mw.handle?.__validationSchema)?.handle.__validationSchema;
|
|
116
|
+
// If body exists
|
|
117
|
+
if (METHODS_WITH_BODY.includes(method)) {
|
|
118
|
+
if (validation?.body) {
|
|
119
|
+
doc.requestBody = {
|
|
120
|
+
required: true,
|
|
121
|
+
content: {
|
|
122
|
+
"application/json": {
|
|
123
|
+
schema: translateYupSchema(validation.body),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Auth
|
|
130
|
+
const auth = getAuthStatus(detail.middlewares);
|
|
131
|
+
if (auth.type === "required") {
|
|
132
|
+
doc.security = [{ bearerAuth: [] }];
|
|
133
|
+
doc.description = `Requires authentication (${auth.raw})`;
|
|
134
|
+
}
|
|
135
|
+
else if (auth.type === "any") {
|
|
136
|
+
doc.description = "Optional login route";
|
|
137
|
+
}
|
|
138
|
+
routerDetails[fullPath][method] = doc;
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
return routerDetails;
|
|
142
|
+
}
|
|
143
|
+
/* =================== LOAD MODULES ==================== */
|
|
144
|
+
function RouterFetcher(baseDir) {
|
|
145
|
+
const modules = fs_1.default.readdirSync(baseDir);
|
|
146
|
+
let paths = {};
|
|
147
|
+
const tags = [];
|
|
148
|
+
modules.forEach((mf) => {
|
|
149
|
+
const routerPath = path_1.default.join(baseDir, mf, `${mf}.routes.js`);
|
|
150
|
+
try {
|
|
151
|
+
const router = require(routerPath);
|
|
152
|
+
paths = { ...paths, ...routeAnalyzer(router, mf) };
|
|
153
|
+
tags.push({
|
|
154
|
+
name: mf.replace("_", " "),
|
|
155
|
+
description: `${mf} operations`,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
console.error("Swagger loading error:", err.message);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
openapi: "3.0.3",
|
|
164
|
+
info: {
|
|
165
|
+
title: `${require(path_1.default.join(process.cwd(), "package.json")).name} APIs`,
|
|
166
|
+
version: "1.0.0",
|
|
167
|
+
},
|
|
168
|
+
servers: [{ url: "/api/v1" }],
|
|
169
|
+
paths,
|
|
170
|
+
tags,
|
|
171
|
+
components: {
|
|
172
|
+
securitySchemes: {
|
|
173
|
+
bearerAuth: { type: "http", scheme: "bearer", bearerFormat: "JWT" },
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/* ==================== EXPORT HOOK ==================== */
|
|
179
|
+
function swaggerLoader(app, baseDir = path_1.default.join(process.cwd(), "src/module")) {
|
|
180
|
+
const doc = RouterFetcher(baseDir);
|
|
181
|
+
const theme = new swagger_themes_1.SwaggerTheme();
|
|
182
|
+
app.use("/docs", swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(doc, {
|
|
183
|
+
customCss: theme.getBuffer(swagger_themes_1.SwaggerThemeNameEnum.DARK),
|
|
184
|
+
}));
|
|
185
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import auth from
|
|
2
|
-
import db from
|
|
3
|
-
import uploader from
|
|
4
|
-
import validator from
|
|
1
|
+
import auth from "./auth/auth";
|
|
2
|
+
import db from "./db/db";
|
|
3
|
+
import uploader from "./uploader/uploader";
|
|
4
|
+
import validator from "./validator/validator";
|
|
5
|
+
import document from "./document/document";
|
|
5
6
|
declare const utils: {
|
|
6
7
|
translator: (text?: string, lang?: string) => Promise<unknown>;
|
|
7
8
|
};
|
|
@@ -67,4 +68,4 @@ declare const models: {
|
|
|
67
68
|
declare const modules: {
|
|
68
69
|
translation: import("express-serve-static-core").Router;
|
|
69
70
|
};
|
|
70
|
-
export { auth, db, uploader, validator, models, modules, utils };
|
|
71
|
+
export { auth, db, uploader, validator, models, modules, utils, document };
|
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.utils = exports.modules = exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
|
|
6
|
+
exports.document = exports.utils = exports.modules = exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
|
|
7
7
|
const auth_1 = __importDefault(require("./auth/auth"));
|
|
8
8
|
exports.auth = auth_1.default;
|
|
9
9
|
const db_1 = __importDefault(require("./db/db"));
|
|
@@ -14,9 +14,11 @@ const validator_1 = __importDefault(require("./validator/validator"));
|
|
|
14
14
|
exports.validator = validator_1.default;
|
|
15
15
|
const translation_1 = __importDefault(require("./model/translation"));
|
|
16
16
|
const translation_routes_1 = __importDefault(require("./modules/translation/translation.routes"));
|
|
17
|
+
const document_1 = __importDefault(require("./document/document"));
|
|
18
|
+
exports.document = document_1.default;
|
|
17
19
|
const translator_1 = __importDefault(require("./util/translator"));
|
|
18
20
|
const utils = {
|
|
19
|
-
translator: translator_1.default
|
|
21
|
+
translator: translator_1.default,
|
|
20
22
|
};
|
|
21
23
|
exports.utils = utils;
|
|
22
24
|
const models = { translation: translation_1.default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "speedly",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.43",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "npm run build:cjs && npm run build:esm",
|
|
15
15
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
16
16
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
17
|
-
"
|
|
17
|
+
"pub": "npm run build && git add . && git commit -m 'publish' && npm version patch && npm publish ",
|
|
18
18
|
"dev": "ts-node src/index.ts"
|
|
19
19
|
},
|
|
20
20
|
"author": "MAHSERIN",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@types/express": "^5.0.3",
|
|
25
25
|
"@types/multer": "^2.0.0",
|
|
26
26
|
"@types/node": "^24.5.2",
|
|
27
|
+
"@types/swagger-ui-express": "^4.1.8",
|
|
27
28
|
"ts-node": "^10.9.2",
|
|
28
29
|
"tsc": "^2.0.4",
|
|
29
30
|
"typescript": "^5.9.3"
|
|
@@ -35,6 +36,8 @@
|
|
|
35
36
|
"jsonwebtoken": "^9.0.2",
|
|
36
37
|
"mongoose": "^8.18.2",
|
|
37
38
|
"multer": "^2.0.2",
|
|
39
|
+
"swagger-themes": "^1.4.3",
|
|
40
|
+
"swagger-ui-express": "^5.0.1",
|
|
38
41
|
"translate": "^3.0.1",
|
|
39
42
|
"yup": "^1.7.1"
|
|
40
43
|
}
|