@modainteract/moda-interact-shared 1.3.5 → 1.5.0

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.
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
 
3
3
  declare const SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1: 1;
4
4
  declare const SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2: 2;
5
+ declare const SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V3: 3;
5
6
  declare const SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION: 1;
6
7
  declare const SHOPIFY_COMMERCE_EVENT_TYPES: {
7
8
  readonly CHECKOUT_OBSERVED: "checkout.observed";
@@ -13,6 +14,9 @@ declare const SHOPIFY_RECOVERY_EVENT_TYPES_V2: {
13
14
  readonly CHECKOUT_UPDATED: "checkout.updated";
14
15
  readonly ORDER_COMPLETED: "order.completed";
15
16
  };
17
+ declare const SHOPIFY_RECOVERY_EVENT_TYPES_V3: {
18
+ readonly CHECKOUT_UPDATED: "checkout.updated";
19
+ };
16
20
  declare const SHOPIFY_WEBHOOK_OUTBOX_DESTINATIONS: {
17
21
  readonly CHECKOUT_EVENTS: "CHECKOUT_EVENTS";
18
22
  readonly ORDER_EVENTS: "ORDER_EVENTS";
@@ -772,6 +776,367 @@ declare function createShopifyOrderCorrelationOrderingKey(input: {
772
776
  checkoutToken: string | null;
773
777
  }): string;
774
778
 
779
+ declare const CheckoutUpdatedPayloadV3Schema: z.ZodObject<{
780
+ checkoutToken: z.ZodString;
781
+ cartToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
782
+ checkoutCreatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
783
+ abandonedCheckoutUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
784
+ }, z.core.$strict>;
785
+ type CheckoutUpdatedPayloadV3 = z.infer<typeof CheckoutUpdatedPayloadV3Schema>;
786
+
787
+ declare const ShopifyCheckoutUpdatedEventV3Schema: z.ZodObject<{
788
+ schemaVersion: z.ZodLiteral<3>;
789
+ receiptId: z.ZodString;
790
+ deliveryId: z.ZodString;
791
+ eventId: z.ZodNullable<z.ZodString>;
792
+ source: z.ZodLiteral<"shopify">;
793
+ providerTopic: z.ZodString;
794
+ tenant: z.ZodObject<{
795
+ shopId: z.ZodString;
796
+ shopDomain: z.ZodString;
797
+ }, z.core.$strict>;
798
+ occurredAt: z.ZodNullable<z.ZodISODateTime>;
799
+ receivedAt: z.ZodISODateTime;
800
+ traceId: z.ZodString;
801
+ orderingKey: z.ZodString;
802
+ internationalContext: z.ZodOptional<z.ZodObject<{
803
+ languageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
804
+ languageSource: z.ZodNullable<z.ZodEnum<{
805
+ "customer-explicit": "customer-explicit";
806
+ detected: "detected";
807
+ shopify: "shopify";
808
+ "merchant-default": "merchant-default";
809
+ "platform-default": "platform-default";
810
+ }>>;
811
+ countryCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
812
+ currencyCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
813
+ timeZone: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
814
+ }, z.core.$strict>>;
815
+ eventType: z.ZodLiteral<"checkout.updated">;
816
+ payload: z.ZodObject<{
817
+ checkoutToken: z.ZodString;
818
+ cartToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
819
+ checkoutCreatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
820
+ abandonedCheckoutUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
821
+ }, z.core.$strict>;
822
+ }, z.core.$strict>;
823
+ type ShopifyCheckoutUpdatedEventV3 = z.infer<typeof ShopifyCheckoutUpdatedEventV3Schema>;
824
+
825
+ declare const ShopifyRecoveryEventSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
826
+ schemaVersion: z.ZodLiteral<2>;
827
+ receiptId: z.ZodString;
828
+ deliveryId: z.ZodString;
829
+ eventId: z.ZodNullable<z.ZodString>;
830
+ source: z.ZodLiteral<"shopify">;
831
+ providerTopic: z.ZodString;
832
+ tenant: z.ZodObject<{
833
+ shopId: z.ZodString;
834
+ shopDomain: z.ZodString;
835
+ }, z.core.$strict>;
836
+ occurredAt: z.ZodNullable<z.ZodISODateTime>;
837
+ receivedAt: z.ZodISODateTime;
838
+ traceId: z.ZodString;
839
+ orderingKey: z.ZodString;
840
+ internationalContext: z.ZodOptional<z.ZodObject<{
841
+ languageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
842
+ languageSource: z.ZodNullable<z.ZodEnum<{
843
+ "customer-explicit": "customer-explicit";
844
+ detected: "detected";
845
+ shopify: "shopify";
846
+ "merchant-default": "merchant-default";
847
+ "platform-default": "platform-default";
848
+ }>>;
849
+ countryCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
850
+ currencyCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
851
+ timeZone: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
852
+ }, z.core.$strict>>;
853
+ eventType: z.ZodLiteral<"cart.activity">;
854
+ payload: z.ZodObject<{
855
+ cartToken: z.ZodString;
856
+ isEmpty: z.ZodNullable<z.ZodBoolean>;
857
+ }, z.core.$strict>;
858
+ }, z.core.$strict>, z.ZodObject<{
859
+ schemaVersion: z.ZodLiteral<2>;
860
+ receiptId: z.ZodString;
861
+ deliveryId: z.ZodString;
862
+ eventId: z.ZodNullable<z.ZodString>;
863
+ source: z.ZodLiteral<"shopify">;
864
+ providerTopic: z.ZodString;
865
+ tenant: z.ZodObject<{
866
+ shopId: z.ZodString;
867
+ shopDomain: z.ZodString;
868
+ }, z.core.$strict>;
869
+ occurredAt: z.ZodNullable<z.ZodISODateTime>;
870
+ receivedAt: z.ZodISODateTime;
871
+ traceId: z.ZodString;
872
+ orderingKey: z.ZodString;
873
+ internationalContext: z.ZodOptional<z.ZodObject<{
874
+ languageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
875
+ languageSource: z.ZodNullable<z.ZodEnum<{
876
+ "customer-explicit": "customer-explicit";
877
+ detected: "detected";
878
+ shopify: "shopify";
879
+ "merchant-default": "merchant-default";
880
+ "platform-default": "platform-default";
881
+ }>>;
882
+ countryCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
883
+ currencyCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
884
+ timeZone: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
885
+ }, z.core.$strict>>;
886
+ eventType: z.ZodLiteral<"checkout.created">;
887
+ payload: z.ZodObject<{
888
+ checkoutToken: z.ZodString;
889
+ cartToken: z.ZodNullable<z.ZodString>;
890
+ abandonedCheckoutUrl: z.ZodNullable<z.ZodURL>;
891
+ checkoutCreatedAt: z.ZodNullable<z.ZodISODateTime>;
892
+ }, z.core.$strict>;
893
+ }, z.core.$strict>, z.ZodObject<{
894
+ schemaVersion: z.ZodLiteral<2>;
895
+ receiptId: z.ZodString;
896
+ deliveryId: z.ZodString;
897
+ eventId: z.ZodNullable<z.ZodString>;
898
+ source: z.ZodLiteral<"shopify">;
899
+ providerTopic: z.ZodString;
900
+ tenant: z.ZodObject<{
901
+ shopId: z.ZodString;
902
+ shopDomain: z.ZodString;
903
+ }, z.core.$strict>;
904
+ occurredAt: z.ZodNullable<z.ZodISODateTime>;
905
+ receivedAt: z.ZodISODateTime;
906
+ traceId: z.ZodString;
907
+ orderingKey: z.ZodString;
908
+ internationalContext: z.ZodOptional<z.ZodObject<{
909
+ languageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
910
+ languageSource: z.ZodNullable<z.ZodEnum<{
911
+ "customer-explicit": "customer-explicit";
912
+ detected: "detected";
913
+ shopify: "shopify";
914
+ "merchant-default": "merchant-default";
915
+ "platform-default": "platform-default";
916
+ }>>;
917
+ countryCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
918
+ currencyCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
919
+ timeZone: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
920
+ }, z.core.$strict>>;
921
+ eventType: z.ZodLiteral<"checkout.updated">;
922
+ payload: z.ZodObject<{
923
+ checkoutToken: z.ZodString;
924
+ }, z.core.$strict>;
925
+ }, z.core.$strict>, z.ZodObject<{
926
+ schemaVersion: z.ZodLiteral<2>;
927
+ receiptId: z.ZodString;
928
+ deliveryId: z.ZodString;
929
+ eventId: z.ZodNullable<z.ZodString>;
930
+ source: z.ZodLiteral<"shopify">;
931
+ providerTopic: z.ZodString;
932
+ tenant: z.ZodObject<{
933
+ shopId: z.ZodString;
934
+ shopDomain: z.ZodString;
935
+ }, z.core.$strict>;
936
+ occurredAt: z.ZodNullable<z.ZodISODateTime>;
937
+ receivedAt: z.ZodISODateTime;
938
+ traceId: z.ZodString;
939
+ orderingKey: z.ZodString;
940
+ internationalContext: z.ZodOptional<z.ZodObject<{
941
+ languageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
942
+ languageSource: z.ZodNullable<z.ZodEnum<{
943
+ "customer-explicit": "customer-explicit";
944
+ detected: "detected";
945
+ shopify: "shopify";
946
+ "merchant-default": "merchant-default";
947
+ "platform-default": "platform-default";
948
+ }>>;
949
+ countryCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
950
+ currencyCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
951
+ timeZone: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
952
+ }, z.core.$strict>>;
953
+ eventType: z.ZodLiteral<"order.completed">;
954
+ payload: z.ZodObject<{
955
+ orderId: z.ZodString;
956
+ checkoutToken: z.ZodNullable<z.ZodString>;
957
+ cartToken: z.ZodNullable<z.ZodString>;
958
+ completedAt: z.ZodISODateTime;
959
+ }, z.core.$strict>;
960
+ }, z.core.$strict>], "eventType">, z.ZodObject<{
961
+ schemaVersion: z.ZodLiteral<3>;
962
+ receiptId: z.ZodString;
963
+ deliveryId: z.ZodString;
964
+ eventId: z.ZodNullable<z.ZodString>;
965
+ source: z.ZodLiteral<"shopify">;
966
+ providerTopic: z.ZodString;
967
+ tenant: z.ZodObject<{
968
+ shopId: z.ZodString;
969
+ shopDomain: z.ZodString;
970
+ }, z.core.$strict>;
971
+ occurredAt: z.ZodNullable<z.ZodISODateTime>;
972
+ receivedAt: z.ZodISODateTime;
973
+ traceId: z.ZodString;
974
+ orderingKey: z.ZodString;
975
+ internationalContext: z.ZodOptional<z.ZodObject<{
976
+ languageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
977
+ languageSource: z.ZodNullable<z.ZodEnum<{
978
+ "customer-explicit": "customer-explicit";
979
+ detected: "detected";
980
+ shopify: "shopify";
981
+ "merchant-default": "merchant-default";
982
+ "platform-default": "platform-default";
983
+ }>>;
984
+ countryCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
985
+ currencyCode: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
986
+ timeZone: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
987
+ }, z.core.$strict>>;
988
+ eventType: z.ZodLiteral<"checkout.updated">;
989
+ payload: z.ZodObject<{
990
+ checkoutToken: z.ZodString;
991
+ cartToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
992
+ checkoutCreatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
993
+ abandonedCheckoutUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
994
+ }, z.core.$strict>;
995
+ }, z.core.$strict>]>;
996
+ type ShopifyRecoveryEvent = ShopifyRecoveryEventV2 | ShopifyCheckoutUpdatedEventV3;
997
+ declare function parseShopifyRecoveryEvent(input: unknown): ShopifyRecoveryEvent;
998
+ declare function safeParseShopifyRecoveryEvent(input: unknown): z.ZodSafeParseResult<{
999
+ schemaVersion: 2;
1000
+ receiptId: string;
1001
+ deliveryId: string;
1002
+ eventId: string | null;
1003
+ source: "shopify";
1004
+ providerTopic: string;
1005
+ tenant: {
1006
+ shopId: string;
1007
+ shopDomain: string;
1008
+ };
1009
+ occurredAt: string | null;
1010
+ receivedAt: string;
1011
+ traceId: string;
1012
+ orderingKey: string;
1013
+ eventType: "checkout.created";
1014
+ payload: {
1015
+ checkoutToken: string;
1016
+ cartToken: string | null;
1017
+ abandonedCheckoutUrl: string | null;
1018
+ checkoutCreatedAt: string | null;
1019
+ };
1020
+ internationalContext?: {
1021
+ languageTag: string | null;
1022
+ languageSource: "customer-explicit" | "detected" | "shopify" | "merchant-default" | "platform-default" | null;
1023
+ countryCode: string | null;
1024
+ currencyCode: string | null;
1025
+ timeZone: string | null;
1026
+ } | undefined;
1027
+ } | {
1028
+ schemaVersion: 2;
1029
+ receiptId: string;
1030
+ deliveryId: string;
1031
+ eventId: string | null;
1032
+ source: "shopify";
1033
+ providerTopic: string;
1034
+ tenant: {
1035
+ shopId: string;
1036
+ shopDomain: string;
1037
+ };
1038
+ occurredAt: string | null;
1039
+ receivedAt: string;
1040
+ traceId: string;
1041
+ orderingKey: string;
1042
+ eventType: "cart.activity";
1043
+ payload: {
1044
+ cartToken: string;
1045
+ isEmpty: boolean | null;
1046
+ };
1047
+ internationalContext?: {
1048
+ languageTag: string | null;
1049
+ languageSource: "customer-explicit" | "detected" | "shopify" | "merchant-default" | "platform-default" | null;
1050
+ countryCode: string | null;
1051
+ currencyCode: string | null;
1052
+ timeZone: string | null;
1053
+ } | undefined;
1054
+ } | {
1055
+ schemaVersion: 2;
1056
+ receiptId: string;
1057
+ deliveryId: string;
1058
+ eventId: string | null;
1059
+ source: "shopify";
1060
+ providerTopic: string;
1061
+ tenant: {
1062
+ shopId: string;
1063
+ shopDomain: string;
1064
+ };
1065
+ occurredAt: string | null;
1066
+ receivedAt: string;
1067
+ traceId: string;
1068
+ orderingKey: string;
1069
+ eventType: "checkout.updated";
1070
+ payload: {
1071
+ checkoutToken: string;
1072
+ };
1073
+ internationalContext?: {
1074
+ languageTag: string | null;
1075
+ languageSource: "customer-explicit" | "detected" | "shopify" | "merchant-default" | "platform-default" | null;
1076
+ countryCode: string | null;
1077
+ currencyCode: string | null;
1078
+ timeZone: string | null;
1079
+ } | undefined;
1080
+ } | {
1081
+ schemaVersion: 2;
1082
+ receiptId: string;
1083
+ deliveryId: string;
1084
+ eventId: string | null;
1085
+ source: "shopify";
1086
+ providerTopic: string;
1087
+ tenant: {
1088
+ shopId: string;
1089
+ shopDomain: string;
1090
+ };
1091
+ occurredAt: string | null;
1092
+ receivedAt: string;
1093
+ traceId: string;
1094
+ orderingKey: string;
1095
+ eventType: "order.completed";
1096
+ payload: {
1097
+ orderId: string;
1098
+ checkoutToken: string | null;
1099
+ cartToken: string | null;
1100
+ completedAt: string;
1101
+ };
1102
+ internationalContext?: {
1103
+ languageTag: string | null;
1104
+ languageSource: "customer-explicit" | "detected" | "shopify" | "merchant-default" | "platform-default" | null;
1105
+ countryCode: string | null;
1106
+ currencyCode: string | null;
1107
+ timeZone: string | null;
1108
+ } | undefined;
1109
+ } | {
1110
+ schemaVersion: 3;
1111
+ receiptId: string;
1112
+ deliveryId: string;
1113
+ eventId: string | null;
1114
+ source: "shopify";
1115
+ providerTopic: string;
1116
+ tenant: {
1117
+ shopId: string;
1118
+ shopDomain: string;
1119
+ };
1120
+ occurredAt: string | null;
1121
+ receivedAt: string;
1122
+ traceId: string;
1123
+ orderingKey: string;
1124
+ eventType: "checkout.updated";
1125
+ payload: {
1126
+ checkoutToken: string;
1127
+ cartToken?: string | null | undefined;
1128
+ checkoutCreatedAt?: string | null | undefined;
1129
+ abandonedCheckoutUrl?: string | null | undefined;
1130
+ };
1131
+ internationalContext?: {
1132
+ languageTag: string | null;
1133
+ languageSource: "customer-explicit" | "detected" | "shopify" | "merchant-default" | "platform-default" | null;
1134
+ countryCode: string | null;
1135
+ currencyCode: string | null;
1136
+ timeZone: string | null;
1137
+ } | undefined;
1138
+ }>;
1139
+
775
1140
  declare const SHOPIFY_WEBHOOK_QUEUE_CONTRACTS: {
776
1141
  readonly CHECKOUT_EVENTS: {
777
1142
  readonly queueName: "checkout-events";
@@ -843,4 +1208,4 @@ declare function safeParseShopifyDiscountSyncJob(input: unknown): z.ZodSafeParse
843
1208
  webhookTopic: "discounts/create" | "discounts/update" | "discounts/delete" | "discounts/redeemcode_added" | "discounts/redeemcode_removed" | null;
844
1209
  }>;
845
1210
 
846
- export { type CheckoutCreatedPayloadV2, CheckoutCreatedPayloadV2Schema, type CheckoutObservedPayload, CheckoutObservedPayloadSchema, type CheckoutUpdatedPayloadV2, CheckoutUpdatedPayloadV2Schema, MAX_LINE_ITEMS, MAX_URL_LENGTH, type OrderCompletedPayload, OrderCompletedPayloadSchema, type OrderCompletedPayloadV2, OrderCompletedPayloadV2Schema, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2, SHOPIFY_COMMERCE_EVENT_TYPES, SHOPIFY_DISCOUNT_SYNC_REASONS, SHOPIFY_DISCOUNT_SYNC_WEBHOOK_TOPICS, SHOPIFY_RECOVERY_EVENT_TYPES_V2, SHOPIFY_WEBHOOK_OUTBOX_DESTINATIONS, SHOPIFY_WEBHOOK_QUEUE_CONTRACTS, type ShopifyCartActivityEventV2, ShopifyCartActivityEventV2Schema, type ShopifyCartActivityPayloadV2, ShopifyCartActivityPayloadV2Schema, type ShopifyCheckoutCreatedEventV2, ShopifyCheckoutCreatedEventV2Schema, type ShopifyCheckoutLineItem, ShopifyCheckoutLineItemSchema, ShopifyCheckoutLineItemsSchema, type ShopifyCheckoutObservedEvent, ShopifyCheckoutObservedEventSchema, type ShopifyCheckoutUpdatedEventV2, ShopifyCheckoutUpdatedEventV2Schema, type ShopifyCommerceEvent, ShopifyCommerceEventSchema, type ShopifyCommerceEventType, type ShopifyCustomerReference, ShopifyCustomerReferenceSchema, type ShopifyDiscountSyncJob, ShopifyDiscountSyncJobSchema, ShopifyDiscountSyncReasonSchema, ShopifyDiscountSyncWebhookTopicSchema, type ShopifyMoney, ShopifyMoneySchema, type ShopifyOrderCompletedEvent, ShopifyOrderCompletedEventSchema, type ShopifyOrderCompletedEventV2, ShopifyOrderCompletedEventV2Schema, type ShopifyRecoveryEventTypeV2, type ShopifyRecoveryEventV2, ShopifyRecoveryEventV2Schema, type ShopifyTenant, ShopifyTenantSchema, createShopifyCartActivityOrderingKey, createShopifyCommerceOrderingKey, createShopifyOrderCorrelationOrderingKey, createShopifyOrderOrderingKey, createShopifyPendingRecoveryOrderingKey, isCartActivityEventV2, isCheckoutCreatedEventV2, isCheckoutObservedEvent, isCheckoutUpdatedEventV2, isOrderCompletedEvent, isOrderCompletedEventV2, parseShopifyCommerceEvent, parseShopifyDiscountSyncJob, parseShopifyRecoveryEventV2, safeParseShopifyCommerceEvent, safeParseShopifyDiscountSyncJob, safeParseShopifyRecoveryEventV2 };
1211
+ export { type CheckoutCreatedPayloadV2, CheckoutCreatedPayloadV2Schema, type CheckoutObservedPayload, CheckoutObservedPayloadSchema, type CheckoutUpdatedPayloadV2, CheckoutUpdatedPayloadV2Schema, type CheckoutUpdatedPayloadV3, CheckoutUpdatedPayloadV3Schema, MAX_LINE_ITEMS, MAX_URL_LENGTH, type OrderCompletedPayload, OrderCompletedPayloadSchema, type OrderCompletedPayloadV2, OrderCompletedPayloadV2Schema, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V3, SHOPIFY_COMMERCE_EVENT_TYPES, SHOPIFY_DISCOUNT_SYNC_REASONS, SHOPIFY_DISCOUNT_SYNC_WEBHOOK_TOPICS, SHOPIFY_RECOVERY_EVENT_TYPES_V2, SHOPIFY_RECOVERY_EVENT_TYPES_V3, SHOPIFY_WEBHOOK_OUTBOX_DESTINATIONS, SHOPIFY_WEBHOOK_QUEUE_CONTRACTS, type ShopifyCartActivityEventV2, ShopifyCartActivityEventV2Schema, type ShopifyCartActivityPayloadV2, ShopifyCartActivityPayloadV2Schema, type ShopifyCheckoutCreatedEventV2, ShopifyCheckoutCreatedEventV2Schema, type ShopifyCheckoutLineItem, ShopifyCheckoutLineItemSchema, ShopifyCheckoutLineItemsSchema, type ShopifyCheckoutObservedEvent, ShopifyCheckoutObservedEventSchema, type ShopifyCheckoutUpdatedEventV2, ShopifyCheckoutUpdatedEventV2Schema, type ShopifyCheckoutUpdatedEventV3, ShopifyCheckoutUpdatedEventV3Schema, type ShopifyCommerceEvent, ShopifyCommerceEventSchema, type ShopifyCommerceEventType, type ShopifyCustomerReference, ShopifyCustomerReferenceSchema, type ShopifyDiscountSyncJob, ShopifyDiscountSyncJobSchema, ShopifyDiscountSyncReasonSchema, ShopifyDiscountSyncWebhookTopicSchema, type ShopifyMoney, ShopifyMoneySchema, type ShopifyOrderCompletedEvent, ShopifyOrderCompletedEventSchema, type ShopifyOrderCompletedEventV2, ShopifyOrderCompletedEventV2Schema, type ShopifyRecoveryEvent, ShopifyRecoveryEventSchema, type ShopifyRecoveryEventTypeV2, type ShopifyRecoveryEventV2, ShopifyRecoveryEventV2Schema, type ShopifyTenant, ShopifyTenantSchema, createShopifyCartActivityOrderingKey, createShopifyCommerceOrderingKey, createShopifyOrderCorrelationOrderingKey, createShopifyOrderOrderingKey, createShopifyPendingRecoveryOrderingKey, isCartActivityEventV2, isCheckoutCreatedEventV2, isCheckoutObservedEvent, isCheckoutUpdatedEventV2, isOrderCompletedEvent, isOrderCompletedEventV2, parseShopifyCommerceEvent, parseShopifyDiscountSyncJob, parseShopifyRecoveryEvent, parseShopifyRecoveryEventV2, safeParseShopifyCommerceEvent, safeParseShopifyDiscountSyncJob, safeParseShopifyRecoveryEvent, safeParseShopifyRecoveryEventV2 };
@@ -2,6 +2,7 @@ import {
2
2
  CheckoutCreatedPayloadV2Schema,
3
3
  CheckoutObservedPayloadSchema,
4
4
  CheckoutUpdatedPayloadV2Schema,
5
+ CheckoutUpdatedPayloadV3Schema,
5
6
  MAX_LINE_ITEMS,
6
7
  MAX_URL_LENGTH,
7
8
  OrderCompletedPayloadSchema,
@@ -9,10 +10,12 @@ import {
9
10
  SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION,
10
11
  SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1,
11
12
  SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2,
13
+ SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V3,
12
14
  SHOPIFY_COMMERCE_EVENT_TYPES,
13
15
  SHOPIFY_DISCOUNT_SYNC_REASONS,
14
16
  SHOPIFY_DISCOUNT_SYNC_WEBHOOK_TOPICS,
15
17
  SHOPIFY_RECOVERY_EVENT_TYPES_V2,
18
+ SHOPIFY_RECOVERY_EVENT_TYPES_V3,
16
19
  SHOPIFY_WEBHOOK_OUTBOX_DESTINATIONS,
17
20
  SHOPIFY_WEBHOOK_QUEUE_CONTRACTS,
18
21
  ShopifyCartActivityEventV2Schema,
@@ -22,6 +25,7 @@ import {
22
25
  ShopifyCheckoutLineItemsSchema,
23
26
  ShopifyCheckoutObservedEventSchema,
24
27
  ShopifyCheckoutUpdatedEventV2Schema,
28
+ ShopifyCheckoutUpdatedEventV3Schema,
25
29
  ShopifyCommerceEventSchema,
26
30
  ShopifyCustomerReferenceSchema,
27
31
  ShopifyDiscountSyncJobSchema,
@@ -30,6 +34,7 @@ import {
30
34
  ShopifyMoneySchema,
31
35
  ShopifyOrderCompletedEventSchema,
32
36
  ShopifyOrderCompletedEventV2Schema,
37
+ ShopifyRecoveryEventSchema,
33
38
  ShopifyRecoveryEventV2Schema,
34
39
  ShopifyTenantSchema,
35
40
  createShopifyCartActivityOrderingKey,
@@ -45,16 +50,19 @@ import {
45
50
  isOrderCompletedEventV2,
46
51
  parseShopifyCommerceEvent,
47
52
  parseShopifyDiscountSyncJob,
53
+ parseShopifyRecoveryEvent,
48
54
  parseShopifyRecoveryEventV2,
49
55
  safeParseShopifyCommerceEvent,
50
56
  safeParseShopifyDiscountSyncJob,
57
+ safeParseShopifyRecoveryEvent,
51
58
  safeParseShopifyRecoveryEventV2
52
- } from "../chunk-I4WVQ6D7.js";
59
+ } from "../chunk-SU2DAOEC.js";
53
60
  import "../chunk-4KSODB2R.js";
54
61
  export {
55
62
  CheckoutCreatedPayloadV2Schema,
56
63
  CheckoutObservedPayloadSchema,
57
64
  CheckoutUpdatedPayloadV2Schema,
65
+ CheckoutUpdatedPayloadV3Schema,
58
66
  MAX_LINE_ITEMS,
59
67
  MAX_URL_LENGTH,
60
68
  OrderCompletedPayloadSchema,
@@ -62,10 +70,12 @@ export {
62
70
  SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION,
63
71
  SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1,
64
72
  SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2,
73
+ SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V3,
65
74
  SHOPIFY_COMMERCE_EVENT_TYPES,
66
75
  SHOPIFY_DISCOUNT_SYNC_REASONS,
67
76
  SHOPIFY_DISCOUNT_SYNC_WEBHOOK_TOPICS,
68
77
  SHOPIFY_RECOVERY_EVENT_TYPES_V2,
78
+ SHOPIFY_RECOVERY_EVENT_TYPES_V3,
69
79
  SHOPIFY_WEBHOOK_OUTBOX_DESTINATIONS,
70
80
  SHOPIFY_WEBHOOK_QUEUE_CONTRACTS,
71
81
  ShopifyCartActivityEventV2Schema,
@@ -75,6 +85,7 @@ export {
75
85
  ShopifyCheckoutLineItemsSchema,
76
86
  ShopifyCheckoutObservedEventSchema,
77
87
  ShopifyCheckoutUpdatedEventV2Schema,
88
+ ShopifyCheckoutUpdatedEventV3Schema,
78
89
  ShopifyCommerceEventSchema,
79
90
  ShopifyCustomerReferenceSchema,
80
91
  ShopifyDiscountSyncJobSchema,
@@ -83,6 +94,7 @@ export {
83
94
  ShopifyMoneySchema,
84
95
  ShopifyOrderCompletedEventSchema,
85
96
  ShopifyOrderCompletedEventV2Schema,
97
+ ShopifyRecoveryEventSchema,
86
98
  ShopifyRecoveryEventV2Schema,
87
99
  ShopifyTenantSchema,
88
100
  createShopifyCartActivityOrderingKey,
@@ -98,9 +110,11 @@ export {
98
110
  isOrderCompletedEventV2,
99
111
  parseShopifyCommerceEvent,
100
112
  parseShopifyDiscountSyncJob,
113
+ parseShopifyRecoveryEvent,
101
114
  parseShopifyRecoveryEventV2,
102
115
  safeParseShopifyCommerceEvent,
103
116
  safeParseShopifyDiscountSyncJob,
117
+ safeParseShopifyRecoveryEvent,
104
118
  safeParseShopifyRecoveryEventV2
105
119
  };
106
120
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,109 @@
1
+ import { C as CommerceTurnIdentity, a as CommerceConversationGrant, b as CommerceManifest, T as ToolDescriptor, G as GrantedTool, c as CommerceToolResult, D as Digest, d as CommerceFinalResponse } from './response-DjZkLFT7.js';
2
+ import { S as StructuredLogger } from './types-B32wDMLO.js';
3
+
4
+ /** Finite, non-customer-facing failure taxonomy for Commerce hosts and logs. */
5
+ declare const RUNNER_DIAGNOSTIC_STAGES: readonly ["preflight.validate", "preflight.contract", "runtime.cancellation", "runtime.deadline", "runtime.operation", "tools.resolve", "model.invoke", "model.validate", "model.route", "tool.authorize", "tool.validate", "tool.execute", "tool.result", "evidence.validate", "final.validate", "graph.execute"];
6
+ type RunnerDiagnosticStage = typeof RUNNER_DIAGNOSTIC_STAGES[number];
7
+ declare const RUNNER_DIAGNOSTIC_REASONS: readonly ["CANCELLED_BY_CALLER", "TURN_DEADLINE_EXCEEDED", "OPERATION_TIMEOUT", "UPSTREAM_OPERATION_FAILED", "UNEXPECTED_EXCEPTION", "INPUT_TOO_LARGE", "TURN_INVALID", "GRANT_INVALID", "MANIFEST_INVALID", "GRANT_MISMATCH", "RUNNER_VERSION_INCOMPATIBLE", "RESPONSE_CONTRACT_INVALID", "LANGUAGE_INVALID", "BUDGET_INVALID", "CONTEXT_INVALID", "TOOL_REGISTRATION_INVALID", "MODEL_STEP_BUDGET_EXHAUSTED", "MODEL_INVOCATION_FAILED", "MODEL_STEP_NOT_OBJECT", "MODEL_STEP_CALLS_MISSING", "MODEL_STEP_CALLS_NOT_ARRAY", "MODEL_OUTPUT_TOKENS_MISSING", "MODEL_OUTPUT_TOKENS_NOT_SAFE_INTEGER", "MODEL_OUTPUT_TOKENS_NEGATIVE", "MODEL_OUTPUT_TOKENS_OVER_BUDGET", "MODEL_TOOL_CALL_LIMIT_EXCEEDED", "MODEL_TOOL_CALL_NULL", "MODEL_TOOL_CALL_NOT_OBJECT", "MODEL_TOOL_CALL_NAME_MISSING", "MODEL_TOOL_CALL_NAME_NOT_STRING", "MODEL_TOOL_CALL_NAME_EMPTY", "MODEL_TOOL_CALL_NAME_TOO_LONG", "MODEL_TOOL_CALL_ARGUMENTS_MISSING", "MODEL_TOOL_CALL_ARGUMENTS_NULL", "MODEL_TOOL_CALL_ARGUMENTS_NOT_OBJECT", "MODEL_STEP_TOO_LARGE", "MODEL_STEP_NOT_SERIALIZABLE", "MODEL_STEP_VALIDATION_FAILED", "MODEL_CALL_ROUTE_INVALID", "MODEL_RESULT_MISSING", "REQUEST_INVALID", "MODEL_REQUEST_HISTORY_INVALID", "MODEL_REQUEST_TOOL_RESULT_INVALID", "MODEL_CONFIGURATION_INVALID", "MODEL_CREDENTIAL_INVALID", "MODEL_ADAPTER_INITIALIZATION_FAILED", "MODEL_REQUEST_CANCELLED", "TOOL_BIND_FAILED", "PROVIDER_AUTH_FAILED", "PROVIDER_RATE_LIMITED", "PROVIDER_HTTP_ERROR", "PROVIDER_REQUEST_FAILED", "PROVIDER_RESPONSE_INVALID", "PROVIDER_RESPONSE_USAGE_INVALID", "PROVIDER_RESPONSE_TOOL_CALL_INVALID", "TOOL_DESCRIPTOR_MISMATCH", "TOOL_AUTHORIZATION_FAILED", "TOOL_INPUT_INVALID", "TOOL_CALL_BUDGET_EXHAUSTED", "TOOL_EXECUTION_FAILED", "TOOL_RESULT_TOO_LARGE", "TOOL_RESULT_INVALID", "TOOL_RESULT_MISSING", "TOOL_STALE_TURN", "EVIDENCE_INVALID", "FINAL_SCHEMA_INVALID", "FINAL_LANGUAGE_MISMATCH", "FINAL_REFERRAL_REQUIRED", "FINAL_EVIDENCE_INVALID", "FINAL_EVIDENCE_EXPIRED", "EVIDENCE_RESERVATION_EXCEEDED"];
8
+ type RunnerDiagnosticReason = typeof RUNNER_DIAGNOSTIC_REASONS[number];
9
+ /** Recognised transport failures, never arbitrary OS/provider error codes. */
10
+ declare const RUNNER_TRANSPORT_CODES: readonly ["ENOTFOUND", "EAI_AGAIN", "ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "ENETUNREACH", "EHOSTUNREACH", "EPIPE", "UND_ERR_CONNECT_TIMEOUT", "UND_ERR_HEADERS_TIMEOUT", "UND_ERR_SOCKET", "CERT_HAS_EXPIRED", "UNABLE_TO_VERIFY_LEAF_SIGNATURE", "DEPTH_ZERO_SELF_SIGNED_CERT", "ERR_TLS_CERT_ALTNAME_INVALID"];
11
+ type RunnerTransportCode = typeof RUNNER_TRANSPORT_CODES[number];
12
+ /** All optional fields are allowlisted; never include free-form provider or exception text. */
13
+ type RunnerDiagnostic = Readonly<{
14
+ stage: RunnerDiagnosticStage;
15
+ reasonCode: RunnerDiagnosticReason;
16
+ /** Fixed, safe operator explanation; computed from the validated code and detail. */
17
+ reasonMessage?: string;
18
+ /** Fixed, safe next step for the operator; never provider-supplied. */
19
+ operatorAction?: string;
20
+ /** Transport/exception details are from a fixed allowlist, not error.message. */
21
+ transportCode?: RunnerTransportCode;
22
+ exceptionName?: string;
23
+ statusCode?: number;
24
+ providerCode?: number;
25
+ providerStage?: "request" | "binding" | "provider" | "response";
26
+ modelStep?: number;
27
+ /** Zero-based index for a rejected tool call. Never includes user content. */
28
+ callIndex?: number;
29
+ remoteCallNumber?: number;
30
+ attempt?: number;
31
+ toolName?: string;
32
+ issueCount?: number;
33
+ issueCodes?: readonly string[];
34
+ issuePaths?: readonly string[];
35
+ }>;
36
+
37
+ type ModelCall = {
38
+ name: string;
39
+ arguments: unknown;
40
+ };
41
+ type ModelStep = {
42
+ calls: ModelCall[];
43
+ outputTokens: number;
44
+ };
45
+ type ModelRequest = {
46
+ instructions: readonly string[];
47
+ context: unknown;
48
+ history: readonly unknown[];
49
+ messages: readonly unknown[];
50
+ tools: Array<{
51
+ name: string;
52
+ description: string;
53
+ inputSchema: unknown;
54
+ }>;
55
+ maxOutputTokens: number;
56
+ };
57
+ type CommerceModelInvoker = {
58
+ invoke(request: ModelRequest, signal: AbortSignal): Promise<ModelStep>;
59
+ };
60
+ type RunnerTool = {
61
+ descriptor: ToolDescriptor;
62
+ isAuthorized: (tool: GrantedTool, signal: AbortSignal) => Promise<boolean>;
63
+ execute: (arguments_: Record<string, unknown>, signal: AbortSignal) => Promise<CommerceToolResult>;
64
+ extractEvidence?: (result: CommerceToolResult) => unknown[];
65
+ };
66
+ type RunCommerceTurnInput = {
67
+ turn: CommerceTurnIdentity;
68
+ grant: CommerceConversationGrant;
69
+ manifest: CommerceManifest;
70
+ hostInstructions: readonly string[];
71
+ context: unknown;
72
+ history: readonly unknown[];
73
+ language: {
74
+ tag: string | null;
75
+ source: string | null;
76
+ };
77
+ signal: AbortSignal;
78
+ dependencies: {
79
+ model: CommerceModelInvoker;
80
+ tools: RunnerTool[];
81
+ now: () => number;
82
+ digest: Digest;
83
+ logger?: StructuredLogger;
84
+ };
85
+ budgets?: {
86
+ modelSteps?: number;
87
+ remoteCalls?: number;
88
+ deadlineMs?: number;
89
+ outputTokens?: number;
90
+ };
91
+ };
92
+ type RunnerErrorCode = "INVALID_INPUT" | "INVALID_FINAL" | "BUDGET_EXHAUSTED" | "CANCELLED" | "DEADLINE" | "UNAVAILABLE" | "DENIED" | "STALE_TURN" | "INCOMPATIBLE_VERSION";
93
+ type RunCommerceTurnResult = {
94
+ ok: true;
95
+ result: CommerceFinalResponse;
96
+ usage: {
97
+ modelSteps: number;
98
+ remoteCalls: number;
99
+ };
100
+ } | {
101
+ ok: false;
102
+ error: {
103
+ code: RunnerErrorCode;
104
+ retryable: boolean;
105
+ diagnostic?: RunnerDiagnostic;
106
+ };
107
+ };
108
+
109
+ export type { CommerceModelInvoker as C, ModelStep as M, RunnerTransportCode as R, RunnerDiagnostic as a, RunCommerceTurnInput as b, RunCommerceTurnResult as c, ModelCall as d, ModelRequest as e, RunnerDiagnosticReason as f, RunnerDiagnosticStage as g, RunnerErrorCode as h, RunnerTool as i };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modainteract/moda-interact-shared",
3
- "version": "1.3.5",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",