@ivfuture/ecomm-types
Advanced tools
Comparing version 1.1.1 to 1.1.2-cibo.0
export * as CacheTypes from "./cache"; | ||
export * as CommonTypes from "./common"; | ||
export * as DAL from "./dal"; | ||
export * as EventBusTypes from "./event-bus"; | ||
export * as FeatureFlagTypes from "./feature-flag"; | ||
export * as InventoryTypes from "./inventory"; | ||
export * as LoggerTypes from "./logger"; | ||
export * as ProductTypes from "./product"; | ||
export * as ModulesSdkTypes from "./modules-sdk"; | ||
export * as PricingTypes from "./pricing"; | ||
export * as ProductTypes from "./product"; | ||
export * as SalesChannelTypes from "./sales-channel"; | ||
export * as SearchTypes from "./search"; | ||
export * as StockLocationTypes from "./stock-location"; | ||
export * as TransactionBaseTypes from "./transaction-base"; | ||
export * as WorkflowTypes from "./workflow"; | ||
export * as DAL from "./dal"; | ||
export * as LoggerTypes from "./logger"; |
@@ -26,18 +26,14 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WorkflowTypes = exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.SalesChannelTypes = exports.ProductTypes = exports.PricingTypes = exports.ModulesSdkTypes = exports.LoggerTypes = exports.InventoryTypes = exports.FeatureFlagTypes = exports.EventBusTypes = exports.DAL = exports.CommonTypes = exports.CacheTypes = void 0; | ||
exports.LoggerTypes = exports.DAL = exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.ProductTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0; | ||
exports.CacheTypes = __importStar(require("./cache")); | ||
exports.CommonTypes = __importStar(require("./common")); | ||
exports.DAL = __importStar(require("./dal")); | ||
exports.EventBusTypes = __importStar(require("./event-bus")); | ||
exports.FeatureFlagTypes = __importStar(require("./feature-flag")); | ||
exports.InventoryTypes = __importStar(require("./inventory")); | ||
exports.LoggerTypes = __importStar(require("./logger")); | ||
exports.ProductTypes = __importStar(require("./product")); | ||
exports.ModulesSdkTypes = __importStar(require("./modules-sdk")); | ||
exports.PricingTypes = __importStar(require("./pricing")); | ||
exports.ProductTypes = __importStar(require("./product")); | ||
exports.SalesChannelTypes = __importStar(require("./sales-channel")); | ||
exports.SearchTypes = __importStar(require("./search")); | ||
exports.StockLocationTypes = __importStar(require("./stock-location")); | ||
exports.TransactionBaseTypes = __importStar(require("./transaction-base")); | ||
exports.WorkflowTypes = __importStar(require("./workflow")); | ||
exports.DAL = __importStar(require("./dal")); | ||
exports.LoggerTypes = __importStar(require("./logger")); | ||
//# sourceMappingURL=bundles.js.map |
@@ -7,6 +7,6 @@ import { FindManyOptions, FindOneOptions, FindOperator, FindOptionsSelect, FindOptionsWhere, OrderByCondition } from "typeorm"; | ||
*/ | ||
export type WithRequiredProperty<T, K extends keyof T> = T & { | ||
export declare type WithRequiredProperty<T, K extends keyof T> = T & { | ||
[Property in K]-?: T[Property]; | ||
}; | ||
export type PartialPick<T, K extends keyof T> = { | ||
export declare type PartialPick<T, K extends keyof T> = { | ||
[P in K]?: T[P]; | ||
@@ -22,23 +22,7 @@ }; | ||
} | ||
export type Writable<T> = { | ||
export declare type Writable<T> = { | ||
-readonly [key in keyof T]: T[key] | FindOperator<T[key]> | FindOperator<T[key][]> | FindOperator<string[]>; | ||
}; | ||
/** | ||
* @interface | ||
* | ||
* An object that is used to configure how an entity is retrieved from the database. It accepts as a typed parameter an `Entity` class, | ||
* which provides correct typing of field names in its properties. | ||
* | ||
* @prop select - An array of strings, each being attribute names of the entity to retrieve in the result. | ||
* @prop skip - A number indicating the number of records to skip before retrieving the results. | ||
* @prop take - A number indicating the number of records to return in the result. | ||
* @prop relations - An array of strings, each being relation names of the entity to retrieve in the result. | ||
* @prop order - | ||
* An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC` | ||
* to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order. | ||
* @prop withDeleted - A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the | ||
* `SoftDeletableEntity` class. | ||
*/ | ||
export interface FindConfig<Entity> { | ||
select?: (keyof Entity | string)[]; | ||
select?: (keyof Entity)[]; | ||
skip?: number; | ||
@@ -50,5 +34,4 @@ take?: number; | ||
}; | ||
withDeleted?: boolean; | ||
} | ||
export type ExtendedFindConfig<TEntity> = (Omit<FindOneOptions<TEntity>, "where" | "relations" | "select"> | Omit<FindManyOptions<TEntity>, "where" | "relations" | "select">) & { | ||
export declare type ExtendedFindConfig<TEntity> = (Omit<FindOneOptions<TEntity>, "where" | "relations" | "select"> | Omit<FindManyOptions<TEntity>, "where" | "relations" | "select">) & { | ||
select?: FindOptionsSelect<TEntity>; | ||
@@ -61,12 +44,12 @@ relations?: FindOptionsRelations<TEntity>; | ||
}; | ||
export type QuerySelector<TEntity> = Selector<TEntity> & { | ||
export declare type QuerySelector<TEntity> = Selector<TEntity> & { | ||
q?: string; | ||
}; | ||
export type TreeQuerySelector<TEntity> = QuerySelector<TEntity> & { | ||
export declare type TreeQuerySelector<TEntity> = QuerySelector<TEntity> & { | ||
include_descendants_tree?: boolean; | ||
}; | ||
export type Selector<TEntity> = { | ||
export declare type Selector<TEntity> = { | ||
[key in keyof TEntity]?: TEntity[key] | TEntity[key][] | DateComparisonOperator | StringComparisonOperator | NumericalComparisonOperator | FindOperator<TEntity[key][] | string | string[]>; | ||
}; | ||
export type TotalField = "shipping_total" | "discount_total" | "tax_total" | "refunded_total" | "total" | "subtotal" | "refundable_amount" | "gift_card_total" | "gift_card_tax_total"; | ||
export declare type TotalField = "shipping_total" | "discount_total" | "tax_total" | "refunded_total" | "total" | "subtotal" | "refundable_amount" | "gift_card_total" | "gift_card_tax_total"; | ||
export interface CustomFindOptions<TModel, InKeys extends keyof TModel> { | ||
@@ -81,3 +64,3 @@ select?: FindManyOptions<TModel>["select"]; | ||
} | ||
export type QueryConfig<TEntity extends BaseEntity> = { | ||
export declare type QueryConfig<TEntity extends BaseEntity> = { | ||
defaultFields?: (keyof TEntity | string)[]; | ||
@@ -90,3 +73,3 @@ defaultRelations?: string[]; | ||
}; | ||
export type RequestQueryFields = { | ||
export declare type RequestQueryFields = { | ||
expand?: string; | ||
@@ -98,3 +81,3 @@ fields?: string; | ||
}; | ||
export type PaginatedResponse = { | ||
export declare type PaginatedResponse = { | ||
limit: number; | ||
@@ -104,3 +87,3 @@ offset: number; | ||
}; | ||
export type DeleteResponse = { | ||
export declare type DeleteResponse = { | ||
id: string; | ||
@@ -107,0 +90,0 @@ object: string; |
import { RedisOptions } from "ioredis"; | ||
import { LoggerOptions } from "typeorm"; | ||
import { ExternalModuleDeclaration, InternalModuleDeclaration } from "../modules-sdk"; | ||
type SessionOptions = { | ||
declare type SessionOptions = { | ||
name?: string; | ||
@@ -12,3 +12,3 @@ resave?: boolean; | ||
}; | ||
export type HttpCompressionOptions = { | ||
export declare type HttpCompressionOptions = { | ||
enabled?: boolean; | ||
@@ -19,3 +19,3 @@ level?: number; | ||
}; | ||
export type ProjectConfigOptions = { | ||
export declare type ProjectConfigOptions = { | ||
redis_url?: string; | ||
@@ -40,4 +40,7 @@ redis_prefix?: string; | ||
admin_cors?: string; | ||
waiter_cors?: string; | ||
eric_cors?: string; | ||
merchant_id?: string; | ||
}; | ||
export type ConfigModule = { | ||
export declare type ConfigModule = { | ||
projectConfig: ProjectConfigOptions; | ||
@@ -44,0 +47,0 @@ featureFlags: Record<string, boolean | string>; |
import { AwilixContainer } from "awilix"; | ||
export type MedusaContainer = AwilixContainer & { | ||
export declare type MedusaContainer = AwilixContainer & { | ||
registerAdd: <T>(name: string, registration: T) => MedusaContainer; | ||
createScope: () => MedusaContainer; | ||
}; |
import { Dictionary, FilterQuery, Order } from "./utils"; | ||
export { FilterQuery } from "./utils"; | ||
/** | ||
* @interface | ||
* | ||
* An object used to allow specifying flexible queries with and/or conditions. | ||
* | ||
* @prop $and - An array of filters to apply on the entity, where each item in the array is joined with an "and" condition. | ||
* @prop $or - An array of filters to apply on the entity, where each item in the array is joined with an "or" condition. | ||
*/ | ||
export interface BaseFilterable<T> { | ||
$and?: (T | BaseFilterable<T>)[]; | ||
$or?: (T | BaseFilterable<T>)[]; | ||
$and?: T; | ||
$or?: T; | ||
} | ||
@@ -24,7 +16,6 @@ export interface OptionsQuery<T, P extends string = never> { | ||
} | ||
export type FindOptions<T = any> = { | ||
where: FilterQuery<T> & BaseFilterable<FilterQuery<T>>; | ||
export declare type FindOptions<T = any> = { | ||
where: FilterQuery<T>; | ||
options?: OptionsQuery<T, any>; | ||
}; | ||
export * from "./repository-service"; | ||
export * from "./entity"; |
@@ -18,3 +18,2 @@ "use strict"; | ||
__exportStar(require("./repository-service"), exports); | ||
__exportStar(require("./entity"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -0,4 +1,3 @@ | ||
import { FindOptions } from "./index"; | ||
import { RepositoryTransformOptions } from "../common"; | ||
import { Context } from "../shared-context"; | ||
import { FindOptions } from "./index"; | ||
/** | ||
@@ -9,55 +8,5 @@ * Data access layer (DAL) interface to implements for any repository service. | ||
*/ | ||
interface BaseRepositoryService<T = any> { | ||
transaction<TManager = unknown>(task: (transactionManager: TManager) => Promise<any>, context?: { | ||
isolationLevel?: string; | ||
transaction?: TManager; | ||
enableNestedTransactions?: boolean; | ||
}): Promise<any>; | ||
getFreshManager<TManager = unknown>(): TManager; | ||
getActiveManager<TManager = unknown>(): TManager; | ||
serialize<TOutput extends object | object[]>(data: any, options?: any): Promise<TOutput>; | ||
export interface RepositoryService<T = any> { | ||
find(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions): Promise<T[]>; | ||
findAndCount(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions): Promise<[T[], number]>; | ||
} | ||
export interface RepositoryService<T = any> extends BaseRepositoryService<T> { | ||
find(options?: FindOptions<T>, context?: Context): Promise<T[]>; | ||
findAndCount(options?: FindOptions<T>, context?: Context): Promise<[T[], number]>; | ||
create(data: unknown[], context?: Context): Promise<T[]>; | ||
update(data: unknown[], context?: Context): Promise<T[]>; | ||
delete(ids: string[], context?: Context): Promise<void>; | ||
/** | ||
* Soft delete entities and cascade to related entities if configured. | ||
* | ||
* @param ids | ||
* @param context | ||
* | ||
* @returns [T[], Record<string, string[]>] the second value being the map of the entity names and ids that were soft deleted | ||
*/ | ||
softDelete(ids: string[], context?: Context): Promise<[T[], Record<string, unknown[]>]>; | ||
restore(ids: string[], context?: Context): Promise<[T[], Record<string, unknown[]>]>; | ||
} | ||
export interface TreeRepositoryService<T = any> extends BaseRepositoryService<T> { | ||
find(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<T[]>; | ||
findAndCount(options?: FindOptions<T>, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<[T[], number]>; | ||
create(data: unknown, context?: Context): Promise<T>; | ||
delete(id: string, context?: Context): Promise<void>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted. | ||
* | ||
* @prop returnLinkableKeys - An array of strings, each being the ID attribute names of the entity's relations. | ||
*/ | ||
export type SoftDeleteReturn<TReturnableLinkableKeys = string> = { | ||
returnLinkableKeys?: TReturnableLinkableKeys[]; | ||
}; | ||
/** | ||
* @interface | ||
* | ||
* An object that is used to specify an entity's related entities that should be restored when the main entity is restored. | ||
* | ||
* @prop returnLinkableKeys - An array of strings, each being the ID attribute names of the entity's relations. | ||
*/ | ||
export type RestoreReturn<TReturnableLinkableKeys = string> = { | ||
returnLinkableKeys?: TReturnableLinkableKeys[]; | ||
}; | ||
export {}; |
/// <reference types="node" /> | ||
export type Dictionary<T = any> = { | ||
export declare type Dictionary<T = any> = { | ||
[k: string]: T; | ||
}; | ||
type Query<T> = T extends object ? T extends Scalar ? never : FilterQuery<T> : FilterValue<T>; | ||
type ExpandScalar<T> = null | (T extends string ? string | RegExp : T extends Date ? Date | string : T); | ||
type Scalar = boolean | number | string | bigint | symbol | Date | RegExp | Buffer | { | ||
declare type Query<T> = T extends object ? T extends Scalar ? never : FilterQuery<T> : FilterValue<T>; | ||
declare type ExpandScalar<T> = null | (T extends string ? string | RegExp : T extends Date ? Date | string : T); | ||
declare type Scalar = boolean | number | string | bigint | symbol | Date | RegExp | Buffer | { | ||
toHexString(): string; | ||
}; | ||
type ReadonlyPrimary<T> = T extends any[] ? Readonly<T> : T; | ||
declare type ReadonlyPrimary<T> = T extends any[] ? Readonly<T> : T; | ||
declare const PrimaryKeyType: unique symbol; | ||
type Primary<T> = T extends { | ||
declare type Primary<T> = T extends { | ||
[PrimaryKeyType]?: infer PK; | ||
@@ -21,3 +21,3 @@ } ? ReadonlyPrimary<PK> : T extends { | ||
} ? ReadonlyPrimary<PK> : never; | ||
export type OperatorMap<T> = { | ||
export declare type OperatorMap<T> = { | ||
$and?: Query<T>[]; | ||
@@ -43,6 +43,6 @@ $or?: Query<T>[]; | ||
}; | ||
type FilterValue2<T> = T | ExpandScalar<T> | Primary<T>; | ||
type FilterValue<T> = OperatorMap<FilterValue2<T>> | FilterValue2<T> | FilterValue2<T>[] | null; | ||
type PrevLimit = [never, 1, 2, 3]; | ||
export type FilterQuery<T = any, Prev extends number = 3> = Prev extends never ? never : { | ||
declare type FilterValue2<T> = T | ExpandScalar<T> | Primary<T>; | ||
declare type FilterValue<T> = OperatorMap<FilterValue2<T>> | FilterValue2<T> | FilterValue2<T>[] | null; | ||
declare type PrevLimit = [never, 1, 2, 3]; | ||
export declare type FilterQuery<T = any, Prev extends number = 3> = Prev extends never ? never : { | ||
[Key in keyof T]?: T[Key] extends boolean | number | string | bigint | symbol | Date ? T[Key] | OperatorMap<T[Key]> : T[Key] extends infer U ? U extends { | ||
@@ -52,5 +52,5 @@ [x: number]: infer V; | ||
}; | ||
export type Order<T> = { | ||
export declare type Order<T> = { | ||
[key in keyof T]?: "ASC" | "DESC" | Order<T[key] extends Array<any> ? T[key][0] : T[key]>; | ||
}; | ||
export {}; |
@@ -1,11 +0,11 @@ | ||
export type Subscriber<T = unknown> = (data: T, eventName: string) => Promise<void>; | ||
export type SubscriberContext = { | ||
export declare type Subscriber<T = unknown> = (data: T, eventName: string) => Promise<void>; | ||
export declare type SubscriberContext = { | ||
subscriberId: string; | ||
}; | ||
export type SubscriberDescriptor = { | ||
export declare type SubscriberDescriptor = { | ||
id: string; | ||
subscriber: Subscriber; | ||
}; | ||
export type EventHandler<T = unknown> = (data: T, eventName: string) => Promise<void>; | ||
export type EmitData<T = unknown> = { | ||
export declare type EventHandler<T = unknown> = (data: T, eventName: string) => Promise<void>; | ||
export declare type EmitData<T = unknown> = { | ||
eventName: string; | ||
@@ -12,0 +12,0 @@ data: T; |
import { EmitData, Subscriber, SubscriberContext } from "./common"; | ||
export interface IEventBusModuleService { | ||
emit<T>(eventName: string, data: T, options?: Record<string, unknown>): Promise<void>; | ||
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>; | ||
emit<T>(data: EmitData<T>[]): Promise<void>; | ||
@@ -5,0 +5,0 @@ subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this; |
@@ -1,19 +0,10 @@ | ||
export * from "./address"; | ||
export * from "./bundles"; | ||
export * from "./cache"; | ||
export * from "./cart"; | ||
export * from "./common"; | ||
export * from "./dal"; | ||
export * from "./event-bus"; | ||
export * from "./feature-flag"; | ||
export * from "./file-service"; | ||
export * from "./inventory"; | ||
export * from "./joiner"; | ||
export * from "./link-modules"; | ||
export * from "./logger"; | ||
export * from "./modules-sdk"; | ||
export * from "./pricing"; | ||
export * from "./product"; | ||
export * from "./product-category"; | ||
export * from "./sales-channel"; | ||
export * from "./search"; | ||
@@ -23,2 +14,3 @@ export * from "./shared-context"; | ||
export * from "./transaction-base"; | ||
export * from "./workflow"; | ||
export * from "./dal"; | ||
export * from "./logger"; |
@@ -17,20 +17,11 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./address"), exports); | ||
__exportStar(require("./bundles"), exports); | ||
__exportStar(require("./cache"), exports); | ||
__exportStar(require("./cart"), exports); | ||
__exportStar(require("./common"), exports); | ||
__exportStar(require("./dal"), exports); | ||
__exportStar(require("./event-bus"), exports); | ||
__exportStar(require("./feature-flag"), exports); | ||
__exportStar(require("./file-service"), exports); | ||
__exportStar(require("./inventory"), exports); | ||
__exportStar(require("./joiner"), exports); | ||
__exportStar(require("./link-modules"), exports); | ||
__exportStar(require("./logger"), exports); | ||
__exportStar(require("./modules-sdk"), exports); | ||
__exportStar(require("./pricing"), exports); | ||
__exportStar(require("./product"), exports); | ||
__exportStar(require("./product-category"), exports); | ||
__exportStar(require("./sales-channel"), exports); | ||
__exportStar(require("./search"), exports); | ||
@@ -40,3 +31,4 @@ __exportStar(require("./shared-context"), exports); | ||
__exportStar(require("./transaction-base"), exports); | ||
__exportStar(require("./workflow"), exports); | ||
__exportStar(require("./dal"), exports); | ||
__exportStar(require("./logger"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -64,3 +64,3 @@ import { NumericalComparisonOperator, StringComparisonOperator } from "../common"; | ||
*/ | ||
export type InventoryItemDTO = { | ||
export declare type InventoryItemDTO = { | ||
id: string; | ||
@@ -131,3 +131,3 @@ sku?: string | null; | ||
*/ | ||
export type ReservationItemDTO = { | ||
export declare type ReservationItemDTO = { | ||
id: string; | ||
@@ -184,3 +184,3 @@ location_id: string; | ||
*/ | ||
export type InventoryLevelDTO = { | ||
export declare type InventoryLevelDTO = { | ||
id: string; | ||
@@ -197,3 +197,3 @@ inventory_item_id: string; | ||
}; | ||
export type FilterableReservationItemProps = { | ||
export declare type FilterableReservationItemProps = { | ||
id?: string | string[]; | ||
@@ -208,3 +208,3 @@ type?: string | string[]; | ||
}; | ||
export type FilterableInventoryItemProps = { | ||
export declare type FilterableInventoryItemProps = { | ||
id?: string | string[]; | ||
@@ -218,19 +218,19 @@ location_id?: string | string[]; | ||
}; | ||
export type CreateInventoryItemInput = { | ||
sku?: 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; | ||
title?: string | null; | ||
description?: string | null; | ||
thumbnail?: string | null; | ||
export declare type CreateInventoryItemInput = { | ||
sku?: string; | ||
origin_country?: string; | ||
mid_code?: string; | ||
material?: string; | ||
weight?: number; | ||
length?: number; | ||
height?: number; | ||
width?: number; | ||
title?: string; | ||
description?: string; | ||
thumbnail?: string; | ||
metadata?: Record<string, unknown> | null; | ||
hs_code?: string | null; | ||
hs_code?: string; | ||
requires_shipping?: boolean; | ||
}; | ||
export type CreateReservationItemInput = { | ||
export declare type CreateReservationItemInput = { | ||
line_item_id?: string; | ||
@@ -245,3 +245,3 @@ inventory_item_id: string; | ||
}; | ||
export type FilterableInventoryLevelProps = { | ||
export declare type FilterableInventoryLevelProps = { | ||
inventory_item_id?: string | string[]; | ||
@@ -253,3 +253,3 @@ location_id?: string | string[]; | ||
}; | ||
export type CreateInventoryLevelInput = { | ||
export declare type CreateInventoryLevelInput = { | ||
inventory_item_id: string; | ||
@@ -261,11 +261,7 @@ location_id: string; | ||
}; | ||
export type UpdateInventoryLevelInput = { | ||
export declare type UpdateInventoryLevelInput = { | ||
stocked_quantity?: number; | ||
incoming_quantity?: number; | ||
}; | ||
export type BulkUpdateInventoryLevelInput = { | ||
inventory_item_id: string; | ||
location_id: string; | ||
} & UpdateInventoryLevelInput; | ||
export type UpdateReservationItemInput = { | ||
export declare type UpdateReservationItemInput = { | ||
quantity?: number; | ||
@@ -276,3 +272,3 @@ location_id?: string; | ||
}; | ||
export type ReserveQuantityContext = { | ||
export declare type ReserveQuantityContext = { | ||
locationId?: string; | ||
@@ -279,0 +275,0 @@ lineItemId?: string; |
export * from "./common"; | ||
export * from "./service"; | ||
export * from "./inventory"; |
@@ -18,3 +18,3 @@ "use strict"; | ||
__exportStar(require("./common"), exports); | ||
__exportStar(require("./service"), exports); | ||
__exportStar(require("./inventory"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export type JoinerRelationship = { | ||
export declare type JoinerRelationship = { | ||
alias: string; | ||
@@ -6,40 +6,6 @@ foreignKey: string; | ||
serviceName: string; | ||
/** | ||
* If true, the relationship is an internal service from the medusa core | ||
* TODO: Remove when there are no more "internal" services | ||
*/ | ||
isInternalService?: boolean; | ||
/** | ||
* In an inverted relationship the foreign key is on the other service and the primary key is on the current service | ||
*/ | ||
inverse?: boolean; | ||
/** | ||
* Force the relationship to return a list | ||
*/ | ||
isList?: boolean; | ||
/** | ||
* Extra arguments to pass to the remoteFetchData callback | ||
*/ | ||
args?: Record<string, any>; | ||
}; | ||
export interface JoinerServiceConfigAlias { | ||
name: string; | ||
/** | ||
* Extra arguments to pass to the remoteFetchData callback | ||
*/ | ||
args?: Record<string, any>; | ||
} | ||
export interface JoinerServiceConfig { | ||
serviceName: string; | ||
/** | ||
* Property name to use as entrypoint to the service | ||
*/ | ||
alias?: JoinerServiceConfigAlias | JoinerServiceConfigAlias[]; | ||
/** | ||
* alias for deeper nested relationships (e.g. { 'price': 'prices.calculated_price_set.amount' }) | ||
*/ | ||
fieldAlias?: Record<string, string | { | ||
path: string; | ||
forwardArgumentsOnPath: string[]; | ||
}>; | ||
primaryKeys: string[]; | ||
@@ -49,8 +15,4 @@ relationships?: JoinerRelationship[]; | ||
serviceName: string; | ||
relationship: JoinerRelationship; | ||
resolve: JoinerRelationship; | ||
}[]; | ||
/** | ||
* Extra arguments to pass to the remoteFetchData callback | ||
*/ | ||
args?: Record<string, any>; | ||
} | ||
@@ -60,10 +22,6 @@ export interface JoinerArgument { | ||
value?: any; | ||
field?: string; | ||
} | ||
export interface JoinerDirective { | ||
name: string; | ||
value?: any; | ||
} | ||
export interface RemoteJoinerQuery { | ||
service?: string; | ||
alias?: string; | ||
service: string; | ||
expands?: Array<{ | ||
@@ -73,11 +31,6 @@ property: string; | ||
args?: JoinerArgument[]; | ||
directives?: { | ||
[field: string]: JoinerDirective[]; | ||
}; | ||
relationships?: JoinerRelationship[]; | ||
}>; | ||
fields: string[]; | ||
args?: JoinerArgument[]; | ||
directives?: { | ||
[field: string]: JoinerDirective[]; | ||
}; | ||
} | ||
@@ -93,4 +46,2 @@ export interface RemoteNestedExpands { | ||
property: string; | ||
parent: string; | ||
parentConfig?: JoinerServiceConfig; | ||
serviceConfig: JoinerServiceConfig; | ||
@@ -97,0 +48,0 @@ fields: string[]; |
@@ -1,9 +0,7 @@ | ||
import { JoinerRelationship, JoinerServiceConfig } from "../joiner"; | ||
import { MedusaContainer } from "../common"; | ||
import { RepositoryService } from "../dal"; | ||
import { Logger } from "../logger"; | ||
export type Constructor<T> = new (...args: any[]) => T; | ||
export declare type Constructor<T> = new (...args: any[]) => T; | ||
export * from "../common/medusa-container"; | ||
export type LogLevel = "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"; | ||
export type LoggerOptions = boolean | "all" | LogLevel[]; | ||
export declare type LogLevel = "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"; | ||
export declare type LoggerOptions = boolean | "all" | LogLevel[]; | ||
export declare enum MODULE_SCOPE { | ||
@@ -17,21 +15,11 @@ INTERNAL = "internal", | ||
} | ||
export type InternalModuleDeclaration = { | ||
export declare type InternalModuleDeclaration = { | ||
scope: MODULE_SCOPE.INTERNAL; | ||
resources: MODULE_RESOURCE_TYPE; | ||
dependencies?: string[]; | ||
definition?: ModuleDefinition; | ||
resolve?: string; | ||
options?: Record<string, unknown>; | ||
/** | ||
* If multiple modules are registered with the same key, the alias can be used to differentiate them | ||
*/ | ||
alias?: string; | ||
/** | ||
* If the module is the main module for the key when multiple ones are registered | ||
*/ | ||
main?: boolean; | ||
}; | ||
export type ExternalModuleDeclaration = { | ||
export declare type ExternalModuleDeclaration = { | ||
scope: MODULE_SCOPE.EXTERNAL; | ||
definition?: ModuleDefinition; | ||
server?: { | ||
@@ -42,13 +30,4 @@ type: "http"; | ||
}; | ||
options?: Record<string, unknown>; | ||
/** | ||
* If multiple modules are registered with the same key, the alias can be used to differentiate them | ||
*/ | ||
alias?: string; | ||
/** | ||
* If the module is the main module for the key when multiple ones are registered | ||
*/ | ||
main?: boolean; | ||
}; | ||
export type ModuleResolution = { | ||
export declare type ModuleResolution = { | ||
resolutionPath: string | false; | ||
@@ -61,3 +40,3 @@ definition: ModuleDefinition; | ||
}; | ||
export type ModuleDefinition = { | ||
export declare type ModuleDefinition = { | ||
key: string; | ||
@@ -67,33 +46,8 @@ registrationName: string; | ||
label: string; | ||
/** | ||
* @deprecated property will be removed in future versions | ||
*/ | ||
canOverride?: boolean; | ||
/** | ||
* @deprecated property will be removed in future versions | ||
*/ | ||
isRequired?: boolean; | ||
isQueryable?: boolean; | ||
isLegacy?: boolean; | ||
dependencies?: string[]; | ||
defaultModuleDeclaration: InternalModuleDeclaration | ExternalModuleDeclaration; | ||
}; | ||
export type LinkModuleDefinition = { | ||
key: string; | ||
registrationName: string; | ||
label: string; | ||
dependencies?: string[]; | ||
defaultModuleDeclaration: InternalModuleDeclaration; | ||
}; | ||
type ModuleDeclaration = ExternalModuleDeclaration | InternalModuleDeclaration; | ||
export type ModuleConfig = ModuleDeclaration & { | ||
module: string; | ||
path: string; | ||
definition: ModuleDefinition; | ||
}; | ||
export type LoadedModule = unknown & { | ||
__joinerConfig: ModuleJoinerConfig; | ||
__definition: ModuleDefinition; | ||
}; | ||
export type LoaderOptions<TOptions = Record<string, unknown>> = { | ||
export declare type LoaderOptions<TOptions = Record<string, unknown>> = { | ||
container: MedusaContainer; | ||
@@ -103,66 +57,8 @@ options?: TOptions; | ||
}; | ||
export type ModuleLoaderFunction = (options: LoaderOptions, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>; | ||
export type ModulesResponse = { | ||
export declare type ModuleLoaderFunction = (options: LoaderOptions, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>; | ||
export declare type ModulesResponse = { | ||
module: string; | ||
resolution: string | false; | ||
}[]; | ||
export type ModuleJoinerConfig = Omit<JoinerServiceConfig, "serviceName" | "primaryKeys" | "relationships" | "extends"> & { | ||
/** | ||
* GraphQL schema for the all module's available entities and fields | ||
*/ | ||
schema?: string; | ||
relationships?: ModuleJoinerRelationship[]; | ||
extends?: { | ||
serviceName: string; | ||
fieldAlias?: Record<string, string | { | ||
path: string; | ||
forwardArgumentsOnPath: string[]; | ||
}>; | ||
relationship: ModuleJoinerRelationship; | ||
}[]; | ||
serviceName?: string; | ||
primaryKeys?: string[]; | ||
/** | ||
* If the module is a link module | ||
*/ | ||
isLink?: boolean; | ||
/** | ||
* Keys that can be used to link to other modules. e.g { product_id: "Product" } "Product" being the entity it refers to | ||
*/ | ||
linkableKeys?: Record<string, string>; | ||
/** | ||
* If true it expands a RemoteQuery property but doesn't create a pivot table | ||
*/ | ||
isReadOnlyLink?: boolean; | ||
databaseConfig?: { | ||
/** | ||
* Name of the pivot table. If not provided it is auto generated | ||
*/ | ||
tableName?: string; | ||
/** | ||
* Prefix for the id column. If not provided it is "link" | ||
*/ | ||
idPrefix?: string; | ||
extraFields?: Record<string, { | ||
type: "date" | "time" | "datetime" | "bigint" | "blob" | "uint8array" | "array" | "enumArray" | "enum" | "json" | "integer" | "smallint" | "tinyint" | "mediumint" | "float" | "double" | "boolean" | "decimal" | "string" | "uuid" | "text"; | ||
defaultValue?: string; | ||
nullable?: boolean; | ||
/** | ||
* Mikro-orm options for the column | ||
*/ | ||
options?: Record<string, unknown>; | ||
}>; | ||
}; | ||
}; | ||
export declare type ModuleJoinerRelationship = JoinerRelationship & { | ||
/** | ||
* If true, the relationship is an internal service from the medusa core TODO: Remove when there are no more "internal" services | ||
*/ | ||
isInternalService?: boolean; | ||
/** | ||
* If true, the link joiner will cascade deleting the relationship | ||
*/ | ||
deleteCascade?: boolean; | ||
}; | ||
export type ModuleExports = { | ||
export declare type ModuleExports = { | ||
service: Constructor<any>; | ||
@@ -175,25 +71,1 @@ loaders?: ModuleLoaderFunction[]; | ||
}; | ||
export interface ModuleServiceInitializeOptions { | ||
database: { | ||
/** | ||
* Forces to use a shared knex connection | ||
*/ | ||
connection?: any; | ||
clientUrl?: string; | ||
schema?: string; | ||
host?: string; | ||
port?: number; | ||
user?: string; | ||
password?: string; | ||
database?: string; | ||
driverOptions?: Record<string, unknown>; | ||
debug?: boolean; | ||
pool?: Record<string, unknown>; | ||
}; | ||
} | ||
export type ModuleServiceInitializeCustomDataLayerOptions = { | ||
manager?: any; | ||
repositories?: { | ||
[key: string]: Constructor<RepositoryService>; | ||
}; | ||
}; |
@@ -23,3 +23,3 @@ "use strict"; | ||
MODULE_SCOPE["EXTERNAL"] = "external"; | ||
})(MODULE_SCOPE || (exports.MODULE_SCOPE = MODULE_SCOPE = {})); | ||
})(MODULE_SCOPE = exports.MODULE_SCOPE || (exports.MODULE_SCOPE = {})); | ||
var MODULE_RESOURCE_TYPE; | ||
@@ -29,3 +29,3 @@ (function (MODULE_RESOURCE_TYPE) { | ||
MODULE_RESOURCE_TYPE["ISOLATED"] = "isolated"; | ||
})(MODULE_RESOURCE_TYPE || (exports.MODULE_RESOURCE_TYPE = MODULE_RESOURCE_TYPE = {})); | ||
})(MODULE_RESOURCE_TYPE = exports.MODULE_RESOURCE_TYPE || (exports.MODULE_RESOURCE_TYPE = {})); | ||
//# sourceMappingURL=index.js.map |
import { BaseFilterable } from "../dal"; | ||
import { OperatorMap } from "../dal/utils"; | ||
/** | ||
* @enum | ||
*/ | ||
export declare enum ProductStatus { | ||
@@ -13,34 +10,3 @@ DRAFT = "draft", | ||
/** | ||
* @interface | ||
* | ||
* A product's data. | ||
* @prop id - The ID of the product. | ||
* @prop title - The title of the product. | ||
* @prop handle - The handle of the product. The handle can be used to create slug URL paths. It can possibly be `null`. | ||
* @prop subtitle - The subttle of the product. It can possibly be `null`. | ||
* @prop description - The description of the product. It can possibly be `null`. | ||
* @prop is_giftcard - Whether the product is a gift card. | ||
* @prop status - The status of the product. Its value can be one of the values of the enum {@link ProductStatus}. | ||
* @prop thumbnail - The URL of the product's thumbnail. It can possibly be `null`. | ||
* @prop weight - The weight of the product. It can possibly be `null`. | ||
* @prop length - The length of the product. It can possibly be `null`. | ||
* @prop height - The height of the product. It can possibly be `null`. | ||
* @prop origin_country - The origin country of the product. It can possibly be `null`. | ||
* @prop hs_code - The HS Code of the product. It can possibly be `null`. | ||
* @prop mid_code - The MID Code of the product. It can possibly be `null`. | ||
* @prop material - The material of the product. It can possibly be `null`. | ||
* @prop collection - The associated product collection. It may only be available if the `collection` relation is expanded. | ||
* @prop categories -The associated product categories. It may only be available if the `categories` relation is expanded. | ||
* @prop type - The associated product type. It may only be available if the `type` relation is expanded. | ||
* @prop tags - The associated product tags. It may only be available if the `tags` relation is expanded. | ||
* @prop variants - The associated product variants. It may only be available if the `variants` relation is expanded. | ||
* @prop options - The associated product options. It may only be available if the `options` relation is expanded. | ||
* @prop images - The associated product images. It may only be available if the `images` relation is expanded. | ||
* @prop discountable - Whether the product can be discounted. | ||
* @prop external_id - | ||
* 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. | ||
* @prop created_at - When the product was created. | ||
* @prop updated_at - When the product was updated. | ||
* @prop deleted_at - When the product was deleted. | ||
* DTO in and out of the module (module API) | ||
*/ | ||
@@ -56,3 +22,2 @@ export interface ProductDTO { | ||
thumbnail?: string | null; | ||
width?: number | null; | ||
weight?: number | null; | ||
@@ -71,3 +36,2 @@ length?: number | null; | ||
options: ProductOptionDTO[]; | ||
images: ProductImageDTO[]; | ||
discountable?: boolean; | ||
@@ -78,35 +42,3 @@ external_id?: string | null; | ||
deleted_at?: string | Date; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product variant's data. | ||
* | ||
* @prop id - The ID of the product variant. | ||
* @prop title - The tile of the product variant. | ||
* @prop sku - The SKU of the product variant. It can possibly be `null`. | ||
* @prop barcode - The barcode of the product variant. It can possibly be `null`. | ||
* @prop ean - The EAN of the product variant. It can possibly be `null`. | ||
* @prop upc - The UPC of the product variant. It can possibly be `null`. | ||
* @prop inventory_quantity - The inventory quantiy of the product variant. | ||
* @prop allow_backorder - Whether the product variant can be ordered when it's out of stock. | ||
* @prop manage_inventory - Whether the product variant's inventory should be managed by the core system. | ||
* @prop hs_code - The HS Code of the product variant. It can possibly be `null`. | ||
* @prop origin_country - The origin country of the product variant. It can possibly be `null`. | ||
* @prop mid_code - The MID Code of the product variant. It can possibly be `null`. | ||
* @prop material - The material of the product variant. It can possibly be `null`. | ||
* @prop weight - The weight of the product variant. It can possibly be `null`. | ||
* @prop length - The length of the product variant. It can possibly be `null`. | ||
* @prop height - The height of the product variant. It can possibly be `null`. | ||
* @prop width - The width of the product variant. It can possibly be `null`. | ||
* @prop options - The associated product options. It may only be available if the `options` relation is expanded. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop product - The associated product. It may only be available if the `product` relation is expanded. | ||
* @prop product_id - The ID of the associated product. | ||
* @prop variant_rank - The ranking of the variant among other variants associated with the product. It can possibly be `null`. | ||
* @prop created_at - When the product variant was created. | ||
* @prop updated_at - When the product variant was updated. | ||
* @prop deleted_at - When the product variant was deleted. | ||
*/ | ||
export interface ProductVariantDTO { | ||
@@ -133,3 +65,2 @@ id: string; | ||
product: ProductDTO; | ||
product_id: string; | ||
variant_rank?: number | null; | ||
@@ -140,19 +71,2 @@ created_at: string | Date; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product category's data. | ||
* | ||
* @prop id - The ID of the product category. | ||
* @prop name - The name of the product category. | ||
* @prop description - The description of the product category. | ||
* @prop handle - The handle of the product category. The handle can be used to create slug URL paths. | ||
* @prop is_active - Whether the product category is active. | ||
* @prop is_internal - Whether the product category is internal. This can be used to only show the product category to admins and hide it from customers. | ||
* @prop rank - The ranking of the product category among sibling categories. | ||
* @prop parent_category - The associated parent category. It may only be available if the `parent_category` relation is expanded. | ||
* @prop category_children - The associated child categories. It may only be available if the `category_children` relation is expanded. | ||
* @prop created_at - When the product category was created. | ||
* @prop updated_at - When the product category was updated. | ||
*/ | ||
export interface ProductCategoryDTO { | ||
@@ -171,56 +85,2 @@ id: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product category to create. | ||
* | ||
* @prop name - The product category's name. | ||
* @prop handle - The product category's handle. | ||
* @prop is_active - Whether the product category is active. | ||
* @prop is_internal - Whether the product category is internal. This can be used to only show the product category to admins and hide it from customers. | ||
* @prop rank - The ranking of the category among sibling categories. | ||
* @prop parent_category_id - The ID of the parent product category, if it has any. It may also be `null`. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface CreateProductCategoryDTO { | ||
name: string; | ||
handle?: string; | ||
is_active?: boolean; | ||
is_internal?: boolean; | ||
rank?: number; | ||
parent_category_id: string | null; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The data to update in a product category. | ||
* | ||
* @prop name - The name of the product category. | ||
* @prop handle - The handle of the product category. | ||
* @prop is_active - Whether the product category is active. | ||
* @prop is_internal - Whether the product category is internal. This can be used to only show the product category to admins and hide it from customers. | ||
* @prop rank - The ranking of the category among sibling categories. | ||
* @prop parent_category_id - The ID of the parent product category, if it has any. It may also be `null`. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface UpdateProductCategoryDTO { | ||
name?: string; | ||
handle?: string; | ||
is_active?: boolean; | ||
is_internal?: boolean; | ||
rank?: number; | ||
parent_category_id?: string | null; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product tag's data. | ||
* | ||
* @prop id - The ID of the product tag. | ||
* @prop value - The value of the product tag. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop products - The associated products. It may only be available if the `products` relation is expanded. | ||
*/ | ||
export interface ProductTagDTO { | ||
@@ -230,16 +90,4 @@ id: string; | ||
metadata?: Record<string, unknown> | null; | ||
products?: ProductDTO[]; | ||
products: ProductDTO[]; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product collection's data. | ||
* | ||
* @prop id - The ID of the product collection. | ||
* @prop title - The title of the product collection. | ||
* @prop handle - The handle of the product collection. The handle can be used to create slug URL paths. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop deleted_at - When the product collection was deleted. | ||
* @prop products - The associated products. It may only be available if the `products` relation is expanded. | ||
*/ | ||
export interface ProductCollectionDTO { | ||
@@ -251,14 +99,3 @@ id: string; | ||
deleted_at?: string | Date; | ||
products?: ProductDTO[]; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product type's data. | ||
* | ||
* @prop id - The ID of the product type. | ||
* @prop value - The value of the product type. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop deleted_at - When the product type was deleted. | ||
*/ | ||
export interface ProductTypeDTO { | ||
@@ -270,15 +107,2 @@ id: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product option's data. | ||
* | ||
* @prop id - The ID of the product option. | ||
* @prop title - The title of the product option. | ||
* @prop product - The associated product. It may only be available if the `product` relation is expanded. | ||
* @prop values - The associated product option values. It may only be available if the `values` relation is expanded. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop deleted_at - When the product option was deleted. | ||
* | ||
*/ | ||
export interface ProductOptionDTO { | ||
@@ -292,30 +116,2 @@ id: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The product image's data. | ||
* | ||
* @prop id - The ID of the product image. | ||
* @prop url - The URL of the product image. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop deleted_at - When the product image was deleted. | ||
*/ | ||
export interface ProductImageDTO { | ||
id: string; | ||
url: string; | ||
metadata?: Record<string, unknown> | null; | ||
deleted_at?: string | Date; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The product option value's data. | ||
* | ||
* @prop id - The ID of the product option value. | ||
* @prop value - The value of the product option value. | ||
* @prop option - The associated product option. It may only be available if the `option` relation is expanded. | ||
* @prop variant - The associated product variant. It may only be available if the `variant` relation is expanded. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
* @prop deleted_at - When the product option value was deleted. | ||
*/ | ||
export interface ProductOptionValueDTO { | ||
@@ -330,15 +126,5 @@ id: string; | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved products. | ||
* | ||
* @prop q - Search through the products' attributes, such as titles and descriptions, using this search term. | ||
* @prop handle - The handles to filter products by. | ||
* @prop id - The IDs to filter products by. | ||
* @prop tags - Filters on a product's tags. | ||
* @prop categories - Filters on a product's categories. | ||
* @prop collection_id - Filters a product by its associated collections. | ||
* Filters/Config (module API input filters and config) | ||
*/ | ||
export interface FilterableProductProps extends BaseFilterable<FilterableProductProps> { | ||
q?: string; | ||
handle?: string | string[]; | ||
@@ -351,16 +137,5 @@ id?: string | string[]; | ||
id?: string | string[] | OperatorMap<string>; | ||
is_internal?: boolean; | ||
is_active?: boolean; | ||
}; | ||
category_id?: string | string[] | OperatorMap<string>; | ||
collection_id?: string | string[] | OperatorMap<string>; | ||
category_ids?: string | string[] | OperatorMap<string>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved product tags. | ||
* | ||
* @prop id - The IDs to filter product tags by. | ||
* @prop value - The value to filter product tags by. | ||
*/ | ||
export interface FilterableProductTagProps extends BaseFilterable<FilterableProductTagProps> { | ||
@@ -370,55 +145,9 @@ id?: string | string[]; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved product types. | ||
* | ||
* @prop id - The IDs to filter product types by. | ||
* @prop value - The value to filter product types by. | ||
*/ | ||
export interface FilterableProductTypeProps extends BaseFilterable<FilterableProductTypeProps> { | ||
id?: string | string[]; | ||
value?: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved product options. | ||
* | ||
* @prop id - The IDs to filter product options by. | ||
* @prop title - The titles to filter product options by. | ||
* @prop product_id - Filter the product options by their associated products' IDs. | ||
*/ | ||
export interface FilterableProductOptionProps extends BaseFilterable<FilterableProductOptionProps> { | ||
id?: string | string[]; | ||
title?: string; | ||
product_id?: string | string[]; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved product collections. | ||
* | ||
* @prop id - The IDs to filter product collections by. | ||
* @prop title - The title to filter product collections by. | ||
*/ | ||
export interface FilterableProductCollectionProps extends BaseFilterable<FilterableProductCollectionProps> { | ||
id?: string | string[]; | ||
handle?: string | string[]; | ||
title?: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved product variants. | ||
* | ||
* @prop id - The IDs to filter product variants by. | ||
* @prop sku - The SKUs to filter product variants by. | ||
* @prop product_id - Filter the product variants by their associated products' IDs. | ||
* @prop options - Filter product variants by their associated options. | ||
*/ | ||
export interface FilterableProductVariantProps extends BaseFilterable<FilterableProductVariantProps> { | ||
id?: string | string[]; | ||
sku?: string | string[]; | ||
product_id?: string | string[]; | ||
options?: { | ||
@@ -428,18 +157,4 @@ id?: string[]; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The filters to apply on retrieved product categories. | ||
* | ||
* @prop id - The IDs to filter product categories by. | ||
* @prop name - The names to filter product categories by. | ||
* @prop parent_category_id - Filter product categories by their parent category's ID. | ||
* @prop handle - The handles to filter product categories by. | ||
* @prop is_active - Filter product categories by whether they're active. | ||
* @prop is_internal - Filter product categories by whether they're internal. | ||
* @prop include_descendants_tree - Whether to include children of retrieved product categories. | ||
*/ | ||
export interface FilterableProductCategoryProps extends BaseFilterable<FilterableProductCategoryProps> { | ||
id?: string | string[]; | ||
name?: string | string[]; | ||
parent_category_id?: string | string[] | null; | ||
@@ -451,431 +166,1 @@ handle?: string | string[]; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product collection to create. | ||
* | ||
* @prop title - The product collection's title. | ||
* @prop handle - The product collection's handle. If not provided, the value of this attribute is set to the slug version of the title. | ||
* @prop products - The products to associate with the collection. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface CreateProductCollectionDTO { | ||
title: string; | ||
handle?: string; | ||
product_ids?: string[]; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The data to update in a product collection. The `id` is used to identify which product collection to update. | ||
* | ||
* @prop id - The ID of the product collection to update. | ||
* @prop value - The value of the product collection. | ||
* @prop title - The title of the product collection. | ||
* @prop handle - The handle of the product collection. | ||
* @prop product_ids - The IDs of the products to associate with the product collection. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface UpdateProductCollectionDTO { | ||
id: string; | ||
value?: string; | ||
title?: string; | ||
handle?: string; | ||
product_ids?: string[]; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product type to create. | ||
* | ||
* @prop id - The product type's ID. | ||
* @prop value - The product type's value. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface CreateProductTypeDTO { | ||
id?: string; | ||
value: string; | ||
metadata?: Record<string, unknown>; | ||
} | ||
export interface UpsertProductTypeDTO { | ||
id?: string; | ||
value: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The data to update in a product type. The `id` is used to identify which product type to update. | ||
* | ||
* @prop id - The ID of the product type to update. | ||
* @prop value - The new value of the product type. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface UpdateProductTypeDTO { | ||
id: string; | ||
value?: string; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product tag to create. | ||
* | ||
* @prop value - The value of the product tag. | ||
*/ | ||
export interface CreateProductTagDTO { | ||
value: string; | ||
} | ||
export interface UpsertProductTagDTO { | ||
id?: string; | ||
value: string; | ||
} | ||
/** | ||
* | ||
* @interface | ||
* | ||
* The data to update in a product tag. The `id` is used to identify which product tag to update. | ||
* | ||
* @prop id - The ID of the product tag to update. | ||
* @prop value - The value of the product tag. | ||
*/ | ||
export interface UpdateProductTagDTO { | ||
id: string; | ||
value?: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product option to create. | ||
* | ||
* @prop title - The product option's title. | ||
* @prop product_id - The ID of the associated product. | ||
*/ | ||
export interface CreateProductOptionDTO { | ||
title: string; | ||
product_id?: string; | ||
} | ||
export interface UpdateProductOptionDTO { | ||
id: string; | ||
title?: string; | ||
product_id?: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product variant option to create. | ||
* | ||
* @prop value - The value of a product variant option. | ||
*/ | ||
export interface CreateProductVariantOptionDTO { | ||
value: string; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product variant to create. | ||
* | ||
* @prop title - The tile of the product variant. | ||
* @prop sku - The SKU of the product variant. | ||
* @prop barcode - The barcode of the product variant. | ||
* @prop ean - The EAN of the product variant. | ||
* @prop upc - The UPC of the product variant. | ||
* @prop allow_backorder - Whether the product variant can be ordered when it's out of stock. | ||
* @prop inventory_quantity - The inventory quantiy of the product variant. | ||
* @prop manage_inventory - Whether the product variant's inventory should be managed by the core system. | ||
* @prop hs_code - The HS Code of the product variant. | ||
* @prop origin_country - The origin country of the product variant. | ||
* @prop mid_code - The MID Code of the product variant. | ||
* @prop material - The material of the product variant. | ||
* @prop weight - The weight of the product variant. | ||
* @prop length - The length of the product variant. | ||
* @prop height - The height of the product variant. | ||
* @prop width - The width of the product variant. | ||
* @prop options - The product variant options to create and associate with the product variant. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface CreateProductVariantDTO { | ||
title: string; | ||
sku?: string; | ||
barcode?: string; | ||
ean?: string; | ||
upc?: string; | ||
allow_backorder?: boolean; | ||
inventory_quantity?: number; | ||
manage_inventory?: boolean; | ||
hs_code?: string; | ||
origin_country?: string; | ||
mid_code?: string; | ||
material?: string; | ||
weight?: number; | ||
length?: number; | ||
height?: number; | ||
width?: number; | ||
options?: CreateProductVariantOptionDTO[]; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The data to update in a product variant. The `id` is used to identify which product variant to update. | ||
* | ||
* @prop id - The ID of the product variant to update. | ||
* @prop title - The tile of the product variant. | ||
* @prop sku - The SKU of the product variant. | ||
* @prop barcode - The barcode of the product variant. | ||
* @prop ean - The EAN of the product variant. | ||
* @prop upc - The UPC of the product variant. | ||
* @prop allow_backorder - Whether the product variant can be ordered when it's out of stock. | ||
* @prop inventory_quantity - The inventory quantiy of the product variant. | ||
* @prop manage_inventory - Whether the product variant's inventory should be managed by the core system. | ||
* @prop hs_code - The HS Code of the product variant. | ||
* @prop origin_country - The origin country of the product variant. | ||
* @prop mid_code - The MID Code of the product variant. | ||
* @prop material - The material of the product variant. | ||
* @prop weight - The weight of the product variant. | ||
* @prop length - The length of the product variant. | ||
* @prop height - The height of the product variant. | ||
* @prop width - The width of the product variant. | ||
* @prop options - The product variant options to create and associate with the product variant. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface UpdateProductVariantDTO { | ||
id: string; | ||
title?: string; | ||
sku?: string; | ||
barcode?: string; | ||
ean?: string; | ||
upc?: string; | ||
allow_backorder?: boolean; | ||
inventory_quantity?: number; | ||
manage_inventory?: boolean; | ||
hs_code?: string; | ||
origin_country?: string; | ||
mid_code?: string; | ||
material?: string; | ||
weight?: number; | ||
length?: number; | ||
height?: number; | ||
width?: number; | ||
options?: CreateProductVariantOptionDTO[]; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* A product to create. | ||
* | ||
* @prop title - The title of the product. | ||
* @prop subtitle - The subttle of the product. | ||
* @prop description - The description of the product. | ||
* @prop is_giftcard - Whether the product is a gift card. | ||
* @prop discountable - Whether the product can be discounted. | ||
* @prop images - | ||
* The product's images. If an array of strings is supplied, each string will be a URL and a `ProductImage` will be created | ||
* and associated with the product. If an array of objects is supplied, you can pass along the ID of an existing `ProductImage`. | ||
* @prop thumbnail - The URL of the product's thumbnail. | ||
* @prop handle - | ||
* 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. | ||
* @prop status - The status of the product. Its value can be one of the values of the enum {@link ProductStatus}. | ||
* @prop type - The product type to create and associate with the product. | ||
* @prop type_id - The product type to be associated with the product. | ||
* @prop collection_id - The product collection to be associated with the product. | ||
* @prop tags - The product tags to be created and associated with the product. | ||
* @prop categories - The product categories to associate with the product. | ||
* @prop options - The product options to be created and associated with the product. | ||
* @prop variants - The product variants to be created and associated with the product. | ||
* @prop width - The width of the product. | ||
* @prop height - The height of the product. | ||
* @prop length - The length of the product. | ||
* @prop weight - The weight of the product. | ||
* @prop origin_country - The origin country of the product. | ||
* @prop hs_code - The HS Code of the product. | ||
* @prop material - The material of the product. | ||
* @prop mid_code - The MID Code of the product. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface CreateProductDTO { | ||
title: string; | ||
subtitle?: string; | ||
description?: string; | ||
is_giftcard?: boolean; | ||
discountable?: boolean; | ||
images?: string[] | { | ||
id?: string; | ||
url: string; | ||
}[]; | ||
thumbnail?: string; | ||
handle?: string; | ||
status?: ProductStatus; | ||
type?: CreateProductTypeDTO; | ||
type_id?: string; | ||
collection_id?: string; | ||
tags?: CreateProductTagDTO[]; | ||
categories?: { | ||
id: string; | ||
}[]; | ||
options?: CreateProductOptionDTO[]; | ||
variants?: CreateProductVariantDTO[]; | ||
width?: number; | ||
height?: number; | ||
length?: number; | ||
weight?: number; | ||
origin_country?: string; | ||
hs_code?: string; | ||
material?: string; | ||
mid_code?: string; | ||
metadata?: Record<string, unknown>; | ||
} | ||
/** | ||
* @interface | ||
* | ||
* The data to update in a product. The `id` is used to identify which product to update. | ||
* | ||
* @prop id - The ID of the product to update. | ||
* @prop title - The title of the product. | ||
* @prop subtitle - The subttle of the product. | ||
* @prop description - The description of the product. | ||
* @prop is_giftcard - Whether the product is a gift card. | ||
* @prop discountable - Whether the product can be discounted. | ||
* @prop images - | ||
* The product's images. If an array of strings is supplied, each string will be a URL and a `ProductImage` will be created | ||
* and associated with the product. If an array of objects is supplied, you can pass along the ID of an existing `ProductImage`. | ||
* @prop thumbnail - The URL of the product's thumbnail. | ||
* @prop handle - | ||
* 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. | ||
* @prop status - The status of the product. Its value can be one of the values of the enum {@link ProductStatus}. | ||
* @prop type - The product type to create and associate with the product. | ||
* @prop type_id - The product type to be associated with the product. | ||
* @prop collection_id - The product collection to be associated with the product. | ||
* @prop tags - The product tags to be created and associated with the product. | ||
* @prop categories - The product categories to associate with the product. | ||
* @prop options - The product options to be created and associated with the product. | ||
* @prop variants - | ||
* The product variants to be created and associated with the product. You can also update existing product variants associated with the product. | ||
* @prop width - The width of the product. | ||
* @prop height - The height of the product. | ||
* @prop length - The length of the product. | ||
* @prop weight - The weight of the product. | ||
* @prop origin_country - The origin country of the product. | ||
* @prop hs_code - The HS Code of the product. | ||
* @prop material - The material of the product. | ||
* @prop mid_code - The MID Code of the product. | ||
* @prop metadata - Holds custom data in key-value pairs. | ||
*/ | ||
export interface UpdateProductDTO { | ||
id: string; | ||
title?: string; | ||
subtitle?: string; | ||
description?: string; | ||
is_giftcard?: boolean; | ||
discountable?: boolean; | ||
images?: string[] | { | ||
id?: string; | ||
url: string; | ||
}[]; | ||
thumbnail?: string; | ||
handle?: string; | ||
status?: ProductStatus; | ||
type?: CreateProductTypeDTO; | ||
type_id?: string | null; | ||
collection_id?: string | null; | ||
tags?: CreateProductTagDTO[]; | ||
categories?: { | ||
id: string; | ||
}[]; | ||
options?: CreateProductOptionDTO[]; | ||
variants?: (CreateProductVariantDTO | UpdateProductVariantDTO)[]; | ||
width?: number; | ||
height?: number; | ||
length?: number; | ||
weight?: number; | ||
origin_country?: string; | ||
hs_code?: string; | ||
material?: string; | ||
mid_code?: string; | ||
metadata?: Record<string, unknown>; | ||
} | ||
export interface CreateProductOnlyDTO { | ||
title: string; | ||
subtitle?: string; | ||
description?: string; | ||
is_giftcard?: boolean; | ||
discountable?: boolean; | ||
images?: { | ||
id?: string; | ||
url: string; | ||
}[]; | ||
thumbnail?: string; | ||
handle?: string; | ||
status?: ProductStatus; | ||
collection_id?: string; | ||
width?: number; | ||
height?: number; | ||
length?: number; | ||
weight?: number; | ||
origin_country?: string; | ||
hs_code?: string; | ||
material?: string; | ||
mid_code?: string; | ||
metadata?: Record<string, unknown>; | ||
tags?: { | ||
id: string; | ||
}[]; | ||
categories?: { | ||
id: string; | ||
}[]; | ||
type_id?: string; | ||
} | ||
export interface CreateProductVariantOnlyDTO { | ||
title: string; | ||
sku?: string; | ||
barcode?: string; | ||
ean?: string; | ||
upc?: string; | ||
allow_backorder?: boolean; | ||
inventory_quantity?: number; | ||
manage_inventory?: boolean; | ||
hs_code?: string; | ||
origin_country?: string; | ||
mid_code?: string; | ||
material?: string; | ||
weight?: number; | ||
length?: number; | ||
height?: number; | ||
width?: number; | ||
options?: (CreateProductVariantOptionDTO & { | ||
option: any; | ||
})[]; | ||
metadata?: Record<string, unknown>; | ||
} | ||
export interface UpdateProductVariantOnlyDTO { | ||
id: string; | ||
title?: string; | ||
sku?: string; | ||
barcode?: string; | ||
ean?: string; | ||
upc?: string; | ||
allow_backorder?: boolean; | ||
inventory_quantity?: number; | ||
manage_inventory?: boolean; | ||
hs_code?: string; | ||
origin_country?: string; | ||
mid_code?: string; | ||
material?: string; | ||
weight?: number; | ||
length?: number; | ||
height?: number; | ||
width?: number; | ||
options?: (CreateProductVariantOptionDTO & { | ||
option: any; | ||
})[]; | ||
metadata?: Record<string, unknown>; | ||
} | ||
export interface CreateProductOptionOnlyDTO { | ||
product_id?: string; | ||
product?: Record<any, any>; | ||
title: string; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ProductStatus = void 0; | ||
/** | ||
* @enum | ||
*/ | ||
var ProductStatus; | ||
@@ -13,3 +10,3 @@ (function (ProductStatus) { | ||
ProductStatus["REJECTED"] = "rejected"; | ||
})(ProductStatus || (exports.ProductStatus = ProductStatus = {})); | ||
})(ProductStatus = exports.ProductStatus || (exports.ProductStatus = {})); | ||
//# sourceMappingURL=common.js.map |
@@ -0,2 +1,2 @@ | ||
export * from "./service"; | ||
export * from "./common"; | ||
export * from "./service"; |
@@ -17,4 +17,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./service"), exports); | ||
__exportStar(require("./common"), exports); | ||
__exportStar(require("./service"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -0,4 +1,6 @@ | ||
export * from "./index-types"; | ||
export * from "./interface"; | ||
export * from "./settings"; | ||
export type IndexSettings = { | ||
export * from "./variant-keys"; | ||
export declare type IndexSettings = { | ||
/** | ||
@@ -5,0 +7,0 @@ * Settings specific to the provider. E.g. `searchableAttributes`. |
@@ -17,4 +17,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./index-types"), exports); | ||
__exportStar(require("./interface"), exports); | ||
__exportStar(require("./settings"), exports); | ||
__exportStar(require("./variant-keys"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export type IndexSettings = { | ||
export declare type IndexSettings = { | ||
/** | ||
@@ -3,0 +3,0 @@ * Settings specific to the provider. E.g. `searchableAttributes`. |
import { EntityManager } from "typeorm"; | ||
export type SharedContext = { | ||
export declare type SharedContext = { | ||
transactionManager?: EntityManager; | ||
manager?: EntityManager; | ||
}; | ||
/** | ||
* @internal The interface tag is used to ensure that the type is documented similar to interfaces. | ||
* @interface | ||
* | ||
* A shared context object that is used to share resources between the application and the module. | ||
* | ||
* @prop transactionManager - An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`. | ||
* @prop manager - An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`. | ||
* @prop isolationLevel - A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`. | ||
* @prop enableNestedTransactions - a boolean value indicating whether nested transactions are enabled. | ||
* @prop transactionId - a string indicating the ID of the current transaction. | ||
*/ | ||
export type Context<TManager = unknown> = { | ||
transactionManager?: TManager; | ||
manager?: TManager; | ||
isolationLevel?: string; | ||
enableNestedTransactions?: boolean; | ||
transactionId?: string; | ||
}; |
@@ -66,3 +66,3 @@ import { StringComparisonOperator } from "../common/common"; | ||
*/ | ||
export type StockLocationAddressDTO = { | ||
export declare type StockLocationAddressDTO = { | ||
id?: string; | ||
@@ -128,3 +128,3 @@ address_1: string; | ||
*/ | ||
export type StockLocationDTO = { | ||
export declare type StockLocationDTO = { | ||
id: string; | ||
@@ -148,6 +148,6 @@ name: string; | ||
*/ | ||
export type StockLocationExpandedDTO = StockLocationDTO & { | ||
export declare type StockLocationExpandedDTO = StockLocationDTO & { | ||
sales_channels?: any[]; | ||
}; | ||
export type FilterableStockLocationProps = { | ||
export declare type FilterableStockLocationProps = { | ||
id?: string | string[]; | ||
@@ -198,3 +198,3 @@ name?: string | string[] | StringComparisonOperator; | ||
*/ | ||
export type StockLocationAddressInput = { | ||
export declare type StockLocationAddressInput = { | ||
address_1: string; | ||
@@ -233,3 +233,3 @@ address_2?: string; | ||
*/ | ||
export type CreateStockLocationInput = { | ||
export declare type CreateStockLocationInput = { | ||
name: string; | ||
@@ -262,3 +262,3 @@ address_id?: string; | ||
*/ | ||
export type UpdateStockLocationInput = { | ||
export declare type UpdateStockLocationInput = { | ||
name?: string; | ||
@@ -265,0 +265,0 @@ address_id?: string; |
export * from "./common"; | ||
export * from "./service"; | ||
export * from "./stock-location"; |
@@ -18,3 +18,3 @@ "use strict"; | ||
__exportStar(require("./common"), exports); | ||
__exportStar(require("./service"), exports); | ||
__exportStar(require("./stock-location"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ivfuture/ecomm-types", | ||
"version": "1.1.1", | ||
"version": "1.1.2-cibo.0", | ||
"description": "Medusa Types definition", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
@@ -24,14 +23,14 @@ "type": "git", | ||
"ioredis": "^5.2.5", | ||
"rimraf": "^5.0.1", | ||
"typeorm": "^0.3.16", | ||
"typescript": "^5.1.6", | ||
"typescript": "^4.4.4", | ||
"winston": "^3.8.2" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "cross-env NODE_ENV=production tsc --build", | ||
"build": "rimraf dist && tsc --build", | ||
"build:prod": "cross-env NODE_ENV=production yarn run build", | ||
"build": "tsc --build", | ||
"watch": "tsc --build --watch", | ||
"test": "exit 0", | ||
"clean": "rm -rf dist" | ||
} | ||
}, | ||
"gitHead": "57764f52c49c8821ee40d2f28a3ba23aaa015640" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
71859
113
1669
2
1