@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
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
2
-
3
- var _chunkAYHKQWHHjs = require('./chunk-AYHKQWHH.js');
4
-
5
-
6
-
7
-
8
- var _chunkPMXG5WBCjs = require('./chunk-PMXG5WBC.js');
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- var _chunkQ4FXESVTjs = require('./chunk-Q4FXESVT.js');
17
-
18
-
19
- var _chunk7QVYU63Ejs = require('./chunk-7QVYU63E.js');
20
-
21
- // src/features/auth/auth.module.ts
22
- var AuthModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractApiData {
30
- static {
31
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Auth");
32
- }
33
-
34
-
35
-
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 = _nullishCoalesce(data.jsonApi.attributes.token, () => ( void 0));
51
- this._refreshToken = _nullishCoalesce(data.jsonApi.attributes.refreshToken, () => ( void 0));
52
- this._user = this._readIncluded(data, "user", _chunkQ4FXESVTjs.Modules.User);
53
- return this;
54
- }
55
- createJsonApi(data) {
56
- const response = {
57
- data: {
58
- type: _chunkQ4FXESVTjs.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 _chunkQ4FXESVTjs.AbstractService {
75
- static {
76
- _chunk7QVYU63Ejs.__name.call(void 0, this, "AuthService");
77
- }
78
- static async login(params) {
79
- const language = params.language || "en-US";
80
- const apiResponse = await _chunkPMXG5WBCjs.JsonApiPost.call(void 0, {
81
- classKey: _chunkQ4FXESVTjs.Modules.Auth,
82
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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 = _chunkAYHKQWHHjs.getTokenHandler.call(void 0, );
89
- if (handler) {
90
- await handler.updateToken({
91
- token: auth.token,
92
- refreshToken: auth.refreshToken,
93
- userId: auth.user.id,
94
- companyId: _optionalChain([auth, 'access', _ => _.user, 'access', _2 => _2.company, 'optionalAccess', _3 => _3.id]),
95
- licenseExpirationDate: _optionalChain([auth, 'access', _4 => _4.user, 'access', _5 => _5.company, 'optionalAccess', _6 => _6.licenseExpirationDate]),
96
- roles: auth.user.roles.map((role) => role.id),
97
- features: _nullishCoalesce(_optionalChain([auth, 'access', _7 => _7.user, 'access', _8 => _8.company, 'optionalAccess', _9 => _9.features, 'optionalAccess', _10 => _10.map, 'call', _11 => _11((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 = _optionalChain([params, 'optionalAccess', _12 => _12.language]) || "en-US";
108
- await _chunkPMXG5WBCjs.JsonApiDelete.call(void 0, {
109
- classKey: _chunkQ4FXESVTjs.Modules.Auth,
110
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth }).generate(),
111
- language
112
- });
113
- const handler = _chunkAYHKQWHHjs.getTokenHandler.call(void 0, );
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 _chunkPMXG5WBCjs.JsonApiPost.call(void 0, {
121
- classKey: _chunkQ4FXESVTjs.Modules.Auth,
122
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "register" });
132
- await this.callApi({
133
- type: _chunkQ4FXESVTjs.Modules.Auth,
134
- method: "POST" /* POST */,
135
- endpoint: endpoint.generate(),
136
- input: params
137
- });
138
- }
139
- static async activate(params) {
140
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
141
- endpoint: _chunkQ4FXESVTjs.Modules.Auth,
142
- id: "activate",
143
- childEndpoint: params.activationCode
144
- });
145
- await this.callApi({ type: _chunkQ4FXESVTjs.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 _chunkPMXG5WBCjs.JsonApiGet.call(void 0, {
150
- classKey: _chunkQ4FXESVTjs.Modules.Auth,
151
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "reset", childEndpoint: params.code });
158
- const input = { password: params.password };
159
- await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
160
- }
161
- static async acceptInvitation(params) {
162
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth, id: "invitation", childEndpoint: params.code });
163
- const input = { password: params.password };
164
- await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
165
- }
166
- static async findToken(params) {
167
- return await this.callApi({
168
- type: _chunkQ4FXESVTjs.Modules.Auth,
169
- method: "POST" /* POST */,
170
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Auth }).addAdditionalParam("code", params.tokenCode).generate()
171
- });
172
- }
173
- static async saveToken(params) {
174
- const auth = _chunkQ4FXESVTjs.rehydrate.call(void 0, _chunkQ4FXESVTjs.Modules.Auth, params.dehydratedAuth);
175
- const handler = _chunkAYHKQWHHjs.getTokenHandler.call(void 0, );
176
- if (handler) {
177
- await handler.updateToken({
178
- token: auth.token,
179
- refreshToken: auth.refreshToken,
180
- userId: auth.user.id,
181
- companyId: _optionalChain([auth, 'access', _13 => _13.user, 'access', _14 => _14.company, 'optionalAccess', _15 => _15.id]),
182
- licenseExpirationDate: _optionalChain([auth, 'access', _16 => _16.user, 'access', _17 => _17.company, 'optionalAccess', _18 => _18.licenseExpirationDate]),
183
- roles: auth.user.roles.map((role) => role.id),
184
- features: _nullishCoalesce(_optionalChain([auth, 'access', _19 => _19.user, 'access', _20 => _20.company, 'optionalAccess', _21 => _21.features, 'optionalAccess', _22 => _22.map, 'call', _23 => _23((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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractApiData {
216
- static {
217
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Company");
218
- }
219
-
220
-
221
-
222
-
223
-
224
-
225
-
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 _nullishCoalesce(this._features, () => ( []));
241
- }
242
- get modules() {
243
- return _nullishCoalesce(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", _chunkQ4FXESVTjs.Modules.Feature);
256
- this._modules = this._readIncluded(data, "modules", _chunkQ4FXESVTjs.Modules.Module);
257
- return this;
258
- }
259
- createJsonApi(data) {
260
- const response = {
261
- data: {
262
- type: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.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 _chunkQ4FXESVTjs.AbstractService {
306
- static {
307
- _chunk7QVYU63Ejs.__name.call(void 0, this, "CompanyService");
308
- }
309
- static async findOne(params) {
310
- return this.callApi({
311
- type: _chunkQ4FXESVTjs.Modules.Company,
312
- method: "GET" /* GET */,
313
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.companyId }).generate()
314
- });
315
- }
316
- static async findMany(params) {
317
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company });
318
- if (params.search) endpoint.addAdditionalParam("search", params.search);
319
- return this.callApi({
320
- type: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.Company,
329
- method: "DELETE" /* DELETE */,
330
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.companyId }).generate()
331
- });
332
- }
333
- static async create(params) {
334
- return this.callApi({
335
- type: _chunkQ4FXESVTjs.Modules.Company,
336
- method: "POST" /* POST */,
337
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company }).generate(),
338
- input: params
339
- });
340
- }
341
- static async update(params) {
342
- return this.callApi({
343
- type: _chunkQ4FXESVTjs.Modules.Company,
344
- method: "PUT" /* PUT */,
345
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Company, id: params.id }).generate(),
346
- input: params
347
- });
348
- }
349
- static async updateConfigurations(params) {
350
- return this.callApi({
351
- type: _chunkQ4FXESVTjs.Modules.Company,
352
- method: "PUT" /* PUT */,
353
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({
354
- endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.Company,
364
- method: "PUT" /* PUT */,
365
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
373
- pageUrl: "/contents",
374
- name: "contents",
375
- model: Content,
376
- inclusions: {
377
- lists: {
378
- fields: [
379
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "content", [`name`, `tldr`, `abstract`, `aiStatus`, `relevance`]),
380
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "users", [`name`, `avatar`]),
381
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "topics", [`name`]),
382
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "expertises", [`name`])
383
- ]
384
- }
385
- }
386
- }), "ContentModule");
387
-
388
- // src/features/content/data/content.ts
389
- var Content = class extends _chunkQ4FXESVTjs.AbstractApiData {
390
- static {
391
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Content");
392
- }
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
- get searchResult() {
402
- return _nullishCoalesce(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 _nullishCoalesce(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 _nullishCoalesce(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", _chunkQ4FXESVTjs.Modules.User);
439
- this._editors = this._readIncluded(data, "editors", _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.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 _chunkQ4FXESVTjs.AbstractService {
468
- static {
469
- _chunk7QVYU63Ejs.__name.call(void 0, this, "ContentService");
470
- }
471
- static async findMany(params) {
472
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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 (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _24 => _24.Content, 'access', _25 => _25.inclusions, 'optionalAccess', _26 => _26.lists, 'optionalAccess', _27 => _27.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.fields);
481
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _28 => _28.Content, 'access', _29 => _29.inclusions, 'optionalAccess', _30 => _30.lists, 'optionalAccess', _31 => _31.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.types);
482
- return this.callApi({
483
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
491
- endpoint: _chunkQ4FXESVTjs.Modules.Content,
492
- id: params.id,
493
- childEndpoint: "relevance"
494
- });
495
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _32 => _32.Content, 'access', _33 => _33.inclusions, 'optionalAccess', _34 => _34.lists, 'optionalAccess', _35 => _35.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.fields);
496
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _36 => _36.Content, 'access', _37 => _37.inclusions, 'optionalAccess', _38 => _38.lists, 'optionalAccess', _39 => _39.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.types);
497
- return this.callApi({
498
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
506
- endpoint: _chunkQ4FXESVTjs.Modules.Author,
507
- id: params.userId,
508
- childEndpoint: _chunkQ4FXESVTjs.Modules.Content
509
- });
510
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
511
- if (params.search) endpoint.addAdditionalParam("search", params.search);
512
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _40 => _40.Content, 'access', _41 => _41.inclusions, 'optionalAccess', _42 => _42.lists, 'optionalAccess', _43 => _43.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.fields);
513
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _44 => _44.Content, 'access', _45 => _45.inclusions, 'optionalAccess', _46 => _46.lists, 'optionalAccess', _47 => _47.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.Content.inclusions.lists.types);
514
- return this.callApi({
515
- type: _chunkQ4FXESVTjs.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 = class extends _chunkQ4FXESVTjs.AbstractApiData {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
525
- static {
526
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Feature");
527
- }
528
-
529
-
530
- __init() {this._modules = []}
531
- get name() {
532
- return _nullishCoalesce(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 = _nullishCoalesce(data.jsonApi.attributes.isProduction, () => ( false));
544
- this._modules = this._readIncluded(data, `modules`, _chunkQ4FXESVTjs.Modules.Module);
545
- return this;
546
- }
547
- }, _class);
548
-
549
- // src/features/feature/feature.module.ts
550
- var FeatureModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractService {
559
- static {
560
- _chunk7QVYU63Ejs.__name.call(void 0, this, "FeatureService");
561
- }
562
- static async findMany(params) {
563
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Feature });
564
- if (params.companyId) endpoint.endpoint(_chunkQ4FXESVTjs.Modules.Company).id(params.companyId).childEndpoint(_chunkQ4FXESVTjs.Modules.Feature);
565
- if (params.search) endpoint.addAdditionalParam("search", params.search);
566
- return this.callApi({
567
- type: _chunkQ4FXESVTjs.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 _chunkQ4FXESVTjs.AbstractApiData {
577
- static {
578
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Module");
579
- }
580
-
581
-
582
-
583
- get name() {
584
- if (!this._name) throw new Error("Name is not defined");
585
- return _nullishCoalesce(this._name, () => ( ""));
586
- }
587
- get isCore() {
588
- return _nullishCoalesce(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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractApiData {
613
- static {
614
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Notification");
615
- }
616
-
617
-
618
-
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", _chunkQ4FXESVTjs.Modules.User);
634
- return this;
635
- }
636
- createJsonApi(data) {
637
- const response = {
638
- data: {
639
- type: _chunkQ4FXESVTjs.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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractService {
672
- static {
673
- _chunk7QVYU63Ejs.__name.call(void 0, this, "NotificationService");
674
- }
675
- static async findMany(params) {
676
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Notification });
677
- if (params.isArchived) endpoint.addAdditionalParam("isArchived", "true");
678
- return this.callApi({
679
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Notification });
687
- await this.callApi({
688
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Notification, id: params.id, childEndpoint: "archive" });
697
- await this.callApi({ type: _chunkQ4FXESVTjs.Modules.Notification, method: "POST" /* POST */, endpoint: endpoint.generate() });
698
- }
699
- };
700
-
701
- // src/features/push/data/push.ts
702
- var Push = class extends _chunkQ4FXESVTjs.AbstractApiData {
703
- static {
704
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Push");
705
- }
706
- createJsonApi(data) {
707
- const response = {
708
- data: {
709
- type: _chunkQ4FXESVTjs.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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractService {
730
- static {
731
- _chunk7QVYU63Ejs.__name.call(void 0, this, "PushService");
732
- }
733
- static async register(params) {
734
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Push });
735
- await this.callApi({
736
- type: _chunkQ4FXESVTjs.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 _chunkQ4FXESVTjs.AbstractApiData {
747
- static {
748
- _chunk7QVYU63Ejs.__name.call(void 0, this, "Role");
749
- }
750
-
751
-
752
-
753
-
754
- get name() {
755
- if (!this._name) throw new Error("Name is not defined");
756
- return this._name;
757
- }
758
- get description() {
759
- return _nullishCoalesce(this._description, () => ( ""));
760
- }
761
- get isSelectable() {
762
- return _nullishCoalesce(this._isSelectable, () => ( false));
763
- }
764
- get requiredFeature() {
765
- return this._requiredFeature;
766
- }
767
- rehydrate(data) {
768
- super.rehydrate(data);
769
- this._name = _nullishCoalesce(data.jsonApi.attributes.name, () => ( void 0));
770
- this._description = _nullishCoalesce(data.jsonApi.attributes.description, () => ( void 0));
771
- this._isSelectable = _nullishCoalesce(data.jsonApi.attributes.isSelectable, () => ( void 0));
772
- this._requiredFeature = this._readIncluded(
773
- data,
774
- "requiredFeature",
775
- _chunkQ4FXESVTjs.Modules.Feature
776
- );
777
- return this;
778
- }
779
- createJsonApi(data) {
780
- const response = {
781
- data: {
782
- type: _chunkQ4FXESVTjs.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 _chunkQ4FXESVTjs.AbstractService {
808
- static {
809
- _chunk7QVYU63Ejs.__name.call(void 0, this, "RoleService");
810
- }
811
- static async findById(params) {
812
- return this.callApi({
813
- type: _chunkQ4FXESVTjs.Modules.Role,
814
- method: "GET" /* GET */,
815
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId }).generate()
816
- });
817
- }
818
- static async findAllRoles(params) {
819
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role });
820
- if (params.search) endpoint.addAdditionalParam("search", params.search);
821
- return this.callApi({
822
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId, childEndpoint: _chunkQ4FXESVTjs.Modules.Role });
830
- if (params.search) endpoint.addAdditionalParam("search", params.search);
831
- return this.callApi({
832
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
840
- endpoint: _chunkQ4FXESVTjs.Modules.User,
841
- id: params.userId,
842
- childEndpoint: _chunkQ4FXESVTjs.Modules.Role
843
- }).addAdditionalParam("userNotIn", "true");
844
- if (params.search) endpoint.addAdditionalParam("search", params.search);
845
- return this.callApi({
846
- type: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.Role,
855
- method: "POST" /* POST */,
856
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({
857
- endpoint: _chunkQ4FXESVTjs.Modules.Role,
858
- id: params.roleId,
859
- childEndpoint: _chunkQ4FXESVTjs.Modules.User,
860
- childId: params.userId
861
- }).generate()
862
- });
863
- }
864
- static async removeUserFromRole(params) {
865
- this.callApi({
866
- type: _chunkQ4FXESVTjs.Modules.Role,
867
- method: "DELETE" /* DELETE */,
868
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({
869
- endpoint: _chunkQ4FXESVTjs.Modules.Role,
870
- id: params.roleId,
871
- childEndpoint: _chunkQ4FXESVTjs.Modules.User,
872
- childId: params.userId
873
- }).generate()
874
- });
875
- }
876
- static async create(params) {
877
- return this.callApi({
878
- type: _chunkQ4FXESVTjs.Modules.Role,
879
- method: "POST" /* POST */,
880
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.Role,
887
- method: "PUT" /* PUT */,
888
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.Role,
895
- method: "DELETE" /* DELETE */,
896
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId }).generate()
897
- });
898
- }
899
- };
900
-
901
- // src/features/role/role.module.ts
902
- var RoleModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractApiData {
911
- static {
912
- _chunk7QVYU63Ejs.__name.call(void 0, this, "S3");
913
- }
914
-
915
-
916
-
917
-
918
-
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 = _nullishCoalesce(data.jsonApi.attributes.url, () => ( void 0));
939
- this._storageType = _nullishCoalesce(data.jsonApi.attributes.storageType, () => ( void 0));
940
- this._contentType = _nullishCoalesce(data.jsonApi.attributes.contentType, () => ( void 0));
941
- this._blobType = _nullishCoalesce(data.jsonApi.attributes.blobType, () => ( void 0));
942
- this._acl = _nullishCoalesce(data.jsonApi.attributes.acl, () => ( void 0));
943
- return this;
944
- }
945
- createJsonApi(data) {
946
- const response = {
947
- data: {
948
- type: _chunkQ4FXESVTjs.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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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 _chunkQ4FXESVTjs.AbstractService {
970
- static {
971
- _chunk7QVYU63Ejs.__name.call(void 0, this, "S3Service");
972
- }
973
- static async getPreSignedUrl(params) {
974
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.S3 }).addAdditionalParam("key", params.key).addAdditionalParam("contentType", params.contentType);
975
- if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
976
- return this.callApi({ type: _chunkQ4FXESVTjs.Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
977
- }
978
- static async getSignedUrl(params) {
979
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.S3, id: "sign" }).addAdditionalParam("key", params.key);
980
- if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
981
- return this.callApi({ type: _chunkQ4FXESVTjs.Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
982
- }
983
- static async deleteFile(params) {
984
- this.callApi({
985
- type: _chunkQ4FXESVTjs.Modules.S3,
986
- method: "DELETE" /* DELETE */,
987
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.S3 }).addAdditionalParam("key", params.key).generate()
988
- });
989
- }
990
- };
991
-
992
- // src/features/user/data/user.ts
993
- var User = (_class2 = class extends _chunkQ4FXESVTjs.AbstractApiData {constructor(...args2) { super(...args2); _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
994
- static {
995
- _chunk7QVYU63Ejs.__name.call(void 0, this, "User");
996
- }
997
-
998
-
999
-
1000
-
1001
-
1002
-
1003
-
1004
-
1005
-
1006
-
1007
-
1008
-
1009
- __init2() {this._roles = []}
1010
-
1011
- __init3() {this._modules = []}
1012
- get searchResult() {
1013
- return _nullishCoalesce(this._name, () => ( ""));
1014
- }
1015
- get name() {
1016
- return _nullishCoalesce(this._name, () => ( ""));
1017
- }
1018
- get email() {
1019
- return _nullishCoalesce(this._email, () => ( ""));
1020
- }
1021
- get title() {
1022
- return _nullishCoalesce(this._title, () => ( ""));
1023
- }
1024
- get bio() {
1025
- return _nullishCoalesce(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 _nullishCoalesce(this._isActivated, () => ( false));
1044
- }
1045
- get isDeleted() {
1046
- return _nullishCoalesce(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", _chunkQ4FXESVTjs.Modules.Role);
1075
- this._company = this._readIncluded(data, "company", _chunkQ4FXESVTjs.Modules.Company);
1076
- this._modules = this._readIncluded(data, "modules", _chunkQ4FXESVTjs.Modules.Module);
1077
- return this;
1078
- }
1079
- createJsonApi(data) {
1080
- const response = {
1081
- data: {
1082
- type: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.Role.name,
1105
- id: roleId
1106
- }))
1107
- };
1108
- }
1109
- if (data.companyId) {
1110
- response.data.relationships.company = {
1111
- data: {
1112
- type: _chunkQ4FXESVTjs.Modules.Company.name,
1113
- id: data.companyId
1114
- }
1115
- };
1116
- }
1117
- return response;
1118
- }
1119
- }, _class2);
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 _chunkQ4FXESVTjs.AbstractService {
1134
- static {
1135
- _chunk7QVYU63Ejs.__name.call(void 0, this, "UserService");
1136
- }
1137
- static async findFullUser() {
1138
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: "me", childEndpoint: "full" });
1139
- return this.callApi({
1140
- type: _chunkQ4FXESVTjs.Modules.User,
1141
- method: "GET" /* GET */,
1142
- endpoint: endpoint.generate()
1143
- });
1144
- }
1145
- static async findById(params) {
1146
- return this.callApi({
1147
- type: _chunkQ4FXESVTjs.Modules.User,
1148
- method: "GET" /* GET */,
1149
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId }).generate()
1150
- });
1151
- }
1152
- static async findByEmail(params) {
1153
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: "email", childEndpoint: params.email });
1154
- return this.callApi({ type: _chunkQ4FXESVTjs.Modules.User, method: "GET" /* GET */, endpoint: endpoint.generate() });
1155
- }
1156
- static async findMany(params) {
1157
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
1184
- endpoint: _chunkQ4FXESVTjs.Modules.Content,
1185
- id: params.id,
1186
- childEndpoint: "user-relevance"
1187
- });
1188
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _48 => _48.User, 'access', _49 => _49.inclusions, 'optionalAccess', _50 => _50.lists, 'optionalAccess', _51 => _51.fields])) endpoint.limitToFields(_chunkQ4FXESVTjs.Modules.User.inclusions.lists.fields);
1189
- if (_optionalChain([_chunkQ4FXESVTjs.Modules, 'access', _52 => _52.User, 'access', _53 => _53.inclusions, 'optionalAccess', _54 => _54.lists, 'optionalAccess', _55 => _55.types])) endpoint.limitToType(_chunkQ4FXESVTjs.Modules.User.inclusions.lists.types);
1190
- return this.callApi({
1191
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
1200
- endpoint: _chunkQ4FXESVTjs.Modules.Company,
1201
- id: params.companyId,
1202
- childEndpoint: _chunkQ4FXESVTjs.Modules.User
1203
- });
1204
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1205
- return this.callApi({
1206
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
1215
- endpoint: _chunkQ4FXESVTjs.Modules.Company,
1216
- id: params.companyId,
1217
- childEndpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.Role, id: params.roleId, childEndpoint: _chunkQ4FXESVTjs.Modules.User });
1232
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1233
- return this.callApi({
1234
- type: _chunkQ4FXESVTjs.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 (0, _chunkQ4FXESVTjs.EndpointCreator)({
1242
- endpoint: _chunkQ4FXESVTjs.Modules.Role,
1243
- id: params.roleId,
1244
- childEndpoint: _chunkQ4FXESVTjs.Modules.User
1245
- }).addAdditionalParam("notInRole", "true");
1246
- if (params.search) endpoint.addAdditionalParam("search", params.search);
1247
- return this.callApi({
1248
- type: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.User,
1257
- method: "POST" /* POST */,
1258
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User }).generate(),
1259
- companyId: params.companyId,
1260
- input: params
1261
- });
1262
- }
1263
- static async reactivate(params) {
1264
- return this.callApi({
1265
- type: _chunkQ4FXESVTjs.Modules.User,
1266
- method: "PATCH" /* PATCH */,
1267
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.Modules.User, id: params.userId }).generate()
1268
- });
1269
- }
1270
- static async sendInvitation(params) {
1271
- const endpoint = new (0, _chunkQ4FXESVTjs.EndpointCreator)({
1272
- endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.User,
1279
- method: "POST" /* POST */,
1280
- endpoint: endpoint.generate()
1281
- });
1282
- }
1283
- static async update(params) {
1284
- return this.callApi({
1285
- type: _chunkQ4FXESVTjs.Modules.User,
1286
- method: "PUT" /* PUT */,
1287
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.User,
1295
- method: "PATCH" /* PATCH */,
1296
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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: _chunkQ4FXESVTjs.Modules.User,
1304
- method: "DELETE" /* DELETE */,
1305
- endpoint: new (0, _chunkQ4FXESVTjs.EndpointCreator)({ endpoint: _chunkQ4FXESVTjs.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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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__ */ _chunk7QVYU63Ejs.__name.call(void 0, (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
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "users", [`name`, `email`, `avatar`, `title`]),
1329
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "usertopics", [`level`]),
1330
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "userexpertises", [`level`]),
1331
- _chunkQ4FXESVTjs.createJsonApiInclusion.call(void 0, "topics", [`name`])
1332
- ]
1333
- }
1334
- }
1335
- }), "UserModule");
1336
-
1337
-
1338
-
1339
-
1340
-
1341
-
1342
-
1343
-
1344
-
1345
-
1346
-
1347
-
1348
-
1349
-
1350
-
1351
-
1352
-
1353
-
1354
-
1355
-
1356
-
1357
-
1358
-
1359
-
1360
-
1361
-
1362
-
1363
-
1364
-
1365
-
1366
-
1367
-
1368
-
1369
-
1370
-
1371
-
1372
-
1373
-
1374
- exports.Role = Role; exports.RoleFields = RoleFields; exports.RoleService = RoleService; exports.RoleModule = RoleModule; exports.User = User; exports.UserFields = UserFields; exports.UserService = UserService; exports.S3 = S3; exports.S3Module = S3Module; exports.S3Service = S3Service; exports.AuthorModule = AuthorModule; exports.UserModule = UserModule; exports.Company = Company; exports.CompanyFields = CompanyFields; exports.CompanyService = CompanyService; exports.Feature = Feature; exports.FeatureModule = FeatureModule; exports.FeatureService = FeatureService; exports.Notification = Notification; exports.NotificationFields = NotificationFields; exports.NotificationService = NotificationService; exports.AuthModule = AuthModule; exports.Auth = Auth; exports.AuthService = AuthService; exports.AuthComponent = AuthComponent; exports.CompanyModule = CompanyModule; exports.ContentModule = ContentModule; exports.Content = Content; exports.ContentFields = ContentFields; exports.ContentService = ContentService; exports.Module = Module; exports.ModuleModule = ModuleModule; exports.NotificationModule = NotificationModule; exports.Push = Push; exports.PushModule = PushModule; exports.PushService = PushService;
1375
- //# sourceMappingURL=chunk-PO5Q3H5I.js.map