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.
Files changed (30) hide show
  1. package/client/dist/assets/{CodeBlockShiki-DOHz3hxi.js → CodeBlockShiki-EiAndB3z.js} +3 -3
  2. package/client/dist/assets/{bundle-web-BeYtMvYb.js → bundle-web-6lGPc2DD.js} +1 -1
  3. package/client/dist/assets/{index-ROdmYOAM.css → index-BQYneYFo.css} +123 -8
  4. package/client/dist/assets/{index-BfDGXG1A.js → index-r91_MxC4.js} +701 -501
  5. package/client/dist/index.html +2 -2
  6. package/package.json +19 -21
  7. package/server/dist/controllers/configuration.controller.cjs +3 -5
  8. package/server/dist/controllers/configuration.controller.cjs.map +1 -1
  9. package/server/dist/controllers/configuration.controller.d.ts +2 -2
  10. package/server/dist/controllers/configuration.controller.mjs +3 -5
  11. package/server/dist/controllers/configuration.controller.mjs.map +1 -1
  12. package/server/dist/controllers/dictionary.controller.cjs +13 -17
  13. package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
  14. package/server/dist/controllers/dictionary.controller.d.ts +6 -5
  15. package/server/dist/controllers/dictionary.controller.mjs +7 -11
  16. package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
  17. package/server/dist/index.cjs +45 -30
  18. package/server/dist/index.cjs.map +1 -1
  19. package/server/dist/index.mjs +38 -25
  20. package/server/dist/index.mjs.map +1 -1
  21. package/server/dist/routes/config.routes.cjs +3 -3
  22. package/server/dist/routes/config.routes.cjs.map +1 -1
  23. package/server/dist/routes/config.routes.d.ts +2 -2
  24. package/server/dist/routes/config.routes.mjs +3 -3
  25. package/server/dist/routes/config.routes.mjs.map +1 -1
  26. package/server/dist/routes/dictionary.routes.cjs +4 -4
  27. package/server/dist/routes/dictionary.routes.cjs.map +1 -1
  28. package/server/dist/routes/dictionary.routes.d.ts +2 -2
  29. package/server/dist/routes/dictionary.routes.mjs +4 -4
  30. package/server/dist/routes/dictionary.routes.mjs.map +1 -1
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Intlayer Editor</title>
8
- <script type="module" crossorigin src="/assets/index-BfDGXG1A.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-ROdmYOAM.css">
8
+ <script type="module" crossorigin src="/assets/index-r91_MxC4.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-BQYneYFo.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer-editor",
3
- "version": "7.5.9",
3
+ "version": "7.5.11",
4
4
  "private": false,
5
5
  "description": "Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.",
6
6
  "keywords": [
@@ -85,27 +85,25 @@
85
85
  "typecheck": "tsc --project ./server/tsconfig.types.json --noEmit"
86
86
  },
87
87
  "dependencies": {
88
- "@intlayer/chokidar": "7.5.9",
89
- "@intlayer/config": "7.5.9",
90
- "@intlayer/unmerged-dictionaries-entry": "7.5.9",
91
- "compression": "1.8.1",
92
- "cookie-parser": "1.4.7",
93
- "cors": "2.8.5",
94
- "express": "5.2.1",
95
- "express-intlayer": "7.5.9",
96
- "helmet": "8.1.0",
88
+ "@fastify/compress": "^8.0.0",
89
+ "@fastify/cookie": "^10.0.0",
90
+ "@fastify/cors": "^10.0.0",
91
+ "@fastify/formbody": "^8.0.0",
92
+ "@fastify/helmet": "^12.0.0",
93
+ "@fastify/static": "^8.0.0",
94
+ "@intlayer/chokidar": "7.5.11",
95
+ "@intlayer/config": "7.5.11",
96
+ "@intlayer/unmerged-dictionaries-entry": "7.5.11",
97
+ "fastify": "5.6.2",
98
+ "fastify-intlayer": "7.5.11",
97
99
  "mime": "4.1.0"
98
100
  },
99
101
  "devDependencies": {
100
- "@intlayer/design-system": "7.5.9",
101
- "@intlayer/editor-react": "7.5.9",
102
- "@intlayer/types": "7.5.9",
102
+ "@intlayer/design-system": "7.5.11",
103
+ "@intlayer/editor-react": "7.5.11",
104
+ "@intlayer/types": "7.5.11",
103
105
  "@tailwindcss/vite": "4.1.18",
104
106
  "@tanstack/react-query": "5.90.12",
105
- "@types/compression": "1.8.1",
106
- "@types/cookie-parser": "1.4.10",
107
- "@types/cors": "2.8.19",
108
- "@types/express": "5.0.6",
109
107
  "@types/node": "25.0.3",
110
108
  "@types/react": "19.2.7",
111
109
  "@types/react-dom": "19.2.3",
@@ -117,22 +115,22 @@
117
115
  "framer-motion": "12.23.26",
118
116
  "fuse.js": "7.1.0",
119
117
  "globals": "16.5.0",
120
- "intlayer": "7.5.9",
118
+ "intlayer": "7.5.11",
121
119
  "lucide-react": "0.562.0",
122
120
  "react": "19.2.3",
123
121
  "react-dom": "19.2.3",
124
- "react-intlayer": "7.5.9",
122
+ "react-intlayer": "7.5.11",
125
123
  "react-router-dom": "7.9.6",
126
124
  "tailwind-merge": "3.4.0",
127
125
  "tailwindcss": "4.1.18",
128
126
  "tsdown": "0.18.2",
129
127
  "typescript": "5.9.3",
130
128
  "vite": "7.3.0",
131
- "vite-intlayer": "7.5.9",
129
+ "vite-intlayer": "7.5.11",
132
130
  "vitest": "4.0.16"
133
131
  },
134
132
  "engines": {
135
- "node": ">=14.18"
133
+ "node": ">=18.0.0"
136
134
  },
137
135
  "bug": {
138
136
  "url": "https://github.com/aymericzip/intlayer/issues"
@@ -6,11 +6,10 @@ let _intlayer_config = require("@intlayer/config");
6
6
  /**
7
7
  * Get the Intlayer configuration
8
8
  */
9
- const getConfiguration = async (_req, res, _next) => {
9
+ const getConfiguration = async (_req, res) => {
10
10
  try {
11
11
  const formattedResponse = require_utils_responseData.formatResponse({ data: (0, _intlayer_config.getConfiguration)() });
12
- res.json(formattedResponse);
13
- return;
12
+ return res.send(formattedResponse);
14
13
  } catch (err) {
15
14
  const errorMessage = err ?? {
16
15
  message: "Internal Server Error",
@@ -24,8 +23,7 @@ const getConfiguration = async (_req, res, _next) => {
24
23
  },
25
24
  status: errorMessage.status ?? 500
26
25
  });
27
- res.json(formattedErrorResponse);
28
- return;
26
+ return res.send(formattedErrorResponse);
29
27
  }
30
28
  };
31
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.controller.cjs","names":["formatResponse"],"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import { getConfiguration as getApplicationConfiguration } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { NextFunction, Request, Response } from 'express';\n\nexport type GetConfigurationResult = ResponseData<IntlayerConfig>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getConfiguration = async (\n _req: Request,\n res: Response<GetConfigurationResult>,\n _next: NextFunction\n): Promise<void> => {\n try {\n const config = getApplicationConfiguration();\n\n const formattedResponse = formatResponse<IntlayerConfig>({\n data: config,\n });\n\n res.json(formattedResponse);\n return;\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<IntlayerConfig>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n res.json(formattedErrorResponse);\n return;\n }\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,mBAAmB,OAC9B,MACA,KACA,UACkB;AAClB,KAAI;EAGF,MAAM,oBAAoBA,0CAA+B,EACvD,8CAH0C,EAI3C,CAAC;AAEF,MAAI,KAAK,kBAAkB;AAC3B;UACO,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyBA,0CAA+B;GAC5D,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,MAAI,KAAK,uBAAuB;AAChC"}
1
+ {"version":3,"file":"configuration.controller.cjs","names":["formatResponse"],"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import { getConfiguration as getApplicationConfiguration } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\n\nexport type GetConfigurationResult = ResponseData<IntlayerConfig>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getConfiguration = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const config = getApplicationConfiguration();\n\n const formattedResponse = formatResponse<IntlayerConfig>({\n data: config,\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<IntlayerConfig>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,mBAAmB,OAC9B,MACA,QACkB;AAClB,KAAI;EAGF,MAAM,oBAAoBA,0CAA+B,EACvD,8CAH0C,EAI3C,CAAC;AAEF,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyBA,0CAA+B;GAC5D,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,SAAO,IAAI,KAAK,uBAAuB"}
@@ -1,13 +1,13 @@
1
1
  import { ResponseData } from "../utils/responseData.js";
2
2
  import { IntlayerConfig } from "@intlayer/types";
3
- import { NextFunction, Request, Response } from "express";
3
+ import { FastifyReply, FastifyRequest } from "fastify";
4
4
 
5
5
  //#region src/controllers/configuration.controller.d.ts
6
6
  type GetConfigurationResult = ResponseData<IntlayerConfig>;
7
7
  /**
8
8
  * Get the Intlayer configuration
9
9
  */
10
- declare const getConfiguration: (_req: Request, res: Response<GetConfigurationResult>, _next: NextFunction) => Promise<void>;
10
+ declare const getConfiguration: (_req: FastifyRequest, res: FastifyReply) => Promise<void>;
11
11
  //#endregion
12
12
  export { GetConfigurationResult, getConfiguration };
13
13
  //# sourceMappingURL=configuration.controller.d.ts.map
@@ -5,11 +5,10 @@ import { getConfiguration as getConfiguration$1 } from "@intlayer/config";
5
5
  /**
6
6
  * Get the Intlayer configuration
7
7
  */
8
- const getConfiguration = async (_req, res, _next) => {
8
+ const getConfiguration = async (_req, res) => {
9
9
  try {
10
10
  const formattedResponse = formatResponse({ data: getConfiguration$1() });
11
- res.json(formattedResponse);
12
- return;
11
+ return res.send(formattedResponse);
13
12
  } catch (err) {
14
13
  const errorMessage = err ?? {
15
14
  message: "Internal Server Error",
@@ -23,8 +22,7 @@ const getConfiguration = async (_req, res, _next) => {
23
22
  },
24
23
  status: errorMessage.status ?? 500
25
24
  });
26
- res.json(formattedErrorResponse);
27
- return;
25
+ return res.send(formattedErrorResponse);
28
26
  }
29
27
  };
30
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.controller.mjs","names":["getApplicationConfiguration"],"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import { getConfiguration as getApplicationConfiguration } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { NextFunction, Request, Response } from 'express';\n\nexport type GetConfigurationResult = ResponseData<IntlayerConfig>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getConfiguration = async (\n _req: Request,\n res: Response<GetConfigurationResult>,\n _next: NextFunction\n): Promise<void> => {\n try {\n const config = getApplicationConfiguration();\n\n const formattedResponse = formatResponse<IntlayerConfig>({\n data: config,\n });\n\n res.json(formattedResponse);\n return;\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<IntlayerConfig>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n res.json(formattedErrorResponse);\n return;\n }\n};\n"],"mappings":";;;;;;;AAUA,MAAa,mBAAmB,OAC9B,MACA,KACA,UACkB;AAClB,KAAI;EAGF,MAAM,oBAAoB,eAA+B,EACvD,MAHaA,oBAA6B,EAI3C,CAAC;AAEF,MAAI,KAAK,kBAAkB;AAC3B;UACO,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyB,eAA+B;GAC5D,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,MAAI,KAAK,uBAAuB;AAChC"}
1
+ {"version":3,"file":"configuration.controller.mjs","names":["getApplicationConfiguration"],"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import { getConfiguration as getApplicationConfiguration } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\n\nexport type GetConfigurationResult = ResponseData<IntlayerConfig>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getConfiguration = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const config = getApplicationConfiguration();\n\n const formattedResponse = formatResponse<IntlayerConfig>({\n data: config,\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<IntlayerConfig>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":";;;;;;;AAUA,MAAa,mBAAmB,OAC9B,MACA,QACkB;AAClB,KAAI;EAGF,MAAM,oBAAoB,eAA+B,EACvD,MAHaA,oBAA6B,EAI3C,CAAC;AAEF,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyB,eAA+B;GAC5D,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,SAAO,IAAI,KAAK,uBAAuB"}
@@ -3,17 +3,16 @@ const require_utils_responseData = require('../utils/responseData.cjs');
3
3
  let _intlayer_config = require("@intlayer/config");
4
4
  let _intlayer_chokidar = require("@intlayer/chokidar");
5
5
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
6
- let express_intlayer = require("express-intlayer");
6
+ let fastify_intlayer = require("fastify-intlayer");
7
7
 
8
8
  //#region src/controllers/dictionary.controller.ts
9
9
  /**
10
10
  * Get the Intlayer configuration
11
11
  */
12
- const getDictionaries = async (_req, res, _next) => {
12
+ const getDictionaries = async (_req, res) => {
13
13
  try {
14
14
  const formattedResponse = require_utils_responseData.formatResponse({ data: (0, _intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)() });
15
- res.json(formattedResponse);
16
- return;
15
+ return res.send(formattedResponse);
17
16
  } catch (err) {
18
17
  const errorMessage = err ?? {
19
18
  message: "Internal Server Error",
@@ -27,49 +26,48 @@ const getDictionaries = async (_req, res, _next) => {
27
26
  },
28
27
  status: errorMessage.status ?? 500
29
28
  });
30
- res.json(formattedErrorResponse);
31
- return;
29
+ return res.send(formattedErrorResponse);
32
30
  }
33
31
  };
34
32
  /**
35
33
  * Adds a new dictionary to the database.
36
34
  */
37
- const writeContentDeclaration = async (req, res, _next) => {
35
+ const writeContentDeclaration = async (req, res) => {
38
36
  try {
39
37
  const dictionaryData = req.body.dictionary;
40
38
  const result = await (0, _intlayer_chokidar.writeContentDeclaration)(dictionaryData, (0, _intlayer_config.getConfiguration)());
41
39
  let description = "";
42
40
  switch (result.status) {
43
41
  case "created":
44
- description = (0, express_intlayer.t)({
42
+ description = (0, fastify_intlayer.t)({
45
43
  en: "Content declaration created successfully",
46
44
  fr: "Déclaration de contenu créée avec succès",
47
45
  es: "Declaración de contenido creada con éxito"
48
46
  });
49
47
  break;
50
48
  case "updated":
51
- description = (0, express_intlayer.t)({
49
+ description = (0, fastify_intlayer.t)({
52
50
  en: "Content declaration updated successfully",
53
51
  fr: "Déclaration de contenu mise à jour avec succès",
54
52
  es: "Declaración de contenido actualizada con éxito"
55
53
  });
56
54
  break;
57
55
  case "reimported in JSON":
58
- description = (0, express_intlayer.t)({
56
+ description = (0, fastify_intlayer.t)({
59
57
  en: "Content declaration reimported in JSON successfully",
60
58
  fr: "Déclaration de contenu réimportée en JSON avec succès",
61
59
  es: "Declaración de contenido reimportada en JSON con éxito"
62
60
  });
63
61
  break;
64
62
  case "new content file":
65
- description = (0, express_intlayer.t)({
63
+ description = (0, fastify_intlayer.t)({
66
64
  en: "Content declaration new content file successfully",
67
65
  fr: "Déclaration de contenu réimportée dans un nouveau emplacement avec succès",
68
66
  es: "Declaración de contenido reimportada en un nuevo lugar con éxito"
69
67
  });
70
68
  break;
71
69
  default:
72
- description = (0, express_intlayer.t)({
70
+ description = (0, fastify_intlayer.t)({
73
71
  en: "Content declaration written successfully",
74
72
  fr: "Déclaration de contenu écrite avec succès",
75
73
  es: "Declaración de contenido escrita con éxito"
@@ -78,15 +76,14 @@ const writeContentDeclaration = async (req, res, _next) => {
78
76
  }
79
77
  const formattedResponse = require_utils_responseData.formatResponse({
80
78
  data: result,
81
- message: (0, express_intlayer.t)({
79
+ message: (0, fastify_intlayer.t)({
82
80
  en: "Content declaration written",
83
81
  fr: "Déclaration de contenu écrite",
84
82
  es: "Declaración de contenido escrita"
85
83
  }),
86
84
  description
87
85
  });
88
- res.json(formattedResponse);
89
- return;
86
+ return res.send(formattedResponse);
90
87
  } catch (err) {
91
88
  const errorMessage = err ?? {
92
89
  message: "Internal Server Error",
@@ -101,8 +98,7 @@ const writeContentDeclaration = async (req, res, _next) => {
101
98
  },
102
99
  status: errorMessage.status ?? 500
103
100
  });
104
- res.json(formattedErrorResponse);
105
- return;
101
+ return res.send(formattedErrorResponse);
106
102
  }
107
103
  };
108
104
 
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.controller.cjs","names":["formatResponse"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { NextFunction, Request, Response } from 'express';\nimport { t } from 'express-intlayer';\n\ntype GetDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: Request,\n res: Response<GetDictionariesResult>,\n _next: NextFunction\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n res.json(formattedResponse);\n return;\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n res.json(formattedErrorResponse);\n return;\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: Request<any, any, WriteContentDeclarationBody>,\n res: Response<WriteContentDeclarationResult>,\n _next: NextFunction\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n res.json(formattedResponse);\n return;\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n res.json(formattedErrorResponse);\n return;\n }\n};\n"],"mappings":";;;;;;;;;;;AAmBA,MAAa,kBAAkB,OAC7B,MACA,KACA,UACkB;AAClB,KAAI;EACF,MAAM,oBAAoBA,0CAAqC,EAC7D,0EAA+B,EAChC,CAAC;AAEF,MAAI,KAAK,kBAAkB;AAC3B;UACO,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyBA,0CAAqC;GAClE,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,MAAI,KAAK,uBAAuB;AAChC;;;;;;AAeJ,MAAa,0BAA0B,OACrC,KACA,KACA,UACkB;AAClB,KAAI;EACF,MAAM,iBAAiB,IAAI,KAAK;EAIhC,MAAM,SAAS,sDAAoC,wDAFlB,CAEyC;EAE1E,IAAI,cAAc;AAElB,UAAQ,OAAO,QAAf;GACE,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAGF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF;AACE,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;;EAIJ,MAAM,oBAAoBA,0CACxB;GACE,MAAM;GACN,iCAAW;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACL,CAAC;GACF;GACD,CACF;AAED,MAAI,KAAK,kBAAkB;AAC3B;UACO,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;AAED,UAAQ,MAAM,aAAa;EAE3B,MAAM,yBACJA,0CAAkD;GAChD,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEJ,MAAI,KAAK,uBAAuB;AAChC"}
1
+ {"version":3,"file":"dictionary.controller.cjs","names":["formatResponse"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\nimport { t } from 'fastify-intlayer';\n\ntype GetDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: FastifyRequest<{ Body: WriteContentDeclarationBody }>,\n res: FastifyReply\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":";;;;;;;;;;;AAmBA,MAAa,kBAAkB,OAC7B,MACA,QACkB;AAClB,KAAI;EACF,MAAM,oBAAoBA,0CAAqC,EAC7D,0EAA+B,EAChC,CAAC;AAEF,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyBA,0CAAqC;GAClE,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,SAAO,IAAI,KAAK,uBAAuB;;;;;;AAe3C,MAAa,0BAA0B,OACrC,KACA,QACkB;AAClB,KAAI;EACF,MAAM,iBAAiB,IAAI,KAAK;EAIhC,MAAM,SAAS,sDAAoC,wDAFlB,CAEyC;EAE1E,IAAI,cAAc;AAElB,UAAQ,OAAO,QAAf;GACE,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAGF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF;AACE,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;;EAIJ,MAAM,oBAAoBA,0CACxB;GACE,MAAM;GACN,iCAAW;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACL,CAAC;GACF;GACD,CACF;AAED,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;AAED,UAAQ,MAAM,aAAa;EAE3B,MAAM,yBACJA,0CAAkD;GAChD,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEJ,SAAO,IAAI,KAAK,uBAAuB"}
@@ -1,15 +1,14 @@
1
1
  import { ResponseData } from "../utils/responseData.js";
2
2
  import { Dictionary } from "@intlayer/types";
3
- import { NextFunction, Request, Response } from "express";
3
+ import { FastifyReply, FastifyRequest } from "fastify";
4
4
  import { DictionaryStatus } from "@intlayer/chokidar";
5
- import { UnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
6
5
 
7
6
  //#region src/controllers/dictionary.controller.d.ts
8
- type GetDictionariesResult = ResponseData<UnmergedDictionaries>;
7
+
9
8
  /**
10
9
  * Get the Intlayer configuration
11
10
  */
12
- declare const getDictionaries: (_req: Request, res: Response<GetDictionariesResult>, _next: NextFunction) => Promise<void>;
11
+ declare const getDictionaries: (_req: FastifyRequest, res: FastifyReply) => Promise<void>;
13
12
  type WriteContentDeclarationBody = {
14
13
  dictionary: Dictionary;
15
14
  };
@@ -21,7 +20,9 @@ type WriteContentDeclarationResult = ResponseData<WriteContentDeclarationResultD
21
20
  /**
22
21
  * Adds a new dictionary to the database.
23
22
  */
24
- declare const writeContentDeclaration: (req: Request<any, any, WriteContentDeclarationBody>, res: Response<WriteContentDeclarationResult>, _next: NextFunction) => Promise<void>;
23
+ declare const writeContentDeclaration: (req: FastifyRequest<{
24
+ Body: WriteContentDeclarationBody;
25
+ }>, res: FastifyReply) => Promise<void>;
25
26
  //#endregion
26
27
  export { WriteContentDeclarationBody, WriteContentDeclarationResult, getDictionaries, writeContentDeclaration };
27
28
  //# sourceMappingURL=dictionary.controller.d.ts.map
@@ -2,17 +2,16 @@ import { formatResponse } from "../utils/responseData.mjs";
2
2
  import { getConfiguration } from "@intlayer/config";
3
3
  import { writeContentDeclaration as writeContentDeclaration$1 } from "@intlayer/chokidar";
4
4
  import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
5
- import { t } from "express-intlayer";
5
+ import { t } from "fastify-intlayer";
6
6
 
7
7
  //#region src/controllers/dictionary.controller.ts
8
8
  /**
9
9
  * Get the Intlayer configuration
10
10
  */
11
- const getDictionaries = async (_req, res, _next) => {
11
+ const getDictionaries = async (_req, res) => {
12
12
  try {
13
13
  const formattedResponse = formatResponse({ data: getUnmergedDictionaries() });
14
- res.json(formattedResponse);
15
- return;
14
+ return res.send(formattedResponse);
16
15
  } catch (err) {
17
16
  const errorMessage = err ?? {
18
17
  message: "Internal Server Error",
@@ -26,14 +25,13 @@ const getDictionaries = async (_req, res, _next) => {
26
25
  },
27
26
  status: errorMessage.status ?? 500
28
27
  });
29
- res.json(formattedErrorResponse);
30
- return;
28
+ return res.send(formattedErrorResponse);
31
29
  }
32
30
  };
33
31
  /**
34
32
  * Adds a new dictionary to the database.
35
33
  */
36
- const writeContentDeclaration = async (req, res, _next) => {
34
+ const writeContentDeclaration = async (req, res) => {
37
35
  try {
38
36
  const dictionaryData = req.body.dictionary;
39
37
  const result = await writeContentDeclaration$1(dictionaryData, getConfiguration());
@@ -84,8 +82,7 @@ const writeContentDeclaration = async (req, res, _next) => {
84
82
  }),
85
83
  description
86
84
  });
87
- res.json(formattedResponse);
88
- return;
85
+ return res.send(formattedResponse);
89
86
  } catch (err) {
90
87
  const errorMessage = err ?? {
91
88
  message: "Internal Server Error",
@@ -100,8 +97,7 @@ const writeContentDeclaration = async (req, res, _next) => {
100
97
  },
101
98
  status: errorMessage.status ?? 500
102
99
  });
103
- res.json(formattedErrorResponse);
104
- return;
100
+ return res.send(formattedErrorResponse);
105
101
  }
106
102
  };
107
103
 
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.controller.mjs","names":["writeContentDeclarationEditor"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { NextFunction, Request, Response } from 'express';\nimport { t } from 'express-intlayer';\n\ntype GetDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: Request,\n res: Response<GetDictionariesResult>,\n _next: NextFunction\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n res.json(formattedResponse);\n return;\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n res.json(formattedErrorResponse);\n return;\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: Request<any, any, WriteContentDeclarationBody>,\n res: Response<WriteContentDeclarationResult>,\n _next: NextFunction\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n res.json(formattedResponse);\n return;\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n res.json(formattedErrorResponse);\n return;\n }\n};\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,kBAAkB,OAC7B,MACA,KACA,UACkB;AAClB,KAAI;EACF,MAAM,oBAAoB,eAAqC,EAC7D,MAAM,yBAAyB,EAChC,CAAC;AAEF,MAAI,KAAK,kBAAkB;AAC3B;UACO,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyB,eAAqC;GAClE,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,MAAI,KAAK,uBAAuB;AAChC;;;;;;AAeJ,MAAa,0BAA0B,OACrC,KACA,KACA,UACkB;AAClB,KAAI;EACF,MAAM,iBAAiB,IAAI,KAAK;EAIhC,MAAM,SAAS,MAAMA,0BAA8B,gBAFpC,kBAAkB,CAEyC;EAE1E,IAAI,cAAc;AAElB,UAAQ,OAAO,QAAf;GACE,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAGF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF;AACE,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;;EAIJ,MAAM,oBAAoB,eACxB;GACE,MAAM;GACN,SAAS,EAAE;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACL,CAAC;GACF;GACD,CACF;AAED,MAAI,KAAK,kBAAkB;AAC3B;UACO,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;AAED,UAAQ,MAAM,aAAa;EAE3B,MAAM,yBACJ,eAAkD;GAChD,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEJ,MAAI,KAAK,uBAAuB;AAChC"}
1
+ {"version":3,"file":"dictionary.controller.mjs","names":["writeContentDeclarationEditor"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\nimport { t } from 'fastify-intlayer';\n\ntype GetDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: FastifyRequest<{ Body: WriteContentDeclarationBody }>,\n res: FastifyReply\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":";;;;;;;;;;AAmBA,MAAa,kBAAkB,OAC7B,MACA,QACkB;AAClB,KAAI;EACF,MAAM,oBAAoB,eAAqC,EAC7D,MAAM,yBAAyB,EAChC,CAAC;AAEF,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyB,eAAqC;GAClE,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,SAAO,IAAI,KAAK,uBAAuB;;;;;;AAe3C,MAAa,0BAA0B,OACrC,KACA,QACkB;AAClB,KAAI;EACF,MAAM,iBAAiB,IAAI,KAAK;EAIhC,MAAM,SAAS,MAAMA,0BAA8B,gBAFpC,kBAAkB,CAEyC;EAE1E,IAAI,cAAc;AAElB,UAAQ,OAAO,QAAf;GACE,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAGF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF;AACE,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;;EAIJ,MAAM,oBAAoB,eACxB;GACE,MAAM;GACN,SAAS,EAAE;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACL,CAAC;GACF;GACD,CACF;AAED,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;AAED,UAAQ,MAAM,aAAa;EAE3B,MAAM,yBACJ,eAAkD;GAChD,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEJ,SAAO,IAAI,KAAK,uBAAuB"}
@@ -3,20 +3,24 @@ const require_routes_config_routes = require('./routes/config.routes.cjs');
3
3
  const require_routes_dictionary_routes = require('./routes/dictionary.routes.cjs');
4
4
  const require_utils_checkPortAvailability = require('./utils/checkPortAvailability.cjs');
5
5
  let _intlayer_config = require("@intlayer/config");
6
- let express_intlayer = require("express-intlayer");
6
+ let fastify_intlayer = require("fastify-intlayer");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
9
9
  let node_url = require("node:url");
10
- let express = require("express");
11
- express = require_rolldown_runtime.__toESM(express);
12
- let compression = require("compression");
13
- compression = require_rolldown_runtime.__toESM(compression);
14
- let cookie_parser = require("cookie-parser");
15
- cookie_parser = require_rolldown_runtime.__toESM(cookie_parser);
16
- let cors = require("cors");
17
- cors = require_rolldown_runtime.__toESM(cors);
18
- let helmet = require("helmet");
19
- helmet = require_rolldown_runtime.__toESM(helmet);
10
+ let _fastify_compress = require("@fastify/compress");
11
+ _fastify_compress = require_rolldown_runtime.__toESM(_fastify_compress);
12
+ let _fastify_cookie = require("@fastify/cookie");
13
+ _fastify_cookie = require_rolldown_runtime.__toESM(_fastify_cookie);
14
+ let _fastify_cors = require("@fastify/cors");
15
+ _fastify_cors = require_rolldown_runtime.__toESM(_fastify_cors);
16
+ let _fastify_formbody = require("@fastify/formbody");
17
+ _fastify_formbody = require_rolldown_runtime.__toESM(_fastify_formbody);
18
+ let _fastify_helmet = require("@fastify/helmet");
19
+ _fastify_helmet = require_rolldown_runtime.__toESM(_fastify_helmet);
20
+ let _fastify_static = require("@fastify/static");
21
+ _fastify_static = require_rolldown_runtime.__toESM(_fastify_static);
22
+ let fastify = require("fastify");
23
+ fastify = require_rolldown_runtime.__toESM(fastify);
20
24
  let mime = require("mime");
21
25
  mime = require_rolldown_runtime.__toESM(mime);
22
26
 
@@ -27,8 +31,8 @@ const envFileOptions = {
27
31
  envFile: process.env.ENV_FILE
28
32
  };
29
33
  const packageJson = JSON.parse((0, node_fs.readFileSync)((0, node_path.resolve)(__dirname$1, "../../package.json"), "utf8"));
30
- const app = (0, express.default)();
31
- app.use((0, express_intlayer.intlayer)());
34
+ const app = (0, fastify.default)({ disableRequestLogging: true });
35
+ app.register(fastify_intlayer.intlayer);
32
36
  const FALLBACK_PORT = 8e3;
33
37
  const config = (0, _intlayer_config.getConfiguration)(envFileOptions);
34
38
  const port = config.editor.port ?? FALLBACK_PORT;
@@ -42,25 +46,33 @@ const startServer = async (app$1) => {
42
46
  console.error(`\x1b[1;31mError: Port ${port} is already in use.\x1b[0m`);
43
47
  process.exit(255);
44
48
  }
45
- app$1.disable("x-powered-by");
46
- app$1.use((0, helmet.default)({ contentSecurityPolicy: false }));
47
- app$1.use((0, cors.default)(corsOptions));
48
- app$1.use((0, compression.default)());
49
- app$1.use(express.default.json());
50
- app$1.use((0, cookie_parser.default)());
51
- app$1.use(express.default.urlencoded({ extended: true }));
52
- app$1.use("/api/dictionary", require_routes_dictionary_routes.dictionaryRouter);
53
- app$1.use("/api/config", require_routes_config_routes.configurationRouter);
54
- app$1.use(express.default.static(clientDistPath));
55
- app$1.get(/(.*)/, (req, res) => {
56
- const requestedPath = (0, node_path.join)(clientDistPath, req.url);
49
+ await app$1.register(_fastify_helmet.default, {
50
+ contentSecurityPolicy: false,
51
+ global: true
52
+ });
53
+ await app$1.register(_fastify_cors.default, corsOptions);
54
+ await app$1.register(_fastify_compress.default);
55
+ await app$1.register(_fastify_cookie.default);
56
+ await app$1.register(_fastify_formbody.default);
57
+ await app$1.register(require_routes_dictionary_routes.dictionaryRouter, { prefix: "/api/dictionary" });
58
+ await app$1.register(require_routes_config_routes.configurationRouter, { prefix: "/api/config" });
59
+ await app$1.register(_fastify_static.default, {
60
+ root: clientDistPath,
61
+ wildcard: false
62
+ });
63
+ app$1.setNotFoundHandler((req, reply) => {
64
+ const requestedPath = (0, node_path.join)(clientDistPath, req.raw.url || "/");
57
65
  if ((0, node_fs.existsSync)(requestedPath) && (0, node_fs.lstatSync)(requestedPath).isFile()) {
58
66
  const mimeType = mime.default.getType(requestedPath) ?? "application/octet-stream";
59
- res.setHeader("Content-Type", mimeType);
60
- res.sendFile(requestedPath);
61
- } else res.sendFile((0, node_path.resolve)(clientDistPath, "index.html"));
67
+ reply.header("Content-Type", mimeType);
68
+ return reply.sendFile(req.raw.url?.split("/").pop() || "index.html");
69
+ } else return reply.sendFile("index.html");
62
70
  });
63
- app$1.listen(port, () => {
71
+ try {
72
+ await app$1.listen({
73
+ port,
74
+ host: "0.0.0.0"
75
+ });
64
76
  const dotEnvFilePath = (0, _intlayer_config.getEnvFilePath)(envFileOptions.env, envFileOptions.envFile);
65
77
  console.log(`
66
78
  ${(0, _intlayer_config.colorize)((0, _intlayer_config.colorize)("INTLAYER", _intlayer_config.ANSIColors.BOLD), _intlayer_config.ANSIColors.GREY_DARK)} ${(0, _intlayer_config.colorize)(`v${packageJson.version}`, _intlayer_config.ANSIColors.GREY_DARK)}
@@ -70,7 +82,10 @@ const startServer = async (app$1) => {
70
82
  ${(0, _intlayer_config.colorize)("➜", _intlayer_config.ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? "-"}
71
83
  ${(0, _intlayer_config.colorize)("➜", _intlayer_config.ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? "-"}
72
84
  `);
73
- });
85
+ } catch (err) {
86
+ app$1.log.error(err);
87
+ process.exit(1);
88
+ }
74
89
  };
75
90
  startServer(app);
76
91
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["__dirname","app: Express","corsOptions: CorsOptions","checkPortAvailability","dictionaryRouter","configurationRouter","ANSIColors"],"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 {\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 compression from 'compression';\nimport cookieParser from 'cookie-parser';\nimport cors, { type CorsOptions } from 'cors';\nimport express, { type Express } from 'express';\nimport { intlayer } from 'express-intlayer';\nimport helmet from 'helmet';\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: Express = express();\n\n// Load internationalization request handler\napp.use(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: CorsOptions = {\n origin: '*',\n credentials: true,\n};\n\nconst startServer = async (app: Express) => {\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 app.disable('x-powered-by'); // Disabled to prevent attackers from knowing that the app is running Express\n app.use(\n helmet({\n contentSecurityPolicy: false,\n })\n );\n\n app.use(cors(corsOptions));\n\n // Compress all HTTP responses\n app.use(compression());\n\n app.use(express.json());\n\n app.use(cookieParser());\n\n // Parse incoming requests with urlencoded payloads\n app.use(express.urlencoded({ extended: true }));\n\n app.use('/api/dictionary', dictionaryRouter);\n app.use('/api/config', configurationRouter);\n\n app.use(express.static(clientDistPath));\n\n // For single-page applications, redirect all unmatched routes to index.html\n app.get(/(.*)/, (req, res) => {\n const requestedPath = join(clientDistPath, req.url); // Full path of the requested file\n\n if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {\n // If the requested file exists, determine its MIME type and serve it\n const mimeType =\n mime.getType(requestedPath) ?? 'application/octet-stream';\n res.setHeader('Content-Type', mimeType);\n res.sendFile(requestedPath);\n } else {\n // Otherwise, serve the index.html for React Router fallback\n res.sendFile(resolve(clientDistPath, 'index.html'));\n }\n });\n\n app.listen(port, () => {\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 });\n};\n\n// Start it up!\nstartServer(app);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,+GAAkD,CAAC;AAEzD,MAAM,iBAAiB;CACrB,KAAK,QAAQ,IAAI;CACjB,SAAS,QAAQ,IAAI;CACtB;AAGD,MAAM,cAAc,KAAK,uDACFA,aAAW,qBAAqB,EAAE,OAAO,CAC/D;AAED,MAAMC,4BAAwB;AAG9B,IAAI,oCAAc,CAAC;AAEnB,MAAM,gBAAgB;AACtB,MAAM,gDAA0B,eAAe;AAC/C,MAAM,OAAO,OAAO,OAAO,QAAQ;AAEnC,MAAM,wCAAyBD,aAAW,oBAAoB;AAE9D,MAAME,cAA2B;CAC/B,QAAQ;CACR,aAAa;CACd;AAED,MAAM,cAAc,OAAO,UAAiB;AAG1C,KAAI,CAFoB,MAAMC,0DAAsB,KAAK,EAEnC;AACpB,UAAQ,MAAM,yBAAyB,KAAK,4BAA4B;AACxE,UAAQ,KAAK,IAAI;;AAGnB,OAAI,QAAQ,eAAe;AAC3B,OAAI,wBACK,EACL,uBAAuB,OACxB,CAAC,CACH;AAED,OAAI,sBAAS,YAAY,CAAC;AAG1B,OAAI,8BAAiB,CAAC;AAEtB,OAAI,IAAI,gBAAQ,MAAM,CAAC;AAEvB,OAAI,gCAAkB,CAAC;AAGvB,OAAI,IAAI,gBAAQ,WAAW,EAAE,UAAU,MAAM,CAAC,CAAC;AAE/C,OAAI,IAAI,mBAAmBC,kDAAiB;AAC5C,OAAI,IAAI,eAAeC,iDAAoB;AAE3C,OAAI,IAAI,gBAAQ,OAAO,eAAe,CAAC;AAGvC,OAAI,IAAI,SAAS,KAAK,QAAQ;EAC5B,MAAM,oCAAqB,gBAAgB,IAAI,IAAI;AAEnD,8BAAe,cAAc,2BAAc,cAAc,CAAC,QAAQ,EAAE;GAElE,MAAM,WACJ,aAAK,QAAQ,cAAc,IAAI;AACjC,OAAI,UAAU,gBAAgB,SAAS;AACvC,OAAI,SAAS,cAAc;QAG3B,KAAI,gCAAiB,gBAAgB,aAAa,CAAC;GAErD;AAEF,OAAI,OAAO,YAAY;EACrB,MAAM,sDACJ,eAAe,KACf,eAAe,QAChB;AAED,UAAQ,IAAI;oEACQ,YAAYC,4BAAW,KAAK,EAAEA,4BAAW,UAAU,CAAC,kCAAY,IAAI,YAAY,WAAWA,4BAAW,UAAU,CAAC;;sEAEzF,oBAAoB,OAAO,CAAC;qCAC7D,KAAKA,4BAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,mBAAmB,KAAK,yCAAmB,OAAO,OAAO,eAAe,CAAC;qCAChJ,KAAKA,4BAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,YAAY,IAAI;qCACvF,KAAKA,4BAAW,UAAU,CAAC,8BAA8B,kBAAkB,IAAI;MACxF;GACF;;AAIJ,YAAY,IAAI"}
1
+ {"version":3,"file":"index.cjs","names":["__dirname","app: FastifyInstance","intlayer","corsOptions: FastifyCorsOptions","checkPortAvailability","app","fastifyHelmet","fastifyCors","fastifyCompress","fastifyCookie","fastifyFormbody","dictionaryRouter","configurationRouter","fastifyStatic","ANSIColors"],"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,MAAMA,+GAAkD,CAAC;AAEzD,MAAM,iBAAiB;CACrB,KAAK,QAAQ,IAAI;CACjB,SAAS,QAAQ,IAAI;CACtB;AAGD,MAAM,cAAc,KAAK,uDACFA,aAAW,qBAAqB,EAAE,OAAO,CAC/D;AAED,MAAMC,2BAA+B,EACnC,uBAAuB,MACxB,CAAC;AAIF,IAAI,SAASC,0BAAS;AAEtB,MAAM,gBAAgB;AACtB,MAAM,gDAA0B,eAAe;AAC/C,MAAM,OAAO,OAAO,OAAO,QAAQ;AAEnC,MAAM,wCAAyBF,aAAW,oBAAoB;AAE9D,MAAMG,cAAkC;CACtC,QAAQ;CACR,aAAa;CACd;AAED,MAAM,cAAc,OAAO,UAAyB;AAGlD,KAAI,CAFoB,MAAMC,0DAAsB,KAAK,EAEnC;AACpB,UAAQ,MAAM,yBAAyB,KAAK,4BAA4B;AACxE,UAAQ,KAAK,IAAI;;AAInB,OAAMC,MAAI,SAASC,yBAAe;EAChC,uBAAuB;EACvB,QAAQ;EACT,CAAC;AAGF,OAAMD,MAAI,SAASE,uBAAa,YAAY;AAG5C,OAAMF,MAAI,SAASG,0BAAgB;AAGnC,OAAMH,MAAI,SAASI,wBAAc;AAGjC,OAAMJ,MAAI,SAASK,0BAAgB;AAGnC,OAAML,MAAI,SAASM,mDAAkB,EAAE,QAAQ,mBAAmB,CAAC;AACnE,OAAMN,MAAI,SAASO,kDAAqB,EAAE,QAAQ,eAAe,CAAC;AAGlE,OAAMP,MAAI,SAASQ,yBAAe;EAChC,MAAM;EACN,UAAU;EACX,CAAC;AAGF,OAAI,oBAAoB,KAAK,UAAU;EACrC,MAAM,oCAAqB,gBAAgB,IAAI,IAAI,OAAO,IAAI;AAE9D,8BAAe,cAAc,2BAAc,cAAc,CAAC,QAAQ,EAAE;GAClE,MAAM,WACJ,aAAK,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,QAAMR,MAAI,OAAO;GAAE;GAAM,MAAM;GAAW,CAAC;EAE3C,MAAM,sDACJ,eAAe,KACf,eAAe,QAChB;AAED,UAAQ,IAAI;oEACQ,YAAYS,4BAAW,KAAK,EAAEA,4BAAW,UAAU,CAAC,kCAAY,IAAI,YAAY,WAAWA,4BAAW,UAAU,CAAC;;sEAEzF,oBAAoB,OAAO,CAAC;qCAC7D,KAAKA,4BAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,mBAAmB,KAAK,yCAAmB,OAAO,OAAO,eAAe,CAAC;qCAChJ,KAAKA,4BAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,YAAY,IAAI;qCACvF,KAAKA,4BAAW,UAAU,CAAC,8BAA8B,kBAAkB,IAAI;MACxF;UACK,KAAK;AACZ,QAAI,IAAI,MAAM,IAAI;AAClB,UAAQ,KAAK,EAAE;;;AAKnB,YAAY,IAAI"}