vtb-appit 0.0.76 → 0.0.78

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.
@@ -9,7 +9,7 @@ class AppitBaseTransformer {
9
9
  const data = JSON.parse(fs.readFileSync(pth.join(__dirname, '../../assets/travelplan.json'), {encoding: 'utf8' }));
10
10
  this.travelplan = JSON.parse(JSON.stringify(data));
11
11
  this.profile = {};
12
- // lets do it
12
+
13
13
  try {
14
14
  this.token = fs.readFileSync(pth.join(__dirname, '../../assets/token.jwt'), {encoding: 'utf8' });
15
15
  } catch(e) {
@@ -236,75 +236,6 @@ class AppitBaseTransformer {
236
236
  })
237
237
  }
238
238
 
239
- async tsGetDocuments()
240
- {
241
- const jwt = await this.fetchTSJWT();
242
- const tokenDecodablePart = jwt.split('.')[1];
243
- const decoded = JSON.parse(Buffer.from(tokenDecodablePart, 'base64').toString());
244
- const endPath = '/documentdata/';
245
- let documents = await this.tsFetchDocuments(jwt, decoded, endPath);
246
-
247
- let promises = [];
248
- documents.forEach(document => {
249
- promises.push(new Promise(resolve => {
250
- const req = https.request({
251
- headers: {
252
- 'Authorization': jwt
253
- },
254
- hostname: decoded['https://visualtourbuilder.com/app_metadata'].baseUrl.replace('https://', '').replace(/.com\/.*/, '.com').replace(/.app\/.*/, '.app'),
255
- path: decoded['https://visualtourbuilder.com/app_metadata'].baseUrl.replace(/.*?.app/, '').replace(/.*?.com/, '') + endPath + document.id,
256
- method: 'GET'
257
- }, res => {
258
- let chunks = [];
259
- res.on('data', chunk => {
260
- chunks.push(chunk);
261
- });
262
-
263
- res.on('end', () => {
264
- const buffer = Buffer.concat(chunks);
265
-
266
- resolve({
267
- id: document.id,
268
- filename: document.filename,
269
- data: buffer
270
- });
271
- });
272
- });
273
-
274
- req.end();
275
- }));
276
- });
277
-
278
- return Promise.all(promises);
279
- }
280
-
281
- tsFetchDocuments(jwt, decoded, endPath)
282
- {
283
-
284
-
285
- return new Promise(async (resolve) => {
286
- let req = https.request({
287
- headers: {
288
- 'Authorization': jwt
289
- },
290
- hostname: decoded['https://visualtourbuilder.com/app_metadata'].baseUrl.replace('https://', '').replace(/.com\/.*/, '.com').replace(/.app\/.*/, '.app'),
291
- path: decoded['https://visualtourbuilder.com/app_metadata'].baseUrl.replace(/.*?.app/, '').replace(/.*?.com/, '') + endPath,
292
- method: 'GET'
293
- }, (r) => {
294
- let data = '';
295
-
296
- r.on('data', (d) => { data += d; });
297
-
298
- r.on('end', () => {
299
- let res = JSON.parse(data);
300
- console.log('RES', res);
301
- resolve(res);
302
- });
303
- });
304
- req.end();
305
- })
306
- }
307
-
308
239
  async tsGetData()
309
240
  {
310
241
  return new Promise(async (resolve) => {
package/appit.js CHANGED
@@ -72,14 +72,6 @@ class Appit {
72
72
  }
73
73
  }
74
74
 
75
- if(this.options && this.options.tsDocuments) {
76
- try {
77
- this.transformer.tsDocuments = await this.transformer.tsGetDocuments();
78
- } catch(e) {
79
-
80
- }
81
- }
82
-
83
75
  await this.excursion();
84
76
  await this.labels();
85
77
  await this.places();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtb-appit",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {