@intlayer/api 8.3.0-canary.0 → 8.3.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/getIntlayerAPI/ai.cjs +2 -2
- package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/audit.cjs +2 -2
- package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/bitbucket.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/dictionary.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/editor.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/github.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/gitlab.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/index.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/newsletter.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/oAuth.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/organization.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/project.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/search.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/showcaseProject.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/showcaseProject.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/stripe.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/tag.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/user.cjs +1 -1
- package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
- package/dist/esm/getIntlayerAPI/ai.mjs +2 -2
- package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/audit.mjs +2 -2
- package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/bitbucket.mjs +1 -1
- package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/dictionary.mjs +1 -1
- package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/editor.mjs +1 -1
- package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/github.mjs +1 -1
- package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/gitlab.mjs +1 -1
- package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/index.mjs +1 -1
- package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/newsletter.mjs +1 -1
- package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/oAuth.mjs +1 -1
- package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/organization.mjs +1 -1
- package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/project.mjs +1 -1
- package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/search.mjs +1 -1
- package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/showcaseProject.mjs +1 -1
- package/dist/esm/getIntlayerAPI/showcaseProject.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/stripe.mjs +1 -1
- package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/tag.mjs +1 -1
- package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/user.mjs +1 -1
- package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
- package/dist/types/apps/backend/dist/types/controllers/ai.controller.d.ts +88 -0
- package/dist/types/apps/backend/dist/types/controllers/ai.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/dictionary.controller.d.ts +81 -0
- package/dist/types/apps/backend/dist/types/controllers/dictionary.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/eventListener.controller.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/controllers/github.controller.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/controllers/newsletter.controller.d.ts +26 -0
- package/dist/types/apps/backend/dist/types/controllers/newsletter.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/oAuth2.controller.d.ts +8 -0
- package/dist/types/apps/backend/dist/types/controllers/oAuth2.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/organization.controller.d.ts +64 -0
- package/dist/types/apps/backend/dist/types/controllers/organization.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/project.controller.d.ts +75 -0
- package/dist/types/apps/backend/dist/types/controllers/project.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/projectAccessKey.controller.d.ts +27 -0
- package/dist/types/apps/backend/dist/types/controllers/projectAccessKey.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/recursiveAudit.controller.d.ts +31 -0
- package/dist/types/apps/backend/dist/types/controllers/recursiveAudit.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/search.controller.d.ts +20 -0
- package/dist/types/apps/backend/dist/types/controllers/search.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/showcaseProject.controller.d.ts +76 -0
- package/dist/types/apps/backend/dist/types/controllers/showcaseProject.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/stripe.controller.d.ts +31 -0
- package/dist/types/apps/backend/dist/types/controllers/stripe.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/tag.controller.d.ts +35 -0
- package/dist/types/apps/backend/dist/types/controllers/tag.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/controllers/translation.controller.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/controllers/user.controller.d.ts +36 -0
- package/dist/types/apps/backend/dist/types/controllers/user.controller.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/export.d.ts +27 -0
- package/dist/types/apps/backend/dist/types/middlewares/sessionAuth.middleware.d.ts +12 -0
- package/dist/types/apps/backend/dist/types/middlewares/sessionAuth.middleware.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/services/audit/types.d.ts +34 -0
- package/dist/types/apps/backend/dist/types/services/audit/types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/services/ci.service.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/services/github.service.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/services/subscription.service.d.ts +11 -0
- package/dist/types/apps/backend/dist/types/services/subscription.service.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/dictionary.types.d.ts +47 -0
- package/dist/types/apps/backend/dist/types/types/dictionary.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/discussion.types.d.ts +28 -0
- package/dist/types/apps/backend/dist/types/types/discussion.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/oAuth2.types.d.ts +16 -0
- package/dist/types/apps/backend/dist/types/types/oAuth2.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/organization.types.d.ts +33 -0
- package/dist/types/apps/backend/dist/types/types/organization.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/plan.types.d.ts +23 -0
- package/dist/types/apps/backend/dist/types/types/plan.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/project.types.d.ts +92 -0
- package/dist/types/apps/backend/dist/types/types/project.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/session.types.d.ts +28 -0
- package/dist/types/apps/backend/dist/types/types/session.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/showcaseProject.types.d.ts +59 -0
- package/dist/types/apps/backend/dist/types/types/showcaseProject.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/tag.types.d.ts +31 -0
- package/dist/types/apps/backend/dist/types/types/tag.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/types/user.types.d.ts +28 -0
- package/dist/types/apps/backend/dist/types/types/user.types.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/askDocQuestion/askDocQuestion.d.ts +8 -0
- package/dist/types/apps/backend/dist/types/utils/AI/askDocQuestion/askDocQuestion.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditDictionary/index.d.ts +14 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditDictionary/index.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditDictionaryField/index.d.ts +11 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditDictionaryField/index.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditDictionaryMetadata/index.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditTag/index.d.ts +8 -0
- package/dist/types/apps/backend/dist/types/utils/AI/auditTag/index.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/customQuery/index.d.ts +11 -0
- package/dist/types/apps/backend/dist/types/utils/AI/customQuery/index.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/AI/translateJSON/index.d.ts +21 -0
- package/dist/types/apps/backend/dist/types/utils/AI/translateJSON/index.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/auth/getAuth.d.ts +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getDictionaryFiltersAndPagination.d.ts +31 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getDictionaryFiltersAndPagination.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getDiscussionFiltersAndPagination.d.ts +19 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getDiscussionFiltersAndPagination.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getFiltersAndPaginationFromBody.d.ts +12 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getFiltersAndPaginationFromBody.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getOrganizationFiltersAndPagination.d.ts +25 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getOrganizationFiltersAndPagination.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getProjectFiltersAndPagination.d.ts +18 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getProjectFiltersAndPagination.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getTagFiltersAndPagination.d.ts +16 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getTagFiltersAndPagination.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getUserFiltersAndPagination.d.ts +20 -0
- package/dist/types/apps/backend/dist/types/utils/filtersAndPagination/getUserFiltersAndPagination.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/httpStatusCodes.d.ts +408 -0
- package/dist/types/apps/backend/dist/types/utils/httpStatusCodes.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/permissions.d.ts +37 -0
- package/dist/types/apps/backend/dist/types/utils/permissions.d.ts.map +1 -0
- package/dist/types/apps/backend/dist/types/utils/responseData.d.ts +27 -0
- package/dist/types/apps/backend/dist/types/utils/responseData.d.ts.map +1 -0
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/ai.d.ts +3 -2
- package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/audit.d.ts +3 -2
- package/dist/types/getIntlayerAPI/audit.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/bitbucket.d.ts +1 -1
- package/dist/types/getIntlayerAPI/bitbucket.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/dictionary.d.ts +2 -2
- package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/editor.d.ts +3 -3
- package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/github.d.ts +1 -1
- package/dist/types/getIntlayerAPI/github.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/gitlab.d.ts +1 -1
- package/dist/types/getIntlayerAPI/gitlab.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/newsletter.d.ts +2 -2
- package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/oAuth.d.ts +2 -1
- package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/organization.d.ts +2 -2
- package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/project.d.ts +4 -2
- package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/search.d.ts +2 -2
- package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/showcaseProject.d.ts +2 -2
- package/dist/types/getIntlayerAPI/showcaseProject.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/stripe.d.ts +2 -2
- package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/tag.d.ts +2 -2
- package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/user.d.ts +6 -3
- package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -3
- package/dist/types/packages/@intlayer/ai/dist/types/aiSdk.d.ts +110 -0
- package/dist/types/packages/@intlayer/ai/dist/types/aiSdk.d.ts.map +1 -0
- package/dist/types/packages/@intlayer/ai/dist/types/auditDictionaryMetadata/index.d.ts +12 -0
- package/dist/types/packages/@intlayer/ai/dist/types/auditDictionaryMetadata/index.d.ts.map +1 -0
- package/dist/types/packages/@intlayer/ai/dist/types/customQuery.d.ts +8 -0
- package/dist/types/packages/@intlayer/ai/dist/types/customQuery.d.ts.map +1 -0
- package/dist/types/packages/@intlayer/ai/dist/types/index.d.ts +27 -0
- package/dist/types/packages/@intlayer/ai/dist/types/index.d.ts.map +1 -0
- package/dist/types/packages/@intlayer/ai/dist/types/translateJSON/index.d.ts +10 -0
- package/dist/types/packages/@intlayer/ai/dist/types/translateJSON/index.d.ts.map +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/build.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/cleanOutputDir.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createType/createModuleAugmentation.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/createType/createType.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/formatDictionary.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/loadDictionaries/loadContentDeclaration.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/loadDictionaries/loadDictionaries.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/prepareIntlayer.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/writeConfiguration/index.d.ts +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +6 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/writeContentDeclaration/transformJSFile.d.ts +2 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +3 -0
- package/dist/types/packages/@intlayer/chokidar/dist/types/writeContentDeclaration/writeJSFile.d.ts +2 -0
- package/dist/types/packages/@intlayer/core/dist/types/messageFormat/ICU.d.ts +1 -0
- package/dist/types/packages/@intlayer/core/dist/types/messageFormat/i18next.d.ts +1 -0
- package/dist/types/packages/@intlayer/core/dist/types/messageFormat/index.d.ts +1 -0
- package/dist/types/packages/@intlayer/core/dist/types/messageFormat/vue-i18n.d.ts +1 -0
- package/dist/types/packages/@intlayer/unmerged-dictionaries-entry/dist/types/index.d.ts +10 -0
- package/dist/types/packages/@intlayer/unmerged-dictionaries-entry/dist/types/index.d.ts.map +1 -0
- package/dist/types/packages/intlayer-editor/server/dist/controllers/configuration.controller.d.ts +12 -0
- package/dist/types/packages/intlayer-editor/server/dist/controllers/configuration.controller.d.ts.map +1 -0
- package/dist/types/packages/intlayer-editor/server/dist/controllers/dictionary.controller.d.ts +25 -0
- package/dist/types/packages/intlayer-editor/server/dist/controllers/dictionary.controller.d.ts.map +1 -0
- package/dist/types/packages/intlayer-editor/server/dist/export.d.ts +2 -0
- package/dist/types/packages/intlayer-editor/server/dist/utils/httpStatusCodes.d.ts +408 -0
- package/dist/types/packages/intlayer-editor/server/dist/utils/httpStatusCodes.d.ts.map +1 -0
- package/dist/types/packages/intlayer-editor/server/dist/utils/responseData.d.ts +20 -0
- package/dist/types/packages/intlayer-editor/server/dist/utils/responseData.d.ts.map +1 -0
- package/dist/types/types.d.ts +1 -1
- package/package.json +6 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../fetcher.cjs`),t=(t={},n)=>{let r=`${n.editor.backendURL}/api/showcase-project`;return{getShowcaseProjects:async(n,i={})=>{let a={};return n?.page!==void 0&&(a.page=String(n.page)),n?.pageSize!==void 0&&(a.pageSize=String(n.pageSize)),n?.search!==void 0&&(a.search=n.search),n?.isOpenSource!==void 0&&(a.isOpenSource=String(n.isOpenSource)),n?.selectedUseCases?.length&&(a.selectedUseCases=n.selectedUseCases),await e.fetcher(r,t,i,{method:`GET`,params:a})},getShowcaseProjectById:async(n,i={})=>await e.fetcher(`${r}/${n}`,t,i,{method:`GET`}),getOtherShowcaseProjects:async(n,i={})=>{let a={excludeId:n.excludeId};return n.limit!==void 0&&(a.limit=String(n.limit)),await e.fetcher(`${r}/others`,t,i,{method:`GET`,params:a})},submitShowcaseProject:async(n,i={})=>await e.fetcher(`${r}/submit`,t,i,{method:`POST`,body:n}),toggleShowcaseUpvote:async(n,i={})=>await e.fetcher(`${r}/upvote`,t,i,{method:`POST`,body:n}),toggleShowcaseDownvote:async(n,i={})=>await e.fetcher(`${r}/downvote`,t,i,{method:`POST`,body:n}),deleteShowcaseProject:async(n,i={})=>await e.fetcher(`${r}/${n}`,t,i,{method:`DELETE`}),updateShowcaseProject:async(n,i,a={})=>await e.fetcher(`${r}/${n}`,t,a,{method:`PATCH`,body:i})}};exports.getShowcaseProjectAPI=t;
|
|
2
2
|
//# sourceMappingURL=showcaseProject.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showcaseProject.cjs","names":["
|
|
1
|
+
{"version":3,"file":"showcaseProject.cjs","names":["fetcher"],"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 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;\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":"qGAgCa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAqB,GAFR,EAAe,OAAO,WAEA,uBAwGzC,MAAO,CACL,oBAvG0B,MAC1B,EACA,EAA+B,EAAE,GAC9B,CACH,IAAM,EAA4C,EAAE,CASpD,OARI,GAAO,OAAS,IAAA,KAAW,EAAO,KAAO,OAAO,EAAM,KAAK,EAC3D,GAAO,WAAa,IAAA,KAAW,EAAO,SAAW,OAAO,EAAM,SAAS,EACvE,GAAO,SAAW,IAAA,KAAW,EAAO,OAAS,EAAM,QACnD,GAAO,eAAiB,IAAA,KAC1B,EAAO,aAAe,OAAO,EAAM,aAAa,EAC9C,GAAO,kBAAkB,SAC3B,EAAO,iBAAmB,EAAM,kBAE3B,MAAMA,EAAAA,QACX,EACA,EACA,EACA,CAAE,OAAQ,MAAe,SAAe,CACzC,EAsFD,uBAnF6B,MAC7B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAmB,GAAG,IACzB,EACA,EACA,CAAE,OAAQ,MAAO,CAClB,CA2ED,yBAzE+B,MAC/B,EACA,EAA+B,EAAE,GAC9B,CACH,IAAM,EAAiC,CAAE,UAAW,EAAM,UAAW,CAErE,OADI,EAAM,QAAU,IAAA,KAAW,EAAO,MAAQ,OAAO,EAAM,MAAM,EAC1D,MAAMA,EAAAA,QACX,GAAG,EAAmB,SACtB,EACA,EACA,CAAE,OAAQ,MAAe,SAAe,CACzC,EA+DD,sBA5D4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAmB,SACtB,EACA,EACA,CAAE,OAAQ,OAAQ,OAAM,CACzB,CAoDD,qBAlD2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAmB,SACtB,EACA,EACA,CAAE,OAAQ,OAAQ,OAAM,CACzB,CA0CD,uBAxC6B,MAC7B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAmB,WACtB,EACA,EACA,CAAE,OAAQ,OAAQ,OAAM,CACzB,CAgCD,sBA9B4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAmB,GAAG,IACzB,EACA,EACA,CAAE,OAAQ,SAAU,CACrB,CAsBD,sBApB4B,MAC5B,EACA,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAmB,GAAG,IACzB,EACA,EACA,CAAE,OAAQ,QAAS,OAAM,CAC1B,CAWF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../fetcher.cjs`),t=(t={},n)=>{let r=`${n.editor.backendURL}/api/stripe`;return{getPricing:async(n,i={})=>await e.fetcher(`${r}/pricing`,t,i,{method:`POST`,body:n}),getSubscription:async(n,i={})=>await e.fetcher(`${r}/create-subscription`,t,i,{method:`POST`,body:n}),cancelSubscription:async(n={})=>await e.fetcher(`${r}/cancel-subscription`,t,n,{method:`POST`})}};exports.getStripeAPI=t;
|
|
2
2
|
//# sourceMappingURL=stripe.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.cjs","names":["
|
|
1
|
+
{"version":3,"file":"stripe.cjs","names":["fetcher"],"sources":["../../../src/getIntlayerAPI/stripe.ts"],"sourcesContent":["import type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetPricingBody,\n GetPricingResult,\n} from '@intlayer/backend';\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;\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 return {\n getPricing,\n getSubscription,\n cancelSubscription,\n };\n};\n"],"mappings":"qGASa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aAoDvC,MAAO,CACL,WA/CiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAiB,UACpB,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAoCD,gBA9BsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAiB,sBACpB,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAmBD,mBAbyB,MAAO,EAA+B,EAAE,GACjE,MAAMA,EAAAA,QACJ,GAAG,EAAiB,sBACpB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAMF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../fetcher.cjs`),t=(t={},n)=>{let r=`${n.editor.backendURL}/api/tag`;return{getTags:async(n,i={})=>await e.fetcher(r,t,i,{cache:`no-store`,params:n}),addTag:async(n,i={})=>await e.fetcher(`${r}`,t,i,{method:`POST`,body:n}),updateTag:async(n,i,a={})=>await e.fetcher(`${r}/${n}`,t,a,{method:`PUT`,body:i}),deleteTag:async(n,i={})=>await e.fetcher(`${r}/${n}`,t,i,{method:`DELETE`})}};exports.getTagAPI=t;
|
|
2
2
|
//# sourceMappingURL=tag.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.cjs","names":["
|
|
1
|
+
{"version":3,"file":"tag.cjs","names":["fetcher"],"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 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;\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":"qGAca,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAoB,GAFP,EAAe,OAAO,WAED,UAyExC,MAAO,CACL,QApEc,MACd,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CAwDD,OAlDa,MAAO,EAAiB,EAA+B,EAAE,GACtE,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CA0CD,UApCgB,MAChB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,IACxB,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAwBD,UAlBgB,MAChB,EAEA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,IACxB,EACA,EACA,CACE,OAAQ,SACT,CACF,CAOF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../fetcher.cjs`),t=(t={},n)=>{let r=`${n.editor.backendURL}/api/user`;return{createUser:async(n,i={})=>await e.fetcher(`${r}/`,t,i,{method:`POST`,body:n}),getUsers:async(n,i={})=>await e.fetcher(r,t,i,{cache:`no-store`,params:n}),getUserById:async(n,i={})=>await e.fetcher(`${r}/${n}`,t,i,{cache:`no-store`}),getUserByAccount:async(n,i,a={})=>await e.fetcher(`${r}/account/${i}/${n}`,t,a,{cache:`no-store`}),getUserByEmail:async(n,i={})=>await e.fetcher(`${r}/email/${n}`,t,i,{cache:`no-store`}),updateUser:async(n,i={})=>await e.fetcher(`${r}`,t,i,{method:`PUT`,body:n}),deleteUser:async(n,i={})=>await e.fetcher(`${r}/${n}`,t,i,{method:`DELETE`}),getVerifyEmailStatusURL:e=>`${r}/verify-email-status/${String(e)}`}};exports.getUserAPI=t;
|
|
2
2
|
//# sourceMappingURL=user.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.cjs","names":["
|
|
1
|
+
{"version":3,"file":"user.cjs","names":["fetcher"],"sources":["../../../src/getIntlayerAPI/user.ts"],"sourcesContent":["import type {\n CreateUserBody,\n CreateUserResult,\n GetUserByEmailParams,\n GetUserByEmailResult,\n GetUserByIdParams,\n GetUserByIdResult,\n GetUsersParams,\n GetUsersResult,\n UpdateUserBody,\n UpdateUserResult,\n UserAPI,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\ntype GetUserByAccountParams = { providerAccountId: string; provider: string };\ntype GetUserByAccountResult = import('@intlayer/backend').ResponseData<UserAPI>;\n\nexport const getUserAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const USER_API_ROUTE = `${backendURL}/api/user`;\n\n /**\n * Retrieves a list of users based on filters and pagination.\n * @param filters - Filters and pagination options.\n * @returns List of users.\n */\n const getUsers = async (\n filters?: GetUsersParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetUsersResult>(\n USER_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 user by ID.\n * @param userId - User ID.\n * @returns User object.\n */\n const getUserById = async (\n userId: GetUserByIdParams['userId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetUserByIdResult>(\n `${USER_API_ROUTE}/${userId}`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a user by email.\n * @param email - User email.\n * @returns User object.\n */\n const getUserByEmail = async (\n email: GetUserByEmailParams['email'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetUserByEmailResult>(\n `${USER_API_ROUTE}/email/${email}`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a user by account.\n * @param providerAccountId - The provider account ID.\n * @param provider - The provider of the account.\n */\n const getUserByAccount = async (\n providerAccountId: GetUserByAccountParams['providerAccountId'],\n provider: GetUserByAccountParams['provider'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetUserByAccountResult>(\n `${USER_API_ROUTE}/account/${provider}/${providerAccountId}`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Creates a new user.\n * @param user - User credentials.\n * @returns User object.\n */\n const createUser = async (\n user: CreateUserBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateUserResult>(\n `${USER_API_ROUTE}/`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n }\n );\n\n /**\n * Updates the user with the provided data.\n * @param user - Updated user data.\n * @returns User object.\n */\n const updateUser = async (\n user: UpdateUserBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateUserResult>(\n `${USER_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: user,\n }\n );\n\n /**\n * Deletes a user with the provided ID.\n * @param userId - User ID.\n * @returns User object.\n */\n const deleteUser = async (\n userId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateUserResult>(\n `${USER_API_ROUTE}/${userId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Gets the verify email status URL to use in the SSE.\n * @param userId - User ID.\n * @returns The verify email status URL.\n */\n const getVerifyEmailStatusURL = (userId: string | UserAPI['id']) =>\n `${USER_API_ROUTE}/verify-email-status/${String(userId)}`;\n\n return {\n createUser,\n getUsers,\n getUserById,\n getUserByAccount,\n getUserByEmail,\n updateUser,\n deleteUser,\n getVerifyEmailStatusURL,\n };\n};\n"],"mappings":"qGAmBa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAiB,GAFJ,EAAe,OAAO,WAEJ,WA6IrC,MAAO,CACL,WA5DiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAe,GAClB,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAiDD,SAxIe,MACf,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CA4HD,YArHkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAe,GAAG,IACrB,EACA,EACA,CACE,MAAO,WACR,CACF,CA2GD,iBAlFuB,MACvB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAe,WAAW,EAAS,GAAG,IACzC,EACA,EACA,CACE,MAAO,WACR,CACF,CAuED,eArGqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAe,SAAS,IAC3B,EACA,EACA,CACE,MAAO,WACR,CACF,CA2FD,WA9CiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAmCD,WA5BiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAe,GAAG,IACrB,EACA,EACA,CACE,OAAQ,SACT,CACF,CAkBD,wBAX+B,GAC/B,GAAG,EAAe,uBAAuB,OAAO,EAAO,GAWxD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
2
|
-
`);u=n.pop()??``;for(let e of n)if(e.startsWith(`data: `))try{let t=JSON.parse(e.slice(6));t.chunk&&
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/ai`;return{customQuery:async(n,i={})=>await e(r,t,i,{method:`POST`,body:n}),translateJSON:async(n,i={})=>await e(`${r}/translate/json`,t,i,{method:`POST`,body:n}),auditContentDeclaration:async(n,i={})=>await e(`${r}/audit/dictionary`,t,i,{method:`POST`,body:n}),auditContentDeclarationField:async(n,i={})=>await e(`${r}/audit/dictionary/field`,t,i,{method:`POST`,body:n}),auditContentDeclarationMetadata:async(n,i={})=>await e(`${r}/audit/dictionary/metadata`,t,i,{method:`POST`,body:n}),auditTag:async(n,i={})=>await e(`${r}/audit/tag`,t,i,{method:`POST`,body:n}),askDocQuestion:async(e,n={})=>{if(!e)return;let{onMessage:i,onDone:a,...o}=e,s=new AbortController;try{let e=await fetch(`${r}/ask`,{method:`POST`,headers:{"Content-Type":`application/json`,...t.headers,...n.headers},body:JSON.stringify({...o,...t.body,...n.body}),signal:s.signal,credentials:`include`});if(!e.ok){let t=`An error occurred`;try{let n=await e.json();t=JSON.stringify(n.error)??`An error occurred`}catch{try{let n=await e.text();n&&(t=n)}catch{}}throw Error(t)}let c=e.body?.getReader();if(!c)throw Error(`No reader available`);let l=new TextDecoder,u=``;for(;;){let{done:e,value:t}=await c.read();if(e)break;u+=l.decode(t,{stream:!0});let n=u.split(`
|
|
2
|
+
`);u=n.pop()??``;for(let e of n)if(e.startsWith(`data: `))try{let t=JSON.parse(e.slice(6));t.chunk&&i?.(t.chunk),t.done&&t.response&&a?.(t.response)}catch(e){console.error(`Failed to parse SSE data:`,e)}}}catch(e){throw console.error(`Error in askDocQuestion:`,e),e}},autocomplete:async(n,i={})=>await e(`${r}/autocomplete`,t,i,{method:`POST`,body:n}),getDiscussions:async(n,i={})=>await e(`${r}/discussions`,t,i,{method:`GET`,params:n})}};export{t as getAiAPI};
|
|
3
3
|
//# sourceMappingURL=ai.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.mjs","names":[],"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import type {\n AIOptions,\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n GetDiscussionsParams,\n GetDiscussionsResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type AutocompleteBody = {\n text: string;\n aiOptions?: AIOptions;\n contextBefore?: string;\n currentLine?: string;\n contextAfter?: string;\n};\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discussionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify({\n ...rest,\n ...authAPIOptions.body,\n ...otherOptions.body,\n }),\n signal: abortController.signal,\n credentials: 'include',\n });\n\n if (!response.ok) {\n // Align error handling with generic `fetcher` utility so that callers receive\n // meaningful messages (e.g. for 429 \"Too Many Requests\" responses).\n let errorMessage: string = 'An error occurred';\n\n try {\n // Attempt to parse JSON error payload produced by backend\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? 'An error occurred';\n } catch {\n // Fallback to plain-text body or HTTP status text\n try {\n const errorText = await response.text();\n if (errorText) {\n errorMessage = errorText;\n }\n } catch {\n // ignore – we already have a default message\n }\n }\n\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Retrieves discussions with filters and pagination. Only user or admin can access.\n */\n const getDiscussions = async (\n params?: GetDiscussionsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDiscussionsResult>(\n `${AI_API_ROUTE}/discussions`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n getDiscussions,\n };\n};\n"],"mappings":"+EAyCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAc,GAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAGH,IAAM,EAAe,GAAG,EAAW,SA+PnC,MAAO,CACL,YAzPkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,EACA,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA8OD,cAvOoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,iBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA4ND,wBArN8B,MAC9B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,mBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA0MD,6BAnMmC,MACnC,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,yBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAwLD,gCAjLsC,MACtC,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,4BAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAsKD,SA/Je,MACf,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,YAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAoJD,eA/HqB,MACrB,EACA,EAA+B,EAAE,GAC9B,CACH,GAAI,CAAC,EAAM,OAEX,GAAM,CAAE,YAAW,SAAQ,GAAG,GAAS,EACjC,EAAkB,IAAI,gBAE5B,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,GAAG,EAAa,MAAO,CAClD,OAAQ,OACR,QAAS,CACP,eAAgB,mBAChB,GAAG,EAAe,QAClB,GAAG,EAAa,QACjB,CACD,KAAM,KAAK,UAAU,CACnB,GAAG,EACH,GAAG,EAAe,KAClB,GAAG,EAAa,KACjB,CAAC,CACF,OAAQ,EAAgB,OACxB,YAAa,UACd,CAAC,CAEF,GAAI,CAAC,EAAS,GAAI,CAGhB,IAAI,EAAuB,oBAE3B,GAAI,CAEF,IAAM,EAAY,MAAM,EAAS,MAAM,CACvC,EAAe,KAAK,UAAU,EAAU,MAAM,EAAI,yBAC5C,CAEN,GAAI,CACF,IAAM,EAAY,MAAM,EAAS,MAAM,CACnC,IACF,EAAe,QAEX,GAKV,MAAU,MAAM,EAAa,CAG/B,IAAM,EAAS,EAAS,MAAM,WAAW,CACzC,GAAI,CAAC,EACH,MAAU,MAAM,sBAAsB,CAGxC,IAAM,EAAU,IAAI,YAChB,EAAS,GAEb,OAAa,CACX,GAAM,CAAE,OAAM,SAAU,MAAM,EAAO,MAAM,CAC3C,GAAI,EAAM,MAEV,GAAU,EAAQ,OAAO,EAAO,CAAE,OAAQ,GAAM,CAAC,CACjD,IAAM,EAAQ,EAAO,MAAM;EAAK,CAChC,EAAS,EAAM,KAAK,EAAI,GAExB,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAK,WAAW,SAAS,CAC3B,GAAI,CACF,IAAM,EAAO,KAAK,MAAM,EAAK,MAAM,EAAE,CAAC,CAClC,EAAK,OACP,IAAY,EAAK,MAAM,CAErB,EAAK,MAAQ,EAAK,UACpB,IAAS,EAAK,SAAS,OAElB,EAAG,CACV,QAAQ,MAAM,4BAA6B,EAAE,SAK9C,EAAO,CAEd,MADA,QAAQ,MAAM,2BAA4B,EAAM,CAC1C,IA4CR,aAxCmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,eAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA6BD,eAxBqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,cAChB,EACA,EACA,CACE,OAAQ,MAER,SACD,CACF,CAYF"}
|
|
1
|
+
{"version":3,"file":"ai.mjs","names":[],"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import type {\n AIOptions,\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n GetDiscussionsParams,\n GetDiscussionsResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type AutocompleteBody = {\n text: string;\n aiOptions?: AIOptions;\n contextBefore?: string;\n currentLine?: string;\n contextAfter?: string;\n};\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discussionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify({\n ...rest,\n ...authAPIOptions.body,\n ...otherOptions.body,\n }),\n signal: abortController.signal,\n credentials: 'include',\n });\n\n if (!response.ok) {\n // Align error handling with generic `fetcher` utility so that callers receive\n // meaningful messages (e.g. for 429 \"Too Many Requests\" responses).\n let errorMessage: string = 'An error occurred';\n\n try {\n // Attempt to parse JSON error payload produced by backend\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? 'An error occurred';\n } catch {\n // Fallback to plain-text body or HTTP status text\n try {\n const errorText = await response.text();\n if (errorText) {\n errorMessage = errorText;\n }\n } catch {\n // ignore – we already have a default message\n }\n }\n\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Retrieves discussions with filters and pagination. Only user or admin can access.\n */\n const getDiscussions = async (\n params?: GetDiscussionsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDiscussionsResult>(\n `${AI_API_ROUTE}/discussions`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n getDiscussions,\n };\n};\n"],"mappings":"yCAwCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAe,GAFF,EAAe,OAAO,WAEN,SA+PnC,MAAO,CACL,YAzPkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,EACA,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA8OD,cAvOoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,iBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA4ND,wBArN8B,MAC9B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,mBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA0MD,6BAnMmC,MACnC,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,yBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAwLD,gCAjLsC,MACtC,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,4BAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAsKD,SA/Je,MACf,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,YAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAoJD,eA/HqB,MACrB,EACA,EAA+B,EAAE,GAC9B,CACH,GAAI,CAAC,EAAM,OAEX,GAAM,CAAE,YAAW,SAAQ,GAAG,GAAS,EACjC,EAAkB,IAAI,gBAE5B,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,GAAG,EAAa,MAAO,CAClD,OAAQ,OACR,QAAS,CACP,eAAgB,mBAChB,GAAG,EAAe,QAClB,GAAG,EAAa,QACjB,CACD,KAAM,KAAK,UAAU,CACnB,GAAG,EACH,GAAG,EAAe,KAClB,GAAG,EAAa,KACjB,CAAC,CACF,OAAQ,EAAgB,OACxB,YAAa,UACd,CAAC,CAEF,GAAI,CAAC,EAAS,GAAI,CAGhB,IAAI,EAAuB,oBAE3B,GAAI,CAEF,IAAM,EAAY,MAAM,EAAS,MAAM,CACvC,EAAe,KAAK,UAAU,EAAU,MAAM,EAAI,yBAC5C,CAEN,GAAI,CACF,IAAM,EAAY,MAAM,EAAS,MAAM,CACnC,IACF,EAAe,QAEX,GAKV,MAAU,MAAM,EAAa,CAG/B,IAAM,EAAS,EAAS,MAAM,WAAW,CACzC,GAAI,CAAC,EACH,MAAU,MAAM,sBAAsB,CAGxC,IAAM,EAAU,IAAI,YAChB,EAAS,GAEb,OAAa,CACX,GAAM,CAAE,OAAM,SAAU,MAAM,EAAO,MAAM,CAC3C,GAAI,EAAM,MAEV,GAAU,EAAQ,OAAO,EAAO,CAAE,OAAQ,GAAM,CAAC,CACjD,IAAM,EAAQ,EAAO,MAAM;EAAK,CAChC,EAAS,EAAM,KAAK,EAAI,GAExB,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAK,WAAW,SAAS,CAC3B,GAAI,CACF,IAAM,EAAO,KAAK,MAAM,EAAK,MAAM,EAAE,CAAC,CAClC,EAAK,OACP,IAAY,EAAK,MAAM,CAErB,EAAK,MAAQ,EAAK,UACpB,IAAS,EAAK,SAAS,OAElB,EAAG,CACV,QAAQ,MAAM,4BAA6B,EAAE,SAK9C,EAAO,CAEd,MADA,QAAQ,MAAM,2BAA4B,EAAM,CAC1C,IA4CR,aAxCmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,eAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA6BD,eAxBqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAa,cAChB,EACA,EACA,CACE,OAAQ,MAER,SACD,CACF,CAYF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
2
|
-
`);d=n.pop()??``;for(let e of n)if(e.startsWith(`data: `))try{let t=JSON.parse(e.slice(6));
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/scan`;return{discoverUrls:async(n,i={})=>await e(`${r}/recursive/discover`,t,i,{method:`GET`,params:n}),scanUrl:async(e,n={})=>{if(!e?.url)return;let{url:i,onMessage:a,onDone:o}=e,s=`${r}?${new URLSearchParams({url:i}).toString()}`,c=await fetch(s,{method:`GET`,headers:{Accept:`text/event-stream`,...t.headers,...n.headers},credentials:`include`,signal:n.signal});if(!c.ok){let e=`An error occurred`;try{let t=await c.json();e=JSON.stringify(t.error)??e}catch{try{let t=await c.text();t&&(e=t)}catch{}}throw Error(e)}let l=c.body?.getReader();if(!l)throw Error(`No reader available`);let u=new TextDecoder,d=``;for(;;){let{done:e,value:t}=await l.read();if(e)break;d+=u.decode(t,{stream:!0});let n=d.split(`
|
|
2
|
+
`);d=n.pop()??``;for(let e of n)if(e.startsWith(`data: `))try{let t=JSON.parse(e.slice(6));a?.(t)}catch{}}o?.()},startRecursiveAudit:async(n,i={})=>await e(`${r}/recursive/start`,t,i,{method:`POST`,params:n?.url?{url:n.url}:void 0,body:n?.urls===void 0?void 0:{urls:n.urls}}),getRecursiveAuditStatus:async(n,i={})=>await e(`${r}/recursive/${n?.jobId}`,t,i,{method:`GET`}),cancelRecursiveAudit:async(n,i={})=>await e(`${r}/recursive/${n?.jobId}/cancel`,t,i,{method:`POST`}),pauseRecursiveAudit:async(n,i={})=>await e(`${r}/recursive/${n?.jobId}/pause`,t,i,{method:`POST`}),resumeRecursiveAudit:async(n,i={})=>await e(`${r}/recursive/${n?.jobId}/resume`,t,i,{method:`POST`})}};export{t as getAuditAPI};
|
|
3
3
|
//# sourceMappingURL=audit.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.mjs","names":[],"sources":["../../../src/getIntlayerAPI/audit.ts"],"sourcesContent":["import type {\n AuditEvent,\n GetRecursiveAuditStatusResult,\n StartRecursiveAuditResult,\n} from '@intlayer/backend';\nimport
|
|
1
|
+
{"version":3,"file":"audit.mjs","names":[],"sources":["../../../src/getIntlayerAPI/audit.ts"],"sourcesContent":["import type {\n AuditEvent,\n GetRecursiveAuditStatusResult,\n StartRecursiveAuditResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type {\n AuditEvent,\n GetRecursiveAuditStatusResult,\n StartRecursiveAuditResult,\n};\n\nexport type ScanUrlBody = {\n url: string;\n onMessage?: (event: AuditEvent) => void;\n onDone?: () => void;\n};\n\nexport type DiscoverUrlsParams = {\n url: string;\n};\n\nexport type DiscoverUrlsResult = {\n urls: string[];\n};\n\nexport type StartRecursiveAuditBody = {\n url: string;\n urls?: string[];\n};\n\nexport type GetRecursiveAuditStatusParams = {\n jobId: string;\n};\n\nexport type RecursiveAuditJobParams = {\n jobId: string;\n};\n\nexport const getAuditAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const AUDIT_API_ROUTE = `${backendURL}/api/scan`;\n\n /**\n * Streams a single-page SEO audit as Server-Sent Events.\n *\n * Usage:\n * ```ts\n * await audit.scanUrl({\n * url: 'https://example.com',\n * onMessage: (event) => console.log(event),\n * onDone: () => console.log('done'),\n * });\n * ```\n */\n const discoverUrls = async (\n params?: DiscoverUrlsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DiscoverUrlsResult>(\n `${AUDIT_API_ROUTE}/recursive/discover`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params,\n }\n );\n\n const scanUrl = async (\n body?: ScanUrlBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body?.url) return;\n\n const { url, onMessage, onDone } = body;\n\n const params = new URLSearchParams({ url });\n const endpoint = `${AUDIT_API_ROUTE}?${params.toString()}`;\n\n const response = await fetch(endpoint, {\n method: 'GET',\n headers: {\n Accept: 'text/event-stream',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n credentials: 'include',\n signal: otherOptions.signal,\n });\n\n if (!response.ok) {\n let errorMessage = 'An error occurred';\n try {\n const errorData = await response.json();\n errorMessage = JSON.stringify(errorData.error) ?? errorMessage;\n } catch {\n try {\n const errorText = await response.text();\n if (errorText) errorMessage = errorText;\n } catch {\n // ignore\n }\n }\n throw new Error(errorMessage);\n }\n\n const reader = response.body?.getReader();\n if (!reader) throw new Error('No reader available');\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const event = JSON.parse(line.slice(6)) as AuditEvent;\n onMessage?.(event);\n } catch {\n // ignore malformed lines\n }\n }\n }\n }\n\n onDone?.();\n };\n\n /**\n * Starts a recursive audit job for the given URL.\n */\n const startRecursiveAudit = async (\n body?: StartRecursiveAuditBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<StartRecursiveAuditResult>(\n `${AUDIT_API_ROUTE}/recursive/start`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n params: body?.url ? { url: body.url } : undefined,\n body: body?.urls !== undefined ? { urls: body.urls as any } : undefined,\n }\n );\n\n /**\n * Gets the status of a recursive audit job.\n */\n const getRecursiveAuditStatus = async (\n params?: GetRecursiveAuditStatusParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetRecursiveAuditStatusResult>(\n `${AUDIT_API_ROUTE}/recursive/${params?.jobId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n const cancelRecursiveAudit = async (\n params?: RecursiveAuditJobParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<{ success: boolean }>(\n `${AUDIT_API_ROUTE}/recursive/${params?.jobId}/cancel`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const pauseRecursiveAudit = async (\n params?: RecursiveAuditJobParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<{ success: boolean }>(\n `${AUDIT_API_ROUTE}/recursive/${params?.jobId}/pause`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n const resumeRecursiveAudit = async (\n params?: RecursiveAuditJobParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<{ success: boolean }>(\n `${AUDIT_API_ROUTE}/recursive/${params?.jobId}/resume`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n return {\n discoverUrls,\n scanUrl,\n startRecursiveAudit,\n getRecursiveAuditStatus,\n cancelRecursiveAudit,\n pauseRecursiveAudit,\n resumeRecursiveAudit,\n };\n};\n"],"mappings":"yCAyCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAkB,GAFL,EAAe,OAAO,WAEH,WAmKtC,MAAO,CACL,aAtJmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAgB,qBACnB,EACA,EACA,CACE,OAAQ,MACR,SACD,CACF,CA2ID,QAzIc,MACd,EACA,EAA+B,EAAE,GAC9B,CACH,GAAI,CAAC,GAAM,IAAK,OAEhB,GAAM,CAAE,MAAK,YAAW,UAAW,EAG7B,EAAW,GAAG,EAAgB,GADrB,IAAI,gBAAgB,CAAE,MAAK,CAAC,CACG,UAAU,GAElD,EAAW,MAAM,MAAM,EAAU,CACrC,OAAQ,MACR,QAAS,CACP,OAAQ,oBACR,GAAG,EAAe,QAClB,GAAG,EAAa,QACjB,CACD,YAAa,UACb,OAAQ,EAAa,OACtB,CAAC,CAEF,GAAI,CAAC,EAAS,GAAI,CAChB,IAAI,EAAe,oBACnB,GAAI,CACF,IAAM,EAAY,MAAM,EAAS,MAAM,CACvC,EAAe,KAAK,UAAU,EAAU,MAAM,EAAI,OAC5C,CACN,GAAI,CACF,IAAM,EAAY,MAAM,EAAS,MAAM,CACnC,IAAW,EAAe,QACxB,GAIV,MAAU,MAAM,EAAa,CAG/B,IAAM,EAAS,EAAS,MAAM,WAAW,CACzC,GAAI,CAAC,EAAQ,MAAU,MAAM,sBAAsB,CAEnD,IAAM,EAAU,IAAI,YAChB,EAAS,GAEb,OAAa,CACX,GAAM,CAAE,OAAM,SAAU,MAAM,EAAO,MAAM,CAE3C,GAAI,EAAM,MAEV,GAAU,EAAQ,OAAO,EAAO,CAAE,OAAQ,GAAM,CAAC,CACjD,IAAM,EAAQ,EAAO,MAAM;EAAK,CAChC,EAAS,EAAM,KAAK,EAAI,GAExB,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAK,WAAW,SAAS,CAC3B,GAAI,CACF,IAAM,EAAQ,KAAK,MAAM,EAAK,MAAM,EAAE,CAAC,CACvC,IAAY,EAAM,MACZ,GAOd,KAAU,EAyEV,oBAnE0B,MAC1B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAgB,kBACnB,EACA,EACA,CACE,OAAQ,OACR,OAAQ,GAAM,IAAM,CAAE,IAAK,EAAK,IAAK,CAAG,IAAA,GACxC,KAAM,GAAM,OAAS,IAAA,GAAyC,IAAA,GAA7B,CAAE,KAAM,EAAK,KAAa,CAC5D,CACF,CAuDD,wBAlD8B,MAC9B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAgB,aAAa,GAAQ,QACxC,EACA,EACA,CACE,OAAQ,MACT,CACF,CAwCD,qBAtC2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAgB,aAAa,GAAQ,MAAM,SAC9C,EACA,EACA,CAAE,OAAQ,OAAQ,CACnB,CA8BD,oBA5B0B,MAC1B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAgB,aAAa,GAAQ,MAAM,QAC9C,EACA,EACA,CAAE,OAAQ,OAAQ,CACnB,CAoBD,qBAlB2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAgB,aAAa,GAAQ,MAAM,SAC9C,EACA,EACA,CAAE,OAAQ,OAAQ,CACnB,CAUF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/bitbucket`;return{getAuthUrl:async(n,i={})=>await e(`${r}/auth-url`,t,i,{params:{redirectUri:n}}),authenticate:async(n,i={})=>await e(`${r}/auth`,t,i,{method:`POST`,body:{code:n}}),getRepositories:async(n,i={})=>await e(`${r}/repos`,t,i,{params:n?{token:n}:void 0}),checkIntlayerConfig:async(n,i,a,o=`main`,s={})=>await e(`${r}/check-config`,t,s,{method:`POST`,body:{token:n??void 0,workspace:i,repoSlug:a,branch:o}}),getConfigFile:async(n,i,a,o=`main`,s=`intlayer.config.ts`,c={})=>await e(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,workspace:i,repoSlug:a,branch:o,path:s}})}};export{t as getBitbucketAPI};
|
|
2
2
|
//# sourceMappingURL=bitbucket.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket.mjs","names":[],"sources":["../../../src/getIntlayerAPI/bitbucket.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"bitbucket.mjs","names":[],"sources":["../../../src/getIntlayerAPI/bitbucket.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type BitbucketRepository = {\n uuid: string;\n name: string;\n full_name: string;\n slug: string;\n mainbranch?: {\n name: string;\n type: string;\n };\n links: {\n html: {\n href: string;\n };\n };\n workspace: {\n slug: string;\n name: string;\n uuid: string;\n };\n owner: {\n display_name: string;\n username?: string;\n uuid: string;\n };\n updated_on: string;\n is_private: boolean;\n};\n\nexport type BitbucketAuthCallbackBody = {\n code: string;\n};\n\nexport type BitbucketAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type BitbucketListReposResult = {\n data: BitbucketRepository[];\n};\n\nexport type BitbucketCheckConfigBody = {\n token?: string;\n workspace: string;\n repoSlug: string;\n branch?: string;\n};\n\nexport type BitbucketCheckConfigResult = {\n data: {\n hasConfig: boolean;\n configPaths: string[];\n };\n};\n\nexport type BitbucketGetConfigFileBody = {\n token?: string;\n workspace: string;\n repoSlug: string;\n branch?: string;\n path?: string;\n};\n\nexport type BitbucketGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type BitbucketGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport const getBitbucketAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const BITBUCKET_API_ROUTE = `${backendURL}/api/bitbucket`;\n\n /**\n * Get Bitbucket 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<BitbucketGetAuthUrlResult>(\n `${BITBUCKET_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri },\n }\n );\n\n /**\n * Exchange Bitbucket authorization code for access token\n * @param code - Bitbucket authorization code\n */\n const authenticate = async (\n code: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<BitbucketAuthCallbackResult>(\n `${BITBUCKET_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code },\n }\n );\n\n /**\n * Get user's Bitbucket repositories\n * @param token - Optional Bitbucket 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<BitbucketListReposResult>(\n `${BITBUCKET_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 Bitbucket repository\n * @param token - Optional Bitbucket access token. If not provided, backend will use session.\n * @param workspace - Bitbucket workspace slug\n * @param repoSlug - Repository slug\n * @param branch - Branch name (default: 'main')\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n workspace: string,\n repoSlug: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<BitbucketCheckConfigResult>(\n `${BITBUCKET_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, workspace, repoSlug, branch },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a Bitbucket repository\n * @param token - Optional Bitbucket access token. If not provided, backend will use session.\n * @param workspace - Bitbucket workspace slug\n * @param repoSlug - Repository slug\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 workspace: string,\n repoSlug: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<BitbucketGetConfigFileResult>(\n `${BITBUCKET_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n workspace,\n repoSlug,\n branch,\n path,\n },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n"],"mappings":"yCA+EA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAsB,GAFT,EAAe,OAAO,WAEC,gBA8G1C,MAAO,CACL,WAzGiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAoB,WACvB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,CACxB,CACF,CA+FD,aAzFmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAoB,OACvB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,CACf,CACF,CA8ED,gBAxEsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAoB,QACvB,EACA,EACA,CACE,OAAQ,EAAQ,CAAE,QAAO,CAAG,IAAA,GAC7B,CACF,CA8DD,oBArD0B,MAC1B,EACA,EACA,EACA,EAAiB,OACjB,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAoB,eACvB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,MAAO,GAAS,IAAA,GAAW,YAAW,WAAU,SAAQ,CACjE,CACF,CAuCD,cA7BoB,MACpB,EACA,EACA,EACA,EAAiB,OACjB,EAAe,qBACf,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAoB,kBACvB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CACJ,MAAO,GAAS,IAAA,GAChB,YACA,WACA,SACA,OACD,CACF,CACF,CAQF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/dictionary`;return{getDictionaries:async(n,i={})=>await e(r,t,i,{cache:`no-store`,params:n}),getDictionariesKeys:async(n={})=>await e(`${r}/keys`,t,n,{cache:`no-store`}),getDictionariesUpdateTimestamp:async(n={})=>await e(`${r}/update`,t,n,{cache:`no-store`}),getDictionary:async(n,i,a={})=>await e(`${r}/${n}`,t,a,{params:i?{version:i.toString()}:void 0}),pushDictionaries:async(n,i={})=>await e(`${r}`,t,i,{method:`PATCH`,body:{dictionaries:n}}),addDictionary:async(n,i={})=>await e(`${r}`,t,i,{method:`POST`,body:n}),updateDictionary:async(n,i={})=>await e(`${r}/${n.id}`,t,i,{method:`PUT`,body:n}),deleteDictionary:async(n,i={})=>await e(`${r}/${n}`,t,i,{method:`DELETE`})}};export{t as getDictionaryAPI};
|
|
2
2
|
//# sourceMappingURL=dictionary.mjs.map
|
|
@@ -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
|
|
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 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;\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":"yCAoBA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAoB,GAFP,EAAe,OAAO,WAED,iBAuIxC,MAAO,CACL,gBAlIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CAsHD,oBAjH0B,MAAO,EAA+B,EAAE,GAClE,MAAM,EACJ,GAAG,EAAkB,OACrB,EACA,EACA,CACE,MAAO,WACR,CACF,CA0GD,+BArGqC,MACrC,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAkB,SACrB,EACA,EACA,CACE,MAAO,WACR,CACF,CA4FD,cArFoB,MACpB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAkB,GAAG,IACxB,EACA,EACA,CACE,OAAQ,EAAU,CAAE,QAAS,EAAQ,UAAU,CAAE,CAAG,IAAA,GACrD,CACF,CA0ED,iBAtDuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,QACR,KAAM,CAAE,eAAc,CACvB,CACF,CA2CD,cArEoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CA0DD,iBAtCuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAkB,GAAG,EAAW,KACnC,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CA2BD,iBArBuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAkB,GAAG,IACxB,EACA,EACA,CACE,OAAQ,SACT,CACF,CAWF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=n.editor.editorURL;if(!r)throw Error(`Editor URL is not defined in the Intlayer configuration.`);let i=`${r}/api`;return{getDictionaries:async(n={})=>(await e(`${i}/dictionary`,t,n)).data,getConfiguration:async(n={})=>(await e(`${i}/config`,t,n)).data,writeDictionary:async(n,r={})=>await e(`${i}/dictionary`,t,r,{method:`POST`,body:n})}};export{t as getEditorAPI};
|
|
2
2
|
//# sourceMappingURL=editor.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import 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;\n\n if (!editorURL) {\n throw new Error('Editor URL is not defined in the Intlayer configuration.');\n }\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":"yCASA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EAAY,EAAe,OAAO,UAExC,GAAI,CAAC,EACH,MAAU,MAAM,2DAA2D,CAG7E,IAAM,EAAmB,GAAG,EAAU,MAkDtC,MAAO,CACL,gBA/BsB,MACtB,EAA+B,EAAE,IAEhB,MAAM,EACrB,GAAG,EAAiB,aACpB,EACA,EACD,EAEe,KAuBhB,iBA/CuB,MACvB,EAA+B,EAAE,IAEhB,MAAM,EACrB,GAAG,EAAiB,SACpB,EACA,EACD,EAEe,KAuChB,gBAjBsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,aACpB,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAMF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/github`;return{getAuthUrl:async(n,i={})=>await e(`${r}/auth-url`,t,i,{params:{redirectUri:n}}),authenticate:async(n,i={})=>await e(`${r}/auth`,t,i,{method:`POST`,body:{code:n}}),getRepositories:async(n,i={})=>await e(`${r}/repos`,t,i,{params:n?{token:n}:void 0}),checkIntlayerConfig:async(n,i,a,o=`main`,s={})=>await e(`${r}/check-config`,t,s,{method:`POST`,body:{token:n??void 0,owner:i,repository:a,branch:o}}),getConfigFile:async(n,i,a,o=`main`,s=`intlayer.config.ts`,c={})=>await e(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,owner:i,repository:a,branch:o,path:s}})}};export{t as getGithubAPI};
|
|
2
2
|
//# sourceMappingURL=github.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import 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 const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.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 return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n"],"mappings":"yCA+DA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aAwGvC,MAAO,CACL,WAnGiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,CACxB,CACF,CAyFD,aAnFmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,OACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,CACf,CACF,CAwED,gBAlEsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,QACpB,EACA,EACA,CACE,OAAQ,EAAQ,CAAE,QAAO,CAAG,IAAA,GAC7B,CACF,CAwDD,oBA/C0B,MAC1B,EACA,EACA,EACA,EAAiB,OACjB,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,eACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,MAAO,GAAS,IAAA,GAAW,QAAO,aAAY,SAAQ,CAC/D,CACF,CAiCD,cAvBoB,MACpB,EACA,EACA,EACA,EAAiB,OACjB,EAAe,qBACf,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,kBACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,MAAO,GAAS,IAAA,GAAW,QAAO,aAAY,SAAQ,OAAM,CACrE,CACF,CAQF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/gitlab`;return{getAuthUrl:async(n,i,a={})=>await e(`${r}/auth-url`,t,a,{params:{redirectUri:n,...i&&{instanceUrl:i}}}),authenticate:async(n,i,a,o={})=>await e(`${r}/auth`,t,o,{method:`POST`,body:{code:n,redirectUri:i,instanceUrl:a}}),getProjects:async(n,i,a={})=>await e(`${r}/projects`,t,a,{params:{...n&&{token:n},...i&&{instanceUrl:i}}}),checkIntlayerConfig:async(n,i,a=`main`,o,s={})=>await e(`${r}/check-config`,t,s,{method:`POST`,body:{token:n??void 0,projectId:i,branch:a,...o&&{instanceUrl:o}}}),getConfigFile:async(n,i,a=`main`,o=`intlayer.config.ts`,s,c={})=>await e(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,projectId:i,branch:a,path:o,...s&&{instanceUrl:s}}})}};export{t as getGitlabAPI};
|
|
2
2
|
//# sourceMappingURL=gitlab.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import 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;\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":"yCAoEA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aA8HvC,MAAO,CACL,WAxHiB,MACjB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,GAAI,GAAe,CAAE,cAAa,CAAG,CAC7D,CACF,CA6GD,aArGmB,MACnB,EACA,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,OACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,cAAa,cAAa,CACzC,CACF,CAwFD,YAjFkB,MAClB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CACN,GAAI,GAAS,CAAE,QAAO,CACtB,GAAI,GAAe,CAAE,cAAa,CACnC,CACF,CACF,CAmED,oBA1D0B,MAC1B,EACA,EACA,EAAiB,OACjB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,eACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CACJ,MAAO,GAAS,IAAA,GAChB,YACA,SACA,GAAI,GAAe,CAAE,cAAa,CACnC,CACF,CACF,CAuCD,cA7BoB,MACpB,EACA,EACA,EAAiB,OACjB,EAAe,qBACf,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,kBACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CACJ,MAAO,GAAS,IAAA,GAChB,YACA,SACA,OACA,GAAI,GAAe,CAAE,cAAa,CACnC,CACF,CACF,CAQF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getAiAPI as e}from"./ai.mjs";import{getAuditAPI as t}from"./audit.mjs";import{getBitbucketAPI as n}from"./bitbucket.mjs";import{getDictionaryAPI as r}from"./dictionary.mjs";import{getEditorAPI as i}from"./editor.mjs";import{getGithubAPI as a}from"./github.mjs";import{getGitlabAPI as o}from"./gitlab.mjs";import{getNewsletterAPI as s}from"./newsletter.mjs";import{getOAuthAPI as c}from"./oAuth.mjs";import{getOrganizationAPI as l}from"./organization.mjs";import{getProjectAPI as u}from"./project.mjs";import{getSearchAPI as d}from"./search.mjs";import{getShowcaseProjectAPI as f}from"./showcaseProject.mjs";import{getStripeAPI as p}from"./stripe.mjs";import{getTagAPI as m}from"./tag.mjs";import{getUserAPI as h}from"./user.mjs";const
|
|
1
|
+
import{getAiAPI as e}from"./ai.mjs";import{getAuditAPI as t}from"./audit.mjs";import{getBitbucketAPI as n}from"./bitbucket.mjs";import{getDictionaryAPI as r}from"./dictionary.mjs";import{getEditorAPI as i}from"./editor.mjs";import{getGithubAPI as a}from"./github.mjs";import{getGitlabAPI as o}from"./gitlab.mjs";import{getNewsletterAPI as s}from"./newsletter.mjs";import{getOAuthAPI as c}from"./oAuth.mjs";import{getOrganizationAPI as l}from"./organization.mjs";import{getProjectAPI as u}from"./project.mjs";import{getSearchAPI as d}from"./search.mjs";import{getShowcaseProjectAPI as f}from"./showcaseProject.mjs";import{getStripeAPI as p}from"./stripe.mjs";import{getTagAPI as m}from"./tag.mjs";import{getUserAPI as h}from"./user.mjs";import g from"@intlayer/config/built";import{defu as _}from"defu";const v=(v={},y)=>{let b=_(y??{},g);return{organization:l(v,b),project:u(v,b),user:h(v,b),oAuth:c(b),dictionary:r(v,b),stripe:p(v,b),ai:e(v,b),audit:t(v,b),tag:m(v,b),search:d(v,b),editor:i(v,b),newsletter:s(v,b),github:a(v,b),gitlab:o(v,b),bitbucket:n(v,b),showcaseProject:f(v,b)}};export{v as getIntlayerAPI};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\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 { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\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}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPIReturn => ({\n organization: getOrganizationAPI(authAPIOptions,
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import builtConfiguration 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 { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\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}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(\n intlayerConfig ?? {},\n builtConfiguration\n ) as IntlayerConfig;\n\n return {\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(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 };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":"kyBAwCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACsB,CACtB,IAAM,EAAiB,EACrB,GAAkB,EAAE,CACpB,EACD,CAED,MAAO,CACL,aAAc,EAAmB,EAAgB,EAAe,CAChE,QAAS,EAAc,EAAgB,EAAe,CACtD,KAAM,EAAW,EAAgB,EAAe,CAChD,MAAO,EAAY,EAAe,CAClC,WAAY,EAAiB,EAAgB,EAAe,CAC5D,OAAQ,EAAa,EAAgB,EAAe,CACpD,GAAI,EAAS,EAAgB,EAAe,CAC5C,MAAO,EAAY,EAAgB,EAAe,CAClD,IAAK,EAAU,EAAgB,EAAe,CAC9C,OAAQ,EAAa,EAAgB,EAAe,CACpD,OAAQ,EAAa,EAAgB,EAAe,CACpD,WAAY,EAAiB,EAAgB,EAAe,CAC5D,OAAQ,EAAa,EAAgB,EAAe,CACpD,OAAQ,EAAa,EAAgB,EAAe,CACpD,UAAW,EAAgB,EAAgB,EAAe,CAC1D,gBAAiB,EAAsB,EAAgB,EAAe,CACvE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/newsletter`;return{subscribeToNewsletter:async(n,i={})=>await e(`${r}/subscribe`,t,i,{method:`POST`,body:n}),unsubscribeFromNewsletter:async(n,i={})=>await e(`${r}/unsubscribe`,t,i,{method:`POST`,body:n}),getNewsletterStatus:async(n={})=>await e(`${r}/status`,t,n,{method:`GET`})}};export{t as getNewsletterAPI};
|
|
2
2
|
//# sourceMappingURL=newsletter.mjs.map
|
|
@@ -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
|
|
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 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;\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":"yCAQA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAuB,GAFV,EAAe,OAAO,WAEE,iBAsD3C,MAAO,CACL,sBAhD4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAqB,YACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAqCD,0BA9BgC,MAChC,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAqB,cACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAmBD,oBAb0B,MAAO,EAA+B,EAAE,GAClE,MAAM,EACJ,GAAG,EAAqB,SACxB,EACA,EACA,CACE,OAAQ,MACT,CACF,CAMF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=t=>{let n=t.editor.backendURL,{clientId:r,clientSecret:i}=t.editor;return{getOAuth2AccessToken:async(t={})=>await e(`${n}/oauth2/token`,{},t,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:{grant_type:`client_credentials`,client_id:r,client_secret:i}})}};export{t as getOAuthAPI};
|
|
2
2
|
//# sourceMappingURL=oAuth.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport
|
|
1
|
+
{"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (intlayerConfig: IntlayerConfig) => {\n const backendURL = intlayerConfig.editor.backendURL;\n const { clientId, clientSecret } = intlayerConfig.editor;\n\n /**\n * Gets an oAuth2 accessToken\n * @return The token information\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 return {\n getOAuth2AccessToken,\n };\n};\n"],"mappings":"yCAOA,MAAa,EAAe,GAAmC,CAC7D,IAAM,EAAa,EAAe,OAAO,WACnC,CAAE,WAAU,gBAAiB,EAAe,OAwBlD,MAAO,CACL,qBAnB2B,MAAO,EAA+B,EAAE,GACnE,MAAM,EACJ,GAAG,EAAW,eACd,EAAE,CACF,EACA,CACE,OAAQ,OACR,QAAS,CACP,eAAgB,oCACjB,CACD,KAAM,CACJ,WAAY,qBACZ,UAAW,EACX,cAAe,EAChB,CACF,CACF,CAIF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{fetcher as e}from"../fetcher.mjs";
|
|
1
|
+
import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/organization`;return{getOrganizations:async(n,i={})=>await e(r,t,i,{cache:`no-store`,params:n}),getOrganization:async(n,i={})=>await e(`${r}/${String(n)}`,t,i),addOrganization:async(n,i={})=>await e(r,t,i,{method:`POST`,body:n}),addOrganizationMember:async(n,i={})=>e(`${r}/member`,t,i,{method:`POST`,body:n}),updateOrganization:async(n,i={})=>e(r,t,i,{method:`PUT`,body:n}),updateOrganizationMembers:async(n,i={})=>e(`${r}/members`,t,i,{method:`PUT`,body:n}),updateOrganizationMembersById:async(n,i,a={})=>e(`${r}/${n}/members`,t,a,{method:`PUT`,body:i}),deleteOrganization:async(n={})=>await e(r,t,n,{method:`DELETE`}),selectOrganization:async(n,i={})=>await e(`${r}/${String(n)}`,t,i,{method:`PUT`}),unselectOrganization:async(n={})=>await e(`${r}/logout`,t,n,{method:`POST`})}};export{t as getOrganizationAPI};
|
|
2
2
|
//# sourceMappingURL=organization.mjs.map
|