chore: make apis nullable (#7763)
what: - makes top level attributes of each object an optional field in the http layer where possible RESOLVES CORE-2229
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { OrderEdit } from "@medusajs/medusa"
|
||||
import { DataSource } from "typeorm"
|
||||
import { OrderFactoryData, simpleOrderFactory } from "./simple-order-factory"
|
||||
import { OrderEdit } from "@medusajs/medusa"
|
||||
|
||||
export type OrderEditFactoryData = {
|
||||
id?: string
|
||||
order?: OrderFactoryData
|
||||
order_id?: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
declined_reason?: string
|
||||
payment_collection_id?: string
|
||||
confirmed_at?: Date | string
|
||||
|
||||
@@ -102,7 +102,8 @@ function prepareFulfillmentData({
|
||||
} as FulfillmentWorkflow.CreateFulfillmentItemWorkflowDTO
|
||||
})
|
||||
|
||||
let locationId: string | undefined = input.location_id
|
||||
let locationId: string | undefined | null = input.location_id
|
||||
|
||||
if (!locationId) {
|
||||
locationId = shippingOption.service_zone.fulfillment_set.location?.id
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ function prepareFulfillmentData({
|
||||
} as FulfillmentWorkflow.CreateFulfillmentItemWorkflowDTO
|
||||
})
|
||||
|
||||
let locationId: string | undefined = input.location_id
|
||||
let locationId: string | undefined | null = input.location_id
|
||||
if (!locationId) {
|
||||
locationId = returnShippingOption.service_zone.fulfillment_set.location?.id
|
||||
}
|
||||
|
||||
@@ -361,3 +361,5 @@ export type KebabCase<S extends string> =
|
||||
? `${Lowercase<T>}-${KebabCase<`${Lowercase<U>}${V}`>}`
|
||||
: `${T}${KebabCase<`${U}${V}`>}`
|
||||
: S
|
||||
|
||||
export type MetadataType = Record<string, unknown> | null
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MetadataType } from "../common"
|
||||
|
||||
/**
|
||||
* The customer address to be created.
|
||||
*/
|
||||
@@ -5,7 +7,7 @@ export interface CreateCustomerAddressDTO {
|
||||
/**
|
||||
* The address's name.
|
||||
*/
|
||||
address_name?: string
|
||||
address_name?: string | null
|
||||
|
||||
/**
|
||||
* Whether the address is default shipping.
|
||||
@@ -25,57 +27,57 @@ export interface CreateCustomerAddressDTO {
|
||||
/**
|
||||
* The company.
|
||||
*/
|
||||
company?: string
|
||||
company?: string | null
|
||||
|
||||
/**
|
||||
* The first name.
|
||||
*/
|
||||
first_name?: string
|
||||
first_name?: string | null
|
||||
|
||||
/**
|
||||
* The last name.
|
||||
*/
|
||||
last_name?: string
|
||||
last_name?: string | null
|
||||
|
||||
/**
|
||||
* The address 1.
|
||||
*/
|
||||
address_1?: string
|
||||
address_1?: string | null
|
||||
|
||||
/**
|
||||
* The address 2.
|
||||
*/
|
||||
address_2?: string
|
||||
address_2?: string | null
|
||||
|
||||
/**
|
||||
* The city.
|
||||
*/
|
||||
city?: string
|
||||
city?: string | null
|
||||
|
||||
/**
|
||||
* The country code.
|
||||
*/
|
||||
country_code?: string
|
||||
country_code?: string | null
|
||||
|
||||
/**
|
||||
* The province.
|
||||
*/
|
||||
province?: string
|
||||
province?: string | null
|
||||
|
||||
/**
|
||||
* The postal code.
|
||||
*/
|
||||
postal_code?: string
|
||||
postal_code?: string | null
|
||||
|
||||
/**
|
||||
* The phone.
|
||||
*/
|
||||
phone?: string
|
||||
phone?: string | null
|
||||
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +162,7 @@ export interface UpdateCustomerAddressDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,32 +172,32 @@ export interface CreateCustomerDTO {
|
||||
/**
|
||||
* The company name of the customer.
|
||||
*/
|
||||
company_name?: string
|
||||
company_name?: string | null
|
||||
|
||||
/**
|
||||
* The first name of the customer.
|
||||
*/
|
||||
first_name?: string
|
||||
first_name?: string | null
|
||||
|
||||
/**
|
||||
* The last name of the customer.
|
||||
*/
|
||||
last_name?: string
|
||||
last_name?: string | null
|
||||
|
||||
/**
|
||||
* The email of the customer.
|
||||
*/
|
||||
email?: string
|
||||
email?: string | null
|
||||
|
||||
/**
|
||||
* The phone of the customer.
|
||||
*/
|
||||
phone?: string
|
||||
phone?: string | null
|
||||
|
||||
/**
|
||||
* Who created the customer.
|
||||
*/
|
||||
created_by?: string
|
||||
created_by?: string | null
|
||||
|
||||
/**
|
||||
* The addresses of the customer.
|
||||
@@ -205,7 +207,7 @@ export interface CreateCustomerDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,7 +247,7 @@ export interface UpdateCustomerDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,7 +282,7 @@ export interface CustomerUpdatableFields {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,7 +297,7 @@ export interface CustomerGroupUpdatableFields {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,7 +322,7 @@ export interface UpdateCustomerGroupDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -335,7 +337,7 @@ export interface CreateCustomerGroupDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
|
||||
/**
|
||||
* Who created the customer group. For example,
|
||||
@@ -361,5 +363,5 @@ export interface UpdateCustomerGroupDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export interface UpdateServiceZoneDTO {
|
||||
/**
|
||||
* The name of the service zone.
|
||||
*/
|
||||
name?: string
|
||||
name?: string | null
|
||||
|
||||
/**
|
||||
* The geo zones associated with the service zone.
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface UpdateReservationItemInput {
|
||||
/**
|
||||
* The description of the reservation item.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
/**
|
||||
* Allow backorder of the item. If true, it won't check inventory levels before reserving it.
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ export interface CreateReservationItemInput {
|
||||
/**
|
||||
* The ID of the associated line item.
|
||||
*/
|
||||
line_item_id?: string
|
||||
line_item_id?: string | null
|
||||
/**
|
||||
* The ID of the associated inventory item.
|
||||
*/
|
||||
@@ -56,15 +56,15 @@ export interface CreateReservationItemInput {
|
||||
/**
|
||||
* The description of the reservation.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
/**
|
||||
* The user or system that created the reservation. Can be any form of identification string.
|
||||
*/
|
||||
created_by?: string
|
||||
created_by?: string | null
|
||||
/**
|
||||
* An ID associated with an external third-party system that the reservation item is connected to.
|
||||
*/
|
||||
external_id?: string
|
||||
external_id?: string | null
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ export interface CreateReservationItemInput {
|
||||
}
|
||||
|
||||
export interface ReserveQuantityContext {
|
||||
locationId?: string
|
||||
lineItemId?: string
|
||||
locationId?: string | null
|
||||
lineItemId?: string | null
|
||||
salesChannelId?: string | null
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ export interface CreateOrderChangeDTO {
|
||||
claim_id?: string
|
||||
exchange_id?: string
|
||||
description?: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
requested_by?: string
|
||||
requested_at?: Date
|
||||
created_by?: string
|
||||
@@ -265,7 +265,7 @@ export interface UpdateOrderChangeDTO {
|
||||
id: string
|
||||
status?: string
|
||||
description?: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
requested_by?: string
|
||||
requested_at?: Date
|
||||
confirmed_by?: string
|
||||
@@ -309,14 +309,14 @@ export interface CreateOrderChangeActionDTO {
|
||||
reference?: string
|
||||
reference_id?: string
|
||||
action: ChangeActionType
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
amount?: BigNumberInput
|
||||
details?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface UpdateOrderChangeActionDTO {
|
||||
id: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
}
|
||||
|
||||
/** ORDER TRANSACTION START */
|
||||
@@ -326,7 +326,7 @@ export interface CreateOrderTransactionDTO {
|
||||
description?: string
|
||||
reference?: string
|
||||
reference_id?: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
created_by?: string
|
||||
amount: BigNumberInput
|
||||
currency_code: string
|
||||
@@ -338,7 +338,7 @@ export interface UpdateOrderTransactionDTO {
|
||||
amount?: BigNumberInput
|
||||
currency_code?: string
|
||||
description?: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
reference?: string
|
||||
reference_id?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
@@ -378,8 +378,8 @@ export interface UpdateOrderItemWithSelectorDTO {
|
||||
interface BaseOrderBundledItemActionsDTO {
|
||||
id: string
|
||||
quantity: BigNumberInput
|
||||
internal_note?: string
|
||||
note?: string
|
||||
internal_note?: string | null
|
||||
note?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
interface BaseOrderBundledActionsDTO {
|
||||
@@ -389,10 +389,10 @@ interface BaseOrderBundledActionsDTO {
|
||||
exchange_id?: string
|
||||
|
||||
description?: string
|
||||
internal_note?: string
|
||||
internal_note?: string | null
|
||||
reference?: string
|
||||
reference_id?: string
|
||||
created_by?: string
|
||||
created_by?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
@@ -414,9 +414,9 @@ export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
|
||||
items: {
|
||||
id: string
|
||||
quantity: BigNumberInput
|
||||
internal_note?: string
|
||||
note?: string
|
||||
reason_id?: string
|
||||
internal_note?: string | null
|
||||
note?: string | null
|
||||
reason_id?: string | null
|
||||
metadata?: Record<string, any>
|
||||
}[]
|
||||
shipping_method?: Omit<CreateOrderShippingMethodDTO, "order_id"> | string
|
||||
|
||||
@@ -90,11 +90,11 @@ export interface UpdateMoneyAmountDTO {
|
||||
/**
|
||||
* The minimum quantity required to be purchased for this money amount to be applied.
|
||||
*/
|
||||
min_quantity?: BigNumberInput
|
||||
min_quantity?: BigNumberInput | null
|
||||
/**
|
||||
* The maximum quantity required to be purchased for this money amount to be applied.
|
||||
*/
|
||||
max_quantity?: BigNumberInput
|
||||
max_quantity?: BigNumberInput | null
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -203,7 +203,7 @@ export interface UpdatePriceListDTO {
|
||||
/**
|
||||
* The price list's description.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
/**
|
||||
* The price list is enabled starting from this date.
|
||||
*/
|
||||
|
||||
@@ -5,8 +5,8 @@ export interface CreatePriceListPriceWorkflowDTO {
|
||||
amount: number
|
||||
currency_code: string
|
||||
variant_id: string
|
||||
max_quantity?: number
|
||||
min_quantity?: number
|
||||
max_quantity?: number | null
|
||||
min_quantity?: number | null
|
||||
rules?: Record<string, string>
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ export interface UpdatePriceListPriceWorkflowDTO {
|
||||
variant_id: string
|
||||
amount?: number
|
||||
currency_code?: string
|
||||
max_quantity?: number
|
||||
min_quantity?: number
|
||||
max_quantity?: number | null
|
||||
min_quantity?: number | null
|
||||
rules?: Record<string, string>
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface CreatePriceListWorkflowInputDTO {
|
||||
export interface UpdatePriceListWorkflowInputDTO {
|
||||
id: string
|
||||
title?: string
|
||||
description?: string
|
||||
description?: string | null
|
||||
starts_at?: string | null
|
||||
ends_at?: string | null
|
||||
status?: PriceListStatus
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MetadataType } from "../common"
|
||||
import { BaseFilterable } from "../dal"
|
||||
import { OperatorMap } from "../dal/utils"
|
||||
|
||||
@@ -150,7 +151,7 @@ export interface ProductDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +299,7 @@ export interface ProductCategoryDTO {
|
||||
/**
|
||||
* The ranking of the product category among sibling categories.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* The associated parent category.
|
||||
*
|
||||
@@ -368,7 +369,7 @@ export interface CreateProductCategoryDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
export interface UpsertProductCategoryDTO extends UpdateProductCategoryDTO {
|
||||
@@ -415,7 +416,7 @@ export interface UpdateProductCategoryDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -435,7 +436,7 @@ export interface ProductTagDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* The associated products.
|
||||
*
|
||||
@@ -465,7 +466,7 @@ export interface ProductCollectionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* When the product collection was created.
|
||||
*/
|
||||
@@ -503,7 +504,7 @@ export interface ProductTypeDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* When the product type was created.
|
||||
*/
|
||||
@@ -552,7 +553,7 @@ export interface ProductOptionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* When the product option was created.
|
||||
*/
|
||||
@@ -589,7 +590,7 @@ export interface ProductImageDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* When the product image was created.
|
||||
*/
|
||||
@@ -638,7 +639,7 @@ export interface ProductOptionValueDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
/**
|
||||
* When the product option value was created.
|
||||
*/
|
||||
@@ -950,7 +951,7 @@ export interface CreateProductCollectionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -992,7 +993,7 @@ export interface UpdateProductCollectionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1008,7 +1009,7 @@ export interface CreateProductTypeDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1038,7 +1039,7 @@ export interface UpdateProductTypeDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1054,7 +1055,7 @@ export interface CreateProductImageDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1083,7 +1084,7 @@ export interface UpdateProductImageDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1255,7 +1256,7 @@ export interface CreateProductVariantDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1347,7 +1348,7 @@ export interface UpdateProductVariantDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1456,7 +1457,7 @@ export interface CreateProductDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1573,5 +1574,5 @@ export interface UpdateProductDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface CreateCampaignDTO {
|
||||
/**
|
||||
* The description of the campaign.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
|
||||
/**
|
||||
* The campaign identifier of the campaign.
|
||||
@@ -77,12 +77,12 @@ export interface CreateCampaignDTO {
|
||||
/**
|
||||
* The start date of the campaign.
|
||||
*/
|
||||
starts_at?: Date
|
||||
starts_at?: Date | null
|
||||
|
||||
/**
|
||||
* The end date of the campaign.
|
||||
*/
|
||||
ends_at?: Date
|
||||
ends_at?: Date | null
|
||||
|
||||
/**
|
||||
* The associated campaign budget.
|
||||
@@ -107,7 +107,7 @@ export interface UpdateCampaignDTO {
|
||||
/**
|
||||
* The description of the campaign.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
|
||||
/**
|
||||
* The campaign identifier of the campaign.
|
||||
@@ -117,12 +117,12 @@ export interface UpdateCampaignDTO {
|
||||
/**
|
||||
* The start date of the campaign.
|
||||
*/
|
||||
starts_at?: Date
|
||||
starts_at?: Date | null
|
||||
|
||||
/**
|
||||
* The end date of the campaign.
|
||||
*/
|
||||
ends_at?: Date
|
||||
ends_at?: Date | null
|
||||
|
||||
/**
|
||||
* The budget of the campaign.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MetadataType } from "../common"
|
||||
|
||||
/**
|
||||
* The region to be created.
|
||||
*/
|
||||
@@ -25,7 +27,7 @@ export interface CreateRegionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +59,7 @@ export interface UpsertRegionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,5 +85,5 @@ export interface UpdateRegionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MetadataType } from "../common"
|
||||
|
||||
/**
|
||||
* The sales channel to be created.
|
||||
*/
|
||||
@@ -10,7 +12,7 @@ export interface CreateSalesChannelDTO {
|
||||
/**
|
||||
* The description of the sales channel.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
|
||||
/**
|
||||
* Whether the sales channel is disabled.
|
||||
@@ -39,7 +41,7 @@ export interface UpdateSalesChannelDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,5 +71,5 @@ export interface UpsertSalesChannelDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MetadataType } from "../common"
|
||||
import { BaseFilterable, OperatorMap } from "../dal"
|
||||
import { FulfillmentSetDTO } from "../fulfillment"
|
||||
|
||||
@@ -114,7 +115,7 @@ export type StockLocationAddressDTO = {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
|
||||
/**
|
||||
* The creation date of the stock location address.
|
||||
@@ -346,7 +347,7 @@ export type StockLocationAddressInput = {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,7 +383,7 @@ export type CreateStockLocationInput = {
|
||||
/**
|
||||
* The associated address's ID.
|
||||
*/
|
||||
address_id?: string
|
||||
address_id?: string | null
|
||||
|
||||
/**
|
||||
* The associated address.
|
||||
@@ -392,7 +393,7 @@ export type CreateStockLocationInput = {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,7 +427,7 @@ export type UpdateStockLocationInput = {
|
||||
/**
|
||||
* The associated address's ID.
|
||||
*/
|
||||
address_id?: string
|
||||
address_id?: string | null
|
||||
|
||||
/**
|
||||
* The associated address's details.
|
||||
@@ -436,7 +437,7 @@ export type UpdateStockLocationInput = {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MetadataType } from "../common"
|
||||
|
||||
/**
|
||||
* The tax rate to be created.
|
||||
*/
|
||||
@@ -44,7 +46,7 @@ export interface CreateTaxRateDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +91,7 @@ export interface UpsertTaxRateDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown> | null
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +144,7 @@ export interface UpdateTaxRateDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +169,7 @@ export interface CreateTaxRegionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
|
||||
/**
|
||||
* Who created the tax region. For example, the ID of
|
||||
@@ -200,7 +202,7 @@ export interface CreateTaxRegionDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +234,7 @@ export interface CreateTaxRateRuleDTO {
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
metadata?: MetadataType
|
||||
|
||||
/**
|
||||
* Who created the tax rate rule. For example, the ID of the
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface CreateServiceZonesWorkflowInput {
|
||||
}
|
||||
|
||||
interface UpdateServiceZone {
|
||||
name?: string
|
||||
name?: string | null
|
||||
geo_zones?: (
|
||||
| Omit<CreateCountryGeoZoneDTO, "service_zone_id">
|
||||
| Omit<CreateProvinceGeoZoneDTO, "service_zone_id">
|
||||
|
||||
@@ -10,6 +10,6 @@ export interface CreateOrderFulfillmentWorkflowInput {
|
||||
created_by?: string // The id of the authenticated user
|
||||
items: CreateOrderFulfillmentItem[]
|
||||
no_notification?: boolean
|
||||
location_id?: string
|
||||
metadata?: Record<string, any>
|
||||
location_id?: string | null
|
||||
metadata?: Record<string, any> | null
|
||||
}
|
||||
|
||||
@@ -3,25 +3,25 @@ import { BigNumberInput } from "../../totals"
|
||||
interface CreateReturnItem {
|
||||
id: string
|
||||
quantity: BigNumberInput
|
||||
internal_note?: string
|
||||
note?: string
|
||||
reason_id?: string
|
||||
internal_note?: string | null
|
||||
reason_id?: string | null
|
||||
note?: string | null
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
|
||||
export interface CreateOrderReturnWorkflowInput {
|
||||
order_id: string
|
||||
created_by?: string // The id of the authenticated user
|
||||
created_by?: string | null // The id of the authenticated user
|
||||
items: CreateReturnItem[]
|
||||
return_shipping: {
|
||||
option_id: string
|
||||
price?: number
|
||||
}
|
||||
note?: string
|
||||
note?: string | null
|
||||
receive_now?: boolean
|
||||
refund_amount?: number
|
||||
/**
|
||||
* Default fallback to the shipping option location id
|
||||
*/
|
||||
location_id?: string
|
||||
location_id?: string | null
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { MetadataType } from "../../common"
|
||||
import { BigNumberInput } from "../../totals"
|
||||
import { CreateFulfillmentLabelWorkflowDTO } from "../fulfillment"
|
||||
|
||||
@@ -13,5 +14,5 @@ export interface CreateOrderShipmentWorkflowInput {
|
||||
items: CreateOrderShipmentItem[]
|
||||
labels: CreateFulfillmentLabelWorkflowDTO[]
|
||||
no_notification?: boolean
|
||||
metadata?: Record<string, any>
|
||||
metadata?: MetadataType
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { ApiKeyType } from "@medusajs/utils"
|
||||
import { z } from "zod"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
import { ApiKeyType } from "@medusajs/utils"
|
||||
|
||||
export const AdminGetApiKeyParams = createSelectParams()
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ export const AdminGetCampaignsParams = createFindParams({
|
||||
export const CreateCampaignBudget = z
|
||||
.object({
|
||||
type: z.nativeEnum(CampaignBudgetType),
|
||||
limit: z.number().optional().nullable(),
|
||||
currency_code: z.string().optional().nullable(),
|
||||
limit: z.number().optional(),
|
||||
currency_code: z.string().nullish(),
|
||||
})
|
||||
.strict()
|
||||
.refine(
|
||||
@@ -52,7 +52,7 @@ export const CreateCampaignBudget = z
|
||||
|
||||
export const UpdateCampaignBudget = z
|
||||
.object({
|
||||
limit: z.number().optional().nullable(),
|
||||
limit: z.number().optional(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -61,10 +61,10 @@ export const AdminCreateCampaign = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
campaign_identifier: z.string(),
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
budget: CreateCampaignBudget.optional(),
|
||||
starts_at: z.coerce.date().optional(),
|
||||
ends_at: z.coerce.date().optional(),
|
||||
starts_at: z.coerce.date().nullish(),
|
||||
ends_at: z.coerce.date().nullish(),
|
||||
promotions: z.array(z.object({ id: z.string() })).optional(),
|
||||
})
|
||||
.strict()
|
||||
@@ -73,9 +73,9 @@ export type AdminUpdateCampaignType = z.infer<typeof AdminUpdateCampaign>
|
||||
export const AdminUpdateCampaign = z.object({
|
||||
name: z.string().optional(),
|
||||
campaign_identifier: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
budget: UpdateCampaignBudget.optional(),
|
||||
starts_at: z.coerce.date().optional(),
|
||||
ends_at: z.coerce.date().optional(),
|
||||
starts_at: z.coerce.date().nullish(),
|
||||
ends_at: z.coerce.date().nullish(),
|
||||
promotions: z.array(z.object({ id: z.string() })).optional(),
|
||||
})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from "zod"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
|
||||
export const AdminGetCollectionParams = createSelectParams()
|
||||
|
||||
@@ -30,12 +30,12 @@ export type AdminCreateCollectionType = z.infer<typeof AdminCreateCollection>
|
||||
export const AdminCreateCollection = z.object({
|
||||
title: z.string(),
|
||||
handle: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminUpdateCollectionType = z.infer<typeof AdminUpdateCollection>
|
||||
export const AdminUpdateCollection = z.object({
|
||||
title: z.string().optional(),
|
||||
handle: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export const AdminGetCurrencyParams = createSelectParams()
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export type AdminCreateCustomerGroupType = z.infer<
|
||||
>
|
||||
export const AdminCreateCustomerGroup = z.object({
|
||||
name: z.string(),
|
||||
metadata: z.record(z.any()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminUpdateCustomerGroupType = z.infer<
|
||||
@@ -66,5 +66,5 @@ export type AdminUpdateCustomerGroupType = z.infer<
|
||||
>
|
||||
export const AdminUpdateCustomerGroup = z.object({
|
||||
name: z.string(),
|
||||
metadata: z.record(z.any()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
@@ -43,38 +43,38 @@ export const AdminCustomersParams = createFindParams({
|
||||
)
|
||||
|
||||
export const AdminCreateCustomer = z.object({
|
||||
email: z.string().email().optional(),
|
||||
company_name: z.string().optional(),
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
email: z.string().email().nullish(),
|
||||
company_name: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
phone: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export const AdminUpdateCustomer = z.object({
|
||||
email: z.string().email().nullable().optional(),
|
||||
company_name: z.string().nullable().optional(),
|
||||
first_name: z.string().nullable().optional(),
|
||||
last_name: z.string().nullable().optional(),
|
||||
phone: z.string().nullable().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
email: z.string().email().nullish(),
|
||||
company_name: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
phone: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export const AdminCreateCustomerAddress = z.object({
|
||||
address_name: z.string().optional(),
|
||||
address_name: z.string().nullish(),
|
||||
is_default_shipping: z.boolean().optional(),
|
||||
is_default_billing: z.boolean().optional(),
|
||||
company: z.string().optional(),
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
address_1: z.string().optional(),
|
||||
address_2: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
country_code: z.string().optional(),
|
||||
province: z.string().optional(),
|
||||
postal_code: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
company: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
address_1: z.string().nullish(),
|
||||
address_2: z.string().nullish(),
|
||||
city: z.string().nullish(),
|
||||
country_code: z.string().nullish(),
|
||||
province: z.string().nullish(),
|
||||
postal_code: z.string().nullish(),
|
||||
phone: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export const AdminUpdateCustomerAddress = AdminCreateCustomerAddress
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { AddressPayload, BigNumberInput } from "../../utils/common-validators"
|
||||
import { z } from "zod"
|
||||
import { AddressPayload, BigNumberInput } from "../../utils/common-validators"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export type AdminGetOrderParamsType = z.infer<typeof AdminGetOrderParams>
|
||||
export const AdminGetOrderParams = createSelectParams()
|
||||
@@ -23,8 +23,8 @@ enum Status {
|
||||
}
|
||||
|
||||
const ShippingMethod = z.object({
|
||||
shipping_method_id: z.string().optional(),
|
||||
order_id: z.string().optional(),
|
||||
shipping_method_id: z.string().nullish(),
|
||||
order_id: z.string().nullish(),
|
||||
name: z.string(),
|
||||
option_id: z.string(),
|
||||
data: z.record(z.string(), z.unknown()).optional(),
|
||||
@@ -33,13 +33,13 @@ const ShippingMethod = z.object({
|
||||
|
||||
const Item = z
|
||||
.object({
|
||||
title: z.string().optional(),
|
||||
sku: z.string().optional(),
|
||||
barcode: z.string().optional(),
|
||||
variant_id: z.string().optional(),
|
||||
unit_price: BigNumberInput.optional(),
|
||||
title: z.string().nullish(),
|
||||
sku: z.string().nullish(),
|
||||
barcode: z.string().nullish(),
|
||||
variant_id: z.string().nullish(),
|
||||
unit_price: BigNumberInput.nullish(),
|
||||
quantity: z.number(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.refine((data) => {
|
||||
if (!data.variant_id) {
|
||||
@@ -53,18 +53,18 @@ export type AdminCreateDraftOrderType = z.infer<typeof AdminCreateDraftOrder>
|
||||
export const AdminCreateDraftOrder = z
|
||||
.object({
|
||||
status: z.nativeEnum(Status).optional(),
|
||||
sales_channel_id: z.string().optional(),
|
||||
email: z.string().optional(),
|
||||
customer_id: z.string().optional(),
|
||||
sales_channel_id: z.string().nullish(),
|
||||
email: z.string().nullish(),
|
||||
customer_id: z.string().nullish(),
|
||||
billing_address: AddressPayload.optional(),
|
||||
shipping_address: AddressPayload.optional(),
|
||||
items: z.array(Item).optional(),
|
||||
region_id: z.string(),
|
||||
promo_codes: z.array(z.string()).optional(),
|
||||
currency_code: z.string().optional(),
|
||||
currency_code: z.string().nullish(),
|
||||
no_notification_order: z.boolean().optional(),
|
||||
shipping_methods: z.array(ShippingMethod),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
.refine(
|
||||
|
||||
@@ -30,7 +30,7 @@ export const AdminCreateFulfillmentSetServiceZonesSchema = z
|
||||
|
||||
export const AdminUpdateFulfillmentSetServiceZonesSchema = z
|
||||
.object({
|
||||
name: z.string().optional(),
|
||||
name: z.string().nullish(),
|
||||
geo_zones: z
|
||||
.array(
|
||||
z.union([
|
||||
|
||||
@@ -2,7 +2,7 @@ import { z } from "zod"
|
||||
|
||||
const geoZoneBaseSchema = z.object({
|
||||
country_code: z.string(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export const geoZoneCountrySchema = geoZoneBaseSchema.merge(
|
||||
|
||||
@@ -9,8 +9,8 @@ const AdminCreateFulfillmentItem = z.object({
|
||||
sku: z.string(),
|
||||
quantity: z.number(),
|
||||
barcode: z.string(),
|
||||
line_item_id: z.string().optional(),
|
||||
inventory_item_id: z.string().optional(),
|
||||
line_item_id: z.string().nullish(),
|
||||
inventory_item_id: z.string().nullish(),
|
||||
})
|
||||
|
||||
const AdminCreateFulfillmentLabel = z.object({
|
||||
@@ -32,13 +32,13 @@ export const AdminCreateFulfillment = z.object({
|
||||
labels: z.array(AdminCreateFulfillmentLabel),
|
||||
order: z.object({}),
|
||||
order_id: z.string(),
|
||||
shipping_option_id: z.string().optional(),
|
||||
data: z.record(z.unknown()).optional().nullable(),
|
||||
packed_at: z.coerce.date().optional().nullable(),
|
||||
shipped_at: z.coerce.date().optional().nullable(),
|
||||
delivered_at: z.coerce.date().optional().nullable(),
|
||||
canceled_at: z.coerce.date().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
shipping_option_id: z.string().nullish(),
|
||||
data: z.record(z.unknown()).nullable(),
|
||||
packed_at: z.coerce.date().nullish(),
|
||||
shipped_at: z.coerce.date().nullish(),
|
||||
delivered_at: z.coerce.date().nullish(),
|
||||
canceled_at: z.coerce.date().nullish(),
|
||||
metadata: z.record(z.unknown()).nullable(),
|
||||
})
|
||||
|
||||
export type AdminCreateShipmentType = z.infer<typeof AdminCreateShipment>
|
||||
|
||||
@@ -90,20 +90,20 @@ export type AdminCreateInventoryItemType = z.infer<
|
||||
>
|
||||
export const AdminCreateInventoryItem = z
|
||||
.object({
|
||||
sku: z.string().optional(),
|
||||
hs_code: z.string().optional(),
|
||||
weight: z.number().optional(),
|
||||
length: z.number().optional(),
|
||||
height: z.number().optional(),
|
||||
width: z.number().optional(),
|
||||
origin_country: z.string().optional(),
|
||||
mid_code: z.string().optional(),
|
||||
material: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
sku: z.string().nullish(),
|
||||
hs_code: z.string().nullish(),
|
||||
weight: z.number().nullish(),
|
||||
length: z.number().nullish(),
|
||||
height: z.number().nullish(),
|
||||
width: z.number().nullish(),
|
||||
origin_country: z.string().nullish(),
|
||||
mid_code: z.string().nullish(),
|
||||
material: z.string().nullish(),
|
||||
title: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
requires_shipping: z.boolean().optional(),
|
||||
thumbnail: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
thumbnail: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
location_levels: z.array(AdminCreateInventoryLocationLevel).optional(),
|
||||
})
|
||||
.strict()
|
||||
@@ -113,19 +113,19 @@ export type AdminUpdateInventoryItemType = z.infer<
|
||||
>
|
||||
export const AdminUpdateInventoryItem = z
|
||||
.object({
|
||||
sku: z.string().optional(),
|
||||
hs_code: z.string().optional(),
|
||||
weight: z.number().optional(),
|
||||
length: z.number().optional(),
|
||||
height: z.number().optional(),
|
||||
width: z.number().optional(),
|
||||
origin_country: z.string().optional(),
|
||||
mid_code: z.string().optional(),
|
||||
material: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
sku: z.string().nullish(),
|
||||
hs_code: z.string().nullish(),
|
||||
weight: z.number().nullish(),
|
||||
length: z.number().nullish(),
|
||||
height: z.number().nullish(),
|
||||
width: z.number().nullish(),
|
||||
origin_country: z.string().nullish(),
|
||||
mid_code: z.string().nullish(),
|
||||
material: z.string().nullish(),
|
||||
title: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
requires_shipping: z.boolean().optional(),
|
||||
thumbnail: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
thumbnail: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -44,8 +44,8 @@ export const AdminCreateInvite = z
|
||||
export type AdminInviteAcceptType = z.infer<typeof AdminInviteAccept>
|
||||
export const AdminInviteAccept = z
|
||||
.object({
|
||||
email: z.string().optional(),
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
email: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -54,9 +54,9 @@ const Item = z.object({
|
||||
|
||||
export const AdminOrderCreateFulfillment = z.object({
|
||||
items: z.array(Item),
|
||||
location_id: z.string().optional(),
|
||||
location_id: z.string().nullish(),
|
||||
no_notification: z.boolean().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminOrderCreateFulfillmentType = z.infer<
|
||||
@@ -73,7 +73,7 @@ export const AdminOrderCreateShipment = z.object({
|
||||
items: z.array(Item),
|
||||
labels: z.array(Label).optional(),
|
||||
no_notification: z.boolean().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminOrderCreateShipmentType = z.infer<
|
||||
|
||||
@@ -29,8 +29,8 @@ export const AdminCreatePriceListPrice = z.object({
|
||||
currency_code: z.string(),
|
||||
amount: z.number(),
|
||||
variant_id: z.string(),
|
||||
min_quantity: z.number().optional(),
|
||||
max_quantity: z.number().optional(),
|
||||
min_quantity: z.number().nullish(),
|
||||
max_quantity: z.number().nullish(),
|
||||
rules: z.record(z.string(), z.string()).optional(),
|
||||
})
|
||||
|
||||
@@ -43,8 +43,8 @@ export const AdminUpdatePriceListPrice = z.object({
|
||||
currency_code: z.string().optional(),
|
||||
amount: z.number().optional(),
|
||||
variant_id: z.string(),
|
||||
min_quantity: z.number().optional(),
|
||||
max_quantity: z.number().optional(),
|
||||
min_quantity: z.number().nullish(),
|
||||
max_quantity: z.number().nullish(),
|
||||
rules: z.record(z.string(), z.string()).optional(),
|
||||
})
|
||||
|
||||
@@ -55,8 +55,8 @@ export type AdminUpdatePriceListPriceType = z.infer<
|
||||
export const AdminCreatePriceList = z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
starts_at: z.union([z.string(), z.null()]).optional(),
|
||||
ends_at: z.union([z.string(), z.null()]).optional(),
|
||||
starts_at: z.union([z.string(), z.null()]).nullish(),
|
||||
ends_at: z.union([z.string(), z.null()]).nullish(),
|
||||
status: z.nativeEnum(PriceListStatus).optional(),
|
||||
type: z.nativeEnum(PriceListType).optional(),
|
||||
rules: z.record(z.string(), z.array(z.string())).optional(),
|
||||
@@ -67,9 +67,9 @@ export type AdminCreatePriceListType = z.infer<typeof AdminCreatePriceList>
|
||||
|
||||
export const AdminUpdatePriceList = z.object({
|
||||
title: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
starts_at: z.string().optional().nullable(),
|
||||
ends_at: z.string().optional().nullable(),
|
||||
description: z.string().nullish(),
|
||||
starts_at: z.string().nullish(),
|
||||
ends_at: z.string().nullish(),
|
||||
status: z.nativeEnum(PriceListStatus).optional(),
|
||||
type: z.nativeEnum(PriceListType).optional(),
|
||||
rules: z.record(z.string(), z.array(z.string())).optional(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export type AdminGetPricingRuleTypeParamsType = z.infer<
|
||||
typeof AdminGetPricingRuleTypeParams
|
||||
|
||||
@@ -48,8 +48,8 @@ export const AdminCreateProductCategory = z
|
||||
handle: z.string().optional(),
|
||||
is_internal: z.boolean().optional(),
|
||||
is_active: z.boolean().optional(),
|
||||
parent_category_id: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
parent_category_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
rank: z.number().nonnegative().optional(),
|
||||
})
|
||||
.strict()
|
||||
@@ -65,8 +65,8 @@ export const AdminUpdateProductCategory = z
|
||||
handle: z.string().optional(),
|
||||
is_internal: z.boolean().optional(),
|
||||
is_active: z.boolean().optional(),
|
||||
parent_category_id: z.string().nullable().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
parent_category_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
rank: z.number().nonnegative().optional(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -33,7 +33,7 @@ export type AdminCreateProductTagType = z.infer<typeof AdminCreateProductTag>
|
||||
export const AdminCreateProductTag = z
|
||||
.object({
|
||||
value: z.string(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -41,6 +41,6 @@ export type AdminUpdateProductTagType = z.infer<typeof AdminUpdateProductTag>
|
||||
export const AdminUpdateProductTag = z
|
||||
.object({
|
||||
value: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -22,7 +22,7 @@ export const AdminGetProductTypesParams = createFindParams({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
value: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
// TODO: To be added in next iteration
|
||||
// discount_condition_id: z.string().optional(),
|
||||
// discount_condition_id: z.string().nullish(),
|
||||
created_at: createOperatorMap().optional(),
|
||||
updated_at: createOperatorMap().optional(),
|
||||
deleted_at: createOperatorMap().optional(),
|
||||
@@ -35,7 +35,7 @@ export type AdminCreateProductTypeType = z.infer<typeof AdminCreateProductType>
|
||||
export const AdminCreateProductType = z
|
||||
.object({
|
||||
value: z.string(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -43,6 +43,6 @@ export type AdminUpdateProductTypeType = z.infer<typeof AdminUpdateProductType>
|
||||
export const AdminUpdateProductType = z
|
||||
.object({
|
||||
value: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -71,7 +71,7 @@ export const AdminGetProductOptionsParams = createFindParams({
|
||||
|
||||
export type AdminCreateProductTagType = z.infer<typeof AdminCreateProductTag>
|
||||
export const AdminCreateProductTag = z.object({
|
||||
value: z.string().optional(),
|
||||
value: z.string(),
|
||||
})
|
||||
|
||||
export type AdminUpdateProductTagType = z.infer<typeof AdminUpdateProductTag>
|
||||
@@ -104,8 +104,8 @@ export type AdminCreateVariantPriceType = z.infer<
|
||||
export const AdminCreateVariantPrice = z.object({
|
||||
currency_code: z.string(),
|
||||
amount: z.number(),
|
||||
min_quantity: z.number().optional(),
|
||||
max_quantity: z.number().optional(),
|
||||
min_quantity: z.number().nullish(),
|
||||
max_quantity: z.number().nullish(),
|
||||
})
|
||||
|
||||
// TODO: Add support for rules
|
||||
@@ -116,8 +116,8 @@ export const AdminUpdateVariantPrice = z.object({
|
||||
id: z.string().optional(),
|
||||
currency_code: z.string().optional(),
|
||||
amount: z.number().optional(),
|
||||
min_quantity: z.number().optional(),
|
||||
max_quantity: z.number().optional(),
|
||||
min_quantity: z.number().nullish(),
|
||||
max_quantity: z.number().nullish(),
|
||||
})
|
||||
|
||||
export type AdminCreateProductTypeType = z.infer<typeof AdminCreateProductType>
|
||||
@@ -131,22 +131,22 @@ export type AdminCreateProductVariantType = z.infer<
|
||||
export const AdminCreateProductVariant = z
|
||||
.object({
|
||||
title: z.string(),
|
||||
sku: z.string().nullable().optional(),
|
||||
ean: z.string().nullable().optional(),
|
||||
upc: z.string().nullable().optional(),
|
||||
barcode: z.string().nullable().optional(),
|
||||
hs_code: z.string().nullable().optional(),
|
||||
mid_code: z.string().nullable().optional(),
|
||||
sku: z.string().nullish(),
|
||||
ean: z.string().nullish(),
|
||||
upc: z.string().nullish(),
|
||||
barcode: z.string().nullish(),
|
||||
hs_code: z.string().nullish(),
|
||||
mid_code: z.string().nullish(),
|
||||
allow_backorder: z.boolean().optional().default(false),
|
||||
manage_inventory: z.boolean().optional().default(true),
|
||||
variant_rank: z.number().optional(),
|
||||
weight: z.number().nullable().optional(),
|
||||
length: z.number().nullable().optional(),
|
||||
height: z.number().nullable().optional(),
|
||||
width: z.number().nullable().optional(),
|
||||
origin_country: z.string().nullable().optional(),
|
||||
material: z.string().nullable().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
weight: z.number().nullish(),
|
||||
length: z.number().nullish(),
|
||||
height: z.number().nullish(),
|
||||
width: z.number().nullish(),
|
||||
origin_country: z.string().nullish(),
|
||||
material: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
prices: z.array(AdminCreateVariantPrice),
|
||||
options: z.record(z.string()).optional(),
|
||||
inventory_items: z
|
||||
@@ -168,22 +168,22 @@ export const AdminUpdateProductVariant = z
|
||||
id: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
prices: z.array(AdminUpdateVariantPrice).optional(),
|
||||
sku: z.string().nullable().optional().nullable(),
|
||||
ean: z.string().nullable().optional().nullable(),
|
||||
upc: z.string().nullable().optional().nullable(),
|
||||
barcode: z.string().nullable().optional().nullable(),
|
||||
hs_code: z.string().nullable().optional().nullable(),
|
||||
mid_code: z.string().nullable().optional().nullable(),
|
||||
sku: z.string().nullish(),
|
||||
ean: z.string().nullish(),
|
||||
upc: z.string().nullish(),
|
||||
barcode: z.string().nullish(),
|
||||
hs_code: z.string().nullish(),
|
||||
mid_code: z.string().nullish(),
|
||||
allow_backorder: z.boolean().optional(),
|
||||
manage_inventory: z.boolean().optional(),
|
||||
variant_rank: z.number().optional(),
|
||||
weight: z.number().nullable().optional().nullable(),
|
||||
length: z.number().nullable().optional().nullable(),
|
||||
height: z.number().nullable().optional().nullable(),
|
||||
width: z.number().nullable().optional().nullable(),
|
||||
origin_country: z.string().nullable().optional().nullable(),
|
||||
material: z.string().nullable().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
weight: z.number().nullish(),
|
||||
length: z.number().nullish(),
|
||||
height: z.number().nullish(),
|
||||
width: z.number().nullish(),
|
||||
origin_country: z.string().nullish(),
|
||||
material: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
options: z.record(z.string()).optional(),
|
||||
})
|
||||
.strict()
|
||||
@@ -203,30 +203,30 @@ export type AdminCreateProductType = z.infer<typeof AdminCreateProduct>
|
||||
export const AdminCreateProduct = z
|
||||
.object({
|
||||
title: z.string(),
|
||||
subtitle: z.string().nullable().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
subtitle: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
is_giftcard: z.boolean().optional().default(false),
|
||||
discountable: z.boolean().optional().default(true),
|
||||
images: z.array(z.object({ url: z.string() })).optional(),
|
||||
thumbnail: z.string().optional(),
|
||||
thumbnail: z.string().nullish(),
|
||||
handle: z.string().optional(),
|
||||
status: statusEnum.optional().default(ProductStatus.DRAFT),
|
||||
type_id: z.string().optional(),
|
||||
collection_id: z.string().optional(),
|
||||
status: statusEnum.nullish().default(ProductStatus.DRAFT),
|
||||
type_id: z.string().nullish(),
|
||||
collection_id: z.string().nullish(),
|
||||
categories: z.array(AdminCreateProductProductCategory).optional(),
|
||||
tags: z.array(AdminUpdateProductTag).optional(),
|
||||
options: z.array(AdminCreateProductOption).optional(),
|
||||
variants: z.array(AdminCreateProductVariant).optional(),
|
||||
sales_channels: z.array(z.object({ id: z.string() })).optional(),
|
||||
weight: z.number().optional(),
|
||||
length: z.number().optional(),
|
||||
height: z.number().optional(),
|
||||
width: z.number().optional(),
|
||||
hs_code: z.string().optional(),
|
||||
mid_code: z.string().optional(),
|
||||
origin_country: z.string().optional(),
|
||||
material: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
weight: z.number().nullish(),
|
||||
length: z.number().nullish(),
|
||||
height: z.number().nullish(),
|
||||
width: z.number().nullish(),
|
||||
hs_code: z.string().nullish(),
|
||||
mid_code: z.string().nullish(),
|
||||
origin_country: z.string().nullish(),
|
||||
material: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -239,25 +239,25 @@ export const AdminUpdateProduct = z
|
||||
options: z.array(AdminUpdateProductOption).optional(),
|
||||
variants: z.array(AdminUpdateProductVariant).optional(),
|
||||
status: statusEnum.optional(),
|
||||
subtitle: z.string().optional().nullable(),
|
||||
description: z.string().optional().nullable(),
|
||||
subtitle: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
images: z.array(z.object({ url: z.string() })).optional(),
|
||||
thumbnail: z.string().optional().nullable(),
|
||||
handle: z.string().optional(),
|
||||
type_id: z.string().optional().nullable(),
|
||||
collection_id: z.string().optional().nullable(),
|
||||
thumbnail: z.string().nullish(),
|
||||
handle: z.string().nullish(),
|
||||
type_id: z.string().nullish(),
|
||||
collection_id: z.string().nullish(),
|
||||
categories: z.array(AdminCreateProductProductCategory).optional(),
|
||||
tags: z.array(AdminUpdateProductTag).nullable().optional(),
|
||||
tags: z.array(AdminUpdateProductTag).optional(),
|
||||
sales_channels: z.array(z.object({ id: z.string() })).optional(),
|
||||
weight: z.number().optional().nullable(),
|
||||
length: z.number().optional().nullable(),
|
||||
height: z.number().optional().nullable(),
|
||||
width: z.number().optional().nullable(),
|
||||
hs_code: z.string().optional().nullable(),
|
||||
mid_code: z.string().optional().nullable(),
|
||||
origin_country: z.string().optional().nullable(),
|
||||
material: z.string().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
weight: z.number().nullish(),
|
||||
length: z.number().nullish(),
|
||||
height: z.number().nullish(),
|
||||
width: z.number().nullish(),
|
||||
hs_code: z.string().nullish(),
|
||||
mid_code: z.string().nullish(),
|
||||
origin_country: z.string().nullish(),
|
||||
material: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ export type AdminCreatePromotionRuleType = z.infer<
|
||||
export const AdminCreatePromotionRule = z
|
||||
.object({
|
||||
operator: z.nativeEnum(PromotionRuleOperator),
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
attribute: z.string(),
|
||||
values: z.union([z.string(), z.array(z.string())]),
|
||||
})
|
||||
@@ -94,7 +94,7 @@ export const AdminUpdatePromotionRule = z
|
||||
.object({
|
||||
id: z.string(),
|
||||
operator: z.nativeEnum(PromotionRuleOperator).optional(),
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
attribute: z.string().optional(),
|
||||
values: z.union([z.string(), z.array(z.string())]),
|
||||
})
|
||||
@@ -105,17 +105,17 @@ export type AdminCreateApplicationMethodType = z.infer<
|
||||
>
|
||||
export const AdminCreateApplicationMethod = z
|
||||
.object({
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
value: z.number(),
|
||||
currency_code: z.string().optional().nullable(),
|
||||
max_quantity: z.number().optional().nullable(),
|
||||
currency_code: z.string().nullish(),
|
||||
max_quantity: z.number().nullish(),
|
||||
type: z.nativeEnum(ApplicationMethodType),
|
||||
target_type: z.nativeEnum(ApplicationMethodTargetType),
|
||||
allocation: z.nativeEnum(ApplicationMethodAllocation).optional(),
|
||||
target_rules: z.array(AdminCreatePromotionRule).optional(),
|
||||
buy_rules: z.array(AdminCreatePromotionRule).optional(),
|
||||
apply_to_quantity: z.number().optional(),
|
||||
buy_rules_min_quantity: z.number().optional(),
|
||||
apply_to_quantity: z.number().nullish(),
|
||||
buy_rules_min_quantity: z.number().nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -124,17 +124,17 @@ export type AdminUpdateApplicationMethodType = z.infer<
|
||||
>
|
||||
export const AdminUpdateApplicationMethod = z
|
||||
.object({
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
value: z.number().optional(),
|
||||
max_quantity: z.number().optional().nullable(),
|
||||
currency_code: z.string().optional().nullable(),
|
||||
max_quantity: z.number().nullish(),
|
||||
currency_code: z.string().nullish(),
|
||||
type: z.nativeEnum(ApplicationMethodType).optional(),
|
||||
target_type: z.nativeEnum(ApplicationMethodTargetType).optional(),
|
||||
allocation: z.nativeEnum(ApplicationMethodAllocation).optional(),
|
||||
target_rules: z.array(AdminCreatePromotionRule).optional(),
|
||||
buy_rules: z.array(AdminCreatePromotionRule).optional(),
|
||||
apply_to_quantity: z.number().optional(),
|
||||
buy_rules_min_quantity: z.number().optional(),
|
||||
apply_to_quantity: z.number().nullish(),
|
||||
buy_rules_min_quantity: z.number().nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -161,7 +161,7 @@ export const AdminCreatePromotion = z
|
||||
code: z.string(),
|
||||
is_automatic: z.boolean().optional(),
|
||||
type: z.nativeEnum(PromotionType),
|
||||
campaign_id: z.string().optional().nullable(),
|
||||
campaign_id: z.string().nullish(),
|
||||
campaign: AdminCreateCampaign.optional(),
|
||||
application_method: AdminCreateApplicationMethod,
|
||||
rules: z.array(AdminCreatePromotionRule).optional(),
|
||||
@@ -179,7 +179,7 @@ export const AdminUpdatePromotion = z
|
||||
code: z.string().optional(),
|
||||
is_automatic: z.boolean().optional(),
|
||||
type: z.nativeEnum(PromotionType).optional(),
|
||||
campaign_id: z.string().optional().nullable(),
|
||||
campaign_id: z.string().nullish(),
|
||||
campaign: AdminCreateCampaign.optional(),
|
||||
application_method: AdminUpdateApplicationMethod.optional(),
|
||||
rules: z.array(AdminCreatePromotionRule).optional(),
|
||||
|
||||
@@ -34,7 +34,7 @@ export const AdminCreateRegion = z
|
||||
countries: z.array(z.string()).optional(),
|
||||
automatic_taxes: z.boolean().optional(),
|
||||
payment_providers: z.array(z.string()).optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -46,6 +46,6 @@ export const AdminUpdateRegion = z
|
||||
countries: z.array(z.string()).optional(),
|
||||
automatic_taxes: z.boolean().optional(),
|
||||
payment_providers: z.array(z.string()).optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from "zod"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
|
||||
export type AdminGetReservationParamsType = z.infer<
|
||||
typeof AdminGetReservationParams
|
||||
@@ -33,12 +33,12 @@ export const AdminGetReservationsParams = createFindParams({
|
||||
export type AdminCreateReservationType = z.infer<typeof AdminCreateReservation>
|
||||
export const AdminCreateReservation = z
|
||||
.object({
|
||||
line_item_id: z.string().optional(),
|
||||
line_item_id: z.string().nullish(),
|
||||
location_id: z.string(),
|
||||
inventory_item_id: z.string(),
|
||||
quantity: z.number(),
|
||||
description: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
description: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -47,7 +47,7 @@ export const AdminUpdateReservation = z
|
||||
.object({
|
||||
location_id: z.string().optional(),
|
||||
quantity: z.number().optional(),
|
||||
description: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
description: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -52,9 +52,9 @@ export type AdminGetReturnReasonsParamsType = z.infer<
|
||||
export const AdminCreateReturnReason = z.object({
|
||||
value: z.string(),
|
||||
label: z.string(),
|
||||
descripton: z.string().optional(),
|
||||
parent_return_reason_id: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
descripton: z.string().nullish(),
|
||||
parent_return_reason_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
export type AdminCreateReturnReasonType = z.infer<
|
||||
typeof AdminCreateReturnReason
|
||||
@@ -63,8 +63,8 @@ export type AdminCreateReturnReasonType = z.infer<
|
||||
export const AdminUpdateReturnReason = z.object({
|
||||
value: z.string(),
|
||||
label: z.string(),
|
||||
descripton: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
descripton: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
export type AdminUpdateReturnReasonType = z.infer<
|
||||
typeof AdminUpdateReturnReason
|
||||
|
||||
@@ -45,18 +45,18 @@ const ReturnShippingSchema = z.object({
|
||||
const ItemSchema = z.object({
|
||||
id: z.string(),
|
||||
quantity: z.number().min(1),
|
||||
reason_id: z.string().optional(),
|
||||
note: z.string().optional(),
|
||||
reason_id: z.string().nullish(),
|
||||
note: z.string().nullish(),
|
||||
})
|
||||
|
||||
export const AdminPostReturnsReqSchema = z.object({
|
||||
order_id: z.string(),
|
||||
items: z.array(ItemSchema),
|
||||
return_shipping: ReturnShippingSchema,
|
||||
note: z.string().optional(),
|
||||
note: z.string().nullish(),
|
||||
receive_now: z.boolean().optional(),
|
||||
refund_amount: z.number().optional(),
|
||||
location_id: z.string().optional(),
|
||||
location_id: z.string().nullish(),
|
||||
})
|
||||
export type AdminPostReturnsReqSchemaType = z.infer<
|
||||
typeof AdminPostReturnsReqSchema
|
||||
|
||||
@@ -39,9 +39,9 @@ export type AdminCreateSalesChannelType = z.infer<
|
||||
>
|
||||
export const AdminCreateSalesChannel = z.object({
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullish(),
|
||||
is_disabled: z.boolean().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminUpdateSalesChannelType = z.infer<
|
||||
@@ -49,7 +49,7 @@ export type AdminUpdateSalesChannelType = z.infer<
|
||||
>
|
||||
export const AdminUpdateSalesChannel = z.object({
|
||||
name: z.string().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
description: z.string().nullish(),
|
||||
is_disabled: z.boolean().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@ export const AdminCreateShippingProfile = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
type: z.string(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -48,6 +48,6 @@ export const AdminUpdateShippingProfile = z
|
||||
.object({
|
||||
name: z.string().optional(),
|
||||
type: z.string().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -36,13 +36,13 @@ export type AdminUpsertStockLocationAddressType = z.infer<
|
||||
>
|
||||
export const AdminUpsertStockLocationAddress = z.object({
|
||||
address_1: z.string(),
|
||||
address_2: z.string().optional(),
|
||||
company: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
address_2: z.string().nullish(),
|
||||
company: z.string().nullish(),
|
||||
city: z.string().nullish(),
|
||||
country_code: z.string(),
|
||||
phone: z.string().optional(),
|
||||
postal_code: z.string().optional(),
|
||||
province: z.string().optional(),
|
||||
phone: z.string().nullish(),
|
||||
postal_code: z.string().nullish(),
|
||||
province: z.string().nullish(),
|
||||
})
|
||||
|
||||
export type AdminCreateStockLocationType = z.infer<
|
||||
@@ -51,8 +51,8 @@ export type AdminCreateStockLocationType = z.infer<
|
||||
export const AdminCreateStockLocation = z.object({
|
||||
name: z.preprocess((val: any) => val.trim(), z.string()),
|
||||
address: AdminUpsertStockLocationAddress.optional(),
|
||||
address_id: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
address_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminUpdateStockLocationType = z.infer<
|
||||
@@ -63,8 +63,8 @@ export const AdminUpdateStockLocation = z.object({
|
||||
.preprocess((val: any) => val.trim(), z.string().optional())
|
||||
.optional(),
|
||||
address: AdminUpsertStockLocationAddress.optional(),
|
||||
address_id: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
address_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminCreateStockLocationFulfillmentSetType = z.infer<
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export type AdminGetStoreParamsType = z.infer<typeof AdminGetStoreParams>
|
||||
export const AdminGetStoreParams = createSelectParams()
|
||||
@@ -20,11 +20,11 @@ export const AdminGetStoresParams = createFindParams({
|
||||
|
||||
export type AdminUpdateStoreType = z.infer<typeof AdminUpdateStore>
|
||||
export const AdminUpdateStore = z.object({
|
||||
name: z.string().optional(),
|
||||
name: z.string().nullish(),
|
||||
supported_currency_codes: z.array(z.string()).optional(),
|
||||
default_currency_code: z.string().optional(),
|
||||
default_sales_channel_id: z.string().optional(),
|
||||
default_region_id: z.string().optional(),
|
||||
default_location_id: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
default_currency_code: z.string().nullish(),
|
||||
default_sales_channel_id: z.string().nullish(),
|
||||
default_region_id: z.string().nullish(),
|
||||
default_location_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
@@ -42,7 +42,7 @@ export const AdminCreateTaxRate = z.object({
|
||||
is_default: z.boolean().optional(),
|
||||
is_combinable: z.boolean().optional(),
|
||||
tax_region_id: z.string(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type AdminUpdateTaxRateType = z.infer<typeof AdminUpdateTaxRate>
|
||||
@@ -53,5 +53,5 @@ export const AdminUpdateTaxRate = z.object({
|
||||
name: z.string().optional(),
|
||||
is_default: z.boolean().optional(),
|
||||
is_combinable: z.boolean().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
@@ -41,8 +41,8 @@ export const AdminGetTaxRegionsParams = createFindParams({
|
||||
export type AdminCreateTaxRegionType = z.infer<typeof AdminCreateTaxRegion>
|
||||
export const AdminCreateTaxRegion = z.object({
|
||||
country_code: z.string(),
|
||||
province_code: z.string().optional(),
|
||||
parent_id: z.string().optional(),
|
||||
province_code: z.string().nullish(),
|
||||
parent_id: z.string().nullish(),
|
||||
default_tax_rate: z
|
||||
.object({
|
||||
rate: z.number().optional(),
|
||||
@@ -51,8 +51,8 @@ export const AdminCreateTaxRegion = z.object({
|
||||
is_combinable: z
|
||||
.union([z.literal("true"), z.literal("false")])
|
||||
.optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from "zod"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
|
||||
export const AdminGetUserParams = createSelectParams()
|
||||
|
||||
@@ -18,23 +18,23 @@ export const AdminGetUsersParams = createFindParams({
|
||||
created_at: createOperatorMap().optional(),
|
||||
updated_at: createOperatorMap().optional(),
|
||||
deleted_at: createOperatorMap().optional(),
|
||||
email: z.string().optional(),
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
email: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
})
|
||||
)
|
||||
|
||||
export type AdminCreateUserType = z.infer<typeof AdminCreateUser>
|
||||
export const AdminCreateUser = z.object({
|
||||
email: z.string(),
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
avatar_url: z.string().optional(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
avatar_url: z.string().nullish(),
|
||||
})
|
||||
|
||||
export type AdminUpdateUserType = z.infer<typeof AdminUpdateUser>
|
||||
export const AdminUpdateUser = z.object({
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
avatar_url: z.string().optional(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
avatar_url: z.string().nullish(),
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TransactionHandlerType } from "@medusajs/utils"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export type AdminGetWorkflowExecutionDetailsParamsType = z.infer<
|
||||
typeof AdminGetWorkflowExecutionDetailsParams
|
||||
|
||||
@@ -8,20 +8,20 @@ export const StoreGetCartsCart = createSelectParams()
|
||||
const ItemSchema = z.object({
|
||||
variant_id: z.string(),
|
||||
quantity: z.number(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type StoreCreateCartType = z.infer<typeof StoreCreateCart>
|
||||
export const StoreCreateCart = z
|
||||
.object({
|
||||
region_id: z.string().optional().nullable(),
|
||||
region_id: z.string().nullish(),
|
||||
shipping_address: z.union([AddressPayload, z.string()]).optional(),
|
||||
billing_address: z.union([AddressPayload, z.string()]).optional(),
|
||||
email: z.string().email().optional().nullable(),
|
||||
currency_code: z.string().optional(),
|
||||
email: z.string().email().nullish(),
|
||||
currency_code: z.string().nullish(),
|
||||
items: z.array(ItemSchema).optional(),
|
||||
sales_channel_id: z.string().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
sales_channel_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -44,12 +44,12 @@ export const StoreRemoveCartPromotions = z
|
||||
export type StoreUpdateCartType = z.infer<typeof StoreUpdateCart>
|
||||
export const StoreUpdateCart = z
|
||||
.object({
|
||||
region_id: z.string().optional().nullable(),
|
||||
email: z.string().email().optional().nullable(),
|
||||
region_id: z.string().nullish(),
|
||||
email: z.string().email().nullish(),
|
||||
billing_address: z.union([AddressPayload, z.string()]).optional(),
|
||||
shipping_address: z.union([AddressPayload, z.string()]).optional(),
|
||||
sales_channel_id: z.string().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
sales_channel_id: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
promo_codes: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict()
|
||||
@@ -63,7 +63,7 @@ export type StoreAddCartLineItemType = z.infer<typeof StoreAddCartLineItem>
|
||||
export const StoreAddCartLineItem = z.object({
|
||||
variant_id: z.string(),
|
||||
quantity: z.number(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type StoreUpdateCartLineItemType = z.infer<
|
||||
@@ -71,7 +71,7 @@ export type StoreUpdateCartLineItemType = z.infer<
|
||||
>
|
||||
export const StoreUpdateCartLineItem = z.object({
|
||||
quantity: z.number(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
|
||||
export type StoreAddCartShippingMethodsType = z.infer<
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { z } from "zod"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
|
||||
export const StoreGetCollectionParams = createSelectParams()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export const StoreGetCurrencyParams = createSelectParams()
|
||||
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { AddressPayload } from "../../utils/common-validators"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export const StoreGetCustomerParams = createSelectParams()
|
||||
|
||||
export const StoreCreateCustomer = z.object({
|
||||
email: z.string().email().optional(),
|
||||
company_name: z.string().optional(),
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
email: z.string().email().nullish(),
|
||||
company_name: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
phone: z.string().nullish(),
|
||||
})
|
||||
|
||||
export const StoreUpdateCustomer = z.object({
|
||||
company_name: z.string().nullable().optional(),
|
||||
first_name: z.string().nullable().optional(),
|
||||
last_name: z.string().nullable().optional(),
|
||||
phone: z.string().nullable().optional(),
|
||||
company_name: z.string().nullish(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
phone: z.string().nullish(),
|
||||
})
|
||||
|
||||
export const StoreGetCustomerAddressParams = createSelectParams()
|
||||
|
||||
export const StoreCreateCustomerAddress = AddressPayload.merge(
|
||||
z.object({
|
||||
address_name: z.string().optional(),
|
||||
address_name: z.string().nullish(),
|
||||
is_default_shipping: z.boolean().optional(),
|
||||
is_default_billing: z.boolean().optional(),
|
||||
})
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { z } from "zod"
|
||||
import { OptionalBooleanValidator } from "../../utils/common-validators"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
import { OptionalBooleanValidator } from "../../utils/common-validators"
|
||||
|
||||
export type StoreProductCategoryParamsType = z.infer<
|
||||
typeof StoreProductCategoryParams
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
|
||||
export type StoreGetRegionParamsType = z.infer<typeof StoreGetRegionParams>
|
||||
export const StoreGetRegionParams = createSelectParams()
|
||||
|
||||
@@ -22,17 +22,17 @@ const ReturnShippingSchema = z.object({
|
||||
const ItemSchema = z.object({
|
||||
id: z.string(),
|
||||
quantity: z.number().min(1),
|
||||
reason_id: z.string().optional(),
|
||||
note: z.string().optional(),
|
||||
reason_id: z.string().nullish(),
|
||||
note: z.string().nullish(),
|
||||
})
|
||||
|
||||
export const StorePostReturnsReqSchema = z.object({
|
||||
order_id: z.string(),
|
||||
items: z.array(ItemSchema),
|
||||
return_shipping: ReturnShippingSchema,
|
||||
note: z.string().optional(),
|
||||
note: z.string().nullish(),
|
||||
receive_now: z.boolean().optional(),
|
||||
location_id: z.string().optional(),
|
||||
location_id: z.string().nullish(),
|
||||
})
|
||||
export type StorePostReturnsReqSchemaType = z.infer<
|
||||
typeof StorePostReturnsReqSchema
|
||||
|
||||
@@ -2,17 +2,17 @@ import { z } from "zod"
|
||||
|
||||
export const AddressPayload = z
|
||||
.object({
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
company: z.string().optional(),
|
||||
address_1: z.string().optional(),
|
||||
address_2: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
country_code: z.string().optional(),
|
||||
province: z.string().optional(),
|
||||
postal_code: z.string().optional(),
|
||||
metadata: z.record(z.string()).optional().nullable(),
|
||||
first_name: z.string().nullish(),
|
||||
last_name: z.string().nullish(),
|
||||
phone: z.string().nullish(),
|
||||
company: z.string().nullish(),
|
||||
address_1: z.string().nullish(),
|
||||
address_2: z.string().nullish(),
|
||||
city: z.string().nullish(),
|
||||
country_code: z.string().nullish(),
|
||||
province: z.string().nullish(),
|
||||
postal_code: z.string().nullish(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ export const ProductStatusEnum = z.nativeEnum(ProductStatus)
|
||||
export const GetProductsParams = z.object({
|
||||
q: z.string().optional(),
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
title: z.string().optional(),
|
||||
handle: z.string().optional(),
|
||||
title: z.string().nullish(),
|
||||
handle: z.string().nullish(),
|
||||
is_giftcard: OptionalBooleanValidator,
|
||||
category_id: z.string().array().optional(),
|
||||
sales_channel_id: z.string().array().optional(),
|
||||
collection_id: z.string().array().optional(),
|
||||
category_id: z.string().array().nullish(),
|
||||
sales_channel_id: z.string().array().nullish(),
|
||||
collection_id: z.string().array().nullish(),
|
||||
tags: z.string().array().optional(),
|
||||
type_id: z.string().array().optional(),
|
||||
created_at: createOperatorMap().optional(),
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface CreatePriceListDTO {
|
||||
export interface UpdatePriceListDTO {
|
||||
id: string
|
||||
title?: string
|
||||
description?: string | null
|
||||
starts_at?: string | null
|
||||
ends_at?: string | null
|
||||
status?: PriceListStatus
|
||||
|
||||
@@ -3,19 +3,19 @@ import { Promotion } from "@models"
|
||||
|
||||
export interface CreateCampaignDTO {
|
||||
name: string
|
||||
description?: string
|
||||
description?: string | null
|
||||
campaign_identifier: string
|
||||
starts_at?: Date
|
||||
ends_at?: Date
|
||||
starts_at?: Date | null
|
||||
ends_at?: Date | null
|
||||
promotions?: (PromotionDTO | Promotion)[]
|
||||
}
|
||||
|
||||
export interface UpdateCampaignDTO {
|
||||
id: string
|
||||
name?: string
|
||||
description?: string
|
||||
description?: string | null
|
||||
campaign_identifier?: string
|
||||
starts_at?: Date
|
||||
ends_at?: Date
|
||||
starts_at?: Date | null
|
||||
ends_at?: Date | null
|
||||
promotions?: (PromotionDTO | Promotion)[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user