@carlonicora/nextjs-jsonapi 1.6.0 → 1.7.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 (122) 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/scripts/generate-web-module/templates/components/container.template.js +1 -1
  56. package/dist/scripts/generate-web-module/templates/components/content.template.js +1 -1
  57. package/dist/scripts/generate-web-module/templates/components/deleter.template.js +1 -1
  58. package/dist/scripts/generate-web-module/templates/components/editor.template.js +4 -4
  59. package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
  60. package/dist/scripts/generate-web-module/templates/components/list.template.js +1 -1
  61. package/dist/scripts/generate-web-module/templates/components/multi-selector.template.js +3 -3
  62. package/dist/scripts/generate-web-module/templates/components/selector.template.js +3 -3
  63. package/dist/scripts/generate-web-module/templates/context.template.js +2 -2
  64. package/dist/scripts/generate-web-module/templates/module.template.js +1 -1
  65. package/dist/scripts/generate-web-module/templates/pages/detail-page.template.js +1 -1
  66. package/dist/scripts/generate-web-module/templates/pages/list-page.template.js +1 -1
  67. package/dist/scripts/generate-web-module/templates/table-hook.template.js +3 -3
  68. package/dist/scripts/generate-web-module/templates/table-hook.template.js.map +1 -1
  69. package/dist/server/index.d.mts +5 -235
  70. package/dist/server/index.d.ts +5 -235
  71. package/dist/server/index.js +12 -16
  72. package/dist/server/index.js.map +1 -1
  73. package/dist/server/index.mjs +3 -7
  74. package/dist/server/index.mjs.map +1 -1
  75. package/dist/{useSocket-BWJUXuOl.d.mts → useSocket-91s8M4Xd.d.mts} +1 -1
  76. package/dist/{useSocket-8vwK_R_c.d.ts → useSocket-DSR7vaXj.d.ts} +1 -1
  77. package/package.json +1 -1
  78. package/scripts/generate-web-module/templates/components/container.template.ts +1 -1
  79. package/scripts/generate-web-module/templates/components/content.template.ts +1 -1
  80. package/scripts/generate-web-module/templates/components/deleter.template.ts +1 -1
  81. package/scripts/generate-web-module/templates/components/editor.template.ts +4 -4
  82. package/scripts/generate-web-module/templates/components/list.template.ts +1 -1
  83. package/scripts/generate-web-module/templates/components/multi-selector.template.ts +3 -3
  84. package/scripts/generate-web-module/templates/components/selector.template.ts +3 -3
  85. package/scripts/generate-web-module/templates/context.template.ts +2 -2
  86. package/scripts/generate-web-module/templates/module.template.ts +1 -1
  87. package/scripts/generate-web-module/templates/pages/detail-page.template.ts +1 -1
  88. package/scripts/generate-web-module/templates/pages/list-page.template.ts +1 -1
  89. package/scripts/generate-web-module/templates/table-hook.template.ts +3 -3
  90. package/src/core/index.ts +3 -0
  91. package/src/features/auth/data/index.ts +1 -0
  92. package/src/features/company/data/index.ts +1 -0
  93. package/src/features/content/data/index.ts +1 -0
  94. package/src/features/feature/data/index.ts +1 -0
  95. package/src/features/notification/data/index.ts +1 -0
  96. package/src/features/push/data/index.ts +1 -0
  97. package/src/features/role/data/index.ts +1 -0
  98. package/src/features/s3/data/index.ts +1 -0
  99. package/src/features/user/data/index.ts +1 -0
  100. package/dist/BlockNoteEditor-7FM7B737.js.map +0 -1
  101. package/dist/JsonApiRequest-KOKGVPBI.js +0 -25
  102. package/dist/JsonApiRequest-KOKGVPBI.js.map +0 -1
  103. package/dist/chunk-2Z56AS2S.js.map +0 -1
  104. package/dist/chunk-37NJZ2VD.mjs +0 -637
  105. package/dist/chunk-37NJZ2VD.mjs.map +0 -1
  106. package/dist/chunk-AGAJMJ4T.js +0 -147
  107. package/dist/chunk-AGAJMJ4T.js.map +0 -1
  108. package/dist/chunk-CSM6AIAP.js +0 -98
  109. package/dist/chunk-CSM6AIAP.js.map +0 -1
  110. package/dist/chunk-F4Y3GZG4.mjs.map +0 -1
  111. package/dist/chunk-K4W5QXL5.mjs +0 -98
  112. package/dist/chunk-K4W5QXL5.mjs.map +0 -1
  113. package/dist/chunk-KFL5ZFM4.mjs.map +0 -1
  114. package/dist/chunk-LOSPCUCF.js +0 -637
  115. package/dist/chunk-LOSPCUCF.js.map +0 -1
  116. package/dist/chunk-RBIVEH2K.mjs +0 -147
  117. package/dist/chunk-RBIVEH2K.mjs.map +0 -1
  118. package/dist/chunk-SVX7E6RR.js.map +0 -1
  119. package/dist/chunk-ZUEEIQHW.js.map +0 -1
  120. package/dist/s3.interface-D7ttGatc.d.ts +0 -119
  121. package/dist/s3.interface-DlaMDRTn.d.mts +0 -119
  122. /package/dist/{JsonApiRequest-VCCRO732.mjs.map → JsonApiRequest-SYZ6FGCA.mjs.map} +0 -0
@@ -1,637 +0,0 @@
1
- import {
2
- JsonApiDelete,
3
- JsonApiGet,
4
- JsonApiPost
5
- } from "./chunk-F4Y3GZG4.mjs";
6
- import {
7
- AbstractService,
8
- EndpointCreator,
9
- Modules,
10
- getTokenHandler,
11
- rehydrate
12
- } from "./chunk-KFL5ZFM4.mjs";
13
- import {
14
- __name
15
- } from "./chunk-PAWJFY3S.mjs";
16
-
17
- // src/features/auth/data/auth.service.ts
18
- var AuthService = class extends AbstractService {
19
- static {
20
- __name(this, "AuthService");
21
- }
22
- static async login(params) {
23
- const language = params.language || "en-US";
24
- const apiResponse = await JsonApiPost({
25
- classKey: Modules.Auth,
26
- endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "login" }).generate(),
27
- body: { email: params.email, password: params.password },
28
- language
29
- });
30
- if (!apiResponse.ok) throw new Error(apiResponse.error);
31
- const auth = apiResponse.data;
32
- const handler = getTokenHandler();
33
- if (handler) {
34
- await handler.updateToken({
35
- token: auth.token,
36
- refreshToken: auth.refreshToken,
37
- userId: auth.user.id,
38
- companyId: auth.user.company?.id,
39
- licenseExpirationDate: auth.user.company?.licenseExpirationDate,
40
- roles: auth.user.roles.map((role) => role.id),
41
- features: auth.user.company?.features?.map((feature) => feature.id) ?? [],
42
- modules: auth.user.modules.map((module) => ({
43
- id: module.id,
44
- permissions: module.permissions
45
- }))
46
- });
47
- }
48
- return auth.user;
49
- }
50
- static async logout(params) {
51
- const language = params?.language || "en-US";
52
- await JsonApiDelete({
53
- classKey: Modules.Auth,
54
- endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),
55
- language
56
- });
57
- const handler = getTokenHandler();
58
- if (handler) {
59
- await handler.removeToken();
60
- }
61
- }
62
- static async initialiseForgotPassword(params) {
63
- const language = params.language || "en-US";
64
- const response = await JsonApiPost({
65
- classKey: Modules.Auth,
66
- endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "forgot" }).generate(),
67
- body: { email: params.email },
68
- language
69
- });
70
- if (!response.ok) {
71
- throw new Error(response.error);
72
- }
73
- }
74
- static async register(params) {
75
- const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "register" });
76
- await this.callApi({
77
- type: Modules.Auth,
78
- method: "POST" /* POST */,
79
- endpoint: endpoint.generate(),
80
- input: params
81
- });
82
- }
83
- static async activate(params) {
84
- const endpoint = new EndpointCreator({
85
- endpoint: Modules.Auth,
86
- id: "activate",
87
- childEndpoint: params.activationCode
88
- });
89
- await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate() });
90
- }
91
- static async validateCode(params) {
92
- const language = params.language || "en-US";
93
- const apiResponse = await JsonApiGet({
94
- classKey: Modules.Auth,
95
- endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
96
- language
97
- });
98
- if (!apiResponse.ok) throw new Error(apiResponse.error);
99
- }
100
- static async resetPassword(params) {
101
- const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "reset", childEndpoint: params.code });
102
- const input = { password: params.password };
103
- await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
104
- }
105
- static async acceptInvitation(params) {
106
- const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "invitation", childEndpoint: params.code });
107
- const input = { password: params.password };
108
- await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
109
- }
110
- static async findToken(params) {
111
- return await this.callApi({
112
- type: Modules.Auth,
113
- method: "POST" /* POST */,
114
- endpoint: new EndpointCreator({ endpoint: Modules.Auth }).addAdditionalParam("code", params.tokenCode).generate()
115
- });
116
- }
117
- static async saveToken(params) {
118
- const auth = rehydrate(Modules.Auth, params.dehydratedAuth);
119
- const handler = getTokenHandler();
120
- if (handler) {
121
- await handler.updateToken({
122
- token: auth.token,
123
- refreshToken: auth.refreshToken,
124
- userId: auth.user.id,
125
- companyId: auth.user.company?.id,
126
- licenseExpirationDate: auth.user.company?.licenseExpirationDate,
127
- roles: auth.user.roles.map((role) => role.id),
128
- features: auth.user.company?.features?.map((feature) => feature.id) ?? [],
129
- modules: auth.user.modules.map((module) => ({
130
- id: module.id,
131
- permissions: module.permissions
132
- }))
133
- });
134
- }
135
- }
136
- };
137
-
138
- // src/features/user/data/user.service.ts
139
- var UserService = class extends AbstractService {
140
- static {
141
- __name(this, "UserService");
142
- }
143
- static async findFullUser() {
144
- const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "me", childEndpoint: "full" });
145
- return this.callApi({
146
- type: Modules.User,
147
- method: "GET" /* GET */,
148
- endpoint: endpoint.generate()
149
- });
150
- }
151
- static async findById(params) {
152
- return this.callApi({
153
- type: Modules.User,
154
- method: "GET" /* GET */,
155
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
156
- });
157
- }
158
- static async findByEmail(params) {
159
- const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "email", childEndpoint: params.email });
160
- return this.callApi({ type: Modules.User, method: "GET" /* GET */, endpoint: endpoint.generate() });
161
- }
162
- static async findMany(params) {
163
- const endpoint = new EndpointCreator({ endpoint: Modules.User });
164
- if (params.roleId) endpoint.addAdditionalParam("roleId", params.roleId);
165
- if (params.includeDeleted) endpoint.addAdditionalParam("includeDeleted", "true");
166
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
167
- if (params.search) endpoint.addAdditionalParam("search", params.search);
168
- return this.callApi({
169
- type: Modules.User,
170
- method: "GET" /* GET */,
171
- endpoint: endpoint.generate(),
172
- next: params.next
173
- });
174
- }
175
- static async findManyByContentIds(params) {
176
- const endpoint = new EndpointCreator({ endpoint: Modules.User });
177
- endpoint.addAdditionalParam("contentIds", params.contentIds.map((id) => id).join(","));
178
- endpoint.addAdditionalParam("includeDeleted", "true");
179
- endpoint.addAdditionalParam("fetchAll", "true");
180
- if (params.search) endpoint.addAdditionalParam("search", params.search);
181
- return this.callApi({
182
- type: Modules.User,
183
- method: "GET" /* GET */,
184
- endpoint: endpoint.generate(),
185
- next: params.next
186
- });
187
- }
188
- static async findRelevant(params) {
189
- const endpoint = new EndpointCreator({
190
- endpoint: Modules.Content,
191
- id: params.id,
192
- childEndpoint: "user-relevance"
193
- });
194
- if (Modules.User.inclusions?.lists?.fields) endpoint.limitToFields(Modules.User.inclusions.lists.fields);
195
- if (Modules.User.inclusions?.lists?.types) endpoint.limitToType(Modules.User.inclusions.lists.types);
196
- return this.callApi({
197
- type: Modules.User,
198
- method: "GET" /* GET */,
199
- endpoint: endpoint.generate(),
200
- next: params.next
201
- });
202
- }
203
- static async findManyForAmin(params) {
204
- if (!params.companyId) return [];
205
- const endpoint = new EndpointCreator({
206
- endpoint: Modules.Company,
207
- id: params.companyId,
208
- childEndpoint: Modules.User
209
- });
210
- if (params.search) endpoint.addAdditionalParam("search", params.search);
211
- return this.callApi({
212
- type: Modules.User,
213
- method: "GET" /* GET */,
214
- endpoint: endpoint.generate(),
215
- next: params.next,
216
- previous: params.prev
217
- });
218
- }
219
- static async findAllUsers(params) {
220
- const endpoint = new EndpointCreator({
221
- endpoint: Modules.Company,
222
- id: params.companyId,
223
- childEndpoint: Modules.User
224
- });
225
- if (params.search) endpoint.addAdditionalParam("search", params.search);
226
- if (params.isDeleted) endpoint.addAdditionalParam("isDeleted", "true");
227
- if (params.limitToRoles && params.limitToRoles.length > 0)
228
- endpoint.addAdditionalParam("limitToRoles", params.limitToRoles.join(","));
229
- return this.callApi({
230
- type: Modules.User,
231
- method: "GET" /* GET */,
232
- endpoint: endpoint.generate(),
233
- next: params.next
234
- });
235
- }
236
- static async findAllUsersByRole(params) {
237
- const endpoint = new EndpointCreator({ endpoint: Modules.Role, id: params.roleId, childEndpoint: Modules.User });
238
- if (params.search) endpoint.addAdditionalParam("search", params.search);
239
- return this.callApi({
240
- type: Modules.User,
241
- method: "GET" /* GET */,
242
- endpoint: endpoint.generate(),
243
- next: params.next
244
- });
245
- }
246
- static async findAllUsersNotInRole(params) {
247
- const endpoint = new EndpointCreator({
248
- endpoint: Modules.Role,
249
- id: params.roleId,
250
- childEndpoint: Modules.User
251
- }).addAdditionalParam("notInRole", "true");
252
- if (params.search) endpoint.addAdditionalParam("search", params.search);
253
- return this.callApi({
254
- type: Modules.User,
255
- method: "GET" /* GET */,
256
- endpoint: endpoint.generate(),
257
- next: params.next
258
- });
259
- }
260
- static async create(params) {
261
- return this.callApi({
262
- type: Modules.User,
263
- method: "POST" /* POST */,
264
- endpoint: new EndpointCreator({ endpoint: Modules.User }).generate(),
265
- companyId: params.companyId,
266
- input: params
267
- });
268
- }
269
- static async reactivate(params) {
270
- return this.callApi({
271
- type: Modules.User,
272
- method: "PATCH" /* PATCH */,
273
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
274
- });
275
- }
276
- static async sendInvitation(params) {
277
- const endpoint = new EndpointCreator({
278
- endpoint: Modules.User,
279
- id: params.userId,
280
- childEndpoint: "send-invitation-email"
281
- });
282
- if (params.companyId) endpoint.addAdditionalParam("companyId", params.companyId);
283
- this.callApi({
284
- type: Modules.User,
285
- method: "POST" /* POST */,
286
- endpoint: endpoint.generate()
287
- });
288
- }
289
- static async update(params) {
290
- return this.callApi({
291
- type: Modules.User,
292
- method: "PUT" /* PUT */,
293
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id }).generate(),
294
- companyId: params.companyId,
295
- input: params
296
- });
297
- }
298
- static async patchRate(params) {
299
- return this.callApi({
300
- type: Modules.User,
301
- method: "PATCH" /* PATCH */,
302
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id, childEndpoint: "rates" }).generate(),
303
- companyId: params.companyId,
304
- input: params
305
- });
306
- }
307
- static async delete(params) {
308
- await this.callApi({
309
- type: Modules.User,
310
- method: "DELETE" /* DELETE */,
311
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),
312
- companyId: params.companyId
313
- });
314
- }
315
- };
316
-
317
- // src/features/company/data/company.service.ts
318
- var CompanyService = class extends AbstractService {
319
- static {
320
- __name(this, "CompanyService");
321
- }
322
- static async findOne(params) {
323
- return this.callApi({
324
- type: Modules.Company,
325
- method: "GET" /* GET */,
326
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
327
- });
328
- }
329
- static async findMany(params) {
330
- const endpoint = new EndpointCreator({ endpoint: Modules.Company });
331
- if (params.search) endpoint.addAdditionalParam("search", params.search);
332
- return this.callApi({
333
- type: Modules.Company,
334
- method: "GET" /* GET */,
335
- endpoint: endpoint.generate(),
336
- next: params.next
337
- });
338
- }
339
- static async delete(params) {
340
- await this.callApi({
341
- type: Modules.Company,
342
- method: "DELETE" /* DELETE */,
343
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
344
- });
345
- }
346
- static async create(params) {
347
- return this.callApi({
348
- type: Modules.Company,
349
- method: "POST" /* POST */,
350
- endpoint: new EndpointCreator({ endpoint: Modules.Company }).generate(),
351
- input: params
352
- });
353
- }
354
- static async update(params) {
355
- return this.callApi({
356
- type: Modules.Company,
357
- method: "PUT" /* PUT */,
358
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id }).generate(),
359
- input: params
360
- });
361
- }
362
- static async updateConfigurations(params) {
363
- return this.callApi({
364
- type: Modules.Company,
365
- method: "PUT" /* PUT */,
366
- endpoint: new EndpointCreator({
367
- endpoint: Modules.Company,
368
- id: params.id,
369
- childEndpoint: "configurations"
370
- }).generate(),
371
- input: params
372
- });
373
- }
374
- static async activateLicense(params) {
375
- return this.callApi({
376
- type: Modules.Company,
377
- method: "PUT" /* PUT */,
378
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id, childEndpoint: "license" }).generate(),
379
- input: params
380
- });
381
- }
382
- };
383
-
384
- // src/features/role/data/role.service.ts
385
- var RoleService = class extends AbstractService {
386
- static {
387
- __name(this, "RoleService");
388
- }
389
- static async findById(params) {
390
- return this.callApi({
391
- type: Modules.Role,
392
- method: "GET" /* GET */,
393
- endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
394
- });
395
- }
396
- static async findAllRoles(params) {
397
- const endpoint = new EndpointCreator({ endpoint: Modules.Role });
398
- if (params.search) endpoint.addAdditionalParam("search", params.search);
399
- return this.callApi({
400
- type: Modules.Role,
401
- method: "GET" /* GET */,
402
- endpoint: endpoint.generate(),
403
- next: params.next
404
- });
405
- }
406
- static async findAllRolesByUser(params) {
407
- const endpoint = new EndpointCreator({ endpoint: Modules.User, id: params.userId, childEndpoint: Modules.Role });
408
- if (params.search) endpoint.addAdditionalParam("search", params.search);
409
- return this.callApi({
410
- type: Modules.Role,
411
- method: "GET" /* GET */,
412
- endpoint: endpoint.generate(),
413
- next: params.next
414
- });
415
- }
416
- static async findAllRolesUserNotIn(params) {
417
- const endpoint = new EndpointCreator({
418
- endpoint: Modules.User,
419
- id: params.userId,
420
- childEndpoint: Modules.Role
421
- }).addAdditionalParam("userNotIn", "true");
422
- if (params.search) endpoint.addAdditionalParam("search", params.search);
423
- return this.callApi({
424
- type: Modules.Role,
425
- method: "GET" /* GET */,
426
- endpoint: endpoint.generate(),
427
- next: params.next
428
- });
429
- }
430
- static async addUserToRole(params) {
431
- this.callApi({
432
- type: Modules.Role,
433
- method: "POST" /* POST */,
434
- endpoint: new EndpointCreator({
435
- endpoint: Modules.Role,
436
- id: params.roleId,
437
- childEndpoint: Modules.User,
438
- childId: params.userId
439
- }).generate()
440
- });
441
- }
442
- static async removeUserFromRole(params) {
443
- this.callApi({
444
- type: Modules.Role,
445
- method: "DELETE" /* DELETE */,
446
- endpoint: new EndpointCreator({
447
- endpoint: Modules.Role,
448
- id: params.roleId,
449
- childEndpoint: Modules.User,
450
- childId: params.userId
451
- }).generate()
452
- });
453
- }
454
- static async create(params) {
455
- return this.callApi({
456
- type: Modules.Role,
457
- method: "POST" /* POST */,
458
- endpoint: new EndpointCreator({ endpoint: Modules.Role }).generate(),
459
- input: { id: params.roleId, name: params.name, description: params.description }
460
- });
461
- }
462
- static async update(params) {
463
- return this.callApi({
464
- type: Modules.Role,
465
- method: "PUT" /* PUT */,
466
- endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),
467
- input: { id: params.roleId, name: params.name, description: params.description }
468
- });
469
- }
470
- static async delete(params) {
471
- return this.callApi({
472
- type: Modules.Role,
473
- method: "DELETE" /* DELETE */,
474
- endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
475
- });
476
- }
477
- };
478
-
479
- // src/features/content/data/content.service.ts
480
- var ContentService = class extends AbstractService {
481
- static {
482
- __name(this, "ContentService");
483
- }
484
- static async findMany(params) {
485
- const endpoint = new EndpointCreator({ endpoint: Modules.Content });
486
- if (params.contentIds) {
487
- endpoint.addAdditionalParam("contentIds", params.contentIds.join(","));
488
- endpoint.addAdditionalParam("fetchAll", "true");
489
- } else {
490
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
491
- if (params.search) endpoint.addAdditionalParam("search", params.search);
492
- }
493
- if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
494
- if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
495
- return this.callApi({
496
- type: Modules.Content,
497
- method: "GET" /* GET */,
498
- endpoint: endpoint.generate(),
499
- next: params.next
500
- });
501
- }
502
- static async findRelevant(params) {
503
- const endpoint = new EndpointCreator({
504
- endpoint: Modules.Content,
505
- id: params.id,
506
- childEndpoint: "relevance"
507
- });
508
- if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
509
- if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
510
- return this.callApi({
511
- type: Modules.Content,
512
- method: "GET" /* GET */,
513
- endpoint: endpoint.generate(),
514
- next: params.next
515
- });
516
- }
517
- static async findManyByAuthor(params) {
518
- const endpoint = new EndpointCreator({
519
- endpoint: Modules.Author,
520
- id: params.userId,
521
- childEndpoint: Modules.Content
522
- });
523
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
524
- if (params.search) endpoint.addAdditionalParam("search", params.search);
525
- if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
526
- if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
527
- return this.callApi({
528
- type: Modules.Content,
529
- method: "GET" /* GET */,
530
- endpoint: endpoint.generate(),
531
- next: params.next
532
- });
533
- }
534
- };
535
-
536
- // src/features/notification/data/notification.service.ts
537
- var NotificationService = class extends AbstractService {
538
- static {
539
- __name(this, "NotificationService");
540
- }
541
- static async findMany(params) {
542
- const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
543
- if (params.isArchived) endpoint.addAdditionalParam("isArchived", "true");
544
- return this.callApi({
545
- type: Modules.Notification,
546
- method: "GET" /* GET */,
547
- endpoint: endpoint.generate(),
548
- next: params.next
549
- });
550
- }
551
- static async markAsRead(params) {
552
- const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
553
- await this.callApi({
554
- type: Modules.Notification,
555
- method: "PATCH" /* PATCH */,
556
- endpoint: endpoint.generate(),
557
- input: params.data,
558
- overridesJsonApiCreation: true
559
- });
560
- }
561
- static async archive(params) {
562
- const endpoint = new EndpointCreator({ endpoint: Modules.Notification, id: params.id, childEndpoint: "archive" });
563
- await this.callApi({ type: Modules.Notification, method: "POST" /* POST */, endpoint: endpoint.generate() });
564
- }
565
- };
566
-
567
- // src/features/feature/data/feature.service.ts
568
- var FeatureService = class extends AbstractService {
569
- static {
570
- __name(this, "FeatureService");
571
- }
572
- static async findMany(params) {
573
- const endpoint = new EndpointCreator({ endpoint: Modules.Feature });
574
- if (params.companyId) endpoint.endpoint(Modules.Company).id(params.companyId).childEndpoint(Modules.Feature);
575
- if (params.search) endpoint.addAdditionalParam("search", params.search);
576
- return this.callApi({
577
- type: Modules.Feature,
578
- method: "GET" /* GET */,
579
- endpoint: endpoint.generate(),
580
- next: params.next
581
- });
582
- }
583
- };
584
-
585
- // src/features/push/data/push.service.ts
586
- var PushService = class extends AbstractService {
587
- static {
588
- __name(this, "PushService");
589
- }
590
- static async register(params) {
591
- const endpoint = new EndpointCreator({ endpoint: Modules.Push });
592
- await this.callApi({
593
- type: Modules.Push,
594
- method: "POST" /* POST */,
595
- endpoint: endpoint.generate(),
596
- input: params.data,
597
- overridesJsonApiCreation: true
598
- });
599
- }
600
- };
601
-
602
- // src/features/s3/data/s3.service.ts
603
- var S3Service = class extends AbstractService {
604
- static {
605
- __name(this, "S3Service");
606
- }
607
- static async getPreSignedUrl(params) {
608
- const endpoint = new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).addAdditionalParam("contentType", params.contentType);
609
- if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
610
- return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
611
- }
612
- static async getSignedUrl(params) {
613
- const endpoint = new EndpointCreator({ endpoint: Modules.S3, id: "sign" }).addAdditionalParam("key", params.key);
614
- if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
615
- return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
616
- }
617
- static async deleteFile(params) {
618
- this.callApi({
619
- type: Modules.S3,
620
- method: "DELETE" /* DELETE */,
621
- endpoint: new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).generate()
622
- });
623
- }
624
- };
625
-
626
- export {
627
- AuthService,
628
- UserService,
629
- CompanyService,
630
- RoleService,
631
- ContentService,
632
- NotificationService,
633
- FeatureService,
634
- PushService,
635
- S3Service
636
- };
637
- //# sourceMappingURL=chunk-37NJZ2VD.mjs.map