@carlonicora/nextjs-jsonapi 0.0.1

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