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
package/dist/index.js
CHANGED
|
@@ -1,36 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./sdk/jdConnector"), exports);
|
|
18
|
+
__exportStar(require("./sdk/jdSdk"), exports);
|
|
19
|
+
__exportStar(require("./sdk/configs/jdConfig"), exports);
|
|
4
20
|
// export * from "./sdk/extensions/extensions";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
__exportStar(require("./sdk/utilities/browserUtils"), exports);
|
|
22
|
+
__exportStar(require("./sdk/utilities/cryptoUtils"), exports);
|
|
23
|
+
__exportStar(require("./sdk/utilities/dateUtils"), exports);
|
|
24
|
+
__exportStar(require("./sdk/utilities/globalEventHandler"), exports);
|
|
25
|
+
__exportStar(require("./sdk/utilities/stringUtils"), exports);
|
|
26
|
+
__exportStar(require("./sdk/utilities/utils"), exports);
|
|
11
27
|
// Generic Models for different possible modules for all platforms
|
|
12
|
-
|
|
13
|
-
|
|
28
|
+
__exportStar(require("./sdk/models/jdResource"), exports);
|
|
29
|
+
__exportStar(require("./sdk/models/jdApplication"), exports);
|
|
14
30
|
//Dashboard
|
|
15
|
-
|
|
31
|
+
__exportStar(require("./sdk/models/modules/dashboard/jdDashboardCombinations"), exports);
|
|
16
32
|
//User
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
__exportStar(require("./sdk/models/modules/user/jdUser"), exports);
|
|
34
|
+
__exportStar(require("./sdk/models/modules/user/jdUserRole"), exports);
|
|
35
|
+
__exportStar(require("./sdk/models/modules/user/jdSessionUser"), exports);
|
|
36
|
+
__exportStar(require("./sdk/models/modules/user/jdPermission"), exports);
|
|
37
|
+
__exportStar(require("./sdk/models/modules/user/jdPermissionGroup"), exports);
|
|
22
38
|
//Karaoke
|
|
23
|
-
|
|
39
|
+
__exportStar(require("./sdk/models/modules/karaoke/jdKtvShop"), exports);
|
|
24
40
|
//Radio Station
|
|
25
|
-
|
|
41
|
+
__exportStar(require("./sdk/models/modules/radio_station/jdRadioStation"), exports);
|
|
26
42
|
//Music
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
__exportStar(require("./sdk/models/modules/music/jdAlbum"), exports);
|
|
44
|
+
__exportStar(require("./sdk/models/modules/music/jdSong"), exports);
|
|
45
|
+
__exportStar(require("./sdk/models/modules/music/jdArtist"), exports);
|
|
46
|
+
__exportStar(require("./sdk/models/modules/music/jdComposer"), exports);
|
|
47
|
+
__exportStar(require("./sdk/models/modules/music/jdMusicCombinations"), exports);
|
|
32
48
|
//Geolocation
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
__exportStar(require("./sdk/models/modules/geolocation/jdCountry"), exports);
|
|
50
|
+
__exportStar(require("./sdk/models/modules/geolocation/jdState"), exports);
|
|
51
|
+
__exportStar(require("./sdk/models/modules/geolocation/jdCity"), exports);
|
|
52
|
+
__exportStar(require("./sdk/models/modules/geolocation/jdDistrict"), exports);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
// Singleton class to be able to call from everywhere with minified compatible
|
|
2
|
-
|
|
4
|
+
class JDConfig {
|
|
5
|
+
static _instance;
|
|
3
6
|
//Singleton constructor shouldn't be called directly and use JDConfig.instance
|
|
4
7
|
constructor() { }
|
|
5
8
|
static get instance() {
|
|
@@ -36,3 +39,4 @@ export default class JDConfig {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
42
|
+
exports.default = JDConfig;
|
package/dist/sdk/jdConnector.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
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
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.JDConnector = exports.SimpleResponse = void 0;
|
|
7
|
+
const globalEventHandler_1 = require("./utilities/globalEventHandler");
|
|
8
|
+
const utils_1 = require("./utilities/utils");
|
|
9
|
+
const jdConfig_1 = __importDefault(require("./configs/jdConfig"));
|
|
10
|
+
class SimpleResponse {
|
|
11
|
+
body;
|
|
12
|
+
statusCode;
|
|
14
13
|
constructor(body, statusCode) {
|
|
15
14
|
this.body = body;
|
|
16
15
|
this.statusCode = statusCode;
|
|
@@ -19,68 +18,59 @@ export class SimpleResponse {
|
|
|
19
18
|
return this.body == '' || this.statusCode == -1;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
21
|
+
exports.SimpleResponse = SimpleResponse;
|
|
22
|
+
class JDConnector {
|
|
23
|
+
async httpGetDirectAsync(url, headers, params, bShowErrorMessage, bForceRefresh = true, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
24
|
+
return await this.httpASyncCallDirect(0 /* JDHttpType.GET */, url, params, headers, {}, bShowErrorMessage, true, false, bForceRefresh, bAutoHideBusyIndicator, overrideVersion);
|
|
27
25
|
}
|
|
28
|
-
httpPostDirectAsync(
|
|
29
|
-
return
|
|
30
|
-
return yield this.httpASyncCallDirect(1 /* JDHttpType.POST */, url, {}, headers, body, bShowErrorMessage, true, false, true, bAutoHideBusyIndicator, overrideVersion);
|
|
31
|
-
});
|
|
26
|
+
async httpPostDirectAsync(url, headers, body, bShowErrorMessage, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
27
|
+
return await this.httpASyncCallDirect(1 /* JDHttpType.POST */, url, {}, headers, body, bShowErrorMessage, true, false, true, bAutoHideBusyIndicator, overrideVersion);
|
|
32
28
|
}
|
|
33
|
-
httpGetRelativeAsync(
|
|
34
|
-
return
|
|
35
|
-
return yield this.httpASyncCallDirect(0 /* JDHttpType.GET */, url, params, headers, {}, bShowErrorMessage, false, true, bForceRefresh, bAutoHideBusyIndicator, overrideVersion);
|
|
36
|
-
});
|
|
29
|
+
async httpGetRelativeAsync(url, headers, params, bShowErrorMessage, bForceRefresh = false, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
30
|
+
return await this.httpASyncCallDirect(0 /* JDHttpType.GET */, url, params, headers, {}, bShowErrorMessage, false, true, bForceRefresh, bAutoHideBusyIndicator, overrideVersion);
|
|
37
31
|
}
|
|
38
|
-
httpPostRelativeAsync(
|
|
39
|
-
return
|
|
40
|
-
return yield this.httpASyncCallDirect(1 /* JDHttpType.POST */, url, {}, headers, body, bShowErrorMessage, false, true, false, bAutoHideBusyIndicator, overrideVersion);
|
|
41
|
-
});
|
|
32
|
+
async httpPostRelativeAsync(url, headers, body, bShowErrorMessage, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
33
|
+
return await this.httpASyncCallDirect(1 /* JDHttpType.POST */, url, {}, headers, body, bShowErrorMessage, false, true, false, bAutoHideBusyIndicator, overrideVersion);
|
|
42
34
|
}
|
|
43
|
-
httpASyncCallDirect(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
finalResponse = new SimpleResponse(responseText, response.status);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
//Request with GET/HEAD method cannot have body.
|
|
65
|
-
const response = yield fetch(finalURL, {
|
|
66
|
-
method: 'GET',
|
|
67
|
-
headers: headers
|
|
68
|
-
});
|
|
69
|
-
const responseText = yield response.text();
|
|
70
|
-
finalResponse = new SimpleResponse(responseText, response.status);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (ex) {
|
|
74
|
-
console.log(ex);
|
|
75
|
-
finalResponse = new SimpleResponse(finalURL, 403);
|
|
35
|
+
async httpASyncCallDirect(httpType, url, params, headers, body, bShowErrorMessage, bBuildParams, bRelativeURL = true, bForceRefresh = true, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
36
|
+
const finalURL = this.buildURL(httpType, url, params, true, bRelativeURL);
|
|
37
|
+
// console.log(bRelativeURL);
|
|
38
|
+
// console.log(`Final URL: ${finalURL}`);
|
|
39
|
+
//Only for debugging purposes only
|
|
40
|
+
if (globalThis.bForceRefreshGetRequests) {
|
|
41
|
+
bForceRefresh = true;
|
|
42
|
+
}
|
|
43
|
+
let finalResponse = new SimpleResponse('failed', 400);
|
|
44
|
+
try {
|
|
45
|
+
if (httpType == 1 /* JDHttpType.POST */) {
|
|
46
|
+
const response = await fetch(finalURL, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
body: JSON.stringify(body), // string or object
|
|
49
|
+
headers: headers
|
|
50
|
+
});
|
|
51
|
+
const responseText = await response.text();
|
|
52
|
+
finalResponse = new SimpleResponse(responseText, response.status);
|
|
76
53
|
}
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
|
|
54
|
+
else {
|
|
55
|
+
//Request with GET/HEAD method cannot have body.
|
|
56
|
+
const response = await fetch(finalURL, {
|
|
57
|
+
method: 'GET',
|
|
58
|
+
headers: headers
|
|
59
|
+
});
|
|
60
|
+
const responseText = await response.text();
|
|
61
|
+
finalResponse = new SimpleResponse(responseText, response.status);
|
|
80
62
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
}
|
|
64
|
+
catch (ex) {
|
|
65
|
+
console.log(ex);
|
|
66
|
+
finalResponse = new SimpleResponse(finalURL, 403);
|
|
67
|
+
}
|
|
68
|
+
if (bShowErrorMessage && finalResponse.statusCode != 200) {
|
|
69
|
+
//Emit event so that the client can listen and show the actual dialog
|
|
70
|
+
globalEventHandler_1.globalEventEmitter.emit("show_alert_dialog", { type: "error", message: finalResponse.body });
|
|
71
|
+
}
|
|
72
|
+
// console.log(finalResponse);
|
|
73
|
+
return finalResponse;
|
|
84
74
|
}
|
|
85
75
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
|
86
76
|
// ////////////////////////// Connector Utilities Functions //////////////////////////
|
|
@@ -91,7 +81,7 @@ export class JDConnector {
|
|
|
91
81
|
// Build a query parameters from a Map type to URL encoded string like ?event=test&type=001
|
|
92
82
|
buildParams(params) {
|
|
93
83
|
let finalParams = "";
|
|
94
|
-
if (Utils.isNotEmpty(params)) {
|
|
84
|
+
if (utils_1.Utils.isNotEmpty(params)) {
|
|
95
85
|
let index = 0;
|
|
96
86
|
for (const key in params) {
|
|
97
87
|
const val = params[key];
|
|
@@ -110,14 +100,14 @@ export class JDConnector {
|
|
|
110
100
|
//bBuildParams - Whether or not the parameters will be embedded in URL
|
|
111
101
|
//TODO: version should be able to override
|
|
112
102
|
buildURL(httpType, baseUrl, params, bBuildParams = false, bRelativeURL = true, overrideVersion = '') {
|
|
113
|
-
const strHost =
|
|
103
|
+
const strHost = jdConfig_1.default.getAPIHost();
|
|
114
104
|
let url = strHost + baseUrl;
|
|
115
105
|
if (!bRelativeURL) {
|
|
116
106
|
url = baseUrl;
|
|
117
107
|
}
|
|
118
108
|
// //Add hashtable form values for GET request
|
|
119
109
|
if (httpType == 0 /* JDHttpType.GET */) {
|
|
120
|
-
if (Utils.isNotEmpty(params) && bBuildParams) {
|
|
110
|
+
if (utils_1.Utils.isNotEmpty(params) && bBuildParams) {
|
|
121
111
|
url += this.buildParams(params);
|
|
122
112
|
}
|
|
123
113
|
}
|
|
@@ -131,7 +121,7 @@ export class JDConnector {
|
|
|
131
121
|
buildDirectURL(httpType, url, data) {
|
|
132
122
|
//Add hashtable form values for GET request
|
|
133
123
|
if (httpType == 0 /* JDHttpType.GET */) {
|
|
134
|
-
if (Utils.isNotEmpty(data))
|
|
124
|
+
if (utils_1.Utils.isNotEmpty(data))
|
|
135
125
|
url += this.buildParams(data);
|
|
136
126
|
}
|
|
137
127
|
// Replace all instances of "\r\n" with "\n"
|
|
@@ -141,3 +131,4 @@ export class JDConnector {
|
|
|
141
131
|
return url;
|
|
142
132
|
}
|
|
143
133
|
}
|
|
134
|
+
exports.JDConnector = JDConnector;
|
package/dist/sdk/jdSdk.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JDSdk = void 0;
|
|
4
|
+
class JDSdk {
|
|
2
5
|
static initialiseApp(applicationId, appId, appKey, appSecret) {
|
|
3
6
|
globalThis.applicationId = applicationId;
|
|
4
7
|
globalThis.appId = appId;
|
|
@@ -17,3 +20,4 @@ export class JDSdk {
|
|
|
17
20
|
globalThis.userId = userId;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
23
|
+
exports.JDSdk = JDSdk;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import JDResource, { ConnectorInfo } from "./jdResource";
|
|
1
|
+
import JDResource, { ConnectorInfo, defaultSortParams, defaultUpdateFields, PaginateParams } from "./jdResource";
|
|
2
2
|
export declare class JDApplication extends JDResource {
|
|
3
3
|
appId: string;
|
|
4
4
|
appKey: string;
|
|
@@ -12,10 +12,16 @@ export declare class JDApplication extends JDResource {
|
|
|
12
12
|
bundleCodeIos: number;
|
|
13
13
|
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
14
14
|
setData(data: Record<string, any>): void;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
getContents(params?: Partial<typeof defaultSortParams>): Promise<import("../jdConnector").SimpleResponse>;
|
|
16
|
+
paginateContents(params?: PaginateParams & {
|
|
17
|
+
name?: string | null;
|
|
18
|
+
sandbox?: string | null;
|
|
19
|
+
featured?: string | null;
|
|
20
|
+
}): Promise<import("../jdConnector").SimpleResponse>;
|
|
21
|
+
findContents(params?: PaginateParams & {
|
|
22
|
+
title?: string;
|
|
18
23
|
}): Promise<import("../jdConnector").SimpleResponse>;
|
|
19
24
|
getInfo(id: string): Promise<import("../jdConnector").SimpleResponse>;
|
|
25
|
+
updateFields(id: string, body?: Partial<typeof defaultUpdateFields>): Promise<import("../jdConnector").SimpleResponse>;
|
|
20
26
|
}
|
|
21
27
|
//# sourceMappingURL=jdApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdApplication.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdApplication.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"jdApplication.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdApplication.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AAE/G,qBAAa,aAAc,SAAQ,UAAU;IAC5C,KAAK,SAAM;IACX,MAAM,SAAM;IACZ,SAAS,SAAM;IACf,UAAU,EAAE,MAAM,CAAM;IACxB,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,SAAM;IACjB,OAAO,SAAM;IACb,WAAW,SAAK;IAChB,iBAAiB,SAAK;IACtB,aAAa,SAAK;gBAEN,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAe1B,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,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAAM;IAQ1H,YAAY,CAAC,MAAM,GAAE,cAAc,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;KAAO;IAM9D,OAAO,CAAC,EAAE,EAAC,MAAM;IAIjB,YAAY,CAAC,EAAE,EAAC,MAAM,EAAE,IAAI,GAAE,OAAO,CAAC,OAAO,mBAAmB,CAAM;CAG5E"}
|
|
@@ -1,58 +1,84 @@
|
|
|
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.JDApplication = void 0;
|
|
27
|
+
const utils_1 = require("../utilities/utils");
|
|
28
|
+
const jdResource_1 = __importStar(require("./jdResource"));
|
|
29
|
+
class JDApplication extends jdResource_1.default {
|
|
30
|
+
appId = '';
|
|
31
|
+
appKey = '';
|
|
32
|
+
appSecret = '';
|
|
33
|
+
storeLinks = {};
|
|
34
|
+
urls = {};
|
|
35
|
+
orientation = '';
|
|
36
|
+
version = '';
|
|
37
|
+
versionCode = 0;
|
|
38
|
+
bundleCodeAndroid = 0;
|
|
39
|
+
bundleCodeIos = 0;
|
|
40
|
+
constructor(data = {}, connectorInfo = new jdResource_1.ConnectorInfo("", "")) {
|
|
14
41
|
super(connectorInfo);
|
|
15
|
-
this.appId = '';
|
|
16
|
-
this.appKey = '';
|
|
17
|
-
this.appSecret = '';
|
|
18
|
-
this.storeLinks = {};
|
|
19
|
-
this.urls = {};
|
|
20
|
-
this.orientation = '';
|
|
21
|
-
this.version = '';
|
|
22
|
-
this.versionCode = 0;
|
|
23
|
-
this.bundleCodeAndroid = 0;
|
|
24
|
-
this.bundleCodeIos = 0;
|
|
25
42
|
this.setData(data);
|
|
26
43
|
}
|
|
27
44
|
setData(data) {
|
|
28
45
|
super.setData(data);
|
|
29
|
-
this.appId = Utils.getString(data, 'app_id');
|
|
30
|
-
this.appKey = Utils.getString(data, 'app_key');
|
|
31
|
-
this.appSecret = Utils.getString(data, 'app_secret');
|
|
32
|
-
this.orientation = Utils.getString(data, 'orientation');
|
|
33
|
-
this.version = Utils.getString(data, 'version');
|
|
34
|
-
this.storeLinks = Utils.getObject(data, 'store_links');
|
|
35
|
-
this.urls = Utils.getObject(data, 'urls');
|
|
36
|
-
this.versionCode = Utils.getInteger(data, 'version_code');
|
|
37
|
-
this.bundleCodeAndroid = Utils.getInteger(data, 'bundle_code_android');
|
|
38
|
-
this.bundleCodeIos = Utils.getInteger(data, 'bundle_code_ios');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
this.appId = utils_1.Utils.getString(data, 'app_id');
|
|
47
|
+
this.appKey = utils_1.Utils.getString(data, 'app_key');
|
|
48
|
+
this.appSecret = utils_1.Utils.getString(data, 'app_secret');
|
|
49
|
+
this.orientation = utils_1.Utils.getString(data, 'orientation');
|
|
50
|
+
this.version = utils_1.Utils.getString(data, 'version');
|
|
51
|
+
this.storeLinks = utils_1.Utils.getObject(data, 'store_links');
|
|
52
|
+
this.urls = utils_1.Utils.getObject(data, 'urls');
|
|
53
|
+
this.versionCode = utils_1.Utils.getInteger(data, 'version_code');
|
|
54
|
+
this.bundleCodeAndroid = utils_1.Utils.getInteger(data, 'bundle_code_android');
|
|
55
|
+
this.bundleCodeIos = utils_1.Utils.getInteger(data, 'bundle_code_ios');
|
|
56
|
+
}
|
|
57
|
+
async getContents(params = {}) {
|
|
58
|
+
const queryParams = this.getSortParameters(params);
|
|
59
|
+
return await this.getRelative('/dashboard/applications', queryParams);
|
|
60
|
+
}
|
|
61
|
+
async paginateContents(params = {}) {
|
|
62
|
+
const queryParams = this.getSortParameters(params);
|
|
63
|
+
if (params.name)
|
|
64
|
+
queryParams['name'] = params.name;
|
|
65
|
+
if (params.sandbox)
|
|
66
|
+
queryParams['sandbox'] = params.sandbox;
|
|
67
|
+
if (params.featured)
|
|
68
|
+
queryParams['featured'] = params.featured;
|
|
69
|
+
return await this.getRelative('/dashboard/applications', queryParams);
|
|
70
|
+
}
|
|
71
|
+
async findContents(params = {}) {
|
|
72
|
+
const queryParams = this.getSortParameters(params);
|
|
73
|
+
if (params.title)
|
|
74
|
+
queryParams['name'] = params.title;
|
|
75
|
+
return await this.getRelative('/dashboard/applications', queryParams);
|
|
76
|
+
}
|
|
77
|
+
async getInfo(id) {
|
|
78
|
+
return await this.getRelative(`/dashboard/applications/${id}`, {});
|
|
79
|
+
}
|
|
80
|
+
async updateFields(id, body = {}) {
|
|
81
|
+
return await this.postRelative(`/dashboard/applications/${id}/update/single_fields`, body);
|
|
57
82
|
}
|
|
58
83
|
}
|
|
84
|
+
exports.JDApplication = JDApplication;
|
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
import { SimpleResponse } from "../jdConnector";
|
|
2
|
+
export declare const defaultPaginateParams: {
|
|
3
|
+
order_by: string;
|
|
4
|
+
order: string;
|
|
5
|
+
page_index: number;
|
|
6
|
+
count_per_page: number;
|
|
7
|
+
fields: string;
|
|
8
|
+
published: null;
|
|
9
|
+
};
|
|
10
|
+
export declare const defaultSortParams: {
|
|
11
|
+
order_by: string;
|
|
12
|
+
order: string;
|
|
13
|
+
page_index: number;
|
|
14
|
+
count_per_page: number;
|
|
15
|
+
fields: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const defaultUpdateFields: {
|
|
18
|
+
published: null;
|
|
19
|
+
note: string;
|
|
20
|
+
};
|
|
21
|
+
export interface UpdateFields {
|
|
22
|
+
published?: boolean | null;
|
|
23
|
+
note?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
export interface PaginateParams {
|
|
26
|
+
title_en?: string | undefined;
|
|
27
|
+
title_mm?: string | undefined;
|
|
28
|
+
keywords_en?: string | undefined;
|
|
29
|
+
keywords_mm?: string | undefined;
|
|
30
|
+
published?: boolean | null;
|
|
31
|
+
order_by?: string | undefined;
|
|
32
|
+
order?: string | undefined;
|
|
33
|
+
page_index?: number | undefined;
|
|
34
|
+
count_per_page?: number | undefined;
|
|
35
|
+
fields?: string | undefined;
|
|
36
|
+
}
|
|
2
37
|
export declare class ConnectorInfo {
|
|
3
38
|
appId: string;
|
|
4
39
|
token: string;
|
|
@@ -39,8 +74,16 @@ export default class JDResource {
|
|
|
39
74
|
getHashBody(remark?: string): Record<string, any>;
|
|
40
75
|
getDefaultHeaders(): Record<string, any>;
|
|
41
76
|
addDefaultParams(params: Record<string, any>): void;
|
|
42
|
-
getSortParameters(
|
|
77
|
+
getSortParameters(params?: Partial<typeof defaultSortParams> & {
|
|
78
|
+
published?: boolean | null;
|
|
79
|
+
title_en?: string | null;
|
|
80
|
+
title_mm?: string | null;
|
|
81
|
+
keywords_en?: string | null;
|
|
82
|
+
keywords_mm?: string | null;
|
|
83
|
+
note?: string | null;
|
|
84
|
+
}): Record<string, any>;
|
|
43
85
|
static getFieldParameters(fields: string): Record<string, any>;
|
|
86
|
+
paginateContents(params?: PaginateParams): Promise<SimpleResponse>;
|
|
44
87
|
getRelative(relativeUrl: string, params: Record<string, any>, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
45
88
|
postRelative(relativeUrl: string, body: Record<string, any>, bShowErrorToast?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
46
89
|
getDirect(directUrl: string, params: Record<string, any>, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdResource.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAI3D,qBAAa,aAAa;IACzB,KAAK,SAAM;IACX,KAAK,SAAM;gBACC,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM;CAItC;AAED,MAAM,CAAC,OAAO,OAAO,UAAU;IAC9B,IAAI,SAAM;IACP,IAAI,SAAM;IACV,KAAK,SAAK;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACjC,SAAS,EAAC,IAAI,CAAc;IAC5B,SAAS,EAAC,IAAI,CAAc;IAC5B,kBAAkB,SAAM;IAC3B,aAAa,EAAC,aAAa,CAA6B;IAQxD,IAAI,cAAc,IAAG,MAAM,CAAsE;IACjG,IAAI,oBAAoB,IAAG,MAAM,CAA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