feat(types,js-sdk,medusa,fulfillment): Types and SDK methods related to Stock Locations (#7625)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { IFulfillmentModuleService } from "@medusajs/types"
|
||||
import {
|
||||
adminHeaders,
|
||||
createAdminUser,
|
||||
} from "../../../../helpers/create-admin-user"
|
||||
import { IFulfillmentModuleService } from "@medusajs/types"
|
||||
|
||||
const { medusaIntegrationTestRunner } = require("medusa-test-utils")
|
||||
|
||||
@@ -211,7 +211,7 @@ medusaIntegrationTestRunner({
|
||||
expect(deleteResponse.data).toEqual(
|
||||
expect.objectContaining({
|
||||
id: serviceZoneId,
|
||||
object: "service-zone",
|
||||
object: "service_zone",
|
||||
deleted: true,
|
||||
parent: expect.objectContaining({
|
||||
id: fulfillmentSetId,
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export const detailsFields =
|
||||
"name,*sales_channels,*address,fulfillment_sets.type,fulfillment_sets.name,*fulfillment_sets.service_zones.geo_zones,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options,*fulfillment_sets.service_zones.shipping_options.rules,*fulfillment_sets.service_zones.shipping_options.shipping_profile"
|
||||
"name,*sales_channels,*address,fulfillment_sets.type,fulfillment_sets.name,*fulfillment_sets.service_zones.geo_zones,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options,*fulfillment_sets.service_zones.shipping_options.rules,*fulfillment_sets.service_zones.shipping_options.shipping_profile,*fulfillment_sets.service_zones.shipping_options.prices"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class FulfillmentProvider {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminFulfillmentProviderListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentProviderListResponse>(
|
||||
`/admin/fulfillment-providers`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class FulfillmentSet {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentSetDeleteResponse>(
|
||||
`/admin/fulfillment-sets/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async createServiceZone(
|
||||
id: string,
|
||||
body: HttpTypes.AdminCreateFulfillmentSetServiceZone,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
|
||||
`/admin/fulfillment-sets/${id}/service-zones`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async retrieveServiceZones(
|
||||
fulfillmentSetId: string,
|
||||
serviceZoneId: string,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminServiceZoneResponse>(
|
||||
`/admin/fulfillment-sets/${fulfillmentSetId}/service-zones/${serviceZoneId}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async updateServiceZone(
|
||||
fulfillmentSetId: string,
|
||||
serviceZoneId: string,
|
||||
body: HttpTypes.AdminUpdateFulfillmentSetServiceZone,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
|
||||
`/admin/fulfillment-sets/${fulfillmentSetId}/service-zones/${serviceZoneId}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async deleteServiceZone(
|
||||
fulfillmentSetId: string,
|
||||
serviceZoneId: string,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminServiceZoneDeleteResponse>(
|
||||
`/admin/fulfillment-sets/${fulfillmentSetId}/service-zones/${serviceZoneId}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class Fulfillment {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateFulfillment,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
|
||||
`/admin/fulfillments`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async cancel(
|
||||
id: string,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
|
||||
`/admin/fulfillments/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
body: {},
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async createShipment(
|
||||
id: string,
|
||||
body: HttpTypes.AdminCreateFulfillmentShipment,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminFulfillmentResponse>(
|
||||
`/admin/fulfillments/${id}/shipments`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
import { Client } from "../client"
|
||||
import { Customer } from "./customer"
|
||||
import { Fulfillment } from "./fulfillment"
|
||||
import { FulfillmentSet } from "./fulfillment-set"
|
||||
import { Invite } from "./invite"
|
||||
import { Order } from "./order"
|
||||
import { Product } from "./product"
|
||||
import { ProductCollection } from "./product-collection"
|
||||
import { Region } from "./region"
|
||||
import { SalesChannel } from "./sales-channel"
|
||||
import { ShippingOption } from "./shipping-option"
|
||||
import { ShippingProfile } from "./shipping-profile"
|
||||
import { StockLocation } from "./stock-location"
|
||||
import { Upload } from "./upload"
|
||||
import { Order } from "./order"
|
||||
|
||||
export class Admin {
|
||||
public invite: Invite
|
||||
@@ -14,6 +20,12 @@ export class Admin {
|
||||
public product: Product
|
||||
public upload: Upload
|
||||
public region: Region
|
||||
public stockLocation: StockLocation
|
||||
public salesChannel: SalesChannel
|
||||
public fulfillmentSet: FulfillmentSet
|
||||
public fulfillment: Fulfillment
|
||||
public shippingOption: ShippingOption
|
||||
public shippingProfile: ShippingProfile
|
||||
public order: Order
|
||||
|
||||
constructor(client: Client) {
|
||||
@@ -23,6 +35,12 @@ export class Admin {
|
||||
this.product = new Product(client)
|
||||
this.upload = new Upload(client)
|
||||
this.region = new Region(client)
|
||||
this.stockLocation = new StockLocation(client)
|
||||
this.salesChannel = new SalesChannel(client)
|
||||
this.fulfillmentSet = new FulfillmentSet(client)
|
||||
this.fulfillment = new Fulfillment(client)
|
||||
this.shippingOption = new ShippingOption(client)
|
||||
this.shippingProfile = new ShippingProfile(client)
|
||||
this.order = new Order(client)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class SalesChannel {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateSalesChannel,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminSalesChannelResponse>(
|
||||
`/admin/sales-channels`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateSalesChannel,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminSalesChannelResponse>(
|
||||
`/admin/sales-channels/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return await this.client.fetch<HttpTypes.AdminSalesChannelDeleteResponse>(
|
||||
`/admin/sales-channels/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async retrieve(
|
||||
id: string,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminSalesChannelResponse>(
|
||||
`/admin/sales-channels/${id}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminSalesChannelListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminSalesChannelListResponse>(
|
||||
`/admin/sales-channels`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async updateProducts(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateSalesChannelProducts,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminSalesChannelResponse>(
|
||||
`/admin/sales-channels/${id}/products`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class ShippingOption {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateShippingOption,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingOptionResponse>(
|
||||
`/admin/shipping-options`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateShippingOption,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingOptionResponse>(
|
||||
`/admin/shipping-options/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingOptionDeleteResponse>(
|
||||
`/admin/shipping-options/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminShippingOptionListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingOptionListResponse>(
|
||||
`/admin/shipping-options`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async updateRules(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateShippingOptionRules,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminUpdateShippingOptionRulesResponse>(
|
||||
`/admin/shipping-options/${id}/rules/batch`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class ShippingProfile {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateShippingProfile,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingProfileResponse>(
|
||||
`/admin/shipping-profiles`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateShippingProfile,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingProfileResponse>(
|
||||
`/admin/shipping-profiles/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingProfileDeleteResponse>(
|
||||
`/admin/shipping-profiles/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminShippingProfileListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingProfileListResponse>(
|
||||
`/admin/shipping-profiles`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async retrieve(
|
||||
id: string,
|
||||
query?: HttpTypes.SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminShippingProfileResponse>(
|
||||
`/admin/shipping-profiles/${id}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { HttpTypes, SelectParams } from "@medusajs/types"
|
||||
import { Client } from "../client"
|
||||
import { ClientHeaders } from "../types"
|
||||
|
||||
export class StockLocation {
|
||||
private client: Client
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
async create(
|
||||
body: HttpTypes.AdminCreateStockLocation,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationResponse>(
|
||||
`/admin/stock-locations`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateStockLocation,
|
||||
query?: SelectParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationResponse>(
|
||||
`/admin/stock-locations/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async delete(id: string, headers?: ClientHeaders) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationDeleteResponse>(
|
||||
`/admin/stock-locations/${id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationResponse>(
|
||||
`/admin/stock-locations/${id}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async list(
|
||||
query?: HttpTypes.AdminStockLocationListParams,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationListResponse>(
|
||||
`/admin/stock-locations`,
|
||||
{
|
||||
method: "GET",
|
||||
headers,
|
||||
query,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async updateSalesChannels(
|
||||
id: string,
|
||||
body: HttpTypes.AdminUpdateStockLocationSalesChannels,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationResponse>(
|
||||
`/admin/stock-locations/${id}/sales-channels`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async createFulfillmentSet(
|
||||
id: string,
|
||||
body: HttpTypes.AdminCreateStockLocationFulfillmentSet,
|
||||
headers?: ClientHeaders
|
||||
) {
|
||||
return await this.client.fetch<HttpTypes.AdminStockLocationResponse>(
|
||||
`/admin/stock-locations/${id}/fulfillment-sets`,
|
||||
{
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export interface AdminFulfillmentProvider {
|
||||
id: string
|
||||
name: string
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./entities"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,7 @@
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface AdminFulfillmentProviderListParams extends FindParams {
|
||||
id?: string | string[]
|
||||
q?: string
|
||||
is_enabled?: boolean
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
import { AdminFulfillmentProvider } from "./entities"
|
||||
|
||||
export interface AdminFulfillmentProviderListResponse
|
||||
extends PaginatedResponse<{
|
||||
fulfillment_providers: AdminFulfillmentProvider[]
|
||||
}> {}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./admin"
|
||||
@@ -0,0 +1,33 @@
|
||||
import { GeoZoneType } from "../../../fulfillment"
|
||||
|
||||
export interface AdminGeoZone {
|
||||
id: string
|
||||
type: GeoZoneType
|
||||
country_code: string
|
||||
province_code: string | null
|
||||
city: string | null
|
||||
postal_expression: Record<string, unknown> | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminServiceZone {
|
||||
id: string
|
||||
fulfillment_set_id: string
|
||||
geo_zones: AdminGeoZone[]
|
||||
shipping_options: any[]
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminFulfillmentSet {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
service_zones: AdminServiceZone[]
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./entities"
|
||||
export * from "./payloads"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,79 @@
|
||||
interface AdminUpsertGeoZone {
|
||||
type: string
|
||||
country_code: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
interface AdminUpsertFulfillmentSetServiceZoneCountry
|
||||
extends AdminUpsertGeoZone {
|
||||
type: "country"
|
||||
}
|
||||
|
||||
interface AdminUpsertFulfillmentSetServiceZoneProvince
|
||||
extends AdminUpsertGeoZone {
|
||||
type: "province"
|
||||
province_code: string
|
||||
}
|
||||
|
||||
interface AdminUpsertFulfillmentSetServiceZoneCity extends AdminUpsertGeoZone {
|
||||
type: "city"
|
||||
province_code: string
|
||||
city: string
|
||||
}
|
||||
|
||||
interface AdminUpsertFulfillmentSetServiceZoneZip extends AdminUpsertGeoZone {
|
||||
type: "zip"
|
||||
province_code: string
|
||||
city: string
|
||||
postal_expression: Record<string, unknown>
|
||||
}
|
||||
|
||||
type AdminUpsertFulfillmentSetServiceZoneGeoZone =
|
||||
| AdminUpsertFulfillmentSetServiceZoneCountry
|
||||
| AdminUpsertFulfillmentSetServiceZoneProvince
|
||||
| AdminUpsertFulfillmentSetServiceZoneCity
|
||||
| AdminUpsertFulfillmentSetServiceZoneZip
|
||||
|
||||
export interface AdminCreateFulfillmentSetServiceZone {
|
||||
name: string
|
||||
geo_zones: AdminUpsertFulfillmentSetServiceZoneGeoZone[]
|
||||
}
|
||||
|
||||
interface AdminUpdateGeoZone extends AdminUpsertGeoZone {
|
||||
id?: string
|
||||
}
|
||||
|
||||
interface AdminUpdateFulfillmentSetServiceZoneCountry
|
||||
extends AdminUpdateGeoZone {
|
||||
type: "country"
|
||||
}
|
||||
|
||||
interface AdminUpdateFulfillmentSetServiceZoneProvince
|
||||
extends AdminUpdateGeoZone {
|
||||
type: "province"
|
||||
province_code: string
|
||||
}
|
||||
|
||||
interface AdminUpdateFulfillmentSetServiceZoneCity extends AdminUpdateGeoZone {
|
||||
type: "city"
|
||||
province_code: string
|
||||
city: string
|
||||
}
|
||||
|
||||
interface AdminUpdateFulfillmentSetServiceZoneZip extends AdminUpdateGeoZone {
|
||||
type: "zip"
|
||||
province_code: string
|
||||
city: string
|
||||
postal_expression: Record<string, unknown>
|
||||
}
|
||||
|
||||
type AdminUpdateFulfillmentSetServiceZoneGeoZone =
|
||||
| AdminUpdateFulfillmentSetServiceZoneCountry
|
||||
| AdminUpdateFulfillmentSetServiceZoneProvince
|
||||
| AdminUpdateFulfillmentSetServiceZoneCity
|
||||
| AdminUpdateFulfillmentSetServiceZoneZip
|
||||
|
||||
export interface AdminUpdateFulfillmentSetServiceZone {
|
||||
name?: string
|
||||
geo_zones?: AdminUpdateFulfillmentSetServiceZoneGeoZone[]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { OperatorMap } from "../../../dal"
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface AdminFulfillmentSetListParams extends FindParams {
|
||||
id?: string | string[]
|
||||
name?: string | string[]
|
||||
type?: string | string[]
|
||||
service_zone_id?: string | string[]
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { DeleteResponse } from "../../common"
|
||||
import { AdminFulfillmentSet, AdminServiceZone } from "./entities"
|
||||
|
||||
export interface AdminServiceZoneResponse {
|
||||
service_zone: AdminServiceZone
|
||||
}
|
||||
|
||||
export interface AdminServiceZoneDeleteResponse
|
||||
extends DeleteResponse<"service_zone", AdminFulfillmentSet> {}
|
||||
|
||||
export interface AdminFulfillmentSetResponse {
|
||||
fulfillment_set: AdminFulfillmentSet
|
||||
}
|
||||
|
||||
export interface AdminFulfillmentSetDeleteResponse
|
||||
extends DeleteResponse<"fulfillment_set"> {}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./admin"
|
||||
@@ -0,0 +1,65 @@
|
||||
import { AdminFulfillmentProvider } from "../../fulfillment-provider"
|
||||
|
||||
export interface AdminFulfillmentItem {
|
||||
id: string
|
||||
title: string
|
||||
quantity: number
|
||||
sku: string
|
||||
barcode: string
|
||||
line_item_id: string | null
|
||||
inventory_item_id: string | null
|
||||
fulfillment_id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminFulfillmentLabel {
|
||||
id: string
|
||||
tracking_number: string
|
||||
tracking_url: string
|
||||
label_url: string
|
||||
fulfillment_id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminFulfillmentAddress {
|
||||
id: string
|
||||
fulfillment_id: string | null
|
||||
company: string | null
|
||||
first_name: string | null
|
||||
last_name: string | null
|
||||
address_1: string | null
|
||||
address_2: string | null
|
||||
city: string | null
|
||||
country_code: string | null
|
||||
province: string | null
|
||||
postal_code: string | null
|
||||
phone: string | null
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminFulfillment {
|
||||
id: string
|
||||
location_id: string
|
||||
provider_id: string
|
||||
shipping_option_id: string | null
|
||||
provider: AdminFulfillmentProvider
|
||||
delivery_address: AdminFulfillmentAddress
|
||||
items: AdminFulfillmentItem[]
|
||||
labels: AdminFulfillmentLabel[]
|
||||
packed_at: string | null
|
||||
shipped_at: string | null
|
||||
delivered_at: string | null
|
||||
canceled_at: string | null
|
||||
data: Record<string, unknown> | null
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
export interface AdminFulfillmentAddressResponse {
|
||||
id: string
|
||||
fulfillment_id: string | null
|
||||
company: string | null
|
||||
first_name: string | null
|
||||
last_name: string | null
|
||||
address_1: string | null
|
||||
address_2: string | null
|
||||
city: string | null
|
||||
country_code: string | null
|
||||
province: string | null
|
||||
postal_code: string | null
|
||||
phone: string | null
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
export interface AdminFulfillmentItemResponse {
|
||||
id: string
|
||||
title: string
|
||||
quantity: number
|
||||
sku: string
|
||||
barcode: string
|
||||
line_item_id: string | null
|
||||
inventory_item_id: string | null
|
||||
fulfillment_id: string
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
export interface AdminFulfillmentLabelResponse {
|
||||
id: string
|
||||
tracking_number: string
|
||||
tracking_url: string
|
||||
label_url: string
|
||||
fulfillment_id: string
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
export interface AdminFulfillmentProviderResponse {
|
||||
id: string
|
||||
name: string
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { ServiceZoneResponse } from "./service-zone"
|
||||
|
||||
export interface FulfillmentSetResponse {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
metadata: Record<string, unknown> | null
|
||||
service_zones: ServiceZoneResponse[]
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
export interface AdminFulfillmentSetResponse {
|
||||
fulfillment_set: FulfillmentSetResponse
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { DeleteResponse } from "../../common"
|
||||
import { AdminFulfillmentAddressResponse } from "./fulfillment-address"
|
||||
import { AdminFulfillmentItemResponse } from "./fulfillment-item"
|
||||
import { AdminFulfillmentLabelResponse } from "./fulfillment-label"
|
||||
import { AdminFulfillmentProviderResponse } from "./fulfillment-provider"
|
||||
|
||||
export interface AdminFulfillmentResponse {
|
||||
id: string
|
||||
location_id: string
|
||||
packed_at: Date | null
|
||||
shipped_at: Date | null
|
||||
delivered_at: Date | null
|
||||
canceled_at: Date | null
|
||||
data: Record<string, unknown> | null
|
||||
provider_id: string
|
||||
shipping_option_id: string | null
|
||||
metadata: Record<string, unknown> | null
|
||||
provider: AdminFulfillmentProviderResponse
|
||||
delivery_address: AdminFulfillmentAddressResponse
|
||||
items: AdminFulfillmentItemResponse[]
|
||||
labels: AdminFulfillmentLabelResponse[]
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
export interface AdminFulfillmentSetsDeleteResponse
|
||||
extends DeleteResponse<"fulfillment_set"> {}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { GeoZoneType } from "../../../fulfillment"
|
||||
|
||||
export interface AdminGeoZoneResponse {
|
||||
id: string
|
||||
type: GeoZoneType
|
||||
country_code: string
|
||||
province_code: string | null
|
||||
city: string | null
|
||||
postal_expression: Record<string, unknown> | null
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,12 +1,3 @@
|
||||
export * from "./fulfillment"
|
||||
export * from "./fulfillment-item"
|
||||
export * from "./fulfillment-set"
|
||||
export * from "./fulfillment-label"
|
||||
export * from "./fulfillment-provider"
|
||||
export * from "./fulfillment-address"
|
||||
export * from "./geo-zone"
|
||||
export * from "./service-zone"
|
||||
export * from "./shipping-option"
|
||||
export * from "./shipping-option-rule"
|
||||
export * from "./shipping-option-type"
|
||||
export * from "./shipping-profile"
|
||||
export * from "./entitites"
|
||||
export * from "./payloads"
|
||||
export * from "./responses"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
interface AdminCreateFulfillmentItem {
|
||||
title: string
|
||||
sku: string
|
||||
quantity: number
|
||||
barcode: string
|
||||
line_item_id?: string
|
||||
inventory_item_id?: string
|
||||
}
|
||||
|
||||
interface AdminCreateFulfillmentLabel {
|
||||
tracking_number: string
|
||||
tracking_url: string
|
||||
label_url: string
|
||||
}
|
||||
|
||||
interface AdminFulfillmentDeliveryAddress {
|
||||
first_name?: string
|
||||
last_name?: string
|
||||
phone?: string
|
||||
company?: string
|
||||
address_1?: string
|
||||
address_2?: string
|
||||
city?: string
|
||||
country_code?: string
|
||||
province?: string
|
||||
postal_code?: string
|
||||
metadata?: Record<string, string> | null
|
||||
}
|
||||
|
||||
export interface AdminCreateFulfillment {
|
||||
location_id: string
|
||||
provider_id: string
|
||||
delivery_address: AdminFulfillmentDeliveryAddress
|
||||
items: AdminCreateFulfillmentItem[]
|
||||
labels: AdminCreateFulfillmentLabel[]
|
||||
// TODO: Validator requires an empty object for the order field.
|
||||
// This is a temporary solution until the order field is
|
||||
// removed or typed correctly.
|
||||
order: Record<string, unknown>
|
||||
order_id: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface AdminCreateFulfillmentShipment {
|
||||
labels: AdminCreateFulfillmentLabel[]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { AdminFulfillment } from "./entitites"
|
||||
|
||||
export interface AdminFulfillmentResponse {
|
||||
fulfillment: AdminFulfillment
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { FulfillmentSetResponse } from "./fulfillment-set"
|
||||
import { AdminGeoZoneResponse } from "./geo-zone"
|
||||
|
||||
export interface AdminServiceZoneResponse {
|
||||
service_zone: ServiceZoneResponse
|
||||
}
|
||||
|
||||
export interface AdminServiceZoneDeleteResponse {
|
||||
id: string
|
||||
object: "service-zone"
|
||||
deleted: boolean
|
||||
parent: FulfillmentSetResponse
|
||||
}
|
||||
|
||||
export interface ServiceZoneResponse {
|
||||
id: string
|
||||
name: string
|
||||
metadata: Record<string, unknown> | null
|
||||
geo_zones: AdminGeoZoneResponse[]
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
export interface AdminShippingOptionRuleResponse {
|
||||
id: string
|
||||
attribute: string
|
||||
operator: string
|
||||
value: { value: string | string[] } | null
|
||||
shipping_option_id: string
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
export interface AdminShippingOptionTypeResponse {
|
||||
id: string
|
||||
label: string
|
||||
description: string
|
||||
code: string
|
||||
shipping_option_id: string
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
import { ShippingOptionPriceType } from "../../../fulfillment"
|
||||
import { AdminServiceZoneResponse } from "./service-zone"
|
||||
import { AdminShippingOptionTypeResponse } from "./shipping-option-type"
|
||||
import { AdminShippingOptionRuleResponse } from "./shipping-option-rule"
|
||||
import { AdminShippingProfileResponse } from "./shipping-profile"
|
||||
import { AdminFulfillmentProviderResponse } from "./fulfillment-provider"
|
||||
import { AdminPriceSetPriceResponse } from "../../pricing"
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
|
||||
interface AdminShippingOptionResponse {
|
||||
id: string
|
||||
name: string
|
||||
price_type: ShippingOptionPriceType
|
||||
service_zone_id: string
|
||||
shipping_profile_id: string
|
||||
provider_id: string
|
||||
shipping_option_type_id: string | null
|
||||
data: Record<string, unknown> | null
|
||||
metadata: Record<string, unknown> | null
|
||||
service_zone: AdminServiceZoneResponse
|
||||
shipping_profile: AdminShippingProfileResponse
|
||||
provider: AdminFulfillmentProviderResponse
|
||||
type: AdminShippingOptionTypeResponse
|
||||
rules: AdminShippingOptionRuleResponse[]
|
||||
prices: AdminPriceSetPriceResponse[]
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
export interface AdminShippingOptionRetrieveResponse {
|
||||
shipping_option: AdminShippingOptionResponse
|
||||
}
|
||||
|
||||
export type AdminShippingOptionListResponse = PaginatedResponse<{
|
||||
shipping_options: AdminShippingOptionResponse[]
|
||||
}>
|
||||
|
||||
export interface AdminShippingOptionDeleteResponse
|
||||
extends DeleteResponse<"shipping_option"> {}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
|
||||
export interface ShippingProfileResponse {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
|
||||
export interface AdminShippingProfileResponse {
|
||||
shipping_profile: ShippingProfileResponse
|
||||
}
|
||||
|
||||
export type AdminShippingProfilesResponse = PaginatedResponse<{
|
||||
shipping_profiles: ShippingProfileResponse[]
|
||||
}>
|
||||
|
||||
export interface AdminShippingProfileDeleteResponse
|
||||
extends DeleteResponse<"shipping_profile"> {}
|
||||
@@ -4,7 +4,10 @@ export * from "./cart"
|
||||
export * from "./collection"
|
||||
export * from "./common"
|
||||
export * from "./customer"
|
||||
export * from "./file"
|
||||
export * from "./fulfillment"
|
||||
export * from "./fulfillment-provider"
|
||||
export * from "./fulfillment-set"
|
||||
export * from "./inventory"
|
||||
export * from "./invite"
|
||||
export * from "./order"
|
||||
@@ -16,7 +19,8 @@ export * from "./promotion"
|
||||
export * from "./region"
|
||||
export * from "./reservation"
|
||||
export * from "./sales-channel"
|
||||
export * from "./shipping-option"
|
||||
export * from "./shipping-profile"
|
||||
export * from "./stock-locations"
|
||||
export * from "./tax"
|
||||
export * from "./user"
|
||||
export * from "./file"
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* TODO: Not sure how to type this properly, as it's unclear to me what is returned
|
||||
* by our API. As an example we return `price_list: null` but `price_list_id` is missing.
|
||||
*
|
||||
* Type in model that aren't currently in this type:
|
||||
* - price_list_id
|
||||
* - price_list
|
||||
* - price_rules
|
||||
* - rules_count
|
||||
*
|
||||
* Also `raw_amount` is typed as `Record<string, unknown>` but it seems to always return:
|
||||
* ```ts
|
||||
* {
|
||||
* amount: number
|
||||
* precision: number
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export interface AdminPrice {
|
||||
id: string
|
||||
title: string
|
||||
currency_code: string
|
||||
amount: number
|
||||
raw_amount: Record<string, unknown>
|
||||
min_quantity: number | null
|
||||
max_quantity: number | null
|
||||
price_set_id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./entitites"
|
||||
@@ -1 +1 @@
|
||||
export * from "./price"
|
||||
export * from "./admin"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
export interface AdminPriceSetPriceResponse {
|
||||
id: string
|
||||
amount: number
|
||||
currency_code: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface AdminSalesChannel {
|
||||
id: string
|
||||
name: string
|
||||
description: string | null
|
||||
is_disabled: boolean
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
@@ -1 +1,4 @@
|
||||
export * from "./sales-channel"
|
||||
export * from "./entities"
|
||||
export * from "./payloads"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
export interface AdminCreateSalesChannel {
|
||||
name: string
|
||||
description?: string
|
||||
is_disabled?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateSalesChannel {
|
||||
name?: string
|
||||
description?: string | null
|
||||
is_disabled?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateSalesChannelProducts {
|
||||
add?: string[]
|
||||
remove?: string[]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { OperatorMap } from "../../../dal"
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface AdminSalesChannelListParams extends FindParams {
|
||||
id?: string | string[]
|
||||
q?: string
|
||||
name?: string | string[]
|
||||
description?: string
|
||||
is_disabled?: boolean
|
||||
location_id?: string | string[]
|
||||
publishable_key_id?: string | string[]
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
deleted_at?: OperatorMap<string>
|
||||
$and?: AdminSalesChannelListParams[]
|
||||
$or?: AdminSalesChannelListParams[]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
import { AdminSalesChannel } from "./entities"
|
||||
|
||||
export interface AdminSalesChannelResponse {
|
||||
sales_channel: AdminSalesChannel
|
||||
}
|
||||
|
||||
export type AdminSalesChannelListResponse = PaginatedResponse<{
|
||||
sales_channels: AdminSalesChannel[]
|
||||
}>
|
||||
|
||||
export interface AdminSalesChannelDeleteResponse
|
||||
extends DeleteResponse<"sales_channel"> {}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { PaginatedResponse } from "../../common"
|
||||
|
||||
interface SalesChannelResponse {
|
||||
id: string
|
||||
name: string
|
||||
description: string | null
|
||||
is_disabled: boolean
|
||||
metadata: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export type AdminSalesChannelListResponse = PaginatedResponse<{
|
||||
sales_channels: SalesChannelResponse[]
|
||||
}>
|
||||
|
||||
export interface AdminSalesChannelResponse {
|
||||
sales_channel: SalesChannelResponse
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { ShippingOptionPriceType } from "../../../fulfillment"
|
||||
import { AdminFulfillmentProvider } from "../../fulfillment-provider"
|
||||
import { AdminServiceZone } from "../../fulfillment-set"
|
||||
import { AdminPrice } from "../../pricing"
|
||||
import { AdminShippingProfile } from "../../shipping-profile"
|
||||
|
||||
export interface AdminShippingOptionType {
|
||||
id: string
|
||||
label: string
|
||||
description: string
|
||||
code: string
|
||||
shipping_option_id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminShippingOptionRule {
|
||||
id: string
|
||||
attribute: string
|
||||
operator: string
|
||||
value: string | string[] | null
|
||||
shipping_option_id: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
|
||||
export interface AdminShippingOption {
|
||||
id: string
|
||||
name: string
|
||||
price_type: ShippingOptionPriceType
|
||||
service_zone_id: string
|
||||
service_zone: AdminServiceZone
|
||||
provider_id: string
|
||||
provider: AdminFulfillmentProvider
|
||||
shipping_option_type_id: string | null
|
||||
type: AdminShippingOptionType
|
||||
shipping_profile_id: string
|
||||
shipping_profile: AdminShippingProfile
|
||||
rules: AdminShippingOptionRule[]
|
||||
prices: AdminPrice[]
|
||||
data: Record<string, unknown> | null
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./entities"
|
||||
export * from "./payloads"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,75 @@
|
||||
import { RuleOperatorType } from "../../../common"
|
||||
import { ShippingOptionPriceType } from "../../../fulfillment"
|
||||
|
||||
interface AdminCreateShippingOptionRule {
|
||||
operator: RuleOperatorType
|
||||
attribute: string
|
||||
value: string | string[]
|
||||
}
|
||||
|
||||
interface AdminCreateShippingOptionType {
|
||||
label: string
|
||||
description: string
|
||||
code: string
|
||||
}
|
||||
|
||||
interface AdminCreateShippingOptionPriceWithCurrency {
|
||||
currency_code: string
|
||||
amount: number
|
||||
}
|
||||
|
||||
interface AdminCreateShippingOptionPriceWithRegion {
|
||||
region_id: string
|
||||
amount: number
|
||||
}
|
||||
|
||||
export interface AdminCreateShippingOption {
|
||||
name: string
|
||||
service_zone_id: string
|
||||
shipping_profile_id: string
|
||||
data?: Record<string, unknown>
|
||||
price_type: ShippingOptionPriceType
|
||||
provider_id: string
|
||||
type: AdminCreateShippingOptionType
|
||||
prices: (
|
||||
| AdminCreateShippingOptionPriceWithCurrency
|
||||
| AdminCreateShippingOptionPriceWithRegion
|
||||
)[]
|
||||
rules?: AdminCreateShippingOptionRule[]
|
||||
}
|
||||
|
||||
interface AdminUpdateShippingOptionRule extends AdminCreateShippingOptionRule {
|
||||
id: string
|
||||
}
|
||||
|
||||
interface AdminUpdateShippingOptionPriceWithCurrency {
|
||||
id?: string
|
||||
currency_code?: string
|
||||
amount?: number
|
||||
}
|
||||
|
||||
interface AdminUpdateShippingOptionPriceWithRegion {
|
||||
id?: string
|
||||
region_id?: string
|
||||
amount?: number
|
||||
}
|
||||
|
||||
export interface AdminUpdateShippingOption {
|
||||
name?: string
|
||||
data?: Record<string, unknown>
|
||||
price_type?: ShippingOptionPriceType
|
||||
provider_id?: string
|
||||
shipping_profile_id?: string
|
||||
type?: AdminCreateShippingOptionType
|
||||
prices?: (
|
||||
| AdminUpdateShippingOptionPriceWithCurrency
|
||||
| AdminUpdateShippingOptionPriceWithRegion
|
||||
)[]
|
||||
rules?: (AdminUpdateShippingOptionRule | AdminCreateShippingOptionRule)[]
|
||||
}
|
||||
|
||||
export interface AdminUpdateShippingOptionRules {
|
||||
create?: any[]
|
||||
update?: any[]
|
||||
delete?: string[]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { OperatorMap } from "../../../dal"
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface AdminShippingOptionListParams extends FindParams {
|
||||
id?: string | string[]
|
||||
q?: string
|
||||
service_zone_id?: string
|
||||
shipping_profile_id?: string
|
||||
provider_id?: string
|
||||
shipping_option_type_id?: string
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
import { AdminShippingOption, AdminShippingOptionRule } from "./entities"
|
||||
|
||||
export interface AdminShippingOptionResponse {
|
||||
shipping_option: AdminShippingOption
|
||||
}
|
||||
|
||||
export type AdminShippingOptionListResponse = PaginatedResponse<{
|
||||
shipping_options: AdminShippingOption[]
|
||||
}>
|
||||
|
||||
export interface AdminShippingOptionDeleteResponse
|
||||
extends DeleteResponse<"shipping_option"> {}
|
||||
|
||||
export interface AdminUpdateShippingOptionRulesResponse {
|
||||
created: AdminShippingOptionRule[]
|
||||
updated: AdminShippingOptionRule[]
|
||||
deleted: {
|
||||
ids: string[]
|
||||
object: "shipping_option_rule"
|
||||
deleted: boolean
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./admin"
|
||||
@@ -0,0 +1,9 @@
|
||||
export interface AdminShippingProfile {
|
||||
id: string
|
||||
name: string
|
||||
type: string
|
||||
metadata: Record<string, unknown> | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
deleted_at: string | null
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./entities"
|
||||
export * from "./payloads"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,11 @@
|
||||
export interface AdminCreateShippingProfile {
|
||||
name: string
|
||||
type: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateShippingProfile {
|
||||
name?: string
|
||||
type?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { OperatorMap } from "../../../dal"
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface AdminShippingProfileListParams extends FindParams {
|
||||
id?: string | string[]
|
||||
q?: string
|
||||
type?: string
|
||||
name?: string
|
||||
created_at?: OperatorMap<string>
|
||||
updated_at?: OperatorMap<string>
|
||||
deleted_at?: OperatorMap<string>
|
||||
$and?: AdminShippingProfileListParams[]
|
||||
$or?: AdminShippingProfileListParams[]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
import { AdminShippingProfile } from "./entities"
|
||||
|
||||
export interface AdminShippingProfileResponse {
|
||||
shipping_profile: AdminShippingProfile
|
||||
}
|
||||
|
||||
export type AdminShippingProfileListResponse = PaginatedResponse<{
|
||||
shipping_profiles: AdminShippingProfile[]
|
||||
}>
|
||||
|
||||
export interface AdminShippingProfileDeleteResponse
|
||||
extends DeleteResponse<"shipping_profile"> {}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./admin"
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AdminSalesChannel } from "../../sales-channel"
|
||||
|
||||
export interface AdminStockLocationAddress {
|
||||
id: string
|
||||
address_1: string
|
||||
address_2: string | null
|
||||
company: string | null
|
||||
country_code: string
|
||||
city: string | null
|
||||
phone: string | null
|
||||
postal_code: string | null
|
||||
province: string | null
|
||||
}
|
||||
|
||||
export interface AdminStockLocation {
|
||||
id: string
|
||||
name: string
|
||||
address_id: string
|
||||
address?: AdminStockLocationAddress
|
||||
sales_channels?: AdminSalesChannel[]
|
||||
fulfillment_sets?: any[]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./entities"
|
||||
export * from "./payloads"
|
||||
export * from "./queries"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,34 @@
|
||||
interface AdminUpsertStockLocationAddress {
|
||||
address_1: string
|
||||
address_2?: string
|
||||
company?: string
|
||||
country_code: string
|
||||
city?: string
|
||||
phone?: string
|
||||
postal_code?: string
|
||||
province?: string
|
||||
}
|
||||
|
||||
export interface AdminCreateStockLocation {
|
||||
name: string
|
||||
address_id?: string
|
||||
address?: AdminUpsertStockLocationAddress
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateStockLocation {
|
||||
name?: string
|
||||
address_id?: string
|
||||
address?: AdminUpsertStockLocationAddress
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AdminUpdateStockLocationSalesChannels {
|
||||
add?: string[]
|
||||
remove?: string[]
|
||||
}
|
||||
|
||||
export interface AdminCreateStockLocationFulfillmentSet {
|
||||
name: string
|
||||
type: string
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface AdminStockLocationListParams extends FindParams {
|
||||
id?: string | string[]
|
||||
q?: string
|
||||
name?: string | string[]
|
||||
address_id?: string | string[]
|
||||
sales_channel_id?: string | string[]
|
||||
$and?: AdminStockLocationListParams[]
|
||||
$or?: AdminStockLocationListParams[]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||
import { AdminStockLocation } from "./entities"
|
||||
|
||||
export interface AdminStockLocationResponse {
|
||||
stock_location: AdminStockLocation
|
||||
}
|
||||
|
||||
export interface AdminStockLocationListResponse
|
||||
extends PaginatedResponse<{
|
||||
stock_locations: AdminStockLocation[]
|
||||
}> {}
|
||||
|
||||
export interface AdminStockLocationDeleteResponse
|
||||
extends DeleteResponse<"stock_location"> {}
|
||||
@@ -1,30 +0,0 @@
|
||||
import { AdminFulfillmentSetResponse } from "../fulfillment"
|
||||
|
||||
export type AdminStockLocationAddressResponse = {
|
||||
id?: string
|
||||
address_1: string
|
||||
address_2?: string | null
|
||||
company?: string | null
|
||||
country_code: string
|
||||
city?: string | null
|
||||
phone?: string | null
|
||||
postal_code?: string | null
|
||||
province?: string | null
|
||||
metadata?: Record<string, unknown> | null
|
||||
created_at: string | Date
|
||||
updated_at: string | Date
|
||||
deleted_at: string | Date | null
|
||||
}
|
||||
|
||||
export interface AdminStockLocationResponse {
|
||||
id: string
|
||||
name: string
|
||||
metadata: Record<string, unknown> | null
|
||||
address_id: string
|
||||
address?: AdminStockLocationAddressResponse
|
||||
created_at: string | Date
|
||||
updated_at: string | Date
|
||||
deleted_at: string | Date | null
|
||||
|
||||
fulfillment_sets?: AdminFulfillmentSetResponse[]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
export * from "./common"
|
||||
export * from "./admin"
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface UpdateSalesChannelDTO {
|
||||
/**
|
||||
* The description of the sales channel.
|
||||
*/
|
||||
description?: string
|
||||
description?: string | null
|
||||
|
||||
/**
|
||||
* Whether the sales channel is disabled.
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
import { z } from "zod"
|
||||
import { createSelectParams } from "../../utils/validators"
|
||||
import { OptionalBooleanValidator } from "../../utils/common-validators"
|
||||
import { createFindParams } from "../../utils/validators"
|
||||
|
||||
export type AdminFulfillmentProvidersParamsType = z.infer<
|
||||
typeof AdminFulfillmentProvidersParams
|
||||
>
|
||||
export const AdminFulfillmentProvidersParams = createSelectParams()
|
||||
export const AdminFulfillmentProvidersParams = createFindParams({
|
||||
limit: 50,
|
||||
offset: 0,
|
||||
})
|
||||
.merge(
|
||||
z.object({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
is_enabled: OptionalBooleanValidator,
|
||||
q: z.string().optional(),
|
||||
})
|
||||
)
|
||||
.strict()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AdminFulfillmentSetsDeleteResponse } from "@medusajs/types"
|
||||
import { deleteFulfillmentSetsWorkflow } from "@medusajs/core-flows"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminFulfillmentSetsDeleteResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminFulfillmentSetDeleteResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
|
||||
+2
-3
@@ -5,7 +5,6 @@ import {
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import {
|
||||
AdminFulfillmentSetResponse,
|
||||
AdminServiceZoneDeleteResponse,
|
||||
AdminServiceZoneResponse,
|
||||
IFulfillmentModuleService,
|
||||
} from "@medusajs/types"
|
||||
@@ -94,7 +93,7 @@ export const POST = async (
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminServiceZoneDeleteResponse>
|
||||
res: MedusaResponse
|
||||
) => {
|
||||
const { id, zone_id } = req.params
|
||||
|
||||
@@ -120,7 +119,7 @@ export const DELETE = async (
|
||||
|
||||
res.status(200).json({
|
||||
id: zone_id,
|
||||
object: "service-zone",
|
||||
object: "service_zone",
|
||||
deleted: true,
|
||||
parent: fulfillmentSet,
|
||||
})
|
||||
|
||||
@@ -14,11 +14,6 @@ export const retrieveTransformQueryConfig = {
|
||||
isList: false,
|
||||
}
|
||||
|
||||
export const listTransformQueryConfig = {
|
||||
...retrieveTransformQueryConfig,
|
||||
isList: true,
|
||||
}
|
||||
|
||||
export const retrieveServiceZoneTransformQueryConfig = {
|
||||
defaults: [
|
||||
"id",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createOperatorMap } from "../../utils/validators"
|
||||
import { createSelectParams } from "../../utils/validators"
|
||||
import {
|
||||
geoZoneCitySchema,
|
||||
geoZoneCountrySchema,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
geoZoneZipSchema,
|
||||
} from "./validators/geo-zone"
|
||||
|
||||
export const AdminServiceZonesParams = createFindParams()
|
||||
export const AdminServiceZonesParams = createSelectParams()
|
||||
export type AdminServiceZonesParamsType = z.infer<
|
||||
typeof AdminServiceZonesParams
|
||||
>
|
||||
@@ -44,20 +44,7 @@ export const AdminUpdateFulfillmentSetServiceZonesSchema = z
|
||||
})
|
||||
.strict()
|
||||
|
||||
export const AdminFulfillmentSetParams = createFindParams({
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
}).merge(
|
||||
z.object({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
name: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
type: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
service_zone_id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
created_at: createOperatorMap().optional(),
|
||||
updated_at: createOperatorMap().optional(),
|
||||
deleted_at: createOperatorMap().optional(),
|
||||
})
|
||||
)
|
||||
export const AdminFulfillmentSetParams = createSelectParams()
|
||||
|
||||
export type AdminCreateFulfillmentSetServiceZonesType = z.infer<
|
||||
typeof AdminCreateFulfillmentSetServiceZonesSchema
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod"
|
||||
import { OptionalBooleanValidator } from "../../utils/common-validators"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
@@ -22,6 +23,7 @@ export const AdminGetSalesChannelsParams = createFindParams({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
name: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
description: z.string().optional(),
|
||||
is_disabled: OptionalBooleanValidator,
|
||||
created_at: createOperatorMap().optional(),
|
||||
updated_at: createOperatorMap().optional(),
|
||||
deleted_at: createOperatorMap().optional(),
|
||||
@@ -47,7 +49,7 @@ export type AdminUpdateSalesChannelType = z.infer<
|
||||
>
|
||||
export const AdminUpdateSalesChannel = z.object({
|
||||
name: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
is_disabled: z.boolean().optional(),
|
||||
metadata: z.record(z.string(), z.unknown()).optional(),
|
||||
})
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
import {
|
||||
AdminShippingOptionDeleteResponse,
|
||||
AdminShippingOptionRetrieveResponse,
|
||||
FulfillmentWorkflow,
|
||||
} from "@medusajs/types"
|
||||
import { AdminUpdateShippingOptionType } from "../validators"
|
||||
import {
|
||||
deleteShippingOptionsWorkflow,
|
||||
updateShippingOptionsWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import { FulfillmentWorkflow, HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../types/routing"
|
||||
import { refetchShippingOption } from "../helpers"
|
||||
import { AdminUpdateShippingOptionType } from "../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminUpdateShippingOptionType>,
|
||||
res: MedusaResponse<AdminShippingOptionRetrieveResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingOptionResponse>
|
||||
) => {
|
||||
const shippingOptionPayload = req.validatedBody
|
||||
|
||||
@@ -43,7 +39,7 @@ export const POST = async (
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminShippingOptionDeleteResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingOptionDeleteResponse>
|
||||
) => {
|
||||
const shippingOptionId = req.params.id
|
||||
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
import { createShippingOptionsWorkflow } from "@medusajs/core-flows"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
AdminShippingOptionListResponse,
|
||||
AdminShippingOptionRetrieveResponse,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
import { refetchShippingOption } from "./helpers"
|
||||
import {
|
||||
AdminCreateShippingOptionType,
|
||||
AdminGetShippingOptionsParamsType,
|
||||
} from "./validators"
|
||||
import { refetchShippingOption } from "./helpers"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<AdminGetShippingOptionsParamsType>,
|
||||
res: MedusaResponse<AdminShippingOptionListResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingOptionListResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -44,7 +41,7 @@ export const GET = async (
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminCreateShippingOptionType>,
|
||||
res: MedusaResponse<AdminShippingOptionRetrieveResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingOptionResponse>
|
||||
) => {
|
||||
const shippingOptionPayload = req.validatedBody
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@ import {
|
||||
ShippingOptionPriceType as ShippingOptionPriceTypeEnum,
|
||||
} from "@medusajs/utils"
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
|
||||
export type AdminGetShippingOptionParamsType = z.infer<
|
||||
typeof AdminGetShippingOptionParams
|
||||
@@ -16,7 +20,21 @@ export type AdminGetShippingOptionsParamsType = z.infer<
|
||||
export const AdminGetShippingOptionsParams = createFindParams({
|
||||
offset: 0,
|
||||
limit: 20,
|
||||
})
|
||||
}).merge(
|
||||
z.object({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
q: z.string().optional(),
|
||||
service_zone_id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
shipping_profile_id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
provider_id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
shipping_option_type_id: z
|
||||
.union([z.string(), z.array(z.string())])
|
||||
.optional(),
|
||||
created_at: createOperatorMap().optional(),
|
||||
updated_at: createOperatorMap().optional(),
|
||||
deleted_at: createOperatorMap().optional(),
|
||||
})
|
||||
)
|
||||
|
||||
/**
|
||||
* SHIPPING OPTIONS RULES
|
||||
@@ -127,6 +145,8 @@ export const AdminUpdateShippingOption = z
|
||||
)
|
||||
.array()
|
||||
.optional(),
|
||||
rules: AdminUpdateShippingOptionRule.or(AdminCreateShippingOptionRule).array().optional(),
|
||||
rules: AdminUpdateShippingOptionRule.or(AdminCreateShippingOptionRule)
|
||||
.array()
|
||||
.optional(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -3,11 +3,7 @@ import {
|
||||
updateShippingProfilesWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import {
|
||||
AdminShippingProfileDeleteResponse,
|
||||
AdminShippingProfileResponse,
|
||||
IFulfillmentModuleService,
|
||||
} from "@medusajs/types"
|
||||
import { HttpTypes, IFulfillmentModuleService } from "@medusajs/types"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
@@ -20,7 +16,7 @@ import {
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<AdminGetShippingProfileParamsType>,
|
||||
res: MedusaResponse<AdminShippingProfileResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingProfileResponse>
|
||||
) => {
|
||||
const shippingProfile = await refetchShippingProfile(
|
||||
req.params.id,
|
||||
@@ -33,7 +29,7 @@ export const GET = async (
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminShippingProfileDeleteResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingProfileDeleteResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -57,7 +53,7 @@ export const DELETE = async (
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminUpdateShippingProfileType>,
|
||||
res: MedusaResponse<AdminShippingProfileResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingProfileResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { createShippingProfilesWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
AdminShippingProfileResponse,
|
||||
AdminShippingProfilesResponse,
|
||||
} from "@medusajs/types"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
@@ -11,15 +8,15 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
import { refetchShippingProfile } from "./helpers"
|
||||
import {
|
||||
AdminCreateShippingProfileType,
|
||||
AdminGetShippingProfilesParamsType,
|
||||
} from "./validators"
|
||||
import { refetchShippingProfile } from "./helpers"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminCreateShippingProfileType>,
|
||||
res: MedusaResponse<AdminShippingProfileResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingProfileResponse>
|
||||
) => {
|
||||
const shippingProfilePayload = req.validatedBody
|
||||
|
||||
@@ -38,7 +35,7 @@ export const POST = async (
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<AdminGetShippingProfilesParamsType>,
|
||||
res: MedusaResponse<AdminShippingProfilesResponse>
|
||||
res: MedusaResponse<HttpTypes.AdminShippingProfileListResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ export const AdminGetShippingProfilesParams = createFindParams({
|
||||
offset: 0,
|
||||
}).merge(
|
||||
z.object({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
q: z.string().optional(),
|
||||
type: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { z } from "zod"
|
||||
import { createFindParams, createSelectParams } from "../../utils/validators"
|
||||
import {
|
||||
createFindParams,
|
||||
createOperatorMap,
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
|
||||
export type AdminGetStockLocationParamsType = z.infer<
|
||||
typeof AdminGetStockLocationParams
|
||||
@@ -19,6 +23,9 @@ export const AdminGetStockLocationsParams = createFindParams({
|
||||
name: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
address_id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
sales_channel_id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
created_at: createOperatorMap().optional(),
|
||||
updated_at: createOperatorMap().optional(),
|
||||
deleted_at: createOperatorMap().optional(),
|
||||
$and: z.lazy(() => AdminGetStockLocationsParams.array()).optional(),
|
||||
$or: z.lazy(() => AdminGetStockLocationsParams.array()).optional(),
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { generateEntityId } from "@medusajs/utils"
|
||||
import { Searchable, generateEntityId } from "@medusajs/utils"
|
||||
import {
|
||||
BeforeCreate,
|
||||
Entity,
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
|
||||
@Entity()
|
||||
export default class FulfillmentProvider {
|
||||
@Searchable()
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
createPsqlIndexStatementHelper,
|
||||
DALUtils,
|
||||
generateEntityId,
|
||||
Searchable,
|
||||
ShippingOptionPriceType,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
@@ -68,6 +69,7 @@ export default class ShippingOption {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
|
||||
@Searchable()
|
||||
@Property({ columnType: "text" })
|
||||
name: string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user