@tramvai/module-server 1.85.0 → 1.89.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server.es.js +15 -2
- package/lib/server.js +15 -2
- package/package.json +11 -11
package/lib/server.es.js
CHANGED
|
@@ -369,10 +369,20 @@ try {
|
|
|
369
369
|
Api = require('@tramvai/cli/lib/external/api').default; // eslint-disable-line import/no-unresolved
|
|
370
370
|
}
|
|
371
371
|
catch (e) { }
|
|
372
|
-
const getFileApi = () => {
|
|
372
|
+
const getFileApi = ({ logger }) => {
|
|
373
|
+
const log = logger('papi:fileApi');
|
|
373
374
|
const result = [];
|
|
374
375
|
eachObj((v, k) => {
|
|
375
376
|
const handler = (v.handler || v.default);
|
|
377
|
+
if (!handler) {
|
|
378
|
+
log.error({
|
|
379
|
+
message: `Cannot resolve a papi handler.
|
|
380
|
+
Check that you are using file based papi right way by docs https://tramvai.dev/docs/how-to/how-create-papi#automatic-handler-creation
|
|
381
|
+
In case you have not added any file papi handler, consider renaming directory ./src/api (by default) to the other name to resolve conflicts with papi, or
|
|
382
|
+
change settings application.commands.build.options.serverApiDir in tramvai.json`,
|
|
383
|
+
});
|
|
384
|
+
throw new Error('Not a papi');
|
|
385
|
+
}
|
|
376
386
|
const papiParameters = getPapiParameters(handler);
|
|
377
387
|
result.push(createPapiMethod({
|
|
378
388
|
...v,
|
|
@@ -386,7 +396,10 @@ const getFileApi = () => {
|
|
|
386
396
|
const fileApiProvider = {
|
|
387
397
|
provide: SERVER_MODULE_PAPI_PUBLIC_ROUTE,
|
|
388
398
|
multi: true,
|
|
389
|
-
|
|
399
|
+
useFactory: getFileApi,
|
|
400
|
+
deps: {
|
|
401
|
+
logger: LOGGER_TOKEN,
|
|
402
|
+
},
|
|
390
403
|
};
|
|
391
404
|
|
|
392
405
|
const sharedProviders = [
|
package/lib/server.js
CHANGED
|
@@ -395,10 +395,20 @@ try {
|
|
|
395
395
|
Api = require('@tramvai/cli/lib/external/api').default; // eslint-disable-line import/no-unresolved
|
|
396
396
|
}
|
|
397
397
|
catch (e) { }
|
|
398
|
-
const getFileApi = () => {
|
|
398
|
+
const getFileApi = ({ logger }) => {
|
|
399
|
+
const log = logger('papi:fileApi');
|
|
399
400
|
const result = [];
|
|
400
401
|
eachObj__default["default"]((v, k) => {
|
|
401
402
|
const handler = (v.handler || v.default);
|
|
403
|
+
if (!handler) {
|
|
404
|
+
log.error({
|
|
405
|
+
message: `Cannot resolve a papi handler.
|
|
406
|
+
Check that you are using file based papi right way by docs https://tramvai.dev/docs/how-to/how-create-papi#automatic-handler-creation
|
|
407
|
+
In case you have not added any file papi handler, consider renaming directory ./src/api (by default) to the other name to resolve conflicts with papi, or
|
|
408
|
+
change settings application.commands.build.options.serverApiDir in tramvai.json`,
|
|
409
|
+
});
|
|
410
|
+
throw new Error('Not a papi');
|
|
411
|
+
}
|
|
402
412
|
const papiParameters = papi.getPapiParameters(handler);
|
|
403
413
|
result.push(papi.createPapiMethod({
|
|
404
414
|
...v,
|
|
@@ -412,7 +422,10 @@ const getFileApi = () => {
|
|
|
412
422
|
const fileApiProvider = {
|
|
413
423
|
provide: tokensServer.SERVER_MODULE_PAPI_PUBLIC_ROUTE,
|
|
414
424
|
multi: true,
|
|
415
|
-
|
|
425
|
+
useFactory: getFileApi,
|
|
426
|
+
deps: {
|
|
427
|
+
logger: tokensCommon.LOGGER_TOKEN,
|
|
428
|
+
},
|
|
416
429
|
};
|
|
417
430
|
|
|
418
431
|
const sharedProviders = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.89.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"@tinkoff/terminus": "0.0.1",
|
|
24
24
|
"@tinkoff/monkeypatch": "1.3.3",
|
|
25
25
|
"@tinkoff/url": "0.7.37",
|
|
26
|
-
"@tramvai/module-cache-warmup": "1.
|
|
27
|
-
"@tramvai/module-metrics": "1.
|
|
28
|
-
"@tramvai/papi": "1.
|
|
29
|
-
"@tramvai/tokens-server": "1.
|
|
30
|
-
"@tramvai/tokens-server-private": "1.
|
|
26
|
+
"@tramvai/module-cache-warmup": "1.89.1",
|
|
27
|
+
"@tramvai/module-metrics": "1.89.1",
|
|
28
|
+
"@tramvai/papi": "1.89.1",
|
|
29
|
+
"@tramvai/tokens-server": "1.89.1",
|
|
30
|
+
"@tramvai/tokens-server-private": "1.89.1",
|
|
31
31
|
"body-parser": "^1.19.0",
|
|
32
32
|
"compression": "^1.7.4",
|
|
33
33
|
"cookie-parser": "^1.4.3",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@tinkoff/dippy": "0.7.39",
|
|
43
43
|
"@tinkoff/utils": "^2.1.2",
|
|
44
|
-
"@tramvai/cli": "1.
|
|
45
|
-
"@tramvai/core": "1.
|
|
46
|
-
"@tramvai/module-common": "1.
|
|
47
|
-
"@tramvai/module-environment": "1.
|
|
48
|
-
"@tramvai/tokens-common": "1.
|
|
44
|
+
"@tramvai/cli": "1.89.1",
|
|
45
|
+
"@tramvai/core": "1.89.1",
|
|
46
|
+
"@tramvai/module-common": "1.89.1",
|
|
47
|
+
"@tramvai/module-environment": "1.89.1",
|
|
48
|
+
"@tramvai/tokens-common": "1.89.1",
|
|
49
49
|
"tslib": "^2.0.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|