rerobe-js-orm 3.0.12 → 3.0.13

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.
@@ -22,8 +22,9 @@ export default class Utilities {
22
22
  lastName: string;
23
23
  };
24
24
  formatTimestamp(timestampMillis: number): {
25
+ createdAtHour: string;
25
26
  createdAtDay: string;
26
27
  createdAtMonth: string;
27
- createdAtHour: string;
28
+ createdAtYear: string;
28
29
  };
29
30
  }
@@ -149,9 +149,10 @@ class Utilities {
149
149
  formatTimestamp(timestampMillis) {
150
150
  if (typeof timestampMillis !== 'number' || Number.isNaN(new Date(timestampMillis).valueOf())) {
151
151
  return {
152
+ createdAtHour: '',
152
153
  createdAtDay: '',
153
154
  createdAtMonth: '',
154
- createdAtHour: '',
155
+ createdAtYear: '',
155
156
  };
156
157
  }
157
158
  const dateObj = new Date(timestampMillis);
@@ -159,13 +160,15 @@ class Utilities {
159
160
  const month = (dateObj.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are 0-indexed in JS
160
161
  const day = dateObj.getUTCDate().toString().padStart(2, '0');
161
162
  const hour = dateObj.getUTCHours().toString().padStart(2, '0');
163
+ const createdAtHour = `${year}-${month}-${day} ${hour}`;
162
164
  const createdAtDay = `${year}-${month}-${day}`;
163
165
  const createdAtMonth = `${year}-${month}`;
164
- const createdAtHour = `${year}-${month}-${day} ${hour}`;
166
+ const createdAtYear = `${year}`;
165
167
  return {
168
+ createdAtHour,
166
169
  createdAtDay,
167
170
  createdAtMonth,
168
- createdAtHour,
171
+ createdAtYear,
169
172
  };
170
173
  }
171
174
  }
@@ -335,7 +335,7 @@ class Order extends Base_1.default {
335
335
  ? this.lineItems[0].image.originalSrc
336
336
  : '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';
337
337
  const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp);
338
- const { createdAtHour, createdAtDay, createdAtMonth } = this.utilities.formatTimestamp(createdAtTimestamp);
338
+ const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
339
339
  const stagedObj = {
340
340
  id: this.utilities.sanitizeString(this.documentId),
341
341
  documentId: this.utilities.sanitizeString(this.documentId),
@@ -344,6 +344,7 @@ class Order extends Base_1.default {
344
344
  createdAtHour,
345
345
  createdAtDay,
346
346
  createdAtMonth,
347
+ createdAtYear,
347
348
  updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
348
349
  merchantId: this.utilities.sanitizeString(this.merchantId),
349
350
  image: this.utilities.sanitizeString(image),
@@ -262,7 +262,7 @@ class Product extends Base_1.default {
262
262
  }
263
263
  toObjForTypesense() {
264
264
  const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.createdAtTimestamp);
265
- const { createdAtHour, createdAtDay, createdAtMonth } = this.utilities.formatTimestamp(createdAtTimestamp);
265
+ const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
266
266
  const stagedObj = {
267
267
  brand: this.utilities.sanitizeString(this.filterAttributes.brand),
268
268
  size: this.utilities.sanitizeString(this.filterAttributes.size),
@@ -296,6 +296,7 @@ class Product extends Base_1.default {
296
296
  createdAtHour,
297
297
  createdAtDay,
298
298
  createdAtMonth,
299
+ createdAtYear,
299
300
  updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.updatedAtTimestamp),
300
301
  sellRequestReviewTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellRequestReviewTimestamp),
301
302
  sellRequestReviewDraftTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellRequestReviewDraftTimestamp),
@@ -319,7 +319,7 @@ class User extends Base_1.default {
319
319
  }
320
320
  toObjForTypesense(merchantId) {
321
321
  const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp);
322
- const { createdAtHour, createdAtDay, createdAtMonth } = this.utilities.formatTimestamp(createdAtTimestamp);
322
+ const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
323
323
  const stagedObj = {
324
324
  id: this.utilities.sanitizeString(this.documentId),
325
325
  documentId: this.utilities.sanitizeString(this.documentId),
@@ -328,6 +328,7 @@ class User extends Base_1.default {
328
328
  createdAtHour,
329
329
  createdAtDay,
330
330
  createdAtMonth,
331
+ createdAtYear,
331
332
  updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
332
333
  merchantId: this.utilities.sanitizeString(merchantId),
333
334
  firstName: this.utilities.sanitizeString(this.firstName),
@@ -766,4 +766,5 @@ declare type TypesenseOrderObj = {
766
766
  createdAtDay: string;
767
767
  createdAtMonth: string;
768
768
  createdAtHour: string;
769
+ createdAtYear: string;
769
770
  };
@@ -302,5 +302,6 @@ declare type TypesenseProductObj = {
302
302
  createdAtDay: string;
303
303
  createdAtMonth: string;
304
304
  createdAtHour: string;
305
+ createdAtYear: string;
305
306
  [key: string]: any;
306
307
  };
@@ -164,7 +164,8 @@ declare type TypesenseUserObj = {
164
164
  lastOrderTimestamp: number;
165
165
  lastUploadTimestamp: number;
166
166
  registrationSource: string;
167
+ createdAtHour: string;
167
168
  createdAtDay: string;
168
169
  createdAtMonth: string;
169
- createdAtHour: string;
170
+ createdAtYear: string;
170
171
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",