content
stringlengths 29
370k
|
---|
---
title: "JobState"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## JobState
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="2174" packageName="@vendure/common" />
The state of a Job in the JobQueue
```ts title="Signature"
enum JobState {
CANCELLED = 'CANCELLED'
COMPLETED = 'COMPLETED'
FAILED = 'FAILED'
PENDING = 'PENDING'
RETRYING = 'RETRYING'
RUNNING = 'RUNNING'
}
```
|
---
title: "JsonCompatible"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## JsonCompatible
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="52" packageName="@vendure/common" />
A type representing JSON-compatible values.
From https://github.com/microsoft/TypeScript/issues/1897#issuecomment-580962081
```ts title="Signature"
type JsonCompatible<T> = {
[P in keyof T]: T[P] extends Json
? T[P]
: Pick<T, P> extends Required<Pick<T, P>>
? never
: JsonCompatible<T[P]>;
}
```
|
---
title: "LanguageCode"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## LanguageCode
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="2192" packageName="@vendure/common" />
Languages in the form of a ISO 639-1 language code with optional
region or script modifier (e.g. de_AT). The selection available is based
on the [Unicode CLDR summary list](https://unicode-org.github.io/cldr-staging/charts/37/summary/root.html)
and includes the major spoken languages of the world and any widely-used variants.
```ts title="Signature"
enum LanguageCode {
af = 'af'
ak = 'ak'
am = 'am'
ar = 'ar'
as = 'as'
az = 'az'
be = 'be'
bg = 'bg'
bm = 'bm'
bn = 'bn'
bo = 'bo'
br = 'br'
bs = 'bs'
ca = 'ca'
ce = 'ce'
co = 'co'
cs = 'cs'
cu = 'cu'
cy = 'cy'
da = 'da'
de = 'de'
de_AT = 'de_AT'
de_CH = 'de_CH'
dz = 'dz'
ee = 'ee'
el = 'el'
en = 'en'
en_AU = 'en_AU'
en_CA = 'en_CA'
en_GB = 'en_GB'
en_US = 'en_US'
eo = 'eo'
es = 'es'
es_ES = 'es_ES'
es_MX = 'es_MX'
et = 'et'
eu = 'eu'
fa = 'fa'
fa_AF = 'fa_AF'
ff = 'ff'
fi = 'fi'
fo = 'fo'
fr = 'fr'
fr_CA = 'fr_CA'
fr_CH = 'fr_CH'
fy = 'fy'
ga = 'ga'
gd = 'gd'
gl = 'gl'
gu = 'gu'
gv = 'gv'
ha = 'ha'
he = 'he'
hi = 'hi'
hr = 'hr'
ht = 'ht'
hu = 'hu'
hy = 'hy'
ia = 'ia'
id = 'id'
ig = 'ig'
ii = 'ii'
is = 'is'
it = 'it'
ja = 'ja'
jv = 'jv'
ka = 'ka'
ki = 'ki'
kk = 'kk'
kl = 'kl'
km = 'km'
kn = 'kn'
ko = 'ko'
ks = 'ks'
ku = 'ku'
kw = 'kw'
ky = 'ky'
la = 'la'
lb = 'lb'
lg = 'lg'
ln = 'ln'
lo = 'lo'
lt = 'lt'
lu = 'lu'
lv = 'lv'
mg = 'mg'
mi = 'mi'
mk = 'mk'
ml = 'ml'
mn = 'mn'
mr = 'mr'
ms = 'ms'
mt = 'mt'
my = 'my'
nb = 'nb'
nd = 'nd'
ne = 'ne'
nl = 'nl'
nl_BE = 'nl_BE'
nn = 'nn'
ny = 'ny'
om = 'om'
or = 'or'
os = 'os'
pa = 'pa'
pl = 'pl'
ps = 'ps'
pt = 'pt'
pt_BR = 'pt_BR'
pt_PT = 'pt_PT'
qu = 'qu'
rm = 'rm'
rn = 'rn'
ro = 'ro'
ro_MD = 'ro_MD'
ru = 'ru'
rw = 'rw'
sa = 'sa'
sd = 'sd'
se = 'se'
sg = 'sg'
si = 'si'
sk = 'sk'
sl = 'sl'
sm = 'sm'
sn = 'sn'
so = 'so'
sq = 'sq'
sr = 'sr'
st = 'st'
su = 'su'
sv = 'sv'
sw = 'sw'
sw_CD = 'sw_CD'
ta = 'ta'
te = 'te'
tg = 'tg'
th = 'th'
ti = 'ti'
tk = 'tk'
to = 'to'
tr = 'tr'
tt = 'tt'
ug = 'ug'
uk = 'uk'
ur = 'ur'
uz = 'uz'
vi = 'vi'
vo = 'vo'
wo = 'wo'
xh = 'xh'
yi = 'yi'
yo = 'yo'
zh = 'zh'
zh_Hans = 'zh_Hans'
zh_Hant = 'zh_Hant'
zu = 'zu'
}
```
|
---
title: "Middleware"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Middleware
<GenerationInfo sourceFile="packages/core/src/common/types/common-types.ts" sourceLine="212" packageName="@vendure/core" />
Defines API middleware, set in the <a href='/reference/typescript-api/configuration/api-options#apioptions'>ApiOptions</a>. Middleware can be either
[Express middleware](https://expressjs.com/en/guide/using-middleware.html) or [NestJS middleware](https://docs.nestjs.com/middleware).
## Increasing the maximum request body size limit
Internally, Vendure relies on the body-parser middleware to parse incoming JSON data. By default, the maximum
body size is set to 100kb. Attempting to send a request with more than 100kb of JSON data will result in a
`PayloadTooLargeError`. To increase this limit, we can manually configure the body-parser middleware:
*Example*
```ts
import { VendureConfig } from '@vendure/core';
import { json } from 'body-parser';
export const config: VendureConfig = {
// ...
apiOptions: {
middleware: [{
handler: json({ limit: '10mb' }),
route: '*',
beforeListen: true,
}],
},
};
```
```ts title="Signature"
interface Middleware {
handler: MiddlewareHandler;
route: string;
beforeListen?: boolean;
}
```
<div className="members-wrapper">
### handler
<MemberInfo kind="property" type={`MiddlewareHandler`} />
The Express middleware function or NestJS `NestMiddleware` class.
### route
<MemberInfo kind="property" type={`string`} />
The route to which this middleware will apply. Pattern based routes are supported as well.
The `'ab*cd'` route path will match `abcd`, `ab_cd`, `abecd`, and so on. The characters `?`, `+`, `*`, and `()` may be used in a route path,
and are subsets of their regular expression counterparts. The hyphen (`-`) and the dot (`.`) are interpreted literally.
### beforeListen
<MemberInfo kind="property" type={`boolean`} default="false" since="1.1.0" />
When set to `true`, this will cause the middleware to be applied before the Vendure server (and underlying Express server) starts listening
for connections. In practical terms this means that the middleware will be at the very start of the middleware stack, before even the
`body-parser` middleware which is automatically applied by NestJS. This can be useful in certain cases such as when you need to access the
raw unparsed request for a specific route.
</div>
|
---
title: "PaginatedList"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## PaginatedList
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="67" packageName="@vendure/common" />
A type describing the shape of a paginated list response. In Vendure, almost all list queries
(`products`, `collections`, `orders`, `customers` etc) return an object of this type.
```ts title="Signature"
type PaginatedList<T> = {
items: T[];
totalItems: number;
}
```
<div className="members-wrapper">
### items
<MemberInfo kind="property" type={`T[]`} />
### totalItems
<MemberInfo kind="property" type={`number`} />
</div>
|
---
title: "Permission"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Permission
<GenerationInfo sourceFile="packages/common/src/generated-types.ts" sourceLine="4326" packageName="@vendure/common" />
Permissions for administrators and customers. Used to control access to
GraphQL resolvers via the <a href='/reference/typescript-api/request/allow-decorator#allow'>Allow</a> decorator.
## Understanding Permission.Owner
`Permission.Owner` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only
be accessible to the "owner" of that resource.
For example, the Shop API `activeCustomer` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
based on the activeUserId of the current session. As a result, the resolver code looks like this:
*Example*
```TypeScript
@Query()
@Allow(Permission.Owner)
async activeCustomer(@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
const userId = ctx.activeUserId;
if (userId) {
return this.customerService.findOneByUserId(ctx, userId);
}
}
```
Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
nor statically encoded at build-time, any resolvers using `Permission.Owner` **must** include logic to enforce that only the owner
of the resource has access. If not, then it is the equivalent of using `Permission.Public`.
```ts title="Signature"
enum Permission {
Authenticated = 'Authenticated'
CreateAdministrator = 'CreateAdministrator'
CreateAsset = 'CreateAsset'
CreateCatalog = 'CreateCatalog'
CreateChannel = 'CreateChannel'
CreateCollection = 'CreateCollection'
CreateCountry = 'CreateCountry'
CreateCustomer = 'CreateCustomer'
CreateCustomerGroup = 'CreateCustomerGroup'
CreateFacet = 'CreateFacet'
CreateOrder = 'CreateOrder'
CreatePaymentMethod = 'CreatePaymentMethod'
CreateProduct = 'CreateProduct'
CreatePromotion = 'CreatePromotion'
CreateSeller = 'CreateSeller'
CreateSettings = 'CreateSettings'
CreateShippingMethod = 'CreateShippingMethod'
CreateStockLocation = 'CreateStockLocation'
CreateSystem = 'CreateSystem'
CreateTag = 'CreateTag'
CreateTaxCategory = 'CreateTaxCategory'
CreateTaxRate = 'CreateTaxRate'
CreateZone = 'CreateZone'
DeleteAdministrator = 'DeleteAdministrator'
DeleteAsset = 'DeleteAsset'
DeleteCatalog = 'DeleteCatalog'
DeleteChannel = 'DeleteChannel'
DeleteCollection = 'DeleteCollection'
DeleteCountry = 'DeleteCountry'
DeleteCustomer = 'DeleteCustomer'
DeleteCustomerGroup = 'DeleteCustomerGroup'
DeleteFacet = 'DeleteFacet'
DeleteOrder = 'DeleteOrder'
DeletePaymentMethod = 'DeletePaymentMethod'
DeleteProduct = 'DeleteProduct'
DeletePromotion = 'DeletePromotion'
DeleteSeller = 'DeleteSeller'
DeleteSettings = 'DeleteSettings'
DeleteShippingMethod = 'DeleteShippingMethod'
DeleteStockLocation = 'DeleteStockLocation'
DeleteSystem = 'DeleteSystem'
DeleteTag = 'DeleteTag'
DeleteTaxCategory = 'DeleteTaxCategory'
DeleteTaxRate = 'DeleteTaxRate'
DeleteZone = 'DeleteZone'
Owner = 'Owner'
Public = 'Public'
ReadAdministrator = 'ReadAdministrator'
ReadAsset = 'ReadAsset'
ReadCatalog = 'ReadCatalog'
ReadChannel = 'ReadChannel'
ReadCollection = 'ReadCollection'
ReadCountry = 'ReadCountry'
ReadCustomer = 'ReadCustomer'
ReadCustomerGroup = 'ReadCustomerGroup'
ReadFacet = 'ReadFacet'
ReadOrder = 'ReadOrder'
ReadPaymentMethod = 'ReadPaymentMethod'
ReadProduct = 'ReadProduct'
ReadPromotion = 'ReadPromotion'
ReadSeller = 'ReadSeller'
ReadSettings = 'ReadSettings'
ReadShippingMethod = 'ReadShippingMethod'
ReadStockLocation = 'ReadStockLocation'
ReadSystem = 'ReadSystem'
ReadTag = 'ReadTag'
ReadTaxCategory = 'ReadTaxCategory'
ReadTaxRate = 'ReadTaxRate'
ReadZone = 'ReadZone'
SuperAdmin = 'SuperAdmin'
UpdateAdministrator = 'UpdateAdministrator'
UpdateAsset = 'UpdateAsset'
UpdateCatalog = 'UpdateCatalog'
UpdateChannel = 'UpdateChannel'
UpdateCollection = 'UpdateCollection'
UpdateCountry = 'UpdateCountry'
UpdateCustomer = 'UpdateCustomer'
UpdateCustomerGroup = 'UpdateCustomerGroup'
UpdateFacet = 'UpdateFacet'
UpdateGlobalSettings = 'UpdateGlobalSettings'
UpdateOrder = 'UpdateOrder'
UpdatePaymentMethod = 'UpdatePaymentMethod'
UpdateProduct = 'UpdateProduct'
UpdatePromotion = 'UpdatePromotion'
UpdateSeller = 'UpdateSeller'
UpdateSettings = 'UpdateSettings'
UpdateShippingMethod = 'UpdateShippingMethod'
UpdateStockLocation = 'UpdateStockLocation'
UpdateSystem = 'UpdateSystem'
UpdateTag = 'UpdateTag'
UpdateTaxCategory = 'UpdateTaxCategory'
UpdateTaxRate = 'UpdateTaxRate'
UpdateZone = 'UpdateZone'
}
```
|
---
title: "PriceCalculationResult"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## PriceCalculationResult
<GenerationInfo sourceFile="packages/core/src/common/types/common-types.ts" sourceLine="174" packageName="@vendure/core" />
The result of the price calculation from the <a href='/reference/typescript-api/products-stock/product-variant-price-calculation-strategy#productvariantpricecalculationstrategy'>ProductVariantPriceCalculationStrategy</a> or the
<a href='/reference/typescript-api/orders/order-item-price-calculation-strategy#orderitempricecalculationstrategy'>OrderItemPriceCalculationStrategy</a>.
```ts title="Signature"
type PriceCalculationResult = {
price: number;
priceIncludesTax: boolean;
}
```
<div className="members-wrapper">
### price
<MemberInfo kind="property" type={`number`} />
### priceIncludesTax
<MemberInfo kind="property" type={`boolean`} />
</div>
|
---
title: "ProcessContext"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProcessContext
<GenerationInfo sourceFile="packages/core/src/process-context/process-context.ts" sourceLine="31" packageName="@vendure/core" />
The ProcessContext can be injected into your providers & modules in order to know whether it
is being executed in the context of the main Vendure server or the worker.
*Example*
```ts
import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
import { ProcessContext } from '@vendure/core';
@Injectable()
export class MyService implements OnApplicationBootstrap {
constructor(private processContext: ProcessContext) {}
onApplicationBootstrap() {
if (this.processContext.isServer) {
// code which will only execute when running in
// the server process
}
}
}
```
```ts title="Signature"
class ProcessContext {
isServer: boolean
isWorker: boolean
}
```
<div className="members-wrapper">
### isServer
<MemberInfo kind="property" type={`boolean`} />
### isWorker
<MemberInfo kind="property" type={`boolean`} />
</div>
|
---
title: "VENDURE_VERSION"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## VENDURE_VERSION
<GenerationInfo sourceFile="packages/core/src/version.ts" sourceLine="17" packageName="@vendure/core" since="2.0.0" />
A constant which holds the current version of the Vendure core. You can use
this when your code needs to know the version of Vendure which is running.
*Example*
```ts
import { VENDURE_VERSION } from '@vendure/core';
console.log('Vendure version:', VENDURE_VERSION);
```
|
---
title: "AdminUiAppConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AdminUiAppConfig
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="349" packageName="@vendure/common" />
Configures the path to a custom-build of the Admin UI app.
```ts title="Signature"
interface AdminUiAppConfig {
path: string;
route?: string;
compile?: () => Promise<void>;
}
```
<div className="members-wrapper">
### path
<MemberInfo kind="property" type={`string`} />
The path to the compiled admin UI app files. If not specified, an internal
default build is used. This path should contain the `vendure-ui-config.json` file,
index.html, the compiled js bundles etc.
### route
<MemberInfo kind="property" type={`string`} default="'admin'" />
Specifies the url route to the Admin UI app.
### compile
<MemberInfo kind="property" type={`() => Promise<void>`} />
The function which will be invoked to start the app compilation process.
</div>
|
---
title: "AdminUiAppDevModeConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AdminUiAppDevModeConfig
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="377" packageName="@vendure/common" />
Information about the Admin UI app dev server.
```ts title="Signature"
interface AdminUiAppDevModeConfig {
sourcePath: string;
port: number;
route?: string;
compile: () => Promise<void>;
}
```
<div className="members-wrapper">
### sourcePath
<MemberInfo kind="property" type={`string`} />
The path to the uncompiled UI app source files. This path should contain the `vendure-ui-config.json` file.
### port
<MemberInfo kind="property" type={`number`} />
The port on which the dev server is listening. Overrides the value set by `AdminUiOptions.port`.
### route
<MemberInfo kind="property" type={`string`} default="'admin'" />
Specifies the url route to the Admin UI app.
### compile
<MemberInfo kind="property" type={`() => Promise<void>`} />
The function which will be invoked to start the app compilation process.
</div>
|
---
title: "AdminUiConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AdminUiConfig
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="215" packageName="@vendure/common" />
This interface describes JSON config file (vendure-ui-config.json) used by the Admin UI.
The values are loaded at run-time by the Admin UI app, and allow core configuration to be
managed without the need to re-build the application.
```ts title="Signature"
interface AdminUiConfig {
apiHost: string | 'auto';
apiPort: number | 'auto';
adminApiPath: string;
tokenMethod: 'cookie' | 'bearer';
authTokenHeaderKey: string;
channelTokenKey: string;
defaultLanguage: LanguageCode;
defaultLocale?: string;
availableLanguages: LanguageCode[];
availableLocales: string[];
loginUrl?: string;
brand?: string;
hideVendureBranding?: boolean;
hideVersion?: boolean;
loginImageUrl?: string;
cancellationReasons?: string[];
}
```
<div className="members-wrapper">
### apiHost
<MemberInfo kind="property" type={`string | 'auto'`} default="'http://localhost'" />
The hostname of the Vendure server which the admin UI will be making API calls
to. If set to "auto", the Admin UI app will determine the hostname from the
current location (i.e. `window.location.hostname`).
### apiPort
<MemberInfo kind="property" type={`number | 'auto'`} default="3000" />
The port of the Vendure server which the admin UI will be making API calls
to. If set to "auto", the Admin UI app will determine the port from the
current location (i.e. `window.location.port`).
### adminApiPath
<MemberInfo kind="property" type={`string`} default="'admin-api'" />
The path to the GraphQL Admin API.
### tokenMethod
<MemberInfo kind="property" type={`'cookie' | 'bearer'`} default="'cookie'" />
Whether to use cookies or bearer tokens to track sessions.
Should match the setting of in the server's `tokenMethod` config
option.
### authTokenHeaderKey
<MemberInfo kind="property" type={`string`} default="'vendure-auth-token'" />
The header used when using the 'bearer' auth method. Should match the
setting of the server's `authOptions.authTokenHeaderKey` config option.
### channelTokenKey
<MemberInfo kind="property" type={`string`} default="'vendure-token'" />
The name of the header which contains the channel token. Should match the
setting of the server's `apiOptions.channelTokenKey` config option.
### defaultLanguage
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>`} default="<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>.en" />
The default language for the Admin UI. Must be one of the
items specified in the `availableLanguages` property.
### defaultLocale
<MemberInfo kind="property" type={`string`} since="2.2.0" />
The default locale for the Admin UI. The locale affects the formatting of
currencies & dates. Must be one of the items specified
in the `availableLocales` property.
If not set, the browser default locale will be used.
### availableLanguages
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>[]`} />
An array of languages for which translations exist for the Admin UI.
### availableLocales
<MemberInfo kind="property" type={`string[]`} since="2.2.0" />
An array of locales to be used on Admin UI.
### loginUrl
<MemberInfo kind="property" type={`string`} />
If you are using an external <a href='/reference/typescript-api/auth/authentication-strategy#authenticationstrategy'>AuthenticationStrategy</a> for the Admin API, you can configure
a custom URL for the login page with this option. On logging out or redirecting an unauthenticated
user, the Admin UI app will redirect the user to this URL rather than the default username/password
screen.
### brand
<MemberInfo kind="property" type={`string`} />
The custom brand name.
### hideVendureBranding
<MemberInfo kind="property" type={`boolean`} default="false" />
Option to hide vendure branding.
### hideVersion
<MemberInfo kind="property" type={`boolean`} default="false" />
Option to hide version.
### loginImageUrl
<MemberInfo kind="property" type={`string`} since="1.9.0" />
A url of a custom image to be used on the login screen, to override the images provided by Vendure's login image server.
### cancellationReasons
<MemberInfo kind="property" type={`string[]`} default="['order.cancel-reason-customer-request', 'order.cancel-reason-not-available']" since="1.5.0" />
Allows you to provide default reasons for a refund or cancellation. This will be used in the
refund/cancel dialog. The values can be literal strings (e.g. "Not in stock") or translation
tokens (see [Adding Admin UI Translations](/guides/extending-the-admin-ui/adding-ui-translations/)).
</div>
|
---
title: "Admin Ui"
isDefaultIndex: true
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
import DocCardList from '@theme/DocCardList';
<DocCardList /> |
---
title: "ConfigArgType"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ConfigArgType
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="126" packageName="@vendure/common" />
Certain entities (those which implement <a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a>) allow arbitrary
configuration arguments to be specified which can then be set in the admin-ui and used in
the business logic of the app. These are the valid data types of such arguments.
The data type influences:
1. How the argument form field is rendered in the admin-ui
2. The JavaScript type into which the value is coerced before being passed to the business logic.
```ts title="Signature"
type ConfigArgType = 'string' | 'int' | 'float' | 'boolean' | 'datetime' | 'ID'
```
|
---
title: "ConfigArgs"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ConfigArgs
<GenerationInfo sourceFile="packages/core/src/common/configurable-operation.ts" sourceLine="140" packageName="@vendure/core" />
A object which defines the configurable arguments which may be passed to
functions in those classes which implement the <a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a> interface.
## Data types
Each argument has a data type, which must be one of <a href='/reference/typescript-api/configurable-operation-def/config-arg-type#configargtype'>ConfigArgType</a>.
*Example*
```ts
{
apiKey: { type: 'string' },
maxRetries: { type: 'int' },
logErrors: { type: 'boolean' },
}
```
## Lists
Setting the `list` property to `true` will make the argument into an array of the specified
data type. For example, if you want to store an array of strings:
*Example*
```ts
{
aliases: {
type: 'string',
list: true,
},
}
```
In the Admin UI, this will be rendered as an orderable list of string inputs.
## UI Component
The `ui` field allows you to specify a specific input component to be used in the Admin UI.
When not set, a default input component is used appropriate to the data type.
*Example*
```ts
{
operator: {
type: 'string',
ui: {
component: 'select-form-input',
options: [
{ value: 'startsWith' },
{ value: 'endsWith' },
{ value: 'contains' },
{ value: 'doesNotContain' },
],
},
},
secretKey: {
type: 'string',
ui: { component: 'password-form-input' },
},
}
```
The available components as well as their configuration options can be found in the <a href='/reference/typescript-api/configurable-operation-def/default-form-config-hash#defaultformconfighash'>DefaultFormConfigHash</a> docs.
Custom UI components may also be defined via an Admin UI extension using the `registerFormInputComponent()` function
which is exported from `@vendure/admin-ui/core`.
```ts title="Signature"
type ConfigArgs = {
[name: string]: ConfigArgDef<ConfigArgType>;
}
```
<div className="members-wrapper">
### [index]
<MemberInfo kind="property" type={`ConfigArgDef<<a href='/reference/typescript-api/configurable-operation-def/config-arg-type#configargtype'>ConfigArgType</a>>`} />
</div>
|
---
title: "ConfigurableOperationDefOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ConfigurableOperationDefOptions
<GenerationInfo sourceFile="packages/core/src/common/configurable-operation.ts" sourceLine="230" packageName="@vendure/core" />
Common configuration options used when creating a new instance of a
<a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a> (
```ts title="Signature"
interface ConfigurableOperationDefOptions<T extends ConfigArgs> extends InjectableStrategy {
code: string;
args: T;
description: LocalizedStringArray;
}
```
* Extends: <code><a href='/reference/typescript-api/common/injectable-strategy#injectablestrategy'>InjectableStrategy</a></code>
<div className="members-wrapper">
### code
<MemberInfo kind="property" type={`string`} />
A unique code used to identify this operation.
### args
<MemberInfo kind="property" type={`T`} />
Optional provider-specific arguments which, when specified, are
editable in the admin-ui. For example, args could be used to store an API key
for a payment provider service.
*Example*
```ts
args: {
apiKey: { type: 'string' },
}
```
See <a href='/reference/typescript-api/configurable-operation-def/config-args#configargs'>ConfigArgs</a> for available configuration options.
### description
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/localized-string-array#localizedstringarray'>LocalizedStringArray</a>`} />
A human-readable description for the operation method.
</div>
|
---
title: "DefaultFormComponentId"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## DefaultFormComponentId
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="135" packageName="@vendure/common" />
The ids of the default form input components that ship with the
Admin UI.
```ts title="Signature"
type DefaultFormComponentId = | 'boolean-form-input'
| 'currency-form-input'
| 'customer-group-form-input'
| 'date-form-input'
| 'facet-value-form-input'
| 'json-editor-form-input'
| 'html-editor-form-input'
| 'number-form-input'
| 'password-form-input'
| 'product-selector-form-input'
| 'relation-form-input'
| 'rich-text-form-input'
| 'select-form-input'
| 'text-form-input'
| 'textarea-form-input'
| 'product-multi-form-input'
| 'combination-mode-form-input'
```
|
---
title: "DefaultFormConfigHash"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## DefaultFormConfigHash
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="160" packageName="@vendure/common" />
Used to define the expected arguments for a given default form input component.
```ts title="Signature"
type DefaultFormConfigHash = {
'boolean-form-input': Record<string, never>;
'currency-form-input': Record<string, never>;
'customer-group-form-input': Record<string, never>;
'date-form-input': { min?: string; max?: string; yearRange?: number };
'facet-value-form-input': Record<string, never>;
'json-editor-form-input': { height?: string };
'html-editor-form-input': { height?: string };
'number-form-input': { min?: number; max?: number; step?: number; prefix?: string; suffix?: string };
'password-form-input': Record<string, never>;
'product-selector-form-input': Record<string, never>;
'relation-form-input': Record<string, never>;
'rich-text-form-input': Record<string, never>;
'select-form-input': {
options?: Array<{ value: string; label?: Array<Omit<LocalizedString, '__typename'>> }>;
};
'text-form-input': { prefix?: string; suffix?: string };
'textarea-form-input': {
spellcheck?: boolean;
};
'product-multi-form-input': {
selectionMode?: 'product' | 'variant';
};
'combination-mode-form-input': Record<string, never>;
}
```
<div className="members-wrapper">
### 'boolean-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'currency-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'customer-group-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'date-form-input'
<MemberInfo kind="property" type={`{ min?: string; max?: string; yearRange?: number }`} />
### 'facet-value-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'json-editor-form-input'
<MemberInfo kind="property" type={`{ height?: string }`} />
### 'html-editor-form-input'
<MemberInfo kind="property" type={`{ height?: string }`} />
### 'number-form-input'
<MemberInfo kind="property" type={`{ min?: number; max?: number; step?: number; prefix?: string; suffix?: string }`} />
### 'password-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'product-selector-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'relation-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'rich-text-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
### 'select-form-input'
<MemberInfo kind="property" type={`{
options?: Array<{ value: string; label?: Array<Omit<LocalizedString, '__typename'>> }>;
}`} />
### 'text-form-input'
<MemberInfo kind="property" type={`{ prefix?: string; suffix?: string }`} />
### 'textarea-form-input'
<MemberInfo kind="property" type={`{
spellcheck?: boolean;
}`} />
### 'product-multi-form-input'
<MemberInfo kind="property" type={`{
selectionMode?: 'product' | 'variant';
}`} />
### 'combination-mode-form-input'
<MemberInfo kind="property" type={`Record<string, never>`} />
</div>
|
---
title: "ConfigurableOperationDef"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ConfigurableOperationDef
<GenerationInfo sourceFile="packages/core/src/common/configurable-operation.ts" sourceLine="335" packageName="@vendure/core" />
A ConfigurableOperationDef is a special type of object used extensively by Vendure to define
code blocks which have arguments which are configurable at run-time by the administrator.
This is the mechanism used by:
* <a href='/reference/typescript-api/configuration/collection-filter#collectionfilter'>CollectionFilter</a>
* <a href='/reference/typescript-api/payment/payment-method-handler#paymentmethodhandler'>PaymentMethodHandler</a>
* <a href='/reference/typescript-api/promotions/promotion-action#promotionaction'>PromotionAction</a>
* <a href='/reference/typescript-api/promotions/promotion-condition#promotioncondition'>PromotionCondition</a>
* <a href='/reference/typescript-api/shipping/shipping-calculator#shippingcalculator'>ShippingCalculator</a>
* <a href='/reference/typescript-api/shipping/shipping-eligibility-checker#shippingeligibilitychecker'>ShippingEligibilityChecker</a>
Any class which extends ConfigurableOperationDef works in the same way: it takes a
config object as the constructor argument. That config object extends the <a href='/reference/typescript-api/configurable-operation-def/configurable-operation-def-options#configurableoperationdefoptions'>ConfigurableOperationDefOptions</a>
interface and typically adds some kind of business logic function to it.
For example, in the case of `ShippingEligibilityChecker`,
it adds the `check()` function to the config object which defines the logic for checking whether an Order is eligible
for a particular ShippingMethod.
## The `args` property
The key feature of the ConfigurableOperationDef is the `args` property. This is where we define those
arguments that are exposed via the Admin UI as data input components. This allows their values to
be set at run-time by the Administrator. Those values can then be accessed in the business logic
of the operation.
The data type of the args can be one of <a href='/reference/typescript-api/configurable-operation-def/config-arg-type#configargtype'>ConfigArgType</a>, and the configuration is further explained in
the docs of <a href='/reference/typescript-api/configurable-operation-def/config-args#configargs'>ConfigArgs</a>.
## Dependency Injection
If your business logic relies on injectable providers, such as the `TransactionalConnection` object, or any of the
internal Vendure services or those defined in a plugin, you can inject them by using the config object's
`init()` method, which exposes the <a href='/reference/typescript-api/common/injector#injector'>Injector</a>.
Here's an example of a ShippingCalculator that injects a service which has been defined in a plugin:
*Example*
```ts
import { Injector, ShippingCalculator } from '@vendure/core';
import { ShippingRatesService } from './shipping-rates.service';
// We keep reference to our injected service by keeping it
// in the top-level scope of the file.
let shippingRatesService: ShippingRatesService;
export const customShippingCalculator = new ShippingCalculator({
code: 'custom-shipping-calculator',
description: [],
args: {},
init(injector: Injector) {
// The init function is called during bootstrap, and allows
// us to inject any providers we need.
shippingRatesService = injector.get(ShippingRatesService);
},
calculate: async (order, args) => {
// We can now use the injected provider in the business logic.
const { price, priceWithTax } = await shippingRatesService.getRate({
destination: order.shippingAddress,
contents: order.lines,
});
return {
price,
priceWithTax,
};
},
});
```
```ts title="Signature"
class ConfigurableOperationDef<T extends ConfigArgs = ConfigArgs> {
code: string
args: T
description: LocalizedStringArray
constructor(options: ConfigurableOperationDefOptions<T>)
init(injector: Injector) => ;
destroy() => ;
toGraphQlType(ctx: RequestContext) => ConfigurableOperationDefinition;
argsArrayToHash(args: ConfigArg[]) => ConfigArgValues<T>;
}
```
<div className="members-wrapper">
### code
<MemberInfo kind="property" type={`string`} />
### args
<MemberInfo kind="property" type={`T`} />
### description
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configurable-operation-def/localized-string-array#localizedstringarray'>LocalizedStringArray</a>`} />
### constructor
<MemberInfo kind="method" type={`(options: <a href='/reference/typescript-api/configurable-operation-def/configurable-operation-def-options#configurableoperationdefoptions'>ConfigurableOperationDefOptions</a><T>) => ConfigurableOperationDef`} />
### init
<MemberInfo kind="method" type={`(injector: <a href='/reference/typescript-api/common/injector#injector'>Injector</a>) => `} />
### destroy
<MemberInfo kind="method" type={`() => `} />
### toGraphQlType
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => ConfigurableOperationDefinition`} />
Convert a ConfigurableOperationDef into a ConfigurableOperationDefinition object, typically
so that it can be sent via the API.
### argsArrayToHash
<MemberInfo kind="method" type={`(args: ConfigArg[]) => ConfigArgValues<T>`} />
Coverts an array of ConfigArgs into a hash object:
from:
`[{ name: 'foo', type: 'string', value: 'bar'}]`
to:
`{ foo: 'bar' }`
</div>
|
---
title: "LocalizedStringArray"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## LocalizedStringArray
<GenerationInfo sourceFile="packages/core/src/common/configurable-operation.ts" sourceLine="43" packageName="@vendure/core" />
An array of string values in a given <a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>, used to define human-readable string values.
The `ui` property can be used in conjunction with the Vendure Admin UI to specify a custom form input
component.
*Example*
```ts
const title: LocalizedStringArray = [
{ languageCode: LanguageCode.en, value: 'English Title' },
{ languageCode: LanguageCode.de, value: 'German Title' },
{ languageCode: LanguageCode.zh, value: 'Chinese Title' },
]
```
```ts title="Signature"
type LocalizedStringArray = Array<Omit<LocalizedString, '__typename'>>
```
|
---
title: "Configuration"
weight: 10
date: 2023-07-14T16:57:49.490Z
showtoc: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
# configuration |
---
title: "ApiOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ApiOptions
<GenerationInfo sourceFile="packages/core/src/config/vendure-config.ts" sourceLine="67" packageName="@vendure/core" />
The ApiOptions define how the Vendure GraphQL APIs are exposed, as well as allowing the API layer
to be extended with middleware.
```ts title="Signature"
interface ApiOptions {
hostname?: string;
port: number;
adminApiPath?: string;
shopApiPath?: string;
adminApiPlayground?: boolean | RenderPageOptions;
shopApiPlayground?: boolean | RenderPageOptions;
adminApiDebug?: boolean;
shopApiDebug?: boolean;
shopListQueryLimit?: number;
adminListQueryLimit?: number;
adminApiValidationRules?: Array<(context: ValidationContext) => any>;
shopApiValidationRules?: Array<(context: ValidationContext) => any>;
channelTokenKey?: string;
cors?: boolean | CorsOptions;
middleware?: Middleware[];
apolloServerPlugins?: ApolloServerPlugin[];
introspection?: boolean;
}
```
<div className="members-wrapper">
### hostname
<MemberInfo kind="property" type={`string`} default="''" />
Set the hostname of the server. If not set, the server will be available on localhost.
### port
<MemberInfo kind="property" type={`number`} default="3000" />
Which port the Vendure server should listen on.
### adminApiPath
<MemberInfo kind="property" type={`string`} default="'admin-api'" />
The path to the admin GraphQL API.
### shopApiPath
<MemberInfo kind="property" type={`string`} default="'shop-api'" />
The path to the shop GraphQL API.
### adminApiPlayground
<MemberInfo kind="property" type={`boolean | RenderPageOptions`} default="false" />
The playground config to the admin GraphQL API
[ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
### shopApiPlayground
<MemberInfo kind="property" type={`boolean | RenderPageOptions`} default="false" />
The playground config to the shop GraphQL API
[ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
### adminApiDebug
<MemberInfo kind="property" type={`boolean`} default="false" />
The debug config to the admin GraphQL API
[ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
### shopApiDebug
<MemberInfo kind="property" type={`boolean`} default="false" />
The debug config to the shop GraphQL API
[ApolloServer playground](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver).
### shopListQueryLimit
<MemberInfo kind="property" type={`number`} default="100" />
The maximum number of items that may be returned by a query which returns a `PaginatedList` response. In other words,
this is the upper limit of the `take` input option.
### adminListQueryLimit
<MemberInfo kind="property" type={`number`} default="1000" />
The maximum number of items that may be returned by a query which returns a `PaginatedList` response. In other words,
this is the upper limit of the `take` input option.
### adminApiValidationRules
<MemberInfo kind="property" type={`Array<(context: ValidationContext) => any>`} default="[]" />
Custom functions to use as additional validation rules when validating the schema for the admin GraphQL API
[ApolloServer validation rules](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#validationrules).
### shopApiValidationRules
<MemberInfo kind="property" type={`Array<(context: ValidationContext) => any>`} default="[]" />
Custom functions to use as additional validation rules when validating the schema for the shop GraphQL API
[ApolloServer validation rules](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#validationrules).
### channelTokenKey
<MemberInfo kind="property" type={`string`} default="'vendure-token'" />
The name of the property which contains the token of the
active channel. This property can be included either in
the request header or as a query string.
### cors
<MemberInfo kind="property" type={`boolean | CorsOptions`} default="{ origin: true, credentials: true }" />
Set the CORS handling for the server. See the [express CORS docs](https://github.com/expressjs/cors#configuration-options).
### middleware
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/middleware#middleware'>Middleware</a>[]`} default="[]" />
Custom Express or NestJS middleware for the server. More information can be found in the <a href='/reference/typescript-api/common/middleware#middleware'>Middleware</a> docs.
### apolloServerPlugins
<MemberInfo kind="property" type={`ApolloServerPlugin[]`} default="[]" />
Custom [ApolloServerPlugins](https://www.apollographql.com/docs/apollo-server/integrations/plugins/) which
allow the extension of the Apollo Server, which is the underlying GraphQL server used by Vendure.
Apollo plugins can be used e.g. to perform custom data transformations on incoming operations or outgoing
data.
### introspection
<MemberInfo kind="property" type={`boolean`} default="true" since="1.5.0" />
Controls whether introspection of the GraphQL APIs is enabled. For production, it is recommended to disable
introspection, since exposing your entire schema can allow an attacker to trivially learn all operations
and much more easily find any potentially exploitable queries.
**Note:** when introspection is disabled, tooling which relies on it for things like autocompletion
will not work.
*Example*
```ts
{
introspection: process.env.NODE_ENV !== 'production'
}
```
</div>
|
---
title: "CollectionFilter"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## CollectionFilter
<GenerationInfo sourceFile="packages/core/src/config/catalog/collection-filter.ts" sourceLine="64" packageName="@vendure/core" />
A CollectionFilter defines a rule which can be used to associate ProductVariants with a Collection.
The filtering is done by defining the `apply()` function, which receives a TypeORM
[`QueryBuilder`](https://typeorm.io/#/select-query-builder) object to which clauses may be added.
Creating a CollectionFilter is considered an advanced Vendure topic. For more insight into how
they work, study the [default collection filters](https://github.com/vendure-ecommerce/vendure/blob/master/packages/core/src/config/catalog/default-collection-filters.ts)
Here's a simple example of a custom CollectionFilter:
*Example*
```ts
import { CollectionFilter, LanguageCode } from '@vendure/core';
export const skuCollectionFilter = new CollectionFilter({
args: {
// The `args` object defines the user-configurable arguments
// which will get passed to the filter's `apply()` function.
sku: {
type: 'string',
label: [{ languageCode: LanguageCode.en, value: 'SKU' }],
description: [
{
languageCode: LanguageCode.en,
value: 'Matches any product variants with SKUs containing this value',
},
],
},
},
code: 'variant-sku-filter',
description: [{ languageCode: LanguageCode.en, value: 'Filter by matching SKU' }],
// This is the function that defines the logic of the filter.
apply: (qb, args) => {
const LIKE = qb.connection.options.type === 'postgres' ? 'ILIKE' : 'LIKE';
return qb.andWhere(`productVariant.sku ${LIKE} :sku`, { sku: `%${args.sku}%` });
},
});
```
```ts title="Signature"
class CollectionFilter<T extends ConfigArgs = ConfigArgs> extends ConfigurableOperationDef<T> {
constructor(config: CollectionFilterConfig<T>)
apply(qb: SelectQueryBuilder<ProductVariant>, args: ConfigArg[]) => SelectQueryBuilder<ProductVariant>;
}
```
* Extends: <code><a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a><T></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(config: CollectionFilterConfig<T>) => CollectionFilter`} />
### apply
<MemberInfo kind="method" type={`(qb: SelectQueryBuilder<<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>>, args: ConfigArg[]) => SelectQueryBuilder<<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>>`} />
</div>
|
---
title: "DefaultConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## defaultConfig
<GenerationInfo sourceFile="packages/core/src/config/default-config.ts" sourceLine="60" packageName="@vendure/core" />
The default configuration settings which are used if not explicitly overridden in the bootstrap() call.
|
---
title: "EntityDuplicator"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## EntityDuplicator
<GenerationInfo sourceFile="packages/core/src/config/entity/entity-duplicator.ts" sourceLine="158" packageName="@vendure/core" since="2.2.0" />
An EntityDuplicator is used to define the logic for duplicating entities when the `duplicateEntity` mutation is called.
This allows you to add support for duplication of both core and custom entities.
*Example*
```ts title=src/config/custom-collection-duplicator.ts
import { Collection, LanguageCode, Permission
EntityDuplicator, TransactionalConnection, CollectionService } from '@vendure/core';
let collectionService: CollectionService;
let connection: TransactionalConnection;
// This is just an example - we already ship with a built-in duplicator for Collections.
const customCollectionDuplicator = new EntityDuplicator({
code: 'custom-collection-duplicator',
description: [{ languageCode: LanguageCode.en, value: 'Custom collection duplicator' }],
args: {
throwError: {
type: 'boolean',
defaultValue: false,
},
},
forEntities: ['Collection'],
requiresPermission: [Permission.UpdateCollection],
init(injector) {
collectionService = injector.get(CollectionService);
connection = injector.get(TransactionalConnection);
},
duplicate: async input => {
const { ctx, id, args } = input;
const original = await connection.getEntityOrThrow(ctx, Collection, id, {
relations: {
assets: true,
featuredAsset: true,
},
});
const newCollection = await collectionService.create(ctx, {
isPrivate: original.isPrivate,
customFields: original.customFields,
assetIds: original.assets.map(a => a.id),
featuredAssetId: original.featuredAsset?.id,
parentId: original.parentId,
filters: original.filters.map(f => ({
code: f.code,
arguments: f.args,
})),
inheritFilters: original.inheritFilters,
translations: original.translations.map(t => ({
languageCode: t.languageCode,
name: `${t.name} (copy)`,
slug: `${t.slug}-copy`,
description: t.description,
customFields: t.customFields,
})),
});
if (args.throwError) {
// If an error is thrown at any point during the duplication process, the entire
// transaction will get automatically rolled back, and the mutation will return
// an ErrorResponse containing the error message.
throw new Error('Dummy error');
}
return newCollection;
},
});
```
The duplicator then gets passed to your VendureConfig object:
```ts title=src/vendure-config.ts
import { VendureConfig, defaultEntityDuplicators } from '@vendure/core';
import { customCollectionDuplicator } from './config/custom-collection-duplicator';
export const config: VendureConfig = {
// ...
entityOptions: {
entityDuplicators: [
...defaultEntityDuplicators,
customCollectionDuplicator,
],
},
};
```
```ts title="Signature"
class EntityDuplicator<T extends ConfigArgs = ConfigArgs> extends ConfigurableOperationDef<T> {
constructor(config: EntityDuplicatorConfig<T>)
duplicate(input: {
ctx: RequestContext;
entityName: string;
id: ID;
args: ConfigArg[];
}) => Promise<VendureEntity>;
}
```
* Extends: <code><a href='/reference/typescript-api/configurable-operation-def/#configurableoperationdef'>ConfigurableOperationDef</a><T></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(config: <a href='/reference/typescript-api/configuration/entity-duplicator#entityduplicatorconfig'>EntityDuplicatorConfig</a><T>) => EntityDuplicator`} />
### duplicate
<MemberInfo kind="method" type={`(input: {
ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>;
entityName: string;
id: <a href='/reference/typescript-api/common/id#id'>ID</a>;
args: ConfigArg[];
}) => Promise<<a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a>>`} />
</div>
## DuplicateEntityFn
<GenerationInfo sourceFile="packages/core/src/config/entity/entity-duplicator.ts" sourceLine="21" packageName="@vendure/core" since="2.2.0" />
A function which performs the duplication of an entity.
```ts title="Signature"
type DuplicateEntityFn<T extends ConfigArgs> = (input: {
ctx: RequestContext;
entityName: string;
id: ID;
args: ConfigArgValues<T>;
}) => Promise<VendureEntity>
```
## EntityDuplicatorConfig
<GenerationInfo sourceFile="packages/core/src/config/entity/entity-duplicator.ts" sourceLine="36" packageName="@vendure/core" since="2.2.0" />
Configuration for creating a new EntityDuplicator.
```ts title="Signature"
interface EntityDuplicatorConfig<T extends ConfigArgs> extends ConfigurableOperationDefOptions<T> {
requiresPermission: Array<Permission | string> | Permission | string;
forEntities: string[];
duplicate: DuplicateEntityFn<T>;
}
```
* Extends: <code><a href='/reference/typescript-api/configurable-operation-def/configurable-operation-def-options#configurableoperationdefoptions'>ConfigurableOperationDefOptions</a><T></code>
<div className="members-wrapper">
### requiresPermission
<MemberInfo kind="property" type={`Array<<a href='/reference/typescript-api/common/permission#permission'>Permission</a> | string> | <a href='/reference/typescript-api/common/permission#permission'>Permission</a> | string`} />
The permissions required in order to execute this duplicator. If an array is passed,
then the administrator must have at least one of the permissions in the array.
### forEntities
<MemberInfo kind="property" type={`string[]`} />
The entities for which this duplicator is able to duplicate.
### duplicate
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/entity-duplicator#duplicateentityfn'>DuplicateEntityFn</a><T>`} />
The function which performs the duplication.
*Example*
```ts
duplicate: async input => {
const { ctx, id, args } = input;
// perform the duplication logic here
return newEntity;
}
```
</div>
|
---
title: "EntityId Decorator"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## EntityId
<GenerationInfo sourceFile="packages/core/src/entity/entity-id.decorator.ts" sourceLine="41" packageName="@vendure/core" />
Decorates a property which points to another entity by ID. This custom decorator is needed
because we do not know the data type of the ID column until runtime, when we have access
to the configured EntityIdStrategy.
```ts title="Signature"
function EntityId(options?: IdColumnOptions): void
```
Parameters
### options
<MemberInfo kind="parameter" type={`IdColumnOptions`} />
|
---
title: "EntityIdStrategy"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AutoIncrementIdStrategy
<GenerationInfo sourceFile="packages/core/src/config/entity/auto-increment-id-strategy.ts" sourceLine="11" packageName="@vendure/core" />
An id strategy which uses auto-increment integers as primary keys
for all entities. This is the default strategy used by Vendure.
```ts title="Signature"
class AutoIncrementIdStrategy implements EntityIdStrategy<'increment'> {
readonly primaryKeyType = 'increment';
decodeId(id: string) => number;
encodeId(primaryKey: number) => string;
}
```
* Implements: <code><a href='/reference/typescript-api/configuration/entity-id-strategy#entityidstrategy'>EntityIdStrategy</a><'increment'></code>
<div className="members-wrapper">
### primaryKeyType
<MemberInfo kind="property" type={``} />
### decodeId
<MemberInfo kind="method" type={`(id: string) => number`} />
### encodeId
<MemberInfo kind="method" type={`(primaryKey: number) => string`} />
</div>
## EntityIdStrategy
<GenerationInfo sourceFile="packages/core/src/config/entity/entity-id-strategy.ts" sourceLine="32" packageName="@vendure/core" />
The EntityIdStrategy determines how entity IDs are generated and stored in the
database, as well as how they are transformed when being passed from the API to the
service layer and vice versa.
Vendure ships with two strategies: <a href='/reference/typescript-api/configuration/entity-id-strategy#autoincrementidstrategy'>AutoIncrementIdStrategy</a> and <a href='/reference/typescript-api/configuration/entity-id-strategy#uuididstrategy'>UuidIdStrategy</a>,
but custom strategies can be used, e.g. to apply some custom encoding to the ID before exposing
it in the GraphQL API.
:::info
This is configured via the `entityOptions.entityIdStrategy` property of
your VendureConfig.
:::
:::caution
Note: changing from an integer-based strategy to a uuid-based strategy
on an existing Vendure database will lead to problems with broken foreign-key
references. To change primary key types like this, you'll need to start with
a fresh database.
:::
```ts title="Signature"
interface EntityIdStrategy<T extends 'increment' | 'uuid'> extends InjectableStrategy {
readonly primaryKeyType: T;
encodeId: (primaryKey: PrimaryKeyType<T>) => string;
decodeId: (id: string) => PrimaryKeyType<T>;
}
```
* Extends: <code><a href='/reference/typescript-api/common/injectable-strategy#injectablestrategy'>InjectableStrategy</a></code>
<div className="members-wrapper">
### primaryKeyType
<MemberInfo kind="property" type={`T`} />
Defines how the primary key will be stored in the database - either
`'increment'` for auto-increment integer IDs, or `'uuid'` for a unique
string ID.
### encodeId
<MemberInfo kind="property" type={`(primaryKey: PrimaryKeyType<T>) => string`} />
Allows the raw ID from the database to be transformed in some way before exposing
it in the GraphQL API.
For example, you may need to use auto-increment integer IDs due to some business
constraint, but you may not want to expose this data publicly in your API. In this
case, you can use the encode/decode methods to obfuscate the ID with some kind of
encoding scheme, such as base64 (or something more sophisticated).
### decodeId
<MemberInfo kind="property" type={`(id: string) => PrimaryKeyType<T>`} />
Reverses the transformation performed by the `encodeId` method in order to get
back to the raw ID value.
</div>
## UuidIdStrategy
<GenerationInfo sourceFile="packages/core/src/config/entity/uuid-id-strategy.ts" sourceLine="25" packageName="@vendure/core" />
An id strategy which uses string uuids as primary keys
for all entities. This strategy can be configured with the
`entityIdStrategy` property of the `entityOptions` property
of <a href='/reference/typescript-api/configuration/vendure-config#vendureconfig'>VendureConfig</a>.
*Example*
```ts
import { UuidIdStrategy, VendureConfig } from '@vendure/core';
export const config: VendureConfig = {
entityOptions: {
entityIdStrategy: new UuidIdStrategy(),
// ...
}
}
```
```ts title="Signature"
class UuidIdStrategy implements EntityIdStrategy<'uuid'> {
readonly primaryKeyType = 'uuid';
decodeId(id: string) => string;
encodeId(primaryKey: string) => string;
}
```
* Implements: <code><a href='/reference/typescript-api/configuration/entity-id-strategy#entityidstrategy'>EntityIdStrategy</a><'uuid'></code>
<div className="members-wrapper">
### primaryKeyType
<MemberInfo kind="property" type={``} />
### decodeId
<MemberInfo kind="method" type={`(id: string) => string`} />
### encodeId
<MemberInfo kind="method" type={`(primaryKey: string) => string`} />
</div>
|
---
title: "EntityOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## EntityOptions
<GenerationInfo sourceFile="packages/core/src/config/vendure-config.ts" sourceLine="945" packageName="@vendure/core" since="1.3.0" />
Options relating to the internal handling of entities.
```ts title="Signature"
interface EntityOptions {
entityIdStrategy?: EntityIdStrategy<any>;
entityDuplicators?: Array<EntityDuplicator<any>>;
moneyStrategy?: MoneyStrategy;
channelCacheTtl?: number;
zoneCacheTtl?: number;
taxRateCacheTtl?: number;
metadataModifiers?: EntityMetadataModifier[];
}
```
<div className="members-wrapper">
### entityIdStrategy
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/entity-id-strategy#entityidstrategy'>EntityIdStrategy</a><any>`} default="<a href='/reference/typescript-api/configuration/entity-id-strategy#autoincrementidstrategy'>AutoIncrementIdStrategy</a>" since="1.3.0" />
Defines the strategy used for both storing the primary keys of entities
in the database, and the encoding & decoding of those ids when exposing
entities via the API. The default uses a simple auto-increment integer
strategy.
:::caution
Note: changing from an integer-based strategy to a uuid-based strategy
on an existing Vendure database will lead to problems with broken foreign-key
references. To change primary key types like this, you'll need to start with
a fresh database.
:::
### entityDuplicators
<MemberInfo kind="property" type={`Array<<a href='/reference/typescript-api/configuration/entity-duplicator#entityduplicator'>EntityDuplicator</a><any>>`} default="defaultEntityDuplicators" since="2.2.0" />
An array of <a href='/reference/typescript-api/configuration/entity-duplicator#entityduplicator'>EntityDuplicator</a> instances which are used to duplicate entities
when using the `duplicateEntity` mutation.
### moneyStrategy
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/money/money-strategy#moneystrategy'>MoneyStrategy</a>`} default="<a href='/reference/typescript-api/money/default-money-strategy#defaultmoneystrategy'>DefaultMoneyStrategy</a>" since="2.0.0" />
Defines the strategy used to store and round monetary values.
### channelCacheTtl
<MemberInfo kind="property" type={`number`} default="30000" since="1.3.0" />
Channels get cached in-memory as they are accessed very frequently. This
setting determines how long the cache lives (in ms) until it is considered stale and
refreshed. For multi-instance deployments (e.g. serverless, load-balanced), a
smaller value here will prevent data inconsistencies between instances.
### zoneCacheTtl
<MemberInfo kind="property" type={`number`} default="30000" since="1.3.0" />
Zones get cached in-memory as they are accessed very frequently. This
setting determines how long the cache lives (in ms) until it is considered stale and
refreshed. For multi-instance deployments (e.g. serverless, load-balanced), a
smaller value here will prevent data inconsistencies between instances.
### taxRateCacheTtl
<MemberInfo kind="property" type={`number`} default="30000" since="1.9.0" />
TaxRates get cached in-memory as they are accessed very frequently. This
setting determines how long the cache lives (in ms) until it is considered stale and
refreshed. For multi-instance deployments (e.g. serverless, load-balanced), a
smaller value here will prevent data inconsistencies between instances.
### metadataModifiers
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/entity-options#entitymetadatamodifier'>EntityMetadataModifier</a>[]`} default="[]" since="1.6.0" />
Allows the metadata of the built-in TypeORM entities to be manipulated. This allows you
to do things like altering data types, adding indices etc. This is an advanced feature
which should be used with some caution as it will result in DB schema changes. For examples
see <a href='/reference/typescript-api/configuration/entity-options#entitymetadatamodifier'>EntityMetadataModifier</a>.
</div>
## EntityMetadataModifier
<GenerationInfo sourceFile="packages/core/src/config/entity-metadata/entity-metadata-modifier.ts" sourceLine="56" packageName="@vendure/core" since="1.6.0" />
A function which allows TypeORM entity metadata to be manipulated prior to the DB schema being generated
during bootstrap.
:::caution
Certain DB schema modifications will result in auto-generated migrations which will lead to data loss. For instance,
changing the data type of a column will drop the column & data and then re-create it. To avoid loss of important data,
always check and modify your migration scripts as needed.
:::
*Example*
```ts
import { Index } from 'typeorm';
import { EntityMetadataModifier, ProductVariant } from '@vendure/core';
// Adds a unique index to the ProductVariant.sku column
export const addSkuUniqueIndex: EntityMetadataModifier = metadata => {
const instance = new ProductVariant();
Index({ unique: true })(instance, 'sku');
};
```
*Example*
```ts
import { Column } from 'typeorm';
import { EntityMetadataModifier, ProductTranslation } from '@vendure/core';
// Use the "mediumtext" datatype for the Product's description rather than
// the default "text" type.
export const makeProductDescriptionMediumText: EntityMetadataModifier = metadata => {
const descriptionColumnIndex = metadata.columns.findIndex(
col => col.propertyName === 'description' && col.target === ProductTranslation,
);
if (-1 < descriptionColumnIndex) {
// First we need to remove the existing column definition
// from the metadata.
metadata.columns.splice(descriptionColumnIndex, 1);
// Then we add a new column definition with our custom
// data type "mediumtext"
// DANGER: this particular modification will generate a DB migration
// which will result in data loss of existing descriptions. Make sure
// to manually check & modify your migration scripts.
const instance = new ProductTranslation();
Column({ type: 'mediumtext' })(instance, 'description');
}
};
```
```ts title="Signature"
type EntityMetadataModifier = (metadata: MetadataArgsStorage) => void | Promise<void>
```
|
---
title: "Configuration"
isDefaultIndex: true
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
import DocCardList from '@theme/DocCardList';
<DocCardList /> |
---
title: "MergeConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## mergeConfig
<GenerationInfo sourceFile="packages/core/src/config/merge-config.ts" sourceLine="30" packageName="@vendure/core" />
Performs a deep merge of two VendureConfig objects. Unlike `Object.assign()` the `target` object is
not mutated, instead the function returns a new object which is the result of deeply merging the
values of `source` into `target`.
Arrays do not get merged, they are treated as a single value that will be replaced. So if merging the
`plugins` array, you must explicitly concatenate the array.
*Example*
```ts
const result = mergeConfig(defaultConfig, {
assetOptions: {
uploadMaxFileSize: 5000,
},
plugins: [
...defaultConfig.plugins,
MyPlugin,
]
};
```
```ts title="Signature"
function mergeConfig<T extends VendureConfig>(target: T, source: PartialVendureConfig, depth: = 0): T
```
Parameters
### target
<MemberInfo kind="parameter" type={`T`} />
### source
<MemberInfo kind="parameter" type={`PartialVendureConfig`} />
### depth
<MemberInfo kind="parameter" type={``} />
|
---
title: "ProductVariantPriceSelectionStrategy"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProductVariantPriceSelectionStrategy
<GenerationInfo sourceFile="packages/core/src/config/catalog/product-variant-price-selection-strategy.ts" sourceLine="21" packageName="@vendure/core" since="2.0.0" />
The strategy for selecting the price for a ProductVariant in a given Channel.
:::info
This is configured via the `catalogOptions.productVariantPriceSelectionStrategy` property of
your VendureConfig.
:::
```ts title="Signature"
interface ProductVariantPriceSelectionStrategy extends InjectableStrategy {
selectPrice(
ctx: RequestContext,
prices: ProductVariantPrice[],
): ProductVariantPrice | undefined | Promise<ProductVariantPrice | undefined>;
}
```
* Extends: <code><a href='/reference/typescript-api/common/injectable-strategy#injectablestrategy'>InjectableStrategy</a></code>
<div className="members-wrapper">
### selectPrice
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a> | undefined | Promise<<a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a> | undefined>`} />
</div>
## DefaultProductVariantPriceSelectionStrategy
<GenerationInfo sourceFile="packages/core/src/config/catalog/default-product-variant-price-selection-strategy.ts" sourceLine="17" packageName="@vendure/core" since="2.0.0" />
The default strategy for selecting the price for a ProductVariant in a given Channel. It
first filters all available prices to those which are in the current Channel, and then
selects the first price which matches the current currency.
```ts title="Signature"
class DefaultProductVariantPriceSelectionStrategy implements ProductVariantPriceSelectionStrategy {
selectPrice(ctx: RequestContext, prices: ProductVariantPrice[]) => ;
}
```
* Implements: <code><a href='/reference/typescript-api/configuration/product-variant-price-selection-strategy#productvariantpriceselectionstrategy'>ProductVariantPriceSelectionStrategy</a></code>
<div className="members-wrapper">
### selectPrice
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => `} />
</div>
|
---
title: "ProductVariantPriceUpdateStrategy"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProductVariantPriceUpdateStrategy
<GenerationInfo sourceFile="packages/core/src/config/catalog/product-variant-price-update-strategy.ts" sourceLine="58" packageName="@vendure/core" since="2.2.0" />
This strategy determines how updates to a ProductVariantPrice is handled in regard to
any other prices which may be associated with the same ProductVariant.
For instance, in a multichannel setup, if a price is updated for a ProductVariant in one
Channel, this strategy can be used to update the prices in other Channels.
Using custom logic, this can be made more sophisticated - for example, you could have a
one-way sync that only updates prices in child channels when the price in the default
channel is updated. You could also have a conditional sync which is dependent on the
permissions of the current administrator, or based on custom field flags on the ProductVariant
or Channel.
Another use-case might be to update the prices of a ProductVariant in other currencies
when a price is updated in one currency, based on the current exchange rate.
:::info
This is configured via the `catalogOptions.productVariantPriceUpdateStrategy` property of
your VendureConfig.
:::
```ts title="Signature"
interface ProductVariantPriceUpdateStrategy extends InjectableStrategy {
onPriceCreated(
ctx: RequestContext,
createdPrice: ProductVariantPrice,
prices: ProductVariantPrice[],
): UpdatedProductVariantPrice[] | Promise<UpdatedProductVariantPrice[]>;
onPriceUpdated(
ctx: RequestContext,
updatedPrice: ProductVariantPrice,
prices: ProductVariantPrice[],
): UpdatedProductVariantPrice[] | Promise<UpdatedProductVariantPrice[]>;
onPriceDeleted(
ctx: RequestContext,
deletedPrice: ProductVariantPrice,
prices: ProductVariantPrice[],
): UpdatedProductVariantPrice[] | Promise<UpdatedProductVariantPrice[]>;
}
```
* Extends: <code><a href='/reference/typescript-api/common/injectable-strategy#injectablestrategy'>InjectableStrategy</a></code>
<div className="members-wrapper">
### onPriceCreated
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, createdPrice: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => UpdatedProductVariantPrice[] | Promise<UpdatedProductVariantPrice[]>`} />
This method is called when a ProductVariantPrice is created. It receives the created
ProductVariantPrice and the array of all prices associated with the ProductVariant.
It should return an array of UpdatedProductVariantPrice objects which will be used to update
the prices of the specific ProductVariantPrices.
### onPriceUpdated
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, updatedPrice: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => UpdatedProductVariantPrice[] | Promise<UpdatedProductVariantPrice[]>`} />
This method is called when a ProductVariantPrice is updated. It receives the updated
ProductVariantPrice and the array of all prices associated with the ProductVariant.
It should return an array of UpdatedProductVariantPrice objects which will be used to update
the prices of the specific ProductVariantPrices.
### onPriceDeleted
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, deletedPrice: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => UpdatedProductVariantPrice[] | Promise<UpdatedProductVariantPrice[]>`} />
This method is called when a ProductVariantPrice is deleted. It receives the deleted
ProductVariantPrice and the array of all prices associated with the ProductVariant.
It should return an array of UpdatedProductVariantPrice objects which will be used to update
the prices of the specific ProductVariantPrices.
</div>
## DefaultProductVariantPriceUpdateStrategyOptions
<GenerationInfo sourceFile="packages/core/src/config/catalog/default-product-variant-price-update-strategy.ts" sourceLine="14" packageName="@vendure/core" since="2.2.0" />
The options available to the <a href='/reference/typescript-api/configuration/product-variant-price-update-strategy#defaultproductvariantpriceupdatestrategy'>DefaultProductVariantPriceUpdateStrategy</a>.
```ts title="Signature"
interface DefaultProductVariantPriceUpdateStrategyOptions {
syncPricesAcrossChannels: boolean;
}
```
<div className="members-wrapper">
### syncPricesAcrossChannels
<MemberInfo kind="property" type={`boolean`} />
When `true`, any price changes to a ProductVariant in one Channel will update any other
prices of the same currencyCode in other Channels. Note that if there are different
tax settings across the channels, these will not be taken into account. To handle this
case, a custom strategy should be implemented.
</div>
## DefaultProductVariantPriceUpdateStrategy
<GenerationInfo sourceFile="packages/core/src/config/catalog/default-product-variant-price-update-strategy.ts" sourceLine="56" packageName="@vendure/core" since="2.2.0" />
The default <a href='/reference/typescript-api/configuration/product-variant-price-update-strategy#productvariantpriceupdatestrategy'>ProductVariantPriceUpdateStrategy</a> which by default will not update any other
prices when a price is created, updated or deleted.
If the `syncPricesAcrossChannels` option is set to `true`, then when a price is updated in one Channel,
the price of the same currencyCode in other Channels will be updated to match. Note that if there are different
tax settings across the channels, these will not be taken into account. To handle this
case, a custom strategy should be implemented.
*Example*
```ts
import { DefaultProductVariantPriceUpdateStrategy, VendureConfig } from '@vendure/core';
export const config: VendureConfig = {
// ...
catalogOptions: {
// highlight-start
productVariantPriceUpdateStrategy: new DefaultProductVariantPriceUpdateStrategy({
syncPricesAcrossChannels: true,
}),
// highlight-end
},
// ...
};
```
```ts title="Signature"
class DefaultProductVariantPriceUpdateStrategy implements ProductVariantPriceUpdateStrategy {
constructor(options: DefaultProductVariantPriceUpdateStrategyOptions)
onPriceCreated(ctx: RequestContext, price: ProductVariantPrice) => ;
onPriceUpdated(ctx: RequestContext, updatedPrice: ProductVariantPrice, prices: ProductVariantPrice[]) => ;
onPriceDeleted(ctx: RequestContext, deletedPrice: ProductVariantPrice, prices: ProductVariantPrice[]) => ;
}
```
* Implements: <code><a href='/reference/typescript-api/configuration/product-variant-price-update-strategy#productvariantpriceupdatestrategy'>ProductVariantPriceUpdateStrategy</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(options: <a href='/reference/typescript-api/configuration/product-variant-price-update-strategy#defaultproductvariantpriceupdatestrategyoptions'>DefaultProductVariantPriceUpdateStrategyOptions</a>) => DefaultProductVariantPriceUpdateStrategy`} />
### onPriceCreated
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, price: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>) => `} />
### onPriceUpdated
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, updatedPrice: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => `} />
### onPriceDeleted
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, deletedPrice: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>, prices: <a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]) => `} />
</div>
|
---
title: "RuntimeVendureConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## RuntimeVendureConfig
<GenerationInfo sourceFile="packages/core/src/config/vendure-config.ts" sourceLine="1192" packageName="@vendure/core" />
This interface represents the VendureConfig object available at run-time, i.e. the user-supplied
config values have been merged with the <a href='/reference/typescript-api/configuration/default-config#defaultconfig'>defaultConfig</a> values.
```ts title="Signature"
interface RuntimeVendureConfig extends Required<VendureConfig> {
apiOptions: Required<ApiOptions>;
assetOptions: Required<AssetOptions>;
authOptions: Required<AuthOptions>;
catalogOptions: Required<CatalogOptions>;
customFields: Required<CustomFields>;
entityOptions: Required<Omit<EntityOptions, 'entityIdStrategy'>> & EntityOptions;
importExportOptions: Required<ImportExportOptions>;
jobQueueOptions: Required<JobQueueOptions>;
orderOptions: Required<OrderOptions>;
promotionOptions: Required<PromotionOptions>;
shippingOptions: Required<ShippingOptions>;
taxOptions: Required<TaxOptions>;
systemOptions: Required<SystemOptions>;
}
```
* Extends: <code>Required<<a href='/reference/typescript-api/configuration/vendure-config#vendureconfig'>VendureConfig</a>></code>
<div className="members-wrapper">
### apiOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/configuration/api-options#apioptions'>ApiOptions</a>>`} />
### assetOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/assets/asset-options#assetoptions'>AssetOptions</a>>`} />
### authOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/auth/auth-options#authoptions'>AuthOptions</a>>`} />
### catalogOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/products-stock/catalog-options#catalogoptions'>CatalogOptions</a>>`} />
### customFields
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/custom-fields/#customfields'>CustomFields</a>>`} />
### entityOptions
<MemberInfo kind="property" type={`Required<Omit<<a href='/reference/typescript-api/configuration/entity-options#entityoptions'>EntityOptions</a>, 'entityIdStrategy'>> & <a href='/reference/typescript-api/configuration/entity-options#entityoptions'>EntityOptions</a>`} />
### importExportOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/import-export/import-export-options#importexportoptions'>ImportExportOptions</a>>`} />
### jobQueueOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/job-queue/job-queue-options#jobqueueoptions'>JobQueueOptions</a>>`} />
### orderOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/orders/order-options#orderoptions'>OrderOptions</a>>`} />
### promotionOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/promotions/promotion-options#promotionoptions'>PromotionOptions</a>>`} />
### shippingOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/shipping/shipping-options#shippingoptions'>ShippingOptions</a>>`} />
### taxOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/tax/tax-options#taxoptions'>TaxOptions</a>>`} />
### systemOptions
<MemberInfo kind="property" type={`Required<<a href='/reference/typescript-api/configuration/system-options#systemoptions'>SystemOptions</a>>`} />
</div>
|
---
title: "SystemOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## SystemOptions
<GenerationInfo sourceFile="packages/core/src/config/vendure-config.ts" sourceLine="1034" packageName="@vendure/core" since="1.6.0" />
Options relating to system functions.
```ts title="Signature"
interface SystemOptions {
healthChecks?: HealthCheckStrategy[];
errorHandlers?: ErrorHandlerStrategy[];
}
```
<div className="members-wrapper">
### healthChecks
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/health-check/health-check-strategy#healthcheckstrategy'>HealthCheckStrategy</a>[]`} default="[<a href='/reference/typescript-api/health-check/type-ormhealth-check-strategy#typeormhealthcheckstrategy'>TypeORMHealthCheckStrategy</a>]" since="1.6.0" />
Defines an array of <a href='/reference/typescript-api/health-check/health-check-strategy#healthcheckstrategy'>HealthCheckStrategy</a> instances which are used by the `/health` endpoint to verify
that any critical systems which the Vendure server depends on are also healthy.
### errorHandlers
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/errors/error-handler-strategy#errorhandlerstrategy'>ErrorHandlerStrategy</a>[]`} default="[]" since="2.2.0" />
Defines an array of <a href='/reference/typescript-api/errors/error-handler-strategy#errorhandlerstrategy'>ErrorHandlerStrategy</a> instances which are used to define logic to be executed
when an error occurs, either on the server or the worker.
</div>
|
---
title: "VendureConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## VendureConfig
<GenerationInfo sourceFile="packages/core/src/config/vendure-config.ts" sourceLine="1062" packageName="@vendure/core" />
All possible configuration options are defined by the
[`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/server/src/config/vendure-config.ts) interface.
```ts title="Signature"
interface VendureConfig {
apiOptions: ApiOptions;
assetOptions?: AssetOptions;
authOptions: AuthOptions;
catalogOptions?: CatalogOptions;
customFields?: CustomFields;
dbConnectionOptions: DataSourceOptions;
defaultChannelToken?: string | null;
defaultLanguageCode?: LanguageCode;
entityIdStrategy?: EntityIdStrategy<any>;
entityOptions?: EntityOptions;
importExportOptions?: ImportExportOptions;
orderOptions?: OrderOptions;
paymentOptions: PaymentOptions;
plugins?: Array<DynamicModule | Type<any>>;
promotionOptions?: PromotionOptions;
shippingOptions?: ShippingOptions;
logger?: VendureLogger;
taxOptions?: TaxOptions;
jobQueueOptions?: JobQueueOptions;
systemOptions?: SystemOptions;
}
```
<div className="members-wrapper">
### apiOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/api-options#apioptions'>ApiOptions</a>`} />
Configuration for the GraphQL APIs, including hostname, port, CORS settings,
middleware etc.
### assetOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/assets/asset-options#assetoptions'>AssetOptions</a>`} />
Configuration for the handling of Assets.
### authOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/auth/auth-options#authoptions'>AuthOptions</a>`} />
Configuration for authorization.
### catalogOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/products-stock/catalog-options#catalogoptions'>CatalogOptions</a>`} />
Configuration for Products and Collections.
### customFields
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/custom-fields/#customfields'>CustomFields</a>`} default="{}" />
Defines custom fields which can be used to extend the built-in entities.
### dbConnectionOptions
<MemberInfo kind="property" type={`DataSourceOptions`} />
The connection options used by TypeORM to connect to the database.
See the [TypeORM documentation](https://typeorm.io/#/connection-options) for a
full description of all available options.
### defaultChannelToken
<MemberInfo kind="property" type={`string | null`} default="null" />
The token for the default channel. If not specified, a token
will be randomly generated.
### defaultLanguageCode
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>`} default="<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>.en" />
The default languageCode of the app.
### entityIdStrategy
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/entity-id-strategy#entityidstrategy'>EntityIdStrategy</a><any>`} default="<a href='/reference/typescript-api/configuration/entity-id-strategy#autoincrementidstrategy'>AutoIncrementIdStrategy</a>" />
Defines the strategy used for both storing the primary keys of entities
in the database, and the encoding & decoding of those ids when exposing
entities via the API. The default uses a simple auto-increment integer
strategy.
### entityOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/entity-options#entityoptions'>EntityOptions</a>`} />
### importExportOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/import-export/import-export-options#importexportoptions'>ImportExportOptions</a>`} />
Configuration settings for data import and export.
### orderOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/orders/order-options#orderoptions'>OrderOptions</a>`} />
Configuration settings governing how orders are handled.
### paymentOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/payment/payment-options#paymentoptions'>PaymentOptions</a>`} />
Configures available payment processing methods.
### plugins
<MemberInfo kind="property" type={`Array<DynamicModule | Type<any>>`} default="[]" />
An array of plugins.
### promotionOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/promotions/promotion-options#promotionoptions'>PromotionOptions</a>`} />
Configures the Conditions and Actions available when creating Promotions.
### shippingOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/shipping/shipping-options#shippingoptions'>ShippingOptions</a>`} />
Configures the available checkers and calculators for ShippingMethods.
### logger
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/logger/vendure-logger#vendurelogger'>VendureLogger</a>`} default="<a href='/reference/typescript-api/logger/default-logger#defaultlogger'>DefaultLogger</a>" />
Provide a logging service which implements the <a href='/reference/typescript-api/logger/vendure-logger#vendurelogger'>VendureLogger</a> interface.
Note that the logging of SQL queries is controlled separately by the
`dbConnectionOptions.logging` property.
### taxOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/tax/tax-options#taxoptions'>TaxOptions</a>`} />
Configures how taxes are calculated on products.
### jobQueueOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/job-queue/job-queue-options#jobqueueoptions'>JobQueueOptions</a>`} />
Configures how the job queue is persisted and processed.
### systemOptions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/configuration/system-options#systemoptions'>SystemOptions</a>`} since="1.6.0" />
Configures system options
</div>
|
---
title: "CustomFieldConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## CustomFieldConfig
<GenerationInfo sourceFile="packages/core/src/config/custom-field/custom-field-types.ts" sourceLine="124" packageName="@vendure/core" />
An object used to configure a custom field.
```ts title="Signature"
type CustomFieldConfig = | StringCustomFieldConfig
| LocaleStringCustomFieldConfig
| TextCustomFieldConfig
| LocaleTextCustomFieldConfig
| IntCustomFieldConfig
| FloatCustomFieldConfig
| BooleanCustomFieldConfig
| DateTimeCustomFieldConfig
| RelationCustomFieldConfig
```
|
---
title: "CustomFieldType"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## CustomFieldType
<GenerationInfo sourceFile="packages/common/src/shared-types.ts" sourceLine="103" packageName="@vendure/common" />
A data type for a custom field. The CustomFieldType determines the data types used in the generated
database columns and GraphQL fields as follows (key: m = MySQL, p = Postgres, s = SQLite):
Type | DB type | GraphQL type
----- |--------- |---------------
string | varchar | String
localeString | varchar | String
text | longtext(m), text(p,s) | String
localeText | longtext(m), text(p,s) | String
int | int | Int
float | double precision | Float
boolean | tinyint (m), bool (p), boolean (s) | Boolean
datetime | datetime (m,s), timestamp (p) | DateTime
relation | many-to-one / many-to-many relation | As specified in config
Additionally, the CustomFieldType also dictates which [configuration options](/reference/typescript-api/custom-fields/#configuration-options)
are available for that custom field.
```ts title="Signature"
type CustomFieldType = | 'string'
| 'localeString'
| 'int'
| 'float'
| 'boolean'
| 'datetime'
| 'relation'
| 'text'
| 'localeText'
```
|
---
title: "CustomFields"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## CustomFields
<GenerationInfo sourceFile="packages/core/src/config/custom-field/custom-field-types.ts" sourceLine="159" packageName="@vendure/core" />
Most entities can have additional fields added to them by defining an array of <a href='/reference/typescript-api/custom-fields/custom-field-config#customfieldconfig'>CustomFieldConfig</a>
objects on against the corresponding key.
*Example*
```ts
bootstrap({
// ...
customFields: {
Product: [
{ name: 'infoUrl', type: 'string' },
{ name: 'downloadable', type: 'boolean', defaultValue: false },
{ name: 'shortName', type: 'localeString' },
],
User: [
{ name: 'socialLoginToken', type: 'string', public: false },
],
},
})
```
```ts title="Signature"
type CustomFields = {
Address?: CustomFieldConfig[];
Administrator?: CustomFieldConfig[];
Asset?: CustomFieldConfig[];
Channel?: CustomFieldConfig[];
Collection?: CustomFieldConfig[];
Customer?: CustomFieldConfig[];
CustomerGroup?: CustomFieldConfig[];
Facet?: CustomFieldConfig[];
FacetValue?: CustomFieldConfig[];
Fulfillment?: CustomFieldConfig[];
GlobalSettings?: CustomFieldConfig[];
Order?: CustomFieldConfig[];
OrderLine?: CustomFieldConfig[];
PaymentMethod?: CustomFieldConfig[];
Product?: CustomFieldConfig[];
ProductOption?: CustomFieldConfig[];
ProductOptionGroup?: CustomFieldConfig[];
ProductVariant?: CustomFieldConfig[];
ProductVariantPrice?: CustomFieldConfig[];
Promotion?: CustomFieldConfig[];
Region?: CustomFieldConfig[];
Seller?: CustomFieldConfig[];
ShippingMethod?: CustomFieldConfig[];
StockLocation?: CustomFieldConfig[];
TaxCategory?: CustomFieldConfig[];
TaxRate?: CustomFieldConfig[];
User?: CustomFieldConfig[];
Zone?: CustomFieldConfig[];
} & { [entity: string]: CustomFieldConfig[] }
```
|
---
title: "TypedCustomSingleFieldConfig"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## TypedCustomSingleFieldConfig
<GenerationInfo sourceFile="packages/core/src/config/custom-field/custom-field-types.ts" sourceLine="66" packageName="@vendure/core" />
Configures a custom field on an entity in the <a href='/reference/typescript-api/custom-fields/#customfields'>CustomFields</a> config object.
```ts title="Signature"
type TypedCustomSingleFieldConfig<T extends CustomFieldType, C extends CustomField> = BaseTypedCustomFieldConfig<T, C> & {
list?: false;
defaultValue?: DefaultValueType<T>;
validate?: (
value: DefaultValueType<T>,
injector: Injector,
ctx: RequestContext,
) => string | LocalizedString[] | void | Promise<string | LocalizedString[] | void>;
}
```
|
---
title: "Data Access"
weight: 10
date: 2023-07-14T16:57:49.418Z
showtoc: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
# data-access |
---
title: "Calculated"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Calculated
<GenerationInfo sourceFile="packages/core/src/common/calculated-decorator.ts" sourceLine="43" packageName="@vendure/core" />
Used to define calculated entity getters. The decorator simply attaches an array of "calculated"
property names to the entity's prototype. This array is then used by the {@link CalculatedPropertySubscriber}
to transfer the getter function from the prototype to the entity instance.
```ts title="Signature"
function Calculated(queryInstruction?: CalculatedColumnQueryInstruction): MethodDecorator
```
Parameters
### queryInstruction
<MemberInfo kind="parameter" type={`<a href='/reference/typescript-api/data-access/calculated#calculatedcolumnqueryinstruction'>CalculatedColumnQueryInstruction</a>`} />
## CalculatedColumnQueryInstruction
<GenerationInfo sourceFile="packages/core/src/common/calculated-decorator.ts" sourceLine="17" packageName="@vendure/core" />
Optional metadata used to tell the <a href='/reference/typescript-api/data-access/list-query-builder#listquerybuilder'>ListQueryBuilder</a> & <a href='/reference/typescript-api/request/relations-decorator#relations'>Relations</a> decorator how to deal with
calculated columns when sorting, filtering and deriving required relations from GraphQL operations.
```ts title="Signature"
interface CalculatedColumnQueryInstruction {
relations?: string[];
query?: (qb: SelectQueryBuilder<any>) => void;
expression?: string;
}
```
<div className="members-wrapper">
### relations
<MemberInfo kind="property" type={`string[]`} />
If the calculated property depends on one or more relations being present
on the entity (e.g. an `Order` entity calculating the `totalQuantity` by adding
up the quantities of each `OrderLine`), then those relations should be defined here.
### query
<MemberInfo kind="property" type={`(qb: SelectQueryBuilder<any>) => void`} />
### expression
<MemberInfo kind="property" type={`string`} />
</div>
|
---
title: "EntityHydrator"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## EntityHydrator
<GenerationInfo sourceFile="packages/core/src/service/helpers/entity-hydrator/entity-hydrator.service.ts" sourceLine="77" packageName="@vendure/core" since="1.3.0" />
This is a helper class which is used to "hydrate" entity instances, which means to populate them
with the specified relations. This is useful when writing plugin code which receives an entity,
and you need to ensure that one or more relations are present.
*Example*
```ts
import { Injectable } from '@nestjs/common';
import { ID, RequestContext, EntityHydrator, ProductVariantService } from '@vendure/core';
@Injectable()
export class MyService {
constructor(
// highlight-next-line
private entityHydrator: EntityHydrator,
private productVariantService: ProductVariantService,
) {}
myMethod(ctx: RequestContext, variantId: ID) {
const product = await this.productVariantService
.getProductForVariant(ctx, variantId);
// at this stage, we don't know which of the Product relations
// will be joined at runtime.
// highlight-start
await this.entityHydrator
.hydrate(ctx, product, { relations: ['facetValues.facet' ]});
// You can be sure now that the `facetValues` & `facetValues.facet` relations are populated
// highlight-end
}
}
```
In this above example, the `product` instance will now have the `facetValues` relation
available, and those FacetValues will have their `facet` relations joined too.
This `hydrate` method will _also_ automatically take care or translating any
translatable entities (e.g. Product, Collection, Facet), and if the `applyProductVariantPrices`
options is used (see <a href='/reference/typescript-api/data-access/hydrate-options#hydrateoptions'>HydrateOptions</a>), any related ProductVariant will have the correct
Channel-specific prices applied to them.
Custom field relations may also be hydrated:
*Example*
```ts
const customer = await this.customerService
.findOne(ctx, id);
await this.entityHydrator
.hydrate(ctx, customer, { relations: ['customFields.avatar' ]});
```
```ts title="Signature"
class EntityHydrator {
constructor(connection: TransactionalConnection, productPriceApplicator: ProductPriceApplicator, translator: TranslatorService)
hydrate(ctx: RequestContext, target: Entity, options: HydrateOptions<Entity>) => Promise<Entity>;
}
```
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(connection: <a href='/reference/typescript-api/data-access/transactional-connection#transactionalconnection'>TransactionalConnection</a>, productPriceApplicator: <a href='/reference/typescript-api/service-helpers/product-price-applicator#productpriceapplicator'>ProductPriceApplicator</a>, translator: <a href='/reference/typescript-api/service-helpers/translator-service#translatorservice'>TranslatorService</a>) => EntityHydrator`} />
### hydrate
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, target: Entity, options: <a href='/reference/typescript-api/data-access/hydrate-options#hydrateoptions'>HydrateOptions</a><Entity>) => Promise<Entity>`} since="1.3.0" />
Hydrates (joins) the specified relations to the target entity instance. This method
mutates the `target` entity.
*Example*
```ts
await this.entityHydrator.hydrate(ctx, product, {
relations: [
'variants.stockMovements'
'optionGroups.options',
'featuredAsset',
],
applyProductVariantPrices: true,
});
```
</div>
|
---
title: "GetEntityOrThrowOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## GetEntityOrThrowOptions
<GenerationInfo sourceFile="packages/core/src/connection/types.ts" sourceLine="10" packageName="@vendure/core" />
Options used by the <a href='/reference/typescript-api/data-access/transactional-connection#transactionalconnection'>TransactionalConnection</a> `getEntityOrThrow` method.
```ts title="Signature"
interface GetEntityOrThrowOptions<T = any> extends FindOneOptions<T> {
channelId?: ID;
retries?: number;
retryDelay?: number;
includeSoftDeleted?: boolean;
}
```
* Extends: <code>FindOneOptions<T></code>
<div className="members-wrapper">
### channelId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
An optional channelId to limit results to entities assigned to the given Channel. Should
only be used when getting entities that implement the <a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a> interface.
### retries
<MemberInfo kind="property" type={`number`} default="0" since="1.1.0" />
If set to a positive integer, it will retry getting the entity in case it is initially not
found.
### retryDelay
<MemberInfo kind="property" type={`number`} default="25" since="1.1.0" />
Specifies the delay in ms to wait between retries.
### includeSoftDeleted
<MemberInfo kind="property" type={`boolean`} default="false" since="1.3.0" />
If set to `true`, soft-deleted entities will be returned. Otherwise they will
throw as if they did not exist.
</div>
|
---
title: "HydrateOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## HydrateOptions
<GenerationInfo sourceFile="packages/core/src/service/helpers/entity-hydrator/entity-hydrator-types.ts" sourceLine="12" packageName="@vendure/core" since="1.3.0" />
Options used to control which relations of the entity get hydrated
when using the <a href='/reference/typescript-api/data-access/entity-hydrator#entityhydrator'>EntityHydrator</a> helper.
```ts title="Signature"
interface HydrateOptions<Entity extends VendureEntity> {
relations: Array<EntityRelationPaths<Entity>>;
applyProductVariantPrices?: boolean;
}
```
<div className="members-wrapper">
### relations
<MemberInfo kind="property" type={`Array<<a href='/reference/typescript-api/common/entity-relation-paths#entityrelationpaths'>EntityRelationPaths</a><Entity>>`} />
Defines the relations to hydrate, using strings with dot notation to indicate
nested joins. If the entity already has a particular relation available, that relation
will be skipped (no extra DB join will be added).
### applyProductVariantPrices
<MemberInfo kind="property" type={`boolean`} default="false" />
If set to `true`, any ProductVariants will also have their `price` and `priceWithTax` fields
applied based on the current context. If prices are not required, this can be left `false` which
will be slightly more efficient.
</div>
|
---
title: "Data Access"
isDefaultIndex: true
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
import DocCardList from '@theme/DocCardList';
<DocCardList /> |
---
title: "ListQueryBuilder"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ListQueryBuilder
<GenerationInfo sourceFile="packages/core/src/service/helpers/list-query-builder/list-query-builder.ts" sourceLine="200" packageName="@vendure/core" />
This helper class is used when fetching entities the database from queries which return a <a href='/reference/typescript-api/common/paginated-list#paginatedlist'>PaginatedList</a> type.
These queries all follow the same format:
In the GraphQL definition, they return a type which implements the `Node` interface, and the query returns a
type which implements the `PaginatedList` interface:
```GraphQL
type BlogPost implements Node {
id: ID!
published: DateTime!
title: String!
body: String!
}
type BlogPostList implements PaginatedList {
items: [BlogPost!]!
totalItems: Int!
}
# Generated at run-time by Vendure
input BlogPostListOptions
extend type Query {
blogPosts(options: BlogPostListOptions): BlogPostList!
}
```
When Vendure bootstraps, it will find the `BlogPostListOptions` input and, because it is used in a query
returning a `PaginatedList` type, it knows that it should dynamically generate this input. This means
all primitive field of the `BlogPost` type (namely, "published", "title" and "body") will have `filter` and
`sort` inputs created for them, as well a `skip` and `take` fields for pagination.
Your resolver function will then look like this:
```ts
@Resolver()
export class BlogPostResolver
constructor(private blogPostService: BlogPostService) {}
@Query()
async blogPosts(
@Ctx() ctx: RequestContext,
@Args() args: any,
): Promise<PaginatedList<BlogPost>> {
return this.blogPostService.findAll(ctx, args.options || undefined);
}
}
```
and the corresponding service will use the ListQueryBuilder:
```ts
@Injectable()
export class BlogPostService {
constructor(private listQueryBuilder: ListQueryBuilder) {}
findAll(ctx: RequestContext, options?: ListQueryOptions<BlogPost>) {
return this.listQueryBuilder
.build(BlogPost, options)
.getManyAndCount()
.then(async ([items, totalItems]) => {
return { items, totalItems };
});
}
}
```
```ts title="Signature"
class ListQueryBuilder implements OnApplicationBootstrap {
constructor(connection: TransactionalConnection, configService: ConfigService)
filterObjectHasProperty(filterObject: FP | NullOptionals<FP> | null | undefined, property: keyof FP) => boolean;
build(entity: Type<T>, options: ListQueryOptions<T> = {}, extendedOptions: ExtendedListQueryOptions<T> = {}) => SelectQueryBuilder<T>;
}
```
* Implements: <code>OnApplicationBootstrap</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(connection: <a href='/reference/typescript-api/data-access/transactional-connection#transactionalconnection'>TransactionalConnection</a>, configService: ConfigService) => ListQueryBuilder`} />
### filterObjectHasProperty
<MemberInfo kind="method" type={`(filterObject: FP | NullOptionals<FP> | null | undefined, property: keyof FP) => boolean`} />
Used to determine whether a list query `filter` object contains the
given property, either at the top level or nested inside a boolean
`_and` or `_or` expression.
This is useful when a custom property map is used to map a filter
field to a related entity, and we need to determine whether the
filter object contains that property, which then means we would need
to join that relation.
### build
<MemberInfo kind="method" type={`(entity: Type<T>, options: ListQueryOptions<T> = {}, extendedOptions: <a href='/reference/typescript-api/data-access/list-query-builder#extendedlistqueryoptions'>ExtendedListQueryOptions</a><T> = {}) => SelectQueryBuilder<T>`} />
</div>
## ExtendedListQueryOptions
<GenerationInfo sourceFile="packages/core/src/service/helpers/list-query-builder/list-query-builder.ts" sourceLine="41" packageName="@vendure/core" />
Options which can be passed to the ListQueryBuilder's `build()` method.
```ts title="Signature"
type ExtendedListQueryOptions<T extends VendureEntity> = {
relations?: string[];
channelId?: ID;
where?: FindOptionsWhere<T>;
orderBy?: FindOneOptions<T>['order'];
entityAlias?: string;
ctx?: RequestContext;
customPropertyMap?: { [name: string]: string };
ignoreQueryLimits?: boolean;
}
```
<div className="members-wrapper">
### relations
<MemberInfo kind="property" type={`string[]`} />
### channelId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### where
<MemberInfo kind="property" type={`FindOptionsWhere<T>`} />
### orderBy
<MemberInfo kind="property" type={`FindOneOptions<T>['order']`} />
### entityAlias
<MemberInfo kind="property" type={`string`} since="1.6.0" />
Allows you to specify the alias used for the entity `T` in the generated SQL query.
Defaults to the entity class name lower-cased, i.e. `ProductVariant` -> `'productvariant'`.
### ctx
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>`} />
When a RequestContext is passed, then the query will be
executed as part of any outer transaction.
### customPropertyMap
<MemberInfo kind="property" type={`{ [name: string]: string }`} />
One of the main tasks of the ListQueryBuilder is to auto-generate filter and sort queries based on the
available columns of a given entity. However, it may also be sometimes desirable to allow filter/sort
on a property of a relation. In this case, the `customPropertyMap` can be used to define a property
of the `options.sort` or `options.filter` which does not correspond to a direct column of the current
entity, and then provide a mapping to the related property to be sorted/filtered.
Example: we want to allow sort/filter by and Order's `customerLastName`. The actual lastName property is
not a column in the Order table, it exists on the Customer entity, and Order has a relation to Customer via
`Order.customer`. Therefore, we can define a customPropertyMap like this:
*Example*
```GraphQL
"""
Manually extend the filter & sort inputs to include the new
field that we want to be able to use in building list queries.
"""
input OrderFilterParameter {
customerLastName: StringOperators
}
input OrderSortParameter {
customerLastName: SortOrder
}
```
*Example*
```ts
const qb = this.listQueryBuilder.build(Order, options, {
relations: ['customer'],
customPropertyMap: {
// Tell TypeORM how to map that custom
// sort/filter field to the property on a
// related entity.
customerLastName: 'customer.lastName',
},
};
```
We can now use the `customerLastName` property to filter or sort
on the list query:
*Example*
```GraphQL
query {
myOrderQuery(options: {
filter: {
customerLastName: { contains: "sm" }
}
}) {
# ...
}
}
```
### ignoreQueryLimits
<MemberInfo kind="property" type={`boolean`} default="false" since="2.0.2" />
When set to `true`, the configured `shopListQueryLimit` and `adminListQueryLimit` values will be ignored,
allowing unlimited results to be returned. Use caution when exposing an unlimited list query to the public,
as it could become a vector for a denial of service attack if an attacker requests a very large list.
</div>
|
---
title: "TransactionalConnection"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## TransactionalConnection
<GenerationInfo sourceFile="packages/core/src/connection/transactional-connection.ts" sourceLine="39" packageName="@vendure/core" />
The TransactionalConnection is a wrapper around the TypeORM `Connection` object which works in conjunction
with the <a href='/reference/typescript-api/request/transaction-decorator#transaction'>Transaction</a> decorator to implement per-request transactions. All services which access the
database should use this class rather than the raw TypeORM connection, to ensure that db changes can be
easily wrapped in transactions when required.
The service layer does not need to know about the scope of a transaction, as this is covered at the
API by the use of the `Transaction` decorator.
```ts title="Signature"
class TransactionalConnection {
constructor(dataSource: DataSource, transactionWrapper: TransactionWrapper)
rawConnection: DataSource
getRepository(target: ObjectType<Entity> | EntitySchema<Entity> | string) => Repository<Entity>;
getRepository(ctx: RequestContext | undefined, target: ObjectType<Entity> | EntitySchema<Entity> | string) => Repository<Entity>;
getRepository(ctxOrTarget: RequestContext | ObjectType<Entity> | EntitySchema<Entity> | string | undefined, maybeTarget?: ObjectType<Entity> | EntitySchema<Entity> | string) => Repository<Entity>;
withTransaction(work: (ctx: RequestContext) => Promise<T>) => Promise<T>;
withTransaction(ctx: RequestContext, work: (ctx: RequestContext) => Promise<T>) => Promise<T>;
withTransaction(ctxOrWork: RequestContext | ((ctx: RequestContext) => Promise<T>), maybeWork?: (ctx: RequestContext) => Promise<T>) => Promise<T>;
startTransaction(ctx: RequestContext, isolationLevel?: TransactionIsolationLevel) => ;
commitOpenTransaction(ctx: RequestContext) => ;
rollBackTransaction(ctx: RequestContext) => ;
getEntityOrThrow(ctx: RequestContext, entityType: Type<T>, id: ID, options: GetEntityOrThrowOptions<T> = {}) => Promise<T>;
findOneInChannel(ctx: RequestContext, entity: Type<T>, id: ID, channelId: ID, options: FindOneOptions<T> = {}) => ;
findByIdsInChannel(ctx: RequestContext, entity: Type<T>, ids: ID[], channelId: ID, options: FindManyOptions<T>) => ;
}
```
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(dataSource: DataSource, transactionWrapper: TransactionWrapper) => TransactionalConnection`} />
### rawConnection
<MemberInfo kind="property" type={`DataSource`} />
The plain TypeORM Connection object. Should be used carefully as any operations
performed with this connection will not be performed within any outer
transactions.
### getRepository
<MemberInfo kind="method" type={`(target: ObjectType<Entity> | EntitySchema<Entity> | string) => Repository<Entity>`} />
Returns a TypeORM repository. Note that when no RequestContext is supplied, the repository will not
be aware of any existing transaction. Therefore, calling this method without supplying a RequestContext
is discouraged without a deliberate reason.
### getRepository
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a> | undefined, target: ObjectType<Entity> | EntitySchema<Entity> | string) => Repository<Entity>`} />
Returns a TypeORM repository which is bound to any existing transactions. It is recommended to _always_ pass
the RequestContext argument when possible, otherwise the queries will be executed outside of any
ongoing transactions which have been started by the <a href='/reference/typescript-api/request/transaction-decorator#transaction'>Transaction</a> decorator.
### getRepository
<MemberInfo kind="method" type={`(ctxOrTarget: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a> | ObjectType<Entity> | EntitySchema<Entity> | string | undefined, maybeTarget?: ObjectType<Entity> | EntitySchema<Entity> | string) => Repository<Entity>`} />
### withTransaction
<MemberInfo kind="method" type={`(work: (ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => Promise<T>) => Promise<T>`} since="1.3.0" />
Allows database operations to be wrapped in a transaction, ensuring that in the event of an error being
thrown at any point, the entire transaction will be rolled back and no changes will be saved.
In the context of API requests, you should instead use the <a href='/reference/typescript-api/request/transaction-decorator#transaction'>Transaction</a> decorator on your resolver or
controller method.
On the other hand, for code that does not run in the context of a GraphQL/REST request, this method
should be used to protect against non-atomic changes to the data which could leave your data in an
inconsistent state.
Such situations include function processed by the JobQueue or stand-alone scripts which make use
of Vendure internal services.
If there is already a <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a> object available, you should pass it in as the first
argument in order to create transactional context as the copy. If not, omit the first argument and an empty
RequestContext object will be created, which is then used to propagate the transaction to
all inner method calls.
*Example*
```ts
private async transferCredit(outerCtx: RequestContext, fromId: ID, toId: ID, amount: number) {
await this.connection.withTransaction(outerCtx, async ctx => {
// Note you must not use `outerCtx` here, instead use `ctx`. Otherwise, this query
// will be executed outside of transaction
await this.giftCardService.updateCustomerCredit(ctx, fromId, -amount);
await this.connection.getRepository(ctx, GiftCard).update(fromId, { transferred: true })
// If some intermediate logic here throws an Error,
// then all DB transactions will be rolled back and neither Customer's
// credit balance will have changed.
await this.giftCardService.updateCustomerCredit(ctx, toId, amount);
})
}
```
### withTransaction
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, work: (ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => Promise<T>) => Promise<T>`} />
### withTransaction
<MemberInfo kind="method" type={`(ctxOrWork: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a> | ((ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => Promise<T>), maybeWork?: (ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => Promise<T>) => Promise<T>`} />
### startTransaction
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, isolationLevel?: <a href='/reference/typescript-api/request/transaction-decorator#transactionisolationlevel'>TransactionIsolationLevel</a>) => `} />
Manually start a transaction if one is not already in progress. This method should be used in
conjunction with the `'manual'` mode of the <a href='/reference/typescript-api/request/transaction-decorator#transaction'>Transaction</a> decorator.
### commitOpenTransaction
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => `} />
Manually commits any open transaction. Should be very rarely needed, since the <a href='/reference/typescript-api/request/transaction-decorator#transaction'>Transaction</a> decorator
and the internal TransactionInterceptor take care of this automatically. Use-cases include situations
in which the worker thread needs to access changes made in the current transaction, or when using the
Transaction decorator in manual mode.
### rollBackTransaction
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>) => `} />
Manually rolls back any open transaction. Should be very rarely needed, since the <a href='/reference/typescript-api/request/transaction-decorator#transaction'>Transaction</a> decorator
and the internal TransactionInterceptor take care of this automatically. Use-cases include when using the
Transaction decorator in manual mode.
### getEntityOrThrow
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, entityType: Type<T>, id: <a href='/reference/typescript-api/common/id#id'>ID</a>, options: <a href='/reference/typescript-api/data-access/get-entity-or-throw-options#getentityorthrowoptions'>GetEntityOrThrowOptions</a><T> = {}) => Promise<T>`} />
Finds an entity of the given type by ID, or throws an `EntityNotFoundError` if none
is found.
### findOneInChannel
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, entity: Type<T>, id: <a href='/reference/typescript-api/common/id#id'>ID</a>, channelId: <a href='/reference/typescript-api/common/id#id'>ID</a>, options: FindOneOptions<T> = {}) => `} />
Like the TypeOrm `Repository.findOne()` method, but limits the results to
the given Channel.
### findByIdsInChannel
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, entity: Type<T>, ids: <a href='/reference/typescript-api/common/id#id'>ID</a>[], channelId: <a href='/reference/typescript-api/common/id#id'>ID</a>, options: FindManyOptions<T>) => `} />
Like the TypeOrm `Repository.findByIds()` method, but limits the results to
the given Channel.
</div>
|
---
title: "DefaultSearchPluginInitOptions"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## DefaultSearchPluginInitOptions
<GenerationInfo sourceFile="packages/core/src/plugin/default-search-plugin/types.ts" sourceLine="15" packageName="@vendure/core" />
Options which configure the behaviour of the DefaultSearchPlugin
```ts title="Signature"
interface DefaultSearchPluginInitOptions {
indexStockStatus?: boolean;
bufferUpdates?: boolean;
searchStrategy?: SearchStrategy;
}
```
<div className="members-wrapper">
### indexStockStatus
<MemberInfo kind="property" type={`boolean`} default="false." />
If set to `true`, the stock status of a ProductVariant (inStock: Boolean) will
be exposed in the `search` query results. Enabling this option on an existing
Vendure installation will require a DB migration/synchronization.
### bufferUpdates
<MemberInfo kind="property" type={`boolean`} default="false" since="1.3.0" />
If set to `true`, updates to Products, ProductVariants and Collections will not immediately
trigger an update to the search index. Instead, all these changes will be buffered and will
only be run via a call to the `runPendingSearchIndexUpdates` mutation in the Admin API.
This is very useful for installations with a large number of ProductVariants and/or
Collections, as the buffering allows better control over when these expensive jobs are run,
and also performs optimizations to minimize the amount of work that needs to be performed by
the worker.
### searchStrategy
<MemberInfo kind="property" type={`SearchStrategy`} default="undefined" since="1.6.0" />
Set a custom search strategy that implements {@link SearchStrategy} or extends an existing search strategy
such as {@link MysqlSearchStrategy}, {@link PostgresSearchStrategy} or {@link SqliteSearchStrategy}.
*Example*
```ts
export class MySearchStrategy implements SearchStrategy {
private readonly minTermLength = 2;
private connection: TransactionalConnection;
private options: DefaultSearchPluginInitOptions;
async init(injector: Injector) {
this.connection = injector.get(TransactionalConnection);
this.options = injector.get(PLUGIN_INIT_OPTIONS);
}
async getFacetValueIds(
ctx: RequestContext,
input: SearchInput,
enabledOnly: boolean,
): Promise<Map<ID, number>> {
// ...
return createFacetIdCountMap(facetValuesResult);
}
async getCollectionIds(
ctx: RequestContext,
input: SearchInput,
enabledOnly: boolean,
): Promise<Map<ID, number>> {
// ...
return createCollectionIdCountMap(collectionsResult);
}
async getSearchResults(
ctx: RequestContext,
input: SearchInput,
enabledOnly: boolean,
): Promise<SearchResult[]> {
const take = input.take || 25;
const skip = input.skip || 0;
const sort = input.sort;
const qb = this.connection
.getRepository(SearchIndexItem)
.createQueryBuilder('si')
.select(this.createMysqlSelect(!!input.groupByProduct));
// ...
return qb
.take(take)
.skip(skip)
.getRawMany()
.then(res => res.map(r => mapToSearchResult(r, ctx.channel.currencyCode)));
}
async getTotalCount(ctx: RequestContext, input: SearchInput, enabledOnly: boolean): Promise<number> {
const innerQb = this.applyTermAndFilters(
ctx,
this.connection
.getRepository(SearchIndexItem)
.createQueryBuilder('si')
.select(this.createMysqlSelect(!!input.groupByProduct)),
input,
);
if (enabledOnly) {
innerQb.andWhere('si.enabled = :enabled', { enabled: true });
}
const totalItemsQb = this.connection.rawConnection
.createQueryBuilder()
.select('COUNT(*) as total')
.from(`(${innerQb.getQuery()})`, 'inner')
.setParameters(innerQb.getParameters());
return totalItemsQb.getRawOne().then(res => res.total);
}
}
```
</div>
|
---
title: "DefaultSearchPlugin"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## DefaultSearchPlugin
<GenerationInfo sourceFile="packages/core/src/plugin/default-search-plugin/default-search-plugin.ts" sourceLine="69" packageName="@vendure/core" />
The DefaultSearchPlugin provides a full-text Product search based on the full-text searching capabilities of the
underlying database.
The DefaultSearchPlugin is bundled with the `@vendure/core` package. If you are not using an alternative search
plugin, then make sure this one is used, otherwise you will not be able to search products via the
[`search` query](/reference/graphql-api/shop/queries#search).
:::caution
Note that the quality of the fulltext search capabilities varies depending on the underlying database being used. For example,
the MySQL & Postgres implementations will typically yield better results than the SQLite implementation.
:::
*Example*
```ts
import { DefaultSearchPlugin, VendureConfig } from '@vendure/core';
export const config: VendureConfig = {
// Add an instance of the plugin to the plugins array
plugins: [
DefaultSearchPlugin.init({
indexStockStatus: true,
bufferUpdates: true,
}),
],
};
```
```ts title="Signature"
class DefaultSearchPlugin implements OnApplicationBootstrap, OnApplicationShutdown {
static options: DefaultSearchPluginInitOptions = {};
init(options: DefaultSearchPluginInitOptions) => Type<DefaultSearchPlugin>;
}
```
* Implements: <code>OnApplicationBootstrap</code>, <code>OnApplicationShutdown</code>
<div className="members-wrapper">
### options
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/default-search-plugin/default-search-plugin-init-options#defaultsearchplugininitoptions'>DefaultSearchPluginInitOptions</a>`} />
### init
<MemberInfo kind="method" type={`(options: <a href='/reference/typescript-api/default-search-plugin/default-search-plugin-init-options#defaultsearchplugininitoptions'>DefaultSearchPluginInitOptions</a>) => Type<<a href='/reference/typescript-api/default-search-plugin/#defaultsearchplugin'>DefaultSearchPlugin</a>>`} />
</div>
|
---
title: "Entities"
weight: 10
date: 2023-07-14T16:57:49.454Z
showtoc: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
# entities |
---
title: "Address"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Address
<GenerationInfo sourceFile="packages/core/src/entity/address/address.entity.ts" sourceLine="16" packageName="@vendure/core" />
Represents a <a href='/reference/typescript-api/entities/customer#customer'>Customer</a>'s address.
```ts title="Signature"
class Address extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<Address>)
@Index()
@ManyToOne(type => Customer, customer => customer.addresses)
customer: Customer;
@Column({ default: '' }) fullName: string;
@Column({ default: '' })
company: string;
@Column() streetLine1: string;
@Column({ default: '' })
streetLine2: string;
@Column({ default: '' }) city: string;
@Column({ default: '' })
province: string;
@Column({ default: '' }) postalCode: string;
@Index()
@ManyToOne(type => Country)
country: Country;
@Column({ default: '' })
phoneNumber: string;
@Column({ default: false })
defaultShippingAddress: boolean;
@Column({ default: false })
defaultBillingAddress: boolean;
@Column(type => CustomAddressFields)
customFields: CustomAddressFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/address#address'>Address</a>>) => Address`} />
### customer
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer#customer'>Customer</a>`} />
### fullName
<MemberInfo kind="property" type={`string`} />
### company
<MemberInfo kind="property" type={`string`} />
### streetLine1
<MemberInfo kind="property" type={`string`} />
### streetLine2
<MemberInfo kind="property" type={`string`} />
### city
<MemberInfo kind="property" type={`string`} />
### province
<MemberInfo kind="property" type={`string`} />
### postalCode
<MemberInfo kind="property" type={`string`} />
### country
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/country#country'>Country</a>`} />
### phoneNumber
<MemberInfo kind="property" type={`string`} />
### defaultShippingAddress
<MemberInfo kind="property" type={`boolean`} />
### defaultBillingAddress
<MemberInfo kind="property" type={`boolean`} />
### customFields
<MemberInfo kind="property" type={`CustomAddressFields`} />
</div>
|
---
title: "Administrator"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Administrator
<GenerationInfo sourceFile="packages/core/src/entity/administrator/administrator.entity.ts" sourceLine="18" packageName="@vendure/core" />
An administrative user who has access to the Admin UI and Admin API. The
specific permissions of the Administrator are determined by the assigned
<a href='/reference/typescript-api/entities/role#role'>Role</a>s.
```ts title="Signature"
class Administrator extends VendureEntity implements SoftDeletable, HasCustomFields {
constructor(input?: DeepPartial<Administrator>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column() firstName: string;
@Column() lastName: string;
@Column({ unique: true })
emailAddress: string;
@OneToOne(type => User)
@JoinColumn()
user: User;
@Column(type => CustomAdministratorFields)
customFields: CustomAdministratorFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>, <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/administrator#administrator'>Administrator</a>>) => Administrator`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### firstName
<MemberInfo kind="property" type={`string`} />
### lastName
<MemberInfo kind="property" type={`string`} />
### emailAddress
<MemberInfo kind="property" type={`string`} />
### user
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/user#user'>User</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomAdministratorFields`} />
</div>
|
---
title: "AnonymousSession"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AnonymousSession
<GenerationInfo sourceFile="packages/core/src/entity/session/anonymous-session.entity.ts" sourceLine="16" packageName="@vendure/core" />
An anonymous session is created when a unauthenticated user interacts with restricted operations,
such as calling the `activeOrder` query in the Shop API. Anonymous sessions allow a guest Customer
to maintain an order without requiring authentication and a registered account beforehand.
```ts title="Signature"
class AnonymousSession extends Session {
constructor(input: DeepPartial<AnonymousSession>)
}
```
* Extends: <code><a href='/reference/typescript-api/entities/session#session'>Session</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/anonymous-session#anonymoussession'>AnonymousSession</a>>) => AnonymousSession`} />
</div>
|
---
title: "Asset"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Asset
<GenerationInfo sourceFile="packages/core/src/entity/asset/asset.entity.ts" sourceLine="22" packageName="@vendure/core" />
An Asset represents a file such as an image which can be associated with certain other entities
such as Products.
```ts title="Signature"
class Asset extends VendureEntity implements Taggable, ChannelAware, HasCustomFields {
constructor(input?: DeepPartial<Asset>)
@Column() name: string;
@Column('varchar') type: AssetType;
@Column() mimeType: string;
@Column({ default: 0 }) width: number;
@Column({ default: 0 }) height: number;
@Column() fileSize: number;
@Column() source: string;
@Column() preview: string;
@Column('simple-json', { nullable: true })
focalPoint?: { x: number; y: number };
@ManyToMany(type => Tag)
@JoinTable()
tags: Tag[];
@ManyToMany(type => Channel)
@JoinTable()
channels: Channel[];
@OneToMany(type => Collection, collection => collection.featuredAsset)
featuredInCollections?: Collection[];
@OneToMany(type => ProductVariant, productVariant => productVariant.featuredAsset)
featuredInVariants?: ProductVariant[];
@OneToMany(type => Product, product => product.featuredAsset)
featuredInProducts?: Product[];
@Column(type => CustomAssetFields)
customFields: CustomAssetFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#taggable'>Taggable</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/asset#asset'>Asset</a>>) => Asset`} />
### name
<MemberInfo kind="property" type={`string`} />
### type
<MemberInfo kind="property" type={`AssetType`} />
### mimeType
<MemberInfo kind="property" type={`string`} />
### width
<MemberInfo kind="property" type={`number`} />
### height
<MemberInfo kind="property" type={`number`} />
### fileSize
<MemberInfo kind="property" type={`number`} />
### source
<MemberInfo kind="property" type={`string`} />
### preview
<MemberInfo kind="property" type={`string`} />
### focalPoint
<MemberInfo kind="property" type={`{ x: number; y: number }`} />
### tags
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tag#tag'>Tag</a>[]`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### featuredInCollections
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>[]`} />
### featuredInVariants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
### featuredInProducts
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product#product'>Product</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomAssetFields`} />
</div>
|
---
title: "AuthenticatedSession"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AuthenticatedSession
<GenerationInfo sourceFile="packages/core/src/entity/session/authenticated-session.entity.ts" sourceLine="14" packageName="@vendure/core" />
An AuthenticatedSession is created upon successful authentication.
```ts title="Signature"
class AuthenticatedSession extends Session {
constructor(input: DeepPartial<AuthenticatedSession>)
@Index()
@ManyToOne(type => User, user => user.sessions)
user: User;
@Column()
authenticationStrategy: string;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/session#session'>Session</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/authenticated-session#authenticatedsession'>AuthenticatedSession</a>>) => AuthenticatedSession`} />
### user
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/user#user'>User</a>`} />
The <a href='/reference/typescript-api/entities/user#user'>User</a> who has authenticated to create this session.
### authenticationStrategy
<MemberInfo kind="property" type={`string`} />
The name of the <a href='/reference/typescript-api/auth/authentication-strategy#authenticationstrategy'>AuthenticationStrategy</a> used when authenticating
to create this session.
</div>
|
---
title: "AuthenticationMethod"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## AuthenticationMethod
<GenerationInfo sourceFile="packages/core/src/entity/authentication-method/authentication-method.entity.ts" sourceLine="14" packageName="@vendure/core" />
An AuthenticationMethod represents the means by which a <a href='/reference/typescript-api/entities/user#user'>User</a> is authenticated. There are two kinds:
<a href='/reference/typescript-api/entities/authentication-method#nativeauthenticationmethod'>NativeAuthenticationMethod</a> and <a href='/reference/typescript-api/entities/authentication-method#externalauthenticationmethod'>ExternalAuthenticationMethod</a>.
```ts title="Signature"
class AuthenticationMethod extends VendureEntity {
@Index()
@ManyToOne(type => User, user => user.authenticationMethods)
user: User;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### user
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/user#user'>User</a>`} />
</div>
## ExternalAuthenticationMethod
<GenerationInfo sourceFile="packages/core/src/entity/authentication-method/external-authentication-method.entity.ts" sourceLine="14" packageName="@vendure/core" />
This method is used when an external authentication service is used to authenticate Vendure Users.
Examples of external auth include social logins or corporate identity servers.
```ts title="Signature"
class ExternalAuthenticationMethod extends AuthenticationMethod {
constructor(input: DeepPartial<ExternalAuthenticationMethod>)
@Column()
strategy: string;
@Column()
externalIdentifier: string;
@Column('simple-json')
metadata: any;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/authentication-method#authenticationmethod'>AuthenticationMethod</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/authentication-method#externalauthenticationmethod'>ExternalAuthenticationMethod</a>>) => ExternalAuthenticationMethod`} />
### strategy
<MemberInfo kind="property" type={`string`} />
### externalIdentifier
<MemberInfo kind="property" type={`string`} />
### metadata
<MemberInfo kind="property" type={`any`} />
</div>
## NativeAuthenticationMethod
<GenerationInfo sourceFile="packages/core/src/entity/authentication-method/native-authentication-method.entity.ts" sourceLine="14" packageName="@vendure/core" />
This is the default, built-in authentication method which uses a identifier (typically username or email address)
and password combination to authenticate a User.
```ts title="Signature"
class NativeAuthenticationMethod extends AuthenticationMethod {
constructor(input?: DeepPartial<NativeAuthenticationMethod>)
@Column()
identifier: string;
@Column({ select: false }) passwordHash: string;
@Column({ type: 'varchar', nullable: true })
verificationToken: string | null;
@Column({ type: 'varchar', nullable: true })
passwordResetToken: string | null;
@Column({ type: 'varchar', nullable: true })
identifierChangeToken: string | null;
@Column({ type: 'varchar', nullable: true })
pendingIdentifier: string | null;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/authentication-method#authenticationmethod'>AuthenticationMethod</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/authentication-method#nativeauthenticationmethod'>NativeAuthenticationMethod</a>>) => NativeAuthenticationMethod`} />
### identifier
<MemberInfo kind="property" type={`string`} />
### passwordHash
<MemberInfo kind="property" type={`string`} />
### verificationToken
<MemberInfo kind="property" type={`string | null`} />
### passwordResetToken
<MemberInfo kind="property" type={`string | null`} />
### identifierChangeToken
<MemberInfo kind="property" type={`string | null`} />
A token issued when a User requests to change their identifier (typically
an email address)
### pendingIdentifier
<MemberInfo kind="property" type={`string | null`} />
When a request has been made to change the User's identifier, the new identifier
will be stored here until it has been verified, after which it will
replace the current value of the `identifier` field.
</div>
|
---
title: "Channel"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Channel
<GenerationInfo sourceFile="packages/core/src/entity/channel/channel.entity.ts" sourceLine="37" packageName="@vendure/core" />
A Channel represents a distinct sales channel and configures defaults for that
channel.
* Set a channel-specific currency, language, tax and shipping defaults
* Assign only specific Products to the Channel (with Channel-specific prices)
* Create Administrator roles limited to the Channel
* Assign only specific StockLocations, Assets, Facets, Collections, Promotions, ShippingMethods & PaymentMethods to the Channel
* Have Orders and Customers associated with specific Channels.
In Vendure, Channels have a number of different uses, such as:
* Multi-region stores, where there is a distinct website for each territory with its own available inventory, pricing, tax and shipping rules.
* Creating distinct rules and inventory for different sales channels such as Amazon.
* Specialized stores offering a subset of the main inventory.
* Implementing multi-vendor marketplace applications.
```ts title="Signature"
class Channel extends VendureEntity {
constructor(input?: DeepPartial<Channel>)
@Column({ unique: true })
code: string;
@Column({ unique: true })
token: string;
@Column({ default: '', nullable: true })
description: string;
@Index()
@ManyToOne(type => Seller, seller => seller.channels)
seller?: Seller;
@EntityId({ nullable: true })
sellerId?: ID;
@Column('varchar') defaultLanguageCode: LanguageCode;
@Column({ type: 'simple-array', nullable: true })
availableLanguageCodes: LanguageCode[];
@Index()
@ManyToOne(type => Zone, zone => zone.defaultTaxZoneChannels)
defaultTaxZone: Zone;
@Index()
@ManyToOne(type => Zone, zone => zone.defaultShippingZoneChannels)
defaultShippingZone: Zone;
@Column('varchar')
defaultCurrencyCode: CurrencyCode;
@Column({ type: 'simple-array', nullable: true })
availableCurrencyCodes: CurrencyCode[];
@Column({ default: true })
trackInventory: boolean;
@Column({ default: 0 })
outOfStockThreshold: number;
@Column(type => CustomChannelFields)
customFields: CustomChannelFields;
@Column() pricesIncludeTax: boolean;
@ManyToMany(type => Product, product => product.channels, { onDelete: 'CASCADE' })
products: Product[];
@ManyToMany(type => ProductVariant, productVariant => productVariant.channels, { onDelete: 'CASCADE' })
productVariants: ProductVariant[];
@ManyToMany(type => FacetValue, facetValue => facetValue.channels, { onDelete: 'CASCADE' })
facetValues: FacetValue[];
@ManyToMany(type => Facet, facet => facet.channels, { onDelete: 'CASCADE' })
facets: Facet[];
@ManyToMany(type => Collection, collection => collection.channels, { onDelete: 'CASCADE' })
collections: Collection[];
@ManyToMany(type => Promotion, promotion => promotion.channels, { onDelete: 'CASCADE' })
promotions: Promotion[];
@ManyToMany(type => PaymentMethod, paymentMethod => paymentMethod.channels, { onDelete: 'CASCADE' })
paymentMethods: PaymentMethod[];
@ManyToMany(type => ShippingMethod, shippingMethod => shippingMethod.channels, { onDelete: 'CASCADE' })
shippingMethods: ShippingMethod[];
@ManyToMany(type => Customer, customer => customer.channels, { onDelete: 'CASCADE' })
customers: Customer[];
@ManyToMany(type => Role, role => role.channels, { onDelete: 'CASCADE' })
roles: Role[];
@ManyToMany(type => StockLocation, stockLocation => stockLocation.channels, { onDelete: 'CASCADE' })
stockLocations: StockLocation[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>>) => Channel`} />
### code
<MemberInfo kind="property" type={`string`} />
The name of the Channel. For example "US Webstore" or "German Webstore".
### token
<MemberInfo kind="property" type={`string`} />
A unique token (string) used to identify the Channel in the `vendure-token` header of the
GraphQL API requests.
### description
<MemberInfo kind="property" type={`string`} />
### seller
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/seller#seller'>Seller</a>`} />
### sellerId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### defaultLanguageCode
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>`} />
### availableLanguageCodes
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>[]`} />
### defaultTaxZone
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/zone#zone'>Zone</a>`} />
### defaultShippingZone
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/zone#zone'>Zone</a>`} />
### defaultCurrencyCode
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/currency-code#currencycode'>CurrencyCode</a>`} />
### availableCurrencyCodes
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/currency-code#currencycode'>CurrencyCode</a>[]`} />
### trackInventory
<MemberInfo kind="property" type={`boolean`} />
Specifies the default value for inventory tracking for ProductVariants.
Can be overridden per ProductVariant, but this value determines the default
if not otherwise specified.
### outOfStockThreshold
<MemberInfo kind="property" type={`number`} />
Specifies the value of stockOnHand at which a given ProductVariant is considered
out of stock.
### customFields
<MemberInfo kind="property" type={`CustomChannelFields`} />
### pricesIncludeTax
<MemberInfo kind="property" type={`boolean`} />
### products
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product#product'>Product</a>[]`} />
### productVariants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
### facetValues
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>[]`} />
### facets
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/facet#facet'>Facet</a>[]`} />
### collections
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>[]`} />
### promotions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a>[]`} />
### paymentMethods
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/payment-method#paymentmethod'>PaymentMethod</a>[]`} />
### shippingMethods
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a>[]`} />
### customers
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer#customer'>Customer</a>[]`} />
### roles
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/role#role'>Role</a>[]`} />
### stockLocations
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-location#stocklocation'>StockLocation</a>[]`} />
</div>
|
---
title: "Collection"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Collection
<GenerationInfo sourceFile="packages/core/src/entity/collection/collection.entity.ts" sourceLine="35" packageName="@vendure/core" />
A Collection is a grouping of <a href='/reference/typescript-api/entities/product#product'>Product</a>s based on various configurable criteria.
```ts title="Signature"
class Collection extends VendureEntity implements Translatable, HasCustomFields, ChannelAware, Orderable {
constructor(input?: DeepPartial<Collection>)
@Column({ default: false })
isRoot: boolean;
@Column()
position: number;
@Column({ default: false })
isPrivate: boolean;
name: LocaleString;
description: LocaleString;
slug: LocaleString;
@OneToMany(type => CollectionTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Collection>>;
@Index()
@ManyToOne(type => Asset, asset => asset.featuredInCollections, { onDelete: 'SET NULL' })
featuredAsset: Asset;
@OneToMany(type => CollectionAsset, collectionAsset => collectionAsset.collection)
assets: CollectionAsset[];
@Column('simple-json') filters: ConfigurableOperation[];
@Column({ default: true }) inheritFilters: boolean;
@ManyToMany(type => ProductVariant, productVariant => productVariant.collections)
@JoinTable()
productVariants: ProductVariant[];
@Column(type => CustomCollectionFields)
customFields: CustomCollectionFields;
@TreeChildren()
children: Collection[];
@TreeParent()
parent: Collection;
@EntityId({ nullable: true })
parentId: ID;
@ManyToMany(type => Channel, channel => channel.collections)
@JoinTable()
channels: Channel[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#orderable'>Orderable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>>) => Collection`} />
### isRoot
<MemberInfo kind="property" type={`boolean`} />
### position
<MemberInfo kind="property" type={`number`} />
### isPrivate
<MemberInfo kind="property" type={`boolean`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### description
<MemberInfo kind="property" type={`LocaleString`} />
### slug
<MemberInfo kind="property" type={`LocaleString`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>>>`} />
### featuredAsset
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/asset#asset'>Asset</a>`} />
### assets
<MemberInfo kind="property" type={`CollectionAsset[]`} />
### filters
<MemberInfo kind="property" type={`ConfigurableOperation[]`} />
### inheritFilters
<MemberInfo kind="property" type={`boolean`} since="2.0.0" />
### productVariants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomCollectionFields`} />
### children
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>[]`} />
### parent
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>`} />
### parentId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
</div>
|
---
title: "Country"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Country
<GenerationInfo sourceFile="packages/core/src/entity/region/country.entity.ts" sourceLine="14" packageName="@vendure/core" />
A country to which is available when creating / updating an <a href='/reference/typescript-api/entities/address#address'>Address</a>. Countries are
grouped together into <a href='/reference/typescript-api/entities/zone#zone'>Zone</a>s which are in turn used to determine applicable shipping
and taxes for an <a href='/reference/typescript-api/entities/order#order'>Order</a>.
```ts title="Signature"
class Country extends Region {
constructor(input?: DeepPartial<Country>)
readonly type: RegionType = 'country';
}
```
* Extends: <code><a href='/reference/typescript-api/entities/region#region'>Region</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/country#country'>Country</a>>) => Country`} />
### type
<MemberInfo kind="property" type={`RegionType`} />
</div>
|
---
title: "CustomerGroup"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## CustomerGroup
<GenerationInfo sourceFile="packages/core/src/entity/customer-group/customer-group.entity.ts" sourceLine="17" packageName="@vendure/core" />
A grouping of <a href='/reference/typescript-api/entities/customer#customer'>Customer</a>s which enables features such as group-based promotions
or tax rules.
```ts title="Signature"
class CustomerGroup extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<CustomerGroup>)
@Column() name: string;
@ManyToMany(type => Customer, customer => customer.groups)
customers: Customer[];
@Column(type => CustomCustomerGroupFields)
customFields: CustomCustomerGroupFields;
@OneToMany(type => TaxRate, taxRate => taxRate.zone)
taxRates: TaxRate[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/customer-group#customergroup'>CustomerGroup</a>>) => CustomerGroup`} />
### name
<MemberInfo kind="property" type={`string`} />
### customers
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer#customer'>Customer</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomCustomerGroupFields`} />
### taxRates
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a>[]`} />
</div>
|
---
title: "CustomerHistoryEntry"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## CustomerHistoryEntry
<GenerationInfo sourceFile="packages/core/src/entity/history-entry/customer-history-entry.entity.ts" sourceLine="14" packageName="@vendure/core" />
Represents an event in the history of a particular <a href='/reference/typescript-api/entities/customer#customer'>Customer</a>.
```ts title="Signature"
class CustomerHistoryEntry extends HistoryEntry {
constructor(input: DeepPartial<CustomerHistoryEntry>)
@Index()
@ManyToOne(type => Customer, { onDelete: 'CASCADE' })
customer: Customer;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/history-entry#historyentry'>HistoryEntry</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/customer-history-entry#customerhistoryentry'>CustomerHistoryEntry</a>>) => CustomerHistoryEntry`} />
### customer
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer#customer'>Customer</a>`} />
</div>
|
---
title: "Customer"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Customer
<GenerationInfo sourceFile="packages/core/src/entity/customer/customer.entity.ts" sourceLine="22" packageName="@vendure/core" />
This entity represents a customer of the store, typically an individual person. A Customer can be
a guest, in which case it has no associated <a href='/reference/typescript-api/entities/user#user'>User</a>. Customers with registered account will
have an associated User entity.
```ts title="Signature"
class Customer extends VendureEntity implements ChannelAware, HasCustomFields, SoftDeletable {
constructor(input?: DeepPartial<Customer>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column({ nullable: true })
title: string;
@Column() firstName: string;
@Column() lastName: string;
@Column({ nullable: true })
phoneNumber: string;
@Column()
emailAddress: string;
@ManyToMany(type => CustomerGroup, group => group.customers)
@JoinTable()
groups: CustomerGroup[];
@OneToMany(type => Address, address => address.customer)
addresses: Address[];
@OneToMany(type => Order, order => order.customer)
orders: Order[];
@OneToOne(type => User, { eager: true })
@JoinColumn()
user?: User;
@Column(type => CustomCustomerFields)
customFields: CustomCustomerFields;
@ManyToMany(type => Channel, channel => channel.customers)
@JoinTable()
channels: Channel[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/customer#customer'>Customer</a>>) => Customer`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### title
<MemberInfo kind="property" type={`string`} />
### firstName
<MemberInfo kind="property" type={`string`} />
### lastName
<MemberInfo kind="property" type={`string`} />
### phoneNumber
<MemberInfo kind="property" type={`string`} />
### emailAddress
<MemberInfo kind="property" type={`string`} />
### groups
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer-group#customergroup'>CustomerGroup</a>[]`} />
### addresses
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/address#address'>Address</a>[]`} />
### orders
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>[]`} />
### user
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/user#user'>User</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomCustomerFields`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
</div>
|
---
title: "FacetValue"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## FacetValue
<GenerationInfo sourceFile="packages/core/src/entity/facet-value/facet-value.entity.ts" sourceLine="23" packageName="@vendure/core" />
A particular value of a <a href='/reference/typescript-api/entities/facet#facet'>Facet</a>.
```ts title="Signature"
class FacetValue extends VendureEntity implements Translatable, HasCustomFields, ChannelAware {
constructor(input?: DeepPartial<FacetValue>)
name: LocaleString;
@Column() code: string;
@OneToMany(type => FacetValueTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<FacetValue>>;
@Index()
@ManyToOne(type => Facet, group => group.values, { onDelete: 'CASCADE' })
facet: Facet;
@EntityId()
facetId: ID;
@Column(type => CustomFacetValueFields)
customFields: CustomFacetValueFields;
@ManyToMany(type => Channel, channel => channel.facetValues)
@JoinTable()
channels: Channel[];
@ManyToMany(() => Product, product => product.facetValues, { onDelete: 'CASCADE' })
products: Product[];
@ManyToMany(type => ProductVariant, productVariant => productVariant.facetValues)
productVariants: ProductVariant[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>>) => FacetValue`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### code
<MemberInfo kind="property" type={`string`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>>>`} />
### facet
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/facet#facet'>Facet</a>`} />
### facetId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomFacetValueFields`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### products
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product#product'>Product</a>[]`} />
### productVariants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
</div>
|
---
title: "Facet"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Facet
<GenerationInfo sourceFile="packages/core/src/entity/facet/facet.entity.ts" sourceLine="25" packageName="@vendure/core" />
A Facet is a class of properties which can be applied to a <a href='/reference/typescript-api/entities/product#product'>Product</a> or <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>.
They are used to enable [faceted search](https://en.wikipedia.org/wiki/Faceted_search) whereby products
can be filtered along a number of dimensions (facets).
For example, there could be a Facet named "Brand" which has a number of <a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>s representing
the various brands of product, e.g. "Apple", "Samsung", "Dell", "HP" etc.
```ts title="Signature"
class Facet extends VendureEntity implements Translatable, HasCustomFields, ChannelAware {
constructor(input?: DeepPartial<Facet>)
name: LocaleString;
@Column({ default: false })
isPrivate: boolean;
@Column({ unique: true })
code: string;
@OneToMany(type => FacetTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Facet>>;
@OneToMany(type => FacetValue, value => value.facet)
values: FacetValue[];
@Column(type => CustomFacetFields)
customFields: CustomFacetFields;
@ManyToMany(type => Channel, channel => channel.facets)
@JoinTable()
channels: Channel[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/facet#facet'>Facet</a>>) => Facet`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### isPrivate
<MemberInfo kind="property" type={`boolean`} />
### code
<MemberInfo kind="property" type={`string`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/facet#facet'>Facet</a>>>`} />
### values
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomFacetFields`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
</div>
|
---
title: "Fulfillment"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Fulfillment
<GenerationInfo sourceFile="packages/core/src/entity/fulfillment/fulfillment.entity.ts" sourceLine="18" packageName="@vendure/core" />
This entity represents a fulfillment of an Order or part of it, i.e. which <a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>s have been
delivered to the Customer after successful payment.
```ts title="Signature"
class Fulfillment extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<Fulfillment>)
@Column('varchar') state: FulfillmentState;
@Column({ default: '' })
trackingCode: string;
@Column()
method: string;
@Column()
handlerCode: string;
@OneToMany(type => FulfillmentLine, fulfillmentLine => fulfillmentLine.fulfillment)
lines: FulfillmentLine[];
@ManyToMany(type => Order, order => order.fulfillments)
orders: Order[];
@Column(type => CustomFulfillmentFields)
customFields: CustomFulfillmentFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/fulfillment#fulfillment'>Fulfillment</a>>) => Fulfillment`} />
### state
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/fulfillment/fulfillment-state#fulfillmentstate'>FulfillmentState</a>`} />
### trackingCode
<MemberInfo kind="property" type={`string`} />
### method
<MemberInfo kind="property" type={`string`} />
### handlerCode
<MemberInfo kind="property" type={`string`} />
### lines
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line-reference#fulfillmentline'>FulfillmentLine</a>[]`} />
### orders
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomFulfillmentFields`} />
</div>
|
---
title: "HistoryEntry"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## HistoryEntry
<GenerationInfo sourceFile="packages/core/src/entity/history-entry/history-entry.entity.ts" sourceLine="14" packageName="@vendure/core" />
An abstract entity representing an entry in the history of an Order (<a href='/reference/typescript-api/entities/order-history-entry#orderhistoryentry'>OrderHistoryEntry</a>)
or a Customer (<a href='/reference/typescript-api/entities/customer-history-entry#customerhistoryentry'>CustomerHistoryEntry</a>).
```ts title="Signature"
class HistoryEntry extends VendureEntity {
@Index()
@ManyToOne(type => Administrator)
administrator?: Administrator;
@Column({ nullable: false, type: 'varchar' })
readonly type: HistoryEntryType;
@Column()
isPublic: boolean;
@Column('simple-json')
data: any;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### administrator
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/administrator#administrator'>Administrator</a>`} />
### type
<MemberInfo kind="property" type={`HistoryEntryType`} />
### isPublic
<MemberInfo kind="property" type={`boolean`} />
### data
<MemberInfo kind="property" type={`any`} />
</div>
|
---
title: "Entities"
isDefaultIndex: true
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
import DocCardList from '@theme/DocCardList';
<DocCardList /> |
---
title: "Interfaces"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ChannelAware
<GenerationInfo sourceFile="packages/core/src/common/types/common-types.ts" sourceLine="17" packageName="@vendure/core" />
Entities which can be assigned to Channels should implement this interface.
```ts title="Signature"
interface ChannelAware {
channels: Channel[];
}
```
<div className="members-wrapper">
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
</div>
## SoftDeletable
<GenerationInfo sourceFile="packages/core/src/common/types/common-types.ts" sourceLine="28" packageName="@vendure/core" />
Entities which can be soft deleted should implement this interface.
```ts title="Signature"
interface SoftDeletable {
deletedAt: Date | null;
}
```
<div className="members-wrapper">
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
</div>
## Orderable
<GenerationInfo sourceFile="packages/core/src/common/types/common-types.ts" sourceLine="39" packageName="@vendure/core" />
Entities which can be ordered relative to their siblings in a list.
```ts title="Signature"
interface Orderable {
position: number;
}
```
<div className="members-wrapper">
### position
<MemberInfo kind="property" type={`number`} />
</div>
## Taggable
<GenerationInfo sourceFile="packages/core/src/common/types/common-types.ts" sourceLine="50" packageName="@vendure/core" />
Entities which can have Tags applied to them.
```ts title="Signature"
interface Taggable {
tags: Tag[];
}
```
<div className="members-wrapper">
### tags
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tag#tag'>Tag</a>[]`} />
</div>
## Translatable
<GenerationInfo sourceFile="packages/core/src/common/types/locale-types.ts" sourceLine="29" packageName="@vendure/core" />
Entities which have localizable string properties should implement this type.
```ts title="Signature"
interface Translatable {
translations: Array<Translation<VendureEntity>>;
}
```
<div className="members-wrapper">
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a>>>`} />
</div>
|
---
title: "OrderHistoryEntry"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## OrderHistoryEntry
<GenerationInfo sourceFile="packages/core/src/entity/history-entry/order-history-entry.entity.ts" sourceLine="14" packageName="@vendure/core" />
Represents an event in the history of a particular <a href='/reference/typescript-api/entities/order#order'>Order</a>.
```ts title="Signature"
class OrderHistoryEntry extends HistoryEntry {
constructor(input: DeepPartial<OrderHistoryEntry>)
@Index()
@ManyToOne(type => Order, { onDelete: 'CASCADE' })
order: Order;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/history-entry#historyentry'>HistoryEntry</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/order-history-entry#orderhistoryentry'>OrderHistoryEntry</a>>) => OrderHistoryEntry`} />
### order
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
</div>
|
---
title: "OrderLineReference"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## FulfillmentLine
<GenerationInfo sourceFile="packages/core/src/entity/order-line-reference/fulfillment-line.entity.ts" sourceLine="16" packageName="@vendure/core" />
This entity represents a line from an <a href='/reference/typescript-api/entities/order#order'>Order</a> which has been fulfilled by a <a href='/reference/typescript-api/entities/fulfillment#fulfillment'>Fulfillment</a>.
```ts title="Signature"
class FulfillmentLine extends OrderLineReference {
constructor(input?: DeepPartial<FulfillmentLine>)
@Index()
@ManyToOne(type => Fulfillment, fulfillment => fulfillment.lines)
fulfillment: Fulfillment;
@EntityId()
fulfillmentId: ID;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/order-line-reference#orderlinereference'>OrderLineReference</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/order-line-reference#fulfillmentline'>FulfillmentLine</a>>) => FulfillmentLine`} />
### fulfillment
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/fulfillment#fulfillment'>Fulfillment</a>`} />
### fulfillmentId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
</div>
## OrderLineReference
<GenerationInfo sourceFile="packages/core/src/entity/order-line-reference/order-line-reference.entity.ts" sourceLine="15" packageName="@vendure/core" />
This is an abstract base class for entities which reference an <a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>.
```ts title="Signature"
class OrderLineReference extends VendureEntity {
@Column()
quantity: number;
@Index()
@ManyToOne(type => OrderLine, line => line.linesReferences, { onDelete: 'CASCADE' })
orderLine: OrderLine;
@EntityId()
orderLineId: ID;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### quantity
<MemberInfo kind="property" type={`number`} />
### orderLine
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>`} />
### orderLineId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
</div>
## OrderModificationLine
<GenerationInfo sourceFile="packages/core/src/entity/order-line-reference/order-modification-line.entity.ts" sourceLine="16" packageName="@vendure/core" />
This entity represents a line from an <a href='/reference/typescript-api/entities/order#order'>Order</a> which has been modified by an <a href='/reference/typescript-api/entities/order-modification#ordermodification'>OrderModification</a>.
```ts title="Signature"
class OrderModificationLine extends OrderLineReference {
constructor(input?: DeepPartial<OrderModificationLine>)
@Index()
@ManyToOne(type => OrderModification, modification => modification.lines)
modification: OrderModification;
@EntityId()
modificationId: ID;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/order-line-reference#orderlinereference'>OrderLineReference</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/order-line-reference#ordermodificationline'>OrderModificationLine</a>>) => OrderModificationLine`} />
### modification
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-modification#ordermodification'>OrderModification</a>`} />
### modificationId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
</div>
## RefundLine
<GenerationInfo sourceFile="packages/core/src/entity/order-line-reference/refund-line.entity.ts" sourceLine="16" packageName="@vendure/core" />
This entity represents a line from an <a href='/reference/typescript-api/entities/order#order'>Order</a> which has been refunded by a {@link Refund}.
```ts title="Signature"
class RefundLine extends OrderLineReference {
constructor(input?: DeepPartial<RefundLine>)
@Index()
@ManyToOne(type => Refund, refund => refund.lines)
refund: Refund;
@EntityId()
refundId: ID;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/order-line-reference#orderlinereference'>OrderLineReference</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/order-line-reference#refundline'>RefundLine</a>>) => RefundLine`} />
### refund
<MemberInfo kind="property" type={`Refund`} />
### refundId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
</div>
|
---
title: "OrderLine"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## OrderLine
<GenerationInfo sourceFile="packages/core/src/entity/order-line/order-line.entity.ts" sourceLine="32" packageName="@vendure/core" />
A single line on an <a href='/reference/typescript-api/entities/order#order'>Order</a> which contains information about the <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> and
quantity ordered, as well as the price and tax information.
```ts title="Signature"
class OrderLine extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<OrderLine>)
@Index()
@ManyToOne(type => Channel, { nullable: true, onDelete: 'SET NULL' })
sellerChannel?: Channel;
@EntityId({ nullable: true })
sellerChannelId?: ID;
@Index()
@ManyToOne(type => ShippingLine, shippingLine => shippingLine.orderLines, {
nullable: true,
onDelete: 'SET NULL',
})
shippingLine?: ShippingLine;
@EntityId({ nullable: true })
shippingLineId?: ID;
@Index()
@ManyToOne(type => ProductVariant, productVariant => productVariant.lines, { onDelete: 'CASCADE' })
productVariant: ProductVariant;
@EntityId()
productVariantId: ID;
@Index()
@ManyToOne(type => TaxCategory)
taxCategory: TaxCategory;
@Index()
@ManyToOne(type => Asset, asset => asset.featuredInVariants, { onDelete: 'SET NULL' })
featuredAsset: Asset;
@Index()
@ManyToOne(type => Order, order => order.lines, { onDelete: 'CASCADE' })
order: Order;
@OneToMany(type => OrderLineReference, lineRef => lineRef.orderLine)
linesReferences: OrderLineReference[];
@OneToMany(type => Sale, sale => sale.orderLine)
sales: Sale[];
@Column()
quantity: number;
@Column({ default: 0 })
orderPlacedQuantity: number;
@Money({ nullable: true })
initialListPrice: number;
@Money()
listPrice: number;
@Column()
listPriceIncludesTax: boolean;
@Column('simple-json')
adjustments: Adjustment[];
@Column('simple-json')
taxLines: TaxLine[];
@OneToMany(type => Cancellation, cancellation => cancellation.orderLine)
cancellations: Cancellation[];
@OneToMany(type => Allocation, allocation => allocation.orderLine)
allocations: Allocation[];
@Column(type => CustomOrderLineFields)
customFields: CustomOrderLineFields;
unitPrice: number
unitPriceWithTax: number
unitPriceChangeSinceAdded: number
unitPriceWithTaxChangeSinceAdded: number
discountedUnitPrice: number
discountedUnitPriceWithTax: number
proratedUnitPrice: number
proratedUnitPriceWithTax: number
unitTax: number
proratedUnitTax: number
taxRate: number
linePrice: number
linePriceWithTax: number
discountedLinePrice: number
discountedLinePriceWithTax: number
discounts: Discount[]
lineTax: number
proratedLinePrice: number
proratedLinePriceWithTax: number
proratedLineTax: number
addAdjustment(adjustment: Adjustment) => ;
clearAdjustments(type?: AdjustmentType) => ;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>>) => OrderLine`} />
### sellerChannel
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>`} />
The <a href='/reference/typescript-api/entities/channel#channel'>Channel</a> of the <a href='/reference/typescript-api/entities/seller#seller'>Seller</a> for a multivendor setup.
### sellerChannelId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### shippingLine
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/shipping-line#shippingline'>ShippingLine</a>`} />
The <a href='/reference/typescript-api/entities/shipping-line#shippingline'>ShippingLine</a> to which this line has been assigned.
This is determined by the configured <a href='/reference/typescript-api/shipping/shipping-line-assignment-strategy#shippinglineassignmentstrategy'>ShippingLineAssignmentStrategy</a>.
### shippingLineId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### productVariant
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>`} />
The <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> which is being ordered.
### productVariantId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### taxCategory
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a>`} />
### featuredAsset
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/asset#asset'>Asset</a>`} />
### order
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
### linesReferences
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line-reference#orderlinereference'>OrderLineReference</a>[]`} />
### sales
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-movement#sale'>Sale</a>[]`} />
### quantity
<MemberInfo kind="property" type={`number`} />
### orderPlacedQuantity
<MemberInfo kind="property" type={`number`} />
The quantity of this OrderLine at the time the order was placed (as per the <a href='/reference/typescript-api/orders/order-placed-strategy#orderplacedstrategy'>OrderPlacedStrategy</a>).
### initialListPrice
<MemberInfo kind="property" type={`number`} />
The price as calculated when the OrderLine was first added to the Order. Usually will be identical to the
`listPrice`, except when the ProductVariant price has changed in the meantime and a re-calculation of
the Order has been performed.
### listPrice
<MemberInfo kind="property" type={`number`} />
This is the price as listed by the ProductVariant (and possibly modified by the <a href='/reference/typescript-api/orders/order-item-price-calculation-strategy#orderitempricecalculationstrategy'>OrderItemPriceCalculationStrategy</a>),
which, depending on the current Channel, may or may not include tax.
### listPriceIncludesTax
<MemberInfo kind="property" type={`boolean`} />
Whether the listPrice includes tax, which depends on the settings of the current Channel.
### adjustments
<MemberInfo kind="property" type={`Adjustment[]`} />
### taxLines
<MemberInfo kind="property" type={`TaxLine[]`} />
### cancellations
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-movement#cancellation'>Cancellation</a>[]`} />
### allocations
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-movement#allocation'>Allocation</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomOrderLineFields`} />
### unitPrice
<MemberInfo kind="property" type={`number`} />
The price of a single unit, excluding tax and discounts.
### unitPriceWithTax
<MemberInfo kind="property" type={`number`} />
The price of a single unit, including tax but excluding discounts.
### unitPriceChangeSinceAdded
<MemberInfo kind="property" type={`number`} />
Non-zero if the `unitPrice` has changed since it was initially added to Order.
### unitPriceWithTaxChangeSinceAdded
<MemberInfo kind="property" type={`number`} />
Non-zero if the `unitPriceWithTax` has changed since it was initially added to Order.
### discountedUnitPrice
<MemberInfo kind="property" type={`number`} />
The price of a single unit including discounts, excluding tax.
If Order-level discounts have been applied, this will not be the
actual taxable unit price (see `proratedUnitPrice`), but is generally the
correct price to display to customers to avoid confusion
about the internal handling of distributed Order-level discounts.
### discountedUnitPriceWithTax
<MemberInfo kind="property" type={`number`} />
The price of a single unit including discounts and tax
### proratedUnitPrice
<MemberInfo kind="property" type={`number`} />
The actual unit price, taking into account both item discounts _and_ prorated (proportionally-distributed)
Order-level discounts. This value is the true economic value of a single unit in this OrderLine, and is used in tax
and refund calculations.
### proratedUnitPriceWithTax
<MemberInfo kind="property" type={`number`} />
The `proratedUnitPrice` including tax.
### unitTax
<MemberInfo kind="property" type={`number`} />
### proratedUnitTax
<MemberInfo kind="property" type={`number`} />
### taxRate
<MemberInfo kind="property" type={`number`} />
### linePrice
<MemberInfo kind="property" type={`number`} />
The total price of the line excluding tax and discounts.
### linePriceWithTax
<MemberInfo kind="property" type={`number`} />
The total price of the line including tax but excluding discounts.
### discountedLinePrice
<MemberInfo kind="property" type={`number`} />
The price of the line including discounts, excluding tax.
### discountedLinePriceWithTax
<MemberInfo kind="property" type={`number`} />
The price of the line including discounts and tax.
### discounts
<MemberInfo kind="property" type={`Discount[]`} />
### lineTax
<MemberInfo kind="property" type={`number`} />
The total tax on this line.
### proratedLinePrice
<MemberInfo kind="property" type={`number`} />
The actual line price, taking into account both item discounts _and_ prorated (proportionally-distributed)
Order-level discounts. This value is the true economic value of the OrderLine, and is used in tax
and refund calculations.
### proratedLinePriceWithTax
<MemberInfo kind="property" type={`number`} />
The `proratedLinePrice` including tax.
### proratedLineTax
<MemberInfo kind="property" type={`number`} />
### addAdjustment
<MemberInfo kind="method" type={`(adjustment: Adjustment) => `} />
### clearAdjustments
<MemberInfo kind="method" type={`(type?: AdjustmentType) => `} />
</div>
|
---
title: "OrderModification"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## OrderModification
<GenerationInfo sourceFile="packages/core/src/entity/order-modification/order-modification.entity.ts" sourceLine="21" packageName="@vendure/core" />
An entity which represents a modification to an order which has been placed, and
then modified afterwards by an administrator.
```ts title="Signature"
class OrderModification extends VendureEntity {
constructor(input?: DeepPartial<OrderModification>)
@Column()
note: string;
@Index()
@ManyToOne(type => Order, order => order.modifications, { onDelete: 'CASCADE' })
order: Order;
@OneToMany(type => OrderModificationLine, line => line.modification)
lines: OrderModificationLine[];
@OneToMany(type => Surcharge, surcharge => surcharge.orderModification)
surcharges: Surcharge[];
@Money()
priceChange: number;
@OneToOne(type => Payment)
@JoinColumn()
payment?: Payment;
@OneToOne(type => Refund)
@JoinColumn()
refund?: Refund;
@Column('simple-json', { nullable: true }) shippingAddressChange: OrderAddress;
@Column('simple-json', { nullable: true }) billingAddressChange: OrderAddress;
isSettled: boolean
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/order-modification#ordermodification'>OrderModification</a>>) => OrderModification`} />
### note
<MemberInfo kind="property" type={`string`} />
### order
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
### lines
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line-reference#ordermodificationline'>OrderModificationLine</a>[]`} />
### surcharges
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/surcharge#surcharge'>Surcharge</a>[]`} />
### priceChange
<MemberInfo kind="property" type={`number`} />
### payment
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/payment#payment'>Payment</a>`} />
### refund
<MemberInfo kind="property" type={`Refund`} />
### shippingAddressChange
<MemberInfo kind="property" type={`OrderAddress`} />
### billingAddressChange
<MemberInfo kind="property" type={`OrderAddress`} />
### isSettled
<MemberInfo kind="property" type={`boolean`} />
</div>
|
---
title: "Order"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Order
<GenerationInfo sourceFile="packages/core/src/entity/order/order.entity.ts" sourceLine="43" packageName="@vendure/core" />
An Order is created whenever a <a href='/reference/typescript-api/entities/customer#customer'>Customer</a> adds an item to the cart. It contains all the
information required to fulfill an order: which <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>s in what quantities;
the shipping address and price; any applicable promotions; payments etc.
An Order exists in a well-defined state according to the <a href='/reference/typescript-api/orders/order-process#orderstate'>OrderState</a> type. A state machine
is used to govern the transition from one state to another.
```ts title="Signature"
class Order extends VendureEntity implements ChannelAware, HasCustomFields {
constructor(input?: DeepPartial<Order>)
@Column('varchar', { default: OrderType.Regular })
type: OrderType;
@OneToMany(type => Order, sellerOrder => sellerOrder.aggregateOrder)
sellerOrders: Order[];
@Index()
@ManyToOne(type => Order, aggregateOrder => aggregateOrder.sellerOrders)
aggregateOrder?: Order;
@EntityId({ nullable: true })
aggregateOrderId?: ID;
@Column()
@Index({ unique: true })
code: string;
@Column('varchar') state: OrderState;
@Column({ default: true })
active: boolean;
@Column({ nullable: true })
orderPlacedAt?: Date;
@Index()
@ManyToOne(type => Customer, customer => customer.orders)
customer?: Customer;
@EntityId({ nullable: true })
customerId?: ID;
@OneToMany(type => OrderLine, line => line.order)
lines: OrderLine[];
@OneToMany(type => Surcharge, surcharge => surcharge.order)
surcharges: Surcharge[];
@Column('simple-array')
couponCodes: string[];
@ManyToMany(type => Promotion, promotion => promotion.orders)
@JoinTable()
promotions: Promotion[];
@Column('simple-json') shippingAddress: OrderAddress;
@Column('simple-json') billingAddress: OrderAddress;
@OneToMany(type => Payment, payment => payment.order)
payments: Payment[];
@ManyToMany(type => Fulfillment, fulfillment => fulfillment.orders)
@JoinTable()
fulfillments: Fulfillment[];
@Column('varchar')
currencyCode: CurrencyCode;
@Column(type => CustomOrderFields)
customFields: CustomOrderFields;
@EntityId({ nullable: true })
taxZoneId?: ID;
@ManyToMany(type => Channel)
@JoinTable()
channels: Channel[];
@OneToMany(type => OrderModification, modification => modification.order)
modifications: OrderModification[];
@Money()
subTotal: number;
@Money()
subTotalWithTax: number;
@OneToMany(type => ShippingLine, shippingLine => shippingLine.order)
shippingLines: ShippingLine[];
@Money({ default: 0 })
shipping: number;
@Money({ default: 0 })
shippingWithTax: number;
discounts: Discount[]
total: number
totalWithTax: number
totalQuantity: number
taxSummary: OrderTaxSummary[]
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/order#order'>Order</a>>) => Order`} />
### type
<MemberInfo kind="property" type={`OrderType`} />
### sellerOrders
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>[]`} />
### aggregateOrder
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
### aggregateOrderId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### code
<MemberInfo kind="property" type={`string`} />
A unique code for the Order, generated according to the
<a href='/reference/typescript-api/orders/order-code-strategy#ordercodestrategy'>OrderCodeStrategy</a>. This should be used as an order reference
for Customers, rather than the Order's id.
### state
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/orders/order-process#orderstate'>OrderState</a>`} />
### active
<MemberInfo kind="property" type={`boolean`} />
Whether the Order is considered "active", meaning that the
Customer can still make changes to it and has not yet completed
the checkout process.
This is governed by the <a href='/reference/typescript-api/orders/order-placed-strategy#orderplacedstrategy'>OrderPlacedStrategy</a>.
### orderPlacedAt
<MemberInfo kind="property" type={`Date`} />
The date & time that the Order was placed, i.e. the Customer
completed the checkout and the Order is no longer "active".
This is governed by the <a href='/reference/typescript-api/orders/order-placed-strategy#orderplacedstrategy'>OrderPlacedStrategy</a>.
### customer
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer#customer'>Customer</a>`} />
### customerId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### lines
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>[]`} />
### surcharges
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/surcharge#surcharge'>Surcharge</a>[]`} />
Surcharges are arbitrary modifications to the Order total which are neither
ProductVariants nor discounts resulting from applied Promotions. For example,
one-off discounts based on customer interaction, or surcharges based on payment
methods.
### couponCodes
<MemberInfo kind="property" type={`string[]`} />
An array of all coupon codes applied to the Order.
### promotions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a>[]`} />
Promotions applied to the order. Only gets populated after the payment process has completed,
i.e. the Order is no longer active.
### shippingAddress
<MemberInfo kind="property" type={`OrderAddress`} />
### billingAddress
<MemberInfo kind="property" type={`OrderAddress`} />
### payments
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/payment#payment'>Payment</a>[]`} />
### fulfillments
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/fulfillment#fulfillment'>Fulfillment</a>[]`} />
### currencyCode
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/currency-code#currencycode'>CurrencyCode</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomOrderFields`} />
### taxZoneId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### modifications
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-modification#ordermodification'>OrderModification</a>[]`} />
### subTotal
<MemberInfo kind="property" type={`number`} />
The subTotal is the total of all OrderLines in the Order. This figure also includes any Order-level
discounts which have been prorated (proportionally distributed) amongst the OrderItems.
To get a total of all OrderLines which does not account for prorated discounts, use the
sum of <a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>'s `discountedLinePrice` values.
### subTotalWithTax
<MemberInfo kind="property" type={`number`} />
Same as subTotal, but inclusive of tax.
### shippingLines
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/shipping-line#shippingline'>ShippingLine</a>[]`} />
The shipping charges applied to this order.
### shipping
<MemberInfo kind="property" type={`number`} />
The total of all the `shippingLines`.
### shippingWithTax
<MemberInfo kind="property" type={`number`} />
### discounts
<MemberInfo kind="property" type={`Discount[]`} />
### total
<MemberInfo kind="property" type={`number`} />
Equal to `subTotal` plus `shipping`
### totalWithTax
<MemberInfo kind="property" type={`number`} />
The final payable amount. Equal to `subTotalWithTax` plus `shippingWithTax`.
### totalQuantity
<MemberInfo kind="property" type={`number`} />
### taxSummary
<MemberInfo kind="property" type={`OrderTaxSummary[]`} />
A summary of the taxes being applied to this Order.
</div>
|
---
title: "OrderableAsset"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## OrderableAsset
<GenerationInfo sourceFile="packages/core/src/entity/asset/orderable-asset.entity.ts" sourceLine="18" packageName="@vendure/core" />
This base class is extended in order to enable specific ordering of the one-to-many
Entity -> Assets relation. Using a many-to-many relation does not provide a way
to guarantee order of the Assets, so this entity is used in place of the
usual join table that would be created by TypeORM.
See https://typeorm.io/#/many-to-many-relations/many-to-many-relations-with-custom-properties
```ts title="Signature"
class OrderableAsset extends VendureEntity implements Orderable {
constructor(input?: DeepPartial<OrderableAsset>)
@Column()
assetId: ID;
@Index()
@ManyToOne(type => Asset, { eager: true, onDelete: 'CASCADE' })
asset: Asset;
@Column()
position: number;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#orderable'>Orderable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/orderable-asset#orderableasset'>OrderableAsset</a>>) => OrderableAsset`} />
### assetId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### asset
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/asset#asset'>Asset</a>`} />
### position
<MemberInfo kind="property" type={`number`} />
</div>
|
---
title: "PaymentMethod"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## PaymentMethod
<GenerationInfo sourceFile="packages/core/src/entity/payment-method/payment-method.entity.ts" sourceLine="21" packageName="@vendure/core" />
A PaymentMethod is created automatically according to the configured <a href='/reference/typescript-api/payment/payment-method-handler#paymentmethodhandler'>PaymentMethodHandler</a>s defined
in the <a href='/reference/typescript-api/payment/payment-options#paymentoptions'>PaymentOptions</a> config.
```ts title="Signature"
class PaymentMethod extends VendureEntity implements Translatable, ChannelAware, HasCustomFields {
constructor(input?: DeepPartial<PaymentMethod>)
name: LocaleString;
@Column({ default: '' }) code: string;
description: LocaleString;
@OneToMany(type => PaymentMethodTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<PaymentMethod>>;
@Column() enabled: boolean;
@Column('simple-json', { nullable: true }) checker: ConfigurableOperation | null;
@Column('simple-json') handler: ConfigurableOperation;
@ManyToMany(type => Channel, channel => channel.paymentMethods)
@JoinTable()
channels: Channel[];
@Column(type => CustomPaymentMethodFields)
customFields: CustomPaymentMethodFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/payment-method#paymentmethod'>PaymentMethod</a>>) => PaymentMethod`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### code
<MemberInfo kind="property" type={`string`} />
### description
<MemberInfo kind="property" type={`LocaleString`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/payment-method#paymentmethod'>PaymentMethod</a>>>`} />
### enabled
<MemberInfo kind="property" type={`boolean`} />
### checker
<MemberInfo kind="property" type={`ConfigurableOperation | null`} />
### handler
<MemberInfo kind="property" type={`ConfigurableOperation`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomPaymentMethodFields`} />
</div>
|
---
title: "Payment"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Payment
<GenerationInfo sourceFile="packages/core/src/entity/payment/payment.entity.ts" sourceLine="18" packageName="@vendure/core" />
A Payment represents a single payment transaction and exists in a well-defined state
defined by the <a href='/reference/typescript-api/payment/payment-state#paymentstate'>PaymentState</a> type.
```ts title="Signature"
class Payment extends VendureEntity {
constructor(input?: DeepPartial<Payment>)
@Column() method: string;
@Money() amount: number;
@Column('varchar') state: PaymentState;
@Column({ type: 'varchar', nullable: true })
errorMessage: string | undefined;
@Column({ nullable: true })
transactionId: string;
@Column('simple-json') metadata: PaymentMetadata;
@Index()
@ManyToOne(type => Order, order => order.payments)
order: Order;
@OneToMany(type => Refund, refund => refund.payment)
refunds: Refund[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/payment#payment'>Payment</a>>) => Payment`} />
### method
<MemberInfo kind="property" type={`string`} />
### amount
<MemberInfo kind="property" type={`number`} />
### state
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/payment/payment-state#paymentstate'>PaymentState</a>`} />
### errorMessage
<MemberInfo kind="property" type={`string | undefined`} />
### transactionId
<MemberInfo kind="property" type={`string`} />
### metadata
<MemberInfo kind="property" type={`PaymentMetadata`} />
### order
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
### refunds
<MemberInfo kind="property" type={`Refund[]`} />
</div>
|
---
title: "ProductOptionGroup"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProductOptionGroup
<GenerationInfo sourceFile="packages/core/src/entity/product-option-group/product-option-group.entity.ts" sourceLine="20" packageName="@vendure/core" />
A grouping of one or more <a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>s.
```ts title="Signature"
class ProductOptionGroup extends VendureEntity implements Translatable, HasCustomFields, SoftDeletable {
constructor(input?: DeepPartial<ProductOptionGroup>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
name: LocaleString;
@Column()
code: string;
@OneToMany(type => ProductOptionGroupTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<ProductOptionGroup>>;
@OneToMany(type => ProductOption, option => option.group)
options: ProductOption[];
@Index()
@ManyToOne(type => Product, product => product.optionGroups)
product: Product;
@Column(type => CustomProductOptionGroupFields)
customFields: CustomProductOptionGroupFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a>>) => ProductOptionGroup`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### code
<MemberInfo kind="property" type={`string`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a>>>`} />
### options
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>[]`} />
### product
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product#product'>Product</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomProductOptionGroupFields`} />
</div>
|
---
title: "ProductOption"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProductOption
<GenerationInfo sourceFile="packages/core/src/entity/product-option/product-option.entity.ts" sourceLine="21" packageName="@vendure/core" />
A ProductOption is used to differentiate <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>s from one another.
```ts title="Signature"
class ProductOption extends VendureEntity implements Translatable, HasCustomFields, SoftDeletable {
constructor(input?: DeepPartial<ProductOption>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
name: LocaleString;
@Column() code: string;
@OneToMany(type => ProductOptionTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<ProductOption>>;
@Index()
@ManyToOne(type => ProductOptionGroup, group => group.options)
group: ProductOptionGroup;
@EntityId()
groupId: ID;
@ManyToMany(type => ProductVariant, variant => variant.options)
productVariants: ProductVariant[];
@Column(type => CustomProductOptionFields)
customFields: CustomProductOptionFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>) => ProductOption`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### code
<MemberInfo kind="property" type={`string`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>>>`} />
### group
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a>`} />
### groupId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### productVariants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomProductOptionFields`} />
</div>
|
---
title: "ProductVariantPrice"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProductVariantPrice
<GenerationInfo sourceFile="packages/core/src/entity/product-variant/product-variant-price.entity.ts" sourceLine="20" packageName="@vendure/core" />
A ProductVariantPrice is a Channel-specific price for a ProductVariant. For every Channel to
which a ProductVariant is assigned, there will be a corresponding ProductVariantPrice entity.
```ts title="Signature"
class ProductVariantPrice extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<ProductVariantPrice>)
@Money() price: number;
@EntityId({ nullable: true }) channelId: ID;
@Column('varchar')
currencyCode: CurrencyCode;
@Index()
@ManyToOne(type => ProductVariant, variant => variant.productVariantPrices, { onDelete: 'CASCADE' })
variant: ProductVariant;
@Column(type => CustomProductVariantPriceFields)
customFields: CustomProductVariantPriceFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>>) => ProductVariantPrice`} />
### price
<MemberInfo kind="property" type={`number`} />
### channelId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### currencyCode
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/currency-code#currencycode'>CurrencyCode</a>`} />
### variant
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomProductVariantPriceFields`} />
</div>
|
---
title: "ProductVariant"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ProductVariant
<GenerationInfo sourceFile="packages/core/src/entity/product-variant/product-variant.entity.ts" sourceLine="38" packageName="@vendure/core" />
A ProductVariant represents a single stock keeping unit (SKU) in the store's inventory.
Whereas a <a href='/reference/typescript-api/entities/product#product'>Product</a> is a "container" of variants, the variant itself holds the
data on price, tax category etc. When one adds items to their cart, they are adding
ProductVariants, not Products.
```ts title="Signature"
class ProductVariant extends VendureEntity implements Translatable, HasCustomFields, SoftDeletable, ChannelAware {
constructor(input?: DeepPartial<ProductVariant>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
name: LocaleString;
@Column({ default: true })
enabled: boolean;
@Column()
sku: string;
listPrice: number;
listPriceIncludesTax: boolean;
currencyCode: CurrencyCode;
price: number
priceWithTax: number
taxRateApplied: TaxRate;
@Index()
@ManyToOne(type => Asset, asset => asset.featuredInVariants, { onDelete: 'SET NULL' })
featuredAsset: Asset;
@OneToMany(type => ProductVariantAsset, productVariantAsset => productVariantAsset.productVariant, {
onDelete: 'SET NULL',
})
assets: ProductVariantAsset[];
@Index()
@ManyToOne(type => TaxCategory, taxCategory => taxCategory.productVariants)
taxCategory: TaxCategory;
@OneToMany(type => ProductVariantPrice, price => price.variant, { eager: true })
productVariantPrices: ProductVariantPrice[];
@OneToMany(type => ProductVariantTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<ProductVariant>>;
@Index()
@ManyToOne(type => Product, product => product.variants)
product: Product;
@EntityId({ nullable: true })
productId: ID;
@Column({ default: 0 })
outOfStockThreshold: number;
@Column({ default: true })
useGlobalOutOfStockThreshold: boolean;
@Column({ type: 'varchar', default: GlobalFlag.INHERIT })
trackInventory: GlobalFlag;
@OneToMany(type => StockLevel, stockLevel => stockLevel.productVariant)
stockLevels: StockLevel[];
@OneToMany(type => StockMovement, stockMovement => stockMovement.productVariant)
stockMovements: StockMovement[];
@ManyToMany(type => ProductOption, productOption => productOption.productVariants)
@JoinTable()
options: ProductOption[];
@ManyToMany(type => FacetValue, facetValue => facetValue.productVariants)
@JoinTable()
facetValues: FacetValue[];
@Column(type => CustomProductVariantFields)
customFields: CustomProductVariantFields;
@ManyToMany(type => Collection, collection => collection.productVariants)
collections: Collection[];
@ManyToMany(type => Channel, channel => channel.productVariants)
@JoinTable()
channels: Channel[];
@OneToMany(type => OrderLine, orderLine => orderLine.productVariant)
lines: OrderLine[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>>) => ProductVariant`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### enabled
<MemberInfo kind="property" type={`boolean`} />
### sku
<MemberInfo kind="property" type={`string`} />
### listPrice
<MemberInfo kind="property" type={`number`} />
### listPriceIncludesTax
<MemberInfo kind="property" type={`boolean`} />
### currencyCode
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/currency-code#currencycode'>CurrencyCode</a>`} />
### price
<MemberInfo kind="property" type={`number`} />
### priceWithTax
<MemberInfo kind="property" type={`number`} />
### taxRateApplied
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a>`} />
### featuredAsset
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/asset#asset'>Asset</a>`} />
### assets
<MemberInfo kind="property" type={`ProductVariantAsset[]`} />
### taxCategory
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a>`} />
### productVariantPrices
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant-price#productvariantprice'>ProductVariantPrice</a>[]`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>>>`} />
### product
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product#product'>Product</a>`} />
### productId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### outOfStockThreshold
<MemberInfo kind="property" type={`number`} />
Specifies the value of stockOnHand at which the ProductVariant is considered
out of stock.
### useGlobalOutOfStockThreshold
<MemberInfo kind="property" type={`boolean`} />
When true, the `outOfStockThreshold` value will be taken from the GlobalSettings and the
value set on this ProductVariant will be ignored.
### trackInventory
<MemberInfo kind="property" type={`GlobalFlag`} />
### stockLevels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-level#stocklevel'>StockLevel</a>[]`} />
### stockMovements
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a>[]`} />
### options
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-option#productoption'>ProductOption</a>[]`} />
### facetValues
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomProductVariantFields`} />
### collections
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/collection#collection'>Collection</a>[]`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### lines
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>[]`} />
</div>
|
---
title: "Product"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Product
<GenerationInfo sourceFile="packages/core/src/entity/product/product.entity.ts" sourceLine="25" packageName="@vendure/core" />
A Product contains one or more <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>s and serves as a container for those variants,
providing an overall name, description etc.
```ts title="Signature"
class Product extends VendureEntity implements Translatable, HasCustomFields, ChannelAware, SoftDeletable {
constructor(input?: DeepPartial<Product>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
name: LocaleString;
slug: LocaleString;
description: LocaleString;
@Column({ default: true })
enabled: boolean;
@Index()
@ManyToOne(type => Asset, asset => asset.featuredInProducts, { onDelete: 'SET NULL' })
featuredAsset: Asset;
@OneToMany(type => ProductAsset, productAsset => productAsset.product)
assets: ProductAsset[];
@OneToMany(type => ProductTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Product>>;
@OneToMany(type => ProductVariant, variant => variant.product)
variants: ProductVariant[];
@OneToMany(type => ProductOptionGroup, optionGroup => optionGroup.product)
optionGroups: ProductOptionGroup[];
@ManyToMany(type => FacetValue, facetValue => facetValue.products)
@JoinTable()
facetValues: FacetValue[];
@ManyToMany(type => Channel, channel => channel.products)
@JoinTable()
channels: Channel[];
@Column(type => CustomProductFields)
customFields: CustomProductFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/product#product'>Product</a>>) => Product`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### slug
<MemberInfo kind="property" type={`LocaleString`} />
### description
<MemberInfo kind="property" type={`LocaleString`} />
### enabled
<MemberInfo kind="property" type={`boolean`} />
### featuredAsset
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/asset#asset'>Asset</a>`} />
### assets
<MemberInfo kind="property" type={`ProductAsset[]`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/product#product'>Product</a>>>`} />
### variants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
### optionGroups
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-option-group#productoptiongroup'>ProductOptionGroup</a>[]`} />
### facetValues
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/facet-value#facetvalue'>FacetValue</a>[]`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomProductFields`} />
</div>
|
---
title: "Promotion"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Promotion
<GenerationInfo sourceFile="packages/core/src/entity/promotion/promotion.entity.ts" sourceLine="56" packageName="@vendure/core" />
A Promotion is used to define a set of conditions under which promotions actions (typically discounts)
will be applied to an Order.
Each assigned <a href='/reference/typescript-api/promotions/promotion-condition#promotioncondition'>PromotionCondition</a> is checked against the Order, and if they all return `true`,
then each assign <a href='/reference/typescript-api/promotions/promotion-action#promotionitemaction'>PromotionItemAction</a> / <a href='/reference/typescript-api/promotions/promotion-action#promotionorderaction'>PromotionOrderAction</a> is applied to the Order.
```ts title="Signature"
class Promotion extends AdjustmentSource implements ChannelAware, SoftDeletable, HasCustomFields, Translatable {
type = AdjustmentType.PROMOTION;
constructor(input?: DeepPartial<Promotion> & {
promotionConditions?: Array<PromotionCondition<any>>;
promotionActions?: Array<PromotionAction<any>>;
})
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column({ type: Date, nullable: true })
startsAt: Date | null;
@Column({ type: Date, nullable: true })
endsAt: Date | null;
@Column({ nullable: true })
couponCode: string;
@Column({ nullable: true })
perCustomerUsageLimit: number;
@Column({ nullable: true })
usageLimit: number;
name: LocaleString;
description: LocaleString;
@OneToMany(type => PromotionTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Promotion>>;
@Column() enabled: boolean;
@ManyToMany(type => Channel, channel => channel.promotions)
@JoinTable()
channels: Channel[];
@ManyToMany(type => Order, order => order.promotions)
orders: Order[];
@Column(type => CustomPromotionFields)
customFields: CustomPromotionFields;
@Column('simple-json') conditions: ConfigurableOperation[];
@Column('simple-json') actions: ConfigurableOperation[];
@Column() priorityScore: number;
apply(ctx: RequestContext, args: ApplyOrderActionArgs | ApplyOrderItemActionArgs | ApplyShippingActionArgs, state?: PromotionState) => Promise<Adjustment | undefined>;
test(ctx: RequestContext, order: Order) => Promise<PromotionTestResult>;
activate(ctx: RequestContext, order: Order) => ;
deactivate(ctx: RequestContext, order: Order) => ;
}
```
* Extends: <code>AdjustmentSource</code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={``} />
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a>> & {
promotionConditions?: Array<<a href='/reference/typescript-api/promotions/promotion-condition#promotioncondition'>PromotionCondition</a><any>>;
promotionActions?: Array<<a href='/reference/typescript-api/promotions/promotion-action#promotionaction'>PromotionAction</a><any>>;
}) => Promotion`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### startsAt
<MemberInfo kind="property" type={`Date | null`} />
### endsAt
<MemberInfo kind="property" type={`Date | null`} />
### couponCode
<MemberInfo kind="property" type={`string`} />
### perCustomerUsageLimit
<MemberInfo kind="property" type={`number`} />
### usageLimit
<MemberInfo kind="property" type={`number`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### description
<MemberInfo kind="property" type={`LocaleString`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/promotion#promotion'>Promotion</a>>>`} />
### enabled
<MemberInfo kind="property" type={`boolean`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### orders
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomPromotionFields`} />
### conditions
<MemberInfo kind="property" type={`ConfigurableOperation[]`} />
### actions
<MemberInfo kind="property" type={`ConfigurableOperation[]`} />
### priorityScore
<MemberInfo kind="property" type={`number`} />
The PriorityScore is used to determine the sequence in which multiple promotions are tested
on a given order. A higher number moves the Promotion towards the end of the sequence.
The score is derived from the sum of the priorityValues of the PromotionConditions and
PromotionActions comprising this Promotion.
An example illustrating the need for a priority is this:
Consider 2 Promotions, 1) buy 1 get one free and 2) 10% off when order total is over $50.
If Promotion 2 is evaluated prior to Promotion 1, then it can trigger the 10% discount even
if the subsequent application of Promotion 1 brings the order total down to way below $50.
### apply
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, args: ApplyOrderActionArgs | ApplyOrderItemActionArgs | ApplyShippingActionArgs, state?: PromotionState) => Promise<Adjustment | undefined>`} />
### test
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, order: <a href='/reference/typescript-api/entities/order#order'>Order</a>) => Promise<PromotionTestResult>`} />
### activate
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, order: <a href='/reference/typescript-api/entities/order#order'>Order</a>) => `} />
### deactivate
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, order: <a href='/reference/typescript-api/entities/order#order'>Order</a>) => `} />
</div>
|
---
title: "Province"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Province
<GenerationInfo sourceFile="packages/core/src/entity/region/province.entity.ts" sourceLine="13" packageName="@vendure/core" />
A Province represents an administrative subdivision of a <a href='/reference/typescript-api/entities/country#country'>Country</a>. For example, in the
United States, the country would be "United States" and the province would be "California".
```ts title="Signature"
class Province extends Region {
constructor(input?: DeepPartial<Province>)
readonly type: RegionType = 'province';
}
```
* Extends: <code><a href='/reference/typescript-api/entities/region#region'>Region</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/province#province'>Province</a>>) => Province`} />
### type
<MemberInfo kind="property" type={`RegionType`} />
</div>
|
---
title: "Region"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Region
<GenerationInfo sourceFile="packages/core/src/entity/region/region.entity.ts" sourceLine="22" packageName="@vendure/core" />
A Region represents a geographical administrative unit, such as a Country, Province, State, Prefecture etc.
This is an abstract class which is extended by the <a href='/reference/typescript-api/entities/country#country'>Country</a> and <a href='/reference/typescript-api/entities/province#province'>Province</a> entities.
Regions can be grouped into <a href='/reference/typescript-api/entities/zone#zone'>Zone</a>s which are in turn used to determine applicable shipping and taxes for an <a href='/reference/typescript-api/entities/order#order'>Order</a>.
```ts title="Signature"
class Region extends VendureEntity implements Translatable, HasCustomFields {
@Column() code: string;
@Column({ nullable: false, type: 'varchar' })
readonly type: RegionType;
name: LocaleString;
@Index()
@ManyToOne(type => Region, { nullable: true, onDelete: 'SET NULL' })
parent?: Region;
@EntityId({ nullable: true })
parentId?: ID;
@Column() enabled: boolean;
@OneToMany(type => RegionTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<Region>>;
@Column(type => CustomRegionFields)
customFields: CustomRegionFields;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>, <code>HasCustomFields</code>
<div className="members-wrapper">
### code
<MemberInfo kind="property" type={`string`} />
A code representing the region. The code format will depend on the type of region. For
example, a Country code will be a 2-letter ISO code, whereas a Province code could use
a format relevant to the type of province, e.g. a US state code like "CA".
### type
<MemberInfo kind="property" type={`RegionType`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### parent
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/region#region'>Region</a>`} />
### parentId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### enabled
<MemberInfo kind="property" type={`boolean`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/region#region'>Region</a>>>`} />
### customFields
<MemberInfo kind="property" type={`CustomRegionFields`} />
</div>
|
---
title: "Role"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Role
<GenerationInfo sourceFile="packages/core/src/entity/role/role.entity.ts" sourceLine="16" packageName="@vendure/core" />
A Role represents a collection of permissions which determine the authorization
level of a <a href='/reference/typescript-api/entities/user#user'>User</a> on a given set of <a href='/reference/typescript-api/entities/channel#channel'>Channel</a>s.
```ts title="Signature"
class Role extends VendureEntity implements ChannelAware {
constructor(input?: DeepPartial<Role>)
@Column() code: string;
@Column() description: string;
@Column('simple-array') permissions: Permission[];
@ManyToMany(type => Channel, channel => channel.roles)
@JoinTable()
channels: Channel[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/role#role'>Role</a>>) => Role`} />
### code
<MemberInfo kind="property" type={`string`} />
### description
<MemberInfo kind="property" type={`string`} />
### permissions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/permission#permission'>Permission</a>[]`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
</div>
|
---
title: "Seller"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Seller
<GenerationInfo sourceFile="packages/core/src/entity/seller/seller.entity.ts" sourceLine="17" packageName="@vendure/core" />
A Seller represents the person or organization who is selling the goods on a given <a href='/reference/typescript-api/entities/channel#channel'>Channel</a>.
By default, a single-channel Vendure installation will have a single default Seller.
```ts title="Signature"
class Seller extends VendureEntity implements SoftDeletable, HasCustomFields {
constructor(input?: DeepPartial<Seller>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column() name: string;
@Column(type => CustomSellerFields)
customFields: CustomSellerFields;
@OneToMany(type => Channel, channel => channel.seller)
channels: Channel[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>, <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/seller#seller'>Seller</a>>) => Seller`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### name
<MemberInfo kind="property" type={`string`} />
### customFields
<MemberInfo kind="property" type={`CustomSellerFields`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
</div>
|
---
title: "Session"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Session
<GenerationInfo sourceFile="packages/core/src/entity/session/session.entity.ts" sourceLine="18" packageName="@vendure/core" />
A Session is created when a user makes a request to restricted API operations. A Session can be an <a href='/reference/typescript-api/entities/anonymous-session#anonymoussession'>AnonymousSession</a>
in the case of un-authenticated users, otherwise it is an <a href='/reference/typescript-api/entities/authenticated-session#authenticatedsession'>AuthenticatedSession</a>.
```ts title="Signature"
class Session extends VendureEntity {
@Index({ unique: true })
@Column()
token: string;
@Column() expires: Date;
@Column() invalidated: boolean;
@EntityId({ nullable: true })
activeOrderId?: ID;
@Index()
@ManyToOne(type => Order)
activeOrder: Order | null;
@EntityId({ nullable: true })
activeChannelId?: ID;
@Index()
@ManyToOne(type => Channel)
activeChannel: Channel | null;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### token
<MemberInfo kind="property" type={`string`} />
### expires
<MemberInfo kind="property" type={`Date`} />
### invalidated
<MemberInfo kind="property" type={`boolean`} />
### activeOrderId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### activeOrder
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a> | null`} />
### activeChannelId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### activeChannel
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a> | null`} />
</div>
|
---
title: "ShippingLine"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ShippingLine
<GenerationInfo sourceFile="packages/core/src/entity/shipping-line/shipping-line.entity.ts" sourceLine="24" packageName="@vendure/core" />
A ShippingLine is created when a <a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a> is applied to an <a href='/reference/typescript-api/entities/order#order'>Order</a>.
It contains information about the price of the shipping method, any discounts that were
applied, and the resulting tax on the shipping method.
```ts title="Signature"
class ShippingLine extends VendureEntity {
constructor(input?: DeepPartial<ShippingLine>)
@EntityId()
shippingMethodId: ID | null;
@Index()
@ManyToOne(type => ShippingMethod)
shippingMethod: ShippingMethod;
@Index()
@ManyToOne(type => Order, order => order.shippingLines, { onDelete: 'CASCADE' })
order: Order;
@Money()
listPrice: number;
@Column()
listPriceIncludesTax: boolean;
@Column('simple-json')
adjustments: Adjustment[];
@Column('simple-json')
taxLines: TaxLine[];
@OneToMany(type => OrderLine, orderLine => orderLine.shippingLine)
orderLines: OrderLine[];
price: number
priceWithTax: number
discountedPrice: number
discountedPriceWithTax: number
taxRate: number
discounts: Discount[]
addAdjustment(adjustment: Adjustment) => ;
clearAdjustments() => ;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/shipping-line#shippingline'>ShippingLine</a>>) => ShippingLine`} />
### shippingMethodId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a> | null`} />
### shippingMethod
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a>`} />
### order
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
### listPrice
<MemberInfo kind="property" type={`number`} />
### listPriceIncludesTax
<MemberInfo kind="property" type={`boolean`} />
### adjustments
<MemberInfo kind="property" type={`Adjustment[]`} />
### taxLines
<MemberInfo kind="property" type={`TaxLine[]`} />
### orderLines
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>[]`} />
### price
<MemberInfo kind="property" type={`number`} />
### priceWithTax
<MemberInfo kind="property" type={`number`} />
### discountedPrice
<MemberInfo kind="property" type={`number`} />
### discountedPriceWithTax
<MemberInfo kind="property" type={`number`} />
### taxRate
<MemberInfo kind="property" type={`number`} />
### discounts
<MemberInfo kind="property" type={`Discount[]`} />
### addAdjustment
<MemberInfo kind="method" type={`(adjustment: Adjustment) => `} />
### clearAdjustments
<MemberInfo kind="method" type={`() => `} />
</div>
|
---
title: "ShippingMethod"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## ShippingMethod
<GenerationInfo sourceFile="packages/core/src/entity/shipping-method/shipping-method.entity.ts" sourceLine="33" packageName="@vendure/core" />
A ShippingMethod is used to apply a shipping price to an <a href='/reference/typescript-api/entities/order#order'>Order</a>. It is composed of a
<a href='/reference/typescript-api/shipping/shipping-eligibility-checker#shippingeligibilitychecker'>ShippingEligibilityChecker</a> and a <a href='/reference/typescript-api/shipping/shipping-calculator#shippingcalculator'>ShippingCalculator</a>. For a given Order,
the `checker` is used to determine whether this ShippingMethod can be used. If yes, then
the ShippingMethod can be applied and the `calculator` is used to determine the price of
shipping.
```ts title="Signature"
class ShippingMethod extends VendureEntity implements ChannelAware, SoftDeletable, HasCustomFields, Translatable {
constructor(input?: DeepPartial<ShippingMethod>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column() code: string;
name: LocaleString;
description: LocaleString;
@Column('simple-json') checker: ConfigurableOperation;
@Column('simple-json') calculator: ConfigurableOperation;
@Column()
fulfillmentHandlerCode: string;
@ManyToMany(type => Channel, channel => channel.shippingMethods)
@JoinTable()
channels: Channel[];
@OneToMany(type => ShippingMethodTranslation, translation => translation.base, { eager: true })
translations: Array<Translation<ShippingMethod>>;
@Column(type => CustomShippingMethodFields)
customFields: CustomShippingMethodFields;
apply(ctx: RequestContext, order: Order) => Promise<ShippingCalculationResult | undefined>;
test(ctx: RequestContext, order: Order) => Promise<boolean>;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>, <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#translatable'>Translatable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a>>) => ShippingMethod`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### code
<MemberInfo kind="property" type={`string`} />
### name
<MemberInfo kind="property" type={`LocaleString`} />
### description
<MemberInfo kind="property" type={`LocaleString`} />
### checker
<MemberInfo kind="property" type={`ConfigurableOperation`} />
### calculator
<MemberInfo kind="property" type={`ConfigurableOperation`} />
### fulfillmentHandlerCode
<MemberInfo kind="property" type={`string`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### translations
<MemberInfo kind="property" type={`Array<Translation<<a href='/reference/typescript-api/entities/shipping-method#shippingmethod'>ShippingMethod</a>>>`} />
### customFields
<MemberInfo kind="property" type={`CustomShippingMethodFields`} />
### apply
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, order: <a href='/reference/typescript-api/entities/order#order'>Order</a>) => Promise<<a href='/reference/typescript-api/shipping/shipping-calculator#shippingcalculationresult'>ShippingCalculationResult</a> | undefined>`} />
### test
<MemberInfo kind="method" type={`(ctx: <a href='/reference/typescript-api/request/request-context#requestcontext'>RequestContext</a>, order: <a href='/reference/typescript-api/entities/order#order'>Order</a>) => Promise<boolean>`} />
</div>
|
---
title: "StockLevel"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## StockLevel
<GenerationInfo sourceFile="packages/core/src/entity/stock-level/stock-level.entity.ts" sourceLine="16" packageName="@vendure/core" />
A StockLevel represents the number of a particular <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> which are available
at a particular <a href='/reference/typescript-api/entities/stock-location#stocklocation'>StockLocation</a>.
```ts title="Signature"
class StockLevel extends VendureEntity {
constructor(input: DeepPartial<StockLevel>)
@Index()
@ManyToOne(type => ProductVariant, productVariant => productVariant.stockLevels, { onDelete: 'CASCADE' })
productVariant: ProductVariant;
@EntityId()
productVariantId: ID;
@Index()
@ManyToOne(type => StockLocation, { onDelete: 'CASCADE' })
stockLocation: StockLocation;
@EntityId()
stockLocationId: ID;
@Column()
stockOnHand: number;
@Column()
stockAllocated: number;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-level#stocklevel'>StockLevel</a>>) => StockLevel`} />
### productVariant
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>`} />
### productVariantId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### stockLocation
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-location#stocklocation'>StockLocation</a>`} />
### stockLocationId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### stockOnHand
<MemberInfo kind="property" type={`number`} />
### stockAllocated
<MemberInfo kind="property" type={`number`} />
</div>
|
---
title: "StockLocation"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## StockLocation
<GenerationInfo sourceFile="packages/core/src/entity/stock-location/stock-location.entity.ts" sourceLine="22" packageName="@vendure/core" />
A StockLocation represents a physical location where stock is held. For example, a warehouse or a shop.
When the stock of a <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> is adjusted, the adjustment is applied to a specific StockLocation,
and the stockOnHand of that ProductVariant is updated accordingly. When there are multiple StockLocations
configured, the <a href='/reference/typescript-api/products-stock/stock-location-strategy#stocklocationstrategy'>StockLocationStrategy</a> is used to determine which StockLocation should be used for
a given operation.
```ts title="Signature"
class StockLocation extends VendureEntity implements HasCustomFields, ChannelAware {
constructor(input: DeepPartial<StockLocation>)
@Column()
name: string;
@Column()
description: string;
@Column(type => CustomStockLocationFields)
customFields: CustomStockLocationFields;
@ManyToMany(type => Channel, channel => channel.stockLocations)
@JoinTable()
channels: Channel[];
@OneToMany(type => StockMovement, movement => movement.stockLocation)
stockMovements: StockMovement[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#channelaware'>ChannelAware</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-location#stocklocation'>StockLocation</a>>) => StockLocation`} />
### name
<MemberInfo kind="property" type={`string`} />
### description
<MemberInfo kind="property" type={`string`} />
### customFields
<MemberInfo kind="property" type={`CustomStockLocationFields`} />
### channels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### stockMovements
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a>[]`} />
</div>
|
---
title: "StockMovement"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## StockMovement
<GenerationInfo sourceFile="packages/core/src/entity/stock-movement/stock-movement.entity.ts" sourceLine="19" packageName="@vendure/core" />
A StockMovement is created whenever stock of a particular ProductVariant goes in
or out.
```ts title="Signature"
class StockMovement extends VendureEntity {
@Column({ nullable: false, type: 'varchar' })
readonly type: StockMovementType;
@Index()
@ManyToOne(type => ProductVariant, variant => variant.stockMovements)
productVariant: ProductVariant;
@Index()
@ManyToOne(type => StockLocation, stockLocation => stockLocation.stockMovements, { onDelete: 'CASCADE' })
stockLocation: StockLocation;
@EntityId()
stockLocationId: ID;
@Column()
quantity: number;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={`StockMovementType`} />
### productVariant
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>`} />
### stockLocation
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-location#stocklocation'>StockLocation</a>`} />
### stockLocationId
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### quantity
<MemberInfo kind="property" type={`number`} />
</div>
## Allocation
<GenerationInfo sourceFile="packages/core/src/entity/stock-movement/allocation.entity.ts" sourceLine="17" packageName="@vendure/core" />
An Allocation is created for each ProductVariant in an Order when the checkout is completed
(as configured by the <a href='/reference/typescript-api/orders/stock-allocation-strategy#stockallocationstrategy'>StockAllocationStrategy</a>. This prevents stock being sold twice.
```ts title="Signature"
class Allocation extends StockMovement {
readonly type = StockMovementType.ALLOCATION;
constructor(input: DeepPartial<Allocation>)
@Index()
@ManyToOne(type => OrderLine, orderLine => orderLine.allocations)
orderLine: OrderLine;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={``} />
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-movement#allocation'>Allocation</a>>) => Allocation`} />
### orderLine
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>`} />
</div>
## Cancellation
<GenerationInfo sourceFile="packages/core/src/entity/stock-movement/cancellation.entity.ts" sourceLine="16" packageName="@vendure/core" />
A Cancellation is created when OrderItems from a fulfilled Order are cancelled.
```ts title="Signature"
class Cancellation extends StockMovement {
readonly type = StockMovementType.CANCELLATION;
constructor(input: DeepPartial<Cancellation>)
@ManyToOne(type => OrderLine, orderLine => orderLine.cancellations)
orderLine: OrderLine;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={``} />
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-movement#cancellation'>Cancellation</a>>) => Cancellation`} />
### orderLine
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>`} />
</div>
## Release
<GenerationInfo sourceFile="packages/core/src/entity/stock-movement/release.entity.ts" sourceLine="17" packageName="@vendure/core" />
A Release is created when OrderItems which have been allocated (but not yet fulfilled)
are cancelled.
```ts title="Signature"
class Release extends StockMovement {
readonly type = StockMovementType.RELEASE;
constructor(input: DeepPartial<Release>)
@ManyToOne(type => OrderLine)
orderLine: OrderLine;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={``} />
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-movement#release'>Release</a>>) => Release`} />
### orderLine
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>`} />
</div>
## Sale
<GenerationInfo sourceFile="packages/core/src/entity/stock-movement/sale.entity.ts" sourceLine="16" packageName="@vendure/core" />
A Sale is created when OrderItems are fulfilled.
```ts title="Signature"
class Sale extends StockMovement {
readonly type = StockMovementType.SALE;
constructor(input: DeepPartial<Sale>)
@ManyToOne(type => OrderLine, line => line.sales)
orderLine: OrderLine;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={``} />
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-movement#sale'>Sale</a>>) => Sale`} />
### orderLine
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-line#orderline'>OrderLine</a>`} />
</div>
## StockAdjustment
<GenerationInfo sourceFile="packages/core/src/entity/stock-movement/stock-adjustment.entity.ts" sourceLine="14" packageName="@vendure/core" />
A StockAdjustment is created when the `stockOnHand` level of a ProductVariant is manually adjusted.
```ts title="Signature"
class StockAdjustment extends StockMovement {
readonly type = StockMovementType.ADJUSTMENT;
constructor(input: DeepPartial<StockAdjustment>)
}
```
* Extends: <code><a href='/reference/typescript-api/entities/stock-movement#stockmovement'>StockMovement</a></code>
<div className="members-wrapper">
### type
<MemberInfo kind="property" type={``} />
### constructor
<MemberInfo kind="method" type={`(input: DeepPartial<<a href='/reference/typescript-api/entities/stock-movement#stockadjustment'>StockAdjustment</a>>) => StockAdjustment`} />
</div>
|
---
title: "Surcharge"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Surcharge
<GenerationInfo sourceFile="packages/core/src/entity/surcharge/surcharge.entity.ts" sourceLine="21" packageName="@vendure/core" />
A Surcharge represents an arbitrary extra item on an <a href='/reference/typescript-api/entities/order#order'>Order</a> which is not
a ProductVariant. It can be used to e.g. represent payment-related surcharges.
```ts title="Signature"
class Surcharge extends VendureEntity {
constructor(input?: DeepPartial<Surcharge>)
@Column()
description: string;
@Money()
listPrice: number;
@Column()
listPriceIncludesTax: boolean;
@Column()
sku: string;
@Column('simple-json')
taxLines: TaxLine[];
@Index()
@ManyToOne(type => Order, order => order.surcharges, { onDelete: 'CASCADE' })
order: Order;
@Index()
@ManyToOne(type => OrderModification, orderModification => orderModification.surcharges)
orderModification: OrderModification;
price: number
priceWithTax: number
taxRate: number
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/surcharge#surcharge'>Surcharge</a>>) => Surcharge`} />
### description
<MemberInfo kind="property" type={`string`} />
### listPrice
<MemberInfo kind="property" type={`number`} />
### listPriceIncludesTax
<MemberInfo kind="property" type={`boolean`} />
### sku
<MemberInfo kind="property" type={`string`} />
### taxLines
<MemberInfo kind="property" type={`TaxLine[]`} />
### order
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order#order'>Order</a>`} />
### orderModification
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/order-modification#ordermodification'>OrderModification</a>`} />
### price
<MemberInfo kind="property" type={`number`} />
### priceWithTax
<MemberInfo kind="property" type={`number`} />
### taxRate
<MemberInfo kind="property" type={`number`} />
</div>
|
---
title: "Tag"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Tag
<GenerationInfo sourceFile="packages/core/src/entity/tag/tag.entity.ts" sourceLine="13" packageName="@vendure/core" />
A tag is an arbitrary label which can be applied to certain entities.
It is used to help organize and filter those entities.
```ts title="Signature"
class Tag extends VendureEntity {
constructor(input?: DeepPartial<Tag>)
@Column()
value: string;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/tag#tag'>Tag</a>>) => Tag`} />
### value
<MemberInfo kind="property" type={`string`} />
</div>
|
---
title: "TaxCategory"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## TaxCategory
<GenerationInfo sourceFile="packages/core/src/entity/tax-category/tax-category.entity.ts" sourceLine="16" packageName="@vendure/core" />
A TaxCategory defines what type of taxes to apply to a <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>.
```ts title="Signature"
class TaxCategory extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<TaxCategory>)
@Column() name: string;
@Column({ default: false }) isDefault: boolean;
@Column(type => CustomTaxCategoryFields)
customFields: CustomTaxCategoryFields;
@OneToMany(type => ProductVariant, productVariant => productVariant.taxCategory)
productVariants: ProductVariant[];
@OneToMany(type => TaxRate, taxRate => taxRate.category)
taxRates: TaxRate[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a>>) => TaxCategory`} />
### name
<MemberInfo kind="property" type={`string`} />
### isDefault
<MemberInfo kind="property" type={`boolean`} />
### customFields
<MemberInfo kind="property" type={`CustomTaxCategoryFields`} />
### productVariants
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a>[]`} />
### taxRates
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a>[]`} />
</div>
|
---
title: "TaxRate"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## TaxRate
<GenerationInfo sourceFile="packages/core/src/entity/tax-rate/tax-rate.entity.ts" sourceLine="25" packageName="@vendure/core" />
A TaxRate defines the rate of tax to apply to a <a href='/reference/typescript-api/entities/product-variant#productvariant'>ProductVariant</a> based on three factors:
1. the ProductVariant's <a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a>
2. the applicable <a href='/reference/typescript-api/entities/zone#zone'>Zone</a> ("applicable" being defined by the configured <a href='/reference/typescript-api/tax/tax-zone-strategy#taxzonestrategy'>TaxZoneStrategy</a>)
3. the <a href='/reference/typescript-api/entities/customer-group#customergroup'>CustomerGroup</a> of the current Customer
```ts title="Signature"
class TaxRate extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<TaxRate>)
@Column() name: string;
@Column() enabled: boolean;
@Column({ type: 'decimal', precision: 5, scale: 2, transformer: new DecimalTransformer() }) value: number;
@Index()
@ManyToOne(type => TaxCategory, taxCategory => taxCategory.taxRates)
category: TaxCategory;
@Index()
@ManyToOne(type => Zone, zone => zone.taxRates)
zone: Zone;
@Index()
@ManyToOne(type => CustomerGroup, customerGroup => customerGroup.taxRates, { nullable: true })
customerGroup?: CustomerGroup;
@Column(type => CustomTaxRateFields)
customFields: CustomTaxRateFields;
taxComponentOf(grossPrice: number) => number;
netPriceOf(grossPrice: number) => number;
taxPayableOn(netPrice: number) => number;
grossPriceOf(netPrice: number) => number;
apply(price: number) => TaxLine;
test(zone: Zone, taxCategory: TaxCategory) => boolean;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a>>) => TaxRate`} />
### name
<MemberInfo kind="property" type={`string`} />
### enabled
<MemberInfo kind="property" type={`boolean`} />
### value
<MemberInfo kind="property" type={`number`} />
### category
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a>`} />
### zone
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/zone#zone'>Zone</a>`} />
### customerGroup
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/customer-group#customergroup'>CustomerGroup</a>`} />
### customFields
<MemberInfo kind="property" type={`CustomTaxRateFields`} />
### taxComponentOf
<MemberInfo kind="method" type={`(grossPrice: number) => number`} />
### netPriceOf
<MemberInfo kind="method" type={`(grossPrice: number) => number`} />
### taxPayableOn
<MemberInfo kind="method" type={`(netPrice: number) => number`} />
### grossPriceOf
<MemberInfo kind="method" type={`(netPrice: number) => number`} />
### apply
<MemberInfo kind="method" type={`(price: number) => TaxLine`} />
### test
<MemberInfo kind="method" type={`(zone: <a href='/reference/typescript-api/entities/zone#zone'>Zone</a>, taxCategory: <a href='/reference/typescript-api/entities/tax-category#taxcategory'>TaxCategory</a>) => boolean`} />
</div>
|
---
title: "User"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## User
<GenerationInfo sourceFile="packages/core/src/entity/user/user.entity.ts" sourceLine="21" packageName="@vendure/core" />
A User represents any authenticated user of the Vendure API. This includes both
<a href='/reference/typescript-api/entities/administrator#administrator'>Administrator</a>s as well as registered <a href='/reference/typescript-api/entities/customer#customer'>Customer</a>s.
```ts title="Signature"
class User extends VendureEntity implements HasCustomFields, SoftDeletable {
constructor(input?: DeepPartial<User>)
@Column({ type: Date, nullable: true })
deletedAt: Date | null;
@Column()
identifier: string;
@OneToMany(type => AuthenticationMethod, method => method.user)
authenticationMethods: AuthenticationMethod[];
@Column({ default: false })
verified: boolean;
@ManyToMany(type => Role)
@JoinTable()
roles: Role[];
@Column({ type: Date, nullable: true })
lastLogin: Date | null;
@Column(type => CustomUserFields)
customFields: CustomUserFields;
@OneToMany(type => AuthenticatedSession, session => session.user)
sessions: AuthenticatedSession[];
getNativeAuthenticationMethod() => NativeAuthenticationMethod;
getNativeAuthenticationMethod(strict?: boolean) => NativeAuthenticationMethod | undefined;
getNativeAuthenticationMethod(strict?: boolean) => NativeAuthenticationMethod | undefined;
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>, <code><a href='/reference/typescript-api/entities/interfaces#softdeletable'>SoftDeletable</a></code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/user#user'>User</a>>) => User`} />
### deletedAt
<MemberInfo kind="property" type={`Date | null`} />
### identifier
<MemberInfo kind="property" type={`string`} />
### authenticationMethods
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/authentication-method#authenticationmethod'>AuthenticationMethod</a>[]`} />
### verified
<MemberInfo kind="property" type={`boolean`} />
### roles
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/role#role'>Role</a>[]`} />
### lastLogin
<MemberInfo kind="property" type={`Date | null`} />
### customFields
<MemberInfo kind="property" type={`CustomUserFields`} />
### sessions
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/authenticated-session#authenticatedsession'>AuthenticatedSession</a>[]`} />
### getNativeAuthenticationMethod
<MemberInfo kind="method" type={`() => <a href='/reference/typescript-api/entities/authentication-method#nativeauthenticationmethod'>NativeAuthenticationMethod</a>`} />
### getNativeAuthenticationMethod
<MemberInfo kind="method" type={`(strict?: boolean) => <a href='/reference/typescript-api/entities/authentication-method#nativeauthenticationmethod'>NativeAuthenticationMethod</a> | undefined`} />
### getNativeAuthenticationMethod
<MemberInfo kind="method" type={`(strict?: boolean) => <a href='/reference/typescript-api/entities/authentication-method#nativeauthenticationmethod'>NativeAuthenticationMethod</a> | undefined`} />
</div>
|
---
title: "VendureEntity"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## VendureEntity
<GenerationInfo sourceFile="packages/core/src/entity/base/base.entity.ts" sourceLine="13" packageName="@vendure/core" />
This is the base class from which all entities inherit. The type of
the `id` property is defined by the <a href='/reference/typescript-api/configuration/entity-id-strategy#entityidstrategy'>EntityIdStrategy</a>.
```ts title="Signature"
class VendureEntity {
constructor(input?: DeepPartial<VendureEntity>)
@PrimaryGeneratedId()
id: ID;
@CreateDateColumn() createdAt: Date;
@UpdateDateColumn() updatedAt: Date;
}
```
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a>>) => VendureEntity`} />
### id
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/id#id'>ID</a>`} />
### createdAt
<MemberInfo kind="property" type={`Date`} />
### updatedAt
<MemberInfo kind="property" type={`Date`} />
</div>
|
---
title: "Zone"
isDefaultIndex: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
import MemberInfo from '@site/src/components/MemberInfo';
import GenerationInfo from '@site/src/components/GenerationInfo';
import MemberDescription from '@site/src/components/MemberDescription';
## Zone
<GenerationInfo sourceFile="packages/core/src/entity/zone/zone.entity.ts" sourceLine="19" packageName="@vendure/core" />
A Zone is a grouping of one or more <a href='/reference/typescript-api/entities/country#country'>Country</a> entities. It is used for
calculating applicable shipping and taxes.
```ts title="Signature"
class Zone extends VendureEntity implements HasCustomFields {
constructor(input?: DeepPartial<Zone>)
@Column() name: string;
@ManyToMany(type => Region)
@JoinTable()
members: Region[];
@Column(type => CustomZoneFields)
customFields: CustomZoneFields;
@OneToMany(type => Channel, country => country.defaultShippingZone)
defaultShippingZoneChannels: Channel[];
@OneToMany(type => Channel, country => country.defaultTaxZone)
defaultTaxZoneChannels: Channel[];
@OneToMany(type => TaxRate, taxRate => taxRate.zone)
taxRates: TaxRate[];
}
```
* Extends: <code><a href='/reference/typescript-api/entities/vendure-entity#vendureentity'>VendureEntity</a></code>
* Implements: <code>HasCustomFields</code>
<div className="members-wrapper">
### constructor
<MemberInfo kind="method" type={`(input?: DeepPartial<<a href='/reference/typescript-api/entities/zone#zone'>Zone</a>>) => Zone`} />
### name
<MemberInfo kind="property" type={`string`} />
### members
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/region#region'>Region</a>[]`} />
### customFields
<MemberInfo kind="property" type={`CustomZoneFields`} />
### defaultShippingZoneChannels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### defaultTaxZoneChannels
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/channel#channel'>Channel</a>[]`} />
### taxRates
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a>[]`} />
</div>
|
---
title: "Errors"
weight: 10
date: 2023-07-14T16:57:49.435Z
showtoc: false
generated: true
---
<!-- This file was generated from the Vendure source. Do not modify. Instead, re-run the "docs:build" script -->
# errors |