@edraj/tsdmart 4.1.1 → 5.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.
- package/dmart.model.ts +1 -0
- package/dmart.service.ts +38 -38
- package/package.json +1 -1
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/tsdmart.iml +0 -14
- package/.idea/vcs.xml +0 -6
package/dmart.model.ts
CHANGED
package/dmart.service.ts
CHANGED
|
@@ -105,14 +105,13 @@ export class Dmart {
|
|
|
105
105
|
*/
|
|
106
106
|
public static async login(shortname: string, password: string) {
|
|
107
107
|
const response = await Dmart.axiosDmartInstance.post<LoginResponse>(
|
|
108
|
-
|
|
108
|
+
'user/login',
|
|
109
109
|
{shortname, password},
|
|
110
110
|
{headers}
|
|
111
111
|
);
|
|
112
112
|
const data: LoginResponse = response.data;
|
|
113
113
|
if (data.status == Status.success && data.records.length > 0) {
|
|
114
|
-
headers["Authorization"] =
|
|
115
|
-
"Bearer " + data.records[0]?.attributes.access_token;
|
|
114
|
+
headers["Authorization"] = "Bearer " + data.records[0]?.attributes.access_token;
|
|
116
115
|
}
|
|
117
116
|
return data;
|
|
118
117
|
}
|
|
@@ -127,7 +126,7 @@ export class Dmart {
|
|
|
127
126
|
public static async loginBy(credentials: any, password: string) {
|
|
128
127
|
try {
|
|
129
128
|
const response = await Dmart.axiosDmartInstance.post<LoginResponse>(
|
|
130
|
-
|
|
129
|
+
'user/login',
|
|
131
130
|
{...credentials, password},
|
|
132
131
|
{headers}
|
|
133
132
|
);
|
|
@@ -150,7 +149,7 @@ export class Dmart {
|
|
|
150
149
|
public static async logout() {
|
|
151
150
|
try {
|
|
152
151
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
153
|
-
|
|
152
|
+
'user/logout',
|
|
154
153
|
{},
|
|
155
154
|
{headers}
|
|
156
155
|
);
|
|
@@ -169,7 +168,7 @@ export class Dmart {
|
|
|
169
168
|
public static async createUser(request: ActionRequestRecord) {
|
|
170
169
|
try {
|
|
171
170
|
const {data} = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
172
|
-
|
|
171
|
+
'user/create',
|
|
173
172
|
request,
|
|
174
173
|
{headers}
|
|
175
174
|
);
|
|
@@ -188,7 +187,7 @@ export class Dmart {
|
|
|
188
187
|
public static async updateUser(request: ActionRequestRecord) {
|
|
189
188
|
try {
|
|
190
189
|
const {data} = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
191
|
-
|
|
190
|
+
'user/profile',
|
|
192
191
|
request,
|
|
193
192
|
{headers}
|
|
194
193
|
);
|
|
@@ -224,7 +223,7 @@ export class Dmart {
|
|
|
224
223
|
*/
|
|
225
224
|
public static async getProfile() {
|
|
226
225
|
try {
|
|
227
|
-
const {data} = await Dmart.axiosDmartInstance.get<ProfileResponse>(
|
|
226
|
+
const {data} = await Dmart.axiosDmartInstance.get<ProfileResponse>('user/profile', {
|
|
228
227
|
headers,
|
|
229
228
|
});
|
|
230
229
|
if (typeof localStorage !== "undefined" && data.status === "success") {
|
|
@@ -283,7 +282,7 @@ export class Dmart {
|
|
|
283
282
|
query.sort_by = "created_at";
|
|
284
283
|
query.subpath = query.subpath.replace(/\/+/g, "/");
|
|
285
284
|
const {data} = await Dmart.axiosDmartInstance.post<ApiQueryResponse>(
|
|
286
|
-
|
|
285
|
+
'managed/csv',
|
|
287
286
|
query,
|
|
288
287
|
{headers}
|
|
289
288
|
);
|
|
@@ -329,24 +328,24 @@ export class Dmart {
|
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
330
|
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
public static async space(action: ActionRequest): Promise<ActionResponse> {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
331
|
+
// /** LEGACY, DEPRECATED CODE, DO NOT USE
|
|
332
|
+
// * Performs space-level operations (create, update, delete spaces)
|
|
333
|
+
// * @param action - ActionRequest containing the operation details for space management
|
|
334
|
+
// * @returns Promise resolving to ActionResponse with operation result
|
|
335
|
+
// * @throws Error if space operation fails
|
|
336
|
+
// */
|
|
337
|
+
// public static async space(action: ActionRequest): Promise<ActionResponse> {
|
|
338
|
+
// try {
|
|
339
|
+
// const {data} = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
340
|
+
// 'managed/space',
|
|
341
|
+
// action,
|
|
342
|
+
// {headers}
|
|
343
|
+
// );
|
|
344
|
+
// return data;
|
|
345
|
+
// } catch (error: any) {
|
|
346
|
+
// throw error;
|
|
347
|
+
// }
|
|
348
|
+
// }
|
|
350
349
|
|
|
351
350
|
/**
|
|
352
351
|
* Executes a general request action against the Dmart API
|
|
@@ -354,7 +353,7 @@ export class Dmart {
|
|
|
354
353
|
* @returns Promise resolving to ActionResponse with request result
|
|
355
354
|
*/
|
|
356
355
|
public static async request(action: ActionRequest): Promise<ActionResponse> {
|
|
357
|
-
const res = await Dmart.axiosDmartInstance.post<ActionResponse>(
|
|
356
|
+
const res = await Dmart.axiosDmartInstance.post<ActionResponse>('managed/request', action, {
|
|
358
357
|
headers,
|
|
359
358
|
});
|
|
360
359
|
return res?.data;
|
|
@@ -520,10 +519,11 @@ export class Dmart {
|
|
|
520
519
|
request: GetAttachmentURLRequest,
|
|
521
520
|
scope: string = DmartScope.managed
|
|
522
521
|
) {
|
|
523
|
-
|
|
522
|
+
const subpath = request.subpath.replace(
|
|
524
523
|
/\/+$/,
|
|
525
524
|
""
|
|
526
|
-
)
|
|
525
|
+
);
|
|
526
|
+
return `${Dmart.axiosDmartInstance.defaults.baseURL}/${scope}/payload/${request.resource_type}/${request.space_name}/${subpath}/${request.parent_shortname}/${request.shortname}${request.ext === null ? "" : `.${request.ext}`}`.replaceAll('//', '/');
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
/**
|
|
@@ -637,7 +637,7 @@ export class Dmart {
|
|
|
637
637
|
*/
|
|
638
638
|
public static async getManifest() {
|
|
639
639
|
try {
|
|
640
|
-
const {data} = await Dmart.axiosDmartInstance.get<any>(
|
|
640
|
+
const {data} = await Dmart.axiosDmartInstance.get<any>('info/manifest', {
|
|
641
641
|
headers,
|
|
642
642
|
});
|
|
643
643
|
return data;
|
|
@@ -653,7 +653,7 @@ export class Dmart {
|
|
|
653
653
|
*/
|
|
654
654
|
public static async getSettings() {
|
|
655
655
|
try {
|
|
656
|
-
const {data} = await Dmart.axiosDmartInstance.get<any>(
|
|
656
|
+
const {data} = await Dmart.axiosDmartInstance.get<any>('info/settings', {
|
|
657
657
|
headers,
|
|
658
658
|
});
|
|
659
659
|
return data;
|
|
@@ -680,7 +680,7 @@ export class Dmart {
|
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
683
|
-
|
|
683
|
+
'user/otp-request',
|
|
684
684
|
request,
|
|
685
685
|
{headers: requestHeaders}
|
|
686
686
|
);
|
|
@@ -708,7 +708,7 @@ export class Dmart {
|
|
|
708
708
|
}
|
|
709
709
|
|
|
710
710
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
711
|
-
|
|
711
|
+
'user/otp-request-login',
|
|
712
712
|
request,
|
|
713
713
|
{headers: requestHeaders}
|
|
714
714
|
);
|
|
@@ -727,7 +727,7 @@ export class Dmart {
|
|
|
727
727
|
public static async passwordResetRequest(request: PasswordResetRequest) {
|
|
728
728
|
try {
|
|
729
729
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
730
|
-
|
|
730
|
+
'user/password-reset-request',
|
|
731
731
|
request,
|
|
732
732
|
{headers}
|
|
733
733
|
);
|
|
@@ -746,7 +746,7 @@ export class Dmart {
|
|
|
746
746
|
public static async confirmOtp(request: ConfirmOTPRequest) {
|
|
747
747
|
try {
|
|
748
748
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
749
|
-
|
|
749
|
+
'user/otp-confirm',
|
|
750
750
|
request,
|
|
751
751
|
{headers}
|
|
752
752
|
);
|
|
@@ -765,7 +765,7 @@ export class Dmart {
|
|
|
765
765
|
public static async userReset(shortname: string) {
|
|
766
766
|
try {
|
|
767
767
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
768
|
-
|
|
768
|
+
'user/reset',
|
|
769
769
|
{shortname},
|
|
770
770
|
{headers}
|
|
771
771
|
);
|
|
@@ -784,7 +784,7 @@ export class Dmart {
|
|
|
784
784
|
public static async validatePassword(password: string) {
|
|
785
785
|
try {
|
|
786
786
|
const {data} = await Dmart.axiosDmartInstance.post<ApiResponse>(
|
|
787
|
-
|
|
787
|
+
'user/validate_password',
|
|
788
788
|
{password},
|
|
789
789
|
{headers}
|
|
790
790
|
);
|
package/package.json
CHANGED
package/.idea/modules.xml
DELETED
package/.idea/tsdmart.iml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
<excludeFolder url="file://$MODULE_DIR$/b" />
|
|
9
|
-
<excludeFolder url="file://$MODULE_DIR$/.idea/copilot/chatSessions" />
|
|
10
|
-
</content>
|
|
11
|
-
<orderEntry type="inheritedJdk" />
|
|
12
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
13
|
-
</component>
|
|
14
|
-
</module>
|