@intlayer/api 9.0.0-canary.14 → 9.0.0-canary.16
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/analytics.cjs +64 -0
- package/dist/cjs/getIntlayerAPI/analytics.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/index.cjs +2 -0
- package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/proxy.cjs +2 -0
- package/dist/cjs/proxy.cjs.map +1 -1
- package/dist/esm/getIntlayerAPI/analytics.mjs +62 -0
- package/dist/esm/getIntlayerAPI/analytics.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/index.mjs +2 -0
- package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/proxy.mjs +2 -0
- package/dist/esm/proxy.mjs.map +1 -1
- package/dist/types/getIntlayerAPI/analytics.d.ts +29 -0
- package/dist/types/getIntlayerAPI/analytics.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/index.d.ts +2 -0
- package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/proxy.d.ts.map +1 -1
- package/package.json +12 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_fetcher = require('../fetcher.cjs');
|
|
3
|
+
const require_cms_createIntlayerCMS = require('../cms/createIntlayerCMS.cjs');
|
|
4
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
+
|
|
6
|
+
//#region src/getIntlayerAPI/analytics.ts
|
|
7
|
+
const getAnalyticsAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
8
|
+
const ANALYTICS_API_ROUTE = `${intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.editor.backendURL}/api/analytics`;
|
|
9
|
+
/**
|
|
10
|
+
* Ingest a batch of analytics events. Public — attribution is by the
|
|
11
|
+
* project's `clientId` in the body.
|
|
12
|
+
* @param body - Session id, sdk version, and the collected events.
|
|
13
|
+
* @returns The number of accepted events.
|
|
14
|
+
*/
|
|
15
|
+
const sendEvents = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${ANALYTICS_API_ROUTE}/events`, authAPIOptions, otherOptions, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Page/locale totals for the authenticated project.
|
|
21
|
+
* @returns Views grouped by url and locale.
|
|
22
|
+
*/
|
|
23
|
+
const getOverview = async (otherOptions = {}) => await require_fetcher.fetcher(`${ANALYTICS_API_ROUTE}/overview`, authAPIOptions, otherOptions, { method: "GET" });
|
|
24
|
+
/**
|
|
25
|
+
* Audience report: distinct visitors (today / 7d / window), page views, the
|
|
26
|
+
* daily evolution series, and locale + country breakdowns.
|
|
27
|
+
* @param days - Rolling window size in days (default 30).
|
|
28
|
+
* @returns The audience statistics.
|
|
29
|
+
*/
|
|
30
|
+
const getAudience = async (days = 30, otherOptions = {}) => await require_fetcher.fetcher(`${ANALYTICS_API_ROUTE}/audience`, authAPIOptions, otherOptions, {
|
|
31
|
+
method: "GET",
|
|
32
|
+
params: { days: String(days) }
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Per-content exposure totals — "which content is actually shown".
|
|
36
|
+
* @returns Exposures grouped by dictionary key, key path, and locale.
|
|
37
|
+
*/
|
|
38
|
+
const getContentStats = async (otherOptions = {}) => await require_fetcher.fetcher(`${ANALYTICS_API_ROUTE}/content-stats`, authAPIOptions, otherOptions, { method: "GET" });
|
|
39
|
+
/**
|
|
40
|
+
* A/B experiment results with per-variant conversion rates and significance.
|
|
41
|
+
* @param experimentKey - The experiment to evaluate.
|
|
42
|
+
* @returns The experiment result set.
|
|
43
|
+
*/
|
|
44
|
+
const getExperimentResults = async (experimentKey, otherOptions = {}) => await require_fetcher.fetcher(`${ANALYTICS_API_ROUTE}/experiments/${experimentKey}`, authAPIOptions, otherOptions, { method: "GET" });
|
|
45
|
+
return {
|
|
46
|
+
sendEvents,
|
|
47
|
+
getOverview,
|
|
48
|
+
getAudience,
|
|
49
|
+
getContentStats,
|
|
50
|
+
getExperimentResults
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Authenticated `analytics` endpoint bound to an Intlayer CMS authenticator.
|
|
55
|
+
*
|
|
56
|
+
* Pass an authenticator created with `createIntlayerCMS`, or omit it to use
|
|
57
|
+
* the build-time configuration (`@intlayer/config/built`).
|
|
58
|
+
*/
|
|
59
|
+
const analyticsEndpoint = require_cms_createIntlayerCMS.createEndpoint(getAnalyticsAPI);
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.analyticsEndpoint = analyticsEndpoint;
|
|
63
|
+
exports.getAnalyticsAPI = getAnalyticsAPI;
|
|
64
|
+
//# sourceMappingURL=analytics.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.cjs","names":["editor","fetcher","createEndpoint"],"sources":["../../../src/getIntlayerAPI/analytics.ts"],"sourcesContent":["import type {\n GetAnalyticsOverviewResult,\n GetAudienceResult,\n GetContentStatsResult,\n GetExperimentResultsResult,\n IngestAnalyticsBody,\n IngestAnalyticsResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getAnalyticsAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const ANALYTICS_API_ROUTE = `${backendURL}/api/analytics`;\n\n /**\n * Ingest a batch of analytics events. Public — attribution is by the\n * project's `clientId` in the body.\n * @param body - Session id, sdk version, and the collected events.\n * @returns The number of accepted events.\n */\n const sendEvents = async (\n body: IngestAnalyticsBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<IngestAnalyticsResult>(\n `${ANALYTICS_API_ROUTE}/events`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Page/locale totals for the authenticated project.\n * @returns Views grouped by url and locale.\n */\n const getOverview = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAnalyticsOverviewResult>(\n `${ANALYTICS_API_ROUTE}/overview`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Audience report: distinct visitors (today / 7d / window), page views, the\n * daily evolution series, and locale + country breakdowns.\n * @param days - Rolling window size in days (default 30).\n * @returns The audience statistics.\n */\n const getAudience = async (days = 30, otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAudienceResult>(\n `${ANALYTICS_API_ROUTE}/audience`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: { days: String(days) },\n }\n );\n\n /**\n * Per-content exposure totals — \"which content is actually shown\".\n * @returns Exposures grouped by dictionary key, key path, and locale.\n */\n const getContentStats = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetContentStatsResult>(\n `${ANALYTICS_API_ROUTE}/content-stats`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * A/B experiment results with per-variant conversion rates and significance.\n * @param experimentKey - The experiment to evaluate.\n * @returns The experiment result set.\n */\n const getExperimentResults = async (\n experimentKey: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetExperimentResultsResult>(\n `${ANALYTICS_API_ROUTE}/experiments/${experimentKey}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n return {\n sendEvents,\n getOverview,\n getAudience,\n getContentStats,\n getExperimentResults,\n };\n};\n\n/**\n * Authenticated `analytics` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const analyticsEndpoint = createEndpoint(getAnalyticsAPI);\n"],"mappings":";;;;;;AAaA,MAAa,mBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,sBAAsB,GAFT,gBAAgB,QAAQ,cAAcA,8BAAO,WAEtB;;;;;;;CAQ1C,MAAM,aAAa,OACjB,MACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,GAAG,oBAAoB,UACvB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,cAAc,OAAO,eAA+B,EAAE,KAC1D,MAAMA,wBACJ,GAAG,oBAAoB,YACvB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;;;;;;CAQH,MAAM,cAAc,OAAO,OAAO,IAAI,eAA+B,EAAE,KACrE,MAAMA,wBACJ,GAAG,oBAAoB,YACvB,gBACA,cACA;EACE,QAAQ;EACR,QAAQ,EAAE,MAAM,OAAO,KAAK,EAAE;EAC/B,CACF;;;;;CAMH,MAAM,kBAAkB,OAAO,eAA+B,EAAE,KAC9D,MAAMA,wBACJ,GAAG,oBAAoB,iBACvB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;;;;;CAOH,MAAM,uBAAuB,OAC3B,eACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,oBAAoB,eAAe,iBACtC,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACD;;;;;;;;AASH,MAAa,oBAAoBC,6CAAe,gBAAgB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_getIntlayerAPI_oAuth = require('./oAuth.cjs');
|
|
3
3
|
const require_getIntlayerAPI_ai = require('./ai.cjs');
|
|
4
|
+
const require_getIntlayerAPI_analytics = require('./analytics.cjs');
|
|
4
5
|
const require_getIntlayerAPI_asset = require('./asset.cjs');
|
|
5
6
|
const require_getIntlayerAPI_audit = require('./audit.cjs');
|
|
6
7
|
const require_getIntlayerAPI_bitbucket = require('./bitbucket.cjs');
|
|
@@ -36,6 +37,7 @@ const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
36
37
|
dictionary: require_getIntlayerAPI_dictionary.getDictionaryAPI(authAPIOptions, resolvedConfig),
|
|
37
38
|
stripe: require_getIntlayerAPI_stripe.getStripeAPI(authAPIOptions, resolvedConfig),
|
|
38
39
|
ai: require_getIntlayerAPI_ai.getAiAPI(authAPIOptions, resolvedConfig),
|
|
40
|
+
analytics: require_getIntlayerAPI_analytics.getAnalyticsAPI(authAPIOptions, resolvedConfig),
|
|
39
41
|
audit: require_getIntlayerAPI_audit.getAuditAPI(authAPIOptions, resolvedConfig),
|
|
40
42
|
tag: require_getIntlayerAPI_tag.getTagAPI(authAPIOptions, resolvedConfig),
|
|
41
43
|
search: require_getIntlayerAPI_search.getSearchAPI(authAPIOptions, resolvedConfig),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getAssetAPI","getOrganizationAPI","getProjectAPI","getEnvironmentAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getAuditAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI","getGithubAPI","getGitlabAPI","getBitbucketAPI","getShowcaseProjectAPI","getTranslateAPI","getReviewerAPI","getStatusAPI"],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAssetAPI } from './asset';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStatusAPI } from './status';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n asset: ReturnType<typeof getAssetAPI>;\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n status: ReturnType<typeof getStatusAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n asset: getAssetAPI(authAPIOptions, resolvedConfig),\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n status: getStatusAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getAssetAPI","getOrganizationAPI","getProjectAPI","getEnvironmentAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getAnalyticsAPI","getAuditAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI","getGithubAPI","getGitlabAPI","getBitbucketAPI","getShowcaseProjectAPI","getTranslateAPI","getReviewerAPI","getStatusAPI"],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAnalyticsAPI } from './analytics';\nimport { getAssetAPI } from './asset';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStatusAPI } from './status';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n asset: ReturnType<typeof getAssetAPI>;\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n analytics: ReturnType<typeof getAnalyticsAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n status: ReturnType<typeof getStatusAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n asset: getAssetAPI(authAPIOptions, resolvedConfig),\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n analytics: getAnalyticsAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n status: getStatusAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAa,kBACX,iBAAiC,EAAE,EACnC,mBACsB;CACtB,MAAM,gCAAsB,kBAAkB,EAAE,EAAE,EAChD,uCACD,CAAC;AAEF,QAAO;EACL,OAAOA,yCAAY,gBAAgB,eAAe;EAClD,cAAcC,uDAAmB,gBAAgB,eAAe;EAChE,SAASC,6CAAc,gBAAgB,eAAe;EACtD,aAAaC,qDAAkB,gBAAgB,eAAe;EAC9D,MAAMC,uCAAW,gBAAgB,eAAe;EAChD,OAAOC,yCAAY,gBAAgB,eAAe;EAClD,YAAYC,mDAAiB,gBAAgB,eAAe;EAC5D,QAAQC,2CAAa,gBAAgB,eAAe;EACpD,IAAIC,mCAAS,gBAAgB,eAAe;EAC5C,WAAWC,iDAAgB,gBAAgB,eAAe;EAC1D,OAAOC,yCAAY,gBAAgB,eAAe;EAClD,KAAKC,qCAAU,gBAAgB,eAAe;EAC9C,QAAQC,2CAAa,gBAAgB,eAAe;EACpD,QAAQC,2CAAa,gBAAgB,eAAe;EACpD,YAAYC,mDAAiB,gBAAgB,eAAe;EAC5D,QAAQC,2CAAa,gBAAgB,eAAe;EACpD,QAAQC,2CAAa,gBAAgB,eAAe;EACpD,WAAWC,iDAAgB,gBAAgB,eAAe;EAC1D,iBAAiBC,6DAAsB,gBAAgB,eAAe;EACtE,WAAWC,iDAAgB,gBAAgB,eAAe;EAC1D,UAAUC,+CAAe,gBAAgB,eAAe;EACxD,QAAQC,2CAAa,gBAAgB,eAAe;EACrD"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ const require_getIntlayerAPI_oAuth = require('./getIntlayerAPI/oAuth.cjs');
|
|
|
4
4
|
const require_cms_createAuthManager = require('./cms/createAuthManager.cjs');
|
|
5
5
|
const require_cms_createIntlayerCMS = require('./cms/createIntlayerCMS.cjs');
|
|
6
6
|
const require_getIntlayerAPI_ai = require('./getIntlayerAPI/ai.cjs');
|
|
7
|
+
const require_getIntlayerAPI_analytics = require('./getIntlayerAPI/analytics.cjs');
|
|
7
8
|
const require_getIntlayerAPI_asset = require('./getIntlayerAPI/asset.cjs');
|
|
8
9
|
const require_getIntlayerAPI_audit = require('./getIntlayerAPI/audit.cjs');
|
|
9
10
|
const require_getIntlayerAPI_bitbucket = require('./getIntlayerAPI/bitbucket.cjs');
|
|
@@ -29,6 +30,7 @@ const require_distantDictionary_fetchDistantDictionary = require('./distantDicti
|
|
|
29
30
|
const require_getIntlayerAPI_index = require('./getIntlayerAPI/index.cjs');
|
|
30
31
|
|
|
31
32
|
exports.aiEndpoint = require_getIntlayerAPI_ai.aiEndpoint;
|
|
33
|
+
exports.analyticsEndpoint = require_getIntlayerAPI_analytics.analyticsEndpoint;
|
|
32
34
|
exports.assetEndpoint = require_getIntlayerAPI_asset.assetEndpoint;
|
|
33
35
|
exports.auditEndpoint = require_getIntlayerAPI_audit.auditEndpoint;
|
|
34
36
|
exports.bitbucketEndpoint = require_getIntlayerAPI_bitbucket.bitbucketEndpoint;
|
|
@@ -43,6 +45,7 @@ exports.fetchDistantDictionary = require_distantDictionary_fetchDistantDictionar
|
|
|
43
45
|
exports.fetcher = require_fetcher.fetcher;
|
|
44
46
|
exports.fetcherOptions = require_fetcher.fetcherOptions;
|
|
45
47
|
exports.getAiAPI = require_getIntlayerAPI_ai.getAiAPI;
|
|
48
|
+
exports.getAnalyticsAPI = require_getIntlayerAPI_analytics.getAnalyticsAPI;
|
|
46
49
|
exports.getAssetAPI = require_getIntlayerAPI_asset.getAssetAPI;
|
|
47
50
|
exports.getAuditAPI = require_getIntlayerAPI_audit.getAuditAPI;
|
|
48
51
|
exports.getBitbucketAPI = require_getIntlayerAPI_bitbucket.getBitbucketAPI;
|
package/dist/cjs/proxy.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_getIntlayerAPI_oAuth = require('./getIntlayerAPI/oAuth.cjs');
|
|
3
3
|
const require_cms_createIntlayerCMS = require('./cms/createIntlayerCMS.cjs');
|
|
4
4
|
const require_getIntlayerAPI_ai = require('./getIntlayerAPI/ai.cjs');
|
|
5
|
+
const require_getIntlayerAPI_analytics = require('./getIntlayerAPI/analytics.cjs');
|
|
5
6
|
const require_getIntlayerAPI_asset = require('./getIntlayerAPI/asset.cjs');
|
|
6
7
|
const require_getIntlayerAPI_audit = require('./getIntlayerAPI/audit.cjs');
|
|
7
8
|
const require_getIntlayerAPI_bitbucket = require('./getIntlayerAPI/bitbucket.cjs');
|
|
@@ -34,6 +35,7 @@ const sectionFactories = {
|
|
|
34
35
|
dictionary: require_getIntlayerAPI_dictionary.getDictionaryAPI,
|
|
35
36
|
stripe: require_getIntlayerAPI_stripe.getStripeAPI,
|
|
36
37
|
ai: require_getIntlayerAPI_ai.getAiAPI,
|
|
38
|
+
analytics: require_getIntlayerAPI_analytics.getAnalyticsAPI,
|
|
37
39
|
audit: require_getIntlayerAPI_audit.getAuditAPI,
|
|
38
40
|
tag: require_getIntlayerAPI_tag.getTagAPI,
|
|
39
41
|
search: require_getIntlayerAPI_search.getSearchAPI,
|
package/dist/cjs/proxy.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.cjs","names":["getAssetAPI","getOrganizationAPI","getProjectAPI","getEnvironmentAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getAuditAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI","getGithubAPI","getGitlabAPI","getBitbucketAPI","getShowcaseProjectAPI","getTranslateAPI","getReviewerAPI","getStatusAPI","createIntlayerCMS"],"sources":["../../src/proxy.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createIntlayerCMS, type IntlayerCMS } from './cms/createIntlayerCMS';\nimport type { FetcherOptions } from './fetcher';\nimport { getAiAPI } from './getIntlayerAPI/ai';\nimport { getAssetAPI } from './getIntlayerAPI/asset';\nimport { getAuditAPI } from './getIntlayerAPI/audit';\nimport { getBitbucketAPI } from './getIntlayerAPI/bitbucket';\nimport { getDictionaryAPI } from './getIntlayerAPI/dictionary';\nimport { getEditorAPI } from './getIntlayerAPI/editor';\nimport { getEnvironmentAPI } from './getIntlayerAPI/environment';\nimport { getGithubAPI } from './getIntlayerAPI/github';\nimport { getGitlabAPI } from './getIntlayerAPI/gitlab';\nimport type { IntlayerAPI } from './getIntlayerAPI/index';\nimport { getNewsletterAPI } from './getIntlayerAPI/newsletter';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\nimport { getOrganizationAPI } from './getIntlayerAPI/organization';\nimport { getProjectAPI } from './getIntlayerAPI/project';\nimport { getReviewerAPI } from './getIntlayerAPI/reviewer';\nimport { getSearchAPI } from './getIntlayerAPI/search';\nimport { getShowcaseProjectAPI } from './getIntlayerAPI/showcaseProject';\nimport { getStatusAPI } from './getIntlayerAPI/status';\nimport { getStripeAPI } from './getIntlayerAPI/stripe';\nimport { getTagAPI } from './getIntlayerAPI/tag';\nimport { getTranslateAPI } from './getIntlayerAPI/translate';\nimport { getUserAPI } from './getIntlayerAPI/user';\n\ntype SectionKey = keyof IntlayerAPI;\n\n/**\n * Homogeneous factory map: every domain factory normalized to the same\n * `(fetcherOptions, config) => section` signature, keyed by section name.\n * Declaring it as a single mapped type lets a generic lookup stay callable\n * (a union of factory signatures would not be).\n */\ntype SectionFactories = {\n [Key in SectionKey]: (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => IntlayerAPI[Key];\n};\n\nconst sectionFactories: SectionFactories = {\n asset: getAssetAPI,\n organization: getOrganizationAPI,\n project: getProjectAPI,\n environment: getEnvironmentAPI,\n user: getUserAPI,\n oAuth: getOAuthAPI,\n dictionary: getDictionaryAPI,\n stripe: getStripeAPI,\n ai: getAiAPI,\n audit: getAuditAPI,\n tag: getTagAPI,\n search: getSearchAPI,\n editor: getEditorAPI,\n newsletter: getNewsletterAPI,\n github: getGithubAPI,\n gitlab: getGitlabAPI,\n bitbucket: getBitbucketAPI,\n showcaseProject: getShowcaseProjectAPI,\n translate: getTranslateAPI,\n reviewer: getReviewerAPI,\n status: getStatusAPI,\n};\n\n// The OAuth2 token endpoint must never receive an injected Bearer token —\n// it is the call that issues one.\nconst AUTH_FREE_SECTIONS: ReadonlySet<SectionKey> = new Set<SectionKey>([\n 'oAuth',\n]);\n\n/**\n * Builds the **complete** auto-authenticated Intlayer API as a single lazy\n * object. Every domain is reachable through it, so it pulls every domain client\n * into the bundle.\n *\n * Prefer {@link createIntlayerCMS} together with the per-domain endpoint binders\n * (e.g. `dictionaryEndpoint`) in bundle-sensitive code — they include only the\n * domains you use. This helper is a convenience for Node tools (such as the CLI)\n * where bundle size is not a concern.\n */\nexport const getIntlayerAPIProxy = (\n baseAuthOptions: FetcherOptions = {},\n intlayerConfig: Pick<IntlayerConfig, 'editor'> = { editor },\n sessionToken?: string\n): IntlayerAPI => {\n const cms: IntlayerCMS = createIntlayerCMS(intlayerConfig, {\n baseFetcherOptions: baseAuthOptions,\n sessionToken,\n });\n\n const sectionCache = new Map<SectionKey, unknown>();\n\n // Generic over `Key` so `sectionFactories[key]` resolves to a single\n // `(opts, config) => IntlayerAPI[Key]` signature rather than the union of all\n // factory signatures (which would not be callable).\n const buildSection = <Key extends SectionKey>(key: Key): IntlayerAPI[Key] => {\n const factory = sectionFactories[key] as (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => Record<string, unknown>;\n\n return cms.bindSection(factory, {\n skipAuth: AUTH_FREE_SECTIONS.has(key) ? true : undefined,\n }) as IntlayerAPI[Key];\n };\n\n return new Proxy({} as IntlayerAPI, {\n get(_target, property) {\n const key = property as SectionKey;\n if (!(key in sectionFactories)) return undefined;\n\n if (!sectionCache.has(key)) {\n sectionCache.set(key, buildSection(key));\n }\n\n return sectionCache.get(key);\n },\n has(_target, property) {\n return (property as SectionKey) in sectionFactories;\n },\n ownKeys() {\n return Reflect.ownKeys(sectionFactories);\n },\n getOwnPropertyDescriptor() {\n return { enumerable: true, configurable: true };\n },\n });\n};\n\n/**\n * The complete auto-authenticated Intlayer API returned by\n * {@link getIntlayerAPIProxy}. Equivalent in shape to `IntlayerAPI`.\n */\nexport type IntlayerAPIProxy = ReturnType<typeof getIntlayerAPIProxy>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.cjs","names":["getAssetAPI","getOrganizationAPI","getProjectAPI","getEnvironmentAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getAnalyticsAPI","getAuditAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI","getGithubAPI","getGitlabAPI","getBitbucketAPI","getShowcaseProjectAPI","getTranslateAPI","getReviewerAPI","getStatusAPI","createIntlayerCMS"],"sources":["../../src/proxy.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createIntlayerCMS, type IntlayerCMS } from './cms/createIntlayerCMS';\nimport type { FetcherOptions } from './fetcher';\nimport { getAiAPI } from './getIntlayerAPI/ai';\nimport { getAnalyticsAPI } from './getIntlayerAPI/analytics';\nimport { getAssetAPI } from './getIntlayerAPI/asset';\nimport { getAuditAPI } from './getIntlayerAPI/audit';\nimport { getBitbucketAPI } from './getIntlayerAPI/bitbucket';\nimport { getDictionaryAPI } from './getIntlayerAPI/dictionary';\nimport { getEditorAPI } from './getIntlayerAPI/editor';\nimport { getEnvironmentAPI } from './getIntlayerAPI/environment';\nimport { getGithubAPI } from './getIntlayerAPI/github';\nimport { getGitlabAPI } from './getIntlayerAPI/gitlab';\nimport type { IntlayerAPI } from './getIntlayerAPI/index';\nimport { getNewsletterAPI } from './getIntlayerAPI/newsletter';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\nimport { getOrganizationAPI } from './getIntlayerAPI/organization';\nimport { getProjectAPI } from './getIntlayerAPI/project';\nimport { getReviewerAPI } from './getIntlayerAPI/reviewer';\nimport { getSearchAPI } from './getIntlayerAPI/search';\nimport { getShowcaseProjectAPI } from './getIntlayerAPI/showcaseProject';\nimport { getStatusAPI } from './getIntlayerAPI/status';\nimport { getStripeAPI } from './getIntlayerAPI/stripe';\nimport { getTagAPI } from './getIntlayerAPI/tag';\nimport { getTranslateAPI } from './getIntlayerAPI/translate';\nimport { getUserAPI } from './getIntlayerAPI/user';\n\ntype SectionKey = keyof IntlayerAPI;\n\n/**\n * Homogeneous factory map: every domain factory normalized to the same\n * `(fetcherOptions, config) => section` signature, keyed by section name.\n * Declaring it as a single mapped type lets a generic lookup stay callable\n * (a union of factory signatures would not be).\n */\ntype SectionFactories = {\n [Key in SectionKey]: (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => IntlayerAPI[Key];\n};\n\nconst sectionFactories: SectionFactories = {\n asset: getAssetAPI,\n organization: getOrganizationAPI,\n project: getProjectAPI,\n environment: getEnvironmentAPI,\n user: getUserAPI,\n oAuth: getOAuthAPI,\n dictionary: getDictionaryAPI,\n stripe: getStripeAPI,\n ai: getAiAPI,\n analytics: getAnalyticsAPI,\n audit: getAuditAPI,\n tag: getTagAPI,\n search: getSearchAPI,\n editor: getEditorAPI,\n newsletter: getNewsletterAPI,\n github: getGithubAPI,\n gitlab: getGitlabAPI,\n bitbucket: getBitbucketAPI,\n showcaseProject: getShowcaseProjectAPI,\n translate: getTranslateAPI,\n reviewer: getReviewerAPI,\n status: getStatusAPI,\n};\n\n// The OAuth2 token endpoint must never receive an injected Bearer token —\n// it is the call that issues one.\nconst AUTH_FREE_SECTIONS: ReadonlySet<SectionKey> = new Set<SectionKey>([\n 'oAuth',\n]);\n\n/**\n * Builds the **complete** auto-authenticated Intlayer API as a single lazy\n * object. Every domain is reachable through it, so it pulls every domain client\n * into the bundle.\n *\n * Prefer {@link createIntlayerCMS} together with the per-domain endpoint binders\n * (e.g. `dictionaryEndpoint`) in bundle-sensitive code — they include only the\n * domains you use. This helper is a convenience for Node tools (such as the CLI)\n * where bundle size is not a concern.\n */\nexport const getIntlayerAPIProxy = (\n baseAuthOptions: FetcherOptions = {},\n intlayerConfig: Pick<IntlayerConfig, 'editor'> = { editor },\n sessionToken?: string\n): IntlayerAPI => {\n const cms: IntlayerCMS = createIntlayerCMS(intlayerConfig, {\n baseFetcherOptions: baseAuthOptions,\n sessionToken,\n });\n\n const sectionCache = new Map<SectionKey, unknown>();\n\n // Generic over `Key` so `sectionFactories[key]` resolves to a single\n // `(opts, config) => IntlayerAPI[Key]` signature rather than the union of all\n // factory signatures (which would not be callable).\n const buildSection = <Key extends SectionKey>(key: Key): IntlayerAPI[Key] => {\n const factory = sectionFactories[key] as (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => Record<string, unknown>;\n\n return cms.bindSection(factory, {\n skipAuth: AUTH_FREE_SECTIONS.has(key) ? true : undefined,\n }) as IntlayerAPI[Key];\n };\n\n return new Proxy({} as IntlayerAPI, {\n get(_target, property) {\n const key = property as SectionKey;\n if (!(key in sectionFactories)) return undefined;\n\n if (!sectionCache.has(key)) {\n sectionCache.set(key, buildSection(key));\n }\n\n return sectionCache.get(key);\n },\n has(_target, property) {\n return (property as SectionKey) in sectionFactories;\n },\n ownKeys() {\n return Reflect.ownKeys(sectionFactories);\n },\n getOwnPropertyDescriptor() {\n return { enumerable: true, configurable: true };\n },\n });\n};\n\n/**\n * The complete auto-authenticated Intlayer API returned by\n * {@link getIntlayerAPIProxy}. Equivalent in shape to `IntlayerAPI`.\n */\nexport type IntlayerAPIProxy = ReturnType<typeof getIntlayerAPIProxy>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,mBAAqC;CACzC,OAAOA;CACP,cAAcC;CACd,SAASC;CACT,aAAaC;CACb,MAAMC;CACN,OAAOC;CACP,YAAYC;CACZ,QAAQC;CACR,IAAIC;CACJ,WAAWC;CACX,OAAOC;CACP,KAAKC;CACL,QAAQC;CACR,QAAQC;CACR,YAAYC;CACZ,QAAQC;CACR,QAAQC;CACR,WAAWC;CACX,iBAAiBC;CACjB,WAAWC;CACX,UAAUC;CACV,QAAQC;CACT;AAID,MAAM,qBAA8C,IAAI,IAAgB,CACtE,QACD,CAAC;;;;;;;;;;;AAYF,MAAa,uBACX,kBAAkC,EAAE,EACpC,iBAAiD,EAAE,uCAAQ,EAC3D,iBACgB;CAChB,MAAM,MAAmBC,gDAAkB,gBAAgB;EACzD,oBAAoB;EACpB;EACD,CAAC;CAEF,MAAM,+BAAe,IAAI,KAA0B;CAKnD,MAAM,gBAAwC,QAA+B;EAC3E,MAAM,UAAU,iBAAiB;AAKjC,SAAO,IAAI,YAAY,SAAS,EAC9B,UAAU,mBAAmB,IAAI,IAAI,GAAG,OAAO,QAChD,CAAC;;AAGJ,QAAO,IAAI,MAAM,EAAE,EAAiB;EAClC,IAAI,SAAS,UAAU;GACrB,MAAM,MAAM;AACZ,OAAI,EAAE,OAAO,kBAAmB,QAAO;AAEvC,OAAI,CAAC,aAAa,IAAI,IAAI,CACxB,cAAa,IAAI,KAAK,aAAa,IAAI,CAAC;AAG1C,UAAO,aAAa,IAAI,IAAI;;EAE9B,IAAI,SAAS,UAAU;AACrB,UAAQ,YAA2B;;EAErC,UAAU;AACR,UAAO,QAAQ,QAAQ,iBAAiB;;EAE1C,2BAA2B;AACzB,UAAO;IAAE,YAAY;IAAM,cAAc;IAAM;;EAElD,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { fetcher } from "../fetcher.mjs";
|
|
2
|
+
import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
|
|
3
|
+
import { editor } from "@intlayer/config/built";
|
|
4
|
+
|
|
5
|
+
//#region src/getIntlayerAPI/analytics.ts
|
|
6
|
+
const getAnalyticsAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
7
|
+
const ANALYTICS_API_ROUTE = `${intlayerConfig?.editor?.backendURL ?? editor.backendURL}/api/analytics`;
|
|
8
|
+
/**
|
|
9
|
+
* Ingest a batch of analytics events. Public — attribution is by the
|
|
10
|
+
* project's `clientId` in the body.
|
|
11
|
+
* @param body - Session id, sdk version, and the collected events.
|
|
12
|
+
* @returns The number of accepted events.
|
|
13
|
+
*/
|
|
14
|
+
const sendEvents = async (body, otherOptions = {}) => await fetcher(`${ANALYTICS_API_ROUTE}/events`, authAPIOptions, otherOptions, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
body
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Page/locale totals for the authenticated project.
|
|
20
|
+
* @returns Views grouped by url and locale.
|
|
21
|
+
*/
|
|
22
|
+
const getOverview = async (otherOptions = {}) => await fetcher(`${ANALYTICS_API_ROUTE}/overview`, authAPIOptions, otherOptions, { method: "GET" });
|
|
23
|
+
/**
|
|
24
|
+
* Audience report: distinct visitors (today / 7d / window), page views, the
|
|
25
|
+
* daily evolution series, and locale + country breakdowns.
|
|
26
|
+
* @param days - Rolling window size in days (default 30).
|
|
27
|
+
* @returns The audience statistics.
|
|
28
|
+
*/
|
|
29
|
+
const getAudience = async (days = 30, otherOptions = {}) => await fetcher(`${ANALYTICS_API_ROUTE}/audience`, authAPIOptions, otherOptions, {
|
|
30
|
+
method: "GET",
|
|
31
|
+
params: { days: String(days) }
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Per-content exposure totals — "which content is actually shown".
|
|
35
|
+
* @returns Exposures grouped by dictionary key, key path, and locale.
|
|
36
|
+
*/
|
|
37
|
+
const getContentStats = async (otherOptions = {}) => await fetcher(`${ANALYTICS_API_ROUTE}/content-stats`, authAPIOptions, otherOptions, { method: "GET" });
|
|
38
|
+
/**
|
|
39
|
+
* A/B experiment results with per-variant conversion rates and significance.
|
|
40
|
+
* @param experimentKey - The experiment to evaluate.
|
|
41
|
+
* @returns The experiment result set.
|
|
42
|
+
*/
|
|
43
|
+
const getExperimentResults = async (experimentKey, otherOptions = {}) => await fetcher(`${ANALYTICS_API_ROUTE}/experiments/${experimentKey}`, authAPIOptions, otherOptions, { method: "GET" });
|
|
44
|
+
return {
|
|
45
|
+
sendEvents,
|
|
46
|
+
getOverview,
|
|
47
|
+
getAudience,
|
|
48
|
+
getContentStats,
|
|
49
|
+
getExperimentResults
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Authenticated `analytics` endpoint bound to an Intlayer CMS authenticator.
|
|
54
|
+
*
|
|
55
|
+
* Pass an authenticator created with `createIntlayerCMS`, or omit it to use
|
|
56
|
+
* the build-time configuration (`@intlayer/config/built`).
|
|
57
|
+
*/
|
|
58
|
+
const analyticsEndpoint = createEndpoint(getAnalyticsAPI);
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { analyticsEndpoint, getAnalyticsAPI };
|
|
62
|
+
//# sourceMappingURL=analytics.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.mjs","names":[],"sources":["../../../src/getIntlayerAPI/analytics.ts"],"sourcesContent":["import type {\n GetAnalyticsOverviewResult,\n GetAudienceResult,\n GetContentStatsResult,\n GetExperimentResultsResult,\n IngestAnalyticsBody,\n IngestAnalyticsResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getAnalyticsAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const ANALYTICS_API_ROUTE = `${backendURL}/api/analytics`;\n\n /**\n * Ingest a batch of analytics events. Public — attribution is by the\n * project's `clientId` in the body.\n * @param body - Session id, sdk version, and the collected events.\n * @returns The number of accepted events.\n */\n const sendEvents = async (\n body: IngestAnalyticsBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<IngestAnalyticsResult>(\n `${ANALYTICS_API_ROUTE}/events`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Page/locale totals for the authenticated project.\n * @returns Views grouped by url and locale.\n */\n const getOverview = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAnalyticsOverviewResult>(\n `${ANALYTICS_API_ROUTE}/overview`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * Audience report: distinct visitors (today / 7d / window), page views, the\n * daily evolution series, and locale + country breakdowns.\n * @param days - Rolling window size in days (default 30).\n * @returns The audience statistics.\n */\n const getAudience = async (days = 30, otherOptions: FetcherOptions = {}) =>\n await fetcher<GetAudienceResult>(\n `${ANALYTICS_API_ROUTE}/audience`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: { days: String(days) },\n }\n );\n\n /**\n * Per-content exposure totals — \"which content is actually shown\".\n * @returns Exposures grouped by dictionary key, key path, and locale.\n */\n const getContentStats = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetContentStatsResult>(\n `${ANALYTICS_API_ROUTE}/content-stats`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n /**\n * A/B experiment results with per-variant conversion rates and significance.\n * @param experimentKey - The experiment to evaluate.\n * @returns The experiment result set.\n */\n const getExperimentResults = async (\n experimentKey: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetExperimentResultsResult>(\n `${ANALYTICS_API_ROUTE}/experiments/${experimentKey}`,\n authAPIOptions,\n otherOptions,\n { method: 'GET' }\n );\n\n return {\n sendEvents,\n getOverview,\n getAudience,\n getContentStats,\n getExperimentResults,\n };\n};\n\n/**\n * Authenticated `analytics` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const analyticsEndpoint = createEndpoint(getAnalyticsAPI);\n"],"mappings":";;;;;AAaA,MAAa,mBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,sBAAsB,GAFT,gBAAgB,QAAQ,cAAc,OAAO,WAEtB;;;;;;;CAQ1C,MAAM,aAAa,OACjB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,oBAAoB,UACvB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,cAAc,OAAO,eAA+B,EAAE,KAC1D,MAAM,QACJ,GAAG,oBAAoB,YACvB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;;;;;;CAQH,MAAM,cAAc,OAAO,OAAO,IAAI,eAA+B,EAAE,KACrE,MAAM,QACJ,GAAG,oBAAoB,YACvB,gBACA,cACA;EACE,QAAQ;EACR,QAAQ,EAAE,MAAM,OAAO,KAAK,EAAE;EAC/B,CACF;;;;;CAMH,MAAM,kBAAkB,OAAO,eAA+B,EAAE,KAC9D,MAAM,QACJ,GAAG,oBAAoB,iBACvB,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;;;;;;CAOH,MAAM,uBAAuB,OAC3B,eACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,oBAAoB,eAAe,iBACtC,gBACA,cACA,EAAE,QAAQ,OAAO,CAClB;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACD;;;;;;;;AASH,MAAa,oBAAoB,eAAe,gBAAgB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getOAuthAPI } from "./oAuth.mjs";
|
|
2
2
|
import { getAiAPI } from "./ai.mjs";
|
|
3
|
+
import { getAnalyticsAPI } from "./analytics.mjs";
|
|
3
4
|
import { getAssetAPI } from "./asset.mjs";
|
|
4
5
|
import { getAuditAPI } from "./audit.mjs";
|
|
5
6
|
import { getBitbucketAPI } from "./bitbucket.mjs";
|
|
@@ -35,6 +36,7 @@ const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
35
36
|
dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),
|
|
36
37
|
stripe: getStripeAPI(authAPIOptions, resolvedConfig),
|
|
37
38
|
ai: getAiAPI(authAPIOptions, resolvedConfig),
|
|
39
|
+
analytics: getAnalyticsAPI(authAPIOptions, resolvedConfig),
|
|
38
40
|
audit: getAuditAPI(authAPIOptions, resolvedConfig),
|
|
39
41
|
tag: getTagAPI(authAPIOptions, resolvedConfig),
|
|
40
42
|
search: getSearchAPI(authAPIOptions, resolvedConfig),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAssetAPI } from './asset';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStatusAPI } from './status';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n asset: ReturnType<typeof getAssetAPI>;\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n status: ReturnType<typeof getStatusAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n asset: getAssetAPI(authAPIOptions, resolvedConfig),\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n status: getStatusAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAnalyticsAPI } from './analytics';\nimport { getAssetAPI } from './asset';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStatusAPI } from './status';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n asset: ReturnType<typeof getAssetAPI>;\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n analytics: ReturnType<typeof getAnalyticsAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n status: ReturnType<typeof getStatusAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n asset: getAssetAPI(authAPIOptions, resolvedConfig),\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n analytics: getAnalyticsAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n status: getStatusAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAa,kBACX,iBAAiC,EAAE,EACnC,mBACsB;CACtB,MAAM,iBAAiB,KAAK,kBAAkB,EAAE,EAAE,EAChD,QACD,CAAC;AAEF,QAAO;EACL,OAAO,YAAY,gBAAgB,eAAe;EAClD,cAAc,mBAAmB,gBAAgB,eAAe;EAChE,SAAS,cAAc,gBAAgB,eAAe;EACtD,aAAa,kBAAkB,gBAAgB,eAAe;EAC9D,MAAM,WAAW,gBAAgB,eAAe;EAChD,OAAO,YAAY,gBAAgB,eAAe;EAClD,YAAY,iBAAiB,gBAAgB,eAAe;EAC5D,QAAQ,aAAa,gBAAgB,eAAe;EACpD,IAAI,SAAS,gBAAgB,eAAe;EAC5C,WAAW,gBAAgB,gBAAgB,eAAe;EAC1D,OAAO,YAAY,gBAAgB,eAAe;EAClD,KAAK,UAAU,gBAAgB,eAAe;EAC9C,QAAQ,aAAa,gBAAgB,eAAe;EACpD,QAAQ,aAAa,gBAAgB,eAAe;EACpD,YAAY,iBAAiB,gBAAgB,eAAe;EAC5D,QAAQ,aAAa,gBAAgB,eAAe;EACpD,QAAQ,aAAa,gBAAgB,eAAe;EACpD,WAAW,gBAAgB,gBAAgB,eAAe;EAC1D,iBAAiB,sBAAsB,gBAAgB,eAAe;EACtE,WAAW,gBAAgB,gBAAgB,eAAe;EAC1D,UAAU,eAAe,gBAAgB,eAAe;EACxD,QAAQ,aAAa,gBAAgB,eAAe;EACrD"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { getOAuthAPI } from "./getIntlayerAPI/oAuth.mjs";
|
|
|
3
3
|
import { createAuthManager } from "./cms/createAuthManager.mjs";
|
|
4
4
|
import { createEndpoint, createIntlayerCMS } from "./cms/createIntlayerCMS.mjs";
|
|
5
5
|
import { aiEndpoint, getAiAPI } from "./getIntlayerAPI/ai.mjs";
|
|
6
|
+
import { analyticsEndpoint, getAnalyticsAPI } from "./getIntlayerAPI/analytics.mjs";
|
|
6
7
|
import { assetEndpoint, getAssetAPI } from "./getIntlayerAPI/asset.mjs";
|
|
7
8
|
import { auditEndpoint, getAuditAPI } from "./getIntlayerAPI/audit.mjs";
|
|
8
9
|
import { bitbucketEndpoint, getBitbucketAPI } from "./getIntlayerAPI/bitbucket.mjs";
|
|
@@ -27,4 +28,4 @@ import { fetchDistantDictionaries } from "./distantDictionary/fetchDistantDictio
|
|
|
27
28
|
import { fetchDistantDictionary } from "./distantDictionary/fetchDistantDictionary.mjs";
|
|
28
29
|
import { getIntlayerAPI } from "./getIntlayerAPI/index.mjs";
|
|
29
30
|
|
|
30
|
-
export { aiEndpoint, assetEndpoint, auditEndpoint, bitbucketEndpoint, createAuthManager, createEndpoint, createIntlayerCMS, dictionaryEndpoint, editorEndpoint, environmentEndpoint, fetchDistantDictionaries, fetchDistantDictionary, fetcher, fetcherOptions, getAiAPI, getAssetAPI, getAuditAPI, getBitbucketAPI, getDictionaryAPI, getEditorAPI, getEnvironmentAPI, getGithubAPI, getGitlabAPI, getIntlayerAPI, getIntlayerAPIProxy, getNewsletterAPI, getOAuthAPI, getOrganizationAPI, getProjectAPI, getReviewerAPI, getSearchAPI, getShowcaseProjectAPI, getStatusAPI, getStripeAPI, getTagAPI, getTranslateAPI, getUserAPI, githubEndpoint, gitlabEndpoint, newsletterEndpoint, organizationEndpoint, projectEndpoint, reviewerEndpoint, searchEndpoint, showcaseProjectEndpoint, statusEndpoint, stripeEndpoint, tagEndpoint, translateEndpoint, userEndpoint };
|
|
31
|
+
export { aiEndpoint, analyticsEndpoint, assetEndpoint, auditEndpoint, bitbucketEndpoint, createAuthManager, createEndpoint, createIntlayerCMS, dictionaryEndpoint, editorEndpoint, environmentEndpoint, fetchDistantDictionaries, fetchDistantDictionary, fetcher, fetcherOptions, getAiAPI, getAnalyticsAPI, getAssetAPI, getAuditAPI, getBitbucketAPI, getDictionaryAPI, getEditorAPI, getEnvironmentAPI, getGithubAPI, getGitlabAPI, getIntlayerAPI, getIntlayerAPIProxy, getNewsletterAPI, getOAuthAPI, getOrganizationAPI, getProjectAPI, getReviewerAPI, getSearchAPI, getShowcaseProjectAPI, getStatusAPI, getStripeAPI, getTagAPI, getTranslateAPI, getUserAPI, githubEndpoint, gitlabEndpoint, newsletterEndpoint, organizationEndpoint, projectEndpoint, reviewerEndpoint, searchEndpoint, showcaseProjectEndpoint, statusEndpoint, stripeEndpoint, tagEndpoint, translateEndpoint, userEndpoint };
|
package/dist/esm/proxy.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getOAuthAPI } from "./getIntlayerAPI/oAuth.mjs";
|
|
2
2
|
import { createIntlayerCMS } from "./cms/createIntlayerCMS.mjs";
|
|
3
3
|
import { getAiAPI } from "./getIntlayerAPI/ai.mjs";
|
|
4
|
+
import { getAnalyticsAPI } from "./getIntlayerAPI/analytics.mjs";
|
|
4
5
|
import { getAssetAPI } from "./getIntlayerAPI/asset.mjs";
|
|
5
6
|
import { getAuditAPI } from "./getIntlayerAPI/audit.mjs";
|
|
6
7
|
import { getBitbucketAPI } from "./getIntlayerAPI/bitbucket.mjs";
|
|
@@ -33,6 +34,7 @@ const sectionFactories = {
|
|
|
33
34
|
dictionary: getDictionaryAPI,
|
|
34
35
|
stripe: getStripeAPI,
|
|
35
36
|
ai: getAiAPI,
|
|
37
|
+
analytics: getAnalyticsAPI,
|
|
36
38
|
audit: getAuditAPI,
|
|
37
39
|
tag: getTagAPI,
|
|
38
40
|
search: getSearchAPI,
|
package/dist/esm/proxy.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.mjs","names":[],"sources":["../../src/proxy.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createIntlayerCMS, type IntlayerCMS } from './cms/createIntlayerCMS';\nimport type { FetcherOptions } from './fetcher';\nimport { getAiAPI } from './getIntlayerAPI/ai';\nimport { getAssetAPI } from './getIntlayerAPI/asset';\nimport { getAuditAPI } from './getIntlayerAPI/audit';\nimport { getBitbucketAPI } from './getIntlayerAPI/bitbucket';\nimport { getDictionaryAPI } from './getIntlayerAPI/dictionary';\nimport { getEditorAPI } from './getIntlayerAPI/editor';\nimport { getEnvironmentAPI } from './getIntlayerAPI/environment';\nimport { getGithubAPI } from './getIntlayerAPI/github';\nimport { getGitlabAPI } from './getIntlayerAPI/gitlab';\nimport type { IntlayerAPI } from './getIntlayerAPI/index';\nimport { getNewsletterAPI } from './getIntlayerAPI/newsletter';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\nimport { getOrganizationAPI } from './getIntlayerAPI/organization';\nimport { getProjectAPI } from './getIntlayerAPI/project';\nimport { getReviewerAPI } from './getIntlayerAPI/reviewer';\nimport { getSearchAPI } from './getIntlayerAPI/search';\nimport { getShowcaseProjectAPI } from './getIntlayerAPI/showcaseProject';\nimport { getStatusAPI } from './getIntlayerAPI/status';\nimport { getStripeAPI } from './getIntlayerAPI/stripe';\nimport { getTagAPI } from './getIntlayerAPI/tag';\nimport { getTranslateAPI } from './getIntlayerAPI/translate';\nimport { getUserAPI } from './getIntlayerAPI/user';\n\ntype SectionKey = keyof IntlayerAPI;\n\n/**\n * Homogeneous factory map: every domain factory normalized to the same\n * `(fetcherOptions, config) => section` signature, keyed by section name.\n * Declaring it as a single mapped type lets a generic lookup stay callable\n * (a union of factory signatures would not be).\n */\ntype SectionFactories = {\n [Key in SectionKey]: (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => IntlayerAPI[Key];\n};\n\nconst sectionFactories: SectionFactories = {\n asset: getAssetAPI,\n organization: getOrganizationAPI,\n project: getProjectAPI,\n environment: getEnvironmentAPI,\n user: getUserAPI,\n oAuth: getOAuthAPI,\n dictionary: getDictionaryAPI,\n stripe: getStripeAPI,\n ai: getAiAPI,\n audit: getAuditAPI,\n tag: getTagAPI,\n search: getSearchAPI,\n editor: getEditorAPI,\n newsletter: getNewsletterAPI,\n github: getGithubAPI,\n gitlab: getGitlabAPI,\n bitbucket: getBitbucketAPI,\n showcaseProject: getShowcaseProjectAPI,\n translate: getTranslateAPI,\n reviewer: getReviewerAPI,\n status: getStatusAPI,\n};\n\n// The OAuth2 token endpoint must never receive an injected Bearer token —\n// it is the call that issues one.\nconst AUTH_FREE_SECTIONS: ReadonlySet<SectionKey> = new Set<SectionKey>([\n 'oAuth',\n]);\n\n/**\n * Builds the **complete** auto-authenticated Intlayer API as a single lazy\n * object. Every domain is reachable through it, so it pulls every domain client\n * into the bundle.\n *\n * Prefer {@link createIntlayerCMS} together with the per-domain endpoint binders\n * (e.g. `dictionaryEndpoint`) in bundle-sensitive code — they include only the\n * domains you use. This helper is a convenience for Node tools (such as the CLI)\n * where bundle size is not a concern.\n */\nexport const getIntlayerAPIProxy = (\n baseAuthOptions: FetcherOptions = {},\n intlayerConfig: Pick<IntlayerConfig, 'editor'> = { editor },\n sessionToken?: string\n): IntlayerAPI => {\n const cms: IntlayerCMS = createIntlayerCMS(intlayerConfig, {\n baseFetcherOptions: baseAuthOptions,\n sessionToken,\n });\n\n const sectionCache = new Map<SectionKey, unknown>();\n\n // Generic over `Key` so `sectionFactories[key]` resolves to a single\n // `(opts, config) => IntlayerAPI[Key]` signature rather than the union of all\n // factory signatures (which would not be callable).\n const buildSection = <Key extends SectionKey>(key: Key): IntlayerAPI[Key] => {\n const factory = sectionFactories[key] as (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => Record<string, unknown>;\n\n return cms.bindSection(factory, {\n skipAuth: AUTH_FREE_SECTIONS.has(key) ? true : undefined,\n }) as IntlayerAPI[Key];\n };\n\n return new Proxy({} as IntlayerAPI, {\n get(_target, property) {\n const key = property as SectionKey;\n if (!(key in sectionFactories)) return undefined;\n\n if (!sectionCache.has(key)) {\n sectionCache.set(key, buildSection(key));\n }\n\n return sectionCache.get(key);\n },\n has(_target, property) {\n return (property as SectionKey) in sectionFactories;\n },\n ownKeys() {\n return Reflect.ownKeys(sectionFactories);\n },\n getOwnPropertyDescriptor() {\n return { enumerable: true, configurable: true };\n },\n });\n};\n\n/**\n * The complete auto-authenticated Intlayer API returned by\n * {@link getIntlayerAPIProxy}. Equivalent in shape to `IntlayerAPI`.\n */\nexport type IntlayerAPIProxy = ReturnType<typeof getIntlayerAPIProxy>;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.mjs","names":[],"sources":["../../src/proxy.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createIntlayerCMS, type IntlayerCMS } from './cms/createIntlayerCMS';\nimport type { FetcherOptions } from './fetcher';\nimport { getAiAPI } from './getIntlayerAPI/ai';\nimport { getAnalyticsAPI } from './getIntlayerAPI/analytics';\nimport { getAssetAPI } from './getIntlayerAPI/asset';\nimport { getAuditAPI } from './getIntlayerAPI/audit';\nimport { getBitbucketAPI } from './getIntlayerAPI/bitbucket';\nimport { getDictionaryAPI } from './getIntlayerAPI/dictionary';\nimport { getEditorAPI } from './getIntlayerAPI/editor';\nimport { getEnvironmentAPI } from './getIntlayerAPI/environment';\nimport { getGithubAPI } from './getIntlayerAPI/github';\nimport { getGitlabAPI } from './getIntlayerAPI/gitlab';\nimport type { IntlayerAPI } from './getIntlayerAPI/index';\nimport { getNewsletterAPI } from './getIntlayerAPI/newsletter';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\nimport { getOrganizationAPI } from './getIntlayerAPI/organization';\nimport { getProjectAPI } from './getIntlayerAPI/project';\nimport { getReviewerAPI } from './getIntlayerAPI/reviewer';\nimport { getSearchAPI } from './getIntlayerAPI/search';\nimport { getShowcaseProjectAPI } from './getIntlayerAPI/showcaseProject';\nimport { getStatusAPI } from './getIntlayerAPI/status';\nimport { getStripeAPI } from './getIntlayerAPI/stripe';\nimport { getTagAPI } from './getIntlayerAPI/tag';\nimport { getTranslateAPI } from './getIntlayerAPI/translate';\nimport { getUserAPI } from './getIntlayerAPI/user';\n\ntype SectionKey = keyof IntlayerAPI;\n\n/**\n * Homogeneous factory map: every domain factory normalized to the same\n * `(fetcherOptions, config) => section` signature, keyed by section name.\n * Declaring it as a single mapped type lets a generic lookup stay callable\n * (a union of factory signatures would not be).\n */\ntype SectionFactories = {\n [Key in SectionKey]: (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => IntlayerAPI[Key];\n};\n\nconst sectionFactories: SectionFactories = {\n asset: getAssetAPI,\n organization: getOrganizationAPI,\n project: getProjectAPI,\n environment: getEnvironmentAPI,\n user: getUserAPI,\n oAuth: getOAuthAPI,\n dictionary: getDictionaryAPI,\n stripe: getStripeAPI,\n ai: getAiAPI,\n analytics: getAnalyticsAPI,\n audit: getAuditAPI,\n tag: getTagAPI,\n search: getSearchAPI,\n editor: getEditorAPI,\n newsletter: getNewsletterAPI,\n github: getGithubAPI,\n gitlab: getGitlabAPI,\n bitbucket: getBitbucketAPI,\n showcaseProject: getShowcaseProjectAPI,\n translate: getTranslateAPI,\n reviewer: getReviewerAPI,\n status: getStatusAPI,\n};\n\n// The OAuth2 token endpoint must never receive an injected Bearer token —\n// it is the call that issues one.\nconst AUTH_FREE_SECTIONS: ReadonlySet<SectionKey> = new Set<SectionKey>([\n 'oAuth',\n]);\n\n/**\n * Builds the **complete** auto-authenticated Intlayer API as a single lazy\n * object. Every domain is reachable through it, so it pulls every domain client\n * into the bundle.\n *\n * Prefer {@link createIntlayerCMS} together with the per-domain endpoint binders\n * (e.g. `dictionaryEndpoint`) in bundle-sensitive code — they include only the\n * domains you use. This helper is a convenience for Node tools (such as the CLI)\n * where bundle size is not a concern.\n */\nexport const getIntlayerAPIProxy = (\n baseAuthOptions: FetcherOptions = {},\n intlayerConfig: Pick<IntlayerConfig, 'editor'> = { editor },\n sessionToken?: string\n): IntlayerAPI => {\n const cms: IntlayerCMS = createIntlayerCMS(intlayerConfig, {\n baseFetcherOptions: baseAuthOptions,\n sessionToken,\n });\n\n const sectionCache = new Map<SectionKey, unknown>();\n\n // Generic over `Key` so `sectionFactories[key]` resolves to a single\n // `(opts, config) => IntlayerAPI[Key]` signature rather than the union of all\n // factory signatures (which would not be callable).\n const buildSection = <Key extends SectionKey>(key: Key): IntlayerAPI[Key] => {\n const factory = sectionFactories[key] as (\n fetcherOptions: FetcherOptions,\n intlayerConfig: IntlayerConfig\n ) => Record<string, unknown>;\n\n return cms.bindSection(factory, {\n skipAuth: AUTH_FREE_SECTIONS.has(key) ? true : undefined,\n }) as IntlayerAPI[Key];\n };\n\n return new Proxy({} as IntlayerAPI, {\n get(_target, property) {\n const key = property as SectionKey;\n if (!(key in sectionFactories)) return undefined;\n\n if (!sectionCache.has(key)) {\n sectionCache.set(key, buildSection(key));\n }\n\n return sectionCache.get(key);\n },\n has(_target, property) {\n return (property as SectionKey) in sectionFactories;\n },\n ownKeys() {\n return Reflect.ownKeys(sectionFactories);\n },\n getOwnPropertyDescriptor() {\n return { enumerable: true, configurable: true };\n },\n });\n};\n\n/**\n * The complete auto-authenticated Intlayer API returned by\n * {@link getIntlayerAPIProxy}. Equivalent in shape to `IntlayerAPI`.\n */\nexport type IntlayerAPIProxy = ReturnType<typeof getIntlayerAPIProxy>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,mBAAqC;CACzC,OAAO;CACP,cAAc;CACd,SAAS;CACT,aAAa;CACb,MAAM;CACN,OAAO;CACP,YAAY;CACZ,QAAQ;CACR,IAAI;CACJ,WAAW;CACX,OAAO;CACP,KAAK;CACL,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,iBAAiB;CACjB,WAAW;CACX,UAAU;CACV,QAAQ;CACT;AAID,MAAM,qBAA8C,IAAI,IAAgB,CACtE,QACD,CAAC;;;;;;;;;;;AAYF,MAAa,uBACX,kBAAkC,EAAE,EACpC,iBAAiD,EAAE,QAAQ,EAC3D,iBACgB;CAChB,MAAM,MAAmB,kBAAkB,gBAAgB;EACzD,oBAAoB;EACpB;EACD,CAAC;CAEF,MAAM,+BAAe,IAAI,KAA0B;CAKnD,MAAM,gBAAwC,QAA+B;EAC3E,MAAM,UAAU,iBAAiB;AAKjC,SAAO,IAAI,YAAY,SAAS,EAC9B,UAAU,mBAAmB,IAAI,IAAI,GAAG,OAAO,QAChD,CAAC;;AAGJ,QAAO,IAAI,MAAM,EAAE,EAAiB;EAClC,IAAI,SAAS,UAAU;GACrB,MAAM,MAAM;AACZ,OAAI,EAAE,OAAO,kBAAmB,QAAO;AAEvC,OAAI,CAAC,aAAa,IAAI,IAAI,CACxB,cAAa,IAAI,KAAK,aAAa,IAAI,CAAC;AAG1C,UAAO,aAAa,IAAI,IAAI;;EAE9B,IAAI,SAAS,UAAU;AACrB,UAAQ,YAA2B;;EAErC,UAAU;AACR,UAAO,QAAQ,QAAQ,iBAAiB;;EAE1C,2BAA2B;AACzB,UAAO;IAAE,YAAY;IAAM,cAAc;IAAM;;EAElD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FetcherOptions } from "../fetcher.js";
|
|
2
|
+
import { CMSEndpoint } from "../cms/createIntlayerCMS.js";
|
|
3
|
+
import { IntlayerConfig } from "@intlayer/types/config";
|
|
4
|
+
import { IngestAnalyticsBody } from "@intlayer/backend";
|
|
5
|
+
|
|
6
|
+
//#region src/getIntlayerAPI/analytics.d.ts
|
|
7
|
+
declare const getAnalyticsAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
8
|
+
sendEvents: (body: IngestAnalyticsBody, otherOptions?: FetcherOptions) => Promise<IngestAnalyticsResult>;
|
|
9
|
+
getOverview: (otherOptions?: FetcherOptions) => Promise<GetAnalyticsOverviewResult>;
|
|
10
|
+
getAudience: (days?: number, otherOptions?: FetcherOptions) => Promise<GetAudienceResult>;
|
|
11
|
+
getContentStats: (otherOptions?: FetcherOptions) => Promise<GetContentStatsResult>;
|
|
12
|
+
getExperimentResults: (experimentKey: string, otherOptions?: FetcherOptions) => Promise<GetExperimentResultsResult>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Authenticated `analytics` endpoint bound to an Intlayer CMS authenticator.
|
|
16
|
+
*
|
|
17
|
+
* Pass an authenticator created with `createIntlayerCMS`, or omit it to use
|
|
18
|
+
* the build-time configuration (`@intlayer/config/built`).
|
|
19
|
+
*/
|
|
20
|
+
declare const analyticsEndpoint: CMSEndpoint<{
|
|
21
|
+
sendEvents: (body: IngestAnalyticsBody, otherOptions?: FetcherOptions) => Promise<IngestAnalyticsResult>;
|
|
22
|
+
getOverview: (otherOptions?: FetcherOptions) => Promise<GetAnalyticsOverviewResult>;
|
|
23
|
+
getAudience: (days?: number, otherOptions?: FetcherOptions) => Promise<GetAudienceResult>;
|
|
24
|
+
getContentStats: (otherOptions?: FetcherOptions) => Promise<GetContentStatsResult>;
|
|
25
|
+
getExperimentResults: (experimentKey: string, otherOptions?: FetcherOptions) => Promise<GetExperimentResultsResult>;
|
|
26
|
+
}>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { analyticsEndpoint, getAnalyticsAPI };
|
|
29
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","names":[],"sources":["../../../src/getIntlayerAPI/analytics.ts"],"mappings":";;;;;;cAaa,eAAA,GACX,cAAA,GAAgB,cAAA,EAChB,cAAA,GAAiB,cAAA;qBAaT,mBAAA,EAAmB,YAAA,GACX,cAAA,KAAc,OAAA,CAAA,qBAAA;+BAgBW,cAAA,KAAc,OAAA,CAAA,0BAAA;8CAcH,cAAA,KAAc,OAAA,CAAA,iBAAA;mCAerB,cAAA,KAAc,OAAA,CAAA,qBAAA;gDAcpC,YAAA,GACP,cAAA,KAAc,OAAA,CAAA,0BAAA;AAAA;;;;;;;cAwBnB,iBAAA,EAxBmB,WAAA;qBA7DtB,mBAAA,EAAmB,YAAA,GACX,cAAA,KAAc,OAAA,CAAA,qBAAA;+BAgBW,cAAA,KAAc,OAAA,CAAA,0BAAA;8CAcH,cAAA,KAAc,OAAA,CAAA,iBAAA;mCAerB,cAAA,KAAc,OAAA,CAAA,qBAAA;gDAcpC,YAAA,GACP,cAAA,KAAc,OAAA,CAAA,0BAAA;AAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FetcherOptions } from "../fetcher.js";
|
|
2
|
+
import { getAnalyticsAPI } from "./analytics.js";
|
|
2
3
|
import { getAssetAPI } from "./asset.js";
|
|
3
4
|
import { getAuditAPI } from "./audit.js";
|
|
4
5
|
import { getBitbucketAPI } from "./bitbucket.js";
|
|
@@ -33,6 +34,7 @@ interface IntlayerAPIReturn {
|
|
|
33
34
|
dictionary: ReturnType<typeof getDictionaryAPI>;
|
|
34
35
|
stripe: ReturnType<typeof getStripeAPI>;
|
|
35
36
|
ai: ReturnType<typeof getAiAPI>;
|
|
37
|
+
analytics: ReturnType<typeof getAnalyticsAPI>;
|
|
36
38
|
audit: ReturnType<typeof getAuditAPI>;
|
|
37
39
|
tag: ReturnType<typeof getTagAPI>;
|
|
38
40
|
search: ReturnType<typeof getSearchAPI>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;UA2BU,iBAAA;EACR,KAAA,EAAO,UAAA,QAAkB,WAAA;EACzB,YAAA,EAAc,UAAA,QAAkB,kBAAA;EAChC,OAAA,EAAS,UAAA,QAAkB,aAAA;EAC3B,WAAA,EAAa,UAAA,QAAkB,iBAAA;EAC/B,IAAA,EAAM,UAAA,QAAkB,UAAA;EACxB,KAAA,EAAO,UAAA,QAAkB,WAAA;EACzB,UAAA,EAAY,UAAA,QAAkB,gBAAA;EAC9B,MAAA,EAAQ,UAAA,QAAkB,YAAA;EAC1B,EAAA,EAAI,UAAA,QAAkB,QAAA;EACtB,SAAA,EAAW,UAAA,QAAkB,eAAA;EAC7B,KAAA,EAAO,UAAA,QAAkB,WAAA;EACzB,GAAA,EAAK,UAAA,QAAkB,SAAA;EACvB,MAAA,EAAQ,UAAA,QAAkB,YAAA;EAC1B,MAAA,EAAQ,UAAA,QAAkB,YAAA;EAC1B,UAAA,EAAY,UAAA,QAAkB,gBAAA;EAC9B,MAAA,EAAQ,UAAA,QAAkB,YAAA;EAC1B,MAAA,EAAQ,UAAA,QAAkB,YAAA;EAC1B,SAAA,EAAW,UAAA,QAAkB,eAAA;EAC7B,eAAA,EAAiB,UAAA,QAAkB,qBAAA;EACnC,SAAA,EAAW,UAAA,QAAkB,eAAA;EAC7B,QAAA,EAAU,UAAA,QAAkB,cAAA;EAC5B,MAAA,EAAQ,UAAA,QAAkB,YAAA;AAAA;AAAA,cAGf,cAAA,GACX,cAAA,GAAgB,cAAA,EAChB,cAAA,GAAiB,IAAA,CAAK,cAAA,gBACrB,iBAAA;AAAA,KA+BS,WAAA,GAAc,UAAA,QAAkB,cAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AuthManager, AuthManagerOptions, BindSectionOptions, createAuthManager
|
|
|
3
3
|
import { CMSEndpoint, IntlayerCMS, IntlayerCMSOptions, createEndpoint, createIntlayerCMS } from "./cms/createIntlayerCMS.js";
|
|
4
4
|
import { fetchDistantDictionaries } from "./distantDictionary/fetchDistantDictionaries.js";
|
|
5
5
|
import { fetchDistantDictionary } from "./distantDictionary/fetchDistantDictionary.js";
|
|
6
|
+
import { analyticsEndpoint, getAnalyticsAPI } from "./getIntlayerAPI/analytics.js";
|
|
6
7
|
import { assetEndpoint, getAssetAPI } from "./getIntlayerAPI/asset.js";
|
|
7
8
|
import { AuditEvent, DiscoverUrlsParams, DiscoverUrlsResult, GetRecursiveAuditStatusParams, GetRecursiveAuditStatusResult, RecursiveAuditJobParams, ScanUrlBody, StartRecursiveAuditBody, StartRecursiveAuditResult, auditEndpoint, getAuditAPI } from "./getIntlayerAPI/audit.js";
|
|
8
9
|
import { BitbucketAuthCallbackBody, BitbucketAuthCallbackResult, BitbucketCheckConfigBody, BitbucketCheckConfigResult, BitbucketGetAuthUrlResult, BitbucketGetConfigFileBody, BitbucketGetConfigFileResult, BitbucketListReposResult, BitbucketRepository, bitbucketEndpoint, getBitbucketAPI } from "./getIntlayerAPI/bitbucket.js";
|
|
@@ -27,4 +28,4 @@ import { IntlayerAPI, getIntlayerAPI } from "./getIntlayerAPI/index.js";
|
|
|
27
28
|
import { IntlayerAPIProxy, getIntlayerAPIProxy } from "./proxy.js";
|
|
28
29
|
import { AIOptions } from "./types.js";
|
|
29
30
|
import { AskDocQuestionBody, AskDocQuestionResult, AutocompleteBody, ChatBody, ChatResult, ClientAction, aiEndpoint, getAiAPI } from "./getIntlayerAPI/ai.js";
|
|
30
|
-
export { AIOptions, AskDocQuestionBody, AskDocQuestionResult, AuditEvent, AuthManager, AuthManagerOptions, AutocompleteBody, BindSectionOptions, BitbucketAuthCallbackBody, BitbucketAuthCallbackResult, BitbucketCheckConfigBody, BitbucketCheckConfigResult, BitbucketGetAuthUrlResult, BitbucketGetConfigFileBody, BitbucketGetConfigFileResult, BitbucketListReposResult, BitbucketRepository, CMSEndpoint, ChatBody, ChatResult, ClientAction, DiscoverUrlsParams, DiscoverUrlsResult, FetcherOptions, GetDemoSessionResult, GetRecursiveAuditStatusParams, GetRecursiveAuditStatusResult, GitHubAuthCallbackBody, GitHubAuthCallbackResult, GitHubCheckConfigBody, GitHubCheckConfigResult, GitHubGetAuthUrlResult, GitHubGetConfigFileBody, GitHubGetConfigFileResult, GitHubGetTokenResult, GitHubListReposResult, GitHubRepository, GitLabAuthCallbackBody, GitLabAuthCallbackResult, GitLabCheckConfigBody, GitLabCheckConfigResult, GitLabGetAuthUrlResult, GitLabGetConfigFileBody, GitLabGetConfigFileResult, GitLabListProjectsResult, GitLabProject, IntlayerAPI, IntlayerAPIProxy, IntlayerCMS, IntlayerCMSOptions, OtherShowcaseProjectsQuery, RecursiveAuditJobParams, ScanUrlBody, ShowcaseProjectsQuery, StartRecursiveAuditBody, StartRecursiveAuditResult, TranslateDictionariesBody, TranslateDictionariesResult, aiEndpoint, assetEndpoint, auditEndpoint, bitbucketEndpoint, createAuthManager, createEndpoint, createIntlayerCMS, dictionaryEndpoint, editorEndpoint, environmentEndpoint, fetchDistantDictionaries, fetchDistantDictionary, fetcher, fetcherOptions, getAiAPI, getAssetAPI, getAuditAPI, getBitbucketAPI, getDictionaryAPI, getEditorAPI, getEnvironmentAPI, getGithubAPI, getGitlabAPI, getIntlayerAPI, getIntlayerAPIProxy, getNewsletterAPI, getOAuthAPI, getOrganizationAPI, getProjectAPI, getReviewerAPI, getSearchAPI, getShowcaseProjectAPI, getStatusAPI, getStripeAPI, getTagAPI, getTranslateAPI, getUserAPI, githubEndpoint, gitlabEndpoint, newsletterEndpoint, organizationEndpoint, projectEndpoint, reviewerEndpoint, searchEndpoint, showcaseProjectEndpoint, statusEndpoint, stripeEndpoint, tagEndpoint, translateEndpoint, userEndpoint };
|
|
31
|
+
export { AIOptions, AskDocQuestionBody, AskDocQuestionResult, AuditEvent, AuthManager, AuthManagerOptions, AutocompleteBody, BindSectionOptions, BitbucketAuthCallbackBody, BitbucketAuthCallbackResult, BitbucketCheckConfigBody, BitbucketCheckConfigResult, BitbucketGetAuthUrlResult, BitbucketGetConfigFileBody, BitbucketGetConfigFileResult, BitbucketListReposResult, BitbucketRepository, CMSEndpoint, ChatBody, ChatResult, ClientAction, DiscoverUrlsParams, DiscoverUrlsResult, FetcherOptions, GetDemoSessionResult, GetRecursiveAuditStatusParams, GetRecursiveAuditStatusResult, GitHubAuthCallbackBody, GitHubAuthCallbackResult, GitHubCheckConfigBody, GitHubCheckConfigResult, GitHubGetAuthUrlResult, GitHubGetConfigFileBody, GitHubGetConfigFileResult, GitHubGetTokenResult, GitHubListReposResult, GitHubRepository, GitLabAuthCallbackBody, GitLabAuthCallbackResult, GitLabCheckConfigBody, GitLabCheckConfigResult, GitLabGetAuthUrlResult, GitLabGetConfigFileBody, GitLabGetConfigFileResult, GitLabListProjectsResult, GitLabProject, IntlayerAPI, IntlayerAPIProxy, IntlayerCMS, IntlayerCMSOptions, OtherShowcaseProjectsQuery, RecursiveAuditJobParams, ScanUrlBody, ShowcaseProjectsQuery, StartRecursiveAuditBody, StartRecursiveAuditResult, TranslateDictionariesBody, TranslateDictionariesResult, aiEndpoint, analyticsEndpoint, assetEndpoint, auditEndpoint, bitbucketEndpoint, createAuthManager, createEndpoint, createIntlayerCMS, dictionaryEndpoint, editorEndpoint, environmentEndpoint, fetchDistantDictionaries, fetchDistantDictionary, fetcher, fetcherOptions, getAiAPI, getAnalyticsAPI, getAssetAPI, getAuditAPI, getBitbucketAPI, getDictionaryAPI, getEditorAPI, getEnvironmentAPI, getGithubAPI, getGitlabAPI, getIntlayerAPI, getIntlayerAPIProxy, getNewsletterAPI, getOAuthAPI, getOrganizationAPI, getProjectAPI, getReviewerAPI, getSearchAPI, getShowcaseProjectAPI, getStatusAPI, getStripeAPI, getTagAPI, getTranslateAPI, getUserAPI, githubEndpoint, gitlabEndpoint, newsletterEndpoint, organizationEndpoint, projectEndpoint, reviewerEndpoint, searchEndpoint, showcaseProjectEndpoint, statusEndpoint, stripeEndpoint, tagEndpoint, translateEndpoint, userEndpoint };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/proxy.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/proxy.ts"],"mappings":";;;;;;;AAoFA;;;;;;;;cAAa,mBAAA,GACX,eAAA,GAAiB,cAAA,EACjB,cAAA,GAAgB,IAAA,CAAK,cAAA,aACrB,YAAA,cACC,WAAA;;;;;KAiDS,gBAAA,GAAmB,UAAA,QAAkB,mBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/api",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SDK for interacting with the Intlayer API, enabling content auditing, and managing organizations, projects, and users.",
|
|
6
6
|
"keywords": [
|
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
"require": "./dist/cjs/getIntlayerAPI/ai.cjs",
|
|
44
44
|
"import": "./dist/esm/getIntlayerAPI/ai.mjs"
|
|
45
45
|
},
|
|
46
|
+
"./analytics": {
|
|
47
|
+
"types": "./dist/types/getIntlayerAPI/analytics.d.ts",
|
|
48
|
+
"require": "./dist/cjs/getIntlayerAPI/analytics.cjs",
|
|
49
|
+
"import": "./dist/esm/getIntlayerAPI/analytics.mjs"
|
|
50
|
+
},
|
|
46
51
|
"./asset": {
|
|
47
52
|
"types": "./dist/types/getIntlayerAPI/asset.d.ts",
|
|
48
53
|
"require": "./dist/cjs/getIntlayerAPI/asset.cjs",
|
|
@@ -158,6 +163,9 @@
|
|
|
158
163
|
"ai": [
|
|
159
164
|
"./dist/types/getIntlayerAPI/ai.d.ts"
|
|
160
165
|
],
|
|
166
|
+
"analytics": [
|
|
167
|
+
"./dist/types/getIntlayerAPI/analytics.d.ts"
|
|
168
|
+
],
|
|
161
169
|
"audit": [
|
|
162
170
|
"./dist/types/getIntlayerAPI/audit.d.ts"
|
|
163
171
|
],
|
|
@@ -248,8 +256,8 @@
|
|
|
248
256
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
249
257
|
},
|
|
250
258
|
"dependencies": {
|
|
251
|
-
"@intlayer/config": "9.0.0-canary.
|
|
252
|
-
"@intlayer/types": "9.0.0-canary.
|
|
259
|
+
"@intlayer/config": "9.0.0-canary.16",
|
|
260
|
+
"@intlayer/types": "9.0.0-canary.16",
|
|
253
261
|
"defu": "6.1.7"
|
|
254
262
|
},
|
|
255
263
|
"devDependencies": {
|
|
@@ -260,7 +268,7 @@
|
|
|
260
268
|
"rimraf": "6.1.3",
|
|
261
269
|
"tsdown": "0.21.10",
|
|
262
270
|
"typescript": "6.0.3",
|
|
263
|
-
"vitest": "4.1.
|
|
271
|
+
"vitest": "4.1.10"
|
|
264
272
|
},
|
|
265
273
|
"engines": {
|
|
266
274
|
"node": ">=14.18"
|