jd_platform_sdk 0.0.3 → 0.0.6
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 +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/sdk/configs/jdConfig.d.ts.map +1 -1
- package/dist/sdk/configs/jdConfig.js +0 -2
- package/dist/sdk/jdConnector.d.ts +2 -2
- package/dist/sdk/jdConnector.d.ts.map +1 -1
- package/dist/sdk/jdConnector.js +1 -1
- package/dist/sdk/models/jdApplication.d.ts +6 -6
- package/dist/sdk/models/jdApplication.d.ts.map +1 -1
- package/dist/sdk/models/jdApplication.js +9 -11
- package/dist/sdk/models/jdResource.d.ts +17 -10
- package/dist/sdk/models/jdResource.d.ts.map +1 -1
- package/dist/sdk/models/jdResource.js +50 -20
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts +15 -0
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdCity.js +50 -0
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts +10 -0
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdCountry.js +42 -0
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts +14 -0
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdDistrict.js +44 -0
- package/dist/sdk/models/modules/geolocation/jdState.d.ts +15 -0
- package/dist/sdk/models/modules/geolocation/jdState.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdState.js +50 -0
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts +6 -5
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts.map +1 -1
- package/dist/sdk/models/modules/karaoke/jdKtvShop.js +13 -11
- package/dist/sdk/models/modules/music/jdSong.d.ts +85 -0
- package/dist/sdk/models/modules/music/jdSong.d.ts.map +1 -0
- package/dist/sdk/models/modules/music/jdSong.js +140 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts +35 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdPermission.js +73 -0
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts +17 -0
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdSessionUser.js +62 -0
- package/dist/sdk/models/modules/user/jdUser.d.ts +18 -0
- package/dist/sdk/models/modules/user/jdUser.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdUser.js +71 -0
- package/dist/sdk/utilities/browserUtils.d.ts +15 -4
- package/dist/sdk/utilities/browserUtils.d.ts.map +1 -1
- package/dist/sdk/utilities/browserUtils.js +102 -21
- package/dist/sdk/utilities/utils.d.ts +22 -10
- package/dist/sdk/utilities/utils.d.ts.map +1 -1
- package/dist/sdk/utilities/utils.js +87 -3
- package/package.json +4 -1
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDState extends JDResource {
|
|
13
|
+
get localisedCountryTitle() { return globalThis.language == 'en' ? this.countryTitleEN : this.countryTitleMM; }
|
|
14
|
+
get countryTitleEN() { return Utils.getString(Utils.getObject(this.country, 'title'), 'en'); }
|
|
15
|
+
get countryTitleMM() { return Utils.getString(Utils.getObject(this.country, 'title'), 'mm'); }
|
|
16
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
17
|
+
super(connectorInfo);
|
|
18
|
+
this.countryId = "";
|
|
19
|
+
this.country = {};
|
|
20
|
+
this.setData(data);
|
|
21
|
+
}
|
|
22
|
+
setData(data) {
|
|
23
|
+
super.setData(data);
|
|
24
|
+
this.countryId = Utils.getString(data, "country_id");
|
|
25
|
+
this.country = Utils.getObject(data, "country");
|
|
26
|
+
}
|
|
27
|
+
getStates() {
|
|
28
|
+
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
29
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
30
|
+
return yield this.getRelative('/modules/geolocation/states', params);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
findStates(title_1) {
|
|
34
|
+
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
35
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
36
|
+
return yield this.getRelative('/modules/geolocation/states/find', params);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
getCities(stateId_1) {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (stateId, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
41
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
42
|
+
return yield this.getRelative(`/modules/geolocation/states/${stateId}/cities`, params);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
getInfo(id) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return yield this.getRelative(`/modules/geolocation/states/${id}`, {});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import JDResource from "../../jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
2
|
export declare class JDKtvShop extends JDResource {
|
|
3
3
|
licenseKey: string;
|
|
4
4
|
activationsCount: number;
|
|
@@ -22,9 +22,10 @@ export declare class JDKtvShop extends JDResource {
|
|
|
22
22
|
get districtTitleEN(): string;
|
|
23
23
|
get districtTitleMM(): string;
|
|
24
24
|
expiryDate: Date;
|
|
25
|
-
constructor(data
|
|
26
|
-
setData(data:
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
26
|
+
setData(data: Record<string, any>): void;
|
|
27
|
+
getKtvShops(isRecommended?: boolean, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
28
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
29
|
+
updateInfo(id: string, title: Record<string, string>, slug: string, expiryDate: Date): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=jdKtvShop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdKtvShop.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/karaoke/jdKtvShop.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdKtvShop.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/karaoke/jdKtvShop.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,SAAU,SAAQ,UAAU;IACxC,UAAU,EAAC,MAAM,CAAM;IAC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M,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAC,IAAI;CAGxF"}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import JDResource from "../../jdResource";
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
11
|
import { Utils } from "../../../utilities/utils";
|
|
12
12
|
export class JDKtvShop extends JDResource {
|
|
13
13
|
get localisedAddress() {
|
|
@@ -22,8 +22,8 @@ export class JDKtvShop extends JDResource {
|
|
|
22
22
|
get cityTitleMM() { return Utils.getString(Utils.getObject(this.city, 'title'), 'mm'); }
|
|
23
23
|
get districtTitleEN() { return Utils.getString(Utils.getObject(this.district, 'title'), 'en'); }
|
|
24
24
|
get districtTitleMM() { return Utils.getString(Utils.getObject(this.district, 'title'), 'mm'); }
|
|
25
|
-
constructor(data) {
|
|
26
|
-
super(
|
|
25
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
26
|
+
super(connectorInfo);
|
|
27
27
|
this.licenseKey = "";
|
|
28
28
|
this.activationsCount = 0;
|
|
29
29
|
this.maxActivationsCount = 0;
|
|
@@ -55,21 +55,23 @@ export class JDKtvShop extends JDResource {
|
|
|
55
55
|
this.district = Utils.getObject(data, "district");
|
|
56
56
|
this.expiryDate = Utils.getDate(data, "expiry_date");
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
getKtvShops() {
|
|
59
59
|
return __awaiter(this, arguments, void 0, function* (isRecommended = false, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
60
|
-
const params =
|
|
60
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
61
61
|
if (Utils.isset(isRecommended)) {
|
|
62
62
|
params['recommended'] = isRecommended ? 'true' : 'false';
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
const response = yield JDResource.getRelative('/modules/karaoke/ktv_shops', params);
|
|
66
|
-
return response;
|
|
64
|
+
return yield this.getRelative('/modules/karaoke/ktv_shops', params);
|
|
67
65
|
});
|
|
68
66
|
}
|
|
69
|
-
|
|
67
|
+
getInfo(id) {
|
|
70
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
return yield this.getRelative(`/modules/karaoke/ktv_shops/${id}`, {});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
updateInfo(id, title, slug, expiryDate) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return yield this.getRelative(`/modules/karaoke/ktv_shops/${id}`, {});
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDSong extends JDResource {
|
|
3
|
+
albumId: string;
|
|
4
|
+
mainArtistId: string;
|
|
5
|
+
languageId: string;
|
|
6
|
+
isrcCode: string;
|
|
7
|
+
note: string;
|
|
8
|
+
hasLyrics: boolean;
|
|
9
|
+
hasKaraoke: boolean;
|
|
10
|
+
recommended: boolean;
|
|
11
|
+
promoted: boolean;
|
|
12
|
+
durationSeconds: number;
|
|
13
|
+
channelsCount: number;
|
|
14
|
+
tracksCount: number;
|
|
15
|
+
releasedYear: number;
|
|
16
|
+
keywords: Record<string, any>;
|
|
17
|
+
cdnStorage: Record<string, any>;
|
|
18
|
+
songValidation: Record<string, any>;
|
|
19
|
+
album: Record<string, any>;
|
|
20
|
+
mainArtist: Record<string, any>;
|
|
21
|
+
language: Record<string, any>;
|
|
22
|
+
checksums: Record<string, any>;
|
|
23
|
+
artists: any[];
|
|
24
|
+
composers: any[];
|
|
25
|
+
bands: any[];
|
|
26
|
+
artistIds: any[];
|
|
27
|
+
composerIds: any[];
|
|
28
|
+
bandIds: any[];
|
|
29
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
30
|
+
setData(data: Record<string, any>): void;
|
|
31
|
+
getSongs({ titleEn, keywordEn, published, recommended, hasLyrics, hasKaraoke, languageId, year, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
32
|
+
titleEn?: string | undefined;
|
|
33
|
+
keywordEn?: string | undefined;
|
|
34
|
+
published?: string | undefined;
|
|
35
|
+
recommended?: string | undefined;
|
|
36
|
+
hasLyrics?: string | undefined;
|
|
37
|
+
hasKaraoke?: string | undefined;
|
|
38
|
+
languageId?: string | undefined;
|
|
39
|
+
year?: string | undefined;
|
|
40
|
+
orderBy?: string | undefined;
|
|
41
|
+
order?: string | undefined;
|
|
42
|
+
pageIndex?: number | undefined;
|
|
43
|
+
countPerPage?: number | undefined;
|
|
44
|
+
fields?: string | undefined;
|
|
45
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
46
|
+
paginateSongs({ titleEN, titleMM, keywordsEN, keywordsMM, published, recommended, hasLyrics, hasKaraoke, wrongTracks, languageId, year, note, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
47
|
+
titleEN?: string | null;
|
|
48
|
+
titleMM?: string | null;
|
|
49
|
+
keywordsEN?: string | null;
|
|
50
|
+
keywordsMM?: string | null;
|
|
51
|
+
published?: boolean | null;
|
|
52
|
+
recommended?: boolean | null;
|
|
53
|
+
hasLyrics?: boolean | null;
|
|
54
|
+
hasKaraoke?: boolean | null;
|
|
55
|
+
wrongTracks?: boolean | null;
|
|
56
|
+
languageId?: string | null;
|
|
57
|
+
year?: number | null;
|
|
58
|
+
note?: string | null;
|
|
59
|
+
orderBy?: string | null;
|
|
60
|
+
order?: string | null;
|
|
61
|
+
pageIndex?: number | null;
|
|
62
|
+
countPerPage?: number | null;
|
|
63
|
+
fields?: string | null;
|
|
64
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
65
|
+
findSongs({ title, published, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
66
|
+
title?: string | undefined;
|
|
67
|
+
published?: string | undefined;
|
|
68
|
+
orderBy?: string | undefined;
|
|
69
|
+
order?: string | undefined;
|
|
70
|
+
pageIndex?: number | undefined;
|
|
71
|
+
countPerPage?: number | undefined;
|
|
72
|
+
fields?: string | undefined;
|
|
73
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
74
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
75
|
+
updateInfo(id: string, title: Record<string, string>, slug: string, expiryDate: Date): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
76
|
+
publish(id: string, val: boolean): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
77
|
+
updateSingleFields(id: string, { published, has_karaoke, has_lyrics, recommended, note }: {
|
|
78
|
+
published?: boolean | null;
|
|
79
|
+
has_karaoke?: boolean | null;
|
|
80
|
+
has_lyrics?: boolean | null;
|
|
81
|
+
recommended?: boolean | null;
|
|
82
|
+
note?: string | null;
|
|
83
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=jdSong.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdSong.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/music/jdSong.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,MAAO,SAAQ,UAAU;IACrC,OAAO,EAAC,MAAM,CAAM;IACpB,YAAY,EAAC,MAAM,CAAM;IACzB,UAAU,EAAC,MAAM,CAAM;IACvB,QAAQ,EAAC,MAAM,CAAM;IACrB,IAAI,EAAC,MAAM,CAAM;IAEjB,SAAS,EAAC,OAAO,CAAS;IAC1B,UAAU,EAAC,OAAO,CAAS;IAC3B,WAAW,EAAC,OAAO,CAAS;IAC5B,QAAQ,EAAC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CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAC,IAAI;IAIlF,OAAO,CAAC,EAAE,EAAC,MAAM,EAAE,GAAG,EAAC,OAAO;IAK9B,kBAAkB,CAAC,EAAE,EAAC,MAAM,EAAE,EAAC,SAAiB,EAAE,WAAkB,EAAE,UAAiB,EAAE,WAAkB,EAAE,IAAU,EAAC,EAAE;QAC/H,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC3B,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC5B,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB;CAID"}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDSong extends JDResource {
|
|
13
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
14
|
+
super(connectorInfo);
|
|
15
|
+
this.albumId = "";
|
|
16
|
+
this.mainArtistId = "";
|
|
17
|
+
this.languageId = "";
|
|
18
|
+
this.isrcCode = "";
|
|
19
|
+
this.note = "";
|
|
20
|
+
this.hasLyrics = false;
|
|
21
|
+
this.hasKaraoke = false;
|
|
22
|
+
this.recommended = false;
|
|
23
|
+
this.promoted = false;
|
|
24
|
+
this.durationSeconds = 0;
|
|
25
|
+
this.channelsCount = 0;
|
|
26
|
+
this.tracksCount = 0;
|
|
27
|
+
this.releasedYear = 0;
|
|
28
|
+
this.keywords = {};
|
|
29
|
+
this.cdnStorage = {};
|
|
30
|
+
this.songValidation = {};
|
|
31
|
+
this.album = {};
|
|
32
|
+
this.mainArtist = {};
|
|
33
|
+
this.language = {};
|
|
34
|
+
this.checksums = {};
|
|
35
|
+
this.artists = [];
|
|
36
|
+
this.composers = [];
|
|
37
|
+
this.bands = [];
|
|
38
|
+
this.artistIds = [];
|
|
39
|
+
this.composerIds = [];
|
|
40
|
+
this.bandIds = [];
|
|
41
|
+
this.setData(data);
|
|
42
|
+
}
|
|
43
|
+
setData(data) {
|
|
44
|
+
super.setData(data);
|
|
45
|
+
this.albumId = Utils.getString(data, "album_id");
|
|
46
|
+
this.mainArtistId = Utils.getString(data, "main_artist_id");
|
|
47
|
+
this.languageId = Utils.getString(data, "language_id");
|
|
48
|
+
this.isrcCode = Utils.getString(data, "isrc_code");
|
|
49
|
+
this.note = Utils.getString(data, "note");
|
|
50
|
+
this.hasLyrics = Utils.getBoolean(data, "has_lyrics");
|
|
51
|
+
this.hasKaraoke = Utils.getBoolean(data, "has_karaoke");
|
|
52
|
+
this.recommended = Utils.getBoolean(data, "recommended");
|
|
53
|
+
this.promoted = Utils.getBoolean(data, "promoted");
|
|
54
|
+
this.durationSeconds = Utils.getInteger(data, "duration_seconds");
|
|
55
|
+
this.channelsCount = Utils.getInteger(data, "channels_count");
|
|
56
|
+
this.tracksCount = Utils.getInteger(data, "tracks_count");
|
|
57
|
+
this.releasedYear = Utils.getInteger(data, "released_year");
|
|
58
|
+
this.keywords = Utils.getObject(data, "keywords");
|
|
59
|
+
this.cdnStorage = Utils.getObject(data, "cdn_storage");
|
|
60
|
+
this.songValidation = Utils.getObject(data, "song_validation");
|
|
61
|
+
this.album = Utils.getObject(data, "album");
|
|
62
|
+
this.mainArtist = Utils.getObject(data, "main_artist");
|
|
63
|
+
this.language = Utils.getObject(data, "language");
|
|
64
|
+
this.checksums = Utils.getObject(data, "checksums");
|
|
65
|
+
this.artists = Utils.getArray(data, "artists");
|
|
66
|
+
this.composers = Utils.getArray(data, "composers");
|
|
67
|
+
this.bands = Utils.getArray(data, "bands");
|
|
68
|
+
this.artistIds = Utils.getArray(data, "artist_ids");
|
|
69
|
+
this.composerIds = Utils.getArray(data, "composer_ids");
|
|
70
|
+
this.bandIds = Utils.getArray(data, "band_ids");
|
|
71
|
+
}
|
|
72
|
+
// Filter songs
|
|
73
|
+
getSongs(_a) {
|
|
74
|
+
return __awaiter(this, arguments, void 0, function* ({ titleEn = "", keywordEn = "", published = "", recommended = "", hasLyrics = "", hasKaraoke = "", languageId = "", year = "", orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '' }) {
|
|
75
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
76
|
+
//Addon filters
|
|
77
|
+
params['title.en'] = titleEn;
|
|
78
|
+
params['keyword.en'] = keywordEn;
|
|
79
|
+
params['published'] = published;
|
|
80
|
+
params['recommended'] = recommended;
|
|
81
|
+
params['has_lyrics'] = hasLyrics;
|
|
82
|
+
params['has_karaoke'] = hasKaraoke;
|
|
83
|
+
params['language_id'] = languageId;
|
|
84
|
+
params['year'] = year;
|
|
85
|
+
return yield this.getRelative('/modules/music/songs', params);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
paginateSongs(_a) {
|
|
89
|
+
return __awaiter(this, arguments, void 0, function* ({ titleEN = "", titleMM = "", keywordsEN = "", keywordsMM = "", published = null, recommended = null, hasLyrics = null, hasKaraoke = null, wrongTracks = null, languageId = "", year = null, note = "", orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '' }) {
|
|
90
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
91
|
+
//Addon filters
|
|
92
|
+
params['title.en'] = titleEN;
|
|
93
|
+
params['title.mm'] = titleMM;
|
|
94
|
+
params['keyword.en'] = keywordsEN;
|
|
95
|
+
params['keyword.mm'] = keywordsMM;
|
|
96
|
+
params['published'] = published === null ? '' : published ? 'true' : 'false';
|
|
97
|
+
params['recommended'] = recommended === null ? '' : recommended ? 'true' : 'false';
|
|
98
|
+
params['has_lyrics'] = hasLyrics === null ? '' : hasLyrics ? 'true' : 'false';
|
|
99
|
+
params['has_karaoke'] = hasKaraoke === null ? '' : hasKaraoke ? 'true' : 'false';
|
|
100
|
+
params['wrong_tracks'] = wrongTracks === null ? '' : wrongTracks ? 'true' : 'false';
|
|
101
|
+
params['language_id'] = languageId;
|
|
102
|
+
params['note'] = note;
|
|
103
|
+
params['year'] = year === null ? '' : year;
|
|
104
|
+
// console.log('paginateSongs')
|
|
105
|
+
// console.log(params);
|
|
106
|
+
return yield this.getRelative('/modules/music/songs/paginate', params);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
findSongs(_a) {
|
|
110
|
+
return __awaiter(this, arguments, void 0, function* ({ title = "", published = "", orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '' }) {
|
|
111
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
112
|
+
//Addon filters
|
|
113
|
+
params['title'] = title;
|
|
114
|
+
params['published'] = published;
|
|
115
|
+
return yield this.getRelative('/modules/music/songs/find', params);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
getInfo(id) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
return yield this.getRelative(`/modules/music/songs/${id}`, {});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
updateInfo(id, title, slug, expiryDate) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
return yield this.getRelative(`/modules/music/songs/${id}`, {});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
publish(id, val) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
const body = { published: val ? 'true' : 'false' };
|
|
131
|
+
return yield this.postRelative(`/modules/music/songs/${id}/publish`, body);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
updateSingleFields(id_1, _a) {
|
|
135
|
+
return __awaiter(this, arguments, void 0, function* (id, { published = false, has_karaoke = false, has_lyrics = false, recommended = false, note = null }) {
|
|
136
|
+
const body = { published, has_karaoke, has_lyrics, recommended, note };
|
|
137
|
+
return yield this.postRelative(`/modules/music/songs/${id}/update/single_fields`, body);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDPermission extends JDResource {
|
|
3
|
+
name: string;
|
|
4
|
+
guardName: string;
|
|
5
|
+
descriptionPlain: string;
|
|
6
|
+
userPermissionGroupId: string;
|
|
7
|
+
userPermissionGroup: Record<string, any>;
|
|
8
|
+
roleIds: any[];
|
|
9
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
10
|
+
setData(data: Record<string, any>): void;
|
|
11
|
+
getPermissionsCount(): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getEstimatedPermissionsCount(): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
getPermissions({ name, guardName, published, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
guardName?: string | undefined;
|
|
16
|
+
published?: string | undefined;
|
|
17
|
+
orderBy?: string | undefined;
|
|
18
|
+
order?: string | undefined;
|
|
19
|
+
pageIndex?: number | undefined;
|
|
20
|
+
countPerPage?: number | undefined;
|
|
21
|
+
fields?: string | undefined;
|
|
22
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
23
|
+
findPermissions({ name, published, orderBy, order, pageIndex, countPerPage, fields }: {
|
|
24
|
+
name?: string | undefined;
|
|
25
|
+
published?: string | undefined;
|
|
26
|
+
orderBy?: string | undefined;
|
|
27
|
+
order?: string | undefined;
|
|
28
|
+
pageIndex?: number | undefined;
|
|
29
|
+
countPerPage?: number | undefined;
|
|
30
|
+
fields?: string | undefined;
|
|
31
|
+
}): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
32
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
33
|
+
publish(id: string, published: boolean): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=jdPermission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdPermission.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdPermission.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,EAAC,MAAM,CAAM;IACjB,SAAS,EAAC,MAAM,CAAM;IACtB,gBAAgB,EAAC,MAAM,CAAM;IAC7B,qBAAqB,EAAC,MAAM,CAAM;IAClC,mBAAmB,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC7C,OAAO,EAAE,GAAG,EAAE,CAAM;gBAER,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAU1B,mBAAmB;IAInB,4BAA4B;IAK5B,cAAc,CAAC,EAAC,IAAS,EAAE,SAAc,EAAE,SAAc,EAAE,OAAsB,EAAE,KAAc,EAAE,SAAa,EAAE,YAAiB,EAAE,MAAW,EAAC;;;;;;;;;KAAA;IASjJ,eAAe,CAAC,EAAC,IAAS,EAAE,SAAc,EAAE,OAAsB,EAAE,KAAc,EAAE,SAAa,EAAE,YAAiB,EAAE,MAAW,EAAC;;;;;;;;KAAA;IAQlI,OAAO,CAAC,EAAE,EAAC,MAAM;IAIjB,OAAO,CAAC,EAAE,EAAC,MAAM,EAAE,SAAS,EAAC,OAAO;CAI1C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDPermission extends JDResource {
|
|
13
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
14
|
+
super(connectorInfo);
|
|
15
|
+
this.name = "";
|
|
16
|
+
this.guardName = "";
|
|
17
|
+
this.descriptionPlain = "";
|
|
18
|
+
this.userPermissionGroupId = "";
|
|
19
|
+
this.userPermissionGroup = {};
|
|
20
|
+
this.roleIds = [];
|
|
21
|
+
this.setData(data);
|
|
22
|
+
}
|
|
23
|
+
setData(data) {
|
|
24
|
+
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
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getEstimatedPermissionsCount() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.getRelative('/modules/user/permissions/estimated_count', {});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Filter the permissions with custom searches which may slow bet get better accuracy
|
|
43
|
+
getPermissions(_a) {
|
|
44
|
+
return __awaiter(this, arguments, void 0, function* ({ name = "", guardName = "", published = "", orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '' }) {
|
|
45
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
46
|
+
params['name'] = name;
|
|
47
|
+
params['guard_name'] = guardName;
|
|
48
|
+
params['published'] = published;
|
|
49
|
+
return yield this.getRelative('/modules/user/permissions', params);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Find the permission with text search index which is a fast way to search the whole word
|
|
53
|
+
findPermissions(_a) {
|
|
54
|
+
return __awaiter(this, arguments, void 0, function* ({ name = "", published = "", orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '' }) {
|
|
55
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
56
|
+
params['name'] = name;
|
|
57
|
+
params['published'] = published;
|
|
58
|
+
return yield this.getRelative('/modules/user/permissions/find', params);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Get the user information
|
|
62
|
+
getInfo(id) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return yield this.getRelative(`/modules/user/permissions/${id}`, {});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
publish(id, published) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const body = { published: published ? 'true' : 'false' };
|
|
70
|
+
return yield this.postRelative(`/modules/user/permissions/${id}/publish`, body);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDSessionUser extends JDResource {
|
|
3
|
+
cloudSessionId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
username: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
searchTokens: any[];
|
|
8
|
+
get isLoggedIn(): boolean;
|
|
9
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
10
|
+
setData(data: Record<string, any>): void;
|
|
11
|
+
findSessionUsers(name: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
logout(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=jdSessionUser.d.ts.map
|
|
@@ -0,0 +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;AAE3D,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,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAS1B,gBAAgB,CAAC,IAAI,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAMnH,YAAY,CAAC,QAAQ,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAK7C,QAAQ,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAKlF,MAAM,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;IAMhF,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
});
|
|
9
|
+
};
|
|
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("", "")) {
|
|
15
|
+
super(connectorInfo);
|
|
16
|
+
this.cloudSessionId = "";
|
|
17
|
+
this.name = "";
|
|
18
|
+
this.username = "";
|
|
19
|
+
this.phone = "";
|
|
20
|
+
this.searchTokens = [];
|
|
21
|
+
this.setData(data);
|
|
22
|
+
}
|
|
23
|
+
setData(data) {
|
|
24
|
+
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
|
+
findSessionUsers(name_1) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (name, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
33
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
34
|
+
return yield this.getRelative('/modules/user/session_users/find', params);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// TODO: Sign the API calls to only be able to call from this client only
|
|
38
|
+
authenticate(username, password) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const body = { username, password };
|
|
41
|
+
return yield this.postRelative('/modules/user/session_users/authenticate', body);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
register(name, username, email, phone, password) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const body = { name, username, email, phone, password };
|
|
47
|
+
return yield this.postRelative('/modules/user/session_users/register', body);
|
|
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
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Get the user information
|
|
57
|
+
getInfo(id) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return yield this.getRelative(`/modules/user/session_users/${id}`, {});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDUser extends JDResource {
|
|
3
|
+
name: string;
|
|
4
|
+
username: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
email: string;
|
|
7
|
+
searchTokens: any[];
|
|
8
|
+
get isLoggedIn(): boolean;
|
|
9
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
10
|
+
setData(data: Record<string, any>): void;
|
|
11
|
+
getUsers(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
findUsers(name: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
|
+
logout(): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=jdUser.d.ts.map
|
|
@@ -0,0 +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;AAE3D,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,QAAQ,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK9F,SAAS,CAAC,IAAI,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAM5G,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;IAKN,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|