rerobe-js-orm 2.6.2 → 2.6.5

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.
@@ -1,6 +1,8 @@
1
1
  import Base from '../Base';
2
2
  export default class ChatRoom extends Base {
3
3
  documentId: string;
4
+ createdAt: string;
5
+ createdAtTimestamp: number;
4
6
  userIdsToBeNotified: string[];
5
7
  type: ChatRoomType;
6
8
  lastMessage: LastMessageObj;
@@ -5,6 +5,8 @@ class ChatRoom extends Base_1.default {
5
5
  constructor(props) {
6
6
  super();
7
7
  this.documentId = (props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28);
8
+ this.createdAt = (props === null || props === void 0 ? void 0 : props.createdAt) || '';
9
+ this.createdAtTimestamp = (props === null || props === void 0 ? void 0 : props.createdAtTimestamp) || 0;
8
10
  this.userIdsToBeNotified = (props === null || props === void 0 ? void 0 : props.userIdsToBeNotified) || [];
9
11
  this.type = (props === null || props === void 0 ? void 0 : props.type) || 'CUSTOMER_SUPPORT';
10
12
  this.lastMessage = (props === null || props === void 0 ? void 0 : props.lastMessage) || {};
@@ -15,6 +17,8 @@ class ChatRoom extends Base_1.default {
15
17
  toObj() {
16
18
  return {
17
19
  documentId: this.documentId,
20
+ createdAt: this.createdAt,
21
+ createdAtTimestamp: this.createdAtTimestamp,
18
22
  userIdsToBeNotified: this.userIdsToBeNotified,
19
23
  type: this.type,
20
24
  lastMessage: this.lastMessage,
@@ -32,6 +36,11 @@ class ChatRoom extends Base_1.default {
32
36
  name: 'documentId',
33
37
  type: 'string',
34
38
  },
39
+ {
40
+ facet: true,
41
+ name: 'createdAtTimestamp',
42
+ type: 'int64',
43
+ },
35
44
  {
36
45
  facet: true,
37
46
  name: 'type',
@@ -62,6 +71,11 @@ class ChatRoom extends Base_1.default {
62
71
  name: 'lastMessage.content',
63
72
  type: 'string',
64
73
  },
74
+ {
75
+ facet: true,
76
+ name: 'createdAtTimestamp',
77
+ type: 'int64',
78
+ },
65
79
  {
66
80
  facet: true,
67
81
  name: 'lastMessage.createdAtTimestamp',
@@ -83,7 +97,7 @@ class ChatRoom extends Base_1.default {
83
97
  type: 'string',
84
98
  },
85
99
  ],
86
- name,
100
+ name: 'dev_chatRooms_20220725',
87
101
  };
88
102
  }
89
103
  toObjForTypesense() {
@@ -98,6 +112,7 @@ class ChatRoom extends Base_1.default {
98
112
  }, []);
99
113
  const stagedObj = {
100
114
  documentId: this.utilities.sanitizeString(this.documentId),
115
+ createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
101
116
  type: this.utilities.sanitizeString(this.type),
102
117
  userIds: this.utilities.sanitzeStringArr(this.userIds),
103
118
  userIdsToBeNotified: this.utilities.sanitzeStringArr(this.userIdsToBeNotified),
@@ -1,6 +1,8 @@
1
1
  import Base from '../Base';
2
2
  export default class ProductCollection extends Base {
3
3
  documentId: string;
4
+ merchantId: string;
5
+ createdAtTimestamp: number;
4
6
  preTitle: string;
5
7
  title: string;
6
8
  subTitle: string;
@@ -12,4 +14,20 @@ export default class ProductCollection extends Base {
12
14
  collectionId: string;
13
15
  constructor(props?: any);
14
16
  toObj(): ProductCollectionType;
17
+ generateSchemaForTypesense(name?: string): {
18
+ default_sorting_field: string;
19
+ fields: ({
20
+ facet: boolean;
21
+ name: string;
22
+ type: string;
23
+ optional?: undefined;
24
+ } | {
25
+ facet: boolean;
26
+ optional: boolean;
27
+ name: string;
28
+ type: string;
29
+ })[];
30
+ name: string;
31
+ };
32
+ toObjForTypesense(): TypesenseProductCollectionObj;
15
33
  }
@@ -5,6 +5,8 @@ class ProductCollection extends Base_1.default {
5
5
  constructor(props) {
6
6
  super();
7
7
  this.documentId = (props === null || props === void 0 ? void 0 : props.documentId) || this.utilities.makeRandId(28);
8
+ this.merchantId = (props === null || props === void 0 ? void 0 : props.merchantId) || '';
9
+ this.createdAtTimestamp = (props === null || props === void 0 ? void 0 : props.createdAtTimestamp) || 0;
8
10
  this.preTitle = (props === null || props === void 0 ? void 0 : props.preTitle) || '';
9
11
  this.title = (props === null || props === void 0 ? void 0 : props.title) || '';
10
12
  this.subTitle = (props === null || props === void 0 ? void 0 : props.subTitle) || '';
@@ -18,6 +20,8 @@ class ProductCollection extends Base_1.default {
18
20
  toObj() {
19
21
  const productCollectionObj = {
20
22
  documentId: this.documentId,
23
+ merchantId: this.merchantId,
24
+ createdAtTimestamp: this.createdAtTimestamp,
21
25
  preTitle: this.preTitle,
22
26
  title: this.title,
23
27
  subTitle: this.subTitle,
@@ -30,5 +34,176 @@ class ProductCollection extends Base_1.default {
30
34
  };
31
35
  return productCollectionObj;
32
36
  }
37
+ generateSchemaForTypesense(name = 'prod_productCollections_20220722') {
38
+ return {
39
+ default_sorting_field: 'createdAtTimestamp',
40
+ fields: [
41
+ {
42
+ facet: false,
43
+ name: 'documentId',
44
+ type: 'string',
45
+ },
46
+ {
47
+ facet: true,
48
+ name: 'merchantId',
49
+ type: 'string',
50
+ },
51
+ {
52
+ facet: true,
53
+ name: 'createdAtTimestamp',
54
+ type: 'int64',
55
+ },
56
+ {
57
+ facet: true,
58
+ name: 'title',
59
+ type: 'string',
60
+ },
61
+ {
62
+ facet: true,
63
+ name: 'preTitle',
64
+ type: 'string',
65
+ },
66
+ {
67
+ facet: true,
68
+ name: 'subTitle',
69
+ type: 'string',
70
+ },
71
+ {
72
+ facet: false,
73
+ name: 'description',
74
+ type: 'string',
75
+ },
76
+ {
77
+ facet: true,
78
+ name: 'type',
79
+ type: 'string',
80
+ },
81
+ {
82
+ facet: false,
83
+ name: 'imgUrl',
84
+ type: 'string',
85
+ },
86
+ {
87
+ facet: true,
88
+ optional: true,
89
+ name: 'refinements.brandRefinement',
90
+ type: 'string[]',
91
+ },
92
+ {
93
+ facet: true,
94
+ optional: true,
95
+ name: 'refinements.clothingSizeRefinement',
96
+ type: 'string[]',
97
+ },
98
+ {
99
+ facet: true,
100
+ optional: true,
101
+ name: 'refinements.colorRefinement',
102
+ type: 'string[]',
103
+ },
104
+ {
105
+ facet: true,
106
+ optional: true,
107
+ name: 'refinements.conditionRefinement',
108
+ type: 'string[]',
109
+ },
110
+ {
111
+ facet: true,
112
+ optional: true,
113
+ name: 'refinements.genderRefinement',
114
+ type: 'string[]',
115
+ },
116
+ {
117
+ facet: true,
118
+ optional: true,
119
+ name: 'refinements.jeanSizeRefinement',
120
+ type: 'string[]',
121
+ },
122
+ {
123
+ facet: true,
124
+ optional: true,
125
+ name: 'refinements.materialCompositionRefinement',
126
+ type: 'string[]',
127
+ },
128
+ {
129
+ facet: true,
130
+ optional: true,
131
+ name: 'refinements.priceRangeRefinement',
132
+ type: 'string[]',
133
+ },
134
+ {
135
+ facet: true,
136
+ optional: true,
137
+ name: 'refinements.productCategoryRefinement',
138
+ type: 'string[]',
139
+ },
140
+ {
141
+ facet: true,
142
+ optional: true,
143
+ name: 'refinements.productTypeRefinement',
144
+ type: 'string[]',
145
+ },
146
+ {
147
+ facet: true,
148
+ optional: true,
149
+ name: 'refinements.productStyleRefinement',
150
+ type: 'string[]',
151
+ },
152
+ {
153
+ facet: true,
154
+ optional: true,
155
+ name: 'refinements.shoeSizeRefinement',
156
+ type: 'string[]',
157
+ },
158
+ {
159
+ facet: true,
160
+ optional: true,
161
+ name: 'refinements.statusRefinement',
162
+ type: 'string[]',
163
+ },
164
+ {
165
+ facet: true,
166
+ optional: true,
167
+ name: 'refinements.salesChannelRefinement',
168
+ type: 'string[]',
169
+ },
170
+ {
171
+ facet: false,
172
+ name: 'tags',
173
+ type: 'string[]',
174
+ },
175
+ ],
176
+ name: 'dev_productCollections_20220725',
177
+ };
178
+ }
179
+ toObjForTypesense() {
180
+ const stagedObj = {
181
+ documentId: this.utilities.sanitizeString(this.documentId),
182
+ merchantId: this.utilities.sanitizeString(this.merchantId),
183
+ createdAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp),
184
+ preTitle: this.utilities.sanitizeString(this.preTitle),
185
+ title: this.utilities.sanitizeString(this.title),
186
+ subTitle: this.utilities.sanitizeString(this.subTitle),
187
+ description: this.utilities.sanitizeString(this.description),
188
+ type: this.utilities.sanitizeString(this.type),
189
+ imgUrl: this.utilities.sanitizeString(this.imgUrl),
190
+ 'refinements.brandRefinement': this.utilities.sanitzeStringArr(this.refinements.brandRefinement),
191
+ 'refinements.clothingSizeRefinement': this.utilities.sanitzeStringArr(this.refinements.clothingSizeRefinement),
192
+ 'refinements.colorRefinement': this.utilities.sanitzeStringArr(this.refinements.colorRefinement),
193
+ 'refinements.conditionRefinement': this.utilities.sanitzeStringArr(this.refinements.conditionRefinement),
194
+ 'refinements.genderRefinement': this.utilities.sanitzeStringArr(this.refinements.genderRefinement),
195
+ 'refinements.jeanSizeRefinement': this.utilities.sanitzeStringArr(this.refinements.jeanSizeRefinement),
196
+ 'refinements.materialCompositionRefinement': this.utilities.sanitzeStringArr(this.refinements.materialCompositionRefinement),
197
+ 'refinements.priceRangeRefinement': this.utilities.sanitzeStringArr(this.refinements.priceRangeRefinement),
198
+ 'refinements.productCategoryRefinement': this.utilities.sanitzeStringArr(this.refinements.productCategoryRefinement),
199
+ 'refinements.productTypeRefinement': this.utilities.sanitzeStringArr(this.refinements.productTypeRefinement),
200
+ 'refinements.productStyleRefinement': this.utilities.sanitzeStringArr(this.refinements.productStyleRefinement),
201
+ 'refinements.shoeSizeRefinement': this.utilities.sanitzeStringArr(this.refinements.shoeSizeRefinement),
202
+ 'refinements.statusRefinement': this.utilities.sanitzeStringArr(this.refinements.statusRefinement),
203
+ 'refinements.salesChannelRefinement': this.utilities.sanitzeStringArr(this.refinements.salesChannelRefinement),
204
+ tags: this.utilities.sanitzeStringArr(this.tags),
205
+ };
206
+ return stagedObj;
207
+ }
33
208
  }
34
209
  exports.default = ProductCollection;
@@ -35,8 +35,10 @@ interface ProductRefinements {
35
35
  declare type CollectionType = 'AUTOMATED' | 'MANUAL';
36
36
  declare type ProductCollectionType = {
37
37
  createdAt?: string;
38
+ createdAtTimestamp?: number;
38
39
  updatedAt?: string;
39
40
  documentId?: string;
41
+ merchantId?: string;
40
42
  preTitle: string;
41
43
  title: string;
42
44
  subTitle: string;
@@ -61,3 +63,29 @@ declare type ProductCollectionFormFields = {
61
63
  tags: MultiSelectFormField<string>;
62
64
  collectionId: TextInputFormField<string>;
63
65
  };
66
+ declare type TypesenseProductCollectionObj = {
67
+ documentId: string;
68
+ merchantId: string;
69
+ createdAtTimestamp: number;
70
+ preTitle: string;
71
+ title: string;
72
+ subTitle: string;
73
+ description: string;
74
+ type: string;
75
+ imgUrl: string;
76
+ 'refinements.brandRefinement': string[];
77
+ 'refinements.clothingSizeRefinement': string[];
78
+ 'refinements.colorRefinement': string[];
79
+ 'refinements.conditionRefinement': string[];
80
+ 'refinements.genderRefinement': string[];
81
+ 'refinements.jeanSizeRefinement': string[];
82
+ 'refinements.materialCompositionRefinement': string[];
83
+ 'refinements.priceRangeRefinement': string[];
84
+ 'refinements.productCategoryRefinement': string[];
85
+ 'refinements.productTypeRefinement': string[];
86
+ 'refinements.productStyleRefinement': string[];
87
+ 'refinements.shoeSizeRefinement': string[];
88
+ 'refinements.statusRefinement': string[];
89
+ 'refinements.salesChannelRefinement': string[];
90
+ tags: string[];
91
+ };
@@ -1,5 +1,7 @@
1
1
  declare type ChatRoomAttributes = {
2
2
  documentId: string;
3
+ createdAt: string;
4
+ createdAtTimestamp: number;
3
5
  userIdsToBeNotified: string[];
4
6
  type: ChatRoomType;
5
7
  lastMessage: LastMessageObj;
@@ -30,6 +32,7 @@ declare type ChatRoomUserInfo = {
30
32
  };
31
33
  declare type TypesenseChatRoomObj = {
32
34
  documentId: string;
35
+ createdAtTimestamp: number;
33
36
  type: string;
34
37
  userIds: string[];
35
38
  userIdsToBeNotified: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.6.2",
3
+ "version": "2.6.5",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",