@intlayer/chokidar 5.5.10 → 5.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 (34) hide show
  1. package/dist/cjs/cleanOutputDir.cjs +4 -0
  2. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  3. package/dist/cjs/fetchDistantDictionaries.cjs +5 -1
  4. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  5. package/dist/cjs/fetchDistantDictionaryKeys.cjs +5 -1
  6. package/dist/cjs/fetchDistantDictionaryKeys.cjs.map +1 -1
  7. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs +4 -31
  8. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs.map +1 -1
  9. package/dist/cjs/utils/resolveObjectPromises.cjs +51 -0
  10. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -0
  11. package/dist/cjs/utils/resolveObjectPromises.test.cjs +107 -0
  12. package/dist/cjs/utils/resolveObjectPromises.test.cjs.map +1 -0
  13. package/dist/esm/cleanOutputDir.mjs +4 -0
  14. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  15. package/dist/esm/fetchDistantDictionaries.mjs +5 -1
  16. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  17. package/dist/esm/fetchDistantDictionaryKeys.mjs +5 -1
  18. package/dist/esm/fetchDistantDictionaryKeys.mjs.map +1 -1
  19. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs +3 -29
  20. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs.map +1 -1
  21. package/dist/esm/utils/resolveObjectPromises.mjs +27 -0
  22. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -0
  23. package/dist/esm/utils/resolveObjectPromises.test.mjs +106 -0
  24. package/dist/esm/utils/resolveObjectPromises.test.mjs.map +1 -0
  25. package/dist/types/cleanOutputDir.d.ts.map +1 -1
  26. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  27. package/dist/types/fetchDistantDictionaryKeys.d.ts.map +1 -1
  28. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts +0 -5
  29. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts.map +1 -1
  30. package/dist/types/utils/resolveObjectPromises.d.ts +6 -0
  31. package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -0
  32. package/dist/types/utils/resolveObjectPromises.test.d.ts +2 -0
  33. package/dist/types/utils/resolveObjectPromises.test.d.ts.map +1 -0
  34. package/package.json +16 -14
@@ -27,6 +27,7 @@ const cleanOutputDir = (configuration = (0, import_config.getConfiguration)()) =
27
27
  const {
28
28
  dictionariesDir,
29
29
  unmergedDictionariesDir,
30
+ dynamicDictionariesDir,
30
31
  mainDir,
31
32
  typesDir,
32
33
  configDir
@@ -38,6 +39,9 @@ const cleanOutputDir = (configuration = (0, import_config.getConfiguration)()) =
38
39
  if ((0, import_fs.existsSync)(unmergedDictionariesDir)) {
39
40
  (0, import_fs.rmSync)(unmergedDictionariesDir, { recursive: true });
40
41
  }
42
+ if ((0, import_fs.existsSync)(dynamicDictionariesDir)) {
43
+ (0, import_fs.rmSync)(dynamicDictionariesDir, { recursive: true });
44
+ }
41
45
  if ((0, import_fs.existsSync)(mainDir)) {
42
46
  (0, import_fs.rmSync)(mainDir, { recursive: true });
43
47
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { getAppLogger, getConfiguration } from '@intlayer/config';\nimport { existsSync, rmSync } from 'fs';\n\nexport const cleanOutputDir = (configuration = getConfiguration()) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAC/C,gBAAmC;AAE5B,MAAM,iBAAiB,CAAC,oBAAgB,gCAAiB,MAAM;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc;AAElB,QAAM,gBAAY,4BAAa,aAAa;AAE5C,UAAI,sBAAW,eAAe,GAAG;AAE/B,0BAAO,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAAA,EAC7C;AAEA,UAAI,sBAAW,uBAAuB,GAAG;AAEvC,0BAAO,yBAAyB,EAAE,WAAW,KAAK,CAAC;AAAA,EACrD;AAGA,UAAI,sBAAW,OAAO,GAAG;AACvB,0BAAO,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACrC;AAGA,UAAI,sBAAW,QAAQ,GAAG;AACxB,0BAAO,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACtC;AAGA,UAAI,sBAAW,SAAS,GAAG;AACzB,0BAAO,WAAW,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC;AAEA,YAAU,4BAA4B;AAAA,IACpC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { getAppLogger, getConfiguration } from '@intlayer/config';\nimport { existsSync, rmSync } from 'fs';\n\nexport const cleanOutputDir = (configuration = getConfiguration()) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n if (existsSync(dynamicDictionariesDir)) {\n // Delete the dynamic dictionaries directory\n rmSync(dynamicDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAC/C,gBAAmC;AAE5B,MAAM,iBAAiB,CAAC,oBAAgB,gCAAiB,MAAM;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc;AAElB,QAAM,gBAAY,4BAAa,aAAa;AAE5C,UAAI,sBAAW,eAAe,GAAG;AAE/B,0BAAO,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAAA,EAC7C;AAEA,UAAI,sBAAW,uBAAuB,GAAG;AAEvC,0BAAO,yBAAyB,EAAE,WAAW,KAAK,CAAC;AAAA,EACrD;AAEA,UAAI,sBAAW,sBAAsB,GAAG;AAEtC,0BAAO,wBAAwB,EAAE,WAAW,KAAK,CAAC;AAAA,EACpD;AAGA,UAAI,sBAAW,OAAO,GAAG;AACvB,0BAAO,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACrC;AAGA,UAAI,sBAAW,QAAQ,GAAG;AACxB,0BAAO,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACtC;AAGA,UAAI,sBAAW,SAAS,GAAG;AACzB,0BAAO,WAAW,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC;AAEA,YAAU,4BAA4B;AAAA,IACpC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -64,7 +64,11 @@ const fetchDistantDictionaries = async (options) => {
64
64
  dictionaryKey,
65
65
  void 0,
66
66
  {
67
- headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
67
+ ...oAuth2AccessToken && {
68
+ headers: {
69
+ Authorization: `Bearer ${oAuth2AccessToken}`
70
+ }
71
+ }
68
72
  }
69
73
  );
70
74
  const distantDictionary = getDictionaryResult.data;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getAuthAPI, getDictionaryAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration } from '@intlayer/config';\nimport pLimit from 'p-limit';\nimport { logger } from './log';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getAuthAPI(undefined, config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: { status: 'fetching' },\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n logger.updateStatus([\n { dictionaryKey, type: 'distant', status: { status: 'imported' } },\n ]);\n\n return distantDictionary;\n } catch (error) {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: {\n status: 'error',\n error: error as Error,\n errorMessage: `${options?.logPrefix ?? ''}Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n },\n ]);\n return undefined;\n }\n };\n\n const fetchPromises = distantDictionariesKeys.map((dictionaryKey) =>\n limit(async () => await processDictionary(dictionaryKey))\n );\n\n const result = await Promise.all(fetchPromises);\n\n // Output any error messages\n const statuses = logger.getStatuses();\n for (const statusObj of statuses) {\n const currentState = statusObj.state.find((s) => s.type === 'distant');\n if (currentState && currentState.errorMessage) {\n appLogger(currentState.errorMessage, { level: 'error' });\n }\n }\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict): dict is DictionaryAPI => dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(error, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA6C;AAG7C,oBAA+C;AAC/C,qBAAmB;AACnB,iBAAuB;AAWhB,MAAM,2BAA2B,OACtC,YAC6B;AAC7B,QAAM,aAAS,gCAAiB;AAChC,QAAM,gBAAY,4BAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,cAAU,uBAAW,QAAW,MAAM;AAC5C,UAAM,oBAAgB,6BAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAGxC,UAAM,YAAQ,eAAAA,SAAO,CAAC;AAEtB,UAAM,oBAAoB,OACxB,kBACuC;AACvC,wBAAO,aAAa;AAAA,QAClB;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ,EAAE,QAAQ,WAAW;AAAA,QAC/B;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,UAC1D;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,0BAAO,aAAa;AAAA,UAClB,EAAE,eAAe,MAAM,WAAW,QAAQ,EAAE,QAAQ,WAAW,EAAE;AAAA,QACnE,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,0BAAO,aAAa;AAAA,UAClB;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,QAAQ;AAAA,cACR;AAAA,cACA,cAAc,GAAG,SAAS,aAAa,EAAE,6BAA6B,aAAa,KAAK,KAAK;AAAA,YAC/F;AAAA,UACF;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,gBAAgB,wBAAwB;AAAA,MAAI,CAAC,kBACjD,MAAM,YAAY,MAAM,kBAAkB,aAAa,CAAC;AAAA,IAC1D;AAEA,UAAM,SAAS,MAAM,QAAQ,IAAI,aAAa;AAG9C,UAAM,WAAW,kBAAO,YAAY;AACpC,eAAW,aAAa,UAAU;AAChC,YAAM,eAAe,UAAU,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACrE,UAAI,gBAAgB,aAAa,cAAc;AAC7C,kBAAU,aAAa,cAAc,EAAE,OAAO,QAAQ,CAAC;AAAA,MACzD;AAAA,IACF;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SAAgC,SAAS;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,cAAU,OAAO,EAAE,OAAO,QAAQ,CAAC;AACnC,WAAO,CAAC;AAAA,EACV;AACF;","names":["pLimit"]}
1
+ {"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getAuthAPI, getDictionaryAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration } from '@intlayer/config';\nimport pLimit from 'p-limit';\nimport { logger } from './log';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getAuthAPI(undefined, config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: { status: 'fetching' },\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n logger.updateStatus([\n { dictionaryKey, type: 'distant', status: { status: 'imported' } },\n ]);\n\n return distantDictionary;\n } catch (error) {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: {\n status: 'error',\n error: error as Error,\n errorMessage: `${options?.logPrefix ?? ''}Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n },\n ]);\n return undefined;\n }\n };\n\n const fetchPromises = distantDictionariesKeys.map((dictionaryKey) =>\n limit(async () => await processDictionary(dictionaryKey))\n );\n\n const result = await Promise.all(fetchPromises);\n\n // Output any error messages\n const statuses = logger.getStatuses();\n for (const statusObj of statuses) {\n const currentState = statusObj.state.find((s) => s.type === 'distant');\n if (currentState && currentState.errorMessage) {\n appLogger(currentState.errorMessage, { level: 'error' });\n }\n }\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict): dict is DictionaryAPI => dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(error, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA6C;AAG7C,oBAA+C;AAC/C,qBAAmB;AACnB,iBAAuB;AAWhB,MAAM,2BAA2B,OACtC,YAC6B;AAC7B,QAAM,aAAS,gCAAiB;AAChC,QAAM,gBAAY,4BAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,cAAU,uBAAW,QAAW,MAAM;AAC5C,UAAM,oBAAgB,6BAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAGxC,UAAM,YAAQ,eAAAA,SAAO,CAAC;AAEtB,UAAM,oBAAoB,OACxB,kBACuC;AACvC,wBAAO,aAAa;AAAA,QAClB;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ,EAAE,QAAQ,WAAW;AAAA,QAC/B;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,GAAI,qBAAqB;AAAA,cACvB,SAAS;AAAA,gBACP,eAAe,UAAU,iBAAiB;AAAA,cAC5C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,0BAAO,aAAa;AAAA,UAClB,EAAE,eAAe,MAAM,WAAW,QAAQ,EAAE,QAAQ,WAAW,EAAE;AAAA,QACnE,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,0BAAO,aAAa;AAAA,UAClB;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,QAAQ;AAAA,cACR;AAAA,cACA,cAAc,GAAG,SAAS,aAAa,EAAE,6BAA6B,aAAa,KAAK,KAAK;AAAA,YAC/F;AAAA,UACF;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,gBAAgB,wBAAwB;AAAA,MAAI,CAAC,kBACjD,MAAM,YAAY,MAAM,kBAAkB,aAAa,CAAC;AAAA,IAC1D;AAEA,UAAM,SAAS,MAAM,QAAQ,IAAI,aAAa;AAG9C,UAAM,WAAW,kBAAO,YAAY;AACpC,eAAW,aAAa,UAAU;AAChC,YAAM,eAAe,UAAU,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACrE,UAAI,gBAAgB,aAAa,cAAc;AAC7C,kBAAU,aAAa,cAAc,EAAE,OAAO,QAAQ,CAAC;AAAA,MACzD;AAAA,IACF;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SAAgC,SAAS;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,cAAU,OAAO,EAAE,OAAO,QAAQ,CAAC;AACnC,WAAO,CAAC;AAAA,EACV;AACF;","names":["pLimit"]}
@@ -34,7 +34,11 @@ const fetchDistantDictionaryKeys = async (configuration = (0, import_config.getC
34
34
  const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();
35
35
  const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
36
36
  const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesKeys({
37
- headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
37
+ ...oAuth2AccessToken && {
38
+ headers: {
39
+ Authorization: `Bearer ${oAuth2AccessToken}`
40
+ }
41
+ }
38
42
  });
39
43
  if (!getDictionariesKeysResult.data) {
40
44
  throw new Error("No distant dictionaries found");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesKeys: string[] = getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesKeys;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA+B;AAC/B,oBAAsD;AAE/C,MAAM,6BAA6B,OACxC,oBAAgC,gCAAiB,MAC3B;AACtB,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,2BAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,oBAAoB;AAAA,IAC/C,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,EAC1D,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,0BAAoC,0BAA0B;AAGpE,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesKeys: string[] = getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesKeys;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA+B;AAC/B,oBAAsD;AAE/C,MAAM,6BAA6B,OACxC,oBAAgC,gCAAiB,MAC3B;AACtB,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,2BAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,oBAAoB;AAAA,IAC/C,GAAI,qBAAqB;AAAA,MACvB,SAAS;AAAA,QACP,eAAe,UAAU,iBAAiB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,0BAAoC,0BAA0B;AAGpE,SAAO;AACT;","names":[]}
@@ -18,40 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var processContentDeclaration_exports = {};
20
20
  __export(processContentDeclaration_exports, {
21
- processContentDeclaration: () => processContentDeclaration,
22
- resolveContentPromises: () => resolveContentPromises
21
+ processContentDeclaration: () => processContentDeclaration
23
22
  });
24
23
  module.exports = __toCommonJS(processContentDeclaration_exports);
25
24
  var import_client = require("@intlayer/config/client");
26
- const resolveContentPromises = async (entry) => {
27
- if (entry && typeof entry.then === "function") {
28
- const awaited = await entry;
29
- return resolveContentPromises(awaited);
30
- }
31
- if (typeof entry === "function") {
32
- const result = entry();
33
- return resolveContentPromises(result);
34
- }
35
- if (Array.isArray(entry)) {
36
- return Promise.all(
37
- entry.map(async (item) => resolveContentPromises(item))
38
- );
39
- }
40
- if (entry && typeof entry === "object") {
41
- const result = {};
42
- const keys = Object.keys(entry);
43
- await Promise.all(
44
- keys.map(async (key) => {
45
- result[key] = await resolveContentPromises(entry[key]);
46
- })
47
- );
48
- return result;
49
- }
50
- return entry;
51
- };
25
+ var import_resolveObjectPromises = require('../../../utils/resolveObjectPromises.cjs');
52
26
  const processContentDeclaration = async (contentDeclaration) => {
53
27
  try {
54
- const content = await resolveContentPromises(
28
+ const content = await (0, import_resolveObjectPromises.resolveObjectPromises)(
55
29
  contentDeclaration.content
56
30
  );
57
31
  return {
@@ -66,7 +40,6 @@ const processContentDeclaration = async (contentDeclaration) => {
66
40
  };
67
41
  // Annotate the CommonJS export names for ESM import in node:
68
42
  0 && (module.exports = {
69
- processContentDeclaration,
70
- resolveContentPromises
43
+ processContentDeclaration
71
44
  });
72
45
  //# sourceMappingURL=processContentDeclaration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\n\n/**\n * A more \"unified\" approach where each type (function, array, object, primitive)\n * is handled inside the main recursive body.\n */\nexport const resolveContentPromises = async <T = unknown>(\n entry: any\n): Promise<T> => {\n // Check if entry is a Promise (Thenable)\n if (entry && typeof entry.then === 'function') {\n const awaited = await entry;\n return resolveContentPromises(awaited);\n }\n\n // If entry is a function, invoke it and process the result\n if (typeof entry === 'function') {\n const result = entry();\n return resolveContentPromises(result);\n }\n\n if (Array.isArray(entry)) {\n return Promise.all(\n entry.map(async (item) => resolveContentPromises(item))\n ) as unknown as T;\n }\n\n if (entry && typeof entry === 'object') {\n const result: Record<string, any> = {};\n const keys = Object.keys(entry);\n await Promise.all(\n keys.map(async (key) => {\n result[key] = await resolveContentPromises(entry[key]);\n })\n );\n return result as T;\n }\n\n return entry as T;\n};\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveContentPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAOhB,MAAM,yBAAyB,OACpC,UACe;AAEf,MAAI,SAAS,OAAO,MAAM,SAAS,YAAY;AAC7C,UAAM,UAAU,MAAM;AACtB,WAAO,uBAAuB,OAAO;AAAA,EACvC;AAGA,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,SAAS,MAAM;AACrB,WAAO,uBAAuB,MAAM;AAAA,EACtC;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,QAAQ;AAAA,MACb,MAAM,IAAI,OAAO,SAAS,uBAAuB,IAAI,CAAC;AAAA,IACxD;AAAA,EACF;AAEA,MAAI,SAAS,OAAO,UAAU,UAAU;AACtC,UAAM,SAA8B,CAAC;AACrC,UAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,UAAM,QAAQ;AAAA,MACZ,KAAK,IAAI,OAAO,QAAQ;AACtB,eAAO,GAAG,IAAI,MAAM,uBAAuB,MAAM,GAAG,CAAC;AAAA,MACvD,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAKO,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,MAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,8BAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { resolveObjectPromises } from '../../../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAEvB,mCAAsC;AAK/B,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,UAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,8BAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var resolveObjectPromises_exports = {};
20
+ __export(resolveObjectPromises_exports, {
21
+ resolveObjectPromises: () => resolveObjectPromises
22
+ });
23
+ module.exports = __toCommonJS(resolveObjectPromises_exports);
24
+ const resolveObjectPromises = async (entry) => {
25
+ if (entry && typeof entry.then === "function") {
26
+ const awaited = await entry;
27
+ return resolveObjectPromises(awaited);
28
+ }
29
+ if (typeof entry === "function") {
30
+ const result = entry();
31
+ return resolveObjectPromises(result);
32
+ }
33
+ if (Array.isArray(entry)) {
34
+ return Promise.all(
35
+ entry.map(async (item) => resolveObjectPromises(item))
36
+ );
37
+ }
38
+ if (entry && typeof entry === "object") {
39
+ const result = {};
40
+ for (const key of Object.keys(entry)) {
41
+ result[key] = await resolveObjectPromises(entry[key]);
42
+ }
43
+ return result;
44
+ }
45
+ return entry;
46
+ };
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ resolveObjectPromises
50
+ });
51
+ //# sourceMappingURL=resolveObjectPromises.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/resolveObjectPromises.ts"],"sourcesContent":["/**\n * A more \"unified\" approach where each type (function, array, object, primitive)\n * is handled inside the main recursive body.\n */\nexport const resolveObjectPromises = async <T = unknown>(\n entry: any\n): Promise<T> => {\n // Check if entry is a Promise (Thenable)\n if (entry && typeof entry.then === 'function') {\n const awaited = await entry;\n return resolveObjectPromises(awaited);\n }\n\n // If entry is a function, invoke it and process the result\n if (typeof entry === 'function') {\n const result = entry();\n return resolveObjectPromises(result);\n }\n\n if (Array.isArray(entry)) {\n return Promise.all(\n entry.map(async (item) => resolveObjectPromises(item))\n ) as unknown as T;\n }\n\n // Handle plain objects (but not arrays)\n if (entry && typeof entry === 'object') {\n // Arrays are handled in the `Array.isArray` branch above, so we know `entry` is a plain object here.\n\n const result: Record<string, any> = {};\n\n // Iterate over keys **sequentially** to make sure the insertion order of the\n // resulting object matches the original key order. Using `Promise.all` here\n // could lead to out-of-order insertions when asynchronous resolutions\n // finish at different times.\n for (const key of Object.keys(entry)) {\n result[key] = await resolveObjectPromises(entry[key]);\n }\n\n return result as T;\n }\n\n return entry as T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,wBAAwB,OACnC,UACe;AAEf,MAAI,SAAS,OAAO,MAAM,SAAS,YAAY;AAC7C,UAAM,UAAU,MAAM;AACtB,WAAO,sBAAsB,OAAO;AAAA,EACtC;AAGA,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,SAAS,MAAM;AACrB,WAAO,sBAAsB,MAAM;AAAA,EACrC;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,QAAQ;AAAA,MACb,MAAM,IAAI,OAAO,SAAS,sBAAsB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAGA,MAAI,SAAS,OAAO,UAAU,UAAU;AAGtC,UAAM,SAA8B,CAAC;AAMrC,eAAW,OAAO,OAAO,KAAK,KAAK,GAAG;AACpC,aAAO,GAAG,IAAI,MAAM,sBAAsB,MAAM,GAAG,CAAC;AAAA,IACtD;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var import_vitest = require("vitest");
3
+ var import_resolveObjectPromises = require('./resolveObjectPromises.cjs');
4
+ const getKeysInOrder = (obj) => {
5
+ return Object.keys(obj);
6
+ };
7
+ const delay = async (ms) => {
8
+ await new Promise((resolve) => setTimeout(resolve, ms));
9
+ };
10
+ const testCase = {
11
+ test1: 1,
12
+ test2: () => 2,
13
+ test3: async () => 3,
14
+ test4: [
15
+ 41,
16
+ () => 42,
17
+ async () => {
18
+ await delay(100);
19
+ return 43;
20
+ },
21
+ [
22
+ Promise.resolve(44),
23
+ async () => {
24
+ await delay(100);
25
+ return 45;
26
+ },
27
+ 46
28
+ ]
29
+ ],
30
+ test5: {
31
+ test51: () => 51,
32
+ test52: () => 52,
33
+ test53: () => 53
34
+ },
35
+ test6: {
36
+ test61: {
37
+ test611: 611,
38
+ test612: 612,
39
+ test613: 613
40
+ }
41
+ },
42
+ test7: {
43
+ test71: async () => {
44
+ await delay(100);
45
+ return {
46
+ test711: async () => 711,
47
+ test712: async () => {
48
+ await delay(100);
49
+ return 712;
50
+ },
51
+ test713: async () => {
52
+ await delay(100);
53
+ return [
54
+ 7131,
55
+ async () => {
56
+ await delay(100);
57
+ return 7132;
58
+ },
59
+ async () => {
60
+ await delay(100);
61
+ return 7133;
62
+ },
63
+ 7134
64
+ ];
65
+ },
66
+ test714: 714
67
+ };
68
+ }
69
+ },
70
+ test8: 8
71
+ };
72
+ const testCaseResolved = {
73
+ test1: 1,
74
+ test2: 2,
75
+ test3: 3,
76
+ test4: [41, 42, 43, [44, 45, 46]],
77
+ test5: {
78
+ test51: 51,
79
+ test52: 52,
80
+ test53: 53
81
+ },
82
+ test6: {
83
+ test61: {
84
+ test611: 611,
85
+ test612: 612,
86
+ test613: 613
87
+ }
88
+ },
89
+ test7: {
90
+ test71: {
91
+ test711: 711,
92
+ test712: 712,
93
+ test713: [7131, 7132, 7133, 7134],
94
+ test714: 714
95
+ }
96
+ },
97
+ test8: 8
98
+ };
99
+ (0, import_vitest.describe)("resolveObjectPromises", () => {
100
+ (0, import_vitest.it)("should the result be in the same order as the original object", async () => {
101
+ const resolved = await (0, import_resolveObjectPromises.resolveObjectPromises)(testCase);
102
+ (0, import_vitest.expect)(JSON.stringify(resolved)).toStrictEqual(
103
+ JSON.stringify(testCaseResolved)
104
+ );
105
+ });
106
+ });
107
+ //# sourceMappingURL=resolveObjectPromises.test.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/resolveObjectPromises.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { resolveObjectPromises } from './resolveObjectPromises';\n\n// Helper to extract keys order of an object\nconst getKeysInOrder = (obj: Record<string, unknown>): string[] => {\n return Object.keys(obj);\n};\n\nconst delay = async (ms: number) => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n\nconst testCase = {\n test1: 1,\n test2: () => 2,\n test3: async () => 3,\n test4: [\n 41,\n () => 42,\n async () => {\n await delay(100);\n return 43;\n },\n [\n Promise.resolve(44),\n async () => {\n await delay(100);\n return 45;\n },\n 46,\n ],\n ],\n test5: {\n test51: () => 51,\n test52: () => 52,\n test53: () => 53,\n },\n test6: {\n test61: {\n test611: 611,\n test612: 612,\n test613: 613,\n },\n },\n test7: {\n test71: async () => {\n await delay(100);\n return {\n test711: async () => 711,\n test712: async () => {\n await delay(100);\n return 712;\n },\n test713: async () => {\n await delay(100);\n return [\n 7131,\n async () => {\n await delay(100);\n return 7132;\n },\n async () => {\n await delay(100);\n return 7133;\n },\n 7134,\n ];\n },\n test714: 714,\n };\n },\n },\n test8: 8,\n};\n\nconst testCaseResolved = {\n test1: 1,\n test2: 2,\n test3: 3,\n test4: [41, 42, 43, [44, 45, 46]],\n test5: {\n test51: 51,\n test52: 52,\n test53: 53,\n },\n test6: {\n test61: {\n test611: 611,\n test612: 612,\n test613: 613,\n },\n },\n test7: {\n test71: {\n test711: 711,\n test712: 712,\n test713: [7131, 7132, 7133, 7134],\n test714: 714,\n },\n },\n test8: 8,\n};\n\ndescribe('resolveObjectPromises', () => {\n it('should the result be in the same order as the original object', async () => {\n const resolved = await resolveObjectPromises<typeof testCase>(testCase);\n\n // Stringify the objects to ensure the order of the keys is the same\n expect(JSON.stringify(resolved)).toStrictEqual(\n JSON.stringify(testCaseResolved)\n );\n });\n});\n"],"mappings":";AAAA,oBAAqC;AACrC,mCAAsC;AAGtC,MAAM,iBAAiB,CAAC,QAA2C;AACjE,SAAO,OAAO,KAAK,GAAG;AACxB;AAEA,MAAM,QAAQ,OAAO,OAAe;AAClC,QAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACxD;AAEA,MAAM,WAAW;AAAA,EACf,OAAO;AAAA,EACP,OAAO,MAAM;AAAA,EACb,OAAO,YAAY;AAAA,EACnB,OAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,YAAY;AACV,YAAM,MAAM,GAAG;AACf,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,QAAQ,QAAQ,EAAE;AAAA,MAClB,YAAY;AACV,cAAM,MAAM,GAAG;AACf,eAAO;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ,YAAY;AAClB,YAAM,MAAM,GAAG;AACf,aAAO;AAAA,QACL,SAAS,YAAY;AAAA,QACrB,SAAS,YAAY;AACnB,gBAAM,MAAM,GAAG;AACf,iBAAO;AAAA,QACT;AAAA,QACA,SAAS,YAAY;AACnB,gBAAM,MAAM,GAAG;AACf,iBAAO;AAAA,YACL;AAAA,YACA,YAAY;AACV,oBAAM,MAAM,GAAG;AACf,qBAAO;AAAA,YACT;AAAA,YACA,YAAY;AACV,oBAAM,MAAM,GAAG;AACf,qBAAO;AAAA,YACT;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,mBAAmB;AAAA,EACvB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AAAA,EAChC,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,MAAM,MAAM,IAAI;AAAA,MAChC,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAAA,IAEA,wBAAS,yBAAyB,MAAM;AACtC,wBAAG,iEAAiE,YAAY;AAC9E,UAAM,WAAW,UAAM,oDAAuC,QAAQ;AAGtE,8BAAO,KAAK,UAAU,QAAQ,CAAC,EAAE;AAAA,MAC/B,KAAK,UAAU,gBAAgB;AAAA,IACjC;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
@@ -4,6 +4,7 @@ const cleanOutputDir = (configuration = getConfiguration()) => {
4
4
  const {
5
5
  dictionariesDir,
6
6
  unmergedDictionariesDir,
7
+ dynamicDictionariesDir,
7
8
  mainDir,
8
9
  typesDir,
9
10
  configDir
@@ -15,6 +16,9 @@ const cleanOutputDir = (configuration = getConfiguration()) => {
15
16
  if (existsSync(unmergedDictionariesDir)) {
16
17
  rmSync(unmergedDictionariesDir, { recursive: true });
17
18
  }
19
+ if (existsSync(dynamicDictionariesDir)) {
20
+ rmSync(dynamicDictionariesDir, { recursive: true });
21
+ }
18
22
  if (existsSync(mainDir)) {
19
23
  rmSync(mainDir, { recursive: true });
20
24
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { getAppLogger, getConfiguration } from '@intlayer/config';\nimport { existsSync, rmSync } from 'fs';\n\nexport const cleanOutputDir = (configuration = getConfiguration()) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA,SAAS,cAAc,wBAAwB;AAC/C,SAAS,YAAY,cAAc;AAE5B,MAAM,iBAAiB,CAAC,gBAAgB,iBAAiB,MAAM;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc;AAElB,QAAM,YAAY,aAAa,aAAa;AAE5C,MAAI,WAAW,eAAe,GAAG;AAE/B,WAAO,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAAA,EAC7C;AAEA,MAAI,WAAW,uBAAuB,GAAG;AAEvC,WAAO,yBAAyB,EAAE,WAAW,KAAK,CAAC;AAAA,EACrD;AAGA,MAAI,WAAW,OAAO,GAAG;AACvB,WAAO,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACrC;AAGA,MAAI,WAAW,QAAQ,GAAG;AACxB,WAAO,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACtC;AAGA,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,WAAW,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC;AAEA,YAAU,4BAA4B;AAAA,IACpC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { getAppLogger, getConfiguration } from '@intlayer/config';\nimport { existsSync, rmSync } from 'fs';\n\nexport const cleanOutputDir = (configuration = getConfiguration()) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n if (existsSync(dynamicDictionariesDir)) {\n // Delete the dynamic dictionaries directory\n rmSync(dynamicDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA,SAAS,cAAc,wBAAwB;AAC/C,SAAS,YAAY,cAAc;AAE5B,MAAM,iBAAiB,CAAC,gBAAgB,iBAAiB,MAAM;AACpE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc;AAElB,QAAM,YAAY,aAAa,aAAa;AAE5C,MAAI,WAAW,eAAe,GAAG;AAE/B,WAAO,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAAA,EAC7C;AAEA,MAAI,WAAW,uBAAuB,GAAG;AAEvC,WAAO,yBAAyB,EAAE,WAAW,KAAK,CAAC;AAAA,EACrD;AAEA,MAAI,WAAW,sBAAsB,GAAG;AAEtC,WAAO,wBAAwB,EAAE,WAAW,KAAK,CAAC;AAAA,EACpD;AAGA,MAAI,WAAW,OAAO,GAAG;AACvB,WAAO,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACrC;AAGA,MAAI,WAAW,QAAQ,GAAG;AACxB,WAAO,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACtC;AAGA,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,WAAW,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC;AAEA,YAAU,4BAA4B;AAAA,IACpC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -31,7 +31,11 @@ const fetchDistantDictionaries = async (options) => {
31
31
  dictionaryKey,
32
32
  void 0,
33
33
  {
34
- headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
34
+ ...oAuth2AccessToken && {
35
+ headers: {
36
+ Authorization: `Bearer ${oAuth2AccessToken}`
37
+ }
38
+ }
35
39
  }
36
40
  );
37
41
  const distantDictionary = getDictionaryResult.data;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getAuthAPI, getDictionaryAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration } from '@intlayer/config';\nimport pLimit from 'p-limit';\nimport { logger } from './log';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getAuthAPI(undefined, config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: { status: 'fetching' },\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n logger.updateStatus([\n { dictionaryKey, type: 'distant', status: { status: 'imported' } },\n ]);\n\n return distantDictionary;\n } catch (error) {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: {\n status: 'error',\n error: error as Error,\n errorMessage: `${options?.logPrefix ?? ''}Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n },\n ]);\n return undefined;\n }\n };\n\n const fetchPromises = distantDictionariesKeys.map((dictionaryKey) =>\n limit(async () => await processDictionary(dictionaryKey))\n );\n\n const result = await Promise.all(fetchPromises);\n\n // Output any error messages\n const statuses = logger.getStatuses();\n for (const statusObj of statuses) {\n const currentState = statusObj.state.find((s) => s.type === 'distant');\n if (currentState && currentState.errorMessage) {\n appLogger(currentState.errorMessage, { level: 'error' });\n }\n }\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict): dict is DictionaryAPI => dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(error, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"AAAA,SAAS,YAAY,wBAAwB;AAG7C,SAAS,cAAc,wBAAwB;AAC/C,OAAO,YAAY;AACnB,SAAS,cAAc;AAWhB,MAAM,2BAA2B,OACtC,YAC6B;AAC7B,QAAM,SAAS,iBAAiB;AAChC,QAAM,YAAY,aAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,UAAU,WAAW,QAAW,MAAM;AAC5C,UAAM,gBAAgB,iBAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAGxC,UAAM,QAAQ,OAAO,CAAC;AAEtB,UAAM,oBAAoB,OACxB,kBACuC;AACvC,aAAO,aAAa;AAAA,QAClB;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ,EAAE,QAAQ,WAAW;AAAA,QAC/B;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,UAC1D;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,eAAO,aAAa;AAAA,UAClB,EAAE,eAAe,MAAM,WAAW,QAAQ,EAAE,QAAQ,WAAW,EAAE;AAAA,QACnE,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,eAAO,aAAa;AAAA,UAClB;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,QAAQ;AAAA,cACR;AAAA,cACA,cAAc,GAAG,SAAS,aAAa,EAAE,6BAA6B,aAAa,KAAK,KAAK;AAAA,YAC/F;AAAA,UACF;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,gBAAgB,wBAAwB;AAAA,MAAI,CAAC,kBACjD,MAAM,YAAY,MAAM,kBAAkB,aAAa,CAAC;AAAA,IAC1D;AAEA,UAAM,SAAS,MAAM,QAAQ,IAAI,aAAa;AAG9C,UAAM,WAAW,OAAO,YAAY;AACpC,eAAW,aAAa,UAAU;AAChC,YAAM,eAAe,UAAU,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACrE,UAAI,gBAAgB,aAAa,cAAc;AAC7C,kBAAU,aAAa,cAAc,EAAE,OAAO,QAAQ,CAAC;AAAA,MACzD;AAAA,IACF;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SAAgC,SAAS;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,cAAU,OAAO,EAAE,OAAO,QAAQ,CAAC;AACnC,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getAuthAPI, getDictionaryAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration } from '@intlayer/config';\nimport pLimit from 'p-limit';\nimport { logger } from './log';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getAuthAPI(undefined, config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: { status: 'fetching' },\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n logger.updateStatus([\n { dictionaryKey, type: 'distant', status: { status: 'imported' } },\n ]);\n\n return distantDictionary;\n } catch (error) {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: {\n status: 'error',\n error: error as Error,\n errorMessage: `${options?.logPrefix ?? ''}Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n },\n ]);\n return undefined;\n }\n };\n\n const fetchPromises = distantDictionariesKeys.map((dictionaryKey) =>\n limit(async () => await processDictionary(dictionaryKey))\n );\n\n const result = await Promise.all(fetchPromises);\n\n // Output any error messages\n const statuses = logger.getStatuses();\n for (const statusObj of statuses) {\n const currentState = statusObj.state.find((s) => s.type === 'distant');\n if (currentState && currentState.errorMessage) {\n appLogger(currentState.errorMessage, { level: 'error' });\n }\n }\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict): dict is DictionaryAPI => dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(error, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"AAAA,SAAS,YAAY,wBAAwB;AAG7C,SAAS,cAAc,wBAAwB;AAC/C,OAAO,YAAY;AACnB,SAAS,cAAc;AAWhB,MAAM,2BAA2B,OACtC,YAC6B;AAC7B,QAAM,SAAS,iBAAiB;AAChC,QAAM,YAAY,aAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,UAAU,WAAW,QAAW,MAAM;AAC5C,UAAM,gBAAgB,iBAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAGxC,UAAM,QAAQ,OAAO,CAAC;AAEtB,UAAM,oBAAoB,OACxB,kBACuC;AACvC,aAAO,aAAa;AAAA,QAClB;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ,EAAE,QAAQ,WAAW;AAAA,QAC/B;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,GAAI,qBAAqB;AAAA,cACvB,SAAS;AAAA,gBACP,eAAe,UAAU,iBAAiB;AAAA,cAC5C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,eAAO,aAAa;AAAA,UAClB,EAAE,eAAe,MAAM,WAAW,QAAQ,EAAE,QAAQ,WAAW,EAAE;AAAA,QACnE,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,eAAO,aAAa;AAAA,UAClB;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,QAAQ;AAAA,cACR;AAAA,cACA,cAAc,GAAG,SAAS,aAAa,EAAE,6BAA6B,aAAa,KAAK,KAAK;AAAA,YAC/F;AAAA,UACF;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,gBAAgB,wBAAwB;AAAA,MAAI,CAAC,kBACjD,MAAM,YAAY,MAAM,kBAAkB,aAAa,CAAC;AAAA,IAC1D;AAEA,UAAM,SAAS,MAAM,QAAQ,IAAI,aAAa;AAG9C,UAAM,WAAW,OAAO,YAAY;AACpC,eAAW,aAAa,UAAU;AAChC,YAAM,eAAe,UAAU,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACrE,UAAI,gBAAgB,aAAa,cAAc;AAC7C,kBAAU,aAAa,cAAc,EAAE,OAAO,QAAQ,CAAC;AAAA,MACzD;AAAA,IACF;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SAAgC,SAAS;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,cAAU,OAAO,EAAE,OAAO,QAAQ,CAAC;AACnC,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -11,7 +11,11 @@ const fetchDistantDictionaryKeys = async (configuration = getConfiguration()) =>
11
11
  const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();
12
12
  const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
13
13
  const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesKeys({
14
- headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
14
+ ...oAuth2AccessToken && {
15
+ headers: {
16
+ Authorization: `Bearer ${oAuth2AccessToken}`
17
+ }
18
+ }
15
19
  });
16
20
  if (!getDictionariesKeysResult.data) {
17
21
  throw new Error("No distant dictionaries found");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesKeys: string[] = getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesKeys;\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,wBAA6C;AAE/C,MAAM,6BAA6B,OACxC,gBAAgC,iBAAiB,MAC3B;AACtB,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,eAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,oBAAoB;AAAA,IAC/C,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,EAC1D,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,0BAAoC,0BAA0B;AAGpE,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/fetchDistantDictionaryKeys.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeys = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesKeys({\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesKeys: string[] = getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesKeys;\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,wBAA6C;AAE/C,MAAM,6BAA6B,OACxC,gBAAgC,iBAAiB,MAC3B;AACtB,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,eAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,oBAAoB;AAAA,IAC/C,GAAI,qBAAqB;AAAA,MACvB,SAAS;AAAA,QACP,eAAe,UAAU,iBAAiB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,0BAAoC,0BAA0B;AAGpE,SAAO;AACT;","names":[]}
@@ -1,33 +1,8 @@
1
1
  import { logger } from "@intlayer/config/client";
2
- const resolveContentPromises = async (entry) => {
3
- if (entry && typeof entry.then === "function") {
4
- const awaited = await entry;
5
- return resolveContentPromises(awaited);
6
- }
7
- if (typeof entry === "function") {
8
- const result = entry();
9
- return resolveContentPromises(result);
10
- }
11
- if (Array.isArray(entry)) {
12
- return Promise.all(
13
- entry.map(async (item) => resolveContentPromises(item))
14
- );
15
- }
16
- if (entry && typeof entry === "object") {
17
- const result = {};
18
- const keys = Object.keys(entry);
19
- await Promise.all(
20
- keys.map(async (key) => {
21
- result[key] = await resolveContentPromises(entry[key]);
22
- })
23
- );
24
- return result;
25
- }
26
- return entry;
27
- };
2
+ import { resolveObjectPromises } from "../../../utils/resolveObjectPromises.mjs";
28
3
  const processContentDeclaration = async (contentDeclaration) => {
29
4
  try {
30
- const content = await resolveContentPromises(
5
+ const content = await resolveObjectPromises(
31
6
  contentDeclaration.content
32
7
  );
33
8
  return {
@@ -41,7 +16,6 @@ const processContentDeclaration = async (contentDeclaration) => {
41
16
  }
42
17
  };
43
18
  export {
44
- processContentDeclaration,
45
- resolveContentPromises
19
+ processContentDeclaration
46
20
  };
47
21
  //# sourceMappingURL=processContentDeclaration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\n\n/**\n * A more \"unified\" approach where each type (function, array, object, primitive)\n * is handled inside the main recursive body.\n */\nexport const resolveContentPromises = async <T = unknown>(\n entry: any\n): Promise<T> => {\n // Check if entry is a Promise (Thenable)\n if (entry && typeof entry.then === 'function') {\n const awaited = await entry;\n return resolveContentPromises(awaited);\n }\n\n // If entry is a function, invoke it and process the result\n if (typeof entry === 'function') {\n const result = entry();\n return resolveContentPromises(result);\n }\n\n if (Array.isArray(entry)) {\n return Promise.all(\n entry.map(async (item) => resolveContentPromises(item))\n ) as unknown as T;\n }\n\n if (entry && typeof entry === 'object') {\n const result: Record<string, any> = {};\n const keys = Object.keys(entry);\n await Promise.all(\n keys.map(async (key) => {\n result[key] = await resolveContentPromises(entry[key]);\n })\n );\n return result as T;\n }\n\n return entry as T;\n};\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveContentPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"AAAA,SAAS,cAAc;AAOhB,MAAM,yBAAyB,OACpC,UACe;AAEf,MAAI,SAAS,OAAO,MAAM,SAAS,YAAY;AAC7C,UAAM,UAAU,MAAM;AACtB,WAAO,uBAAuB,OAAO;AAAA,EACvC;AAGA,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,SAAS,MAAM;AACrB,WAAO,uBAAuB,MAAM;AAAA,EACtC;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,QAAQ;AAAA,MACb,MAAM,IAAI,OAAO,SAAS,uBAAuB,IAAI,CAAC;AAAA,IACxD;AAAA,EACF;AAEA,MAAI,SAAS,OAAO,UAAU,UAAU;AACtC,UAAM,SAA8B,CAAC;AACrC,UAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,UAAM,QAAQ;AAAA,MACZ,KAAK,IAAI,OAAO,QAAQ;AACtB,eAAO,GAAG,IAAI,MAAM,uBAAuB,MAAM,GAAG,CAAC;AAAA,MACvD,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAKO,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,MAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,WAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { resolveObjectPromises } from '../../../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":"AAAA,SAAS,cAAc;AAEvB,SAAS,6BAA6B;AAK/B,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,MAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,WAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,27 @@
1
+ const resolveObjectPromises = async (entry) => {
2
+ if (entry && typeof entry.then === "function") {
3
+ const awaited = await entry;
4
+ return resolveObjectPromises(awaited);
5
+ }
6
+ if (typeof entry === "function") {
7
+ const result = entry();
8
+ return resolveObjectPromises(result);
9
+ }
10
+ if (Array.isArray(entry)) {
11
+ return Promise.all(
12
+ entry.map(async (item) => resolveObjectPromises(item))
13
+ );
14
+ }
15
+ if (entry && typeof entry === "object") {
16
+ const result = {};
17
+ for (const key of Object.keys(entry)) {
18
+ result[key] = await resolveObjectPromises(entry[key]);
19
+ }
20
+ return result;
21
+ }
22
+ return entry;
23
+ };
24
+ export {
25
+ resolveObjectPromises
26
+ };
27
+ //# sourceMappingURL=resolveObjectPromises.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/resolveObjectPromises.ts"],"sourcesContent":["/**\n * A more \"unified\" approach where each type (function, array, object, primitive)\n * is handled inside the main recursive body.\n */\nexport const resolveObjectPromises = async <T = unknown>(\n entry: any\n): Promise<T> => {\n // Check if entry is a Promise (Thenable)\n if (entry && typeof entry.then === 'function') {\n const awaited = await entry;\n return resolveObjectPromises(awaited);\n }\n\n // If entry is a function, invoke it and process the result\n if (typeof entry === 'function') {\n const result = entry();\n return resolveObjectPromises(result);\n }\n\n if (Array.isArray(entry)) {\n return Promise.all(\n entry.map(async (item) => resolveObjectPromises(item))\n ) as unknown as T;\n }\n\n // Handle plain objects (but not arrays)\n if (entry && typeof entry === 'object') {\n // Arrays are handled in the `Array.isArray` branch above, so we know `entry` is a plain object here.\n\n const result: Record<string, any> = {};\n\n // Iterate over keys **sequentially** to make sure the insertion order of the\n // resulting object matches the original key order. Using `Promise.all` here\n // could lead to out-of-order insertions when asynchronous resolutions\n // finish at different times.\n for (const key of Object.keys(entry)) {\n result[key] = await resolveObjectPromises(entry[key]);\n }\n\n return result as T;\n }\n\n return entry as T;\n};\n"],"mappings":"AAIO,MAAM,wBAAwB,OACnC,UACe;AAEf,MAAI,SAAS,OAAO,MAAM,SAAS,YAAY;AAC7C,UAAM,UAAU,MAAM;AACtB,WAAO,sBAAsB,OAAO;AAAA,EACtC;AAGA,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,SAAS,MAAM;AACrB,WAAO,sBAAsB,MAAM;AAAA,EACrC;AAEA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,QAAQ;AAAA,MACb,MAAM,IAAI,OAAO,SAAS,sBAAsB,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AAGA,MAAI,SAAS,OAAO,UAAU,UAAU;AAGtC,UAAM,SAA8B,CAAC;AAMrC,eAAW,OAAO,OAAO,KAAK,KAAK,GAAG;AACpC,aAAO,GAAG,IAAI,MAAM,sBAAsB,MAAM,GAAG,CAAC;AAAA,IACtD;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,106 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { resolveObjectPromises } from "./resolveObjectPromises.mjs";
3
+ const getKeysInOrder = (obj) => {
4
+ return Object.keys(obj);
5
+ };
6
+ const delay = async (ms) => {
7
+ await new Promise((resolve) => setTimeout(resolve, ms));
8
+ };
9
+ const testCase = {
10
+ test1: 1,
11
+ test2: () => 2,
12
+ test3: async () => 3,
13
+ test4: [
14
+ 41,
15
+ () => 42,
16
+ async () => {
17
+ await delay(100);
18
+ return 43;
19
+ },
20
+ [
21
+ Promise.resolve(44),
22
+ async () => {
23
+ await delay(100);
24
+ return 45;
25
+ },
26
+ 46
27
+ ]
28
+ ],
29
+ test5: {
30
+ test51: () => 51,
31
+ test52: () => 52,
32
+ test53: () => 53
33
+ },
34
+ test6: {
35
+ test61: {
36
+ test611: 611,
37
+ test612: 612,
38
+ test613: 613
39
+ }
40
+ },
41
+ test7: {
42
+ test71: async () => {
43
+ await delay(100);
44
+ return {
45
+ test711: async () => 711,
46
+ test712: async () => {
47
+ await delay(100);
48
+ return 712;
49
+ },
50
+ test713: async () => {
51
+ await delay(100);
52
+ return [
53
+ 7131,
54
+ async () => {
55
+ await delay(100);
56
+ return 7132;
57
+ },
58
+ async () => {
59
+ await delay(100);
60
+ return 7133;
61
+ },
62
+ 7134
63
+ ];
64
+ },
65
+ test714: 714
66
+ };
67
+ }
68
+ },
69
+ test8: 8
70
+ };
71
+ const testCaseResolved = {
72
+ test1: 1,
73
+ test2: 2,
74
+ test3: 3,
75
+ test4: [41, 42, 43, [44, 45, 46]],
76
+ test5: {
77
+ test51: 51,
78
+ test52: 52,
79
+ test53: 53
80
+ },
81
+ test6: {
82
+ test61: {
83
+ test611: 611,
84
+ test612: 612,
85
+ test613: 613
86
+ }
87
+ },
88
+ test7: {
89
+ test71: {
90
+ test711: 711,
91
+ test712: 712,
92
+ test713: [7131, 7132, 7133, 7134],
93
+ test714: 714
94
+ }
95
+ },
96
+ test8: 8
97
+ };
98
+ describe("resolveObjectPromises", () => {
99
+ it("should the result be in the same order as the original object", async () => {
100
+ const resolved = await resolveObjectPromises(testCase);
101
+ expect(JSON.stringify(resolved)).toStrictEqual(
102
+ JSON.stringify(testCaseResolved)
103
+ );
104
+ });
105
+ });
106
+ //# sourceMappingURL=resolveObjectPromises.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/resolveObjectPromises.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { resolveObjectPromises } from './resolveObjectPromises';\n\n// Helper to extract keys order of an object\nconst getKeysInOrder = (obj: Record<string, unknown>): string[] => {\n return Object.keys(obj);\n};\n\nconst delay = async (ms: number) => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n\nconst testCase = {\n test1: 1,\n test2: () => 2,\n test3: async () => 3,\n test4: [\n 41,\n () => 42,\n async () => {\n await delay(100);\n return 43;\n },\n [\n Promise.resolve(44),\n async () => {\n await delay(100);\n return 45;\n },\n 46,\n ],\n ],\n test5: {\n test51: () => 51,\n test52: () => 52,\n test53: () => 53,\n },\n test6: {\n test61: {\n test611: 611,\n test612: 612,\n test613: 613,\n },\n },\n test7: {\n test71: async () => {\n await delay(100);\n return {\n test711: async () => 711,\n test712: async () => {\n await delay(100);\n return 712;\n },\n test713: async () => {\n await delay(100);\n return [\n 7131,\n async () => {\n await delay(100);\n return 7132;\n },\n async () => {\n await delay(100);\n return 7133;\n },\n 7134,\n ];\n },\n test714: 714,\n };\n },\n },\n test8: 8,\n};\n\nconst testCaseResolved = {\n test1: 1,\n test2: 2,\n test3: 3,\n test4: [41, 42, 43, [44, 45, 46]],\n test5: {\n test51: 51,\n test52: 52,\n test53: 53,\n },\n test6: {\n test61: {\n test611: 611,\n test612: 612,\n test613: 613,\n },\n },\n test7: {\n test71: {\n test711: 711,\n test712: 712,\n test713: [7131, 7132, 7133, 7134],\n test714: 714,\n },\n },\n test8: 8,\n};\n\ndescribe('resolveObjectPromises', () => {\n it('should the result be in the same order as the original object', async () => {\n const resolved = await resolveObjectPromises<typeof testCase>(testCase);\n\n // Stringify the objects to ensure the order of the keys is the same\n expect(JSON.stringify(resolved)).toStrictEqual(\n JSON.stringify(testCaseResolved)\n );\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,6BAA6B;AAGtC,MAAM,iBAAiB,CAAC,QAA2C;AACjE,SAAO,OAAO,KAAK,GAAG;AACxB;AAEA,MAAM,QAAQ,OAAO,OAAe;AAClC,QAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACxD;AAEA,MAAM,WAAW;AAAA,EACf,OAAO;AAAA,EACP,OAAO,MAAM;AAAA,EACb,OAAO,YAAY;AAAA,EACnB,OAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,YAAY;AACV,YAAM,MAAM,GAAG;AACf,aAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,QAAQ,QAAQ,EAAE;AAAA,MAClB,YAAY;AACV,cAAM,MAAM,GAAG;AACf,eAAO;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ,YAAY;AAClB,YAAM,MAAM,GAAG;AACf,aAAO;AAAA,QACL,SAAS,YAAY;AAAA,QACrB,SAAS,YAAY;AACnB,gBAAM,MAAM,GAAG;AACf,iBAAO;AAAA,QACT;AAAA,QACA,SAAS,YAAY;AACnB,gBAAM,MAAM,GAAG;AACf,iBAAO;AAAA,YACL;AAAA,YACA,YAAY;AACV,oBAAM,MAAM,GAAG;AACf,qBAAO;AAAA,YACT;AAAA,YACA,YAAY;AACV,oBAAM,MAAM,GAAG;AACf,qBAAO;AAAA,YACT;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,mBAAmB;AAAA,EACvB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AAAA,EAChC,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,MAAM,MAAM,IAAI;AAAA,MAChC,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,SAAS,yBAAyB,MAAM;AACtC,KAAG,iEAAiE,YAAY;AAC9E,UAAM,WAAW,MAAM,sBAAuC,QAAQ;AAGtE,WAAO,KAAK,UAAU,QAAQ,CAAC,EAAE;AAAA,MAC/B,KAAK,UAAU,gBAAgB;AAAA,IACjC;AAAA,EACF,CAAC;AACH,CAAC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"cleanOutputDir.d.ts","sourceRoot":"","sources":["../../src/cleanOutputDir.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,GAAI,yDAAkC,SAuChE,CAAC"}
1
+ {"version":3,"file":"cleanOutputDir.d.ts","sourceRoot":"","sources":["../../src/cleanOutputDir.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,GAAI,yDAAkC,SA6ChE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,KACvC,OAAO,CAAC,aAAa,EAAE,CAgGzB,CAAC"}
1
+ {"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,KACvC,OAAO,CAAC,aAAa,EAAE,CAoGzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaryKeys.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,0BAA0B,GACrC,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,EAAE,CA6BlB,CAAC"}
1
+ {"version":3,"file":"fetchDistantDictionaryKeys.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,0BAA0B,GACrC,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,EAAE,CAiClB,CAAC"}
@@ -1,9 +1,4 @@
1
1
  import type { Dictionary } from '@intlayer/core';
2
- /**
3
- * A more "unified" approach where each type (function, array, object, primitive)
4
- * is handled inside the main recursive body.
5
- */
6
- export declare const resolveContentPromises: <T = unknown>(entry: any) => Promise<T>;
7
2
  /**
8
3
  * Function to load, process the module and return the Intlayer Dictionary from the module file
9
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAU,CAAC,GAAG,OAAO,EACtD,OAAO,GAAG,KACT,OAAO,CAAC,CAAC,CA+BX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,UAAU,KAC7B,OAAO,CAAC,UAAU,GAAG,SAAS,CAehC,CAAC"}
1
+ {"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,UAAU,KAC7B,OAAO,CAAC,UAAU,GAAG,SAAS,CAehC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A more "unified" approach where each type (function, array, object, primitive)
3
+ * is handled inside the main recursive body.
4
+ */
5
+ export declare const resolveObjectPromises: <T = unknown>(entry: any) => Promise<T>;
6
+ //# sourceMappingURL=resolveObjectPromises.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveObjectPromises.d.ts","sourceRoot":"","sources":["../../../src/utils/resolveObjectPromises.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAU,CAAC,GAAG,OAAO,EACrD,OAAO,GAAG,KACT,OAAO,CAAC,CAAC,CAqCX,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resolveObjectPromises.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveObjectPromises.test.d.ts","sourceRoot":"","sources":["../../../src/utils/resolveObjectPromises.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "5.5.10",
3
+ "version": "5.5.11",
4
4
  "private": false,
5
5
  "description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
6
6
  "keywords": [
@@ -68,12 +68,12 @@
68
68
  "fast-glob": "^3.3.3",
69
69
  "p-limit": "^3.1.0",
70
70
  "simple-git": "^3.27.0",
71
- "@intlayer/api": "5.5.10",
72
- "@intlayer/config": "5.5.10",
73
- "@intlayer/dictionaries-entry": "5.5.10",
74
- "intlayer": "5.5.10",
75
- "@intlayer/core": "5.5.10",
76
- "@intlayer/unmerged-dictionaries-entry": "5.5.10"
71
+ "@intlayer/config": "5.5.11",
72
+ "@intlayer/api": "5.5.11",
73
+ "@intlayer/core": "5.5.11",
74
+ "intlayer": "5.5.11",
75
+ "@intlayer/dictionaries-entry": "5.5.11",
76
+ "@intlayer/unmerged-dictionaries-entry": "5.5.11"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@changesets/cli": "2.29.4",
@@ -90,19 +90,20 @@
90
90
  "tsc-alias": "^1.8.16",
91
91
  "tsup": "^8.5.0",
92
92
  "typescript": "^5.8.3",
93
- "@intlayer/backend": "5.5.10",
93
+ "vitest": "^3.2.2",
94
+ "@intlayer/backend": "5.5.11",
94
95
  "@utils/eslint-config": "1.0.4",
95
- "@utils/ts-config": "1.0.4",
96
96
  "@utils/tsup-config": "1.0.4",
97
+ "@utils/ts-config": "1.0.4",
97
98
  "@utils/ts-config-types": "1.0.4"
98
99
  },
99
100
  "peerDependencies": {
100
101
  "fast-glob": "^3.3.3",
101
102
  "react": ">=16.0.0",
102
- "@intlayer/api": "5.5.10",
103
- "@intlayer/core": "5.5.10",
104
- "@intlayer/config": "5.5.10",
105
- "intlayer": "5.5.10"
103
+ "@intlayer/config": "5.5.11",
104
+ "intlayer": "5.5.11",
105
+ "@intlayer/api": "5.5.11",
106
+ "@intlayer/core": "5.5.11"
106
107
  },
107
108
  "engines": {
108
109
  "node": ">=14.18"
@@ -121,6 +122,7 @@
121
122
  "prettier": "prettier . --check",
122
123
  "prettier:fix": "prettier --write src/**/*",
123
124
  "reset": "pnpm clean & pnpm build",
124
- "test": ""
125
+ "test": "vitest run",
126
+ "test:watch": "vitest"
125
127
  }
126
128
  }