intlayer-editor 5.5.4 → 5.5.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer-editor",
3
- "version": "5.5.4",
3
+ "version": "5.5.6",
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": [
@@ -74,14 +74,14 @@
74
74
  "react-dom": "^19.0.0",
75
75
  "react-router-dom": "^7.4.0",
76
76
  "rimraf": "^6.0.1",
77
- "@intlayer/api": "5.5.4",
78
- "@intlayer/core": "5.5.4",
79
- "@intlayer/config": "5.5.4",
80
- "@intlayer/editor-react": "5.5.4",
81
- "express-intlayer": "5.5.4",
82
- "react-intlayer": "5.5.4",
83
- "@intlayer/design-system": "5.5.4",
84
- "vite-intlayer": "5.5.4"
77
+ "@intlayer/api": "5.5.6",
78
+ "@intlayer/config": "5.5.6",
79
+ "@intlayer/core": "5.5.6",
80
+ "@intlayer/design-system": "5.5.6",
81
+ "react-intlayer": "5.5.6",
82
+ "express-intlayer": "5.5.6",
83
+ "vite-intlayer": "5.5.6",
84
+ "@intlayer/editor-react": "5.5.6"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@tailwindcss/vite": "^4.0.14",
@@ -103,7 +103,7 @@
103
103
  "typescript-eslint": "^8.27.0",
104
104
  "vite": "^6.3.1",
105
105
  "vitest": "^3.0.9",
106
- "@intlayer/backend": "5.5.4"
106
+ "@intlayer/backend": "5.5.6"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "@types/compression": "^1.7.5",
@@ -114,15 +114,15 @@
114
114
  "react-dom": ">=16.0.0",
115
115
  "react-router-dom": ">=6.0.0",
116
116
  "tailwind-merge": "^3.0.2",
117
- "@intlayer/config": "5.5.4",
118
- "@intlayer/core": "5.5.4",
119
- "@intlayer/design-system": "5.5.4",
120
- "@intlayer/editor-react": "5.5.4",
121
- "react-intlayer": "5.5.4",
122
- "vite-intlayer": "5.5.4",
123
- "@intlayer/dictionaries-entry": "5.5.4",
124
- "@intlayer/chokidar": "5.5.4",
125
- "intlayer": "5.5.4"
117
+ "@intlayer/core": "5.5.6",
118
+ "@intlayer/editor-react": "5.5.6",
119
+ "@intlayer/design-system": "5.5.6",
120
+ "react-intlayer": "5.5.6",
121
+ "vite-intlayer": "5.5.6",
122
+ "@intlayer/config": "5.5.6",
123
+ "@intlayer/dictionaries-entry": "5.5.6",
124
+ "intlayer": "5.5.6",
125
+ "@intlayer/chokidar": "5.5.6"
126
126
  },
127
127
  "engines": {
128
128
  "node": ">=14.18"
@@ -23,7 +23,7 @@ __export(configuration_controller_exports, {
23
23
  module.exports = __toCommonJS(configuration_controller_exports);
24
24
  var import_config = require("@intlayer/config");
25
25
  var import_responseData = require('./../utils/responseData.cjs');
26
- const getConfiguration = async (req, res, _next) => {
26
+ const getConfiguration = async (_req, res, _next) => {
27
27
  try {
28
28
  const config = (0, import_config.getConfiguration)();
29
29
  const formattedResponse = (0, import_responseData.formatResponse)({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import {\n type IntlayerConfig,\n getConfiguration as getApplicationConfiguration,\n} from '@intlayer/config';\nimport { type ResponseData, formatResponse } 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,0BAAkD;AAQ3C,MAAM,mBAAmB,OAC9B,KACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,aAAS,cAAAA,kBAA4B;AAE3C,UAAM,wBAAoB,oCAA+B;AAAA,MACvD,MAAM;AAAA,IACR,CAAC;AAED,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,UAAM,6BAAyB,oCAA+B;AAAA,MAC5D,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAED,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":["getApplicationConfiguration"]}
1
+ {"version":3,"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import {\n type IntlayerConfig,\n getConfiguration as getApplicationConfiguration,\n} from '@intlayer/config';\nimport { type ResponseData, formatResponse } 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAGO;AACP,0BAAkD;AAQ3C,MAAM,mBAAmB,OAC9B,MACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,aAAS,cAAAA,kBAA4B;AAE3C,UAAM,wBAAoB,oCAA+B;AAAA,MACvD,MAAM;AAAA,IACR,CAAC;AAED,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,UAAM,6BAAyB,oCAA+B;AAAA,MAC5D,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAED,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":["getApplicationConfiguration"]}
@@ -5,5 +5,5 @@ export type GetConfigurationResult = ResponseData<IntlayerConfig>;
5
5
  /**
6
6
  * Get the Intlayer configuration
7
7
  */
8
- export declare const getConfiguration: (req: Request, res: Response<GetConfigurationResult>, _next: NextFunction) => Promise<void>;
8
+ export declare const getConfiguration: (_req: Request, res: Response<GetConfigurationResult>, _next: NextFunction) => Promise<void>;
9
9
  //# sourceMappingURL=configuration.controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/configuration.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,OAAO,EACZ,KAAK,QAAQ,CAAC,sBAAsB,CAAC,EACrC,OAAO,YAAY,KAClB,OAAO,CAAC,IAAI,CA4Bd,CAAC"}
1
+ {"version":3,"file":"configuration.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/configuration.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,OAAO,EACb,KAAK,QAAQ,CAAC,sBAAsB,CAAC,EACrC,OAAO,YAAY,KAClB,OAAO,CAAC,IAAI,CA4Bd,CAAC"}
@@ -2,7 +2,7 @@ import {
2
2
  getConfiguration as getApplicationConfiguration
3
3
  } from "@intlayer/config";
4
4
  import { formatResponse } from "./../utils/responseData.mjs";
5
- const getConfiguration = async (req, res, _next) => {
5
+ const getConfiguration = async (_req, res, _next) => {
6
6
  try {
7
7
  const config = getApplicationConfiguration();
8
8
  const formattedResponse = formatResponse({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import {\n type IntlayerConfig,\n getConfiguration as getApplicationConfiguration,\n} from '@intlayer/config';\nimport { type ResponseData, formatResponse } 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":"AAAA;AAAA,EAEE,oBAAoB;AAAA,OACf;AACP,SAA4B,sBAAsB;AAQ3C,MAAM,mBAAmB,OAC9B,KACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,SAAS,4BAA4B;AAE3C,UAAM,oBAAoB,eAA+B;AAAA,MACvD,MAAM;AAAA,IACR,CAAC;AAED,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,UAAM,yBAAyB,eAA+B;AAAA,MAC5D,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAED,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/controllers/configuration.controller.ts"],"sourcesContent":["import {\n type IntlayerConfig,\n getConfiguration as getApplicationConfiguration,\n} from '@intlayer/config';\nimport { type ResponseData, formatResponse } 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":"AAAA;AAAA,EAEE,oBAAoB;AAAA,OACf;AACP,SAA4B,sBAAsB;AAQ3C,MAAM,mBAAmB,OAC9B,MACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,SAAS,4BAA4B;AAE3C,UAAM,oBAAoB,eAA+B;AAAA,MACvD,MAAM;AAAA,IACR,CAAC;AAED,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,UAAM,yBAAyB,eAA+B;AAAA,MAC5D,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAED,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":[]}
@@ -37,7 +37,7 @@ var import_config = require("@intlayer/config");
37
37
  var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"), 1);
38
38
  var import_responseData = require('./../utils/responseData.cjs');
39
39
  var import_express_intlayer = require("express-intlayer");
40
- const getDictionaries = async (req, res, _next) => {
40
+ const getDictionaries = async (_req, res, _next) => {
41
41
  try {
42
42
  const formattedResponse = (0, import_responseData.formatResponse)({
43
43
  data: import_dictionaries_entry.default
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n writeContentDeclaration as writeContentDeclarationEditor,\n type DictionaryStatus,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport { type Dictionary } from '@intlayer/core';\nimport dictionaries from '@intlayer/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<Record<string, Dictionary>>;\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<Record<string, Dictionary>>({\n data: dictionaries,\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<Record<string, Dictionary>>({\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 '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 'reimported in new location': {\n description = t({\n en: 'Content declaration reimported in new location 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: 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 }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAGO;AACP,oBAAiC;AAEjC,gCAAyB;AACzB,0BAAkD;AAElD,8BAAkB;AAOX,MAAM,kBAAkB,OAC7B,KACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,wBAAoB,oCAA2C;AA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I;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,iBAAa,2BAAE;AAAA,UACb,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,IACF;AAEA,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,YAAQ,MAAM,YAAY;AAE1B,UAAM,6BACJ,oCAAkD;AAAA,MAChD,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAEH,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":["dictionaries","writeContentDeclarationEditor"]}
1
+ {"version":3,"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n writeContentDeclaration as writeContentDeclarationEditor,\n type DictionaryStatus,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport { type Dictionary } from '@intlayer/core';\nimport dictionaries from '@intlayer/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<Record<string, Dictionary>>;\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<Record<string, Dictionary>>({\n data: dictionaries,\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<Record<string, Dictionary>>({\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 '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 'reimported in new location': {\n description = t({\n en: 'Content declaration reimported in new location 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: 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 }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAGO;AACP,oBAAiC;AAEjC,gCAAyB;AACzB,0BAAkD;AAElD,8BAAkB;AAOX,MAAM,kBAAkB,OAC7B,MACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,wBAAoB,oCAA2C;AAAA,MACnE,MAAM,0BAAAA;AAAA,IACR,CAAC;AAED,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,UAAM,6BAAyB,oCAA2C;AAAA,MACxE,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAED,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;AAaO,MAAM,0BAA0B,OACrC,KACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,iBAAiB,IAAI,KAAK;AAEhC,UAAM,aAAS,gCAAiB;AAEhC,UAAM,SAAS,UAAM,gBAAAC,yBAA8B,gBAAgB,MAAM;AAEzE,QAAI,cAAc;AAElB,YAAQ,OAAO,QAAQ;AAAA,MACrB,KAAK,WAAW;AACd,0BAAc,2BAAE;AAAA,UACd,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AACD;AAAA,MACF;AAAA,MACA,KAAK,sBAAsB;AACzB,0BAAc,2BAAE;AAAA,UACd,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AACD;AAAA,MACF;AAAA,MACA,KAAK,8BAA8B;AACjC,0BAAc,2BAAE;AAAA,UACd,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AACD;AAAA,MACF;AAAA,MACA,SAAS;AACP,0BAAc,2BAAE;AAAA,UACd,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AACD;AAAA,MACF;AAAA,IACF;AAEA,UAAM,wBAAoB;AAAA,MACxB;AAAA,QACE,MAAM;AAAA,QACN,aAAS,2BAAE;AAAA,UACT,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,iBAAa,2BAAE;AAAA,UACb,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;AAAA,IACF;AAEA,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,YAAQ,MAAM,YAAY;AAE1B,UAAM,6BACJ,oCAAkD;AAAA,MAChD,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAEH,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":["dictionaries","writeContentDeclarationEditor"]}
@@ -6,7 +6,7 @@ type GetDictionariesResult = ResponseData<Record<string, Dictionary>>;
6
6
  /**
7
7
  * Get the Intlayer configuration
8
8
  */
9
- export declare const getDictionaries: (req: Request, res: Response<GetDictionariesResult>, _next: NextFunction) => Promise<void>;
9
+ export declare const getDictionaries: (_req: Request, res: Response<GetDictionariesResult>, _next: NextFunction) => Promise<void>;
10
10
  export type WriteContentDeclarationBody = {
11
11
  dictionary: Dictionary;
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/dictionary.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG/D,KAAK,qBAAqB,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,OAAO,EACZ,KAAK,QAAQ,CAAC,qBAAqB,CAAC,EACpC,OAAO,YAAY,KAClB,OAAO,CAAC,IAAI,CA0Bd,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AACrE,KAAK,iCAAiC,GAAG;IACvC,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,6BAA6B,GACvC,YAAY,CAAC,iCAAiC,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,2BAA2B,CAAC,EACnD,KAAK,QAAQ,CAAC,6BAA6B,CAAC,EAC5C,OAAO,YAAY,KAClB,OAAO,CAAC,IAAI,CAoFd,CAAC"}
1
+ {"version":3,"file":"dictionary.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/dictionary.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG/D,KAAK,qBAAqB,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,OAAO,EACb,KAAK,QAAQ,CAAC,qBAAqB,CAAC,EACpC,OAAO,YAAY,KAClB,OAAO,CAAC,IAAI,CA0Bd,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AACrE,KAAK,iCAAiC,GAAG;IACvC,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,6BAA6B,GACvC,YAAY,CAAC,iCAAiC,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,2BAA2B,CAAC,EACnD,KAAK,QAAQ,CAAC,6BAA6B,CAAC,EAC5C,OAAO,YAAY,KAClB,OAAO,CAAC,IAAI,CAoFd,CAAC"}
@@ -5,7 +5,7 @@ import { getConfiguration } from "@intlayer/config";
5
5
  import dictionaries from "@intlayer/dictionaries-entry";
6
6
  import { formatResponse } from "./../utils/responseData.mjs";
7
7
  import { t } from "express-intlayer";
8
- const getDictionaries = async (req, res, _next) => {
8
+ const getDictionaries = async (_req, res, _next) => {
9
9
  try {
10
10
  const formattedResponse = formatResponse({
11
11
  data: dictionaries
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n writeContentDeclaration as writeContentDeclarationEditor,\n type DictionaryStatus,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport { type Dictionary } from '@intlayer/core';\nimport dictionaries from '@intlayer/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<Record<string, Dictionary>>;\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<Record<string, Dictionary>>({\n data: dictionaries,\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<Record<string, Dictionary>>({\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 '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 'reimported in new location': {\n description = t({\n en: 'Content declaration reimported in new location 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: 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 }\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":"AAAA;AAAA,EACE,2BAA2B;AAAA,OAEtB;AACP,SAAS,wBAAwB;AAEjC,OAAO,kBAAkB;AACzB,SAAS,sBAAyC;AAElD,SAAS,SAAS;AAOX,MAAM,kBAAkB,OAC7B,KACA,KACA,UACkB;AAClB,MAAI;AACF,UAAM,oBAAoB,eAA2C;AAAA,MACnE,MAAM;AAAA,IACR,CAAC;AAED,QAAI,KAAK,iBAAiB;AAC1B;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,UAAM,yBAAyB,eAA2C;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,UAAM,eAAgB,OAAiD;AAAA,MACrE,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAEA,YAAQ,MAAM,YAAY;AAE1B,UAAM,yBACJ,eAAkD;AAAA,MAChD,OAAO;AAAA,QACL,SAAS,aAAa,WAAW;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,QAAQ,aAAa,UAAU;AAAA,IACjC,CAAC;AAEH,QAAI,KAAK,sBAAsB;AAC/B;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n writeContentDeclaration as writeContentDeclarationEditor,\n type DictionaryStatus,\n} from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport { type Dictionary } from '@intlayer/core';\nimport dictionaries from '@intlayer/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<Record<string, Dictionary>>;\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<Record<string, Dictionary>>({\n data: dictionaries,\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<Record<string, Dictionary>>({\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 '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 'reimported in new location': {\n description = t({\n en: 'Content declaration reimported in new location 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: 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 }\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"],"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