@reactionary/hcl 0.9.13 → 0.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  export * from './cart/cart.factory.js';
2
2
  export * from './checkout/checkout.factory.js';
3
+ export * from './company/company.factory.js';
3
4
  export * from './product/product.factory.js';
4
5
  export * from './category/category.factory.js';
5
6
  export * from './product-search/product-search.factory.js';
@@ -10,5 +11,7 @@ export * from './profile/profile.factory.js';
10
11
  export * from './order/order.factory.js';
11
12
  export * from './order-search/order-search.factory.js';
12
13
  export * from './product-associations/product-associations.factory.js';
14
+ export * from './product-list/product-list.factory.js';
13
15
  export * from './product-recommendations/product-recommendations.factory.js';
14
16
  export * from './personalization-profile/personalization-profile.factory.js';
17
+ export * from './store/store.factory.js';
@@ -0,0 +1,40 @@
1
+ import type * as z from 'zod';
2
+ import type { AnyProductListItemPaginatedSchema, AnyProductListItemSchema, AnyProductListPaginatedSchema, AnyProductListSchema, ProductListFactory, ProductListIdentifier, ProductListItemPaginatedResultsSchema, ProductListItemSchema, ProductListItemsQuery, ProductListPaginatedResultsSchema, ProductListQuery, ProductListSchema, RequestContext } from '@reactionary/core';
3
+ import type { HclRequisitionList, HclRequisitionListDetailResponse, HclRequisitionListItem, HclRequisitionListResponse, HclWishlist, HclWishlistItem, HclWishlistItemResponse, HclWishlistListResponse } from '../../schema/hcl.schema.js';
4
+ /** Passed to parseProductListItem so it can include the parent list reference. */
5
+ export interface HclProductListItemInput {
6
+ item: HclWishlistItem;
7
+ list: ProductListIdentifier;
8
+ }
9
+ /** Passed to parseRequisitionListItem so it can include the parent list reference. */
10
+ export interface HclRequisitionListItemInput {
11
+ item: HclRequisitionListItem;
12
+ list: ProductListIdentifier;
13
+ }
14
+ /** Extension interface implemented by HclProductListFactory for requisition list parsing. */
15
+ export interface HclRequisitionListFactoryExtension {
16
+ parseRequisitionList(context: RequestContext, data: HclRequisitionList): unknown;
17
+ parseRequisitionListItem(context: RequestContext, data: HclRequisitionListItemInput): unknown;
18
+ parseRequisitionListPaginatedResult(context: RequestContext, data: HclRequisitionListResponse, query: ProductListQuery): unknown;
19
+ parseRequisitionListItemPaginatedResult(context: RequestContext, data: HclRequisitionListDetailResponse, query: ProductListItemsQuery): unknown;
20
+ }
21
+ /**
22
+ * Encode a listType and user description into HCL's description field.
23
+ * Format: `{type}:{description}` — e.g. `favorite:My list` or `wish:`
24
+ */
25
+ export declare function encodeWishlistType(type: string, description: string | undefined): string;
26
+ export declare class HclProductListFactory<TProductListSchema extends AnyProductListSchema = typeof ProductListSchema, TProductListItemSchema extends AnyProductListItemSchema = typeof ProductListItemSchema, TProductListPaginatedSchema extends AnyProductListPaginatedSchema = typeof ProductListPaginatedResultsSchema, TProductListItemPaginatedSchema extends AnyProductListItemPaginatedSchema = typeof ProductListItemPaginatedResultsSchema> implements ProductListFactory<TProductListSchema, TProductListItemSchema, TProductListPaginatedSchema, TProductListItemPaginatedSchema> {
27
+ readonly productListSchema: TProductListSchema;
28
+ readonly productListItemSchema: TProductListItemSchema;
29
+ readonly productListPaginatedSchema: TProductListPaginatedSchema;
30
+ readonly productListItemPaginatedSchema: TProductListItemPaginatedSchema;
31
+ constructor(productListSchema: TProductListSchema, productListItemSchema: TProductListItemSchema, productListPaginatedSchema: TProductListPaginatedSchema, productListItemPaginatedSchema: TProductListItemPaginatedSchema);
32
+ parseProductList(_context: RequestContext, data: HclWishlist): z.output<TProductListSchema>;
33
+ parseProductListItem(_context: RequestContext, data: HclProductListItemInput): z.output<TProductListItemSchema>;
34
+ parseProductListPaginatedResult(context: RequestContext, data: HclWishlistListResponse, query: ProductListQuery): z.output<TProductListPaginatedSchema>;
35
+ parseProductListItemPaginatedResult(context: RequestContext, data: HclWishlistItemResponse, query: ProductListItemsQuery): z.output<TProductListItemPaginatedSchema>;
36
+ parseRequisitionList(_context: RequestContext, data: HclRequisitionList): z.output<TProductListSchema>;
37
+ parseRequisitionListItem(_context: RequestContext, data: HclRequisitionListItemInput): z.output<TProductListItemSchema>;
38
+ parseRequisitionListPaginatedResult(context: RequestContext, data: HclRequisitionListResponse, query: ProductListQuery): z.output<TProductListPaginatedSchema>;
39
+ parseRequisitionListItemPaginatedResult(context: RequestContext, data: HclRequisitionListDetailResponse, query: ProductListItemsQuery): z.output<TProductListItemPaginatedSchema>;
40
+ }
@@ -0,0 +1,8 @@
1
+ import type * as z from 'zod';
2
+ import type { AnyStoreSchema, RequestContext, StoreFactory, StoreSchema } from '@reactionary/core';
3
+ import type { HclPhysicalStore } from '../../schema/hcl.schema.js';
4
+ export declare class HclStoreFactory<TStoreSchema extends AnyStoreSchema = typeof StoreSchema> implements StoreFactory<TStoreSchema> {
5
+ readonly storeSchema: TStoreSchema;
6
+ constructor(storeSchema: TStoreSchema);
7
+ parseStore(_context: RequestContext, data: HclPhysicalStore): z.output<TStoreSchema>;
8
+ }
package/src/index.d.ts CHANGED
@@ -21,3 +21,6 @@ export * from './capabilities/analytics.capability.js';
21
21
  export * from './capabilities/product-associations.capability.js';
22
22
  export * from './capabilities/product-recommendations.capability.js';
23
23
  export * from './capabilities/personalization-profile.capability.js';
24
+ export * from './capabilities/company.capability.js';
25
+ export * from './capabilities/store.capability.js';
26
+ export * from './capabilities/product-list.capability.js';
@@ -1,4 +1,4 @@
1
- import type { Cache, RequestContext, AnalyticsCapability, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, IdentityFactory, IdentityFactoryWithOutput, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, PersonalizationProfileCapability, PersonalizationProfileFactory, PersonalizationProfileFactoryWithOutput, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductAssociationsCapability, ProductAssociationsFactory, ProductAssociationsFactoryWithOutput, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductRecommendationsCapability, ProductRecommendationsFactory, ProductRecommendationsFactoryWithOutput, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability } from '@reactionary/core';
1
+ import type { Cache, RequestContext, AnalyticsCapability, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, CompanyCapability, CompanyFactory, CompanyFactoryWithOutput, IdentityFactory, IdentityFactoryWithOutput, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, PersonalizationProfileCapability, PersonalizationProfileFactory, PersonalizationProfileFactoryWithOutput, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductAssociationsCapability, ProductAssociationsFactory, ProductAssociationsFactoryWithOutput, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductListCapability, ProductListFactory, ProductListFactoryWithOutput, ProductRecommendationsCapability, ProductRecommendationsFactory, ProductRecommendationsFactoryWithOutput, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability, StoreCapability, StoreFactory, StoreFactoryWithOutput } from '@reactionary/core';
2
2
  import type { HclConfiguration } from './configuration.schema.js';
3
3
  import type { HclClient } from '../core/client.js';
4
4
  import * as z from 'zod';
@@ -18,6 +18,11 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
18
18
  factory: z.ZodOptional<z.ZodUnknown>;
19
19
  capability: z.ZodOptional<z.ZodUnknown>;
20
20
  }, z.core.$loose>>>;
21
+ company: z.ZodOptional<z.ZodOptional<z.ZodObject<{
22
+ enabled: z.ZodBoolean;
23
+ factory: z.ZodOptional<z.ZodUnknown>;
24
+ capability: z.ZodOptional<z.ZodUnknown>;
25
+ }, z.core.$loose>>>;
21
26
  product: z.ZodOptional<z.ZodOptional<z.ZodObject<{
22
27
  enabled: z.ZodBoolean;
23
28
  factory: z.ZodOptional<z.ZodUnknown>;
@@ -43,6 +48,11 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
43
48
  factory: z.ZodOptional<z.ZodUnknown>;
44
49
  capability: z.ZodOptional<z.ZodUnknown>;
45
50
  }, z.core.$loose>>>;
51
+ productList: z.ZodOptional<z.ZodOptional<z.ZodObject<{
52
+ enabled: z.ZodBoolean;
53
+ factory: z.ZodOptional<z.ZodUnknown>;
54
+ capability: z.ZodOptional<z.ZodUnknown>;
55
+ }, z.core.$loose>>>;
46
56
  profile: z.ZodOptional<z.ZodOptional<z.ZodObject<{
47
57
  enabled: z.ZodBoolean;
48
58
  factory: z.ZodOptional<z.ZodUnknown>;
@@ -78,6 +88,11 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
78
88
  factory: z.ZodOptional<z.ZodUnknown>;
79
89
  capability: z.ZodOptional<z.ZodUnknown>;
80
90
  }, z.core.$loose>>>;
91
+ store: z.ZodOptional<z.ZodOptional<z.ZodObject<{
92
+ enabled: z.ZodBoolean;
93
+ factory: z.ZodOptional<z.ZodUnknown>;
94
+ capability: z.ZodOptional<z.ZodUnknown>;
95
+ }, z.core.$loose>>>;
81
96
  }, z.core.$loose>;
82
97
  export type HclCapabilities = z.infer<typeof HclCapabilitiesSchema>;
83
98
  export interface HclCapabilityFactoryArgs {
@@ -111,3 +126,6 @@ export type HclProductAssociationsCapabilityConfig = HclCapabilityConfig<Product
111
126
  /** Product recommendations uses a factory to parse espot activity data into recommendations. */
112
127
  export type HclProductRecommendationsCapabilityConfig = HclCapabilityConfig<ProductRecommendationsFactoryWithOutput<ProductRecommendationsFactory>, ProductRecommendationsCapability>;
113
128
  export type HclPersonalizationProfileCapabilityConfig = HclCapabilityConfig<PersonalizationProfileFactoryWithOutput<PersonalizationProfileFactory>, PersonalizationProfileCapability>;
129
+ export type HclCompanyCapabilityConfig = HclCapabilityConfig<CompanyFactoryWithOutput<CompanyFactory>, CompanyCapability>;
130
+ export type HclStoreCapabilityConfig = HclCapabilityConfig<StoreFactoryWithOutput<StoreFactory>, StoreCapability>;
131
+ export type HclProductListCapabilityConfig = HclCapabilityConfig<ProductListFactoryWithOutput<ProductListFactory>, ProductListCapability>;
@@ -752,3 +752,221 @@ export interface HclSegmentResponse {
752
752
  recordSetStartNumber?: number;
753
753
  recordSetComplete?: boolean;
754
754
  }
755
+ /**
756
+ * A WCS person contact embedded within an organization's contactInfo or addressBook.
757
+ * Shares the same shape as HclWcsPersonContact but is returned under different keys
758
+ * in the organization API response.
759
+ */
760
+ export interface HclWcsOrgContact {
761
+ nickName?: string;
762
+ firstName?: string;
763
+ lastName?: string;
764
+ /** Street address lines. Index 0 = street, index 1 = second line. */
765
+ addressLine?: string[];
766
+ city?: string;
767
+ stateOrProvinceName?: string;
768
+ zipCode?: string;
769
+ country?: string;
770
+ phone1?: string;
771
+ email1?: string;
772
+ /** '1' marks this as the default / primary shipping address. */
773
+ primary?: string;
774
+ addressType?: string;
775
+ addressId?: string;
776
+ }
777
+ /**
778
+ * An organization entry as returned by GET /wcs/resources/store/{storeId}/organization/{id}.
779
+ * Fields present depend on the profileName used (IBM_Org_Entity_Details vs IBM_Organization_Details).
780
+ */
781
+ export interface HclOrganizationItem {
782
+ /** Internal WCS organization/member ID (numeric string). */
783
+ organizationId?: string;
784
+ orgEntityId?: string;
785
+ organizationName?: string;
786
+ displayName?: string;
787
+ /** Approval status code: '0' = pending, '1' = approved, '2' = rejected. */
788
+ status?: string;
789
+ /** '0' = locked/blocked, '1' = active. */
790
+ state?: string;
791
+ /** Tax payer ID (maps to taxIdentifier on the domain model). */
792
+ taxPayerId?: string;
793
+ /** Legal entity identifier. */
794
+ legalId?: string;
795
+ /** Business category. */
796
+ businessCategory?: string;
797
+ description?: string;
798
+ /** Primary billing / contact address. */
799
+ contactInfo?: HclWcsOrgContact;
800
+ /** Additional shipping addresses. */
801
+ addressBook?: HclWcsOrgContact[];
802
+ /** Context attributes set by IBM_Org_Entity_Details profile (key-value map). */
803
+ contextAttribute?: Record<string, unknown>;
804
+ /** Parent organization member ID. */
805
+ parentMemberId?: string;
806
+ }
807
+ /**
808
+ * Top-level response from GET /wcs/resources/store/{storeId}/organization
809
+ * with profileName=IBM_Organization_List_Summary.
810
+ */
811
+ export interface HclOrganizationListResponse {
812
+ organizationDataBeans?: HclOrganizationItem[];
813
+ recordSetTotal?: string;
814
+ recordSetCount?: string;
815
+ recordSetStartNumber?: string;
816
+ recordSetComplete?: string;
817
+ }
818
+ /**
819
+ * Response from POST /wcs/resources/store/{storeId}/organization/buyer.
820
+ * Returns the newly created org entity ID and the buyer admin user ID.
821
+ */
822
+ export interface HclBuyerRegistrationResponse {
823
+ orgEntityId: string;
824
+ userId: string;
825
+ resourceName?: string;
826
+ }
827
+ /** A single store attribute as returned in the storelocator response. */
828
+ export interface HclStoreAttribute {
829
+ name: string;
830
+ value: string;
831
+ displayName?: string;
832
+ displayValue?: string;
833
+ }
834
+ /** A description block for a physical store. */
835
+ export interface HclStoreDescription {
836
+ displayStoreName?: string;
837
+ }
838
+ /**
839
+ * A single physical store entry as returned by the WCS storelocator endpoints.
840
+ * Reference: location_based_services.yaml — storelocator-storelocator_item
841
+ */
842
+ export interface HclPhysicalStore {
843
+ uniqueID: string;
844
+ /** Store name as configured in WCS (fallback when Description[].displayStoreName is absent). */
845
+ storeName?: string;
846
+ /** Array of description blocks; index 0 typically contains displayStoreName. */
847
+ Description?: HclStoreDescription[];
848
+ /** Street address lines. Index 0 = primary line, index 1 = second line. */
849
+ addressLine?: string[];
850
+ city?: string;
851
+ stateOrProvinceName?: string;
852
+ postalCode?: string;
853
+ country?: string;
854
+ telephone1?: string;
855
+ email?: string;
856
+ /** Geographic latitude (as a string — coerce with Number()). */
857
+ latitude?: string;
858
+ /** Geographic longitude (as a string — coerce with Number()). */
859
+ longitude?: string;
860
+ /** Distance from the query point (as a string — coerce with Number()). */
861
+ distance?: string;
862
+ Attribute?: HclStoreAttribute[];
863
+ userDataField?: {
864
+ value?: string;
865
+ key: string;
866
+ }[];
867
+ }
868
+ /**
869
+ * Top-level response from GET /wcs/resources/store/{storeId}/storelocator/latitude/{lat}/longitude/{lon}.
870
+ */
871
+ export interface HclStoreLocatorResponse {
872
+ PhysicalStore?: HclPhysicalStore[];
873
+ recordSetTotal?: string;
874
+ recordSetCount?: string;
875
+ recordSetStartNumber?: string;
876
+ recordSetComplete?: string;
877
+ }
878
+ /**
879
+ * A single item entry within a wishlist — from GET /wishlist/{id}/item.
880
+ */
881
+ export interface HclWishlistItem {
882
+ /** Unique identifier for the wishlist item entry. */
883
+ giftListItemID?: string;
884
+ /** Internal WCS catalog entry ID (numeric string). Corresponds to a SKU. */
885
+ productId?: string;
886
+ /** SKU part number — use this as the variant identifier when present. */
887
+ partNumber?: string;
888
+ /** Requested quantity as a string — coerce with Number(). */
889
+ quantityRequested?: string;
890
+ /** Purchased quantity as a string. */
891
+ quantityBought?: string;
892
+ location?: string;
893
+ }
894
+ /**
895
+ * A single wishlist (GiftList) entry as returned by GET /wishlist/@self.
896
+ */
897
+ export interface HclWishlist {
898
+ /** Internal WCS list ID. */
899
+ uniqueID?: string;
900
+ /** Customer-assigned external identifier. Alias for uniqueID on some responses. */
901
+ externalIdentifier?: string;
902
+ /** The list's display name. */
903
+ descriptionName?: string;
904
+ /** The list's optional description text. */
905
+ description?: string;
906
+ lastUpdate?: string;
907
+ guestAccessKey?: string;
908
+ /** Items embedded in the list (present when fetching a specific list with items). */
909
+ item?: HclWishlistItem[];
910
+ }
911
+ /** Top-level response from GET /wcs/resources/store/{storeId}/wishlist/@self. */
912
+ export interface HclWishlistListResponse {
913
+ GiftList?: HclWishlist[];
914
+ recordSetTotal?: string;
915
+ recordSetCount?: string;
916
+ recordSetStartNumber?: string;
917
+ recordSetComplete?: string;
918
+ }
919
+ /** Top-level response from GET /wcs/resources/store/{storeId}/wishlist/{id}/item. */
920
+ export interface HclWishlistItemResponse {
921
+ GiftList?: HclWishlist[];
922
+ recordSetTotal?: string;
923
+ recordSetCount?: string;
924
+ recordSetStartNumber?: string;
925
+ }
926
+ /** Response from POST /wishlist (create) and PUT /wishlist/{id} (update). */
927
+ export interface HclWishlistMutationResponse {
928
+ uniqueID?: string;
929
+ externalIdentifier?: string;
930
+ resourceName?: string;
931
+ }
932
+ /** A single item in a WCS requisition list. */
933
+ export interface HclRequisitionListItem {
934
+ /** Unique identifier of the item within the list. */
935
+ requisitionListItemId?: string;
936
+ /** Numeric product identifier (same semantics as GiftList item.productId). */
937
+ productId?: string;
938
+ /** Partner number / SKU. */
939
+ partNumber?: string;
940
+ /** Requested quantity as a string. */
941
+ quantity?: string;
942
+ /** Location (e.g. "online"). */
943
+ location?: string;
944
+ }
945
+ /** A single WCS requisition list (from GET /requisitionList/@self or by ID). */
946
+ export interface HclRequisitionList {
947
+ /** Unique identifier of the list. */
948
+ requisitionListId?: string;
949
+ /** Display name of the list. */
950
+ name?: string;
951
+ /** Description of the list. */
952
+ description?: string;
953
+ /** Items in the list (only present on detail endpoints). */
954
+ item?: HclRequisitionListItem[];
955
+ }
956
+ /** Response from GET /requisitionList/@self — array of lists. */
957
+ export interface HclRequisitionListResponse {
958
+ resultList?: HclRequisitionList[];
959
+ recordSetTotal?: string;
960
+ recordSetCount?: string;
961
+ recordSetStartNumber?: string;
962
+ }
963
+ /** Response from GET /requisitionList/{id}/item. */
964
+ export interface HclRequisitionListDetailResponse {
965
+ resultList?: HclRequisitionList[];
966
+ recordSetTotal?: string;
967
+ }
968
+ /** Response from POST /requisitionList (create) and PUT /requisitionList/{id}. */
969
+ export interface HclRequisitionListMutationResponse {
970
+ requisitionListId?: string;
971
+ resourceName?: string;
972
+ }
@@ -4,6 +4,7 @@ export declare function getHclTestConfiguration(): HclConfiguration;
4
4
  export declare function createHclClient(contextOverrides?: Partial<RequestContext>): Omit<import("@reactionary/core").Client, "product" | "productSearch" | "category"> & Omit<import("@reactionary/core").ClientFromCapabilities<{
5
5
  product?: true | undefined;
6
6
  productSearch?: true | undefined;
7
+ company?: false | undefined;
7
8
  price?: false | undefined;
8
9
  order?: false | undefined;
9
10
  cart?: false | undefined;
@@ -12,8 +13,10 @@ export declare function createHclClient(contextOverrides?: Partial<RequestContex
12
13
  profile?: false | undefined;
13
14
  inventory?: false | undefined;
14
15
  category?: true | undefined;
16
+ store?: false | undefined;
17
+ productList?: false | undefined;
15
18
  orderSearch?: false | undefined;
16
- }>, "product" | "productSearch" | "price" | "order" | "cart" | "checkout" | "identity" | "profile" | "inventory" | "category" | "orderSearch"> & {
19
+ }>, "product" | "productSearch" | "company" | "price" | "order" | "cart" | "checkout" | "identity" | "profile" | "inventory" | "category" | "store" | "productList" | "orderSearch"> & {
17
20
  product: import("../index.js").HclProductCapability<import("../index.js").HclProductFactory<import("zod").ZodObject<{
18
21
  identifier: import("zod").ZodObject<{
19
22
  key: import("zod").ZodString;