Clean up product typings (#7663)

There are a lot of issues in the admin after applying the correct typings, but fixing those should be done gradually, it's better to keep it out of this PR
This commit is contained in:
Stevche Radevski
2024-06-11 09:28:40 +00:00
committed by GitHub
parent f3bf8c73a3
commit 8e2a42b786
88 changed files with 1205 additions and 990 deletions
+217 -1
View File
@@ -8,12 +8,27 @@ export class Product {
this.client = client
}
async batch(
body: HttpTypes.AdminBatchProductRequest,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminBatchProductResponse>(
`/admin/products/batch`,
{
method: "POST",
headers,
body,
query,
}
)
}
async create(
body: HttpTypes.AdminCreateProduct,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<{ product: HttpTypes.AdminProduct }>(
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products`,
{
method: "POST",
@@ -23,4 +38,205 @@ export class Product {
}
)
}
async update(
id: string,
body: HttpTypes.AdminUpdateProduct,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products/${id}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async list(
queryParams?: HttpTypes.AdminProductParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductListResponse>(
`/admin/products`,
{
headers,
query: queryParams,
}
)
}
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products/${id}`,
{
query,
headers,
}
)
}
async delete(id: string, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminProductDeleteResponse>(
`/admin/products/${id}`,
{
method: "DELETE",
headers,
}
)
}
async batchVariants(
productId: string,
body: HttpTypes.AdminBatchProductVariantRequest,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminBatchProductVariantResponse>(
`/admin/products/${productId}/variants/batch`,
{
method: "POST",
headers,
body,
query,
}
)
}
async createVariant(
productId: string,
body: HttpTypes.AdminCreateProductVariant,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products/${productId}/variants`,
{
method: "POST",
headers,
body,
query,
}
)
}
async updateVariant(
productId: string,
id: string,
body: HttpTypes.AdminUpdateProductVariant,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products/${productId}/variants/${id}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async listVariants(
productId: string,
queryParams?: HttpTypes.AdminProductVariantParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductVariantListResponse>(
`/admin/products/${productId}/variants`,
{
headers,
query: queryParams,
}
)
}
async retrieveVariant(
productId: string,
id: string,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductVariantResponse>(
`/admin/products/${productId}/variants/${id}`,
{
query,
headers,
}
)
}
async deleteVariant(productId: string, id: string, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminProductVariantDeleteResponse>(
`/admin/products/${productId}/variants/${id}`,
{
method: "DELETE",
headers,
}
)
}
async createOption(
productId: string,
body: HttpTypes.AdminCreateProductOption,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products/${productId}/options`,
{
method: "POST",
headers,
body,
query,
}
)
}
async updateOption(
productId: string,
id: string,
body: HttpTypes.AdminUpdateProductOption,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductResponse>(
`/admin/products/${productId}/variants/${id}`,
{
method: "POST",
headers,
body,
query,
}
)
}
async listOptions(
productId: string,
queryParams?: HttpTypes.AdminProductOptionParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductOptionListResponse>(
`/admin/products/${productId}/options`,
{
headers,
query: queryParams,
}
)
}
async retrieveOption(
productId: string,
id: string,
query?: SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminProductOptionResponse>(
`/admin/products/${productId}/options/${id}`,
{
query,
headers,
}
)
}
async deleteOption(productId: string, id: string, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminProductOptionDeleteResponse>(
`/admin/products/${productId}/options/${id}`,
{
method: "DELETE",
headers,
}
)
}
}
+10 -9
View File
@@ -71,7 +71,7 @@ export class Store {
public category = {
list: async (
query?: FindParams & HttpTypes.StoreProductCategoryFilters,
query?: HttpTypes.StoreProductCategoryParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
@@ -99,22 +99,23 @@ export class Store {
public product = {
list: async (
query?: FindParams & HttpTypes.StoreProductFilters,
query?: HttpTypes.StoreProductParams,
headers?: ClientHeaders
) => {
return this.client.fetch<
PaginatedResponse<{ products: HttpTypes.StoreProduct[] }>
>(`/store/products`, {
query,
headers,
})
return this.client.fetch<HttpTypes.StoreProductListResponse>(
`/store/products`,
{
query,
headers,
}
)
},
retrieve: async (
id: string,
query?: SelectParams,
headers?: ClientHeaders
) => {
return this.client.fetch<{ product: HttpTypes.StoreProduct }>(
return this.client.fetch<HttpTypes.StoreProductResponse>(
`/store/products/${id}`,
{
query,
@@ -1,96 +0,0 @@
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 {}
export interface AdminCreateProductVariantPrice {
currency_code: string
amount: number
min_quantity?: number
max_quantity?: number
}
export interface AdminCreateProductVariant {
title: string
sku?: string
ean?: string
upc?: string
barcode?: string
hs_code?: string
mid_code?: string
allow_backorder?: boolean
manage_inventory?: boolean
variant_rank?: number
weight?: number
length?: number
height?: number
width?: number
origin_country?: string
material?: string
metadata?: Record<string, any>
prices: AdminCreateProductVariantPrice[]
options?: Record<string, any>
}
export interface AdminCreateProduct {
title: string
subtitle?: string
description?: string
is_giftcard?: boolean
discountable?: boolean
images?: { url: string }[]
thumbnail?: string
handle?: string
status?: string
type_id?: string | null
collection_id?: string | null
categories?: { id: string }[]
tags?: { id?: string; value?: string }[]
options?: { title?: string; values?: string[] }[]
variants?: AdminCreateProductVariant[]
sales_channels?: { id: string }[]
weight?: number
length?: number
height?: number
width?: number
hs_code?: string
mid_code?: string
origin_country?: string
material?: string
metadata?: Record<string, any>
}
@@ -0,0 +1,33 @@
import { AdminPrice } from "../../pricing"
import { AdminSalesChannel } from "../../sales-channel"
import {
BaseProduct,
BaseProductCategory,
BaseProductImage,
BaseProductOption,
BaseProductOptionValue,
BaseProductTag,
BaseProductType,
BaseProductVariant,
ProductStatus,
} from "../common"
export interface AdminProductCategory extends BaseProductCategory {
is_active?: boolean
is_internal?: boolean
}
export interface AdminProductVariant extends BaseProductVariant {
prices: AdminPrice[] | null
}
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 AdminProduct
extends Omit<BaseProduct, "categories" | "variants"> {
categories?: AdminProductCategory[] | null
sales_channels?: AdminSalesChannel[] | null
variants?: AdminProductVariant[] | null
}
export type AdminProductStatus = ProductStatus
@@ -0,0 +1,4 @@
export * from "./entitites"
export * from "./payloads"
export * from "./responses"
export * from "./queries"
@@ -0,0 +1,127 @@
import { BatchMethodRequest } from "../../../common"
import { ProductStatus } from "../common"
export interface AdminBatchProductRequest
extends BatchMethodRequest<AdminCreateProduct, AdminUpdateProduct> {}
export interface AdminBatchProductVariantRequest
extends BatchMethodRequest<
AdminCreateProductVariant,
AdminUpdateProductVariant
> {}
export interface AdminCreateProductVariantPrice {
currency_code: string
amount: number
min_quantity?: number | null
max_quantity?: number | null
}
export interface AdminCreateProductVariant {
title: string
sku?: string
ean?: string
upc?: string
barcode?: string
hs_code?: string
mid_code?: string
allow_backorder?: boolean
manage_inventory?: boolean
variant_rank?: number
weight?: number
length?: number
height?: number
width?: number
origin_country?: string
material?: string
metadata?: Record<string, unknown>
prices: AdminCreateProductVariantPrice[]
options?: Record<string, string>
}
export interface AdminCreateProduct {
title: string
subtitle?: string
description?: string
is_giftcard?: boolean
discountable?: boolean
images?: { url: string }[]
thumbnail?: string
handle?: string
status?: ProductStatus
type_id?: string
collection_id?: string
categories?: { id: string }[]
tags?: { id?: string; value?: string }[]
options?: AdminCreateProductOption[]
variants?: AdminCreateProductVariant[]
sales_channels?: { id: string }[]
weight?: number
length?: number
height?: number
width?: number
hs_code?: string
mid_code?: string
origin_country?: string
material?: string
metadata?: Record<string, unknown>
}
export interface AdminUpdateProductVariant {
title?: string
sku?: string | null
ean?: string | null
upc?: string | null
barcode?: string | null
hs_code?: string | null
mid_code?: string | null
allow_backorder?: boolean
manage_inventory?: boolean
variant_rank?: number
weight?: number | null
length?: number | null
height?: number | null
width?: number | null
origin_country?: string | null
material?: string | null
metadata?: Record<string, unknown> | null
prices?: AdminCreateProductVariantPrice[]
options?: Record<string, string>
}
export interface AdminUpdateProduct {
title?: string
subtitle?: string | null
description?: string | null
is_giftcard?: boolean
discountable?: boolean
images?: { url: string }[]
thumbnail?: string | null
handle?: string
status?: ProductStatus
type_id?: string | null
collection_id?: string | null
categories?: { id: string }[]
tags?: { id?: string; value?: string }[]
options?: AdminUpdateProductOption[]
variants?: AdminCreateProductVariant[]
sales_channels?: { id: string }[]
weight?: number | null
length?: number | null
height?: number | null
width?: number | null
hs_code?: string | null
mid_code?: string | null
origin_country?: string | null
material?: string | null
metadata?: Record<string, unknown> | null
}
export interface AdminCreateProductOption {
title: string
values: string[]
}
export interface AdminUpdateProductOption {
title?: string
values?: string[]
}
@@ -0,0 +1,18 @@
import {
BaseProductCategoryParams,
BaseProductOptionParams,
BaseProductParams,
BaseProductTagParams,
BaseProductTypeParams,
BaseProductVariantParams,
} from "../common"
export interface AdminProductTagParams extends BaseProductTagParams {}
export interface AdminProductTypeParams extends BaseProductTypeParams {}
export interface AdminProductOptionParams extends BaseProductOptionParams {}
export interface AdminProductVariantParams extends BaseProductVariantParams {}
export interface AdminProductParams extends BaseProductParams {
price_list_id?: string | string[]
variants?: AdminProductVariantParams
}
export interface AdminProductCategoryParams extends BaseProductCategoryParams {}
@@ -0,0 +1,45 @@
import { BatchMethodResponse } from "../../../common"
import { DeleteResponse, PaginatedResponse } from "../../common"
import {
AdminProduct,
AdminProductOption,
AdminProductVariant,
} from "./entitites"
export interface AdminProductResponse {
product: AdminProduct
}
export type AdminProductListResponse = PaginatedResponse<{
products: AdminProduct[]
}>
export interface AdminProductDeleteResponse extends DeleteResponse<"product"> {}
export interface AdminBatchProductResponse
extends BatchMethodResponse<AdminProduct> {}
export interface AdminProductVariantResponse {
variant: AdminProductVariant
}
export type AdminProductVariantListResponse = PaginatedResponse<{
variants: AdminProductVariant[]
}>
export interface AdminProductVariantDeleteResponse
extends DeleteResponse<"variant", AdminProduct> {}
export interface AdminBatchProductVariantResponse
extends BatchMethodResponse<AdminProductVariant> {}
export interface AdminProductOptionResponse {
product_option: AdminProductOption
}
export type AdminProductOptionListResponse = PaginatedResponse<{
product_options: AdminProductOption[]
}>
export interface AdminProductOptionDeleteResponse
extends DeleteResponse<"product_option", AdminProduct> {}
+94 -86
View File
@@ -1,94 +1,94 @@
import { BaseFilterable, OperatorMap } from "../../dal"
import { BaseCollection } from "../collection/common"
import { FindParams } from "../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?: BaseCollection
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
id: string
title: string
handle: string
subtitle: string | null
description: string | null
is_giftcard: boolean
status: ProductStatus
thumbnail: string | null
width: number | null
weight: number | null
length: number | null
height: number | null
origin_country: string | null
hs_code: string | null
mid_code: string | null
material: string | null
collection: BaseCollection | null
collection_id: string | null
categories?: BaseProductCategory[] | null
type: BaseProductType | null
type_id: string | null
tags: BaseProductTag[] | null
variants: BaseProductVariant[] | null
options: BaseProductOption[] | null
images: BaseProductImage[] | null
discountable: boolean
external_id: string | null
created_at: string | null
updated_at: string | null
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
id: string
title: string | null
sku: string | null
barcode: string | null
ean: string | null
upc: string | null
allow_backorder: boolean | null
manage_inventory: boolean | null
hs_code: string | null
origin_country: string | null
mid_code: string | null
material: string | null
weight: number | null
length: number | null
height: number | null
width: number | null
options: BaseProductOptionValue[] | null
product?: BaseProduct | null
product_id?: string
variant_rank?: number | null
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
id: string
name: string
description: string | null
handle: string
rank?: number
parent_category?: BaseProductCategory
parent_category_id?: string
parent_category?: BaseProductCategory | null
parent_category_id?: string | null
category_children?: BaseProductCategory[]
products?: BaseProduct[]
created_at?: string
updated_at?: string
metadata?: Record<string, unknown>
metadata?: Record<string, unknown> | null
}
export interface BaseProductTag {
id?: string
value?: string
id: string
value: string
products?: BaseProduct[]
metadata?: Record<string, unknown> | null
}
export interface BaseProductType {
id?: string
value?: string
id: string
value: string
created_at?: string
updated_at?: string
deleted_at?: string | null
@@ -96,10 +96,10 @@ export interface BaseProductType {
}
export interface BaseProductOption {
id?: string
title?: string
product?: BaseProduct
product_id?: string
id: string
title: string
product?: BaseProduct | null
product_id?: string | null
values?: BaseProductOptionValue[]
metadata?: Record<string, unknown> | null
created_at?: string
@@ -108,8 +108,8 @@ export interface BaseProductOption {
}
export interface BaseProductImage {
id?: string
url?: string
id: string
url: string
created_at?: string
updated_at?: string
deleted_at?: string | null
@@ -117,19 +117,22 @@ export interface BaseProductImage {
}
export interface BaseProductOptionValue {
id?: string
value?: string
option?: BaseProductOption
option_id?: string
id: string
value: string
option?: BaseProductOption | null
option_id?: string | null
metadata?: Record<string, unknown> | null
created_at?: string
updated_at?: string
deleted_at?: string | null
}
export interface BaseProductFilters extends BaseFilterable<BaseProductFilters> {
export interface BaseProductParams
extends FindParams,
BaseFilterable<BaseProductParams> {
q?: string
status?: ProductStatus | ProductStatus[]
sales_channel_id?: string | string[]
title?: string | string[]
handle?: string | string[]
id?: string | string[]
@@ -146,30 +149,34 @@ export interface BaseProductFilters extends BaseFilterable<BaseProductFilters> {
deleted_at?: OperatorMap<string>
}
export interface BaseProductTagFilters
extends BaseFilterable<BaseProductTagFilters> {
export interface BaseProductTagParams
extends FindParams,
BaseFilterable<BaseProductTagParams> {
q?: string
id?: string | string[]
value?: string | string[]
}
export interface BaseProductTypeFilters
extends BaseFilterable<BaseProductTypeFilters> {
export interface BaseProductTypeParams
extends FindParams,
BaseFilterable<BaseProductTypeParams> {
q?: string
id?: string | string[]
value?: string
}
export interface BaseProductOptionFilters
extends BaseFilterable<BaseProductOptionFilters> {
export interface BaseProductOptionParams
extends FindParams,
BaseFilterable<BaseProductOptionParams> {
q?: string
id?: string | string[]
title?: string | string[]
product_id?: string | string[]
}
export interface BaseProductVariantFilters
extends BaseFilterable<BaseProductVariantFilters> {
export interface BaseProductVariantParams
extends FindParams,
BaseFilterable<BaseProductVariantParams> {
q?: string
id?: string | string[]
sku?: string | string[]
@@ -177,8 +184,9 @@ export interface BaseProductVariantFilters
options?: Record<string, string>
}
export interface BaseProductCategoryFilters
extends BaseFilterable<BaseProductCategoryFilters> {
export interface BaseProductCategoryParams
extends FindParams,
BaseFilterable<BaseProductCategoryParams> {
q?: string
id?: string | string[]
name?: string | string[]
@@ -1,38 +0,0 @@
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 StoreProductTagFilters extends BaseProductTagFilters {}
export interface StoreProductTypeFilters extends BaseProductTypeFilters {}
export interface StoreProductOptionFilters extends BaseProductOptionFilters {}
export interface StoreProductVariantFilters extends BaseProductVariantFilters {}
export interface StoreProductFilters extends BaseProductFilters {
// The region ID and currency_code are not filters, but are used for the pricing context. Maybe move to separate type definition.
region_id?: string
currency_code?: string
variants?: StoreProductVariantFilters
}
export interface StoreProductCategoryFilters
extends BaseProductCategoryFilters {}
@@ -0,0 +1,21 @@
import {
BaseProduct,
BaseProductCategory,
BaseProductImage,
BaseProductOption,
BaseProductOptionValue,
BaseProductTag,
BaseProductType,
BaseProductVariant,
ProductStatus,
} 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 type StoreProductStatus = ProductStatus
@@ -0,0 +1,3 @@
export * from "./entitites"
export * from "./responses"
export * from "./queries"
@@ -0,0 +1,20 @@
import {
BaseProductCategoryParams,
BaseProductParams,
BaseProductOptionParams,
BaseProductTagParams,
BaseProductTypeParams,
BaseProductVariantParams,
} from "../common"
export interface StoreProductTagParams extends BaseProductTagParams {}
export interface StoreProductTypeParams extends BaseProductTypeParams {}
export interface StoreProductOptionParams extends BaseProductOptionParams {}
export interface StoreProductVariantParams extends BaseProductVariantParams {}
export interface StoreProductParams extends BaseProductParams {
// The region ID and currency_code are not params, but are used for the pricing context. Maybe move to separate type definition.
region_id?: string
currency_code?: string
variants?: StoreProductVariantParams
}
export interface StoreProductCategoryParams extends BaseProductCategoryParams {}
@@ -0,0 +1,10 @@
import { PaginatedResponse } from "../../common"
import { StoreProduct } from "../store"
export interface StoreProductResponse {
product: StoreProduct
}
export type StoreProductListResponse = PaginatedResponse<{
products: StoreProduct[]
}>
@@ -1,7 +1,9 @@
import { OperatorMap } from "../../../dal"
import { BaseFilterable, OperatorMap } from "../../../dal"
import { FindParams } from "../../common"
export interface AdminSalesChannelListParams extends FindParams {
export interface AdminSalesChannelListParams
extends FindParams,
BaseFilterable<AdminSalesChannelListParams> {
id?: string | string[]
q?: string
name?: string | string[]
@@ -12,6 +14,4 @@ export interface AdminSalesChannelListParams extends FindParams {
created_at?: OperatorMap<string>
updated_at?: OperatorMap<string>
deleted_at?: OperatorMap<string>
$and?: AdminSalesChannelListParams[]
$or?: AdminSalesChannelListParams[]
}
+61 -61
View File
@@ -23,15 +23,15 @@ export interface ProductDTO {
/**
* The handle of the product. The handle can be used to create slug URL paths.
*/
handle?: string | null
handle: string
/**
* The subttle of the product.
*/
subtitle?: string | null
subtitle: string | null
/**
* The description of the product.
*/
description?: string | null
description: string | null
/**
* Whether the product is a gift card.
*/
@@ -43,49 +43,49 @@ export interface ProductDTO {
/**
* The URL of the product's thumbnail.
*/
thumbnail?: string | null
thumbnail: string | null
/**
* The width of the product.
*/
width?: number | null
width: number | null
/**
* The weight of the product.
*/
weight?: number | null
weight: number | null
/**
* The length of the product.
*/
length?: number | null
length: number | null
/**
* The height of the product.
*/
height?: number | null
height: number | null
/**
* The origin country of the product.
*/
origin_country?: string | null
origin_country: string | null
/**
* The HS Code of the product.
*/
hs_code?: string | null
hs_code: string | null
/**
* The MID Code of the product.
*/
mid_code?: string | null
mid_code: string | null
/**
* The material of the product.
*/
material?: string | null
material: string | null
/**
* The associated product collection.
*
* @expandable
*/
collection?: ProductCollectionDTO | null
collection: ProductCollectionDTO | null
/**
* The associated product collection id.
*/
collection_id?: string | null
collection_id: string | null
/**
* The associated product categories.
*
@@ -97,11 +97,11 @@ export interface ProductDTO {
*
* @expandable
*/
type?: ProductTypeDTO | null
type: ProductTypeDTO | null
/**
* The associated product type id.
*/
type_id?: string | null
type_id: string | null
/**
* The associated product tags.
*
@@ -134,19 +134,19 @@ export interface ProductDTO {
* The ID of the product in an external system. This is useful if you're integrating the product with a third-party service and want to maintain
* a reference to the ID in the integrated service.
*/
external_id?: string | null
external_id: string | null
/**
* When the product was created.
*/
created_at?: string | Date
created_at: string | Date
/**
* When the product was updated.
*/
updated_at?: string | Date
updated_at: string | Date
/**
* When the product was deleted.
*/
deleted_at?: string | Date
deleted_at: string | Date
/**
* Holds custom data in key-value pairs.
*/
@@ -170,59 +170,59 @@ export interface ProductVariantDTO {
/**
* The SKU of the product variant.
*/
sku?: string | null
sku: string | null
/**
* The barcode of the product variant.
*/
barcode?: string | null
barcode: string | null
/**
* The EAN of the product variant.
*/
ean?: string | null
ean: string | null
/**
* The UPC of the product variant.
*/
upc?: string | null
upc: string | null
/**
* Whether the product variant can be ordered when it's out of stock.
*/
allow_backorder?: boolean
allow_backorder: boolean
/**
* Whether the product variant's inventory should be managed by the core system.
*/
manage_inventory?: boolean
manage_inventory: boolean
/**
* The HS Code of the product variant.
*/
hs_code?: string | null
hs_code: string | null
/**
* The origin country of the product variant.
*/
origin_country?: string | null
origin_country: string | null
/**
* The MID Code of the product variant.
*/
mid_code?: string | null
mid_code: string | null
/**
* The material of the product variant.
*/
material?: string | null
material: string | null
/**
* The weight of the product variant.
*/
weight?: number | null
weight: number | null
/**
* The length of the product variant.
*/
length?: number | null
length: number | null
/**
* The height of the product variant.
*/
height?: number | null
height: number | null
/**
* The width of the product variant.
*/
width?: number | null
width: number | null
/**
* The associated product options.
*
@@ -232,7 +232,7 @@ export interface ProductVariantDTO {
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown> | null
metadata: Record<string, unknown> | null
/**
* The associated product.
*
@@ -242,7 +242,7 @@ export interface ProductVariantDTO {
/**
* The associated product id.
*/
product_id?: string | null
product_id: string | null
/**
* he ranking of the variant among other variants associated with the product.
*/
@@ -1183,19 +1183,19 @@ export interface CreateProductVariantDTO {
/**
* The SKU of the product variant.
*/
sku?: string | null
sku?: string
/**
* The barcode of the product variant.
*/
barcode?: string | null
barcode?: string
/**
* The EAN of the product variant.
*/
ean?: string | null
ean?: string
/**
* The UPC of the product variant.
*/
upc?: string | null
upc?: string
/**
* Whether the product variant can be ordered when it's out of stock.
*/
@@ -1207,35 +1207,35 @@ export interface CreateProductVariantDTO {
/**
* The HS Code of the product variant.
*/
hs_code?: string | null
hs_code?: string
/**
* The origin country of the product variant.
*/
origin_country?: string | null
origin_country?: string
/**
* The MID Code of the product variant.
*/
mid_code?: string | null
mid_code?: string
/**
* The material of the product variant.
*/
material?: string | null
material?: string
/**
* The weight of the product variant.
*/
weight?: number | null
weight?: number
/**
* The length of the product variant.
*/
length?: number | null
length?: number
/**
* The height of the product variant.
*/
height?: number | null
height?: number
/**
* The width of the product variant.
*/
width?: number | null
width?: number
/**
* The options of the variant. Each key is an option's title, and value
* is an option's value. If an option with the specified title doesn't exist,
@@ -1340,7 +1340,7 @@ export interface UpdateProductVariantDTO {
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown>
metadata?: Record<string, unknown> | null
}
/**
@@ -1472,11 +1472,11 @@ export interface UpdateProductDTO {
/**
* The subttle of the product.
*/
subtitle?: string
subtitle?: string | null
/**
* The description of the product.
*/
description?: string
description?: string | null
/**
* Whether the product is a gift card.
*/
@@ -1488,7 +1488,7 @@ export interface UpdateProductDTO {
/**
* The URL of the product's thumbnail.
*/
thumbnail?: string
thumbnail?: string | null
/**
* The handle of the product. The handle can be used to create slug URL paths.
* If not supplied, the value of the `handle` attribute of the product is set to the slug version of the `title` attribute.
@@ -1530,37 +1530,37 @@ export interface UpdateProductDTO {
/**
* The width of the product.
*/
width?: number
width?: number | null
/**
* The height of the product.
*/
height?: number
height?: number | null
/**
* The length of the product.
*/
length?: number
length?: number | null
/**
* The weight of the product.
*/
weight?: number
weight?: number | null
/**
* The origin country of the product.
*/
origin_country?: string
origin_country?: string | null
/**
* The HS Code of the product.
*/
hs_code?: string
hs_code?: string | null
/**
* The material of the product.
*/
material?: string
material?: string | null
/**
* The MID Code of the product.
*/
mid_code?: string
mid_code?: string | null
/**
* Holds custom data in key-value pairs.
*/
metadata?: Record<string, unknown>
metadata?: Record<string, unknown> | null
}
@@ -6,9 +6,9 @@ export type CreateProductVariantWorkflowInputDTO =
}
export type UpdateProductVariantWorkflowInputDTO =
(ProductTypes.UpsertProductVariantDTO & {
ProductTypes.UpsertProductVariantDTO & {
prices?: PricingTypes.CreateMoneyAmountDTO[]
})[]
}
export type CreateProductWorkflowInputDTO = Omit<
ProductTypes.CreateProductDTO,