vtb-appit 0.0.99 → 0.1.1

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.
@@ -186,6 +186,10 @@ class AppitBaseTransformer {
186
186
  const endPath = '/documentdata/';
187
187
  let documents = await this.tsFetchDocuments(jwt, decoded, endPath);
188
188
 
189
+ let baseUrl = (decoded.hasOwnProperty('https://visualtourbuilder.com/app_metadata')) ?
190
+ decoded['https://visualtourbuilder.com/app_metadata'].baseUrl :
191
+ decoded.baseUrl;
192
+
189
193
  let promises = [];
190
194
  documents.forEach(document => {
191
195
  promises.push(new Promise(resolve => {
@@ -193,8 +197,8 @@ class AppitBaseTransformer {
193
197
  headers: {
194
198
  'Authorization': jwt
195
199
  },
196
- hostname: decoded['https://visualtourbuilder.com/app_metadata'].baseUrl.replace('https://', '').replace(/.com\/.*/, '.com').replace(/.app\/.*/, '.app'),
197
- path: decoded['https://visualtourbuilder.com/app_metadata'].baseUrl.replace(/.*?.app/, '').replace(/.*?.com/, '') + endPath + document.id,
200
+ hostname: baseUrl.replace('https://', '').replace(/.com\/.*/, '.com').replace(/.app\/.*/, '.app'),
201
+ path: baseUrl.replace(/.*?.app/, '').replace(/.*?.com/, '') + endPath + document.id,
198
202
  method: 'GET'
199
203
  }, res => {
200
204
  let chunks = [];
package/appit.js CHANGED
@@ -252,12 +252,14 @@ class Appit {
252
252
  }
253
253
  }
254
254
 
255
- let nonExisting = this.difference(Object.values(this.history.ships), Object.values(shipsHistory));
256
- for(let i = 0; i < nonExisting.length; i++) {
257
- await this.deleteShips(nonExisting[i]);
258
- }
255
+ if(this.history.hasOwnProperty('ships')) {
256
+ let nonExisting = this.difference(Object.values(this.history.ships), Object.values(shipsHistory));
257
+ for(let i = 0; i < nonExisting.length; i++) {
258
+ await this.deleteShips(nonExisting[i]);
259
+ }
259
260
 
260
- this.history.ships = shipsHistory;
261
+ this.history.ships = shipsHistory;
262
+ }
261
263
  }
262
264
 
263
265
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtb-appit",
3
- "version": "0.0.99",
3
+ "version": "0.1.01",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {},