@hed-hog/catalog 0.0.293 → 0.0.295
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.
- package/README.md +391 -361
- package/dist/catalog-resource.config.d.ts.map +1 -1
- package/dist/catalog-resource.config.js +51 -24
- package/dist/catalog-resource.config.js.map +1 -1
- package/dist/catalog.controller.d.ts +420 -0
- package/dist/catalog.controller.d.ts.map +1 -1
- package/dist/catalog.controller.js +98 -0
- package/dist/catalog.controller.js.map +1 -1
- package/dist/catalog.module.d.ts.map +1 -1
- package/dist/catalog.module.js +5 -1
- package/dist/catalog.module.js.map +1 -1
- package/dist/catalog.service.d.ts +216 -1
- package/dist/catalog.service.d.ts.map +1 -1
- package/dist/catalog.service.js +1121 -7
- package/dist/catalog.service.js.map +1 -1
- package/hedhog/data/catalog_attribute.yaml +202 -0
- package/hedhog/data/catalog_attribute_option.yaml +109 -0
- package/hedhog/data/catalog_category.yaml +47 -0
- package/hedhog/data/catalog_category_attribute.yaml +209 -0
- package/hedhog/data/menu.yaml +46 -12
- package/hedhog/data/role.yaml +7 -7
- package/hedhog/data/route.yaml +64 -0
- package/hedhog/frontend/app/[resource]/page.tsx.ejs +358 -0
- package/hedhog/frontend/app/_components/catalog-ai-form-assist-dialog.tsx.ejs +340 -0
- package/hedhog/frontend/app/_components/catalog-resource-form-sheet.tsx.ejs +815 -0
- package/hedhog/frontend/app/_lib/catalog-resources.tsx.ejs +504 -736
- package/hedhog/frontend/app/dashboard/page.tsx.ejs +14 -83
- package/hedhog/frontend/messages/en.json +150 -60
- package/hedhog/frontend/messages/pt.json +185 -95
- package/hedhog/table/catalog_affiliate_program.yaml +41 -41
- package/hedhog/table/catalog_attribute.yaml +22 -7
- package/hedhog/table/catalog_attribute_group.yaml +18 -18
- package/hedhog/table/catalog_attribute_option.yaml +40 -0
- package/hedhog/table/catalog_brand.yaml +34 -34
- package/hedhog/table/catalog_category.yaml +40 -0
- package/hedhog/table/catalog_category_attribute.yaml +13 -7
- package/hedhog/table/catalog_click_event.yaml +50 -50
- package/hedhog/table/catalog_comparison.yaml +3 -6
- package/hedhog/table/catalog_comparison_highlight.yaml +39 -39
- package/hedhog/table/catalog_comparison_item.yaml +30 -30
- package/hedhog/table/catalog_content_relation.yaml +42 -42
- package/hedhog/table/catalog_import_run.yaml +33 -33
- package/hedhog/table/catalog_import_source.yaml +24 -24
- package/hedhog/table/catalog_merchant.yaml +29 -29
- package/hedhog/table/catalog_offer.yaml +83 -83
- package/hedhog/table/catalog_price_history.yaml +34 -34
- package/hedhog/table/catalog_product.yaml +5 -3
- package/hedhog/table/catalog_product_attribute_value.yaml +15 -2
- package/hedhog/table/catalog_product_category.yaml +3 -3
- package/hedhog/table/catalog_product_image.yaml +34 -34
- package/hedhog/table/catalog_product_score.yaml +38 -38
- package/hedhog/table/catalog_product_site.yaml +47 -47
- package/hedhog/table/catalog_product_tag.yaml +19 -19
- package/hedhog/table/catalog_score_criterion.yaml +25 -8
- package/hedhog/table/catalog_seo_page_rule.yaml +2 -2
- package/hedhog/table/catalog_similarity_rule.yaml +19 -6
- package/hedhog/table/catalog_site.yaml +8 -0
- package/hedhog/table/catalog_site_category.yaml +3 -3
- package/package.json +7 -7
- package/src/catalog-resource.config.ts +51 -24
- package/src/catalog.controller.ts +67 -0
- package/src/catalog.module.ts +5 -1
- package/src/catalog.service.ts +1531 -6
- package/src/index.ts +1 -1
- package/src/language/en.json +4 -4
- package/src/language/pt.json +4 -4
|
@@ -25,6 +25,46 @@ let CatalogController = class CatalogController {
|
|
|
25
25
|
async listProductImages(id, paginationParams, locale) {
|
|
26
26
|
return this.catalogService.listProductImages(id, locale, paginationParams);
|
|
27
27
|
}
|
|
28
|
+
async categoriesTree() {
|
|
29
|
+
return this.catalogService.getCategoriesTree();
|
|
30
|
+
}
|
|
31
|
+
async listCategoryAttributes(id) {
|
|
32
|
+
return this.catalogService.listCategoryAttributes(id);
|
|
33
|
+
}
|
|
34
|
+
async listProductAttributes(id) {
|
|
35
|
+
return this.catalogService.listProductAttributes(id);
|
|
36
|
+
}
|
|
37
|
+
async structuredProduct(id) {
|
|
38
|
+
return this.catalogService.getProductStructuredPayload(id);
|
|
39
|
+
}
|
|
40
|
+
async comparisonPayload(id) {
|
|
41
|
+
return this.catalogService.getProductComparisonPayload(id);
|
|
42
|
+
}
|
|
43
|
+
async generateFormAssistSuggestion(resource, body, locale) {
|
|
44
|
+
var _a;
|
|
45
|
+
const prompt = String((_a = body.prompt) !== null && _a !== void 0 ? _a : '').trim();
|
|
46
|
+
if (!prompt) {
|
|
47
|
+
throw new common_1.BadRequestException('Prompt is required');
|
|
48
|
+
}
|
|
49
|
+
return this.catalogService.generateFormAssistSuggestion(resource, {
|
|
50
|
+
prompt,
|
|
51
|
+
current_values: body.current_values && typeof body.current_values === 'object'
|
|
52
|
+
? body.current_values
|
|
53
|
+
: {},
|
|
54
|
+
fields: Array.isArray(body.fields)
|
|
55
|
+
? body.fields
|
|
56
|
+
: [],
|
|
57
|
+
current_attribute_values: Array.isArray(body.current_attribute_values)
|
|
58
|
+
? body.current_attribute_values
|
|
59
|
+
: [],
|
|
60
|
+
}, locale);
|
|
61
|
+
}
|
|
62
|
+
async updateProductAttributes(id, values) {
|
|
63
|
+
return this.catalogService.updateProductAttributes(id, values !== null && values !== void 0 ? values : []);
|
|
64
|
+
}
|
|
65
|
+
async materializeProductSnapshots(id) {
|
|
66
|
+
return this.catalogService.materializeProductSnapshots(id);
|
|
67
|
+
}
|
|
28
68
|
async stats(resource, locale) {
|
|
29
69
|
return this.catalogService.stats(resource, locale);
|
|
30
70
|
}
|
|
@@ -54,6 +94,64 @@ __decorate([
|
|
|
54
94
|
__metadata("design:paramtypes", [Number, Object, String]),
|
|
55
95
|
__metadata("design:returntype", Promise)
|
|
56
96
|
], CatalogController.prototype, "listProductImages", null);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, common_1.Get)('categories/tree'),
|
|
99
|
+
__metadata("design:type", Function),
|
|
100
|
+
__metadata("design:paramtypes", []),
|
|
101
|
+
__metadata("design:returntype", Promise)
|
|
102
|
+
], CatalogController.prototype, "categoriesTree", null);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, common_1.Get)('categories/:id/attributes'),
|
|
105
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
106
|
+
__metadata("design:type", Function),
|
|
107
|
+
__metadata("design:paramtypes", [Number]),
|
|
108
|
+
__metadata("design:returntype", Promise)
|
|
109
|
+
], CatalogController.prototype, "listCategoryAttributes", null);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, common_1.Get)('products/:id/attributes'),
|
|
112
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
113
|
+
__metadata("design:type", Function),
|
|
114
|
+
__metadata("design:paramtypes", [Number]),
|
|
115
|
+
__metadata("design:returntype", Promise)
|
|
116
|
+
], CatalogController.prototype, "listProductAttributes", null);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, common_1.Get)('products/:id/structured'),
|
|
119
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [Number]),
|
|
122
|
+
__metadata("design:returntype", Promise)
|
|
123
|
+
], CatalogController.prototype, "structuredProduct", null);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, common_1.Get)('products/:id/comparison-payload'),
|
|
126
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
127
|
+
__metadata("design:type", Function),
|
|
128
|
+
__metadata("design:paramtypes", [Number]),
|
|
129
|
+
__metadata("design:returntype", Promise)
|
|
130
|
+
], CatalogController.prototype, "comparisonPayload", null);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, common_1.Post)('forms/:resource/ai-assist'),
|
|
133
|
+
__param(0, (0, common_1.Param)('resource')),
|
|
134
|
+
__param(1, (0, common_1.Body)()),
|
|
135
|
+
__param(2, (0, api_locale_1.Locale)()),
|
|
136
|
+
__metadata("design:type", Function),
|
|
137
|
+
__metadata("design:paramtypes", [String, Object, String]),
|
|
138
|
+
__metadata("design:returntype", Promise)
|
|
139
|
+
], CatalogController.prototype, "generateFormAssistSuggestion", null);
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, common_1.Put)('products/:id/attributes'),
|
|
142
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
143
|
+
__param(1, (0, common_1.Body)('values')),
|
|
144
|
+
__metadata("design:type", Function),
|
|
145
|
+
__metadata("design:paramtypes", [Number, Array]),
|
|
146
|
+
__metadata("design:returntype", Promise)
|
|
147
|
+
], CatalogController.prototype, "updateProductAttributes", null);
|
|
148
|
+
__decorate([
|
|
149
|
+
(0, common_1.Post)('products/:id/materialize-snapshots'),
|
|
150
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
151
|
+
__metadata("design:type", Function),
|
|
152
|
+
__metadata("design:paramtypes", [Number]),
|
|
153
|
+
__metadata("design:returntype", Promise)
|
|
154
|
+
], CatalogController.prototype, "materializeProductSnapshots", null);
|
|
57
155
|
__decorate([
|
|
58
156
|
(0, common_1.Get)(':resource/stats'),
|
|
59
157
|
__param(0, (0, common_1.Param)('resource')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.controller.js","sourceRoot":"","sources":["../src/catalog.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAoC;AACpC,oDAA6C;AAC7C,4DAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"catalog.controller.js","sourceRoot":"","sources":["../src/catalog.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAoC;AACpC,oDAA6C;AAC7C,4DAAqD;AACrD,2CAYwB;AACxB,uDAAmD;AAI5C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAG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V;AAGK;IADL,IAAA,YAAG,EAAC,WAAW,CAAC;IAEd,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,2BAAU,GAAE,CAAA;IACZ,WAAA,IAAA,cAAK,GAAE,CAAA;IACP,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;6CAGV;AAGK;IADL,IAAA,aAAI,EAAC,WAAW,CAAC;IAEf,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IACjB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;+CAGV;4BA/HU,iBAAiB;IAF7B,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,SAAS,CAAC;qCAEyB,gCAAc;GADhD,iBAAiB,CAgI7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.module.d.ts","sourceRoot":"","sources":["../src/catalog.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalog.module.d.ts","sourceRoot":"","sources":["../src/catalog.module.ts"],"names":[],"mappings":"AAMA,qBASa,aAAa;CAAG"}
|
package/dist/catalog.module.js
CHANGED
|
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.CatalogModule = void 0;
|
|
10
10
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
11
|
+
const core_1 = require("@hed-hog/core");
|
|
11
12
|
const common_1 = require("@nestjs/common");
|
|
12
13
|
const catalog_controller_1 = require("./catalog.controller");
|
|
13
14
|
const catalog_service_1 = require("./catalog.service");
|
|
@@ -16,7 +17,10 @@ let CatalogModule = class CatalogModule {
|
|
|
16
17
|
exports.CatalogModule = CatalogModule;
|
|
17
18
|
exports.CatalogModule = CatalogModule = __decorate([
|
|
18
19
|
(0, common_1.Module)({
|
|
19
|
-
imports: [
|
|
20
|
+
imports: [
|
|
21
|
+
(0, common_1.forwardRef)(() => api_pagination_1.PaginationModule),
|
|
22
|
+
(0, common_1.forwardRef)(() => core_1.AiModule),
|
|
23
|
+
],
|
|
20
24
|
controllers: [catalog_controller_1.CatalogController],
|
|
21
25
|
providers: [catalog_service_1.CatalogService],
|
|
22
26
|
exports: [catalog_service_1.CatalogService],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.module.js","sourceRoot":"","sources":["../src/catalog.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,2CAAoD;AACpD,6DAAyD;AACzD,uDAAmD;
|
|
1
|
+
{"version":3,"file":"catalog.module.js","sourceRoot":"","sources":["../src/catalog.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,wCAAyC;AACzC,2CAAoD;AACpD,6DAAyD;AACzD,uDAAmD;AAW5C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IATzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,eAAQ,CAAC;SAC3B;QACD,WAAW,EAAE,CAAC,sCAAiB,CAAC;QAChC,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG"}
|
|
@@ -1,14 +1,118 @@
|
|
|
1
1
|
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
2
2
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import { AiService } from '@hed-hog/core';
|
|
4
|
+
type CatalogAttributeValueInput = {
|
|
5
|
+
attribute_id?: number;
|
|
6
|
+
attribute_option_id?: number | null;
|
|
7
|
+
value_text?: string | null;
|
|
8
|
+
value_number?: number | null;
|
|
9
|
+
value_boolean?: boolean | null;
|
|
10
|
+
raw_value?: string | null;
|
|
11
|
+
value_unit?: string | null;
|
|
12
|
+
normalized_value?: string | null;
|
|
13
|
+
normalized_text?: string | null;
|
|
14
|
+
normalized_number?: number | null;
|
|
15
|
+
source_type?: string | null;
|
|
16
|
+
confidence_score?: number | null;
|
|
17
|
+
is_verified?: boolean | null;
|
|
18
|
+
};
|
|
19
|
+
type CatalogAttributeGroupPayload = {
|
|
20
|
+
id: number | null;
|
|
21
|
+
slug: string;
|
|
22
|
+
name: string;
|
|
23
|
+
attributes: Array<Record<string, any>>;
|
|
24
|
+
};
|
|
25
|
+
type CatalogAttributeSnapshotPayload = {
|
|
26
|
+
slug: string;
|
|
27
|
+
name: string;
|
|
28
|
+
data_type: string;
|
|
29
|
+
unit: string | null;
|
|
30
|
+
group_name: string;
|
|
31
|
+
is_required: boolean;
|
|
32
|
+
is_highlight: boolean;
|
|
33
|
+
is_filter_visible: boolean;
|
|
34
|
+
is_comparison_visible: boolean;
|
|
35
|
+
value: string | number | boolean | null;
|
|
36
|
+
value_text: string | null;
|
|
37
|
+
value_number: number | null;
|
|
38
|
+
value_boolean: boolean | null;
|
|
39
|
+
normalized_value: string | null;
|
|
40
|
+
raw_value: string | null;
|
|
41
|
+
option: {
|
|
42
|
+
id: number;
|
|
43
|
+
slug: string;
|
|
44
|
+
label: string;
|
|
45
|
+
option_value: string;
|
|
46
|
+
} | null;
|
|
47
|
+
};
|
|
48
|
+
type CatalogAiAssistInput = {
|
|
49
|
+
prompt: string;
|
|
50
|
+
current_values?: Record<string, unknown>;
|
|
51
|
+
fields?: Record<string, unknown>[];
|
|
52
|
+
current_attribute_values?: Record<string, unknown>[];
|
|
53
|
+
};
|
|
3
54
|
export declare class CatalogService {
|
|
4
55
|
private readonly prisma;
|
|
5
56
|
private readonly pagination;
|
|
6
|
-
|
|
57
|
+
private readonly aiService;
|
|
58
|
+
constructor(prisma: PrismaService, pagination: PaginationService, aiService: AiService);
|
|
7
59
|
private getConfig;
|
|
8
60
|
private getModel;
|
|
9
61
|
private normalizeValue;
|
|
62
|
+
private extractJsonObject;
|
|
63
|
+
private normalizeComparableText;
|
|
64
|
+
private normalizeAiFieldContext;
|
|
65
|
+
private normalizeBooleanSuggestion;
|
|
66
|
+
private normalizeNumberSuggestion;
|
|
67
|
+
private normalizeSelectSuggestion;
|
|
68
|
+
private resolveRelationSuggestion;
|
|
69
|
+
private normalizeAiFieldSuggestion;
|
|
70
|
+
private buildCurrentAttributeValueMap;
|
|
71
|
+
private buildAttributeContext;
|
|
72
|
+
private normalizeAiProductAttributeSuggestions;
|
|
73
|
+
private buildAiSystemPrompt;
|
|
10
74
|
private sanitizePayload;
|
|
11
75
|
private buildWhere;
|
|
76
|
+
private ensureCategoryExists;
|
|
77
|
+
private normalizeCategoryTree;
|
|
78
|
+
private buildCategoryAttributePayload;
|
|
79
|
+
private isMeaningfulAttributeValue;
|
|
80
|
+
private buildAttributeSnapshotValue;
|
|
81
|
+
private toAttributeSnapshot;
|
|
82
|
+
private decorateProductRecords;
|
|
83
|
+
private validateAttributeValueByType;
|
|
84
|
+
private buildProductStructuredPayload;
|
|
85
|
+
materializeProductSnapshots(productId: number): Promise<{
|
|
86
|
+
spec_snapshot_json: {
|
|
87
|
+
version: number;
|
|
88
|
+
source: string;
|
|
89
|
+
category: {
|
|
90
|
+
id: number;
|
|
91
|
+
slug: string;
|
|
92
|
+
name: string;
|
|
93
|
+
};
|
|
94
|
+
groups: {
|
|
95
|
+
id: number;
|
|
96
|
+
slug: string;
|
|
97
|
+
name: string;
|
|
98
|
+
attributes: CatalogAttributeSnapshotPayload[];
|
|
99
|
+
}[];
|
|
100
|
+
attributes: Record<string, CatalogAttributeSnapshotPayload>;
|
|
101
|
+
generated_at: string;
|
|
102
|
+
};
|
|
103
|
+
comparison_snapshot_json: {
|
|
104
|
+
version: number;
|
|
105
|
+
source: string;
|
|
106
|
+
category: {
|
|
107
|
+
id: number;
|
|
108
|
+
slug: string;
|
|
109
|
+
name: string;
|
|
110
|
+
};
|
|
111
|
+
highlights: CatalogAttributeSnapshotPayload[];
|
|
112
|
+
comparable_attributes: CatalogAttributeSnapshotPayload[];
|
|
113
|
+
generated_at: string;
|
|
114
|
+
};
|
|
115
|
+
}>;
|
|
12
116
|
list(resource: string, locale: string, paginationParams: PaginationDTO, query: Record<string, unknown>): Promise<{
|
|
13
117
|
total: any;
|
|
14
118
|
lastPage: number;
|
|
@@ -32,5 +136,116 @@ export declare class CatalogService {
|
|
|
32
136
|
next: number;
|
|
33
137
|
data: any[];
|
|
34
138
|
}>;
|
|
139
|
+
getCategoriesTree(): Promise<Record<string, any>[]>;
|
|
140
|
+
listCategoryAttributes(categoryId: number): Promise<{
|
|
141
|
+
category: {
|
|
142
|
+
name: string;
|
|
143
|
+
slug: string;
|
|
144
|
+
normalized_name: string | null;
|
|
145
|
+
description: string | null;
|
|
146
|
+
status: import(".prisma/client").$Enums.catalog_category_status_enum;
|
|
147
|
+
parent_category_id: number | null;
|
|
148
|
+
comparison_enabled: boolean;
|
|
149
|
+
sort_order: number;
|
|
150
|
+
id: number;
|
|
151
|
+
created_at: Date;
|
|
152
|
+
updated_at: Date;
|
|
153
|
+
};
|
|
154
|
+
product_id: number;
|
|
155
|
+
groups: CatalogAttributeGroupPayload[];
|
|
156
|
+
attributes: Record<string, any>[];
|
|
157
|
+
}>;
|
|
158
|
+
listProductAttributes(productId: number): Promise<{
|
|
159
|
+
category: {
|
|
160
|
+
name: string;
|
|
161
|
+
slug: string;
|
|
162
|
+
normalized_name: string | null;
|
|
163
|
+
description: string | null;
|
|
164
|
+
status: import(".prisma/client").$Enums.catalog_category_status_enum;
|
|
165
|
+
parent_category_id: number | null;
|
|
166
|
+
comparison_enabled: boolean;
|
|
167
|
+
sort_order: number;
|
|
168
|
+
id: number;
|
|
169
|
+
created_at: Date;
|
|
170
|
+
updated_at: Date;
|
|
171
|
+
};
|
|
172
|
+
product_id: number;
|
|
173
|
+
groups: CatalogAttributeGroupPayload[];
|
|
174
|
+
attributes: Record<string, any>[];
|
|
175
|
+
}>;
|
|
176
|
+
getProductStructuredPayload(productId: number): Promise<{
|
|
177
|
+
product: any;
|
|
178
|
+
category: {
|
|
179
|
+
name: string;
|
|
180
|
+
slug: string;
|
|
181
|
+
normalized_name: string | null;
|
|
182
|
+
description: string | null;
|
|
183
|
+
status: import(".prisma/client").$Enums.catalog_category_status_enum;
|
|
184
|
+
parent_category_id: number | null;
|
|
185
|
+
comparison_enabled: boolean;
|
|
186
|
+
sort_order: number;
|
|
187
|
+
id: number;
|
|
188
|
+
created_at: Date;
|
|
189
|
+
updated_at: Date;
|
|
190
|
+
};
|
|
191
|
+
groups: {
|
|
192
|
+
id: number;
|
|
193
|
+
slug: string;
|
|
194
|
+
name: string;
|
|
195
|
+
attributes: CatalogAttributeSnapshotPayload[];
|
|
196
|
+
}[];
|
|
197
|
+
attributes: CatalogAttributeSnapshotPayload[];
|
|
198
|
+
comparison: {
|
|
199
|
+
category: {
|
|
200
|
+
id: number;
|
|
201
|
+
slug: string;
|
|
202
|
+
name: string;
|
|
203
|
+
};
|
|
204
|
+
highlights: CatalogAttributeSnapshotPayload[];
|
|
205
|
+
comparable_attributes: CatalogAttributeSnapshotPayload[];
|
|
206
|
+
filter_attributes: CatalogAttributeSnapshotPayload[];
|
|
207
|
+
};
|
|
208
|
+
}>;
|
|
209
|
+
getProductComparisonPayload(productId: number): Promise<{
|
|
210
|
+
category: {
|
|
211
|
+
id: number;
|
|
212
|
+
slug: string;
|
|
213
|
+
name: string;
|
|
214
|
+
};
|
|
215
|
+
highlights: CatalogAttributeSnapshotPayload[];
|
|
216
|
+
comparable_attributes: CatalogAttributeSnapshotPayload[];
|
|
217
|
+
filter_attributes: CatalogAttributeSnapshotPayload[];
|
|
218
|
+
}>;
|
|
219
|
+
updateProductAttributes(productId: number, values: CatalogAttributeValueInput[]): Promise<{
|
|
220
|
+
category: {
|
|
221
|
+
name: string;
|
|
222
|
+
slug: string;
|
|
223
|
+
normalized_name: string | null;
|
|
224
|
+
description: string | null;
|
|
225
|
+
status: import(".prisma/client").$Enums.catalog_category_status_enum;
|
|
226
|
+
parent_category_id: number | null;
|
|
227
|
+
comparison_enabled: boolean;
|
|
228
|
+
sort_order: number;
|
|
229
|
+
id: number;
|
|
230
|
+
created_at: Date;
|
|
231
|
+
updated_at: Date;
|
|
232
|
+
};
|
|
233
|
+
product_id: number;
|
|
234
|
+
groups: CatalogAttributeGroupPayload[];
|
|
235
|
+
attributes: Record<string, any>[];
|
|
236
|
+
}>;
|
|
237
|
+
generateFormAssistSuggestion(resource: string, input: CatalogAiAssistInput, locale: string): Promise<{
|
|
238
|
+
resource: string;
|
|
239
|
+
fields: Record<string, unknown>;
|
|
240
|
+
applied_fields: {
|
|
241
|
+
key: string;
|
|
242
|
+
label: string;
|
|
243
|
+
type: string;
|
|
244
|
+
value: unknown;
|
|
245
|
+
}[];
|
|
246
|
+
product_attributes: Record<string, unknown>[];
|
|
247
|
+
warnings: string[];
|
|
248
|
+
}>;
|
|
35
249
|
}
|
|
250
|
+
export {};
|
|
36
251
|
//# sourceMappingURL=catalog.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.service.d.ts","sourceRoot":"","sources":["../src/catalog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog.service.d.ts","sourceRoot":"","sources":["../src/catalog.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAEH,aAAa,EAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C,KAAK,0BAA0B,GAAG;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACt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