@intlayer/cli 7.5.9 → 7.5.10

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/README.md CHANGED
@@ -5,8 +5,11 @@
5
5
  </p>
6
6
 
7
7
  <h1 align="center">
8
- <strong> Intlayer : an Open-source, per-component i18n toolkit with AI-powered translation & CMS.</strong>
8
+ <strong>Per-component i18n</strong>
9
9
  </h1>
10
+ <h2 align="center">
11
+ <strong>AI-powered translation. Visual Editor. Multilingual CMS.</strong>
12
+ </h2>
10
13
 
11
14
  <br />
12
15
 
@@ -24,6 +27,8 @@
24
27
  <a href="https://github.com/aymericzip/intlayer/blob/main/LICENSE" target="_blank" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/github/license/aymericzip/intlayer?style=for-the-badge&labelColor=000000&color=FFFFFF&logoColor=000000&cacheSeconds=86400" alt="license"/></a>
25
28
  <a href="https://github.com/aymericzip/intlayer/commits/main" target="_blank" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/github/last-commit/aymericzip/intlayer?style=for-the-badge&labelColor=000000&color=FFFFFF&logoColor=000000&cacheSeconds=86400" alt="last commit"/>
26
29
  </a>
30
+ <a href="https://www.bountyhub.dev/en/bounty/view/a2f24259-80ae-4a19-82e7-288718fba449/adapt-markdown-parser-in-a-custom-packages" target="_blank" rel="noopener noreferrer nofollow"><img src="https://img.shields.io/badge/Bounties-on%20BountyHub-yellow?style=for-the-badge&labelColor=000000&color=FFFFFF&logoColor=000000&cacheSeconds=86400" alt="Bounties on BountyHub"/>
31
+ </a>
27
32
  </p>
28
33
 
29
34
  ![Watch the video](https://github.com/aymericzip/intlayer/blob/main/docs/assets/demo_video.gif)
@@ -46,7 +51,7 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
46
51
  | Feature | Description |
47
52
  | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48
53
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
49
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.png?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
50
55
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
51
56
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
52
57
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
@@ -268,6 +273,8 @@ You can also follow us on :
268
273
 
269
274
  For more detailed guidelines on contributing to this project, please refer to the [`CONTRIBUTING.md`](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md) file. It contains essential information on our development process, commit message conventions, and release procedures. Your contributions are valuable to us, and we appreciate your efforts in making this project better!
270
275
 
276
+ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https://gitlab.com/ay.pineau/intlayer), or [Bitbucket](https://bitbucket.org/intlayer/intlayer/).
277
+
271
278
  ### Thank You for the Support
272
279
 
273
280
  If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
@@ -7,7 +7,7 @@ let _intlayer_config = require("@intlayer/config");
7
7
  const pushConfig = async (options) => {
8
8
  const config = (0, _intlayer_config.getConfiguration)(options?.configOptions);
9
9
  const appLogger = (0, _intlayer_config.getAppLogger)(config, { config: { prefix: "" } });
10
- if (!await require_utils_checkAccess.checkCMSAuth(config)) return;
10
+ if (!await require_utils_checkAccess.checkCMSAuth(config, false)) return;
11
11
  const getDictionariesKeysResult = await (0, _intlayer_api.getIntlayerAPIProxy)(void 0, config).project.pushProjectConfiguration(config);
12
12
  if (!getDictionariesKeysResult.data) throw new Error("Error pushing project configuration");
13
13
  appLogger("Project configuration pushed successfully");
@@ -1 +1 @@
1
- {"version":3,"file":"pushConfig.cjs","names":["checkCMSAuth"],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":";;;;;;AAYA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,gDAA0B,SAAS,cAAc;CACvD,MAAM,+CAAyB,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,CAFe,MAAMA,uCAAa,OAAO,CAE5B;CAKjB,MAAM,4BACJ,6CAJsC,QAAW,OAAO,CAItC,QAAQ,yBAAyB,OAAO;AAE5D,KAAI,CAAC,0BAA0B,KAC7B,OAAM,IAAI,MAAM,sCAAsC;AAGxD,WAAU,4CAA4C;AAEtD,WAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"pushConfig.cjs","names":["checkCMSAuth"],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":";;;;;;AAYA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,gDAA0B,SAAS,cAAc;CACvD,MAAM,+CAAyB,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,CAFe,MAAMA,uCAAa,QAAQ,MAAM,CAEnC;CAKjB,MAAM,4BACJ,6CAJsC,QAAW,OAAO,CAItC,QAAQ,yBAAyB,OAAO;AAE5D,KAAI,CAAC,0BAA0B,KAC7B,OAAM,IAAI,MAAM,sCAAsC;AAGxD,WAAU,4CAA4C;AAEtD,WAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,EAAE,CAAC"}
@@ -1,24 +1,49 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_utils_checkConfigConsistency = require('./checkConfigConsistency.cjs');
2
3
  let _intlayer_api = require("@intlayer/api");
3
4
  let _intlayer_config = require("@intlayer/config");
4
5
 
5
6
  //#region src/utils/checkAccess.ts
6
- const checkCMSAuth = async (configuration) => {
7
+ const checkCMSAuth = async (configuration, shouldCheckConfigConsistency = true) => {
7
8
  const appLogger = (0, _intlayer_config.getAppLogger)(configuration, { config: { prefix: "" } });
8
9
  if (!(configuration.editor.clientId && configuration.editor.clientSecret)) {
9
- appLogger("CMS auth not provided.", { level: "error" });
10
+ appLogger([
11
+ "CMS auth not provided. You can either retreive the CMS access key on",
12
+ (0, _intlayer_config.colorize)("https://intlayer.org/dahboard", _intlayer_config.ANSIColors.GREY),
13
+ (0, _intlayer_config.colorize)("(see doc:", _intlayer_config.ANSIColors.GREY_DARK),
14
+ (0, _intlayer_config.colorize)("https://intlayer.org/doc/concept/cms", _intlayer_config.ANSIColors.GREY),
15
+ (0, _intlayer_config.colorize)(")", _intlayer_config.ANSIColors.GREY_DARK),
16
+ "."
17
+ ], { level: "error" });
10
18
  return false;
11
19
  }
12
20
  const intlayerAPI = (0, _intlayer_api.getIntlayerAPIProxy)(void 0, configuration);
13
21
  try {
14
- await intlayerAPI.oAuth.getOAuth2AccessToken();
22
+ const project = (await intlayerAPI.oAuth.getOAuth2AccessToken()).data?.project;
23
+ if (!project) {
24
+ appLogger("Project not found");
25
+ return true;
26
+ }
27
+ if (project.configuration && shouldCheckConfigConsistency) try {
28
+ require_utils_checkConfigConsistency.checkConfigConsistency(project.configuration, configuration);
29
+ } catch {
30
+ appLogger([
31
+ "Remote configuration is not up to date. The project configuration does not match the local configuration.",
32
+ "You can push the configuration by running",
33
+ (0, _intlayer_config.colorize)("npx intlayer push", _intlayer_config.ANSIColors.CYAN),
34
+ (0, _intlayer_config.colorize)("(see doc:", _intlayer_config.ANSIColors.GREY_DARK),
35
+ (0, _intlayer_config.colorize)("https://intlayer.org/doc/concept/cli/push", _intlayer_config.ANSIColors.GREY),
36
+ (0, _intlayer_config.colorize)(")", _intlayer_config.ANSIColors.GREY_DARK),
37
+ "."
38
+ ], { level: "warn" });
39
+ }
15
40
  } catch (error) {
16
41
  appLogger((0, _intlayer_config.extractErrorMessage)(error), { level: "error" });
17
42
  return false;
18
43
  }
19
44
  return true;
20
45
  };
21
- const checkAIAccess = async (configuration, aiOptions) => {
46
+ const checkAIAccess = async (configuration, aiOptions, shouldCheckConfigConsistency = true) => {
22
47
  const appLogger = (0, _intlayer_config.getAppLogger)(configuration);
23
48
  const hasCMSAuth = Boolean(configuration.editor.clientId && configuration.editor.clientSecret);
24
49
  if (Boolean(configuration.ai?.apiKey || aiOptions?.apiKey)) return true;
@@ -37,7 +62,7 @@ const checkAIAccess = async (configuration, aiOptions) => {
37
62
  ], { level: "error" });
38
63
  return false;
39
64
  }
40
- return await checkCMSAuth(configuration);
65
+ return await checkCMSAuth(configuration, shouldCheckConfigConsistency);
41
66
  };
42
67
 
43
68
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"checkAccess.cjs","names":["ANSIColors"],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getAppLogger,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger('CMS auth not provided.', {\n level: 'error',\n });\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n await intlayerAPI.oAuth.getOAuth2AccessToken();\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger(\n [\n 'AI options or API key not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '. Alternatively, you can add your own OpenAI API key in the settings',\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/configuration',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration);\n};\n"],"mappings":";;;;;AAUA,MAAa,eAAe,OAC1B,kBACqB;CACrB,MAAM,+CAAyB,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,EADF,cAAc,OAAO,YAAY,cAAc,OAAO,eACvC;AACf,YAAU,0BAA0B,EAClC,OAAO,SACR,CAAC;AAEF,SAAO;;CAET,MAAM,qDAAkC,QAAW,cAAc;AAEjE,KAAI;AACF,QAAM,YAAY,MAAM,sBAAsB;UACvC,OAAO;AAGd,sDAFoC,MAAM,EAEvB,EACjB,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,QAAO;;AAGT,MAAa,gBAAgB,OAC3B,eACA,cACqB;CACrB,MAAM,+CAAyB,cAAc;CAE7C,MAAM,aAAa,QACjB,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAKD,KAJ0B,QACxB,cAAc,IAAI,UAAU,WAAW,OACxC,CAGC,QAAO;AAIT,KAAI,CAAC,YAAY;AACf,YACE;GACE;kCACS,iCAAiCA,4BAAW,KAAK;kCACjD,aAAaA,4BAAW,UAAU;kCAClC,wCAAwCA,4BAAW,KAAK;kCACxD,KAAKA,4BAAW,UAAU;GACnC;kCACS,aAAaA,4BAAW,UAAU;kCAEzC,kDACAA,4BAAW,KACZ;kCACQ,KAAKA,4BAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;AAIT,QAAO,MAAM,aAAa,cAAc"}
1
+ {"version":3,"file":"checkAccess.cjs","names":["ANSIColors"],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getAppLogger,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { checkConfigConsistency } from './checkConfigConsistency';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger(\n [\n 'CMS auth not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n const result = await intlayerAPI.oAuth.getOAuth2AccessToken();\n\n const project = result.data?.project;\n\n if (!project) {\n appLogger('Project not found');\n\n return true;\n }\n\n if (project.configuration && shouldCheckConfigConsistency) {\n try {\n // Recursively check if project.configuration (subset) matches configuration (superset)\n checkConfigConsistency(project.configuration, configuration);\n } catch {\n appLogger(\n [\n 'Remote configuration is not up to date. The project configuration does not match the local configuration.',\n 'You can push the configuration by running',\n colorize('npx intlayer push', ANSIColors.CYAN),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/cli/push',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'warn',\n }\n );\n }\n }\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger(\n [\n 'AI options or API key not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '. Alternatively, you can add your own OpenAI API key in the settings',\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/configuration',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration, shouldCheckConfigConsistency);\n};\n"],"mappings":";;;;;;AAWA,MAAa,eAAe,OAC1B,eACA,+BAAwC,SACnB;CACrB,MAAM,+CAAyB,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,EADF,cAAc,OAAO,YAAY,cAAc,OAAO,eACvC;AACf,YACE;GACE;kCACS,iCAAiCA,4BAAW,KAAK;kCACjD,aAAaA,4BAAW,UAAU;kCAClC,wCAAwCA,4BAAW,KAAK;kCACxD,KAAKA,4BAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;CAET,MAAM,qDAAkC,QAAW,cAAc;AAEjE,KAAI;EAGF,MAAM,WAFS,MAAM,YAAY,MAAM,sBAAsB,EAEtC,MAAM;AAE7B,MAAI,CAAC,SAAS;AACZ,aAAU,oBAAoB;AAE9B,UAAO;;AAGT,MAAI,QAAQ,iBAAiB,6BAC3B,KAAI;AAEF,+DAAuB,QAAQ,eAAe,cAAc;UACtD;AACN,aACE;IACE;IACA;mCACS,qBAAqBA,4BAAW,KAAK;mCACrC,aAAaA,4BAAW,UAAU;mCAEzC,6CACAA,4BAAW,KACZ;mCACQ,KAAKA,4BAAW,UAAU;IACnC;IACD,EACD,EACE,OAAO,QACR,CACF;;UAGE,OAAO;AAGd,sDAFoC,MAAM,EAEvB,EACjB,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,QAAO;;AAGT,MAAa,gBAAgB,OAC3B,eACA,WACA,+BAAwC,SACnB;CACrB,MAAM,+CAAyB,cAAc;CAE7C,MAAM,aAAa,QACjB,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAKD,KAJ0B,QACxB,cAAc,IAAI,UAAU,WAAW,OACxC,CAGC,QAAO;AAIT,KAAI,CAAC,YAAY;AACf,YACE;GACE;kCACS,iCAAiCA,4BAAW,KAAK;kCACjD,aAAaA,4BAAW,UAAU;kCAClC,wCAAwCA,4BAAW,KAAK;kCACxD,KAAKA,4BAAW,UAAU;GACnC;kCACS,aAAaA,4BAAW,UAAU;kCAEzC,kDACAA,4BAAW,KACZ;kCACQ,KAAKA,4BAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;AAIT,QAAO,MAAM,aAAa,eAAe,6BAA6B"}
@@ -0,0 +1,24 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let node_util = require("node:util");
3
+
4
+ //#region src/utils/checkConfigConsistency.ts
5
+ /**
6
+ * Recursively checks if a subset configuration matches a superset configuration.
7
+ * Throws an error if any value in the subset doesn't match the corresponding value in the superset.
8
+ *
9
+ * @param subset - The subset configuration (e.g., project.configuration from CMS)
10
+ * @param superset - The superset configuration (e.g., local configuration)
11
+ * @throws Error if any value in subset doesn't match the corresponding value in superset
12
+ */
13
+ const checkConfigConsistency = (subset, superset) => {
14
+ Object.keys(subset).forEach((key) => {
15
+ const isSubsetObject = typeof subset[key] === "object" && subset[key] !== null && !Array.isArray(subset[key]);
16
+ const isSupersetObject = typeof superset[key] === "object" && superset[key] !== null && !Array.isArray(superset[key]);
17
+ if (isSubsetObject && isSupersetObject) checkConfigConsistency(subset[key], superset[key]);
18
+ else if (!(0, node_util.isDeepStrictEqual)(subset[key], superset[key])) throw new Error(`Configuration mismatch at key "${key}": expected ${JSON.stringify(superset[key])}, got ${JSON.stringify(subset[key])}`);
19
+ });
20
+ };
21
+
22
+ //#endregion
23
+ exports.checkConfigConsistency = checkConfigConsistency;
24
+ //# sourceMappingURL=checkConfigConsistency.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkConfigConsistency.cjs","names":[],"sources":["../../../src/utils/checkConfigConsistency.ts"],"sourcesContent":["import { isDeepStrictEqual } from 'node:util';\n\n/**\n * Recursively checks if a subset configuration matches a superset configuration.\n * Throws an error if any value in the subset doesn't match the corresponding value in the superset.\n *\n * @param subset - The subset configuration (e.g., project.configuration from CMS)\n * @param superset - The superset configuration (e.g., local configuration)\n * @throws Error if any value in subset doesn't match the corresponding value in superset\n */\nexport const checkConfigConsistency = (\n subset: Record<string, any>,\n superset: Record<string, any>\n): void => {\n Object.keys(subset).forEach((key) => {\n const isSubsetObject =\n typeof subset[key] === 'object' &&\n subset[key] !== null &&\n !Array.isArray(subset[key]);\n const isSupersetObject =\n typeof superset[key] === 'object' &&\n superset[key] !== null &&\n !Array.isArray(superset[key]);\n\n if (isSubsetObject && isSupersetObject) {\n checkConfigConsistency(subset[key], superset[key]);\n } else {\n if (!isDeepStrictEqual(subset[key], superset[key])) {\n throw new Error(\n `Configuration mismatch at key \"${key}\": expected ${JSON.stringify(superset[key])}, got ${JSON.stringify(subset[key])}`\n );\n }\n }\n });\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,0BACX,QACA,aACS;AACT,QAAO,KAAK,OAAO,CAAC,SAAS,QAAQ;EACnC,MAAM,iBACJ,OAAO,OAAO,SAAS,YACvB,OAAO,SAAS,QAChB,CAAC,MAAM,QAAQ,OAAO,KAAK;EAC7B,MAAM,mBACJ,OAAO,SAAS,SAAS,YACzB,SAAS,SAAS,QAClB,CAAC,MAAM,QAAQ,SAAS,KAAK;AAE/B,MAAI,kBAAkB,iBACpB,wBAAuB,OAAO,MAAM,SAAS,KAAK;WAE9C,kCAAmB,OAAO,MAAM,SAAS,KAAK,CAChD,OAAM,IAAI,MACR,kCAAkC,IAAI,cAAc,KAAK,UAAU,SAAS,KAAK,CAAC,QAAQ,KAAK,UAAU,OAAO,KAAK,GACtH;GAGL"}
@@ -6,7 +6,7 @@ import { getAppLogger, getConfiguration } from "@intlayer/config";
6
6
  const pushConfig = async (options) => {
7
7
  const config = getConfiguration(options?.configOptions);
8
8
  const appLogger = getAppLogger(config, { config: { prefix: "" } });
9
- if (!await checkCMSAuth(config)) return;
9
+ if (!await checkCMSAuth(config, false)) return;
10
10
  const getDictionariesKeysResult = await getIntlayerAPIProxy(void 0, config).project.pushProjectConfiguration(config);
11
11
  if (!getDictionariesKeysResult.data) throw new Error("Error pushing project configuration");
12
12
  appLogger("Project configuration pushed successfully");
@@ -1 +1 @@
1
- {"version":3,"file":"pushConfig.mjs","names":[],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":";;;;;AAYA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,MAAM,YAAY,aAAa,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,CAFe,MAAM,aAAa,OAAO,CAE5B;CAKjB,MAAM,4BACJ,MAJkB,oBAAoB,QAAW,OAAO,CAItC,QAAQ,yBAAyB,OAAO;AAE5D,KAAI,CAAC,0BAA0B,KAC7B,OAAM,IAAI,MAAM,sCAAsC;AAGxD,WAAU,4CAA4C;AAEtD,WAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"pushConfig.mjs","names":[],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":";;;;;AAYA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,MAAM,YAAY,aAAa,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,CAFe,MAAM,aAAa,QAAQ,MAAM,CAEnC;CAKjB,MAAM,4BACJ,MAJkB,oBAAoB,QAAW,OAAO,CAItC,QAAQ,yBAAyB,OAAO;AAE5D,KAAI,CAAC,0BAA0B,KAC7B,OAAM,IAAI,MAAM,sCAAsC;AAGxD,WAAU,4CAA4C;AAEtD,WAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,EAAE,CAAC"}
@@ -1,23 +1,48 @@
1
+ import { checkConfigConsistency } from "./checkConfigConsistency.mjs";
1
2
  import { getIntlayerAPIProxy } from "@intlayer/api";
2
3
  import { ANSIColors, colorize, extractErrorMessage, getAppLogger } from "@intlayer/config";
3
4
 
4
5
  //#region src/utils/checkAccess.ts
5
- const checkCMSAuth = async (configuration) => {
6
+ const checkCMSAuth = async (configuration, shouldCheckConfigConsistency = true) => {
6
7
  const appLogger = getAppLogger(configuration, { config: { prefix: "" } });
7
8
  if (!(configuration.editor.clientId && configuration.editor.clientSecret)) {
8
- appLogger("CMS auth not provided.", { level: "error" });
9
+ appLogger([
10
+ "CMS auth not provided. You can either retreive the CMS access key on",
11
+ colorize("https://intlayer.org/dahboard", ANSIColors.GREY),
12
+ colorize("(see doc:", ANSIColors.GREY_DARK),
13
+ colorize("https://intlayer.org/doc/concept/cms", ANSIColors.GREY),
14
+ colorize(")", ANSIColors.GREY_DARK),
15
+ "."
16
+ ], { level: "error" });
9
17
  return false;
10
18
  }
11
19
  const intlayerAPI = getIntlayerAPIProxy(void 0, configuration);
12
20
  try {
13
- await intlayerAPI.oAuth.getOAuth2AccessToken();
21
+ const project = (await intlayerAPI.oAuth.getOAuth2AccessToken()).data?.project;
22
+ if (!project) {
23
+ appLogger("Project not found");
24
+ return true;
25
+ }
26
+ if (project.configuration && shouldCheckConfigConsistency) try {
27
+ checkConfigConsistency(project.configuration, configuration);
28
+ } catch {
29
+ appLogger([
30
+ "Remote configuration is not up to date. The project configuration does not match the local configuration.",
31
+ "You can push the configuration by running",
32
+ colorize("npx intlayer push", ANSIColors.CYAN),
33
+ colorize("(see doc:", ANSIColors.GREY_DARK),
34
+ colorize("https://intlayer.org/doc/concept/cli/push", ANSIColors.GREY),
35
+ colorize(")", ANSIColors.GREY_DARK),
36
+ "."
37
+ ], { level: "warn" });
38
+ }
14
39
  } catch (error) {
15
40
  appLogger(extractErrorMessage(error), { level: "error" });
16
41
  return false;
17
42
  }
18
43
  return true;
19
44
  };
20
- const checkAIAccess = async (configuration, aiOptions) => {
45
+ const checkAIAccess = async (configuration, aiOptions, shouldCheckConfigConsistency = true) => {
21
46
  const appLogger = getAppLogger(configuration);
22
47
  const hasCMSAuth = Boolean(configuration.editor.clientId && configuration.editor.clientSecret);
23
48
  if (Boolean(configuration.ai?.apiKey || aiOptions?.apiKey)) return true;
@@ -36,7 +61,7 @@ const checkAIAccess = async (configuration, aiOptions) => {
36
61
  ], { level: "error" });
37
62
  return false;
38
63
  }
39
- return await checkCMSAuth(configuration);
64
+ return await checkCMSAuth(configuration, shouldCheckConfigConsistency);
40
65
  };
41
66
 
42
67
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"checkAccess.mjs","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getAppLogger,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger('CMS auth not provided.', {\n level: 'error',\n });\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n await intlayerAPI.oAuth.getOAuth2AccessToken();\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger(\n [\n 'AI options or API key not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '. Alternatively, you can add your own OpenAI API key in the settings',\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/configuration',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration);\n};\n"],"mappings":";;;;AAUA,MAAa,eAAe,OAC1B,kBACqB;CACrB,MAAM,YAAY,aAAa,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,EADF,cAAc,OAAO,YAAY,cAAc,OAAO,eACvC;AACf,YAAU,0BAA0B,EAClC,OAAO,SACR,CAAC;AAEF,SAAO;;CAET,MAAM,cAAc,oBAAoB,QAAW,cAAc;AAEjE,KAAI;AACF,QAAM,YAAY,MAAM,sBAAsB;UACvC,OAAO;AAGd,YAFgB,oBAAoB,MAAM,EAEvB,EACjB,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,QAAO;;AAGT,MAAa,gBAAgB,OAC3B,eACA,cACqB;CACrB,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,aAAa,QACjB,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAKD,KAJ0B,QACxB,cAAc,IAAI,UAAU,WAAW,OACxC,CAGC,QAAO;AAIT,KAAI,CAAC,YAAY;AACf,YACE;GACE;GACA,SAAS,iCAAiC,WAAW,KAAK;GAC1D,SAAS,aAAa,WAAW,UAAU;GAC3C,SAAS,wCAAwC,WAAW,KAAK;GACjE,SAAS,KAAK,WAAW,UAAU;GACnC;GACA,SAAS,aAAa,WAAW,UAAU;GAC3C,SACE,kDACA,WAAW,KACZ;GACD,SAAS,KAAK,WAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;AAIT,QAAO,MAAM,aAAa,cAAc"}
1
+ {"version":3,"file":"checkAccess.mjs","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getAppLogger,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { checkConfigConsistency } from './checkConfigConsistency';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger(\n [\n 'CMS auth not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n const result = await intlayerAPI.oAuth.getOAuth2AccessToken();\n\n const project = result.data?.project;\n\n if (!project) {\n appLogger('Project not found');\n\n return true;\n }\n\n if (project.configuration && shouldCheckConfigConsistency) {\n try {\n // Recursively check if project.configuration (subset) matches configuration (superset)\n checkConfigConsistency(project.configuration, configuration);\n } catch {\n appLogger(\n [\n 'Remote configuration is not up to date. The project configuration does not match the local configuration.',\n 'You can push the configuration by running',\n colorize('npx intlayer push', ANSIColors.CYAN),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/cli/push',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'warn',\n }\n );\n }\n }\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger(\n [\n 'AI options or API key not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '. Alternatively, you can add your own OpenAI API key in the settings',\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/configuration',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration, shouldCheckConfigConsistency);\n};\n"],"mappings":";;;;;AAWA,MAAa,eAAe,OAC1B,eACA,+BAAwC,SACnB;CACrB,MAAM,YAAY,aAAa,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,EADF,cAAc,OAAO,YAAY,cAAc,OAAO,eACvC;AACf,YACE;GACE;GACA,SAAS,iCAAiC,WAAW,KAAK;GAC1D,SAAS,aAAa,WAAW,UAAU;GAC3C,SAAS,wCAAwC,WAAW,KAAK;GACjE,SAAS,KAAK,WAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;CAET,MAAM,cAAc,oBAAoB,QAAW,cAAc;AAEjE,KAAI;EAGF,MAAM,WAFS,MAAM,YAAY,MAAM,sBAAsB,EAEtC,MAAM;AAE7B,MAAI,CAAC,SAAS;AACZ,aAAU,oBAAoB;AAE9B,UAAO;;AAGT,MAAI,QAAQ,iBAAiB,6BAC3B,KAAI;AAEF,0BAAuB,QAAQ,eAAe,cAAc;UACtD;AACN,aACE;IACE;IACA;IACA,SAAS,qBAAqB,WAAW,KAAK;IAC9C,SAAS,aAAa,WAAW,UAAU;IAC3C,SACE,6CACA,WAAW,KACZ;IACD,SAAS,KAAK,WAAW,UAAU;IACnC;IACD,EACD,EACE,OAAO,QACR,CACF;;UAGE,OAAO;AAGd,YAFgB,oBAAoB,MAAM,EAEvB,EACjB,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,QAAO;;AAGT,MAAa,gBAAgB,OAC3B,eACA,WACA,+BAAwC,SACnB;CACrB,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,aAAa,QACjB,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAKD,KAJ0B,QACxB,cAAc,IAAI,UAAU,WAAW,OACxC,CAGC,QAAO;AAIT,KAAI,CAAC,YAAY;AACf,YACE;GACE;GACA,SAAS,iCAAiC,WAAW,KAAK;GAC1D,SAAS,aAAa,WAAW,UAAU;GAC3C,SAAS,wCAAwC,WAAW,KAAK;GACjE,SAAS,KAAK,WAAW,UAAU;GACnC;GACA,SAAS,aAAa,WAAW,UAAU;GAC3C,SACE,kDACA,WAAW,KACZ;GACD,SAAS,KAAK,WAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;AAIT,QAAO,MAAM,aAAa,eAAe,6BAA6B"}
@@ -0,0 +1,23 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+
3
+ //#region src/utils/checkConfigConsistency.ts
4
+ /**
5
+ * Recursively checks if a subset configuration matches a superset configuration.
6
+ * Throws an error if any value in the subset doesn't match the corresponding value in the superset.
7
+ *
8
+ * @param subset - The subset configuration (e.g., project.configuration from CMS)
9
+ * @param superset - The superset configuration (e.g., local configuration)
10
+ * @throws Error if any value in subset doesn't match the corresponding value in superset
11
+ */
12
+ const checkConfigConsistency = (subset, superset) => {
13
+ Object.keys(subset).forEach((key) => {
14
+ const isSubsetObject = typeof subset[key] === "object" && subset[key] !== null && !Array.isArray(subset[key]);
15
+ const isSupersetObject = typeof superset[key] === "object" && superset[key] !== null && !Array.isArray(superset[key]);
16
+ if (isSubsetObject && isSupersetObject) checkConfigConsistency(subset[key], superset[key]);
17
+ else if (!isDeepStrictEqual(subset[key], superset[key])) throw new Error(`Configuration mismatch at key "${key}": expected ${JSON.stringify(superset[key])}, got ${JSON.stringify(subset[key])}`);
18
+ });
19
+ };
20
+
21
+ //#endregion
22
+ export { checkConfigConsistency };
23
+ //# sourceMappingURL=checkConfigConsistency.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkConfigConsistency.mjs","names":[],"sources":["../../../src/utils/checkConfigConsistency.ts"],"sourcesContent":["import { isDeepStrictEqual } from 'node:util';\n\n/**\n * Recursively checks if a subset configuration matches a superset configuration.\n * Throws an error if any value in the subset doesn't match the corresponding value in the superset.\n *\n * @param subset - The subset configuration (e.g., project.configuration from CMS)\n * @param superset - The superset configuration (e.g., local configuration)\n * @throws Error if any value in subset doesn't match the corresponding value in superset\n */\nexport const checkConfigConsistency = (\n subset: Record<string, any>,\n superset: Record<string, any>\n): void => {\n Object.keys(subset).forEach((key) => {\n const isSubsetObject =\n typeof subset[key] === 'object' &&\n subset[key] !== null &&\n !Array.isArray(subset[key]);\n const isSupersetObject =\n typeof superset[key] === 'object' &&\n superset[key] !== null &&\n !Array.isArray(superset[key]);\n\n if (isSubsetObject && isSupersetObject) {\n checkConfigConsistency(subset[key], superset[key]);\n } else {\n if (!isDeepStrictEqual(subset[key], superset[key])) {\n throw new Error(\n `Configuration mismatch at key \"${key}\": expected ${JSON.stringify(superset[key])}, got ${JSON.stringify(subset[key])}`\n );\n }\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,0BACX,QACA,aACS;AACT,QAAO,KAAK,OAAO,CAAC,SAAS,QAAQ;EACnC,MAAM,iBACJ,OAAO,OAAO,SAAS,YACvB,OAAO,SAAS,QAChB,CAAC,MAAM,QAAQ,OAAO,KAAK;EAC7B,MAAM,mBACJ,OAAO,SAAS,SAAS,YACzB,SAAS,SAAS,QAClB,CAAC,MAAM,QAAQ,SAAS,KAAK;AAE/B,MAAI,kBAAkB,iBACpB,wBAAuB,OAAO,MAAM,SAAS,KAAK;WAE9C,CAAC,kBAAkB,OAAO,MAAM,SAAS,KAAK,CAChD,OAAM,IAAI,MACR,kCAAkC,IAAI,cAAc,KAAK,UAAU,SAAS,KAAK,CAAC,QAAQ,KAAK,UAAU,OAAO,KAAK,GACtH;GAGL"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","names":[],"sources":["../../src/config.ts"],"sourcesContent":[],"mappings":";;;KAMK,aAAA;kBACa;AAHQ,CAAA;AAMb,cAAA,SAAuB,EAAA,CAAA,OAAa,CAAA,EAAb,aAAa,EAAA,GAAA,IAAA"}
1
+ {"version":3,"file":"config.d.ts","names":[],"sources":["../../src/config.ts"],"sourcesContent":[],"mappings":";;;KAMK,aAAA;kBACa;AAHQ,CAAA;AAMb,cAAA,SAAuB,EAAA,CAAA,OAAa,CAAb,EAAA,aAAa,EAAA,GAAA,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pull.d.ts","names":[],"sources":["../../src/pull.ts"],"sourcesContent":[],"mappings":";;;KAmBK,WAAA;;EAAA,mBAAW,CAAA,EAAA,MAGE;EAcL,aA8OZ,CAAA,EA5PiB,uBAciC;;;;;;cAAtC,iBAAwB,gBAAc"}
1
+ {"version":3,"file":"pull.d.ts","names":[],"sources":["../../src/pull.ts"],"sourcesContent":[],"mappings":";;;KAmBK,WAAA;;EAAA,mBAAW,CAAA,EAAA,MAGE;EAcL,aA8OZ,CAAA,EA5PiB,uBAcwC;;;;;;cAA7C,iBAAwB,gBAAc"}
@@ -2,8 +2,8 @@ import { IntlayerConfig } from "@intlayer/types";
2
2
  import { AIOptions } from "@intlayer/api";
3
3
 
4
4
  //#region src/utils/checkAccess.d.ts
5
- declare const checkCMSAuth: (configuration: IntlayerConfig) => Promise<boolean>;
6
- declare const checkAIAccess: (configuration: IntlayerConfig, aiOptions?: AIOptions) => Promise<boolean>;
5
+ declare const checkCMSAuth: (configuration: IntlayerConfig, shouldCheckConfigConsistency?: boolean) => Promise<boolean>;
6
+ declare const checkAIAccess: (configuration: IntlayerConfig, aiOptions?: AIOptions, shouldCheckConfigConsistency?: boolean) => Promise<boolean>;
7
7
  //#endregion
8
8
  export { checkAIAccess, checkCMSAuth };
9
9
  //# sourceMappingURL=checkAccess.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":[],"mappings":";;;;cAUa,8BACI,mBACd;cAgCU,+BACI,4BACH,cACX"}
1
+ {"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":[],"mappings":";;;;cAWa,8BACI,2DAEd;cA2EU,+BACI,4BACH,sDAEX"}
@@ -0,0 +1,13 @@
1
+ //#region src/utils/checkConfigConsistency.d.ts
2
+ /**
3
+ * Recursively checks if a subset configuration matches a superset configuration.
4
+ * Throws an error if any value in the subset doesn't match the corresponding value in the superset.
5
+ *
6
+ * @param subset - The subset configuration (e.g., project.configuration from CMS)
7
+ * @param superset - The superset configuration (e.g., local configuration)
8
+ * @throws Error if any value in subset doesn't match the corresponding value in superset
9
+ */
10
+ declare const checkConfigConsistency: (subset: Record<string, any>, superset: Record<string, any>) => void;
11
+ //#endregion
12
+ export { checkConfigConsistency };
13
+ //# sourceMappingURL=checkConfigConsistency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkConfigConsistency.d.ts","names":[],"sources":["../../../src/utils/checkConfigConsistency.ts"],"sourcesContent":[],"mappings":";;AAUA;;;;;;;cAAa,iCACH,+BACE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/cli",
3
- "version": "7.5.9",
3
+ "version": "7.5.10",
4
4
  "private": false,
5
5
  "description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
6
6
  "keywords": [
@@ -68,14 +68,14 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@clack/prompts": "^0.11.0",
71
- "@intlayer/api": "7.5.9",
72
- "@intlayer/chokidar": "7.5.9",
73
- "@intlayer/config": "7.5.9",
74
- "@intlayer/core": "7.5.9",
75
- "@intlayer/dictionaries-entry": "7.5.9",
76
- "@intlayer/remote-dictionaries-entry": "7.5.9",
77
- "@intlayer/types": "7.5.9",
78
- "@intlayer/unmerged-dictionaries-entry": "7.5.9",
71
+ "@intlayer/api": "7.5.10",
72
+ "@intlayer/chokidar": "7.5.10",
73
+ "@intlayer/config": "7.5.10",
74
+ "@intlayer/core": "7.5.10",
75
+ "@intlayer/dictionaries-entry": "7.5.10",
76
+ "@intlayer/remote-dictionaries-entry": "7.5.10",
77
+ "@intlayer/types": "7.5.10",
78
+ "@intlayer/unmerged-dictionaries-entry": "7.5.10",
79
79
  "commander": "14.0.1",
80
80
  "eventsource": "3.0.7",
81
81
  "fast-glob": "3.3.3"
@@ -91,7 +91,7 @@
91
91
  "vitest": "4.0.16"
92
92
  },
93
93
  "peerDependencies": {
94
- "@intlayer/ai": "7.5.9"
94
+ "@intlayer/ai": "7.5.10"
95
95
  },
96
96
  "peerDependenciesMeta": {
97
97
  "@intlayer/ai": {