@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,3 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
2
|
-
`);u=n.pop()??``;for(let e of n)if(e.startsWith(`data: `))try{let t=JSON.parse(e.slice(6));t.chunk&&
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../fetcher.cjs`),t=(t={},n)=>{let r=`${n.editor.backendURL}/api/ai`;return{customQuery:async(n,i={})=>await e.fetcher(r,t,i,{method:`POST`,body:n}),translateJSON:async(n,i={})=>await e.fetcher(`${r}/translate/json`,t,i,{method:`POST`,body:n}),auditContentDeclaration:async(n,i={})=>await e.fetcher(`${r}/audit/dictionary`,t,i,{method:`POST`,body:n}),auditContentDeclarationField:async(n,i={})=>await e.fetcher(`${r}/audit/dictionary/field`,t,i,{method:`POST`,body:n}),auditContentDeclarationMetadata:async(n,i={})=>await e.fetcher(`${r}/audit/dictionary/metadata`,t,i,{method:`POST`,body:n}),auditTag:async(n,i={})=>await e.fetcher(`${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.fetcher(`${r}/autocomplete`,t,i,{method:`POST`,body:n}),getDiscussions:async(n,i={})=>await e.fetcher(`${r}/discussions`,t,i,{method:`GET`,params:n})}};exports.getAiAPI=t;
|
|
3
3
|
//# sourceMappingURL=ai.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.cjs","names":["configuration","fetcher"],"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":"2MAyCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,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,MAAMC,EAAAA,QACJ,EACA,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA8OD,cAvOoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,iBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA4ND,wBArN8B,MAC9B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,mBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA0MD,6BAnMmC,MACnC,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,yBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAwLD,gCAjLsC,MACtC,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,4BAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAsKD,SA/Je,MACf,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,GAAG,EAAa,eAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA6BD,eAxBqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,cAChB,EACA,EACA,CACE,OAAQ,MAER,SACD,CACF,CAYF"}
|
|
1
|
+
{"version":3,"file":"ai.cjs","names":["fetcher"],"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":"qGAwCa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAe,GAFF,EAAe,OAAO,WAEN,SA+PnC,MAAO,CACL,YAzPkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA8OD,cAvOoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,iBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA4ND,wBArN8B,MAC9B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,mBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA0MD,6BAnMmC,MACnC,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,yBAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAwLD,gCAjLsC,MACtC,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,4BAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAsKD,SA/Je,MACf,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,GAAG,EAAa,eAChB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CA6BD,eAxBqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,cAChB,EACA,EACA,CACE,OAAQ,MAER,SACD,CACF,CAYF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../
|
|
2
|
-
`);d=n.pop()??``;for(let e of n)if(e.startsWith(`data: `))try{let t=JSON.parse(e.slice(6));
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../fetcher.cjs`),t=(t={},n)=>{let r=`${n.editor.backendURL}/api/scan`;return{discoverUrls:async(n,i={})=>await e.fetcher(`${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.fetcher(`${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.fetcher(`${r}/recursive/${n?.jobId}`,t,i,{method:`GET`}),cancelRecursiveAudit:async(n,i={})=>await e.fetcher(`${r}/recursive/${n?.jobId}/cancel`,t,i,{method:`POST`}),pauseRecursiveAudit:async(n,i={})=>await e.fetcher(`${r}/recursive/${n?.jobId}/pause`,t,i,{method:`POST`}),resumeRecursiveAudit:async(n,i={})=>await e.fetcher(`${r}/recursive/${n?.jobId}/resume`,t,i,{method:`POST`})}};exports.getAuditAPI=t;
|
|
3
3
|
//# sourceMappingURL=audit.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.cjs","names":["
|
|
1
|
+
{"version":3,"file":"audit.cjs","names":["fetcher"],"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":"qGAyCa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAkB,GAFL,EAAe,OAAO,WAEH,WAmKtC,MAAO,CACL,aAtJmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,GAAG,EAAgB,aAAa,GAAQ,QACxC,EACA,EACA,CACE,OAAQ,MACT,CACF,CAwCD,qBAtC2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAgB,aAAa,GAAQ,MAAM,SAC9C,EACA,EACA,CAAE,OAAQ,OAAQ,CACnB,CA8BD,oBA5B0B,MAC1B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAgB,aAAa,GAAQ,MAAM,QAC9C,EACA,EACA,CAAE,OAAQ,OAAQ,CACnB,CAoBD,qBAlB2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAgB,aAAa,GAAQ,MAAM,SAC9C,EACA,EACA,CAAE,OAAQ,OAAQ,CACnB,CAUF"}
|
|
@@ -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/bitbucket`;return{getAuthUrl:async(n,i={})=>await e.fetcher(`${r}/auth-url`,t,i,{params:{redirectUri:n}}),authenticate:async(n,i={})=>await e.fetcher(`${r}/auth`,t,i,{method:`POST`,body:{code:n}}),getRepositories:async(n,i={})=>await e.fetcher(`${r}/repos`,t,i,{params:n?{token:n}:void 0}),checkIntlayerConfig:async(n,i,a,o=`main`,s={})=>await e.fetcher(`${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.fetcher(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,workspace:i,repoSlug:a,branch:o,path:s}})}};exports.getBitbucketAPI=t;
|
|
2
2
|
//# sourceMappingURL=bitbucket.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket.cjs","names":["
|
|
1
|
+
{"version":3,"file":"bitbucket.cjs","names":["fetcher"],"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":"qGA+Ea,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAsB,GAFT,EAAe,OAAO,WAEC,gBA8G1C,MAAO,CACL,WAzGiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAoB,WACvB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,CACxB,CACF,CA+FD,aAzFmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAoB,OACvB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,CACf,CACF,CA8ED,gBAxEsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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
|
-
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/dictionary`;return{getDictionaries:async(n,i={})=>await e.fetcher(r,t,i,{cache:`no-store`,params:n}),getDictionariesKeys:async(n={})=>await e.fetcher(`${r}/keys`,t,n,{cache:`no-store`}),getDictionariesUpdateTimestamp:async(n={})=>await e.fetcher(`${r}/update`,t,n,{cache:`no-store`}),getDictionary:async(n,i,a={})=>await e.fetcher(`${r}/${n}`,t,a,{params:i?{version:i.toString()}:void 0}),pushDictionaries:async(n,i={})=>await e.fetcher(`${r}`,t,i,{method:`PATCH`,body:{dictionaries:n}}),addDictionary:async(n,i={})=>await e.fetcher(`${r}`,t,i,{method:`POST`,body:n}),updateDictionary:async(n,i={})=>await e.fetcher(`${r}/${n.id}`,t,i,{method:`PUT`,body:n}),deleteDictionary:async(n,i={})=>await e.fetcher(`${r}/${n}`,t,i,{method:`DELETE`})}};exports.getDictionaryAPI=t;
|
|
2
2
|
//# sourceMappingURL=dictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.cjs","names":["
|
|
1
|
+
{"version":3,"file":"dictionary.cjs","names":["fetcher"],"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":"qGAoBa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAoB,GAFP,EAAe,OAAO,WAED,iBAuIxC,MAAO,CACL,gBAlIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CAsHD,oBAjH0B,MAAO,EAA+B,EAAE,GAClE,MAAMA,EAAAA,QACJ,GAAG,EAAkB,OACrB,EACA,EACA,CACE,MAAO,WACR,CACF,CA0GD,+BArGqC,MACrC,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,SACrB,EACA,EACA,CACE,MAAO,WACR,CACF,CA4FD,cArFoB,MACpB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,QACR,KAAM,CAAE,eAAc,CACvB,CACF,CA2CD,cArEoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CA0DD,iBAtCuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,EAAW,KACnC,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CA2BD,iBArBuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,IACxB,EACA,EACA,CACE,OAAQ,SACT,CACF,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.editorURL;if(!r)throw Error(`Editor URL is not defined in the Intlayer configuration.`);let i=`${r}/api`;return{getDictionaries:async(n={})=>(await e.fetcher(`${i}/dictionary`,t,n)).data,getConfiguration:async(n={})=>(await e.fetcher(`${i}/config`,t,n)).data,writeDictionary:async(n,r={})=>await e.fetcher(`${i}/dictionary`,t,r,{method:`POST`,body:n})}};exports.getEditorAPI=t;
|
|
2
2
|
//# sourceMappingURL=editor.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.cjs","names":["
|
|
1
|
+
{"version":3,"file":"editor.cjs","names":["fetcher"],"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":"qGASa,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,MAAMA,EAAAA,QACrB,GAAG,EAAiB,aACpB,EACA,EACD,EAEe,KAuBhB,iBA/CuB,MACvB,EAA+B,EAAE,IAEhB,MAAMA,EAAAA,QACrB,GAAG,EAAiB,SACpB,EACA,EACD,EAEe,KAuChB,gBAjBsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAiB,aACpB,EACA,EACA,CACE,OAAQ,OACR,OACD,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/github`;return{getAuthUrl:async(n,i={})=>await e.fetcher(`${r}/auth-url`,t,i,{params:{redirectUri:n}}),authenticate:async(n,i={})=>await e.fetcher(`${r}/auth`,t,i,{method:`POST`,body:{code:n}}),getRepositories:async(n,i={})=>await e.fetcher(`${r}/repos`,t,i,{params:n?{token:n}:void 0}),checkIntlayerConfig:async(n,i,a,o=`main`,s={})=>await e.fetcher(`${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.fetcher(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,owner:i,repository:a,branch:o,path:s}})}};exports.getGithubAPI=t;
|
|
2
2
|
//# sourceMappingURL=github.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.cjs","names":["
|
|
1
|
+
{"version":3,"file":"github.cjs","names":["fetcher"],"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":"qGA+Da,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aAwGvC,MAAO,CACL,WAnGiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,CACxB,CACF,CAyFD,aAnFmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAiB,OACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,CACf,CACF,CAwED,gBAlEsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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
|
-
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/gitlab`;return{getAuthUrl:async(n,i,a={})=>await e.fetcher(`${r}/auth-url`,t,a,{params:{redirectUri:n,...i&&{instanceUrl:i}}}),authenticate:async(n,i,a,o={})=>await e.fetcher(`${r}/auth`,t,o,{method:`POST`,body:{code:n,redirectUri:i,instanceUrl:a}}),getProjects:async(n,i,a={})=>await e.fetcher(`${r}/projects`,t,a,{params:{...n&&{token:n},...i&&{instanceUrl:i}}}),checkIntlayerConfig:async(n,i,a=`main`,o,s={})=>await e.fetcher(`${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.fetcher(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,projectId:i,branch:a,path:o,...s&&{instanceUrl:s}}})}};exports.getGitlabAPI=t;
|
|
2
2
|
//# sourceMappingURL=gitlab.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.cjs","names":["
|
|
1
|
+
{"version":3,"file":"gitlab.cjs","names":["fetcher"],"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":"qGAoEa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aA8HvC,MAAO,CACL,WAxHiB,MACjB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,GAAG,EAAiB,OACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,cAAa,cAAa,CACzC,CACF,CAwFD,YAjFkB,MAClB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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,MAAMA,EAAAA,QACJ,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
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./ai.cjs`),n=require(`./audit.cjs`),r=require(`./bitbucket.cjs`),i=require(`./dictionary.cjs`),a=require(`./editor.cjs`),o=require(`./github.cjs`),s=require(`./gitlab.cjs`),c=require(`./newsletter.cjs`),l=require(`./oAuth.cjs`),u=require(`./organization.cjs`),d=require(`./project.cjs`),f=require(`./search.cjs`),p=require(`./showcaseProject.cjs`),m=require(`./stripe.cjs`),h=require(`./tag.cjs`),g=require(`./user.cjs`);let _=require(`@intlayer/config/built`);_=e.__toESM(_);let v=require(`defu`);const y=(e={},y)=>{let b=(0,v.defu)(y??{},_.default);return{organization:u.getOrganizationAPI(e,b),project:d.getProjectAPI(e,b),user:g.getUserAPI(e,b),oAuth:l.getOAuthAPI(b),dictionary:i.getDictionaryAPI(e,b),stripe:m.getStripeAPI(e,b),ai:t.getAiAPI(e,b),audit:n.getAuditAPI(e,b),tag:h.getTagAPI(e,b),search:f.getSearchAPI(e,b),editor:a.getEditorAPI(e,b),newsletter:c.getNewsletterAPI(e,b),github:o.getGithubAPI(e,b),gitlab:s.getGitlabAPI(e,b),bitbucket:r.getBitbucketAPI(e,b),showcaseProject:p.getShowcaseProjectAPI(e,b)}};exports.getIntlayerAPI=y;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getOrganizationAPI","getProjectAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getAuditAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI","getGithubAPI","getGitlabAPI","getBitbucketAPI","getShowcaseProjectAPI"],"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.cjs","names":["builtConfiguration","getOrganizationAPI","getProjectAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getAuditAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI","getGithubAPI","getGitlabAPI","getBitbucketAPI","getShowcaseProjectAPI"],"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":"qnBAwCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACsB,CACtB,IAAM,GAAA,EAAA,EAAA,MACJ,GAAkB,EAAE,CACpBA,EAAAA,QACD,CAED,MAAO,CACL,aAAcC,EAAAA,mBAAmB,EAAgB,EAAe,CAChE,QAASC,EAAAA,cAAc,EAAgB,EAAe,CACtD,KAAMC,EAAAA,WAAW,EAAgB,EAAe,CAChD,MAAOC,EAAAA,YAAY,EAAe,CAClC,WAAYC,EAAAA,iBAAiB,EAAgB,EAAe,CAC5D,OAAQC,EAAAA,aAAa,EAAgB,EAAe,CACpD,GAAIC,EAAAA,SAAS,EAAgB,EAAe,CAC5C,MAAOC,EAAAA,YAAY,EAAgB,EAAe,CAClD,IAAKC,EAAAA,UAAU,EAAgB,EAAe,CAC9C,OAAQC,EAAAA,aAAa,EAAgB,EAAe,CACpD,OAAQC,EAAAA,aAAa,EAAgB,EAAe,CACpD,WAAYC,EAAAA,iBAAiB,EAAgB,EAAe,CAC5D,OAAQC,EAAAA,aAAa,EAAgB,EAAe,CACpD,OAAQC,EAAAA,aAAa,EAAgB,EAAe,CACpD,UAAWC,EAAAA,gBAAgB,EAAgB,EAAe,CAC1D,gBAAiBC,EAAAA,sBAAsB,EAAgB,EAAe,CACvE"}
|
|
@@ -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/newsletter`;return{subscribeToNewsletter:async(n,i={})=>await e.fetcher(`${r}/subscribe`,t,i,{method:`POST`,body:n}),unsubscribeFromNewsletter:async(n,i={})=>await e.fetcher(`${r}/unsubscribe`,t,i,{method:`POST`,body:n}),getNewsletterStatus:async(n={})=>await e.fetcher(`${r}/status`,t,n,{method:`GET`})}};exports.getNewsletterAPI=t;
|
|
2
2
|
//# sourceMappingURL=newsletter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newsletter.cjs","names":["
|
|
1
|
+
{"version":3,"file":"newsletter.cjs","names":["fetcher"],"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":"qGAQa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAuB,GAFV,EAAe,OAAO,WAEE,iBAsD3C,MAAO,CACL,sBAhD4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAqB,YACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAqCD,0BA9BgC,MAChC,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAqB,cACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAmBD,oBAb0B,MAAO,EAA+B,EAAE,GAClE,MAAMA,EAAAA,QACJ,GAAG,EAAqB,SACxB,EACA,EACA,CACE,OAAQ,MACT,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=>{let n=t.editor.backendURL,{clientId:r,clientSecret:i}=t.editor;return{getOAuth2AccessToken:async(t={})=>await e.fetcher(`${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}})}};exports.getOAuthAPI=t;
|
|
2
2
|
//# sourceMappingURL=oAuth.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oAuth.cjs","names":["
|
|
1
|
+
{"version":3,"file":"oAuth.cjs","names":["fetcher"],"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":"qGAOa,EAAe,GAAmC,CAC7D,IAAM,EAAa,EAAe,OAAO,WACnC,CAAE,WAAU,gBAAiB,EAAe,OAwBlD,MAAO,CACL,qBAnB2B,MAAO,EAA+B,EAAE,GACnE,MAAMA,EAAAA,QACJ,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
|
-
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/organization`;return{getOrganizations:async(n,i={})=>await e.fetcher(r,t,i,{cache:`no-store`,params:n}),getOrganization:async(n,i={})=>await e.fetcher(`${r}/${String(n)}`,t,i),addOrganization:async(n,i={})=>await e.fetcher(r,t,i,{method:`POST`,body:n}),addOrganizationMember:async(n,i={})=>e.fetcher(`${r}/member`,t,i,{method:`POST`,body:n}),updateOrganization:async(n,i={})=>e.fetcher(r,t,i,{method:`PUT`,body:n}),updateOrganizationMembers:async(n,i={})=>e.fetcher(`${r}/members`,t,i,{method:`PUT`,body:n}),updateOrganizationMembersById:async(n,i,a={})=>e.fetcher(`${r}/${n}/members`,t,a,{method:`PUT`,body:i}),deleteOrganization:async(n={})=>await e.fetcher(r,t,n,{method:`DELETE`}),selectOrganization:async(n,i={})=>await e.fetcher(`${r}/${String(n)}`,t,i,{method:`PUT`}),unselectOrganization:async(n={})=>await e.fetcher(`${r}/logout`,t,n,{method:`POST`})}};exports.getOrganizationAPI=t;
|
|
2
2
|
//# sourceMappingURL=organization.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.cjs","names":["
|
|
1
|
+
{"version":3,"file":"organization.cjs","names":["fetcher"],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":"qGAqBa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAyB,GAFZ,EAAe,OAAO,WAEI,mBA4K7C,MAAO,CACL,iBAvKuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CA2JD,gBArJsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAuB,GAAG,OAAO,EAAe,GACnD,EACA,EACD,CA8ID,gBAxIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CA6HD,sBA/D4B,MAC5B,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,GAAG,EAAuB,SAC1B,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAoDD,mBAxHyB,MACzB,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,EACA,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CA6GD,0BAvGgC,MAChC,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,GAAG,EAAuB,UAC1B,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CA4FD,8BArFoC,MACpC,EACA,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,GAAG,EAAuB,GAAG,EAAe,UAC5C,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CAyED,mBAjDyB,MAAO,EAA+B,EAAE,GACjE,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,OAAQ,SACT,CACF,CA0CD,mBApCyB,MACzB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAuB,GAAG,OAAO,EAAe,GACnD,EACA,EACA,CACE,OAAQ,MACT,CACF,CA0BD,qBApB2B,MAAO,EAA+B,EAAE,GACnE,MAAMA,EAAAA,QACJ,GAAG,EAAuB,SAC1B,EACA,EACA,CACE,OAAQ,OACT,CACF,CAaF"}
|
|
@@ -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/project`;return{getProjects:async(n,i={})=>await e.fetcher(r,t,i,{cache:`no-store`,params:n}),addProject:async(n,i={})=>await e.fetcher(`${r}`,t,i,{method:`POST`,body:n}),updateProject:async(n,i={})=>await e.fetcher(`${r}`,t,i,{method:`PUT`,body:n}),updateProjectMembers:async(n,i={})=>await e.fetcher(`${r}/members`,t,i,{method:`PUT`,body:n}),pushProjectConfiguration:async(n,i={})=>await e.fetcher(`${r}/configuration`,t,i,{method:`PUT`,body:n}),deleteProject:async(n={})=>await e.fetcher(`${r}`,t,n,{method:`DELETE`}),selectProject:async(n,i={})=>await e.fetcher(`${r}/${String(n)}`,t,i,{method:`PUT`}),unselectProject:async(n={})=>await e.fetcher(`${r}/logout`,t,n,{method:`POST`}),addNewAccessKey:async(n,i={})=>await e.fetcher(`${r}/access_key`,t,i,{method:`POST`,body:n}),deleteAccessKey:async(n,i={})=>await e.fetcher(`${r}/access_key`,t,i,{method:`DELETE`,body:{clientId:n}}),refreshAccessKey:async(n,i={})=>await e.fetcher(`${r}/access_key`,t,i,{method:`PATCH`,body:{clientId:n}}),triggerBuild:async(n={})=>await e.fetcher(`${r}/build`,t,n,{method:`POST`}),triggerWebhook:async(n,i={})=>await e.fetcher(`${r}/webhook`,t,i,{method:`POST`,body:{webhookIndex:n}}),getCIConfig:async(n={})=>await e.fetcher(`${r}/ci`,t,n,{method:`GET`}),pushCIConfig:async(n={})=>await e.fetcher(`${r}/ci`,t,n,{method:`POST`})}};exports.getProjectAPI=t;
|
|
2
2
|
//# sourceMappingURL=project.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n ResponseData,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\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 const getProjectAPI = (\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 PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n /**\n * Triggers CI builds for a project (Git provider pipelines and webhooks).\n * @param otherOptions - Fetcher options.\n * @returns The trigger results.\n */\n const triggerBuild = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<TriggerBuildResult>(\n `${PROJECT_API_ROUTE}/build`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Triggers a single webhook by index.\n * @param webhookIndex - The index of the webhook to trigger.\n * @param otherOptions - Fetcher options.\n * @returns The trigger result.\n */\n const triggerWebhook = async (\n webhookIndex: TriggerWebhookBody['webhookIndex'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TriggerWebhookResult>(\n `${PROJECT_API_ROUTE}/webhook`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { webhookIndex },\n }\n );\n\n /**\n * Get CI configuration status for the current project.\n * @param otherOptions - Fetcher options.\n * @returns The CI configuration status.\n */\n const getCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Push CI configuration file to the repository.\n * @param otherOptions - Fetcher options.\n * @returns Success status.\n */\n const pushCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n };\n};\n"],"mappings":"2MA8BA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAGH,IAAM,EAAoB,GAAG,EAAW,cAsQxC,MAAO,CACL,YAjQkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAMC,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CAqPD,WA/OiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAoOD,cA9NoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAmND,qBA7M2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,UACrB,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CAkMD,yBA7L+B,MAC/B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,gBACrB,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAkLD,cA5KoB,MAAO,EAA+B,EAAE,GAC5D,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,SACT,CACF,CAqKD,cA/JoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,OAAO,EAAU,GACzC,EACA,EACA,CACE,OAAQ,MACT,CACF,CAqJD,gBA/IsB,MAAO,EAA+B,EAAE,GAC9D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,SACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAwID,gBAhIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAqHD,gBA7GsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,SACR,KAAM,CAAE,WAAU,CACnB,CACF,CAkGD,iBA1FuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,QACR,KAAM,CAAE,WAAU,CACnB,CACF,CA+ED,aAxEmB,MAAO,EAA+B,EAAE,GAC3D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,QACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAiED,eAzDqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,UACrB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,eAAc,CACvB,CACF,CA8CD,YAvCkB,MAAO,EAA+B,EAAE,GAC1D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,KACrB,EACA,EACA,CACE,OAAQ,MACT,CACF,CAgCD,aAzBmB,MAAO,EAA+B,EAAE,GAC3D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,KACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAkBF"}
|
|
1
|
+
{"version":3,"file":"project.cjs","names":["fetcher"],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n ResponseData,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n /**\n * Triggers CI builds for a project (Git provider pipelines and webhooks).\n * @param otherOptions - Fetcher options.\n * @returns The trigger results.\n */\n const triggerBuild = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<TriggerBuildResult>(\n `${PROJECT_API_ROUTE}/build`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Triggers a single webhook by index.\n * @param webhookIndex - The index of the webhook to trigger.\n * @param otherOptions - Fetcher options.\n * @returns The trigger result.\n */\n const triggerWebhook = async (\n webhookIndex: TriggerWebhookBody['webhookIndex'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TriggerWebhookResult>(\n `${PROJECT_API_ROUTE}/webhook`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { webhookIndex },\n }\n );\n\n /**\n * Get CI configuration status for the current project.\n * @param otherOptions - Fetcher options.\n * @returns The CI configuration status.\n */\n const getCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Push CI configuration file to the repository.\n * @param otherOptions - Fetcher options.\n * @returns Success status.\n */\n const pushCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n };\n};\n"],"mappings":"qGA6Ba,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAoB,GAFP,EAAe,OAAO,WAED,cAsQxC,MAAO,CACL,YAjQkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CAqPD,WA/OiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAoOD,cA9NoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAmND,qBA7M2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,UACrB,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CAkMD,yBA7L+B,MAC/B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,gBACrB,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAkLD,cA5KoB,MAAO,EAA+B,EAAE,GAC5D,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,SACT,CACF,CAqKD,cA/JoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,OAAO,EAAU,GACzC,EACA,EACA,CACE,OAAQ,MACT,CACF,CAqJD,gBA/IsB,MAAO,EAA+B,EAAE,GAC9D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,SACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAwID,gBAhIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAqHD,gBA7GsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,SACR,KAAM,CAAE,WAAU,CACnB,CACF,CAkGD,iBA1FuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,QACR,KAAM,CAAE,WAAU,CACnB,CACF,CA+ED,aAxEmB,MAAO,EAA+B,EAAE,GAC3D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,QACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAiED,eAzDqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,UACrB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,eAAc,CACvB,CACF,CA8CD,YAvCkB,MAAO,EAA+B,EAAE,GAC1D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,KACrB,EACA,EACA,CACE,OAAQ,MACT,CACF,CAgCD,aAzBmB,MAAO,EAA+B,EAAE,GAC3D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,KACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAkBF"}
|
|
@@ -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/search`;return{searchDoc:async(n,i={})=>await e.fetcher(`${r}/doc`,t,i,{method:`GET`,params:n})}};exports.getSearchAPI=t;
|
|
2
2
|
//# sourceMappingURL=search.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.cjs","names":["
|
|
1
|
+
{"version":3,"file":"search.cjs","names":["fetcher"],"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import type {\n SearchDocUtilParams,\n SearchDocUtilResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":"qGAOa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAe,GAFF,EAAe,OAAO,WAEN,aAqBnC,MAAO,CACL,UAfgB,MAChB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAa,MAChB,EACA,EACA,CACE,OAAQ,MACA,SACT,CACF,CAIF"}
|