rerobe-js-orm 2.6.96 → 2.6.99

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.
@@ -4,7 +4,7 @@ const UserFactory_1 = require("./UserFactory");
4
4
  const User_1 = require("../../models/User");
5
5
  class UserFromFormState extends UserFactory_1.default {
6
6
  createUser(props) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
8
8
  const userAttributes = {
9
9
  documentId: ((_a = props.props) === null || _a === void 0 ? void 0 : _a.documentId) || '',
10
10
  uid: ((_b = props.props) === null || _b === void 0 ? void 0 : _b.uid) || '',
@@ -62,6 +62,8 @@ class UserFromFormState extends UserFactory_1.default {
62
62
  ordersCount: ((_t = props.props) === null || _t === void 0 ? void 0 : _t.ordersCount) || 0,
63
63
  amountSpent: ((_u = props.props) === null || _u === void 0 ? void 0 : _u.amountSpent) || 0,
64
64
  emailVerified: ((_v = props.props) === null || _v === void 0 ? void 0 : _v.emailVerified) || false,
65
+ createdAtTimestamp: ((_w = props.props) === null || _w === void 0 ? void 0 : _w.createdAtTimestamp) || 0,
66
+ updatedAtTimestamp: ((_x = props.props) === null || _x === void 0 ? void 0 : _x.updatedAtTimestamp) || 0,
65
67
  };
66
68
  return new User_1.default(Object.assign({}, userAttributes));
67
69
  }
@@ -270,11 +270,21 @@ class Order extends Base_1.default {
270
270
  name: 'paymentType',
271
271
  type: 'string',
272
272
  },
273
+ {
274
+ facet: true,
275
+ name: 'shippingType',
276
+ type: 'string',
277
+ },
273
278
  {
274
279
  facet: true,
275
280
  name: 'productIds',
276
281
  type: 'string[]',
277
282
  },
283
+ {
284
+ facet: true,
285
+ name: 'tags',
286
+ type: 'string[]',
287
+ },
278
288
  {
279
289
  facet: true,
280
290
  name: 'productTitles',
@@ -291,7 +301,7 @@ class Order extends Base_1.default {
291
301
  type: 'string',
292
302
  },
293
303
  ],
294
- name: 'prod_orders_20220809',
304
+ name: 'dev_orders_20220809',
295
305
  };
296
306
  }
297
307
  toObjForTypesense() {
@@ -313,9 +323,11 @@ class Order extends Base_1.default {
313
323
  fulfillmentStatus: this.utilities.sanitizeString(this.fulfillmentStatus),
314
324
  salesChannel: this.utilities.sanitizeString(this.salesChannel),
315
325
  paymentType: this.utilities.sanitizeString(this.paymentType),
326
+ shippingType: this.utilities.sanitizeString(this.shippingType),
316
327
  productIds: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.productId)),
317
328
  productTitles: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.title)),
318
329
  productBrands: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.brand)),
330
+ tags: this.utilities.sanitzeStringArr(this.tags),
319
331
  };
320
332
  return stagedObj;
321
333
  }
@@ -14,6 +14,8 @@ export default class User extends Base {
14
14
  availableCredit: number;
15
15
  createdAt: string | FireStoreTimeStamp;
16
16
  updatedAt: string | FireStoreTimeStamp;
17
+ createdAtTimestamp: number;
18
+ updatedAtTimestamp: number;
17
19
  lastLogin: string;
18
20
  devicePlatform: string;
19
21
  shoppingSessionId: string;
@@ -41,4 +43,14 @@ export default class User extends Base {
41
43
  toCustomerInputObjForAdmin(): any;
42
44
  mergeUserObjWithFirebaseProps(props: UserAttributes): UserAttributes;
43
45
  toCustomerInputObjForRibbn(): RibbnCustomerObj;
46
+ generateSchemaForTypesense(name?: string): {
47
+ default_sorting_field: string;
48
+ fields: {
49
+ facet: boolean;
50
+ name: string;
51
+ type: string;
52
+ }[];
53
+ name: string;
54
+ };
55
+ toObjForTypesense(merchantId: string): TypesenseUserObj;
44
56
  }
@@ -33,6 +33,8 @@ class User extends Base_1.default {
33
33
  };
34
34
  this.availableCredit = (props === null || props === void 0 ? void 0 : props.availableCredit) || 0;
35
35
  this.createdAt = (props === null || props === void 0 ? void 0 : props.createdAt) || '';
36
+ this.createdAtTimestamp = (props === null || props === void 0 ? void 0 : props.createdAtTimestamp) || 0;
37
+ this.updatedAtTimestamp = (props === null || props === void 0 ? void 0 : props.updatedAtTimestamp) || 0;
36
38
  this.updatedAt = (props === null || props === void 0 ? void 0 : props.updatedAt) || '';
37
39
  this.devicePlatform = (props === null || props === void 0 ? void 0 : props.devicePlatform) || '';
38
40
  this.shoppingSessionId = (props === null || props === void 0 ? void 0 : props.shoppingSessionId) || '';
@@ -71,6 +73,8 @@ class User extends Base_1.default {
71
73
  availableCredit: this.availableCredit,
72
74
  createdAt: this.createdAt,
73
75
  updatedAt: this.updatedAt,
76
+ createdAtTimestamp: this.createdAtTimestamp,
77
+ updatedAtTimestamp: this.updatedAtTimestamp,
74
78
  devicePlatform: this.devicePlatform,
75
79
  shoppingSessionId: this.shoppingSessionId,
76
80
  orders: this.orders,
@@ -86,6 +90,8 @@ class User extends Base_1.default {
86
90
  notes: this.notes,
87
91
  lastLogin: this.lastLogin,
88
92
  emailVerified: this.emailVerified,
93
+ ordersCount: this.ordersCount,
94
+ amountSpent: this.amountSpent,
89
95
  };
90
96
  }
91
97
  toCustomerUpdateInputObjForShopify() {
@@ -158,5 +164,90 @@ class User extends Base_1.default {
158
164
  };
159
165
  return customerInput;
160
166
  }
167
+ generateSchemaForTypesense(name = 'dev_customers_20220811') {
168
+ return {
169
+ default_sorting_field: 'createdAtTimestamp',
170
+ fields: [
171
+ {
172
+ facet: false,
173
+ name: 'id',
174
+ type: 'string',
175
+ },
176
+ {
177
+ facet: false,
178
+ name: 'documentId',
179
+ type: 'string',
180
+ },
181
+ {
182
+ facet: false,
183
+ name: 'userId',
184
+ type: 'string',
185
+ },
186
+ {
187
+ facet: true,
188
+ name: 'createdAtTimestamp',
189
+ type: 'int64',
190
+ },
191
+ {
192
+ facet: true,
193
+ name: 'updatedAtTimestamp',
194
+ type: 'int64',
195
+ },
196
+ {
197
+ facet: true,
198
+ name: 'firstName',
199
+ type: 'string',
200
+ },
201
+ {
202
+ facet: true,
203
+ name: 'lastName',
204
+ type: 'string',
205
+ },
206
+ {
207
+ facet: true,
208
+ name: 'email',
209
+ type: 'string',
210
+ },
211
+ {
212
+ facet: true,
213
+ name: 'isSeller',
214
+ type: 'bool',
215
+ },
216
+ {
217
+ facet: true,
218
+ name: 'amountSpent',
219
+ type: 'float',
220
+ },
221
+ {
222
+ facet: true,
223
+ name: 'ordersCount',
224
+ type: 'int32',
225
+ },
226
+ {
227
+ facet: true,
228
+ name: 'merchantId',
229
+ type: 'string',
230
+ },
231
+ ],
232
+ name: 'prod_customers_20220811',
233
+ };
234
+ }
235
+ toObjForTypesense(merchantId) {
236
+ const stagedObj = {
237
+ id: this.utilities.sanitizeString(this.documentId),
238
+ documentId: this.utilities.sanitizeString(this.documentId),
239
+ userId: this.utilities.sanitizeString(this.uid),
240
+ createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
241
+ updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
242
+ merchantId: this.utilities.sanitizeString(merchantId),
243
+ firstName: this.utilities.sanitizeString(this.firstName),
244
+ lastName: this.utilities.sanitizeString(this.lastName),
245
+ email: this.utilities.sanitizeString(this.email),
246
+ isSeller: this.isSeller,
247
+ amountSpent: this.utilities.sanitizeNumber(this.amountSpent),
248
+ ordersCount: this.utilities.sanitizeNumber(this.ordersCount),
249
+ };
250
+ return stagedObj;
251
+ }
161
252
  }
162
253
  exports.default = User;
@@ -693,8 +693,10 @@ declare type TypesenseOrderObj = {
693
693
  fulfillmentStatus: string;
694
694
  salesChannel: string;
695
695
  paymentType: string;
696
+ shippingType: string;
696
697
  productIds: string[];
697
698
  productTitles: string[];
698
699
  productBrands: string[];
700
+ tags: string[];
699
701
  merchantId: string;
700
702
  };
@@ -30,6 +30,8 @@ interface UserAttributes extends ReRobeDocument {
30
30
  amountSpent?: number;
31
31
  lastLogin?: string;
32
32
  emailVerified: boolean;
33
+ createdAtTimestamp: number;
34
+ updatedAtTimestamp: number;
33
35
  }
34
36
  declare type RibbnCustomerObj = {
35
37
  uid?: string;
@@ -127,3 +129,17 @@ declare type UserRespFromShopifyWebhook = {
127
129
  phone?: string;
128
130
  addresses: AddressInput[];
129
131
  };
132
+ declare type TypesenseUserObj = {
133
+ id: string;
134
+ documentId: string;
135
+ userId: string;
136
+ createdAtTimestamp: number;
137
+ updatedAtTimestamp: number;
138
+ firstName: string;
139
+ lastName: string;
140
+ email: string;
141
+ isSeller: boolean;
142
+ amountSpent: number;
143
+ ordersCount: number;
144
+ merchantId: string;
145
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.6.96",
3
+ "version": "2.6.99",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",