rerobe-js-orm 2.6.98 → 2.7.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.
@@ -52,7 +52,7 @@ class ChatRoom extends Base_1.default {
52
52
  type: 'string[]',
53
53
  },
54
54
  {
55
- facet: false,
55
+ facet: true,
56
56
  name: 'userIdsToBeNotified',
57
57
  type: 'string[]',
58
58
  },
@@ -280,6 +280,11 @@ class Order extends Base_1.default {
280
280
  name: 'productIds',
281
281
  type: 'string[]',
282
282
  },
283
+ {
284
+ facet: true,
285
+ name: 'tags',
286
+ type: 'string[]',
287
+ },
283
288
  {
284
289
  facet: true,
285
290
  name: 'productTitles',
@@ -300,7 +305,9 @@ class Order extends Base_1.default {
300
305
  };
301
306
  }
302
307
  toObjForTypesense() {
303
- var _a;
308
+ const image = this.lineItems && this.lineItems[0] && this.lineItems[0].image && this.lineItems[0].image.originalSrc
309
+ ? this.lineItems[0].image.originalSrc
310
+ : 'https://res.cloudinary.com/ribbn/image/fetch/e_blur:1000,o_20,q_50/https://cdn.shopify.com/s/files/1/0261/9686/9172/products/7AC16810-F519-4665-8891-7163EB29FBB7_1000x1000.jpg%3Fv%3D1634827512';
304
311
  const stagedObj = {
305
312
  id: this.utilities.sanitizeString(this.documentId),
306
313
  documentId: this.utilities.sanitizeString(this.documentId),
@@ -308,11 +315,11 @@ class Order extends Base_1.default {
308
315
  createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
309
316
  updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
310
317
  merchantId: this.utilities.sanitizeString(this.merchantId),
311
- image: this.utilities.sanitizeString((_a = this.lineItems[0].image) === null || _a === void 0 ? void 0 : _a.originalSrc),
318
+ image: this.utilities.sanitizeString(image),
312
319
  orderNumber: this.utilities.sanitizeNumber(this.orderNumber),
313
320
  customerName: this.utilities.sanitizeString(this.customerName),
314
321
  customerEmail: this.utilities.sanitizeString(this.email),
315
- totalPrice: this.utilities.sanitizeNumber(this.totalPrice.amount),
322
+ totalPrice: this.utilities.sanitizeNumber(Number(this.totalPrice.amount) - Number(this.totalRefunded.amount)),
316
323
  state: this.utilities.sanitizeString(this.state),
317
324
  financialStatus: this.utilities.sanitizeString(this.financialStatus),
318
325
  fulfillmentStatus: this.utilities.sanitizeString(this.fulfillmentStatus),
@@ -322,6 +329,7 @@ class Order extends Base_1.default {
322
329
  productIds: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.productId)),
323
330
  productTitles: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.title)),
324
331
  productBrands: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.brand)),
332
+ tags: this.utilities.sanitzeStringArr(this.tags),
325
333
  };
326
334
  return stagedObj;
327
335
  }
@@ -164,7 +164,7 @@ class User extends Base_1.default {
164
164
  };
165
165
  return customerInput;
166
166
  }
167
- generateSchemaForTypesense(name = 'dev_users_20220811') {
167
+ generateSchemaForTypesense(name = 'dev_customers_20220811') {
168
168
  return {
169
169
  default_sorting_field: 'createdAtTimestamp',
170
170
  fields: [
@@ -229,7 +229,7 @@ class User extends Base_1.default {
229
229
  type: 'string',
230
230
  },
231
231
  ],
232
- name: 'dev_users_20220811',
232
+ name: 'prod_customers_20220811',
233
233
  };
234
234
  }
235
235
  toObjForTypesense(merchantId) {
@@ -697,5 +697,6 @@ declare type TypesenseOrderObj = {
697
697
  productIds: string[];
698
698
  productTitles: string[];
699
699
  productBrands: string[];
700
+ tags: string[];
700
701
  merchantId: string;
701
702
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.6.98",
3
+ "version": "2.7.1",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",