@intlayer/design-system 3.2.0 → 3.2.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/.vite/manifest.json +13 -78
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +1 -6
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +1 -6
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +1 -6
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.mjs +1 -6
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -6
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -6
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs +1 -6
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.mjs +1 -6
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +1 -6
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.mjs +1 -6
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +1 -6
- package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.mjs +1 -6
- package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
- package/dist/libs/intlayer-api/auth.cjs +3 -3
- package/dist/libs/intlayer-api/auth.cjs.map +1 -1
- package/dist/libs/intlayer-api/auth.d.ts +2 -1
- package/dist/libs/intlayer-api/auth.d.ts.map +1 -1
- package/dist/libs/intlayer-api/auth.mjs +3 -3
- package/dist/libs/intlayer-api/auth.mjs.map +1 -1
- package/dist/libs/intlayer-api/dictionary.cjs +3 -3
- package/dist/libs/intlayer-api/dictionary.cjs.map +1 -1
- package/dist/libs/intlayer-api/dictionary.d.ts +2 -1
- package/dist/libs/intlayer-api/dictionary.d.ts.map +1 -1
- package/dist/libs/intlayer-api/dictionary.mjs +3 -3
- package/dist/libs/intlayer-api/dictionary.mjs.map +1 -1
- package/dist/libs/intlayer-api/index.cjs +6 -6
- package/dist/libs/intlayer-api/index.cjs.map +1 -1
- package/dist/libs/intlayer-api/index.d.ts +2 -1
- package/dist/libs/intlayer-api/index.d.ts.map +1 -1
- package/dist/libs/intlayer-api/index.mjs +6 -6
- package/dist/libs/intlayer-api/index.mjs.map +1 -1
- package/dist/libs/intlayer-api/organization.cjs +3 -2
- package/dist/libs/intlayer-api/organization.cjs.map +1 -1
- package/dist/libs/intlayer-api/organization.d.ts +2 -1
- package/dist/libs/intlayer-api/organization.d.ts.map +1 -1
- package/dist/libs/intlayer-api/organization.mjs +3 -2
- package/dist/libs/intlayer-api/organization.mjs.map +1 -1
- package/dist/libs/intlayer-api/project.cjs +3 -3
- package/dist/libs/intlayer-api/project.cjs.map +1 -1
- package/dist/libs/intlayer-api/project.d.ts +2 -1
- package/dist/libs/intlayer-api/project.d.ts.map +1 -1
- package/dist/libs/intlayer-api/project.mjs +3 -3
- package/dist/libs/intlayer-api/project.mjs.map +1 -1
- package/dist/libs/intlayer-api/stripe.cjs +1 -1
- package/dist/libs/intlayer-api/stripe.cjs.map +1 -1
- package/dist/libs/intlayer-api/stripe.d.ts +2 -1
- package/dist/libs/intlayer-api/stripe.d.ts.map +1 -1
- package/dist/libs/intlayer-api/stripe.mjs +1 -1
- package/dist/libs/intlayer-api/stripe.mjs.map +1 -1
- package/dist/libs/intlayer-api/user.cjs +3 -3
- package/dist/libs/intlayer-api/user.cjs.map +1 -1
- package/dist/libs/intlayer-api/user.d.ts +2 -1
- package/dist/libs/intlayer-api/user.d.ts.map +1 -1
- package/dist/libs/intlayer-api/user.mjs +3 -3
- package/dist/libs/intlayer-api/user.mjs.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.mjs","sources":["../../../src/libs/intlayer-api/auth.ts"],"sourcesContent":["import type {\n AskResetPasswordBody,\n AskResetPasswordResult,\n CreateSessionBody,\n CreateSessionResult,\n GetSessionInformationQuery,\n GithubLoginQueryParams,\n GoogleLoginQueryParams,\n GetSessionInformationResult,\n LoginBody,\n LoginResult,\n RegisterBody,\n RegisterQuery,\n RegisterResult,\n ResetPasswordParams,\n ResetPasswordResult,\n UpdatePasswordBody,\n UpdatePasswordResult,\n ValidEmailParams,\n ValidEmailResult,\n SetCSRFTokenResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n UserAPI,\n CheckIfUserHasPasswordResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nconst { backendURL, clientId, clientSecret } = getConfiguration().editor;\nconst AUTH_API_ROUTE = `${backendURL}/api/auth`;\n\nexport const getAuthAPI = (authAPIOptions: FetcherOptions = {}) => {\n /**\n * Logs in a user with the provided credentials.\n * @param user - User credentials.\n */\n const login = async (user: LoginBody, otherOptions: FetcherOptions = {}) =>\n await fetcher<LoginResult>(\n `${AUTH_API_ROUTE}/login`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n }\n );\n\n /**\n * Gets the login with GitHub URL.\n * @param params - The parameters for the login with GitHub URL.\n * @returns The login with GitHub URL.\n */\n const getLoginWithGitHubURL = (params: GithubLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;\n };\n\n /**\n * Gets the login with Google URL.\n * @param params - The parameters for the login with Google URL.\n * @returns The login with Google URL.\n */\n const getLoginWithGoogleURL = (params: GoogleLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;\n };\n\n /**\n * Registers a new user with the provided credentials.\n * @param user - User credentials.\n * @returns User object.\n */\n const register = async (\n user: RegisterBody,\n query: RegisterQuery = {},\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RegisterResult>(\n `${AUTH_API_ROUTE}/register`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n params: query,\n }\n );\n\n /**\n * Signs out the user.\n * @returns User object.\n */\n const logout = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<void>(\n `${AUTH_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Ask to resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const askResetPassword = async (\n email: AskResetPasswordBody['email'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AskResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { email },\n }\n );\n\n /**\n * Resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const resetPassword = async (\n params: ResetPasswordParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n { params, method: 'POST' }\n );\n\n /**\n * Changes the password of a user with the provided data.\n * @param data - New password and confirmation.\n * @returns User object.\n */\n const changePassword = async (\n data: UpdatePasswordBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdatePasswordResult>(\n `${AUTH_API_ROUTE}/password`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: data,\n }\n );\n\n /**\n * Checks if a user has a password.\n * @param params - User ID.\n * @returns User object.\n */\n const checkIfUserHasPassword = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CheckIfUserHasPasswordResult>(\n `${AUTH_API_ROUTE}/password/has`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Verifies the email address of a user with the provided token.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const verifyEmail = async (\n { userId, secret }: ValidEmailParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ValidEmailResult>(\n `${AUTH_API_ROUTE}/active/${userId}/${secret}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Gets the verify email status URL to use in the SSE.\n * @param userId - User ID.\n * @returns The verify email status URL.\n */\n const getVerifyEmailStatusURL = (userId: string | UserAPI['_id']) =>\n `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;\n\n /**\n * Creates a session for a user.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const createSession = async (\n data: CreateSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateSessionResult>(\n `${AUTH_API_ROUTE}/session`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: data,\n }\n );\n\n /**\n * Gets a session and user.\n * @param sessionToken - Session token.\n * @param otherOptions - Fetcher options.\n * @returns Session and user information.\n */\n const getSession = async (\n sessionToken?: GetSessionInformationQuery['session_token'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetSessionInformationResult>(\n `${backendURL}/session`,\n authAPIOptions,\n otherOptions,\n { params: { session_token: sessionToken } }\n );\n\n /**\n * Gets the CSRF token.\n * @param otherOptions - Fetcher options.\n * @returns The CSRF token.\n */\n const getCSRFToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<SetCSRFTokenResult>(\n `${backendURL}/csrf-token`,\n authAPIOptions,\n otherOptions\n );\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 authAPIOptions,\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 login,\n getLoginWithGitHubURL,\n getLoginWithGoogleURL,\n register,\n logout,\n resetPassword,\n askResetPassword,\n checkIfUserHasPassword,\n verifyEmail,\n getVerifyEmailStatusURL,\n changePassword,\n createSession,\n getSession,\n getCSRFToken,\n getOAuth2AccessToken,\n };\n};\n\nexport const authAPI = getAuthAPI();\n"],"names":[],"mappings":";;AA6BA,MAAM,EAAE,YAAY,UAAU,aAAa,IAAI,mBAAmB;AAClE,MAAM,iBAAiB,GAAG,UAAU;AAE7B,MAAM,aAAa,CAAC,iBAAiC,OAAO;AAKjE,QAAM,QAAQ,OAAO,MAAiB,eAA+B,CAAA,MACnE,MAAM;AAAA,IACJ,GAAG,cAAc;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAQE,QAAA,wBAAwB,CAAC,WAA2C;AAClE,UAAA,eAAe,IAAI,gBAAgB,MAAM;AAE/C,WAAO,GAAG,cAAc,iBAAiB,aAAa,SAAU,CAAA;AAAA,EAAA;AAQ5D,QAAA,wBAAwB,CAAC,WAA2C;AAClE,UAAA,eAAe,IAAI,gBAAgB,MAAM;AAE/C,WAAO,GAAG,cAAc,iBAAiB,aAAa,SAAU,CAAA;AAAA,EAAA;AAQ5D,QAAA,WAAW,OACf,MACA,QAAuB,CAAA,GACvB,eAA+B,CAAC,MAEh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,QAAM,gBAAgB,OACpB,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,cAAc;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AASJ,QAAM,aAAa,OACjB,cACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,UAAU;AAAA,IACb;AAAA,IACA;AAAA,IACA,EAAE,QAAQ,EAAE,eAAe,eAAe;AAAA,EAAA;AAQ9C,QAAM,eAAe,OAAO,eAA+B,CAAA,MACzD,MAAM;AAAA,IACJ,GAAG,UAAU;AAAA,IACb;AAAA,IACA;AAAA,EAAA;AAOJ,QAAM,uBAAuB,OAAO,eAA+B,CAAA,MACjE,MAAM;AAAA,IACJ,GAAG,UAAU;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,UAAU,WAAW;"}
|
|
1
|
+
{"version":3,"file":"auth.mjs","sources":["../../../src/libs/intlayer-api/auth.ts"],"sourcesContent":["import type {\n AskResetPasswordBody,\n AskResetPasswordResult,\n CreateSessionBody,\n CreateSessionResult,\n GetSessionInformationQuery,\n GithubLoginQueryParams,\n GoogleLoginQueryParams,\n GetSessionInformationResult,\n LoginBody,\n LoginResult,\n RegisterBody,\n RegisterQuery,\n RegisterResult,\n ResetPasswordParams,\n ResetPasswordResult,\n UpdatePasswordBody,\n UpdatePasswordResult,\n ValidEmailParams,\n ValidEmailResult,\n SetCSRFTokenResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n UserAPI,\n CheckIfUserHasPasswordResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL, clientId, clientSecret } = (\n intlayerConfig ?? getConfiguration()\n ).editor;\n const AUTH_API_ROUTE = `${backendURL}/api/auth`;\n\n /**\n * Logs in a user with the provided credentials.\n * @param user - User credentials.\n */\n const login = async (user: LoginBody, otherOptions: FetcherOptions = {}) =>\n await fetcher<LoginResult>(\n `${AUTH_API_ROUTE}/login`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n }\n );\n\n /**\n * Gets the login with GitHub URL.\n * @param params - The parameters for the login with GitHub URL.\n * @returns The login with GitHub URL.\n */\n const getLoginWithGitHubURL = (params: GithubLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;\n };\n\n /**\n * Gets the login with Google URL.\n * @param params - The parameters for the login with Google URL.\n * @returns The login with Google URL.\n */\n const getLoginWithGoogleURL = (params: GoogleLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;\n };\n\n /**\n * Registers a new user with the provided credentials.\n * @param user - User credentials.\n * @returns User object.\n */\n const register = async (\n user: RegisterBody,\n query: RegisterQuery = {},\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RegisterResult>(\n `${AUTH_API_ROUTE}/register`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n params: query,\n }\n );\n\n /**\n * Signs out the user.\n * @returns User object.\n */\n const logout = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<void>(\n `${AUTH_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Ask to resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const askResetPassword = async (\n email: AskResetPasswordBody['email'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AskResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { email },\n }\n );\n\n /**\n * Resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const resetPassword = async (\n params: ResetPasswordParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n { params, method: 'POST' }\n );\n\n /**\n * Changes the password of a user with the provided data.\n * @param data - New password and confirmation.\n * @returns User object.\n */\n const changePassword = async (\n data: UpdatePasswordBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdatePasswordResult>(\n `${AUTH_API_ROUTE}/password`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: data,\n }\n );\n\n /**\n * Checks if a user has a password.\n * @param params - User ID.\n * @returns User object.\n */\n const checkIfUserHasPassword = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CheckIfUserHasPasswordResult>(\n `${AUTH_API_ROUTE}/password/has`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Verifies the email address of a user with the provided token.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const verifyEmail = async (\n { userId, secret }: ValidEmailParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ValidEmailResult>(\n `${AUTH_API_ROUTE}/active/${userId}/${secret}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Gets the verify email status URL to use in the SSE.\n * @param userId - User ID.\n * @returns The verify email status URL.\n */\n const getVerifyEmailStatusURL = (userId: string | UserAPI['_id']) =>\n `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;\n\n /**\n * Creates a session for a user.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const createSession = async (\n data: CreateSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateSessionResult>(\n `${AUTH_API_ROUTE}/session`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: data,\n }\n );\n\n /**\n * Gets a session and user.\n * @param sessionToken - Session token.\n * @param otherOptions - Fetcher options.\n * @returns Session and user information.\n */\n const getSession = async (\n sessionToken?: GetSessionInformationQuery['session_token'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetSessionInformationResult>(\n `${backendURL}/session`,\n authAPIOptions,\n otherOptions,\n { params: { session_token: sessionToken } }\n );\n\n /**\n * Gets the CSRF token.\n * @param otherOptions - Fetcher options.\n * @returns The CSRF token.\n */\n const getCSRFToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<SetCSRFTokenResult>(\n `${backendURL}/csrf-token`,\n authAPIOptions,\n otherOptions\n );\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 authAPIOptions,\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 login,\n getLoginWithGitHubURL,\n getLoginWithGoogleURL,\n register,\n logout,\n resetPassword,\n askResetPassword,\n checkIfUserHasPassword,\n verifyEmail,\n getVerifyEmailStatusURL,\n changePassword,\n createSession,\n getSession,\n getCSRFToken,\n getOAuth2AccessToken,\n };\n};\n\nexport const authAPI = getAuthAPI();\n"],"names":[],"mappings":";;AA6BO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P,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,UAAU,WAAW;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("@intlayer/config/client");
|
|
4
4
|
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
+
const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
+
const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;
|
|
8
8
|
const getDictionaries = async (filters, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
9
|
PROJECT_API_ROUTE,
|
|
10
10
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.cjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\
|
|
1
|
+
{"version":3,"file":"dictionary.cjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\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 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\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 dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\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}`,\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}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAmBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAA,KAAgB,kBAAkBA,2BAAoB;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;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AA;AAEJ;AAEO,MAAM,gBAAgB,iBAAiB;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesParams, GetDictionariesResult, UpdateDictionaryBody, UpdateDictionaryResult, PushDictionariesBody, PushDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetDictionariesKeysResult } from '@intlayer/backend';
|
|
2
|
+
import { IntlayerConfig } from '@intlayer/config/client';
|
|
2
3
|
import { FetcherOptions } from './fetcher';
|
|
3
|
-
export declare const getDictionaryAPI: (authAPIOptions?: FetcherOptions) => {
|
|
4
|
+
export declare const getDictionaryAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
4
5
|
getDictionaries: (filters?: GetDictionariesParams, otherOptions?: FetcherOptions) => Promise<GetDictionariesResult>;
|
|
5
6
|
getDictionariesKeys: (otherOptions?: FetcherOptions) => Promise<GetDictionariesKeysResult>;
|
|
6
7
|
getDictionary: (dictionaryKey: GetDictionaryParams["dictionaryKey"], version?: GetDictionaryQuery["version"], otherOptions?: FetcherOptions) => Promise<GetDictionaryResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,gBAAgB,oBACX,cAAc,mBACb,cAAc;gCAUnB,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;gCAfhB,iBAAiB,iBACf,cAAc;mCA+BhB,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAqB/B,CAAC;AAEF,eAAO,MAAM,aAAa;gCAxHZ,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;gCAfhB,iBAAiB,iBACf,cAAc;mCA+BhB,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAuBe,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
2
|
import { fetcher } from "./fetcher.mjs";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
+
const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;
|
|
5
|
+
const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;
|
|
6
6
|
const getDictionaries = async (filters, otherOptions = {}) => await fetcher(
|
|
7
7
|
PROJECT_API_ROUTE,
|
|
8
8
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.mjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\
|
|
1
|
+
{"version":3,"file":"dictionary.mjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\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 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\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 dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\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}`,\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}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":[],"mappings":";;AAmBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAA,KAAgB,kBAAkB,oBAAoB;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAMJ,QAAM,sBAAsB,OAAO,eAA+B,CAAA,MAChE,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,EAAA;AAQJ,QAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,OAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB,IAAI,aAAa;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,SAAA,EAAe,IAAA;AAAA,IACtD;AAAA,EAAA;AAOJ,QAAM,gBAAgB,OACpB,YACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAGJ,QAAM,mBAAmB,OACvB,cACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,aAAa;AAAA,IACvB;AAAA,EAAA;AAOJ,QAAM,mBAAmB,OACvB,YACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAOJ,QAAM,mBAAmB,OACvB,IACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,GAAG;AAAA,IACb;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,gBAAgB,iBAAiB;"}
|
|
@@ -6,12 +6,12 @@ const libs_intlayerApi_organization = require("./organization.cjs");
|
|
|
6
6
|
const libs_intlayerApi_project = require("./project.cjs");
|
|
7
7
|
const libs_intlayerApi_stripe = require("./stripe.cjs");
|
|
8
8
|
const libs_intlayerApi_user = require("./user.cjs");
|
|
9
|
-
const getIntlayerAPI = (authAPIOptions = {}) => ({
|
|
10
|
-
organization: libs_intlayerApi_organization.getOrganizationAPI(authAPIOptions),
|
|
11
|
-
project: libs_intlayerApi_project.getProjectAPI(authAPIOptions),
|
|
12
|
-
user: libs_intlayerApi_user.getUserAPI(authAPIOptions),
|
|
13
|
-
auth: libs_intlayerApi_auth.getAuthAPI(authAPIOptions),
|
|
14
|
-
dictionary: libs_intlayerApi_dictionary.getDictionaryAPI(authAPIOptions),
|
|
9
|
+
const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => ({
|
|
10
|
+
organization: libs_intlayerApi_organization.getOrganizationAPI(authAPIOptions, intlayerConfig),
|
|
11
|
+
project: libs_intlayerApi_project.getProjectAPI(authAPIOptions, intlayerConfig),
|
|
12
|
+
user: libs_intlayerApi_user.getUserAPI(authAPIOptions, intlayerConfig),
|
|
13
|
+
auth: libs_intlayerApi_auth.getAuthAPI(authAPIOptions, intlayerConfig),
|
|
14
|
+
dictionary: libs_intlayerApi_dictionary.getDictionaryAPI(authAPIOptions, intlayerConfig),
|
|
15
15
|
stripe: libs_intlayerApi_stripe.getStripeAPI(authAPIOptions)
|
|
16
16
|
});
|
|
17
17
|
const intlayerAPI = getIntlayerAPI();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/libs/intlayer-api/index.ts"],"sourcesContent":["import { getAuthAPI } from './auth';\nimport { getDictionaryAPI } from './dictionary';\nimport type { FetcherOptions } from './fetcher';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getStripeAPI } from './stripe';\nimport { getUserAPI } from './user';\n\nexport const getIntlayerAPI = (authAPIOptions: FetcherOptions = {}) => ({\n organization: getOrganizationAPI(authAPIOptions),\n project: getProjectAPI(authAPIOptions),\n user: getUserAPI(authAPIOptions),\n auth: getAuthAPI(authAPIOptions),\n dictionary: getDictionaryAPI(authAPIOptions),\n stripe: getStripeAPI(authAPIOptions),\n});\n\nexport const intlayerAPI = getIntlayerAPI();\n"],"names":["getOrganizationAPI","getProjectAPI","getUserAPI","getAuthAPI","getDictionaryAPI","getStripeAPI"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/libs/intlayer-api/index.ts"],"sourcesContent":["import { type IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from './auth';\nimport { getDictionaryAPI } from './dictionary';\nimport type { FetcherOptions } from './fetcher';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getStripeAPI } from './stripe';\nimport { getUserAPI } from './user';\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => ({\n organization: getOrganizationAPI(authAPIOptions, intlayerConfig),\n project: getProjectAPI(authAPIOptions, intlayerConfig),\n user: getUserAPI(authAPIOptions, intlayerConfig),\n auth: getAuthAPI(authAPIOptions, intlayerConfig),\n dictionary: getDictionaryAPI(authAPIOptions, intlayerConfig),\n stripe: getStripeAPI(authAPIOptions, intlayerConfig),\n});\n\nexport const intlayerAPI = getIntlayerAPI();\n"],"names":["getOrganizationAPI","getProjectAPI","getUserAPI","getAuthAPI","getDictionaryAPI","getStripeAPI"],"mappings":";;;;;;;;AASO,MAAM,iBAAiB,CAC5B,iBAAiC,IACjC,oBACI;AAAA,EACJ,cAAcA,8BAAAA,mBAAmB,gBAAgB,cAAc;AAAA,EAC/D,SAASC,yBAAAA,cAAc,gBAAgB,cAAc;AAAA,EACrD,MAAMC,sBAAAA,WAAW,gBAAgB,cAAc;AAAA,EAC/C,MAAMC,sBAAAA,WAAW,gBAAgB,cAAc;AAAA,EAC/C,YAAYC,4BAAAA,iBAAiB,gBAAgB,cAAc;AAAA,EAC3D,QAAQC,wBAAa,aAAA,cAA8B;AACrD;AAEO,MAAM,cAAc,eAAe;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { IntlayerConfig } from '@intlayer/config/client';
|
|
1
2
|
import { FetcherOptions } from './fetcher';
|
|
2
|
-
export declare const getIntlayerAPI: (authAPIOptions?: FetcherOptions) => {
|
|
3
|
+
export declare const getIntlayerAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
3
4
|
organization: {
|
|
4
5
|
getOrganizations: (filters?: import('@intlayer/backend').GetOrganizationsParams, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetOrganizationsResult>;
|
|
5
6
|
getOrganization: (organizationId: import('@intlayer/backend').GetOrganizationParam["organizationId"], otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetOrganizationResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAMhD,eAAO,MAAM,cAAc,oBACT,cAAc,mBACb,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ/B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAmB,CAAC"}
|
|
@@ -4,12 +4,12 @@ import { getOrganizationAPI } from "./organization.mjs";
|
|
|
4
4
|
import { getProjectAPI } from "./project.mjs";
|
|
5
5
|
import { getStripeAPI } from "./stripe.mjs";
|
|
6
6
|
import { getUserAPI } from "./user.mjs";
|
|
7
|
-
const getIntlayerAPI = (authAPIOptions = {}) => ({
|
|
8
|
-
organization: getOrganizationAPI(authAPIOptions),
|
|
9
|
-
project: getProjectAPI(authAPIOptions),
|
|
10
|
-
user: getUserAPI(authAPIOptions),
|
|
11
|
-
auth: getAuthAPI(authAPIOptions),
|
|
12
|
-
dictionary: getDictionaryAPI(authAPIOptions),
|
|
7
|
+
const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => ({
|
|
8
|
+
organization: getOrganizationAPI(authAPIOptions, intlayerConfig),
|
|
9
|
+
project: getProjectAPI(authAPIOptions, intlayerConfig),
|
|
10
|
+
user: getUserAPI(authAPIOptions, intlayerConfig),
|
|
11
|
+
auth: getAuthAPI(authAPIOptions, intlayerConfig),
|
|
12
|
+
dictionary: getDictionaryAPI(authAPIOptions, intlayerConfig),
|
|
13
13
|
stripe: getStripeAPI(authAPIOptions)
|
|
14
14
|
});
|
|
15
15
|
const intlayerAPI = getIntlayerAPI();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/libs/intlayer-api/index.ts"],"sourcesContent":["import { getAuthAPI } from './auth';\nimport { getDictionaryAPI } from './dictionary';\nimport type { FetcherOptions } from './fetcher';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getStripeAPI } from './stripe';\nimport { getUserAPI } from './user';\n\nexport const getIntlayerAPI = (authAPIOptions: FetcherOptions = {}) => ({\n organization: getOrganizationAPI(authAPIOptions),\n project: getProjectAPI(authAPIOptions),\n user: getUserAPI(authAPIOptions),\n auth: getAuthAPI(authAPIOptions),\n dictionary: getDictionaryAPI(authAPIOptions),\n stripe: getStripeAPI(authAPIOptions),\n});\n\nexport const intlayerAPI = getIntlayerAPI();\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/libs/intlayer-api/index.ts"],"sourcesContent":["import { type IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from './auth';\nimport { getDictionaryAPI } from './dictionary';\nimport type { FetcherOptions } from './fetcher';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getStripeAPI } from './stripe';\nimport { getUserAPI } from './user';\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => ({\n organization: getOrganizationAPI(authAPIOptions, intlayerConfig),\n project: getProjectAPI(authAPIOptions, intlayerConfig),\n user: getUserAPI(authAPIOptions, intlayerConfig),\n auth: getAuthAPI(authAPIOptions, intlayerConfig),\n dictionary: getDictionaryAPI(authAPIOptions, intlayerConfig),\n stripe: getStripeAPI(authAPIOptions, intlayerConfig),\n});\n\nexport const intlayerAPI = getIntlayerAPI();\n"],"names":[],"mappings":";;;;;;AASO,MAAM,iBAAiB,CAC5B,iBAAiC,IACjC,oBACI;AAAA,EACJ,cAAc,mBAAmB,gBAAgB,cAAc;AAAA,EAC/D,SAAS,cAAc,gBAAgB,cAAc;AAAA,EACrD,MAAM,WAAW,gBAAgB,cAAc;AAAA,EAC/C,MAAM,WAAW,gBAAgB,cAAc;AAAA,EAC/C,YAAY,iBAAiB,gBAAgB,cAAc;AAAA,EAC3D,QAAQ,aAAa,cAA8B;AACrD;AAEO,MAAM,cAAc,eAAe;"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("@intlayer/config/client");
|
|
4
4
|
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
+
const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
+
const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
|
|
7
8
|
const getOrganizations = async (filters, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
8
9
|
ORGANIZATION_API_ROUTE,
|
|
9
10
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.cjs","sources":["../../../src/libs/intlayer-api/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n UpdateOrganizationBody,\n UpdateOrganizationResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\
|
|
1
|
+
{"version":3,"file":"organization.cjs","sources":["../../../src/libs/intlayer-api/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n UpdateOrganizationBody,\n UpdateOrganizationResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\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 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 * 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 deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n\nexport const organizationAP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IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,qBAAqB,OACzB,gBACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,sBAAsB,IAAI,OAAO,cAAc,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,uBAAuB,OAAO,eAA+B,CAAA,MACjE,MAAMA,yBAAA;AAAA,IACJ,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,kBAAkB,mBAAmB;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AddOrganizationBody, AddOrganizationResult, DeleteOrganizationResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, UpdateOrganizationBody, UpdateOrganizationResult, SelectOrganizationParam, SelectOrganizationResult, UnselectOrganizationResult, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, AddOrganizationMemberBody, AddOrganizationMemberResult } from '@intlayer/backend';
|
|
2
|
+
import { IntlayerConfig } from '@intlayer/config/client';
|
|
2
3
|
import { FetcherOptions } from './fetcher';
|
|
3
|
-
export declare const getOrganizationAPI: (authAPIOptions?: FetcherOptions) => {
|
|
4
|
+
export declare const getOrganizationAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
4
5
|
getOrganizations: (filters?: GetOrganizationsParams, otherOptions?: FetcherOptions) => Promise<GetOrganizationsResult>;
|
|
5
6
|
getOrganization: (organizationId: GetOrganizationParam["organizationId"], otherOptions?: FetcherOptions) => Promise<GetOrganizationResult>;
|
|
6
7
|
addOrganization: (organization: AddOrganizationBody, otherOptions?: FetcherOptions) => Promise<AddOrganizationResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,kBAAkB,oBACb,cAAc,mBACb,cAAc;iCAUnB,sBAAsB,iBAClB,cAAc;sCAgBZ,oBAAoB,CAAC,gBAAgB,CAAC,iBACxC,cAAc;oCAad,mBAAmB,iBACnB,cAAc;kCAqDtB,yBAAyB,iBACjB,cAAc;uCArCd,sBAAsB,iBACtB,cAAc;sCAiBtB,6BAA6B,iBACrB,cAAc;wCAkCkB,cAAc;yCAe5C,uBAAuB,CAAC,gBAAgB,CAAC,iBAC3C,cAAc;0CAeoB,cAAc;CAqBjE,CAAC;AAEF,eAAO,MAAM,eAAe;iCA5Jd,sBAAsB,iBAClB,cAAc;sCAgBZ,oBAAoB,CAAC,gBAAgB,CAAC,iBACxC,cAAc;oCAad,mBAAmB,iBACnB,cAAc;kCAqDtB,yBAAyB,iBACjB,cAAc;uCArCd,sBAAsB,iBACtB,cAAc;sCAiBtB,6BAA6B,iBACrB,cAAc;wCAkCkB,cAAc;yCAe5C,uBAAuB,CAAC,gBAAgB,CAAC,iBAC3C,cAAc;0CAeoB,cAAc;CAuBf,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
2
|
import { fetcher } from "./fetcher.mjs";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
+
const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;
|
|
5
|
+
const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
|
|
5
6
|
const getOrganizations = async (filters, otherOptions = {}) => await fetcher(
|
|
6
7
|
ORGANIZATION_API_ROUTE,
|
|
7
8
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.mjs","sources":["../../../src/libs/intlayer-api/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n UpdateOrganizationBody,\n UpdateOrganizationResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\
|
|
1
|
+
{"version":3,"file":"organization.mjs","sources":["../../../src/libs/intlayer-api/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n UpdateOrganizationBody,\n UpdateOrganizationResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\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 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 * 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 deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n\nexport const organizationAPI = getOrganizationAPI();\n"],"names":[],"mappings":";;AAqBO,MAAM,qBAAqB,CAChC,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAA,KAAgB,kBAAkB,oBAAoB;AACxD,QAAA,yBAAyB,GAAG,UAAU;AAM5C,QAAM,mBAAmB,OACvB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,kBAAkB,OACtB,gBACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,sBAAsB,IAAI,OAAO,cAAc,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,EAAA;AAOJ,QAAM,kBAAkB,OACtB,cACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAOJ,QAAM,qBAAqB,OACzB,cACA,eAA+B,CAE/B,MAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAOJ,QAAM,4BAA4B,OAChC,MACA,eAA+B,CAE/B,MAAA;AAAA,IACE,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAOJ,QAAM,wBAAwB,OAC5B,MACA,eAA+B,CAE/B,MAAA;AAAA,IACE,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAOJ,QAAM,qBAAqB,OAAO,eAA+B,CAAA,MAC/D,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,qBAAqB,OACzB,gBACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,sBAAsB,IAAI,OAAO,cAAc,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,uBAAuB,OAAO,eAA+B,CAAA,MACjE,MAAM;AAAA,IACJ,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,kBAAkB,mBAAmB;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("@intlayer/config/client");
|
|
4
4
|
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
+
const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
+
const PROJECT_API_ROUTE = `${backendURL}/api/project`;
|
|
8
8
|
const getProjects = async (filters, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
9
|
PROJECT_API_ROUTE,
|
|
10
10
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.cjs","sources":["../../../src/libs/intlayer-api/project.ts"],"sourcesContent":["import type {\n AddProjectBody,\n AddProjectResult,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n UpdateProjectBody,\n UpdateProjectResult,\n SelectProjectParam,\n SelectProjectResult,\n UnselectProjectResult,\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\
|
|
1
|
+
{"version":3,"file":"project.cjs","sources":["../../../src/libs/intlayer-api/project.ts"],"sourcesContent":["import type {\n AddProjectBody,\n AddProjectResult,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n UpdateProjectBody,\n UpdateProjectResult,\n SelectProjectParam,\n SelectProjectResult,\n UnselectProjectResult,\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\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 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 /**\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 return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n };\n};\n\nexport const projectAPI = getProjectAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAuBO,MAAM,gBAAgB,CAC3B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAA,KAAgB,kBAAkBA,2BAAoB;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,cAAc,OAClB,SACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,aAAa,OACjB,SACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QA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AA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,SAAS;AAAA,IACnB;AAAA,EAAA;AASJ,QAAM,mBAAmB,OACvB,UACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,SAAS;AAAA,IACnB;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,aAAa,cAAc;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AddProjectBody, AddProjectResult, DeleteProjectResult, GetProjectsParams, GetProjectsResult, UpdateProjectBody, UpdateProjectResult, SelectProjectParam, SelectProjectResult, UnselectProjectResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, DeleteAccessKeyBody, DeleteAccessKeyResponse, RefreshAccessKeyBody, RefreshAccessKeyResponse, UpdateProjectMembersBody, UpdateProjectMembersResult } from '@intlayer/backend';
|
|
2
|
+
import { IntlayerConfig } from '@intlayer/config/client';
|
|
2
3
|
import { FetcherOptions } from './fetcher';
|
|
3
|
-
export declare const getProjectAPI: (authAPIOptions?: FetcherOptions) => {
|
|
4
|
+
export declare const getProjectAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
4
5
|
getProjects: (filters?: GetProjectsParams, otherOptions?: FetcherOptions) => Promise<GetProjectsResult>;
|
|
5
6
|
addProject: (project: AddProjectBody, otherOptions?: FetcherOptions) => Promise<AddProjectResult>;
|
|
6
7
|
updateProject: (project: UpdateProjectBody, otherOptions?: FetcherOptions) => Promise<UpdateProjectResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,aAAa,oBACR,cAAc,mBACb,cAAc;4BAUnB,iBAAiB,iBACb,cAAc;0BAgBnB,cAAc,iBACT,cAAc;6BAiBnB,iBAAiB,iBACZ,cAAc;iCAiBtB,wBAAwB,iBAChB,cAAc;mCAgBa,cAAc;+BAe5C,kBAAkB,CAAC,WAAW,CAAC,iBAC5B,cAAc;qCAee,cAAc;iCAiB9C,mBAAmB,iBAChB,cAAc;gCAmBlB,mBAAmB,CAAC,UAAU,CAAC,iBAC3B,cAAc;iCAmBlB,oBAAoB,CAAC,UAAU,CAAC,iBAC5B,cAAc;CAwB/B,CAAC;AAEF,eAAO,MAAM,UAAU;4BAzLT,iBAAiB,iBACb,cAAc;0BAgBnB,cAAc,iBACT,cAAc;6BAiBnB,iBAAiB,iBACZ,cAAc;iCAiBtB,wBAAwB,iBAChB,cAAc;mCAgBa,cAAc;+BAe5C,kBAAkB,CAAC,WAAW,CAAC,iBAC5B,cAAc;qCAee,cAAc;iCAiB9C,mBAAmB,iBAChB,cAAc;gCAmBlB,mBAAmB,CAAC,UAAU,CAAC,iBAC3B,cAAc;iCAmBlB,oBAAoB,CAAC,UAAU,CAAC,iBAC5B,cAAc;CA0BS,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
2
|
import { fetcher } from "./fetcher.mjs";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
+
const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;
|
|
5
|
+
const PROJECT_API_ROUTE = `${backendURL}/api/project`;
|
|
6
6
|
const getProjects = async (filters, otherOptions = {}) => await fetcher(
|
|
7
7
|
PROJECT_API_ROUTE,
|
|
8
8
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.mjs","sources":["../../../src/libs/intlayer-api/project.ts"],"sourcesContent":["import type {\n AddProjectBody,\n AddProjectResult,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n UpdateProjectBody,\n UpdateProjectResult,\n SelectProjectParam,\n SelectProjectResult,\n UnselectProjectResult,\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\
|
|
1
|
+
{"version":3,"file":"project.mjs","sources":["../../../src/libs/intlayer-api/project.ts"],"sourcesContent":["import type {\n AddProjectBody,\n AddProjectResult,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n UpdateProjectBody,\n UpdateProjectResult,\n SelectProjectParam,\n SelectProjectResult,\n UnselectProjectResult,\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\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 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 /**\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 return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n };\n};\n\nexport const projectAPI = getProjectAPI();\n"],"names":[],"mappings":";;AAuBO,MAAM,gBAAgB,CAC3B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAA,KAAgB,kBAAkB,oBAAoB;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,cAAc,OAClB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EAAA;AAOJ,QAAM,aAAa,OACjB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAOJ,QAAM,gBAAgB,OACpB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EAAA;AAOJ,QAAM,uBAAuB,OAC3B,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EA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 +4,7 @@ const client = require("@intlayer/config/client");
|
|
|
4
4
|
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
5
|
const backendURL = client.getConfiguration().editor.backendURL;
|
|
6
6
|
const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;
|
|
7
|
-
const getStripeAPI = (authAPIOptions = {}) => {
|
|
7
|
+
const getStripeAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
8
8
|
const getSubscription = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
9
|
`${STRIPE_API_ROUTE}/create-subscription`,
|
|
10
10
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.cjs","sources":["../../../src/libs/intlayer-api/stripe.ts"],"sourcesContent":["import type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nconst backendURL = getConfiguration().editor.backendURL;\nconst STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\nexport const getStripeAPI = (authAPIOptions: FetcherOptions = {}) => {\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getSubscription,\n };\n};\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAOA,MAAM,aAAaA,OAAiB,iBAAA,EAAE,OAAO;AAC7C,MAAM,mBAAmB,GAAG,UAAU;AAE/B,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"stripe.cjs","sources":["../../../src/libs/intlayer-api/stripe.ts"],"sourcesContent":["import type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nconst backendURL = getConfiguration().editor.backendURL;\nconst STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\nexport const getStripeAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getSubscription,\n };\n};\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAOA,MAAM,aAAaA,OAAiB,iBAAA,EAAE,OAAO;AAC7C,MAAM,mBAAmB,GAAG,UAAU;AAE/B,MAAM,eAAe,CAC1B,iBAAiC,IACjC,mBACG;AAKH,QAAM,kBAAkB,OACtB,MACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ,GAAG,gBAAgB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GetCheckoutSessionBody, GetCheckoutSessionResult } from '@intlayer/backend';
|
|
2
|
+
import { IntlayerConfig } from '@intlayer/config/client';
|
|
2
3
|
import { FetcherOptions } from './fetcher';
|
|
3
|
-
export declare const getStripeAPI: (authAPIOptions?: FetcherOptions) => {
|
|
4
|
+
export declare const getStripeAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
4
5
|
getSubscription: (body?: GetCheckoutSessionBody, otherOptions?: FetcherOptions) => Promise<GetCheckoutSessionResult>;
|
|
5
6
|
};
|
|
6
7
|
//# sourceMappingURL=stripe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/stripe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/stripe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAKzD,eAAO,MAAM,YAAY,oBACP,cAAc,mBACb,cAAc;6BAOtB,sBAAsB,iBACf,cAAc;CAe/B,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { getConfiguration } from "@intlayer/config/client";
|
|
|
2
2
|
import { fetcher } from "./fetcher.mjs";
|
|
3
3
|
const backendURL = getConfiguration().editor.backendURL;
|
|
4
4
|
const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;
|
|
5
|
-
const getStripeAPI = (authAPIOptions = {}) => {
|
|
5
|
+
const getStripeAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
6
|
const getSubscription = async (body, otherOptions = {}) => await fetcher(
|
|
7
7
|
`${STRIPE_API_ROUTE}/create-subscription`,
|
|
8
8
|
authAPIOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.mjs","sources":["../../../src/libs/intlayer-api/stripe.ts"],"sourcesContent":["import type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n} from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nconst backendURL = getConfiguration().editor.backendURL;\nconst STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\nexport const getStripeAPI = (authAPIOptions: FetcherOptions = {}) => {\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getSubscription,\n };\n};\n"],"names":[],"mappings":";;AAOA,MAAM,aAAa,iBAAiB,EAAE,OAAO;AAC7C,MAAM,mBAAmB,GAAG,UAAU;AAE/B,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"stripe.mjs","sources":["../../../src/libs/intlayer-api/stripe.ts"],"sourcesContent":["import type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nconst backendURL = getConfiguration().editor.backendURL;\nconst STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\nexport const getStripeAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getSubscription,\n };\n};\n"],"names":[],"mappings":";;AAOA,MAAM,aAAa,iBAAiB,EAAE,OAAO;AAC7C,MAAM,mBAAmB,GAAG,UAAU;AAE/B,MAAM,eAAe,CAC1B,iBAAiC,IACjC,mBACG;AAKH,QAAM,kBAAkB,OACtB,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,gBAAgB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EAAA;AAGG,SAAA;AAAA,IACL;AAAA,EAAA;AAEJ;"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("@intlayer/config/client");
|
|
4
4
|
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const getUserAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
+
const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
+
const USER_API_ROUTE = `${backendURL}/api/user`;
|
|
8
8
|
const getUsers = async (filters, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
9
|
USER_API_ROUTE,
|
|
10
10
|
authAPIOptions,
|