@reactionary/hcl 0.10.25 → 0.10.26
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/factories/product/product.factory.js +7 -2
- package/factories/product-search/product-search.factory.js +8 -1
- package/package.json +2 -2
- package/src/factories/product/product.factory.d.ts +2 -1
- package/src/factories/product-search/product-search.factory.d.ts +3 -2
- package/src/test/test-utils.d.ts +37 -0
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
ProductAttributeValueSchema,
|
|
8
8
|
ProductOptionSchema,
|
|
9
9
|
ProductOptionValueSchema,
|
|
10
|
-
ProductVariantOptionSchema
|
|
10
|
+
ProductVariantOptionSchema,
|
|
11
|
+
ProductComplianceDataSchema
|
|
11
12
|
} from "@reactionary/core";
|
|
12
13
|
const USAGE_DEFINING = "Defining";
|
|
13
14
|
const USAGE_DESCRIPTIVE = "Descriptive";
|
|
@@ -120,6 +121,9 @@ class HclProductFactory {
|
|
|
120
121
|
constructor(productSchema) {
|
|
121
122
|
this.productSchema = productSchema;
|
|
122
123
|
}
|
|
124
|
+
parseComplianceData(context, data) {
|
|
125
|
+
return ProductComplianceDataSchema.parse({});
|
|
126
|
+
}
|
|
123
127
|
parseProduct(_context, data) {
|
|
124
128
|
const name = data.name;
|
|
125
129
|
const slug = data.seo?.href?.split("/").filter(Boolean).pop() ?? data.seo?.tokenValue ?? data.partNumber;
|
|
@@ -143,7 +147,8 @@ class HclProductFactory {
|
|
|
143
147
|
sharedAttributes,
|
|
144
148
|
options,
|
|
145
149
|
mainVariant,
|
|
146
|
-
variants
|
|
150
|
+
variants,
|
|
151
|
+
complianceData: this.parseComplianceData(_context, data)
|
|
147
152
|
};
|
|
148
153
|
return this.productSchema.parse(result);
|
|
149
154
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProductSearchResultItemComplianceDataSchema
|
|
3
|
+
} from "@reactionary/core";
|
|
1
4
|
class HclProductSearchFactory {
|
|
2
5
|
productSearchResultSchema;
|
|
3
6
|
constructor(productSearchResultSchema) {
|
|
@@ -24,6 +27,9 @@ class HclProductSearchFactory {
|
|
|
24
27
|
};
|
|
25
28
|
return this.productSearchResultSchema.parse(result);
|
|
26
29
|
}
|
|
30
|
+
parseComplianceData(data) {
|
|
31
|
+
return ProductSearchResultItemComplianceDataSchema.parse({});
|
|
32
|
+
}
|
|
27
33
|
parseSearchItem(p) {
|
|
28
34
|
const slug = p.seo?.href?.split("/").filter(Boolean).pop() ?? p.seo?.tokenValue ?? p.partNumber;
|
|
29
35
|
const variants = [
|
|
@@ -41,7 +47,8 @@ class HclProductSearchFactory {
|
|
|
41
47
|
identifier: { key: p.partNumber },
|
|
42
48
|
name: p.name ?? "",
|
|
43
49
|
slug,
|
|
44
|
-
variants
|
|
50
|
+
variants,
|
|
51
|
+
complianceData: this.parseComplianceData(p)
|
|
45
52
|
};
|
|
46
53
|
}
|
|
47
54
|
parseFacet(f, query) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/hcl",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "git+https://github.com/Solteq/reactionary.git"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@reactionary/core": "0.10.
|
|
12
|
+
"@reactionary/core": "0.10.26",
|
|
13
13
|
"debug": "^4.4.3",
|
|
14
14
|
"zod": "4.1.9"
|
|
15
15
|
},
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type ProductSchema, type AnyProductSchema, type ProductFactory, type RequestContext } from '@reactionary/core';
|
|
1
|
+
import { type ProductSchema, type AnyProductSchema, type ProductFactory, type RequestContext, type ProductComplianceData } from '@reactionary/core';
|
|
2
2
|
import type * as z from 'zod';
|
|
3
3
|
import type { HclProductResponse } from '../../schema/hcl.schema.js';
|
|
4
4
|
export declare class HclProductFactory<TProductSchema extends AnyProductSchema = typeof ProductSchema> implements ProductFactory<TProductSchema> {
|
|
5
5
|
readonly productSchema: TProductSchema;
|
|
6
6
|
constructor(productSchema: TProductSchema);
|
|
7
|
+
protected parseComplianceData(context: RequestContext, data: HclProductResponse): ProductComplianceData;
|
|
7
8
|
parseProduct(_context: RequestContext, data: HclProductResponse): z.output<TProductSchema>;
|
|
8
9
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnyProductSearchResultSchema, type ProductSearchFactory, type ProductSearchResultFacet, type ProductSearchResultItem, type RequestContext, type ProductSearchQueryByTerm } from '@reactionary/core';
|
|
2
2
|
import type * as z from 'zod';
|
|
3
|
-
import type { ProductSearchResultSchema } from '@reactionary/core';
|
|
3
|
+
import type { ProductSearchResultItemComplianceData, ProductSearchResultSchema } from '@reactionary/core';
|
|
4
4
|
import type { HclFacet, HclProductQueryResponse, HclProductSearchItem } from '../../schema/hcl.schema.js';
|
|
5
5
|
export declare class HclProductSearchFactory<TProductSearchResultSchema extends AnyProductSearchResultSchema = typeof ProductSearchResultSchema> implements ProductSearchFactory<TProductSearchResultSchema> {
|
|
6
6
|
readonly productSearchResultSchema: TProductSearchResultSchema;
|
|
7
7
|
constructor(productSearchResultSchema: TProductSearchResultSchema);
|
|
8
8
|
parseSearchResult(_context: RequestContext, data: HclProductQueryResponse, query: ProductSearchQueryByTerm): z.output<TProductSearchResultSchema>;
|
|
9
|
+
protected parseComplianceData(data: HclProductSearchItem): ProductSearchResultItemComplianceData;
|
|
9
10
|
protected parseSearchItem(p: HclProductSearchItem): ProductSearchResultItem;
|
|
10
11
|
protected parseFacet(f: HclFacet, query: ProductSearchQueryByTerm): ProductSearchResultFacet;
|
|
11
12
|
}
|
package/src/test/test-utils.d.ts
CHANGED
|
@@ -122,6 +122,35 @@ export declare function createHclClient(contextOverrides?: Partial<RequestContex
|
|
|
122
122
|
}, import("zod/v4/core").$loose>;
|
|
123
123
|
}, import("zod/v4/core").$loose>>;
|
|
124
124
|
}, import("zod/v4/core").$loose>>>;
|
|
125
|
+
complianceData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
126
|
+
ce_marking: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
127
|
+
weee_symbol: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
128
|
+
energy_class: import("zod").ZodOptional<import("zod").ZodString>;
|
|
129
|
+
garan_duration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
130
|
+
safety_warnings: import("zod").ZodOptional<import("zod").ZodString>;
|
|
131
|
+
composition: import("zod").ZodOptional<import("zod").ZodString>;
|
|
132
|
+
additional_disclosures: import("zod").ZodOptional<import("zod").ZodString>;
|
|
133
|
+
traceability: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
134
|
+
product_identifier: import("zod").ZodOptional<import("zod").ZodString>;
|
|
135
|
+
manufacturer: import("zod").ZodObject<{
|
|
136
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
137
|
+
postal_address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
138
|
+
electronic_address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
139
|
+
}, import("zod/v4/core").$strip>;
|
|
140
|
+
eu_responsible_person: import("zod").ZodObject<{
|
|
141
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
142
|
+
postal_address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
143
|
+
electronic_address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
144
|
+
}, import("zod/v4/core").$strip>;
|
|
145
|
+
}, import("zod/v4/core").$strip>>;
|
|
146
|
+
organic: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
147
|
+
is_organic: import("zod").ZodBoolean;
|
|
148
|
+
certification_type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
149
|
+
control_body_code: import("zod").ZodOptional<import("zod").ZodString>;
|
|
150
|
+
agriculture_origin: import("zod").ZodOptional<import("zod").ZodString>;
|
|
151
|
+
certificate_url: import("zod").ZodOptional<import("zod").ZodURL>;
|
|
152
|
+
}, import("zod/v4/core").$strip>>;
|
|
153
|
+
}, import("zod/v4/core").$loose>>;
|
|
125
154
|
}, import("zod/v4/core").$loose>>>;
|
|
126
155
|
productSearch: import("../index.js").HclProductSearchCapability<import("../index.js").HclProductSearchFactory<import("zod").ZodObject<{
|
|
127
156
|
pageNumber: import("zod").ZodNumber;
|
|
@@ -134,6 +163,14 @@ export declare function createHclClient(contextOverrides?: Partial<RequestContex
|
|
|
134
163
|
}, import("zod/v4/core").$loose>;
|
|
135
164
|
name: import("zod").ZodString;
|
|
136
165
|
slug: import("zod").ZodString;
|
|
166
|
+
complianceData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
167
|
+
ce_marking: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
168
|
+
weee_symbol: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
169
|
+
energy_class: import("zod").ZodOptional<import("zod").ZodString>;
|
|
170
|
+
garan_duration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
171
|
+
is_organic: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
172
|
+
organic_certification_type: import("zod").ZodOptional<import("zod").ZodString>;
|
|
173
|
+
}, import("zod/v4/core").$loose>>;
|
|
137
174
|
variants: import("zod").ZodArray<import("zod").ZodObject<{
|
|
138
175
|
variant: import("zod").ZodObject<{
|
|
139
176
|
sku: import("zod").ZodString;
|