@edraj/tsdmart 1.0.11 → 1.0.13
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/index.ts +16 -18
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -329,20 +329,20 @@ export default class Dmart {
|
|
|
329
329
|
public static async login(shortname: string, password: string) {
|
|
330
330
|
const {data} = await axios.post<
|
|
331
331
|
ApiResponse & { records: Array<LoginResponseRecord> }
|
|
332
|
-
>(this.baseURL
|
|
332
|
+
>(`${this.baseURL}/user/login`, {shortname, password}, {headers});
|
|
333
333
|
return data;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
public static async loginBy(credentials: any, password: string) {
|
|
337
337
|
const {data} = await axios.post<
|
|
338
338
|
ApiResponse & { records: Array<LoginResponseRecord> }
|
|
339
|
-
>(this.baseURL
|
|
339
|
+
>(`${this.baseURL}/user/login`, {...credentials, password}, {headers});
|
|
340
340
|
return data;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
public static async logout() {
|
|
344
344
|
const {data} = await axios.post<ApiResponse>(
|
|
345
|
-
this.baseURL
|
|
345
|
+
`${this.baseURL}/user/logout`,
|
|
346
346
|
{},
|
|
347
347
|
{headers}
|
|
348
348
|
);
|
|
@@ -352,7 +352,7 @@ export default class Dmart {
|
|
|
352
352
|
public static async create_user(request: any) {
|
|
353
353
|
try {
|
|
354
354
|
const {data} = await axios.post<ActionResponse>(
|
|
355
|
-
this.baseURL
|
|
355
|
+
`${this.baseURL}/user/create`,
|
|
356
356
|
request,
|
|
357
357
|
{headers}
|
|
358
358
|
);
|
|
@@ -365,7 +365,7 @@ export default class Dmart {
|
|
|
365
365
|
public static async update_user(request: any) {
|
|
366
366
|
try {
|
|
367
367
|
const {data} = await axios.post<ActionResponse>(
|
|
368
|
-
this.baseURL
|
|
368
|
+
`${this.baseURL}/user/profile`,
|
|
369
369
|
request,
|
|
370
370
|
{headers}
|
|
371
371
|
);
|
|
@@ -390,7 +390,7 @@ export default class Dmart {
|
|
|
390
390
|
public static async get_profile() {
|
|
391
391
|
try {
|
|
392
392
|
const {data} = await axios.get<ProfileResponse>(
|
|
393
|
-
this.baseURL
|
|
393
|
+
`${this.baseURL}/user/profile`,
|
|
394
394
|
{
|
|
395
395
|
headers,
|
|
396
396
|
}
|
|
@@ -419,7 +419,7 @@ export default class Dmart {
|
|
|
419
419
|
}
|
|
420
420
|
query.subpath = query.subpath.replace(/\/+/g, "/");
|
|
421
421
|
const {data} = await axios.post<ApiQueryResponse>(
|
|
422
|
-
this.baseURL
|
|
422
|
+
`${this.baseURL}/${scope}/query`,
|
|
423
423
|
query,
|
|
424
424
|
{headers, timeout: 3000}
|
|
425
425
|
);
|
|
@@ -435,7 +435,7 @@ export default class Dmart {
|
|
|
435
435
|
query.sort_by = "created_at";
|
|
436
436
|
query.subpath = query.subpath.replace(/\/+/g, "/");
|
|
437
437
|
const {data} = await axios.post<ApiQueryResponse>(
|
|
438
|
-
this.baseURL
|
|
438
|
+
`${this.baseURL}/managed/csv`,
|
|
439
439
|
query,
|
|
440
440
|
{headers}
|
|
441
441
|
);
|
|
@@ -448,7 +448,7 @@ export default class Dmart {
|
|
|
448
448
|
public static async space(action: ActionRequest): Promise<ActionResponse> {
|
|
449
449
|
try {
|
|
450
450
|
const {data} = await axios.post<ActionResponse>(
|
|
451
|
-
this.baseURL
|
|
451
|
+
`${this.baseURL}/managed/space`,
|
|
452
452
|
action,
|
|
453
453
|
{headers}
|
|
454
454
|
);
|
|
@@ -461,7 +461,7 @@ export default class Dmart {
|
|
|
461
461
|
public static async request(action: ActionRequest): Promise<ActionResponse> {
|
|
462
462
|
try {
|
|
463
463
|
const {data} = await axios.post<ActionResponse>(
|
|
464
|
-
this.baseURL
|
|
464
|
+
`${this.baseURL}/managed/request`,
|
|
465
465
|
action,
|
|
466
466
|
{headers}
|
|
467
467
|
);
|
|
@@ -483,11 +483,9 @@ export default class Dmart {
|
|
|
483
483
|
): Promise<ResponseEntry | null> {
|
|
484
484
|
try {
|
|
485
485
|
if (!subpath || subpath == "/") subpath = "__root__";
|
|
486
|
+
const url = `${scope}/entry/${resource_type}/${space_name}/${subpath}/${shortname}?retrieve_json_payload=${retrieve_json_payload}&retrieve_attachments=${retrieve_attachments}&validate_schema=${validate_schema}`;
|
|
486
487
|
const {data} = await axios.get<ResponseEntry>(
|
|
487
|
-
`${this.baseURL}/${
|
|
488
|
-
/\/+/g,
|
|
489
|
-
"/"
|
|
490
|
-
),
|
|
488
|
+
`${this.baseURL}/${url.replace(/\/+/g, "/")}`,
|
|
491
489
|
{headers}
|
|
492
490
|
);
|
|
493
491
|
return data;
|
|
@@ -533,7 +531,7 @@ export default class Dmart {
|
|
|
533
531
|
const headers = {"Content-Type": "multipart/form-data"};
|
|
534
532
|
|
|
535
533
|
const {data} = await axios.post<ApiResponse>(
|
|
536
|
-
this.baseURL
|
|
534
|
+
`${this.baseURL}/managed/resource_with_payload`,
|
|
537
535
|
form_data,
|
|
538
536
|
{headers}
|
|
539
537
|
);
|
|
@@ -623,7 +621,7 @@ export default class Dmart {
|
|
|
623
621
|
public static async get_space_health(space_name: string) {
|
|
624
622
|
const {data} = await axios.get<
|
|
625
623
|
ApiQueryResponse & { attributes: { folders_report: Object } }
|
|
626
|
-
>(this.baseURL
|
|
624
|
+
>(`${this.baseURL}/managed/health/${space_name}`, {headers});
|
|
627
625
|
return data;
|
|
628
626
|
}
|
|
629
627
|
|
|
@@ -719,14 +717,14 @@ export default class Dmart {
|
|
|
719
717
|
}
|
|
720
718
|
|
|
721
719
|
public static async get_manifest() {
|
|
722
|
-
const {data} = await axios.get<any>(this.baseURL
|
|
720
|
+
const {data} = await axios.get<any>(`${this.baseURL}/info/manifest`, {
|
|
723
721
|
headers,
|
|
724
722
|
});
|
|
725
723
|
return data;
|
|
726
724
|
}
|
|
727
725
|
|
|
728
726
|
public static async get_settings() {
|
|
729
|
-
const {data} = await axios.get<any>(this.baseURL
|
|
727
|
+
const {data} = await axios.get<any>(`${this.baseURL}/info/settings`, {
|
|
730
728
|
headers,
|
|
731
729
|
});
|
|
732
730
|
return data;
|