intlayer-editor 7.5.9 → 7.5.11
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/client/dist/assets/{CodeBlockShiki-DOHz3hxi.js → CodeBlockShiki-EiAndB3z.js} +3 -3
- package/client/dist/assets/{bundle-web-BeYtMvYb.js → bundle-web-6lGPc2DD.js} +1 -1
- package/client/dist/assets/{index-ROdmYOAM.css → index-BQYneYFo.css} +123 -8
- package/client/dist/assets/{index-BfDGXG1A.js → index-r91_MxC4.js} +701 -501
- package/client/dist/index.html +2 -2
- package/package.json +19 -21
- package/server/dist/controllers/configuration.controller.cjs +3 -5
- package/server/dist/controllers/configuration.controller.cjs.map +1 -1
- package/server/dist/controllers/configuration.controller.d.ts +2 -2
- package/server/dist/controllers/configuration.controller.mjs +3 -5
- package/server/dist/controllers/configuration.controller.mjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.cjs +13 -17
- package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.d.ts +6 -5
- package/server/dist/controllers/dictionary.controller.mjs +7 -11
- package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
- package/server/dist/index.cjs +45 -30
- package/server/dist/index.cjs.map +1 -1
- package/server/dist/index.mjs +38 -25
- package/server/dist/index.mjs.map +1 -1
- package/server/dist/routes/config.routes.cjs +3 -3
- package/server/dist/routes/config.routes.cjs.map +1 -1
- package/server/dist/routes/config.routes.d.ts +2 -2
- package/server/dist/routes/config.routes.mjs +3 -3
- package/server/dist/routes/config.routes.mjs.map +1 -1
- package/server/dist/routes/dictionary.routes.cjs +4 -4
- package/server/dist/routes/dictionary.routes.cjs.map +1 -1
- package/server/dist/routes/dictionary.routes.d.ts +2 -2
- package/server/dist/routes/dictionary.routes.mjs +4 -4
- package/server/dist/routes/dictionary.routes.mjs.map +1 -1
package/server/dist/index.mjs
CHANGED
|
@@ -2,15 +2,17 @@ import { configurationRouter } from "./routes/config.routes.mjs";
|
|
|
2
2
|
import { dictionaryRouter } from "./routes/dictionary.routes.mjs";
|
|
3
3
|
import { checkPortAvailability } from "./utils/checkPortAvailability.mjs";
|
|
4
4
|
import { ANSIColors, colorize, colorizePath, getConfiguration, getEnvFilePath } from "@intlayer/config";
|
|
5
|
-
import { intlayer } from "
|
|
5
|
+
import { intlayer } from "fastify-intlayer";
|
|
6
6
|
import { existsSync, lstatSync, readFileSync } from "node:fs";
|
|
7
7
|
import { dirname, join, resolve } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
9
|
+
import fastifyCompress from "@fastify/compress";
|
|
10
|
+
import fastifyCookie from "@fastify/cookie";
|
|
11
|
+
import fastifyCors from "@fastify/cors";
|
|
12
|
+
import fastifyFormbody from "@fastify/formbody";
|
|
13
|
+
import fastifyHelmet from "@fastify/helmet";
|
|
14
|
+
import fastifyStatic from "@fastify/static";
|
|
15
|
+
import Fastify from "fastify";
|
|
14
16
|
import mime from "mime";
|
|
15
17
|
|
|
16
18
|
//#region src/index.ts
|
|
@@ -20,8 +22,8 @@ const envFileOptions = {
|
|
|
20
22
|
envFile: process.env.ENV_FILE
|
|
21
23
|
};
|
|
22
24
|
const packageJson = JSON.parse(readFileSync(resolve(__dirname, "../../package.json"), "utf8"));
|
|
23
|
-
const app =
|
|
24
|
-
app.
|
|
25
|
+
const app = Fastify({ disableRequestLogging: true });
|
|
26
|
+
app.register(intlayer);
|
|
25
27
|
const FALLBACK_PORT = 8e3;
|
|
26
28
|
const config = getConfiguration(envFileOptions);
|
|
27
29
|
const port = config.editor.port ?? FALLBACK_PORT;
|
|
@@ -35,25 +37,33 @@ const startServer = async (app$1) => {
|
|
|
35
37
|
console.error(`\x1b[1;31mError: Port ${port} is already in use.\x1b[0m`);
|
|
36
38
|
process.exit(255);
|
|
37
39
|
}
|
|
38
|
-
app$1.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
app$1.
|
|
43
|
-
app$1.
|
|
44
|
-
app$1.
|
|
45
|
-
app$1.
|
|
46
|
-
app$1.
|
|
47
|
-
app$1.
|
|
48
|
-
app$1.
|
|
49
|
-
|
|
40
|
+
await app$1.register(fastifyHelmet, {
|
|
41
|
+
contentSecurityPolicy: false,
|
|
42
|
+
global: true
|
|
43
|
+
});
|
|
44
|
+
await app$1.register(fastifyCors, corsOptions);
|
|
45
|
+
await app$1.register(fastifyCompress);
|
|
46
|
+
await app$1.register(fastifyCookie);
|
|
47
|
+
await app$1.register(fastifyFormbody);
|
|
48
|
+
await app$1.register(dictionaryRouter, { prefix: "/api/dictionary" });
|
|
49
|
+
await app$1.register(configurationRouter, { prefix: "/api/config" });
|
|
50
|
+
await app$1.register(fastifyStatic, {
|
|
51
|
+
root: clientDistPath,
|
|
52
|
+
wildcard: false
|
|
53
|
+
});
|
|
54
|
+
app$1.setNotFoundHandler((req, reply) => {
|
|
55
|
+
const requestedPath = join(clientDistPath, req.raw.url || "/");
|
|
50
56
|
if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {
|
|
51
57
|
const mimeType = mime.getType(requestedPath) ?? "application/octet-stream";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} else
|
|
58
|
+
reply.header("Content-Type", mimeType);
|
|
59
|
+
return reply.sendFile(req.raw.url?.split("/").pop() || "index.html");
|
|
60
|
+
} else return reply.sendFile("index.html");
|
|
55
61
|
});
|
|
56
|
-
|
|
62
|
+
try {
|
|
63
|
+
await app$1.listen({
|
|
64
|
+
port,
|
|
65
|
+
host: "0.0.0.0"
|
|
66
|
+
});
|
|
57
67
|
const dotEnvFilePath = getEnvFilePath(envFileOptions.env, envFileOptions.envFile);
|
|
58
68
|
console.log(`
|
|
59
69
|
${colorize(colorize("INTLAYER", ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}
|
|
@@ -63,7 +73,10 @@ const startServer = async (app$1) => {
|
|
|
63
73
|
${colorize("➜", ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? "-"}
|
|
64
74
|
${colorize("➜", ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? "-"}
|
|
65
75
|
`);
|
|
66
|
-
})
|
|
76
|
+
} catch (err) {
|
|
77
|
+
app$1.log.error(err);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
67
80
|
};
|
|
68
81
|
startServer(app);
|
|
69
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["app:
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["app: FastifyInstance","corsOptions: FastifyCorsOptions","app"],"sources":["../src/index.ts"],"sourcesContent":["import { existsSync, lstatSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport fastifyCompress from '@fastify/compress';\nimport fastifyCookie from '@fastify/cookie';\nimport fastifyCors, { type FastifyCorsOptions } from '@fastify/cors';\nimport fastifyFormbody from '@fastify/formbody';\nimport fastifyHelmet from '@fastify/helmet';\nimport fastifyStatic from '@fastify/static';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n getConfiguration,\n getEnvFilePath,\n} from '@intlayer/config';\nimport { configurationRouter } from '@routes/config.routes';\nimport { dictionaryRouter } from '@routes/dictionary.routes';\nimport { checkPortAvailability } from '@utils/checkPortAvailability';\nimport Fastify, { type FastifyInstance } from 'fastify';\nimport { intlayer } from 'fastify-intlayer';\nimport mime from 'mime';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst envFileOptions = {\n env: process.env.NODE_ENV,\n envFile: process.env.ENV_FILE,\n};\n\n// Load package.json\nconst packageJson = JSON.parse(\n readFileSync(resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst app: FastifyInstance = Fastify({\n disableRequestLogging: true, // Optional: Keep logs clean like the original\n});\n\n// Load internationalization plugin\n// Assuming fastify-intlayer is the Fastify equivalent of express-intlayer\napp.register(intlayer);\n\nconst FALLBACK_PORT = 8000;\nconst config = getConfiguration(envFileOptions);\nconst port = config.editor.port ?? FALLBACK_PORT;\n\nconst clientDistPath = resolve(__dirname, '../../client/dist');\n\nconst corsOptions: FastifyCorsOptions = {\n origin: '*',\n credentials: true,\n};\n\nconst startServer = async (app: FastifyInstance) => {\n const isPortAvailable = await checkPortAvailability(port);\n\n if (!isPortAvailable) {\n console.error(`\\x1b[1;31mError: Port ${port} is already in use.\\x1b[0m`);\n process.exit(255);\n }\n\n // Security Headers\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n // CORS\n await app.register(fastifyCors, corsOptions);\n\n // Compression\n await app.register(fastifyCompress);\n\n // Cookie Parser\n await app.register(fastifyCookie);\n\n // Parse application/x-www-form-urlencoded\n await app.register(fastifyFormbody);\n\n // Register Routes\n await app.register(dictionaryRouter, { prefix: '/api/dictionary' });\n await app.register(configurationRouter, { prefix: '/api/config' });\n\n // Serve Static Files\n await app.register(fastifyStatic, {\n root: clientDistPath,\n wildcard: false, // We handle the fallback manually to match SPA logic\n });\n\n // For single-page applications, redirect all unmatched routes to index.html\n app.setNotFoundHandler((req, reply) => {\n const requestedPath = join(clientDistPath, req.raw.url || '/');\n\n if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {\n const mimeType =\n mime.getType(requestedPath) ?? 'application/octet-stream';\n reply.header('Content-Type', mimeType);\n return reply.sendFile(req.raw.url?.split('/').pop() || 'index.html');\n } else {\n return reply.sendFile('index.html');\n }\n });\n\n try {\n await app.listen({ port, host: '0.0.0.0' });\n\n const dotEnvFilePath = getEnvFilePath(\n envFileOptions.env,\n envFileOptions.envFile\n );\n\n console.log(`\n ${colorize(colorize('INTLAYER', ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}\n\n Editor running at: ${colorizePath(`http://localhost:${port}`)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === '' ? '-' : colorizePath(config.editor.applicationURL)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? '-'}\n ${colorize('➜', ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? '-'}\n `);\n } catch (err) {\n app.log.error(err);\n process.exit(1);\n }\n};\n\n// Start it up!\nstartServer(app);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,MAAM,iBAAiB;CACrB;CACA,SAAS,QAAQ,IAAI;CACtB;AAGD,MAAM,cAAc,KAAK,MACvB,aAAa,QAAQ,WAAW,qBAAqB,EAAE,OAAO,CAC/D;AAED,MAAMA,MAAuB,QAAQ,EACnC,uBAAuB,MACxB,CAAC;AAIF,IAAI,SAAS,SAAS;AAEtB,MAAM,gBAAgB;AACtB,MAAM,SAAS,iBAAiB,eAAe;AAC/C,MAAM,OAAO,OAAO,OAAO,QAAQ;AAEnC,MAAM,iBAAiB,QAAQ,WAAW,oBAAoB;AAE9D,MAAMC,cAAkC;CACtC,QAAQ;CACR,aAAa;CACd;AAED,MAAM,cAAc,OAAO,UAAyB;AAGlD,KAAI,CAFoB,MAAM,sBAAsB,KAAK,EAEnC;AACpB,UAAQ,MAAM,yBAAyB,KAAK,4BAA4B;AACxE,UAAQ,KAAK,IAAI;;AAInB,OAAMC,MAAI,SAAS,eAAe;EAChC,uBAAuB;EACvB,QAAQ;EACT,CAAC;AAGF,OAAMA,MAAI,SAAS,aAAa,YAAY;AAG5C,OAAMA,MAAI,SAAS,gBAAgB;AAGnC,OAAMA,MAAI,SAAS,cAAc;AAGjC,OAAMA,MAAI,SAAS,gBAAgB;AAGnC,OAAMA,MAAI,SAAS,kBAAkB,EAAE,QAAQ,mBAAmB,CAAC;AACnE,OAAMA,MAAI,SAAS,qBAAqB,EAAE,QAAQ,eAAe,CAAC;AAGlE,OAAMA,MAAI,SAAS,eAAe;EAChC,MAAM;EACN,UAAU;EACX,CAAC;AAGF,OAAI,oBAAoB,KAAK,UAAU;EACrC,MAAM,gBAAgB,KAAK,gBAAgB,IAAI,IAAI,OAAO,IAAI;AAE9D,MAAI,WAAW,cAAc,IAAI,UAAU,cAAc,CAAC,QAAQ,EAAE;GAClE,MAAM,WACJ,KAAK,QAAQ,cAAc,IAAI;AACjC,SAAM,OAAO,gBAAgB,SAAS;AACtC,UAAO,MAAM,SAAS,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,KAAK,IAAI,aAAa;QAEpE,QAAO,MAAM,SAAS,aAAa;GAErC;AAEF,KAAI;AACF,QAAMA,MAAI,OAAO;GAAE;GAAM,MAAM;GAAW,CAAC;EAE3C,MAAM,iBAAiB,eACrB,eAAe,KACf,eAAe,QAChB;AAED,UAAQ,IAAI;MACV,SAAS,SAAS,YAAY,WAAW,KAAK,EAAE,WAAW,UAAU,CAAC,GAAG,SAAS,IAAI,YAAY,WAAW,WAAW,UAAU,CAAC;;mCAEtG,aAAa,oBAAoB,OAAO,CAAC;MACtE,SAAS,KAAK,WAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,mBAAmB,KAAK,MAAM,aAAa,OAAO,OAAO,eAAe,CAAC;MACzJ,SAAS,KAAK,WAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,YAAY,IAAI;MAChG,SAAS,KAAK,WAAW,UAAU,CAAC,8BAA8B,kBAAkB,IAAI;MACxF;UACK,KAAK;AACZ,QAAI,IAAI,MAAM,IAAI;AAClB,UAAQ,KAAK,EAAE;;;AAKnB,YAAY,IAAI"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_controllers_configuration_controller = require('../controllers/configuration.controller.cjs');
|
|
3
3
|
let _intlayer_config = require("@intlayer/config");
|
|
4
|
-
let express = require("express");
|
|
5
4
|
|
|
6
5
|
//#region src/routes/config.routes.ts
|
|
7
|
-
const configurationRouter = (0, express.Router)();
|
|
8
6
|
const { editor } = (0, _intlayer_config.getConfiguration)();
|
|
9
7
|
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
10
8
|
const getConfigurationRoutes = () => ({ getConfiguration: {
|
|
@@ -12,7 +10,9 @@ const getConfigurationRoutes = () => ({ getConfiguration: {
|
|
|
12
10
|
url: getBaseURL(),
|
|
13
11
|
method: "GET"
|
|
14
12
|
} });
|
|
15
|
-
configurationRouter
|
|
13
|
+
const configurationRouter = async (fastify) => {
|
|
14
|
+
fastify.get(getConfigurationRoutes().getConfiguration.urlModel, require_controllers_configuration_controller.getConfiguration);
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
exports.configurationRouter = configurationRouter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.routes.cjs","names":[
|
|
1
|
+
{"version":3,"file":"config.routes.cjs","names":[],"sources":["../../src/routes/config.routes.ts"],"sourcesContent":["import * as configurationController from '@controllers/configuration.controller';\nimport { getConfiguration } from '@intlayer/config';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getConfigurationRoutes = () =>\n ({\n getConfiguration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n }) satisfies Routes;\n\nexport const configurationRouter = async (fastify: FastifyInstance) => {\n fastify.get(\n getConfigurationRoutes().getConfiguration.urlModel,\n configurationController.getConfiguration\n );\n};\n"],"mappings":";;;;;AAKA,MAAM,EAAE,mDAA6B;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,gCACV,EACC,kBAAkB;CAChB,UAAU;CACV,KAAK,YAAY;CACjB,QAAQ;CACT,EACF;AAEH,MAAa,sBAAsB,OAAO,YAA6B;AACrE,SAAQ,IACN,wBAAwB,CAAC,iBAAiB,wEAE3C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FastifyInstance } from "fastify";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/config.routes.d.ts
|
|
4
|
-
declare const configurationRouter: Router;
|
|
5
4
|
declare const getConfigurationRoutes: () => {
|
|
6
5
|
getConfiguration: {
|
|
7
6
|
urlModel: string;
|
|
@@ -9,6 +8,7 @@ declare const getConfigurationRoutes: () => {
|
|
|
9
8
|
method: "GET";
|
|
10
9
|
};
|
|
11
10
|
};
|
|
11
|
+
declare const configurationRouter: (fastify: FastifyInstance) => Promise<void>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { configurationRouter, getConfigurationRoutes };
|
|
14
14
|
//# sourceMappingURL=config.routes.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getConfiguration as getConfiguration$1 } from "../controllers/configuration.controller.mjs";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config";
|
|
3
|
-
import { Router } from "express";
|
|
4
3
|
|
|
5
4
|
//#region src/routes/config.routes.ts
|
|
6
|
-
const configurationRouter = Router();
|
|
7
5
|
const { editor } = getConfiguration();
|
|
8
6
|
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
9
7
|
const getConfigurationRoutes = () => ({ getConfiguration: {
|
|
@@ -11,7 +9,9 @@ const getConfigurationRoutes = () => ({ getConfiguration: {
|
|
|
11
9
|
url: getBaseURL(),
|
|
12
10
|
method: "GET"
|
|
13
11
|
} });
|
|
14
|
-
configurationRouter
|
|
12
|
+
const configurationRouter = async (fastify) => {
|
|
13
|
+
fastify.get(getConfigurationRoutes().getConfiguration.urlModel, getConfiguration$1);
|
|
14
|
+
};
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
export { configurationRouter, getConfigurationRoutes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.routes.mjs","names":["
|
|
1
|
+
{"version":3,"file":"config.routes.mjs","names":["configurationController.getConfiguration"],"sources":["../../src/routes/config.routes.ts"],"sourcesContent":["import * as configurationController from '@controllers/configuration.controller';\nimport { getConfiguration } from '@intlayer/config';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getConfigurationRoutes = () =>\n ({\n getConfiguration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n }) satisfies Routes;\n\nexport const configurationRouter = async (fastify: FastifyInstance) => {\n fastify.get(\n getConfigurationRoutes().getConfiguration.urlModel,\n configurationController.getConfiguration\n );\n};\n"],"mappings":";;;;AAKA,MAAM,EAAE,WAAW,kBAAkB;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,gCACV,EACC,kBAAkB;CAChB,UAAU;CACV,KAAK,YAAY;CACjB,QAAQ;CACT,EACF;AAEH,MAAa,sBAAsB,OAAO,YAA6B;AACrE,SAAQ,IACN,wBAAwB,CAAC,iBAAiB,UAC1CA,mBACD"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_controllers_dictionary_controller = require('../controllers/dictionary.controller.cjs');
|
|
3
3
|
let _intlayer_config = require("@intlayer/config");
|
|
4
|
-
let express = require("express");
|
|
5
4
|
|
|
6
5
|
//#region src/routes/dictionary.routes.ts
|
|
7
|
-
const dictionaryRouter = (0, express.Router)();
|
|
8
6
|
const { editor } = (0, _intlayer_config.getConfiguration)();
|
|
9
7
|
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
10
8
|
const getDictionaryRoutes = () => ({
|
|
@@ -19,8 +17,10 @@ const getDictionaryRoutes = () => ({
|
|
|
19
17
|
method: "POST"
|
|
20
18
|
}
|
|
21
19
|
});
|
|
22
|
-
dictionaryRouter
|
|
23
|
-
|
|
20
|
+
const dictionaryRouter = async (fastify) => {
|
|
21
|
+
fastify.get(getDictionaryRoutes().getDictionaries.urlModel, require_controllers_dictionary_controller.getDictionaries);
|
|
22
|
+
fastify.post(getDictionaryRoutes().writeContentDeclaration.urlModel, require_controllers_dictionary_controller.writeContentDeclaration);
|
|
23
|
+
};
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
26
|
exports.dictionaryRouter = dictionaryRouter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.routes.cjs","names":["
|
|
1
|
+
{"version":3,"file":"dictionary.routes.cjs","names":["getDictionaries","writeContentDeclaration"],"sources":["../../src/routes/dictionary.routes.ts"],"sourcesContent":["import {\n getDictionaries,\n writeContentDeclaration,\n} from '@controllers/dictionary.controller';\nimport { getConfiguration } from '@intlayer/config';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getDictionaryRoutes = () =>\n ({\n getDictionaries: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n writeContentDeclaration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'POST',\n },\n }) satisfies Routes;\n\nexport const dictionaryRouter = async (fastify: FastifyInstance) => {\n fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);\n fastify.post(\n getDictionaryRoutes().writeContentDeclaration.urlModel,\n writeContentDeclaration\n );\n};\n"],"mappings":";;;;;AAQA,MAAM,EAAE,mDAA6B;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,6BACV;CACC,iBAAiB;EACf,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACD,yBAAyB;EACvB,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACF;AAEH,MAAa,mBAAmB,OAAO,YAA6B;AAClE,SAAQ,IAAI,qBAAqB,CAAC,gBAAgB,UAAUA,0DAAgB;AAC5E,SAAQ,KACN,qBAAqB,CAAC,wBAAwB,UAC9CC,kEACD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FastifyInstance } from "fastify";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/dictionary.routes.d.ts
|
|
4
|
-
declare const dictionaryRouter: Router;
|
|
5
4
|
declare const getDictionaryRoutes: () => {
|
|
6
5
|
getDictionaries: {
|
|
7
6
|
urlModel: string;
|
|
@@ -14,6 +13,7 @@ declare const getDictionaryRoutes: () => {
|
|
|
14
13
|
method: "POST";
|
|
15
14
|
};
|
|
16
15
|
};
|
|
16
|
+
declare const dictionaryRouter: (fastify: FastifyInstance) => Promise<void>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { dictionaryRouter, getDictionaryRoutes };
|
|
19
19
|
//# sourceMappingURL=dictionary.routes.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getDictionaries, writeContentDeclaration } from "../controllers/dictionary.controller.mjs";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config";
|
|
3
|
-
import { Router } from "express";
|
|
4
3
|
|
|
5
4
|
//#region src/routes/dictionary.routes.ts
|
|
6
|
-
const dictionaryRouter = Router();
|
|
7
5
|
const { editor } = getConfiguration();
|
|
8
6
|
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
9
7
|
const getDictionaryRoutes = () => ({
|
|
@@ -18,8 +16,10 @@ const getDictionaryRoutes = () => ({
|
|
|
18
16
|
method: "POST"
|
|
19
17
|
}
|
|
20
18
|
});
|
|
21
|
-
dictionaryRouter
|
|
22
|
-
|
|
19
|
+
const dictionaryRouter = async (fastify) => {
|
|
20
|
+
fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);
|
|
21
|
+
fastify.post(getDictionaryRoutes().writeContentDeclaration.urlModel, writeContentDeclaration);
|
|
22
|
+
};
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
25
|
export { dictionaryRouter, getDictionaryRoutes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.routes.mjs","names":[
|
|
1
|
+
{"version":3,"file":"dictionary.routes.mjs","names":[],"sources":["../../src/routes/dictionary.routes.ts"],"sourcesContent":["import {\n getDictionaries,\n writeContentDeclaration,\n} from '@controllers/dictionary.controller';\nimport { getConfiguration } from '@intlayer/config';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getDictionaryRoutes = () =>\n ({\n getDictionaries: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n writeContentDeclaration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'POST',\n },\n }) satisfies Routes;\n\nexport const dictionaryRouter = async (fastify: FastifyInstance) => {\n fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);\n fastify.post(\n getDictionaryRoutes().writeContentDeclaration.urlModel,\n writeContentDeclaration\n );\n};\n"],"mappings":";;;;AAQA,MAAM,EAAE,WAAW,kBAAkB;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,6BACV;CACC,iBAAiB;EACf,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACD,yBAAyB;EACvB,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACF;AAEH,MAAa,mBAAmB,OAAO,YAA6B;AAClE,SAAQ,IAAI,qBAAqB,CAAC,gBAAgB,UAAU,gBAAgB;AAC5E,SAAQ,KACN,qBAAqB,CAAC,wBAAwB,UAC9C,wBACD"}
|