@carlonicora/nextjs-jsonapi 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ApiResponseInterface-CfcC7pPC.d.mts → ApiResponseInterface-DMwITHYP.d.mts} +1 -1
- package/dist/{ApiResponseInterface-DTBJaV5R.d.ts → ApiResponseInterface-DWgIAXI-.d.ts} +1 -1
- package/dist/{BlockNoteEditor-7FM7B737.js → BlockNoteEditor-IJASTIUZ.js} +14 -18
- package/dist/BlockNoteEditor-IJASTIUZ.js.map +1 -0
- package/dist/{BlockNoteEditor-RVL76ZAS.mjs → BlockNoteEditor-M6TUP3NT.mjs} +5 -9
- package/dist/{BlockNoteEditor-RVL76ZAS.mjs.map → BlockNoteEditor-M6TUP3NT.mjs.map} +1 -1
- package/dist/JsonApiRequest-2OM5NDAW.js +24 -0
- package/dist/JsonApiRequest-2OM5NDAW.js.map +1 -0
- package/dist/{JsonApiRequest-VCCRO732.mjs → JsonApiRequest-SYZ6FGCA.mjs} +2 -3
- package/dist/{chunk-SVX7E6RR.js → chunk-4L7OWJ2P.js} +360 -364
- package/dist/chunk-4L7OWJ2P.js.map +1 -0
- package/dist/{chunk-KFL5ZFM4.mjs → chunk-4U5CJA44.mjs} +732 -20
- package/dist/chunk-4U5CJA44.mjs.map +1 -0
- package/dist/{chunk-ZUEEIQHW.js → chunk-CKS6SVUK.js} +158 -22
- package/dist/chunk-CKS6SVUK.js.map +1 -0
- package/dist/{chunk-F4Y3GZG4.mjs → chunk-SAL7XW2G.mjs} +141 -5
- package/dist/chunk-SAL7XW2G.mjs.map +1 -0
- package/dist/{chunk-ZQTFZKLJ.mjs → chunk-TW4QRJ7D.mjs} +10 -14
- package/dist/{chunk-ZQTFZKLJ.mjs.map → chunk-TW4QRJ7D.mjs.map} +1 -1
- package/dist/{chunk-2Z56AS2S.js → chunk-U4NADAHN.js} +744 -32
- package/dist/chunk-U4NADAHN.js.map +1 -0
- package/dist/client/index.d.mts +5 -5
- package/dist/client/index.d.ts +5 -5
- package/dist/client/index.js +4 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +3 -6
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +4 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -6
- package/dist/{config-B43zxEvn.d.mts → config-BdCV25CE.d.mts} +1 -1
- package/dist/{config-D2OUrI_G.d.ts → config-C9dt1QiR.d.ts} +1 -1
- package/dist/{content.interface-Bs8a7uW6.d.mts → content.interface-B6qP_ABq.d.mts} +1 -1
- package/dist/{content.interface-UtsJ-mzs.d.ts → content.interface-DHAFLasV.d.ts} +1 -1
- package/dist/contexts/index.d.mts +2 -2
- package/dist/contexts/index.d.ts +2 -2
- package/dist/contexts/index.js +4 -7
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +3 -6
- package/dist/core/index.d.mts +43 -7
- package/dist/core/index.d.ts +43 -7
- package/dist/core/index.js +29 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +28 -2
- package/dist/index.d.mts +7 -44
- package/dist/index.d.ts +7 -44
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -8
- package/dist/{notification.interface-BdcwkuQE.d.mts → notification.interface-agcMYCkg.d.mts} +1 -1
- package/dist/{notification.interface-BdcwkuQE.d.ts → notification.interface-agcMYCkg.d.ts} +1 -1
- package/dist/s3.service-DYnmymEd.d.mts +350 -0
- package/dist/s3.service-DyXjKTqr.d.ts +350 -0
- package/dist/server/index.d.mts +5 -235
- package/dist/server/index.d.ts +5 -235
- package/dist/server/index.js +12 -16
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +3 -7
- package/dist/server/index.mjs.map +1 -1
- package/dist/{useSocket-BWJUXuOl.d.mts → useSocket-91s8M4Xd.d.mts} +1 -1
- package/dist/{useSocket-8vwK_R_c.d.ts → useSocket-DSR7vaXj.d.ts} +1 -1
- package/package.json +1 -1
- package/src/core/index.ts +3 -0
- package/src/features/auth/data/index.ts +1 -0
- package/src/features/company/data/index.ts +1 -0
- package/src/features/content/data/index.ts +1 -0
- package/src/features/feature/data/index.ts +1 -0
- package/src/features/notification/data/index.ts +1 -0
- package/src/features/push/data/index.ts +1 -0
- package/src/features/role/data/index.ts +1 -0
- package/src/features/s3/data/index.ts +1 -0
- package/src/features/user/data/index.ts +1 -0
- package/dist/BlockNoteEditor-7FM7B737.js.map +0 -1
- package/dist/JsonApiRequest-KOKGVPBI.js +0 -25
- package/dist/JsonApiRequest-KOKGVPBI.js.map +0 -1
- package/dist/chunk-2Z56AS2S.js.map +0 -1
- package/dist/chunk-37NJZ2VD.mjs +0 -637
- package/dist/chunk-37NJZ2VD.mjs.map +0 -1
- package/dist/chunk-AGAJMJ4T.js +0 -147
- package/dist/chunk-AGAJMJ4T.js.map +0 -1
- package/dist/chunk-CSM6AIAP.js +0 -98
- package/dist/chunk-CSM6AIAP.js.map +0 -1
- package/dist/chunk-F4Y3GZG4.mjs.map +0 -1
- package/dist/chunk-K4W5QXL5.mjs +0 -98
- package/dist/chunk-K4W5QXL5.mjs.map +0 -1
- package/dist/chunk-KFL5ZFM4.mjs.map +0 -1
- package/dist/chunk-LOSPCUCF.js +0 -637
- package/dist/chunk-LOSPCUCF.js.map +0 -1
- package/dist/chunk-RBIVEH2K.mjs +0 -147
- package/dist/chunk-RBIVEH2K.mjs.map +0 -1
- package/dist/chunk-SVX7E6RR.js.map +0 -1
- package/dist/chunk-ZUEEIQHW.js.map +0 -1
- package/dist/s3.interface-D7ttGatc.d.ts +0 -119
- package/dist/s3.interface-DlaMDRTn.d.mts +0 -119
- /package/dist/{JsonApiRequest-VCCRO732.mjs.map → JsonApiRequest-SYZ6FGCA.mjs.map} +0 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { a as ApiRequestDataTypeInterface, l as FeatureInterface, o as RoleInterface, k as CompanyInterface, C as CompanyInput, U as UserInterface, p as UserInput, A as ApiDataInterface, J as JsonApiHydratedDataInterface, N as NotificationInterface } from './notification.interface-agcMYCkg.mjs';
|
|
2
|
+
import { a as ContentInterface } from './content.interface-B6qP_ABq.mjs';
|
|
3
|
+
|
|
4
|
+
declare enum HttpMethod {
|
|
5
|
+
GET = "GET",
|
|
6
|
+
POST = "POST",
|
|
7
|
+
PUT = "PUT",
|
|
8
|
+
PATCH = "PATCH",
|
|
9
|
+
DELETE = "DELETE"
|
|
10
|
+
}
|
|
11
|
+
interface NextRef {
|
|
12
|
+
next?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PreviousRef {
|
|
15
|
+
previous?: string;
|
|
16
|
+
}
|
|
17
|
+
interface SelfRef {
|
|
18
|
+
self?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set a global error handler for API errors (client-side only).
|
|
22
|
+
* This handler will be called instead of throwing errors.
|
|
23
|
+
*/
|
|
24
|
+
declare function setGlobalErrorHandler(handler: (status: number, message: string) => void): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get the current global error handler.
|
|
27
|
+
*/
|
|
28
|
+
declare function getGlobalErrorHandler(): ((status: number, message: string) => void) | null;
|
|
29
|
+
/**
|
|
30
|
+
* Abstract base class for services that interact with the JSON:API.
|
|
31
|
+
* Extend this class to create feature-specific services.
|
|
32
|
+
*/
|
|
33
|
+
declare abstract class AbstractService {
|
|
34
|
+
/**
|
|
35
|
+
* Extract locale from client-side URL pathname
|
|
36
|
+
* URL structure: /{locale}/route-path (e.g., /it/accounts)
|
|
37
|
+
* Fallback chain: URL locale → navigator.language → "en"
|
|
38
|
+
*/
|
|
39
|
+
private static getClientLocale;
|
|
40
|
+
static next<T>(params: {
|
|
41
|
+
type: ApiRequestDataTypeInterface;
|
|
42
|
+
endpoint: string;
|
|
43
|
+
next?: NextRef;
|
|
44
|
+
previous?: PreviousRef;
|
|
45
|
+
self?: SelfRef;
|
|
46
|
+
}): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Fetch the previous page of results.
|
|
49
|
+
*/
|
|
50
|
+
static previous<T>(params: {
|
|
51
|
+
type: ApiRequestDataTypeInterface;
|
|
52
|
+
endpoint: string;
|
|
53
|
+
next?: NextRef;
|
|
54
|
+
previous?: PreviousRef;
|
|
55
|
+
self?: SelfRef;
|
|
56
|
+
}): Promise<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Make an API call with automatic environment detection and error handling.
|
|
59
|
+
*/
|
|
60
|
+
protected static callApi<T>(params: {
|
|
61
|
+
type: ApiRequestDataTypeInterface;
|
|
62
|
+
method: HttpMethod;
|
|
63
|
+
endpoint: string;
|
|
64
|
+
companyId?: string;
|
|
65
|
+
input?: any;
|
|
66
|
+
overridesJsonApiCreation?: boolean;
|
|
67
|
+
next?: NextRef;
|
|
68
|
+
previous?: PreviousRef;
|
|
69
|
+
self?: SelfRef;
|
|
70
|
+
responseType?: ApiRequestDataTypeInterface;
|
|
71
|
+
files?: {
|
|
72
|
+
[key: string]: File | Blob;
|
|
73
|
+
} | File | Blob;
|
|
74
|
+
}): Promise<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Get raw JSON:API response data without deserialization.
|
|
77
|
+
*/
|
|
78
|
+
protected static getRawData(params: {
|
|
79
|
+
type: ApiRequestDataTypeInterface;
|
|
80
|
+
method: HttpMethod;
|
|
81
|
+
endpoint: string;
|
|
82
|
+
companyId?: string;
|
|
83
|
+
}): Promise<any>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare class FeatureService extends AbstractService {
|
|
87
|
+
static findMany(params: {
|
|
88
|
+
companyId?: string;
|
|
89
|
+
search?: string;
|
|
90
|
+
next?: NextRef;
|
|
91
|
+
}): Promise<FeatureInterface[]>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class RoleService extends AbstractService {
|
|
95
|
+
static findById(params: {
|
|
96
|
+
roleId: string;
|
|
97
|
+
}): Promise<RoleInterface>;
|
|
98
|
+
static findAllRoles(params: {
|
|
99
|
+
search?: string;
|
|
100
|
+
next?: NextRef;
|
|
101
|
+
}): Promise<RoleInterface[]>;
|
|
102
|
+
static findAllRolesByUser(params: {
|
|
103
|
+
userId: string;
|
|
104
|
+
search?: string;
|
|
105
|
+
next?: NextRef;
|
|
106
|
+
prev?: PreviousRef;
|
|
107
|
+
}): Promise<RoleInterface[]>;
|
|
108
|
+
static findAllRolesUserNotIn(params: {
|
|
109
|
+
userId: string;
|
|
110
|
+
search?: string;
|
|
111
|
+
next?: NextRef;
|
|
112
|
+
prev?: PreviousRef;
|
|
113
|
+
}): Promise<RoleInterface[]>;
|
|
114
|
+
static addUserToRole(params: {
|
|
115
|
+
userId: string;
|
|
116
|
+
roleId: string;
|
|
117
|
+
}): Promise<void>;
|
|
118
|
+
static removeUserFromRole(params: {
|
|
119
|
+
userId: string;
|
|
120
|
+
roleId: string;
|
|
121
|
+
}): Promise<void>;
|
|
122
|
+
static create(params: {
|
|
123
|
+
roleId: string;
|
|
124
|
+
name: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
}): Promise<RoleInterface>;
|
|
127
|
+
static update(params: {
|
|
128
|
+
roleId: string;
|
|
129
|
+
name: string;
|
|
130
|
+
description?: string;
|
|
131
|
+
}): Promise<RoleInterface>;
|
|
132
|
+
static delete(params: {
|
|
133
|
+
roleId: string;
|
|
134
|
+
}): Promise<RoleInterface>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class CompanyService extends AbstractService {
|
|
138
|
+
static findOne(params: {
|
|
139
|
+
companyId: string;
|
|
140
|
+
}): Promise<CompanyInterface>;
|
|
141
|
+
static findMany(params: {
|
|
142
|
+
search?: string;
|
|
143
|
+
next?: NextRef;
|
|
144
|
+
}): Promise<CompanyInterface[]>;
|
|
145
|
+
static delete(params: {
|
|
146
|
+
companyId: string;
|
|
147
|
+
}): Promise<void>;
|
|
148
|
+
static create(params: CompanyInput): Promise<CompanyInterface>;
|
|
149
|
+
static update(params: CompanyInput): Promise<CompanyInterface>;
|
|
150
|
+
static updateConfigurations(params: CompanyInput): Promise<CompanyInterface>;
|
|
151
|
+
static activateLicense(params: CompanyInput): Promise<CompanyInterface>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class UserService extends AbstractService {
|
|
155
|
+
static findFullUser(): Promise<UserInterface>;
|
|
156
|
+
static findById(params: {
|
|
157
|
+
userId: string;
|
|
158
|
+
}): Promise<UserInterface>;
|
|
159
|
+
static findByEmail(params: {
|
|
160
|
+
email: string;
|
|
161
|
+
}): Promise<UserInterface>;
|
|
162
|
+
static findMany(params: {
|
|
163
|
+
roleId?: string;
|
|
164
|
+
search?: string;
|
|
165
|
+
fetchAll?: boolean;
|
|
166
|
+
includeDeleted?: boolean;
|
|
167
|
+
next?: NextRef;
|
|
168
|
+
prev?: PreviousRef;
|
|
169
|
+
}): Promise<UserInterface[]>;
|
|
170
|
+
static findManyByContentIds(params: {
|
|
171
|
+
contentIds: string[];
|
|
172
|
+
search?: string;
|
|
173
|
+
next?: NextRef;
|
|
174
|
+
prev?: PreviousRef;
|
|
175
|
+
}): Promise<UserInterface[]>;
|
|
176
|
+
static findRelevant(params: {
|
|
177
|
+
id: string;
|
|
178
|
+
next?: NextRef;
|
|
179
|
+
prev?: PreviousRef;
|
|
180
|
+
}): Promise<UserInterface[]>;
|
|
181
|
+
static findManyForAmin(params: {
|
|
182
|
+
companyId?: string;
|
|
183
|
+
search?: string;
|
|
184
|
+
next?: NextRef;
|
|
185
|
+
prev?: PreviousRef;
|
|
186
|
+
}): Promise<UserInterface[]>;
|
|
187
|
+
static findAllUsers(params: {
|
|
188
|
+
companyId: string;
|
|
189
|
+
search?: string;
|
|
190
|
+
limitToRoles?: string[];
|
|
191
|
+
isDeleted?: boolean;
|
|
192
|
+
next?: NextRef;
|
|
193
|
+
prev?: PreviousRef;
|
|
194
|
+
}): Promise<UserInterface[]>;
|
|
195
|
+
static findAllUsersByRole(params: {
|
|
196
|
+
roleId: string;
|
|
197
|
+
search?: string;
|
|
198
|
+
next?: NextRef;
|
|
199
|
+
prev?: PreviousRef;
|
|
200
|
+
}): Promise<UserInterface[]>;
|
|
201
|
+
static findAllUsersNotInRole(params: {
|
|
202
|
+
roleId: string;
|
|
203
|
+
search?: string;
|
|
204
|
+
next?: NextRef;
|
|
205
|
+
prev?: PreviousRef;
|
|
206
|
+
}): Promise<UserInterface[]>;
|
|
207
|
+
static create(params: UserInput): Promise<UserInterface>;
|
|
208
|
+
static reactivate(params: {
|
|
209
|
+
userId: string;
|
|
210
|
+
}): Promise<UserInterface>;
|
|
211
|
+
static sendInvitation(params: {
|
|
212
|
+
userId: string;
|
|
213
|
+
companyId?: string;
|
|
214
|
+
}): Promise<void>;
|
|
215
|
+
static update(params: UserInput): Promise<UserInterface>;
|
|
216
|
+
static patchRate(params: UserInput): Promise<UserInterface>;
|
|
217
|
+
static delete(params: {
|
|
218
|
+
userId: string;
|
|
219
|
+
companyId: string;
|
|
220
|
+
}): Promise<void>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
type AuthInput = {
|
|
224
|
+
id?: string;
|
|
225
|
+
email?: string | undefined | null;
|
|
226
|
+
password?: string | undefined;
|
|
227
|
+
name?: string;
|
|
228
|
+
companyName?: string;
|
|
229
|
+
partitaIva?: string;
|
|
230
|
+
codiceFiscale?: string;
|
|
231
|
+
};
|
|
232
|
+
type AuthQuery = {
|
|
233
|
+
userId?: string;
|
|
234
|
+
tokenCode?: string;
|
|
235
|
+
refreshToken?: string;
|
|
236
|
+
login?: boolean;
|
|
237
|
+
forgot?: boolean;
|
|
238
|
+
code?: string;
|
|
239
|
+
activationCode?: string;
|
|
240
|
+
checkUsername?: string;
|
|
241
|
+
};
|
|
242
|
+
interface AuthInterface extends ApiDataInterface {
|
|
243
|
+
get token(): string;
|
|
244
|
+
get refreshToken(): string;
|
|
245
|
+
get user(): UserInterface;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class AuthService extends AbstractService {
|
|
249
|
+
static login(params: {
|
|
250
|
+
email: string;
|
|
251
|
+
password: string;
|
|
252
|
+
language?: string;
|
|
253
|
+
}): Promise<UserInterface>;
|
|
254
|
+
static logout(params?: {
|
|
255
|
+
language?: string;
|
|
256
|
+
}): Promise<void>;
|
|
257
|
+
static initialiseForgotPassword(params: {
|
|
258
|
+
email: string;
|
|
259
|
+
language?: string;
|
|
260
|
+
}): Promise<void>;
|
|
261
|
+
static register(params: AuthInput): Promise<void>;
|
|
262
|
+
static activate(params: {
|
|
263
|
+
activationCode: string;
|
|
264
|
+
}): Promise<void>;
|
|
265
|
+
static validateCode(params: {
|
|
266
|
+
code: string;
|
|
267
|
+
language?: string;
|
|
268
|
+
}): Promise<void>;
|
|
269
|
+
static resetPassword(params: {
|
|
270
|
+
code: string;
|
|
271
|
+
password: string;
|
|
272
|
+
}): Promise<void>;
|
|
273
|
+
static acceptInvitation(params: {
|
|
274
|
+
code: string;
|
|
275
|
+
password: string;
|
|
276
|
+
}): Promise<void>;
|
|
277
|
+
static findToken(params: {
|
|
278
|
+
tokenCode: string;
|
|
279
|
+
}): Promise<AuthInterface>;
|
|
280
|
+
static saveToken(params: {
|
|
281
|
+
dehydratedAuth: JsonApiHydratedDataInterface;
|
|
282
|
+
}): Promise<void>;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
declare class ContentService extends AbstractService {
|
|
286
|
+
static findMany(params: {
|
|
287
|
+
contentIds?: string[];
|
|
288
|
+
search?: string;
|
|
289
|
+
fetchAll?: boolean;
|
|
290
|
+
next?: NextRef;
|
|
291
|
+
prev?: PreviousRef;
|
|
292
|
+
}): Promise<ContentInterface[]>;
|
|
293
|
+
static findRelevant(params: {
|
|
294
|
+
id: string;
|
|
295
|
+
next?: NextRef;
|
|
296
|
+
prev?: PreviousRef;
|
|
297
|
+
}): Promise<ContentInterface[]>;
|
|
298
|
+
static findManyByAuthor(params: {
|
|
299
|
+
userId: string;
|
|
300
|
+
search?: string;
|
|
301
|
+
fetchAll?: boolean;
|
|
302
|
+
next?: NextRef;
|
|
303
|
+
prev?: PreviousRef;
|
|
304
|
+
}): Promise<ContentInterface[]>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class NotificationService extends AbstractService {
|
|
308
|
+
static findMany(params: {
|
|
309
|
+
isArchived?: boolean;
|
|
310
|
+
next?: NextRef;
|
|
311
|
+
}): Promise<NotificationInterface[]>;
|
|
312
|
+
static markAsRead(params: {
|
|
313
|
+
data: any;
|
|
314
|
+
}): Promise<void>;
|
|
315
|
+
static archive(params: {
|
|
316
|
+
id: string;
|
|
317
|
+
}): Promise<void>;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
declare class PushService extends AbstractService {
|
|
321
|
+
static register(params: {
|
|
322
|
+
data: any;
|
|
323
|
+
}): Promise<void>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
type S3Input = {
|
|
327
|
+
key: string;
|
|
328
|
+
contentType?: string;
|
|
329
|
+
};
|
|
330
|
+
interface S3Interface extends ApiDataInterface {
|
|
331
|
+
get url(): string;
|
|
332
|
+
get headers(): Record<string, string>;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
declare class S3Service extends AbstractService {
|
|
336
|
+
static getPreSignedUrl(params: {
|
|
337
|
+
key: string;
|
|
338
|
+
contentType: string;
|
|
339
|
+
isPublic?: boolean;
|
|
340
|
+
}): Promise<S3Interface>;
|
|
341
|
+
static getSignedUrl(params: {
|
|
342
|
+
key: string;
|
|
343
|
+
isPublic?: boolean;
|
|
344
|
+
}): Promise<S3Interface>;
|
|
345
|
+
static deleteFile(params: {
|
|
346
|
+
key: string;
|
|
347
|
+
}): Promise<void>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export { AbstractService as A, CompanyService as C, FeatureService as F, HttpMethod as H, type NextRef as N, type PreviousRef as P, RoleService as R, type SelfRef as S, UserService as U, type AuthInput as a, type AuthQuery as b, type AuthInterface as c, AuthService as d, ContentService as e, NotificationService as f, getGlobalErrorHandler as g, PushService as h, type S3Input as i, type S3Interface as j, S3Service as k, setGlobalErrorHandler as s };
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { a as ApiRequestDataTypeInterface, l as FeatureInterface, o as RoleInterface, k as CompanyInterface, C as CompanyInput, U as UserInterface, p as UserInput, A as ApiDataInterface, J as JsonApiHydratedDataInterface, N as NotificationInterface } from './notification.interface-agcMYCkg.js';
|
|
2
|
+
import { a as ContentInterface } from './content.interface-DHAFLasV.js';
|
|
3
|
+
|
|
4
|
+
declare enum HttpMethod {
|
|
5
|
+
GET = "GET",
|
|
6
|
+
POST = "POST",
|
|
7
|
+
PUT = "PUT",
|
|
8
|
+
PATCH = "PATCH",
|
|
9
|
+
DELETE = "DELETE"
|
|
10
|
+
}
|
|
11
|
+
interface NextRef {
|
|
12
|
+
next?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PreviousRef {
|
|
15
|
+
previous?: string;
|
|
16
|
+
}
|
|
17
|
+
interface SelfRef {
|
|
18
|
+
self?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set a global error handler for API errors (client-side only).
|
|
22
|
+
* This handler will be called instead of throwing errors.
|
|
23
|
+
*/
|
|
24
|
+
declare function setGlobalErrorHandler(handler: (status: number, message: string) => void): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get the current global error handler.
|
|
27
|
+
*/
|
|
28
|
+
declare function getGlobalErrorHandler(): ((status: number, message: string) => void) | null;
|
|
29
|
+
/**
|
|
30
|
+
* Abstract base class for services that interact with the JSON:API.
|
|
31
|
+
* Extend this class to create feature-specific services.
|
|
32
|
+
*/
|
|
33
|
+
declare abstract class AbstractService {
|
|
34
|
+
/**
|
|
35
|
+
* Extract locale from client-side URL pathname
|
|
36
|
+
* URL structure: /{locale}/route-path (e.g., /it/accounts)
|
|
37
|
+
* Fallback chain: URL locale → navigator.language → "en"
|
|
38
|
+
*/
|
|
39
|
+
private static getClientLocale;
|
|
40
|
+
static next<T>(params: {
|
|
41
|
+
type: ApiRequestDataTypeInterface;
|
|
42
|
+
endpoint: string;
|
|
43
|
+
next?: NextRef;
|
|
44
|
+
previous?: PreviousRef;
|
|
45
|
+
self?: SelfRef;
|
|
46
|
+
}): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Fetch the previous page of results.
|
|
49
|
+
*/
|
|
50
|
+
static previous<T>(params: {
|
|
51
|
+
type: ApiRequestDataTypeInterface;
|
|
52
|
+
endpoint: string;
|
|
53
|
+
next?: NextRef;
|
|
54
|
+
previous?: PreviousRef;
|
|
55
|
+
self?: SelfRef;
|
|
56
|
+
}): Promise<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Make an API call with automatic environment detection and error handling.
|
|
59
|
+
*/
|
|
60
|
+
protected static callApi<T>(params: {
|
|
61
|
+
type: ApiRequestDataTypeInterface;
|
|
62
|
+
method: HttpMethod;
|
|
63
|
+
endpoint: string;
|
|
64
|
+
companyId?: string;
|
|
65
|
+
input?: any;
|
|
66
|
+
overridesJsonApiCreation?: boolean;
|
|
67
|
+
next?: NextRef;
|
|
68
|
+
previous?: PreviousRef;
|
|
69
|
+
self?: SelfRef;
|
|
70
|
+
responseType?: ApiRequestDataTypeInterface;
|
|
71
|
+
files?: {
|
|
72
|
+
[key: string]: File | Blob;
|
|
73
|
+
} | File | Blob;
|
|
74
|
+
}): Promise<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Get raw JSON:API response data without deserialization.
|
|
77
|
+
*/
|
|
78
|
+
protected static getRawData(params: {
|
|
79
|
+
type: ApiRequestDataTypeInterface;
|
|
80
|
+
method: HttpMethod;
|
|
81
|
+
endpoint: string;
|
|
82
|
+
companyId?: string;
|
|
83
|
+
}): Promise<any>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare class FeatureService extends AbstractService {
|
|
87
|
+
static findMany(params: {
|
|
88
|
+
companyId?: string;
|
|
89
|
+
search?: string;
|
|
90
|
+
next?: NextRef;
|
|
91
|
+
}): Promise<FeatureInterface[]>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class RoleService extends AbstractService {
|
|
95
|
+
static findById(params: {
|
|
96
|
+
roleId: string;
|
|
97
|
+
}): Promise<RoleInterface>;
|
|
98
|
+
static findAllRoles(params: {
|
|
99
|
+
search?: string;
|
|
100
|
+
next?: NextRef;
|
|
101
|
+
}): Promise<RoleInterface[]>;
|
|
102
|
+
static findAllRolesByUser(params: {
|
|
103
|
+
userId: string;
|
|
104
|
+
search?: string;
|
|
105
|
+
next?: NextRef;
|
|
106
|
+
prev?: PreviousRef;
|
|
107
|
+
}): Promise<RoleInterface[]>;
|
|
108
|
+
static findAllRolesUserNotIn(params: {
|
|
109
|
+
userId: string;
|
|
110
|
+
search?: string;
|
|
111
|
+
next?: NextRef;
|
|
112
|
+
prev?: PreviousRef;
|
|
113
|
+
}): Promise<RoleInterface[]>;
|
|
114
|
+
static addUserToRole(params: {
|
|
115
|
+
userId: string;
|
|
116
|
+
roleId: string;
|
|
117
|
+
}): Promise<void>;
|
|
118
|
+
static removeUserFromRole(params: {
|
|
119
|
+
userId: string;
|
|
120
|
+
roleId: string;
|
|
121
|
+
}): Promise<void>;
|
|
122
|
+
static create(params: {
|
|
123
|
+
roleId: string;
|
|
124
|
+
name: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
}): Promise<RoleInterface>;
|
|
127
|
+
static update(params: {
|
|
128
|
+
roleId: string;
|
|
129
|
+
name: string;
|
|
130
|
+
description?: string;
|
|
131
|
+
}): Promise<RoleInterface>;
|
|
132
|
+
static delete(params: {
|
|
133
|
+
roleId: string;
|
|
134
|
+
}): Promise<RoleInterface>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class CompanyService extends AbstractService {
|
|
138
|
+
static findOne(params: {
|
|
139
|
+
companyId: string;
|
|
140
|
+
}): Promise<CompanyInterface>;
|
|
141
|
+
static findMany(params: {
|
|
142
|
+
search?: string;
|
|
143
|
+
next?: NextRef;
|
|
144
|
+
}): Promise<CompanyInterface[]>;
|
|
145
|
+
static delete(params: {
|
|
146
|
+
companyId: string;
|
|
147
|
+
}): Promise<void>;
|
|
148
|
+
static create(params: CompanyInput): Promise<CompanyInterface>;
|
|
149
|
+
static update(params: CompanyInput): Promise<CompanyInterface>;
|
|
150
|
+
static updateConfigurations(params: CompanyInput): Promise<CompanyInterface>;
|
|
151
|
+
static activateLicense(params: CompanyInput): Promise<CompanyInterface>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class UserService extends AbstractService {
|
|
155
|
+
static findFullUser(): Promise<UserInterface>;
|
|
156
|
+
static findById(params: {
|
|
157
|
+
userId: string;
|
|
158
|
+
}): Promise<UserInterface>;
|
|
159
|
+
static findByEmail(params: {
|
|
160
|
+
email: string;
|
|
161
|
+
}): Promise<UserInterface>;
|
|
162
|
+
static findMany(params: {
|
|
163
|
+
roleId?: string;
|
|
164
|
+
search?: string;
|
|
165
|
+
fetchAll?: boolean;
|
|
166
|
+
includeDeleted?: boolean;
|
|
167
|
+
next?: NextRef;
|
|
168
|
+
prev?: PreviousRef;
|
|
169
|
+
}): Promise<UserInterface[]>;
|
|
170
|
+
static findManyByContentIds(params: {
|
|
171
|
+
contentIds: string[];
|
|
172
|
+
search?: string;
|
|
173
|
+
next?: NextRef;
|
|
174
|
+
prev?: PreviousRef;
|
|
175
|
+
}): Promise<UserInterface[]>;
|
|
176
|
+
static findRelevant(params: {
|
|
177
|
+
id: string;
|
|
178
|
+
next?: NextRef;
|
|
179
|
+
prev?: PreviousRef;
|
|
180
|
+
}): Promise<UserInterface[]>;
|
|
181
|
+
static findManyForAmin(params: {
|
|
182
|
+
companyId?: string;
|
|
183
|
+
search?: string;
|
|
184
|
+
next?: NextRef;
|
|
185
|
+
prev?: PreviousRef;
|
|
186
|
+
}): Promise<UserInterface[]>;
|
|
187
|
+
static findAllUsers(params: {
|
|
188
|
+
companyId: string;
|
|
189
|
+
search?: string;
|
|
190
|
+
limitToRoles?: string[];
|
|
191
|
+
isDeleted?: boolean;
|
|
192
|
+
next?: NextRef;
|
|
193
|
+
prev?: PreviousRef;
|
|
194
|
+
}): Promise<UserInterface[]>;
|
|
195
|
+
static findAllUsersByRole(params: {
|
|
196
|
+
roleId: string;
|
|
197
|
+
search?: string;
|
|
198
|
+
next?: NextRef;
|
|
199
|
+
prev?: PreviousRef;
|
|
200
|
+
}): Promise<UserInterface[]>;
|
|
201
|
+
static findAllUsersNotInRole(params: {
|
|
202
|
+
roleId: string;
|
|
203
|
+
search?: string;
|
|
204
|
+
next?: NextRef;
|
|
205
|
+
prev?: PreviousRef;
|
|
206
|
+
}): Promise<UserInterface[]>;
|
|
207
|
+
static create(params: UserInput): Promise<UserInterface>;
|
|
208
|
+
static reactivate(params: {
|
|
209
|
+
userId: string;
|
|
210
|
+
}): Promise<UserInterface>;
|
|
211
|
+
static sendInvitation(params: {
|
|
212
|
+
userId: string;
|
|
213
|
+
companyId?: string;
|
|
214
|
+
}): Promise<void>;
|
|
215
|
+
static update(params: UserInput): Promise<UserInterface>;
|
|
216
|
+
static patchRate(params: UserInput): Promise<UserInterface>;
|
|
217
|
+
static delete(params: {
|
|
218
|
+
userId: string;
|
|
219
|
+
companyId: string;
|
|
220
|
+
}): Promise<void>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
type AuthInput = {
|
|
224
|
+
id?: string;
|
|
225
|
+
email?: string | undefined | null;
|
|
226
|
+
password?: string | undefined;
|
|
227
|
+
name?: string;
|
|
228
|
+
companyName?: string;
|
|
229
|
+
partitaIva?: string;
|
|
230
|
+
codiceFiscale?: string;
|
|
231
|
+
};
|
|
232
|
+
type AuthQuery = {
|
|
233
|
+
userId?: string;
|
|
234
|
+
tokenCode?: string;
|
|
235
|
+
refreshToken?: string;
|
|
236
|
+
login?: boolean;
|
|
237
|
+
forgot?: boolean;
|
|
238
|
+
code?: string;
|
|
239
|
+
activationCode?: string;
|
|
240
|
+
checkUsername?: string;
|
|
241
|
+
};
|
|
242
|
+
interface AuthInterface extends ApiDataInterface {
|
|
243
|
+
get token(): string;
|
|
244
|
+
get refreshToken(): string;
|
|
245
|
+
get user(): UserInterface;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class AuthService extends AbstractService {
|
|
249
|
+
static login(params: {
|
|
250
|
+
email: string;
|
|
251
|
+
password: string;
|
|
252
|
+
language?: string;
|
|
253
|
+
}): Promise<UserInterface>;
|
|
254
|
+
static logout(params?: {
|
|
255
|
+
language?: string;
|
|
256
|
+
}): Promise<void>;
|
|
257
|
+
static initialiseForgotPassword(params: {
|
|
258
|
+
email: string;
|
|
259
|
+
language?: string;
|
|
260
|
+
}): Promise<void>;
|
|
261
|
+
static register(params: AuthInput): Promise<void>;
|
|
262
|
+
static activate(params: {
|
|
263
|
+
activationCode: string;
|
|
264
|
+
}): Promise<void>;
|
|
265
|
+
static validateCode(params: {
|
|
266
|
+
code: string;
|
|
267
|
+
language?: string;
|
|
268
|
+
}): Promise<void>;
|
|
269
|
+
static resetPassword(params: {
|
|
270
|
+
code: string;
|
|
271
|
+
password: string;
|
|
272
|
+
}): Promise<void>;
|
|
273
|
+
static acceptInvitation(params: {
|
|
274
|
+
code: string;
|
|
275
|
+
password: string;
|
|
276
|
+
}): Promise<void>;
|
|
277
|
+
static findToken(params: {
|
|
278
|
+
tokenCode: string;
|
|
279
|
+
}): Promise<AuthInterface>;
|
|
280
|
+
static saveToken(params: {
|
|
281
|
+
dehydratedAuth: JsonApiHydratedDataInterface;
|
|
282
|
+
}): Promise<void>;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
declare class ContentService extends AbstractService {
|
|
286
|
+
static findMany(params: {
|
|
287
|
+
contentIds?: string[];
|
|
288
|
+
search?: string;
|
|
289
|
+
fetchAll?: boolean;
|
|
290
|
+
next?: NextRef;
|
|
291
|
+
prev?: PreviousRef;
|
|
292
|
+
}): Promise<ContentInterface[]>;
|
|
293
|
+
static findRelevant(params: {
|
|
294
|
+
id: string;
|
|
295
|
+
next?: NextRef;
|
|
296
|
+
prev?: PreviousRef;
|
|
297
|
+
}): Promise<ContentInterface[]>;
|
|
298
|
+
static findManyByAuthor(params: {
|
|
299
|
+
userId: string;
|
|
300
|
+
search?: string;
|
|
301
|
+
fetchAll?: boolean;
|
|
302
|
+
next?: NextRef;
|
|
303
|
+
prev?: PreviousRef;
|
|
304
|
+
}): Promise<ContentInterface[]>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class NotificationService extends AbstractService {
|
|
308
|
+
static findMany(params: {
|
|
309
|
+
isArchived?: boolean;
|
|
310
|
+
next?: NextRef;
|
|
311
|
+
}): Promise<NotificationInterface[]>;
|
|
312
|
+
static markAsRead(params: {
|
|
313
|
+
data: any;
|
|
314
|
+
}): Promise<void>;
|
|
315
|
+
static archive(params: {
|
|
316
|
+
id: string;
|
|
317
|
+
}): Promise<void>;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
declare class PushService extends AbstractService {
|
|
321
|
+
static register(params: {
|
|
322
|
+
data: any;
|
|
323
|
+
}): Promise<void>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
type S3Input = {
|
|
327
|
+
key: string;
|
|
328
|
+
contentType?: string;
|
|
329
|
+
};
|
|
330
|
+
interface S3Interface extends ApiDataInterface {
|
|
331
|
+
get url(): string;
|
|
332
|
+
get headers(): Record<string, string>;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
declare class S3Service extends AbstractService {
|
|
336
|
+
static getPreSignedUrl(params: {
|
|
337
|
+
key: string;
|
|
338
|
+
contentType: string;
|
|
339
|
+
isPublic?: boolean;
|
|
340
|
+
}): Promise<S3Interface>;
|
|
341
|
+
static getSignedUrl(params: {
|
|
342
|
+
key: string;
|
|
343
|
+
isPublic?: boolean;
|
|
344
|
+
}): Promise<S3Interface>;
|
|
345
|
+
static deleteFile(params: {
|
|
346
|
+
key: string;
|
|
347
|
+
}): Promise<void>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export { AbstractService as A, CompanyService as C, FeatureService as F, HttpMethod as H, type NextRef as N, type PreviousRef as P, RoleService as R, type SelfRef as S, UserService as U, type AuthInput as a, type AuthQuery as b, type AuthInterface as c, AuthService as d, ContentService as e, NotificationService as f, getGlobalErrorHandler as g, PushService as h, type S3Input as i, type S3Interface as j, S3Service as k, setGlobalErrorHandler as s };
|