@intlayer/api 6.1.6 → 7.0.0-canary.1

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,99 +1,94 @@
1
- import configuration from "@intlayer/config/built";
2
1
  import { fetcher } from "../fetcher.mjs";
2
+ import configuration from "@intlayer/config/built";
3
+
4
+ //#region src/getIntlayerAPI/organization.ts
3
5
  const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
4
- const backendURL = intlayerConfig?.editor?.backendURL ?? configuration.editor?.backendURL;
5
- if (!backendURL) {
6
- throw new Error(
7
- "Backend URL is not defined in the Intlayer configuration--."
8
- );
9
- }
10
- const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
11
- const getOrganizations = async (filters, otherOptions = {}) => await fetcher(
12
- ORGANIZATION_API_ROUTE,
13
- authAPIOptions,
14
- otherOptions,
15
- {
16
- params: filters
17
- }
18
- );
19
- const getOrganization = async (organizationId, otherOptions = {}) => await fetcher(
20
- `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,
21
- authAPIOptions,
22
- otherOptions
23
- );
24
- const addOrganization = async (organization, otherOptions = {}) => await fetcher(
25
- ORGANIZATION_API_ROUTE,
26
- authAPIOptions,
27
- otherOptions,
28
- {
29
- method: "POST",
30
- body: organization
31
- }
32
- );
33
- const updateOrganization = async (organization, otherOptions = {}) => fetcher(
34
- ORGANIZATION_API_ROUTE,
35
- authAPIOptions,
36
- otherOptions,
37
- {
38
- method: "PUT",
39
- body: organization
40
- }
41
- );
42
- const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(
43
- `${ORGANIZATION_API_ROUTE}/members`,
44
- authAPIOptions,
45
- otherOptions,
46
- {
47
- method: "PUT",
48
- body
49
- }
50
- );
51
- const addOrganizationMember = async (body, otherOptions = {}) => fetcher(
52
- `${ORGANIZATION_API_ROUTE}/member`,
53
- authAPIOptions,
54
- otherOptions,
55
- {
56
- method: "POST",
57
- body
58
- }
59
- );
60
- const deleteOrganization = async (otherOptions = {}) => await fetcher(
61
- ORGANIZATION_API_ROUTE,
62
- authAPIOptions,
63
- otherOptions,
64
- {
65
- method: "DELETE"
66
- }
67
- );
68
- const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(
69
- `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,
70
- authAPIOptions,
71
- otherOptions,
72
- {
73
- method: "PUT"
74
- }
75
- );
76
- const unselectOrganization = async (otherOptions = {}) => await fetcher(
77
- `${ORGANIZATION_API_ROUTE}/logout`,
78
- authAPIOptions,
79
- otherOptions,
80
- {
81
- method: "POST"
82
- }
83
- );
84
- return {
85
- getOrganizations,
86
- getOrganization,
87
- addOrganization,
88
- addOrganizationMember,
89
- updateOrganization,
90
- updateOrganizationMembers,
91
- deleteOrganization,
92
- selectOrganization,
93
- unselectOrganization
94
- };
95
- };
96
- export {
97
- getOrganizationAPI
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 ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
9
+ /**
10
+ * Retrieves a list of organizations based on filters and pagination.
11
+ * @param filters - Filters and pagination options.
12
+ */
13
+ const getOrganizations = async (filters, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
14
+ cache: "no-store",
15
+ params: filters
16
+ });
17
+ /**
18
+ * Retrieves an organization by its ID.
19
+ * @param organizationId - Organization ID.
20
+ */
21
+ const getOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions);
22
+ /**
23
+ * Adds a new organization to the database.
24
+ * @param organization - Organization data.
25
+ */
26
+ const addOrganization = async (organization, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
27
+ method: "POST",
28
+ body: organization
29
+ });
30
+ /**
31
+ * Updates an existing organization in the database.
32
+ * @param organization - Updated organization data.
33
+ */
34
+ const updateOrganization = async (organization, otherOptions = {}) => fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
35
+ method: "PUT",
36
+ body: organization
37
+ });
38
+ /**
39
+ * Update members to the organization in the database.
40
+ * @param body - Updated organization members data.
41
+ */
42
+ const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/members`, authAPIOptions, otherOptions, {
43
+ method: "PUT",
44
+ body
45
+ });
46
+ /**
47
+ * Admin-only: Update members of any organization by ID
48
+ * @param organizationId - Organization ID
49
+ * @param body - Updated organization members data.
50
+ */
51
+ const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/${organizationId}/members`, authAPIOptions, otherOptions, {
52
+ method: "PUT",
53
+ body
54
+ });
55
+ /**
56
+ * Add member to the organization in the database.
57
+ * @param body - Updated organization members data.
58
+ */
59
+ const addOrganizationMember = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/member`, authAPIOptions, otherOptions, {
60
+ method: "POST",
61
+ body
62
+ });
63
+ /**
64
+ * Deletes an organization from the database by its ID.
65
+ * @param organizationId - Organization ID.
66
+ */
67
+ const deleteOrganization = async (otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, { method: "DELETE" });
68
+ /**
69
+ * Select an organization from the database by its ID.
70
+ * @param organizationId - Organization ID.
71
+ */
72
+ const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions, { method: "PUT" });
73
+ /**
74
+ * Unselect an organization from the database by its ID.
75
+ * @param organizationId - Organization ID.
76
+ */
77
+ const unselectOrganization = async (otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
78
+ return {
79
+ getOrganizations,
80
+ getOrganization,
81
+ addOrganization,
82
+ addOrganizationMember,
83
+ updateOrganization,
84
+ updateOrganizationMembers,
85
+ updateOrganizationMembersById,
86
+ deleteOrganization,
87
+ selectOrganization,
88
+ unselectOrganization
89
+ };
98
90
  };
91
+
92
+ //#endregion
93
+ export { getOrganizationAPI };
99
94
  //# sourceMappingURL=organization.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from '../fetcher';\nimport type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '../types';\n\nexport const getOrganizationAPI = (\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 ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMembers,\n deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,eAAoC;AAoBtC,MAAM,qBAAqB,CAChC,iBAAiC,CAAC,GAClC,mBACG;AACH,QAAM,aACJ,gBAAgB,QAAQ,cAAc,cAAc,QAAQ;AAE9D,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,yBAAyB,GAAG,UAAU;AAM5C,QAAM,mBAAmB,OACvB,SACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AAMF,QAAM,kBAAkB,OACtB,gBACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ,GAAG,sBAAsB,IAAI,OAAO,cAAc,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,EACF;AAMF,QAAM,kBAAkB,OACtB,cACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAMF,QAAM,qBAAqB,OACzB,cACA,eAA+B,CAAC,MAEhC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAMF,QAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC;AAAA,IACE,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAMF,QAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC;AAAA,IACE,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAMF,QAAM,qBAAqB,OAAO,eAA+B,CAAC,MAChE,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AAMF,QAAM,qBAAqB,OACzB,gBACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ,GAAG,sBAAsB,IAAI,OAAO,cAAc,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AAMF,QAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM;AAAA,IACJ,GAAG,sBAAsB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AAEF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"organization.mjs","names":[],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '../types';\n\nexport const getOrganizationAPI = (\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 ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":";;;;AAsBA,MAAa,sBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,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AAO,eAA+B,EAAE,KACnE,MAAM,QACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1,123 +1,110 @@
1
- import configuration from "@intlayer/config/built";
2
1
  import { fetcher } from "../fetcher.mjs";
2
+ import configuration from "@intlayer/config/built";
3
+
4
+ //#region src/getIntlayerAPI/project.ts
3
5
  const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
4
- const backendURL = intlayerConfig?.editor?.backendURL ?? configuration.editor?.backendURL;
5
- if (!backendURL) {
6
- throw new Error(
7
- "Backend URL is not defined in the Intlayer configuration."
8
- );
9
- }
10
- const PROJECT_API_ROUTE = `${backendURL}/api/project`;
11
- const getProjects = async (filters, otherOptions = {}) => await fetcher(
12
- PROJECT_API_ROUTE,
13
- authAPIOptions,
14
- otherOptions,
15
- {
16
- params: filters
17
- }
18
- );
19
- const addProject = async (project, otherOptions = {}) => await fetcher(
20
- `${PROJECT_API_ROUTE}`,
21
- authAPIOptions,
22
- otherOptions,
23
- {
24
- method: "POST",
25
- body: project
26
- }
27
- );
28
- const updateProject = async (project, otherOptions = {}) => await fetcher(
29
- `${PROJECT_API_ROUTE}`,
30
- authAPIOptions,
31
- otherOptions,
32
- {
33
- method: "PUT",
34
- body: project
35
- }
36
- );
37
- const updateProjectMembers = async (body, otherOptions = {}) => await fetcher(
38
- `${PROJECT_API_ROUTE}/members`,
39
- authAPIOptions,
40
- otherOptions,
41
- {
42
- method: "PUT",
43
- body
44
- }
45
- );
46
- const pushProjectConfiguration = async (projectConfiguration, otherOptions = {}) => await fetcher(
47
- `${PROJECT_API_ROUTE}/configuration`,
48
- authAPIOptions,
49
- otherOptions,
50
- {
51
- method: "PUT",
52
- body: projectConfiguration
53
- }
54
- );
55
- const deleteProject = async (otherOptions = {}) => await fetcher(
56
- `${PROJECT_API_ROUTE}`,
57
- authAPIOptions,
58
- otherOptions,
59
- {
60
- method: "DELETE"
61
- }
62
- );
63
- const selectProject = async (projectId, otherOptions = {}) => await fetcher(
64
- `${PROJECT_API_ROUTE}/${String(projectId)}`,
65
- authAPIOptions,
66
- otherOptions,
67
- {
68
- method: "PUT"
69
- }
70
- );
71
- const unselectProject = async (otherOptions = {}) => await fetcher(
72
- `${PROJECT_API_ROUTE}/logout`,
73
- authAPIOptions,
74
- otherOptions,
75
- {
76
- method: "POST"
77
- }
78
- );
79
- const addNewAccessKey = async (accessKey, otherOptions = {}) => await fetcher(
80
- `${PROJECT_API_ROUTE}/access_key`,
81
- authAPIOptions,
82
- otherOptions,
83
- {
84
- method: "POST",
85
- body: accessKey
86
- }
87
- );
88
- const deleteAccessKey = async (clientId, otherOptions = {}) => await fetcher(
89
- `${PROJECT_API_ROUTE}/access_key`,
90
- authAPIOptions,
91
- otherOptions,
92
- {
93
- method: "DELETE",
94
- body: { clientId }
95
- }
96
- );
97
- const refreshAccessKey = async (clientId, otherOptions = {}) => await fetcher(
98
- `${PROJECT_API_ROUTE}/access_key`,
99
- authAPIOptions,
100
- otherOptions,
101
- {
102
- method: "PATCH",
103
- body: { clientId }
104
- }
105
- );
106
- return {
107
- getProjects,
108
- addProject,
109
- updateProject,
110
- updateProjectMembers,
111
- pushProjectConfiguration,
112
- deleteProject,
113
- selectProject,
114
- unselectProject,
115
- addNewAccessKey,
116
- deleteAccessKey,
117
- refreshAccessKey
118
- };
119
- };
120
- export {
121
- getProjectAPI
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 PROJECT_API_ROUTE = `${backendURL}/api/project`;
9
+ /**
10
+ * Retrieves a list of projects based on filters and pagination.
11
+ * @param filters - Filters and pagination options.
12
+ */
13
+ const getProjects = async (filters, otherOptions = {}) => await fetcher(PROJECT_API_ROUTE, authAPIOptions, otherOptions, {
14
+ cache: "no-store",
15
+ params: filters
16
+ });
17
+ /**
18
+ * Adds a new project to the database.
19
+ * @param project - Project data.
20
+ */
21
+ const addProject = async (project, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
22
+ method: "POST",
23
+ body: project
24
+ });
25
+ /**
26
+ * Updates an existing project in the database.
27
+ * @param project - Updated project data.
28
+ */
29
+ const updateProject = async (project, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
30
+ method: "PUT",
31
+ body: project
32
+ });
33
+ /**
34
+ * Updates project members in the database.
35
+ * @param project - Updated project data.
36
+ */
37
+ const updateProjectMembers = async (body, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/members`, authAPIOptions, otherOptions, {
38
+ method: "PUT",
39
+ body
40
+ });
41
+ /** Pushes a project configuration to the database.
42
+ * @param projectConfiguration - Project configuration data.
43
+ */
44
+ const pushProjectConfiguration = async (projectConfiguration, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/configuration`, authAPIOptions, otherOptions, {
45
+ method: "PUT",
46
+ body: projectConfiguration
47
+ });
48
+ /**
49
+ * Deletes a project from the database by its ID.
50
+ * @param id - Project ID.
51
+ */
52
+ const deleteProject = async (otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, { method: "DELETE" });
53
+ /**
54
+ * Select a project from the database by its ID.
55
+ * @param projectId - Organization ID.
56
+ */
57
+ const selectProject = async (projectId, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/${String(projectId)}`, authAPIOptions, otherOptions, { method: "PUT" });
58
+ /**
59
+ * Unselect a project from the database by its ID.
60
+ * @param projectId - Project ID.
61
+ */
62
+ const unselectProject = async (otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
63
+ /**
64
+ * Add a new access key to a project.
65
+ * @param accessKey - Access key data.
66
+ * @param otherOptions - Fetcher options.
67
+ * @returns The new access key.
68
+ */
69
+ const addNewAccessKey = async (accessKey, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
70
+ method: "POST",
71
+ body: accessKey
72
+ });
73
+ /**
74
+ * Delete a project access key.
75
+ * @param clientId - Access key client ID.
76
+ * @param otherOptions - Fetcher options.
77
+ * @returns The deleted project.
78
+ */
79
+ const deleteAccessKey = async (clientId, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
80
+ method: "DELETE",
81
+ body: { clientId }
82
+ });
83
+ /**
84
+ * Refreshes an access key from a project.
85
+ * @param clientId - The ID of the client to refresh.
86
+ * @param projectId - The ID of the project to refresh the access key from.
87
+ * @returns The new access key.
88
+ */
89
+ const refreshAccessKey = async (clientId, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
90
+ method: "PATCH",
91
+ body: { clientId }
92
+ });
93
+ return {
94
+ getProjects,
95
+ addProject,
96
+ updateProject,
97
+ updateProjectMembers,
98
+ pushProjectConfiguration,
99
+ deleteProject,
100
+ selectProject,
101
+ unselectProject,
102
+ addNewAccessKey,
103
+ deleteAccessKey,
104
+ refreshAccessKey
105
+ };
122
106
  };
107
+
108
+ //#endregion
109
+ export { getProjectAPI };
123
110
  //# sourceMappingURL=project.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from '../fetcher';\nimport type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n SelectProjectParam,\n SelectProjectResult,\n UnselectProjectResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '../types';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n };\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,eAAoC;AAwBtC,MAAM,gBAAgB,CAC3B,iBAAiC,CAAC,GAClC,mBACG;AACH,QAAM,aACJ,gBAAgB,QAAQ,cAAc,cAAc,QAAQ;AAE9D,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,oBAAoB,GAAG,UAAU;AAMvC,QAAM,cAAc,OAClB,SACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AAMF,QAAM,aAAa,OACjB,SACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAMF,QAAM,gBAAgB,OACpB,SACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AAMF,QAAM,uBAAuB,OAC3B,MACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ,GA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AA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,SAAS;AAAA,IACnB;AAAA,EACF;AAEF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"project.mjs","names":[],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n SelectProjectParam,\n SelectProjectResult,\n UnselectProjectResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '../types';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n };\n};\n"],"mappings":";;;;AA0BA,MAAa,iBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4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,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;;;;;;;CAQH,MAAM,mBAAmB,OACvB,UACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1,27 +1,23 @@
1
- import configuration from "@intlayer/config/built";
2
1
  import { fetcher } from "../fetcher.mjs";
2
+ import configuration from "@intlayer/config/built";
3
+
4
+ //#region src/getIntlayerAPI/search.ts
3
5
  const getSearchAPI = (authAPIOptions = {}, intlayerConfig) => {
4
- const backendURL = intlayerConfig?.editor?.backendURL ?? configuration.editor?.backendURL;
5
- if (!backendURL) {
6
- throw new Error(
7
- "Backend URL is not defined in the Intlayer configuration."
8
- );
9
- }
10
- const AI_API_ROUTE = `${backendURL}/api/search`;
11
- const searchDoc = async (params, otherOptions = {}) => await fetcher(
12
- `${AI_API_ROUTE}/doc`,
13
- authAPIOptions,
14
- otherOptions,
15
- {
16
- method: "GET",
17
- params
18
- }
19
- );
20
- return {
21
- searchDoc
22
- };
23
- };
24
- export {
25
- getSearchAPI
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 AI_API_ROUTE = `${backendURL}/api/search`;
9
+ /**
10
+ * Search documentation
11
+ * @param params - Search parameters containing the input query.
12
+ * @returns Search results with GitHub URLs.
13
+ */
14
+ const searchDoc = async (params, otherOptions = {}) => await fetcher(`${AI_API_ROUTE}/doc`, authAPIOptions, otherOptions, {
15
+ method: "GET",
16
+ params
17
+ });
18
+ return { searchDoc };
26
19
  };
20
+
21
+ //#endregion
22
+ export { getSearchAPI };
27
23
  //# sourceMappingURL=search.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from '../fetcher';\nimport type { SearchDocUtilParams, SearchDocUtilResult } from '../types';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,eAAoC;AAGtC,MAAM,eAAe,CAC1B,iBAAiC,CAAC,GAClC,mBACG;AACH,QAAM,aACJ,gBAAgB,QAAQ,cAAc,cAAc,QAAQ;AAE9D,MAAI,CAAC,YAAY;AACf,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,eAAe,GAAG,UAAU;AAOlC,QAAM,YAAY,OAChB,QACA,eAA+B,CAAC,MAEhC,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AAAA,IACL;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"search.mjs","names":[],"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type { SearchDocUtilParams, SearchDocUtilResult } from '../types';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":";;;;AAKA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,eAAe,GAAG,WAAW;;;;;;CAOnC,MAAM,YAAY,OAChB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,OAChB,gBACA,cACA;EACE,QAAQ;EACA;EACT,CACF;AAEH,QAAO,EACL,WACD"}