diff --git a/packages/core-flows/src/fulfillment/steps/remove-rules-from-fulfillment-shipping-option.ts b/packages/core-flows/src/fulfillment/steps/remove-rules-from-fulfillment-shipping-option.ts index 31c415232f..2d721933e7 100644 --- a/packages/core-flows/src/fulfillment/steps/remove-rules-from-fulfillment-shipping-option.ts +++ b/packages/core-flows/src/fulfillment/steps/remove-rules-from-fulfillment-shipping-option.ts @@ -2,7 +2,7 @@ import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService, RemoveFulfillmentShippingOptionRulesWorkflowDTO, - ShippingOptionRuleOperatorType, + RuleOperatorType, } from "@medusajs/types" import { StepResponse, createStep } from "@medusajs/workflows-sdk" @@ -41,7 +41,7 @@ export const removeRulesFromFulfillmentShippingOptionStep = createStep( await fulfillmentModule.createShippingOptionRules( shippingOptionRules.map((rule) => ({ attribute: rule.attribute, - operator: rule.operator as ShippingOptionRuleOperatorType, + operator: rule.operator as RuleOperatorType, value: rule.value as unknown as string | string[], shipping_option_id: rule.shipping_option_id, })) diff --git a/packages/types/src/bundles.ts b/packages/types/src/bundles.ts index b6cd78c752..e0c8de7370 100644 --- a/packages/types/src/bundles.ts +++ b/packages/types/src/bundles.ts @@ -25,4 +25,5 @@ export * as WorkflowTypes from "./workflow" export * as ApiKeyTypes from "./api-key" export * as StoreTypes from "./store" export * as CurrencyTypes from "./currency" +export * as HttpTypes from "./http" export * as FileTypes from "./file" diff --git a/packages/types/src/common/index.ts b/packages/types/src/common/index.ts index a7d522e39a..9d965586f7 100644 --- a/packages/types/src/common/index.ts +++ b/packages/types/src/common/index.ts @@ -1,3 +1,4 @@ export * from "./common" +export * from "./rule" export * from "./config-module" export * from "./medusa-container" diff --git a/packages/types/src/common/rule.ts b/packages/types/src/common/rule.ts new file mode 100644 index 0000000000..b520abca12 --- /dev/null +++ b/packages/types/src/common/rule.ts @@ -0,0 +1,9 @@ +export type RuleOperatorType = + | "in" + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "nin" diff --git a/packages/types/src/fulfillment/mutations/shipping-option-rule.ts b/packages/types/src/fulfillment/mutations/shipping-option-rule.ts index 425ec5181c..e6bb20affc 100644 --- a/packages/types/src/fulfillment/mutations/shipping-option-rule.ts +++ b/packages/types/src/fulfillment/mutations/shipping-option-rule.ts @@ -1,16 +1,8 @@ -export type ShippingOptionRuleOperatorType = - | "in" - | "eq" - | "ne" - | "gt" - | "gte" - | "lt" - | "lte" - | "nin" +import { RuleOperatorType } from "../../common" export interface CreateShippingOptionRuleDTO { attribute: string - operator: ShippingOptionRuleOperatorType + operator: RuleOperatorType value: string | string[] shipping_option_id: string } diff --git a/packages/types/src/http/fulfillment/admin/fulfillment-address.ts b/packages/types/src/http/fulfillment/admin/fulfillment-address.ts new file mode 100644 index 0000000000..d894d39106 --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/fulfillment-address.ts @@ -0,0 +1,21 @@ +/** + * @experimental + */ +export interface AdminFulfillmentAddressResponse { + id: string + fulfillment_id: string | null + company: string | null + first_name: string | null + last_name: string | null + address_1: string | null + address_2: string | null + city: string | null + country_code: string | null + province: string | null + postal_code: string | null + phone: string | null + metadata: Record | null + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/fulfillment-item.ts b/packages/types/src/http/fulfillment/admin/fulfillment-item.ts new file mode 100644 index 0000000000..a384d1dca2 --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/fulfillment-item.ts @@ -0,0 +1,16 @@ +/** + * @experimental + */ +export interface AdminFulfillmentItemResponse { + id: string + title: string + quantity: number + sku: string + barcode: string + line_item_id: string | null + inventory_item_id: string | null + fulfillment_id: string + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/fulfillment-label.ts b/packages/types/src/http/fulfillment/admin/fulfillment-label.ts new file mode 100644 index 0000000000..1f0f6232f3 --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/fulfillment-label.ts @@ -0,0 +1,13 @@ +/** + * @experimental + */ +export interface AdminFulfillmentLabelResponse { + id: string + tracking_number: string + tracking_url: string + label_url: string + fulfillment_id: string + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/fulfillment-provider.ts b/packages/types/src/http/fulfillment/admin/fulfillment-provider.ts new file mode 100644 index 0000000000..691bb3815f --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/fulfillment-provider.ts @@ -0,0 +1,11 @@ +/** + * @experimental + */ +export interface AdminFulfillmentProviderResponse { + id: string + name: string + metadata: Record | null + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/fulfillment-set.ts b/packages/types/src/http/fulfillment/admin/fulfillment-set.ts new file mode 100644 index 0000000000..060ebe0e89 --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/fulfillment-set.ts @@ -0,0 +1,15 @@ +import { AdminServiceZoneResponse } from "./service-zone" + +/** + * @experimental + */ +export interface AdminFulfillmentSetResponse { + id: string + name: string + type: string + metadata: Record | null + service_zones: AdminServiceZoneResponse[] + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/fulfillment.ts b/packages/types/src/http/fulfillment/admin/fulfillment.ts new file mode 100644 index 0000000000..bf5086580d --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/fulfillment.ts @@ -0,0 +1,27 @@ +import { AdminFulfillmentAddressResponse } from "./fulfillment-address" +import { AdminFulfillmentProviderResponse } from "./fulfillment-provider" +import { AdminFulfillmentItemResponse } from "./fulfillment-item" +import { AdminFulfillmentLabelResponse } from "./fulfillment-label" + +/** + * @experimental + */ +export interface AdminFulfillmentResponse { + id: string + location_id: string + packed_at: Date | null + shipped_at: Date | null + delivered_at: Date | null + canceled_at: Date | null + data: Record | null + provider_id: string + shipping_option_id: string | null + metadata: Record | null + provider: AdminFulfillmentProviderResponse + delivery_address: AdminFulfillmentAddressResponse + items: AdminFulfillmentItemResponse[] + labels: AdminFulfillmentLabelResponse[] + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/geo-zone.ts b/packages/types/src/http/fulfillment/admin/geo-zone.ts new file mode 100644 index 0000000000..9d78dfaabb --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/geo-zone.ts @@ -0,0 +1,17 @@ +import { GeoZoneType } from "../../../fulfillment" + +/** + * @experimental + */ +export interface AdminGeoZoneResponse { + id: string + type: GeoZoneType + country_code: string + province_code: string | null + city: string | null + postal_expression: Record | null + metadata: Record | null + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/index.ts b/packages/types/src/http/fulfillment/admin/index.ts new file mode 100644 index 0000000000..cedec1962a --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/index.ts @@ -0,0 +1,12 @@ +export * from "./fulfillment" +export * from "./fulfillment-item" +export * from "./fulfillment-set" +export * from "./fulfillment-label" +export * from "./fulfillment-provider" +export * from "./fulfillment-address" +export * from "./geo-zone" +export * from "./service-zone" +export * from "./shipping-option" +export * from "./shipping-option-rule" +export * from "./shipping-option-type" +export * from "./shipping-profile" diff --git a/packages/types/src/http/fulfillment/admin/service-zone.ts b/packages/types/src/http/fulfillment/admin/service-zone.ts new file mode 100644 index 0000000000..1e88e90466 --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/service-zone.ts @@ -0,0 +1,14 @@ +import { AdminGeoZoneResponse } from "./geo-zone" + +/** + * @experimental + */ +export interface AdminServiceZoneResponse { + id: string + name: string + metadata: Record | null + geo_zones: AdminGeoZoneResponse[] + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/shipping-option-rule.ts b/packages/types/src/http/fulfillment/admin/shipping-option-rule.ts new file mode 100644 index 0000000000..8f1142b44d --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/shipping-option-rule.ts @@ -0,0 +1,13 @@ +/** + * @experimental + */ +export interface AdminShippingOptionRuleResponse { + id: string + attribute: string + operator: string + value: { value: string | string[] } | null + shipping_option_id: string + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/shipping-option-type.ts b/packages/types/src/http/fulfillment/admin/shipping-option-type.ts new file mode 100644 index 0000000000..d0fd66dae9 --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/shipping-option-type.ts @@ -0,0 +1,13 @@ +/** + * @experimental + */ +export interface AdminShippingOptionTypeResponse { + id: string + label: string + description: string + code: string + shipping_option_id: string + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/shipping-option.ts b/packages/types/src/http/fulfillment/admin/shipping-option.ts new file mode 100644 index 0000000000..598975c55e --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/shipping-option.ts @@ -0,0 +1,31 @@ +import { ShippingOptionPriceType } from "../../../fulfillment" +import { AdminServiceZoneResponse } from "./service-zone" +import { AdminShippingOptionTypeResponse } from "./shipping-option-type" +import { AdminShippingOptionRuleResponse } from "./shipping-option-rule" +import { AdminShippingProfileResponse } from "./shipping-profile" +import { AdminFulfillmentProviderResponse } from "./fulfillment-provider" +import { AdminFulfillmentResponse } from "./fulfillment" + +/** + * @experimental + */ +export interface AdminShippingOptionResponse { + id: string + name: string + price_type: ShippingOptionPriceType + service_zone_id: string + shipping_profile_id: string + provider_id: string + shipping_option_type_id: string | null + data: Record | null + metadata: Record | null + service_zone: AdminServiceZoneResponse + shipping_profile: AdminShippingProfileResponse + fulfillment_provider: AdminFulfillmentProviderResponse + type: AdminShippingOptionTypeResponse + rules: AdminShippingOptionRuleResponse[] + fulfillments: AdminFulfillmentResponse[] + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/admin/shipping-profile.ts b/packages/types/src/http/fulfillment/admin/shipping-profile.ts new file mode 100644 index 0000000000..21408cb8fa --- /dev/null +++ b/packages/types/src/http/fulfillment/admin/shipping-profile.ts @@ -0,0 +1,12 @@ +/** + * @experimental + */ +export interface AdminShippingProfileResponse { + id: string + name: string + type: string + metadata: Record | null + created_at: Date + updated_at: Date + deleted_at: Date | null +} diff --git a/packages/types/src/http/fulfillment/index.ts b/packages/types/src/http/fulfillment/index.ts new file mode 100644 index 0000000000..26b8eb9dad --- /dev/null +++ b/packages/types/src/http/fulfillment/index.ts @@ -0,0 +1 @@ +export * from "./admin" diff --git a/packages/types/src/http/index.ts b/packages/types/src/http/index.ts new file mode 100644 index 0000000000..b3f8f6afd6 --- /dev/null +++ b/packages/types/src/http/index.ts @@ -0,0 +1 @@ +export * from "./fulfillment" diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 2c5d9e48df..566c2b446b 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -35,4 +35,5 @@ export * from "./transaction-base" export * from "./user" export * from "./workflow" export * from "./currency" +export * from "./http" export * from "./file"