/** * Prettify complex types to a flat object structure */ export type Prettify = { [K in keyof T]: T[K]; } & {}; /** * Utility type used to remove some optional attributes (coming from K) from a type T */ export type WithRequiredProperty = T & { [Property in K]-?: T[Property]; }; /** * @ignore */ export type PartialPick = { [P in K]?: T[P]; }; /** * Representing a table in the database. */ export interface BaseEntity { /** * The ID of an entity's record. */ id: string; /** * The date an entity's record was created. */ created_at: Date; /** * The date an entity's record was updated. */ updated_at: Date; } /** * Representing a deletable entity. */ export interface SoftDeletableEntity extends BaseEntity { /** * The date an entity's record was deleted. */ deleted_at: Date | null; } /** * Temporary type fixing to allow any level of orders until we get to properly clean all the types */ export type FindConfigOrder = { [Key: string]: "ASC" | "DESC" | (string & {}) | FindConfigOrder; }; /** * @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. */ export interface FindConfig { /** * An array of strings, each being attribute names of the entity to retrieve in the result. */ select?: (keyof Entity | (string & {}))[]; /** * A number indicating the number of records to skip before retrieving the results. */ skip?: number | null | undefined; /** * A number indicating the number of records to return in the result. */ take?: number | null | undefined; /** * An array of strings, each being relation names of the entity to retrieve in the result. * * You can only retrieve data models defined in the same module. To retrieve linked data models * from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead. */ relations?: string[]; /** * 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. */ order?: FindConfigOrder; /** * 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. */ withDeleted?: boolean; /** * Enable ORM specific defined filters */ filters?: Record; /** * Enable ORM specific defined options */ options?: Record; } /** * @ignore */ export type TotalField = "shipping_total" | "discount_total" | "tax_total" | "refunded_total" | "total" | "subtotal" | "refundable_amount" | "gift_card_total" | "gift_card_tax_total"; /** * @interface * * Fields that can be passed in the query parameters of a request. */ export type RequestQueryFields = { /** * Comma-separated fields that should be included in the returned data. * if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. * without prefix it will replace the entire default fields. */ fields?: string; /** * The number of items to skip when retrieving a list. */ offset?: number; /** * Limit the number of items returned in the list. */ limit?: number; /** * The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`. */ order?: string; /** * Whether to include deleted records in the result. */ with_deleted?: boolean; }; /** * Requests that don't accept any query parameters can use this type. */ export interface EmptyQueryParams { } export interface RepositoryTransformOptions { } /** * Fields used to apply flexible filters on dates. */ export interface DateComparisonOperator { /** * The filtered date must be less than this value. */ lt?: Date; /** * The filtered date must be greater than this value. */ gt?: Date; /** * The filtered date must be greater than or equal to this value. */ gte?: Date; /** * The filtered date must be less than or equal to this value. */ lte?: Date; } /** * Fields used to apply flexible filters on strings. */ export interface StringComparisonOperator { /** * The filtered string must be less than this value. */ lt?: string; /** * The filtered string must be greater than this value. */ gt?: string; /** * The filtered string must be greater than or equal to this value. */ gte?: string; /** * The filtered string must be less than or equal to this value. */ lte?: string; /** * The filtered string must contain this value. */ contains?: string; /** * The filtered string must start with this value. */ starts_with?: string; /** * The filtered string must end with this value. */ ends_with?: string; } /** * Fields used to apply flexible filters on numbers. */ export interface NumericalComparisonOperator { /** * The filtered number must be less than this value. */ lt?: number; /** * The filtered number must be greater than this value. */ gt?: number; /** * The filtered number must be greater than or equal to this value. */ gte?: number; /** * The filtered number must be less than or equal to this value. */ lte?: number; } /** * The keywords that does not have a plural form */ type UncountableRules = "adulthood" | "advice" | "agenda" | "aid" | "aircraft" | "alcohol" | "ammo" | "analytics" | "anime" | "athletics" | "audio" | "bison" | "blood" | "bream" | "buffalo" | "butter" | "carp" | "cash" | "chassis" | "chess" | "clothing" | "cod" | "commerce" | "cooperation" | "corps" | "debris" | "diabetes" | "digestion" | "elk" | "energy" | "equipment" | "excretion" | "expertise" | "firmware" | "flounder" | "fun" | "gallows" | "garbage" | "graffiti" | "hardware" | "headquarters" | "health" | "herpes" | "highjinks" | "homework" | "housework" | "information" | "jeans" | "justice" | "kudos" | "labour" | "literature" | "machinery" | "mackerel" | "mail" | "media" | "mews" | "moose" | "music" | "mud" | "manga" | "news" | "only" | "personnel" | "pike" | "plankton" | "pliers" | "police" | "pollution" | "premises" | "rain" | "research" | "rice" | "salmon" | "scissors" | "series" | "sewage" | "shambles" | "shrimp" | "software" | "staff" | "swine" | "tennis" | "traffic" | "transportation" | "trout" | "tuna" | "wealth" | "welfare" | "whiting" | "wildebeest" | "wildlife" | "you" | "deer" | "sheep" | "info"; type PluralizationSpecialRules = { person: "people"; child: "children"; man: "men"; criterion: "criteria"; tooth: "teeth"; foot: "feet"; }; /** * @ignore */ export type Pluralize = Lowercase extends keyof PluralizationSpecialRules ? PluralizationSpecialRules[Lowercase] : Lowercase extends UncountableRules ? Singular : Singular extends `${string}ss` ? `${Singular}es` : Singular extends `${infer R}sis` ? `${R}ses` : Singular extends `${infer R}is` ? `${R}ises` : Singular extends `${string}s` ? `${Singular}` : Singular extends `${infer R}ay` ? `${R}ays` : Singular extends `${infer R}ey` ? `${R}eys` : Singular extends `${infer R}iy` ? `${R}iys` : Singular extends `${infer R}oy` ? `${R}oys` : Singular extends `${infer R}uy` ? `${R}uys` : Singular extends `${infer R}y` ? `${R}ies` : Singular extends `${string}es` ? `${Singular}` : Singular extends `${string}sh` | `${string}ch` | `${string}x` | `${string}z` | `${string}o` ? `${Singular}es` : Singular extends `${infer R}fe` ? `${R}ves` : Singular extends `${infer R}ex` | `${infer R}ix` ? `${R}ices` : Singular extends `${infer R}eau` ? `${R}eaux` : Singular extends `${infer R}ieu` ? `${R}ieux` : `${Singular}s`; export type SnakeCase = S extends `${infer T}${infer U}${infer V}` ? U extends Uppercase ? `${Lowercase}_${SnakeCase<`${Lowercase}${V}`>}` : `${T}${SnakeCase<`${U}${V}`>}` : S; export type KebabCase = S extends `${infer T}${infer U}${infer V}` ? U extends Uppercase ? `${Lowercase}-${KebabCase<`${Lowercase}${V}`>}` : `${T}${KebabCase<`${U}${V}`>}` : S; export type MetadataType = Record | null; export type RawRounding = { value: string; precision: number; }; /** * @ignore */ export type QueryConfig = { /** * Default fields and relations to return. * use `*` or `.*` to select all fields from a relations (e.g '*products' or 'products.*' will select all products properties) */ defaults?: (keyof TEntity | string)[]; /** * Fields and relations that are allowed to be requested. * Symbol such as `*`, `+` and `-` should be removed as they dont make sense for * the authorization search. */ allowed?: string[]; defaultLimit?: number; /** * If the route that will use that configuration is supposed to return a list of entities. This * will change the configuration that will be created on req.listConfig and req.queryConfig (among * other things it will include pagination and sorting) */ isList?: boolean; }; export type TransformObjectMethodToAsync = { [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => Promise> : T[K] extends object ? TransformObjectMethodToAsync : T[K]; }; export type QueryContextType = Record & { __type?: "QueryContext"; }; export {}; //# sourceMappingURL=common.d.ts.map