jd_platform_sdk 0.0.7 → 0.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/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -24
- package/dist/sdk/configs/jdConfig.js +5 -1
- package/dist/sdk/jdConnector.js +63 -72
- package/dist/sdk/jdSdk.js +5 -1
- package/dist/sdk/models/jdApplication.d.ts +10 -4
- package/dist/sdk/models/jdApplication.d.ts.map +1 -1
- package/dist/sdk/models/jdApplication.js +76 -50
- package/dist/sdk/models/jdResource.d.ts +44 -1
- package/dist/sdk/models/jdResource.d.ts.map +1 -1
- package/dist/sdk/models/jdResource.js +131 -103
- package/dist/sdk/models/modules/dashboard/jdDashboardCombinations.d.ts +6 -0
- package/dist/sdk/models/modules/dashboard/jdDashboardCombinations.d.ts.map +1 -0
- package/dist/sdk/models/modules/dashboard/jdDashboardCombinations.js +37 -0
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts +8 -4
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdCity.js +61 -41
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts +8 -4
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdCountry.js +53 -33
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts +7 -3
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdDistrict.js +57 -35
- package/dist/sdk/models/modules/geolocation/jdState.d.ts +8 -4
- package/dist/sdk/models/modules/geolocation/jdState.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdState.js +61 -41
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts +13 -2
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts.map +1 -1
- package/dist/sdk/models/modules/karaoke/jdKtvShop.js +91 -62
- package/dist/sdk/models/modules/music/jdAlbum.d.ts +9 -51
- package/dist/sdk/models/modules/music/jdAlbum.d.ts.map +1 -1
- package/dist/sdk/models/modules/music/jdAlbum.js +102 -117
- package/dist/sdk/models/modules/music/jdArtist.d.ts +10 -49
- package/dist/sdk/models/modules/music/jdArtist.d.ts.map +1 -1
- package/dist/sdk/models/modules/music/jdArtist.js +90 -99
- package/dist/sdk/models/modules/music/jdComposer.d.ts +9 -49
- package/dist/sdk/models/modules/music/jdComposer.d.ts.map +1 -1
- package/dist/sdk/models/modules/music/jdComposer.js +87 -99
- package/dist/sdk/models/modules/music/jdMusicCombinations.js +31 -15
- package/dist/sdk/models/modules/music/jdSong.d.ts +11 -51
- package/dist/sdk/models/modules/music/jdSong.d.ts.map +1 -1
- package/dist/sdk/models/modules/music/jdSong.js +113 -131
- package/dist/sdk/models/modules/radio_station/jdRadioStation.d.ts +42 -0
- package/dist/sdk/models/modules/radio_station/jdRadioStation.d.ts.map +1 -0
- package/dist/sdk/models/modules/radio_station/jdRadioStation.js +106 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts +9 -21
- package/dist/sdk/models/modules/user/jdPermission.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdPermission.js +63 -58
- package/dist/sdk/models/modules/user/jdPermissionGroup.d.ts +19 -0
- package/dist/sdk/models/modules/user/jdPermissionGroup.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdPermissionGroup.js +72 -0
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts +15 -2
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdSessionUser.js +78 -50
- package/dist/sdk/models/modules/user/jdUser.d.ts +16 -4
- package/dist/sdk/models/modules/user/jdUser.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdUser.js +77 -56
- package/dist/sdk/models/modules/user/jdUserRole.d.ts +16 -0
- package/dist/sdk/models/modules/user/jdUserRole.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdUserRole.js +70 -0
- package/dist/sdk/utilities/browserUtils.js +24 -31
- package/dist/sdk/utilities/cryptoUtils.js +13 -6
- package/dist/sdk/utilities/dateUtils.js +5 -1
- package/dist/sdk/utilities/globalEventHandler.js +5 -4
- package/dist/sdk/utilities/stringUtils.js +6 -2
- package/dist/sdk/utilities/utils.js +22 -19
- package/package.json +3 -1
- package/readme.md +9 -0
|
@@ -1,73 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
9
24
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.JDPermission = void 0;
|
|
27
|
+
const jdResource_1 = __importStar(require("../../jdResource"));
|
|
28
|
+
const utils_1 = require("../../../utilities/utils");
|
|
29
|
+
class JDPermission extends jdResource_1.default {
|
|
30
|
+
name = "";
|
|
31
|
+
guardName = "";
|
|
32
|
+
descriptionPlain = "";
|
|
33
|
+
userPermissionGroupId = "";
|
|
34
|
+
userPermissionGroup = {};
|
|
35
|
+
roleIds = [];
|
|
36
|
+
constructor(data = {}, connectorInfo = new jdResource_1.ConnectorInfo("", "")) {
|
|
14
37
|
super(connectorInfo);
|
|
15
|
-
this.name = "";
|
|
16
|
-
this.guardName = "";
|
|
17
|
-
this.descriptionPlain = "";
|
|
18
|
-
this.userPermissionGroupId = "";
|
|
19
|
-
this.userPermissionGroup = {};
|
|
20
|
-
this.roleIds = [];
|
|
21
38
|
this.setData(data);
|
|
22
39
|
}
|
|
23
40
|
setData(data) {
|
|
24
41
|
super.setData(data);
|
|
25
|
-
this.name = Utils.getString(data, "name");
|
|
26
|
-
this.guardName = Utils.getString(data, "guard_name");
|
|
27
|
-
this.descriptionPlain = Utils.getString(data, "description");
|
|
28
|
-
this.userPermissionGroupId = Utils.getString(data, "user_permission_group_id");
|
|
29
|
-
this.userPermissionGroup = Utils.getObject(data, "user_permission_group");
|
|
30
|
-
this.roleIds = Utils.getArray(data, "role_ids");
|
|
31
|
-
}
|
|
32
|
-
getPermissionsCount() {
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
return yield this.getRelative('/modules/user/permissions/count', {});
|
|
35
|
-
});
|
|
42
|
+
this.name = utils_1.Utils.getString(data, "name");
|
|
43
|
+
this.guardName = utils_1.Utils.getString(data, "guard_name");
|
|
44
|
+
this.descriptionPlain = utils_1.Utils.getString(data, "description");
|
|
45
|
+
this.userPermissionGroupId = utils_1.Utils.getString(data, "user_permission_group_id");
|
|
46
|
+
this.userPermissionGroup = utils_1.Utils.getObject(data, "user_permission_group");
|
|
47
|
+
this.roleIds = utils_1.Utils.getArray(data, "role_ids");
|
|
36
48
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
49
|
+
async getContents(params = {}) {
|
|
50
|
+
const queryParams = this.getSortParameters(params);
|
|
51
|
+
return await this.getRelative(`/modules/user/permissions`, queryParams);
|
|
41
52
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return yield this.getRelative('/modules/user/permissions', params);
|
|
50
|
-
});
|
|
53
|
+
async paginateContents(params = {}) {
|
|
54
|
+
const queryParams = this.getSortParameters(params);
|
|
55
|
+
if (params.name)
|
|
56
|
+
queryParams['name'] = params.name;
|
|
57
|
+
if (params.guard_name)
|
|
58
|
+
queryParams['guard_name'] = params.guard_name;
|
|
59
|
+
return await this.getRelative('/modules/user/permissions/paginate', queryParams);
|
|
51
60
|
}
|
|
52
61
|
// Find the permission with text search index which is a fast way to search the whole word
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
async findContents(params = {}) {
|
|
63
|
+
const queryParams = this.getSortParameters(params);
|
|
64
|
+
if (params.name)
|
|
65
|
+
queryParams['name'] = params.name;
|
|
66
|
+
if (params.published)
|
|
67
|
+
queryParams['published'] = params.published;
|
|
68
|
+
return await this.getRelative('/modules/user/permissions/find', queryParams);
|
|
60
69
|
}
|
|
61
70
|
// Get the user information
|
|
62
|
-
getInfo(id) {
|
|
63
|
-
return
|
|
64
|
-
return yield this.getRelative(`/modules/user/permissions/${id}`, {});
|
|
65
|
-
});
|
|
71
|
+
async getInfo(id) {
|
|
72
|
+
return await this.getRelative(`/modules/user/permissions/${id}`, {});
|
|
66
73
|
}
|
|
67
|
-
|
|
68
|
-
return
|
|
69
|
-
const body = { published: published ? 'true' : 'false' };
|
|
70
|
-
return yield this.postRelative(`/modules/user/permissions/${id}/publish`, body);
|
|
71
|
-
});
|
|
74
|
+
async updateSingleFields(id, body = {}) {
|
|
75
|
+
return await this.postRelative(`/modules/user/permissions/${id}/update/single_fields`, body);
|
|
72
76
|
}
|
|
73
77
|
}
|
|
78
|
+
exports.JDPermission = JDPermission;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo, defaultSortParams, defaultUpdateFields, PaginateParams } from "../../jdResource";
|
|
2
|
+
export declare class JDPermissionGroup extends JDResource {
|
|
3
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
4
|
+
setData(data: Record<string, any>): void;
|
|
5
|
+
getContents(params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
6
|
+
paginateContents(params?: PaginateParams & {
|
|
7
|
+
name?: string;
|
|
8
|
+
guardName?: string;
|
|
9
|
+
published?: string;
|
|
10
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
findContents(params?: PaginateParams & {
|
|
12
|
+
name?: string;
|
|
13
|
+
published?: string;
|
|
14
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
|
+
getPermissions(permissionGroupId: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
17
|
+
updateSingleFields(id: string, body?: Partial<typeof defaultUpdateFields>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=jdPermissionGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdPermissionGroup.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdPermissionGroup.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEnH,qBAAa,iBAAkB,SAAQ,UAAU;gBACpC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI1B,WAAW,CAAC,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAK1D,gBAAgB,CAAC,MAAM,GAAE,cAAc,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;KAAO;IAWzG,YAAY,CAAC,MAAM,GAAE,cAAc,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;KAAO;IAUjF,cAAc,CAAC,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAMxF,OAAO,CAAC,EAAE,EAAC,MAAM;IAIjB,kBAAkB,CAAC,EAAE,EAAC,MAAM,EAAE,IAAI,GAAE,OAAO,CAAC,OAAO,mBAAmB,CAAM;CAGlF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.JDPermissionGroup = void 0;
|
|
27
|
+
const jdResource_1 = __importStar(require("../../jdResource"));
|
|
28
|
+
class JDPermissionGroup extends jdResource_1.default {
|
|
29
|
+
constructor(data = {}, connectorInfo = new jdResource_1.ConnectorInfo("", "")) {
|
|
30
|
+
super(connectorInfo);
|
|
31
|
+
this.setData(data);
|
|
32
|
+
}
|
|
33
|
+
setData(data) {
|
|
34
|
+
super.setData(data);
|
|
35
|
+
}
|
|
36
|
+
async getContents(params = {}) {
|
|
37
|
+
const queryParams = this.getSortParameters(params);
|
|
38
|
+
return await this.getRelative(`/modules/user/permission_groups`, queryParams);
|
|
39
|
+
}
|
|
40
|
+
async paginateContents(params = {}) {
|
|
41
|
+
const queryParams = this.getSortParameters(params);
|
|
42
|
+
// Add custom filters
|
|
43
|
+
if (params.name)
|
|
44
|
+
queryParams['name'] = params.name;
|
|
45
|
+
if (params.guardName)
|
|
46
|
+
queryParams['guard_name'] = params.guardName;
|
|
47
|
+
if (params.published)
|
|
48
|
+
queryParams['published'] = params.published;
|
|
49
|
+
return await this.getRelative('/modules/user/permission_groups/paginate', queryParams);
|
|
50
|
+
}
|
|
51
|
+
async findContents(params = {}) {
|
|
52
|
+
const queryParams = this.getSortParameters(params);
|
|
53
|
+
// Add custom filters
|
|
54
|
+
if (params.name)
|
|
55
|
+
queryParams['name'] = params.name;
|
|
56
|
+
if (params.published)
|
|
57
|
+
queryParams['published'] = params.published;
|
|
58
|
+
return await this.getRelative('/modules/user/permission_groups/find', queryParams);
|
|
59
|
+
}
|
|
60
|
+
async getPermissions(permissionGroupId, params = {}) {
|
|
61
|
+
const queryParams = this.getSortParameters(params);
|
|
62
|
+
return await this.getRelative(`/modules/user/permission_groups/${permissionGroupId}/permissions`, queryParams);
|
|
63
|
+
}
|
|
64
|
+
// Get the user information
|
|
65
|
+
async getInfo(id) {
|
|
66
|
+
return await this.getRelative(`/modules/user/permission_groups/${id}`, {});
|
|
67
|
+
}
|
|
68
|
+
async updateSingleFields(id, body = {}) {
|
|
69
|
+
return await this.postRelative(`/modules/user/permission_groups/${id}/update/single_fields`, body);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.JDPermissionGroup = JDPermissionGroup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo, defaultSortParams, PaginateParams, UpdateFields } from "../../jdResource";
|
|
2
2
|
export declare class JDSessionUser extends JDResource {
|
|
3
3
|
cloudSessionId: string;
|
|
4
4
|
name: string;
|
|
@@ -8,10 +8,23 @@ export declare class JDSessionUser extends JDResource {
|
|
|
8
8
|
get isLoggedIn(): boolean;
|
|
9
9
|
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
10
10
|
setData(data: Record<string, any>): void;
|
|
11
|
-
|
|
11
|
+
paginateContents(params?: PaginateParams & {
|
|
12
|
+
name?: string | null;
|
|
13
|
+
username?: string | null;
|
|
14
|
+
email?: string | null;
|
|
15
|
+
phone?: string | null;
|
|
16
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
17
|
+
getContents(params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
18
|
+
findContents(name: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
19
|
authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
20
|
register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
21
|
logout(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
22
|
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
23
|
+
updateSingleFields(id: string, body?: UpdateFields & {
|
|
24
|
+
name?: string | null;
|
|
25
|
+
username?: string | null;
|
|
26
|
+
email?: string | null;
|
|
27
|
+
phone?: string | null;
|
|
28
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
29
|
}
|
|
17
30
|
//# sourceMappingURL=jdSessionUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdSessionUser.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdSessionUser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdSessionUser.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdSessionUser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAyB,iBAAiB,EAAuB,cAAc,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAExJ,qBAAa,aAAc,SAAQ,UAAU;IAC5C,cAAc,EAAC,MAAM,CAAM;IAC3B,IAAI,EAAC,MAAM,CAAM;IACjB,QAAQ,EAAC,MAAM,CAAM;IACrB,KAAK,EAAC,MAAM,CAAM;IAClB,YAAY,EAAE,GAAG,EAAE,CAAM;IAEzB,IAAI,UAAU,IAAG,OAAO,CAA+C;gBAE3D,IAAI,GAA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
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
9
24
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.JDSessionUser = void 0;
|
|
27
|
+
const jdResource_1 = __importStar(require("../../jdResource"));
|
|
28
|
+
const utils_1 = require("../../../utilities/utils");
|
|
29
|
+
class JDSessionUser extends jdResource_1.default {
|
|
30
|
+
cloudSessionId = "";
|
|
31
|
+
name = "";
|
|
32
|
+
username = "";
|
|
33
|
+
phone = "";
|
|
34
|
+
searchTokens = [];
|
|
35
|
+
get isLoggedIn() { return utils_1.Utils.isset(globalThis.xAuthToken); }
|
|
36
|
+
constructor(data = {}, connectorInfo = new jdResource_1.ConnectorInfo("", "")) {
|
|
15
37
|
super(connectorInfo);
|
|
16
|
-
this.cloudSessionId = "";
|
|
17
|
-
this.name = "";
|
|
18
|
-
this.username = "";
|
|
19
|
-
this.phone = "";
|
|
20
|
-
this.searchTokens = [];
|
|
21
38
|
this.setData(data);
|
|
22
39
|
}
|
|
23
40
|
setData(data) {
|
|
24
41
|
super.setData(data);
|
|
25
|
-
this.cloudSessionId = Utils.getString(data, "cloud_session_id");
|
|
26
|
-
this.name = Utils.getString(data, "name");
|
|
27
|
-
this.username = Utils.getString(data, "username");
|
|
28
|
-
this.phone = Utils.getString(data, "phone");
|
|
29
|
-
this.searchTokens = Utils.getArray(data, "search_tokens");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
this.cloudSessionId = utils_1.Utils.getString(data, "cloud_session_id");
|
|
43
|
+
this.name = utils_1.Utils.getString(data, "name");
|
|
44
|
+
this.username = utils_1.Utils.getString(data, "username");
|
|
45
|
+
this.phone = utils_1.Utils.getString(data, "phone");
|
|
46
|
+
this.searchTokens = utils_1.Utils.getArray(data, "search_tokens");
|
|
47
|
+
}
|
|
48
|
+
async paginateContents(params = {}) {
|
|
49
|
+
const queryParams = this.getSortParameters(params);
|
|
50
|
+
if (params.name)
|
|
51
|
+
queryParams['name'] = params.name;
|
|
52
|
+
if (params.username)
|
|
53
|
+
queryParams['username'] = params.username;
|
|
54
|
+
if (params.email)
|
|
55
|
+
queryParams['username'] = params.email;
|
|
56
|
+
if (params.phone)
|
|
57
|
+
queryParams['username'] = params.phone;
|
|
58
|
+
return await this.getRelative('/modules/user/session_users/paginate', params);
|
|
59
|
+
}
|
|
60
|
+
async getContents(params = {}) {
|
|
61
|
+
const queryParams = this.getSortParameters(params);
|
|
62
|
+
return await this.getRelative('/modules/user/session_users', queryParams);
|
|
63
|
+
}
|
|
64
|
+
async findContents(name, params = {}) {
|
|
65
|
+
const queryParams = this.getSortParameters(params);
|
|
66
|
+
queryParams['name'] = name;
|
|
67
|
+
return await this.getRelative('/modules/user/session_users/find', queryParams);
|
|
36
68
|
}
|
|
37
69
|
// TODO: Sign the API calls to only be able to call from this client only
|
|
38
|
-
authenticate(username, password) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
logout(name, username, email, phone, password) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const body = { name, username, email, phone, password };
|
|
53
|
-
return yield this.postRelative('/modules/user/session_users/register', body);
|
|
54
|
-
});
|
|
70
|
+
async authenticate(username, password) {
|
|
71
|
+
const body = { username, password };
|
|
72
|
+
return await this.postRelative('/modules/user/session_users/authenticate', body);
|
|
73
|
+
}
|
|
74
|
+
async register(name, username, email, phone, password) {
|
|
75
|
+
const body = { name, username, email, phone, password };
|
|
76
|
+
return await this.postRelative('/modules/user/session_users/register', body);
|
|
77
|
+
}
|
|
78
|
+
async logout(name, username, email, phone, password) {
|
|
79
|
+
const body = { name, username, email, phone, password };
|
|
80
|
+
return await this.postRelative('/modules/user/session_users/register', body);
|
|
55
81
|
}
|
|
56
82
|
// Get the user information
|
|
57
|
-
getInfo(id) {
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
83
|
+
async getInfo(id) {
|
|
84
|
+
return await this.getRelative(`/modules/user/session_users/${id}`, {});
|
|
85
|
+
}
|
|
86
|
+
async updateSingleFields(id, body = {}) {
|
|
87
|
+
return await this.postRelative(`/modules/user/session_users/${id}/update/single_fields`, body);
|
|
61
88
|
}
|
|
62
89
|
}
|
|
90
|
+
exports.JDSessionUser = JDSessionUser;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo, defaultSortParams, PaginateParams, UpdateFields } from "../../jdResource";
|
|
2
2
|
export declare class JDUser extends JDResource {
|
|
3
3
|
name: string;
|
|
4
4
|
username: string;
|
|
@@ -8,11 +8,23 @@ export declare class JDUser extends JDResource {
|
|
|
8
8
|
get isLoggedIn(): boolean;
|
|
9
9
|
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
10
10
|
setData(data: Record<string, any>): void;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
getContents(params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
paginateContents(params?: PaginateParams & {
|
|
13
|
+
name?: string | null;
|
|
14
|
+
username?: string | null;
|
|
15
|
+
email?: string | null;
|
|
16
|
+
phone?: string | null;
|
|
17
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
18
|
+
findContents(name: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
19
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
20
|
authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
21
|
register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
22
|
logout(): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
|
-
|
|
23
|
+
updateSingleFields(id: string, body?: UpdateFields & {
|
|
24
|
+
name?: string | null;
|
|
25
|
+
username?: string | null;
|
|
26
|
+
email?: string | null;
|
|
27
|
+
phone?: string | null;
|
|
28
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
17
29
|
}
|
|
18
30
|
//# sourceMappingURL=jdUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdUser.d.ts","sourceRoot":"","sources":["../../../../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AQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAOlF,MAAM;IAIN,kBAAkB,CAAC,EAAE,EAAC,MAAM,EAAE,IAAI,GAAE,YAAY,GAAI;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAAO;CAGhK"}
|
|
@@ -1,71 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
9
24
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.JDUser = void 0;
|
|
27
|
+
const jdResource_1 = __importStar(require("../../jdResource"));
|
|
28
|
+
const utils_1 = require("../../../utilities/utils");
|
|
29
|
+
class JDUser extends jdResource_1.default {
|
|
30
|
+
name = "";
|
|
31
|
+
username = "";
|
|
32
|
+
phone = "";
|
|
33
|
+
email = "";
|
|
34
|
+
searchTokens = [];
|
|
35
|
+
get isLoggedIn() { return utils_1.Utils.isset(globalThis.xAuthToken); }
|
|
36
|
+
constructor(data = {}, connectorInfo = new jdResource_1.ConnectorInfo("", "")) {
|
|
15
37
|
super(connectorInfo);
|
|
16
|
-
this.name = "";
|
|
17
|
-
this.username = "";
|
|
18
|
-
this.phone = "";
|
|
19
|
-
this.email = "";
|
|
20
|
-
this.searchTokens = [];
|
|
21
38
|
this.setData(data);
|
|
22
39
|
}
|
|
23
40
|
setData(data) {
|
|
24
41
|
super.setData(data);
|
|
25
|
-
this.name = Utils.getString(data, "name");
|
|
26
|
-
this.username = Utils.getString(data, "username");
|
|
27
|
-
this.phone = Utils.getString(data, "phone");
|
|
28
|
-
this.email = Utils.getString(data, "email");
|
|
29
|
-
this.searchTokens = Utils.getArray(data, "search_tokens");
|
|
42
|
+
this.name = utils_1.Utils.getString(data, "name");
|
|
43
|
+
this.username = utils_1.Utils.getString(data, "username");
|
|
44
|
+
this.phone = utils_1.Utils.getString(data, "phone");
|
|
45
|
+
this.email = utils_1.Utils.getString(data, "email");
|
|
46
|
+
this.searchTokens = utils_1.Utils.getArray(data, "search_tokens");
|
|
47
|
+
}
|
|
48
|
+
async getContents(params = {}) {
|
|
49
|
+
const queryParams = this.getSortParameters(params);
|
|
50
|
+
return await this.getRelative('/modules/user/users', queryParams);
|
|
51
|
+
}
|
|
52
|
+
async paginateContents(params = {}) {
|
|
53
|
+
const queryParams = this.getSortParameters(params);
|
|
54
|
+
if (params.name)
|
|
55
|
+
queryParams['name'] = params.name;
|
|
56
|
+
if (params.username)
|
|
57
|
+
queryParams['username'] = params.username;
|
|
58
|
+
if (params.email)
|
|
59
|
+
queryParams['username'] = params.email;
|
|
60
|
+
if (params.phone)
|
|
61
|
+
queryParams['username'] = params.phone;
|
|
62
|
+
return await this.getRelative('/modules/user/users/paginate', params);
|
|
30
63
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
64
|
+
async findContents(name, params = {}) {
|
|
65
|
+
const queryParams = this.getSortParameters(params);
|
|
66
|
+
queryParams['name'] = name;
|
|
67
|
+
return await this.getRelative('/modules/user/users/find', queryParams);
|
|
36
68
|
}
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
40
|
-
return yield this.getRelative('/modules/user/users/find', params);
|
|
41
|
-
});
|
|
69
|
+
async getInfo(id) {
|
|
70
|
+
return await this.getRelative(`/modules/user/users/${id}`, {});
|
|
42
71
|
}
|
|
43
72
|
// TODO: Sign the API calls to only be able to call from this client only
|
|
44
|
-
authenticate(username, password) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return response;
|
|
50
|
-
});
|
|
73
|
+
async authenticate(username, password) {
|
|
74
|
+
const body = { username, password };
|
|
75
|
+
const response = await this.postRelative('/modules/user/users/authenticate', body);
|
|
76
|
+
await this.checkUser(response);
|
|
77
|
+
return response;
|
|
51
78
|
}
|
|
52
|
-
register(name, username, email, phone, password) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return response;
|
|
58
|
-
});
|
|
79
|
+
async register(name, username, email, phone, password) {
|
|
80
|
+
const body = { name, username, email, phone, password };
|
|
81
|
+
const response = await this.postRelative('/modules/user/users/register', body);
|
|
82
|
+
await this.checkUser(response);
|
|
83
|
+
return response;
|
|
59
84
|
}
|
|
60
|
-
logout() {
|
|
61
|
-
return
|
|
62
|
-
return yield this.postRelative('/modules/user/users/logout', {});
|
|
63
|
-
});
|
|
85
|
+
async logout() {
|
|
86
|
+
return await this.postRelative('/modules/user/users/logout', {});
|
|
64
87
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return yield this.getRelative(`/modules/user/users/${id}`, {});
|
|
69
|
-
});
|
|
88
|
+
async updateSingleFields(id, body = {}) {
|
|
89
|
+
return await this.postRelative(`/modules/user/users/${id}/update/single_fields`, body);
|
|
70
90
|
}
|
|
71
91
|
}
|
|
92
|
+
exports.JDUser = JDUser;
|