@intlayer/api 8.12.2 → 8.12.4-canary.0

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 (61) hide show
  1. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
  2. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
  3. package/dist/cjs/fetcher.cjs.map +1 -1
  4. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  5. package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
  6. package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
  7. package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
  8. package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
  9. package/dist/cjs/getIntlayerAPI/environment.cjs.map +1 -1
  10. package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
  11. package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
  12. package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
  13. package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
  14. package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
  15. package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
  16. package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAPI/reviewer.cjs.map +1 -1
  18. package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
  19. package/dist/cjs/getIntlayerAPI/showcaseProject.cjs.map +1 -1
  20. package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
  21. package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
  22. package/dist/cjs/getIntlayerAPI/translate.cjs.map +1 -1
  23. package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
  24. package/dist/cjs/proxy.cjs.map +1 -1
  25. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
  26. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
  27. package/dist/esm/fetcher.mjs.map +1 -1
  28. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  29. package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
  30. package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
  31. package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
  32. package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
  33. package/dist/esm/getIntlayerAPI/environment.mjs.map +1 -1
  34. package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
  35. package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
  36. package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
  37. package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
  38. package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
  39. package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
  40. package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
  41. package/dist/esm/getIntlayerAPI/reviewer.mjs.map +1 -1
  42. package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
  43. package/dist/esm/getIntlayerAPI/showcaseProject.mjs.map +1 -1
  44. package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
  45. package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
  46. package/dist/esm/getIntlayerAPI/translate.mjs.map +1 -1
  47. package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
  48. package/dist/esm/proxy.mjs.map +1 -1
  49. package/dist/types/fetcher.d.ts.map +1 -1
  50. package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
  51. package/dist/types/getIntlayerAPI/audit.d.ts.map +1 -1
  52. package/dist/types/getIntlayerAPI/bitbucket.d.ts.map +1 -1
  53. package/dist/types/getIntlayerAPI/github.d.ts.map +1 -1
  54. package/dist/types/getIntlayerAPI/gitlab.d.ts.map +1 -1
  55. package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
  56. package/dist/types/getIntlayerAPI/showcaseProject.d.ts.map +1 -1
  57. package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
  58. package/dist/types/index.d.ts +1 -1
  59. package/dist/types/proxy.d.ts.map +1 -1
  60. package/dist/types/types.d.ts +1 -1
  61. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/getIntlayerAPI/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesKeysResult,\n GetDictionariesParams,\n GetDictionariesResult,\n GetDictionariesUpdateTimestampResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesUpdateTimestamp = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesUpdateTimestampResult>(\n `${PROJECT_API_ROUTE}/update`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n body: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionary.id}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}/${id}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionariesUpdateTimestamp,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n"],"mappings":";;;;AAqBA,MAAa,oBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAc,OAAO,WAExB;;;;;CAMxC,MAAM,kBAAkB,OACtB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;CAKF,MAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,MAAM,QACJ,GAAG,kBAAkB,QACrB,gBACA,cACA,EACE,OAAO,WACT,CACF;;;;CAKF,MAAM,iCAAiC,OACrC,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,UACrB,gBACA,cACA,EACE,OAAO,WACT,CACF;;;;;;CAOF,MAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,iBACxB,gBACA,cACA,EACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,SAAS,EAAE,IAAI,OACtD,CACF;;;;;CAMF,MAAM,gBAAgB,OACpB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;CAEF,MAAM,mBAAmB,OACvB,cACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,aAAa;CACvB,CACF;;;;;CAMF,MAAM,mBAAmB,OACvB,YACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,WAAW,MACnC,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,mBAAmB,OACvB,IACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,MACxB,gBACA,cACA,EACE,QAAQ,SACV,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/getIntlayerAPI/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesKeysResult,\n GetDictionariesParams,\n GetDictionariesResult,\n GetDictionariesUpdateTimestampResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesUpdateTimestamp = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesUpdateTimestampResult>(\n `${PROJECT_API_ROUTE}/update`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n body: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionary.id}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}/${id}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionariesUpdateTimestamp,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n"],"mappings":";;;;AAqBA,MAAa,oBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAc,OAAO,WAExB;;;;;CAMxC,MAAM,kBAAkB,OACtB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;CAKH,MAAM,sBAAsB,OAAO,eAA+B,EAAE,KAClE,MAAM,QACJ,GAAG,kBAAkB,QACrB,gBACA,cACA,EACE,OAAO,YACR,CACF;;;;CAKH,MAAM,iCAAiC,OACrC,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,UACrB,gBACA,cACA,EACE,OAAO,YACR,CACF;;;;;;CAOH,MAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,GAAG,iBACxB,gBACA,cACA,EACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,UAAU,EAAE,GAAG,QACrD,CACF;;;;;CAMH,MAAM,gBAAgB,OACpB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;CAEH,MAAM,mBAAmB,OACvB,cACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,cAAc;EACvB,CACF;;;;;CAMH,MAAM,mBAAmB,OACvB,YACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,GAAG,WAAW,MACnC,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,mBAAmB,OACvB,IACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,GAAG,MACxB,gBACA,cACA,EACE,QAAQ,UACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from 'intlayer-editor';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEditorAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const editorURL = intlayerConfig?.editor?.editorURL ?? editor.editorURL;\n\n const EDITOR_API_ROUTE = `${editorURL}/api`;\n\n /**\n * Get the Intlayer configuration\n */\n const getConfiguration = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetConfigurationResult> => {\n const response = await fetcher<GetConfigurationResult>(\n `${EDITOR_API_ROUTE}/config`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetConfigurationResult;\n };\n\n /**\n * Get the Intlayer configuration\n */\n const getDictionaries = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetEditorDictionariesResult> => {\n const response = await fetcher<GetEditorDictionariesResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetEditorDictionariesResult;\n };\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const writeDictionary = async (\n body: WriteContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<WriteContentDeclarationResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getDictionaries,\n getConfiguration,\n writeDictionary,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,mBAAmB,GAFP,gBAAgB,QAAQ,aAAa,OAAO,UAExB;;;;CAKtC,MAAM,mBAAmB,OACvB,eAA+B,CAAC,MACI;EAOpC,QAAO,MANgB,QACrB,GAAG,iBAAiB,UACpB,gBACA,YACF,GAEgB;CAClB;;;;CAKA,MAAM,kBAAkB,OACtB,eAA+B,CAAC,MACS;EAOzC,QAAO,MANgB,QACrB,GAAG,iBAAiB,cACpB,gBACA,YACF,GAEgB;CAClB;;;;;CAMA,MAAM,kBAAkB,OACtB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,cACpB,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from 'intlayer-editor';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEditorAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const editorURL = intlayerConfig?.editor?.editorURL ?? editor.editorURL;\n\n const EDITOR_API_ROUTE = `${editorURL}/api`;\n\n /**\n * Get the Intlayer configuration\n */\n const getConfiguration = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetConfigurationResult> => {\n const response = await fetcher<GetConfigurationResult>(\n `${EDITOR_API_ROUTE}/config`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetConfigurationResult;\n };\n\n /**\n * Get the Intlayer configuration\n */\n const getDictionaries = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetEditorDictionariesResult> => {\n const response = await fetcher<GetEditorDictionariesResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetEditorDictionariesResult;\n };\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const writeDictionary = async (\n body: WriteContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<WriteContentDeclarationResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getDictionaries,\n getConfiguration,\n writeDictionary,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,mBAAmB,GAFP,gBAAgB,QAAQ,aAAa,OAAO,UAExB;;;;CAKtC,MAAM,mBAAmB,OACvB,eAA+B,EAAE,KACG;AAOpC,UAAO,MANgB,QACrB,GAAG,iBAAiB,UACpB,gBACA,aACD,EAEe;;;;;CAMlB,MAAM,kBAAkB,OACtB,eAA+B,EAAE,KACQ;AAOzC,UAAO,MANgB,QACrB,GAAG,iBAAiB,cACpB,gBACA,aACD,EAEe;;;;;;CAOlB,MAAM,kBAAkB,OACtB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,cACpB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"environment.mjs","names":[],"sources":["../../../src/getIntlayerAPI/environment.ts"],"sourcesContent":["import type {\n AddEnvironmentBody,\n AddEnvironmentResult,\n DeleteEnvironmentResult,\n MigrateEnvironmentBody,\n MigrateEnvironmentResult,\n ResetToProductionEnvironmentResult,\n SelectEnvironmentResult,\n UpdateEnvironmentBody,\n UpdateEnvironmentResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEnvironmentAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const ENVIRONMENT_API_ROUTE = `${backendURL}/api/project/environment`;\n\n const addEnvironment = async (\n body: AddEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddEnvironmentResult>(\n ENVIRONMENT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const updateEnvironment = async (\n environmentId: string,\n body: UpdateEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/${environmentId}`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n const deleteEnvironment = async (\n environmentId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/${environmentId}`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n const selectEnvironment = async (\n environmentId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/${environmentId}/select`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT' }\n );\n\n const resetToProductionEnvironment = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetToProductionEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/production/select`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT' }\n );\n\n const migrateEnvironment = async (\n body: MigrateEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<MigrateEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/migrate`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n return {\n addEnvironment,\n updateEnvironment,\n deleteEnvironment,\n selectEnvironment,\n resetToProductionEnvironment,\n migrateEnvironment,\n };\n};\n"],"mappings":";;;;AAeA,MAAa,qBACX,iBAAiC,CAAC,GAClC,mBACG;CAEH,MAAM,wBAAwB,GADX,gBAAgB,QAAQ,cAAc,OAAO,WACpB;CAE5C,MAAM,iBAAiB,OACrB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,uBACA,gBACA,cACA;EAAE,QAAQ;EAAQ;CAAK,CACzB;CAEF,MAAM,oBAAoB,OACxB,eACA,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,sBAAsB,GAAG,iBAC5B,gBACA,cACA;EAAE,QAAQ;EAAO;CAAK,CACxB;CAEF,MAAM,oBAAoB,OACxB,eACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,sBAAsB,GAAG,iBAC5B,gBACA,cACA,EAAE,QAAQ,SAAS,CACrB;CAEF,MAAM,oBAAoB,OACxB,eACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,sBAAsB,GAAG,cAAc,UAC1C,gBACA,cACA,EAAE,QAAQ,MAAM,CAClB;CAEF,MAAM,+BAA+B,OACnC,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,sBAAsB,qBACzB,gBACA,cACA,EAAE,QAAQ,MAAM,CAClB;CAEF,MAAM,qBAAqB,OACzB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,sBAAsB,WACzB,gBACA,cACA;EAAE,QAAQ;EAAQ;CAAK,CACzB;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"environment.mjs","names":[],"sources":["../../../src/getIntlayerAPI/environment.ts"],"sourcesContent":["import type {\n AddEnvironmentBody,\n AddEnvironmentResult,\n DeleteEnvironmentResult,\n MigrateEnvironmentBody,\n MigrateEnvironmentResult,\n ResetToProductionEnvironmentResult,\n SelectEnvironmentResult,\n UpdateEnvironmentBody,\n UpdateEnvironmentResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEnvironmentAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const ENVIRONMENT_API_ROUTE = `${backendURL}/api/project/environment`;\n\n const addEnvironment = async (\n body: AddEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddEnvironmentResult>(\n ENVIRONMENT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const updateEnvironment = async (\n environmentId: string,\n body: UpdateEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/${environmentId}`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n const deleteEnvironment = async (\n environmentId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/${environmentId}`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n const selectEnvironment = async (\n environmentId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/${environmentId}/select`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT' }\n );\n\n const resetToProductionEnvironment = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetToProductionEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/production/select`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT' }\n );\n\n const migrateEnvironment = async (\n body: MigrateEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<MigrateEnvironmentResult>(\n `${ENVIRONMENT_API_ROUTE}/migrate`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n return {\n addEnvironment,\n updateEnvironment,\n deleteEnvironment,\n selectEnvironment,\n resetToProductionEnvironment,\n migrateEnvironment,\n };\n};\n"],"mappings":";;;;AAeA,MAAa,qBACX,iBAAiC,EAAE,EACnC,mBACG;CAEH,MAAM,wBAAwB,GADX,gBAAgB,QAAQ,cAAc,OAAO,WACpB;CAE5C,MAAM,iBAAiB,OACrB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,uBACA,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;CAEH,MAAM,oBAAoB,OACxB,eACA,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,sBAAsB,GAAG,iBAC5B,gBACA,cACA;EAAE,QAAQ;EAAO;EAAM,CACxB;CAEH,MAAM,oBAAoB,OACxB,eACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,sBAAsB,GAAG,iBAC5B,gBACA,cACA,EAAE,QAAQ,UAAU,CACrB;CAEH,MAAM,oBAAoB,OACxB,eACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,sBAAsB,GAAG,cAAc,UAC1C,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;CAEH,MAAM,+BAA+B,OACnC,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,sBAAsB,qBACzB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;CAEH,MAAM,qBAAqB,OACzB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,sBAAsB,WACzB,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitHubRepository = {\n id: number;\n name: string;\n full_name: string;\n owner: {\n login: string;\n id: number;\n };\n html_url: string;\n default_branch: string;\n private: boolean;\n};\n\nexport type GitHubAuthCallbackBody = {\n code: string;\n};\n\nexport type GitHubAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitHubListReposResult = {\n data: GitHubRepository[];\n};\n\nexport type GitHubCheckConfigBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n};\n\nexport type GitHubCheckConfigResult = {\n data: {\n hasConfig: boolean;\n };\n};\n\nexport type GitHubGetConfigFileBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n path?: string;\n};\n\nexport type GitHubGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitHubGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport type GitHubGetTokenResult = {\n data: {\n token: string;\n };\n};\n\nexport const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const GITHUB_API_ROUTE = `${backendURL}/api/github`;\n\n /**\n * Get GitHub OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n */\n const getAuthUrl = async (\n redirectUri: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetAuthUrlResult>(\n `${GITHUB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri },\n }\n );\n\n /**\n * Exchange GitHub authorization code for access token\n * @param code - GitHub authorization code\n */\n const authenticate = async (\n code: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubAuthCallbackResult>(\n `${GITHUB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code },\n }\n );\n\n /**\n * Get user's GitHub repositories\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n */\n const getRepositories = async (\n token?: string | null,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubListReposResult>(\n `${GITHUB_API_ROUTE}/repos`,\n authAPIOptions,\n otherOptions,\n {\n params: token ? { token } : undefined,\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubCheckConfigResult>(\n `${GITHUB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n */\n const getConfigFile = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetConfigFileResult>(\n `${GITHUB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch, path },\n }\n );\n\n /**\n * Get user's GitHub token\n */\n const getToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GitHubGetTokenResult>(\n `${GITHUB_API_ROUTE}/token`,\n authAPIOptions,\n otherOptions\n );\n\n return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n getToken,\n };\n};\n"],"mappings":";;;;AAsEA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;CAMvC,MAAM,aAAa,OACjB,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ,EAAE,YAAY,EACxB,CACF;;;;;CAMF,MAAM,eAAe,OACnB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,KAAK;CACf,CACF;;;;;CAMF,MAAM,kBAAkB,OACtB,OACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,SACpB,gBACA,cACA,EACE,QAAQ,QAAQ,EAAE,MAAM,IAAI,OAC9B,CACF;;;;;;;;CASF,MAAM,sBAAsB,OAC1B,OACA,OACA,YACA,SAAiB,QACjB,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;EAAO;CAC/D,CACF;;;;;;;;;CAUF,MAAM,gBAAgB,OACpB,OACA,OACA,YACA,SAAiB,QACjB,OAAe,sBACf,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;EAAK;CACrE,CACF;;;;CAKF,MAAM,WAAW,OAAO,eAA+B,CAAC,MACtD,MAAM,QACJ,GAAG,iBAAiB,SACpB,gBACA,YACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitHubRepository = {\n id: number;\n name: string;\n full_name: string;\n owner: {\n login: string;\n id: number;\n };\n html_url: string;\n default_branch: string;\n private: boolean;\n};\n\nexport type GitHubAuthCallbackBody = {\n code: string;\n};\n\nexport type GitHubAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitHubListReposResult = {\n data: GitHubRepository[];\n};\n\nexport type GitHubCheckConfigBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n};\n\nexport type GitHubCheckConfigResult = {\n data: {\n hasConfig: boolean;\n };\n};\n\nexport type GitHubGetConfigFileBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n path?: string;\n};\n\nexport type GitHubGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitHubGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport type GitHubGetTokenResult = {\n data: {\n token: string;\n };\n};\n\nexport const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const GITHUB_API_ROUTE = `${backendURL}/api/github`;\n\n /**\n * Get GitHub OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n */\n const getAuthUrl = async (\n redirectUri: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetAuthUrlResult>(\n `${GITHUB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri },\n }\n );\n\n /**\n * Exchange GitHub authorization code for access token\n * @param code - GitHub authorization code\n */\n const authenticate = async (\n code: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubAuthCallbackResult>(\n `${GITHUB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code },\n }\n );\n\n /**\n * Get user's GitHub repositories\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n */\n const getRepositories = async (\n token?: string | null,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubListReposResult>(\n `${GITHUB_API_ROUTE}/repos`,\n authAPIOptions,\n otherOptions,\n {\n params: token ? { token } : undefined,\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubCheckConfigResult>(\n `${GITHUB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n */\n const getConfigFile = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetConfigFileResult>(\n `${GITHUB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch, path },\n }\n );\n\n /**\n * Get user's GitHub token\n */\n const getToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GitHubGetTokenResult>(\n `${GITHUB_API_ROUTE}/token`,\n authAPIOptions,\n otherOptions\n );\n\n return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n getToken,\n };\n};\n"],"mappings":";;;;AAsEA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;CAMvC,MAAM,aAAa,OACjB,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ,EAAE,aAAa,EACxB,CACF;;;;;CAMH,MAAM,eAAe,OACnB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,MAAM;EACf,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,OACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,SACpB,gBACA,cACA,EACE,QAAQ,QAAQ,EAAE,OAAO,GAAG,QAC7B,CACF;;;;;;;;CASH,MAAM,sBAAsB,OAC1B,OACA,OACA,YACA,SAAiB,QACjB,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;EAC/D,CACF;;;;;;;;;CAUH,MAAM,gBAAgB,OACpB,OACA,OACA,YACA,SAAiB,QACjB,OAAe,sBACf,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;GAAM;EACrE,CACF;;;;CAKH,MAAM,WAAW,OAAO,eAA+B,EAAE,KACvD,MAAM,QACJ,GAAG,iBAAiB,SACpB,gBACA,aACD;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitLabProject = {\n id: number;\n name: string;\n path_with_namespace: string;\n web_url: string;\n default_branch: string;\n visibility: string;\n last_activity_at: string;\n namespace: {\n id: number;\n name: string;\n path: string;\n };\n};\n\nexport type GitLabAuthCallbackBody = {\n code: string;\n redirectUri: string;\n instanceUrl?: string;\n};\n\nexport type GitLabAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitLabListProjectsResult = {\n data: GitLabProject[];\n};\n\nexport type GitLabCheckConfigBody = {\n token?: string;\n projectId: number;\n branch?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabCheckConfigResult = {\n data: {\n hasConfig: boolean;\n configPaths: string[];\n };\n};\n\nexport type GitLabGetConfigFileBody = {\n token?: string;\n projectId: number;\n branch?: string;\n path?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitLabGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport const getGitlabAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const GITLAB_API_ROUTE = `${backendURL}/api/gitlab`;\n\n /**\n * Get GitLab OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n * @param instanceUrl - Custom GitLab instance URL (optional, for self-hosted)\n */\n const getAuthUrl = async (\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetAuthUrlResult>(\n `${GITLAB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri, ...(instanceUrl && { instanceUrl }) },\n }\n );\n\n /**\n * Exchange GitLab authorization code for access token\n * @param code - GitLab authorization code\n * @param redirectUri - Redirect URI used in the authorization request\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const authenticate = async (\n code: string,\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabAuthCallbackResult>(\n `${GITLAB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code, redirectUri, instanceUrl },\n }\n );\n\n /**\n * Get user's GitLab projects\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getProjects = async (\n token?: string | null,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabListProjectsResult>(\n `${GITLAB_API_ROUTE}/projects`,\n authAPIOptions,\n otherOptions,\n {\n params: {\n ...(token && { token }),\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabCheckConfigResult>(\n `${GITLAB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getConfigFile = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetConfigFileResult>(\n `${GITLAB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n path,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getProjects,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n"],"mappings":";;;;AAqEA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;;CAOvC,MAAM,aAAa,OACjB,aACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EAAE;EAAa,GAAI,eAAe,EAAE,YAAY;CAAG,EAC7D,CACF;;;;;;;CAQF,MAAM,eAAe,OACnB,MACA,aACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE;GAAM;GAAa;EAAY;CACzC,CACF;;;;;;CAOF,MAAM,cAAc,OAClB,OACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EACN,GAAI,SAAS,EAAE,MAAM;EACrB,GAAI,eAAe,EAAE,YAAY;CACnC,EACF,CACF;;;;;;;;CASF,MAAM,sBAAsB,OAC1B,OACA,WACA,SAAiB,QACjB,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA,GAAI,eAAe,EAAE,YAAY;EACnC;CACF,CACF;;;;;;;;;CAUF,MAAM,gBAAgB,OACpB,OACA,WACA,SAAiB,QACjB,OAAe,sBACf,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA;GACA,GAAI,eAAe,EAAE,YAAY;EACnC;CACF,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitLabProject = {\n id: number;\n name: string;\n path_with_namespace: string;\n web_url: string;\n default_branch: string;\n visibility: string;\n last_activity_at: string;\n namespace: {\n id: number;\n name: string;\n path: string;\n };\n};\n\nexport type GitLabAuthCallbackBody = {\n code: string;\n redirectUri: string;\n instanceUrl?: string;\n};\n\nexport type GitLabAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitLabListProjectsResult = {\n data: GitLabProject[];\n};\n\nexport type GitLabCheckConfigBody = {\n token?: string;\n projectId: number;\n branch?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabCheckConfigResult = {\n data: {\n hasConfig: boolean;\n configPaths: string[];\n };\n};\n\nexport type GitLabGetConfigFileBody = {\n token?: string;\n projectId: number;\n branch?: string;\n path?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitLabGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport const getGitlabAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const GITLAB_API_ROUTE = `${backendURL}/api/gitlab`;\n\n /**\n * Get GitLab OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n * @param instanceUrl - Custom GitLab instance URL (optional, for self-hosted)\n */\n const getAuthUrl = async (\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetAuthUrlResult>(\n `${GITLAB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri, ...(instanceUrl && { instanceUrl }) },\n }\n );\n\n /**\n * Exchange GitLab authorization code for access token\n * @param code - GitLab authorization code\n * @param redirectUri - Redirect URI used in the authorization request\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const authenticate = async (\n code: string,\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabAuthCallbackResult>(\n `${GITLAB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code, redirectUri, instanceUrl },\n }\n );\n\n /**\n * Get user's GitLab projects\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getProjects = async (\n token?: string | null,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabListProjectsResult>(\n `${GITLAB_API_ROUTE}/projects`,\n authAPIOptions,\n otherOptions,\n {\n params: {\n ...(token && { token }),\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabCheckConfigResult>(\n `${GITLAB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getConfigFile = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetConfigFileResult>(\n `${GITLAB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n path,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getProjects,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n"],"mappings":";;;;AAqEA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;;CAOvC,MAAM,aAAa,OACjB,aACA,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EAAE;EAAa,GAAI,eAAe,EAAE,aAAa;EAAG,EAC7D,CACF;;;;;;;CAQH,MAAM,eAAe,OACnB,MACA,aACA,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE;GAAM;GAAa;GAAa;EACzC,CACF;;;;;;CAOH,MAAM,cAAc,OAClB,OACA,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EACN,GAAI,SAAS,EAAE,OAAO;EACtB,GAAI,eAAe,EAAE,aAAa;EACnC,EACF,CACF;;;;;;;;CASH,MAAM,sBAAsB,OAC1B,OACA,WACA,SAAiB,QACjB,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA,GAAI,eAAe,EAAE,aAAa;GACnC;EACF,CACF;;;;;;;;;CAUH,MAAM,gBAAgB,OACpB,OACA,WACA,SAAiB,QACjB,OAAe,sBACf,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA;GACA,GAAI,eAAe,EAAE,aAAa;GACnC;EACF,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,kBACX,iBAAiC,CAAC,GAClC,mBACsB;CACtB,MAAM,iBAAiB,KAAK,kBAAkB,CAAC,GAAG,EAChD,OACF,CAAC;CAED,OAAO;EACL,cAAc,mBAAmB,gBAAgB,cAAc;EAC/D,SAAS,cAAc,gBAAgB,cAAc;EACrD,aAAa,kBAAkB,gBAAgB,cAAc;EAC7D,MAAM,WAAW,gBAAgB,cAAc;EAC/C,OAAO,YAAY,gBAAgB,cAAc;EACjD,YAAY,iBAAiB,gBAAgB,cAAc;EAC3D,QAAQ,aAAa,gBAAgB,cAAc;EACnD,IAAI,SAAS,gBAAgB,cAAc;EAC3C,OAAO,YAAY,gBAAgB,cAAc;EACjD,KAAK,UAAU,gBAAgB,cAAc;EAC7C,QAAQ,aAAa,gBAAgB,cAAc;EACnD,QAAQ,aAAa,gBAAgB,cAAc;EACnD,YAAY,iBAAiB,gBAAgB,cAAc;EAC3D,QAAQ,aAAa,gBAAgB,cAAc;EACnD,QAAQ,aAAa,gBAAgB,cAAc;EACnD,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,iBAAiB,sBAAsB,gBAAgB,cAAc;EACrE,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,UAAU,eAAe,gBAAgB,cAAc;CACzD;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,kBACX,iBAAiC,EAAE,EACnC,mBACsB;CACtB,MAAM,iBAAiB,KAAK,kBAAkB,EAAE,EAAE,EAChD,QACD,CAAC;AAEF,QAAO;EACL,cAAc,mBAAmB,gBAAgB,eAAe;EAChE,SAAS,cAAc,gBAAgB,eAAe;EACtD,aAAa,kBAAkB,gBAAgB,eAAe;EAC9D,MAAM,WAAW,gBAAgB,eAAe;EAChD,OAAO,YAAY,gBAAgB,eAAe;EAClD,YAAY,iBAAiB,gBAAgB,eAAe;EAC5D,QAAQ,aAAa,gBAAgB,eAAe;EACpD,IAAI,SAAS,gBAAgB,eAAe;EAC5C,OAAO,YAAY,gBAAgB,eAAe;EAClD,KAAK,UAAU,gBAAgB,eAAe;EAC9C,QAAQ,aAAa,gBAAgB,eAAe;EACpD,QAAQ,aAAa,gBAAgB,eAAe;EACpD,YAAY,iBAAiB,gBAAgB,eAAe;EAC5D,QAAQ,aAAa,gBAAgB,eAAe;EACpD,QAAQ,aAAa,gBAAgB,eAAe;EACpD,WAAW,gBAAgB,gBAAgB,eAAe;EAC1D,iBAAiB,sBAAsB,gBAAgB,eAAe;EACtE,WAAW,gBAAgB,gBAAgB,eAAe;EAC1D,UAAU,eAAe,gBAAgB,eAAe;EACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"newsletter.mjs","names":[],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;\n\n /**\n * Subscribe a user to newsletter(s)\n * @param body - Newsletter subscription parameters.\n * @returns Newsletter subscription result.\n */\n const subscribeToNewsletter = async (\n body: NewsletterSubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/subscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Unsubscribe a user from newsletter(s)\n * @param body - Newsletter unsubscription parameters.\n * @returns Newsletter unsubscription result.\n */\n const unsubscribeFromNewsletter = async (\n body: NewsletterUnsubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/unsubscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Get newsletter subscription status for the authenticated user\n * @returns Newsletter subscription status.\n */\n const getNewsletterStatus = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/status`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n return {\n subscribeToNewsletter,\n unsubscribeFromNewsletter,\n getNewsletterStatus,\n };\n};\n"],"mappings":";;;;AASA,MAAa,oBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,uBAAuB,GAFV,gBAAgB,QAAQ,cAAc,OAAO,WAErB;;;;;;CAO3C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBAAqB,aACxB,gBACA,cACA;EACE,QAAQ;EACF;CACR,CACF;;;;;;CAOF,MAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBAAqB,eACxB,gBACA,cACA;EACE,QAAQ;EACF;CACR,CACF;;;;;CAMF,MAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,MAAM,QACJ,GAAG,qBAAqB,UACxB,gBACA,cACA,EACE,QAAQ,MACV,CACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"newsletter.mjs","names":[],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;\n\n /**\n * Subscribe a user to newsletter(s)\n * @param body - Newsletter subscription parameters.\n * @returns Newsletter subscription result.\n */\n const subscribeToNewsletter = async (\n body: NewsletterSubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/subscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Unsubscribe a user from newsletter(s)\n * @param body - Newsletter unsubscription parameters.\n * @returns Newsletter unsubscription result.\n */\n const unsubscribeFromNewsletter = async (\n body: NewsletterUnsubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/unsubscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Get newsletter subscription status for the authenticated user\n * @returns Newsletter subscription status.\n */\n const getNewsletterStatus = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/status`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n return {\n subscribeToNewsletter,\n unsubscribeFromNewsletter,\n getNewsletterStatus,\n };\n};\n"],"mappings":";;;;AASA,MAAa,oBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,uBAAuB,GAFV,gBAAgB,QAAQ,cAAc,OAAO,WAErB;;;;;;CAO3C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBAAqB,aACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBAAqB,eACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;CAMH,MAAM,sBAAsB,OAAO,eAA+B,EAAE,KAClE,MAAM,QACJ,GAAG,qBAAqB,UACxB,gBACA,cACA,EACE,QAAQ,OACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n CreateCliSessionTokenResult,\n GetCliSessionMeResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n /**\n * Gets an oAuth2 accessToken via client_credentials grant\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n `${backendURL}/oauth2/token`,\n {},\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n /**\n * Creates a short-lived (2h) CLI session token for the authenticated user.\n * Requires a valid browser session cookie.\n */\n const createCliSessionToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreateCliSessionTokenResult>(\n `${backendURL}/api/cli-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Verifies a CLI session token and returns the associated project context.\n * Useful for checking config consistency in the CLI.\n */\n const getCliSessionMe = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCliSessionMeResult>(\n `${backendURL}/api/cli-session/me`,\n authAPIOptions,\n otherOptions\n );\n\n return {\n getOAuth2AccessToken,\n createCliSessionToken,\n getCliSessionMe,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,eACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aAAa,gBAAgB,QAAQ,cAAc,OAAO;CAChE,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,CAAC;;;;CAK9D,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM,QACJ,GAAG,WAAW,gBACd,CAAC,GACD,cACA;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,oCAClB;EACA,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;EACjB;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAAO,eAA+B,CAAC,MACnE,MAAM,QACJ,GAAG,WAAW,mBACd,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;;;;;CAMF,MAAM,kBAAkB,OAAO,eAA+B,CAAC,MAC7D,MAAM,QACJ,GAAG,WAAW,sBACd,gBACA,YACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n CreateCliSessionTokenResult,\n GetCliSessionMeResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n /**\n * Gets an oAuth2 accessToken via client_credentials grant\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n `${backendURL}/oauth2/token`,\n {},\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n /**\n * Creates a short-lived (2h) CLI session token for the authenticated user.\n * Requires a valid browser session cookie.\n */\n const createCliSessionToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreateCliSessionTokenResult>(\n `${backendURL}/api/cli-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Verifies a CLI session token and returns the associated project context.\n * Useful for checking config consistency in the CLI.\n */\n const getCliSessionMe = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCliSessionMeResult>(\n `${backendURL}/api/cli-session/me`,\n authAPIOptions,\n otherOptions\n );\n\n return {\n getOAuth2AccessToken,\n createCliSessionToken,\n getCliSessionMe,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,eACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aAAa,gBAAgB,QAAQ,cAAc,OAAO;CAChE,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,EAAE;;;;CAK/D,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAM,QACJ,GAAG,WAAW,gBACd,EAAE,EACF,cACA;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,qCACjB;EACD,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;GAChB;EACF,CACF;;;;;CAMH,MAAM,wBAAwB,OAAO,eAA+B,EAAE,KACpE,MAAM,QACJ,GAAG,WAAW,mBACd,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;;;;;CAMH,MAAM,kBAAkB,OAAO,eAA+B,EAAE,KAC9D,MAAM,QACJ,GAAG,WAAW,sBACd,gBACA,aACD;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"organization.mjs","names":[],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Admin-only: Deletes any organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganizationByIdAdmin = async (\n organizationId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n deleteOrganizationByIdAdmin,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":";;;;AAsBA,MAAa,sBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,yBAAyB,GAFZ,gBAAgB,QAAQ,cAAc,OAAO,WAEnB;;;;;CAM7C,MAAM,mBAAmB,OACvB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;;CAMF,MAAM,kBAAkB,OACtB,gBACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,cAAc,KAClD,gBACA,YACF;;;;;CAMF,MAAM,kBAAkB,OACtB,cACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,qBAAqB,OACzB,cACA,eAA+B,CAAC,MAEhC,QACE,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,WAC1B,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;;CAOF,MAAM,gCAAgC,OACpC,gBACA,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,GAAG,eAAe,WAC5C,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,UAC1B,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;CAMF,MAAM,qBAAqB,OAAO,eAA+B,CAAC,MAChE,MAAM,QACJ,wBACA,gBACA,cACA,EACE,QAAQ,SACV,CACF;;;;;CAMF,MAAM,8BAA8B,OAClC,gBACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,GAAG,eAAe,SAC5C,gBACA,cACA,EAAE,QAAQ,SAAS,CACrB;;;;;CAMF,MAAM,qBAAqB,OACzB,gBACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,cAAc,KAClD,gBACA,cACA,EACE,QAAQ,MACV,CACF;;;;;CAMF,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM,QACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,OACV,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"organization.mjs","names":[],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Admin-only: Deletes any organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganizationByIdAdmin = async (\n organizationId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n deleteOrganizationByIdAdmin,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":";;;;AAsBA,MAAa,sBACX,iBAAiC,EAAE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G,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;CAMH,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAM,QACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"project.mjs","names":[],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n ResponseData,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateMemberAccessBody,\n UpdateMemberAccessResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Admin-only: Deletes any project from the database by its ID.\n * @param projectId - Project ID.\n */\n const deleteProjectByIdAdmin = async (\n projectId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}/${projectId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n /**\n * Triggers CI builds for a project (Git provider pipelines and webhooks).\n * @param otherOptions - Fetcher options.\n * @returns The trigger results.\n */\n const triggerBuild = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<TriggerBuildResult>(\n `${PROJECT_API_ROUTE}/build`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Triggers a single webhook by index.\n * @param webhookIndex - The index of the webhook to trigger.\n * @param otherOptions - Fetcher options.\n * @returns The trigger result.\n */\n const triggerWebhook = async (\n webhookIndex: TriggerWebhookBody['webhookIndex'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TriggerWebhookResult>(\n `${PROJECT_API_ROUTE}/webhook`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { webhookIndex },\n }\n );\n\n /**\n * Get CI configuration status for the current project.\n * @param otherOptions - Fetcher options.\n * @returns The CI configuration status.\n */\n const getCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Push CI configuration file to the repository.\n * @param otherOptions - Fetcher options.\n * @returns Success status.\n */\n const pushCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Updates granular access constraints for a project member.\n * @param userId - The user ID to update access for.\n * @param body - The new access constraints.\n */\n const updateMemberAccess = async (\n userId: string,\n body: UpdateMemberAccessBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateMemberAccessResult>(\n `${PROJECT_API_ROUTE}/member/${userId}/access`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n deleteProjectByIdAdmin,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n updateMemberAccess,\n };\n};\n"],"mappings":";;;;AAgCA,MAAa,iBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAc,OAAO,WAExB;;;;;CAMxC,MAAM,cAAc,OAClB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;;CAMF,MAAM,aAAa,OACjB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,gBAAgB,OACpB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,uBAAuB,OAC3B,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;CAKF,MAAM,2BAA2B,OAC/B,sBACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,iBACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,gBAAgB,OAAO,eAA+B,CAAC,MAC3D,MAAM,QACJ,GAAG,qBACH,gBACA,cACA,EACE,QAAQ,SACV,CACF;;;;;CAMF,MAAM,yBAAyB,OAC7B,WACA,eAA+B,CAAC,MAEhC,QACE,GAAG,kBAAkB,GAAG,UAAU,SAClC,gBACA,cACA,EAAE,QAAQ,SAAS,CACrB;;;;;CAMF,MAAM,gBAAgB,OACpB,WACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,OAAO,SAAS,KACxC,gBACA,cACA,EACE,QAAQ,MACV,CACF;;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A;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"project.mjs","names":[],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n ResponseData,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateMemberAccessBody,\n UpdateMemberAccessResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Admin-only: Deletes any project from the database by its ID.\n * @param projectId - Project ID.\n */\n const deleteProjectByIdAdmin = async (\n projectId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}/${projectId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n /**\n * Triggers CI builds for a project (Git provider pipelines and webhooks).\n * @param otherOptions - Fetcher options.\n * @returns The trigger results.\n */\n const triggerBuild = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<TriggerBuildResult>(\n `${PROJECT_API_ROUTE}/build`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Triggers a single webhook by index.\n * @param webhookIndex - The index of the webhook to trigger.\n * @param otherOptions - Fetcher options.\n * @returns The trigger result.\n */\n const triggerWebhook = async (\n webhookIndex: TriggerWebhookBody['webhookIndex'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TriggerWebhookResult>(\n `${PROJECT_API_ROUTE}/webhook`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { webhookIndex },\n }\n );\n\n /**\n * Get CI configuration status for the current project.\n * @param otherOptions - Fetcher options.\n * @returns The CI configuration status.\n */\n const getCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Push CI configuration file to the repository.\n * @param otherOptions - Fetcher options.\n * @returns Success status.\n */\n const pushCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Updates granular access constraints for a project member.\n * @param userId - The user ID to update access for.\n * @param body - The new access constraints.\n */\n const updateMemberAccess = async (\n userId: string,\n body: UpdateMemberAccessBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateMemberAccessResult>(\n `${PROJECT_API_ROUTE}/member/${userId}/access`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n deleteProjectByIdAdmin,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n updateMemberAccess,\n };\n};\n"],"mappings":";;;;AAgCA,MAAa,iBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ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gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;;;CAQH,MAAM,kBAAkB,OACtB,UACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;;;;;;;CAQH,MAAM,mBAAmB,OACvB,UACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;;;;;;CAOH,MAAM,eAAe,OAAO,eAA+B,EAAE,KAC3D,MAAM,QACJ,GAAG,kBAAkB,SACrB,gBACA,cACA,EACE,QAAQ,QACT,CACF;;;;;;;CAQH,MAAM,iBAAiB,OACrB,cACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,cAAc;EACvB,CACF;;;;;;CAOH,MAAM,cAAc,OAAO,eAA+B,EAAE,KAC1D,MAAM,QACJ,GAAG,kBAAkB,MACrB,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;;CAOH,MAAM,eAAe,OAAO,eAA+B,EAAE,KAC3D,MAAM,QACJ,GAAG,kBAAkB,MACrB,gBACA,cACA,EACE,QAAQ,QACT,CACF;;;;;;CAOH,MAAM,qBAAqB,OACzB,QACA,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,UAAU,OAAO,UACtC,gBACA,cACA;EAAE,QAAQ;EAAO;EAAM,CACxB;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"reviewer.mjs","names":[],"sources":["../../../src/getIntlayerAPI/reviewer.ts"],"sourcesContent":["import type {\n CreateMissionBody,\n EstimateMissionBody,\n GetMarketplaceQuery,\n MissionEstimate,\n PaginatedResponse,\n PriceDistributionData,\n RegisterReviewerBody,\n ResponseData,\n ReviewerMessageAPI,\n ReviewerProfileAPI,\n ReviewerReviewAPI,\n SendMessageBody,\n SubmitReviewBody,\n TranslationMissionAPI,\n UpdateMissionStatusBody,\n UpdateReviewerBody,\n UploadReviewerPictureResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getReviewerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const BASE = `${backendURL}/api/reviewer`;\n\n // ── Marketplace ────────────────────────────────────────────────────────────\n\n const getMarketplace = (\n params: GetMarketplaceQuery = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n if (Array.isArray(value)) {\n value.forEach((item) => {\n searchParams.append(key, String(item));\n });\n } else {\n searchParams.append(key, String(value));\n }\n }\n const query = searchParams.toString();\n\n return fetcher<PaginatedResponse<ReviewerProfileAPI>>(\n `${BASE}/marketplace${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n const getPriceDistribution = (\n params: Pick<\n GetMarketplaceQuery,\n 'fromLocale' | 'toLocale' | 'minRating' | 'categories'\n > = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n if (Array.isArray(value)) {\n value.forEach((item) => {\n searchParams.append(key, String(item));\n });\n } else {\n searchParams.append(key, String(value));\n }\n }\n const query = searchParams.toString();\n return fetcher<ResponseData<PriceDistributionData>>(\n `${BASE}/marketplace/price-distribution${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n const getReviewerById = (\n reviewerId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/${reviewerId}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const getReviewerReviews = (\n reviewerId: string,\n params: { page?: number; pageSize?: number } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const query = new URLSearchParams(\n Object.fromEntries(\n Object.entries(params)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => [k, String(v)])\n )\n ).toString();\n return fetcher<PaginatedResponse<ReviewerReviewAPI>>(\n `${BASE}/${reviewerId}/reviews${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n // ── My profile ─────────────────────────────────────────────────────────────\n\n const getMyReviewerProfile = (otherOptions: FetcherOptions = {}) =>\n fetcher<ResponseData<ReviewerProfileAPI | null>>(\n `${BASE}/me`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const registerAsReviewer = (\n body: RegisterReviewerBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/register`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const updateReviewerProfile = (\n body: UpdateReviewerBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n const deleteReviewerProfile = (otherOptions: FetcherOptions = {}) =>\n fetcher<ResponseData<null>>(BASE, authAPIOptions, otherOptions, {\n method: 'DELETE',\n });\n\n // ── Contact ────────────────────────────────────────────────────────────────\n\n const contactReviewer = (\n reviewerId: string,\n body: { message: string },\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<null>>(\n `${BASE}/${reviewerId}/contact`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n // ── Missions ───────────────────────────────────────────────────────────────\n\n const estimateMission = (\n body: EstimateMissionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<MissionEstimate>>(\n `${BASE}/mission/estimate`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const createMission = (\n body: CreateMissionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<TranslationMissionAPI>>(\n `${BASE}/mission`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const getMyMissions = (\n params: {\n role?: 'client' | 'reviewer';\n page?: number;\n pageSize?: number;\n } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const query = new URLSearchParams(\n Object.fromEntries(\n Object.entries(params)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => [k, String(v)])\n )\n ).toString();\n return fetcher<PaginatedResponse<TranslationMissionAPI>>(\n `${BASE}/mission${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n const getMissionById = (\n missionId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<TranslationMissionAPI>>(\n `${BASE}/mission/${missionId}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const updateMissionStatus = (\n missionId: string,\n body: UpdateMissionStatusBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<TranslationMissionAPI>>(\n `${BASE}/mission/${missionId}/status`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n // ── Reviews ────────────────────────────────────────────────────────────────\n\n const submitReview = (\n missionId: string,\n body: SubmitReviewBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerReviewAPI>>(\n `${BASE}/mission/${missionId}/review`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n // ── Chat ───────────────────────────────────────────────────────────────────\n\n const getChatHistory = (\n missionId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerMessageAPI[]>>(\n `${BASE}/mission/${missionId}/chat/history`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const sendMessage = (\n missionId: string,\n body: SendMessageBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerMessageAPI>>(\n `${BASE}/mission/${missionId}/chat`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const getChatStreamUrl = (missionId: string) =>\n `${BASE}/mission/${missionId}/chat/stream`;\n\n // ── Picture uploads ────────────────────────────────────────────────────────\n\n const uploadPicture = async (\n kind: 'main' | 'cover',\n file: File,\n otherOptions: FetcherOptions = {}\n ): Promise<UploadReviewerPictureResult> => {\n const buffer = await file.arrayBuffer();\n\n const baseHeaders: Record<string, string> = {\n 'Content-Type': file.type || 'image/jpeg',\n };\n\n const authHeaders =\n (authAPIOptions.headers as Record<string, string> | undefined) ?? {};\n\n const response = await fetch(`${BASE}/me/picture/${kind}`, {\n method: 'POST',\n credentials: 'include',\n headers: { ...authHeaders, ...baseHeaders },\n body: buffer,\n signal: otherOptions.signal as AbortSignal | undefined,\n });\n\n if (!response.ok) {\n const result = await response.json();\n throw new Error(JSON.stringify(result.error) ?? 'Picture upload failed');\n }\n\n return (await response.json()) as UploadReviewerPictureResult;\n };\n\n const uploadMainPicture = (file: File, otherOptions: FetcherOptions = {}) =>\n uploadPicture('main', file, otherOptions);\n\n const uploadCoverPicture = (file: File, otherOptions: FetcherOptions = {}) =>\n uploadPicture('cover', file, otherOptions);\n\n // ── Admin ──────────────────────────────────────────────────────────────────\n\n const validateReviewerProfile = (\n reviewerId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/${reviewerId}/validate`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT' }\n );\n\n const getAdminReviewers = (\n params: { page?: number; pageSize?: number; status?: string } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const query = new URLSearchParams(\n Object.fromEntries(\n Object.entries(params)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => [k, String(v)])\n )\n ).toString();\n return fetcher<PaginatedResponse<ReviewerProfileAPI>>(\n `${BASE}/admin/reviewers${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n return {\n getMarketplace,\n getPriceDistribution,\n getReviewerById,\n getReviewerReviews,\n getMyReviewerProfile,\n registerAsReviewer,\n updateReviewerProfile,\n deleteReviewerProfile,\n estimateMission,\n createMission,\n getMyMissions,\n getMissionById,\n updateMissionStatus,\n submitReview,\n contactReviewer,\n getChatHistory,\n sendMessage,\n getChatStreamUrl,\n uploadMainPicture,\n uploadCoverPicture,\n validateReviewerProfile,\n getAdminReviewers,\n };\n};\n"],"mappings":";;;;AAuBA,MAAa,kBACX,iBAAiC,CAAC,GAClC,mBACG;CAEH,MAAM,OAAO,GADM,gBAAgB,QAAQ,cAAc,OAAO,WACrC;CAI3B,MAAM,kBACJ,SAA8B,CAAC,GAC/B,eAA+B,CAAC,MAC7B;EACH,MAAM,eAAe,IAAI,gBAAgB;EACzC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;GACjD,IAAI,UAAU,QAAW;GACzB,IAAI,MAAM,QAAQ,KAAK,GACrB,MAAM,SAAS,SAAS;IACtB,aAAa,OAAO,KAAK,OAAO,IAAI,CAAC;GACvC,CAAC;QAED,aAAa,OAAO,KAAK,OAAO,KAAK,CAAC;EAE1C;EACA,MAAM,QAAQ,aAAa,SAAS;EAEpC,OAAO,QACL,GAAG,KAAK,cAAc,QAAQ,IAAI,UAAU,MAC5C,gBACA,cACA,EAAE,QAAQ,MAAM,CAClB;CACF;CAEA,MAAM,wBACJ,SAGI,CAAC,GACL,eAA+B,CAAC,MAC7B;EACH,MAAM,eAAe,IAAI,gBAAgB;EACzC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;GACjD,IAAI,UAAU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;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"reviewer.mjs","names":[],"sources":["../../../src/getIntlayerAPI/reviewer.ts"],"sourcesContent":["import type {\n CreateMissionBody,\n EstimateMissionBody,\n GetMarketplaceQuery,\n MissionEstimate,\n PaginatedResponse,\n PriceDistributionData,\n RegisterReviewerBody,\n ResponseData,\n ReviewerMessageAPI,\n ReviewerProfileAPI,\n ReviewerReviewAPI,\n SendMessageBody,\n SubmitReviewBody,\n TranslationMissionAPI,\n UpdateMissionStatusBody,\n UpdateReviewerBody,\n UploadReviewerPictureResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getReviewerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const BASE = `${backendURL}/api/reviewer`;\n\n // ── Marketplace ────────────────────────────────────────────────────────────\n\n const getMarketplace = (\n params: GetMarketplaceQuery = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n if (Array.isArray(value)) {\n value.forEach((item) => {\n searchParams.append(key, String(item));\n });\n } else {\n searchParams.append(key, String(value));\n }\n }\n const query = searchParams.toString();\n\n return fetcher<PaginatedResponse<ReviewerProfileAPI>>(\n `${BASE}/marketplace${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n const getPriceDistribution = (\n params: Pick<\n GetMarketplaceQuery,\n 'fromLocale' | 'toLocale' | 'minRating' | 'categories'\n > = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n if (Array.isArray(value)) {\n value.forEach((item) => {\n searchParams.append(key, String(item));\n });\n } else {\n searchParams.append(key, String(value));\n }\n }\n const query = searchParams.toString();\n return fetcher<ResponseData<PriceDistributionData>>(\n `${BASE}/marketplace/price-distribution${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n const getReviewerById = (\n reviewerId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/${reviewerId}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const getReviewerReviews = (\n reviewerId: string,\n params: { page?: number; pageSize?: number } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const query = new URLSearchParams(\n Object.fromEntries(\n Object.entries(params)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => [k, String(v)])\n )\n ).toString();\n return fetcher<PaginatedResponse<ReviewerReviewAPI>>(\n `${BASE}/${reviewerId}/reviews${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n // ── My profile ─────────────────────────────────────────────────────────────\n\n const getMyReviewerProfile = (otherOptions: FetcherOptions = {}) =>\n fetcher<ResponseData<ReviewerProfileAPI | null>>(\n `${BASE}/me`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const registerAsReviewer = (\n body: RegisterReviewerBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/register`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const updateReviewerProfile = (\n body: UpdateReviewerBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n const deleteReviewerProfile = (otherOptions: FetcherOptions = {}) =>\n fetcher<ResponseData<null>>(BASE, authAPIOptions, otherOptions, {\n method: 'DELETE',\n });\n\n // ── Contact ────────────────────────────────────────────────────────────────\n\n const contactReviewer = (\n reviewerId: string,\n body: { message: string },\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<null>>(\n `${BASE}/${reviewerId}/contact`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n // ── Missions ───────────────────────────────────────────────────────────────\n\n const estimateMission = (\n body: EstimateMissionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<MissionEstimate>>(\n `${BASE}/mission/estimate`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const createMission = (\n body: CreateMissionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<TranslationMissionAPI>>(\n `${BASE}/mission`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const getMyMissions = (\n params: {\n role?: 'client' | 'reviewer';\n page?: number;\n pageSize?: number;\n } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const query = new URLSearchParams(\n Object.fromEntries(\n Object.entries(params)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => [k, String(v)])\n )\n ).toString();\n return fetcher<PaginatedResponse<TranslationMissionAPI>>(\n `${BASE}/mission${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n const getMissionById = (\n missionId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<TranslationMissionAPI>>(\n `${BASE}/mission/${missionId}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const updateMissionStatus = (\n missionId: string,\n body: UpdateMissionStatusBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<TranslationMissionAPI>>(\n `${BASE}/mission/${missionId}/status`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n // ── Reviews ────────────────────────────────────────────────────────────────\n\n const submitReview = (\n missionId: string,\n body: SubmitReviewBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerReviewAPI>>(\n `${BASE}/mission/${missionId}/review`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n // ── Chat ───────────────────────────────────────────────────────────────────\n\n const getChatHistory = (\n missionId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerMessageAPI[]>>(\n `${BASE}/mission/${missionId}/chat/history`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const sendMessage = (\n missionId: string,\n body: SendMessageBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerMessageAPI>>(\n `${BASE}/mission/${missionId}/chat`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const getChatStreamUrl = (missionId: string) =>\n `${BASE}/mission/${missionId}/chat/stream`;\n\n // ── Picture uploads ────────────────────────────────────────────────────────\n\n const uploadPicture = async (\n kind: 'main' | 'cover',\n file: File,\n otherOptions: FetcherOptions = {}\n ): Promise<UploadReviewerPictureResult> => {\n const buffer = await file.arrayBuffer();\n\n const baseHeaders: Record<string, string> = {\n 'Content-Type': file.type || 'image/jpeg',\n };\n\n const authHeaders =\n (authAPIOptions.headers as Record<string, string> | undefined) ?? {};\n\n const response = await fetch(`${BASE}/me/picture/${kind}`, {\n method: 'POST',\n credentials: 'include',\n headers: { ...authHeaders, ...baseHeaders },\n body: buffer,\n signal: otherOptions.signal as AbortSignal | undefined,\n });\n\n if (!response.ok) {\n const result = await response.json();\n throw new Error(JSON.stringify(result.error) ?? 'Picture upload failed');\n }\n\n return (await response.json()) as UploadReviewerPictureResult;\n };\n\n const uploadMainPicture = (file: File, otherOptions: FetcherOptions = {}) =>\n uploadPicture('main', file, otherOptions);\n\n const uploadCoverPicture = (file: File, otherOptions: FetcherOptions = {}) =>\n uploadPicture('cover', file, otherOptions);\n\n // ── Admin ──────────────────────────────────────────────────────────────────\n\n const validateReviewerProfile = (\n reviewerId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<ResponseData<ReviewerProfileAPI>>(\n `${BASE}/${reviewerId}/validate`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT' }\n );\n\n const getAdminReviewers = (\n params: { page?: number; pageSize?: number; status?: string } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const query = new URLSearchParams(\n Object.fromEntries(\n Object.entries(params)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => [k, String(v)])\n )\n ).toString();\n return fetcher<PaginatedResponse<ReviewerProfileAPI>>(\n `${BASE}/admin/reviewers${query ? `?${query}` : ''}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n return {\n getMarketplace,\n getPriceDistribution,\n getReviewerById,\n getReviewerReviews,\n getMyReviewerProfile,\n registerAsReviewer,\n updateReviewerProfile,\n deleteReviewerProfile,\n estimateMission,\n createMission,\n getMyMissions,\n getMissionById,\n updateMissionStatus,\n submitReview,\n contactReviewer,\n getChatHistory,\n sendMessage,\n getChatStreamUrl,\n uploadMainPicture,\n uploadCoverPicture,\n validateReviewerProfile,\n getAdminReviewers,\n };\n};\n"],"mappings":";;;;AAuBA,MAAa,kBACX,iBAAiC,EAAE,EACnC,mBACG;CAEH,MAAM,OAAO,GADM,gBAAgB,QAAQ,cAAc,OAAO,WACrC;CAI3B,MAAM,kBACJ,SAA8B,EAAE,EAChC,eAA+B,EAAE,KAC9B;EACH,MAAM,eAAe,IAAI,iBAAiB;AAC1C,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,EAAE;AACjD,OAAI,UAAU,OAAW;AACzB,OAAI,MAAM,QAAQ,MAAM,CACtB,OAAM,SAAS,SAAS;AACtB,iBAAa,OAAO,KAAK,OAAO,KAAK,CAAC;KACtC;OAEF,cAAa,OAAO,KAAK,OAAO,MAAM,CAAC;;EAG3C,MAAM,QAAQ,aAAa,UAAU;AAErC,SAAO,QACL,GAAG,KAAK,cAAc,QAAQ,IAAI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O,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CACnC,CACF,CAAC,UAAU;AACZ,SAAO,QACL,GAAG,KAAK,kBAAkB,QAAQ,IAAI,UAAU,MAChD,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;AAGH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.mjs","names":[],"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import type {\n SearchDocUtilParams,\n SearchDocUtilResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":";;;;AAQA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,eAAe,GAFF,gBAAgB,QAAQ,cAAc,OAAO,WAE7B;;;;;;CAOnC,MAAM,YAAY,OAChB,QACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,aAAa,OAChB,gBACA,cACA;EACE,QAAQ;EACA;CACV,CACF;CAEF,OAAO,EACL,UACF;AACF"}
1
+ {"version":3,"file":"search.mjs","names":[],"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import type {\n SearchDocUtilParams,\n SearchDocUtilResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":";;;;AAQA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,eAAe,GAFF,gBAAgB,QAAQ,cAAc,OAAO,WAE7B;;;;;;CAOnC,MAAM,YAAY,OAChB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,OAChB,gBACA,cACA;EACE,QAAQ;EACA;EACT,CACF;AAEH,QAAO,EACL,WACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"showcaseProject.mjs","names":[],"sources":["../../../src/getIntlayerAPI/showcaseProject.ts"],"sourcesContent":["import type {\n GetOtherShowcaseProjectsResult,\n GetShowcaseProjectByIdParams,\n GetShowcaseProjectByIdResult,\n GetShowcaseProjectsResult,\n SubmitShowcaseProjectBody,\n SubmitShowcaseProjectResult,\n ToggleShowcaseDownvoteBody,\n ToggleShowcaseDownvoteResult,\n ToggleShowcaseUpvoteBody,\n ToggleShowcaseUpvoteResult,\n UpdateShowcaseProjectBody,\n UpdateShowcaseProjectResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n// Client-side query types use proper JS types (numbers/booleans) rather than\n// the backend querystring types which are always strings.\nexport type ShowcaseProjectsQuery = {\n page?: number;\n pageSize?: number;\n search?: string;\n selectedUseCases?: string[];\n isOpenSource?: boolean;\n};\n\nexport type OtherShowcaseProjectsQuery = {\n excludeId: string;\n limit?: number;\n};\n\nexport const getShowcaseProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const SHOWCASE_API_ROUTE = `${backendURL}/api/showcase-project`;\n\n const getShowcaseProjects = async (\n query?: ShowcaseProjectsQuery,\n otherOptions: FetcherOptions = {}\n ) => {\n const params: Record<string, string | string[]> = {};\n if (query?.page !== undefined) params.page = String(query.page);\n if (query?.pageSize !== undefined) params.pageSize = String(query.pageSize);\n if (query?.search !== undefined) params.search = query.search;\n if (query?.isOpenSource !== undefined)\n params.isOpenSource = String(query.isOpenSource);\n if (query?.selectedUseCases?.length)\n params.selectedUseCases = query.selectedUseCases;\n\n return await fetcher<GetShowcaseProjectsResult>(\n SHOWCASE_API_ROUTE,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params: params as any }\n );\n };\n\n const getShowcaseProjectById = async (\n projectId: GetShowcaseProjectByIdParams['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetShowcaseProjectByIdResult>(\n `${SHOWCASE_API_ROUTE}/${projectId}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const getOtherShowcaseProjects = async (\n query: OtherShowcaseProjectsQuery,\n otherOptions: FetcherOptions = {}\n ) => {\n const params: Record<string, string> = { excludeId: query.excludeId };\n if (query.limit !== undefined) params.limit = String(query.limit);\n return await fetcher<GetOtherShowcaseProjectsResult>(\n `${SHOWCASE_API_ROUTE}/others`,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params: params as any }\n );\n };\n\n const submitShowcaseProject = async (\n body: SubmitShowcaseProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SubmitShowcaseProjectResult>(\n `${SHOWCASE_API_ROUTE}/submit`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const toggleShowcaseUpvote = async (\n body: ToggleShowcaseUpvoteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ToggleShowcaseUpvoteResult>(\n `${SHOWCASE_API_ROUTE}/upvote`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const toggleShowcaseDownvote = async (\n body: ToggleShowcaseDownvoteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ToggleShowcaseDownvoteResult>(\n `${SHOWCASE_API_ROUTE}/downvote`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const deleteShowcaseProject = async (\n projectId: GetShowcaseProjectByIdParams['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<{ data: { success: boolean } }>(\n `${SHOWCASE_API_ROUTE}/${projectId}`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n const updateShowcaseProject = async (\n projectId: GetShowcaseProjectByIdParams['projectId'],\n body: UpdateShowcaseProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateShowcaseProjectResult>(\n `${SHOWCASE_API_ROUTE}/${projectId}`,\n authAPIOptions,\n otherOptions,\n { method: 'PATCH', body }\n );\n\n return {\n getShowcaseProjects,\n getShowcaseProjectById,\n getOtherShowcaseProjects,\n submitShowcaseProject,\n toggleShowcaseUpvote,\n toggleShowcaseDownvote,\n deleteShowcaseProject,\n updateShowcaseProject,\n };\n};\n"],"mappings":";;;;AAiCA,MAAa,yBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,qBAAqB,GAFR,gBAAgB,QAAQ,cAAc,OAAO,WAEvB;CAEzC,MAAM,sBAAsB,OAC1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AAM,QACJ,GAAG,mBAAmB,GAAG,aACzB,gBACA,cACA,EAAE,QAAQ,SAAS,CACrB;CAEF,MAAM,wBAAwB,OAC5B,WACA,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,mBAAmB,GAAG,aACzB,gBACA,cACA;EAAE,QAAQ;EAAS;CAAK,CAC1B;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"showcaseProject.mjs","names":[],"sources":["../../../src/getIntlayerAPI/showcaseProject.ts"],"sourcesContent":["import type {\n GetOtherShowcaseProjectsResult,\n GetShowcaseProjectByIdParams,\n GetShowcaseProjectByIdResult,\n GetShowcaseProjectsResult,\n SubmitShowcaseProjectBody,\n SubmitShowcaseProjectResult,\n ToggleShowcaseDownvoteBody,\n ToggleShowcaseDownvoteResult,\n ToggleShowcaseUpvoteBody,\n ToggleShowcaseUpvoteResult,\n UpdateShowcaseProjectBody,\n UpdateShowcaseProjectResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n// Client-side query types use proper JS types (numbers/booleans) rather than\n// the backend querystring types which are always strings.\nexport type ShowcaseProjectsQuery = {\n page?: number;\n pageSize?: number;\n search?: string;\n selectedUseCases?: string[];\n isOpenSource?: boolean;\n};\n\nexport type OtherShowcaseProjectsQuery = {\n excludeId: string;\n limit?: number;\n};\n\nexport const getShowcaseProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const SHOWCASE_API_ROUTE = `${backendURL}/api/showcase-project`;\n\n const getShowcaseProjects = async (\n query?: ShowcaseProjectsQuery,\n otherOptions: FetcherOptions = {}\n ) => {\n const params: Record<string, string | string[]> = {};\n if (query?.page !== undefined) params.page = String(query.page);\n if (query?.pageSize !== undefined) params.pageSize = String(query.pageSize);\n if (query?.search !== undefined) params.search = query.search;\n if (query?.isOpenSource !== undefined)\n params.isOpenSource = String(query.isOpenSource);\n if (query?.selectedUseCases?.length)\n params.selectedUseCases = query.selectedUseCases;\n\n return await fetcher<GetShowcaseProjectsResult>(\n SHOWCASE_API_ROUTE,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params: params as any }\n );\n };\n\n const getShowcaseProjectById = async (\n projectId: GetShowcaseProjectByIdParams['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetShowcaseProjectByIdResult>(\n `${SHOWCASE_API_ROUTE}/${projectId}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const getOtherShowcaseProjects = async (\n query: OtherShowcaseProjectsQuery,\n otherOptions: FetcherOptions = {}\n ) => {\n const params: Record<string, string> = { excludeId: query.excludeId };\n if (query.limit !== undefined) params.limit = String(query.limit);\n return await fetcher<GetOtherShowcaseProjectsResult>(\n `${SHOWCASE_API_ROUTE}/others`,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params: params as any }\n );\n };\n\n const submitShowcaseProject = async (\n body: SubmitShowcaseProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SubmitShowcaseProjectResult>(\n `${SHOWCASE_API_ROUTE}/submit`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const toggleShowcaseUpvote = async (\n body: ToggleShowcaseUpvoteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ToggleShowcaseUpvoteResult>(\n `${SHOWCASE_API_ROUTE}/upvote`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const toggleShowcaseDownvote = async (\n body: ToggleShowcaseDownvoteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ToggleShowcaseDownvoteResult>(\n `${SHOWCASE_API_ROUTE}/downvote`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const deleteShowcaseProject = async (\n projectId: GetShowcaseProjectByIdParams['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<{ data: { success: boolean } }>(\n `${SHOWCASE_API_ROUTE}/${projectId}`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n const updateShowcaseProject = async (\n projectId: GetShowcaseProjectByIdParams['projectId'],\n body: UpdateShowcaseProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateShowcaseProjectResult>(\n `${SHOWCASE_API_ROUTE}/${projectId}`,\n authAPIOptions,\n otherOptions,\n { method: 'PATCH', body }\n );\n\n return {\n getShowcaseProjects,\n getShowcaseProjectById,\n getOtherShowcaseProjects,\n submitShowcaseProject,\n toggleShowcaseUpvote,\n toggleShowcaseDownvote,\n deleteShowcaseProject,\n updateShowcaseProject,\n };\n};\n"],"mappings":";;;;AAiCA,MAAa,yBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,qBAAqB,GAFR,gBAAgB,QAAQ,cAAc,OAAO,WAEvB;CAEzC,MAAM,sBAAsB,OAC1B,OACA,eAA+B,EAAE,KAC9B;EACH,MAAM,SAA4C,EAAE;AACpD,MAAI,OAAO,SAAS,OAAW,QAAO,OAAO,OAAO,MAAM,KAAK;AAC/D,MAAI,OAAO,aAAa,OAAW,QAAO,WAAW,OAAO,MAAM,SAAS;AAC3E,MAAI,OAAO,WAAW,OAAW,QAAO,SAAS,MAAM;AACvD,MAAI,OAAO,iBAAiB,OAC1B,QAAO,eAAe,OAAO,MAAM,aAAa;AAClD,MAAI,OAAO,kBAAkB,OAC3B,QAAO,mBAAmB,MAAM;AAElC,SAAO,MAAM,QACX,oBACA,gBACA,cACA;GAAE,QAAQ;GAAe;GAAe,CACzC;;CAGH,MAAM,yBAAyB,OAC7B,WACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBAAmB,GAAG,aACzB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;CAEH,MAAM,2BAA2B,OAC/B,OACA,eAA+B,EAAE,KAC9B;EACH,MAAM,SAAiC,EAAE,WAAW,MAAM,WAAW;AACrE,MAAI,MAAM,UAAU,OAAW,QAAO,QAAQ,OAAO,MAAM,MAAM;AACjE,SAAO,MAAM,QACX,GAAG,mBAAmB,UACtB,gBACA,cACA;GAAE,QAAQ;GAAe;GAAe,CACzC;;CAGH,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBAAmB,UACtB,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;CAEH,MAAM,uBAAuB,OAC3B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBAAmB,UACtB,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;CAEH,MAAM,yBAAyB,OAC7B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBAAmB,YACtB,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;CAEH,MAAM,wBAAwB,OAC5B,WACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBAAmB,GAAG,aACzB,gBACA,cACA,EAAE,QAAQ,UAAU,CACrB;CAEH,MAAM,wBAAwB,OAC5B,WACA,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBAAmB,GAAG,aACzB,gBACA,cACA;EAAE,QAAQ;EAAS;EAAM,CAC1B;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.mjs","names":[],"sources":["../../../src/getIntlayerAPI/stripe.ts"],"sourcesContent":["import type {\n AcceptAffiliateInvitationResult,\n CreatePortalSessionResult,\n CreatePromoCodeBody,\n CreatePromoCodeResult,\n DeletePromoCodeResult,\n GetAffiliateAccountSessionResult,\n GetAffiliateByIdResult,\n GetAffiliateInvitationResult,\n GetAffiliateInvitationsResult,\n GetAffiliateOnboardingLinkResult,\n GetAffiliateResult,\n GetAffiliateStatsResult,\n GetAffiliatesParams,\n GetAffiliatesResult,\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetInvoicesResult,\n GetPaymentMethodResult,\n GetPricingBody,\n GetPricingResult,\n GetPromoCodeByIdResult,\n GetPromoCodesResult,\n GrantAffiliateAccessBody,\n GrantAffiliateAccessResult,\n SendAffiliateInvitationBody,\n SendAffiliateInvitationResult,\n UpdateAffiliateStatusBody,\n UpdateAffiliateStatusResult,\n UpdatePromoCodeBody,\n UpdatePromoCodeResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getStripeAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\n /**\n * Get a pricing plan calculated for a given promotion code.\n * @param body - Pricing plan body.\n */\n const getPricing = async (\n body?: GetPricingBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetPricingResult>(\n `${STRIPE_API_ROUTE}/pricing`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Cancels a subscription.\n * @param body - Checkout session body.\n */\n const cancelSubscription = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/cancel-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Lists invoices for the authenticated organization's Stripe customer.\n */\n const getInvoices = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetInvoicesResult>(\n `${STRIPE_API_ROUTE}/invoices`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Returns the first card payment method for the authenticated organization's\n * Stripe customer (or null if none).\n */\n const getPaymentMethod = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetPaymentMethodResult>(\n `${STRIPE_API_ROUTE}/payment-method`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Creates a Stripe Billing Portal session for the authenticated organization.\n */\n const createPortalSession = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreatePortalSessionResult>(\n `${STRIPE_API_ROUTE}/portal-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Admin-only: grants affiliate access to a user by creating their Stripe Connect account.\n */\n const grantAffiliateAccess = async (\n body: GrantAffiliateAccessBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GrantAffiliateAccessResult>(\n `${STRIPE_API_ROUTE}/affiliate/grant`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n /**\n * Admin-only: returns a paginated list of all affiliates.\n */\n const getAffiliates = async (\n params?: GetAffiliatesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliatesResult>(\n `${STRIPE_API_ROUTE}/affiliates`,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params: params as Record<string, string> }\n );\n\n /**\n * Admin-only: returns a single affiliate by ID.\n */\n const getAffiliateById = async (\n { id }: { id: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateByIdResult>(\n `${STRIPE_API_ROUTE}/affiliates/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Returns the affiliate record for the authenticated user (null if not an affiliate).\n */\n const getAffiliate = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAffiliateResult>(\n `${STRIPE_API_ROUTE}/affiliate`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Creates a Stripe Connect account session for the authenticated affiliate (embedded onboarding).\n */\n const getAffiliateAccountSession = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateAccountSessionResult>(\n `${STRIPE_API_ROUTE}/affiliate/account-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Returns a Stripe-hosted onboarding URL for the authenticated affiliate.\n */\n const getAffiliateOnboardingLink = async (\n params?: { returnUrl?: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateOnboardingLinkResult>(\n `${STRIPE_API_ROUTE}/affiliate/onboarding-link`,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params }\n );\n\n /**\n * Returns referral stats for the authenticated affiliate.\n */\n const getAffiliateStats = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAffiliateStatsResult>(\n `${STRIPE_API_ROUTE}/affiliate/stats`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Admin-only: returns a paginated list of all affiliate invitations.\n */\n const getAffiliateInvitations = async (\n params: GetAffiliatesParams = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const qs = new URLSearchParams();\n if (params.page) qs.set('page', String(params.page));\n if (params.pageSize) qs.set('pageSize', String(params.pageSize));\n if (params.search) qs.set('search', params.search);\n const query = qs.toString() ? `?${qs.toString()}` : '';\n return await fetcher<GetAffiliateInvitationsResult>(\n `${STRIPE_API_ROUTE}/affiliate/invitations${query}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n /**\n * Sends an affiliate invitation email to the given address (admin only).\n */\n const sendAffiliateInvitation = async (\n body: SendAffiliateInvitationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SendAffiliateInvitationResult>(\n `${STRIPE_API_ROUTE}/affiliate/invite`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n /**\n * Retrieves an affiliate invitation by token (public — no auth required).\n */\n const getAffiliateInvitation = async (\n { token }: { token: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateInvitationResult>(\n `${STRIPE_API_ROUTE}/affiliate/invitation/${token}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Admin-only: updates an affiliate's status and/or category.\n */\n const updateAffiliateStatus = async (\n { id }: { id: string },\n body: UpdateAffiliateStatusBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateAffiliateStatusResult>(\n `${STRIPE_API_ROUTE}/affiliates/${id}/status`,\n authAPIOptions,\n otherOptions,\n { method: 'PATCH', body }\n );\n\n /**\n * Accepts an affiliate invitation and creates the affiliate account.\n */\n const acceptAffiliateInvitation = async (\n {\n token,\n country,\n stripeAccountType,\n }: {\n token: string;\n country?: string;\n stripeAccountType?: 'express' | 'standard';\n },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AcceptAffiliateInvitationResult>(\n `${STRIPE_API_ROUTE}/affiliate/invitation/${token}/accept`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body: { country, stripeAccountType } }\n );\n\n /**\n * Admin-only: returns a paginated list of all promo codes.\n */\n const getPromoCodeById = async (\n id: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetPromoCodeByIdResult>(\n `${STRIPE_API_ROUTE}/promo-codes/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const getPromoCodes = async (\n params: { affiliateId?: string } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const qs = params.affiliateId\n ? `?affiliateId=${encodeURIComponent(params.affiliateId)}`\n : '';\n return await fetcher<GetPromoCodesResult>(\n `${STRIPE_API_ROUTE}/promo-codes${qs}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n /**\n * Admin-only: creates a new promo code (Stripe coupon + promotion code).\n */\n const createPromoCode = async (\n body: CreatePromoCodeBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreatePromoCodeResult>(\n `${STRIPE_API_ROUTE}/promo-codes`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n /**\n * Admin-only: updates a promo code.\n */\n const updatePromoCode = async (\n { id, ...body }: { id: string } & UpdatePromoCodeBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdatePromoCodeResult>(\n `${STRIPE_API_ROUTE}/promo-codes/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'PATCH', body }\n );\n\n /**\n * Admin-only: deactivates a promo code (sets active=false, disables Stripe promotion code).\n */\n const deletePromoCode = async (\n { id }: { id: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeletePromoCodeResult>(\n `${STRIPE_API_ROUTE}/promo-codes/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Retrieves the active promo code associated with a given affiliate referral code.\n */\n const getAffiliatePromoCode = async (\n referralCode: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<any>(\n `${STRIPE_API_ROUTE}/affiliate-promo-code/${referralCode}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n return {\n getPricing,\n getSubscription,\n cancelSubscription,\n getInvoices,\n getPaymentMethod,\n createPortalSession,\n grantAffiliateAccess,\n getAffiliates,\n getAffiliateById,\n getAffiliate,\n getAffiliateAccountSession,\n getAffiliateOnboardingLink,\n getAffiliateStats,\n getAffiliateInvitations,\n sendAffiliateInvitation,\n getAffiliateInvitation,\n acceptAffiliateInvitation,\n updateAffiliateStatus,\n getPromoCodeById,\n getPromoCodes,\n createPromoCode,\n updatePromoCode,\n deletePromoCode,\n getAffiliatePromoCode,\n };\n};\n"],"mappings":";;;;AAoCA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;CAMvC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,"file":"stripe.mjs","names":[],"sources":["../../../src/getIntlayerAPI/stripe.ts"],"sourcesContent":["import type {\n AcceptAffiliateInvitationResult,\n CreatePortalSessionResult,\n CreatePromoCodeBody,\n CreatePromoCodeResult,\n DeletePromoCodeResult,\n GetAffiliateAccountSessionResult,\n GetAffiliateByIdResult,\n GetAffiliateInvitationResult,\n GetAffiliateInvitationsResult,\n GetAffiliateOnboardingLinkResult,\n GetAffiliateResult,\n GetAffiliateStatsResult,\n GetAffiliatesParams,\n GetAffiliatesResult,\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetInvoicesResult,\n GetPaymentMethodResult,\n GetPricingBody,\n GetPricingResult,\n GetPromoCodeByIdResult,\n GetPromoCodesResult,\n GrantAffiliateAccessBody,\n GrantAffiliateAccessResult,\n SendAffiliateInvitationBody,\n SendAffiliateInvitationResult,\n UpdateAffiliateStatusBody,\n UpdateAffiliateStatusResult,\n UpdatePromoCodeBody,\n UpdatePromoCodeResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getStripeAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\n /**\n * Get a pricing plan calculated for a given promotion code.\n * @param body - Pricing plan body.\n */\n const getPricing = async (\n body?: GetPricingBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetPricingResult>(\n `${STRIPE_API_ROUTE}/pricing`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Cancels a subscription.\n * @param body - Checkout session body.\n */\n const cancelSubscription = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/cancel-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Lists invoices for the authenticated organization's Stripe customer.\n */\n const getInvoices = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetInvoicesResult>(\n `${STRIPE_API_ROUTE}/invoices`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Returns the first card payment method for the authenticated organization's\n * Stripe customer (or null if none).\n */\n const getPaymentMethod = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetPaymentMethodResult>(\n `${STRIPE_API_ROUTE}/payment-method`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Creates a Stripe Billing Portal session for the authenticated organization.\n */\n const createPortalSession = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreatePortalSessionResult>(\n `${STRIPE_API_ROUTE}/portal-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Admin-only: grants affiliate access to a user by creating their Stripe Connect account.\n */\n const grantAffiliateAccess = async (\n body: GrantAffiliateAccessBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GrantAffiliateAccessResult>(\n `${STRIPE_API_ROUTE}/affiliate/grant`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n /**\n * Admin-only: returns a paginated list of all affiliates.\n */\n const getAffiliates = async (\n params?: GetAffiliatesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliatesResult>(\n `${STRIPE_API_ROUTE}/affiliates`,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params: params as Record<string, string> }\n );\n\n /**\n * Admin-only: returns a single affiliate by ID.\n */\n const getAffiliateById = async (\n { id }: { id: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateByIdResult>(\n `${STRIPE_API_ROUTE}/affiliates/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Returns the affiliate record for the authenticated user (null if not an affiliate).\n */\n const getAffiliate = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAffiliateResult>(\n `${STRIPE_API_ROUTE}/affiliate`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Creates a Stripe Connect account session for the authenticated affiliate (embedded onboarding).\n */\n const getAffiliateAccountSession = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateAccountSessionResult>(\n `${STRIPE_API_ROUTE}/affiliate/account-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Returns a Stripe-hosted onboarding URL for the authenticated affiliate.\n */\n const getAffiliateOnboardingLink = async (\n params?: { returnUrl?: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateOnboardingLinkResult>(\n `${STRIPE_API_ROUTE}/affiliate/onboarding-link`,\n authAPIOptions,\n otherOptions,\n { method: 'GET', params }\n );\n\n /**\n * Returns referral stats for the authenticated affiliate.\n */\n const getAffiliateStats = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAffiliateStatsResult>(\n `${STRIPE_API_ROUTE}/affiliate/stats`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Admin-only: returns a paginated list of all affiliate invitations.\n */\n const getAffiliateInvitations = async (\n params: GetAffiliatesParams = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const qs = new URLSearchParams();\n if (params.page) qs.set('page', String(params.page));\n if (params.pageSize) qs.set('pageSize', String(params.pageSize));\n if (params.search) qs.set('search', params.search);\n const query = qs.toString() ? `?${qs.toString()}` : '';\n return await fetcher<GetAffiliateInvitationsResult>(\n `${STRIPE_API_ROUTE}/affiliate/invitations${query}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n /**\n * Sends an affiliate invitation email to the given address (admin only).\n */\n const sendAffiliateInvitation = async (\n body: SendAffiliateInvitationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SendAffiliateInvitationResult>(\n `${STRIPE_API_ROUTE}/affiliate/invite`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n /**\n * Retrieves an affiliate invitation by token (public — no auth required).\n */\n const getAffiliateInvitation = async (\n { token }: { token: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAffiliateInvitationResult>(\n `${STRIPE_API_ROUTE}/affiliate/invitation/${token}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Admin-only: updates an affiliate's status and/or category.\n */\n const updateAffiliateStatus = async (\n { id }: { id: string },\n body: UpdateAffiliateStatusBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateAffiliateStatusResult>(\n `${STRIPE_API_ROUTE}/affiliates/${id}/status`,\n authAPIOptions,\n otherOptions,\n { method: 'PATCH', body }\n );\n\n /**\n * Accepts an affiliate invitation and creates the affiliate account.\n */\n const acceptAffiliateInvitation = async (\n {\n token,\n country,\n stripeAccountType,\n }: {\n token: string;\n country?: string;\n stripeAccountType?: 'express' | 'standard';\n },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AcceptAffiliateInvitationResult>(\n `${STRIPE_API_ROUTE}/affiliate/invitation/${token}/accept`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body: { country, stripeAccountType } }\n );\n\n /**\n * Admin-only: returns a paginated list of all promo codes.\n */\n const getPromoCodeById = async (\n id: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetPromoCodeByIdResult>(\n `${STRIPE_API_ROUTE}/promo-codes/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n const getPromoCodes = async (\n params: { affiliateId?: string } = {},\n otherOptions: FetcherOptions = {}\n ) => {\n const qs = params.affiliateId\n ? `?affiliateId=${encodeURIComponent(params.affiliateId)}`\n : '';\n return await fetcher<GetPromoCodesResult>(\n `${STRIPE_API_ROUTE}/promo-codes${qs}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n };\n\n /**\n * Admin-only: creates a new promo code (Stripe coupon + promotion code).\n */\n const createPromoCode = async (\n body: CreatePromoCodeBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreatePromoCodeResult>(\n `${STRIPE_API_ROUTE}/promo-codes`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n /**\n * Admin-only: updates a promo code.\n */\n const updatePromoCode = async (\n { id, ...body }: { id: string } & UpdatePromoCodeBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdatePromoCodeResult>(\n `${STRIPE_API_ROUTE}/promo-codes/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'PATCH', body }\n );\n\n /**\n * Admin-only: deactivates a promo code (sets active=false, disables Stripe promotion code).\n */\n const deletePromoCode = async (\n { id }: { id: string },\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeletePromoCodeResult>(\n `${STRIPE_API_ROUTE}/promo-codes/${id}`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Retrieves the active promo code associated with a given affiliate referral code.\n */\n const getAffiliatePromoCode = async (\n referralCode: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<any>(\n `${STRIPE_API_ROUTE}/affiliate-promo-code/${referralCode}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n return {\n getPricing,\n getSubscription,\n cancelSubscription,\n getInvoices,\n getPaymentMethod,\n createPortalSession,\n grantAffiliateAccess,\n getAffiliates,\n getAffiliateById,\n getAffiliate,\n getAffiliateAccountSession,\n getAffiliateOnboardingLink,\n getAffiliateStats,\n getAffiliateInvitations,\n sendAffiliateInvitation,\n getAffiliateInvitation,\n acceptAffiliateInvitation,\n updateAffiliateStatus,\n getPromoCodeById,\n getPromoCodes,\n createPromoCode,\n updatePromoCode,\n deletePromoCode,\n getAffiliatePromoCode,\n };\n};\n"],"mappings":";;;;AAoCA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;CAMvC,MAAM,aAAa,OACjB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,WACpB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,uBACpB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,qBAAqB,OAAO,eAA+B,EAAE,KACjE,MAAM,QACJ,GAAG,iBAAiB,uBACpB,gBACA,cACA,EACE,QAAQ,QACT,CACF;;;;CAKH,MAAM,cAAc,OAAO,eAA+B,EAAE,KAC1D,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;;;;CAMH,MAAM,mBAAmB,OAAO,eAA+B,EAAE,KAC/D,MAAM,QACJ,GAAG,iBAAiB,kBACpB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;;;CAKH,MAAM,sBAAsB,OAAO,eAA+B,EAAE,KAClE,MAAM,QACJ,GAAG,iBAAiB,kBACpB,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;;;;CAKH,MAAM,uBAAuB,OAC3B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;;;;CAKH,MAAM,gBAAgB,OACpB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,cACpB,gBACA,cACA;EAAE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AAwB,OAC5B,cACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,wBAAwB,gBAC5C,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"tag.mjs","names":[],"sources":["../../../src/getIntlayerAPI/tag.ts"],"sourcesContent":["import type {\n AddTagBody,\n AddTagResult,\n DeleteTagParams,\n DeleteTagResult,\n GetTagsParams,\n GetTagsResult,\n UpdateTagBody,\n UpdateTagParams,\n UpdateTagResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getTagAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/tag`;\n\n /**\n * Retrieves a list of tags based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getTags = async (\n filters?: GetTagsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetTagsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new tag to the database.\n * @param tag - Tag data.\n */\n const addTag = async (tag: AddTagBody, otherOptions: FetcherOptions = {}) =>\n await fetcher<AddTagResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: tag,\n }\n );\n\n /**\n * Updates an existing tag in the database.\n * @param tag - Updated tag data.\n */\n const updateTag = async (\n tagId: UpdateTagParams['tagId'],\n tag: UpdateTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateTagResult>(\n `${PROJECT_API_ROUTE}/${tagId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: tag,\n }\n );\n\n /**\n * Deletes a tag from the database by its ID.\n * @param tagId - Tag ID.\n */\n const deleteTag = async (\n tagId: DeleteTagParams['tagId'],\n\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteTagResult>(\n `${PROJECT_API_ROUTE}/${tagId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n return {\n getTags,\n addTag,\n updateTag,\n deleteTag,\n };\n};\n"],"mappings":";;;;AAeA,MAAa,aACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAc,OAAO,WAExB;;;;;CAMxC,MAAM,UAAU,OACd,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;;CAMF,MAAM,SAAS,OAAO,KAAiB,eAA+B,CAAC,MACrE,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,YAAY,OAChB,OACA,KACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,SACxB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,YAAY,OAChB,OAEA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,SACxB,gBACA,cACA,EACE,QAAQ,SACV,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"tag.mjs","names":[],"sources":["../../../src/getIntlayerAPI/tag.ts"],"sourcesContent":["import type {\n AddTagBody,\n AddTagResult,\n DeleteTagParams,\n DeleteTagResult,\n GetTagsParams,\n GetTagsResult,\n UpdateTagBody,\n UpdateTagParams,\n UpdateTagResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getTagAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/tag`;\n\n /**\n * Retrieves a list of tags based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getTags = async (\n filters?: GetTagsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetTagsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new tag to the database.\n * @param tag - Tag data.\n */\n const addTag = async (tag: AddTagBody, otherOptions: FetcherOptions = {}) =>\n await fetcher<AddTagResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: tag,\n }\n );\n\n /**\n * Updates an existing tag in the database.\n * @param tag - Updated tag data.\n */\n const updateTag = async (\n tagId: UpdateTagParams['tagId'],\n tag: UpdateTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateTagResult>(\n `${PROJECT_API_ROUTE}/${tagId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: tag,\n }\n );\n\n /**\n * Deletes a tag from the database by its ID.\n * @param tagId - Tag ID.\n */\n const deleteTag = async (\n tagId: DeleteTagParams['tagId'],\n\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteTagResult>(\n `${PROJECT_API_ROUTE}/${tagId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n return {\n getTags,\n addTag,\n updateTag,\n deleteTag,\n };\n};\n"],"mappings":";;;;AAeA,MAAa,aACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAc,OAAO,WAExB;;;;;CAMxC,MAAM,UAAU,OACd,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;;CAMH,MAAM,SAAS,OAAO,KAAiB,eAA+B,EAAE,KACtE,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,YAAY,OAChB,OACA,KACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,GAAG,SACxB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,YAAY,OAChB,OAEA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,GAAG,SACxB,gBACA,cACA,EACE,QAAQ,UACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"translate.mjs","names":[],"sources":["../../../src/getIntlayerAPI/translate.ts"],"sourcesContent":["import type {\n TranslateDictionariesBody,\n TranslateDictionariesResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type { TranslateDictionariesBody, TranslateDictionariesResult };\n\nexport const getTranslateAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const TRANSLATE_API_ROUTE = `${backendURL}/api/translate`;\n\n const translateDictionaries = async (\n body: TranslateDictionariesBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<TranslateDictionariesResult>(\n `${TRANSLATE_API_ROUTE}/dictionaries`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const pauseTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/pause`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const resumeTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/resume`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const stopTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/stop`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const retryTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/retry`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const restartTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/restart`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n return {\n translateDictionaries,\n pauseTranslationJob,\n resumeTranslationJob,\n stopTranslationJob,\n retryTranslationJob,\n restartTranslationJob,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,mBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,sBAAsB,GAFT,gBAAgB,QAAQ,cAAc,OAAO,WAEtB;CAE1C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,oBAAoB,gBACvB,gBACA,cACA;EAAE,QAAQ;EAAQ;CAAK,CACzB;CAEF,MAAM,sBAAsB,OAC1B,OACA,eAA+B,CAAC,MAEhC,QACE,GAAG,oBAAoB,GAAG,MAAM,SAChC,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;CAEF,MAAM,uBAAuB,OAC3B,OACA,eAA+B,CAAC,MAEhC,QACE,GAAG,oBAAoB,GAAG,MAAM,UAChC,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;CAEF,MAAM,qBAAqB,OACzB,OACA,eAA+B,CAAC,MAEhC,QACE,GAAG,oBAAoB,GAAG,MAAM,QAChC,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;CAEF,MAAM,sBAAsB,OAC1B,OACA,eAA+B,CAAC,MAEhC,QACE,GAAG,oBAAoB,GAAG,MAAM,SAChC,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;CAEF,MAAM,wBAAwB,OAC5B,OACA,eAA+B,CAAC,MAEhC,QACE,GAAG,oBAAoB,GAAG,MAAM,WAChC,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"translate.mjs","names":[],"sources":["../../../src/getIntlayerAPI/translate.ts"],"sourcesContent":["import type {\n TranslateDictionariesBody,\n TranslateDictionariesResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type { TranslateDictionariesBody, TranslateDictionariesResult };\n\nexport const getTranslateAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const TRANSLATE_API_ROUTE = `${backendURL}/api/translate`;\n\n const translateDictionaries = async (\n body: TranslateDictionariesBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<TranslateDictionariesResult>(\n `${TRANSLATE_API_ROUTE}/dictionaries`,\n authAPIOptions,\n otherOptions,\n { method: 'POST', body }\n );\n\n const pauseTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/pause`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const resumeTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/resume`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const stopTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/stop`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const retryTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/retry`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const restartTranslationJob = async (\n jobId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<{ data: { jobId: string } }>(\n `${TRANSLATE_API_ROUTE}/${jobId}/restart`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n return {\n translateDictionaries,\n pauseTranslationJob,\n resumeTranslationJob,\n stopTranslationJob,\n retryTranslationJob,\n restartTranslationJob,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,mBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,sBAAsB,GAFT,gBAAgB,QAAQ,cAAc,OAAO,WAEtB;CAE1C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,oBAAoB,gBACvB,gBACA,cACA;EAAE,QAAQ;EAAQ;EAAM,CACzB;CAEH,MAAM,sBAAsB,OAC1B,OACA,eAA+B,EAAE,KAEjC,QACE,GAAG,oBAAoB,GAAG,MAAM,SAChC,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;CAEH,MAAM,uBAAuB,OAC3B,OACA,eAA+B,EAAE,KAEjC,QACE,GAAG,oBAAoB,GAAG,MAAM,UAChC,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;CAEH,MAAM,qBAAqB,OACzB,OACA,eAA+B,EAAE,KAEjC,QACE,GAAG,oBAAoB,GAAG,MAAM,QAChC,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;CAEH,MAAM,sBAAsB,OAC1B,OACA,eAA+B,EAAE,KAEjC,QACE,GAAG,oBAAoB,GAAG,MAAM,SAChC,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;CAEH,MAAM,wBAAwB,OAC5B,OACA,eAA+B,EAAE,KAEjC,QACE,GAAG,oBAAoB,GAAG,MAAM,WAChC,gBACA,cACA,EAAE,QAAQ,QAAQ,CACnB;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD"}