Skip to content

Commit

Permalink
chore: Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Apr 15, 2024
1 parent a054549 commit 54acd4d
Show file tree
Hide file tree
Showing 41 changed files with 259 additions and 129 deletions.
26 changes: 13 additions & 13 deletions docs/docs/reference/admin-ui-api/alerts/alert-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ interface AlertConfig<T = any> {
recheck?: (context: AlertContext) => Observable<any>;
isAlert: (data: T, context: AlertContext) => boolean;
action: (data: T, context: AlertContext) => void;
label: (
data: T,
context: AlertContext,
label: (
data: T,
context: AlertContext,
) => { text: string; translationVars?: { [key: string]: string | number } };
requiredPermissions?: Permission[];
}
Expand All @@ -41,18 +41,18 @@ A unique identifier for the alert.

<MemberInfo kind="property" type={`(context: <a href='/reference/admin-ui-api/alerts/alert-context#alertcontext'>AlertContext</a>) =&#62; T | Promise&#60;T&#62; | Observable&#60;T&#62;`} />

A function which is gets the data used to determine whether the alert should be shown.
Typically, this function will query the server or some other remote data source.

This function will be called once when the Admin UI app bootstraps, and can be also
A function which is gets the data used to determine whether the alert should be shown.
Typically, this function will query the server or some other remote data source.

This function will be called once when the Admin UI app bootstraps, and can be also
set to run at regular intervals by setting the `recheckIntervalMs` property.
### recheck

<MemberInfo kind="property" type={`(context: <a href='/reference/admin-ui-api/alerts/alert-context#alertcontext'>AlertContext</a>) =&#62; Observable&#60;any&#62;`} default="undefined" />

A function which returns an Observable which is used to determine when to re-run the `check`
function. Whenever the observable emits, the `check` function will be called again.

A function which returns an Observable which is used to determine when to re-run the `check`
function. Whenever the observable emits, the `check` function will be called again.

A basic time-interval-based recheck can be achieved by using the `interval` function from RxJS.

*Example*
Expand All @@ -69,7 +69,7 @@ If this is not set, the `check` function will only be called once when the Admin

<MemberInfo kind="property" type={`(data: T, context: <a href='/reference/admin-ui-api/alerts/alert-context#alertcontext'>AlertContext</a>) =&#62; boolean`} />

A function which determines whether the alert should be shown based on the data returned by the `check`
A function which determines whether the alert should be shown based on the data returned by the `check`
function.
### action

Expand All @@ -78,14 +78,14 @@ function.
A function which is called when the alert is clicked in the Admin UI.
### label

<MemberInfo kind="property" type={`( data: T, context: <a href='/reference/admin-ui-api/alerts/alert-context#alertcontext'>AlertContext</a>, ) =&#62; { text: string; translationVars?: { [key: string]: string | number } }`} />
<MemberInfo kind="property" type={`( data: T, context: <a href='/reference/admin-ui-api/alerts/alert-context#alertcontext'>AlertContext</a>, ) =&#62; { text: string; translationVars?: { [key: string]: string | number } }`} />

A function which returns the text used in the UI to describe the alert.
### requiredPermissions

<MemberInfo kind="property" type={`<a href='/reference/typescript-api/common/permission#permission'>Permission</a>[]`} />

A list of permissions which the current Administrator must have in order. If the current
A list of permissions which the current Administrator must have in order. If the current
Administrator does not have these permissions, none of the other alert functions will be called.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ await this.entityHydrator

```ts title="Signature"
class EntityHydrator {
constructor(connection: TransactionalConnection, productPriceApplicator: ProductPriceApplicator, translator: TranslatorService, listQueryBuilder: ListQueryBuilder)
constructor(connection: TransactionalConnection, productPriceApplicator: ProductPriceApplicator, translator: TranslatorService)
hydrate(ctx: RequestContext, target: Entity, options: HydrateOptions<Entity>) => Promise<Entity>;
}
```
Expand All @@ -80,7 +80,7 @@ class EntityHydrator {

### 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>, listQueryBuilder: <a href='/reference/typescript-api/data-access/list-query-builder#listquerybuilder'>ListQueryBuilder</a>) => EntityHydrator`} />
<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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## ListQueryBuilder

<GenerationInfo sourceFile="packages/core/src/service/helpers/list-query-builder/list-query-builder.ts" sourceLine="201" packageName="@vendure/core" />
<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:
Expand Down Expand Up @@ -84,7 +84,6 @@ 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>;
joinTreeRelationsDynamically(qb: SelectQueryBuilder<T>, entity: EntityTarget<T>, requestedRelations: string[] = []) => Set<string>;
}
```
* Implements: <code>OnApplicationBootstrap</code>
Expand Down Expand Up @@ -115,19 +114,14 @@ to join that relation.
<MemberInfo kind="method" type={`(entity: Type&#60;T&#62;, options: ListQueryOptions&#60;T&#62; = {}, extendedOptions: <a href='/reference/typescript-api/data-access/list-query-builder#extendedlistqueryoptions'>ExtendedListQueryOptions</a>&#60;T&#62; = {}) => SelectQueryBuilder&#60;T&#62;`} />


### joinTreeRelationsDynamically

<MemberInfo kind="method" type={`(qb: SelectQueryBuilder&#60;T&#62;, entity: EntityTarget&#60;T&#62;, requestedRelations: string[] = []) => Set&#60;string&#62;`} />




</div>


## ExtendedListQueryOptions

<GenerationInfo sourceFile="packages/core/src/service/helpers/list-query-builder/list-query-builder.ts" sourceLine="42" packageName="@vendure/core" />
<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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## TransactionalConnection

<GenerationInfo sourceFile="packages/core/src/connection/transactional-connection.ts" sourceLine="38" packageName="@vendure/core" />
<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
Expand All @@ -23,8 +23,8 @@ API by the use of the `Transaction` decorator.

```ts title="Signature"
class TransactionalConnection {
constructor(connection: Connection, transactionWrapper: TransactionWrapper)
rawConnection: Connection
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>;
Expand All @@ -44,12 +44,12 @@ class TransactionalConnection {

### constructor

<MemberInfo kind="method" type={`(connection: Connection, transactionWrapper: TransactionWrapper) => TransactionalConnection`} />
<MemberInfo kind="method" type={`(dataSource: DataSource, transactionWrapper: TransactionWrapper) => TransactionalConnection`} />


### rawConnection

<MemberInfo kind="property" type={`Connection`} />
<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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ An AuthenticatedSession is created upon successful authentication.
class AuthenticatedSession extends Session {
constructor(input: DeepPartial<AuthenticatedSession>)
@Index()
@ManyToOne(type => User)
@ManyToOne(type => User, user => user.sessions)
user: User;
@Column()
authenticationStrategy: string;
Expand Down
50 changes: 46 additions & 4 deletions docs/docs/reference/typescript-api/entities/channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## Channel

<GenerationInfo sourceFile="packages/core/src/entity/channel/channel.entity.ts" sourceLine="36" packageName="@vendure/core" />
<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.
Expand Down Expand Up @@ -39,18 +39,18 @@ class Channel extends VendureEntity {
@Column({ default: '', nullable: true })
description: string;
@Index()
@ManyToOne(type => Seller)
@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)
@ManyToOne(type => Zone, zone => zone.defaultTaxZoneChannels)
defaultTaxZone: Zone;
@Index()
@ManyToOne(type => Zone)
@ManyToOne(type => Zone, zone => zone.defaultShippingZoneChannels)
defaultShippingZone: Zone;
@Column('varchar')
defaultCurrencyCode: CurrencyCode;
Expand All @@ -73,6 +73,18 @@ class Channel extends VendureEntity {
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>
Expand Down Expand Up @@ -190,6 +202,36 @@ out of stock.
<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>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## CustomerGroup

<GenerationInfo sourceFile="packages/core/src/entity/customer-group/customer-group.entity.ts" sourceLine="16" packageName="@vendure/core" />
<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.
Expand All @@ -24,6 +24,8 @@ class CustomerGroup extends VendureEntity implements HasCustomFields {
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>
Expand Down Expand Up @@ -55,6 +57,11 @@ class CustomerGroup extends VendureEntity implements HasCustomFields {
<MemberInfo kind="property" type={`CustomCustomerGroupFields`} />


### taxRates

<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/tax-rate#taxrate'>TaxRate</a>[]`} />




</div>
2 changes: 1 addition & 1 deletion docs/docs/reference/typescript-api/entities/customer.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Customer extends VendureEntity implements ChannelAware, HasCustomFields, S
user?: User;
@Column(type => CustomCustomerFields)
customFields: CustomCustomerFields;
@ManyToMany(type => Channel)
@ManyToMany(type => Channel, channel => channel.customers)
@JoinTable()
channels: Channel[];
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/reference/typescript-api/entities/facet.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Facet extends VendureEntity implements Translatable, HasCustomFields, Chan
values: FacetValue[];
@Column(type => CustomFacetFields)
customFields: CustomFacetFields;
@ManyToMany(type => Channel)
@ManyToMany(type => Channel, channel => channel.facets)
@JoinTable()
channels: Channel[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class OrderLineReference extends VendureEntity {
@Column()
quantity: number;
@Index()
@ManyToOne(type => OrderLine, { onDelete: 'CASCADE' })
@ManyToOne(type => OrderLine, line => line.linesReferences, { onDelete: 'CASCADE' })
orderLine: OrderLine;
@EntityId()
orderLineId: ID;
Expand Down
40 changes: 32 additions & 8 deletions docs/docs/reference/typescript-api/entities/order-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## OrderLine

<GenerationInfo sourceFile="packages/core/src/entity/order-line/order-line.entity.ts" sourceLine="29" packageName="@vendure/core" />
<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.
Expand All @@ -25,24 +25,31 @@ class OrderLine extends VendureEntity implements HasCustomFields {
@EntityId({ nullable: true })
sellerChannelId?: ID;
@Index()
@ManyToOne(type => ShippingLine, { nullable: true, onDelete: 'SET NULL' })
@ManyToOne(type => ShippingLine, shippingLine => shippingLine.orderLines, {
nullable: true,
onDelete: 'SET NULL',
})
shippingLine?: ShippingLine;
@EntityId({ nullable: true })
shippingLineId?: ID;
@Index()
@ManyToOne(type => ProductVariant)
@ManyToOne(type => ProductVariant, productVariant => productVariant.lines, { onDelete: 'CASCADE' })
productVariant: ProductVariant;
@EntityId()
productVariantId: ID;
@Index()
@ManyToOne(type => TaxCategory)
taxCategory: TaxCategory;
@Index()
@ManyToOne(type => Asset)
@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 })
Expand All @@ -57,8 +64,10 @@ class OrderLine extends VendureEntity implements HasCustomFields {
adjustments: Adjustment[];
@Column('simple-json')
taxLines: TaxLine[];
@OneToOne(type => Cancellation, cancellation => cancellation.orderLine)
cancellation: Cancellation;
@OneToMany(type => Cancellation, cancellation => cancellation.orderLine)
cancellations: Cancellation[];
@OneToMany(type => Allocation, allocation => allocation.orderLine)
allocations: Allocation[];
@Column(type => CustomOrderLineFields)
customFields: CustomOrderLineFields;
unitPrice: number
Expand Down Expand Up @@ -145,6 +154,16 @@ The <a href='/reference/typescript-api/entities/product-variant#productvariant'>
<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`} />
Expand Down Expand Up @@ -183,9 +202,14 @@ Whether the listPrice includes tax, which depends on the settings of the current
<MemberInfo kind="property" type={`TaxLine[]`} />


### cancellation
### 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#cancellation'>Cancellation</a>`} />
<MemberInfo kind="property" type={`<a href='/reference/typescript-api/entities/stock-movement#allocation'>Allocation</a>[]`} />


### customFields
Expand Down
Loading

0 comments on commit 54acd4d

Please sign in to comment.