rerobe-js-orm 2.6.2 → 2.6.3

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