jd_platform_sdk 0.0.8 → 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.js +44 -28
- 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.js +31 -15
- 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 +7 -18
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts.map +1 -1
- package/dist/sdk/models/modules/geolocation/jdCountry.js +53 -49
- 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 +10 -16
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts.map +1 -1
- package/dist/sdk/models/modules/karaoke/jdKtvShop.js +89 -78
- package/dist/sdk/models/modules/music/jdAlbum.d.ts +8 -50
- 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 +9 -47
- 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 +10 -16
- package/dist/sdk/models/modules/radio_station/jdRadioStation.d.ts.map +1 -1
- package/dist/sdk/models/modules/radio_station/jdRadioStation.js +89 -78
- package/dist/sdk/models/modules/user/jdPermission.d.ts +7 -33
- package/dist/sdk/models/modules/user/jdPermission.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdPermission.js +63 -74
- package/dist/sdk/models/modules/user/jdPermissionGroup.d.ts +11 -39
- package/dist/sdk/models/modules/user/jdPermissionGroup.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdPermissionGroup.js +57 -51
- 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 +7 -17
- package/dist/sdk/models/modules/user/jdUser.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdUser.js +76 -73
- package/dist/sdk/models/modules/user/jdUserRole.d.ts +7 -43
- package/dist/sdk/models/modules/user/jdUserRole.d.ts.map +1 -1
- package/dist/sdk/models/modules/user/jdUserRole.js +55 -57
- 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 +1 -1
|
@@ -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,33 +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
|
-
paginateContents(
|
|
11
|
+
getContents(params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
paginateContents(params?: PaginateParams & {
|
|
13
13
|
name?: string | null;
|
|
14
14
|
username?: string | null;
|
|
15
15
|
email?: string | null;
|
|
16
16
|
phone?: string | null;
|
|
17
|
-
published?: boolean | null;
|
|
18
|
-
orderBy?: string | null;
|
|
19
|
-
order?: string | null;
|
|
20
|
-
pageIndex?: number | null;
|
|
21
|
-
countPerPage?: number | null;
|
|
22
|
-
fields?: string | null;
|
|
23
17
|
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
24
|
-
|
|
18
|
+
findContents(name: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
19
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
25
20
|
authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
26
21
|
register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
27
22
|
logout(): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
28
|
-
|
|
29
|
-
updateSingleFields(id: string, { name, username, phone, email, published, note }: {
|
|
23
|
+
updateSingleFields(id: string, body?: UpdateFields & {
|
|
30
24
|
name?: string | null;
|
|
31
25
|
username?: string | null;
|
|
32
|
-
phone?: string | null;
|
|
33
26
|
email?: string | null;
|
|
34
|
-
|
|
35
|
-
recommended?: boolean | null;
|
|
36
|
-
downloadable?: boolean | null;
|
|
37
|
-
note?: string | null;
|
|
27
|
+
phone?: string | null;
|
|
38
28
|
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
39
29
|
}
|
|
40
30
|
//# sourceMappingURL=jdUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdUser.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdUser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdUser.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdUser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAyB,iBAAiB,EAAuB,cAAc,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAWxJ,qBAAa,MAAO,SAAQ,UAAU;IACrC,IAAI,EAAC,MAAM,CAAM;IACjB,QAAQ,EAAC,MAAM,CAAM;IACrB,KAAK,EAAC,MAAM,CAAM;IAClB,KAAK,EAAC,MAAM,CAAM;IAClB,YAAY,EAAE,GAAG,EAAE,CAAM;IAEzB,IAAI,UAAU,IAAG,OAAO,CAA+C;gBAE3D,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAS1B,WAAW,CAAC,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAK1D,gBAAgB,CAAC,MAAM,GAAE,cAAc,GAAG;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;KAAQ;IASjJ,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAMzE,OAAO,CAAC,EAAE,EAAC,MAAM;IAKjB,YAAY,CAAC,QAAQ,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAO7C,QAAQ,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,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,89 +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");
|
|
30
47
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return yield this.getRelative('/modules/user/users', params);
|
|
35
|
-
});
|
|
48
|
+
async getContents(params = {}) {
|
|
49
|
+
const queryParams = this.getSortParameters(params);
|
|
50
|
+
return await this.getRelative('/modules/user/users', queryParams);
|
|
36
51
|
}
|
|
37
|
-
paginateContents(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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);
|
|
48
63
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
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);
|
|
54
68
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const body = { username, password };
|
|
59
|
-
const response = yield this.postRelative('/modules/user/users/authenticate', body);
|
|
60
|
-
yield this.checkUser(response);
|
|
61
|
-
return response;
|
|
62
|
-
});
|
|
69
|
+
async getInfo(id) {
|
|
70
|
+
return await this.getRelative(`/modules/user/users/${id}`, {});
|
|
63
71
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
72
|
+
// 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;
|
|
71
78
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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;
|
|
76
84
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
return yield this.getRelative(`/modules/user/users/${id}`, {});
|
|
81
|
-
});
|
|
85
|
+
async logout() {
|
|
86
|
+
return await this.postRelative('/modules/user/users/logout', {});
|
|
82
87
|
}
|
|
83
|
-
updateSingleFields(
|
|
84
|
-
return
|
|
85
|
-
const body = { name, username, phone, email, published, note };
|
|
86
|
-
return yield this.postRelative(`/modules/user/users/me/update/single_fields`, body);
|
|
87
|
-
});
|
|
88
|
+
async updateSingleFields(id, body = {}) {
|
|
89
|
+
return await this.postRelative(`/modules/user/users/${id}/update/single_fields`, body);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
92
|
+
exports.JDUser = JDUser;
|
|
@@ -1,52 +1,16 @@
|
|
|
1
|
-
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo, defaultSortParams, defaultUpdateFields, PaginateParams } from "../../jdResource";
|
|
2
2
|
export declare class JDUserRole extends JDResource {
|
|
3
3
|
permissionIds: any[];
|
|
4
4
|
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
5
5
|
setData(data: Record<string, any>): void;
|
|
6
|
-
getContents(
|
|
7
|
-
|
|
8
|
-
order?: string | undefined;
|
|
9
|
-
pageIndex?: number | undefined;
|
|
10
|
-
countPerPage?: number | undefined;
|
|
11
|
-
fields?: string | undefined;
|
|
12
|
-
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
-
paginateContents({ name, guard_name, published, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
6
|
+
getContents(params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
7
|
+
paginateContents(params?: PaginateParams & {
|
|
14
8
|
name?: string | null;
|
|
15
|
-
guard_name?: string | null;
|
|
16
|
-
published?: boolean | null;
|
|
17
|
-
orderBy?: string | null;
|
|
18
|
-
order?: string | null;
|
|
19
|
-
pageIndex?: number | null;
|
|
20
|
-
countPerPage?: number | null;
|
|
21
|
-
fields?: string | null;
|
|
22
|
-
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
23
|
-
getUsers(userRoleId: string, { orderBy, order, pageIndex, countPerPage, fields }: {
|
|
24
|
-
orderBy?: string | undefined;
|
|
25
|
-
order?: string | undefined;
|
|
26
|
-
pageIndex?: number | undefined;
|
|
27
|
-
countPerPage?: number | undefined;
|
|
28
|
-
fields?: string | undefined;
|
|
29
|
-
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
30
|
-
getPermissions(userRoleId: string, { orderBy, order, pageIndex, countPerPage, fields }: {
|
|
31
|
-
orderBy?: string | undefined;
|
|
32
|
-
order?: string | undefined;
|
|
33
|
-
pageIndex?: number | undefined;
|
|
34
|
-
countPerPage?: number | undefined;
|
|
35
|
-
fields?: string | undefined;
|
|
36
|
-
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
37
|
-
findPermissions({ name, published, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
38
|
-
name?: string | undefined;
|
|
39
|
-
published?: string | undefined;
|
|
40
|
-
orderBy?: string | undefined;
|
|
41
|
-
order?: string | undefined;
|
|
42
|
-
pageIndex?: number | undefined;
|
|
43
|
-
countPerPage?: number | undefined;
|
|
44
|
-
fields?: string | undefined;
|
|
45
9
|
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
10
|
+
findContents(title: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
getUsers(userRoleId: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getPermissions(userRoleId: string, params?: Partial<typeof defaultSortParams>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
46
13
|
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
47
|
-
updateSingleFields(id: string,
|
|
48
|
-
published?: boolean | null;
|
|
49
|
-
note?: string | null;
|
|
50
|
-
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
updateSingleFields(id: string, body?: Partial<typeof defaultUpdateFields>): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
51
15
|
}
|
|
52
16
|
//# sourceMappingURL=jdUserRole.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdUserRole.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdUserRole.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdUserRole.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdUserRole.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEnH,qBAAa,UAAW,SAAQ,UAAU;IACzC,aAAa,EAAC,GAAG,EAAE,CAAM;gBAEb,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAK1B,WAAW,CAAC,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAK1D,gBAAgB,CAAC,MAAM,GAAE,cAAc,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAAQ;IAMzE,YAAY,CAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAO3E,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAK3E,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,OAAO,iBAAiB,CAAM;IAKjF,OAAO,CAAC,EAAE,EAAC,MAAM;IAIjB,kBAAkB,CAAC,EAAE,EAAC,MAAM,EAAE,IAAI,GAAE,OAAO,CAAC,OAAO,mBAAmB,CAAM;CAGlF"}
|
|
@@ -1,72 +1,70 @@
|
|
|
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.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("", "")) {
|
|
14
32
|
super(connectorInfo);
|
|
15
|
-
this.permissionIds = [];
|
|
16
33
|
this.setData(data);
|
|
17
34
|
}
|
|
18
35
|
setData(data) {
|
|
19
36
|
super.setData(data);
|
|
20
|
-
this.permissionIds = Utils.getArray(data, 'permission_ids');
|
|
37
|
+
this.permissionIds = utils_1.Utils.getArray(data, 'permission_ids');
|
|
21
38
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
26
|
-
return yield this.getRelative('/modules/user/user_roles', params);
|
|
27
|
-
});
|
|
39
|
+
async getContents(params = {}) {
|
|
40
|
+
const queryParams = this.getSortParameters(params);
|
|
41
|
+
return await this.getRelative('/modules/user/user_roles', queryParams);
|
|
28
42
|
}
|
|
29
|
-
paginateContents(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
params['guard_name'] = guard_name;
|
|
35
|
-
params['published'] = published === null ? '' : published ? 'true' : 'false';
|
|
36
|
-
return yield this.getRelative('/modules/user/user_roles/paginate', params);
|
|
37
|
-
});
|
|
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);
|
|
38
48
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
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);
|
|
44
53
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
54
|
+
// 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);
|
|
50
58
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return
|
|
54
|
-
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
55
|
-
params['name'] = name;
|
|
56
|
-
params['published'] = published;
|
|
57
|
-
return yield this.getRelative('/modules/user/user_roles/find', params);
|
|
58
|
-
});
|
|
59
|
+
async getPermissions(userRoleId, params = {}) {
|
|
60
|
+
const queryParams = this.getSortParameters(params);
|
|
61
|
+
return await this.getRelative(`/modules/user/user_roles/${userRoleId}/permissions`, queryParams);
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
return yield this.getRelative(`/modules/user/user_roles/${id}`, {});
|
|
64
|
-
});
|
|
63
|
+
async getInfo(id) {
|
|
64
|
+
return await this.getRelative(`/modules/user/user_roles/${id}`, {});
|
|
65
65
|
}
|
|
66
|
-
updateSingleFields(
|
|
67
|
-
return
|
|
68
|
-
const body = { published, note };
|
|
69
|
-
return yield this.postRelative(`/modules/user/user_roles/${id}/update/single_fields`, body);
|
|
70
|
-
});
|
|
66
|
+
async updateSingleFields(id, body = {}) {
|
|
67
|
+
return await this.postRelative(`/modules/user/user_roles/${id}/update/single_fields`, body);
|
|
71
68
|
}
|
|
72
69
|
}
|
|
70
|
+
exports.JDUserRole = JDUserRole;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { Utils } from "./utils";
|
|
11
|
-
import { JDUser } from "../models/modules/user/jdUser";
|
|
12
|
-
export class BrowserUtils {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserUtils = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const jdUser_1 = require("../models/modules/user/jdUser");
|
|
6
|
+
class BrowserUtils {
|
|
13
7
|
// Set a session storage item
|
|
14
8
|
static setSessionItem(key, val) {
|
|
15
9
|
if (typeof window !== "undefined") {
|
|
@@ -59,49 +53,48 @@ export class BrowserUtils {
|
|
|
59
53
|
return event.cookies.get(key);
|
|
60
54
|
}
|
|
61
55
|
static setServerUserSessionInfo(event, dataRaw) {
|
|
62
|
-
const token = Utils.getString(dataRaw, "token");
|
|
63
|
-
const dataUser = Utils.getObject(dataRaw, "user");
|
|
56
|
+
const token = utils_1.Utils.getString(dataRaw, "token");
|
|
57
|
+
const dataUser = utils_1.Utils.getObject(dataRaw, "user");
|
|
64
58
|
//Save to browser session for long term user log in
|
|
65
59
|
this.setCookie(event, "token", token);
|
|
66
|
-
this.setCookie(event, "user", Utils.objectToString(dataUser));
|
|
60
|
+
this.setCookie(event, "user", utils_1.Utils.objectToString(dataUser));
|
|
67
61
|
// console.log(`Saving token in locals: ${token}`);
|
|
68
62
|
// Locals are a way to register trusted, server-side, per-request state only
|
|
69
63
|
event.locals.token = token;
|
|
70
64
|
// Save to svelte session as well
|
|
71
|
-
return new JDUser(dataUser);
|
|
65
|
+
return new jdUser_1.JDUser(dataUser);
|
|
72
66
|
}
|
|
73
67
|
// Data coming back with the API response in {user, token} format from new user registration or authentication
|
|
74
68
|
static setUserSessionInfo(dataRaw) {
|
|
75
|
-
const token = Utils.getString(dataRaw, "token");
|
|
76
|
-
const dataUser = Utils.getObject(dataRaw, "user");
|
|
69
|
+
const token = utils_1.Utils.getString(dataRaw, "token");
|
|
70
|
+
const dataUser = utils_1.Utils.getObject(dataRaw, "user");
|
|
77
71
|
//Save to browser session for long term user log in
|
|
78
72
|
this.setSessionItem("token", token);
|
|
79
|
-
this.setSessionItem("user", Utils.objectToString(dataUser));
|
|
73
|
+
this.setSessionItem("user", utils_1.Utils.objectToString(dataUser));
|
|
80
74
|
//Also save in client-side global variables
|
|
81
75
|
globalThis.xAuthToken = token;
|
|
82
76
|
globalThis.userData = dataUser;
|
|
83
77
|
// Save to svelte session as well
|
|
84
|
-
return new JDUser(dataUser);
|
|
78
|
+
return new jdUser_1.JDUser(dataUser);
|
|
85
79
|
}
|
|
86
80
|
static getUserFromSession() {
|
|
87
81
|
const strUserInfo = this.getSessionItem("user");
|
|
88
82
|
if (strUserInfo != null) {
|
|
89
|
-
const dataUser = Utils.stringToObject(strUserInfo);
|
|
90
|
-
return new JDUser(dataUser);
|
|
83
|
+
const dataUser = utils_1.Utils.stringToObject(strUserInfo);
|
|
84
|
+
return new jdUser_1.JDUser(dataUser);
|
|
91
85
|
}
|
|
92
|
-
return new JDUser({});
|
|
86
|
+
return new jdUser_1.JDUser({});
|
|
93
87
|
}
|
|
94
88
|
static isLoggedIn() {
|
|
95
89
|
const token = this.getSessionItem("token");
|
|
96
90
|
return token != null;
|
|
97
91
|
}
|
|
98
|
-
static logout(connectorInfo) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return response.statusCode == 200;
|
|
105
|
-
});
|
|
92
|
+
static async logout(connectorInfo) {
|
|
93
|
+
const response = await new jdUser_1.JDUser({}, connectorInfo).logout();
|
|
94
|
+
// Force to log out no matter what
|
|
95
|
+
this.setSessionItem("token", "");
|
|
96
|
+
this.setSessionItem("user", "");
|
|
97
|
+
return response.statusCode == 200;
|
|
106
98
|
}
|
|
107
99
|
}
|
|
100
|
+
exports.BrowserUtils = BrowserUtils;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CryptoUtils = void 0;
|
|
7
|
+
const hmac_sha256_1 = __importDefault(require("crypto-js/hmac-sha256"));
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
class CryptoUtils {
|
|
4
10
|
// Generate hash string to sign to communicate with the server to allow from this client only
|
|
5
11
|
static generateBeforeHashString(paramsArray) {
|
|
6
12
|
const curUserId = globalThis.userId;
|
|
7
13
|
const curApplicationId = globalThis.applicationId;
|
|
8
14
|
const curAppSecret = globalThis.appSecret;
|
|
9
|
-
if (!Utils.isset(curUserId) || !Utils.isset(curApplicationId) || !Utils.isset(curAppSecret)) {
|
|
15
|
+
if (!utils_1.Utils.isset(curUserId) || !utils_1.Utils.isset(curApplicationId) || !utils_1.Utils.isset(curAppSecret)) {
|
|
10
16
|
console.log("You need to initialise the required parameters before hashing!");
|
|
11
17
|
return;
|
|
12
18
|
}
|
|
@@ -17,9 +23,10 @@ export class CryptoUtils {
|
|
|
17
23
|
// console.log(`Cur Application Id: ${curApplicationId.get()}`);
|
|
18
24
|
// console.log(`Cur User Id: ${userId}`);
|
|
19
25
|
// console.log(`Before Hash: ${strBeforeHash}`);
|
|
20
|
-
return
|
|
26
|
+
return (0, hmac_sha256_1.default)(strBeforeHash, curAppSecret).toString();
|
|
21
27
|
}
|
|
22
28
|
static generateHash(strMessage, secret) {
|
|
23
|
-
return
|
|
29
|
+
return (0, hmac_sha256_1.default)(strMessage, secret).toString();
|
|
24
30
|
}
|
|
25
31
|
}
|
|
32
|
+
exports.CryptoUtils = CryptoUtils;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateUtils = void 0;
|
|
4
|
+
class DateUtils {
|
|
2
5
|
//////////////////////////////////////////////////////////////////////////////////
|
|
3
6
|
// Example usage:
|
|
4
7
|
// const targetDate = new Date('2023-08-01T12:00:00Z');
|
|
@@ -47,3 +50,4 @@ export class DateUtils {
|
|
|
47
50
|
return Date.now().toString();
|
|
48
51
|
}
|
|
49
52
|
}
|
|
53
|
+
exports.DateUtils = DateUtils;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.globalEventEmitter = void 0;
|
|
1
4
|
////////////////////////////////////////////////////////////////
|
|
2
5
|
// Listening for an event
|
|
3
6
|
// import { globalEventEmitter } from "./GlobalEventEmitter";
|
|
@@ -7,9 +10,7 @@
|
|
|
7
10
|
// });
|
|
8
11
|
////////////////////////////////////////////////////////////////
|
|
9
12
|
class GlobalEventEmitter {
|
|
10
|
-
|
|
11
|
-
this.events = {};
|
|
12
|
-
}
|
|
13
|
+
events = {};
|
|
13
14
|
// Register an event listener
|
|
14
15
|
on(event, handler) {
|
|
15
16
|
if (!this.events[event]) {
|
|
@@ -31,4 +32,4 @@ class GlobalEventEmitter {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
// Export a singleton instance
|
|
34
|
-
|
|
35
|
+
exports.globalEventEmitter = new GlobalEventEmitter();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.capitalize = capitalize;
|
|
4
|
+
exports.lowercase = lowercase;
|
|
5
|
+
function capitalize(text) {
|
|
2
6
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
3
7
|
}
|
|
4
|
-
|
|
8
|
+
function lowercase(text) {
|
|
5
9
|
return text.toLowerCase();
|
|
6
10
|
}
|