@devbro/pashmak 0.1.46 → 0.1.47
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/bin/app/console/DefaultCommand.cjs +7 -8
- package/dist/bin/app/console/KeyGenerateCommand.cjs +7 -8
- package/dist/bin/app/console/StartCommand.cjs +7 -8
- package/dist/bin/app/console/generate/GenerateApiDocsCommand.cjs +7 -8
- package/dist/bin/app/console/generate/GenerateControllerCommand.cjs +7 -8
- package/dist/bin/app/console/generate/index.cjs +7 -8
- package/dist/bin/app/console/index.cjs +7 -8
- package/dist/bin/app/console/migrate/GenerateMigrateCommand.cjs +7 -8
- package/dist/bin/app/console/migrate/MigrateCommand.cjs +7 -8
- package/dist/bin/app/console/migrate/MigrateRollbackCommand.cjs +7 -8
- package/dist/bin/app/console/migrate/index.cjs +7 -8
- package/dist/bin/app/console/queue/GenerateQueueMigrateCommand.cjs +7 -8
- package/dist/bin/cache.cjs +7 -8
- package/dist/bin/facades.cjs +7 -8
- package/dist/bin/factories.cjs +7 -8
- package/dist/bin/index.cjs +7 -8
- package/dist/bin/middlewares.cjs +7 -8
- package/dist/bin/queue.cjs +7 -8
- package/dist/bin/router.cjs +46 -12
- package/dist/facades.mjs +1 -2
- package/dist/facades.mjs.map +1 -1
- package/dist/factories.mjs.map +1 -1
- package/dist/router.d.mts +1 -1
- package/dist/router.mjs +40 -6
- package/dist/router.mjs.map +1 -1
- package/package.json +1 -10
|
@@ -111,7 +111,9 @@ var CompiledRoute = class {
|
|
|
111
111
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
112
112
|
}
|
|
113
113
|
async run() {
|
|
114
|
-
|
|
114
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
115
|
+
this.response.end();
|
|
116
|
+
return rc;
|
|
115
117
|
}
|
|
116
118
|
prepareOutputJsonFormat(obj) {
|
|
117
119
|
function traverse(value) {
|
|
@@ -162,20 +164,18 @@ var CompiledRoute = class {
|
|
|
162
164
|
const header_content_type = res.getHeader("Content-Type");
|
|
163
165
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
164
166
|
await this.writeAsync(res, controller_rc);
|
|
165
|
-
res.end();
|
|
166
167
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
167
168
|
res.setHeader("Content-Type", "application/json");
|
|
168
|
-
res.
|
|
169
|
+
res.write(this.convertToString(controller_rc));
|
|
169
170
|
} else if (!header_content_type) {
|
|
170
171
|
res.setHeader("Content-Type", "text/plain");
|
|
171
|
-
res.
|
|
172
|
+
res.write(this.convertToString(controller_rc));
|
|
172
173
|
} else {
|
|
173
|
-
res.
|
|
174
|
+
res.write(this.convertToString(controller_rc));
|
|
174
175
|
}
|
|
175
176
|
return;
|
|
176
177
|
} else {
|
|
177
178
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
178
|
-
res.end();
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
async writeAsync(res, chunk) {
|
|
@@ -718,8 +718,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
718
718
|
queue_config.provider,
|
|
719
719
|
queue_config.config
|
|
720
720
|
);
|
|
721
|
-
|
|
722
|
-
return rc;
|
|
721
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
723
722
|
});
|
|
724
723
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
725
724
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -114,7 +114,9 @@ var CompiledRoute = class {
|
|
|
114
114
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
115
115
|
}
|
|
116
116
|
async run() {
|
|
117
|
-
|
|
117
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
118
|
+
this.response.end();
|
|
119
|
+
return rc;
|
|
118
120
|
}
|
|
119
121
|
prepareOutputJsonFormat(obj) {
|
|
120
122
|
function traverse(value) {
|
|
@@ -165,20 +167,18 @@ var CompiledRoute = class {
|
|
|
165
167
|
const header_content_type = res.getHeader("Content-Type");
|
|
166
168
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
167
169
|
await this.writeAsync(res, controller_rc);
|
|
168
|
-
res.end();
|
|
169
170
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
170
171
|
res.setHeader("Content-Type", "application/json");
|
|
171
|
-
res.
|
|
172
|
+
res.write(this.convertToString(controller_rc));
|
|
172
173
|
} else if (!header_content_type) {
|
|
173
174
|
res.setHeader("Content-Type", "text/plain");
|
|
174
|
-
res.
|
|
175
|
+
res.write(this.convertToString(controller_rc));
|
|
175
176
|
} else {
|
|
176
|
-
res.
|
|
177
|
+
res.write(this.convertToString(controller_rc));
|
|
177
178
|
}
|
|
178
179
|
return;
|
|
179
180
|
} else {
|
|
180
181
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
181
|
-
res.end();
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
async writeAsync(res, chunk) {
|
|
@@ -721,8 +721,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
721
721
|
queue_config.provider,
|
|
722
722
|
queue_config.config
|
|
723
723
|
);
|
|
724
|
-
|
|
725
|
-
return rc;
|
|
724
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
726
725
|
});
|
|
727
726
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
728
727
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -112,7 +112,9 @@ var CompiledRoute = class {
|
|
|
112
112
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
113
113
|
}
|
|
114
114
|
async run() {
|
|
115
|
-
|
|
115
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
116
|
+
this.response.end();
|
|
117
|
+
return rc;
|
|
116
118
|
}
|
|
117
119
|
prepareOutputJsonFormat(obj) {
|
|
118
120
|
function traverse(value) {
|
|
@@ -163,20 +165,18 @@ var CompiledRoute = class {
|
|
|
163
165
|
const header_content_type = res.getHeader("Content-Type");
|
|
164
166
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
165
167
|
await this.writeAsync(res, controller_rc);
|
|
166
|
-
res.end();
|
|
167
168
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
168
169
|
res.setHeader("Content-Type", "application/json");
|
|
169
|
-
res.
|
|
170
|
+
res.write(this.convertToString(controller_rc));
|
|
170
171
|
} else if (!header_content_type) {
|
|
171
172
|
res.setHeader("Content-Type", "text/plain");
|
|
172
|
-
res.
|
|
173
|
+
res.write(this.convertToString(controller_rc));
|
|
173
174
|
} else {
|
|
174
|
-
res.
|
|
175
|
+
res.write(this.convertToString(controller_rc));
|
|
175
176
|
}
|
|
176
177
|
return;
|
|
177
178
|
} else {
|
|
178
179
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
179
|
-
res.end();
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
async writeAsync(res, chunk) {
|
|
@@ -719,8 +719,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
719
719
|
queue_config.provider,
|
|
720
720
|
queue_config.config
|
|
721
721
|
);
|
|
722
|
-
|
|
723
|
-
return rc;
|
|
722
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
724
723
|
});
|
|
725
724
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
726
725
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -110,7 +110,9 @@ var CompiledRoute = class {
|
|
|
110
110
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
111
111
|
}
|
|
112
112
|
async run() {
|
|
113
|
-
|
|
113
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
114
|
+
this.response.end();
|
|
115
|
+
return rc;
|
|
114
116
|
}
|
|
115
117
|
prepareOutputJsonFormat(obj) {
|
|
116
118
|
function traverse(value) {
|
|
@@ -161,20 +163,18 @@ var CompiledRoute = class {
|
|
|
161
163
|
const header_content_type = res.getHeader("Content-Type");
|
|
162
164
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
163
165
|
await this.writeAsync(res, controller_rc);
|
|
164
|
-
res.end();
|
|
165
166
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
166
167
|
res.setHeader("Content-Type", "application/json");
|
|
167
|
-
res.
|
|
168
|
+
res.write(this.convertToString(controller_rc));
|
|
168
169
|
} else if (!header_content_type) {
|
|
169
170
|
res.setHeader("Content-Type", "text/plain");
|
|
170
|
-
res.
|
|
171
|
+
res.write(this.convertToString(controller_rc));
|
|
171
172
|
} else {
|
|
172
|
-
res.
|
|
173
|
+
res.write(this.convertToString(controller_rc));
|
|
173
174
|
}
|
|
174
175
|
return;
|
|
175
176
|
} else {
|
|
176
177
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
177
|
-
res.end();
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
async writeAsync(res, chunk) {
|
|
@@ -717,8 +717,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
717
717
|
queue_config.provider,
|
|
718
718
|
queue_config.config
|
|
719
719
|
);
|
|
720
|
-
|
|
721
|
-
return rc;
|
|
720
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
722
721
|
});
|
|
723
722
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
724
723
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -110,7 +110,9 @@ var CompiledRoute = class {
|
|
|
110
110
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
111
111
|
}
|
|
112
112
|
async run() {
|
|
113
|
-
|
|
113
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
114
|
+
this.response.end();
|
|
115
|
+
return rc;
|
|
114
116
|
}
|
|
115
117
|
prepareOutputJsonFormat(obj) {
|
|
116
118
|
function traverse(value) {
|
|
@@ -161,20 +163,18 @@ var CompiledRoute = class {
|
|
|
161
163
|
const header_content_type = res.getHeader("Content-Type");
|
|
162
164
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
163
165
|
await this.writeAsync(res, controller_rc);
|
|
164
|
-
res.end();
|
|
165
166
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
166
167
|
res.setHeader("Content-Type", "application/json");
|
|
167
|
-
res.
|
|
168
|
+
res.write(this.convertToString(controller_rc));
|
|
168
169
|
} else if (!header_content_type) {
|
|
169
170
|
res.setHeader("Content-Type", "text/plain");
|
|
170
|
-
res.
|
|
171
|
+
res.write(this.convertToString(controller_rc));
|
|
171
172
|
} else {
|
|
172
|
-
res.
|
|
173
|
+
res.write(this.convertToString(controller_rc));
|
|
173
174
|
}
|
|
174
175
|
return;
|
|
175
176
|
} else {
|
|
176
177
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
177
|
-
res.end();
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
async writeAsync(res, chunk) {
|
|
@@ -717,8 +717,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
717
717
|
queue_config.provider,
|
|
718
718
|
queue_config.config
|
|
719
719
|
);
|
|
720
|
-
|
|
721
|
-
return rc;
|
|
720
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
722
721
|
});
|
|
723
722
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
724
723
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -111,7 +111,9 @@ var CompiledRoute = class {
|
|
|
111
111
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
112
112
|
}
|
|
113
113
|
async run() {
|
|
114
|
-
|
|
114
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
115
|
+
this.response.end();
|
|
116
|
+
return rc;
|
|
115
117
|
}
|
|
116
118
|
prepareOutputJsonFormat(obj) {
|
|
117
119
|
function traverse(value) {
|
|
@@ -162,20 +164,18 @@ var CompiledRoute = class {
|
|
|
162
164
|
const header_content_type = res.getHeader("Content-Type");
|
|
163
165
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
164
166
|
await this.writeAsync(res, controller_rc);
|
|
165
|
-
res.end();
|
|
166
167
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
167
168
|
res.setHeader("Content-Type", "application/json");
|
|
168
|
-
res.
|
|
169
|
+
res.write(this.convertToString(controller_rc));
|
|
169
170
|
} else if (!header_content_type) {
|
|
170
171
|
res.setHeader("Content-Type", "text/plain");
|
|
171
|
-
res.
|
|
172
|
+
res.write(this.convertToString(controller_rc));
|
|
172
173
|
} else {
|
|
173
|
-
res.
|
|
174
|
+
res.write(this.convertToString(controller_rc));
|
|
174
175
|
}
|
|
175
176
|
return;
|
|
176
177
|
} else {
|
|
177
178
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
178
|
-
res.end();
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
async writeAsync(res, chunk) {
|
|
@@ -718,8 +718,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
718
718
|
queue_config.provider,
|
|
719
719
|
queue_config.config
|
|
720
720
|
);
|
|
721
|
-
|
|
722
|
-
return rc;
|
|
721
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
723
722
|
});
|
|
724
723
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
725
724
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -1274,7 +1274,9 @@ var CompiledRoute = class {
|
|
|
1274
1274
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
1275
1275
|
}
|
|
1276
1276
|
async run() {
|
|
1277
|
-
|
|
1277
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
1278
|
+
this.response.end();
|
|
1279
|
+
return rc;
|
|
1278
1280
|
}
|
|
1279
1281
|
prepareOutputJsonFormat(obj) {
|
|
1280
1282
|
function traverse(value) {
|
|
@@ -1325,20 +1327,18 @@ var CompiledRoute = class {
|
|
|
1325
1327
|
const header_content_type = res.getHeader("Content-Type");
|
|
1326
1328
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
1327
1329
|
await this.writeAsync(res, controller_rc);
|
|
1328
|
-
res.end();
|
|
1329
1330
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
1330
1331
|
res.setHeader("Content-Type", "application/json");
|
|
1331
|
-
res.
|
|
1332
|
+
res.write(this.convertToString(controller_rc));
|
|
1332
1333
|
} else if (!header_content_type) {
|
|
1333
1334
|
res.setHeader("Content-Type", "text/plain");
|
|
1334
|
-
res.
|
|
1335
|
+
res.write(this.convertToString(controller_rc));
|
|
1335
1336
|
} else {
|
|
1336
|
-
res.
|
|
1337
|
+
res.write(this.convertToString(controller_rc));
|
|
1337
1338
|
}
|
|
1338
1339
|
return;
|
|
1339
1340
|
} else {
|
|
1340
1341
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
1341
|
-
res.end();
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
1344
|
async writeAsync(res, chunk) {
|
|
@@ -1881,8 +1881,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
1881
1881
|
queue_config.provider,
|
|
1882
1882
|
queue_config.config
|
|
1883
1883
|
);
|
|
1884
|
-
|
|
1885
|
-
return rc;
|
|
1884
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
1886
1885
|
});
|
|
1887
1886
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
1888
1887
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -110,7 +110,9 @@ var CompiledRoute = class {
|
|
|
110
110
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
111
111
|
}
|
|
112
112
|
async run() {
|
|
113
|
-
|
|
113
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
114
|
+
this.response.end();
|
|
115
|
+
return rc;
|
|
114
116
|
}
|
|
115
117
|
prepareOutputJsonFormat(obj) {
|
|
116
118
|
function traverse(value) {
|
|
@@ -161,20 +163,18 @@ var CompiledRoute = class {
|
|
|
161
163
|
const header_content_type = res.getHeader("Content-Type");
|
|
162
164
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
163
165
|
await this.writeAsync(res, controller_rc);
|
|
164
|
-
res.end();
|
|
165
166
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
166
167
|
res.setHeader("Content-Type", "application/json");
|
|
167
|
-
res.
|
|
168
|
+
res.write(this.convertToString(controller_rc));
|
|
168
169
|
} else if (!header_content_type) {
|
|
169
170
|
res.setHeader("Content-Type", "text/plain");
|
|
170
|
-
res.
|
|
171
|
+
res.write(this.convertToString(controller_rc));
|
|
171
172
|
} else {
|
|
172
|
-
res.
|
|
173
|
+
res.write(this.convertToString(controller_rc));
|
|
173
174
|
}
|
|
174
175
|
return;
|
|
175
176
|
} else {
|
|
176
177
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
177
|
-
res.end();
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
async writeAsync(res, chunk) {
|
|
@@ -717,8 +717,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
717
717
|
queue_config.provider,
|
|
718
718
|
queue_config.config
|
|
719
719
|
);
|
|
720
|
-
|
|
721
|
-
return rc;
|
|
720
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
722
721
|
});
|
|
723
722
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
724
723
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -110,7 +110,9 @@ var CompiledRoute = class {
|
|
|
110
110
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
111
111
|
}
|
|
112
112
|
async run() {
|
|
113
|
-
|
|
113
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
114
|
+
this.response.end();
|
|
115
|
+
return rc;
|
|
114
116
|
}
|
|
115
117
|
prepareOutputJsonFormat(obj) {
|
|
116
118
|
function traverse(value) {
|
|
@@ -161,20 +163,18 @@ var CompiledRoute = class {
|
|
|
161
163
|
const header_content_type = res.getHeader("Content-Type");
|
|
162
164
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
163
165
|
await this.writeAsync(res, controller_rc);
|
|
164
|
-
res.end();
|
|
165
166
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
166
167
|
res.setHeader("Content-Type", "application/json");
|
|
167
|
-
res.
|
|
168
|
+
res.write(this.convertToString(controller_rc));
|
|
168
169
|
} else if (!header_content_type) {
|
|
169
170
|
res.setHeader("Content-Type", "text/plain");
|
|
170
|
-
res.
|
|
171
|
+
res.write(this.convertToString(controller_rc));
|
|
171
172
|
} else {
|
|
172
|
-
res.
|
|
173
|
+
res.write(this.convertToString(controller_rc));
|
|
173
174
|
}
|
|
174
175
|
return;
|
|
175
176
|
} else {
|
|
176
177
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
177
|
-
res.end();
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
async writeAsync(res, chunk) {
|
|
@@ -717,8 +717,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
717
717
|
queue_config.provider,
|
|
718
718
|
queue_config.config
|
|
719
719
|
);
|
|
720
|
-
|
|
721
|
-
return rc;
|
|
720
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
722
721
|
});
|
|
723
722
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
724
723
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -1265,7 +1265,9 @@ var CompiledRoute = class {
|
|
|
1265
1265
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
1266
1266
|
}
|
|
1267
1267
|
async run() {
|
|
1268
|
-
|
|
1268
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
1269
|
+
this.response.end();
|
|
1270
|
+
return rc;
|
|
1269
1271
|
}
|
|
1270
1272
|
prepareOutputJsonFormat(obj) {
|
|
1271
1273
|
function traverse(value) {
|
|
@@ -1316,20 +1318,18 @@ var CompiledRoute = class {
|
|
|
1316
1318
|
const header_content_type = res.getHeader("Content-Type");
|
|
1317
1319
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
1318
1320
|
await this.writeAsync(res, controller_rc);
|
|
1319
|
-
res.end();
|
|
1320
1321
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
1321
1322
|
res.setHeader("Content-Type", "application/json");
|
|
1322
|
-
res.
|
|
1323
|
+
res.write(this.convertToString(controller_rc));
|
|
1323
1324
|
} else if (!header_content_type) {
|
|
1324
1325
|
res.setHeader("Content-Type", "text/plain");
|
|
1325
|
-
res.
|
|
1326
|
+
res.write(this.convertToString(controller_rc));
|
|
1326
1327
|
} else {
|
|
1327
|
-
res.
|
|
1328
|
+
res.write(this.convertToString(controller_rc));
|
|
1328
1329
|
}
|
|
1329
1330
|
return;
|
|
1330
1331
|
} else {
|
|
1331
1332
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
1332
|
-
res.end();
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
1335
|
async writeAsync(res, chunk) {
|
|
@@ -1872,8 +1872,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
1872
1872
|
queue_config.provider,
|
|
1873
1873
|
queue_config.config
|
|
1874
1874
|
);
|
|
1875
|
-
|
|
1876
|
-
return rc;
|
|
1875
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
1877
1876
|
});
|
|
1878
1877
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
1879
1878
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -1267,7 +1267,9 @@ var CompiledRoute = class {
|
|
|
1267
1267
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
1268
1268
|
}
|
|
1269
1269
|
async run() {
|
|
1270
|
-
|
|
1270
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
1271
|
+
this.response.end();
|
|
1272
|
+
return rc;
|
|
1271
1273
|
}
|
|
1272
1274
|
prepareOutputJsonFormat(obj) {
|
|
1273
1275
|
function traverse(value) {
|
|
@@ -1318,20 +1320,18 @@ var CompiledRoute = class {
|
|
|
1318
1320
|
const header_content_type = res.getHeader("Content-Type");
|
|
1319
1321
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
1320
1322
|
await this.writeAsync(res, controller_rc);
|
|
1321
|
-
res.end();
|
|
1322
1323
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
1323
1324
|
res.setHeader("Content-Type", "application/json");
|
|
1324
|
-
res.
|
|
1325
|
+
res.write(this.convertToString(controller_rc));
|
|
1325
1326
|
} else if (!header_content_type) {
|
|
1326
1327
|
res.setHeader("Content-Type", "text/plain");
|
|
1327
|
-
res.
|
|
1328
|
+
res.write(this.convertToString(controller_rc));
|
|
1328
1329
|
} else {
|
|
1329
|
-
res.
|
|
1330
|
+
res.write(this.convertToString(controller_rc));
|
|
1330
1331
|
}
|
|
1331
1332
|
return;
|
|
1332
1333
|
} else {
|
|
1333
1334
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
1334
|
-
res.end();
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
1337
|
async writeAsync(res, chunk) {
|
|
@@ -1874,8 +1874,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
1874
1874
|
queue_config.provider,
|
|
1875
1875
|
queue_config.config
|
|
1876
1876
|
);
|
|
1877
|
-
|
|
1878
|
-
return rc;
|
|
1877
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
1879
1878
|
});
|
|
1880
1879
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
1881
1880
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
@@ -110,7 +110,9 @@ var CompiledRoute = class {
|
|
|
110
110
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
111
111
|
}
|
|
112
112
|
async run() {
|
|
113
|
-
|
|
113
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
114
|
+
this.response.end();
|
|
115
|
+
return rc;
|
|
114
116
|
}
|
|
115
117
|
prepareOutputJsonFormat(obj) {
|
|
116
118
|
function traverse(value) {
|
|
@@ -161,20 +163,18 @@ var CompiledRoute = class {
|
|
|
161
163
|
const header_content_type = res.getHeader("Content-Type");
|
|
162
164
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
163
165
|
await this.writeAsync(res, controller_rc);
|
|
164
|
-
res.end();
|
|
165
166
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
166
167
|
res.setHeader("Content-Type", "application/json");
|
|
167
|
-
res.
|
|
168
|
+
res.write(this.convertToString(controller_rc));
|
|
168
169
|
} else if (!header_content_type) {
|
|
169
170
|
res.setHeader("Content-Type", "text/plain");
|
|
170
|
-
res.
|
|
171
|
+
res.write(this.convertToString(controller_rc));
|
|
171
172
|
} else {
|
|
172
|
-
res.
|
|
173
|
+
res.write(this.convertToString(controller_rc));
|
|
173
174
|
}
|
|
174
175
|
return;
|
|
175
176
|
} else {
|
|
176
177
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
177
|
-
res.end();
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
async writeAsync(res, chunk) {
|
|
@@ -717,8 +717,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
717
717
|
queue_config.provider,
|
|
718
718
|
queue_config.config
|
|
719
719
|
);
|
|
720
|
-
|
|
721
|
-
return rc;
|
|
720
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
722
721
|
});
|
|
723
722
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
724
723
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/cache.cjs
CHANGED
|
@@ -111,7 +111,9 @@ var CompiledRoute = class {
|
|
|
111
111
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
112
112
|
}
|
|
113
113
|
async run() {
|
|
114
|
-
|
|
114
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
115
|
+
this.response.end();
|
|
116
|
+
return rc;
|
|
115
117
|
}
|
|
116
118
|
prepareOutputJsonFormat(obj) {
|
|
117
119
|
function traverse(value) {
|
|
@@ -162,20 +164,18 @@ var CompiledRoute = class {
|
|
|
162
164
|
const header_content_type = res.getHeader("Content-Type");
|
|
163
165
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
164
166
|
await this.writeAsync(res, controller_rc);
|
|
165
|
-
res.end();
|
|
166
167
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
167
168
|
res.setHeader("Content-Type", "application/json");
|
|
168
|
-
res.
|
|
169
|
+
res.write(this.convertToString(controller_rc));
|
|
169
170
|
} else if (!header_content_type) {
|
|
170
171
|
res.setHeader("Content-Type", "text/plain");
|
|
171
|
-
res.
|
|
172
|
+
res.write(this.convertToString(controller_rc));
|
|
172
173
|
} else {
|
|
173
|
-
res.
|
|
174
|
+
res.write(this.convertToString(controller_rc));
|
|
174
175
|
}
|
|
175
176
|
return;
|
|
176
177
|
} else {
|
|
177
178
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
178
|
-
res.end();
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
async writeAsync(res, chunk) {
|
|
@@ -718,8 +718,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
718
718
|
queue_config.provider,
|
|
719
719
|
queue_config.config
|
|
720
720
|
);
|
|
721
|
-
|
|
722
|
-
return rc;
|
|
721
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
723
722
|
});
|
|
724
723
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
725
724
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/facades.cjs
CHANGED
|
@@ -119,7 +119,9 @@ var CompiledRoute = class {
|
|
|
119
119
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
120
120
|
}
|
|
121
121
|
async run() {
|
|
122
|
-
|
|
122
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
123
|
+
this.response.end();
|
|
124
|
+
return rc;
|
|
123
125
|
}
|
|
124
126
|
prepareOutputJsonFormat(obj) {
|
|
125
127
|
function traverse(value) {
|
|
@@ -170,20 +172,18 @@ var CompiledRoute = class {
|
|
|
170
172
|
const header_content_type = res.getHeader("Content-Type");
|
|
171
173
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
172
174
|
await this.writeAsync(res, controller_rc);
|
|
173
|
-
res.end();
|
|
174
175
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
175
176
|
res.setHeader("Content-Type", "application/json");
|
|
176
|
-
res.
|
|
177
|
+
res.write(this.convertToString(controller_rc));
|
|
177
178
|
} else if (!header_content_type) {
|
|
178
179
|
res.setHeader("Content-Type", "text/plain");
|
|
179
|
-
res.
|
|
180
|
+
res.write(this.convertToString(controller_rc));
|
|
180
181
|
} else {
|
|
181
|
-
res.
|
|
182
|
+
res.write(this.convertToString(controller_rc));
|
|
182
183
|
}
|
|
183
184
|
return;
|
|
184
185
|
} else {
|
|
185
186
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
186
|
-
res.end();
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
async writeAsync(res, chunk) {
|
|
@@ -726,8 +726,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
726
726
|
queue_config.provider,
|
|
727
727
|
queue_config.config
|
|
728
728
|
);
|
|
729
|
-
|
|
730
|
-
return rc;
|
|
729
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
731
730
|
});
|
|
732
731
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
733
732
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/factories.cjs
CHANGED
|
@@ -120,7 +120,9 @@ var CompiledRoute = class {
|
|
|
120
120
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
121
121
|
}
|
|
122
122
|
async run() {
|
|
123
|
-
|
|
123
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
124
|
+
this.response.end();
|
|
125
|
+
return rc;
|
|
124
126
|
}
|
|
125
127
|
prepareOutputJsonFormat(obj) {
|
|
126
128
|
function traverse(value) {
|
|
@@ -171,20 +173,18 @@ var CompiledRoute = class {
|
|
|
171
173
|
const header_content_type = res.getHeader("Content-Type");
|
|
172
174
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
173
175
|
await this.writeAsync(res, controller_rc);
|
|
174
|
-
res.end();
|
|
175
176
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
176
177
|
res.setHeader("Content-Type", "application/json");
|
|
177
|
-
res.
|
|
178
|
+
res.write(this.convertToString(controller_rc));
|
|
178
179
|
} else if (!header_content_type) {
|
|
179
180
|
res.setHeader("Content-Type", "text/plain");
|
|
180
|
-
res.
|
|
181
|
+
res.write(this.convertToString(controller_rc));
|
|
181
182
|
} else {
|
|
182
|
-
res.
|
|
183
|
+
res.write(this.convertToString(controller_rc));
|
|
183
184
|
}
|
|
184
185
|
return;
|
|
185
186
|
} else {
|
|
186
187
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
187
|
-
res.end();
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
async writeAsync(res, chunk) {
|
|
@@ -555,8 +555,7 @@ var queue = (0, import_neko_helper.createSingleton)((label) => {
|
|
|
555
555
|
queue_config.provider,
|
|
556
556
|
queue_config.config
|
|
557
557
|
);
|
|
558
|
-
|
|
559
|
-
return rc;
|
|
558
|
+
return new import_neko_queue.QueueConnection(provider);
|
|
560
559
|
});
|
|
561
560
|
var cache = (0, import_neko_helper.createSingleton)((label) => {
|
|
562
561
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/index.cjs
CHANGED
|
@@ -129,7 +129,9 @@ var init_CompiledRoute = __esm({
|
|
|
129
129
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
130
130
|
}
|
|
131
131
|
async run() {
|
|
132
|
-
|
|
132
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
133
|
+
this.response.end();
|
|
134
|
+
return rc;
|
|
133
135
|
}
|
|
134
136
|
prepareOutputJsonFormat(obj) {
|
|
135
137
|
function traverse(value) {
|
|
@@ -180,20 +182,18 @@ var init_CompiledRoute = __esm({
|
|
|
180
182
|
const header_content_type = res.getHeader("Content-Type");
|
|
181
183
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
182
184
|
await this.writeAsync(res, controller_rc);
|
|
183
|
-
res.end();
|
|
184
185
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
185
186
|
res.setHeader("Content-Type", "application/json");
|
|
186
|
-
res.
|
|
187
|
+
res.write(this.convertToString(controller_rc));
|
|
187
188
|
} else if (!header_content_type) {
|
|
188
189
|
res.setHeader("Content-Type", "text/plain");
|
|
189
|
-
res.
|
|
190
|
+
res.write(this.convertToString(controller_rc));
|
|
190
191
|
} else {
|
|
191
|
-
res.
|
|
192
|
+
res.write(this.convertToString(controller_rc));
|
|
192
193
|
}
|
|
193
194
|
return;
|
|
194
195
|
} else {
|
|
195
196
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
196
|
-
res.end();
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
async writeAsync(res, chunk) {
|
|
@@ -837,8 +837,7 @@ var init_facades = __esm({
|
|
|
837
837
|
queue_config.provider,
|
|
838
838
|
queue_config.config
|
|
839
839
|
);
|
|
840
|
-
|
|
841
|
-
return rc;
|
|
840
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
842
841
|
});
|
|
843
842
|
cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
844
843
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/middlewares.cjs
CHANGED
|
@@ -108,7 +108,9 @@ var CompiledRoute = class {
|
|
|
108
108
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
109
109
|
}
|
|
110
110
|
async run() {
|
|
111
|
-
|
|
111
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
112
|
+
this.response.end();
|
|
113
|
+
return rc;
|
|
112
114
|
}
|
|
113
115
|
prepareOutputJsonFormat(obj) {
|
|
114
116
|
function traverse(value) {
|
|
@@ -159,20 +161,18 @@ var CompiledRoute = class {
|
|
|
159
161
|
const header_content_type = res.getHeader("Content-Type");
|
|
160
162
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
161
163
|
await this.writeAsync(res, controller_rc);
|
|
162
|
-
res.end();
|
|
163
164
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
164
165
|
res.setHeader("Content-Type", "application/json");
|
|
165
|
-
res.
|
|
166
|
+
res.write(this.convertToString(controller_rc));
|
|
166
167
|
} else if (!header_content_type) {
|
|
167
168
|
res.setHeader("Content-Type", "text/plain");
|
|
168
|
-
res.
|
|
169
|
+
res.write(this.convertToString(controller_rc));
|
|
169
170
|
} else {
|
|
170
|
-
res.
|
|
171
|
+
res.write(this.convertToString(controller_rc));
|
|
171
172
|
}
|
|
172
173
|
return;
|
|
173
174
|
} else {
|
|
174
175
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
175
|
-
res.end();
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
async writeAsync(res, chunk) {
|
|
@@ -719,8 +719,7 @@ var queue = (0, import_neko_helper2.createSingleton)((label) => {
|
|
|
719
719
|
queue_config.provider,
|
|
720
720
|
queue_config.config
|
|
721
721
|
);
|
|
722
|
-
|
|
723
|
-
return rc;
|
|
722
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
724
723
|
});
|
|
725
724
|
var cache = (0, import_neko_helper2.createSingleton)((label) => {
|
|
726
725
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/queue.cjs
CHANGED
|
@@ -111,7 +111,9 @@ var CompiledRoute = class {
|
|
|
111
111
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
112
112
|
}
|
|
113
113
|
async run() {
|
|
114
|
-
|
|
114
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
115
|
+
this.response.end();
|
|
116
|
+
return rc;
|
|
115
117
|
}
|
|
116
118
|
prepareOutputJsonFormat(obj) {
|
|
117
119
|
function traverse(value) {
|
|
@@ -162,20 +164,18 @@ var CompiledRoute = class {
|
|
|
162
164
|
const header_content_type = res.getHeader("Content-Type");
|
|
163
165
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
164
166
|
await this.writeAsync(res, controller_rc);
|
|
165
|
-
res.end();
|
|
166
167
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
167
168
|
res.setHeader("Content-Type", "application/json");
|
|
168
|
-
res.
|
|
169
|
+
res.write(this.convertToString(controller_rc));
|
|
169
170
|
} else if (!header_content_type) {
|
|
170
171
|
res.setHeader("Content-Type", "text/plain");
|
|
171
|
-
res.
|
|
172
|
+
res.write(this.convertToString(controller_rc));
|
|
172
173
|
} else {
|
|
173
|
-
res.
|
|
174
|
+
res.write(this.convertToString(controller_rc));
|
|
174
175
|
}
|
|
175
176
|
return;
|
|
176
177
|
} else {
|
|
177
178
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
178
|
-
res.end();
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
async writeAsync(res, chunk) {
|
|
@@ -615,8 +615,7 @@ var queue = (0, import_neko_helper.createSingleton)((label) => {
|
|
|
615
615
|
queue_config.provider,
|
|
616
616
|
queue_config.config
|
|
617
617
|
);
|
|
618
|
-
|
|
619
|
-
return rc;
|
|
618
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
620
619
|
});
|
|
621
620
|
var cache = (0, import_neko_helper.createSingleton)((label) => {
|
|
622
621
|
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
package/dist/bin/router.cjs
CHANGED
|
@@ -124,7 +124,9 @@ var CompiledRoute = class {
|
|
|
124
124
|
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
125
125
|
}
|
|
126
126
|
async run() {
|
|
127
|
-
|
|
127
|
+
let rc = await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
128
|
+
this.response.end();
|
|
129
|
+
return rc;
|
|
128
130
|
}
|
|
129
131
|
prepareOutputJsonFormat(obj) {
|
|
130
132
|
function traverse(value) {
|
|
@@ -175,20 +177,18 @@ var CompiledRoute = class {
|
|
|
175
177
|
const header_content_type = res.getHeader("Content-Type");
|
|
176
178
|
if (controller_rc instanceof import_stream.Stream || Buffer.isBuffer(controller_rc)) {
|
|
177
179
|
await this.writeAsync(res, controller_rc);
|
|
178
|
-
res.end();
|
|
179
180
|
} else if (!header_content_type && typeof controller_rc === "object") {
|
|
180
181
|
res.setHeader("Content-Type", "application/json");
|
|
181
|
-
res.
|
|
182
|
+
res.write(this.convertToString(controller_rc));
|
|
182
183
|
} else if (!header_content_type) {
|
|
183
184
|
res.setHeader("Content-Type", "text/plain");
|
|
184
|
-
res.
|
|
185
|
+
res.write(this.convertToString(controller_rc));
|
|
185
186
|
} else {
|
|
186
|
-
res.
|
|
187
|
+
res.write(this.convertToString(controller_rc));
|
|
187
188
|
}
|
|
188
189
|
return;
|
|
189
190
|
} else {
|
|
190
191
|
res.statusCode = [200].includes(res.statusCode) ? 204 : res.statusCode;
|
|
191
|
-
res.end();
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
async writeAsync(res, chunk) {
|
|
@@ -612,9 +612,10 @@ function Param(param_name) {
|
|
|
612
612
|
});
|
|
613
613
|
}
|
|
614
614
|
__name(Param, "Param");
|
|
615
|
-
function ApiDocumentation(open_api_url) {
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
function ApiDocumentation(open_api_url, renderer = "redoc") {
|
|
616
|
+
if (renderer === "redoc") {
|
|
617
|
+
return (req, res) => {
|
|
618
|
+
let html = `<!DOCTYPE html>
|
|
618
619
|
<html>
|
|
619
620
|
<head>
|
|
620
621
|
<title>Redoc</title>
|
|
@@ -638,9 +639,42 @@ function ApiDocumentation(open_api_url) {
|
|
|
638
639
|
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
|
|
639
640
|
</body>
|
|
640
641
|
</html>`;
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
642
|
+
res.setHeader("Content-Type", "text/html");
|
|
643
|
+
return html;
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
if (renderer === "rapidoc") {
|
|
647
|
+
return (req, res) => {
|
|
648
|
+
let html = `<!DOCTYPE html>
|
|
649
|
+
<html>
|
|
650
|
+
<head>
|
|
651
|
+
<title>Redoc</title>
|
|
652
|
+
<!-- needed for adaptive design -->
|
|
653
|
+
<meta charset="utf-8"/>
|
|
654
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
655
|
+
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
|
|
656
|
+
|
|
657
|
+
<!--
|
|
658
|
+
Redoc doesn't change outer page styles
|
|
659
|
+
-->
|
|
660
|
+
<style>
|
|
661
|
+
body {
|
|
662
|
+
margin: 0;
|
|
663
|
+
padding: 0;
|
|
664
|
+
}
|
|
665
|
+
</style>
|
|
666
|
+
</head>
|
|
667
|
+
<body>
|
|
668
|
+
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
|
669
|
+
<rapi-doc spec-url="${open_api_url}" theme="dark" render-style="read" show-header="false"
|
|
670
|
+
show-method-in-nav-bar="as-colored-text" allow-server-selection="true"
|
|
671
|
+
></rapi-doc>
|
|
672
|
+
</body>
|
|
673
|
+
</html>`;
|
|
674
|
+
res.setHeader("Content-Type", "text/html");
|
|
675
|
+
return html;
|
|
676
|
+
};
|
|
677
|
+
}
|
|
644
678
|
}
|
|
645
679
|
__name(ApiDocumentation, "ApiDocumentation");
|
|
646
680
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/facades.mjs
CHANGED
|
@@ -89,8 +89,7 @@ const queue = createSingleton((label) => {
|
|
|
89
89
|
queue_config.provider,
|
|
90
90
|
queue_config.config
|
|
91
91
|
);
|
|
92
|
-
|
|
93
|
-
return rc;
|
|
92
|
+
return new QueueConnection(provider);
|
|
94
93
|
});
|
|
95
94
|
const cache = createSingleton((label) => {
|
|
96
95
|
const cache_config = config.get(["caches", label].join("."));
|
package/dist/facades.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/facades.mts"],"sourcesContent":["import { Router } from \"./router.mjs\";\nimport { Schedule, Scheduler } from \"@devbro/neko-scheduler\";\nimport { createSingleton } from \"@devbro/neko-helper\";\nimport { ctx, ctxSafe } from \"@devbro/neko-context\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { Storage, StorageProviderFactory } from \"@devbro/neko-storage\";\nimport {\n Mailer,\n MailerProvider,\n MailerProviderFactory,\n} from \"@devbro/neko-mailer\";\nimport { config } from \"@devbro/neko-config\";\nimport { Cli } from \"clipanion\";\nimport { HttpServer, HttpError } from \"./http.mjs\";\nimport * as yup from \"yup\";\nimport { Logger } from \"@devbro/neko-logger\";\nimport { CacheProviderFactory } from \"./factories.mjs\";\nimport { Cache } from \"@devbro/neko-cache\";\nimport { QueueConnection, QueueTransportFactory } from \"@devbro/neko-queue\";\n\nexport const router = createSingleton<Router>(() => new Router());\nexport const scheduler = createSingleton<Scheduler>(() => {\n const rc = new Scheduler();\n rc.setErrorHandler((err: any, job: Schedule) => {\n logger().error({\n msg: \"Scheduled job error\",\n err,\n job_name: job.getName(),\n });\n });\n return rc;\n});\nexport const db = (label = \"default\") =>\n ctx().getOrThrow<Connection>([\"database\", label]);\n\nexport const storage = createSingleton<Storage>((label: string = \"default\") => {\n let storage_config: any = config.get([\"storages\", label].join(\".\"));\n\n const provider = StorageProviderFactory.create(\n storage_config.provider,\n storage_config.config,\n );\n\n return new Storage(provider);\n});\n\nexport const cli = createSingleton<Cli>(() => {\n const [node, app, ...args] = process.argv;\n return new Cli({\n binaryLabel: `My Application`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n });\n});\n\nexport const httpServer = createSingleton<HttpServer>(() => {\n const server = new HttpServer();\n\n server.setErrorHandler(async (err: Error, req: any, res: any) => {\n if (err instanceof HttpError) {\n res.writeHead(err.statusCode, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ message: err.message, error: err.code }));\n logger().warn({ msg: \"HttpError: \" + err.message, err });\n return;\n } else {\n logger().error({ msg: \"Error: \" + err.message, err });\n }\n res.writeHead(500, { \"Content-Type\": \"\" });\n res.end(JSON.stringify({ error: \"Internal Server Error\" }));\n });\n server.setRouter(router());\n\n return server;\n});\n\nexport const logger = createSingleton<Logger>((label) => {\n const logger_config: any = config.get([\"loggers\", label].join(\".\"));\n const rc = new Logger(logger_config);\n rc.setExtrasFunction((message: any) => {\n message.requestId = ctxSafe()?.get(\"requestId\") || \"N/A\";\n return message;\n });\n\n return rc;\n});\n\nexport const mailer = createSingleton((label) => {\n const mailer_config: any = config.get([\"mailer\", label].join(\".\"));\n\n const provider: MailerProvider = MailerProviderFactory.create(\n mailer_config.provider,\n mailer_config.config,\n );\n\n const rc = new Mailer(provider);\n return rc;\n});\n\nexport const queue = createSingleton((label) => {\n const queue_config: any = config.get([\"queues\", label].join(\".\"));\n if (!queue_config) {\n throw new Error(`Queue configuration for '${label}' not found`);\n }\n const provider = QueueTransportFactory.create(\n queue_config.provider,\n queue_config.config,\n );\n
|
|
1
|
+
{"version":3,"sources":["../src/facades.mts"],"sourcesContent":["import { Router } from \"./router.mjs\";\nimport { Schedule, Scheduler } from \"@devbro/neko-scheduler\";\nimport { createSingleton } from \"@devbro/neko-helper\";\nimport { ctx, ctxSafe } from \"@devbro/neko-context\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { Storage, StorageProviderFactory } from \"@devbro/neko-storage\";\nimport {\n Mailer,\n MailerProvider,\n MailerProviderFactory,\n} from \"@devbro/neko-mailer\";\nimport { config } from \"@devbro/neko-config\";\nimport { Cli } from \"clipanion\";\nimport { HttpServer, HttpError } from \"./http.mjs\";\nimport * as yup from \"yup\";\nimport { Logger } from \"@devbro/neko-logger\";\nimport { CacheProviderFactory } from \"./factories.mjs\";\nimport { Cache } from \"@devbro/neko-cache\";\nimport { QueueConnection, QueueTransportFactory } from \"@devbro/neko-queue\";\n\nexport const router = createSingleton<Router>(() => new Router());\nexport const scheduler = createSingleton<Scheduler>(() => {\n const rc = new Scheduler();\n rc.setErrorHandler((err: any, job: Schedule) => {\n logger().error({\n msg: \"Scheduled job error\",\n err,\n job_name: job.getName(),\n });\n });\n return rc;\n});\nexport const db = (label = \"default\") =>\n ctx().getOrThrow<Connection>([\"database\", label]);\n\nexport const storage = createSingleton<Storage>((label: string = \"default\") => {\n let storage_config: any = config.get([\"storages\", label].join(\".\"));\n\n const provider = StorageProviderFactory.create(\n storage_config.provider,\n storage_config.config,\n );\n\n return new Storage(provider);\n});\n\nexport const cli = createSingleton<Cli>(() => {\n const [node, app, ...args] = process.argv;\n return new Cli({\n binaryLabel: `My Application`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n });\n});\n\nexport const httpServer = createSingleton<HttpServer>(() => {\n const server = new HttpServer();\n\n server.setErrorHandler(async (err: Error, req: any, res: any) => {\n if (err instanceof HttpError) {\n res.writeHead(err.statusCode, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ message: err.message, error: err.code }));\n logger().warn({ msg: \"HttpError: \" + err.message, err });\n return;\n } else {\n logger().error({ msg: \"Error: \" + err.message, err });\n }\n res.writeHead(500, { \"Content-Type\": \"\" });\n res.end(JSON.stringify({ error: \"Internal Server Error\" }));\n });\n server.setRouter(router());\n\n return server;\n});\n\nexport const logger = createSingleton<Logger>((label) => {\n const logger_config: any = config.get([\"loggers\", label].join(\".\"));\n const rc = new Logger(logger_config);\n rc.setExtrasFunction((message: any) => {\n message.requestId = ctxSafe()?.get(\"requestId\") || \"N/A\";\n return message;\n });\n\n return rc;\n});\n\nexport const mailer = createSingleton((label) => {\n const mailer_config: any = config.get([\"mailer\", label].join(\".\"));\n\n const provider: MailerProvider = MailerProviderFactory.create(\n mailer_config.provider,\n mailer_config.config,\n );\n\n const rc = new Mailer(provider);\n return rc;\n});\n\nexport const queue = createSingleton((label) => {\n const queue_config: any = config.get([\"queues\", label].join(\".\"));\n if (!queue_config) {\n throw new Error(`Queue configuration for '${label}' not found`);\n }\n const provider = QueueTransportFactory.create(\n queue_config.provider,\n queue_config.config,\n );\n return new QueueConnection(provider);\n});\n\nexport const cache = createSingleton((label) => {\n const cache_config: any = config.get([\"caches\", label].join(\".\"));\n if (!cache_config) {\n throw new Error(`Cache configuration for '${label}' not found`);\n }\n const provider = CacheProviderFactory.create(\n cache_config.provider,\n cache_config.config,\n );\n\n return new Cache(provider);\n});\n"],"mappings":";;AAAA,SAAS,cAAc;AACvB,SAAmB,iBAAiB;AACpC,SAAS,uBAAuB;AAChC,SAAS,KAAK,eAAe;AAE7B,SAAS,SAAS,8BAA8B;AAChD;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,WAAW;AACpB,SAAS,YAAY,iBAAiB;AAEtC,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC,SAAS,aAAa;AACtB,SAAS,iBAAiB,6BAA6B;AAEhD,MAAM,SAAS,gBAAwB,MAAM,IAAI,OAAO,CAAC;AACzD,MAAM,YAAY,gBAA2B,MAAM;AACxD,QAAM,KAAK,IAAI,UAAU;AACzB,KAAG,gBAAgB,CAAC,KAAU,QAAkB;AAC9C,WAAO,EAAE,MAAM;AAAA,MACb,KAAK;AAAA,MACL;AAAA,MACA,UAAU,IAAI,QAAQ;AAAA,IACxB,CAAC;AAAA,EACH,CAAC;AACD,SAAO;AACT,CAAC;AACM,MAAM,KAAK,wBAAC,QAAQ,cACzB,IAAI,EAAE,WAAuB,CAAC,YAAY,KAAK,CAAC,GADhC;AAGX,MAAM,UAAU,gBAAyB,CAAC,QAAgB,cAAc;AAC7E,MAAI,iBAAsB,OAAO,IAAI,CAAC,YAAY,KAAK,EAAE,KAAK,GAAG,CAAC;AAElE,QAAM,WAAW,uBAAuB;AAAA,IACtC,eAAe;AAAA,IACf,eAAe;AAAA,EACjB;AAEA,SAAO,IAAI,QAAQ,QAAQ;AAC7B,CAAC;AAEM,MAAM,MAAM,gBAAqB,MAAM;AAC5C,QAAM,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,QAAQ;AACrC,SAAO,IAAI,IAAI;AAAA,IACb,aAAa;AAAA,IACb,YAAY,GAAG,IAAI,IAAI,GAAG;AAAA,IAC1B,eAAe;AAAA,EACjB,CAAC;AACH,CAAC;AAEM,MAAM,aAAa,gBAA4B,MAAM;AAC1D,QAAM,SAAS,IAAI,WAAW;AAE9B,SAAO,gBAAgB,OAAO,KAAY,KAAU,QAAa;AAC/D,QAAI,eAAe,WAAW;AAC5B,UAAI,UAAU,IAAI,YAAY,EAAE,gBAAgB,mBAAmB,CAAC;AACpE,UAAI,IAAI,KAAK,UAAU,EAAE,SAAS,IAAI,SAAS,OAAO,IAAI,KAAK,CAAC,CAAC;AACjE,aAAO,EAAE,KAAK,EAAE,KAAK,gBAAgB,IAAI,SAAS,IAAI,CAAC;AACvD;AAAA,IACF,OAAO;AACL,aAAO,EAAE,MAAM,EAAE,KAAK,YAAY,IAAI,SAAS,IAAI,CAAC;AAAA,IACtD;AACA,QAAI,UAAU,KAAK,EAAE,gBAAgB,GAAG,CAAC;AACzC,QAAI,IAAI,KAAK,UAAU,EAAE,OAAO,wBAAwB,CAAC,CAAC;AAAA,EAC5D,CAAC;AACD,SAAO,UAAU,OAAO,CAAC;AAEzB,SAAO;AACT,CAAC;AAEM,MAAM,SAAS,gBAAwB,CAAC,UAAU;AACvD,QAAM,gBAAqB,OAAO,IAAI,CAAC,WAAW,KAAK,EAAE,KAAK,GAAG,CAAC;AAClE,QAAM,KAAK,IAAI,OAAO,aAAa;AACnC,KAAG,kBAAkB,CAAC,YAAiB;AACrC,YAAQ,YAAY,QAAQ,GAAG,IAAI,WAAW,KAAK;AACnD,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT,CAAC;AAEM,MAAM,SAAS,gBAAgB,CAAC,UAAU;AAC/C,QAAM,gBAAqB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,KAAK,GAAG,CAAC;AAEjE,QAAM,WAA2B,sBAAsB;AAAA,IACrD,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AAEA,QAAM,KAAK,IAAI,OAAO,QAAQ;AAC9B,SAAO;AACT,CAAC;AAEM,MAAM,QAAQ,gBAAgB,CAAC,UAAU;AAC9C,QAAM,eAAoB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,KAAK,GAAG,CAAC;AAChE,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,4BAA4B,KAAK,aAAa;AAAA,EAChE;AACA,QAAM,WAAW,sBAAsB;AAAA,IACrC,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AACA,SAAO,IAAI,gBAAgB,QAAQ;AACrC,CAAC;AAEM,MAAM,QAAQ,gBAAgB,CAAC,UAAU;AAC9C,QAAM,eAAoB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,KAAK,GAAG,CAAC;AAChE,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,4BAA4B,KAAK,aAAa;AAAA,EAChE;AACA,QAAM,WAAW,qBAAqB;AAAA,IACpC,aAAa;AAAA,IACb,aAAa;AAAA,EACf;AAEA,SAAO,IAAI,MAAM,QAAQ;AAC3B,CAAC;","names":[]}
|
package/dist/factories.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/factories.mts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"sources":["../src/factories.mts"],"sourcesContent":["import {\n SESProvider,\n SMTPProvider,\n MemoryProvider,\n MailerProviderFactory,\n} from \"@devbro/neko-mailer\";\nimport { MemoryTransport, QueueTransportFactory } from \"@devbro/neko-queue\";\nimport { DatabaseTransport } from \"./queue.mjs\";\nimport {\n CacheProviderInterface,\n MemoryCacheProvider,\n RedisCacheProvider,\n FileCacheProvider,\n DisabledCacheProvider,\n} from \"@devbro/neko-cache\";\nimport {\n AWSS3StorageProvider,\n LocalStorageProvider,\n StorageProviderFactory,\n} from \"@devbro/neko-storage\";\n\nexport class FlexibleFactory<T> {\n registry: Map<string, any> = new Map();\n\n register<T>(key: string, ctor: (...args: any[]) => T) {\n this.registry.set(key, ctor);\n }\n\n create<T>(key: string, ...args: any[]): T {\n const ctor = this.registry.get(key);\n if (!ctor) {\n throw new Error(`No factory registered for key: ${key}`);\n }\n return ctor(...args);\n }\n}\n\nMailerProviderFactory.register(\"ses\", (opt) => {\n return new SESProvider(opt);\n});\n\nMailerProviderFactory.register(\"smtp\", (opt) => {\n return new SMTPProvider(opt);\n});\n\nMailerProviderFactory.register(\"memory\", (opt) => {\n return new MemoryProvider();\n});\n\nQueueTransportFactory.register(\"database\", (opt) => {\n return new DatabaseTransport(opt);\n});\n\nQueueTransportFactory.register(\"memory\", (opt) => {\n return new MemoryTransport(opt);\n});\n\n// CACHE\nexport class CacheProviderFactory {\n static instance: FlexibleFactory<CacheProviderInterface> =\n new FlexibleFactory<CacheProviderInterface>();\n\n static register(\n key: string,\n factory: (...args: any[]) => CacheProviderInterface,\n ): void {\n CacheProviderFactory.instance.register(key, factory);\n }\n\n static create<T>(key: string, ...args: any[]): CacheProviderInterface {\n return CacheProviderFactory.instance.create(key, ...args);\n }\n}\n\nCacheProviderFactory.register(\"memory\", (opt) => {\n return new MemoryCacheProvider(opt);\n});\n\nCacheProviderFactory.register(\"redis\", (opt) => {\n return new RedisCacheProvider(opt);\n});\n\nCacheProviderFactory.register(\"file\", (opt) => {\n return new FileCacheProvider(opt);\n});\n\nCacheProviderFactory.register(\"disabled\", (opt) => {\n return new DisabledCacheProvider();\n});\n\nStorageProviderFactory.register(\"local\", (opt) => {\n return new LocalStorageProvider(opt);\n});\n\nStorageProviderFactory.register(\"s3\", (opt) => {\n return new AWSS3StorageProvider(opt);\n});\n"],"mappings":";;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,6BAA6B;AACvD,SAAS,yBAAyB;AAClC;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,gBAAmB;AAAA,EArBhC,OAqBgC;AAAA;AAAA;AAAA,EAC9B,WAA6B,oBAAI,IAAI;AAAA,EAErC,SAAY,KAAa,MAA6B;AACpD,SAAK,SAAS,IAAI,KAAK,IAAI;AAAA,EAC7B;AAAA,EAEA,OAAU,QAAgB,MAAgB;AACxC,UAAM,OAAO,KAAK,SAAS,IAAI,GAAG;AAClC,QAAI,CAAC,MAAM;AACT,YAAM,IAAI,MAAM,kCAAkC,GAAG,EAAE;AAAA,IACzD;AACA,WAAO,KAAK,GAAG,IAAI;AAAA,EACrB;AACF;AAEA,sBAAsB,SAAS,OAAO,CAAC,QAAQ;AAC7C,SAAO,IAAI,YAAY,GAAG;AAC5B,CAAC;AAED,sBAAsB,SAAS,QAAQ,CAAC,QAAQ;AAC9C,SAAO,IAAI,aAAa,GAAG;AAC7B,CAAC;AAED,sBAAsB,SAAS,UAAU,CAAC,QAAQ;AAChD,SAAO,IAAI,eAAe;AAC5B,CAAC;AAED,sBAAsB,SAAS,YAAY,CAAC,QAAQ;AAClD,SAAO,IAAI,kBAAkB,GAAG;AAClC,CAAC;AAED,sBAAsB,SAAS,UAAU,CAAC,QAAQ;AAChD,SAAO,IAAI,gBAAgB,GAAG;AAChC,CAAC;AAGM,MAAM,qBAAqB;AAAA,EA1DlC,OA0DkC;AAAA;AAAA;AAAA,EAChC,OAAO,WACL,IAAI,gBAAwC;AAAA,EAE9C,OAAO,SACL,KACA,SACM;AACN,yBAAqB,SAAS,SAAS,KAAK,OAAO;AAAA,EACrD;AAAA,EAEA,OAAO,OAAU,QAAgB,MAAqC;AACpE,WAAO,qBAAqB,SAAS,OAAO,KAAK,GAAG,IAAI;AAAA,EAC1D;AACF;AAEA,qBAAqB,SAAS,UAAU,CAAC,QAAQ;AAC/C,SAAO,IAAI,oBAAoB,GAAG;AACpC,CAAC;AAED,qBAAqB,SAAS,SAAS,CAAC,QAAQ;AAC9C,SAAO,IAAI,mBAAmB,GAAG;AACnC,CAAC;AAED,qBAAqB,SAAS,QAAQ,CAAC,QAAQ;AAC7C,SAAO,IAAI,kBAAkB,GAAG;AAClC,CAAC;AAED,qBAAqB,SAAS,YAAY,CAAC,QAAQ;AACjD,SAAO,IAAI,sBAAsB;AACnC,CAAC;AAED,uBAAuB,SAAS,SAAS,CAAC,QAAQ;AAChD,SAAO,IAAI,qBAAqB,GAAG;AACrC,CAAC;AAED,uBAAuB,SAAS,MAAM,CAAC,QAAQ;AAC7C,SAAO,IAAI,qBAAqB,GAAG;AACrC,CAAC;","names":[]}
|
package/dist/router.d.mts
CHANGED
|
@@ -4,6 +4,6 @@ export * from '@devbro/neko-router';
|
|
|
4
4
|
|
|
5
5
|
declare function Model(model: typeof BaseModel, param_name?: string, model_field?: string): ParameterDecorator;
|
|
6
6
|
declare function Param(param_name: string): ParameterDecorator;
|
|
7
|
-
declare function ApiDocumentation(open_api_url: string): (req: Request, res: Response) => string;
|
|
7
|
+
declare function ApiDocumentation(open_api_url: string, renderer?: "redoc" | "rapidoc"): ((req: Request, res: Response) => string) | undefined;
|
|
8
8
|
|
|
9
9
|
export { ApiDocumentation, Model, Param };
|
package/dist/router.mjs
CHANGED
|
@@ -22,9 +22,10 @@ function Param(param_name) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
__name(Param, "Param");
|
|
25
|
-
function ApiDocumentation(open_api_url) {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
function ApiDocumentation(open_api_url, renderer = "redoc") {
|
|
26
|
+
if (renderer === "redoc") {
|
|
27
|
+
return (req, res) => {
|
|
28
|
+
let html = `<!DOCTYPE html>
|
|
28
29
|
<html>
|
|
29
30
|
<head>
|
|
30
31
|
<title>Redoc</title>
|
|
@@ -48,9 +49,42 @@ function ApiDocumentation(open_api_url) {
|
|
|
48
49
|
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
|
|
49
50
|
</body>
|
|
50
51
|
</html>`;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
res.setHeader("Content-Type", "text/html");
|
|
53
|
+
return html;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (renderer === "rapidoc") {
|
|
57
|
+
return (req, res) => {
|
|
58
|
+
let html = `<!DOCTYPE html>
|
|
59
|
+
<html>
|
|
60
|
+
<head>
|
|
61
|
+
<title>Redoc</title>
|
|
62
|
+
<!-- needed for adaptive design -->
|
|
63
|
+
<meta charset="utf-8"/>
|
|
64
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
65
|
+
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
|
|
66
|
+
|
|
67
|
+
<!--
|
|
68
|
+
Redoc doesn't change outer page styles
|
|
69
|
+
-->
|
|
70
|
+
<style>
|
|
71
|
+
body {
|
|
72
|
+
margin: 0;
|
|
73
|
+
padding: 0;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
</head>
|
|
77
|
+
<body>
|
|
78
|
+
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
|
79
|
+
<rapi-doc spec-url="${open_api_url}" theme="dark" render-style="read" show-header="false"
|
|
80
|
+
show-method-in-nav-bar="as-colored-text" allow-server-selection="true"
|
|
81
|
+
></rapi-doc>
|
|
82
|
+
</body>
|
|
83
|
+
</html>`;
|
|
84
|
+
res.setHeader("Content-Type", "text/html");
|
|
85
|
+
return html;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
54
88
|
}
|
|
55
89
|
__name(ApiDocumentation, "ApiDocumentation");
|
|
56
90
|
export {
|
package/dist/router.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router.mts"],"sourcesContent":["import { ctx } from \"@devbro/neko-context\";\nimport { BaseModel } from \"@devbro/neko-orm\";\nimport { Request, Response } from \"@devbro/neko-router\";\nimport { HttpNotFoundError } from \"@devbro/neko-http/errors\";\nimport { createParamDecorator } from \"@devbro/neko-router\";\
|
|
1
|
+
{"version":3,"sources":["../src/router.mts"],"sourcesContent":["import { ctx } from \"@devbro/neko-context\";\nimport { BaseModel } from \"@devbro/neko-orm\";\nimport { Request, Response } from \"@devbro/neko-router\";\nimport { HttpNotFoundError } from \"@devbro/neko-http/errors\";\nimport { createParamDecorator } from \"@devbro/neko-router\";\nexport * from \"@devbro/neko-router\";\n\nexport function Model(\n model: typeof BaseModel,\n param_name: string = \"id\",\n model_field: string = \"id\",\n): ParameterDecorator {\n return createParamDecorator(async () => {\n let rc = await model.findOne({\n [model_field]: ctx().get<Request>(\"request\").params[param_name],\n });\n if (!rc) {\n throw new HttpNotFoundError(\"Object not found\", \"OBJECT_NOT_FOUND\");\n }\n\n return rc;\n });\n}\n\nexport function Param(param_name: string): ParameterDecorator {\n return createParamDecorator(() => {\n return ctx().get<Request>(\"request\").params[param_name] || undefined;\n });\n}\n\nexport function ApiDocumentation(\n open_api_url: string,\n renderer: \"redoc\" | \"rapidoc\" = \"redoc\",\n) {\n if (renderer === \"redoc\") {\n return (req: Request, res: Response) => {\n let html = `<!DOCTYPE html>\n<html>\n <head>\n <title>Redoc</title>\n <!-- needed for adaptive design -->\n <meta charset=\"utf-8\"/>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link href=\"https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700\" rel=\"stylesheet\">\n\n <!--\n Redoc doesn't change outer page styles\n -->\n <style>\n body {\n margin: 0;\n padding: 0;\n }\n </style>\n </head>\n <body>\n <redoc spec-url='${open_api_url}'></redoc>\n <script src=\"https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js\"> </script>\n </body>\n</html>`;\n\n res.setHeader(\"Content-Type\", \"text/html\");\n return html;\n };\n }\n\n if (renderer === \"rapidoc\") {\n return (req: Request, res: Response) => {\n let html = `<!DOCTYPE html>\n<html>\n <head>\n <title>Redoc</title>\n <!-- needed for adaptive design -->\n <meta charset=\"utf-8\"/>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link href=\"https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700\" rel=\"stylesheet\">\n\n <!--\n Redoc doesn't change outer page styles\n -->\n <style>\n body {\n margin: 0;\n padding: 0;\n }\n </style>\n </head>\n <body>\n <script type=\"module\" src=\"https://unpkg.com/rapidoc/dist/rapidoc-min.js\"></script>\n <rapi-doc spec-url=\"${open_api_url}\" theme=\"dark\" render-style=\"read\" show-header=\"false\"\n show-method-in-nav-bar=\"as-colored-text\" allow-server-selection=\"true\"\n ></rapi-doc>\n </body>\n</html>`;\n\n res.setHeader(\"Content-Type\", \"text/html\");\n return html;\n };\n }\n}\n"],"mappings":";;AAAA,SAAS,WAAW;AAGpB,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,cAAc;AAEP,SAAS,MACd,OACA,aAAqB,MACrB,cAAsB,MACF;AACpB,SAAO,qBAAqB,YAAY;AACtC,QAAI,KAAK,MAAM,MAAM,QAAQ;AAAA,MAC3B,CAAC,WAAW,GAAG,IAAI,EAAE,IAAa,SAAS,EAAE,OAAO,UAAU;AAAA,IAChE,CAAC;AACD,QAAI,CAAC,IAAI;AACP,YAAM,IAAI,kBAAkB,oBAAoB,kBAAkB;AAAA,IACpE;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAfgB;AAiBT,SAAS,MAAM,YAAwC;AAC5D,SAAO,qBAAqB,MAAM;AAChC,WAAO,IAAI,EAAE,IAAa,SAAS,EAAE,OAAO,UAAU,KAAK;AAAA,EAC7D,CAAC;AACH;AAJgB;AAMT,SAAS,iBACd,cACA,WAAgC,SAChC;AACA,MAAI,aAAa,SAAS;AACxB,WAAO,CAAC,KAAc,QAAkB;AACtC,UAAI,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAoBM,YAAY;AAAA;AAAA;AAAA;AAK7B,UAAI,UAAU,gBAAgB,WAAW;AACzC,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,aAAa,WAAW;AAC1B,WAAO,CAAC,KAAc,QAAkB;AACtC,UAAI,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAqBS,YAAY;AAAA;AAAA;AAAA;AAAA;AAMhC,UAAI,UAAU,gBAAgB,WAAW;AACzC,aAAO;AAAA,IACT;AAAA,EACF;AACF;AArEgB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devbro/pashmak",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
4
4
|
"description": "testing application for the entire repo",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -118,11 +118,8 @@
|
|
|
118
118
|
"license": "MIT",
|
|
119
119
|
"devDependencies": {
|
|
120
120
|
"@swc/core": "^1.12.9",
|
|
121
|
-
"@types/config": "^3.3.5",
|
|
122
|
-
"@types/jsonwebtoken": "^9.0.9",
|
|
123
121
|
"@types/yup": "^0.32.0",
|
|
124
122
|
"globby": "^14.1.0",
|
|
125
|
-
"pino-pretty": "^13.0.0",
|
|
126
123
|
"typescript": "^5.8.3"
|
|
127
124
|
},
|
|
128
125
|
"dependencies": {
|
|
@@ -140,16 +137,10 @@
|
|
|
140
137
|
"@devbro/neko-storage": "0.1.*",
|
|
141
138
|
"@inquirer/prompts": "^7.10.0",
|
|
142
139
|
"@types/pluralize": "^0.0.33",
|
|
143
|
-
"bcryptjs": "^3.0.2",
|
|
144
140
|
"change-case-all": "^2.1.0",
|
|
145
141
|
"clipanion": "^4.0.0-rc.4",
|
|
146
|
-
"dotenv": "^16.5.0",
|
|
147
142
|
"handlebars": "^4.7.8",
|
|
148
|
-
"jsonwebtoken": "^9.0.2",
|
|
149
|
-
"pg-pool": "3.10.0",
|
|
150
143
|
"pluralize": "^8.0.0",
|
|
151
|
-
"ts-jest": "^29.3.4",
|
|
152
|
-
"tsconfig-paths": "^4.2.0",
|
|
153
144
|
"yup": "^1.6.1"
|
|
154
145
|
},
|
|
155
146
|
"directories": {
|