@intlayer/api 7.1.4 → 7.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/cjs/fetcher.cjs +1 -1
  2. package/dist/cjs/fetcher.cjs.map +1 -1
  3. package/dist/cjs/getIntlayerAPI/ai.cjs +1 -1
  4. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  5. package/dist/esm/fetcher.mjs +1 -1
  6. package/dist/esm/fetcher.mjs.map +1 -1
  7. package/dist/esm/getIntlayerAPI/ai.mjs +1 -1
  8. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  9. package/dist/types/getIntlayerAPI/ai.d.ts +1 -1
  10. package/dist/types/getIntlayerAPI/dictionary.d.ts +1 -1
  11. package/dist/types/getIntlayerAPI/newsletter.d.ts +1 -1
  12. package/dist/types/getIntlayerAPI/oAuth.d.ts +0 -1
  13. package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
  14. package/dist/types/getIntlayerAPI/organization.d.ts +1 -1
  15. package/dist/types/getIntlayerAPI/project.d.ts +1 -1
  16. package/dist/types/getIntlayerAPI/search.d.ts +1 -1
  17. package/dist/types/getIntlayerAPI/stripe.d.ts +1 -1
  18. package/dist/types/getIntlayerAPI/tag.d.ts +1 -1
  19. package/dist/types/getIntlayerAPI/user.d.ts +1 -1
  20. package/package.json +4 -4
  21. package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs +0 -10
  22. package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
  23. package/dist/cjs/config/dist/esm/built.cjs +0 -8
  24. package/dist/cjs/config/dist/esm/built.cjs.map +0 -1
  25. package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs +0 -119
  26. package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs.map +0 -1
  27. package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs +0 -69
  28. package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs.map +0 -1
  29. package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs +0 -26
  30. package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs.map +0 -1
  31. package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs +0 -51
  32. package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs.map +0 -1
  33. package/dist/cjs/config/dist/esm/defaultValues/build.cjs +0 -15
  34. package/dist/cjs/config/dist/esm/defaultValues/build.cjs.map +0 -1
  35. package/dist/cjs/config/dist/esm/defaultValues/content.cjs +0 -54
  36. package/dist/cjs/config/dist/esm/defaultValues/content.cjs.map +0 -1
  37. package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs +0 -7
  38. package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs.map +0 -1
  39. package/dist/cjs/config/dist/esm/defaultValues/editor.cjs +0 -23
  40. package/dist/cjs/config/dist/esm/defaultValues/editor.cjs.map +0 -1
  41. package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs +0 -14
  42. package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs.map +0 -1
  43. package/dist/cjs/config/dist/esm/defaultValues/log.cjs +0 -10
  44. package/dist/cjs/config/dist/esm/defaultValues/log.cjs.map +0 -1
  45. package/dist/cjs/config/dist/esm/defaultValues/routing.cjs +0 -11
  46. package/dist/cjs/config/dist/esm/defaultValues/routing.cjs.map +0 -1
  47. package/dist/cjs/config/dist/esm/loadEnvFile.cjs +0 -26
  48. package/dist/cjs/config/dist/esm/loadEnvFile.cjs.map +0 -1
  49. package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs +0 -23
  50. package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs.map +0 -1
  51. package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs +0 -47
  52. package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +0 -1
  53. package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs +0 -65
  54. package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +0 -1
  55. package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +0 -45
  56. package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +0 -1
  57. package/dist/cjs/config/dist/esm/logger.cjs +0 -47
  58. package/dist/cjs/config/dist/esm/logger.cjs.map +0 -1
  59. package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +0 -15
  60. package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +0 -1
  61. package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs +0 -1128
  62. package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs.map +0 -1
  63. package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs +0 -27
  64. package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +0 -1
  65. package/dist/cjs/config/dist/esm/utils/cache.cjs +0 -261
  66. package/dist/cjs/config/dist/esm/utils/cache.cjs.map +0 -1
  67. package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs +0 -34
  68. package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs.map +0 -1
  69. package/dist/cjs/config/dist/esm/utils/normalizePath.cjs +0 -17
  70. package/dist/cjs/config/dist/esm/utils/normalizePath.cjs.map +0 -1
  71. package/dist/esm/_virtual/rolldown_runtime.mjs +0 -8
  72. package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +0 -11
  73. package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
  74. package/dist/esm/config/dist/esm/built.mjs +0 -8
  75. package/dist/esm/config/dist/esm/built.mjs.map +0 -1
  76. package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +0 -118
  77. package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +0 -1
  78. package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +0 -67
  79. package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +0 -1
  80. package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +0 -26
  81. package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +0 -1
  82. package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +0 -50
  83. package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +0 -1
  84. package/dist/esm/config/dist/esm/defaultValues/build.mjs +0 -10
  85. package/dist/esm/config/dist/esm/defaultValues/build.mjs.map +0 -1
  86. package/dist/esm/config/dist/esm/defaultValues/content.mjs +0 -40
  87. package/dist/esm/config/dist/esm/defaultValues/content.mjs.map +0 -1
  88. package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +0 -6
  89. package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +0 -1
  90. package/dist/esm/config/dist/esm/defaultValues/editor.mjs +0 -14
  91. package/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +0 -1
  92. package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +0 -11
  93. package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +0 -1
  94. package/dist/esm/config/dist/esm/defaultValues/log.mjs +0 -9
  95. package/dist/esm/config/dist/esm/defaultValues/log.mjs.map +0 -1
  96. package/dist/esm/config/dist/esm/defaultValues/routing.mjs +0 -8
  97. package/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +0 -1
  98. package/dist/esm/config/dist/esm/loadEnvFile.mjs +0 -24
  99. package/dist/esm/config/dist/esm/loadEnvFile.mjs.map +0 -1
  100. package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +0 -23
  101. package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +0 -1
  102. package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +0 -47
  103. package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +0 -1
  104. package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +0 -63
  105. package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +0 -1
  106. package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +0 -44
  107. package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +0 -1
  108. package/dist/esm/config/dist/esm/logger.mjs +0 -45
  109. package/dist/esm/config/dist/esm/logger.mjs.map +0 -1
  110. package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +0 -14
  111. package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +0 -1
  112. package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +0 -1128
  113. package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +0 -1
  114. package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +0 -25
  115. package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +0 -1
  116. package/dist/esm/config/dist/esm/utils/cache.mjs +0 -263
  117. package/dist/esm/config/dist/esm/utils/cache.mjs.map +0 -1
  118. package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +0 -33
  119. package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +0 -1
  120. package/dist/esm/config/dist/esm/utils/normalizePath.mjs +0 -16
  121. package/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +0 -1
  122. package/dist/types/distantDictionary/index.d.ts.map +0 -1
  123. package/dist/types/index.d.ts.map +0 -1
@@ -91,7 +91,7 @@ const fetcher = async (url, ...options) => {
91
91
  const { signal } = new AbortController();
92
92
  let paramsString = "";
93
93
  let bodyString;
94
- const mergedOptions = deepMerge([fetcherOptions, ...options.map(({ body, params: params$1, headers,...otherOptions }) => otherOptions)]);
94
+ const mergedOptions = deepMerge([fetcherOptions, ...options.map(({ body, params: params$1, headers, ...otherOptions }) => otherOptions)]);
95
95
  const mergedHeaders = deepMerge([fetcherOptions.headers, ...options.map((option) => option.headers)]);
96
96
  const params = deepMerge(options.map((option) => option.params));
97
97
  const method = mergedOptions.method;
@@ -1 +1 @@
1
- {"version":3,"file":"fetcher.cjs","names":["fetcherOptions: FetcherOptions","acc1: T","obj1: T","bodyString: string | undefined","formattedOptions: RequestInit"],"sources":["../../src/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include',\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n const { signal } = new AbortController();\n\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n signal,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n const response = await fetch(urlResult, formattedOptions);\n\n if (!response.ok) {\n const result = await response.json();\n\n // You can customize the error message or include more details\n throw new Error(JSON.stringify(result.error) ?? 'An error occurred');\n }\n return await response.json();\n};\n"],"mappings":";;;;;;;AAwBA,MAAaA,iBAAiC;CAC5C,QAAQ;CACR,SAAS,EACP,gBAAgB,oBACjB;CACD,aAAa;CACd;;;;;;;;AASD,MAAM,mBAAmB,QAAgB;AACvC,QAAO,KAAK,IAAI,CAAC,SAAS,QAAQ;AAChC,MAAI,IAAI,SAA6B,OACnC,QAAO,IAAI;GAEb;AACF,QAAO;;;;;;;;;;AAWT,MAAM,aAA+B,YACnC,QAAQ,QAAQ,KAAK,QAAQ;CAC3B,MAAMC,OAAW,OAAO,EAAE;CAC1B,MAAMC,OAAU,gBAAgB,OAAO,EAAE,CAAC;AAE1C,KAAI,OAAO,SAAS,YAAY,OAAO,SAAS,SAE9C,QAAO;EAAE,GAAG;EAAM,GAAG;EAAM;AAI7B,QAAO,QAAQ;GACd,EAAE,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDb,MAAa,UAAU,OACrB,KACA,GAAG,YACY;CACf,MAAM,EAAE,WAAW,IAAI,iBAAiB;CAGxC,IAAI,eAAe;CACnB,IAAIC;CAQJ,MAAM,gBAAgB,UAAU,CAAC,gBAAgB,GAL5B,QAAQ,KAC1B,EAAE,MAAM,kBAAQ,QAAS,GAAG,mBAAmB,aACjD,CAGgE,CAAC;CAGlE,MAAM,gBAAgB,UAAU,CAC9B,eAAe,SACf,GAAG,QAAQ,KAAK,WAAW,OAAO,QAAQ,CAC3C,CAAC;CAGF,MAAM,SAAS,UAAU,QAAQ,KAAK,WAAW,OAAO,OAAO,CAAC;CAEhE,MAAM,SAAS,cAAc;AAG7B,KAAI,WAAW,SAAS,WAAW,QAAQ;EAEzC,MAAM,OAAO,UAAU,QAAQ,KAAK,WAAW,OAAO,KAAK,CAAC;AAC5D,MACE,gBAAgB,oBAChB,oCAGA,cAAa,IAAI,gBACf,KACD,CAAC,UAAU;MAGZ,cAAa,KAAK,UAAU,KAAK;;AAKrC,KAAI,OAAO,QAAQ,OAAO,CAAC,SAAS,EAClC,gBAAe,IAAI,IAAI,gBACrB,OACD,CAAC,UAAU;CAId,MAAMC,mBAAgC;EACpC,GAAG;EACH,SAAS;EACT,MAAM;EACN;EACD;CAGD,MAAM,YAAY,GAAG,MAAM;CAG3B,MAAM,WAAW,MAAM,MAAM,WAAW,iBAAiB;AAEzD,KAAI,CAAC,SAAS,IAAI;EAChB,MAAM,SAAS,MAAM,SAAS,MAAM;AAGpC,QAAM,IAAI,MAAM,KAAK,UAAU,OAAO,MAAM,IAAI,oBAAoB;;AAEtE,QAAO,MAAM,SAAS,MAAM"}
1
+ {"version":3,"file":"fetcher.cjs","names":["fetcherOptions: FetcherOptions","acc1: T","obj1: T","bodyString: string | undefined","formattedOptions: RequestInit"],"sources":["../../src/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include',\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n const { signal } = new AbortController();\n\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n signal,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n const response = await fetch(urlResult, formattedOptions);\n\n if (!response.ok) {\n const result = await response.json();\n\n // You can customize the error message or include more details\n throw new Error(JSON.stringify(result.error) ?? 'An error occurred');\n }\n return await response.json();\n};\n"],"mappings":";;;;;;;AAwBA,MAAaA,iBAAiC;CAC5C,QAAQ;CACR,SAAS,EACP,gBAAgB,oBACjB;CACD,aAAa;CACd;;;;;;;;AASD,MAAM,mBAAmB,QAAgB;AACvC,QAAO,KAAK,IAAI,CAAC,SAAS,QAAQ;AAChC,MAAI,IAAI,SAA6B,OACnC,QAAO,IAAI;GAEb;AACF,QAAO;;;;;;;;;;AAWT,MAAM,aAA+B,YACnC,QAAQ,QAAQ,KAAK,QAAQ;CAC3B,MAAMC,OAAW,OAAO,EAAE;CAC1B,MAAMC,OAAU,gBAAgB,OAAO,EAAE,CAAC;AAE1C,KAAI,OAAO,SAAS,YAAY,OAAO,SAAS,SAE9C,QAAO;EAAE,GAAG;EAAM,GAAG;EAAM;AAI7B,QAAO,QAAQ;GACd,EAAE,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDb,MAAa,UAAU,OACrB,KACA,GAAG,YACY;CACf,MAAM,EAAE,WAAW,IAAI,iBAAiB;CAGxC,IAAI,eAAe;CACnB,IAAIC;CAQJ,MAAM,gBAAgB,UAAU,CAAC,gBAAgB,GAL5B,QAAQ,KAC1B,EAAE,MAAM,kBAAQ,SAAS,GAAG,mBAAmB,aACjD,CAGgE,CAAC;CAGlE,MAAM,gBAAgB,UAAU,CAC9B,eAAe,SACf,GAAG,QAAQ,KAAK,WAAW,OAAO,QAAQ,CAC3C,CAAC;CAGF,MAAM,SAAS,UAAU,QAAQ,KAAK,WAAW,OAAO,OAAO,CAAC;CAEhE,MAAM,SAAS,cAAc;AAG7B,KAAI,WAAW,SAAS,WAAW,QAAQ;EAEzC,MAAM,OAAO,UAAU,QAAQ,KAAK,WAAW,OAAO,KAAK,CAAC;AAC5D,MACE,gBAAgB,oBAChB,oCAGA,cAAa,IAAI,gBACf,KACD,CAAC,UAAU;MAGZ,cAAa,KAAK,UAAU,KAAK;;AAKrC,KAAI,OAAO,QAAQ,OAAO,CAAC,SAAS,EAClC,gBAAe,IAAI,IAAI,gBACrB,OACD,CAAC,UAAU;CAId,MAAMC,mBAAgC;EACpC,GAAG;EACH,SAAS;EACT,MAAM;EACN;EACD;CAGD,MAAM,YAAY,GAAG,MAAM;CAG3B,MAAM,WAAW,MAAM,MAAM,WAAW,iBAAiB;AAEzD,KAAI,CAAC,SAAS,IAAI;EAChB,MAAM,SAAS,MAAM,SAAS,MAAM;AAGpC,QAAM,IAAI,MAAM,KAAK,UAAU,OAAO,MAAM,IAAI,oBAAoB;;AAEtE,QAAO,MAAM,SAAS,MAAM"}
@@ -83,7 +83,7 @@ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
83
83
  */
84
84
  const askDocQuestion = async (body, otherOptions = {}) => {
85
85
  if (!body) return;
86
- const { onMessage, onDone,...rest } = body;
86
+ const { onMessage, onDone, ...rest } = body;
87
87
  const abortController = new AbortController();
88
88
  try {
89
89
  const response = await fetch(`${AI_API_ROUTE}/ask`, {
@@ -1 +1 @@
1
- {"version":3,"file":"ai.cjs","names":["configuration","fetcher","errorMessage: string"],"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n GetDiscussionsParams,\n GetDiscussionsResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discussionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify({\n ...rest,\n ...authAPIOptions.body,\n ...otherOptions.body,\n }),\n signal: abortController.signal,\n credentials: 'include',\n });\n\n if (!response.ok) {\n // Align error handling with generic `fetcher` utility so that callers receive\n // meaningful messages (e.g. for 429 \"Too Many Requests\" responses).\n let errorMessage: string = 'An error occurred';\n\n try {\n // Attempt to parse JSON error payload produced by backend\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? 'An error occurred';\n } catch {\n // Fallback to plain-text body or HTTP status text\n try {\n const errorText = await response.text();\n if (errorText) {\n errorMessage = errorText;\n }\n } catch {\n // ignore – we already have a default message\n }\n }\n\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Retrieves discussions with filters and pagination. Only user or admin can access.\n */\n const getDiscussions = async (\n params?: GetDiscussionsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDiscussionsResult>(\n `${AI_API_ROUTE}/discussions`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n getDiscussions,\n };\n};\n"],"mappings":";;;;;;AAiCA,MAAa,YACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MA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cACA;EACE,QAAQ;EAER;EACD,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"ai.cjs","names":["configuration","fetcher","errorMessage: string"],"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n GetDiscussionsParams,\n GetDiscussionsResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discussionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify({\n ...rest,\n ...authAPIOptions.body,\n ...otherOptions.body,\n }),\n signal: abortController.signal,\n credentials: 'include',\n });\n\n if (!response.ok) {\n // Align error handling with generic `fetcher` utility so that callers receive\n // meaningful messages (e.g. for 429 \"Too Many Requests\" responses).\n let errorMessage: string = 'An error occurred';\n\n try {\n // Attempt to parse JSON error payload produced by backend\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? 'An error occurred';\n } catch {\n // Fallback to plain-text body or HTTP status text\n try {\n const errorText = await response.text();\n if (errorText) {\n errorMessage = errorText;\n }\n } catch {\n // ignore – we already have a default message\n }\n }\n\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Retrieves discussions with filters and pagination. Only user or admin can access.\n */\n const getDiscussions = async (\n params?: GetDiscussionsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDiscussionsResult>(\n `${AI_API_ROUTE}/discussions`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n getDiscussions,\n };\n};\n"],"mappings":";;;;;;AAiCA,MAAa,YACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,iCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,eAAe,GAAG,WAAW;;;;;;CAOnC,MAAM,cAAc,OAClB,MACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,cACA,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,gBAAgB,OACpB,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,aAAa,kBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,0BAA0B,OAC9B,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,aAAa,oBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,+BAA+B,OACnC,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,aAAa,0BAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,kCAAkC,OACtC,MACA,eAA+B,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AAS,MAAM,KAAK,IAAI;AAExB,SAAK,MAAM,QAAQ,MACjB,KAAI,KAAK,WAAW,SAAS,CAC3B,KAAI;KACF,MAAM,OAAO,KAAK,MAAM,KAAK,MAAM,EAAE,CAAC;AACtC,SAAI,KAAK,MACP,aAAY,KAAK,MAAM;AAEzB,SAAI,KAAK,QAAQ,KAAK,SACpB,UAAS,KAAK,SAAS;aAElB,GAAG;AACV,aAAQ,MAAM,6BAA6B,EAAE;;;WAK9C,OAAO;AACd,WAAQ,MAAM,4BAA4B,MAAM;AAChD,SAAM;;;CAIV,MAAM,eAAe,OACnB,MACA,eAA+B,EAAE,KAEjC,MAAMD,wBACJ,GAAG,aAAa,gBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;CAKH,MAAM,iBAAiB,OACrB,QACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,aAAa,eAChB,gBACA,cACA;EACE,QAAQ;EAER;EACD,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -90,7 +90,7 @@ const fetcher = async (url, ...options) => {
90
90
  const { signal } = new AbortController();
91
91
  let paramsString = "";
92
92
  let bodyString;
93
- const mergedOptions = deepMerge([fetcherOptions, ...options.map(({ body, params: params$1, headers,...otherOptions }) => otherOptions)]);
93
+ const mergedOptions = deepMerge([fetcherOptions, ...options.map(({ body, params: params$1, headers, ...otherOptions }) => otherOptions)]);
94
94
  const mergedHeaders = deepMerge([fetcherOptions.headers, ...options.map((option) => option.headers)]);
95
95
  const params = deepMerge(options.map((option) => option.params));
96
96
  const method = mergedOptions.method;
@@ -1 +1 @@
1
- {"version":3,"file":"fetcher.mjs","names":["fetcherOptions: FetcherOptions","acc1: T","obj1: T","bodyString: string | undefined","formattedOptions: RequestInit"],"sources":["../../src/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include',\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n const { signal } = new AbortController();\n\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n signal,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n const response = await fetch(urlResult, formattedOptions);\n\n if (!response.ok) {\n const result = await response.json();\n\n // You can customize the error message or include more details\n throw new Error(JSON.stringify(result.error) ?? 'An error occurred');\n }\n return await response.json();\n};\n"],"mappings":";;;;;;AAwBA,MAAaA,iBAAiC;CAC5C,QAAQ;CACR,SAAS,EACP,gBAAgB,oBACjB;CACD,aAAa;CACd;;;;;;;;AASD,MAAM,mBAAmB,QAAgB;AACvC,QAAO,KAAK,IAAI,CAAC,SAAS,QAAQ;AAChC,MAAI,IAAI,SAA6B,OACnC,QAAO,IAAI;GAEb;AACF,QAAO;;;;;;;;;;AAWT,MAAM,aAA+B,YACnC,QAAQ,QAAQ,KAAK,QAAQ;CAC3B,MAAMC,OAAW,OAAO,EAAE;CAC1B,MAAMC,OAAU,gBAAgB,OAAO,EAAE,CAAC;AAE1C,KAAI,OAAO,SAAS,YAAY,OAAO,SAAS,SAE9C,QAAO;EAAE,GAAG;EAAM,GAAG;EAAM;AAI7B,QAAO,QAAQ;GACd,EAAE,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDb,MAAa,UAAU,OACrB,KACA,GAAG,YACY;CACf,MAAM,EAAE,WAAW,IAAI,iBAAiB;CAGxC,IAAI,eAAe;CACnB,IAAIC;CAQJ,MAAM,gBAAgB,UAAU,CAAC,gBAAgB,GAL5B,QAAQ,KAC1B,EAAE,MAAM,kBAAQ,QAAS,GAAG,mBAAmB,aACjD,CAGgE,CAAC;CAGlE,MAAM,gBAAgB,UAAU,CAC9B,eAAe,SACf,GAAG,QAAQ,KAAK,WAAW,OAAO,QAAQ,CAC3C,CAAC;CAGF,MAAM,SAAS,UAAU,QAAQ,KAAK,WAAW,OAAO,OAAO,CAAC;CAEhE,MAAM,SAAS,cAAc;AAG7B,KAAI,WAAW,SAAS,WAAW,QAAQ;EAEzC,MAAM,OAAO,UAAU,QAAQ,KAAK,WAAW,OAAO,KAAK,CAAC;AAC5D,MACE,gBAAgB,oBAChB,oCAGA,cAAa,IAAI,gBACf,KACD,CAAC,UAAU;MAGZ,cAAa,KAAK,UAAU,KAAK;;AAKrC,KAAI,OAAO,QAAQ,OAAO,CAAC,SAAS,EAClC,gBAAe,IAAI,IAAI,gBACrB,OACD,CAAC,UAAU;CAId,MAAMC,mBAAgC;EACpC,GAAG;EACH,SAAS;EACT,MAAM;EACN;EACD;CAGD,MAAM,YAAY,GAAG,MAAM;CAG3B,MAAM,WAAW,MAAM,MAAM,WAAW,iBAAiB;AAEzD,KAAI,CAAC,SAAS,IAAI;EAChB,MAAM,SAAS,MAAM,SAAS,MAAM;AAGpC,QAAM,IAAI,MAAM,KAAK,UAAU,OAAO,MAAM,IAAI,oBAAoB;;AAEtE,QAAO,MAAM,SAAS,MAAM"}
1
+ {"version":3,"file":"fetcher.mjs","names":["fetcherOptions: FetcherOptions","acc1: T","obj1: T","bodyString: string | undefined","formattedOptions: RequestInit"],"sources":["../../src/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include',\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n const { signal } = new AbortController();\n\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n signal,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n const response = await fetch(urlResult, formattedOptions);\n\n if (!response.ok) {\n const result = await response.json();\n\n // You can customize the error message or include more details\n throw new Error(JSON.stringify(result.error) ?? 'An error occurred');\n }\n return await response.json();\n};\n"],"mappings":";;;;;;AAwBA,MAAaA,iBAAiC;CAC5C,QAAQ;CACR,SAAS,EACP,gBAAgB,oBACjB;CACD,aAAa;CACd;;;;;;;;AASD,MAAM,mBAAmB,QAAgB;AACvC,QAAO,KAAK,IAAI,CA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AM,MAAM,WAAW,iBAAiB;AAEzD,KAAI,CAAC,SAAS,IAAI;EAChB,MAAM,SAAS,MAAM,SAAS,MAAM;AAGpC,QAAM,IAAI,MAAM,KAAK,UAAU,OAAO,MAAM,IAAI,oBAAoB;;AAEtE,QAAO,MAAM,SAAS,MAAM"}
@@ -81,7 +81,7 @@ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
81
81
  */
82
82
  const askDocQuestion = async (body, otherOptions = {}) => {
83
83
  if (!body) return;
84
- const { onMessage, onDone,...rest } = body;
84
+ const { onMessage, onDone, ...rest } = body;
85
85
  const abortController = new AbortController();
86
86
  try {
87
87
  const response = await fetch(`${AI_API_ROUTE}/ask`, {
@@ -1 +1 @@
1
- {"version":3,"file":"ai.mjs","names":["errorMessage: string"],"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n GetDiscussionsParams,\n GetDiscussionsResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discussionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify({\n ...rest,\n ...authAPIOptions.body,\n ...otherOptions.body,\n }),\n signal: abortController.signal,\n credentials: 'include',\n });\n\n if (!response.ok) {\n // Align error handling with generic `fetcher` utility so that callers receive\n // meaningful messages (e.g. for 429 \"Too Many Requests\" responses).\n let errorMessage: string = 'An error occurred';\n\n try {\n // Attempt to parse JSON error payload produced by backend\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? 'An error occurred';\n } catch {\n // Fallback to plain-text body or HTTP status text\n try {\n const errorText = await response.text();\n if (errorText) {\n errorMessage = errorText;\n }\n } catch {\n // ignore – we already have a default message\n }\n }\n\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Retrieves discussions with filters and pagination. Only user or admin can access.\n */\n const getDiscussions = async (\n params?: GetDiscussionsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDiscussionsResult>(\n `${AI_API_ROUTE}/discussions`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n getDiscussions,\n };\n};\n"],"mappings":";;;;AAiCA,MAAa,YACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,eAAe,GAAG,WAAW;;;;;;CAOnC,MAAM,cAAc,OAClB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,cACA,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,gBAAgB,OACpB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,kBAChB,gBACA,cACA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GAG/B,MAAM,SAAS,SAAS,MAAM,WAAW;AACzC,OAAI,CAAC,OACH,OAAM,IAAI,MAAM,sBAAsB;GAGxC,MAAM,UAAU,IAAI,aAAa;GACjC,IAAI,SAAS;AAEb,UAAO,MAAM;IACX,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,MAAM;AAC3C,QAAI,KAAM;AAEV,cAAU,QAAQ,OAAO,OAAO,EAAE,QAAQ,MAAM,CAAC;IACjD,MAAM,QAAQ,OAAO,MAAM,KAAK;AAChC,aAAS,MAAM,KAAK,IAAI;AAExB,SAAK,MAAM,QAAQ,MACjB,KAAI,KAAK,WAAW,SAAS,CAC3B,KAAI;KACF,MAAM,OAAO,KAAK,MAAM,KAAK,MAAM,EAAE,CAAC;AACtC,SAAI,KAAK,MACP,aAAY,KAAK,MAAM;AAEzB,SAAI,KAAK,QAAQ,KAAK,SACpB,UAAS,KAAK,SAAS;aAElB,GAAG;AACV,aAAQ,MAAM,6BAA6B,EAAE;;;WAK9C,OAAO;AACd,WAAQ,MAAM,4BAA4B,MAAM;AAChD,SAAM;;;CAIV,MAAM,eAAe,OACnB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,gBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;CAKH,MAAM,iBAAiB,OACrB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,eAChB,gBACA,cACA;EACE,QAAQ;EAER;EACD,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"ai.mjs","names":["errorMessage: string"],"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n GetDiscussionsParams,\n GetDiscussionsResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discussionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify({\n ...rest,\n ...authAPIOptions.body,\n ...otherOptions.body,\n }),\n signal: abortController.signal,\n credentials: 'include',\n });\n\n if (!response.ok) {\n // Align error handling with generic `fetcher` utility so that callers receive\n // meaningful messages (e.g. for 429 \"Too Many Requests\" responses).\n let errorMessage: string = 'An error occurred';\n\n try {\n // Attempt to parse JSON error payload produced by backend\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? 'An error occurred';\n } catch {\n // Fallback to plain-text body or HTTP status text\n try {\n const errorText = await response.text();\n if (errorText) {\n errorMessage = errorText;\n }\n } catch {\n // ignore – we already have a default message\n }\n }\n\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Retrieves discussions with filters and pagination. Only user or admin can access.\n */\n const getDiscussions = async (\n params?: GetDiscussionsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDiscussionsResult>(\n `${AI_API_ROUTE}/discussions`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n getDiscussions,\n };\n};\n"],"mappings":";;;;AAiCA,MAAa,YACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,eAAe,GAAG,WAAW;;;;;;CAOnC,MAAM,cAAc,OAClB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,cACA,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,gBAAgB,OACpB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,kBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,0BAA0B,OAC9B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,oBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,+BAA+B,OACnC,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,0BAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,kCAAkC,OACtC,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,6BAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,WAAW,OACf,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,aAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;;;;;;;;;;;;;;;CAqBH,MAAM,iBAAiB,OACrB,MACA,eAA+B,EAAE,KAC9B;AACH,MAAI,CAAC,KAAM;EAEX,MAAM,EAAE,WAAW,QAAQ,GAAG,SAAS;EACvC,MAAM,kBAAkB,IAAI,iBAAi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B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,gBAChB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;CAKH,MAAM,iBAAiB,OACrB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,eAChB,gBACA,cACA;EACE,QAAQ;EAER;EACD,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1,4 +1,4 @@
1
- import { AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CustomQueryBody, CustomQueryResult, GetDiscussionsParams, GetDiscussionsResult, TranslateJSONBody, TranslateJSONResult } from "../types.js";
1
+ import { AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationMetadataBody, AuditTagBody, AutocompleteBody, ChatCompletionRequestMessage, CustomQueryBody, GetDiscussionsParams, TranslateJSONBody } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionariesUpdateTimestampResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, PushDictionariesBody, PushDictionariesResult, UpdateDictionaryBody, UpdateDictionaryResult } from "../types.js";
1
+ import { AddDictionaryBody, DeleteDictionaryParam, GetDictionariesParams, GetDictionaryParams, GetDictionaryQuery, PushDictionariesBody, UpdateDictionaryBody } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody } from "../types.js";
1
+ import { NewsletterSubscriptionBody, NewsletterUnsubscriptionBody } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,3 @@
1
- import { GetOAuth2TokenResult } from "../types.js";
2
1
  import { FetcherOptions } from "../fetcher.js";
3
2
  import { IntlayerConfig } from "@intlayer/types";
4
3
 
@@ -1 +1 @@
1
- {"version":3,"file":"oAuth.d.ts","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":[],"mappings":";;;;;cAKa,+BAAgC;wCAeO,mBAAc,QAAA;AAflE,CAAA"}
1
+ {"version":3,"file":"oAuth.d.ts","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":[],"mappings":";;;;cAKa,+BAAgC;wCAeO,mBAAc,QAAA;AAflE,CAAA"}
@@ -1,4 +1,4 @@
1
- import { AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, DeleteOrganizationResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, SelectOrganizationParam, SelectOrganizationResult, UnselectOrganizationResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult } from "../types.js";
1
+ import { AddOrganizationBody, AddOrganizationMemberBody, GetOrganizationParam, GetOrganizationsParams, SelectOrganizationParam, UpdateOrganizationBody, UpdateOrganizationMembersBody } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { AddNewAccessKeyBody, AddNewAccessKeyResponse, AddProjectBody, AddProjectResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteProjectResult, GetProjectsParams, GetProjectsResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, SelectProjectParam, SelectProjectResult, UnselectProjectResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult } from "../types.js";
1
+ import { AddNewAccessKeyBody, AddProjectBody, DeleteAccessKeyBody, GetProjectsParams, PushProjectConfigurationBody, RefreshAccessKeyBody, SelectProjectParam, UpdateProjectBody, UpdateProjectMembersBody } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { SearchDocUtilParams, SearchDocUtilResult } from "../types.js";
1
+ import { SearchDocUtilParams } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { GetCheckoutSessionBody, GetCheckoutSessionResult, GetPricingBody, GetPricingResult } from "../types.js";
1
+ import { GetCheckoutSessionBody, GetPricingBody } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { AddTagBody, AddTagResult, DeleteTagParams, DeleteTagResult, GetTagsParams, GetTagsResult, UpdateTagBody, UpdateTagParams, UpdateTagResult } from "../types.js";
1
+ import { AddTagBody, DeleteTagParams, GetTagsParams, UpdateTagBody, UpdateTagParams } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { CreateUserBody, CreateUserResult, GetUserByAccountParams, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, UpdateUserBody, UpdateUserResult, UserAPI } from "../types.js";
1
+ import { CreateUserBody, GetUserByAccountParams, GetUserByEmailParams, GetUserByIdParams, GetUsersParams, UpdateUserBody, UserAPI } from "../types.js";
2
2
  import { FetcherOptions } from "../fetcher.js";
3
3
  import { IntlayerConfig } from "@intlayer/types";
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/api",
3
- "version": "7.1.4",
3
+ "version": "7.1.6",
4
4
  "private": false,
5
5
  "description": "SDK for interacting with the Intlayer API, enabling content auditing, and managing organizations, projects, and users.",
6
6
  "keywords": [
@@ -72,7 +72,7 @@
72
72
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
73
73
  },
74
74
  "dependencies": {
75
- "@intlayer/config": "7.1.4"
75
+ "@intlayer/config": "7.1.6"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/node": "24.10.1",
@@ -85,8 +85,8 @@
85
85
  "vitest": "4.0.8"
86
86
  },
87
87
  "peerDependencies": {
88
- "@intlayer/backend": "7.1.4",
89
- "intlayer-editor": "7.1.4"
88
+ "@intlayer/backend": "7.1.6",
89
+ "intlayer-editor": "7.1.6"
90
90
  },
91
91
  "peerDependenciesMeta": {
92
92
  "@intlayer/backend": {
@@ -1,10 +0,0 @@
1
-
2
- //#region ../config/dist/esm/_virtual/rolldown_runtime.mjs
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
6
- });
7
-
8
- //#endregion
9
- exports.__require = __require;
10
- //# sourceMappingURL=rolldown_runtime.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rolldown_runtime.cjs","names":[],"sources":["../../../../../../../config/dist/esm/_virtual/rolldown_runtime.mjs"],"sourcesContent":["//#region rolldown:runtime\nvar __defProp = Object.defineProperty;\nvar __export = (all) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\treturn target;\n};\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, { get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b] }) : x)(function(x) {\n\tif (typeof require !== \"undefined\") return require.apply(this, arguments);\n\tthrow Error(\"Calling `require` for \\\"\" + x + \"\\\" in an environment that doesn't expose the `require` function.\");\n});\n\n//#endregion\nexport { __export, __require };"],"mappings":";;AAUA,IAAI,YAA4B,kBAAE,MAAM,OAAO,YAAY,cAAc,UAAU,OAAO,UAAU,cAAc,IAAI,MAAM,GAAG,EAAE,MAAM,GAAG,OAAO,OAAO,YAAY,cAAc,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,SAAS,GAAG;AACrN,KAAI,OAAO,YAAY,YAAa,QAAO,QAAQ,MAAM,MAAM,UAAU;AACzE,OAAM,MAAM,6BAA6B,IAAI,mEAAmE;EAC/G"}
@@ -1,8 +0,0 @@
1
- const require_getConfiguration = require('./configFile/getConfiguration.cjs');
2
-
3
- //#region ../config/dist/esm/built.mjs
4
- var built_default = require_getConfiguration.getConfiguration();
5
-
6
- //#endregion
7
- exports.built_default = built_default;
8
- //# sourceMappingURL=built.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"built.cjs","names":["getConfiguration"],"sources":["../../../../../../config/dist/esm/built.mjs"],"sourcesContent":["import { getConfiguration } from \"./configFile/getConfiguration.mjs\";\n\n//#region src/built.ts\nconst configuration = getConfiguration();\nvar built_default = configuration;\n\n//#endregion\nexport { built_default as default };\n//# sourceMappingURL=built.mjs.map"],"mappings":";;;AAIA,IAAI,gBADkBA,2CAAkB"}
@@ -1,119 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_normalizePath = require('../utils/normalizePath.cjs');
3
- const require_build = require('../defaultValues/build.cjs');
4
- const require_content = require('../defaultValues/content.cjs');
5
- const require_dictionary = require('../defaultValues/dictionary.cjs');
6
- const require_editor = require('../defaultValues/editor.cjs');
7
- const require_internationalization = require('../defaultValues/internationalization.cjs');
8
- const require_log = require('../defaultValues/log.cjs');
9
- const require_routing = require('../defaultValues/routing.cjs');
10
- let node_path = require("node:path");
11
-
12
- //#region ../config/dist/esm/configFile/buildConfigurationFields.mjs
13
- let storedConfiguration;
14
- const buildInternationalizationFields = (customConfiguration) => ({
15
- locales: customConfiguration?.locales ?? require_internationalization.LOCALES,
16
- requiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? require_internationalization.REQUIRED_LOCALES,
17
- strictMode: customConfiguration?.strictMode ?? require_internationalization.STRICT_MODE,
18
- defaultLocale: customConfiguration?.defaultLocale ?? require_internationalization.DEFAULT_LOCALE
19
- });
20
- const buildRoutingFields = (customConfiguration) => ({
21
- mode: customConfiguration?.mode ?? require_routing.ROUTING_MODE,
22
- storage: customConfiguration?.storage ?? require_routing.STORAGE,
23
- basePath: customConfiguration?.basePath ?? require_routing.BASE_PATH
24
- });
25
- const buildContentFields = (customConfiguration, baseDir) => {
26
- const notDerivedContentConfig = {
27
- fileExtensions: customConfiguration?.fileExtensions ?? require_content.FILE_EXTENSIONS,
28
- baseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),
29
- excludedPath: customConfiguration?.excludedPath ?? require_content.EXCLUDED_PATHS,
30
- watch: customConfiguration?.watch ?? require_content.WATCH,
31
- formatCommand: customConfiguration?.formatCommand
32
- };
33
- const optionalJoinBaseDir = (path) => {
34
- if ((0, node_path.isAbsolute)(path)) return path;
35
- return (0, node_path.join)(notDerivedContentConfig.baseDir, path);
36
- };
37
- const baseDirDerivedConfiguration = {
38
- contentDir: (customConfiguration?.contentDir ?? require_content.CONTENT_DIR).map(optionalJoinBaseDir),
39
- moduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? require_content.MODULE_AUGMENTATION_DIR),
40
- unmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? require_content.UNMERGED_DICTIONARIES_DIR),
41
- remoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? require_content.REMOTE_DICTIONARIES_DIR),
42
- dictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? require_content.DICTIONARIES_DIR),
43
- dynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? require_content.DYNAMIC_DICTIONARIES_DIR),
44
- fetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? require_content.FETCH_DICTIONARIES_DIR),
45
- typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? require_content.TYPES_DIR),
46
- mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? require_content.MAIN_DIR),
47
- configDir: optionalJoinBaseDir(customConfiguration?.configDir ?? require_content.CONFIG_DIR),
48
- cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? require_content.CACHE_DIR)
49
- };
50
- const patternsConfiguration = {
51
- watchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),
52
- watchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${require_normalizePath.normalizePath(contentDir)}/**/*${ext}`)),
53
- outputFilesPatternWithPath: `${require_normalizePath.normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`
54
- };
55
- return {
56
- ...notDerivedContentConfig,
57
- ...baseDirDerivedConfiguration,
58
- ...patternsConfiguration
59
- };
60
- };
61
- const buildEditorFields = (customConfiguration) => ({
62
- applicationURL: customConfiguration?.applicationURL ?? require_editor.APPLICATION_URL,
63
- editorURL: customConfiguration?.editorURL ?? require_editor.EDITOR_URL,
64
- cmsURL: customConfiguration?.cmsURL ?? require_editor.CMS_URL,
65
- backendURL: customConfiguration?.backendURL ?? require_editor.BACKEND_URL,
66
- port: customConfiguration?.port ?? require_editor.PORT,
67
- enabled: customConfiguration?.enabled ?? require_editor.IS_ENABLED,
68
- clientId: customConfiguration?.clientId ?? void 0,
69
- clientSecret: customConfiguration?.clientSecret ?? void 0,
70
- dictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? require_editor.DICTIONARY_PRIORITY_STRATEGY,
71
- liveSync: customConfiguration?.liveSync ?? require_editor.LIVE_SYNC,
72
- liveSyncPort: customConfiguration?.liveSyncPort ?? require_editor.LIVE_SYNC_PORT,
73
- liveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? require_editor.LIVE_SYNC_PORT}`
74
- });
75
- const buildLogFields = (customConfiguration, logFunctions) => ({
76
- mode: customConfiguration?.mode ?? require_log.MODE,
77
- prefix: customConfiguration?.prefix ?? require_log.PREFIX,
78
- error: logFunctions?.error,
79
- log: logFunctions?.log,
80
- info: logFunctions?.info,
81
- warn: logFunctions?.warn
82
- });
83
- const buildAiFields = (customConfiguration) => ({
84
- provider: customConfiguration?.provider,
85
- apiKey: customConfiguration?.apiKey,
86
- model: customConfiguration?.model,
87
- temperature: customConfiguration?.temperature,
88
- applicationContext: customConfiguration?.applicationContext
89
- });
90
- const buildBuildFields = (customConfiguration) => ({
91
- optimize: customConfiguration?.optimize ?? require_build.OPTIMIZE,
92
- importMode: customConfiguration?.importMode ?? require_build.IMPORT_MODE,
93
- traversePattern: customConfiguration?.traversePattern ?? require_build.TRAVERSE_PATTERN,
94
- outputFormat: customConfiguration?.outputFormat ?? require_build.OUTPUT_FORMAT,
95
- cache: customConfiguration?.cache ?? require_build.CACHE,
96
- require: customConfiguration?.require
97
- });
98
- const buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? require_dictionary.FILL });
99
- /**
100
- * Build the configuration fields by merging the default values with the custom configuration
101
- */
102
- const buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {
103
- storedConfiguration = {
104
- internationalization: buildInternationalizationFields(customConfiguration?.internationalization),
105
- routing: buildRoutingFields(customConfiguration?.routing),
106
- content: buildContentFields(customConfiguration?.content, baseDir),
107
- editor: buildEditorFields(customConfiguration?.editor),
108
- log: buildLogFields(customConfiguration?.log, logFunctions),
109
- ai: buildAiFields(customConfiguration?.ai),
110
- build: buildBuildFields(customConfiguration?.build),
111
- dictionary: buildDictionaryFields(customConfiguration?.dictionary),
112
- plugins: customConfiguration?.plugins
113
- };
114
- return storedConfiguration;
115
- };
116
-
117
- //#endregion
118
- exports.buildConfigurationFields = buildConfigurationFields;
119
- //# sourceMappingURL=buildConfigurationFields.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildConfigurationFields.cjs","names":["LOCALES","REQUIRED_LOCALES","STRICT_MODE","DEFAULT_LOCALE","ROUTING_MODE","STORAGE","BASE_PATH","FILE_EXTENSIONS","EXCLUDED_PATHS","WATCH","CONTENT_DIR","MODULE_AUGMENTATION_DIR","UNMERGED_DICTIONARIES_DIR","REMOTE_DICTIONARIES_DIR","DICTIONARIES_DIR","DYNAMIC_DICTIONARIES_DIR","FETCH_DICTIONARIES_DIR","TYPES_DIR","MAIN_DIR","CONFIG_DIR","CACHE_DIR","normalizePath","APPLICATION_URL","EDITOR_URL","CMS_URL","BACKEND_URL","PORT","IS_ENABLED","DICTIONARY_PRIORITY_STRATEGY","LIVE_SYNC","LIVE_SYNC_PORT","MODE","PREFIX","OPTIMIZE","IMPORT_MODE","TRAVERSE_PATTERN","OUTPUT_FORMAT","CACHE","FILL"],"sources":["../../../../../../../config/dist/esm/configFile/buildConfigurationFields.mjs"],"sourcesContent":["import { normalizePath } from \"../utils/normalizePath.mjs\";\nimport { CACHE, IMPORT_MODE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN } from \"../defaultValues/build.mjs\";\nimport { CACHE_DIR, CONFIG_DIR, CONTENT_DIR, DICTIONARIES_DIR, DYNAMIC_DICTIONARIES_DIR, EXCLUDED_PATHS, FETCH_DICTIONARIES_DIR, FILE_EXTENSIONS, MAIN_DIR, MODULE_AUGMENTATION_DIR, REMOTE_DICTIONARIES_DIR, TYPES_DIR, UNMERGED_DICTIONARIES_DIR, WATCH } from \"../defaultValues/content.mjs\";\nimport { FILL } from \"../defaultValues/dictionary.mjs\";\nimport { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT } from \"../defaultValues/editor.mjs\";\nimport { DEFAULT_LOCALE, LOCALES, REQUIRED_LOCALES, STRICT_MODE } from \"../defaultValues/internationalization.mjs\";\nimport { MODE, PREFIX } from \"../defaultValues/log.mjs\";\nimport { BASE_PATH, ROUTING_MODE, STORAGE } from \"../defaultValues/routing.mjs\";\nimport { isAbsolute, join } from \"node:path\";\n\n//#region src/configFile/buildConfigurationFields.ts\nlet storedConfiguration;\nconst buildInternationalizationFields = (customConfiguration) => ({\n\tlocales: customConfiguration?.locales ?? LOCALES,\n\trequiredLocales: customConfiguration?.requiredLocales ?? customConfiguration?.locales ?? REQUIRED_LOCALES,\n\tstrictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\tdefaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE\n});\nconst buildRoutingFields = (customConfiguration) => ({\n\tmode: customConfiguration?.mode ?? ROUTING_MODE,\n\tstorage: customConfiguration?.storage ?? STORAGE,\n\tbasePath: customConfiguration?.basePath ?? BASE_PATH\n});\nconst buildContentFields = (customConfiguration, baseDir) => {\n\tconst notDerivedContentConfig = {\n\t\tfileExtensions: customConfiguration?.fileExtensions ?? FILE_EXTENSIONS,\n\t\tbaseDir: customConfiguration?.baseDir ?? baseDir ?? process.cwd(),\n\t\texcludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n\t\twatch: customConfiguration?.watch ?? WATCH,\n\t\tformatCommand: customConfiguration?.formatCommand\n\t};\n\tconst optionalJoinBaseDir = (path) => {\n\t\tif (isAbsolute(path)) return path;\n\t\treturn join(notDerivedContentConfig.baseDir, path);\n\t};\n\tconst baseDirDerivedConfiguration = {\n\t\tcontentDir: (customConfiguration?.contentDir ?? CONTENT_DIR).map(optionalJoinBaseDir),\n\t\tmoduleAugmentationDir: optionalJoinBaseDir(customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR),\n\t\tunmergedDictionariesDir: optionalJoinBaseDir(customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR),\n\t\tremoteDictionariesDir: optionalJoinBaseDir(customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR),\n\t\tdictionariesDir: optionalJoinBaseDir(customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR),\n\t\tdynamicDictionariesDir: optionalJoinBaseDir(customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR),\n\t\tfetchDictionariesDir: optionalJoinBaseDir(customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR),\n\t\ttypesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n\t\tmainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n\t\tconfigDir: optionalJoinBaseDir(customConfiguration?.configDir ?? CONFIG_DIR),\n\t\tcacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR)\n\t};\n\tconst patternsConfiguration = {\n\t\twatchedFilesPattern: notDerivedContentConfig.fileExtensions.map((ext) => `/**/*${ext}`),\n\t\twatchedFilesPatternWithPath: notDerivedContentConfig.fileExtensions.flatMap((ext) => baseDirDerivedConfiguration.contentDir.map((contentDir) => `${normalizePath(contentDir)}/**/*${ext}`)),\n\t\toutputFilesPatternWithPath: `${normalizePath(baseDirDerivedConfiguration.dictionariesDir)}/**/*.json`\n\t};\n\treturn {\n\t\t...notDerivedContentConfig,\n\t\t...baseDirDerivedConfiguration,\n\t\t...patternsConfiguration\n\t};\n};\nconst buildEditorFields = (customConfiguration) => ({\n\tapplicationURL: customConfiguration?.applicationURL ?? APPLICATION_URL,\n\teditorURL: customConfiguration?.editorURL ?? EDITOR_URL,\n\tcmsURL: customConfiguration?.cmsURL ?? CMS_URL,\n\tbackendURL: customConfiguration?.backendURL ?? BACKEND_URL,\n\tport: customConfiguration?.port ?? PORT,\n\tenabled: customConfiguration?.enabled ?? IS_ENABLED,\n\tclientId: customConfiguration?.clientId ?? void 0,\n\tclientSecret: customConfiguration?.clientSecret ?? void 0,\n\tdictionaryPriorityStrategy: customConfiguration?.dictionaryPriorityStrategy ?? DICTIONARY_PRIORITY_STRATEGY,\n\tliveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\tliveSyncPort: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\n\tliveSyncURL: customConfiguration?.liveSyncURL ?? `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`\n});\nconst buildLogFields = (customConfiguration, logFunctions) => ({\n\tmode: customConfiguration?.mode ?? MODE,\n\tprefix: customConfiguration?.prefix ?? PREFIX,\n\terror: logFunctions?.error,\n\tlog: logFunctions?.log,\n\tinfo: logFunctions?.info,\n\twarn: logFunctions?.warn\n});\nconst buildAiFields = (customConfiguration) => ({\n\tprovider: customConfiguration?.provider,\n\tapiKey: customConfiguration?.apiKey,\n\tmodel: customConfiguration?.model,\n\ttemperature: customConfiguration?.temperature,\n\tapplicationContext: customConfiguration?.applicationContext\n});\nconst buildBuildFields = (customConfiguration) => ({\n\toptimize: customConfiguration?.optimize ?? OPTIMIZE,\n\timportMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\ttraversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\toutputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\tcache: customConfiguration?.cache ?? CACHE,\n\trequire: customConfiguration?.require\n});\nconst buildDictionaryFields = (customConfiguration) => ({ fill: customConfiguration?.fill ?? FILL });\n/**\n* Build the configuration fields by merging the default values with the custom configuration\n*/\nconst buildConfigurationFields = (customConfiguration, baseDir, logFunctions) => {\n\tstoredConfiguration = {\n\t\tinternationalization: buildInternationalizationFields(customConfiguration?.internationalization),\n\t\trouting: buildRoutingFields(customConfiguration?.routing),\n\t\tcontent: buildContentFields(customConfiguration?.content, baseDir),\n\t\teditor: buildEditorFields(customConfiguration?.editor),\n\t\tlog: buildLogFields(customConfiguration?.log, logFunctions),\n\t\tai: buildAiFields(customConfiguration?.ai),\n\t\tbuild: buildBuildFields(customConfiguration?.build),\n\t\tdictionary: buildDictionaryFields(customConfiguration?.dictionary),\n\t\tplugins: customConfiguration?.plugins\n\t};\n\treturn storedConfiguration;\n};\n\n//#endregion\nexport { buildConfigurationFields };\n//# sourceMappingURL=buildConfigurationFields.mjs.map"],"mappings":";;;;;;;;;;;;AAWA,IAAI;AACJ,MAAM,mCAAmC,yBAAyB;CACjE,SAAS,qBAAqB,WAAWA;CACzC,iBAAiB,qBAAqB,mBAAmB,qBAAqB,WAAWC;CACzF,YAAY,qBAAqB,cAAcC;CAC/C,eAAe,qBAAqB,iBAAiBC;CACrD;AACD,MAAM,sBAAsB,yBAAyB;CACpD,MAAM,qBAAqB,QAAQC;CACnC,SAAS,qBAAqB,WAAWC;CACzC,UAAU,qBAAqB,YAAYC;CAC3C;AACD,MAAM,sBAAsB,qBAAqB,YAAY;CAC5D,MAAM,0BAA0B;EAC/B,gBAAgB,qBAAqB,kBAAkBC;EACvD,SAAS,qBAAqB,WAAW,WAAW,QAAQ,KAAK;EACjE,cAAc,qBAAqB,gBAAgBC;EACnD,OAAO,qBAAqB,SAASC;EACrC,eAAe,qBAAqB;EACpC;CACD,MAAM,uBAAuB,SAAS;AACrC,gCAAe,KAAK,CAAE,QAAO;AAC7B,6BAAY,wBAAwB,SAAS,KAAK;;CAEnD,MAAM,8BAA8B;EACnC,aAAa,qBAAqB,cAAcC,6BAAa,IAAI,oBAAoB;EACrF,uBAAuB,oBAAoB,qBAAqB,yBAAyBC,wCAAwB;EACjH,yBAAyB,oBAAoB,qBAAqB,2BAA2BC,0CAA0B;EACvH,u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AAM,cAAc;CACpB,MAAM,cAAc;CACpB;AACD,MAAM,iBAAiB,yBAAyB;CAC/C,UAAU,qBAAqB;CAC/B,QAAQ,qBAAqB;CAC7B,OAAO,qBAAqB;CAC5B,aAAa,qBAAqB;CAClC,oBAAoB,qBAAqB;CACzC;AACD,MAAM,oBAAoB,yBAAyB;CAClD,UAAU,qBAAqB,YAAYC;CAC3C,YAAY,qBAAqB,cAAcC;CAC/C,iBAAiB,qBAAqB,mBAAmBC;CACzD,cAAc,qBAAqB,gBAAgBC;CACnD,OAAO,qBAAqB,SAASC;CACrC,SAAS,qBAAqB;CAC9B;AACD,MAAM,yBAAyB,yBAAyB,EAAE,MAAM,qBAAqB,QAAQC,yBAAM;;;;AAInG,MAAM,4BAA4B,qBAAqB,SAAS,iBAAiB;AAChF,uBAAsB;EACrB,sBAAsB,gCAAgC,qBAAqB,qBAAqB;EAChG,SAAS,mBAAmB,qBAAqB,QAAQ;EACzD,SAAS,mBAAmB,qBAAqB,SAAS,QAAQ;EAClE,QAAQ,kBAAkB,qBAAqB,OAAO;EACtD,KAAK,eAAe,qBAAqB,KAAK,aAAa;EAC3D,IAAI,cAAc,qBAAqB,GAAG;EAC1C,OAAO,iBAAiB,qBAAqB,MAAM;EACnD,YAAY,sBAAsB,qBAAqB,WAAW;EAClE,SAAS,qBAAqB;EAC9B;AACD,QAAO"}
@@ -1,69 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_logger = require('../logger.cjs');
3
- const require_cache = require('../utils/cache.cjs');
4
- const require_getPackageJsonPath = require('../utils/getPackageJsonPath.cjs');
5
- const require_buildConfigurationFields = require('./buildConfigurationFields.cjs');
6
- const require_searchConfigurationFile = require('./searchConfigurationFile.cjs');
7
- const require_loadConfigurationFile = require('./loadConfigurationFile.cjs');
8
- let node_path = require("node:path");
9
- let deepmerge = require("deepmerge");
10
- deepmerge = require_rolldown_runtime.__toESM(deepmerge);
11
-
12
- //#region ../config/dist/esm/configFile/getConfiguration.mjs
13
- /**
14
- * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
15
- */
16
- const getConfigurationAndFilePath = (options) => {
17
- let baseDir;
18
- try {
19
- baseDir = options?.baseDir ?? require_getPackageJsonPath.getPackageJsonPath().baseDir;
20
- } catch (_err) {
21
- return {
22
- configuration: require_buildConfigurationFields.buildConfigurationFields({}, options?.baseDir, options?.logFunctions),
23
- configurationFilePath: void 0
24
- };
25
- }
26
- const cachedConfiguration = require_cache.cache.get(options);
27
- if (cachedConfiguration) return cachedConfiguration;
28
- const { configurationFilePath, numCustomConfiguration } = require_searchConfigurationFile.searchConfigurationFile(baseDir);
29
- if (options?.override?.log?.mode === "verbose") logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);
30
- let storedConfiguration;
31
- if (configurationFilePath) storedConfiguration = require_buildConfigurationFields.buildConfigurationFields(require_loadConfigurationFile.loadConfigurationFile(configurationFilePath, {
32
- projectRequire: options?.require,
33
- envVarOptions: {
34
- env: options?.env,
35
- envFile: options?.envFile
36
- },
37
- additionalEnvVars: options?.additionalEnvVars,
38
- aliases: options?.aliases
39
- }), options?.baseDir, options?.logFunctions);
40
- const projectRequireConfig = options?.require ? { build: {
41
- require: options?.require,
42
- cache: options?.cache
43
- } } : {};
44
- const configuration = (0, deepmerge.default)((0, deepmerge.default)(storedConfiguration ?? {}, projectRequireConfig), options?.override ?? {});
45
- require_cache.cache.set(options, {
46
- configuration,
47
- configurationFilePath
48
- });
49
- return {
50
- configuration,
51
- configurationFilePath
52
- };
53
- };
54
- /**
55
- * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
56
- */
57
- const getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;
58
- const logConfigFileResult = (baseDir, numCustomConfiguration, configurationFilePath) => {
59
- if (numCustomConfiguration === 0) require_logger.logger("Configuration file not found, using default configuration.", { isVerbose: true });
60
- else {
61
- const relativeOutputPath = (0, node_path.relative)(baseDir, configurationFilePath);
62
- if (numCustomConfiguration === 1) require_logger.logger(`Configuration file found: ${relativeOutputPath}.`, { isVerbose: true });
63
- else require_logger.logger(`Multiple configuration files found, using ${relativeOutputPath}.`, { isVerbose: true });
64
- }
65
- };
66
-
67
- //#endregion
68
- exports.getConfiguration = getConfiguration;
69
- //# sourceMappingURL=getConfiguration.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConfiguration.cjs","names":["getPackageJsonPath","buildConfigurationFields","cache","searchConfigurationFile","loadConfigurationFile"],"sources":["../../../../../../../config/dist/esm/configFile/getConfiguration.mjs"],"sourcesContent":["import { logger } from \"../logger.mjs\";\nimport { cache } from \"../utils/cache.mjs\";\nimport { getPackageJsonPath } from \"../utils/getPackageJsonPath.mjs\";\nimport { buildConfigurationFields } from \"./buildConfigurationFields.mjs\";\nimport { searchConfigurationFile } from \"./searchConfigurationFile.mjs\";\nimport { loadConfigurationFile } from \"./loadConfigurationFile.mjs\";\nimport { relative } from \"node:path\";\nimport merge from \"deepmerge\";\n\n//#region src/configFile/getConfiguration.ts\n/**\n* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n*/\nconst getConfigurationAndFilePath = (options) => {\n\tlet baseDir;\n\ttry {\n\t\tbaseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n\t} catch (_err) {\n\t\treturn {\n\t\t\tconfiguration: buildConfigurationFields({}, options?.baseDir, options?.logFunctions),\n\t\t\tconfigurationFilePath: void 0\n\t\t};\n\t}\n\tconst cachedConfiguration = cache.get(options);\n\tif (cachedConfiguration) return cachedConfiguration;\n\tconst { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);\n\tif (options?.override?.log?.mode === \"verbose\") logConfigFileResult(baseDir, numCustomConfiguration, configurationFilePath);\n\tlet storedConfiguration;\n\tif (configurationFilePath) storedConfiguration = buildConfigurationFields(loadConfigurationFile(configurationFilePath, {\n\t\tprojectRequire: options?.require,\n\t\tenvVarOptions: {\n\t\t\tenv: options?.env,\n\t\t\tenvFile: options?.envFile\n\t\t},\n\t\tadditionalEnvVars: options?.additionalEnvVars,\n\t\taliases: options?.aliases\n\t}), options?.baseDir, options?.logFunctions);\n\tconst projectRequireConfig = options?.require ? { build: {\n\t\trequire: options?.require,\n\t\tcache: options?.cache\n\t} } : {};\n\tconst configuration = merge(merge(storedConfiguration ?? {}, projectRequireConfig), options?.override ?? {});\n\tcache.set(options, {\n\t\tconfiguration,\n\t\tconfigurationFilePath\n\t});\n\treturn {\n\t\tconfiguration,\n\t\tconfigurationFilePath\n\t};\n};\n/**\n* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n*/\nconst getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;\nconst logConfigFileResult = (baseDir, numCustomConfiguration, configurationFilePath) => {\n\tif (numCustomConfiguration === 0) logger(\"Configuration file not found, using default configuration.\", { isVerbose: true });\n\telse {\n\t\tconst relativeOutputPath = relative(baseDir, configurationFilePath);\n\t\tif (numCustomConfiguration === 1) logger(`Configuration file found: ${relativeOutputPath}.`, { isVerbose: true });\n\t\telse logger(`Multiple configuration files found, using ${relativeOutputPath}.`, { isVerbose: true });\n\t}\n};\n\n//#endregion\nexport { getConfiguration, getConfigurationAndFilePath };\n//# sourceMappingURL=getConfiguration.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,+BAA+B,YAAY;CAChD,IAAI;AACJ,KAAI;AACH,YAAU,SAAS,WAAWA,+CAAoB,CAAC;UAC3C,MAAM;AACd,SAAO;GACN,eAAeC,0DAAyB,EAAE,EAAE,SAAS,SAAS,SAAS,aAAa;GACpF,uBAAuB,KAAK;GAC5B;;CAEF,MAAM,sBAAsBC,oBAAM,IAAI,QAAQ;AAC9C,KAAI,oBAAqB,QAAO;CAChC,MAAM,EAAE,uBAAuB,2BAA2BC,wDAAwB,QAAQ;AAC1F,KAAI,SAAS,UAAU,KAAK,SAAS,UAAW,qBAAoB,SAAS,wBAAwB,sBAAsB;CAC3H,IAAI;AACJ,KAAI,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