@intlayer/api 7.0.5 → 7.0.6

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.
@@ -0,0 +1,41 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_fetcher = require('../fetcher.cjs');
3
+ let __intlayer_config_built = require("@intlayer/config/built");
4
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
5
+
6
+ //#region src/getIntlayerAPI/audit.ts
7
+ const getAuditAPI = (authAPIOptions = {}, intlayerConfig) => {
8
+ const backendURL = intlayerConfig?.editor?.backendURL ?? __intlayer_config_built.default?.editor?.backendURL;
9
+ if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
10
+ const AUDIT_API_ROUTE = `${backendURL}/api/audit`;
11
+ /**
12
+ * Creates a new audit in the database.
13
+ * @param audit - Audit data.
14
+ */
15
+ const createAudit = async (audit, otherOptions = {}) => await require_fetcher.fetcher(`${AUDIT_API_ROUTE}`, authAPIOptions, otherOptions, {
16
+ method: "POST",
17
+ body: audit
18
+ });
19
+ /**
20
+ * Retrieves audits for the current user or project.
21
+ * @param params - Query parameters (page, pageSize).
22
+ */
23
+ const getAudits = async (params, otherOptions = {}) => await require_fetcher.fetcher(AUDIT_API_ROUTE, authAPIOptions, otherOptions, {
24
+ cache: "no-store",
25
+ params
26
+ });
27
+ /**
28
+ * Retrieves an audit by its ID.
29
+ * @param auditId - Audit ID.
30
+ */
31
+ const getAuditById = async (auditId, otherOptions = {}) => await require_fetcher.fetcher(`${AUDIT_API_ROUTE}/${String(auditId)}`, authAPIOptions, otherOptions, { cache: "no-store" });
32
+ return {
33
+ createAudit,
34
+ getAudits,
35
+ getAuditById
36
+ };
37
+ };
38
+
39
+ //#endregion
40
+ exports.getAuditAPI = getAuditAPI;
41
+ //# sourceMappingURL=audit.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/audit.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n CreateAuditBody,\n CreateAuditResult,\n GetAuditByIdParams,\n GetAuditByIdResult,\n GetAuditsParams,\n GetAuditsResult,\n} from '../types';\n\nexport const getAuditAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AUDIT_API_ROUTE = `${backendURL}/api/audit`;\n\n /**\n * Creates a new audit in the database.\n * @param audit - Audit data.\n */\n const createAudit = async (\n audit: CreateAuditBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateAuditResult>(\n `${AUDIT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: audit,\n }\n );\n\n /**\n * Retrieves audits for the current user or project.\n * @param params - Query parameters (page, pageSize).\n */\n const getAudits = async (\n params?: GetAuditsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAuditsResult>(\n AUDIT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n /**\n * Retrieves an audit by its ID.\n * @param auditId - Audit ID.\n */\n const getAuditById = async (\n auditId: GetAuditByIdParams['auditId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAuditByIdResult>(\n `${AUDIT_API_ROUTE}/${String(auditId)}`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n return {\n createAudit,\n getAudits,\n getAuditById,\n };\n};\n"],"mappings":";;;;;;AAYA,MAAa,eACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,iCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,kBAAkB,GAAG,WAAW;;;;;CAMtC,MAAM,cAAc,OAClB,OACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,GAAG,mBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,YAAY,OAChB,QACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,iBACA,gBACA,cACA;EACE,OAAO;EAEP;EACD,CACF;;;;;CAMH,MAAM,eAAe,OACnB,SACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,gBAAgB,GAAG,OAAO,QAAQ,IACrC,gBACA,cACA,EACE,OAAO,YACR,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -0,0 +1,39 @@
1
+ import { fetcher } from "../fetcher.mjs";
2
+ import configuration from "@intlayer/config/built";
3
+
4
+ //#region src/getIntlayerAPI/audit.ts
5
+ const getAuditAPI = (authAPIOptions = {}, intlayerConfig) => {
6
+ const backendURL = intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;
7
+ if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
8
+ const AUDIT_API_ROUTE = `${backendURL}/api/audit`;
9
+ /**
10
+ * Creates a new audit in the database.
11
+ * @param audit - Audit data.
12
+ */
13
+ const createAudit = async (audit, otherOptions = {}) => await fetcher(`${AUDIT_API_ROUTE}`, authAPIOptions, otherOptions, {
14
+ method: "POST",
15
+ body: audit
16
+ });
17
+ /**
18
+ * Retrieves audits for the current user or project.
19
+ * @param params - Query parameters (page, pageSize).
20
+ */
21
+ const getAudits = async (params, otherOptions = {}) => await fetcher(AUDIT_API_ROUTE, authAPIOptions, otherOptions, {
22
+ cache: "no-store",
23
+ params
24
+ });
25
+ /**
26
+ * Retrieves an audit by its ID.
27
+ * @param auditId - Audit ID.
28
+ */
29
+ const getAuditById = async (auditId, otherOptions = {}) => await fetcher(`${AUDIT_API_ROUTE}/${String(auditId)}`, authAPIOptions, otherOptions, { cache: "no-store" });
30
+ return {
31
+ createAudit,
32
+ getAudits,
33
+ getAuditById
34
+ };
35
+ };
36
+
37
+ //#endregion
38
+ export { getAuditAPI };
39
+ //# sourceMappingURL=audit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.mjs","names":[],"sources":["../../../src/getIntlayerAPI/audit.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n CreateAuditBody,\n CreateAuditResult,\n GetAuditByIdParams,\n GetAuditByIdResult,\n GetAuditsParams,\n GetAuditsResult,\n} from '../types';\n\nexport const getAuditAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AUDIT_API_ROUTE = `${backendURL}/api/audit`;\n\n /**\n * Creates a new audit in the database.\n * @param audit - Audit data.\n */\n const createAudit = async (\n audit: CreateAuditBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateAuditResult>(\n `${AUDIT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: audit,\n }\n );\n\n /**\n * Retrieves audits for the current user or project.\n * @param params - Query parameters (page, pageSize).\n */\n const getAudits = async (\n params?: GetAuditsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAuditsResult>(\n AUDIT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params,\n }\n );\n\n /**\n * Retrieves an audit by its ID.\n * @param auditId - Audit ID.\n */\n const getAuditById = async (\n auditId: GetAuditByIdParams['auditId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetAuditByIdResult>(\n `${AUDIT_API_ROUTE}/${String(auditId)}`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n return {\n createAudit,\n getAudits,\n getAuditById,\n };\n};\n"],"mappings":";;;;AAYA,MAAa,eACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,kBAAkB,GAAG,WAAW;;;;;CAMtC,MAAM,cAAc,OAClB,OACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,mBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,YAAY,OAChB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,iBACA,gBACA,cACA;EACE,OAAO;EAEP;EACD,CACF;;;;;CAMH,MAAM,eAAe,OACnB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,gBAAgB,GAAG,OAAO,QAAQ,IACrC,gBACA,cACA,EACE,OAAO,YACR,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -0,0 +1,13 @@
1
+ import { CreateAuditBody, GetAuditByIdParams, GetAuditsParams } from "../types.js";
2
+ import { FetcherOptions } from "../fetcher.js";
3
+ import { IntlayerConfig } from "@intlayer/types";
4
+
5
+ //#region src/getIntlayerAPI/audit.d.ts
6
+ declare const getAuditAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
7
+ createAudit: (audit: CreateAuditBody, otherOptions?: FetcherOptions) => Promise<CreateAuditResult>;
8
+ getAudits: (params?: GetAuditsParams, otherOptions?: FetcherOptions) => Promise<GetAuditsResult>;
9
+ getAuditById: (auditId: GetAuditByIdParams["auditId"], otherOptions?: FetcherOptions) => Promise<GetAuditByIdResult>;
10
+ };
11
+ //#endregion
12
+ export { getAuditAPI };
13
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","names":[],"sources":["../../../src/getIntlayerAPI/audit.ts"],"sourcesContent":[],"mappings":";;;;;cAYa,+BACK,iCACC;uBAkBR,gCACO,mBAAc,QAAA;EArBnB,SAAA,EAAA,CAAA,MA0EZ,CAAA,EApCY,eAoCZ,EAAA,YAAA,CAAA,EAnCiB,cAmCjB,EAAA,GAnC+B,OAmC/B,CAnC+B,eAmC/B,CAAA;EAzEiB,YAAA,EAAA,CAAA,OAAA,EAwDL,kBAxDK,CAAA,SAAA,CAAA,EAAA,YAAA,CAAA,EAyDA,cAzDA,EAAA,GAyDc,OAzDd,CAyDc,kBAzDd,CAAA;CACC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/api",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
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": [
@@ -69,23 +69,23 @@
69
69
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
70
70
  },
71
71
  "dependencies": {
72
- "@intlayer/config": "7.0.5"
72
+ "@intlayer/config": "7.0.6"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "24.9.2",
76
- "@utils/ts-config": "7.0.5",
77
- "@utils/ts-config-types": "7.0.5",
78
- "@utils/tsdown-config": "7.0.5",
76
+ "@utils/ts-config": "7.0.6",
77
+ "@utils/ts-config-types": "7.0.6",
78
+ "@utils/tsdown-config": "7.0.6",
79
79
  "rimraf": "6.0.1",
80
80
  "tsdown": "0.15.11",
81
81
  "typescript": "5.9.3",
82
82
  "vitest": "4.0.5"
83
83
  },
84
84
  "peerDependencies": {
85
- "@intlayer/backend": "7.0.5",
86
- "@intlayer/config": "7.0.5",
87
- "@intlayer/types": "7.0.5",
88
- "intlayer-editor": "7.0.5"
85
+ "@intlayer/backend": "7.0.6",
86
+ "@intlayer/config": "7.0.6",
87
+ "@intlayer/types": "7.0.6",
88
+ "intlayer-editor": "7.0.6"
89
89
  },
90
90
  "peerDependenciesMeta": {
91
91
  "@intlayer/backend": {