@intlayer/api 6.1.6-canary.0 → 7.0.0-canary.0

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.
Files changed (117) hide show
  1. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  2. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +18 -55
  3. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
  4. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +20 -58
  5. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
  6. package/dist/cjs/distantDictionary/index.cjs +5 -25
  7. package/dist/cjs/fetcher.cjs +113 -89
  8. package/dist/cjs/fetcher.cjs.map +1 -1
  9. package/dist/cjs/getIntlayerAPI/ai.cjs +163 -188
  10. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  11. package/dist/cjs/getIntlayerAPI/dictionary.cjs +69 -117
  12. package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
  13. package/dist/cjs/getIntlayerAPI/editor.cjs +37 -74
  14. package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
  15. package/dist/cjs/getIntlayerAPI/index.cjs +27 -49
  16. package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAPI/newsletter.cjs +40 -77
  18. package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
  19. package/dist/cjs/getIntlayerAPI/oAuth.cjs +26 -65
  20. package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
  21. package/dist/cjs/getIntlayerAPI/organization.cjs +93 -130
  22. package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
  23. package/dist/cjs/getIntlayerAPI/project.cjs +109 -154
  24. package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
  25. package/dist/cjs/getIntlayerAPI/search.cjs +22 -58
  26. package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
  27. package/dist/cjs/getIntlayerAPI/stripe.cjs +38 -77
  28. package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
  29. package/dist/cjs/getIntlayerAPI/tag.cjs +47 -86
  30. package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
  31. package/dist/cjs/getIntlayerAPI/user.cjs +79 -106
  32. package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
  33. package/dist/cjs/index.cjs +30 -49
  34. package/dist/cjs/proxy.cjs +90 -115
  35. package/dist/cjs/proxy.cjs.map +1 -1
  36. package/dist/cjs/types.cjs +0 -17
  37. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +17 -20
  38. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
  39. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +19 -23
  40. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
  41. package/dist/esm/distantDictionary/index.mjs +4 -3
  42. package/dist/esm/fetcher.mjs +111 -64
  43. package/dist/esm/fetcher.mjs.map +1 -1
  44. package/dist/esm/getIntlayerAPI/ai.mjs +160 -153
  45. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  46. package/dist/esm/getIntlayerAPI/dictionary.mjs +66 -82
  47. package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
  48. package/dist/esm/getIntlayerAPI/editor.mjs +34 -39
  49. package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
  50. package/dist/esm/getIntlayerAPI/index.mjs +16 -14
  51. package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
  52. package/dist/esm/getIntlayerAPI/newsletter.mjs +37 -42
  53. package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
  54. package/dist/esm/getIntlayerAPI/oAuth.mjs +23 -30
  55. package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
  56. package/dist/esm/getIntlayerAPI/organization.mjs +90 -95
  57. package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
  58. package/dist/esm/getIntlayerAPI/project.mjs +106 -119
  59. package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
  60. package/dist/esm/getIntlayerAPI/search.mjs +19 -23
  61. package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
  62. package/dist/esm/getIntlayerAPI/stripe.mjs +35 -42
  63. package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
  64. package/dist/esm/getIntlayerAPI/tag.mjs +44 -51
  65. package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
  66. package/dist/esm/getIntlayerAPI/user.mjs +76 -71
  67. package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
  68. package/dist/esm/index.mjs +16 -15
  69. package/dist/esm/proxy.mjs +89 -90
  70. package/dist/esm/proxy.mjs.map +1 -1
  71. package/dist/esm/types.mjs +0 -1
  72. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +8 -3
  73. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
  74. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +8 -3
  75. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
  76. package/dist/types/distantDictionary/index.d.ts +3 -3
  77. package/dist/types/fetcher.d.ts +14 -11
  78. package/dist/types/fetcher.d.ts.map +1 -1
  79. package/dist/types/getIntlayerAPI/ai.d.ts +22 -18
  80. package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
  81. package/dist/types/getIntlayerAPI/dictionary.d.ts +16 -12
  82. package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
  83. package/dist/types/getIntlayerAPI/editor.d.ts +11 -7
  84. package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
  85. package/dist/types/getIntlayerAPI/index.d.ts +30 -27
  86. package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
  87. package/dist/types/getIntlayerAPI/newsletter.d.ts +11 -7
  88. package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
  89. package/dist/types/getIntlayerAPI/oAuth.d.ts +8 -5
  90. package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
  91. package/dist/types/getIntlayerAPI/organization.d.ts +18 -13
  92. package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
  93. package/dist/types/getIntlayerAPI/project.d.ts +19 -15
  94. package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
  95. package/dist/types/getIntlayerAPI/search.d.ts +9 -5
  96. package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
  97. package/dist/types/getIntlayerAPI/stripe.d.ts +11 -7
  98. package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
  99. package/dist/types/getIntlayerAPI/tag.d.ts +12 -8
  100. package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
  101. package/dist/types/getIntlayerAPI/user.d.ts +16 -12
  102. package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
  103. package/dist/types/index.d.ts +16 -15
  104. package/dist/types/proxy.d.ts +10 -5
  105. package/dist/types/proxy.d.ts.map +1 -1
  106. package/dist/types/types.d.ts +13 -12
  107. package/dist/types/types.d.ts.map +1 -1
  108. package/package.json +29 -38
  109. package/LICENSE +0 -202
  110. package/dist/cjs/distantDictionary/index.cjs.map +0 -1
  111. package/dist/cjs/index.cjs.map +0 -1
  112. package/dist/cjs/types.cjs.map +0 -1
  113. package/dist/esm/distantDictionary/index.mjs.map +0 -1
  114. package/dist/esm/index.mjs.map +0 -1
  115. package/dist/esm/types.mjs.map +0 -1
  116. package/dist/types/distantDictionary/index.d.ts.map +0 -1
  117. package/dist/types/index.d.ts.map +0 -1
@@ -1,77 +1,40 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var editor_exports = {};
30
- __export(editor_exports, {
31
- getEditorAPI: () => getEditorAPI
32
- });
33
- module.exports = __toCommonJS(editor_exports);
34
- var import_built = __toESM(require("@intlayer/config/built"));
35
- var import_fetcher = require('../fetcher.cjs');
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/editor.ts
36
7
  const getEditorAPI = (authAPIOptions = {}, intlayerConfig) => {
37
- const editorURL = intlayerConfig?.editor?.editorURL ?? import_built.default.editor?.editorURL;
38
- if (!editorURL) {
39
- throw new Error("Editor URL is not defined in the Intlayer configuration.");
40
- }
41
- const EDITOR_API_ROUTE = `${editorURL}/api`;
42
- const getConfiguration = async (otherOptions = {}) => {
43
- const response = await (0, import_fetcher.fetcher)(
44
- `${EDITOR_API_ROUTE}/config`,
45
- authAPIOptions,
46
- otherOptions
47
- );
48
- return response.data;
49
- };
50
- const getDictionaries = async (otherOptions = {}) => {
51
- const response = await (0, import_fetcher.fetcher)(
52
- `${EDITOR_API_ROUTE}/dictionary`,
53
- authAPIOptions,
54
- otherOptions
55
- );
56
- return response.data;
57
- };
58
- const writeDictionary = async (body, otherOptions = {}) => await (0, import_fetcher.fetcher)(
59
- `${EDITOR_API_ROUTE}/dictionary`,
60
- authAPIOptions,
61
- otherOptions,
62
- {
63
- method: "POST",
64
- body
65
- }
66
- );
67
- return {
68
- getDictionaries,
69
- getConfiguration,
70
- writeDictionary
71
- };
8
+ const editorURL = intlayerConfig?.editor?.editorURL ?? __intlayer_config_built.default?.editor?.editorURL;
9
+ if (!editorURL) throw new Error("Editor URL is not defined in the Intlayer configuration.");
10
+ const EDITOR_API_ROUTE = `${editorURL}/api`;
11
+ /**
12
+ * Get the Intlayer configuration
13
+ */
14
+ const getConfiguration = async (otherOptions = {}) => {
15
+ return (await require_fetcher.fetcher(`${EDITOR_API_ROUTE}/config`, authAPIOptions, otherOptions)).data;
16
+ };
17
+ /**
18
+ * Get the Intlayer configuration
19
+ */
20
+ const getDictionaries = async (otherOptions = {}) => {
21
+ return (await require_fetcher.fetcher(`${EDITOR_API_ROUTE}/dictionary`, authAPIOptions, otherOptions)).data;
22
+ };
23
+ /**
24
+ * Adds a new dictionary to the database.
25
+ * @param dictionary - Dictionary data.
26
+ */
27
+ const writeDictionary = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${EDITOR_API_ROUTE}/dictionary`, authAPIOptions, otherOptions, {
28
+ method: "POST",
29
+ body
30
+ });
31
+ return {
32
+ getDictionaries,
33
+ getConfiguration,
34
+ writeDictionary
35
+ };
72
36
  };
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- getEditorAPI
76
- });
37
+
38
+ //#endregion
39
+ exports.getEditorAPI = getEditorAPI;
77
40
  //# sourceMappingURL=editor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from '../fetcher';\nimport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from '../types';\n\nexport const getEditorAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const editorURL =\n intlayerConfig?.editor?.editorURL ?? configuration.editor?.editorURL;\n\n if (!editorURL) {\n throw new Error('Editor URL is not defined in the Intlayer configuration.');\n }\n\n const EDITOR_API_ROUTE = `${editorURL}/api`;\n\n /**\n * Get the Intlayer configuration\n */\n const getConfiguration = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetConfigurationResult> => {\n const response = await fetcher<GetConfigurationResult>(\n `${EDITOR_API_ROUTE}/config`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetConfigurationResult;\n };\n\n /**\n * Get the Intlayer configuration\n */\n const getDictionaries = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetEditorDictionariesResult> => {\n const response = await fetcher<GetEditorDictionariesResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetEditorDictionariesResult;\n };\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const writeDictionary = async (\n body: WriteContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<WriteContentDeclarationResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getDictionaries,\n getConfiguration,\n writeDictionary,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,qBAA6C;AAQtC,MAAM,eAAe,CAC1B,iBAAiC,CAAC,GAClC,mBACG;AACH,QAAM,YACJ,gBAAgB,QAAQ,aAAa,aAAAA,QAAc,QAAQ;AAE7D,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AAEA,QAAM,mBAAmB,GAAG,SAAS;AAKrC,QAAM,mBAAmB,OACvB,eAA+B,CAAC,MACI;AACpC,UAAM,WAAW,UAAM;AAAA,MACrB,GAAG,gBAAgB;AAAA,MACnB;AAAA,MACA;AAAA,IACF;AAEA,WAAO,SAAS;AAAA,EAClB;AAKA,QAAM,kBAAkB,OACtB,eAA+B,CAAC,MACS;AACzC,UAAM,WAAW,UAAM;AAAA,MACrB,GAAG,gBAAgB;AAAA,MACnB;AAAA,MACA;AAAA,IACF;AAEA,WAAO,SAAS;AAAA,EAClB;AAMA,QAAM,kBAAkB,OACtB,MACA,eAA+B,CAAC,MAEhC,UAAM;AAAA,IACJ,GAAG,gBAAgB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["configuration"]}
1
+ {"version":3,"file":"editor.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from '../types';\n\nexport const getEditorAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const editorURL =\n intlayerConfig?.editor?.editorURL ?? configuration?.editor?.editorURL;\n\n if (!editorURL) {\n throw new Error('Editor URL is not defined in the Intlayer configuration.');\n }\n\n const EDITOR_API_ROUTE = `${editorURL}/api`;\n\n /**\n * Get the Intlayer configuration\n */\n const getConfiguration = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetConfigurationResult> => {\n const response = await fetcher<GetConfigurationResult>(\n `${EDITOR_API_ROUTE}/config`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetConfigurationResult;\n };\n\n /**\n * Get the Intlayer configuration\n */\n const getDictionaries = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetEditorDictionariesResult> => {\n const response = await fetcher<GetEditorDictionariesResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetEditorDictionariesResult;\n };\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const writeDictionary = async (\n body: WriteContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<WriteContentDeclarationResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getDictionaries,\n getConfiguration,\n writeDictionary,\n };\n};\n"],"mappings":";;;;;;AAUA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,YACJ,gBAAgB,QAAQ,aAAaA,iCAAe,QAAQ;AAE9D,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,2DAA2D;CAG7E,MAAM,mBAAmB,GAAG,UAAU;;;;CAKtC,MAAM,mBAAmB,OACvB,eAA+B,EAAE,KACG;AAOpC,UANiB,MAAMC,wBACrB,GAAG,iBAAiB,UACpB,gBACA,aACD,EAEe;;;;;CAMlB,MAAM,kBAAkB,OACtB,eAA+B,EAAE,KACQ;AAOzC,UANiB,MAAMA,wBACrB,GAAG,iBAAiB,cACpB,gBACA,aACD,EAEe;;;;;;CAOlB,MAAM,kBAAkB,OACtB,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,iBAAiB,cACpB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -1,52 +1,30 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var getIntlayerAPI_exports = {};
20
- __export(getIntlayerAPI_exports, {
21
- getIntlayerAPI: () => getIntlayerAPI
22
- });
23
- module.exports = __toCommonJS(getIntlayerAPI_exports);
24
- var import_ai = require('./ai.cjs');
25
- var import_dictionary = require('./dictionary.cjs');
26
- var import_editor = require('./editor.cjs');
27
- var import_newsletter = require('./newsletter.cjs');
28
- var import_oAuth = require('./oAuth.cjs');
29
- var import_organization = require('./organization.cjs');
30
- var import_project = require('./project.cjs');
31
- var import_search = require('./search.cjs');
32
- var import_stripe = require('./stripe.cjs');
33
- var import_tag = require('./tag.cjs');
34
- var import_user = require('./user.cjs');
1
+ const require_getIntlayerAPI_ai = require('./ai.cjs');
2
+ const require_getIntlayerAPI_dictionary = require('./dictionary.cjs');
3
+ const require_getIntlayerAPI_editor = require('./editor.cjs');
4
+ const require_getIntlayerAPI_newsletter = require('./newsletter.cjs');
5
+ const require_getIntlayerAPI_oAuth = require('./oAuth.cjs');
6
+ const require_getIntlayerAPI_organization = require('./organization.cjs');
7
+ const require_getIntlayerAPI_project = require('./project.cjs');
8
+ const require_getIntlayerAPI_search = require('./search.cjs');
9
+ const require_getIntlayerAPI_stripe = require('./stripe.cjs');
10
+ const require_getIntlayerAPI_tag = require('./tag.cjs');
11
+ const require_getIntlayerAPI_user = require('./user.cjs');
12
+
13
+ //#region src/getIntlayerAPI/index.ts
35
14
  const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => ({
36
- organization: (0, import_organization.getOrganizationAPI)(authAPIOptions, intlayerConfig),
37
- project: (0, import_project.getProjectAPI)(authAPIOptions, intlayerConfig),
38
- user: (0, import_user.getUserAPI)(authAPIOptions, intlayerConfig),
39
- oAuth: (0, import_oAuth.getOAuthAPI)(intlayerConfig),
40
- dictionary: (0, import_dictionary.getDictionaryAPI)(authAPIOptions, intlayerConfig),
41
- stripe: (0, import_stripe.getStripeAPI)(authAPIOptions, intlayerConfig),
42
- ai: (0, import_ai.getAiAPI)(authAPIOptions, intlayerConfig),
43
- tag: (0, import_tag.getTagAPI)(authAPIOptions, intlayerConfig),
44
- search: (0, import_search.getSearchAPI)(authAPIOptions, intlayerConfig),
45
- editor: (0, import_editor.getEditorAPI)(authAPIOptions, intlayerConfig),
46
- newsletter: (0, import_newsletter.getNewsletterAPI)(authAPIOptions, intlayerConfig)
47
- });
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- getIntlayerAPI
15
+ organization: require_getIntlayerAPI_organization.getOrganizationAPI(authAPIOptions, intlayerConfig),
16
+ project: require_getIntlayerAPI_project.getProjectAPI(authAPIOptions, intlayerConfig),
17
+ user: require_getIntlayerAPI_user.getUserAPI(authAPIOptions, intlayerConfig),
18
+ oAuth: require_getIntlayerAPI_oAuth.getOAuthAPI(intlayerConfig),
19
+ dictionary: require_getIntlayerAPI_dictionary.getDictionaryAPI(authAPIOptions, intlayerConfig),
20
+ stripe: require_getIntlayerAPI_stripe.getStripeAPI(authAPIOptions, intlayerConfig),
21
+ ai: require_getIntlayerAPI_ai.getAiAPI(authAPIOptions, intlayerConfig),
22
+ tag: require_getIntlayerAPI_tag.getTagAPI(authAPIOptions, intlayerConfig),
23
+ search: require_getIntlayerAPI_search.getSearchAPI(authAPIOptions, intlayerConfig),
24
+ editor: require_getIntlayerAPI_editor.getEditorAPI(authAPIOptions, intlayerConfig),
25
+ newsletter: require_getIntlayerAPI_newsletter.getNewsletterAPI(authAPIOptions, intlayerConfig)
51
26
  });
27
+
28
+ //#endregion
29
+ exports.getIntlayerAPI = getIntlayerAPI;
52
30
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/config/client';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getSearchAPI } from './search';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPIReturn => ({\n organization: getOrganizationAPI(authAPIOptions, intlayerConfig),\n project: getProjectAPI(authAPIOptions, intlayerConfig),\n user: getUserAPI(authAPIOptions, intlayerConfig),\n oAuth: getOAuthAPI(intlayerConfig),\n dictionary: getDictionaryAPI(authAPIOptions, intlayerConfig),\n stripe: getStripeAPI(authAPIOptions, intlayerConfig),\n ai: getAiAPI(authAPIOptions, intlayerConfig),\n tag: getTagAPI(authAPIOptions, intlayerConfig),\n search: getSearchAPI(authAPIOptions, intlayerConfig),\n editor: getEditorAPI(authAPIOptions, intlayerConfig),\n newsletter: getNewsletterAPI(authAPIOptions, intlayerConfig),\n});\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gBAAyB;AACzB,wBAAiC;AACjC,oBAA6B;AAC7B,wBAAiC;AACjC,mBAA4B;AAC5B,0BAAmC;AACnC,qBAA8B;AAC9B,oBAA6B;AAC7B,oBAA6B;AAC7B,iBAA0B;AAC1B,kBAA2B;AAgBpB,MAAM,iBAAiB,CAC5B,iBAAiC,CAAC,GAClC,oBACuB;AAAA,EACvB,kBAAc,wCAAmB,gBAAgB,cAAc;AAAA,EAC/D,aAAS,8BAAc,gBAAgB,cAAc;AAAA,EACrD,UAAM,wBAAW,gBAAgB,cAAc;AAAA,EAC/C,WAAO,0BAAY,cAAc;AAAA,EACjC,gBAAY,oCAAiB,gBAAgB,cAAc;AAAA,EAC3D,YAAQ,4BAAa,gBAAgB,cAAc;AAAA,EACnD,QAAI,oBAAS,gBAAgB,cAAc;AAAA,EAC3C,SAAK,sBAAU,gBAAgB,cAAc;AAAA,EAC7C,YAAQ,4BAAa,gBAAgB,cAAc;AAAA,EACnD,YAAQ,4BAAa,gBAAgB,cAAc;AAAA,EACnD,gBAAY,oCAAiB,gBAAgB,cAAc;AAC7D;","names":[]}
1
+ {"version":3,"file":"index.cjs","names":["getOrganizationAPI","getProjectAPI","getUserAPI","getOAuthAPI","getDictionaryAPI","getStripeAPI","getAiAPI","getTagAPI","getSearchAPI","getEditorAPI","getNewsletterAPI"],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getSearchAPI } from './search';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPIReturn => ({\n organization: getOrganizationAPI(authAPIOptions, intlayerConfig),\n project: getProjectAPI(authAPIOptions, intlayerConfig),\n user: getUserAPI(authAPIOptions, intlayerConfig),\n oAuth: getOAuthAPI(intlayerConfig),\n dictionary: getDictionaryAPI(authAPIOptions, intlayerConfig),\n stripe: getStripeAPI(authAPIOptions, intlayerConfig),\n ai: getAiAPI(authAPIOptions, intlayerConfig),\n tag: getTagAPI(authAPIOptions, intlayerConfig),\n search: getSearchAPI(authAPIOptions, intlayerConfig),\n editor: getEditorAPI(authAPIOptions, intlayerConfig),\n newsletter: getNewsletterAPI(authAPIOptions, intlayerConfig),\n});\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;AA4BA,MAAa,kBACX,iBAAiC,EAAE,EACnC,oBACuB;CACvB,cAAcA,uDAAmB,gBAAgB,eAAe;CAChE,SAASC,6CAAc,gBAAgB,eAAe;CACtD,MAAMC,uCAAW,gBAAgB,eAAe;CAChD,OAAOC,yCAAY,eAAe;CAClC,YAAYC,mDAAiB,gBAAgB,eAAe;CAC5D,QAAQC,2CAAa,gBAAgB,eAAe;CACpD,IAAIC,mCAAS,gBAAgB,eAAe;CAC5C,KAAKC,qCAAU,gBAAgB,eAAe;CAC9C,QAAQC,2CAAa,gBAAgB,eAAe;CACpD,QAAQC,2CAAa,gBAAgB,eAAe;CACpD,YAAYC,mDAAiB,gBAAgB,eAAe;CAC7D"}
@@ -1,80 +1,43 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var newsletter_exports = {};
30
- __export(newsletter_exports, {
31
- getNewsletterAPI: () => getNewsletterAPI
32
- });
33
- module.exports = __toCommonJS(newsletter_exports);
34
- var import_built = __toESM(require("@intlayer/config/built"));
35
- var import_fetcher = require('../fetcher.cjs');
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/newsletter.ts
36
7
  const getNewsletterAPI = (authAPIOptions = {}, intlayerConfig) => {
37
- const backendURL = intlayerConfig?.editor?.backendURL ?? import_built.default.editor?.backendURL;
38
- if (!backendURL) {
39
- throw new Error(
40
- "Backend URL is not defined in the Intlayer configuration."
41
- );
42
- }
43
- const NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;
44
- const subscribeToNewsletter = async (body, otherOptions = {}) => await (0, import_fetcher.fetcher)(
45
- `${NEWSLETTER_API_ROUTE}/subscribe`,
46
- authAPIOptions,
47
- otherOptions,
48
- {
49
- method: "POST",
50
- body
51
- }
52
- );
53
- const unsubscribeFromNewsletter = async (body, otherOptions = {}) => await (0, import_fetcher.fetcher)(
54
- `${NEWSLETTER_API_ROUTE}/unsubscribe`,
55
- authAPIOptions,
56
- otherOptions,
57
- {
58
- method: "POST",
59
- body
60
- }
61
- );
62
- const getNewsletterStatus = async (otherOptions = {}) => await (0, import_fetcher.fetcher)(
63
- `${NEWSLETTER_API_ROUTE}/status`,
64
- authAPIOptions,
65
- otherOptions,
66
- {
67
- method: "GET"
68
- }
69
- );
70
- return {
71
- subscribeToNewsletter,
72
- unsubscribeFromNewsletter,
73
- getNewsletterStatus
74
- };
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 NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;
11
+ /**
12
+ * Subscribe a user to newsletter(s)
13
+ * @param body - Newsletter subscription parameters.
14
+ * @returns Newsletter subscription result.
15
+ */
16
+ const subscribeToNewsletter = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${NEWSLETTER_API_ROUTE}/subscribe`, authAPIOptions, otherOptions, {
17
+ method: "POST",
18
+ body
19
+ });
20
+ /**
21
+ * Unsubscribe a user from newsletter(s)
22
+ * @param body - Newsletter unsubscription parameters.
23
+ * @returns Newsletter unsubscription result.
24
+ */
25
+ const unsubscribeFromNewsletter = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${NEWSLETTER_API_ROUTE}/unsubscribe`, authAPIOptions, otherOptions, {
26
+ method: "POST",
27
+ body
28
+ });
29
+ /**
30
+ * Get newsletter subscription status for the authenticated user
31
+ * @returns Newsletter subscription status.
32
+ */
33
+ const getNewsletterStatus = async (otherOptions = {}) => await require_fetcher.fetcher(`${NEWSLETTER_API_ROUTE}/status`, authAPIOptions, otherOptions, { method: "GET" });
34
+ return {
35
+ subscribeToNewsletter,
36
+ unsubscribeFromNewsletter,
37
+ getNewsletterStatus
38
+ };
75
39
  };
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- getNewsletterAPI
79
- });
40
+
41
+ //#endregion
42
+ exports.getNewsletterAPI = getNewsletterAPI;
80
43
  //# sourceMappingURL=newsletter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from '../fetcher';\nimport type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '../types';\n\nexport const getNewsletterAPI = (\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 NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;\n\n /**\n * Subscribe a user to newsletter(s)\n * @param body - Newsletter subscription parameters.\n * @returns Newsletter subscription result.\n */\n const subscribeToNewsletter = async (\n body: NewsletterSubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/subscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Unsubscribe a user from newsletter(s)\n * @param body - Newsletter unsubscription parameters.\n * @returns Newsletter unsubscription result.\n */\n const unsubscribeFromNewsletter = async (\n body: NewsletterUnsubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/unsubscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Get newsletter subscription status for the authenticated user\n * @returns Newsletter subscription status.\n */\n const getNewsletterStatus = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/status`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n return {\n subscribeToNewsletter,\n unsubscribeFromNewsletter,\n getNewsletterStatus,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,qBAA6C;AAOtC,MAAM,mBAAmB,CAC9B,iBAAiC,CAAC,GAClC,mBACG;AACH,QAAM,aACJ,gBAAgB,QAAQ,cAAc,aAAAA,QAAc,QAAQ;AAE9D,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,uBAAuB,GAAG,UAAU;AAO1C,QAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,UAAM;AAAA,IACJ,GAAG,oBAAoB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAOF,QAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,UAAM;AAAA,IACJ,GAAG,oBAAoB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAMF,QAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,UAAM;AAAA,IACJ,GAAG,oBAAoB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AAEF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["configuration"]}
1
+ {"version":3,"file":"newsletter.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '../types';\n\nexport const getNewsletterAPI = (\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 NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;\n\n /**\n * Subscribe a user to newsletter(s)\n * @param body - Newsletter subscription parameters.\n * @returns Newsletter subscription result.\n */\n const subscribeToNewsletter = async (\n body: NewsletterSubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/subscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Unsubscribe a user from newsletter(s)\n * @param body - Newsletter unsubscription parameters.\n * @returns Newsletter unsubscription result.\n */\n const unsubscribeFromNewsletter = async (\n body: NewsletterUnsubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/unsubscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Get newsletter subscription status for the authenticated user\n * @returns Newsletter subscription status.\n */\n const getNewsletterStatus = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/status`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n return {\n subscribeToNewsletter,\n unsubscribeFromNewsletter,\n getNewsletterStatus,\n };\n};\n"],"mappings":";;;;;;AASA,MAAa,oBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,iCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,uBAAuB,GAAG,WAAW;;;;;;CAO3C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,GAAG,qBAAqB,aACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,qBAAqB,eACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;CAMH,MAAM,sBAAsB,OAAO,eAA+B,EAAE,KAClE,MAAMA,wBACJ,GAAG,qBAAqB,UACxB,gBACA,cACA,EACE,QAAQ,OACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -1,68 +1,29 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var oAuth_exports = {};
30
- __export(oAuth_exports, {
31
- getOAuthAPI: () => getOAuthAPI
32
- });
33
- module.exports = __toCommonJS(oAuth_exports);
34
- var import_built = __toESM(require("@intlayer/config/built"));
35
- var import_fetcher = require('../fetcher.cjs');
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/oAuth.ts
36
7
  const getOAuthAPI = (intlayerConfig) => {
37
- const backendURL = intlayerConfig?.editor?.backendURL ?? import_built.default.editor?.backendURL;
38
- const { clientId, clientSecret } = intlayerConfig?.editor ?? {};
39
- if (!backendURL) {
40
- throw new Error(
41
- "Backend URL is not defined in the Intlayer configuration."
42
- );
43
- }
44
- const getOAuth2AccessToken = async (otherOptions = {}) => await (0, import_fetcher.fetcher)(
45
- `${backendURL}/oauth2/token`,
46
- {},
47
- otherOptions,
48
- {
49
- method: "POST",
50
- headers: {
51
- "Content-Type": "application/x-www-form-urlencoded"
52
- },
53
- body: {
54
- grant_type: "client_credentials",
55
- client_id: clientId,
56
- client_secret: clientSecret
57
- }
58
- }
59
- );
60
- return {
61
- getOAuth2AccessToken
62
- };
8
+ const backendURL = intlayerConfig?.editor?.backendURL ?? __intlayer_config_built.default?.editor?.backendURL;
9
+ const { clientId, clientSecret } = intlayerConfig?.editor ?? {};
10
+ if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
11
+ /**
12
+ * Gets an oAuth2 accessToken
13
+ * @return The token information
14
+ */
15
+ const getOAuth2AccessToken = async (otherOptions = {}) => await require_fetcher.fetcher(`${backendURL}/oauth2/token`, {}, otherOptions, {
16
+ method: "POST",
17
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
18
+ body: {
19
+ grant_type: "client_credentials",
20
+ client_id: clientId,
21
+ client_secret: clientSecret
22
+ }
23
+ });
24
+ return { getOAuth2AccessToken };
63
25
  };
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- getOAuthAPI
67
- });
26
+
27
+ //#endregion
28
+ exports.getOAuthAPI = getOAuthAPI;
68
29
  //# sourceMappingURL=oAuth.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { FetcherOptions, fetcher } from '../fetcher';\nimport { GetOAuth2TokenBody, GetOAuth2TokenResult } from '../types';\n\nexport const getOAuthAPI = (intlayerConfig?: IntlayerConfig) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration.editor?.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\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 {},\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n return {\n getOAuth2AccessToken,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,qBAAwC;AAGjC,MAAM,cAAc,CAAC,mBAAoC;AAC9D,QAAM,aACJ,gBAAgB,QAAQ,cAAc,aAAAA,QAAc,QAAQ;AAC9D,QAAM,EAAE,UAAU,aAAa,IAAI,gBAAgB,UAAU,CAAC;AAE9D,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAMA,QAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,UAAM;AAAA,IACJ,GAAG,UAAU;AAAA,IACb,CAAC;AAAA,IACD;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,EACF;AAEF,SAAO;AAAA,IACL;AAAA,EACF;AACF;","names":["configuration"]}
1
+ {"version":3,"file":"oAuth.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type { GetOAuth2TokenBody, GetOAuth2TokenResult } from '../types';\n\nexport const getOAuthAPI = (intlayerConfig?: IntlayerConfig) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\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 {},\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n return {\n getOAuth2AccessToken,\n };\n};\n"],"mappings":";;;;;;AAKA,MAAa,eAAe,mBAAoC;CAC9D,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,iCAAe,QAAQ;CAC/D,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,EAAE;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;;;;;CAOH,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAMC,wBACJ,GAAG,WAAW,gBACd,EAAE,EACF,cACA;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,qCACjB;EACD,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;GAChB;EACF,CACF;AAEH,QAAO,EACL,sBACD"}