rerobe-js-orm 2.6.95 → 2.6.98

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
  }
@@ -243,7 +243,7 @@ class Order extends Base_1.default {
243
243
  {
244
244
  facet: true,
245
245
  name: 'totalPrice',
246
- type: 'int32',
246
+ type: 'float',
247
247
  },
248
248
  {
249
249
  facet: true,
@@ -265,6 +265,16 @@ class Order extends Base_1.default {
265
265
  name: 'salesChannel',
266
266
  type: 'string',
267
267
  },
268
+ {
269
+ facet: true,
270
+ name: 'paymentType',
271
+ type: 'string',
272
+ },
273
+ {
274
+ facet: true,
275
+ name: 'shippingType',
276
+ type: 'string',
277
+ },
268
278
  {
269
279
  facet: true,
270
280
  name: 'productIds',
@@ -286,7 +296,7 @@ class Order extends Base_1.default {
286
296
  type: 'string',
287
297
  },
288
298
  ],
289
- name: 'prod_orders_20220809',
299
+ name: 'dev_orders_20220809',
290
300
  };
291
301
  }
292
302
  toObjForTypesense() {
@@ -307,6 +317,8 @@ class Order extends Base_1.default {
307
317
  financialStatus: this.utilities.sanitizeString(this.financialStatus),
308
318
  fulfillmentStatus: this.utilities.sanitizeString(this.fulfillmentStatus),
309
319
  salesChannel: this.utilities.sanitizeString(this.salesChannel),
320
+ paymentType: this.utilities.sanitizeString(this.paymentType),
321
+ shippingType: this.utilities.sanitizeString(this.shippingType),
310
322
  productIds: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.productId)),
311
323
  productTitles: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.title)),
312
324
  productBrands: this.utilities.sanitzeStringArr(this.lineItems.map((l) => l.brand)),
@@ -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_users_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: 'dev_users_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;
@@ -692,6 +692,8 @@ declare type TypesenseOrderObj = {
692
692
  financialStatus: string;
693
693
  fulfillmentStatus: string;
694
694
  salesChannel: string;
695
+ paymentType: string;
696
+ shippingType: string;
695
697
  productIds: string[];
696
698
  productTitles: string[];
697
699
  productBrands: string[];
@@ -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.95",
3
+ "version": "2.6.98",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",