@carlonicora/nextjs-jsonapi 1.3.1 → 1.5.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 (107) hide show
  1. package/README.md +208 -127
  2. package/dist/AuthComponent-B_Ps2Vb9.d.ts +78 -0
  3. package/dist/AuthComponent-CxnGgvoh.d.mts +78 -0
  4. package/dist/{BlockNoteEditor-V625C23O.mjs → BlockNoteEditor-AIEEQM6A.mjs} +4 -6
  5. package/dist/{BlockNoteEditor-V625C23O.mjs.map → BlockNoteEditor-AIEEQM6A.mjs.map} +1 -1
  6. package/dist/{BlockNoteEditor-7WYPN34K.js → BlockNoteEditor-G6AK2NWA.js} +8 -10
  7. package/dist/BlockNoteEditor-G6AK2NWA.js.map +1 -0
  8. package/dist/chunk-3UELCPIN.js +46 -0
  9. package/dist/chunk-3UELCPIN.js.map +1 -0
  10. package/dist/{chunk-5QC7A6BL.mjs → chunk-J7YDGYSW.mjs} +2668 -1319
  11. package/dist/chunk-J7YDGYSW.mjs.map +1 -0
  12. package/dist/chunk-SZZYEG3P.mjs +46 -0
  13. package/dist/chunk-SZZYEG3P.mjs.map +1 -0
  14. package/dist/{chunk-K2ANOT66.js → chunk-VET55IZO.js} +1869 -520
  15. package/dist/chunk-VET55IZO.js.map +1 -0
  16. package/dist/client/index.d.mts +2 -2
  17. package/dist/client/index.d.ts +2 -2
  18. package/dist/client/index.js +3 -4
  19. package/dist/client/index.js.map +1 -1
  20. package/dist/client/index.mjs +2 -3
  21. package/dist/components/index.d.mts +6 -69
  22. package/dist/components/index.d.ts +6 -69
  23. package/dist/components/index.js +3 -4
  24. package/dist/components/index.js.map +1 -1
  25. package/dist/components/index.mjs +2 -3
  26. package/dist/{content.interface-C_PGZMuy.d.ts → content.interface-CR2aBeAW.d.ts} +1 -1
  27. package/dist/{content.interface-D_WS6CrB.d.mts → content.interface-FpLfsaRm.d.mts} +1 -1
  28. package/dist/contexts/index.d.mts +3 -3
  29. package/dist/contexts/index.d.ts +3 -3
  30. package/dist/contexts/index.js +3 -4
  31. package/dist/contexts/index.js.map +1 -1
  32. package/dist/contexts/index.mjs +2 -3
  33. package/dist/features/index.d.mts +50 -49
  34. package/dist/features/index.d.ts +50 -49
  35. package/dist/features/index.js +24 -3
  36. package/dist/features/index.js.map +1 -1
  37. package/dist/features/index.mjs +23 -2
  38. package/dist/hooks/index.d.mts +3 -3
  39. package/dist/hooks/index.d.ts +3 -3
  40. package/dist/hooks/index.js +3 -4
  41. package/dist/hooks/index.js.map +1 -1
  42. package/dist/hooks/index.mjs +2 -3
  43. package/dist/index.js +2 -2
  44. package/dist/index.mjs +1 -1
  45. package/dist/{notification.interface-BBgMUdLR.d.mts → notification.interface-B2BrLoDA.d.mts} +1 -1
  46. package/dist/{notification.interface-gyvT-Z2F.d.ts → notification.interface-DlZLnAfg.d.ts} +1 -1
  47. package/dist/roles/index.d.mts +7 -1
  48. package/dist/roles/index.d.ts +7 -1
  49. package/dist/roles/index.js +8 -2
  50. package/dist/roles/index.js.map +1 -1
  51. package/dist/roles/index.mjs +7 -1
  52. package/dist/scripts/generate-web-module/generator.d.ts.map +1 -1
  53. package/dist/scripts/generate-web-module/generator.js +8 -5
  54. package/dist/scripts/generate-web-module/generator.js.map +1 -1
  55. package/dist/scripts/generate-web-module/index.js +1 -1
  56. package/dist/scripts/generate-web-module/index.js.map +1 -1
  57. package/dist/scripts/generate-web-module/templates/components/editor.template.js +8 -1
  58. package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
  59. package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts +4 -3
  60. package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts.map +1 -1
  61. package/dist/scripts/generate-web-module/transformers/parent-detector.js +9 -3
  62. package/dist/scripts/generate-web-module/transformers/parent-detector.js.map +1 -1
  63. package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts +11 -0
  64. package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts.map +1 -1
  65. package/dist/scripts/generate-web-module/transformers/relationship-resolver.js +36 -9
  66. package/dist/scripts/generate-web-module/transformers/relationship-resolver.js.map +1 -1
  67. package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts +2 -0
  68. package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts.map +1 -1
  69. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +1 -0
  70. package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -1
  71. package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts +4 -3
  72. package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts.map +1 -1
  73. package/dist/scripts/generate-web-module/utils/i18n-updater.js +9 -9
  74. package/dist/scripts/generate-web-module/utils/i18n-updater.js.map +1 -1
  75. package/dist/scripts/generate-web-module/validators/json-schema-validator.js +3 -3
  76. package/dist/scripts/generate-web-module/validators/json-schema-validator.js.map +1 -1
  77. package/dist/{useSocket-DzMKRKCA.d.ts → useSocket-BV6yMdWS.d.ts} +1 -1
  78. package/dist/{useSocket-Cn7fB_B1.d.mts → useSocket-L-An7_Mr.d.mts} +1 -1
  79. package/dist/{user.interface-CAsTIbuQ.d.mts → user.interface-CooB1R79.d.mts} +13 -13
  80. package/dist/{user.interface-CbWqMaaU.d.ts → user.interface-KnIT9pVY.d.ts} +13 -13
  81. package/package.json +1 -1
  82. package/scripts/generate-web-module/generator.ts +8 -5
  83. package/scripts/generate-web-module/index.ts +1 -1
  84. package/scripts/generate-web-module/templates/components/editor.template.ts +7 -2
  85. package/scripts/generate-web-module/transformers/parent-detector.ts +10 -3
  86. package/scripts/generate-web-module/transformers/relationship-resolver.ts +36 -9
  87. package/scripts/generate-web-module/types/json-schema.interface.ts +2 -0
  88. package/scripts/generate-web-module/types/template-data.interface.ts +1 -0
  89. package/scripts/generate-web-module/utils/i18n-updater.ts +9 -9
  90. package/scripts/generate-web-module/validators/json-schema-validator.ts +3 -3
  91. package/src/features/auth/components/details/LandingComponent.tsx +27 -29
  92. package/src/features/user/index.ts +1 -0
  93. package/src/roles/config.ts +15 -0
  94. package/src/roles/index.ts +9 -1
  95. package/dist/AuthComponent-hxOPs9o8.d.mts +0 -11
  96. package/dist/AuthComponent-hxOPs9o8.d.ts +0 -11
  97. package/dist/BlockNoteEditor-7WYPN34K.js.map +0 -1
  98. package/dist/chunk-4HCRAOS5.js +0 -28
  99. package/dist/chunk-4HCRAOS5.js.map +0 -1
  100. package/dist/chunk-5QC7A6BL.mjs.map +0 -1
  101. package/dist/chunk-BLWVZK6J.mjs +0 -28
  102. package/dist/chunk-BLWVZK6J.mjs.map +0 -1
  103. package/dist/chunk-HTLEKZND.mjs +0 -1375
  104. package/dist/chunk-HTLEKZND.mjs.map +0 -1
  105. package/dist/chunk-K2ANOT66.js.map +0 -1
  106. package/dist/chunk-PO5Q3H5I.js +0 -1375
  107. package/dist/chunk-PO5Q3H5I.js.map +0 -1
@@ -1,1375 +0,0 @@
1
- import {
2
- getTokenHandler
3
- } from "./chunk-SM63SZCP.mjs";
4
- import {
5
- JsonApiDelete,
6
- JsonApiGet,
7
- JsonApiPost
8
- } from "./chunk-IKBA4AHN.mjs";
9
- import {
10
- AbstractApiData,
11
- AbstractService,
12
- EndpointCreator,
13
- Modules,
14
- createJsonApiInclusion,
15
- rehydrate
16
- } from "./chunk-FMBQZAIP.mjs";
17
- import {
18
- __name
19
- } from "./chunk-PAWJFY3S.mjs";
20
-
21
- // src/features/auth/auth.module.ts
22
- var AuthModule = /* @__PURE__ */ __name((factory) => factory({
23
- pageUrl: "/auth",
24
- name: "auth",
25
- model: Auth
26
- }), "AuthModule");
27
-
28
- // src/features/auth/data/auth.ts
29
- var Auth = class extends AbstractApiData {
30
- static {
31
- __name(this, "Auth");
32
- }
33
- _token;
34
- _refreshToken;
35
- _user;
36
- get token() {
37
- if (!this._token) throw new Error("Token is not defined");
38
- return this._token;
39
- }
40
- get refreshToken() {
41
- if (!this._refreshToken) throw new Error("Refresh token is not defined");
42
- return this._refreshToken;
43
- }
44
- get user() {
45
- if (!this._user) throw new Error("User is not defined");
46
- return this._user;
47
- }
48
- rehydrate(data) {
49
- super.rehydrate(data);
50
- this._token = data.jsonApi.attributes.token ?? void 0;
51
- this._refreshToken = data.jsonApi.attributes.refreshToken ?? void 0;
52
- this._user = this._readIncluded(data, "user", Modules.User);
53
- return this;
54
- }
55
- createJsonApi(data) {
56
- const response = {
57
- data: {
58
- type: Modules.Auth.name,
59
- attributes: {}
60
- }
61
- };
62
- if (data.id) response.data.id = data.id;
63
- if (data.email !== void 0) response.data.attributes.email = data.email;
64
- if (data.name !== void 0) response.data.attributes.name = data.name;
65
- if (data.companyName !== void 0) response.data.attributes.companyName = data.companyName;
66
- if (data.password !== void 0) response.data.attributes.password = data.password;
67
- if (data.partitaIva !== void 0) response.data.attributes.partitaIva = data.partitaIva;
68
- if (data.codiceFiscale !== void 0) response.data.attributes.codiceFiscale = data.codiceFiscale;
69
- return response;
70
- }
71
- };
72
-
73
- // src/features/auth/data/auth.service.ts
74
- var AuthService = class extends AbstractService {
75
- static {
76
- __name(this, "AuthService");
77
- }
78
- static async login(params) {
79
- const language = params.language || "en-US";
80
- const apiResponse = await JsonApiPost({
81
- classKey: Modules.Auth,
82
- endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "login" }).generate(),
83
- body: { email: params.email, password: params.password },
84
- language
85
- });
86
- if (!apiResponse.ok) throw new Error(apiResponse.error);
87
- const auth = apiResponse.data;
88
- const handler = getTokenHandler();
89
- if (handler) {
90
- await handler.updateToken({
91
- token: auth.token,
92
- refreshToken: auth.refreshToken,
93
- userId: auth.user.id,
94
- companyId: auth.user.company?.id,
95
- licenseExpirationDate: auth.user.company?.licenseExpirationDate,
96
- roles: auth.user.roles.map((role) => role.id),
97
- features: auth.user.company?.features?.map((feature) => feature.id) ?? [],
98
- modules: auth.user.modules.map((module) => ({
99
- id: module.id,
100
- permissions: module.permissions
101
- }))
102
- });
103
- }
104
- return auth.user;
105
- }
106
- static async logout(params) {
107
- const language = params?.language || "en-US";
108
- await JsonApiDelete({
109
- classKey: Modules.Auth,
110
- endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),
111
- language
112
- });
113
- const handler = getTokenHandler();
114
- if (handler) {
115
- await handler.removeToken();
116
- }
117
- }
118
- static async initialiseForgotPassword(params) {
119
- const language = params.language || "en-US";
120
- const response = await JsonApiPost({
121
- classKey: Modules.Auth,
122
- endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "forgot" }).generate(),
123
- body: { email: params.email },
124
- language
125
- });
126
- if (!response.ok) {
127
- throw new Error(response.error);
128
- }
129
- }
130
- static async register(params) {
131
- const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "register" });
132
- await this.callApi({
133
- type: Modules.Auth,
134
- method: "POST" /* POST */,
135
- endpoint: endpoint.generate(),
136
- input: params
137
- });
138
- }
139
- static async activate(params) {
140
- const endpoint = new EndpointCreator({
141
- endpoint: Modules.Auth,
142
- id: "activate",
143
- childEndpoint: params.activationCode
144
- });
145
- await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate() });
146
- }
147
- static async validateCode(params) {
148
- const language = params.language || "en-US";
149
- const apiResponse = await JsonApiGet({
150
- classKey: Modules.Auth,
151
- endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
152
- language
153
- });
154
- if (!apiResponse.ok) throw new Error(apiResponse.error);
155
- }
156
- static async resetPassword(params) {
157
- const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "reset", childEndpoint: params.code });
158
- const input = { password: params.password };
159
- await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
160
- }
161
- static async acceptInvitation(params) {
162
- const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "invitation", childEndpoint: params.code });
163
- const input = { password: params.password };
164
- await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
165
- }
166
- static async findToken(params) {
167
- return await this.callApi({
168
- type: Modules.Auth,
169
- method: "POST" /* POST */,
170
- endpoint: new EndpointCreator({ endpoint: Modules.Auth }).addAdditionalParam("code", params.tokenCode).generate()
171
- });
172
- }
173
- static async saveToken(params) {
174
- const auth = rehydrate(Modules.Auth, params.dehydratedAuth);
175
- const handler = getTokenHandler();
176
- if (handler) {
177
- await handler.updateToken({
178
- token: auth.token,
179
- refreshToken: auth.refreshToken,
180
- userId: auth.user.id,
181
- companyId: auth.user.company?.id,
182
- licenseExpirationDate: auth.user.company?.licenseExpirationDate,
183
- roles: auth.user.roles.map((role) => role.id),
184
- features: auth.user.company?.features?.map((feature) => feature.id) ?? [],
185
- modules: auth.user.modules.map((module) => ({
186
- id: module.id,
187
- permissions: module.permissions
188
- }))
189
- });
190
- }
191
- }
192
- };
193
-
194
- // src/features/auth/enums/AuthComponent.ts
195
- var AuthComponent = /* @__PURE__ */ ((AuthComponent2) => {
196
- AuthComponent2[AuthComponent2["Login"] = 0] = "Login";
197
- AuthComponent2[AuthComponent2["ForgotPassword"] = 1] = "ForgotPassword";
198
- AuthComponent2[AuthComponent2["ResetPassword"] = 2] = "ResetPassword";
199
- AuthComponent2[AuthComponent2["ActivateAccount"] = 3] = "ActivateAccount";
200
- AuthComponent2[AuthComponent2["AcceptInvitation"] = 4] = "AcceptInvitation";
201
- AuthComponent2[AuthComponent2["Register"] = 5] = "Register";
202
- AuthComponent2[AuthComponent2["Landing"] = 6] = "Landing";
203
- return AuthComponent2;
204
- })(AuthComponent || {});
205
-
206
- // src/features/company/company.module.ts
207
- var CompanyModule = /* @__PURE__ */ __name((factory) => factory({
208
- pageUrl: "/companies",
209
- name: "companies",
210
- model: Company,
211
- moduleId: "f9e77c8f-bfd1-4fd4-80b0-e1d891ab7113"
212
- }), "CompanyModule");
213
-
214
- // src/features/company/data/company.ts
215
- var Company = class extends AbstractApiData {
216
- static {
217
- __name(this, "Company");
218
- }
219
- _name;
220
- _logo;
221
- _logoUrl;
222
- _configurations;
223
- _licenseExpirationDate;
224
- _features;
225
- _modules;
226
- get name() {
227
- if (this._name === void 0) throw new Error("Name is not defined");
228
- return this._name;
229
- }
230
- get logo() {
231
- return this._logo;
232
- }
233
- get logoUrl() {
234
- return this._logoUrl;
235
- }
236
- get licenseExpirationDate() {
237
- return this._licenseExpirationDate;
238
- }
239
- get features() {
240
- return this._features ?? [];
241
- }
242
- get modules() {
243
- return this._modules ?? [];
244
- }
245
- get configurations() {
246
- return this._configurations;
247
- }
248
- rehydrate(data) {
249
- super.rehydrate(data);
250
- this._name = data.jsonApi.attributes.name;
251
- this._configurations = data.jsonApi.attributes.configurations ? JSON.parse(data.jsonApi.attributes.configurations) : void 0;
252
- this._logo = data.jsonApi.attributes.logo;
253
- this._logoUrl = data.jsonApi.attributes.logoUrl;
254
- this._licenseExpirationDate = data.jsonApi.attributes.licenseExpirationDate ? new Date(data.jsonApi.attributes.licenseExpirationDate) : void 0;
255
- this._features = this._readIncluded(data, "features", Modules.Feature);
256
- this._modules = this._readIncluded(data, "modules", Modules.Module);
257
- return this;
258
- }
259
- createJsonApi(data) {
260
- const response = {
261
- data: {
262
- type: Modules.Company.name,
263
- id: data.id,
264
- attributes: {},
265
- meta: {},
266
- relationships: {}
267
- },
268
- included: []
269
- };
270
- if (data.name) response.data.attributes.name = data.name;
271
- if (data.configurations) response.data.attributes.configurations = JSON.stringify(data.configurations);
272
- if (data.logo) response.data.attributes.logo = data.logo;
273
- if (data.license) response.data.attributes.license = data.license;
274
- if (data.privateKey) response.data.attributes.privateKey = data.privateKey;
275
- if (data.featureIds && data.featureIds.length > 0) {
276
- response.data.relationships.features = {
277
- data: data.featureIds.map((featureId) => ({
278
- type: Modules.Feature.name,
279
- id: featureId
280
- }))
281
- };
282
- }
283
- if (data.moduleIds && data.moduleIds.length > 0) {
284
- response.data.relationships.modules = {
285
- data: data.moduleIds.map((moduleId) => ({
286
- type: Modules.Module.name,
287
- id: moduleId
288
- }))
289
- };
290
- }
291
- return response;
292
- }
293
- };
294
-
295
- // src/features/company/data/company.fields.ts
296
- var CompanyFields = /* @__PURE__ */ ((CompanyFields2) => {
297
- CompanyFields2["companyId"] = "companyId";
298
- CompanyFields2["name"] = "name";
299
- CompanyFields2["createdAt"] = "createdAt";
300
- CompanyFields2["updatedAt"] = "updatedAt";
301
- return CompanyFields2;
302
- })(CompanyFields || {});
303
-
304
- // src/features/company/data/company.service.ts
305
- var CompanyService = class extends AbstractService {
306
- static {
307
- __name(this, "CompanyService");
308
- }
309
- static async findOne(params) {
310
- return this.callApi({
311
- type: Modules.Company,
312
- method: "GET" /* GET */,
313
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
314
- });
315
- }
316
- static async findMany(params) {
317
- const endpoint = new EndpointCreator({ endpoint: Modules.Company });
318
- if (params.search) endpoint.addAdditionalParam("search", params.search);
319
- return this.callApi({
320
- type: Modules.Company,
321
- method: "GET" /* GET */,
322
- endpoint: endpoint.generate(),
323
- next: params.next
324
- });
325
- }
326
- static async delete(params) {
327
- await this.callApi({
328
- type: Modules.Company,
329
- method: "DELETE" /* DELETE */,
330
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
331
- });
332
- }
333
- static async create(params) {
334
- return this.callApi({
335
- type: Modules.Company,
336
- method: "POST" /* POST */,
337
- endpoint: new EndpointCreator({ endpoint: Modules.Company }).generate(),
338
- input: params
339
- });
340
- }
341
- static async update(params) {
342
- return this.callApi({
343
- type: Modules.Company,
344
- method: "PUT" /* PUT */,
345
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id }).generate(),
346
- input: params
347
- });
348
- }
349
- static async updateConfigurations(params) {
350
- return this.callApi({
351
- type: Modules.Company,
352
- method: "PUT" /* PUT */,
353
- endpoint: new EndpointCreator({
354
- endpoint: Modules.Company,
355
- id: params.id,
356
- childEndpoint: "configurations"
357
- }).generate(),
358
- input: params
359
- });
360
- }
361
- static async activateLicense(params) {
362
- return this.callApi({
363
- type: Modules.Company,
364
- method: "PUT" /* PUT */,
365
- endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id, childEndpoint: "license" }).generate(),
366
- input: params
367
- });
368
- }
369
- };
370
-
371
- // src/features/content/content.module.ts
372
- var ContentModule = /* @__PURE__ */ __name((factory) => factory({
373
- pageUrl: "/contents",
374
- name: "contents",
375
- model: Content,
376
- inclusions: {
377
- lists: {
378
- fields: [
379
- createJsonApiInclusion("content", [`name`, `tldr`, `abstract`, `aiStatus`, `relevance`]),
380
- createJsonApiInclusion("users", [`name`, `avatar`]),
381
- createJsonApiInclusion("topics", [`name`]),
382
- createJsonApiInclusion("expertises", [`name`])
383
- ]
384
- }
385
- }
386
- }), "ContentModule");
387
-
388
- // src/features/content/data/content.ts
389
- var Content = class extends AbstractApiData {
390
- static {
391
- __name(this, "Content");
392
- }
393
- _contentType;
394
- _name;
395
- _abstract;
396
- _tldr;
397
- _aiStatus;
398
- _relevance;
399
- _author;
400
- _editors;
401
- get searchResult() {
402
- return this._name ?? "";
403
- }
404
- get contentType() {
405
- return this._contentType;
406
- }
407
- get name() {
408
- if (this._name === void 0) throw new Error("JsonApi error: content name is missing");
409
- return this._name;
410
- }
411
- get abstract() {
412
- return this._abstract;
413
- }
414
- get tldr() {
415
- return this._tldr;
416
- }
417
- get aiStatus() {
418
- return this._aiStatus ?? "";
419
- }
420
- get relevance() {
421
- return this._relevance;
422
- }
423
- get author() {
424
- if (this._author === void 0) throw new Error("JsonApi error: document author is missing");
425
- return this._author;
426
- }
427
- get editors() {
428
- return this._editors ?? [];
429
- }
430
- rehydrate(data) {
431
- super.rehydrate(data);
432
- this._contentType = data.jsonApi.meta.contentType;
433
- this._name = data.jsonApi.attributes.name;
434
- this._abstract = data.jsonApi.attributes.abstract;
435
- this._tldr = data.jsonApi.attributes.tldr;
436
- this._aiStatus = data.jsonApi.meta.aiStatus;
437
- this._relevance = data.jsonApi.meta.relevance;
438
- this._author = this._readIncluded(data, "author", Modules.User);
439
- this._editors = this._readIncluded(data, "editors", Modules.User);
440
- return this;
441
- }
442
- addContentInput(response, data) {
443
- if (data.name) response.data.attributes.name = data.name;
444
- if (data.authorId) {
445
- response.data.relationships.author = {
446
- data: {
447
- type: Modules.User.name,
448
- id: data.authorId
449
- }
450
- };
451
- }
452
- }
453
- };
454
-
455
- // src/features/content/data/content.fields.ts
456
- var ContentFields = /* @__PURE__ */ ((ContentFields2) => {
457
- ContentFields2["contentId"] = "contentId";
458
- ContentFields2["name"] = "name";
459
- ContentFields2["relevance"] = "relevance";
460
- ContentFields2["authors"] = "authors";
461
- ContentFields2["createdAt"] = "createdAt";
462
- ContentFields2["updatedAt"] = "updatedAt";
463
- return ContentFields2;
464
- })(ContentFields || {});
465
-
466
- // src/features/content/data/content.service.ts
467
- var ContentService = class extends AbstractService {
468
- static {
469
- __name(this, "ContentService");
470
- }
471
- static async findMany(params) {
472
- const endpoint = new EndpointCreator({ endpoint: Modules.Content });
473
- if (params.contentIds) {
474
- endpoint.addAdditionalParam("contentIds", params.contentIds.join(","));
475
- endpoint.addAdditionalParam("fetchAll", "true");
476
- } else {
477
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
478
- if (params.search) endpoint.addAdditionalParam("search", params.search);
479
- }
480
- if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
481
- if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
482
- return this.callApi({
483
- type: Modules.Content,
484
- method: "GET" /* GET */,
485
- endpoint: endpoint.generate(),
486
- next: params.next
487
- });
488
- }
489
- static async findRelevant(params) {
490
- const endpoint = new EndpointCreator({
491
- endpoint: Modules.Content,
492
- id: params.id,
493
- childEndpoint: "relevance"
494
- });
495
- if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
496
- if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
497
- return this.callApi({
498
- type: Modules.Content,
499
- method: "GET" /* GET */,
500
- endpoint: endpoint.generate(),
501
- next: params.next
502
- });
503
- }
504
- static async findManyByAuthor(params) {
505
- const endpoint = new EndpointCreator({
506
- endpoint: Modules.Author,
507
- id: params.userId,
508
- childEndpoint: Modules.Content
509
- });
510
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
511
- if (params.search) endpoint.addAdditionalParam("search", params.search);
512
- if (Modules.Content.inclusions?.lists?.fields) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
513
- if (Modules.Content.inclusions?.lists?.types) endpoint.limitToType(Modules.Content.inclusions.lists.types);
514
- return this.callApi({
515
- type: Modules.Content,
516
- method: "GET" /* GET */,
517
- endpoint: endpoint.generate(),
518
- next: params.next
519
- });
520
- }
521
- };
522
-
523
- // src/features/feature/data/feature.ts
524
- var Feature = class extends AbstractApiData {
525
- static {
526
- __name(this, "Feature");
527
- }
528
- _name;
529
- _isProduction;
530
- _modules = [];
531
- get name() {
532
- return this._name ?? "";
533
- }
534
- get isProduction() {
535
- return this._isProduction == true ? true : false;
536
- }
537
- get modules() {
538
- return this._modules;
539
- }
540
- rehydrate(data) {
541
- super.rehydrate(data);
542
- this._name = data.jsonApi.attributes.name;
543
- this._isProduction = data.jsonApi.attributes.isProduction ?? false;
544
- this._modules = this._readIncluded(data, `modules`, Modules.Module);
545
- return this;
546
- }
547
- };
548
-
549
- // src/features/feature/feature.module.ts
550
- var FeatureModule = /* @__PURE__ */ __name((factory) => factory({
551
- pageUrl: "/features",
552
- name: "features",
553
- model: Feature,
554
- moduleId: "025fdd23-2803-4360-9fd9-eaa3612c2e23"
555
- }), "FeatureModule");
556
-
557
- // src/features/feature/data/feature.service.ts
558
- var FeatureService = class extends AbstractService {
559
- static {
560
- __name(this, "FeatureService");
561
- }
562
- static async findMany(params) {
563
- const endpoint = new EndpointCreator({ endpoint: Modules.Feature });
564
- if (params.companyId) endpoint.endpoint(Modules.Company).id(params.companyId).childEndpoint(Modules.Feature);
565
- if (params.search) endpoint.addAdditionalParam("search", params.search);
566
- return this.callApi({
567
- type: Modules.Feature,
568
- method: "GET" /* GET */,
569
- endpoint: endpoint.generate(),
570
- next: params.next
571
- });
572
- }
573
- };
574
-
575
- // src/features/module/data/module.ts
576
- var Module = class extends AbstractApiData {
577
- static {
578
- __name(this, "Module");
579
- }
580
- _name;
581
- _isCore;
582
- _permissions;
583
- get name() {
584
- if (!this._name) throw new Error("Name is not defined");
585
- return this._name ?? "";
586
- }
587
- get isCore() {
588
- return this._isCore ?? false;
589
- }
590
- get permissions() {
591
- if (!this._permissions) throw new Error("Permissions is not defined");
592
- return this._permissions;
593
- }
594
- rehydrate(data) {
595
- super.rehydrate(data);
596
- this._name = data.jsonApi.attributes.name;
597
- this._isCore = data.jsonApi.attributes.isCore;
598
- this._permissions = data.jsonApi.meta.permissions;
599
- return this;
600
- }
601
- };
602
-
603
- // src/features/module/module.module.ts
604
- var ModuleModule = /* @__PURE__ */ __name((factory) => factory({
605
- pageUrl: "/modules",
606
- name: "modules",
607
- model: Module,
608
- moduleId: "25ffd868-8341-4ca7-963b-6e1c56b03b1d"
609
- }), "ModuleModule");
610
-
611
- // src/features/notification/data/notification.ts
612
- var Notification = class extends AbstractApiData {
613
- static {
614
- __name(this, "Notification");
615
- }
616
- _notificationType;
617
- _isRead;
618
- _actor;
619
- get notificationType() {
620
- if (this._notificationType === void 0) throw new Error("notificationType is not set");
621
- return this._notificationType;
622
- }
623
- get isRead() {
624
- return this._isRead === void 0 ? false : this._isRead;
625
- }
626
- get actor() {
627
- return this._actor;
628
- }
629
- rehydrate(data) {
630
- super.rehydrate(data);
631
- this._notificationType = data.jsonApi.attributes.notificationType;
632
- this._isRead = data.jsonApi.attributes.isRead;
633
- this._actor = this._readIncluded(data, "actor", Modules.User);
634
- return this;
635
- }
636
- createJsonApi(data) {
637
- const response = {
638
- data: {
639
- type: Modules.Notification.name,
640
- id: data.id,
641
- attributes: {
642
- isRead: data.isRead
643
- },
644
- meta: {},
645
- relationships: {}
646
- },
647
- included: []
648
- };
649
- return response;
650
- }
651
- };
652
-
653
- // src/features/notification/notification.module.ts
654
- var NotificationModule = /* @__PURE__ */ __name((factory) => factory({
655
- pageUrl: "/notifications",
656
- name: "notifications",
657
- model: Notification,
658
- moduleId: "9259d704-c670-4e77-a3a1-a728ffc5be3d"
659
- }), "NotificationModule");
660
-
661
- // src/features/notification/data/notification.fields.ts
662
- var NotificationFields = /* @__PURE__ */ ((NotificationFields2) => {
663
- NotificationFields2["notificationId"] = "notificationId";
664
- NotificationFields2["name"] = "name";
665
- NotificationFields2["createdAt"] = "createdAt";
666
- NotificationFields2["updatedAt"] = "updatedAt";
667
- return NotificationFields2;
668
- })(NotificationFields || {});
669
-
670
- // src/features/notification/data/notification.service.ts
671
- var NotificationService = class extends AbstractService {
672
- static {
673
- __name(this, "NotificationService");
674
- }
675
- static async findMany(params) {
676
- const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
677
- if (params.isArchived) endpoint.addAdditionalParam("isArchived", "true");
678
- return this.callApi({
679
- type: Modules.Notification,
680
- method: "GET" /* GET */,
681
- endpoint: endpoint.generate(),
682
- next: params.next
683
- });
684
- }
685
- static async markAsRead(params) {
686
- const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
687
- await this.callApi({
688
- type: Modules.Notification,
689
- method: "PATCH" /* PATCH */,
690
- endpoint: endpoint.generate(),
691
- input: params.data,
692
- overridesJsonApiCreation: true
693
- });
694
- }
695
- static async archive(params) {
696
- const endpoint = new EndpointCreator({ endpoint: Modules.Notification, id: params.id, childEndpoint: "archive" });
697
- await this.callApi({ type: Modules.Notification, method: "POST" /* POST */, endpoint: endpoint.generate() });
698
- }
699
- };
700
-
701
- // src/features/push/data/push.ts
702
- var Push = class extends AbstractApiData {
703
- static {
704
- __name(this, "Push");
705
- }
706
- createJsonApi(data) {
707
- const response = {
708
- data: {
709
- type: Modules.Push.name,
710
- attributes: {
711
- key: data.key
712
- }
713
- },
714
- included: []
715
- };
716
- return response;
717
- }
718
- };
719
-
720
- // src/features/push/push.module.ts
721
- var PushModule = /* @__PURE__ */ __name((factory) => factory({
722
- pageUrl: "/push",
723
- name: "push",
724
- model: Push,
725
- moduleId: ""
726
- }), "PushModule");
727
-
728
- // src/features/push/data/push.service.ts
729
- var PushService = class extends AbstractService {
730
- static {
731
- __name(this, "PushService");
732
- }
733
- static async register(params) {
734
- const endpoint = new EndpointCreator({ endpoint: Modules.Push });
735
- await this.callApi({
736
- type: Modules.Push,
737
- method: "POST" /* POST */,
738
- endpoint: endpoint.generate(),
739
- input: params.data,
740
- overridesJsonApiCreation: true
741
- });
742
- }
743
- };
744
-
745
- // src/features/role/data/role.ts
746
- var Role = class extends AbstractApiData {
747
- static {
748
- __name(this, "Role");
749
- }
750
- _name;
751
- _description;
752
- _isSelectable;
753
- _requiredFeature;
754
- get name() {
755
- if (!this._name) throw new Error("Name is not defined");
756
- return this._name;
757
- }
758
- get description() {
759
- return this._description ?? "";
760
- }
761
- get isSelectable() {
762
- return this._isSelectable ?? false;
763
- }
764
- get requiredFeature() {
765
- return this._requiredFeature;
766
- }
767
- rehydrate(data) {
768
- super.rehydrate(data);
769
- this._name = data.jsonApi.attributes.name ?? void 0;
770
- this._description = data.jsonApi.attributes.description ?? void 0;
771
- this._isSelectable = data.jsonApi.attributes.isSelectable ?? void 0;
772
- this._requiredFeature = this._readIncluded(
773
- data,
774
- "requiredFeature",
775
- Modules.Feature
776
- );
777
- return this;
778
- }
779
- createJsonApi(data) {
780
- const response = {
781
- data: {
782
- type: Modules.Role.name,
783
- id: data.id,
784
- attributes: {
785
- name: data.name
786
- },
787
- meta: {}
788
- },
789
- included: []
790
- };
791
- if (data.description !== void 0) response.data.attributes.description = data.description;
792
- return response;
793
- }
794
- };
795
-
796
- // src/features/role/data/role.fields.ts
797
- var RoleFields = /* @__PURE__ */ ((RoleFields2) => {
798
- RoleFields2["roleId"] = "roleId";
799
- RoleFields2["name"] = "name";
800
- RoleFields2["description"] = "description";
801
- RoleFields2["createdAt"] = "createdAt";
802
- RoleFields2["updatedAt"] = "updatedAt";
803
- return RoleFields2;
804
- })(RoleFields || {});
805
-
806
- // src/features/role/data/role.service.ts
807
- var RoleService = class extends AbstractService {
808
- static {
809
- __name(this, "RoleService");
810
- }
811
- static async findById(params) {
812
- return this.callApi({
813
- type: Modules.Role,
814
- method: "GET" /* GET */,
815
- endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
816
- });
817
- }
818
- static async findAllRoles(params) {
819
- const endpoint = new EndpointCreator({ endpoint: Modules.Role });
820
- if (params.search) endpoint.addAdditionalParam("search", params.search);
821
- return this.callApi({
822
- type: Modules.Role,
823
- method: "GET" /* GET */,
824
- endpoint: endpoint.generate(),
825
- next: params.next
826
- });
827
- }
828
- static async findAllRolesByUser(params) {
829
- const endpoint = new EndpointCreator({ endpoint: Modules.User, id: params.userId, childEndpoint: Modules.Role });
830
- if (params.search) endpoint.addAdditionalParam("search", params.search);
831
- return this.callApi({
832
- type: Modules.Role,
833
- method: "GET" /* GET */,
834
- endpoint: endpoint.generate(),
835
- next: params.next
836
- });
837
- }
838
- static async findAllRolesUserNotIn(params) {
839
- const endpoint = new EndpointCreator({
840
- endpoint: Modules.User,
841
- id: params.userId,
842
- childEndpoint: Modules.Role
843
- }).addAdditionalParam("userNotIn", "true");
844
- if (params.search) endpoint.addAdditionalParam("search", params.search);
845
- return this.callApi({
846
- type: Modules.Role,
847
- method: "GET" /* GET */,
848
- endpoint: endpoint.generate(),
849
- next: params.next
850
- });
851
- }
852
- static async addUserToRole(params) {
853
- this.callApi({
854
- type: Modules.Role,
855
- method: "POST" /* POST */,
856
- endpoint: new EndpointCreator({
857
- endpoint: Modules.Role,
858
- id: params.roleId,
859
- childEndpoint: Modules.User,
860
- childId: params.userId
861
- }).generate()
862
- });
863
- }
864
- static async removeUserFromRole(params) {
865
- this.callApi({
866
- type: Modules.Role,
867
- method: "DELETE" /* DELETE */,
868
- endpoint: new EndpointCreator({
869
- endpoint: Modules.Role,
870
- id: params.roleId,
871
- childEndpoint: Modules.User,
872
- childId: params.userId
873
- }).generate()
874
- });
875
- }
876
- static async create(params) {
877
- return this.callApi({
878
- type: Modules.Role,
879
- method: "POST" /* POST */,
880
- endpoint: new EndpointCreator({ endpoint: Modules.Role }).generate(),
881
- input: { id: params.roleId, name: params.name, description: params.description }
882
- });
883
- }
884
- static async update(params) {
885
- return this.callApi({
886
- type: Modules.Role,
887
- method: "PUT" /* PUT */,
888
- endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),
889
- input: { id: params.roleId, name: params.name, description: params.description }
890
- });
891
- }
892
- static async delete(params) {
893
- return this.callApi({
894
- type: Modules.Role,
895
- method: "DELETE" /* DELETE */,
896
- endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
897
- });
898
- }
899
- };
900
-
901
- // src/features/role/role.module.ts
902
- var RoleModule = /* @__PURE__ */ __name((factory) => factory({
903
- pageUrl: "/roles",
904
- name: "roles",
905
- model: Role,
906
- moduleId: "9f6416e6-7b9b-4e1a-a99f-833191eca8a9"
907
- }), "RoleModule");
908
-
909
- // src/features/s3/data/s3.ts
910
- var S3 = class extends AbstractApiData {
911
- static {
912
- __name(this, "S3");
913
- }
914
- _url;
915
- _storageType;
916
- _contentType;
917
- _blobType;
918
- _acl;
919
- get url() {
920
- if (!this._url) throw new Error("Image URL is not set.");
921
- return this._url;
922
- }
923
- get headers() {
924
- const headers = {};
925
- if (this._contentType) {
926
- headers["Content-Type"] = this._contentType;
927
- }
928
- if (this._blobType) {
929
- headers["x-ms-blob-type"] = this._blobType;
930
- }
931
- if (this._acl) {
932
- headers["x-amz-acl"] = this._acl;
933
- }
934
- return headers;
935
- }
936
- rehydrate(data) {
937
- super.rehydrate(data);
938
- this._url = data.jsonApi.attributes.url ?? void 0;
939
- this._storageType = data.jsonApi.attributes.storageType ?? void 0;
940
- this._contentType = data.jsonApi.attributes.contentType ?? void 0;
941
- this._blobType = data.jsonApi.attributes.blobType ?? void 0;
942
- this._acl = data.jsonApi.attributes.acl ?? void 0;
943
- return this;
944
- }
945
- createJsonApi(data) {
946
- const response = {
947
- data: {
948
- type: Modules.S3.name,
949
- attributes: {
950
- key: data.key
951
- }
952
- },
953
- included: []
954
- };
955
- if (data.contentType) response.data.attributes.contentType = data.contentType;
956
- return response;
957
- }
958
- };
959
-
960
- // src/features/s3/s3.module.ts
961
- var S3Module = /* @__PURE__ */ __name((factory) => factory({
962
- pageUrl: "/s3",
963
- name: "s3",
964
- model: S3,
965
- moduleId: "db41ba46-e171-4324-8845-99353eba8568"
966
- }), "S3Module");
967
-
968
- // src/features/s3/data/s3.service.ts
969
- var S3Service = class extends AbstractService {
970
- static {
971
- __name(this, "S3Service");
972
- }
973
- static async getPreSignedUrl(params) {
974
- const endpoint = new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).addAdditionalParam("contentType", params.contentType);
975
- if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
976
- return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
977
- }
978
- static async getSignedUrl(params) {
979
- const endpoint = new EndpointCreator({ endpoint: Modules.S3, id: "sign" }).addAdditionalParam("key", params.key);
980
- if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
981
- return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
982
- }
983
- static async deleteFile(params) {
984
- this.callApi({
985
- type: Modules.S3,
986
- method: "DELETE" /* DELETE */,
987
- endpoint: new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).generate()
988
- });
989
- }
990
- };
991
-
992
- // src/features/user/data/user.ts
993
- var User = class extends AbstractApiData {
994
- static {
995
- __name(this, "User");
996
- }
997
- _name;
998
- _email;
999
- _title;
1000
- _bio;
1001
- _avatar;
1002
- _avatarUrl;
1003
- _phone;
1004
- _rate;
1005
- _isActivated;
1006
- _isDeleted;
1007
- _lastLogin;
1008
- _relevance;
1009
- _roles = [];
1010
- _company;
1011
- _modules = [];
1012
- get searchResult() {
1013
- return this._name ?? "";
1014
- }
1015
- get name() {
1016
- return this._name ?? "";
1017
- }
1018
- get email() {
1019
- return this._email ?? "";
1020
- }
1021
- get title() {
1022
- return this._title ?? "";
1023
- }
1024
- get bio() {
1025
- return this._bio ?? "";
1026
- }
1027
- get avatar() {
1028
- return this._avatar;
1029
- }
1030
- get avatarUrl() {
1031
- return this._avatarUrl;
1032
- }
1033
- get phone() {
1034
- return this._phone;
1035
- }
1036
- get rate() {
1037
- return this._rate;
1038
- }
1039
- get relevance() {
1040
- return this._relevance;
1041
- }
1042
- get isActivated() {
1043
- return this._isActivated ?? false;
1044
- }
1045
- get isDeleted() {
1046
- return this._isDeleted ?? false;
1047
- }
1048
- get lastLogin() {
1049
- return this._lastLogin;
1050
- }
1051
- get roles() {
1052
- return this._roles;
1053
- }
1054
- get company() {
1055
- return this._company;
1056
- }
1057
- get modules() {
1058
- return this._modules;
1059
- }
1060
- rehydrate(data) {
1061
- super.rehydrate(data);
1062
- this._name = data.jsonApi.attributes.name;
1063
- this._email = data.jsonApi.attributes.email;
1064
- this._title = data.jsonApi.attributes.title;
1065
- this._bio = data.jsonApi.attributes.bio;
1066
- this._phone = data.jsonApi.attributes.phone;
1067
- this._rate = data.jsonApi.attributes.rate;
1068
- this._avatar = data.jsonApi.attributes.avatar;
1069
- this._avatarUrl = data.jsonApi.attributes.avatarUrl;
1070
- this._isActivated = data.jsonApi.meta.isActive;
1071
- this._isDeleted = data.jsonApi.meta.isDeleted;
1072
- this._lastLogin = data.jsonApi.meta.lastLogin ? new Date(data.jsonApi.meta.lastLogin) : void 0;
1073
- this._relevance = data.jsonApi.meta.relevance;
1074
- this._roles = this._readIncluded(data, "roles", Modules.Role);
1075
- this._company = this._readIncluded(data, "company", Modules.Company);
1076
- this._modules = this._readIncluded(data, "modules", Modules.Module);
1077
- return this;
1078
- }
1079
- createJsonApi(data) {
1080
- const response = {
1081
- data: {
1082
- type: Modules.User.name,
1083
- id: data.id,
1084
- attributes: {
1085
- name: data.name
1086
- },
1087
- meta: {},
1088
- relationships: {}
1089
- },
1090
- included: []
1091
- };
1092
- if (data.email !== void 0) response.data.attributes.email = data.email;
1093
- if (data.title !== void 0) response.data.attributes.title = data.title;
1094
- if (data.bio !== void 0) response.data.attributes.bio = data.bio;
1095
- if (data.phone !== void 0) response.data.attributes.phone = data.phone;
1096
- if (data.password !== void 0) response.data.attributes.password = data.password;
1097
- if (data.sendInvitationEmail) response.data.attributes.sendInvitationEmail = true;
1098
- if (data.adminCreated) response.data.attributes.adminCreated = true;
1099
- if (data.avatar) response.data.attributes.avatar = data.avatar;
1100
- if (data.rate !== void 0) response.data.attributes.rate = data.rate;
1101
- if (data.roleIds) {
1102
- response.data.relationships.roles = {
1103
- data: data.roleIds.map((roleId) => ({
1104
- type: Modules.Role.name,
1105
- id: roleId
1106
- }))
1107
- };
1108
- }
1109
- if (data.companyId) {
1110
- response.data.relationships.company = {
1111
- data: {
1112
- type: Modules.Company.name,
1113
- id: data.companyId
1114
- }
1115
- };
1116
- }
1117
- return response;
1118
- }
1119
- };
1120
-
1121
- // src/features/user/data/user.fields.ts
1122
- var UserFields = /* @__PURE__ */ ((UserFields2) => {
1123
- UserFields2["userId"] = "userId";
1124
- UserFields2["name"] = "name";
1125
- UserFields2["email"] = "email";
1126
- UserFields2["relevance"] = "relevance";
1127
- UserFields2["createdAt"] = "createdAt";
1128
- UserFields2["updatedAt"] = "updatedAt";
1129
- return UserFields2;
1130
- })(UserFields || {});
1131
-
1132
- // src/features/user/data/user.service.ts
1133
- var UserService = class extends AbstractService {
1134
- static {
1135
- __name(this, "UserService");
1136
- }
1137
- static async findFullUser() {
1138
- const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "me", childEndpoint: "full" });
1139
- return this.callApi({
1140
- type: Modules.User,
1141
- method: "GET" /* GET */,
1142
- endpoint: endpoint.generate()
1143
- });
1144
- }
1145
- static async findById(params) {
1146
- return this.callApi({
1147
- type: Modules.User,
1148
- method: "GET" /* GET */,
1149
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
1150
- });
1151
- }
1152
- static async findByEmail(params) {
1153
- const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "email", childEndpoint: params.email });
1154
- return this.callApi({ type: Modules.User, method: "GET" /* GET */, endpoint: endpoint.generate() });
1155
- }
1156
- static async findMany(params) {
1157
- const endpoint = new EndpointCreator({ endpoint: Modules.User });
1158
- if (params.roleId) endpoint.addAdditionalParam("roleId", params.roleId);
1159
- if (params.includeDeleted) endpoint.addAdditionalParam("includeDeleted", "true");
1160
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
1161
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1162
- return this.callApi({
1163
- type: Modules.User,
1164
- method: "GET" /* GET */,
1165
- endpoint: endpoint.generate(),
1166
- next: params.next
1167
- });
1168
- }
1169
- static async findManyByContentIds(params) {
1170
- const endpoint = new EndpointCreator({ endpoint: Modules.User });
1171
- endpoint.addAdditionalParam("contentIds", params.contentIds.map((id) => id).join(","));
1172
- endpoint.addAdditionalParam("includeDeleted", "true");
1173
- endpoint.addAdditionalParam("fetchAll", "true");
1174
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1175
- return this.callApi({
1176
- type: Modules.User,
1177
- method: "GET" /* GET */,
1178
- endpoint: endpoint.generate(),
1179
- next: params.next
1180
- });
1181
- }
1182
- static async findRelevant(params) {
1183
- const endpoint = new EndpointCreator({
1184
- endpoint: Modules.Content,
1185
- id: params.id,
1186
- childEndpoint: "user-relevance"
1187
- });
1188
- if (Modules.User.inclusions?.lists?.fields) endpoint.limitToFields(Modules.User.inclusions.lists.fields);
1189
- if (Modules.User.inclusions?.lists?.types) endpoint.limitToType(Modules.User.inclusions.lists.types);
1190
- return this.callApi({
1191
- type: Modules.User,
1192
- method: "GET" /* GET */,
1193
- endpoint: endpoint.generate(),
1194
- next: params.next
1195
- });
1196
- }
1197
- static async findManyForAmin(params) {
1198
- if (!params.companyId) return [];
1199
- const endpoint = new EndpointCreator({
1200
- endpoint: Modules.Company,
1201
- id: params.companyId,
1202
- childEndpoint: Modules.User
1203
- });
1204
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1205
- return this.callApi({
1206
- type: Modules.User,
1207
- method: "GET" /* GET */,
1208
- endpoint: endpoint.generate(),
1209
- next: params.next,
1210
- previous: params.prev
1211
- });
1212
- }
1213
- static async findAllUsers(params) {
1214
- const endpoint = new EndpointCreator({
1215
- endpoint: Modules.Company,
1216
- id: params.companyId,
1217
- childEndpoint: Modules.User
1218
- });
1219
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1220
- if (params.isDeleted) endpoint.addAdditionalParam("isDeleted", "true");
1221
- if (params.limitToRoles && params.limitToRoles.length > 0)
1222
- endpoint.addAdditionalParam("limitToRoles", params.limitToRoles.join(","));
1223
- return this.callApi({
1224
- type: Modules.User,
1225
- method: "GET" /* GET */,
1226
- endpoint: endpoint.generate(),
1227
- next: params.next
1228
- });
1229
- }
1230
- static async findAllUsersByRole(params) {
1231
- const endpoint = new EndpointCreator({ endpoint: Modules.Role, id: params.roleId, childEndpoint: Modules.User });
1232
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1233
- return this.callApi({
1234
- type: Modules.User,
1235
- method: "GET" /* GET */,
1236
- endpoint: endpoint.generate(),
1237
- next: params.next
1238
- });
1239
- }
1240
- static async findAllUsersNotInRole(params) {
1241
- const endpoint = new EndpointCreator({
1242
- endpoint: Modules.Role,
1243
- id: params.roleId,
1244
- childEndpoint: Modules.User
1245
- }).addAdditionalParam("notInRole", "true");
1246
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1247
- return this.callApi({
1248
- type: Modules.User,
1249
- method: "GET" /* GET */,
1250
- endpoint: endpoint.generate(),
1251
- next: params.next
1252
- });
1253
- }
1254
- static async create(params) {
1255
- return this.callApi({
1256
- type: Modules.User,
1257
- method: "POST" /* POST */,
1258
- endpoint: new EndpointCreator({ endpoint: Modules.User }).generate(),
1259
- companyId: params.companyId,
1260
- input: params
1261
- });
1262
- }
1263
- static async reactivate(params) {
1264
- return this.callApi({
1265
- type: Modules.User,
1266
- method: "PATCH" /* PATCH */,
1267
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
1268
- });
1269
- }
1270
- static async sendInvitation(params) {
1271
- const endpoint = new EndpointCreator({
1272
- endpoint: Modules.User,
1273
- id: params.userId,
1274
- childEndpoint: "send-invitation-email"
1275
- });
1276
- if (params.companyId) endpoint.addAdditionalParam("companyId", params.companyId);
1277
- this.callApi({
1278
- type: Modules.User,
1279
- method: "POST" /* POST */,
1280
- endpoint: endpoint.generate()
1281
- });
1282
- }
1283
- static async update(params) {
1284
- return this.callApi({
1285
- type: Modules.User,
1286
- method: "PUT" /* PUT */,
1287
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id }).generate(),
1288
- companyId: params.companyId,
1289
- input: params
1290
- });
1291
- }
1292
- static async patchRate(params) {
1293
- return this.callApi({
1294
- type: Modules.User,
1295
- method: "PATCH" /* PATCH */,
1296
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id, childEndpoint: "rates" }).generate(),
1297
- companyId: params.companyId,
1298
- input: params
1299
- });
1300
- }
1301
- static async delete(params) {
1302
- await this.callApi({
1303
- type: Modules.User,
1304
- method: "DELETE" /* DELETE */,
1305
- endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),
1306
- companyId: params.companyId
1307
- });
1308
- }
1309
- };
1310
-
1311
- // src/features/user/author.module.ts
1312
- var AuthorModule = /* @__PURE__ */ __name((factory) => factory({
1313
- pageUrl: "/authors",
1314
- name: "authors",
1315
- model: User,
1316
- moduleId: "04cfc677-0fd2-4f5e-adf4-2483a00c0277"
1317
- }), "AuthorModule");
1318
-
1319
- // src/features/user/user.module.ts
1320
- var UserModule = /* @__PURE__ */ __name((factory) => factory({
1321
- pageUrl: "/users",
1322
- name: "users",
1323
- model: User,
1324
- moduleId: "04cfc677-0fd2-4f5e-adf4-2483a00c0277",
1325
- inclusions: {
1326
- lists: {
1327
- fields: [
1328
- createJsonApiInclusion("users", [`name`, `email`, `avatar`, `title`]),
1329
- createJsonApiInclusion("usertopics", [`level`]),
1330
- createJsonApiInclusion("userexpertises", [`level`]),
1331
- createJsonApiInclusion("topics", [`name`])
1332
- ]
1333
- }
1334
- }
1335
- }), "UserModule");
1336
-
1337
- export {
1338
- Role,
1339
- RoleFields,
1340
- RoleService,
1341
- RoleModule,
1342
- User,
1343
- UserFields,
1344
- UserService,
1345
- S3,
1346
- S3Module,
1347
- S3Service,
1348
- AuthorModule,
1349
- UserModule,
1350
- Company,
1351
- CompanyFields,
1352
- CompanyService,
1353
- Feature,
1354
- FeatureModule,
1355
- FeatureService,
1356
- Notification,
1357
- NotificationFields,
1358
- NotificationService,
1359
- AuthModule,
1360
- Auth,
1361
- AuthService,
1362
- AuthComponent,
1363
- CompanyModule,
1364
- ContentModule,
1365
- Content,
1366
- ContentFields,
1367
- ContentService,
1368
- Module,
1369
- ModuleModule,
1370
- NotificationModule,
1371
- Push,
1372
- PushModule,
1373
- PushService
1374
- };
1375
- //# sourceMappingURL=chunk-HTLEKZND.mjs.map