jd_platform_sdk 0.1.0 → 0.1.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.
Files changed (30) hide show
  1. package/dist/index.js +28 -44
  2. package/dist/sdk/configs/jdConfig.js +1 -5
  3. package/dist/sdk/jdConnector.js +72 -63
  4. package/dist/sdk/jdSdk.js +1 -5
  5. package/dist/sdk/models/jdApplication.js +63 -71
  6. package/dist/sdk/models/jdResource.js +104 -91
  7. package/dist/sdk/models/modules/dashboard/jdDashboardCombinations.js +15 -31
  8. package/dist/sdk/models/modules/geolocation/jdCity.js +49 -55
  9. package/dist/sdk/models/modules/geolocation/jdCountry.js +47 -53
  10. package/dist/sdk/models/modules/geolocation/jdDistrict.js +49 -57
  11. package/dist/sdk/models/modules/geolocation/jdState.js +49 -55
  12. package/dist/sdk/models/modules/karaoke/jdKtvShop.js +82 -88
  13. package/dist/sdk/models/modules/music/jdAlbum.js +96 -102
  14. package/dist/sdk/models/modules/music/jdArtist.js +87 -89
  15. package/dist/sdk/models/modules/music/jdComposer.js +83 -87
  16. package/dist/sdk/models/modules/music/jdMusicCombinations.js +15 -31
  17. package/dist/sdk/models/modules/music/jdSong.js +105 -113
  18. package/dist/sdk/models/modules/radio_station/jdRadioStation.js +82 -88
  19. package/dist/sdk/models/modules/user/jdPermission.js +55 -63
  20. package/dist/sdk/models/modules/user/jdPermissionGroup.js +51 -57
  21. package/dist/sdk/models/modules/user/jdSessionUser.js +70 -72
  22. package/dist/sdk/models/modules/user/jdUser.js +73 -75
  23. package/dist/sdk/models/modules/user/jdUserRole.js +50 -54
  24. package/dist/sdk/utilities/browserUtils.js +31 -24
  25. package/dist/sdk/utilities/cryptoUtils.js +6 -13
  26. package/dist/sdk/utilities/dateUtils.js +1 -5
  27. package/dist/sdk/utilities/globalEventHandler.js +4 -5
  28. package/dist/sdk/utilities/stringUtils.js +2 -6
  29. package/dist/sdk/utilities/utils.js +19 -22
  30. package/package.json +1 -1
@@ -1,72 +1,66 @@
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;
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
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("", "")) {
10
+ import JDResource, { ConnectorInfo } from "../../jdResource";
11
+ export class JDPermissionGroup extends JDResource {
12
+ constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
30
13
  super(connectorInfo);
31
14
  this.setData(data);
32
15
  }
33
16
  setData(data) {
34
17
  super.setData(data);
35
18
  }
36
- async getContents(params = {}) {
37
- const queryParams = this.getSortParameters(params);
38
- return await this.getRelative(`/modules/user/permission_groups`, queryParams);
19
+ getContents() {
20
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
21
+ const queryParams = this.getSortParameters(params);
22
+ return yield this.getRelative(`/modules/user/permission_groups`, queryParams);
23
+ });
39
24
  }
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);
25
+ paginateContents() {
26
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
27
+ const queryParams = this.getSortParameters(params);
28
+ // Add custom filters
29
+ if (params.name)
30
+ queryParams['name'] = params.name;
31
+ if (params.guardName)
32
+ queryParams['guard_name'] = params.guardName;
33
+ if (params.published)
34
+ queryParams['published'] = params.published;
35
+ return yield this.getRelative('/modules/user/permission_groups/paginate', queryParams);
36
+ });
50
37
  }
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);
38
+ findContents() {
39
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
40
+ const queryParams = this.getSortParameters(params);
41
+ // Add custom filters
42
+ if (params.name)
43
+ queryParams['name'] = params.name;
44
+ if (params.published)
45
+ queryParams['published'] = params.published;
46
+ return yield this.getRelative('/modules/user/permission_groups/find', queryParams);
47
+ });
59
48
  }
60
- async getPermissions(permissionGroupId, params = {}) {
61
- const queryParams = this.getSortParameters(params);
62
- return await this.getRelative(`/modules/user/permission_groups/${permissionGroupId}/permissions`, queryParams);
49
+ getPermissions(permissionGroupId_1) {
50
+ return __awaiter(this, arguments, void 0, function* (permissionGroupId, params = {}) {
51
+ const queryParams = this.getSortParameters(params);
52
+ return yield this.getRelative(`/modules/user/permission_groups/${permissionGroupId}/permissions`, queryParams);
53
+ });
63
54
  }
64
55
  // Get the user information
65
- async getInfo(id) {
66
- return await this.getRelative(`/modules/user/permission_groups/${id}`, {});
56
+ getInfo(id) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ return yield this.getRelative(`/modules/user/permission_groups/${id}`, {});
59
+ });
67
60
  }
68
- async updateSingleFields(id, body = {}) {
69
- return await this.postRelative(`/modules/user/permission_groups/${id}/update/single_fields`, body);
61
+ updateSingleFields(id_1) {
62
+ return __awaiter(this, arguments, void 0, function* (id, body = {}) {
63
+ return yield this.postRelative(`/modules/user/permission_groups/${id}/update/single_fields`, body);
64
+ });
70
65
  }
71
66
  }
72
- exports.JDPermissionGroup = JDPermissionGroup;
@@ -1,90 +1,88 @@
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;
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
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("", "")) {
10
+ import JDResource, { ConnectorInfo } from "../../jdResource";
11
+ import { Utils } from "../../../utilities/utils";
12
+ export class JDSessionUser extends JDResource {
13
+ get isLoggedIn() { return Utils.isset(globalThis.xAuthToken); }
14
+ constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
37
15
  super(connectorInfo);
16
+ this.cloudSessionId = "";
17
+ this.name = "";
18
+ this.username = "";
19
+ this.phone = "";
20
+ this.searchTokens = [];
38
21
  this.setData(data);
39
22
  }
40
23
  setData(data) {
41
24
  super.setData(data);
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");
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");
47
30
  }
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);
31
+ paginateContents() {
32
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
33
+ const queryParams = this.getSortParameters(params);
34
+ if (params.name)
35
+ queryParams['name'] = params.name;
36
+ if (params.username)
37
+ queryParams['username'] = params.username;
38
+ if (params.email)
39
+ queryParams['username'] = params.email;
40
+ if (params.phone)
41
+ queryParams['username'] = params.phone;
42
+ return yield this.getRelative('/modules/user/session_users/paginate', params);
43
+ });
59
44
  }
60
- async getContents(params = {}) {
61
- const queryParams = this.getSortParameters(params);
62
- return await this.getRelative('/modules/user/session_users', queryParams);
45
+ getContents() {
46
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
47
+ const queryParams = this.getSortParameters(params);
48
+ return yield this.getRelative('/modules/user/session_users', queryParams);
49
+ });
63
50
  }
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);
51
+ findContents(name_1) {
52
+ return __awaiter(this, arguments, void 0, function* (name, params = {}) {
53
+ const queryParams = this.getSortParameters(params);
54
+ queryParams['name'] = name;
55
+ return yield this.getRelative('/modules/user/session_users/find', queryParams);
56
+ });
68
57
  }
69
58
  // TODO: Sign the API calls to only be able to call from this client only
70
- async authenticate(username, password) {
71
- const body = { username, password };
72
- return await this.postRelative('/modules/user/session_users/authenticate', body);
59
+ authenticate(username, password) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const body = { username, password };
62
+ return yield this.postRelative('/modules/user/session_users/authenticate', body);
63
+ });
73
64
  }
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);
65
+ register(name, username, email, phone, password) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const body = { name, username, email, phone, password };
68
+ return yield this.postRelative('/modules/user/session_users/register', body);
69
+ });
77
70
  }
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);
71
+ logout(name, username, email, phone, password) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const body = { name, username, email, phone, password };
74
+ return yield this.postRelative('/modules/user/session_users/register', body);
75
+ });
81
76
  }
82
77
  // Get the user information
83
- async getInfo(id) {
84
- return await this.getRelative(`/modules/user/session_users/${id}`, {});
78
+ getInfo(id) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ return yield this.getRelative(`/modules/user/session_users/${id}`, {});
81
+ });
85
82
  }
86
- async updateSingleFields(id, body = {}) {
87
- return await this.postRelative(`/modules/user/session_users/${id}/update/single_fields`, body);
83
+ updateSingleFields(id_1) {
84
+ return __awaiter(this, arguments, void 0, function* (id, body = {}) {
85
+ return yield this.postRelative(`/modules/user/session_users/${id}/update/single_fields`, body);
86
+ });
88
87
  }
89
88
  }
90
- exports.JDSessionUser = JDSessionUser;
@@ -1,92 +1,90 @@
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;
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
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("", "")) {
10
+ import JDResource, { ConnectorInfo } from "../../jdResource";
11
+ import { Utils } from "../../../utilities/utils";
12
+ export class JDUser extends JDResource {
13
+ get isLoggedIn() { return Utils.isset(globalThis.xAuthToken); }
14
+ constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
37
15
  super(connectorInfo);
16
+ this.name = "";
17
+ this.username = "";
18
+ this.phone = "";
19
+ this.email = "";
20
+ this.searchTokens = [];
38
21
  this.setData(data);
39
22
  }
40
23
  setData(data) {
41
24
  super.setData(data);
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");
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");
47
30
  }
48
- async getContents(params = {}) {
49
- const queryParams = this.getSortParameters(params);
50
- return await this.getRelative('/modules/user/users', queryParams);
31
+ getContents() {
32
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
33
+ const queryParams = this.getSortParameters(params);
34
+ return yield this.getRelative('/modules/user/users', queryParams);
35
+ });
51
36
  }
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);
37
+ paginateContents() {
38
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
39
+ const queryParams = this.getSortParameters(params);
40
+ if (params.name)
41
+ queryParams['name'] = params.name;
42
+ if (params.username)
43
+ queryParams['username'] = params.username;
44
+ if (params.email)
45
+ queryParams['username'] = params.email;
46
+ if (params.phone)
47
+ queryParams['username'] = params.phone;
48
+ return yield this.getRelative('/modules/user/users/paginate', params);
49
+ });
63
50
  }
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);
51
+ findContents(name_1) {
52
+ return __awaiter(this, arguments, void 0, function* (name, params = {}) {
53
+ const queryParams = this.getSortParameters(params);
54
+ queryParams['name'] = name;
55
+ return yield this.getRelative('/modules/user/users/find', queryParams);
56
+ });
68
57
  }
69
- async getInfo(id) {
70
- return await this.getRelative(`/modules/user/users/${id}`, {});
58
+ getInfo(id) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ return yield this.getRelative(`/modules/user/users/${id}`, {});
61
+ });
71
62
  }
72
63
  // TODO: Sign the API calls to only be able to call from this client only
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;
64
+ authenticate(username, password) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const body = { username, password };
67
+ const response = yield this.postRelative('/modules/user/users/authenticate', body);
68
+ yield this.checkUser(response);
69
+ return response;
70
+ });
78
71
  }
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;
72
+ register(name, username, email, phone, password) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const body = { name, username, email, phone, password };
75
+ const response = yield this.postRelative('/modules/user/users/register', body);
76
+ yield this.checkUser(response);
77
+ return response;
78
+ });
84
79
  }
85
- async logout() {
86
- return await this.postRelative('/modules/user/users/logout', {});
80
+ logout() {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return yield this.postRelative('/modules/user/users/logout', {});
83
+ });
87
84
  }
88
- async updateSingleFields(id, body = {}) {
89
- return await this.postRelative(`/modules/user/users/${id}/update/single_fields`, body);
85
+ updateSingleFields(id_1) {
86
+ return __awaiter(this, arguments, void 0, function* (id, body = {}) {
87
+ return yield this.postRelative(`/modules/user/users/${id}/update/single_fields`, body);
88
+ });
90
89
  }
91
90
  }
92
- exports.JDUser = JDUser;
@@ -1,70 +1,66 @@
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;
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
24
9
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.JDUserRole = void 0;
27
- const jdResource_1 = __importStar(require("../../jdResource"));
28
- const utils_1 = require("../../../utilities/utils");
29
- class JDUserRole extends jdResource_1.default {
30
- permissionIds = [];
31
- constructor(data = {}, connectorInfo = new jdResource_1.ConnectorInfo("", "")) {
10
+ import JDResource, { ConnectorInfo } from "../../jdResource";
11
+ import { Utils } from "../../../utilities/utils";
12
+ export class JDUserRole extends JDResource {
13
+ constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
32
14
  super(connectorInfo);
15
+ this.permissionIds = [];
33
16
  this.setData(data);
34
17
  }
35
18
  setData(data) {
36
19
  super.setData(data);
37
- this.permissionIds = utils_1.Utils.getArray(data, 'permission_ids');
20
+ this.permissionIds = Utils.getArray(data, 'permission_ids');
38
21
  }
39
- async getContents(params = {}) {
40
- const queryParams = this.getSortParameters(params);
41
- return await this.getRelative('/modules/user/user_roles', queryParams);
22
+ getContents() {
23
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
24
+ const queryParams = this.getSortParameters(params);
25
+ return yield this.getRelative('/modules/user/user_roles', queryParams);
26
+ });
42
27
  }
43
- async paginateContents(params = {}) {
44
- const queryParams = this.getSortParameters(params);
45
- if (params.name)
46
- queryParams['name'] = params.name;
47
- return await this.getRelative('/modules/user/user_roles/paginate', queryParams);
28
+ paginateContents() {
29
+ return __awaiter(this, arguments, void 0, function* (params = {}) {
30
+ const queryParams = this.getSortParameters(params);
31
+ if (params.name)
32
+ queryParams['name'] = params.name;
33
+ return yield this.getRelative('/modules/user/user_roles/paginate', queryParams);
34
+ });
48
35
  }
49
- async findContents(title, params = {}) {
50
- const queryParams = this.getSortParameters(params);
51
- queryParams['title'] = title;
52
- return await this.getRelative('/modules/user/user_roles/find', queryParams);
36
+ findContents(title_1) {
37
+ return __awaiter(this, arguments, void 0, function* (title, params = {}) {
38
+ const queryParams = this.getSortParameters(params);
39
+ queryParams['title'] = title;
40
+ return yield this.getRelative('/modules/user/user_roles/find', queryParams);
41
+ });
53
42
  }
54
43
  // Return the user list with the provided row
55
- async getUsers(userRoleId, params = {}) {
56
- const queryParams = this.getSortParameters(params);
57
- return await this.getRelative(`/modules/user/user_roles/${userRoleId}/users`, queryParams);
44
+ getUsers(userRoleId_1) {
45
+ return __awaiter(this, arguments, void 0, function* (userRoleId, params = {}) {
46
+ const queryParams = this.getSortParameters(params);
47
+ return yield this.getRelative(`/modules/user/user_roles/${userRoleId}/users`, queryParams);
48
+ });
58
49
  }
59
- async getPermissions(userRoleId, params = {}) {
60
- const queryParams = this.getSortParameters(params);
61
- return await this.getRelative(`/modules/user/user_roles/${userRoleId}/permissions`, queryParams);
50
+ getPermissions(userRoleId_1) {
51
+ return __awaiter(this, arguments, void 0, function* (userRoleId, params = {}) {
52
+ const queryParams = this.getSortParameters(params);
53
+ return yield this.getRelative(`/modules/user/user_roles/${userRoleId}/permissions`, queryParams);
54
+ });
62
55
  }
63
- async getInfo(id) {
64
- return await this.getRelative(`/modules/user/user_roles/${id}`, {});
56
+ getInfo(id) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ return yield this.getRelative(`/modules/user/user_roles/${id}`, {});
59
+ });
65
60
  }
66
- async updateSingleFields(id, body = {}) {
67
- return await this.postRelative(`/modules/user/user_roles/${id}/update/single_fields`, body);
61
+ updateSingleFields(id_1) {
62
+ return __awaiter(this, arguments, void 0, function* (id, body = {}) {
63
+ return yield this.postRelative(`/modules/user/user_roles/${id}/update/single_fields`, body);
64
+ });
68
65
  }
69
66
  }
70
- exports.JDUserRole = JDUserRole;