@carlonicora/nextjs-jsonapi 1.6.0 → 1.7.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 (96) hide show
  1. package/dist/{ApiResponseInterface-CfcC7pPC.d.mts → ApiResponseInterface-DMwITHYP.d.mts} +1 -1
  2. package/dist/{ApiResponseInterface-DTBJaV5R.d.ts → ApiResponseInterface-DWgIAXI-.d.ts} +1 -1
  3. package/dist/{BlockNoteEditor-7FM7B737.js → BlockNoteEditor-IJASTIUZ.js} +14 -18
  4. package/dist/BlockNoteEditor-IJASTIUZ.js.map +1 -0
  5. package/dist/{BlockNoteEditor-RVL76ZAS.mjs → BlockNoteEditor-M6TUP3NT.mjs} +5 -9
  6. package/dist/{BlockNoteEditor-RVL76ZAS.mjs.map → BlockNoteEditor-M6TUP3NT.mjs.map} +1 -1
  7. package/dist/JsonApiRequest-2OM5NDAW.js +24 -0
  8. package/dist/JsonApiRequest-2OM5NDAW.js.map +1 -0
  9. package/dist/{JsonApiRequest-VCCRO732.mjs → JsonApiRequest-SYZ6FGCA.mjs} +2 -3
  10. package/dist/{chunk-SVX7E6RR.js → chunk-4L7OWJ2P.js} +360 -364
  11. package/dist/chunk-4L7OWJ2P.js.map +1 -0
  12. package/dist/{chunk-KFL5ZFM4.mjs → chunk-4U5CJA44.mjs} +732 -20
  13. package/dist/chunk-4U5CJA44.mjs.map +1 -0
  14. package/dist/{chunk-ZUEEIQHW.js → chunk-CKS6SVUK.js} +158 -22
  15. package/dist/chunk-CKS6SVUK.js.map +1 -0
  16. package/dist/{chunk-F4Y3GZG4.mjs → chunk-SAL7XW2G.mjs} +141 -5
  17. package/dist/chunk-SAL7XW2G.mjs.map +1 -0
  18. package/dist/{chunk-ZQTFZKLJ.mjs → chunk-TW4QRJ7D.mjs} +10 -14
  19. package/dist/{chunk-ZQTFZKLJ.mjs.map → chunk-TW4QRJ7D.mjs.map} +1 -1
  20. package/dist/{chunk-2Z56AS2S.js → chunk-U4NADAHN.js} +744 -32
  21. package/dist/chunk-U4NADAHN.js.map +1 -0
  22. package/dist/client/index.d.mts +5 -5
  23. package/dist/client/index.d.ts +5 -5
  24. package/dist/client/index.js +4 -7
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/index.mjs +3 -6
  27. package/dist/components/index.d.mts +2 -2
  28. package/dist/components/index.d.ts +2 -2
  29. package/dist/components/index.js +4 -7
  30. package/dist/components/index.js.map +1 -1
  31. package/dist/components/index.mjs +3 -6
  32. package/dist/{config-B43zxEvn.d.mts → config-BdCV25CE.d.mts} +1 -1
  33. package/dist/{config-D2OUrI_G.d.ts → config-C9dt1QiR.d.ts} +1 -1
  34. package/dist/{content.interface-Bs8a7uW6.d.mts → content.interface-B6qP_ABq.d.mts} +1 -1
  35. package/dist/{content.interface-UtsJ-mzs.d.ts → content.interface-DHAFLasV.d.ts} +1 -1
  36. package/dist/contexts/index.d.mts +2 -2
  37. package/dist/contexts/index.d.ts +2 -2
  38. package/dist/contexts/index.js +4 -7
  39. package/dist/contexts/index.js.map +1 -1
  40. package/dist/contexts/index.mjs +3 -6
  41. package/dist/core/index.d.mts +43 -7
  42. package/dist/core/index.d.ts +43 -7
  43. package/dist/core/index.js +29 -3
  44. package/dist/core/index.js.map +1 -1
  45. package/dist/core/index.mjs +28 -2
  46. package/dist/index.d.mts +7 -44
  47. package/dist/index.d.ts +7 -44
  48. package/dist/index.js +20 -4
  49. package/dist/index.js.map +1 -1
  50. package/dist/index.mjs +24 -8
  51. package/dist/{notification.interface-BdcwkuQE.d.mts → notification.interface-agcMYCkg.d.mts} +1 -1
  52. package/dist/{notification.interface-BdcwkuQE.d.ts → notification.interface-agcMYCkg.d.ts} +1 -1
  53. package/dist/s3.service-DYnmymEd.d.mts +350 -0
  54. package/dist/s3.service-DyXjKTqr.d.ts +350 -0
  55. package/dist/server/index.d.mts +5 -235
  56. package/dist/server/index.d.ts +5 -235
  57. package/dist/server/index.js +12 -16
  58. package/dist/server/index.js.map +1 -1
  59. package/dist/server/index.mjs +3 -7
  60. package/dist/server/index.mjs.map +1 -1
  61. package/dist/{useSocket-BWJUXuOl.d.mts → useSocket-91s8M4Xd.d.mts} +1 -1
  62. package/dist/{useSocket-8vwK_R_c.d.ts → useSocket-DSR7vaXj.d.ts} +1 -1
  63. package/package.json +1 -1
  64. package/src/core/index.ts +3 -0
  65. package/src/features/auth/data/index.ts +1 -0
  66. package/src/features/company/data/index.ts +1 -0
  67. package/src/features/content/data/index.ts +1 -0
  68. package/src/features/feature/data/index.ts +1 -0
  69. package/src/features/notification/data/index.ts +1 -0
  70. package/src/features/push/data/index.ts +1 -0
  71. package/src/features/role/data/index.ts +1 -0
  72. package/src/features/s3/data/index.ts +1 -0
  73. package/src/features/user/data/index.ts +1 -0
  74. package/dist/BlockNoteEditor-7FM7B737.js.map +0 -1
  75. package/dist/JsonApiRequest-KOKGVPBI.js +0 -25
  76. package/dist/JsonApiRequest-KOKGVPBI.js.map +0 -1
  77. package/dist/chunk-2Z56AS2S.js.map +0 -1
  78. package/dist/chunk-37NJZ2VD.mjs +0 -637
  79. package/dist/chunk-37NJZ2VD.mjs.map +0 -1
  80. package/dist/chunk-AGAJMJ4T.js +0 -147
  81. package/dist/chunk-AGAJMJ4T.js.map +0 -1
  82. package/dist/chunk-CSM6AIAP.js +0 -98
  83. package/dist/chunk-CSM6AIAP.js.map +0 -1
  84. package/dist/chunk-F4Y3GZG4.mjs.map +0 -1
  85. package/dist/chunk-K4W5QXL5.mjs +0 -98
  86. package/dist/chunk-K4W5QXL5.mjs.map +0 -1
  87. package/dist/chunk-KFL5ZFM4.mjs.map +0 -1
  88. package/dist/chunk-LOSPCUCF.js +0 -637
  89. package/dist/chunk-LOSPCUCF.js.map +0 -1
  90. package/dist/chunk-RBIVEH2K.mjs +0 -147
  91. package/dist/chunk-RBIVEH2K.mjs.map +0 -1
  92. package/dist/chunk-SVX7E6RR.js.map +0 -1
  93. package/dist/chunk-ZUEEIQHW.js.map +0 -1
  94. package/dist/s3.interface-D7ttGatc.d.ts +0 -119
  95. package/dist/s3.interface-DlaMDRTn.d.mts +0 -119
  96. /package/dist/{JsonApiRequest-VCCRO732.mjs.map → JsonApiRequest-SYZ6FGCA.mjs.map} +0 -0
@@ -4,8 +4,11 @@ import {
4
4
  import {
5
5
  DataClassRegistry,
6
6
  JsonApiDataFactory,
7
+ JsonApiDelete,
8
+ JsonApiGet,
9
+ JsonApiPost,
7
10
  translateResponse
8
- } from "./chunk-RBIVEH2K.mjs";
11
+ } from "./chunk-SAL7XW2G.mjs";
9
12
  import {
10
13
  getClientToken
11
14
  } from "./chunk-AUXK7QSA.mjs";
@@ -201,7 +204,7 @@ var AbstractService = class {
201
204
  * Make an API call with automatic environment detection and error handling.
202
205
  */
203
206
  static async callApi(params) {
204
- const { JsonApiGet, JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await import("./JsonApiRequest-VCCRO732.mjs");
207
+ const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await import("./JsonApiRequest-SYZ6FGCA.mjs");
205
208
  let apiResponse;
206
209
  let language = "en";
207
210
  if (typeof window === "undefined") {
@@ -212,7 +215,7 @@ var AbstractService = class {
212
215
  }
213
216
  switch (params.method) {
214
217
  case "GET" /* GET */:
215
- apiResponse = await JsonApiGet({
218
+ apiResponse = await JsonApiGet2({
216
219
  classKey: params.type,
217
220
  endpoint: params.endpoint,
218
221
  companyId: params.companyId,
@@ -220,7 +223,7 @@ var AbstractService = class {
220
223
  });
221
224
  break;
222
225
  case "POST" /* POST */:
223
- apiResponse = await JsonApiPost({
226
+ apiResponse = await JsonApiPost2({
224
227
  classKey: params.type,
225
228
  endpoint: params.endpoint,
226
229
  companyId: params.companyId,
@@ -255,7 +258,7 @@ var AbstractService = class {
255
258
  });
256
259
  break;
257
260
  case "DELETE" /* DELETE */:
258
- apiResponse = await JsonApiDelete({
261
+ apiResponse = await JsonApiDelete2({
259
262
  classKey: params.type,
260
263
  endpoint: params.endpoint,
261
264
  companyId: params.companyId,
@@ -286,7 +289,7 @@ var AbstractService = class {
286
289
  * Get raw JSON:API response data without deserialization.
287
290
  */
288
291
  static async getRawData(params) {
289
- const { JsonApiGet } = await import("./JsonApiRequest-VCCRO732.mjs");
292
+ const { JsonApiGet: JsonApiGet2 } = await import("./JsonApiRequest-SYZ6FGCA.mjs");
290
293
  let language = "en";
291
294
  if (typeof window === "undefined") {
292
295
  const { getLocale } = await import("next-intl/server");
@@ -294,7 +297,7 @@ var AbstractService = class {
294
297
  } else {
295
298
  language = this.getClientLocale();
296
299
  }
297
- const apiResponse = await JsonApiGet({
300
+ const apiResponse = await JsonApiGet2({
298
301
  classKey: params.type,
299
302
  endpoint: params.endpoint,
300
303
  companyId: params.companyId,
@@ -1926,6 +1929,93 @@ var getLucideIconByModuleName = /* @__PURE__ */ __name((params) => {
1926
1929
  return getLucideIconByModule({ module: Modules.findByModelName(params.name) });
1927
1930
  }, "getLucideIconByModuleName");
1928
1931
 
1932
+ // src/permissions/types.ts
1933
+ var Action = /* @__PURE__ */ ((Action2) => {
1934
+ Action2["Read"] = "read";
1935
+ Action2["Create"] = "create";
1936
+ Action2["Update"] = "update";
1937
+ Action2["Delete"] = "delete";
1938
+ return Action2;
1939
+ })(Action || {});
1940
+
1941
+ // src/permissions/check.ts
1942
+ function checkPermissions(params) {
1943
+ const selectedModule = params.user.modules.find((module) => module.id === params.module.moduleId);
1944
+ if (!selectedModule) return false;
1945
+ const permissionConfig = selectedModule.permissions[params.action];
1946
+ if (!permissionConfig) return false;
1947
+ if (typeof permissionConfig === "boolean") return permissionConfig;
1948
+ if (!params.data) return true;
1949
+ try {
1950
+ const singlePermissionConfig = permissionConfig.split("|").map((p) => p.trim());
1951
+ for (const path of singlePermissionConfig) {
1952
+ if (getValueFromPath(params.data, path, params.user.id)) return true;
1953
+ }
1954
+ return false;
1955
+ } catch {
1956
+ if (typeof permissionConfig === "string") {
1957
+ return getValueFromPath(params.data, permissionConfig, params.user.id);
1958
+ }
1959
+ }
1960
+ return false;
1961
+ }
1962
+ __name(checkPermissions, "checkPermissions");
1963
+ function checkPermissionsFromServer(params) {
1964
+ if (!params.selectedModule) return false;
1965
+ const permissionConfig = params.selectedModule.permissions[params.action];
1966
+ if (!permissionConfig) return false;
1967
+ if (typeof permissionConfig === "boolean") return permissionConfig;
1968
+ if (!params.data) return true;
1969
+ try {
1970
+ const singlePermissionConfig = permissionConfig.split("|").map((p) => p.trim());
1971
+ for (const path of singlePermissionConfig) {
1972
+ if (getValueFromPath(params.data, path, params.userId)) return true;
1973
+ }
1974
+ return false;
1975
+ } catch {
1976
+ if (typeof permissionConfig === "string") {
1977
+ return getValueFromPath(params.data, permissionConfig, params.userId);
1978
+ }
1979
+ }
1980
+ return false;
1981
+ }
1982
+ __name(checkPermissionsFromServer, "checkPermissionsFromServer");
1983
+ function getValueFromPath(obj, path, userId) {
1984
+ const parts = path.split(".");
1985
+ let current = obj;
1986
+ for (const part of parts) {
1987
+ if (!current) return false;
1988
+ if (Array.isArray(current)) {
1989
+ let found = false;
1990
+ for (const item of current) {
1991
+ const result = getValueFromPath(item, parts.slice(parts.indexOf(part)).join("."), userId);
1992
+ if (result === userId || result === true) {
1993
+ found = true;
1994
+ break;
1995
+ }
1996
+ }
1997
+ return found;
1998
+ } else if (current[part] !== void 0) {
1999
+ current = current[part];
2000
+ } else {
2001
+ return false;
2002
+ }
2003
+ }
2004
+ if (Array.isArray(current)) {
2005
+ return current.some((item) => {
2006
+ if (typeof item === "object" && item.id !== void 0) {
2007
+ return item.id.toString() === userId;
2008
+ }
2009
+ return item.toString() === userId;
2010
+ });
2011
+ }
2012
+ if (typeof current === "object" && current.id !== void 0) {
2013
+ return current.id.toString() === userId;
2014
+ }
2015
+ return current.toString() === userId;
2016
+ }
2017
+ __name(getValueFromPath, "getValueFromPath");
2018
+
1929
2019
  // src/features/auth/data/auth.ts
1930
2020
  var Auth = class extends AbstractApiData {
1931
2021
  static {
@@ -1971,6 +2061,138 @@ var Auth = class extends AbstractApiData {
1971
2061
  }
1972
2062
  };
1973
2063
 
2064
+ // src/features/auth/config.ts
2065
+ var _tokenHandler = null;
2066
+ function configureAuth(handler) {
2067
+ _tokenHandler = handler;
2068
+ }
2069
+ __name(configureAuth, "configureAuth");
2070
+ function getTokenHandler() {
2071
+ return _tokenHandler;
2072
+ }
2073
+ __name(getTokenHandler, "getTokenHandler");
2074
+
2075
+ // src/features/auth/data/auth.service.ts
2076
+ var AuthService = class extends AbstractService {
2077
+ static {
2078
+ __name(this, "AuthService");
2079
+ }
2080
+ static async login(params) {
2081
+ const language = params.language || "en-US";
2082
+ const apiResponse = await JsonApiPost({
2083
+ classKey: Modules.Auth,
2084
+ endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "login" }).generate(),
2085
+ body: { email: params.email, password: params.password },
2086
+ language
2087
+ });
2088
+ if (!apiResponse.ok) throw new Error(apiResponse.error);
2089
+ const auth = apiResponse.data;
2090
+ const handler = getTokenHandler();
2091
+ if (handler) {
2092
+ await handler.updateToken({
2093
+ token: auth.token,
2094
+ refreshToken: auth.refreshToken,
2095
+ userId: auth.user.id,
2096
+ companyId: auth.user.company?.id,
2097
+ licenseExpirationDate: auth.user.company?.licenseExpirationDate,
2098
+ roles: auth.user.roles.map((role) => role.id),
2099
+ features: auth.user.company?.features?.map((feature) => feature.id) ?? [],
2100
+ modules: auth.user.modules.map((module) => ({
2101
+ id: module.id,
2102
+ permissions: module.permissions
2103
+ }))
2104
+ });
2105
+ }
2106
+ return auth.user;
2107
+ }
2108
+ static async logout(params) {
2109
+ const language = params?.language || "en-US";
2110
+ await JsonApiDelete({
2111
+ classKey: Modules.Auth,
2112
+ endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),
2113
+ language
2114
+ });
2115
+ const handler = getTokenHandler();
2116
+ if (handler) {
2117
+ await handler.removeToken();
2118
+ }
2119
+ }
2120
+ static async initialiseForgotPassword(params) {
2121
+ const language = params.language || "en-US";
2122
+ const response = await JsonApiPost({
2123
+ classKey: Modules.Auth,
2124
+ endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "forgot" }).generate(),
2125
+ body: { email: params.email },
2126
+ language
2127
+ });
2128
+ if (!response.ok) {
2129
+ throw new Error(response.error);
2130
+ }
2131
+ }
2132
+ static async register(params) {
2133
+ const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "register" });
2134
+ await this.callApi({
2135
+ type: Modules.Auth,
2136
+ method: "POST" /* POST */,
2137
+ endpoint: endpoint.generate(),
2138
+ input: params
2139
+ });
2140
+ }
2141
+ static async activate(params) {
2142
+ const endpoint = new EndpointCreator({
2143
+ endpoint: Modules.Auth,
2144
+ id: "activate",
2145
+ childEndpoint: params.activationCode
2146
+ });
2147
+ await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate() });
2148
+ }
2149
+ static async validateCode(params) {
2150
+ const language = params.language || "en-US";
2151
+ const apiResponse = await JsonApiGet({
2152
+ classKey: Modules.Auth,
2153
+ endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
2154
+ language
2155
+ });
2156
+ if (!apiResponse.ok) throw new Error(apiResponse.error);
2157
+ }
2158
+ static async resetPassword(params) {
2159
+ const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "reset", childEndpoint: params.code });
2160
+ const input = { password: params.password };
2161
+ await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
2162
+ }
2163
+ static async acceptInvitation(params) {
2164
+ const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "invitation", childEndpoint: params.code });
2165
+ const input = { password: params.password };
2166
+ await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
2167
+ }
2168
+ static async findToken(params) {
2169
+ return await this.callApi({
2170
+ type: Modules.Auth,
2171
+ method: "POST" /* POST */,
2172
+ endpoint: new EndpointCreator({ endpoint: Modules.Auth }).addAdditionalParam("code", params.tokenCode).generate()
2173
+ });
2174
+ }
2175
+ static async saveToken(params) {
2176
+ const auth = rehydrate(Modules.Auth, params.dehydratedAuth);
2177
+ const handler = getTokenHandler();
2178
+ if (handler) {
2179
+ await handler.updateToken({
2180
+ token: auth.token,
2181
+ refreshToken: auth.refreshToken,
2182
+ userId: auth.user.id,
2183
+ companyId: auth.user.company?.id,
2184
+ licenseExpirationDate: auth.user.company?.licenseExpirationDate,
2185
+ roles: auth.user.roles.map((role) => role.id),
2186
+ features: auth.user.company?.features?.map((feature) => feature.id) ?? [],
2187
+ modules: auth.user.modules.map((module) => ({
2188
+ id: module.id,
2189
+ permissions: module.permissions
2190
+ }))
2191
+ });
2192
+ }
2193
+ }
2194
+ };
2195
+
1974
2196
  // src/features/auth/enums/AuthComponent.ts
1975
2197
  var AuthComponent = /* @__PURE__ */ ((AuthComponent2) => {
1976
2198
  AuthComponent2[AuthComponent2["Login"] = 0] = "Login";
@@ -1983,17 +2205,6 @@ var AuthComponent = /* @__PURE__ */ ((AuthComponent2) => {
1983
2205
  return AuthComponent2;
1984
2206
  })(AuthComponent || {});
1985
2207
 
1986
- // src/features/auth/config.ts
1987
- var _tokenHandler = null;
1988
- function configureAuth(handler) {
1989
- _tokenHandler = handler;
1990
- }
1991
- __name(configureAuth, "configureAuth");
1992
- function getTokenHandler() {
1993
- return _tokenHandler;
1994
- }
1995
- __name(getTokenHandler, "getTokenHandler");
1996
-
1997
2208
  // src/features/auth/auth.module.ts
1998
2209
  var AuthModule = /* @__PURE__ */ __name((factory) => factory({
1999
2210
  pageUrl: "/auth",
@@ -2091,6 +2302,73 @@ var CompanyFields = /* @__PURE__ */ ((CompanyFields2) => {
2091
2302
  return CompanyFields2;
2092
2303
  })(CompanyFields || {});
2093
2304
 
2305
+ // src/features/company/data/company.service.ts
2306
+ var CompanyService = class extends AbstractService {
2307
+ static {
2308
+ __name(this, "CompanyService");
2309
+ }
2310
+ static async findOne(params) {
2311
+ return this.callApi({
2312
+ type: Modules.Company,
2313
+ method: "GET" /* GET */,
2314
+ endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
2315
+ });
2316
+ }
2317
+ static async findMany(params) {
2318
+ const endpoint = new EndpointCreator({ endpoint: Modules.Company });
2319
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2320
+ return this.callApi({
2321
+ type: Modules.Company,
2322
+ method: "GET" /* GET */,
2323
+ endpoint: endpoint.generate(),
2324
+ next: params.next
2325
+ });
2326
+ }
2327
+ static async delete(params) {
2328
+ await this.callApi({
2329
+ type: Modules.Company,
2330
+ method: "DELETE" /* DELETE */,
2331
+ endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
2332
+ });
2333
+ }
2334
+ static async create(params) {
2335
+ return this.callApi({
2336
+ type: Modules.Company,
2337
+ method: "POST" /* POST */,
2338
+ endpoint: new EndpointCreator({ endpoint: Modules.Company }).generate(),
2339
+ input: params
2340
+ });
2341
+ }
2342
+ static async update(params) {
2343
+ return this.callApi({
2344
+ type: Modules.Company,
2345
+ method: "PUT" /* PUT */,
2346
+ endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id }).generate(),
2347
+ input: params
2348
+ });
2349
+ }
2350
+ static async updateConfigurations(params) {
2351
+ return this.callApi({
2352
+ type: Modules.Company,
2353
+ method: "PUT" /* PUT */,
2354
+ endpoint: new EndpointCreator({
2355
+ endpoint: Modules.Company,
2356
+ id: params.id,
2357
+ childEndpoint: "configurations"
2358
+ }).generate(),
2359
+ input: params
2360
+ });
2361
+ }
2362
+ static async activateLicense(params) {
2363
+ return this.callApi({
2364
+ type: Modules.Company,
2365
+ method: "PUT" /* PUT */,
2366
+ endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id, childEndpoint: "license" }).generate(),
2367
+ input: params
2368
+ });
2369
+ }
2370
+ };
2371
+
2094
2372
  // src/features/company/company.module.ts
2095
2373
  var CompanyModule = /* @__PURE__ */ __name((factory) => factory({
2096
2374
  pageUrl: "/companies",
@@ -2177,6 +2455,63 @@ var ContentFields = /* @__PURE__ */ ((ContentFields2) => {
2177
2455
  return ContentFields2;
2178
2456
  })(ContentFields || {});
2179
2457
 
2458
+ // src/features/content/data/content.service.ts
2459
+ var ContentService = class extends AbstractService {
2460
+ static {
2461
+ __name(this, "ContentService");
2462
+ }
2463
+ static async findMany(params) {
2464
+ const endpoint = new EndpointCreator({ endpoint: Modules.Content });
2465
+ if (params.contentIds) {
2466
+ endpoint.addAdditionalParam("contentIds", params.contentIds.join(","));
2467
+ endpoint.addAdditionalParam("fetchAll", "true");
2468
+ } else {
2469
+ if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
2470
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2471
+ }
2472
+ if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
2473
+ if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
2474
+ return this.callApi({
2475
+ type: Modules.Content,
2476
+ method: "GET" /* GET */,
2477
+ endpoint: endpoint.generate(),
2478
+ next: params.next
2479
+ });
2480
+ }
2481
+ static async findRelevant(params) {
2482
+ const endpoint = new EndpointCreator({
2483
+ endpoint: Modules.Content,
2484
+ id: params.id,
2485
+ childEndpoint: "relevance"
2486
+ });
2487
+ if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
2488
+ if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
2489
+ return this.callApi({
2490
+ type: Modules.Content,
2491
+ method: "GET" /* GET */,
2492
+ endpoint: endpoint.generate(),
2493
+ next: params.next
2494
+ });
2495
+ }
2496
+ static async findManyByAuthor(params) {
2497
+ const endpoint = new EndpointCreator({
2498
+ endpoint: Modules.Author,
2499
+ id: params.userId,
2500
+ childEndpoint: Modules.Content
2501
+ });
2502
+ if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
2503
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2504
+ if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
2505
+ if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
2506
+ return this.callApi({
2507
+ type: Modules.Content,
2508
+ method: "GET" /* GET */,
2509
+ endpoint: endpoint.generate(),
2510
+ next: params.next
2511
+ });
2512
+ }
2513
+ };
2514
+
2180
2515
  // src/features/content/content.module.ts
2181
2516
  var ContentModule = /* @__PURE__ */ __name((factory) => factory({
2182
2517
  pageUrl: "/contents",
@@ -2220,6 +2555,24 @@ var Feature = class extends AbstractApiData {
2220
2555
  }
2221
2556
  };
2222
2557
 
2558
+ // src/features/feature/data/feature.service.ts
2559
+ var FeatureService = class extends AbstractService {
2560
+ static {
2561
+ __name(this, "FeatureService");
2562
+ }
2563
+ static async findMany(params) {
2564
+ const endpoint = new EndpointCreator({ endpoint: Modules.Feature });
2565
+ if (params.companyId) endpoint.endpoint(Modules.Company).id(params.companyId).childEndpoint(Modules.Feature);
2566
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2567
+ return this.callApi({
2568
+ type: Modules.Feature,
2569
+ method: "GET" /* GET */,
2570
+ endpoint: endpoint.generate(),
2571
+ next: params.next
2572
+ });
2573
+ }
2574
+ };
2575
+
2223
2576
  // src/features/feature/feature.module.ts
2224
2577
  var FeatureModule = /* @__PURE__ */ __name((factory) => factory({
2225
2578
  pageUrl: "/features",
@@ -2315,6 +2668,37 @@ var NotificationFields = /* @__PURE__ */ ((NotificationFields2) => {
2315
2668
  return NotificationFields2;
2316
2669
  })(NotificationFields || {});
2317
2670
 
2671
+ // src/features/notification/data/notification.service.ts
2672
+ var NotificationService = class extends AbstractService {
2673
+ static {
2674
+ __name(this, "NotificationService");
2675
+ }
2676
+ static async findMany(params) {
2677
+ const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
2678
+ if (params.isArchived) endpoint.addAdditionalParam("isArchived", "true");
2679
+ return this.callApi({
2680
+ type: Modules.Notification,
2681
+ method: "GET" /* GET */,
2682
+ endpoint: endpoint.generate(),
2683
+ next: params.next
2684
+ });
2685
+ }
2686
+ static async markAsRead(params) {
2687
+ const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
2688
+ await this.callApi({
2689
+ type: Modules.Notification,
2690
+ method: "PATCH" /* PATCH */,
2691
+ endpoint: endpoint.generate(),
2692
+ input: params.data,
2693
+ overridesJsonApiCreation: true
2694
+ });
2695
+ }
2696
+ static async archive(params) {
2697
+ const endpoint = new EndpointCreator({ endpoint: Modules.Notification, id: params.id, childEndpoint: "archive" });
2698
+ await this.callApi({ type: Modules.Notification, method: "POST" /* POST */, endpoint: endpoint.generate() });
2699
+ }
2700
+ };
2701
+
2318
2702
  // src/features/notification/notification.module.ts
2319
2703
  var NotificationModule = /* @__PURE__ */ __name((factory) => factory({
2320
2704
  pageUrl: "/notifications",
@@ -2342,6 +2726,23 @@ var Push = class extends AbstractApiData {
2342
2726
  }
2343
2727
  };
2344
2728
 
2729
+ // src/features/push/data/push.service.ts
2730
+ var PushService = class extends AbstractService {
2731
+ static {
2732
+ __name(this, "PushService");
2733
+ }
2734
+ static async register(params) {
2735
+ const endpoint = new EndpointCreator({ endpoint: Modules.Push });
2736
+ await this.callApi({
2737
+ type: Modules.Push,
2738
+ method: "POST" /* POST */,
2739
+ endpoint: endpoint.generate(),
2740
+ input: params.data,
2741
+ overridesJsonApiCreation: true
2742
+ });
2743
+ }
2744
+ };
2745
+
2345
2746
  // src/features/push/push.module.ts
2346
2747
  var PushModule = /* @__PURE__ */ __name((factory) => factory({
2347
2748
  pageUrl: "/push",
@@ -2411,6 +2812,101 @@ var RoleFields = /* @__PURE__ */ ((RoleFields2) => {
2411
2812
  return RoleFields2;
2412
2813
  })(RoleFields || {});
2413
2814
 
2815
+ // src/features/role/data/role.service.ts
2816
+ var RoleService = class extends AbstractService {
2817
+ static {
2818
+ __name(this, "RoleService");
2819
+ }
2820
+ static async findById(params) {
2821
+ return this.callApi({
2822
+ type: Modules.Role,
2823
+ method: "GET" /* GET */,
2824
+ endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
2825
+ });
2826
+ }
2827
+ static async findAllRoles(params) {
2828
+ const endpoint = new EndpointCreator({ endpoint: Modules.Role });
2829
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2830
+ return this.callApi({
2831
+ type: Modules.Role,
2832
+ method: "GET" /* GET */,
2833
+ endpoint: endpoint.generate(),
2834
+ next: params.next
2835
+ });
2836
+ }
2837
+ static async findAllRolesByUser(params) {
2838
+ const endpoint = new EndpointCreator({ endpoint: Modules.User, id: params.userId, childEndpoint: Modules.Role });
2839
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2840
+ return this.callApi({
2841
+ type: Modules.Role,
2842
+ method: "GET" /* GET */,
2843
+ endpoint: endpoint.generate(),
2844
+ next: params.next
2845
+ });
2846
+ }
2847
+ static async findAllRolesUserNotIn(params) {
2848
+ const endpoint = new EndpointCreator({
2849
+ endpoint: Modules.User,
2850
+ id: params.userId,
2851
+ childEndpoint: Modules.Role
2852
+ }).addAdditionalParam("userNotIn", "true");
2853
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
2854
+ return this.callApi({
2855
+ type: Modules.Role,
2856
+ method: "GET" /* GET */,
2857
+ endpoint: endpoint.generate(),
2858
+ next: params.next
2859
+ });
2860
+ }
2861
+ static async addUserToRole(params) {
2862
+ this.callApi({
2863
+ type: Modules.Role,
2864
+ method: "POST" /* POST */,
2865
+ endpoint: new EndpointCreator({
2866
+ endpoint: Modules.Role,
2867
+ id: params.roleId,
2868
+ childEndpoint: Modules.User,
2869
+ childId: params.userId
2870
+ }).generate()
2871
+ });
2872
+ }
2873
+ static async removeUserFromRole(params) {
2874
+ this.callApi({
2875
+ type: Modules.Role,
2876
+ method: "DELETE" /* DELETE */,
2877
+ endpoint: new EndpointCreator({
2878
+ endpoint: Modules.Role,
2879
+ id: params.roleId,
2880
+ childEndpoint: Modules.User,
2881
+ childId: params.userId
2882
+ }).generate()
2883
+ });
2884
+ }
2885
+ static async create(params) {
2886
+ return this.callApi({
2887
+ type: Modules.Role,
2888
+ method: "POST" /* POST */,
2889
+ endpoint: new EndpointCreator({ endpoint: Modules.Role }).generate(),
2890
+ input: { id: params.roleId, name: params.name, description: params.description }
2891
+ });
2892
+ }
2893
+ static async update(params) {
2894
+ return this.callApi({
2895
+ type: Modules.Role,
2896
+ method: "PUT" /* PUT */,
2897
+ endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),
2898
+ input: { id: params.roleId, name: params.name, description: params.description }
2899
+ });
2900
+ }
2901
+ static async delete(params) {
2902
+ return this.callApi({
2903
+ type: Modules.Role,
2904
+ method: "DELETE" /* DELETE */,
2905
+ endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
2906
+ });
2907
+ }
2908
+ };
2909
+
2414
2910
  // src/features/role/role.module.ts
2415
2911
  var RoleModule = /* @__PURE__ */ __name((factory) => factory({
2416
2912
  pageUrl: "/roles",
@@ -2478,6 +2974,30 @@ var S3Module = /* @__PURE__ */ __name((factory) => factory({
2478
2974
  moduleId: "db41ba46-e171-4324-8845-99353eba8568"
2479
2975
  }), "S3Module");
2480
2976
 
2977
+ // src/features/s3/data/s3.service.ts
2978
+ var S3Service = class extends AbstractService {
2979
+ static {
2980
+ __name(this, "S3Service");
2981
+ }
2982
+ static async getPreSignedUrl(params) {
2983
+ const endpoint = new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).addAdditionalParam("contentType", params.contentType);
2984
+ if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
2985
+ return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
2986
+ }
2987
+ static async getSignedUrl(params) {
2988
+ const endpoint = new EndpointCreator({ endpoint: Modules.S3, id: "sign" }).addAdditionalParam("key", params.key);
2989
+ if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
2990
+ return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
2991
+ }
2992
+ static async deleteFile(params) {
2993
+ this.callApi({
2994
+ type: Modules.S3,
2995
+ method: "DELETE" /* DELETE */,
2996
+ endpoint: new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).generate()
2997
+ });
2998
+ }
2999
+ };
3000
+
2481
3001
  // src/features/user/data/user.ts
2482
3002
  var User = class extends AbstractApiData {
2483
3003
  static {
@@ -2618,6 +3138,185 @@ var UserFields = /* @__PURE__ */ ((UserFields2) => {
2618
3138
  return UserFields2;
2619
3139
  })(UserFields || {});
2620
3140
 
3141
+ // src/features/user/data/user.service.ts
3142
+ var UserService = class extends AbstractService {
3143
+ static {
3144
+ __name(this, "UserService");
3145
+ }
3146
+ static async findFullUser() {
3147
+ const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "me", childEndpoint: "full" });
3148
+ return this.callApi({
3149
+ type: Modules.User,
3150
+ method: "GET" /* GET */,
3151
+ endpoint: endpoint.generate()
3152
+ });
3153
+ }
3154
+ static async findById(params) {
3155
+ return this.callApi({
3156
+ type: Modules.User,
3157
+ method: "GET" /* GET */,
3158
+ endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
3159
+ });
3160
+ }
3161
+ static async findByEmail(params) {
3162
+ const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "email", childEndpoint: params.email });
3163
+ return this.callApi({ type: Modules.User, method: "GET" /* GET */, endpoint: endpoint.generate() });
3164
+ }
3165
+ static async findMany(params) {
3166
+ const endpoint = new EndpointCreator({ endpoint: Modules.User });
3167
+ if (params.roleId) endpoint.addAdditionalParam("roleId", params.roleId);
3168
+ if (params.includeDeleted) endpoint.addAdditionalParam("includeDeleted", "true");
3169
+ if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
3170
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3171
+ return this.callApi({
3172
+ type: Modules.User,
3173
+ method: "GET" /* GET */,
3174
+ endpoint: endpoint.generate(),
3175
+ next: params.next
3176
+ });
3177
+ }
3178
+ static async findManyByContentIds(params) {
3179
+ const endpoint = new EndpointCreator({ endpoint: Modules.User });
3180
+ endpoint.addAdditionalParam("contentIds", params.contentIds.map((id) => id).join(","));
3181
+ endpoint.addAdditionalParam("includeDeleted", "true");
3182
+ endpoint.addAdditionalParam("fetchAll", "true");
3183
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3184
+ return this.callApi({
3185
+ type: Modules.User,
3186
+ method: "GET" /* GET */,
3187
+ endpoint: endpoint.generate(),
3188
+ next: params.next
3189
+ });
3190
+ }
3191
+ static async findRelevant(params) {
3192
+ const endpoint = new EndpointCreator({
3193
+ endpoint: Modules.Content,
3194
+ id: params.id,
3195
+ childEndpoint: "user-relevance"
3196
+ });
3197
+ if (Modules.User.inclusions?.lists?.fields) endpoint.limitToFields(Modules.User.inclusions.lists.fields);
3198
+ if (Modules.User.inclusions?.lists?.types) endpoint.limitToType(Modules.User.inclusions.lists.types);
3199
+ return this.callApi({
3200
+ type: Modules.User,
3201
+ method: "GET" /* GET */,
3202
+ endpoint: endpoint.generate(),
3203
+ next: params.next
3204
+ });
3205
+ }
3206
+ static async findManyForAmin(params) {
3207
+ if (!params.companyId) return [];
3208
+ const endpoint = new EndpointCreator({
3209
+ endpoint: Modules.Company,
3210
+ id: params.companyId,
3211
+ childEndpoint: Modules.User
3212
+ });
3213
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3214
+ return this.callApi({
3215
+ type: Modules.User,
3216
+ method: "GET" /* GET */,
3217
+ endpoint: endpoint.generate(),
3218
+ next: params.next,
3219
+ previous: params.prev
3220
+ });
3221
+ }
3222
+ static async findAllUsers(params) {
3223
+ const endpoint = new EndpointCreator({
3224
+ endpoint: Modules.Company,
3225
+ id: params.companyId,
3226
+ childEndpoint: Modules.User
3227
+ });
3228
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3229
+ if (params.isDeleted) endpoint.addAdditionalParam("isDeleted", "true");
3230
+ if (params.limitToRoles && params.limitToRoles.length > 0)
3231
+ endpoint.addAdditionalParam("limitToRoles", params.limitToRoles.join(","));
3232
+ return this.callApi({
3233
+ type: Modules.User,
3234
+ method: "GET" /* GET */,
3235
+ endpoint: endpoint.generate(),
3236
+ next: params.next
3237
+ });
3238
+ }
3239
+ static async findAllUsersByRole(params) {
3240
+ const endpoint = new EndpointCreator({ endpoint: Modules.Role, id: params.roleId, childEndpoint: Modules.User });
3241
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3242
+ return this.callApi({
3243
+ type: Modules.User,
3244
+ method: "GET" /* GET */,
3245
+ endpoint: endpoint.generate(),
3246
+ next: params.next
3247
+ });
3248
+ }
3249
+ static async findAllUsersNotInRole(params) {
3250
+ const endpoint = new EndpointCreator({
3251
+ endpoint: Modules.Role,
3252
+ id: params.roleId,
3253
+ childEndpoint: Modules.User
3254
+ }).addAdditionalParam("notInRole", "true");
3255
+ if (params.search) endpoint.addAdditionalParam("search", params.search);
3256
+ return this.callApi({
3257
+ type: Modules.User,
3258
+ method: "GET" /* GET */,
3259
+ endpoint: endpoint.generate(),
3260
+ next: params.next
3261
+ });
3262
+ }
3263
+ static async create(params) {
3264
+ return this.callApi({
3265
+ type: Modules.User,
3266
+ method: "POST" /* POST */,
3267
+ endpoint: new EndpointCreator({ endpoint: Modules.User }).generate(),
3268
+ companyId: params.companyId,
3269
+ input: params
3270
+ });
3271
+ }
3272
+ static async reactivate(params) {
3273
+ return this.callApi({
3274
+ type: Modules.User,
3275
+ method: "PATCH" /* PATCH */,
3276
+ endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
3277
+ });
3278
+ }
3279
+ static async sendInvitation(params) {
3280
+ const endpoint = new EndpointCreator({
3281
+ endpoint: Modules.User,
3282
+ id: params.userId,
3283
+ childEndpoint: "send-invitation-email"
3284
+ });
3285
+ if (params.companyId) endpoint.addAdditionalParam("companyId", params.companyId);
3286
+ this.callApi({
3287
+ type: Modules.User,
3288
+ method: "POST" /* POST */,
3289
+ endpoint: endpoint.generate()
3290
+ });
3291
+ }
3292
+ static async update(params) {
3293
+ return this.callApi({
3294
+ type: Modules.User,
3295
+ method: "PUT" /* PUT */,
3296
+ endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id }).generate(),
3297
+ companyId: params.companyId,
3298
+ input: params
3299
+ });
3300
+ }
3301
+ static async patchRate(params) {
3302
+ return this.callApi({
3303
+ type: Modules.User,
3304
+ method: "PATCH" /* PATCH */,
3305
+ endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id, childEndpoint: "rates" }).generate(),
3306
+ companyId: params.companyId,
3307
+ input: params
3308
+ });
3309
+ }
3310
+ static async delete(params) {
3311
+ await this.callApi({
3312
+ type: Modules.User,
3313
+ method: "DELETE" /* DELETE */,
3314
+ endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),
3315
+ companyId: params.companyId
3316
+ });
3317
+ }
3318
+ };
3319
+
2621
3320
  // src/features/user/user.module.ts
2622
3321
  var UserModule = /* @__PURE__ */ __name((factory) => factory({
2623
3322
  pageUrl: "/users",
@@ -2690,34 +3389,47 @@ export {
2690
3389
  getLucideIcon,
2691
3390
  getLucideIconByModule,
2692
3391
  getLucideIconByModuleName,
3392
+ Action,
3393
+ checkPermissions,
3394
+ checkPermissionsFromServer,
3395
+ getValueFromPath,
2693
3396
  Auth,
2694
- AuthComponent,
2695
3397
  configureAuth,
2696
3398
  getTokenHandler,
3399
+ AuthService,
3400
+ AuthComponent,
2697
3401
  AuthModule,
2698
3402
  Company,
2699
3403
  CompanyFields,
3404
+ CompanyService,
2700
3405
  CompanyModule,
2701
3406
  Content,
2702
3407
  ContentFields,
3408
+ ContentService,
2703
3409
  ContentModule,
2704
3410
  Feature,
3411
+ FeatureService,
2705
3412
  FeatureModule,
2706
3413
  Module,
2707
3414
  ModuleModule,
2708
3415
  Notification,
2709
3416
  NotificationFields,
3417
+ NotificationService,
2710
3418
  NotificationModule,
2711
3419
  Push,
3420
+ PushService,
2712
3421
  PushModule,
2713
3422
  Role,
2714
3423
  RoleFields,
3424
+ RoleService,
2715
3425
  RoleModule,
2716
3426
  S3,
2717
3427
  S3Module,
3428
+ S3Service,
2718
3429
  User,
2719
3430
  UserFields,
3431
+ UserService,
2720
3432
  UserModule,
2721
3433
  AuthorModule
2722
3434
  };
2723
- //# sourceMappingURL=chunk-KFL5ZFM4.mjs.map
3435
+ //# sourceMappingURL=chunk-4U5CJA44.mjs.map