@blux.ai/web-sdk 1.1.5 → 1.1.7-hotfix0

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.
Files changed (43) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/BluxClient.d.ts +5 -2
  3. package/dist/src/BluxClient.js +115 -50
  4. package/dist/src/BluxClient.js.map +1 -1
  5. package/dist/src/apis/APIs.d.ts +59 -50
  6. package/dist/src/apis/APIs.js +13 -18
  7. package/dist/src/apis/APIs.js.map +1 -1
  8. package/dist/src/apis/getItemRecommendations.d.ts +4 -0
  9. package/dist/src/apis/getItemRecommendations.js +7 -0
  10. package/dist/src/apis/getItemRecommendations.js.map +1 -0
  11. package/dist/src/index.d.ts +1 -1
  12. package/dist/src/index.js +1 -1
  13. package/dist/src/index.js.map +1 -1
  14. package/dist/src/recs/ItemRec.d.ts +14 -0
  15. package/dist/src/recs/ItemRec.js +42 -0
  16. package/dist/src/recs/ItemRec.js.map +1 -0
  17. package/dist/src/recs/Rec.d.ts +5 -0
  18. package/dist/src/{recommendations/Recommendation.js → recs/Rec.js} +2 -2
  19. package/dist/src/recs/Rec.js.map +1 -0
  20. package/dist/src/recs/index.d.ts +1 -0
  21. package/dist/src/recs/index.js +2 -0
  22. package/dist/src/recs/index.js.map +1 -0
  23. package/dist/src/recs/types.d.ts +23 -0
  24. package/dist/src/recs/types.js.map +1 -0
  25. package/dist/src/utils/zodSchemas.d.ts +41 -0
  26. package/dist/src/utils/zodSchemas.js +29 -3
  27. package/dist/src/utils/zodSchemas.js.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +1 -1
  30. package/dist/src/apis/getItemRecommendation.d.ts +0 -4
  31. package/dist/src/apis/getItemRecommendation.js +0 -7
  32. package/dist/src/apis/getItemRecommendation.js.map +0 -1
  33. package/dist/src/recommendations/ItemRecommendation.d.ts +0 -5
  34. package/dist/src/recommendations/ItemRecommendation.js +0 -12
  35. package/dist/src/recommendations/ItemRecommendation.js.map +0 -1
  36. package/dist/src/recommendations/Recommendation.d.ts +0 -5
  37. package/dist/src/recommendations/Recommendation.js.map +0 -1
  38. package/dist/src/recommendations/index.d.ts +0 -1
  39. package/dist/src/recommendations/index.js +0 -2
  40. package/dist/src/recommendations/index.js.map +0 -1
  41. package/dist/src/recommendations/types.d.ts +0 -12
  42. package/dist/src/recommendations/types.js.map +0 -1
  43. /package/dist/src/{recommendations → recs}/types.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"APIs.js","sourceRoot":"/","sources":["src/apis/APIs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACtB,UAAU,EACV,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,IAAK,UAKJ;AALD,WAAK,UAAU;IACb,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACnB,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAE1D,MAAM,KAAW,IAAI,CA8LpB;AA9LD,WAAiB,IAAI;IACnB,IAAiB,mBAAmB,CA6BnC;IA7BD,WAAiB,mBAAmB;QACrB,wBAAI,GAAG,qBAAqB,CAAC;QAC7B,wBAAI,GAAG,GAAG,gBAAgB,wBAAwB,CAAC;QACnD,0BAAM,GAAG,UAAU,CAAC,IAAI,CAAC;QAEzB,8BAAU,GAAG,CAAC,CAAC,MAAM,CAAC;YACjC,SAAS,EAAE,cAAc,CAAC,QAAQ,EAAE;YACpC,YAAY,EAAE,8BAA8B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,CAAC,QAAQ,EAAE;YACrC,YAAY,EAAE,cAAc;SAC7B,CAAC,CAAC;IAML,CAAC,EAnBgB,mCAAmC,GAAnC,wCAAmC,KAAnC,wCAAmC,QAmBnD;AACH,CAAC,EA9LgB,IAAI,KAAJ,IAAI,QA8LpB","sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\nimport { z } from \"zod\";\nimport {\n countryCodeWithLowerCaseSchema,\n customPropertiesRequestSchema,\n customPropertiesSchema,\n dateSchema,\n objectIdSchema,\n} from \"../utils/zodSchemas\";\nimport type { Serialize } from \"../utils/Base\";\n\nenum HttpMethod {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\",\n}\n\nexport enum DevicePlatform {\n ios = \"ios\",\n android = \"android\",\n browser = \"browser\",\n}\n\nconst applicationsRoot = \"/applications/{application_id}\";\n\nexport namespace APIs {\n export namespace bluxUsersInitialize {\n export const name = \"bluxUsersInitialize\";\n export const path = `${applicationsRoot}/blux-users/initialize`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n country_code: countryCodeWithLowerCaseSchema.optional(),\n device_model: z.string(),\n language_code: z.string(),\n os_version: z.string(),\n platform: z.nativeEnum(DevicePlatform),\n sdk_type: z.string(),\n sdk_version: z.string(),\n timezone: z.string(),\n isVisitHandlingInSdk: z.boolean().default(false), // sdk 업데이트 후 삭제\n blux_user_id: z.string().optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n device_id?: string;\n };\n }\n\n export namespace bluxUsersSignIn {\n export const name = \"bluxUsersSignIn\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-in`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n user_id: z.string(),\n device_id: z.string().optional(), // todo: sdk update 후 필수로 변경\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersSignOut {\n export const name = \"bluxUsersSignOut\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-out`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(), // todo: objectIdSchema 로 변경\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersCollectEvents {\n export const name = \"bluxUsersCollectEvents\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/collect-events`;\n export const method = HttpMethod.POST;\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export const bodySchema = z.object({\n events: z.array(\n z.object({\n device_id: objectIdSchema.optional(),\n event_type: z.string(),\n event_value: z.string().optional(),\n item_id: z.string().optional(),\n event_properties: customPropertiesSchema.optional(), // todo : remove this\n custom_event_properties: customPropertiesSchema.optional(),\n internal_event_properties: z\n .object({\n url: z.string().optional(),\n ref: z.string().optional(),\n })\n .optional(),\n captured_at: dateSchema,\n }),\n ),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export type ResponseData = boolean;\n }\n\n export namespace bluxUsersGetItemRecommendations {\n export const name = \"bluxUsersGetItemRecommendations\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/item-recommendations`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n call_type: z.string(),\n limit: z.number(),\n offset: z.number().default(0),\n item_ids: z.array(z.string()).optional(),\n options: z.record(z.string(), z.any()).optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n recommendation_id?: string;\n items: string[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n metadata: Record<string, any>;\n status: {\n is_success: boolean;\n code: number;\n message?: string;\n };\n };\n }\n\n export namespace bluxUsersUpdateUserProperties {\n export const name = \"bluxUsersUpdateUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: z.object({\n phone_number: z.string().nullable().optional(),\n email_address: z.string().nullable().optional(),\n nighttime_notification_consent: z.boolean().nullable().optional(),\n marketing_notification_consent: z.boolean().nullable().optional(),\n sms_consent: z.boolean().nullable().optional(),\n email_consent: z.boolean().nullable().optional(),\n }),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersUpdateCustomUserProperties {\n export const name = \"bluxUsersUpdateCustomUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-custom-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: customPropertiesRequestSchema,\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n}\n"]}
1
+ {"version":3,"file":"APIs.js","sourceRoot":"/","sources":["src/apis/APIs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,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C,CAAC,CAAC;QAGU,8CAAU,GAAG,CAAC,CAAC,MAAM,CAAC;YACjC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACrC,YAAY,EAAE,cAAc;SAC7B,CAAC,CAAC;IAML,CAAC,EAnBgB,mCAAmC,GAAnC,wCAAmC,KAAnC,wCAAmC,QAmBnD;IAED,IAAiB,iCAAiC,CAejD;IAfD,WAAiB,iCAAiC;QACnC,sCAAI,GAAG,mCAAmC,CAAC;QAC3C,sCAAI,GAAG,GAAG,kBAAkB,iDAAiD,CAAC;QAC9E,wCAAM,GAAG,UAAU,CAAC,IAAI,CAAC;QAEzB,4CAAU,GAAG,2BAA2B,CAAC;QAGzC,4CAAU,GAAG,CAAC,CAAC,MAAM,CAAC;YACjC,cAAc,EAAE,cAAc;YAC9B,YAAY,EAAE,cAAc;SAC7B,CAAC,CAAC;IAIL,CAAC,EAfgB,iCAAiC,GAAjC,sCAAiC,KAAjC,sCAAiC,QAejD;AACH,CAAC,EA9KgB,IAAI,KAAJ,IAAI,QA8KpB","sourcesContent":["/* eslint-disable @typescript-eslint/no-namespace */\nimport { z } from \"zod\";\nimport type { RecResponse } from \"../utils/zodSchemas\";\nimport {\n countryCodeWithLowerCaseSchema,\n customPropertiesRequestSchema,\n customPropertiesSchema,\n dateSchema,\n objectIdSchema,\n recommendationRequestSchema,\n} from \"../utils/zodSchemas\";\nimport type { Serialize } from \"../utils/Base\";\n\nenum HttpMethod {\n GET = \"get\",\n POST = \"post\",\n PUT = \"put\",\n DELETE = \"delete\",\n}\n\nexport enum DevicePlatform {\n ios = \"ios\",\n android = \"android\",\n browser = \"browser\",\n}\n\nconst applicationsRoot = \"/applications/{application_id}\";\nconst applicationsRootV2 = \"/v2/applications/{application_id}\";\n\nexport namespace APIs {\n export namespace bluxUsersInitialize {\n export const name = \"bluxUsersInitialize\";\n export const path = `${applicationsRoot}/blux-users/initialize`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n country_code: countryCodeWithLowerCaseSchema.optional(),\n device_model: z.string(),\n language_code: z.string(),\n os_version: z.string(),\n platform: z.nativeEnum(DevicePlatform),\n sdk_type: z.string(),\n sdk_version: z.string(),\n timezone: z.string(),\n isVisitHandlingInSdk: z.boolean().default(false), // sdk 업데이트 후 삭제\n blux_user_id: z.string().optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n device_id?: string;\n };\n }\n\n export namespace bluxUsersSignIn {\n export const name = \"bluxUsersSignIn\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-in`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n user_id: z.string(),\n device_id: z.string().optional(), // todo: sdk update 후 필수로 변경\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersSignOut {\n export const name = \"bluxUsersSignOut\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/sign-out`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n device_id: objectIdSchema.optional(),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(), // todo: objectIdSchema 로 변경\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersCollectEvents {\n export const name = \"bluxUsersCollectEvents\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/collect-events`;\n export const method = HttpMethod.POST;\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export const bodySchema = z.object({\n events: z.array(\n z.object({\n device_id: objectIdSchema.optional(),\n event_type: z.string(),\n event_value: z.string().optional(),\n item_id: z.string().optional(),\n event_properties: customPropertiesSchema.optional(), // todo : remove this\n custom_event_properties: customPropertiesSchema.optional(),\n internal_event_properties: z\n .object({\n url: z.string().optional(),\n ref: z.string().optional(),\n })\n .optional(),\n captured_at: dateSchema,\n }),\n ),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export type ResponseData = boolean;\n }\n\n export namespace bluxUsersUpdateUserProperties {\n export const name = \"bluxUsersUpdateUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: z.object({\n phone_number: z.string().nullable().optional(),\n email_address: z.string().nullable().optional(),\n nighttime_notification_consent: z.boolean().nullable().optional(),\n marketing_notification_consent: z.boolean().nullable().optional(),\n sms_consent: z.boolean().nullable().optional(),\n email_consent: z.boolean().nullable().optional(),\n }),\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersUpdateCustomUserProperties {\n export const name = \"bluxUsersUpdateCustomUserProperties\";\n export const path = `${applicationsRoot}/blux-users/{blux_user_id}/update-custom-user-properties`;\n export const method = HttpMethod.PUT;\n\n export const bodySchema = z.object({\n properties: customPropertiesRequestSchema,\n });\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: z.string().optional(),\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = {\n blux_user_id: string;\n };\n }\n\n export namespace bluxUsersGetItemRecommendationsV2 {\n export const name = \"bluxUsersGetItemRecommendationsV2\";\n export const path = `${applicationsRootV2}/blux-users/{blux_user_id}/item-recommendations`;\n export const method = HttpMethod.POST;\n\n export const bodySchema = recommendationRequestSchema;\n export type Body = Serialize<z.input<typeof bodySchema>>;\n\n export const pathSchema = z.object({\n application_id: objectIdSchema,\n blux_user_id: objectIdSchema,\n });\n export type PathParam = Serialize<z.input<typeof pathSchema>>;\n\n export type ResponseData = RecResponse;\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { AxiosInstance } from "axios";
2
+ import { APIs } from "./APIs";
3
+ import API = APIs.bluxUsersGetItemRecommendationsV2;
4
+ export declare const getItemRecommendations: (instance: AxiosInstance, pathParams: API.PathParam, body: API.Body, headers: Record<string, string>) => Promise<import("axios").AxiosResponse<import("../utils/zodSchemas").RecResponse, any>>;
@@ -0,0 +1,7 @@
1
+ import { APIs } from "./APIs";
2
+ import { getPath } from "../utils/getPath";
3
+ var API = APIs.bluxUsersGetItemRecommendationsV2;
4
+ export const getItemRecommendations = (instance, pathParams, body, headers) => {
5
+ return instance[API.method](getPath(API.path, pathParams), body, { headers });
6
+ };
7
+ //# sourceMappingURL=getItemRecommendations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getItemRecommendations.js","sourceRoot":"/","sources":["src/apis/getItemRecommendations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,IAAO,GAAG,GAAG,IAAI,CAAC,iCAAiC,CAAC;AAEpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,QAAuB,EACvB,UAAyB,EACzB,IAAc,EACd,OAA+B,EAC/B,EAAE;IACF,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CACzB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,EAC7B,IAAI,EACJ,EAAE,OAAO,EAAE,CACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { AxiosInstance } from \"axios\";\nimport { APIs } from \"./APIs\";\nimport { getPath } from \"../utils/getPath\";\n\nimport API = APIs.bluxUsersGetItemRecommendationsV2;\n\nexport const getItemRecommendations = (\n instance: AxiosInstance,\n pathParams: API.PathParam,\n body: API.Body,\n headers: Record<string, string>,\n) => {\n return instance[API.method]<API.ResponseData>(\n getPath(API.path, pathParams),\n body,\n { headers },\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  import { BluxClient } from "./BluxClient";
2
2
  export * from "./events";
3
- export * from "./recommendations";
3
+ export * from "./recs";
4
4
  export { BluxClient };
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BluxClient } from "./BluxClient";
2
2
  export * from "./events";
3
- export * from "./recommendations";
3
+ export * from "./recs";
4
4
  export { BluxClient };
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { BluxClient } from \"./BluxClient\";\n\nexport * from \"./events\";\nexport * from \"./recommendations\";\n\nexport { BluxClient };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { BluxClient } from \"./BluxClient\";\n\nexport * from \"./events\";\nexport * from \"./recs\";\n\nexport { BluxClient };\n"]}
@@ -0,0 +1,14 @@
1
+ import { Rec } from "./Rec";
2
+ import type { ICategoryRec, IItemRec, IItemsRec, IUserRec } from "./types";
3
+ export declare class UserRec extends Rec {
4
+ constructor({ call_type, limit, offset }: IUserRec);
5
+ }
6
+ export declare class ItemRec extends Rec {
7
+ constructor({ call_type, item_id, limit, offset }: IItemRec);
8
+ }
9
+ export declare class ItemsRec extends Rec {
10
+ constructor({ call_type, item_ids, limit, offset }: IItemsRec);
11
+ }
12
+ export declare class CategoryRec extends Rec {
13
+ constructor({ call_type, category_id, limit, offset }: ICategoryRec);
14
+ }
@@ -0,0 +1,42 @@
1
+ import { Rec } from "./Rec";
2
+ export class UserRec extends Rec {
3
+ constructor({ call_type, limit, offset }) {
4
+ super({
5
+ call_type,
6
+ limit,
7
+ offset,
8
+ });
9
+ }
10
+ }
11
+ // (단일) 상품 기반 추천
12
+ export class ItemRec extends Rec {
13
+ constructor({ call_type, item_id, limit, offset }) {
14
+ super({
15
+ call_type,
16
+ item_id,
17
+ limit,
18
+ offset,
19
+ });
20
+ }
21
+ }
22
+ export class ItemsRec extends Rec {
23
+ constructor({ call_type, item_ids, limit, offset }) {
24
+ super({
25
+ call_type,
26
+ item_ids,
27
+ limit,
28
+ offset,
29
+ });
30
+ }
31
+ }
32
+ export class CategoryRec extends Rec {
33
+ constructor({ call_type, category_id, limit, offset }) {
34
+ super({
35
+ call_type,
36
+ category_id,
37
+ limit,
38
+ offset,
39
+ });
40
+ }
41
+ }
42
+ //# sourceMappingURL=ItemRec.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,5 @@
1
+ import type { RecRequest } from "./types";
2
+ export declare abstract class Rec {
3
+ readonly request: RecRequest;
4
+ constructor(data: RecRequest);
5
+ }
@@ -1,4 +1,4 @@
1
- export class Recommendation {
1
+ export class Rec {
2
2
  request;
3
3
  constructor(data) {
4
4
  this.request = {
@@ -6,4 +6,4 @@ export class Recommendation {
6
6
  };
7
7
  }
8
8
  }
9
- //# sourceMappingURL=Recommendation.js.map
9
+ //# sourceMappingURL=Rec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rec.js","sourceRoot":"/","sources":["src/recs/Rec.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,GAAG;IACP,OAAO,CAAa;IAEpC,YAAY,IAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,IAAI;SACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { RecRequest } from \"./types\";\n\nexport abstract class Rec {\n public readonly request: RecRequest;\n\n constructor(data: RecRequest) {\n this.request = {\n ...data,\n };\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from "./ItemRec";
@@ -0,0 +1,2 @@
1
+ export * from "./ItemRec";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["src/recs/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC","sourcesContent":["export * from \"./ItemRec\";\n"]}
@@ -0,0 +1,23 @@
1
+ export interface RecRequest {
2
+ call_type: string;
3
+ limit: number;
4
+ offset?: number;
5
+ item_id?: string;
6
+ item_ids?: string[];
7
+ category_id?: string;
8
+ }
9
+ type BaseRec = Omit<RecRequest, "call_type" | "item_id" | "item_ids" | "category_id">;
10
+ export interface BaseItemRec extends BaseRec {
11
+ call_type: string;
12
+ }
13
+ export type IUserRec = BaseItemRec;
14
+ export interface IItemRec extends BaseItemRec {
15
+ item_id: string;
16
+ }
17
+ export interface IItemsRec extends BaseItemRec {
18
+ item_ids: string[];
19
+ }
20
+ export interface ICategoryRec extends BaseItemRec {
21
+ category_id: string;
22
+ }
23
+ export {};
@@ -0,0 +1 @@
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"]}
@@ -17,3 +17,44 @@ export declare enum CustomPropertyDataType {
17
17
  }
18
18
  export declare const stringToObjectIdsSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string[], string>, string[], string>, ObjectId[], string>;
19
19
  export declare const stringToArraySchema: z.ZodEffects<z.ZodEffects<z.ZodString, string[], string>, string[], string>;
20
+ export declare const recommendationRequestSchema: z.ZodObject<z.objectUtil.extendShape<Pick<{
21
+ application_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, ObjectId, string>;
22
+ blux_user_id: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, ObjectId, string>>>;
23
+ pipeline: z.ZodArray<z.ZodObject<{
24
+ name: z.ZodString;
25
+ kwargs: z.ZodRecord<z.ZodString, z.ZodAny>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ name: string;
28
+ kwargs: Record<string, any>;
29
+ }, {
30
+ name: string;
31
+ kwargs: Record<string, any>;
32
+ }>, "many">;
33
+ item_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ item_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
35
+ limit: z.ZodNumber;
36
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
37
+ options: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
38
+ }, "item_id" | "item_ids" | "limit" | "offset">, {
39
+ call_type: z.ZodString;
40
+ category_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ }>, "strip", z.ZodTypeAny, {
42
+ limit: number;
43
+ offset: number | null;
44
+ call_type: string;
45
+ item_id?: string | null | undefined;
46
+ item_ids?: string[] | null | undefined;
47
+ category_id?: string | null | undefined;
48
+ }, {
49
+ limit: number;
50
+ call_type: string;
51
+ item_id?: string | null | undefined;
52
+ item_ids?: string[] | null | undefined;
53
+ offset?: number | null | undefined;
54
+ category_id?: string | null | undefined;
55
+ }>;
56
+ export type RecResponse = {
57
+ item_ids: string[];
58
+ metadata: Record<string, unknown>;
59
+ recommendation_id: string | null;
60
+ };
@@ -3,12 +3,12 @@ import { COUNTRY_CODES } from "../constants/COUNTRIES";
3
3
  import { assertEqualTypes } from "./assertEqualTypes";
4
4
  import { ISO8601_REGEX } from "../constants/ISO8601_REGEX";
5
5
  import ObjectId from "bson-objectid";
6
- function isObjectId(value) {
6
+ function isObjectIdString(value) {
7
7
  return (typeof value === "string" && value.length === 24 && ObjectId.isValid(value));
8
8
  }
9
9
  export const objectIdSchema = z
10
10
  .string()
11
- .refine((v) => isObjectId(v), (v) => new ZodError([
11
+ .refine((v) => isObjectIdString(v), (v) => new ZodError([
12
12
  {
13
13
  code: "custom",
14
14
  message: `Invalid ObjectId: ${v}`,
@@ -39,7 +39,7 @@ function convertAllObjectId(input) {
39
39
  if (Array.isArray(input)) {
40
40
  return input.map((item) => convertAllObjectId(item));
41
41
  }
42
- else if (isObjectId(input)) {
42
+ else if (isObjectIdString(input)) {
43
43
  return new ObjectId(input);
44
44
  }
45
45
  else if (typeof input === "string" &&
@@ -102,4 +102,30 @@ export const stringToArraySchema = z
102
102
  .refine((arr) => arr.every((item) => item.length > 0), {
103
103
  message: "Each item should not be empty",
104
104
  });
105
+ // Schema for Inference API
106
+ const inferenceRequestSchema = z.object({
107
+ application_id: objectIdSchema,
108
+ blux_user_id: objectIdSchema.nullish(),
109
+ pipeline: z.array(z.object({
110
+ name: z.string(),
111
+ kwargs: z.record(z.any()),
112
+ })),
113
+ item_id: z.string().nullish(),
114
+ item_ids: z.array(z.string()).nullish(),
115
+ limit: z.number(),
116
+ offset: z.number().nullish().default(0),
117
+ options: z.record(z.string(), z.any()).nullish(), // todo: legacy 클라이언트 migration만을 위한 필드라는 점을 고려하여 필드명 수정 필요 ex. legacy_options
118
+ });
119
+ // Schema for Recommendation Request (from client or server)
120
+ export const recommendationRequestSchema = inferenceRequestSchema
121
+ .pick({
122
+ item_id: true,
123
+ item_ids: true,
124
+ limit: true,
125
+ offset: true,
126
+ })
127
+ .extend({
128
+ call_type: z.string(),
129
+ category_id: z.string().nullish(),
130
+ });
105
131
  //# 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,UAAU,CAAC,KAAc;IAChC,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,UAAU,CAAC,CAAC,CAAC,EACpB,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,QAAQ,CAAC;IACX;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,qBAAqB,CAAC,E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AC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;KACzD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;IACrD,OAAO,EAAE,+BAA+B;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 isObjectId(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) => isObjectId(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 (isObjectId(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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Ac,CAAC,OAAO,EAAE;IAEtC,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,OAAO,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IAEvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,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,4DAA4D;AAC5D,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.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\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\n// Schema for Recommendation Request (from client or server)\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"]}