@hed-hog/catalog 0.0.299 → 0.0.301

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,32 +1,32 @@
1
- columns:
2
- - type: pk
3
- - name: catalog_category_id
4
- type: fk
5
- references:
6
- table: catalog_category
7
- column: id
8
- onDelete: CASCADE
9
- - name: related_catalog_category_id
10
- type: fk
11
- isNullable: true
12
- references:
13
- table: catalog_category
14
- column: id
15
- onDelete: SET NULL
16
- - name: shared_attribute_id
17
- type: fk
18
- isNullable: true
19
- references:
20
- table: catalog_attribute
21
- column: id
22
- onDelete: SET NULL
23
- - name: rule_type
24
- type: enum
25
- values: [same_category, compatible_category, shared_attribute, manual]
26
- default: same_category
27
- - name: min_similarity_score
28
- type: decimal
29
- precision: 5
1
+ columns:
2
+ - type: pk
3
+ - name: catalog_category_id
4
+ type: fk
5
+ references:
6
+ table: catalog_category
7
+ column: id
8
+ onDelete: CASCADE
9
+ - name: related_catalog_category_id
10
+ type: fk
11
+ isNullable: true
12
+ references:
13
+ table: catalog_category
14
+ column: id
15
+ onDelete: SET NULL
16
+ - name: shared_attribute_id
17
+ type: fk
18
+ isNullable: true
19
+ references:
20
+ table: catalog_attribute
21
+ column: id
22
+ onDelete: SET NULL
23
+ - name: rule_type
24
+ type: enum
25
+ values: [same_category, compatible_category, shared_attribute, manual]
26
+ default: same_category
27
+ - name: min_similarity_score
28
+ type: decimal
29
+ precision: 5
30
30
  scale: 2
31
31
  default: 0
32
32
  - name: status
@@ -35,7 +35,7 @@ columns:
35
35
  default: active
36
36
  - type: created_at
37
37
  - type: updated_at
38
- indices:
39
- - columns: [catalog_category_id, status]
40
- - columns: [related_catalog_category_id, status]
41
- - columns: [shared_attribute_id, status]
38
+ indices:
39
+ - columns: [catalog_category_id, status]
40
+ - columns: [related_catalog_category_id, status]
41
+ - columns: [shared_attribute_id, status]
@@ -17,22 +17,22 @@ columns:
17
17
  type: enum
18
18
  values: [portal, niche, tenant]
19
19
  default: portal
20
- - name: default_locale_id
21
- type: fk
22
- references:
23
- table: locale
24
- column: id
25
- onDelete: RESTRICT
26
- - name: logo_file_id
27
- type: fk
28
- isNullable: true
29
- references:
30
- table: file
31
- column: id
32
- onDelete: SET NULL
33
- - name: theme_settings_json
34
- type: json
35
- isNullable: true
20
+ - name: default_locale_id
21
+ type: fk
22
+ references:
23
+ table: locale
24
+ column: id
25
+ onDelete: RESTRICT
26
+ - name: logo_file_id
27
+ type: fk
28
+ isNullable: true
29
+ references:
30
+ table: file
31
+ column: id
32
+ onDelete: SET NULL
33
+ - name: theme_settings_json
34
+ type: json
35
+ isNullable: true
36
36
  - name: seo_defaults_json
37
37
  type: json
38
38
  isNullable: true
@@ -41,8 +41,8 @@ columns:
41
41
  indices:
42
42
  - columns: [slug]
43
43
  isUnique: true
44
- - columns: [domain]
45
- isUnique: true
46
- - columns: [status]
47
- - columns: [default_locale_id]
48
- - columns: [logo_file_id]
44
+ - columns: [domain]
45
+ isUnique: true
46
+ - columns: [status]
47
+ - columns: [default_locale_id]
48
+ - columns: [logo_file_id]
@@ -1,17 +1,17 @@
1
- columns:
2
- - type: pk
3
- - name: site_id
1
+ columns:
2
+ - type: pk
3
+ - name: site_id
4
4
  type: fk
5
5
  references:
6
6
  table: catalog_site
7
7
  column: id
8
8
  onDelete: CASCADE
9
- - name: catalog_category_id
10
- type: fk
11
- references:
12
- table: catalog_category
13
- column: id
14
- onDelete: CASCADE
9
+ - name: catalog_category_id
10
+ type: fk
11
+ references:
12
+ table: catalog_category
13
+ column: id
14
+ onDelete: CASCADE
15
15
  - name: is_primary
16
16
  type: boolean
17
17
  default: false
@@ -21,6 +21,6 @@ columns:
21
21
  default: visible
22
22
  - type: created_at
23
23
  - type: updated_at
24
- indices:
25
- - columns: [site_id, catalog_category_id]
26
- isUnique: true
24
+ indices:
25
+ - columns: [site_id, catalog_category_id]
26
+ isUnique: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/catalog",
3
- "version": "0.0.299",
3
+ "version": "0.0.301",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -10,13 +10,13 @@
10
10
  "@nestjs/jwt": "^11",
11
11
  "@nestjs/mapped-types": "*",
12
12
  "@hed-hog/api": "0.0.6",
13
- "@hed-hog/category": "0.0.299",
14
13
  "@hed-hog/api-pagination": "0.0.7",
15
- "@hed-hog/api-locale": "0.0.14",
14
+ "@hed-hog/category": "0.0.301",
15
+ "@hed-hog/content": "0.0.301",
16
16
  "@hed-hog/api-prisma": "0.0.6",
17
- "@hed-hog/tag": "0.0.299",
18
- "@hed-hog/core": "0.0.299",
19
- "@hed-hog/content": "0.0.299"
17
+ "@hed-hog/tag": "0.0.301",
18
+ "@hed-hog/api-locale": "0.0.14",
19
+ "@hed-hog/core": "0.0.301"
20
20
  },
21
21
  "exports": {
22
22
  ".": {
@@ -1,64 +1,64 @@
1
- export type CatalogResourceConfig = {
2
- resource: string;
3
- model: string;
4
- searchFields: string[];
1
+ export type CatalogResourceConfig = {
2
+ resource: string;
3
+ model: string;
4
+ searchFields: string[];
5
5
  filterFields?: string[];
6
6
  fields: string[];
7
7
  defaultOrderBy?: Record<string, 'asc' | 'desc'>;
8
8
  statusField?: string;
9
9
  activeStatusValue?: string;
10
- };
11
-
12
- export const catalogResources: CatalogResourceConfig[] = [
13
- {
14
- resource: 'categories',
15
- model: 'catalog_category',
16
- searchFields: ['slug', 'name', 'normalized_name', 'description'],
17
- filterFields: ['status', 'parent_category_id'],
18
- fields: ['parent_category_id', 'slug', 'name', 'normalized_name', 'description', 'comparison_enabled', 'status', 'sort_order'],
19
- defaultOrderBy: { sort_order: 'asc' },
20
- statusField: 'status',
21
- activeStatusValue: 'active',
22
- },
23
- {
24
- resource: 'brands',
25
- model: 'catalog_brand',
26
- searchFields: ['slug', 'name', 'normalized_name'],
10
+ };
11
+
12
+ export const catalogResources: CatalogResourceConfig[] = [
13
+ {
14
+ resource: 'categories',
15
+ model: 'catalog_category',
16
+ searchFields: ['slug', 'name', 'normalized_name', 'description'],
17
+ filterFields: ['status', 'parent_category_id'],
18
+ fields: ['parent_category_id', 'slug', 'name', 'normalized_name', 'description', 'comparison_enabled', 'status', 'sort_order'],
19
+ defaultOrderBy: { sort_order: 'asc' },
20
+ statusField: 'status',
21
+ activeStatusValue: 'active',
22
+ },
23
+ {
24
+ resource: 'brands',
25
+ model: 'catalog_brand',
26
+ searchFields: ['slug', 'name', 'normalized_name'],
27
27
  filterFields: ['status', 'logo_file_id'],
28
28
  fields: ['slug', 'name', 'normalized_name', 'logo_file_id', 'status', 'website_url'],
29
29
  statusField: 'status',
30
30
  activeStatusValue: 'active',
31
31
  },
32
32
  {
33
- resource: 'sites',
34
- model: 'catalog_site',
35
- searchFields: ['slug', 'name', 'domain'],
36
- filterFields: ['status', 'site_type', 'default_locale_id', 'logo_file_id'],
37
- fields: ['slug', 'name', 'domain', 'status', 'site_type', 'default_locale_id', 'logo_file_id', 'theme_settings_json', 'seo_defaults_json'],
38
- statusField: 'status',
39
- activeStatusValue: 'active',
40
- },
41
- {
42
- resource: 'products',
43
- model: 'catalog_product',
44
- searchFields: ['slug', 'name', 'model_name', 'sku', 'gtin'],
45
- filterFields: ['status', 'comparison_status', 'brand_id', 'catalog_category_id', 'primary_content_id', 'is_active'],
46
- // Snapshot JSON fields remain available for backward-compatible reads,
47
- // but attribute values are now the primary source of truth.
48
- fields: ['brand_id', 'catalog_category_id', 'primary_content_id', 'slug', 'name', 'short_description', 'description', 'model_name', 'sku', 'gtin', 'status', 'comparison_status', 'release_date', 'spec_snapshot_json', 'comparison_snapshot_json', 'is_active'],
49
- statusField: 'status',
50
- activeStatusValue: 'published',
51
- },
52
- {
53
- resource: 'product-categories',
54
- model: 'catalog_product_category',
55
- searchFields: [],
56
- filterFields: ['product_id', 'catalog_category_id', 'is_primary'],
57
- fields: ['product_id', 'catalog_category_id', 'is_primary', 'sort_order'],
58
- },
59
- {
60
- resource: 'product-images',
61
- model: 'catalog_product_image',
33
+ resource: 'sites',
34
+ model: 'catalog_site',
35
+ searchFields: ['slug', 'name', 'domain'],
36
+ filterFields: ['status', 'site_type', 'default_locale_id', 'logo_file_id'],
37
+ fields: ['slug', 'name', 'domain', 'status', 'site_type', 'default_locale_id', 'logo_file_id', 'theme_settings_json', 'seo_defaults_json'],
38
+ statusField: 'status',
39
+ activeStatusValue: 'active',
40
+ },
41
+ {
42
+ resource: 'products',
43
+ model: 'catalog_product',
44
+ searchFields: ['slug', 'name', 'model_name', 'sku', 'gtin'],
45
+ filterFields: ['status', 'comparison_status', 'brand_id', 'catalog_category_id', 'primary_content_id', 'is_active'],
46
+ // Snapshot JSON fields remain available for backward-compatible reads,
47
+ // but attribute values are now the primary source of truth.
48
+ fields: ['brand_id', 'catalog_category_id', 'primary_content_id', 'slug', 'name', 'short_description', 'description', 'model_name', 'sku', 'gtin', 'status', 'comparison_status', 'release_date', 'spec_snapshot_json', 'comparison_snapshot_json', 'is_active'],
49
+ statusField: 'status',
50
+ activeStatusValue: 'published',
51
+ },
52
+ {
53
+ resource: 'product-categories',
54
+ model: 'catalog_product_category',
55
+ searchFields: [],
56
+ filterFields: ['product_id', 'catalog_category_id', 'is_primary'],
57
+ fields: ['product_id', 'catalog_category_id', 'is_primary', 'sort_order'],
58
+ },
59
+ {
60
+ resource: 'product-images',
61
+ model: 'catalog_product_image',
62
62
  searchFields: ['alt_text', 'role'],
63
63
  filterFields: ['product_id', 'file_id', 'role', 'is_primary'],
64
64
  fields: ['product_id', 'file_id', 'role', 'sort_order', 'is_primary', 'alt_text'],
@@ -72,60 +72,60 @@ export const catalogResources: CatalogResourceConfig[] = [
72
72
  statusField: 'publication_status',
73
73
  activeStatusValue: 'published',
74
74
  },
75
- {
76
- resource: 'attribute-groups',
77
- model: 'catalog_attribute_group',
75
+ {
76
+ resource: 'attribute-groups',
77
+ model: 'catalog_attribute_group',
78
78
  searchFields: ['slug', 'name'],
79
79
  filterFields: ['status'],
80
80
  fields: ['slug', 'name', 'status'],
81
81
  statusField: 'status',
82
82
  activeStatusValue: 'active',
83
83
  },
84
- {
85
- resource: 'attributes',
86
- model: 'catalog_attribute',
87
- searchFields: ['slug', 'code', 'name', 'description', 'unit', 'group_name'],
88
- filterFields: ['group_id', 'group_name', 'status', 'data_type', 'comparison_mode', 'is_filterable', 'is_sortable', 'is_comparable', 'is_required_default'],
89
- fields: ['code', 'group_id', 'group_name', 'slug', 'name', 'description', 'data_type', 'unit', 'comparison_mode', 'is_filterable', 'is_sortable', 'is_comparable', 'is_required_default', 'status', 'display_order'],
90
- defaultOrderBy: { display_order: 'asc' },
91
- statusField: 'status',
92
- activeStatusValue: 'active',
93
- },
94
- {
95
- resource: 'attribute-options',
96
- model: 'catalog_attribute_option',
97
- searchFields: ['slug', 'label', 'option_value', 'normalized_value'],
98
- filterFields: ['attribute_id', 'status', 'is_default'],
99
- fields: ['attribute_id', 'slug', 'label', 'option_value', 'normalized_value', 'sort_order', 'status', 'is_default'],
100
- defaultOrderBy: { sort_order: 'asc' },
101
- statusField: 'status',
102
- activeStatusValue: 'active',
103
- },
104
- {
105
- resource: 'category-attributes',
106
- model: 'catalog_category_attribute',
107
- searchFields: [],
108
- filterFields: ['catalog_category_id', 'attribute_id', 'is_required', 'is_highlight', 'is_filter_visible', 'is_comparison_visible', 'facet_mode'],
109
- fields: ['catalog_category_id', 'attribute_id', 'is_required', 'is_highlight', 'is_filter_visible', 'is_comparison_visible', 'sort_order', 'weight', 'facet_mode'],
110
- defaultOrderBy: { sort_order: 'asc' },
111
- },
112
- {
113
- resource: 'product-attributes',
114
- model: 'catalog_product_attribute_value',
115
- searchFields: ['raw_value', 'value_text', 'normalized_value', 'normalized_text', 'source_type'],
116
- filterFields: ['product_id', 'attribute_id', 'attribute_option_id', 'is_verified'],
117
- fields: ['product_id', 'attribute_id', 'attribute_option_id', 'value_text', 'value_number', 'value_boolean', 'raw_value', 'value_unit', 'normalized_value', 'normalized_text', 'normalized_number', 'source_type', 'confidence_score', 'is_verified'],
118
- },
119
- {
120
- resource: 'score-criteria',
121
- model: 'catalog_score_criterion',
122
- searchFields: ['slug', 'name'],
123
- filterFields: ['catalog_category_id', 'attribute_id', 'target_option_id', 'status', 'score_type'],
124
- fields: ['catalog_category_id', 'attribute_id', 'target_option_id', 'slug', 'name', 'weight', 'score_type', 'max_score', 'display_order', 'status'],
125
- defaultOrderBy: { display_order: 'asc' },
126
- statusField: 'status',
127
- activeStatusValue: 'active',
128
- },
84
+ {
85
+ resource: 'attributes',
86
+ model: 'catalog_attribute',
87
+ searchFields: ['slug', 'code', 'name', 'description', 'unit', 'group_name'],
88
+ filterFields: ['group_id', 'group_name', 'status', 'data_type', 'comparison_mode', 'is_filterable', 'is_sortable', 'is_comparable', 'is_required_default'],
89
+ fields: ['code', 'group_id', 'group_name', 'slug', 'name', 'description', 'data_type', 'unit', 'comparison_mode', 'is_filterable', 'is_sortable', 'is_comparable', 'is_required_default', 'status', 'display_order'],
90
+ defaultOrderBy: { display_order: 'asc' },
91
+ statusField: 'status',
92
+ activeStatusValue: 'active',
93
+ },
94
+ {
95
+ resource: 'attribute-options',
96
+ model: 'catalog_attribute_option',
97
+ searchFields: ['slug', 'label', 'option_value', 'normalized_value'],
98
+ filterFields: ['attribute_id', 'status', 'is_default'],
99
+ fields: ['attribute_id', 'slug', 'label', 'option_value', 'normalized_value', 'sort_order', 'status', 'is_default'],
100
+ defaultOrderBy: { sort_order: 'asc' },
101
+ statusField: 'status',
102
+ activeStatusValue: 'active',
103
+ },
104
+ {
105
+ resource: 'category-attributes',
106
+ model: 'catalog_category_attribute',
107
+ searchFields: [],
108
+ filterFields: ['catalog_category_id', 'attribute_id', 'is_required', 'is_highlight', 'is_filter_visible', 'is_comparison_visible', 'facet_mode'],
109
+ fields: ['catalog_category_id', 'attribute_id', 'is_required', 'is_highlight', 'is_filter_visible', 'is_comparison_visible', 'sort_order', 'weight', 'facet_mode'],
110
+ defaultOrderBy: { sort_order: 'asc' },
111
+ },
112
+ {
113
+ resource: 'product-attributes',
114
+ model: 'catalog_product_attribute_value',
115
+ searchFields: ['raw_value', 'value_text', 'normalized_value', 'normalized_text', 'source_type'],
116
+ filterFields: ['product_id', 'attribute_id', 'attribute_option_id', 'is_verified'],
117
+ fields: ['product_id', 'attribute_id', 'attribute_option_id', 'value_text', 'value_number', 'value_boolean', 'raw_value', 'value_unit', 'normalized_value', 'normalized_text', 'normalized_number', 'source_type', 'confidence_score', 'is_verified'],
118
+ },
119
+ {
120
+ resource: 'score-criteria',
121
+ model: 'catalog_score_criterion',
122
+ searchFields: ['slug', 'name'],
123
+ filterFields: ['catalog_category_id', 'attribute_id', 'target_option_id', 'status', 'score_type'],
124
+ fields: ['catalog_category_id', 'attribute_id', 'target_option_id', 'slug', 'name', 'weight', 'score_type', 'max_score', 'display_order', 'status'],
125
+ defaultOrderBy: { display_order: 'asc' },
126
+ statusField: 'status',
127
+ activeStatusValue: 'active',
128
+ },
129
129
  {
130
130
  resource: 'product-scores',
131
131
  model: 'catalog_product_score',
@@ -133,15 +133,15 @@ export const catalogResources: CatalogResourceConfig[] = [
133
133
  filterFields: ['product_id', 'criterion_id', 'is_manual_override'],
134
134
  fields: ['product_id', 'criterion_id', 'score_value', 'score_label', 'summary', 'calculation_source', 'is_manual_override'],
135
135
  },
136
- {
137
- resource: 'comparisons',
138
- model: 'catalog_comparison',
139
- searchFields: ['slug', 'title', 'summary', 'verdict', 'eligibility_hash'],
140
- filterFields: ['catalog_category_id', 'site_id', 'primary_content_id', 'comparison_type', 'generation_mode', 'status'],
141
- fields: ['catalog_category_id', 'site_id', 'primary_content_id', 'slug', 'comparison_type', 'generation_mode', 'status', 'title', 'summary', 'intro', 'verdict', 'eligibility_hash', 'published_at'],
142
- statusField: 'status',
143
- activeStatusValue: 'published',
144
- },
136
+ {
137
+ resource: 'comparisons',
138
+ model: 'catalog_comparison',
139
+ searchFields: ['slug', 'title', 'summary', 'verdict', 'eligibility_hash'],
140
+ filterFields: ['catalog_category_id', 'site_id', 'primary_content_id', 'comparison_type', 'generation_mode', 'status'],
141
+ fields: ['catalog_category_id', 'site_id', 'primary_content_id', 'slug', 'comparison_type', 'generation_mode', 'status', 'title', 'summary', 'intro', 'verdict', 'eligibility_hash', 'published_at'],
142
+ statusField: 'status',
143
+ activeStatusValue: 'published',
144
+ },
145
145
  {
146
146
  resource: 'comparison-items',
147
147
  model: 'catalog_comparison_item',
@@ -156,15 +156,15 @@ export const catalogResources: CatalogResourceConfig[] = [
156
156
  filterFields: ['comparison_id', 'product_id', 'attribute_id', 'highlight_type'],
157
157
  fields: ['comparison_id', 'product_id', 'attribute_id', 'highlight_type', 'title', 'body', 'sort_order'],
158
158
  },
159
- {
160
- resource: 'similarity-rules',
161
- model: 'catalog_similarity_rule',
162
- searchFields: ['rule_type'],
163
- filterFields: ['catalog_category_id', 'related_catalog_category_id', 'shared_attribute_id', 'status'],
164
- fields: ['catalog_category_id', 'related_catalog_category_id', 'shared_attribute_id', 'rule_type', 'min_similarity_score', 'status'],
165
- statusField: 'status',
166
- activeStatusValue: 'active',
167
- },
159
+ {
160
+ resource: 'similarity-rules',
161
+ model: 'catalog_similarity_rule',
162
+ searchFields: ['rule_type'],
163
+ filterFields: ['catalog_category_id', 'related_catalog_category_id', 'shared_attribute_id', 'status'],
164
+ fields: ['catalog_category_id', 'related_catalog_category_id', 'shared_attribute_id', 'rule_type', 'min_similarity_score', 'status'],
165
+ statusField: 'status',
166
+ activeStatusValue: 'active',
167
+ },
168
168
  {
169
169
  resource: 'merchants',
170
170
  model: 'catalog_merchant',
@@ -204,13 +204,13 @@ export const catalogResources: CatalogResourceConfig[] = [
204
204
  filterFields: ['offer_id', 'product_id', 'site_id', 'comparison_id'],
205
205
  fields: ['offer_id', 'product_id', 'site_id', 'comparison_id', 'clicked_at', 'placement', 'utm_json', 'session_hash', 'referrer_host'],
206
206
  },
207
- {
208
- resource: 'site-categories',
209
- model: 'catalog_site_category',
210
- searchFields: ['visibility_status'],
211
- filterFields: ['site_id', 'catalog_category_id', 'is_primary', 'visibility_status'],
212
- fields: ['site_id', 'catalog_category_id', 'is_primary', 'visibility_status'],
213
- },
207
+ {
208
+ resource: 'site-categories',
209
+ model: 'catalog_site_category',
210
+ searchFields: ['visibility_status'],
211
+ filterFields: ['site_id', 'catalog_category_id', 'is_primary', 'visibility_status'],
212
+ fields: ['site_id', 'catalog_category_id', 'is_primary', 'visibility_status'],
213
+ },
214
214
  {
215
215
  resource: 'content-relations',
216
216
  model: 'catalog_content_relation',
@@ -218,15 +218,15 @@ export const catalogResources: CatalogResourceConfig[] = [
218
218
  filterFields: ['site_id', 'content_id', 'product_id', 'comparison_id', 'relation_type'],
219
219
  fields: ['site_id', 'content_id', 'product_id', 'comparison_id', 'relation_type', 'sort_order'],
220
220
  },
221
- {
222
- resource: 'seo-rules',
223
- model: 'catalog_seo_page_rule',
224
- searchFields: ['page_type', 'rule_slug', 'canonical_strategy'],
225
- filterFields: ['site_id', 'catalog_category_id', 'status', 'page_type'],
226
- fields: ['site_id', 'catalog_category_id', 'page_type', 'rule_slug', 'status', 'generation_query_json', 'min_product_count', 'min_attribute_coverage', 'canonical_strategy', 'priority', 'template_json'],
227
- statusField: 'status',
228
- activeStatusValue: 'active',
229
- },
221
+ {
222
+ resource: 'seo-rules',
223
+ model: 'catalog_seo_page_rule',
224
+ searchFields: ['page_type', 'rule_slug', 'canonical_strategy'],
225
+ filterFields: ['site_id', 'catalog_category_id', 'status', 'page_type'],
226
+ fields: ['site_id', 'catalog_category_id', 'page_type', 'rule_slug', 'status', 'generation_query_json', 'min_product_count', 'min_attribute_coverage', 'canonical_strategy', 'priority', 'template_json'],
227
+ statusField: 'status',
228
+ activeStatusValue: 'active',
229
+ },
230
230
  {
231
231
  resource: 'import-sources',
232
232
  model: 'catalog_import_source',