@edraj/tsdmart 4.0.2 → 4.1.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/dmart.model.ts +1 -0
- package/dmart.service.ts +218 -3
- package/package.json +1 -1
package/dmart.model.ts
CHANGED
package/dmart.service.ts
CHANGED
|
@@ -29,10 +29,19 @@ import {
|
|
|
29
29
|
export class Dmart {
|
|
30
30
|
static axiosDmartInstance: AxiosInstance;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Sets the Axios instance to be used for all HTTP requests
|
|
34
|
+
* @param axiosInstance - The Axios instance to use for API calls
|
|
35
|
+
*/
|
|
32
36
|
static setAxiosInstance(axiosInstance: AxiosInstance) {
|
|
33
37
|
Dmart.axiosDmartInstance = axiosInstance;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Gets the current Axios instance
|
|
42
|
+
* @returns The configured Axios instance
|
|
43
|
+
* @throws Error if no Axios instance has been set
|
|
44
|
+
*/
|
|
36
45
|
public static getAxiosInstance(): AxiosInstance {
|
|
37
46
|
if (!Dmart.axiosDmartInstance) {
|
|
38
47
|
throw new Error("Axios instance is not set. Please set it using setAxiosInstance method.");
|
|
@@ -40,30 +49,60 @@ export class Dmart {
|
|
|
40
49
|
return Dmart.axiosDmartInstance;
|
|
41
50
|
}
|
|
42
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Gets the current headers object used for API requests
|
|
54
|
+
* @returns The headers object containing request headers
|
|
55
|
+
*/
|
|
43
56
|
public static getHeaders() {
|
|
44
57
|
return headers;
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Updates the headers object with new headers
|
|
62
|
+
* @param newHeaders - Object containing headers to merge with existing headers
|
|
63
|
+
*/
|
|
47
64
|
public static setHeaders(newHeaders: any) {
|
|
48
65
|
Object.assign(headers, newHeaders);
|
|
49
66
|
}
|
|
50
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Gets the base URL from the Axios instance
|
|
70
|
+
* @returns The base URL string
|
|
71
|
+
*/
|
|
51
72
|
public static getBaseURL() {
|
|
52
73
|
return Dmart.axiosDmartInstance.defaults.baseURL;
|
|
53
74
|
}
|
|
54
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Sets the base URL for the Axios instance
|
|
78
|
+
* @param url - The base URL to set
|
|
79
|
+
*/
|
|
55
80
|
public static set setBaseURL(url: string) {
|
|
56
81
|
Dmart.axiosDmartInstance.defaults.baseURL = url;
|
|
57
82
|
}
|
|
58
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Gets the current authentication token
|
|
86
|
+
* @returns The token string without the "Bearer " prefix, or null if not set
|
|
87
|
+
*/
|
|
59
88
|
public static getToken() {
|
|
60
89
|
return headers["Authorization"] ? headers["Authorization"].replace("Bearer ", "") : null;
|
|
61
90
|
}
|
|
62
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Sets the authentication token in the headers
|
|
94
|
+
* @param token - The JWT token to use for authentication
|
|
95
|
+
*/
|
|
63
96
|
public static setToken(token: string) {
|
|
64
97
|
headers["Authorization"] = `Bearer ${token}`;
|
|
65
98
|
}
|
|
66
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Authenticates a user with shortname and password
|
|
102
|
+
* @param shortname - The user's shortname (username)
|
|
103
|
+
* @param password - The user's password
|
|
104
|
+
* @returns Promise resolving to LoginResponse containing authentication data and access token
|
|
105
|
+
*/
|
|
67
106
|
public static async login(shortname: string, password: string) {
|
|
68
107
|
const response = await Dmart.axiosDmartInstance.post<LoginResponse>(
|
|
69
108
|
`user/login`,
|
|
@@ -78,6 +117,13 @@ export class Dmart {
|
|
|
78
117
|
return data;
|
|
79
118
|
}
|
|
80
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Authenticates a user with custom credentials and password
|
|
122
|
+
* @param credentials - Object containing login credentials (e.g., email, phone, etc.)
|
|
123
|
+
* @param password - The user's password
|
|
124
|
+
* @returns Promise resolving to LoginResponse containing authentication data and access token
|
|
125
|
+
* @throws Error if login request fails
|
|
126
|
+
*/
|
|
81
127
|
public static async loginBy(credentials: any, password: string) {
|
|
82
128
|
try {
|
|
83
129
|
const response = await Dmart.axiosDmartInstance.post<LoginResponse>(
|
|
@@ -96,6 +142,11 @@ export class Dmart {
|
|
|
96
142
|
}
|
|
97
143
|
}
|
|
98
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Logs out the current user session
|
|
147
|
+
* @returns Promise resolving to ApiResponse indicating logout status
|
|
148
|
+
* @throws Error if logout request fails
|
|
149
|
+
*/
|
|
99
150
|
public static async logout() {
|
|
100
151
|
try {
|
|
101
152
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
@@ -109,6 +160,12 @@ export class Dmart {
|
|
|
109
160
|
}
|
|
110
161
|
}
|
|
111
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Creates a new user account
|
|
165
|
+
* @param request - ActionRequestRecord containing user creation data
|
|
166
|
+
* @returns Promise resolving to ActionResponse with creation result
|
|
167
|
+
* @throws Error if user creation fails
|
|
168
|
+
*/
|
|
112
169
|
public static async createUser(request: ActionRequestRecord) {
|
|
113
170
|
try {
|
|
114
171
|
const {data} = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
@@ -122,6 +179,12 @@ export class Dmart {
|
|
|
122
179
|
}
|
|
123
180
|
}
|
|
124
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Updates an existing user's profile information
|
|
184
|
+
* @param request - ActionRequestRecord containing user update data
|
|
185
|
+
* @returns Promise resolving to ActionResponse with update result
|
|
186
|
+
* @throws Error if user update fails
|
|
187
|
+
*/
|
|
125
188
|
public static async updateUser(request: ActionRequestRecord) {
|
|
126
189
|
try {
|
|
127
190
|
const {data} = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
@@ -135,6 +198,13 @@ export class Dmart {
|
|
|
135
198
|
}
|
|
136
199
|
}
|
|
137
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Checks if a user property value already exists in the system
|
|
203
|
+
* @param prop - The property name to check (e.g., 'email', 'shortname')
|
|
204
|
+
* @param value - The value to check for existence
|
|
205
|
+
* @returns Promise resolving to ResponseEntry indicating if the value exists
|
|
206
|
+
* @throws Error if check request fails
|
|
207
|
+
*/
|
|
138
208
|
public static async checkExisting(prop: string, value: string) {
|
|
139
209
|
try {
|
|
140
210
|
const {data} = await Dmart.axiosDmartInstance.get<ResponseEntry>(
|
|
@@ -147,6 +217,11 @@ export class Dmart {
|
|
|
147
217
|
}
|
|
148
218
|
}
|
|
149
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Retrieves the current user's profile information
|
|
222
|
+
* @returns Promise resolving to ProfileResponse containing user profile data, permissions, and roles
|
|
223
|
+
* @throws Error if profile retrieval fails
|
|
224
|
+
*/
|
|
150
225
|
public static async getProfile() {
|
|
151
226
|
try {
|
|
152
227
|
const {data} = await Dmart.axiosDmartInstance.get<ProfileResponse>(`user/profile`, {
|
|
@@ -168,6 +243,13 @@ export class Dmart {
|
|
|
168
243
|
}
|
|
169
244
|
}
|
|
170
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Executes a query against the Dmart API to retrieve data
|
|
248
|
+
* @param query - QueryRequest object containing query parameters, filters, and sorting options
|
|
249
|
+
* @param scope - The scope for the query (default: DmartScope.managed)
|
|
250
|
+
* @returns Promise resolving to ApiQueryResponse with query results or null
|
|
251
|
+
* @throws Error if query execution fails
|
|
252
|
+
*/
|
|
171
253
|
public static async query(
|
|
172
254
|
query: QueryRequest,
|
|
173
255
|
scope: string = DmartScope.managed
|
|
@@ -189,6 +271,12 @@ export class Dmart {
|
|
|
189
271
|
}
|
|
190
272
|
}
|
|
191
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Exports query results as CSV format
|
|
276
|
+
* @param query - Query object with parameters for CSV export
|
|
277
|
+
* @returns Promise resolving to ApiQueryResponse containing CSV data
|
|
278
|
+
* @throws Error if CSV generation fails
|
|
279
|
+
*/
|
|
192
280
|
public static async csv(query: any): Promise<ApiQueryResponse> {
|
|
193
281
|
try {
|
|
194
282
|
query.sort_type = query.sort_type || SortyType.ascending;
|
|
@@ -205,12 +293,17 @@ export class Dmart {
|
|
|
205
293
|
}
|
|
206
294
|
}
|
|
207
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Creates resources from an uploaded CSV file
|
|
298
|
+
* @param request - ResourcesFromCSVRequest containing file data and resource configuration
|
|
299
|
+
* @returns Promise resolving to ApiResponse with creation results, or error object if failed
|
|
300
|
+
*/
|
|
208
301
|
public static async resourcesFromCsv(
|
|
209
302
|
request: ResourcesFromCSVRequest
|
|
210
303
|
) {
|
|
211
304
|
try {
|
|
212
305
|
let csvUrl = `/managed/resources_from_csv/${request.resourceType}/${request.space_name}/${request.subpath}`;
|
|
213
|
-
|
|
306
|
+
const params: any = {};
|
|
214
307
|
if (request.schema) {
|
|
215
308
|
csvUrl += `/${request.schema}`;
|
|
216
309
|
}
|
|
@@ -218,12 +311,16 @@ export class Dmart {
|
|
|
218
311
|
let formdata = new FormData();
|
|
219
312
|
formdata.append("resources_file", request.payload);
|
|
220
313
|
|
|
314
|
+
if(request.isUpdate){
|
|
315
|
+
params['is_update'] = request.isUpdate;
|
|
316
|
+
}
|
|
317
|
+
|
|
221
318
|
const headers = {"Content-Type": "multipart/form-data"};
|
|
222
319
|
|
|
223
320
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
224
321
|
csvUrl,
|
|
225
322
|
formdata,
|
|
226
|
-
{headers}
|
|
323
|
+
{headers, params}
|
|
227
324
|
);
|
|
228
325
|
|
|
229
326
|
return data;
|
|
@@ -232,7 +329,12 @@ export class Dmart {
|
|
|
232
329
|
}
|
|
233
330
|
}
|
|
234
331
|
|
|
235
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Performs space-level operations (create, update, delete spaces)
|
|
334
|
+
* @param action - ActionRequest containing the operation details for space management
|
|
335
|
+
* @returns Promise resolving to ActionResponse with operation result
|
|
336
|
+
* @throws Error if space operation fails
|
|
337
|
+
*/
|
|
236
338
|
public static async space(action: ActionRequest): Promise<ActionResponse> {
|
|
237
339
|
try {
|
|
238
340
|
const {data} = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
@@ -246,6 +348,11 @@ export class Dmart {
|
|
|
246
348
|
}
|
|
247
349
|
}
|
|
248
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Executes a general request action against the Dmart API
|
|
353
|
+
* @param action - ActionRequest containing the request details and parameters
|
|
354
|
+
* @returns Promise resolving to ActionResponse with request result
|
|
355
|
+
*/
|
|
249
356
|
public static async request(action: ActionRequest): Promise<ActionResponse> {
|
|
250
357
|
const res = await Dmart.axiosDmartInstance.post<ActionResponse>(`managed/request`, action, {
|
|
251
358
|
headers,
|
|
@@ -253,6 +360,13 @@ export class Dmart {
|
|
|
253
360
|
return res?.data;
|
|
254
361
|
}
|
|
255
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Retrieves a specific entry from the Dmart system
|
|
365
|
+
* @param request - RetrieveEntryRequest containing entry identification and retrieval options
|
|
366
|
+
* @param scope - The scope for the retrieval (default: DmartScope.managed)
|
|
367
|
+
* @returns Promise resolving to ResponseEntry with entry data or null if not found
|
|
368
|
+
* @throws Error if entry retrieval fails
|
|
369
|
+
*/
|
|
256
370
|
public static async retrieveEntry(
|
|
257
371
|
request: RetrieveEntryRequest,
|
|
258
372
|
scope: string = DmartScope.managed
|
|
@@ -274,6 +388,13 @@ export class Dmart {
|
|
|
274
388
|
}
|
|
275
389
|
|
|
276
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Uploads a resource with an attached payload file
|
|
393
|
+
* @param request - UploadWithPayloadRequest containing resource data and payload file
|
|
394
|
+
* @param scope - The scope for the upload operation (default: DmartScope.managed)
|
|
395
|
+
* @returns Promise resolving to ApiResponse with upload result
|
|
396
|
+
* @throws Error if upload fails
|
|
397
|
+
*/
|
|
277
398
|
public static async uploadWithPayload(
|
|
278
399
|
request: UploadWithPayloadRequest,
|
|
279
400
|
scope: string = DmartScope.managed
|
|
@@ -317,6 +438,12 @@ export class Dmart {
|
|
|
317
438
|
}
|
|
318
439
|
}
|
|
319
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Fetches data assets from the Dmart system with optional SQL query filtering
|
|
443
|
+
* @param request - FetchDataAssetRequest containing asset identification and query parameters
|
|
444
|
+
* @returns Promise resolving to data asset response
|
|
445
|
+
* @throws Error if data asset fetch fails
|
|
446
|
+
*/
|
|
320
447
|
public static async fetchDataAsset(
|
|
321
448
|
request: FetchDataAssetRequest,
|
|
322
449
|
) {
|
|
@@ -340,6 +467,10 @@ export class Dmart {
|
|
|
340
467
|
}
|
|
341
468
|
}
|
|
342
469
|
|
|
470
|
+
/**
|
|
471
|
+
* Retrieves a list of all available spaces in the system
|
|
472
|
+
* @returns Promise resolving to ApiResponse containing spaces data or null
|
|
473
|
+
*/
|
|
343
474
|
public static async getSpaces(): Promise<ApiResponse | null> {
|
|
344
475
|
return await this.query({
|
|
345
476
|
type: QueryType.spaces,
|
|
@@ -350,6 +481,11 @@ export class Dmart {
|
|
|
350
481
|
});
|
|
351
482
|
}
|
|
352
483
|
|
|
484
|
+
/**
|
|
485
|
+
* Gets child resources within a specified space and subpath
|
|
486
|
+
* @param request - GetChildrenRequest containing search parameters and filters
|
|
487
|
+
* @returns Promise resolving to ApiResponse with child resources or null
|
|
488
|
+
*/
|
|
353
489
|
public static async getChildren(
|
|
354
490
|
request: GetChildrenRequest
|
|
355
491
|
): Promise<ApiResponse | null> {
|
|
@@ -374,6 +510,12 @@ export class Dmart {
|
|
|
374
510
|
});
|
|
375
511
|
}
|
|
376
512
|
|
|
513
|
+
/**
|
|
514
|
+
* Generates a URL for accessing attachment resources
|
|
515
|
+
* @param request - GetAttachmentURLRequest containing attachment identification parameters
|
|
516
|
+
* @param scope - The scope for the attachment URL (default: DmartScope.managed)
|
|
517
|
+
* @returns String URL for accessing the attachment
|
|
518
|
+
*/
|
|
377
519
|
public static getAttachmentUrl(
|
|
378
520
|
request: GetAttachmentURLRequest,
|
|
379
521
|
scope: string = DmartScope.managed
|
|
@@ -384,6 +526,12 @@ export class Dmart {
|
|
|
384
526
|
)}/${request.parent_shortname}/${request.shortname}${request.ext === null ? "" : `.${request.ext}`}`;
|
|
385
527
|
}
|
|
386
528
|
|
|
529
|
+
/**
|
|
530
|
+
* Retrieves health information and statistics for a specific space
|
|
531
|
+
* @param space_name - The name of the space to check health for
|
|
532
|
+
* @returns Promise resolving to ApiQueryResponse with health data and folders report
|
|
533
|
+
* @throws Error if health check fails
|
|
534
|
+
*/
|
|
387
535
|
public static async getSpaceHealth(space_name: string) {
|
|
388
536
|
try {
|
|
389
537
|
const {data} = await Dmart.axiosDmartInstance.get<
|
|
@@ -395,6 +543,13 @@ export class Dmart {
|
|
|
395
543
|
}
|
|
396
544
|
}
|
|
397
545
|
|
|
546
|
+
/**
|
|
547
|
+
* Retrieves payload data for a specific resource
|
|
548
|
+
* @param request - GetPayloadRequest containing payload identification parameters
|
|
549
|
+
* @param scope - The scope for the payload retrieval (default: DmartScope.managed)
|
|
550
|
+
* @returns Promise resolving to payload data
|
|
551
|
+
* @throws Error if payload retrieval fails
|
|
552
|
+
*/
|
|
398
553
|
public static async getPayload(
|
|
399
554
|
request: GetPayloadRequest,
|
|
400
555
|
scope: string = DmartScope.managed
|
|
@@ -416,6 +571,12 @@ export class Dmart {
|
|
|
416
571
|
}
|
|
417
572
|
}
|
|
418
573
|
|
|
574
|
+
/**
|
|
575
|
+
* Updates the progress of a ticket with resolution and comments
|
|
576
|
+
* @param request - ProgressTicketRequest containing ticket identification and update data
|
|
577
|
+
* @returns Promise resolving to ApiQueryResponse with progress update result
|
|
578
|
+
* @throws Error if ticket progress update fails
|
|
579
|
+
*/
|
|
419
580
|
public static async progressTicket(
|
|
420
581
|
request: ProgressTicketRequest
|
|
421
582
|
) {
|
|
@@ -440,6 +601,12 @@ export class Dmart {
|
|
|
440
601
|
}
|
|
441
602
|
}
|
|
442
603
|
|
|
604
|
+
/**
|
|
605
|
+
* Submits data to a public endpoint with optional workflow processing
|
|
606
|
+
* @param request - SubmitRequest containing submission data and routing information
|
|
607
|
+
* @returns Promise resolving to submission response data
|
|
608
|
+
* @throws Error if submission fails
|
|
609
|
+
*/
|
|
443
610
|
public static async submit(
|
|
444
611
|
request: SubmitRequest
|
|
445
612
|
) {
|
|
@@ -463,6 +630,11 @@ export class Dmart {
|
|
|
463
630
|
}
|
|
464
631
|
}
|
|
465
632
|
|
|
633
|
+
/**
|
|
634
|
+
* Retrieves the system manifest containing configuration and metadata
|
|
635
|
+
* @returns Promise resolving to manifest data
|
|
636
|
+
* @throws Error if manifest retrieval fails
|
|
637
|
+
*/
|
|
466
638
|
public static async getManifest() {
|
|
467
639
|
try {
|
|
468
640
|
const {data} = await Dmart.axiosDmartInstance.get<any>(`info/manifest`, {
|
|
@@ -474,6 +646,11 @@ export class Dmart {
|
|
|
474
646
|
}
|
|
475
647
|
}
|
|
476
648
|
|
|
649
|
+
/**
|
|
650
|
+
* Retrieves the system settings and configuration
|
|
651
|
+
* @returns Promise resolving to settings data
|
|
652
|
+
* @throws Error if settings retrieval fails
|
|
653
|
+
*/
|
|
477
654
|
public static async getSettings() {
|
|
478
655
|
try {
|
|
479
656
|
const {data} = await Dmart.axiosDmartInstance.get<any>(`info/settings`, {
|
|
@@ -485,6 +662,13 @@ export class Dmart {
|
|
|
485
662
|
}
|
|
486
663
|
}
|
|
487
664
|
|
|
665
|
+
/**
|
|
666
|
+
* Sends an OTP (One-Time Password) request to a user
|
|
667
|
+
* @param request - SendOTPRequest containing recipient information
|
|
668
|
+
* @param acceptLanguage - Optional language preference for the OTP message (default: null)
|
|
669
|
+
* @returns Promise resolving to ApiResponse with OTP request result
|
|
670
|
+
* @throws Error if OTP request fails
|
|
671
|
+
*/
|
|
488
672
|
public static async otpRequest(
|
|
489
673
|
request: SendOTPRequest,
|
|
490
674
|
acceptLanguage: string | null = null
|
|
@@ -506,6 +690,13 @@ export class Dmart {
|
|
|
506
690
|
}
|
|
507
691
|
}
|
|
508
692
|
|
|
693
|
+
/**
|
|
694
|
+
* Sends an OTP (One-Time Password) request for login purposes
|
|
695
|
+
* @param request - SendOTPRequest containing recipient information for login OTP
|
|
696
|
+
* @param acceptLanguage - Optional language preference for the OTP message (default: null)
|
|
697
|
+
* @returns Promise resolving to ApiResponse with OTP login request result
|
|
698
|
+
* @throws Error if OTP login request fails
|
|
699
|
+
*/
|
|
509
700
|
public static async otpRequestLogin(
|
|
510
701
|
request: SendOTPRequest,
|
|
511
702
|
acceptLanguage: string | null = null
|
|
@@ -527,6 +718,12 @@ export class Dmart {
|
|
|
527
718
|
}
|
|
528
719
|
}
|
|
529
720
|
|
|
721
|
+
/**
|
|
722
|
+
* Initiates a password reset request for a user
|
|
723
|
+
* @param request - PasswordResetRequest containing user identification for password reset
|
|
724
|
+
* @returns Promise resolving to ApiResponse with password reset request result
|
|
725
|
+
* @throws Error if password reset request fails
|
|
726
|
+
*/
|
|
530
727
|
public static async passwordResetRequest(request: PasswordResetRequest) {
|
|
531
728
|
try {
|
|
532
729
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
@@ -540,6 +737,12 @@ export class Dmart {
|
|
|
540
737
|
}
|
|
541
738
|
}
|
|
542
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Confirms an OTP (One-Time Password) code provided by the user
|
|
742
|
+
* @param request - ConfirmOTPRequest containing the OTP code and verification details
|
|
743
|
+
* @returns Promise resolving to ApiResponse with OTP confirmation result
|
|
744
|
+
* @throws Error if OTP confirmation fails
|
|
745
|
+
*/
|
|
543
746
|
public static async confirmOtp(request: ConfirmOTPRequest) {
|
|
544
747
|
try {
|
|
545
748
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
@@ -553,6 +756,12 @@ export class Dmart {
|
|
|
553
756
|
}
|
|
554
757
|
}
|
|
555
758
|
|
|
759
|
+
/**
|
|
760
|
+
* Resets a user's account or session state
|
|
761
|
+
* @param shortname - The shortname (username) of the user to reset
|
|
762
|
+
* @returns Promise resolving to ApiResponse with user reset result
|
|
763
|
+
* @throws Error if user reset fails
|
|
764
|
+
*/
|
|
556
765
|
public static async userReset(shortname: string) {
|
|
557
766
|
try {
|
|
558
767
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
@@ -566,6 +775,12 @@ export class Dmart {
|
|
|
566
775
|
}
|
|
567
776
|
}
|
|
568
777
|
|
|
778
|
+
/**
|
|
779
|
+
* Validates a password against system password policies and requirements
|
|
780
|
+
* @param password - The password string to validate
|
|
781
|
+
* @returns Promise resolving to ApiResponse with validation result
|
|
782
|
+
* @throws Error if password validation fails
|
|
783
|
+
*/
|
|
569
784
|
public static async validatePassword(password: string) {
|
|
570
785
|
try {
|
|
571
786
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|