@30nama/sdk 1.8.6 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/api/index.js +81 -97
  2. package/dist/api/index.js.map +1 -1
  3. package/dist/api/request.js +56 -70
  4. package/dist/api/request.js.map +1 -1
  5. package/dist/api/services/biography.js +41 -67
  6. package/dist/api/services/biography.js.map +1 -1
  7. package/dist/api/services/index.js +7 -23
  8. package/dist/api/services/index.js.map +1 -1
  9. package/dist/api/services/news.js +41 -67
  10. package/dist/api/services/news.js.map +1 -1
  11. package/dist/api/services/operator.js +201 -281
  12. package/dist/api/services/operator.js.map +1 -1
  13. package/dist/api/services/soundtrack.js +17 -34
  14. package/dist/api/services/soundtrack.js.map +1 -1
  15. package/dist/api/services/stream.js +51 -77
  16. package/dist/api/services/stream.js.map +1 -1
  17. package/dist/api/services/support.js +41 -67
  18. package/dist/api/services/support.js.map +1 -1
  19. package/dist/api/services/videoContent.js +291 -389
  20. package/dist/api/services/videoContent.js.map +1 -1
  21. package/dist/api/types.js +1 -2
  22. package/dist/core.js +13 -35
  23. package/dist/core.js.map +1 -1
  24. package/dist/entities/BaseEntity.js +2 -5
  25. package/dist/entities/BaseEntity.js.map +1 -1
  26. package/dist/entities/IArticle.d.ts +0 -4
  27. package/dist/entities/IArticle.js +10 -6
  28. package/dist/entities/IArticle.js.map +1 -1
  29. package/dist/entities/IAttachment.js +1 -2
  30. package/dist/entities/IBiography.js +14 -6
  31. package/dist/entities/IBiography.js.map +1 -1
  32. package/dist/entities/IBoxOffice.js +20 -6
  33. package/dist/entities/IBoxOffice.js.map +1 -1
  34. package/dist/entities/ICollection.js +9 -6
  35. package/dist/entities/ICollection.js.map +1 -1
  36. package/dist/entities/ICollector.js +1 -2
  37. package/dist/entities/IOperator.js +2 -5
  38. package/dist/entities/IOperator.js.map +1 -1
  39. package/dist/entities/IPerson.js +1 -2
  40. package/dist/entities/IRating.js +1 -2
  41. package/dist/entities/ISoundTrack.js +1 -2
  42. package/dist/entities/IStream.js +1 -2
  43. package/dist/entities/ITitle.js +34 -8
  44. package/dist/entities/ITitle.js.map +1 -1
  45. package/dist/entities/IVideoContent.js +26 -6
  46. package/dist/entities/IVideoContent.js.map +1 -1
  47. package/dist/entities/index.js +12 -28
  48. package/dist/entities/index.js.map +1 -1
  49. package/dist/index.js +7 -8
  50. package/dist/index.js.map +1 -1
  51. package/dist/pattern/index.js +10 -9
  52. package/dist/pattern/index.js.map +1 -1
  53. package/package.json +1 -1
package/dist/api/index.js CHANGED
@@ -1,30 +1,18 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.API = void 0;
13
- const actions = require("./services");
14
- const request_1 = require("./request");
1
+ import * as actions from './services';
2
+ import request from './request';
15
3
  const getFastestResponse = (promises) => {
16
4
  const newPromises = promises.map((p) => new Promise((resolve, reject) => p.then((v) => v && resolve(v), reject)));
17
5
  newPromises.push(Promise.all(promises).then(() => false));
18
6
  return Promise.race(newPromises);
19
7
  };
20
8
  // API Module
21
- exports.API = {
9
+ export const API = {
22
10
  actions: {},
23
11
  config: {},
24
12
  setConfig(config) {
25
- this.config = Object.assign(Object.assign({}, this.config), config);
13
+ this.config = { ...this.config, ...config };
26
14
  },
27
- store: () => __awaiter(void 0, void 0, void 0, function* () { }),
15
+ store: async () => { },
28
16
  setAPIStore(storeCallback) {
29
17
  this.store = storeCallback;
30
18
  },
@@ -37,92 +25,88 @@ exports.API = {
37
25
  return;
38
26
  console[type]('[SDK::API]', ...msg);
39
27
  },
40
- useTransferEndpoint(endpoints) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- const checkEndpoint = (host) => __awaiter(this, void 0, void 0, function* () {
28
+ async useTransferEndpoint(endpoints) {
29
+ const checkEndpoint = async (host) => {
30
+ try {
31
+ const testReq = new request('user-video-content/test', { ...this, config: { ...this.config, endpoint: host, requestRetries: 0 } });
32
+ const testRes = await testReq.execute();
33
+ if (!testRes)
34
+ return;
35
+ if (!testRes.success)
36
+ return;
37
+ return host;
38
+ }
39
+ catch { }
40
+ };
41
+ const getFastestEndpoint = (endpoints) => {
42
+ const promises = endpoints.map((endpoint) => checkEndpoint(endpoint.host));
43
+ return getFastestResponse(promises);
44
+ };
45
+ const fastestEndpoint = await getFastestEndpoint(endpoints);
46
+ if (!fastestEndpoint)
47
+ return false;
48
+ this.emmiter('endpointUpdated', fastestEndpoint);
49
+ this.config.endpoint = fastestEndpoint;
50
+ return true;
51
+ },
52
+ async initialize() {
53
+ try {
54
+ // Node 1
55
+ const getEndpointsFromAPI = async () => {
43
56
  try {
44
- const testReq = new request_1.default('user-video-content/test', Object.assign(Object.assign({}, this), { config: Object.assign(Object.assign({}, this.config), { endpoint: host, requestRetries: 0 }) }));
45
- const testRes = yield testReq.execute();
46
- if (!testRes)
47
- return;
48
- if (!testRes.success)
49
- return;
50
- return host;
57
+ // TODO: Implement this
58
+ // const getEndpointsReq = new request('endpoint', this)
59
+ // const endpointsRes = await (getEndpointsReq.execute() as Promise<BaseResponse<Endpoints> | undefined>)
60
+ // return endpointsRes?. as { location: string; host: string }[]
61
+ return [];
62
+ }
63
+ catch (err) {
64
+ this.log('warn', '(getEndpointsFromAPI)', err);
51
65
  }
52
- catch (_a) { }
53
- });
54
- const getFastestEndpoint = (endpoints) => {
55
- const promises = endpoints.map((endpoint) => checkEndpoint(endpoint.host));
56
- return getFastestResponse(promises);
57
66
  };
58
- const fastestEndpoint = yield getFastestEndpoint(endpoints);
59
- if (!fastestEndpoint)
60
- return false;
61
- this.emmiter('endpointUpdated', fastestEndpoint);
62
- this.config.endpoint = fastestEndpoint;
63
- return true;
64
- });
65
- },
66
- initialize() {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- try {
69
- // Node 1
70
- const getEndpointsFromAPI = () => __awaiter(this, void 0, void 0, function* () {
71
- try {
72
- // TODO: Implement this
73
- // const getEndpointsReq = new request('endpoint', this)
74
- // const endpointsRes = await (getEndpointsReq.execute() as Promise<BaseResponse<Endpoints> | undefined>)
75
- // return endpointsRes?. as { location: string; host: string }[]
76
- return [];
77
- }
78
- catch (err) {
79
- this.log('warn', '(getEndpointsFromAPI)', err);
80
- }
81
- });
82
- // // Node 2
83
- // const getEndpointsFromGithub = async (): Promise<Endpoints | undefined> => {
84
- // try {
85
- // const api = create({ baseURL: 'https://raw.githubusercontent.com/EternalC0der/30nama/main/sdk-endpoint.json?t=' + new Date().getTime() })
86
- // const res = await api.get<Endpoints>('')
87
- // if (!res.ok) throw res.originalError
88
- // if (!res.data) throw 'Response is falsey'
89
- // return res.data
90
- // } catch (err) {
91
- // this.log('warn', '(getEndpointsFromGithub)', err)
92
- // }
93
- // }
94
- // // Node 3
95
- // const getEndpointsFromArvanCloud = async (): Promise<Endpoints | undefined> => {
96
- // try {
97
- // const api = create({ baseURL: 'https://api-json.s3.ir-thr-at1.arvanstorage.ir/response.json' })
98
- // const res = await api.get<Endpoints>('')
99
- // if (!res.ok) throw res.originalError
100
- // if (!res.data) throw 'Response is falsey'
101
- // return res.data
102
- // } catch (err) {
103
- // this.log('warn', '(getEndpointsFromArvanCloud)', err)
104
- // }
105
- // }
106
- // Try current endpoint, if it's valid, return true
107
- const testReq = new request_1.default('user-video-content/test', this);
108
- const testRes = yield testReq.execute(undefined, 1000 * 15);
109
- if (testRes === null || testRes === void 0 ? void 0 : testRes.success)
110
- return true;
111
- // TODO: Utilize all 3 nodes !!!
112
- // const endpoints = await getFastestResponse<Endpoints>([getEndpointsFromAPI(), getEndpointsFromGithub(), getEndpointsFromArvanCloud()])
113
- const endpoints = yield getFastestResponse([getEndpointsFromAPI()]);
114
- if (!endpoints || !(yield this.useTransferEndpoint(endpoints)))
115
- throw 'Failed to initialize API';
67
+ // // Node 2
68
+ // const getEndpointsFromGithub = async (): Promise<Endpoints | undefined> => {
69
+ // try {
70
+ // const api = create({ baseURL: 'https://raw.githubusercontent.com/EternalC0der/30nama/main/sdk-endpoint.json?t=' + new Date().getTime() })
71
+ // const res = await api.get<Endpoints>('')
72
+ // if (!res.ok) throw res.originalError
73
+ // if (!res.data) throw 'Response is falsey'
74
+ // return res.data
75
+ // } catch (err) {
76
+ // this.log('warn', '(getEndpointsFromGithub)', err)
77
+ // }
78
+ // }
79
+ // // Node 3
80
+ // const getEndpointsFromArvanCloud = async (): Promise<Endpoints | undefined> => {
81
+ // try {
82
+ // const api = create({ baseURL: 'https://api-json.s3.ir-thr-at1.arvanstorage.ir/response.json' })
83
+ // const res = await api.get<Endpoints>('')
84
+ // if (!res.ok) throw res.originalError
85
+ // if (!res.data) throw 'Response is falsey'
86
+ // return res.data
87
+ // } catch (err) {
88
+ // this.log('warn', '(getEndpointsFromArvanCloud)', err)
89
+ // }
90
+ // }
91
+ // Try current endpoint, if it's valid, return true
92
+ const testReq = new request('user-video-content/test', this);
93
+ const testRes = await testReq.execute(undefined, 1000 * 15);
94
+ if (testRes?.success)
116
95
  return true;
117
- }
118
- catch (err) {
119
- this.log('warn', err);
120
- return false;
121
- }
122
- });
96
+ // TODO: Utilize all 3 nodes !!!
97
+ // const endpoints = await getFastestResponse<Endpoints>([getEndpointsFromAPI(), getEndpointsFromGithub(), getEndpointsFromArvanCloud()])
98
+ const endpoints = await getFastestResponse([getEndpointsFromAPI()]);
99
+ if (!endpoints || !(await this.useTransferEndpoint(endpoints)))
100
+ throw 'Failed to initialize API';
101
+ return true;
102
+ }
103
+ catch (err) {
104
+ this.log('warn', err);
105
+ return false;
106
+ }
123
107
  }
124
108
  };
125
109
  // Add all actions to API object and apply API object as first argument
126
110
  for (const [key, value] of Object.entries(actions))
127
- exports.API.actions[key] = value.bind(exports.API);
111
+ API.actions[key] = value.bind(API);
128
112
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAqC;AACrC,uCAA+B;AAa/B,MAAM,kBAAkB,GAAG,CAAI,QAAwB,EAAc,EAAE;IACnE,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;IAC/H,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACzD,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAQ,CAAA;AAC3C,CAAC,CAAA;AAED,aAAa;AACA,QAAA,GAAG,GAAG;IACf,OAAO,EAAE,EAAoB;IAE7B,MAAM,EAAE,EAAY;IACpB,SAAS,CAAC,MAAuB;QAC7B,IAAI,CAAC,MAAM,mCAAQ,IAAI,CAAC,MAAM,GAAK,MAAM,CAAE,CAAA;IAC/C,CAAC;IAED,KAAK,EAAE,GAAS,EAAE,kDAAE,CAAC,CAAA;IACrB,WAAW,CAAC,aAAgD;QACxD,IAAI,CAAC,KAAK,GAAG,aAAa,CAAA;IAC9B,CAAC;IAED,OAAO,EAAE,CAAC,QAAyB,EAAE,QAAgB,EAAE,EAAE,GAAE,CAAC;IAC5D,aAAa,CAAC,eAA2D;QACrE,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C3D,IAAI,OAAO,EAAE,OAAO;gBAAE,OAAO,IAAI,CAAA;YAEjC,gCAAgC;YAChC,yIAAyI;YACzI,MAAM,SAAS,GAAG,MAAM,kBAAkB,CAAY,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAA;YAC9E,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBAAE,MAAM,0BAA0B,CAAA;YAChG,OAAO,IAAI,CAAA;QACf,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;YACrB,OAAO,KAAK,CAAA;QAChB,CAAC;IACL,CAAC;CASgB,CAAA;AAErB,uEAAuE;AACvE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAAG,GAAG,CAAC,OAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAU,CAAC,CAAA"}
@@ -1,21 +1,16 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const apisauce_1 = require("apisauce");
13
- const QueryString = require("qs");
14
- const core_1 = require("../core");
15
- class default_1 {
1
+ import { create } from 'apisauce';
2
+ import QueryString from 'qs';
3
+ import { delay } from '../core';
4
+ export default class {
5
+ overrideSession;
6
+ method = 'post';
7
+ config;
8
+ actionUrl;
9
+ servicePath = 'videocontent';
10
+ emmiter;
11
+ store;
12
+ log;
16
13
  constructor(actionUrl, instance, overrideSession) {
17
- this.method = 'post';
18
- this.servicePath = 'videocontent';
19
14
  const { config, emmiter, store, log } = instance;
20
15
  this.config = config;
21
16
  this.actionUrl = actionUrl;
@@ -27,61 +22,53 @@ class default_1 {
27
22
  buildUrl() {
28
23
  return `${this.config.endpoint}/${this.servicePath}/${this.actionUrl}`;
29
24
  }
30
- buildHeaders() {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- const sessionToken = this.overrideSession || (yield this.store()) || '';
33
- const headers = {
34
- 'Content-Type': 'application/x-www-form-urlencoded',
35
- Authorization: sessionToken ? `Bearer ${sessionToken}` : '',
36
- 'c-version': this.config.version,
37
- // 'c-bypass-limits': this.config.debug ? 'true' : '',
38
- // 'c-return-requests': this.config.debug ? 'true' : '',
39
- 'c-language': this.config.language,
40
- 'user-agent': this.config.userAgent
41
- };
42
- // remove indexes with falsy values
43
- for (const key in headers)
44
- if (!headers[key])
45
- delete headers[key];
46
- return headers;
47
- });
25
+ async buildHeaders() {
26
+ const sessionToken = this.overrideSession || (await this.store()) || '';
27
+ const headers = {
28
+ 'Content-Type': 'application/x-www-form-urlencoded',
29
+ Authorization: sessionToken ? `Bearer ${sessionToken}` : '',
30
+ 'c-version': this.config.version,
31
+ 'c-language': this.config.language,
32
+ 'user-agent': this.config.userAgent
33
+ };
34
+ // remove indexes with falsy values
35
+ for (const key in headers)
36
+ if (!headers[key])
37
+ delete headers[key];
38
+ return headers;
48
39
  }
49
- sendRequest(body_1) {
50
- return __awaiter(this, arguments, void 0, function* (body, retry = 1) {
51
- try {
52
- const response = yield (0, apisauce_1.create)({ baseURL: this.config.endpoint + `/${this.servicePath}`, headers: yield this.buildHeaders() })[this.method](this.actionUrl, this.method === 'get' ? body : QueryString.stringify(body));
53
- if (!response.ok)
54
- throw response.originalError;
55
- this.log('info', `Request to ${this.buildUrl()} was successful.`);
56
- this.emmiter('requestSuccess');
57
- return response.data;
40
+ async sendRequest(body, retry = 1) {
41
+ try {
42
+ const response = await create({ baseURL: this.config.endpoint + `/${this.servicePath}`, headers: await this.buildHeaders() })[this.method](this.actionUrl, this.method === 'get' ? body : QueryString.stringify(body));
43
+ if (!response.ok)
44
+ throw response.originalError;
45
+ this.log('info', `Request to ${this.buildUrl()} was successful.`);
46
+ this.emmiter('requestSuccess');
47
+ return response.data;
48
+ }
49
+ catch (error) {
50
+ this.log('warn', `Request to ${this.buildUrl()} failed:\n`, error.message || error);
51
+ this.emmiter('requestFail');
52
+ if (!this.config.requestRetries)
53
+ return error?.data;
54
+ if (retry >= this.config.requestRetries) {
55
+ this.log('error', `Request to ${this.buildUrl()} failed ${retry} times. Terminating request retry.`);
56
+ this.emmiter('terminateRequestRetry');
57
+ return error?.data;
58
58
  }
59
- catch (error) {
60
- this.log('warn', `Request to ${this.buildUrl()} failed:\n`, error.message || error);
61
- this.emmiter('requestFail');
62
- if (!this.config.requestRetries)
63
- return error === null || error === void 0 ? void 0 : error.data;
64
- if (retry >= this.config.requestRetries) {
65
- this.log('error', `Request to ${this.buildUrl()} failed ${retry} times. Terminating request retry.`);
66
- this.emmiter('terminateRequestRetry');
67
- return error === null || error === void 0 ? void 0 : error.data;
68
- }
69
- yield (0, core_1.delay)(1000);
70
- return yield this.sendRequest(body, retry + 1);
71
- }
72
- });
59
+ await delay(1000);
60
+ return await this.sendRequest(body, retry + 1);
61
+ }
73
62
  }
74
- execute(body, timeout) {
75
- return __awaiter(this, void 0, void 0, function* () {
76
- const responsePromise = this.sendRequest(body);
77
- if (!timeout)
78
- return yield responsePromise;
79
- const timeoutPromise = (0, core_1.delay)(timeout);
80
- const response = Promise.race([responsePromise, timeoutPromise]);
81
- const result = yield response;
82
- if (result)
83
- return result;
84
- });
63
+ async execute(body, timeout) {
64
+ const responsePromise = this.sendRequest(body);
65
+ if (!timeout)
66
+ return await responsePromise;
67
+ const timeoutPromise = delay(timeout);
68
+ const response = Promise.race([responsePromise, timeoutPromise]);
69
+ const result = await response;
70
+ if (result)
71
+ return result;
85
72
  }
86
73
  withService(servicePath) {
87
74
  this.servicePath = servicePath;
@@ -92,5 +79,4 @@ class default_1 {
92
79
  return this;
93
80
  }
94
81
  }
95
- exports.default = default_1;
96
82
  //# sourceMappingURL=request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAiC;AACjC,kCAAkC;AAClC,kCAA+B;AAO/B;IASI,YAAY,SAAiB,EAAE,QAAa,EAAE,eAAwB;QAP9D,WAAM,GAAkB,MAAM,CAAA;QAG9B,gBAAW,GAAG,cAAc,CAAA;QAKhC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAA;QAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAClB,CAAC;IAEO,QAAQ;QACZ,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,EAAE,CAAA;IAC1E,CAAC;IAEa,YAAY;;YACtB,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAA;YACvE,MAAM,OAAO,GAAG;gBACZ,cAAc,EAAE,mCAAmC;gBACnD,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,UAAU,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC3D,WAAW,EAAE,IAAI,C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(thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.biographyAddToFavorites = biographyAddToFavorites;
13
- exports.biographyRemoteFromFavorites = biographyRemoteFromFavorites;
14
- exports.biographyFavorites = biographyFavorites;
15
- exports.biographyPersonDetails = biographyPersonDetails;
16
- exports.biographyPersonsList = biographyPersonsList;
17
- const request_1 = require("../request");
1
+ import request from '../request';
18
2
  const servicePath = 'biography';
19
- function biographyAddToFavorites(person_id) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const This = this;
22
- This.log('info', 'Running action: biographyAddToFavorites');
23
- const req = new request_1.default(`biography/addtofavorites`, this);
24
- req.withService(servicePath);
25
- req.withMethod('get');
26
- const response = (yield req.execute({ person_id }));
27
- return response;
28
- });
3
+ export async function biographyAddToFavorites(person_id) {
4
+ const This = this;
5
+ This.log('info', 'Running action: biographyAddToFavorites');
6
+ const req = new request(`biography/addtofavorites`, this);
7
+ req.withService(servicePath);
8
+ req.withMethod('get');
9
+ const response = (await req.execute({ person_id }));
10
+ return response;
29
11
  }
30
- function biographyRemoteFromFavorites(person_id) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- const This = this;
33
- This.log('info', 'Running action: biographyAddToFavorites');
34
- const req = new request_1.default(`biography/deletefromfavorites`, this);
35
- req.withService(servicePath);
36
- req.withMethod('get');
37
- const response = (yield req.execute({ person_id }));
38
- return response;
39
- });
12
+ export async function biographyRemoteFromFavorites(person_id) {
13
+ const This = this;
14
+ This.log('info', 'Running action: biographyAddToFavorites');
15
+ const req = new request(`biography/deletefromfavorites`, this);
16
+ req.withService(servicePath);
17
+ req.withMethod('get');
18
+ const response = (await req.execute({ person_id }));
19
+ return response;
40
20
  }
41
- function biographyFavorites() {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- const This = this;
44
- This.log('info', 'Running action: biographyFavorites');
45
- const req = new request_1.default(`biography/favorites`, this);
46
- req.withService(servicePath);
47
- req.withMethod('get');
48
- const response = (yield req.execute());
49
- return response;
50
- });
21
+ export async function biographyFavorites() {
22
+ const This = this;
23
+ This.log('info', 'Running action: biographyFavorites');
24
+ const req = new request(`biography/favorites`, this);
25
+ req.withService(servicePath);
26
+ req.withMethod('get');
27
+ const response = (await req.execute());
28
+ return response;
51
29
  }
52
- function biographyPersonDetails(person_id) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- const This = this;
55
- This.log('info', 'Running action: biographyPersonDetails');
56
- const req = new request_1.default(`biography/person/detail`, this);
57
- req.withService(servicePath);
58
- req.withMethod('get');
59
- const response = (yield req.execute({ person_id }));
60
- return response;
61
- });
30
+ export async function biographyPersonDetails(person_id) {
31
+ const This = this;
32
+ This.log('info', 'Running action: biographyPersonDetails');
33
+ const req = new request(`biography/person/detail`, this);
34
+ req.withService(servicePath);
35
+ req.withMethod('get');
36
+ const response = (await req.execute({ person_id }));
37
+ return response;
62
38
  }
63
- function biographyPersonsList(page, gender, profession, search_text) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const This = this;
66
- This.log('info', 'Running action: biographyPersonsList');
67
- const req = new request_1.default(`biography/persons/list`, this);
68
- req.withService(servicePath);
69
- req.withMethod('get');
70
- const response = (yield req.execute({ page, gender, profession, search_text }));
71
- return response;
72
- });
39
+ export async function biographyPersonsList(page, gender, profession, search_text) {
40
+ const This = this;
41
+ This.log('info', 'Running action: biographyPersonsList');
42
+ const req = new request(`biography/persons/list`, this);
43
+ req.withService(servicePath);
44
+ req.withMethod('get');
45
+ const response = (await req.execute({ page, gender, profession, search_text }));
46
+ return response;
73
47
  }
74
48
  //# sourceMappingURL=biography.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"biography.js","sourceRoot":"","sources":["../../../src/api/services/biography.ts"],"names":[],"mappings":";;;;;;;;;;;AASA,0DASC;AAED,oEASC;AAED,gDASC;AAED,wDASC;AAED,oDASC;AA7DD,wCAAgC;AAGhC,MAAM,WAAW,GAAG,WAAW,CAAA;AAK/B,SAAsB,uBAAuB,CAAY,SAAiB;;QACtE,MAAM,IAAI,GAAG,IAAW,CAAA;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,yCAAyC,CAAC,CAAA;QAC3D,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAA;QACzD,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QAC5B,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAErB,MAAM,QAAQ,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAmC,CAAA;QACrF,OAAO,QAAQ,CAAA;IACnB,CAAC;CAAA;AAED,SAAsB,4BAA4B,CAAY,SAAiB;;QAC3E,MAAM,IAAI,GAAG,IAAW,CAAA;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,yCAAyC,CAAC,CAAA;QAC3D,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAA;QAC9D,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QAC5B,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QAErB,MAAM,QAAQ,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAmC,CAAA;QACrF,OAAO,QAAQ,CAAA;IACnB,CAAC;CAAA;AAED,SAAsB,kBAAkB;;QACpC,MAAM,IAAI,GAAG,IAAW,CAAA;QACxB,IAAI,CAAC,GAAG,CAAC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AE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAkD,CAAA;IAChI,OAAO,QAAQ,CAAA;AACnB,CAAC"}
@@ -1,24 +1,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 __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("./videoContent"), exports);
18
- __exportStar(require("./news"), exports);
19
- __exportStar(require("./biography"), exports);
20
- __exportStar(require("./soundtrack"), exports);
21
- __exportStar(require("./support"), exports);
22
- __exportStar(require("./stream"), exports);
23
- __exportStar(require("./operator"), exports);
1
+ export * from './videoContent';
2
+ export * from './news';
3
+ export * from './biography';
4
+ export * from './soundtrack';
5
+ export * from './support';
6
+ export * from './stream';
7
+ export * from './operator';
24
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,yCAAsB;AACtB,8CAA2B;AAC3B,+CAA4B;AAC5B,4CAAyB;AACzB,2CAAwB;AACxB,6CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}