feat: Add missing typings for the http layer and cleanup some (#7260)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { StoreRegion } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
@@ -23,7 +24,7 @@ export class Store {
|
||||
queryParams?: Record<string, any>,
|
||||
headers?: ClientHeaders
|
||||
) => {
|
||||
return this.client.fetch<any>(`/store/regions/${id}`, {
|
||||
return this.client.fetch<StoreRegion>(`/store/regions/${id}`, {
|
||||
query: queryParams,
|
||||
headers,
|
||||
})
|
||||
|
||||
@@ -233,48 +233,6 @@ export type RequestQueryFields = {
|
||||
order?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @interface
|
||||
*
|
||||
* Fields included in the response if it's paginated.
|
||||
*/
|
||||
export type PaginatedResponse<T = unknown> = {
|
||||
/**
|
||||
* The limit applied on the retrieved items.
|
||||
*/
|
||||
limit: number
|
||||
|
||||
/**
|
||||
* The number of items skipped before retrieving the list of items.
|
||||
*/
|
||||
offset: number
|
||||
|
||||
/**
|
||||
* The total count of items.
|
||||
*/
|
||||
count: number
|
||||
} & T
|
||||
|
||||
/**
|
||||
* The fields returned in the response of a DELETE request.
|
||||
*/
|
||||
export type DeleteResponse<T = string> = {
|
||||
/**
|
||||
* The ID of the item that was deleted.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The type of the item that was deleted.
|
||||
*/
|
||||
object: T
|
||||
|
||||
/**
|
||||
* Whether the item was deleted successfully.
|
||||
*/
|
||||
deleted: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that don't accept any query parameters can use this type.
|
||||
*/
|
||||
@@ -373,156 +331,6 @@ export interface NumericalComparisonOperator {
|
||||
lte?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Address fields used when creating/updating an address.
|
||||
*/
|
||||
export interface AddressPayload {
|
||||
/**
|
||||
* First name
|
||||
*/
|
||||
first_name?: string
|
||||
|
||||
/**
|
||||
* Last name
|
||||
*/
|
||||
last_name?: string
|
||||
|
||||
/**
|
||||
* Phone Number
|
||||
*/
|
||||
phone?: string
|
||||
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
|
||||
/**
|
||||
* Company
|
||||
*/
|
||||
company?: string
|
||||
|
||||
/**
|
||||
* Address line 1
|
||||
*/
|
||||
address_1?: string
|
||||
|
||||
/**
|
||||
* Address line 2
|
||||
*/
|
||||
address_2?: string
|
||||
|
||||
/**
|
||||
* City
|
||||
*/
|
||||
city?: string
|
||||
|
||||
/**
|
||||
* The 2 character ISO code of the country in lower case
|
||||
*/
|
||||
country_code?: string
|
||||
|
||||
/**
|
||||
* Province
|
||||
*/
|
||||
province?: string
|
||||
|
||||
/**
|
||||
* Postal Code
|
||||
*/
|
||||
postal_code?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Address fields used when creating an address.
|
||||
*/
|
||||
export interface AddressCreatePayload {
|
||||
/**
|
||||
* First name
|
||||
*/
|
||||
first_name: string
|
||||
|
||||
/**
|
||||
* Last name
|
||||
*/
|
||||
last_name: string
|
||||
|
||||
/**
|
||||
* Phone Number
|
||||
*/
|
||||
phone: string
|
||||
|
||||
/**
|
||||
* Holds custom data in key-value pairs.
|
||||
*/
|
||||
metadata: object
|
||||
|
||||
/**
|
||||
* Company
|
||||
*/
|
||||
company: string
|
||||
|
||||
/**
|
||||
* Address line 1
|
||||
*/
|
||||
address_1: string
|
||||
|
||||
/**
|
||||
* Address line 2
|
||||
*/
|
||||
address_2: string
|
||||
|
||||
/**
|
||||
* City
|
||||
*/
|
||||
city: string
|
||||
|
||||
/**
|
||||
* The 2 character ISO code of the country in lower case
|
||||
*/
|
||||
country_code: string
|
||||
|
||||
/**
|
||||
* Province
|
||||
*/
|
||||
province: string
|
||||
|
||||
/**
|
||||
* Postal Code
|
||||
*/
|
||||
postal_code: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters that can be used to configure how data is retrieved.
|
||||
*/
|
||||
export interface FindParams {
|
||||
/**
|
||||
* Comma-separated relations that should be expanded in the returned data.
|
||||
*/
|
||||
expand?: string
|
||||
|
||||
/**
|
||||
*Comma-separated fields that should be included in the returned data.
|
||||
*/
|
||||
fields?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters that can be used to configure how a list of data is paginated.
|
||||
*/
|
||||
export interface FindPaginationParams {
|
||||
/**
|
||||
* The number of items to skip when retrieving a list.
|
||||
*/
|
||||
offset?: number
|
||||
|
||||
/**
|
||||
* Limit the number of items returned in the list.
|
||||
*/
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { ApiKeyType } from "../../../api-key"
|
||||
import { PaginatedResponse } from "../../../common"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
interface ApiKeyResponse {
|
||||
id: string
|
||||
token: string
|
||||
@@ -17,16 +14,10 @@ interface ApiKeyResponse {
|
||||
revoked_at: Date | null
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminApiKeyResponse {
|
||||
api_key: ApiKeyResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminApiKeyListResponse extends PaginatedResponse {
|
||||
export type AdminApiKeyListResponse = PaginatedResponse<{
|
||||
api_keys: ApiKeyResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { CampaignBudgetTypeValues } from "../../../promotion"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface CampaignResponse {
|
||||
id: string
|
||||
name: string
|
||||
@@ -20,16 +17,10 @@ export interface CampaignResponse {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminCampaignListResponse extends PaginatedResponse {
|
||||
export type AdminCampaignListResponse = PaginatedResponse<{
|
||||
campaigns: CampaignResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminCampaignResponse {
|
||||
campaign: CampaignResponse
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { BaseProductCollection, BaseProductCollectionFilters } from "./common"
|
||||
|
||||
export interface AdminCollection extends BaseProductCollection {}
|
||||
export interface AdminCollectionFilters extends BaseProductCollectionFilters {}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { BaseFilterable, OperatorMap } from "../../dal"
|
||||
import { BaseProduct } from "../product/common"
|
||||
|
||||
export interface BaseProductCollection {
|
||||
id?: string
|
||||
title?: string
|
||||
handle?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
products?: BaseProduct[]
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface BaseProductCollectionFilters
|
||||
extends BaseFilterable<BaseProductCollectionFilters> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
handle?: string | string[]
|
||||
title?: string | string[]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./admin"
|
||||
export * from "./store"
|
||||
@@ -0,0 +1,4 @@
|
||||
import { BaseProductCollection, BaseProductCollectionFilters } from "./common"
|
||||
|
||||
export interface StoreCollection extends BaseProductCollection {}
|
||||
export interface StoreCollectionFilters extends BaseProductCollectionFilters {}
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* The fields returned in the response of a DELETE request.
|
||||
*/
|
||||
export type DeleteResponse<T = string> = {
|
||||
/**
|
||||
* The ID of the item that was deleted.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The type of the item that was deleted.
|
||||
*/
|
||||
object: string
|
||||
|
||||
/**
|
||||
* Whether the item was deleted successfully.
|
||||
*/
|
||||
deleted: boolean
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./paginated-response"
|
||||
export * from "./deleted-response"
|
||||
export * from "./request"
|
||||
export * from "./response"
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export interface PaginatedResponse {
|
||||
limit: number
|
||||
offset: number
|
||||
count: number
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export interface SelectParams {
|
||||
fields?: string[]
|
||||
}
|
||||
|
||||
export interface FindParams extends SelectParams {
|
||||
limit?: number
|
||||
offset?: number
|
||||
order?: string
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
export type DeleteResponse<TObject extends string, TParent = {}> = {
|
||||
/**
|
||||
* The ID of the item that was deleted.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The type of the item that was deleted.
|
||||
*/
|
||||
object: TObject
|
||||
|
||||
/**
|
||||
* Whether the item was deleted successfully.
|
||||
*/
|
||||
deleted: boolean
|
||||
|
||||
/**
|
||||
* The parent resource of the item that was deleted, if applicable.
|
||||
*/
|
||||
parent?: TParent
|
||||
}
|
||||
|
||||
export type PaginatedResponse<T> = {
|
||||
limit: number
|
||||
offset: number
|
||||
count: number
|
||||
} & T
|
||||
@@ -1,8 +1,5 @@
|
||||
import { PaginatedResponse } from "../../../common"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface CustomerGroupResponse {
|
||||
id: string
|
||||
name: string | null
|
||||
@@ -12,9 +9,6 @@ export interface CustomerGroupResponse {
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface CustomerAddressResponse {
|
||||
id: string
|
||||
address_name: string | null
|
||||
@@ -36,9 +30,6 @@ export interface CustomerAddressResponse {
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
interface CustomerResponse {
|
||||
id: string
|
||||
email: string
|
||||
@@ -58,30 +49,18 @@ interface CustomerResponse {
|
||||
updated_at?: Date | string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminCustomerResponse {
|
||||
customer: CustomerResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminCustomerListResponse extends PaginatedResponse {
|
||||
export type AdminCustomerListResponse = PaginatedResponse<{
|
||||
customers: CustomerResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminCustomerGroupResponse {
|
||||
customer_group: CustomerGroupResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminCustomerGroupListResponse extends PaginatedResponse {
|
||||
export type AdminCustomerGroupListResponse = PaginatedResponse<{
|
||||
customer_groups: CustomerGroupResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentAddressResponse {
|
||||
id: string
|
||||
fulfillment_id: string | null
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentItemResponse {
|
||||
id: string
|
||||
title: string
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentLabelResponse {
|
||||
id: string
|
||||
tracking_number: string
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentProviderResponse {
|
||||
id: string
|
||||
name: string
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { ServiceZoneResponse } from "./service-zone"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface FulfillmentSetResponse {
|
||||
id: string
|
||||
name: string
|
||||
@@ -14,9 +11,6 @@ export interface FulfillmentSetResponse {
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentSetResponse {
|
||||
fulfillment_set: FulfillmentSetResponse
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { DeleteResponse } from "../../../common"
|
||||
import { DeleteResponse } from "../../common"
|
||||
import { AdminFulfillmentAddressResponse } from "./fulfillment-address"
|
||||
import { AdminFulfillmentItemResponse } from "./fulfillment-item"
|
||||
import { AdminFulfillmentLabelResponse } from "./fulfillment-label"
|
||||
import { AdminFulfillmentProviderResponse } from "./fulfillment-provider"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentResponse {
|
||||
id: string
|
||||
location_id: string
|
||||
@@ -27,8 +24,5 @@ export interface AdminFulfillmentResponse {
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminFulfillmentSetsDeleteResponse
|
||||
extends DeleteResponse<"fulfillment_set"> {}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { GeoZoneType } from "../../../fulfillment"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminGeoZoneResponse {
|
||||
id: string
|
||||
type: GeoZoneType
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { FulfillmentSetResponse } from "./fulfillment-set"
|
||||
import { AdminGeoZoneResponse } from "./geo-zone"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminServiceZoneResponse {
|
||||
service_zone: ServiceZoneResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminServiceZoneDeleteResponse {
|
||||
id: string
|
||||
object: "service-zone"
|
||||
@@ -18,9 +12,6 @@ export interface AdminServiceZoneDeleteResponse {
|
||||
parent: FulfillmentSetResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface ServiceZoneResponse {
|
||||
id: string
|
||||
name: string
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminShippingOptionRuleResponse {
|
||||
id: string
|
||||
attribute: string
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminShippingOptionTypeResponse {
|
||||
id: string
|
||||
label: string
|
||||
|
||||
@@ -7,9 +7,6 @@ import { AdminFulfillmentProviderResponse } from "./fulfillment-provider"
|
||||
import { AdminPriceSetPriceResponse } from "../../pricing"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
interface AdminShippingOptionResponse {
|
||||
id: string
|
||||
name: string
|
||||
@@ -31,22 +28,13 @@ interface AdminShippingOptionResponse {
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminShippingOptionRetrieveResponse {
|
||||
shipping_option: AdminShippingOptionResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminShippingOptionListResponse extends PaginatedResponse {
|
||||
export type AdminShippingOptionListResponse = PaginatedResponse<{
|
||||
shipping_options: AdminShippingOptionResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminShippingOptionDeleteResponse
|
||||
extends DeleteResponse<"shipping_option"> {}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { DeleteResponse, PaginatedResponse } from "../../../common"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface ShippingProfileResponse {
|
||||
id: string
|
||||
name: string
|
||||
@@ -17,12 +14,9 @@ export interface AdminShippingProfileResponse {
|
||||
shipping_profile: ShippingProfileResponse
|
||||
}
|
||||
|
||||
export interface AdminShippingProfilesResponse extends PaginatedResponse {
|
||||
export type AdminShippingProfilesResponse = PaginatedResponse<{
|
||||
shipping_profiles: ShippingProfileResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminShippingProfileDeleteResponse
|
||||
extends DeleteResponse<"shipping_profile"> {}
|
||||
|
||||
@@ -12,3 +12,7 @@ export * from "./stock-locations"
|
||||
export * from "./tax"
|
||||
export * from "./product-category"
|
||||
export * from "./reservation"
|
||||
export * from "./region"
|
||||
export * from "./product"
|
||||
export * from "./collection"
|
||||
export * from "./common"
|
||||
|
||||
@@ -11,16 +11,11 @@ interface InventoryLevelResponse {
|
||||
incoming_quantity: number
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
|
||||
export interface AdminInventoryLevelResponse {
|
||||
inventory_item: AdminInventoryItemResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminInventoryLevelListResponse extends PaginatedResponse {
|
||||
export type AdminInventoryLevelListResponse = PaginatedResponse<{
|
||||
inventory_levels: InventoryLevelResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -17,16 +17,11 @@ interface InventoryItemResponse {
|
||||
thumbnail?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
|
||||
export interface AdminInventoryItemResponse {
|
||||
inventory_item: InventoryItemResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminInventoryItemListResponse extends PaginatedResponse {
|
||||
export type AdminInventoryItemListResponse = PaginatedResponse<{
|
||||
inventory_items: InventoryItemResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -233,9 +233,6 @@ interface OrderTransaction {
|
||||
updated_at: Date | string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface OrderResponse {
|
||||
id: string
|
||||
version: number
|
||||
@@ -299,16 +296,10 @@ export interface OrderResponse {
|
||||
raw_original_shipping_tax_total?: BigNumberRawValue
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminOrderListResponse extends PaginatedResponse {
|
||||
export type AdminOrderListResponse = PaginatedResponse<{
|
||||
orders: OrderResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminOrderResponse {
|
||||
order: OrderResponse
|
||||
}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { PaginatedResponse } from "../common"
|
||||
import { ProductCategoryResponse } from "./common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminProductCategoryResponse {
|
||||
product_category: ProductCategoryResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminProductCategoryListResponse extends PaginatedResponse {
|
||||
export type AdminProductCategoryListResponse = PaginatedResponse<{
|
||||
product_categories: ProductCategoryResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface ProductCategoryResponse {
|
||||
id: string
|
||||
name: string
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { PaginatedResponse } from "../common"
|
||||
import { ProductCategoryResponse } from "./common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface StoreProductCategoryResponse {
|
||||
product_category: ProductCategoryResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface StoreProductCategoryListResponse extends PaginatedResponse {
|
||||
export type StoreProductCategoryListResponse = PaginatedResponse<{
|
||||
product_categories: ProductCategoryResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import {
|
||||
BaseProduct,
|
||||
BaseProductCategory,
|
||||
BaseProductCategoryFilters,
|
||||
BaseProductFilters,
|
||||
BaseProductImage,
|
||||
BaseProductOption,
|
||||
BaseProductOptionFilters,
|
||||
BaseProductOptionValue,
|
||||
BaseProductTag,
|
||||
BaseProductTagFilters,
|
||||
BaseProductType,
|
||||
BaseProductTypeFilters,
|
||||
BaseProductVariant,
|
||||
BaseProductVariantFilters,
|
||||
} from "./common"
|
||||
|
||||
export interface AdminProduct extends Omit<BaseProduct, "categories"> {
|
||||
categories?: AdminProductCategory[]
|
||||
}
|
||||
|
||||
export interface AdminProductCategory extends BaseProductCategory {
|
||||
is_active?: boolean
|
||||
is_internal?: boolean
|
||||
}
|
||||
export interface AdminProductVariant extends BaseProductVariant {}
|
||||
export interface AdminProductTag extends BaseProductTag {}
|
||||
export interface AdminProductType extends BaseProductType {}
|
||||
export interface AdminProductOption extends BaseProductOption {}
|
||||
export interface AdminProductImage extends BaseProductImage {}
|
||||
export interface AdminProductOptionValue extends BaseProductOptionValue {}
|
||||
|
||||
export interface AdminProductFilters extends BaseProductFilters {}
|
||||
export interface AdminProductTagFilters extends BaseProductTagFilters {}
|
||||
export interface AdminProductTypeFilters extends BaseProductTypeFilters {}
|
||||
export interface AdminProductOptionFilters extends BaseProductOptionFilters {}
|
||||
export interface AdminProductVariantFilters extends BaseProductVariantFilters {}
|
||||
export interface AdminProductCategoryFilters
|
||||
extends BaseProductCategoryFilters {}
|
||||
@@ -0,0 +1,191 @@
|
||||
import { BaseFilterable, OperatorMap } from "../../dal"
|
||||
import { BaseProductCollection } from "../collection/common"
|
||||
|
||||
export type ProductStatus = "draft" | "proposed" | "published" | "rejected"
|
||||
|
||||
export interface BaseProduct {
|
||||
id?: string
|
||||
title?: string
|
||||
handle?: string
|
||||
subtitle?: string | null
|
||||
description?: string | null
|
||||
is_giftcard?: boolean
|
||||
status?: ProductStatus
|
||||
thumbnail?: string
|
||||
width?: number
|
||||
weight?: number
|
||||
length?: number
|
||||
height?: number
|
||||
origin_country?: string
|
||||
hs_code?: string
|
||||
mid_code?: string
|
||||
material?: string
|
||||
collection?: BaseProductCollection
|
||||
collection_id?: string | null
|
||||
categories?: BaseProductCategory[]
|
||||
type?: BaseProductType | null
|
||||
type_id?: string | null
|
||||
tags?: BaseProductTag[]
|
||||
variants?: BaseProductVariant[]
|
||||
options?: BaseProductOption[]
|
||||
images?: BaseProductImage[]
|
||||
discountable?: boolean
|
||||
external_id?: string | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface BaseProductVariant {
|
||||
id?: string
|
||||
title?: string
|
||||
sku?: string
|
||||
barcode?: string
|
||||
ean?: string
|
||||
upc?: string
|
||||
allow_backorder?: boolean
|
||||
manage_inventory?: boolean
|
||||
hs_code?: string
|
||||
origin_country?: string
|
||||
mid_code?: string
|
||||
material?: string
|
||||
weight?: number
|
||||
length?: number
|
||||
height?: number
|
||||
width?: number
|
||||
options?: BaseProductOptionValue[]
|
||||
product?: BaseProduct
|
||||
product_id?: string | null
|
||||
variant_rank?: number
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface BaseProductCategory {
|
||||
id?: string
|
||||
name?: string
|
||||
description?: string | null
|
||||
handle?: string
|
||||
rank?: number
|
||||
parent_category?: BaseProductCategory
|
||||
parent_category_id?: string
|
||||
category_children?: BaseProductCategory[]
|
||||
products?: BaseProduct[]
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface BaseProductTag {
|
||||
id?: string
|
||||
value?: string
|
||||
products?: BaseProduct[]
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface BaseProductType {
|
||||
id?: string
|
||||
value?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface BaseProductOption {
|
||||
id?: string
|
||||
title?: string
|
||||
product?: BaseProduct
|
||||
product_id?: string
|
||||
values?: BaseProductOptionValue[]
|
||||
metadata?: Record<string, unknown> | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
}
|
||||
|
||||
export interface BaseProductImage {
|
||||
id?: string
|
||||
url?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface BaseProductOptionValue {
|
||||
id?: string
|
||||
value?: string
|
||||
option?: BaseProductOption
|
||||
option_id?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
deleted_at?: string | null
|
||||
}
|
||||
|
||||
export interface BaseProductFilters extends BaseFilterable<BaseProductFilters> {
|
||||
q?: string
|
||||
status?: ProductStatus | ProductStatus[]
|
||||
title?: string | string[]
|
||||
handle?: string | string[]
|
||||
id?: string | string[]
|
||||
is_giftcard?: boolean
|
||||
tags?: {
|
||||
value?: string[]
|
||||
}
|
||||
type_id?: string | string[]
|
||||
category_id?: string | string[] | OperatorMap<string>
|
||||
categories?: { id: OperatorMap<string> } | { id: OperatorMap<string[]> }
|
||||
collection_id?: string | string[] | OperatorMap<string>
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
export interface BaseProductTagFilters
|
||||
extends BaseFilterable<BaseProductTagFilters> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
value?: string | string[]
|
||||
}
|
||||
|
||||
export interface BaseProductTypeFilters
|
||||
extends BaseFilterable<BaseProductTypeFilters> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
value?: string
|
||||
}
|
||||
|
||||
export interface BaseProductOptionFilters
|
||||
extends BaseFilterable<BaseProductOptionFilters> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
title?: string | string[]
|
||||
product_id?: string | string[]
|
||||
}
|
||||
|
||||
export interface BaseProductVariantFilters
|
||||
extends BaseFilterable<BaseProductVariantFilters> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
sku?: string | string[]
|
||||
product_id?: string | string[]
|
||||
options?: Record<string, string>
|
||||
}
|
||||
|
||||
export interface BaseProductCategoryFilters
|
||||
extends BaseFilterable<BaseProductCategoryFilters> {
|
||||
q?: string
|
||||
id?: string | string[]
|
||||
name?: string | string[]
|
||||
parent_category_id?: string | string[] | null
|
||||
handle?: string | string[]
|
||||
is_active?: boolean
|
||||
is_internal?: boolean
|
||||
include_descendants_tree?: boolean
|
||||
include_ancestors_tree?: boolean
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./admin"
|
||||
export * from "./store"
|
||||
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
BaseProduct,
|
||||
BaseProductCategory,
|
||||
BaseProductCategoryFilters,
|
||||
BaseProductFilters,
|
||||
BaseProductImage,
|
||||
BaseProductOption,
|
||||
BaseProductOptionFilters,
|
||||
BaseProductOptionValue,
|
||||
BaseProductTag,
|
||||
BaseProductTagFilters,
|
||||
BaseProductType,
|
||||
BaseProductTypeFilters,
|
||||
BaseProductVariant,
|
||||
BaseProductVariantFilters,
|
||||
} from "./common"
|
||||
|
||||
export interface StoreProduct extends BaseProduct {}
|
||||
export interface StoreProductCategory extends BaseProductCategory {}
|
||||
export interface StoreProductVariant extends BaseProductVariant {}
|
||||
export interface StoreProductTag extends BaseProductTag {}
|
||||
export interface StoreProductType extends BaseProductType {}
|
||||
export interface StoreProductOption extends BaseProductOption {}
|
||||
export interface StoreProductImage extends BaseProductImage {}
|
||||
export interface StoreProductOptionValue extends BaseProductOptionValue {}
|
||||
|
||||
export interface StoreProductFilters extends BaseProductFilters {}
|
||||
export interface StoreProductTagFilters extends BaseProductTagFilters {}
|
||||
export interface StoreProductTypeFilters extends BaseProductTypeFilters {}
|
||||
export interface StoreProductOptionFilters extends BaseProductOptionFilters {}
|
||||
export interface StoreProductVariantFilters extends BaseProductVariantFilters {}
|
||||
export interface StoreProductCategoryFilters
|
||||
extends BaseProductCategoryFilters {}
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface PromotionRuleResponse {
|
||||
id: string
|
||||
attribute: string
|
||||
@@ -13,9 +10,6 @@ export interface PromotionRuleResponse {
|
||||
required: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminPromotionRuleListResponse {
|
||||
attributes: PromotionRuleResponse[]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface RuleAttributeOptionsResponse {
|
||||
id: string
|
||||
value: string
|
||||
@@ -10,9 +7,6 @@ export interface RuleAttributeOptionsResponse {
|
||||
disguised: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminRuleAttributeOptionsListResponse {
|
||||
attributes: RuleAttributeOptionsResponse[]
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface RuleOperatorOptionsResponse {
|
||||
id: string
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminRuleOperatorOptionsListResponse {
|
||||
operators: RuleOperatorOptionsResponse[]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import {
|
||||
BaseRegion,
|
||||
BaseRegionCountry,
|
||||
BaseRegionCountryFilters,
|
||||
BaseRegionFilters,
|
||||
} from "./common"
|
||||
|
||||
export interface AdminRegion extends BaseRegion {}
|
||||
export interface AdminRegionCountry extends BaseRegionCountry {}
|
||||
export interface AdminRegionFilters extends BaseRegionFilters {}
|
||||
export interface AdminRegionCountryFilters extends BaseRegionCountryFilters {}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { BaseFilterable, OperatorMap } from "../../dal"
|
||||
|
||||
export interface BaseRegion {
|
||||
id?: string
|
||||
name?: string
|
||||
currency_code?: string
|
||||
automatic_taxes?: boolean
|
||||
countries?: BaseRegionCountry[]
|
||||
metadata?: Record<string, any> | null
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface BaseRegionCountry {
|
||||
id?: string
|
||||
iso_2?: string
|
||||
iso_3?: string
|
||||
num_code?: number
|
||||
name?: string
|
||||
display_name?: string
|
||||
}
|
||||
|
||||
export interface BaseRegionFilters extends BaseFilterable<BaseRegionFilters> {
|
||||
q?: string
|
||||
id?: string[] | string | OperatorMap<string | string[]>
|
||||
name?: string | OperatorMap<string>
|
||||
currency_code?: string | OperatorMap<string>
|
||||
metadata?: Record<string, unknown> | OperatorMap<Record<string, unknown>>
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
export interface BaseRegionCountryFilters
|
||||
extends BaseFilterable<BaseRegionCountryFilters> {
|
||||
id?: string[] | string
|
||||
iso_2?: string[] | string
|
||||
iso_3?: string[] | string
|
||||
num_code?: number[] | string
|
||||
name?: string[] | string
|
||||
display_name?: string[] | string
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./admin"
|
||||
export * from "./store"
|
||||
@@ -0,0 +1,11 @@
|
||||
import {
|
||||
BaseRegion,
|
||||
BaseRegionCountry,
|
||||
BaseRegionCountryFilters,
|
||||
BaseRegionFilters,
|
||||
} from "./common"
|
||||
|
||||
export interface StoreRegion extends BaseRegion {}
|
||||
export interface StoreRegionCountry extends BaseRegionCountry {}
|
||||
export interface StoreRegionFilters extends BaseRegionFilters {}
|
||||
export interface StoreRegionCountryFilters extends BaseRegionCountryFilters {}
|
||||
@@ -1,8 +1,5 @@
|
||||
import { PaginatedResponse } from "../../../common"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
interface ReservationResponse {
|
||||
id: string
|
||||
line_item_id: string | null
|
||||
@@ -19,16 +16,10 @@ interface ReservationResponse {
|
||||
updated_at?: Date | string
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminReservationResponse {
|
||||
reservation: ReservationResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminReservationListResponse extends PaginatedResponse {
|
||||
export type AdminReservationListResponse = PaginatedResponse<{
|
||||
reservations: ReservationResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
interface SalesChannelResponse {
|
||||
id: string
|
||||
name: string
|
||||
@@ -11,16 +8,10 @@ interface SalesChannelResponse {
|
||||
metadata: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminSalesChannelListResponse extends PaginatedResponse {
|
||||
export type AdminSalesChannelListResponse = PaginatedResponse<{
|
||||
sales_channels: SalesChannelResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminSalesChannelResponse {
|
||||
sales_channel: SalesChannelResponse
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { PaginatedResponse } from "../../../common"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { TaxRegionResponse } from "./tax-regions"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface TaxRateResponse {
|
||||
id: string
|
||||
rate: number | null
|
||||
@@ -24,16 +21,10 @@ export interface TaxRateResponse {
|
||||
}[]
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminTaxRateResponse {
|
||||
tax_rate: TaxRateResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminTaxRateListResponse extends PaginatedResponse {
|
||||
export type AdminTaxRateListResponse = PaginatedResponse<{
|
||||
tax_rates: TaxRateResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { PaginatedResponse } from "../../../common"
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { TaxRateResponse } from "./tax-rates"
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface TaxRegionResponse {
|
||||
id: string
|
||||
rate: number | null
|
||||
@@ -26,16 +23,10 @@ export interface TaxRegionResponse {
|
||||
parent: TaxRegionResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminTaxRegionResponse {
|
||||
tax_region: TaxRegionResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export interface AdminTaxRegionListResponse extends PaginatedResponse {
|
||||
export type AdminTaxRegionListResponse = PaginatedResponse<{
|
||||
tax_regions: TaxRegionResponse[]
|
||||
}
|
||||
}>
|
||||
|
||||
Reference in New Issue
Block a user