@blux.ai/web-sdk 1.2.0 → 1.2.2
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/dist/package.json +1 -1
- package/dist/src/BluxClient.d.ts +3 -3
- package/dist/src/BluxClient.js +16 -17
- package/dist/src/BluxClient.js.map +1 -1
- package/dist/src/apis/APIs.d.ts +196 -44
- package/dist/src/apis/APIs.js +3 -13
- package/dist/src/apis/APIs.js.map +1 -1
- package/dist/src/apis/getItemRecommendations.d.ts +1 -1
- package/dist/src/constants/BLUX_ATTRIBUTES.js +2 -2
- package/dist/src/constants/BLUX_ATTRIBUTES.js.map +1 -1
- package/dist/src/events/AddCartaddEvent.d.ts +1 -1
- package/dist/src/events/AddCartaddEvent.js +2 -1
- package/dist/src/events/AddCartaddEvent.js.map +1 -1
- package/dist/src/events/AddInstantImpressionEvent.d.ts +1 -1
- package/dist/src/events/AddInstantImpressionEvent.js +2 -1
- package/dist/src/events/AddInstantImpressionEvent.js.map +1 -1
- package/dist/src/events/AddPageViewEvent.d.ts +1 -1
- package/dist/src/events/AddPageViewEvent.js +2 -2
- package/dist/src/events/AddPageViewEvent.js.map +1 -1
- package/dist/src/events/AddPersistentImpressionEvent.d.ts +1 -1
- package/dist/src/events/AddPersistentImpressionEvent.js +2 -1
- package/dist/src/events/AddPersistentImpressionEvent.js.map +1 -1
- package/dist/src/events/AddProductDetailViewEvent.d.ts +1 -1
- package/dist/src/events/AddProductDetailViewEvent.js +2 -1
- package/dist/src/events/AddProductDetailViewEvent.js.map +1 -1
- package/dist/src/events/AddSectionViewEvent.d.ts +1 -1
- package/dist/src/events/AddSectionViewEvent.js +2 -1
- package/dist/src/events/AddSectionViewEvent.js.map +1 -1
- package/dist/src/events/types.d.ts +12 -0
- package/dist/src/events/types.js.map +1 -1
- package/dist/src/recs/ItemRec.d.ts +5 -5
- package/dist/src/recs/ItemRec.js +3 -2
- package/dist/src/recs/ItemRec.js.map +1 -1
- package/dist/src/recs/types.d.ts +4 -8
- package/dist/src/recs/types.js.map +1 -1
- package/dist/src/utils/zodSchemas.d.ts +102 -54
- package/dist/src/utils/zodSchemas.js +57 -34
- package/dist/src/utils/zodSchemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAddProductDetailViewEvent } from "./types";
|
|
2
2
|
import { Event } from "./Event";
|
|
3
3
|
export declare class AddProductDetailViewEvent extends Event {
|
|
4
|
-
constructor({ item_id, prev_page, prev_section, recommendation_id, custom_event_properties, }: IAddProductDetailViewEvent);
|
|
4
|
+
constructor({ item_id, prev_page, prev_section, recommendation_id, custom_event_properties, trackings, }: IAddProductDetailViewEvent);
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Event, EventType } from "./Event";
|
|
2
2
|
export class AddProductDetailViewEvent extends Event {
|
|
3
|
-
constructor({ item_id, prev_page, prev_section, recommendation_id, custom_event_properties, }) {
|
|
3
|
+
constructor({ item_id, prev_page, prev_section, recommendation_id, custom_event_properties, trackings, }) {
|
|
4
4
|
super({
|
|
5
5
|
event_type: EventType.product_detail_view,
|
|
6
6
|
event_properties: {
|
|
@@ -8,6 +8,7 @@ export class AddProductDetailViewEvent extends Event {
|
|
|
8
8
|
prev_page,
|
|
9
9
|
prev_section,
|
|
10
10
|
recommendation_id,
|
|
11
|
+
trackings,
|
|
11
12
|
},
|
|
12
13
|
custom_event_properties,
|
|
13
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddProductDetailViewEvent.js","sourceRoot":"/","sources":["src/events/AddProductDetailViewEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,EACV,OAAO,EACP,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"AddProductDetailViewEvent.js","sourceRoot":"/","sources":["src/events/AddProductDetailViewEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,EACV,OAAO,EACP,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,SAAS,GACkB;QAC3B,KAAK,CAAC;YACJ,UAAU,EAAE,SAAS,CAAC,mBAAmB;YACzC,gBAAgB,EAAE;gBAChB,OAAO;gBACP,SAAS;gBACT,YAAY;gBACZ,iBAAiB;gBACjB,SAAS;aACV;YACD,uBAAuB;SACxB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { IAddProductDetailViewEvent } from \"./types\";\nimport { Event, EventType } from \"./Event\";\n\nexport class AddProductDetailViewEvent extends Event {\n constructor({\n item_id,\n prev_page,\n prev_section,\n recommendation_id,\n custom_event_properties,\n trackings,\n }: IAddProductDetailViewEvent) {\n super({\n event_type: EventType.product_detail_view,\n event_properties: {\n item_id,\n prev_page,\n prev_section,\n recommendation_id,\n trackings,\n },\n custom_event_properties,\n });\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAddSectionViewEvent } from "./types";
|
|
2
2
|
import { Event } from "./Event";
|
|
3
3
|
export declare class AddSectionViewEvent extends Event {
|
|
4
|
-
constructor({ section, recommendation_id, custom_event_properties, }: IAddSectionViewEvent);
|
|
4
|
+
constructor({ section, recommendation_id, custom_event_properties, trackings, }: IAddSectionViewEvent);
|
|
5
5
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Event, EventType } from "./Event";
|
|
2
2
|
export class AddSectionViewEvent extends Event {
|
|
3
|
-
constructor({ section, recommendation_id, custom_event_properties, }) {
|
|
3
|
+
constructor({ section, recommendation_id, custom_event_properties, trackings, }) {
|
|
4
4
|
super({
|
|
5
5
|
event_type: EventType.section_view,
|
|
6
6
|
event_properties: {
|
|
7
7
|
section,
|
|
8
8
|
recommendation_id,
|
|
9
|
+
trackings,
|
|
9
10
|
},
|
|
10
11
|
custom_event_properties,
|
|
11
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddSectionViewEvent.js","sourceRoot":"/","sources":["src/events/AddSectionViewEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"AddSectionViewEvent.js","sourceRoot":"/","sources":["src/events/AddSectionViewEvent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,uBAAuB,EACvB,SAAS,GACY;QACrB,KAAK,CAAC;YACJ,UAAU,EAAE,SAAS,CAAC,YAAY;YAClC,gBAAgB,EAAE;gBAChB,OAAO;gBACP,iBAAiB;gBACjB,SAAS;aACV;YACD,uBAAuB;SACxB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { IAddSectionViewEvent } from \"./types\";\nimport { Event, EventType } from \"./Event\";\n\nexport class AddSectionViewEvent extends Event {\n constructor({\n section,\n recommendation_id,\n custom_event_properties,\n trackings,\n }: IAddSectionViewEvent) {\n super({\n event_type: EventType.section_view,\n event_properties: {\n section,\n recommendation_id,\n trackings,\n },\n custom_event_properties,\n });\n }\n}\n"]}
|
|
@@ -10,6 +10,12 @@ type EventProperties = {
|
|
|
10
10
|
page?: string;
|
|
11
11
|
position?: number;
|
|
12
12
|
search_query?: string;
|
|
13
|
+
order_amount?: number;
|
|
14
|
+
paid_amount?: number;
|
|
15
|
+
trackings?: {
|
|
16
|
+
id: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
13
19
|
};
|
|
14
20
|
export interface EventRequest {
|
|
15
21
|
id: string;
|
|
@@ -28,12 +34,14 @@ export interface IAddProductDetailViewEvent extends BaseEvent {
|
|
|
28
34
|
recommendation_id?: string;
|
|
29
35
|
prev_page?: string;
|
|
30
36
|
prev_section?: string;
|
|
37
|
+
trackings?: EventProperties["trackings"];
|
|
31
38
|
}
|
|
32
39
|
export interface IAddLikeEvent extends BaseEvent {
|
|
33
40
|
item_id: string;
|
|
34
41
|
}
|
|
35
42
|
export interface IAddCartaddEvent extends BaseEvent {
|
|
36
43
|
item_id: string;
|
|
44
|
+
trackings?: EventProperties["trackings"];
|
|
37
45
|
}
|
|
38
46
|
export interface IAddRateEvent extends BaseEvent {
|
|
39
47
|
item_id: string;
|
|
@@ -52,10 +60,12 @@ export type IVisitEvent = BaseEvent;
|
|
|
52
60
|
export type IAddPageVisitEvent = BaseEvent;
|
|
53
61
|
export interface IAddPageViewEvent extends Omit<BaseEvent, "item_id"> {
|
|
54
62
|
page: string;
|
|
63
|
+
trackings?: EventProperties["trackings"];
|
|
55
64
|
}
|
|
56
65
|
export interface IAddSectionViewEvent extends Omit<BaseEvent, "item_id"> {
|
|
57
66
|
section: string;
|
|
58
67
|
recommendation_id?: string;
|
|
68
|
+
trackings?: EventProperties["trackings"];
|
|
59
69
|
}
|
|
60
70
|
export interface IAddInstantImpressionEvent extends BaseEvent {
|
|
61
71
|
item_id: string;
|
|
@@ -63,6 +73,7 @@ export interface IAddInstantImpressionEvent extends BaseEvent {
|
|
|
63
73
|
section: string;
|
|
64
74
|
position: number;
|
|
65
75
|
recommendation_id?: string;
|
|
76
|
+
trackings?: EventProperties["trackings"];
|
|
66
77
|
}
|
|
67
78
|
export interface IAddPersistentImpressionEvent extends BaseEvent {
|
|
68
79
|
item_id: string;
|
|
@@ -70,6 +81,7 @@ export interface IAddPersistentImpressionEvent extends BaseEvent {
|
|
|
70
81
|
section: string;
|
|
71
82
|
position: number;
|
|
72
83
|
recommendation_id?: string;
|
|
84
|
+
trackings?: EventProperties["trackings"];
|
|
73
85
|
}
|
|
74
86
|
export interface IAddSearchEvent extends BaseEvent {
|
|
75
87
|
search_query: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["src/events/types.ts"],"names":[],"mappings":"AAAA,uDAAuD","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype EventProperties = {\n item_id?: string;\n section?: string;\n prev_section?: string;\n recommendation_id?: string;\n price?: number;\n order_id?: string;\n rating?: number;\n prev_page?: string;\n page?: string;\n position?: number;\n search_query?: string;\n};\nexport interface EventRequest {\n id: string;\n event_type: string;\n event_properties?: EventProperties;\n custom_event_properties?: Record<string, any>;\n internal_event_properties?: { url?: string; ref?: string };\n captured_at: string;\n}\n\ntype BaseEvent = Omit<\n EventRequest,\n | \"event_type\"\n | \"id\"\n | \"captured_at\"\n | \"internal_event_properties\"\n | \"event_properties\"\n>;\n\nexport interface IAddProductDetailViewEvent extends BaseEvent {\n item_id: string;\n recommendation_id?: string;\n prev_page?: string;\n prev_section?: string;\n}\n\nexport interface IAddLikeEvent extends BaseEvent {\n item_id: string;\n}\n\nexport interface IAddCartaddEvent extends BaseEvent {\n item_id: string;\n}\n\nexport interface IAddRateEvent extends BaseEvent {\n item_id: string;\n rating: number;\n}\n\nexport interface IAddPurchaseEvent extends BaseEvent {\n item_id: string;\n price: number;\n order_id?: string;\n}\n\nexport interface IAddCustomEvent extends BaseEvent {\n event_type: string;\n event_properties?: EventProperties;\n}\n\nexport type IVisitEvent = BaseEvent;\n\nexport type IAddPageVisitEvent = BaseEvent;\n\nexport interface IAddPageViewEvent extends Omit<BaseEvent, \"item_id\"> {\n page: string;\n}\n\nexport interface IAddSectionViewEvent extends Omit<BaseEvent, \"item_id\"> {\n section: string;\n recommendation_id?: string;\n}\n\nexport interface IAddInstantImpressionEvent extends BaseEvent {\n item_id: string;\n page: string;\n section: string;\n position: number;\n recommendation_id?: string;\n}\n\nexport interface IAddPersistentImpressionEvent extends BaseEvent {\n item_id: string;\n page: string;\n section: string;\n position: number;\n recommendation_id?: string;\n}\n\nexport interface IAddSearchEvent extends BaseEvent {\n search_query: string;\n recommendation_id?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["src/events/types.ts"],"names":[],"mappings":"AAAA,uDAAuD","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype EventProperties = {\n item_id?: string;\n section?: string;\n prev_section?: string;\n recommendation_id?: string;\n price?: number;\n order_id?: string;\n rating?: number;\n prev_page?: string;\n page?: string;\n position?: number;\n search_query?: string;\n order_amount?: number;\n paid_amount?: number;\n trackings?: {\n id: string;\n type: string;\n }[];\n};\nexport interface EventRequest {\n id: string;\n event_type: string;\n event_properties?: EventProperties;\n custom_event_properties?: Record<string, any>;\n internal_event_properties?: { url?: string; ref?: string };\n captured_at: string;\n}\n\ntype BaseEvent = Omit<\n EventRequest,\n | \"event_type\"\n | \"id\"\n | \"captured_at\"\n | \"internal_event_properties\"\n | \"event_properties\"\n>;\n\nexport interface IAddProductDetailViewEvent extends BaseEvent {\n item_id: string;\n recommendation_id?: string;\n prev_page?: string;\n prev_section?: string;\n trackings?: EventProperties[\"trackings\"];\n}\n\nexport interface IAddLikeEvent extends BaseEvent {\n item_id: string;\n}\n\nexport interface IAddCartaddEvent extends BaseEvent {\n item_id: string;\n trackings?: EventProperties[\"trackings\"];\n}\n\nexport interface IAddRateEvent extends BaseEvent {\n item_id: string;\n rating: number;\n}\n\nexport interface IAddPurchaseEvent extends BaseEvent {\n item_id: string;\n price: number;\n order_id?: string;\n}\n\nexport interface IAddCustomEvent extends BaseEvent {\n event_type: string;\n event_properties?: EventProperties;\n}\n\nexport type IVisitEvent = BaseEvent;\n\nexport type IAddPageVisitEvent = BaseEvent;\n\nexport interface IAddPageViewEvent extends Omit<BaseEvent, \"item_id\"> {\n page: string;\n trackings?: EventProperties[\"trackings\"];\n}\n\nexport interface IAddSectionViewEvent extends Omit<BaseEvent, \"item_id\"> {\n section: string;\n recommendation_id?: string;\n trackings?: EventProperties[\"trackings\"];\n}\n\nexport interface IAddInstantImpressionEvent extends BaseEvent {\n item_id: string;\n page: string;\n section: string;\n position: number;\n recommendation_id?: string;\n trackings?: EventProperties[\"trackings\"];\n}\n\nexport interface IAddPersistentImpressionEvent extends BaseEvent {\n item_id: string;\n page: string;\n section: string;\n position: number;\n recommendation_id?: string;\n trackings?: EventProperties[\"trackings\"];\n}\n\nexport interface IAddSearchEvent extends BaseEvent {\n search_query: string;\n recommendation_id?: string;\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Rec } from "./Rec";
|
|
2
|
-
import type { ICategoryRec,
|
|
2
|
+
import type { ICategoryRec, IItemRec, IItemsRec, IUserRec } from "./types";
|
|
3
3
|
export declare class UserRec extends Rec {
|
|
4
4
|
constructor({ call_type, limit, offset }: IUserRec);
|
|
5
5
|
}
|
|
6
|
-
export declare class
|
|
7
|
-
constructor({ call_type, item_id, limit, offset }:
|
|
6
|
+
export declare class ItemRec extends Rec {
|
|
7
|
+
constructor({ call_type, item_id, limit, offset }: IItemRec);
|
|
8
8
|
}
|
|
9
|
-
export declare class
|
|
10
|
-
constructor({ call_type, item_ids, limit, offset }:
|
|
9
|
+
export declare class ItemsRec extends Rec {
|
|
10
|
+
constructor({ call_type, item_ids, limit, offset }: IItemsRec);
|
|
11
11
|
}
|
|
12
12
|
export declare class CategoryRec extends Rec {
|
|
13
13
|
constructor({ call_type, category_id, limit, offset }: ICategoryRec);
|
package/dist/src/recs/ItemRec.js
CHANGED
|
@@ -8,7 +8,8 @@ export class UserRec extends Rec {
|
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
// (단일) 상품 기반 추천
|
|
12
|
+
export class ItemRec extends Rec {
|
|
12
13
|
constructor({ call_type, item_id, limit, offset }) {
|
|
13
14
|
super({
|
|
14
15
|
call_type,
|
|
@@ -18,7 +19,7 @@ export class ItemRelatedRec extends Rec {
|
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
export class
|
|
22
|
+
export class ItemsRec extends Rec {
|
|
22
23
|
constructor({ call_type, item_ids, limit, offset }) {
|
|
23
24
|
super({
|
|
24
25
|
call_type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemRec.js","sourceRoot":"/","sources":["src/recs/ItemRec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ItemRec.js","sourceRoot":"/","sources":["src/recs/ItemRec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,MAAM,OAAO,OAAQ,SAAQ,GAAG;IAC9B,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAY;QAChD,KAAK,CAAC;YACJ,SAAS;YACT,KAAK;YACL,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,OAAO,OAAQ,SAAQ,GAAG;IAC9B,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY;QACzD,KAAK,CAAC;YACJ,SAAS;YACT,OAAO;YACP,KAAK;YACL,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,GAAG;IAC/B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAa;QAC3D,KAAK,CAAC;YACJ,SAAS;YACT,QAAQ;YACR,KAAK;YACL,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,WAAY,SAAQ,GAAG;IAClC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAgB;QACjE,KAAK,CAAC;YACJ,SAAS;YACT,WAAW;YACX,KAAK;YACL,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Rec } from \"./Rec\";\nimport type { ICategoryRec, IItemRec, IItemsRec, IUserRec } from \"./types\";\n\nexport class UserRec extends Rec {\n constructor({ call_type, limit, offset }: IUserRec) {\n super({\n call_type,\n limit,\n offset,\n });\n }\n}\n\n// (단일) 상품 기반 추천\nexport class ItemRec extends Rec {\n constructor({ call_type, item_id, limit, offset }: IItemRec) {\n super({\n call_type,\n item_id,\n limit,\n offset,\n });\n }\n}\n\nexport class ItemsRec extends Rec {\n constructor({ call_type, item_ids, limit, offset }: IItemsRec) {\n super({\n call_type,\n item_ids,\n limit,\n offset,\n });\n }\n}\n\nexport class CategoryRec extends Rec {\n constructor({ call_type, category_id, limit, offset }: ICategoryRec) {\n super({\n call_type,\n category_id,\n limit,\n offset,\n });\n }\n}\n"]}
|
package/dist/src/recs/types.d.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
interface CategoryId {
|
|
2
|
-
depth: "1" | "2" | "3";
|
|
3
|
-
value: string;
|
|
4
|
-
}
|
|
5
1
|
export interface RecRequest {
|
|
6
2
|
call_type: string;
|
|
7
3
|
limit: number;
|
|
8
4
|
offset?: number;
|
|
9
5
|
item_id?: string;
|
|
10
6
|
item_ids?: string[];
|
|
11
|
-
category_id?:
|
|
7
|
+
category_id?: string;
|
|
12
8
|
}
|
|
13
9
|
type BaseRec = Omit<RecRequest, "call_type" | "item_id" | "item_ids" | "category_id">;
|
|
14
10
|
export interface BaseItemRec extends BaseRec {
|
|
15
11
|
call_type: string;
|
|
16
12
|
}
|
|
17
13
|
export type IUserRec = BaseItemRec;
|
|
18
|
-
export interface
|
|
14
|
+
export interface IItemRec extends BaseItemRec {
|
|
19
15
|
item_id: string;
|
|
20
16
|
}
|
|
21
|
-
export interface
|
|
17
|
+
export interface IItemsRec extends BaseItemRec {
|
|
22
18
|
item_ids: string[];
|
|
23
19
|
}
|
|
24
20
|
export interface ICategoryRec extends BaseItemRec {
|
|
25
|
-
category_id:
|
|
21
|
+
category_id: string;
|
|
26
22
|
}
|
|
27
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["src/recs/types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["src/recs/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface RecRequest {\n call_type: string;\n limit: number;\n offset?: number;\n item_id?: string;\n item_ids?: string[];\n category_id?: string;\n}\n\ntype BaseRec = Omit<\n RecRequest,\n \"call_type\" | \"item_id\" | \"item_ids\" | \"category_id\"\n>;\n\nexport interface BaseItemRec extends BaseRec {\n call_type: string;\n}\n\nexport type IUserRec = BaseItemRec;\n\nexport interface IItemRec extends BaseItemRec {\n item_id: string;\n}\n\nexport interface IItemsRec extends BaseItemRec {\n item_ids: string[];\n}\n\nexport interface ICategoryRec extends BaseItemRec {\n category_id: string;\n}\n"]}
|
|
@@ -4,22 +4,94 @@ export declare const objectIdSchema: z.ZodEffects<z.ZodEffects<z.ZodString, stri
|
|
|
4
4
|
export declare const stringToNumberSchema: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string | number, string | number>, number, string | number>;
|
|
5
5
|
export declare const dateSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>;
|
|
6
6
|
export declare const anonymousObjectSchema: <T extends object = object>() => z.ZodEffects<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, T, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
7
|
-
export declare const countryCodeWithLowerCaseSchema: z.ZodEffects<z.ZodEnum<["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BA" | "BW" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "KH" | "CM" | "CV" | "KY" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CG" | "CD" | "CK" | "CR" | "CI" | "HR" | "CU" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "HT" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "JM" | "JP" | "JO" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "GY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "RO" | "RU" | "KZ" | "RW" | "RE" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SK" | "SI" | "SB" | "SO" | "ZA" | "SS" | "ES" | "LK" | "SD" | "SR" | "SZ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "US" | "CA" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BA" | "BW" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "KH" | "CM" | "CV" | "KY" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CG" | "CD" | "CK" | "CR" | "CI" | "HR" | "CU" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "HT" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "JM" | "JP" | "JO" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "GY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "RO" | "RU" | "KZ" | "RW" | "RE" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SK" | "SI" | "SB" | "SO" | "ZA" | "SS" | "ES" | "LK" | "SD" | "SR" | "SZ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "US" | "CA" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "YE" | "ZM" | "ZW")[]]
|
|
8
|
-
export declare const customPropertiesRequestSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodNull]>>;
|
|
9
|
-
export declare const customPropertiesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many"
|
|
7
|
+
export declare const countryCodeWithLowerCaseSchema: z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodString, string, string>, z.ZodUnion<[z.ZodLiteral<"419">, z.ZodEnum<["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BA" | "BW" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "KH" | "CM" | "CV" | "KY" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CG" | "CD" | "CK" | "CR" | "CI" | "HR" | "CU" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "HT" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "JM" | "JP" | "JO" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "GY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "RO" | "RU" | "KZ" | "RW" | "RE" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SK" | "SI" | "SB" | "SO" | "ZA" | "SS" | "ES" | "LK" | "SD" | "SR" | "SZ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "US" | "CA" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BA" | "BW" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "KH" | "CM" | "CV" | "KY" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CG" | "CD" | "CK" | "CR" | "CI" | "HR" | "CU" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "HT" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "JM" | "JP" | "JO" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "GY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "RO" | "RU" | "KZ" | "RW" | "RE" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SK" | "SI" | "SB" | "SO" | "ZA" | "SS" | "ES" | "LK" | "SD" | "SR" | "SZ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "US" | "CA" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "YE" | "ZM" | "ZW")[]]>]>>, "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BA" | "BW" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "KH" | "CM" | "CV" | "KY" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CG" | "CD" | "CK" | "CR" | "CI" | "HR" | "CU" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "HT" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IL" | "IT" | "JM" | "JP" | "JO" | "KE" | "KI" | "KP" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "GY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "RO" | "RU" | "KZ" | "RW" | "RE" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SK" | "SI" | "SB" | "SO" | "ZA" | "SS" | "ES" | "LK" | "SD" | "SR" | "SZ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "US" | "CA" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "YE" | "ZM" | "ZW" | undefined, string>;
|
|
8
|
+
export declare const customPropertiesRequestSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">, z.ZodNull, z.ZodUndefined]>>;
|
|
9
|
+
export declare const customPropertiesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "many">, z.ZodUndefined]>>;
|
|
10
10
|
export type CustomProperties = z.infer<typeof customPropertiesSchema>;
|
|
11
|
-
export declare enum CustomPropertyDataType {
|
|
12
|
-
DATE = "DATE",
|
|
13
|
-
STRING = "STRING",
|
|
14
|
-
NUMBER = "NUMBER",
|
|
15
|
-
BOOLEAN = "BOOLEAN",
|
|
16
|
-
ARRAY_OF_STRING = "ARRAY_OF_STRING"
|
|
17
|
-
}
|
|
18
|
-
export declare const stringToObjectIdsSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string[], string>, string[], string>, ObjectId[], string>;
|
|
19
11
|
export declare const stringToArraySchema: z.ZodEffects<z.ZodEffects<z.ZodString, string[], string>, string[], string>;
|
|
20
|
-
export declare const
|
|
12
|
+
export declare const eventPropertiesSchema: z.ZodObject<{
|
|
13
|
+
section: z.ZodOptional<z.ZodString>;
|
|
14
|
+
prev_section: z.ZodOptional<z.ZodString>;
|
|
15
|
+
recommendation_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
price: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
order_id: z.ZodOptional<z.ZodString>;
|
|
18
|
+
rating: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
prev_page: z.ZodOptional<z.ZodString>;
|
|
20
|
+
page: z.ZodOptional<z.ZodString>;
|
|
21
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
item_id: z.ZodOptional<z.ZodString>;
|
|
23
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
price: z.ZodNumber;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
price: number;
|
|
29
|
+
}, {
|
|
30
|
+
id: string;
|
|
31
|
+
price: number;
|
|
32
|
+
}>, "many">>;
|
|
33
|
+
search_query: z.ZodOptional<z.ZodString>;
|
|
34
|
+
order_amount: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
paid_amount: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
trackings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
type: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
id: string;
|
|
41
|
+
type: string;
|
|
42
|
+
}, {
|
|
43
|
+
id: string;
|
|
44
|
+
type: string;
|
|
45
|
+
}>, "many">>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
item_id?: string | undefined;
|
|
48
|
+
recommendation_id?: string | undefined;
|
|
49
|
+
prev_page?: string | undefined;
|
|
50
|
+
prev_section?: string | undefined;
|
|
51
|
+
trackings?: {
|
|
52
|
+
id: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
rating?: number | undefined;
|
|
56
|
+
price?: number | undefined;
|
|
57
|
+
order_id?: string | undefined;
|
|
58
|
+
page?: string | undefined;
|
|
59
|
+
section?: string | undefined;
|
|
60
|
+
position?: number | undefined;
|
|
61
|
+
search_query?: string | undefined;
|
|
62
|
+
items?: {
|
|
63
|
+
id: string;
|
|
64
|
+
price: number;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
order_amount?: number | undefined;
|
|
67
|
+
paid_amount?: number | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
item_id?: string | undefined;
|
|
70
|
+
recommendation_id?: string | undefined;
|
|
71
|
+
prev_page?: string | undefined;
|
|
72
|
+
prev_section?: string | undefined;
|
|
73
|
+
trackings?: {
|
|
74
|
+
id: string;
|
|
75
|
+
type: string;
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
rating?: number | undefined;
|
|
78
|
+
price?: number | undefined;
|
|
79
|
+
order_id?: string | undefined;
|
|
80
|
+
page?: string | undefined;
|
|
81
|
+
section?: string | undefined;
|
|
82
|
+
position?: number | undefined;
|
|
83
|
+
search_query?: string | undefined;
|
|
84
|
+
items?: {
|
|
85
|
+
id: string;
|
|
86
|
+
price: number;
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
order_amount?: number | undefined;
|
|
89
|
+
paid_amount?: number | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
export type EventProperties = z.infer<typeof eventPropertiesSchema>;
|
|
92
|
+
export declare const recommendationRequestSchema: z.ZodObject<z.objectUtil.extendShape<Pick<{
|
|
21
93
|
application_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, ObjectId, string>;
|
|
22
|
-
blux_user_id: z.
|
|
94
|
+
blux_user_id: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, ObjectId, string>>>;
|
|
23
95
|
pipeline: z.ZodArray<z.ZodObject<{
|
|
24
96
|
name: z.ZodString;
|
|
25
97
|
kwargs: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -30,55 +102,31 @@ export declare const inferencePipelineRequestSchema: z.ZodObject<{
|
|
|
30
102
|
name: string;
|
|
31
103
|
kwargs: Record<string, any>;
|
|
32
104
|
}>, "many">;
|
|
33
|
-
item_id: z.
|
|
34
|
-
item_ids: z.
|
|
35
|
-
category_id: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
36
|
-
depth: z.ZodEnum<["1", "2", "3"]>;
|
|
37
|
-
value: z.ZodString;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
value: string;
|
|
40
|
-
depth: "1" | "2" | "3";
|
|
41
|
-
}, {
|
|
42
|
-
value: string;
|
|
43
|
-
depth: "1" | "2" | "3";
|
|
44
|
-
}>>>;
|
|
105
|
+
item_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
item_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
45
107
|
limit: z.ZodNumber;
|
|
46
|
-
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
name: string;
|
|
53
|
-
kwargs: Record<string, any>;
|
|
54
|
-
}[];
|
|
55
|
-
item_ids: string[] | null;
|
|
56
|
-
category_id: {
|
|
57
|
-
value: string;
|
|
58
|
-
depth: "1" | "2" | "3";
|
|
59
|
-
} | null;
|
|
108
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
109
|
+
options: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
110
|
+
}, "item_id" | "item_ids" | "limit" | "offset">, {
|
|
111
|
+
call_type: z.ZodString;
|
|
112
|
+
category_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
}>, "strip", z.ZodTypeAny, {
|
|
60
114
|
limit: number;
|
|
61
|
-
offset: number;
|
|
115
|
+
offset: number | null;
|
|
116
|
+
call_type: string;
|
|
117
|
+
item_id?: string | null | undefined;
|
|
118
|
+
item_ids?: string[] | null | undefined;
|
|
119
|
+
category_id?: string | null | undefined;
|
|
62
120
|
}, {
|
|
63
|
-
application_id: string;
|
|
64
|
-
pipeline: {
|
|
65
|
-
name: string;
|
|
66
|
-
kwargs: Record<string, any>;
|
|
67
|
-
}[];
|
|
68
121
|
limit: number;
|
|
122
|
+
call_type: string;
|
|
69
123
|
item_id?: string | null | undefined;
|
|
70
|
-
blux_user_id?: string | null | undefined;
|
|
71
124
|
item_ids?: string[] | null | undefined;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
depth: "1" | "2" | "3";
|
|
75
|
-
} | null | undefined;
|
|
76
|
-
offset?: number | undefined;
|
|
125
|
+
offset?: number | null | undefined;
|
|
126
|
+
category_id?: string | null | undefined;
|
|
77
127
|
}>;
|
|
78
|
-
export type
|
|
128
|
+
export type RecResponse = {
|
|
79
129
|
item_ids: string[];
|
|
80
|
-
count: number;
|
|
81
130
|
metadata: Record<string, unknown>;
|
|
82
|
-
timestamp: number;
|
|
83
131
|
recommendation_id: string | null;
|
|
84
132
|
};
|
|
@@ -58,20 +58,23 @@ export const anonymousObjectSchema = () => z
|
|
|
58
58
|
.object({})
|
|
59
59
|
.passthrough()
|
|
60
60
|
.transform((v) => convertAllObjectId(v));
|
|
61
|
-
export const countryCodeWithLowerCaseSchema = z
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
export const countryCodeWithLowerCaseSchema = z
|
|
62
|
+
.string()
|
|
63
|
+
.transform((v) => v.toUpperCase())
|
|
64
|
+
.pipe(z.union([
|
|
65
|
+
z.literal("419"),
|
|
66
|
+
z.enum(COUNTRY_CODES),
|
|
67
|
+
]))
|
|
68
|
+
.transform((v) => (v === "419" ? undefined : v));
|
|
68
69
|
export const customPropertiesRequestSchema = z.record(z.union([
|
|
69
70
|
dateSchema,
|
|
70
71
|
z.string(),
|
|
71
72
|
z.number(),
|
|
72
73
|
z.boolean(),
|
|
73
74
|
z.array(z.string()),
|
|
75
|
+
z.array(z.object({})),
|
|
74
76
|
z.null(),
|
|
77
|
+
z.undefined(),
|
|
75
78
|
]));
|
|
76
79
|
export const customPropertiesSchema = z.record(z.union([
|
|
77
80
|
dateSchema,
|
|
@@ -79,46 +82,66 @@ export const customPropertiesSchema = z.record(z.union([
|
|
|
79
82
|
z.number(),
|
|
80
83
|
z.boolean(),
|
|
81
84
|
z.array(z.string()),
|
|
85
|
+
z.array(z.object({})),
|
|
86
|
+
z.undefined(),
|
|
82
87
|
]));
|
|
83
88
|
assertEqualTypes(true);
|
|
84
|
-
export var CustomPropertyDataType;
|
|
85
|
-
(function (CustomPropertyDataType) {
|
|
86
|
-
CustomPropertyDataType["DATE"] = "DATE";
|
|
87
|
-
CustomPropertyDataType["STRING"] = "STRING";
|
|
88
|
-
CustomPropertyDataType["NUMBER"] = "NUMBER";
|
|
89
|
-
CustomPropertyDataType["BOOLEAN"] = "BOOLEAN";
|
|
90
|
-
CustomPropertyDataType["ARRAY_OF_STRING"] = "ARRAY_OF_STRING";
|
|
91
|
-
})(CustomPropertyDataType || (CustomPropertyDataType = {}));
|
|
92
|
-
export const stringToObjectIdsSchema = z
|
|
93
|
-
.string()
|
|
94
|
-
.transform((v) => v.split(","))
|
|
95
|
-
.refine((arr) => arr.every((item) => item.length > 0), {
|
|
96
|
-
message: "Each ObjectId should not be empty",
|
|
97
|
-
})
|
|
98
|
-
.transform((arr) => arr.map((id) => objectIdSchema.parse(id)));
|
|
99
89
|
export const stringToArraySchema = z
|
|
100
90
|
.string()
|
|
101
91
|
.transform((v) => v.split(",").map((item) => item.trim()))
|
|
102
92
|
.refine((arr) => arr.every((item) => item.length > 0), {
|
|
103
93
|
message: "Each item should not be empty",
|
|
104
94
|
});
|
|
105
|
-
export const
|
|
95
|
+
export const eventPropertiesSchema = z.object({
|
|
96
|
+
section: z.string().optional(),
|
|
97
|
+
prev_section: z.string().optional(),
|
|
98
|
+
recommendation_id: z.string().optional(),
|
|
99
|
+
price: z.number().optional(),
|
|
100
|
+
order_id: z.string().optional(),
|
|
101
|
+
rating: z.number().optional(),
|
|
102
|
+
prev_page: z.string().optional(),
|
|
103
|
+
page: z.string().optional(),
|
|
104
|
+
position: z.number().optional(),
|
|
105
|
+
item_id: z.string().optional(),
|
|
106
|
+
items: z
|
|
107
|
+
.array(z.object({
|
|
108
|
+
id: z.string(),
|
|
109
|
+
price: z.number(),
|
|
110
|
+
}))
|
|
111
|
+
.optional(),
|
|
112
|
+
search_query: z.string().optional(),
|
|
113
|
+
order_amount: z.number().optional(),
|
|
114
|
+
paid_amount: z.number().optional(),
|
|
115
|
+
trackings: z
|
|
116
|
+
.array(z.object({
|
|
117
|
+
id: z.string(),
|
|
118
|
+
type: z.string(),
|
|
119
|
+
}))
|
|
120
|
+
.optional(),
|
|
121
|
+
});
|
|
122
|
+
// Schema for Inference API
|
|
123
|
+
const inferenceRequestSchema = z.object({
|
|
106
124
|
application_id: objectIdSchema,
|
|
107
|
-
blux_user_id: objectIdSchema.
|
|
125
|
+
blux_user_id: objectIdSchema.nullish(),
|
|
108
126
|
pipeline: z.array(z.object({
|
|
109
127
|
name: z.string(),
|
|
110
128
|
kwargs: z.record(z.any()),
|
|
111
129
|
})),
|
|
112
|
-
item_id: z.string().
|
|
113
|
-
item_ids: z.array(z.string()).
|
|
114
|
-
category_id: z
|
|
115
|
-
.object({
|
|
116
|
-
depth: z.enum(["1", "2", "3"]),
|
|
117
|
-
value: z.string(),
|
|
118
|
-
})
|
|
119
|
-
.nullable()
|
|
120
|
-
.default(null),
|
|
130
|
+
item_id: z.string().nullish(),
|
|
131
|
+
item_ids: z.array(z.string()).nullish(),
|
|
121
132
|
limit: z.number(),
|
|
122
|
-
offset: z.number().
|
|
133
|
+
offset: z.number().nullish().default(0),
|
|
134
|
+
options: z.record(z.string(), z.any()).nullish(), // todo: legacy 클라이언트 migration만을 위한 필드라는 점을 고려하여 필드명 수정 필요 ex. legacy_options
|
|
135
|
+
});
|
|
136
|
+
export const recommendationRequestSchema = inferenceRequestSchema
|
|
137
|
+
.pick({
|
|
138
|
+
item_id: true,
|
|
139
|
+
item_ids: true,
|
|
140
|
+
limit: true,
|
|
141
|
+
offset: true,
|
|
142
|
+
})
|
|
143
|
+
.extend({
|
|
144
|
+
call_type: z.string(),
|
|
145
|
+
category_id: z.string().nullish(),
|
|
123
146
|
});
|
|
124
147
|
//# sourceMappingURL=zodSchemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodSchemas.js","sourceRoot":"/","sources":["src/utils/zodSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAC1B,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,QAAQ,CAAC;IACX;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qBAAqB,CAAC,EAAE;QACjC,IAAI,EAAE,CAAC,WAAW,CAAC;KACpB;CACF,CAAC,CACL;KACA,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,KAAK,CAAC,CAAC,CAAC,CAAC,M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AAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;IACrD,OAAO,EAAE,+BAA+B;CACzC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,cAAc,EAAE,cAAc;IAC9B,YAAY,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAErD,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;KAC1B,CAAC,CACH;IACD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACtD,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KAClB,CAAC;SACD,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;IAEhB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC","sourcesContent":["import { z, ZodError } from \"zod\";\nimport type { CountryCode } from \"../constants/COUNTRIES\";\nimport { COUNTRY_CODES } from \"../constants/COUNTRIES\";\nimport { assertEqualTypes } from \"./assertEqualTypes\";\nimport { ISO8601_REGEX } from \"../constants/ISO8601_REGEX\";\nimport ObjectId from \"bson-objectid\";\n\nfunction isObjectIdString(value: unknown): value is string {\n return (\n typeof value === \"string\" && value.length === 24 && ObjectId.isValid(value)\n );\n}\n\nexport const objectIdSchema = z\n .string()\n .refine(\n (v) => isObjectIdString(v),\n (v) =>\n new ZodError([\n {\n code: \"custom\",\n message: `Invalid ObjectId: ${v}`,\n path: [\"some_path\"],\n },\n ]),\n )\n .transform((v) => new ObjectId(v));\n\nexport const stringToNumberSchema = z\n .union([z.string(), z.number()])\n .refine(\n (v) => {\n if (typeof v === \"number\") return true;\n const parsed = Number(v);\n return !isNaN(parsed);\n },\n {\n message: \"Invalid number or string in stringToNumberSchema\",\n },\n )\n .transform((v): number => (typeof v === \"number\" ? v : Number(v)));\n\nexport const dateSchema = z\n .string()\n .refine(\n (dateString) => {\n return ISO8601_REGEX.test(dateString);\n },\n {\n message: \"Invalid date string\",\n },\n )\n .transform((dateString) => new Date(dateString));\n\nfunction convertAllObjectId(input: unknown): unknown {\n if (Array.isArray(input)) {\n return input.map((item) => convertAllObjectId(item));\n } else if (isObjectIdString(input)) {\n return new ObjectId(input);\n } else if (\n typeof input === \"string\" &&\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/.test(input)\n ) {\n return new Date(input);\n } else if (input !== null && typeof input === \"object\") {\n return Object.entries(input).reduce<Record<string, unknown>>(\n (acc, [key, value]) => {\n acc[key] = convertAllObjectId(value);\n return acc;\n },\n {},\n );\n }\n return input;\n}\n\nexport const anonymousObjectSchema = <T extends object = object>() =>\n z\n .object({})\n .passthrough()\n .transform((v) => convertAllObjectId(v) as T);\n\nexport const countryCodeWithLowerCaseSchema = z.preprocess(\n (v) => {\n if (v === \"419\") return undefined; // https://en.wikipedia.org/wiki/Language_code\n if (typeof v === \"string\") return v.toUpperCase();\n return v;\n },\n z.enum(COUNTRY_CODES as [CountryCode, ...CountryCode[]]),\n);\n\nexport const customPropertiesRequestSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.null(),\n ]),\n);\n\ntype CustomPropertiesRequest = z.infer<typeof customPropertiesRequestSchema>;\n\nexport const customPropertiesSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n ]),\n);\n\nexport type CustomProperties = z.infer<typeof customPropertiesSchema>;\n\nassertEqualTypes<\n {\n [K in keyof CustomPropertiesRequest]: Exclude<\n CustomPropertiesRequest[K],\n null\n >;\n },\n CustomProperties\n>(true);\n\nexport enum CustomPropertyDataType {\n DATE = \"DATE\",\n STRING = \"STRING\",\n NUMBER = \"NUMBER\",\n BOOLEAN = \"BOOLEAN\",\n ARRAY_OF_STRING = \"ARRAY_OF_STRING\",\n}\n\nexport const stringToObjectIdsSchema = z\n .string()\n .transform((v) => v.split(\",\"))\n .refine((arr) => arr.every((item) => item.length > 0), {\n message: \"Each ObjectId should not be empty\",\n })\n .transform((arr) => arr.map((id) => objectIdSchema.parse(id)));\n\nexport const stringToArraySchema = z\n .string()\n .transform((v) => v.split(\",\").map((item) => item.trim()))\n .refine((arr) => arr.every((item) => item.length > 0), {\n message: \"Each item should not be empty\",\n });\n\nexport const inferencePipelineRequestSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema.nullable().default(null),\n\n pipeline: z.array(\n z.object({\n name: z.string(),\n kwargs: z.record(z.any()),\n }),\n ),\n item_id: z.string().nullable().default(null),\n item_ids: z.array(z.string()).nullable().default(null),\n category_id: z\n .object({\n depth: z.enum([\"1\", \"2\", \"3\"]),\n value: z.string(),\n })\n .nullable()\n .default(null),\n\n limit: z.number(),\n offset: z.number().optional().default(0),\n});\n\nexport type InferencePipelineResponse = {\n item_ids: string[];\n count: number;\n metadata: Record<string, unknown>;\n timestamp: number;\n recommendation_id: string | null;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"zodSchemas.js","sourceRoot":"/","sources":["src/utils/zodSchemas.ts"],"names":[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AO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,8EAA8E;CACjI,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,sBAAsB;KAC9D,IAAI,CAAC;IACJ,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;CACb,CAAC;KACD,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CAClC,CAAC,CAAC","sourcesContent":["import { z, ZodError } from \"zod\";\nimport type { CountryCode } from \"../constants/COUNTRIES\";\nimport { COUNTRY_CODES } from \"../constants/COUNTRIES\";\nimport { assertEqualTypes } from \"./assertEqualTypes\";\nimport { ISO8601_REGEX } from \"../constants/ISO8601_REGEX\";\nimport ObjectId from \"bson-objectid\";\n\nfunction isObjectIdString(value: unknown): value is string {\n return (\n typeof value === \"string\" && value.length === 24 && ObjectId.isValid(value)\n );\n}\n\nexport const objectIdSchema = z\n .string()\n .refine(\n (v) => isObjectIdString(v),\n (v) =>\n new ZodError([\n {\n code: \"custom\",\n message: `Invalid ObjectId: ${v}`,\n path: [\"some_path\"],\n },\n ]),\n )\n .transform((v) => new ObjectId(v));\n\nexport const stringToNumberSchema = z\n .union([z.string(), z.number()])\n .refine(\n (v) => {\n if (typeof v === \"number\") return true;\n const parsed = Number(v);\n return !isNaN(parsed);\n },\n {\n message: \"Invalid number or string in stringToNumberSchema\",\n },\n )\n .transform((v): number => (typeof v === \"number\" ? v : Number(v)));\n\nexport const dateSchema = z\n .string()\n .refine(\n (dateString) => {\n return ISO8601_REGEX.test(dateString);\n },\n {\n message: \"Invalid date string\",\n },\n )\n .transform((dateString) => new Date(dateString));\n\nfunction convertAllObjectId(input: unknown): unknown {\n if (Array.isArray(input)) {\n return input.map((item) => convertAllObjectId(item));\n } else if (isObjectIdString(input)) {\n return new ObjectId(input);\n } else if (\n typeof input === \"string\" &&\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$/.test(input)\n ) {\n return new Date(input);\n } else if (input !== null && typeof input === \"object\") {\n return Object.entries(input).reduce<Record<string, unknown>>(\n (acc, [key, value]) => {\n acc[key] = convertAllObjectId(value);\n return acc;\n },\n {},\n );\n }\n return input;\n}\n\nexport const anonymousObjectSchema = <T extends object = object>() =>\n z\n .object({})\n .passthrough()\n .transform((v) => convertAllObjectId(v) as T);\n\nexport const countryCodeWithLowerCaseSchema = z\n .string()\n .transform((v) => v.toUpperCase())\n .pipe(\n z.union([\n z.literal(\"419\"), // https://en.wikipedia.org/wiki/Language_code\n z.enum(COUNTRY_CODES as [CountryCode, ...CountryCode[]]),\n ]),\n )\n .transform((v) => (v === \"419\" ? undefined : v));\n\nexport const customPropertiesRequestSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.object({})),\n z.null(),\n z.undefined(),\n ]),\n);\n\ntype CustomPropertiesRequest = z.infer<typeof customPropertiesRequestSchema>;\n\nexport const customPropertiesSchema = z.record(\n z.union([\n dateSchema,\n z.string(),\n z.number(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.object({})),\n z.undefined(),\n ]),\n);\n\nexport type CustomProperties = z.infer<typeof customPropertiesSchema>;\n\nassertEqualTypes<\n {\n [K in keyof CustomPropertiesRequest]: Exclude<\n CustomPropertiesRequest[K],\n null\n >;\n },\n CustomProperties\n>(true);\n\nexport const stringToArraySchema = z\n .string()\n .transform((v) => v.split(\",\").map((item) => item.trim()))\n .refine((arr) => arr.every((item) => item.length > 0), {\n message: \"Each item should not be empty\",\n });\n\nexport const eventPropertiesSchema = z.object({\n section: z.string().optional(),\n prev_section: z.string().optional(),\n recommendation_id: z.string().optional(),\n price: z.number().optional(),\n order_id: z.string().optional(),\n rating: z.number().optional(),\n prev_page: z.string().optional(),\n page: z.string().optional(),\n position: z.number().optional(),\n item_id: z.string().optional(),\n items: z\n .array(\n z.object({\n id: z.string(),\n price: z.number(),\n }),\n )\n .optional(),\n search_query: z.string().optional(),\n order_amount: z.number().optional(),\n paid_amount: z.number().optional(),\n trackings: z\n .array(\n z.object({\n id: z.string(),\n type: z.string(),\n }),\n )\n .optional(),\n});\nexport type EventProperties = z.infer<typeof eventPropertiesSchema>;\n\n// Schema for Inference API\nconst inferenceRequestSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema.nullish(),\n\n pipeline: z.array(\n z.object({\n name: z.string(),\n kwargs: z.record(z.any()),\n }),\n ),\n item_id: z.string().nullish(),\n item_ids: z.array(z.string()).nullish(),\n\n limit: z.number(),\n offset: z.number().nullish().default(0),\n options: z.record(z.string(), z.any()).nullish(), // todo: legacy 클라이언트 migration만을 위한 필드라는 점을 고려하여 필드명 수정 필요 ex. legacy_options\n});\n\nexport const recommendationRequestSchema = inferenceRequestSchema\n .pick({\n item_id: true,\n item_ids: true,\n limit: true,\n offset: true,\n })\n .extend({\n call_type: z.string(),\n category_id: z.string().nullish(),\n });\n\nexport type RecResponse = {\n item_ids: string[];\n metadata: Record<string, unknown>;\n recommendation_id: string | null;\n};\n"]}
|