فهرست منبع

docs(server): Generate docs for config interfaces

Michael Bromley 7 سال پیش
والد
کامیت
81240f354c
58فایلهای تغییر یافته به همراه1126 افزوده شده و 297 حذف شده
  1. 4 0
      docs/content/docs/api/_index.md
  2. 9 0
      docs/content/docs/api/assets/_index.md
  3. 24 0
      docs/content/docs/api/assets/asset-naming-strategy.md
  4. 36 0
      docs/content/docs/api/assets/asset-options.md
  5. 18 0
      docs/content/docs/api/assets/asset-preview-strategy.md
  6. 48 0
      docs/content/docs/api/assets/asset-storage-strategy.md
  7. 9 0
      docs/content/docs/api/auth/_index.md
  8. 54 0
      docs/content/docs/api/auth/auth-options.md
  9. 9 0
      docs/content/docs/api/email/_index.md
  10. 36 0
      docs/content/docs/api/email/email-options.md
  11. 30 0
      docs/content/docs/api/email/file-transport-options.md
  12. 18 0
      docs/content/docs/api/email/noop-transport-options.md
  13. 72 0
      docs/content/docs/api/email/s-m-t-p-transport-options.md
  14. 30 0
      docs/content/docs/api/email/sendmail-transport-options.md
  15. 24 0
      docs/content/docs/api/email/testing-transport-options.md
  16. 30 0
      docs/content/docs/api/entity-id-strategy.md
  17. 18 0
      docs/content/docs/api/import-export-options.md
  18. 9 0
      docs/content/docs/api/orders/_index.md
  19. 24 0
      docs/content/docs/api/orders/order-merge-options.md
  20. 18 0
      docs/content/docs/api/orders/order-merge-strategy.md
  21. 36 0
      docs/content/docs/api/orders/order-process-options.md
  22. 24 0
      docs/content/docs/api/orders/shipping-options.md
  23. 9 0
      docs/content/docs/api/payment/_index.md
  24. 18 0
      docs/content/docs/api/payment/payment-options.md
  25. 9 0
      docs/content/docs/api/plugins/_index.md
  26. 42 0
      docs/content/docs/api/plugins/vendure-plugin.md
  27. 9 0
      docs/content/docs/api/promotions/_index.md
  28. 24 0
      docs/content/docs/api/promotions/promotion-options.md
  29. 9 0
      docs/content/docs/api/tax/_index.md
  30. 18 0
      docs/content/docs/api/tax/tax-calculation-strategy.md
  31. 24 0
      docs/content/docs/api/tax/tax-options.md
  32. 18 0
      docs/content/docs/api/tax/tax-zone-strategy.md
  33. 150 0
      docs/content/docs/api/vendure-config.md
  34. 0 153
      docs/content/docs/configuration/_index.md
  35. 0 37
      docs/content/docs/configuration/config-asset-options.md
  36. 0 43
      docs/content/docs/configuration/config-auth-options.md
  37. 0 6
      docs/content/docs/configuration/config-custom-fields.md
  38. 0 6
      docs/content/docs/configuration/config-email-options.md
  39. 0 6
      docs/content/docs/configuration/config-order-process-options.md
  40. 0 5
      docs/content/docs/configuration/config-payment-options.md
  41. 0 6
      docs/content/docs/configuration/config-promotion-options.md
  42. 0 7
      docs/content/docs/configuration/config-shipping-options.md
  43. 0 5
      docs/content/docs/configuration/config-tax-options.md
  44. 8 0
      docs/layouts/docs/list.html
  45. 1 5
      docs/layouts/partials/docs/menu-filetree.html
  46. 2 0
      package.json
  47. 5 0
      server/src/config/asset-naming-strategy/asset-naming-strategy.ts
  48. 3 0
      server/src/config/asset-preview-strategy/asset-preview-strategy.ts
  49. 3 0
      server/src/config/asset-storage-strategy/asset-storage-strategy.ts
  50. 28 7
      server/src/config/email/email-transport-options.ts
  51. 3 0
      server/src/config/entity-id-strategy/entity-id-strategy.ts
  52. 1 0
      server/src/config/order-merge-strategy/merge-orders-strategy.ts
  53. 3 0
      server/src/config/order-merge-strategy/order-merge-strategy.ts
  54. 3 0
      server/src/config/tax/tax-calculation-strategy.ts
  55. 3 0
      server/src/config/tax/tax-zone-strategy.ts
  56. 126 11
      server/src/config/vendure-config.ts
  57. 8 0
      server/src/config/vendure-plugin/vendure-plugin.ts
  58. 19 0
      yarn.lock

+ 4 - 0
docs/content/docs/api/_index.md

@@ -0,0 +1,4 @@
+---
+title: "API"
+weight: 10
+---

+ 9 - 0
docs/content/docs/api/assets/_index.md

@@ -0,0 +1,9 @@
+---
+title: "assets"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# assets

+ 24 - 0
docs/content/docs/api/assets/asset-naming-strategy.md

@@ -0,0 +1,24 @@
+---
+title: "AssetNamingStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# AssetNamingStrategy
+
+The AssetNamingStrategy determines how file names are generated based on the uploaded source file name,
as well as how to handle naming conflicts.
+
+### generateSourceFileName
+
+{{< member-info type="(originalFileName: string, conflictFileName: string) => string" >}}
+
+Given the original file name of the uploaded file, generate a file name to
be stored on the server. Operations like normalization and time-stamping can
be performed in this method.

The output will be checked for a naming conflict with an existing file. If a conflict
exists, this method will be invoked again with the second argument passed in and a new, unique
file name should then be generated. This process will repeat until a unique file name has
been returned.
+
+### generatePreviewFileName
+
+{{< member-info type="(sourceFileName: string, conflictFileName: string) => string" >}}
+
+Given the source file name generated in the {@link generateSourceFileName} method, this method
should generate the file name of the preview image.

The same mechanism of checking for conflicts is used as described above.
+

+ 36 - 0
docs/content/docs/api/assets/asset-options.md

@@ -0,0 +1,36 @@
+---
+title: "AssetOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# AssetOptions
+
+The AssetOptions define how assets (images and other files) are named and stored, and how preview images are generated.
+
+### assetNamingStrategy
+
+{{< member-info type="<a href='/docs/api//assets/asset-naming-strategy/'>AssetNamingStrategy</a>" >}}
+
+Defines how asset files and preview images are named before being saved.
+
+### assetStorageStrategy
+
+{{< member-info type="<a href='/docs/api//assets/asset-storage-strategy/'>AssetStorageStrategy</a>" >}}
+
+Defines the strategy used for storing uploaded binary files.
+
+### assetPreviewStrategy
+
+{{< member-info type="<a href='/docs/api//assets/asset-preview-strategy/'>AssetPreviewStrategy</a>" >}}
+
+Defines the strategy used for creating preview images of uploaded assets.
+
+### uploadMaxFileSize
+
+{{< member-info type="number" >}}
+
+The max file size in bytes for uploaded assets.
+

+ 18 - 0
docs/content/docs/api/assets/asset-preview-strategy.md

@@ -0,0 +1,18 @@
+---
+title: "AssetPreviewStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# AssetPreviewStrategy
+
+The AssetPreviewStrategy determines how preview images for assets are created. For image
assets, this would usually typically involve resizing to sensible dimensions. Other file types
could be previewed in a variety of ways, e.g.:
- waveform images generated for audio files
- preview images generated for pdf documents
- watermarks added to preview images
+
+### generatePreviewImage
+
+{{< member-info type="(mimeType: string, data: Buffer) => Promise&#60;Buffer&#62;" >}}
+
+
+

+ 48 - 0
docs/content/docs/api/assets/asset-storage-strategy.md

@@ -0,0 +1,48 @@
+---
+title: "AssetStorageStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# AssetStorageStrategy
+
+The AssetPersistenceStrategy determines how Asset files are physically stored
and retrieved.
+
+### writeFileFromBuffer
+
+{{< member-info type="(fileName: string, data: Buffer) => Promise&#60;string&#62;" >}}
+
+
+
+### writeFileFromStream
+
+{{< member-info type="(fileName: string, data: Stream) => Promise&#60;string&#62;" >}}
+
+
+
+### readFileToBuffer
+
+{{< member-info type="(identifier: string) => Promise&#60;Buffer&#62;" >}}
+
+
+
+### readFileToStream
+
+{{< member-info type="(identifier: string) => Promise&#60;Stream&#62;" >}}
+
+
+
+### fileExists
+
+{{< member-info type="(fileName: string) => Promise&#60;boolean&#62;" >}}
+
+
+
+### toAbsoluteUrl
+
+{{< member-info type="(reqest: Request, identifier: string) => string" >}}
+
+
+

+ 9 - 0
docs/content/docs/api/auth/_index.md

@@ -0,0 +1,9 @@
+---
+title: "auth"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# auth

+ 54 - 0
docs/content/docs/api/auth/auth-options.md

@@ -0,0 +1,54 @@
+---
+title: "AuthOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# AuthOptions
+
+The AuthOptions define how authentication is managed.
+
+### disableAuth
+
+{{< member-info type="boolean" default="truuuu" >}}
+
+Disable authentication & permissions checks.
NEVER set the to true in production. It exists
only to aid certain development tasks.
+
+### tokenMethod
+
+{{< member-info type="'cookie' | 'bearer'" default="'cookie'" >}}
+
+Sets the method by which the session token is delivered and read.

* 'cookie': Upon login, a 'Set-Cookie' header will be returned to the client, setting a
cookie containing the session token. A browser-based client (making requests with credentials)
should automatically send the session cookie with each request.
* 'bearer': Upon login, the token is returned in the response and should be then stored by the
client app. Each request should include the header 'Authorization: Bearer <token>'.
+
+### sessionSecret
+
+{{< member-info type="string" default="'session-secret'" >}}
+
+The secret used for signing the session cookies for authenticated users. Only applies when
tokenMethod is set to 'cookie'.

In production applications, this should not be stored as a string in
source control for security reasons, but may be loaded from an external
file not under source control, or from an environment variable, for example.
+
+### authTokenHeaderKey
+
+{{< member-info type="string" default="'vendure-auth-token'" >}}
+
+Sets the header property which will be used to send the auth token when using the 'bearer' method.
+
+### sessionDuration
+
+{{< member-info type="string | number" default="'7d'" >}}
+
+Session duration, i.e. the time which must elapse from the last authenticted request
after which the user must re-authenticate.

Expressed as a string describing a time span per
[zeit/ms](https://github.com/zeit/ms.js).  Eg: `60`, `'2 days'`, `'10h'`, `'7d'`
+
+### requireVerification
+
+{{< member-info type="boolean" >}}
+
+Determines whether new User accounts require verification of their email address.
+
+### verificationTokenDuration
+
+{{< member-info type="string | number" default="'7d'" >}}
+
+Sets the length of time that a verification token is valid for, after which the verification token must be refreshed.

Expressed as a string describing a time span per
[zeit/ms](https://github.com/zeit/ms.js).  Eg: `60`, `'2 days'`, `'10h'`, `'7d'`
+

+ 9 - 0
docs/content/docs/api/email/_index.md

@@ -0,0 +1,9 @@
+---
+title: "email"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# email

+ 36 - 0
docs/content/docs/api/email/email-options.md

@@ -0,0 +1,36 @@
+---
+title: "EmailOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# EmailOptions
+
+
+
+### emailTemplatePath
+
+{{< member-info type="string" >}}
+
+Path to the email template files.
+
+### emailTypes
+
+{{< member-info type="EmailTypes&#60;EmailType&#62;" >}}
+
+Configuration for the creation and templating of each email type
+
+### generator
+
+{{< member-info type="EmailGenerator" >}}
+
+The EmailGenerator uses the EmailContext and template to generate the email body
+
+### transport
+
+{{< member-info type="EmailTransportOptions" >}}
+
+Configuration for the transport (email sending) method
+

+ 30 - 0
docs/content/docs/api/email/file-transport-options.md

@@ -0,0 +1,30 @@
+---
+title: "FileTransportOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# FileTransportOptions
+
+Outputs the email as an HTML file for development purposes.
+
+### type
+
+{{< member-info type="'file'" >}}
+
+
+
+### outputPath
+
+{{< member-info type="string" >}}
+
+
+
+### raw
+
+{{< member-info type="boolean" >}}
+
+
+

+ 18 - 0
docs/content/docs/api/email/noop-transport-options.md

@@ -0,0 +1,18 @@
+---
+title: "NoopTransportOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# NoopTransportOptions
+
+Does nothing with the generated email. Mainly intended for use in testing where we don't care about the email transport.
+
+### type
+
+{{< member-info type="'none'" >}}
+
+
+

+ 72 - 0
docs/content/docs/api/email/s-m-t-p-transport-options.md

@@ -0,0 +1,72 @@
+---
+title: "SMTPTransportOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# SMTPTransportOptions
+
+A subset of the SMTP transport options of [Nodemailer](https://nodemailer.com/smtp/)
+
+### type
+
+{{< member-info type="'smtp'" >}}
+
+
+
+### host
+
+{{< member-info type="string" >}}
+
+
+
+### port
+
+{{< member-info type="number" >}}
+
+
+
+### auth
+
+{{< member-info type="SMTPCredentials" >}}
+
+
+
+### secure
+
+{{< member-info type="boolean" >}}
+
+
+
+### ignoreTLS
+
+{{< member-info type="boolean" >}}
+
+
+
+### requireTLS
+
+{{< member-info type="boolean" >}}
+
+
+
+### name
+
+{{< member-info type="string" >}}
+
+
+
+### localAddress
+
+{{< member-info type="string" >}}
+
+
+
+### authMethod
+
+{{< member-info type="string" >}}
+
+
+

+ 30 - 0
docs/content/docs/api/email/sendmail-transport-options.md

@@ -0,0 +1,30 @@
+---
+title: "SendmailTransportOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# SendmailTransportOptions
+
+Uses the local Sendmail program to send the email.
+
+### type
+
+{{< member-info type="'sendmail'" >}}
+
+
+
+### path
+
+{{< member-info type="string" >}}
+
+
+
+### newline
+
+{{< member-info type="string" >}}
+
+
+

+ 24 - 0
docs/content/docs/api/email/testing-transport-options.md

@@ -0,0 +1,24 @@
+---
+title: "TestingTransportOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# TestingTransportOptions
+
+Forwards the raw GeneratedEmailContext object to a provided callback, for use in testing.
+
+### type
+
+{{< member-info type="'testing'" >}}
+
+
+
+### onSend
+
+{{< member-info type="(context: GeneratedEmailContext) =&#62; void" >}}
+
+Callback to be invoked when an email would be sent.
+

+ 30 - 0
docs/content/docs/api/entity-id-strategy.md

@@ -0,0 +1,30 @@
+---
+title: "EntityIdStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# EntityIdStrategy
+
+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.
+
+### primaryKeyType
+
+{{< member-info type="PrimaryKeyType" >}}
+
+
+
+### encodeId
+
+{{< member-info type="(primaryKey: T) =&#62; string" >}}
+
+
+
+### decodeId
+
+{{< member-info type="(id: string) =&#62; T" >}}
+
+
+

+ 18 - 0
docs/content/docs/api/import-export-options.md

@@ -0,0 +1,18 @@
+---
+title: "ImportExportOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# ImportExportOptions
+
+
+
+### importAssetsDir
+
+{{< member-info type="string" >}}
+
+The directory in which assets to be imported are located.
+

+ 9 - 0
docs/content/docs/api/orders/_index.md

@@ -0,0 +1,9 @@
+---
+title: "orders"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# orders

+ 24 - 0
docs/content/docs/api/orders/order-merge-options.md

@@ -0,0 +1,24 @@
+---
+title: "OrderMergeOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# OrderMergeOptions
+
+
+
+### mergeStrategy
+
+{{< member-info type="<a href='/docs/api//orders/order-merge-strategy/'>OrderMergeStrategy</a>" >}}
+
+Defines the strategy used to merge a guest Order and an existing Order when
signing in.
+
+### checkoutMergeStrategy
+
+{{< member-info type="<a href='/docs/api//orders/order-merge-strategy/'>OrderMergeStrategy</a>" >}}
+
+Defines the strategy used to merge a guest Order and an existing Order when
signing in as part of the checkout flow.
+

+ 18 - 0
docs/content/docs/api/orders/order-merge-strategy.md

@@ -0,0 +1,18 @@
+---
+title: "OrderMergeStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# OrderMergeStrategy
+
+An OrderMergeStrategy defines what happens when a Customer with an existing Order
signs in with a guest Order, where both Orders may contain differing OrderLines.

Somehow these differing OrderLines need to be reconciled into a single collection
of OrderLines. The OrderMergeStrategy defines the rules governing this reconciliation.
+
+### merge
+
+{{< member-info type="(guestOrder: Order, existingOrder: Order) => OrderLine[]" >}}
+
+
+

+ 36 - 0
docs/content/docs/api/orders/order-process-options.md

@@ -0,0 +1,36 @@
+---
+title: "OrderProcessOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# OrderProcessOptions
+
+
+
+### transtitions
+
+{{< member-info type="Partial&#60;Transitions&#60;T | OrderState&#62;&#62;" >}}
+
+Define how the custom states fit in with the default order
state transitions.
+
+### onTransitionStart
+
+{{< member-info type="(fromState: T, toState: T, data: { order: Order }) => boolean | Promise&#60;boolean&#62; | Observable&#60;boolean&#62; | void" >}}
+
+Define logic to run before a state tranition takes place. Returning
false will prevent the transition from going ahead.
+
+### onTransitionEnd
+
+{{< member-info type="(fromState: T, toState: T, data: { order: Order }) => void" >}}
+
+Define logic to run after a state transition has taken place.
+
+### onError
+
+{{< member-info type="(fromState: T, toState: T, message: string) => void" >}}
+
+Define a custom error handler function for transition errors.
+

+ 24 - 0
docs/content/docs/api/orders/shipping-options.md

@@ -0,0 +1,24 @@
+---
+title: "ShippingOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# ShippingOptions
+
+
+
+### shippingEligibilityCheckers
+
+{{< member-info type="Array&#60;ShippingEligibilityChecker&#60;any&#62;&#62;" >}}
+
+An array of available ShippingEligibilityCheckers for use in configuring ShippingMethods
+
+### shippingCalculators
+
+{{< member-info type="Array&#60;ShippingCalculator&#60;any&#62;&#62;" >}}
+
+An array of available ShippingCalculator for use in configuring ShippingMethods
+

+ 9 - 0
docs/content/docs/api/payment/_index.md

@@ -0,0 +1,9 @@
+---
+title: "payment"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# payment

+ 18 - 0
docs/content/docs/api/payment/payment-options.md

@@ -0,0 +1,18 @@
+---
+title: "PaymentOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# PaymentOptions
+
+
+
+### paymentMethodHandlers
+
+{{< member-info type="Array&#60;PaymentMethodHandler&#60;any&#62;&#62;" >}}
+
+An array of payment methods with which to process payments.
+

+ 9 - 0
docs/content/docs/api/plugins/_index.md

@@ -0,0 +1,9 @@
+---
+title: "plugins"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# plugins

+ 42 - 0
docs/content/docs/api/plugins/vendure-plugin.md

@@ -0,0 +1,42 @@
+---
+title: "VendurePlugin"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# VendurePlugin
+
+A VendurePlugin is a means of configuring and/or extending the functionality of the Vendure server. In its simplest form,
a plugin simply modifies the VendureConfig object. Although such configuration can be directly supplied to the bootstrap
function, using a plugin allows one to abstract away a set of related configuration.

As well as configuring the app, a plugin may also extend the GraphQL schema by extending existing types or adding
entirely new types. Database entities and resolvers can also be defined to handle the extended GraphQL types.
+
+### configure
+
+{{< member-info type="(config: Required&#60;<a href='/docs/api///vendure-config/'>VendureConfig</a>&#62;) => Required&#60;<a href='/docs/api///vendure-config/'>VendureConfig</a>&#62; | Promise&#60;Required&#60;VendureConfig&#62;&#62;" >}}
+
+This method is called before the app bootstraps, and can modify the VendureConfig object and perform
other (potentially async) tasks needed.
+
+### onBootstrap
+
+{{< member-info type="(inject: InjectorFn) => void | Promise&#60;void&#62;" >}}
+
+This method is called after the app has bootstrapped. In this method, instances of services may be injected
into the plugin. For example, the ProductService can be injected in order to enable operations on Product
entities.
+
+### defineGraphQlTypes
+
+{{< member-info type="() => DocumentNode" >}}
+
+The plugin may extend the default Vendure GraphQL schema by implementing this method.
+
+### defineProviders
+
+{{< member-info type="() => Array&#60;Type&#60;any&#62;&#62;" >}}
+
+The plugin may define custom providers (including GraphQL resolvers) which can then be injected via the Nest DI container.
+
+### defineEntities
+
+{{< member-info type="() => Array&#60;Type&#60;any&#62;&#62;" >}}
+
+The plugin may define custom database entities, which should be defined as classes annotated as per the
TypeORM documentation.
+

+ 9 - 0
docs/content/docs/api/promotions/_index.md

@@ -0,0 +1,9 @@
+---
+title: "promotions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# promotions

+ 24 - 0
docs/content/docs/api/promotions/promotion-options.md

@@ -0,0 +1,24 @@
+---
+title: "PromotionOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# PromotionOptions
+
+
+
+### promotionConditions
+
+{{< member-info type="Array&#60;PromotionCondition&#60;any&#62;&#62;" >}}
+
+An array of conditions which can be used to construct Promotions
+
+### promotionActions
+
+{{< member-info type="Array&#60;PromotionAction&#60;any&#62;&#62;" >}}
+
+An array of actions which can be used to construct Promotions
+

+ 9 - 0
docs/content/docs/api/tax/_index.md

@@ -0,0 +1,9 @@
+---
+title: "tax"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# tax

+ 18 - 0
docs/content/docs/api/tax/tax-calculation-strategy.md

@@ -0,0 +1,18 @@
+---
+title: "TaxCalculationStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# TaxCalculationStrategy
+
+Defines how taxes are calculated based on the input price, tax zone and current request context.
+
+### calculate
+
+{{< member-info type="(args: TaxCalculationArgs) => TaxCalculationResult" >}}
+
+
+

+ 24 - 0
docs/content/docs/api/tax/tax-options.md

@@ -0,0 +1,24 @@
+---
+title: "TaxOptions"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# TaxOptions
+
+
+
+### taxZoneStrategy
+
+{{< member-info type="<a href='/docs/api//tax/tax-zone-strategy/'>TaxZoneStrategy</a>" >}}
+
+Defines the strategy used to determine the applicable Zone used in tax calculations.
+
+### taxCalculationStrategy
+
+{{< member-info type="<a href='/docs/api//tax/tax-calculation-strategy/'>TaxCalculationStrategy</a>" >}}
+
+Defines the strategy used for calculating taxes.
+

+ 18 - 0
docs/content/docs/api/tax/tax-zone-strategy.md

@@ -0,0 +1,18 @@
+---
+title: "TaxZoneStrategy"
+weight: 10
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# TaxZoneStrategy
+
+Defines how the active Zone is determined for the purposes of calculating taxes.
+
+### determineTaxZone
+
+{{< member-info type="(zones: Zone[], channel: Channel, order: Order) => Zone" >}}
+
+
+

+ 150 - 0
docs/content/docs/api/vendure-config.md

@@ -0,0 +1,150 @@
+---
+title: "VendureConfig"
+weight: 0
+generated: true
+---
+<!-- This file was generated from the Vendure TypeScript source. Do not modify. Instead, re-run "generate-docs" -->
+
+
+# VendureConfig
+
+All possible configuration options are defined by the
[`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/server/src/config/vendure-config.ts) interface.

{{% alert %}}
Note on terminology: many of the configuration properties are named "Strategy" - this is because their use follows the
[Strategy Pattern](https://en.wikipedia.org/wiki/Strategy_pattern) of software design.
{{% /alert %}}
+
+### apiPath
+
+{{< member-info type="string" >}}
+
+The path to the GraphQL API.
+
+### assetOptions
+
+{{< member-info type="<a href='/docs/api//assets/asset-options/'>AssetOptions</a>" >}}
+
+Configuration for the handling of Assets.
+
+### authOptions
+
+{{< member-info type="<a href='/docs/api//auth/auth-options/'>AuthOptions</a>" >}}
+
+Configuration for authorization.
+
+### channelTokenKey
+
+{{< member-info type="string" >}}
+
+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
+
+{{< member-info type="boolean | CorsOptions" >}}
+
+Set the CORS handling for the server.
+
+### customFields
+
+{{< member-info type="CustomFields" >}}
+
+Defines custom fields which can be used to extend the built-in entities.
+
+### dbConnectionOptions
+
+{{< member-info type="ConnectionOptions" >}}
+
+The connection options used by TypeORM to connect to the database.
+
+### defaultChannelToken
+
+{{< member-info type="string | null" >}}
+
+The token for the default channel. If not specified, a token
will be randomly generated.
+
+### defaultLanguageCode
+
+{{< member-info type="LanguageCode" >}}
+
+The default languageCode of the app.
+
+### emailOptions
+
+{{< member-info type="<a href='/docs/api//email/email-options/'>EmailOptions</a>&#60;any&#62;" >}}
+
+Configures the handling of transactional emails.
+
+### entityIdStrategy
+
+{{< member-info type="<a href='/docs/api///entity-id-strategy/'>EntityIdStrategy</a>&#60;any&#62;" >}}
+
+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.
+
+### hostname
+
+{{< member-info type="string" >}}
+
+Set the hostname of the server.
+
+### importExportOptions
+
+{{< member-info type="<a href='/docs/api///import-export-options/'>ImportExportOptions</a>" >}}
+
+Configuration settings for data import and export.
+
+### orderMergeOptions
+
+{{< member-info type="<a href='/docs/api//orders/order-merge-options/'>OrderMergeOptions</a>" >}}
+
+Define the strategies governing how Orders are merged when an existing
Customer signs in.
+
+### orderProcessOptions
+
+{{< member-info type="<a href='/docs/api//orders/order-process-options/'>OrderProcessOptions</a>&#60;any&#62;" >}}
+
+Defines custom states in the order process finite state machine.
+
+### middleware
+
+{{< member-info type="Array&#60;{ handler: RequestHandler; route: string }&#62;" >}}
+
+Custom Express middleware for the server.
+
+### paymentOptions
+
+{{< member-info type="<a href='/docs/api//payment/payment-options/'>PaymentOptions</a>" >}}
+
+Configures available payment processing methods.
+
+### plugins
+
+{{< member-info type="<a href='/docs/api//plugins/vendure-plugin/'>VendurePlugin</a>[]" >}}
+
+An array of plugins.
+
+### port
+
+{{< member-info type="number" >}}
+
+Which port the Vendure server should listen on.
+
+### promotionOptions
+
+{{< member-info type="<a href='/docs/api//promotions/promotion-options/'>PromotionOptions</a>" >}}
+
+Configures the Conditions and Actions available when creating Promotions.
+
+### shippingOptions
+
+{{< member-info type="<a href='/docs/api//orders/shipping-options/'>ShippingOptions</a>" >}}
+
+Configures the available checkers and calculators for ShippingMethods.
+
+### silent
+
+{{< member-info type="boolean" >}}
+
+When set to true, no application logging will be output to the console.
+
+### taxOptions
+
+{{< member-info type="<a href='/docs/api//tax/tax-options/'>TaxOptions</a>" >}}
+
+Configures how taxes are calculated on products.
+

+ 0 - 153
docs/content/docs/configuration/_index.md

@@ -1,153 +0,0 @@
----
-title: "Configuration"
-weight: 1
----
-
-# Configuration
-
-All configuration and customization of Vendure is done via the `VendureConfig` object which gets passed to the `bootstrap` function:
-
-## Example configuration
-
-```TypeScript
-bootstrap({
-    authOptions: {
-        sessionSecret: 'xup1hki5zo',
-    },
-    port: 3000,
-    apiPath: 'api',
-    dbConnectionOptions: {
-        type: 'mysql',
-        database: 'vendure-dev',
-        host: '192.168.99.100',
-        port: 3306,
-        username: 'root',
-        password: '',
-    },
-    paymentOptions: {
-        paymentMethodHandlers: [examplePaymentHandler],
-    },
-    customFields: {},
-    importExportOptions: {
-        importAssetsDir: path.join(__dirname, 'vendure/import-assets'),
-    },
-    plugins: [
-        new DefaultAssetServerPlugin({
-            route: 'assets',
-            assetUploadDir: path.join(__dirname, 'vendure/assets'),
-            port: 4000,
-        }),
-        new DefaultEmailPlugin({
-            templatePath: path.join(__dirname, 'vendure/email/templates'),
-            devMode: true,
-        }),
-        new DefaultSearchPlugin(),
-        new AdminUiPlugin({
-            port: 3001,
-        }),
-    ],
-}).catch(err => {
-    console.log(err);
-});
-```
-
-## The `VendureConfig` interface
-
-All possible configuration options are defined by the [`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/server/src/config/vendure-config.ts) interface.
-
-{{% alert %}}
-Note on terminology: many of the configuration properties are named "Strategy" - this is because their use follows the [Strategy Pattern](https://en.wikipedia.org/wiki/Strategy_pattern) of software design.
-{{% /alert %}}
-
-### apiPath
-
-The path to the GraphQL API.
-
-### assetOptions
-
-Configuration for the handling of Assets (images and other files). See [assetOptions]({{< ref "config-asset-options.md" >}}).
-
-### authOptions
-
-Configuration for authorization and authentication. See [authOptions](/docs/config-auth-options).
-
-### channelTokenKey
-
-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
-
-Set the CORS handling for the server. See [the Express cors docs](https://github.com/expressjs/cors#configuration-options)
-
-### customFields
-
-Defines custom fields which can be used to extend the built-in entities. See [customFields](/docs/config-custom-fields).
-
-### dbConnectionOptions
-
-The connection options used by TypeORM to connect to the database. See the [TypeORM connection options docs](http://typeorm.io/#/connection-options).
-
-### defaultChannelToken
-
-The token for the default channel. If not specified, a token will be randomly generated.
-
-### defaultLanguageCode
-
-The default ISO 639-1 language code of the server.
-
-### emailOptions
-
-Configures the handling of transactional emails. See [emailOptions](/docs/config-email-options).
-
-### entityIdStrategy
-
-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.
-
-### hostname
-
-Set the hostname of the server.
-
-### importExportOptions
-
-Configuration settings for data import and export.
-
-### orderMergeOptions
-
-Define the strategies governing how Orders are merged when an existing Customer signs in.
-
-### orderProcessOptions
-
-Defines custom states in the order process finite state machine. See [orderProcessOptions](/docs/config-order-process-options).
-
-### middleware
-
-Defines custom Express middleware to use for incoming API requests.
-
-### paymentOptions
-
-Configures available payment processing methods. See [paymentOptions](/docs/config-payment-options).
-
-### plugins
-
-Configure the active Vendure plugins. See [plugins](/docs/plugins).
-
-### port
-
-Which port the Vendure server should listen on.
-
-### promotionOptions
-
-Configures the Conditions and Actions available when creating Promotions. See [promotionOptions](/docs/config-promotion-options).
-
-### shippingOptions
-
-Configures the available checkers and calculators for ShippingMethods. See [shippingOptions](/docs/config-shipping-options).
-
-### silent
-
-When set to true, no application logging will be output to the console.
-
-### taxOptions
-
-Configures how taxes are calculated on products. See [taxOptions](/docs/config-tax-options).
-

+ 0 - 37
docs/content/docs/configuration/config-asset-options.md

@@ -1,37 +0,0 @@
----
-title: "Asset Options"
-weight: 1
----
-
-# Asset Options
-
-The `AssetOptions` define how assets (images and other files) are named and stored, and how preview images are generated.
-
-
-## AssetNamingStrategy
-
-This class defines how the asset file will be named when being stored after upload, including how to deal with naming conflicts with existing files. 
-
-By default the `DefaultAssetNamingStrategy` is used, which normalizes the original file name and in the case of conflicts, appends a number to the end.
-
-## AssetStorageStrategy
-
-This defines how the asset files are stored to disk and retrieved. For example, if you wish to store assets on a cloud server such as Amazon S3, you can create a strategy for that.
-
-{{% alert warning %}}
-By default, the `NoAssetStorageStrategy` is used, which simply throws an error whenever an operation is attempted. Therefore, a valid strategy *must* be set in order to work with assets. The simplest way to do this is to use the `DefaultAssetServerPlugin`.
-{{% /alert %}}
-
-## AssetPreviewStrategy
-
-This defines how preview images of assets are generated. Typically, a preview image would be a scaled-down version of the original file, so that if the source image is a 2MB, 3000 x 4000 pixel photo, the preview could be limited to some maximum dimensions. Additionally, non-image assets (e.g. pdfs, audio files) require preview images.
-
-A use-case for writing a custom `AssetPreviewStrategy` could be the case of a business selling royalty-free music samples. In this case, the asset would be an audio file, and the custom strategy could include code which generates a visual waveform representation of the audio.
-
-{{% alert warning %}}
-By default, the `NoAssetPreviewStrategy` is used, which simply throws an error whenever an operation is attempted. Therefore, a valid strategy *must* be set in order to work with assets. The simplest way to do this is to use the `DefaultAssetServerPlugin`.
-{{% /alert %}}
-
-## uploadMaxFileSize
-
-Sets the max file size in bytes for uploaded assets. Defaults to 20,971,520 bytes (20MiB).

+ 0 - 43
docs/content/docs/configuration/config-auth-options.md

@@ -1,43 +0,0 @@
----
-title: Auth Options
-weight: 1
----
-
-# Auth Options
-
-The `AuthOptions` define how authentication is managed.
-
-## tokenMethod
-{{< config-option type="'cookie' | 'bearer'" default="'cookie'" >}}
-
-Sets the method by which the session token is delivered and read.
-
-* "cookie": Upon login, a `Set-Cookie` header will be returned to the client, setting a cookie containing the session token. A browser-based client (making requests with credentials) should automatically send the session cookie with each request.
-* "bearer": Upon login, the token is returned in the response and should be then stored by the client app. Each request should include the header "Authorization: Bearer <token>".
-
-## sessionSecret
-{{< config-option type="string" default="'session-secret'" >}}
-
-The secret used for signing the session cookies for authenticated users. Only applies when tokenMethod is set to "cookie". In production applications, this should not be stored as a string in source control for security reasons, but may be loaded from an external file not under source control, or from an environment variable, for example.
-
-## authTokenHeaderKey
-{{< config-option type="string" default="'vendure-auth-token'" >}}
-
-Sets the header property which will be used to send the auth token when using the "bearer" method.
-
-## sessionDuration
-{{< config-option type="string | number" default="'7d'" >}}
-
-Session duration, i.e. the time which must elapse from the last authenticted request after which the user must re-authenticate. 
-
-Expressed as a string describing a time span per [zeit/ms](https://github.com/zeit/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"`.
-
-## requireVerification
-
-Determines whether new User accounts require verification of their email address. Defaults to `true`.
-
-## verificationTokenDuration
-
-Sets the length of time that a verification token is valid for, after which the verification token must be refreshed.
-
-Expressed as a string describing a time span per [zeit/ms](https://github.com/zeit/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"`. Defaults to `"7d"`.

+ 0 - 6
docs/content/docs/configuration/config-custom-fields.md

@@ -1,6 +0,0 @@
----
-title: "customFields"
-weight: 1
----
-
-# customFields

+ 0 - 6
docs/content/docs/configuration/config-email-options.md

@@ -1,6 +0,0 @@
----
-title: "emailOptions"
-weight: 1
----
-
-# emailOptions

+ 0 - 6
docs/content/docs/configuration/config-order-process-options.md

@@ -1,6 +0,0 @@
----
-title: "orderProcessOptions"
-weight: 1
----
-
-# orderProcessOptions

+ 0 - 5
docs/content/docs/configuration/config-payment-options.md

@@ -1,5 +0,0 @@
----
-title: "paymentOptions"
-weight: 1
----
-# paymentOptions

+ 0 - 6
docs/content/docs/configuration/config-promotion-options.md

@@ -1,6 +0,0 @@
----
-title: "promotionOptions"
-weight: 1
----
-
-# promotionOptions

+ 0 - 7
docs/content/docs/configuration/config-shipping-options.md

@@ -1,7 +0,0 @@
----
-title: "shippingOptions"
-weight: 1
----
-
-# shippingOptions
- 

+ 0 - 5
docs/content/docs/configuration/config-tax-options.md

@@ -1,5 +0,0 @@
----
-title: "taxOptions"
-weight: 1
----
-# taxOptions

+ 8 - 0
docs/layouts/docs/list.html

@@ -1,6 +1,14 @@
 {{ define "main" }}
 <article class="markdown">
   {{- .Content -}}
+
+    {{ if gt (len .Pages) 0 }}
+        <ul>
+        {{ range .Pages }}
+            <li>{{ .Title }}</li>
+        {{ end}}
+        </ul>
+    {{ end }}
 </article>
 {{ end }}
 

+ 1 - 5
docs/layouts/partials/docs/menu-filetree.html

@@ -12,11 +12,7 @@
     {{ range sort $list "Weight" }}
         {{ if eq .Kind "section" }}
             <li class="section">
-                {{- if .Content -}}
-                  {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
-                {{- else -}}
-                  {{- template "title" . -}}
-                {{- end -}}
+                {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
                 {{ $expanded := in $.CurrentPage .Permalink }}
                 {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage "Expanded" $expanded) }}
             </li>

+ 2 - 0
package.json

@@ -16,6 +16,7 @@
   },
   "devDependencies": {
     "@types/graphql": "^14.0.5",
+    "@types/klaw-sync": "^6.0.0",
     "@types/node": "^10.11.5",
     "graphql": "^14.1.1",
     "graphql-code-generator": "^0.16.0",
@@ -26,6 +27,7 @@
     "graphql-codegen-typescript-server": "^0.16.0",
     "graphql-tools": "^4.0.0",
     "husky": "^0.14.3",
+    "klaw-sync": "^6.0.0",
     "lint-staged": "^7.2.0",
     "prettier": "^1.15.2",
     "ts-node": "^7.0.1",

+ 5 - 0
server/src/config/asset-naming-strategy/asset-naming-strategy.ts

@@ -1,9 +1,13 @@
 /**
+ * @description
  * The AssetNamingStrategy determines how file names are generated based on the uploaded source file name,
  * as well as how to handle naming conflicts.
+ *
+ * @docsCategory assets
  */
 export interface AssetNamingStrategy {
     /**
+     * @description
      * Given the original file name of the uploaded file, generate a file name to
      * be stored on the server. Operations like normalization and time-stamping can
      * be performed in this method.
@@ -16,6 +20,7 @@ export interface AssetNamingStrategy {
     generateSourceFileName(originalFileName: string, conflictFileName?: string): string;
 
     /**
+     * @description
      * Given the source file name generated in the {@link generateSourceFileName} method, this method
      * should generate the file name of the preview image.
      *

+ 3 - 0
server/src/config/asset-preview-strategy/asset-preview-strategy.ts

@@ -1,12 +1,15 @@
 import { Stream } from 'stream';
 
 /**
+ * @description
  * The AssetPreviewStrategy determines how preview images for assets are created. For image
  * assets, this would usually typically involve resizing to sensible dimensions. Other file types
  * could be previewed in a variety of ways, e.g.:
  * - waveform images generated for audio files
  * - preview images generated for pdf documents
  * - watermarks added to preview images
+ *
+ * @docsCategory assets
  */
 export interface AssetPreviewStrategy {
     generatePreviewImage(mimeType: string, data: Buffer): Promise<Buffer>;

+ 3 - 0
server/src/config/asset-storage-strategy/asset-storage-strategy.ts

@@ -3,8 +3,11 @@ import { Request } from 'express';
 import { Stream } from 'stream';
 
 /**
+ * @description
  * The AssetPersistenceStrategy determines how Asset files are physically stored
  * and retrieved.
+ *
+ * @docsCategory assets
  */
 export interface AssetStorageStrategy {
     /**

+ 28 - 7
server/src/config/email/email-transport-options.ts

@@ -1,7 +1,17 @@
 import { GeneratedEmailContext } from '../../email/email-context';
 
+export interface SMTPCredentials {
+    /** the username */
+    user: string;
+    /** then password */
+    pass: string;
+}
+
 /**
- * A subset of the SMTP transport options of Nodemailer (https://nodemailer.com/smtp/)
+ * @description
+ * A subset of the SMTP transport options of [Nodemailer](https://nodemailer.com/smtp/)
+ *
+ * @docsCategory email
  */
 export interface SMTPTransportOptions {
     type: 'smtp';
@@ -10,12 +20,7 @@ export interface SMTPTransportOptions {
     /** the port to connect to (defaults to 25 or 465) */
     port: number;
     /** defines authentication data */
-    auth: {
-        /** the username */
-        user: string;
-        /** then password */
-        pass: string;
-    };
+    auth: SMTPCredentials;
     /** defines if the connection should use SSL (if true) or not (if false) */
     secure?: boolean;
     /** turns off STARTTLS support if true */
@@ -31,7 +36,10 @@ export interface SMTPTransportOptions {
 }
 
 /**
+ * @description
  * Uses the local Sendmail program to send the email.
+ *
+ * @docsCategory email
  */
 export interface SendmailTransportOptions {
     type: 'sendmail';
@@ -42,7 +50,10 @@ export interface SendmailTransportOptions {
 }
 
 /**
+ * @description
  * Outputs the email as an HTML file for development purposes.
+ *
+ * @docsCategory email
  */
 export interface FileTransportOptions {
     type: 'file';
@@ -53,17 +64,27 @@ export interface FileTransportOptions {
 }
 
 /**
+ * @description
  * Does nothing with the generated email. Mainly intended for use in testing where we don't care about the email transport.
+ *
+ * @docsCategory email
  */
 export interface NoopTransportOptions {
     type: 'none';
 }
 
 /**
+ * @description
  * Forwards the raw GeneratedEmailContext object to a provided callback, for use in testing.
+ *
+ * @docsCategory email
  */
 export interface TestingTransportOptions {
     type: 'testing';
+    /**
+     * @description
+     * Callback to be invoked when an email would be sent.
+     */
     onSend: (context: GeneratedEmailContext) => void;
 }
 

+ 3 - 0
server/src/config/entity-id-strategy/entity-id-strategy.ts

@@ -3,9 +3,12 @@ import { ID } from '../../../../shared/shared-types';
 export type PrimaryKeyType = 'increment' | 'uuid';
 
 /**
+ * @description
  * 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.
+ *
+ * @docsCategory
  */
 export interface EntityIdStrategy<T extends ID = ID> {
     readonly primaryKeyType: PrimaryKeyType;

+ 1 - 0
server/src/config/order-merge-strategy/merge-orders-strategy.ts

@@ -4,6 +4,7 @@ import { Order } from '../../entity/order/order.entity';
 import { OrderMergeStrategy } from './order-merge-strategy';
 
 /**
+ * @description
  * Merges both Orders. If the guest order contains items which are already in the
  * existing Order, the guest Order quantity will replace that of the existing Order.
  */

+ 3 - 0
server/src/config/order-merge-strategy/order-merge-strategy.ts

@@ -2,11 +2,14 @@ import { OrderLine } from '../../entity/order-line/order-line.entity';
 import { Order } from '../../entity/order/order.entity';
 
 /**
+ * @description
  * An OrderMergeStrategy defines what happens when a Customer with an existing Order
  * signs in with a guest Order, where both Orders may contain differing OrderLines.
  *
  * Somehow these differing OrderLines need to be reconciled into a single collection
  * of OrderLines. The OrderMergeStrategy defines the rules governing this reconciliation.
+ *
+ * @docsCategory orders
  */
 export interface OrderMergeStrategy {
     merge(guestOrder: Order, existingOrder: Order): OrderLine[];

+ 3 - 0
server/src/config/tax/tax-calculation-strategy.ts

@@ -12,7 +12,10 @@ export interface TaxCalculationArgs {
 }
 
 /**
+ * @description
  * Defines how taxes are calculated based on the input price, tax zone and current request context.
+ *
+ * @docsCategory tax
  */
 export interface TaxCalculationStrategy {
     calculate(args: TaxCalculationArgs): TaxCalculationResult;

+ 3 - 0
server/src/config/tax/tax-zone-strategy.ts

@@ -1,7 +1,10 @@
 import { Channel, Order, Zone } from '../../entity';
 
 /**
+ * @description
  * Defines how the active Zone is determined for the purposes of calculating taxes.
+ *
+ * @docsCategory tax
  */
 export interface TaxZoneStrategy {
     determineTaxZone(zones: Zone[], channel: Channel, order?: Order): Zone;

+ 126 - 11
server/src/config/vendure-config.ts

@@ -25,65 +25,97 @@ import { TaxCalculationStrategy } from './tax/tax-calculation-strategy';
 import { TaxZoneStrategy } from './tax/tax-zone-strategy';
 import { VendurePlugin } from './vendure-plugin/vendure-plugin';
 
+/**
+ * @description
+ * The AuthOptions define how authentication is managed.
+ *
+ * @docsCategory auth
+ */
 export interface AuthOptions {
     /**
+     * @description
      * Disable authentication & permissions checks.
      * NEVER set the to true in production. It exists
      * only to aid certain development tasks.
+     *
+     * @default truuuu
      */
     disableAuth?: boolean;
     /**
+     * @description
      * Sets the method by which the session token is delivered and read.
      *
-     * - "cookie": Upon login, a 'Set-Cookie' header will be returned to the client, setting a
+     * * 'cookie': Upon login, a 'Set-Cookie' header will be returned to the client, setting a
      *   cookie containing the session token. A browser-based client (making requests with credentials)
      *   should automatically send the session cookie with each request.
-     * - "bearer": Upon login, the token is returned in the response and should be then stored by the
-     *   client app. Each request should include the header "Authorization: Bearer <token>".
+     * * 'bearer': Upon login, the token is returned in the response and should be then stored by the
+     *   client app. Each request should include the header 'Authorization: Bearer <token>'.
+     *
+     * @default 'cookie'
      */
     tokenMethod?: 'cookie' | 'bearer';
     /**
+     * @description
      * The secret used for signing the session cookies for authenticated users. Only applies when
-     * tokenMethod is set to "cookie".
+     * tokenMethod is set to 'cookie'.
      *
      * In production applications, this should not be stored as a string in
      * source control for security reasons, but may be loaded from an external
      * file not under source control, or from an environment variable, for example.
-     * See https://stackoverflow.com/a/30090120/772859
+     *
+     * @default 'session-secret'
      */
     sessionSecret?: string;
     /**
-     * Sets the header property which will be used to send the auth token when using the "bearer" method.
+     * @description
+     * Sets the header property which will be used to send the auth token when using the 'bearer' method.
+     *
+     * @default 'vendure-auth-token'
      */
     authTokenHeaderKey?: string;
     /**
+     * @description
      * Session duration, i.e. the time which must elapse from the last authenticted request
      * after which the user must re-authenticate.
      *
-     * Expressed as a string describing a time span
-     * [zeit/ms](https://github.com/zeit/ms.js).  Eg: 60, "2 days", "10h", "7d"
+     * Expressed as a string describing a time span per
+     * [zeit/ms](https://github.com/zeit/ms.js).  Eg: `60`, `'2 days'`, `'10h'`, `'7d'`
+     *
+     * @default '7d'
      */
     sessionDuration?: string | number;
     /**
+     * @description
      * Determines whether new User accounts require verification of their email address.
+     *
+     * @defaut true
      */
     requireVerification?: boolean;
     /**
-     * Sets the length of time that a verification token is valid for.
+     * @description
+     * Sets the length of time that a verification token is valid for, after which the verification token must be refreshed.
      *
-     * Expressed as a string describing a time span
-     * [zeit/ms](https://github.com/zeit/ms.js).  Eg: 60, "2 days", "10h", "7d"
+     * Expressed as a string describing a time span per
+     * [zeit/ms](https://github.com/zeit/ms.js).  Eg: `60`, `'2 days'`, `'10h'`, `'7d'`
+     *
+     * @default '7d'
      */
     verificationTokenDuration?: string | number;
 }
 
+/**
+ * @docsCategory orders
+ */
 export interface OrderProcessOptions<T extends string> {
     /**
+     * @description
      * Define how the custom states fit in with the default order
      * state transitions.
+     *
      */
     transtitions?: Partial<Transitions<T | OrderState>>;
     /**
+     * @description
      * Define logic to run before a state tranition takes place. Returning
      * false will prevent the transition from going ahead.
      */
@@ -93,158 +125,229 @@ export interface OrderProcessOptions<T extends string> {
         data: { order: Order },
     ): boolean | Promise<boolean> | Observable<boolean> | void;
     /**
+     * @description
      * Define logic to run after a state transition has taken place.
      */
     onTransitionEnd?(fromState: T, toState: T, data: { order: Order }): void;
     /**
+     * @description
      * Define a custom error handler function for transition errors.
      */
     onError?(fromState: T, toState: T, message?: string): void;
 }
 
+/**
+ * @docsCategory orders
+ */
 export interface OrderMergeOptions {
     /**
+     * @description
      * Defines the strategy used to merge a guest Order and an existing Order when
      * signing in.
      */
     mergeStrategy: OrderMergeStrategy;
     /**
+     * @description
      * Defines the strategy used to merge a guest Order and an existing Order when
      * signing in as part of the checkout flow.
      */
     checkoutMergeStrategy: OrderMergeStrategy;
 }
 
+/**
+ * @description
+ * The AssetOptions define how assets (images and other files) are named and stored, and how preview images are generated.
+ *
+ * @docsCategory assets
+ */
 export interface AssetOptions {
     /**
+     * @description
      * Defines how asset files and preview images are named before being saved.
      */
     assetNamingStrategy: AssetNamingStrategy;
     /**
+     * @description
      * Defines the strategy used for storing uploaded binary files.
      */
     assetStorageStrategy: AssetStorageStrategy;
     /**
+     * @description
      * Defines the strategy used for creating preview images of uploaded assets.
      */
     assetPreviewStrategy: AssetPreviewStrategy;
     /**
+     * @description
      * The max file size in bytes for uploaded assets.
      */
     uploadMaxFileSize?: number;
 }
 
+/**
+ * @docsCategory promotions
+ */
 export interface PromotionOptions {
     /**
+     * @description
      * An array of conditions which can be used to construct Promotions
      */
     promotionConditions?: Array<PromotionCondition<any>>;
     /**
+     * @description
      * An array of actions which can be used to construct Promotions
      */
     promotionActions?: Array<PromotionAction<any>>;
 }
 
+/**
+ * @docsCategory orders
+ */
 export interface ShippingOptions {
     /**
+     * @description
      * An array of available ShippingEligibilityCheckers for use in configuring ShippingMethods
      */
     shippingEligibilityCheckers?: Array<ShippingEligibilityChecker<any>>;
     /**
+     * @description
      * An array of available ShippingCalculator for use in configuring ShippingMethods
      */
     shippingCalculators?: Array<ShippingCalculator<any>>;
 }
 
+/**
+ * @docsCategory email
+ */
 export interface EmailOptions<EmailType extends string> {
     /**
+     * @description
      * Path to the email template files.
      */
     emailTemplatePath: string;
     /**
+     * @description
      * Configuration for the creation and templating of each email type
      */
     emailTypes?: EmailTypes<EmailType>;
     /**
+     * @description
      * The EmailGenerator uses the EmailContext and template to generate the email body
      */
     generator?: EmailGenerator;
     /**
+     * @description
      * Configuration for the transport (email sending) method
      */
     transport: EmailTransportOptions;
 }
 
+/**
+ * @docsCategory payment
+ */
 export interface PaymentOptions {
     /**
+     * @description
      * An array of payment methods with which to process payments.
      */
     paymentMethodHandlers: Array<PaymentMethodHandler<any>>;
 }
 
+/**
+ * @docsCategory tax
+ */
 export interface TaxOptions {
     /**
+     * @description
      * Defines the strategy used to determine the applicable Zone used in tax calculations.
      */
     taxZoneStrategy: TaxZoneStrategy;
     /**
+     * @description
      * Defines the strategy used for calculating taxes.
      */
     taxCalculationStrategy: TaxCalculationStrategy;
 }
 
+/**
+ * @docsCategory
+ */
 export interface ImportExportOptions {
     /**
+     * @description
      * The directory in which assets to be imported are located.
      */
     importAssetsDir?: string;
 }
 
+/**
+ * @description
+ * All possible configuration options are defined by the
+ * [`VendureConfig`](https://github.com/vendure-ecommerce/vendure/blob/master/server/src/config/vendure-config.ts) interface.
+ *
+ * {{% alert %}}
+ * Note on terminology: many of the configuration properties are named "Strategy" - this is because their use follows the
+ * [Strategy Pattern](https://en.wikipedia.org/wiki/Strategy_pattern) of software design.
+ * {{% /alert %}}
+ *
+ * @docsCategory
+ * @docsWeight 0
+ */
 export interface VendureConfig {
     /**
+     * @description
      * The path to the GraphQL API.
      */
     apiPath?: string;
     /**
+     * @description
      * Configuration for the handling of Assets.
      */
     assetOptions?: AssetOptions;
     /**
+     * @description
      * Configuration for authorization.
      */
     authOptions: AuthOptions;
     /**
+     * @description
      * 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.
      */
     channelTokenKey?: string;
     /**
+     * @description
      * Set the CORS handling for the server.
      */
     cors?: boolean | CorsOptions;
     /**
+     * @description
      * Defines custom fields which can be used to extend the built-in entities.
      */
     customFields?: CustomFields;
     /**
+     * @description
      * The connection options used by TypeORM to connect to the database.
      */
     dbConnectionOptions: ConnectionOptions;
     /**
+     * @description
      * The token for the default channel. If not specified, a token
      * will be randomly generated.
      */
     defaultChannelToken?: string | null;
     /**
+     * @description
      * The default languageCode of the app.
      */
     defaultLanguageCode?: LanguageCode;
     /**
+     * @description
      * Configures the handling of transactional emails.
      */
     emailOptions?: EmailOptions<any>;
     /**
+     * @description
      * 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
@@ -252,51 +355,63 @@ export interface VendureConfig {
      */
     entityIdStrategy?: EntityIdStrategy<any>;
     /**
+     * @description
      * Set the hostname of the server.
      */
     hostname?: string;
     /**
+     * @description
      * Configuration settings for data import and export.
      */
     importExportOptions?: ImportExportOptions;
     /**
+     * @description
      * Define the strategies governing how Orders are merged when an existing
      * Customer signs in.
      */
     orderMergeOptions?: OrderMergeOptions;
     /**
+     * @description
      * Defines custom states in the order process finite state machine.
      */
     orderProcessOptions?: OrderProcessOptions<any>;
     /**
+     * @description
      * Custom Express middleware for the server.
      */
     middleware?: Array<{ handler: RequestHandler; route: string }>;
     /**
+     * @description
      * Configures available payment processing methods.
      */
     paymentOptions: PaymentOptions;
     /**
+     * @description
      * An array of plugins.
      */
     plugins?: VendurePlugin[];
     /**
+     * @description
      * Which port the Vendure server should listen on.
      */
     port: number;
     /**
+     * @description
      * Configures the Conditions and Actions available when creating Promotions.
      */
     promotionOptions?: PromotionOptions;
     /**
+     * @description
      * Configures the available checkers and calculators for ShippingMethods.
      */
     shippingOptions?: ShippingOptions;
     /**
+     * @description
      * When set to true, no application logging will be output to the console.
      */
     silent?: boolean;
     /**
+     * @description
      * Configures how taxes are calculated on products.
      */
     taxOptions?: TaxOptions;

+ 8 - 0
server/src/config/vendure-plugin/vendure-plugin.ts

@@ -6,21 +6,26 @@ import { VendureConfig } from '../vendure-config';
 export type InjectorFn = <T>(type: Type<T>) => T;
 
 /**
+ * @description
  * A VendurePlugin is a means of configuring and/or extending the functionality of the Vendure server. In its simplest form,
  * a plugin simply modifies the VendureConfig object. Although such configuration can be directly supplied to the bootstrap
  * function, using a plugin allows one to abstract away a set of related configuration.
  *
  * As well as configuring the app, a plugin may also extend the GraphQL schema by extending existing types or adding
  * entirely new types. Database entities and resolvers can also be defined to handle the extended GraphQL types.
+ *
+ * @docsCategory plugins
  */
 export interface VendurePlugin {
     /**
+     * @description
      * This method is called before the app bootstraps, and can modify the VendureConfig object and perform
      * other (potentially async) tasks needed.
      */
     configure(config: Required<VendureConfig>): Required<VendureConfig> | Promise<Required<VendureConfig>>;
 
     /**
+     * @description
      * This method is called after the app has bootstrapped. In this method, instances of services may be injected
      * into the plugin. For example, the ProductService can be injected in order to enable operations on Product
      * entities.
@@ -28,16 +33,19 @@ export interface VendurePlugin {
     onBootstrap?(inject: InjectorFn): void | Promise<void>;
 
     /**
+     * @description
      * The plugin may extend the default Vendure GraphQL schema by implementing this method.
      */
     defineGraphQlTypes?(): DocumentNode;
 
     /**
+     * @description
      * The plugin may define custom providers (including GraphQL resolvers) which can then be injected via the Nest DI container.
      */
     defineProviders?(): Array<Type<any>>;
 
     /**
+     * @description
      * The plugin may define custom database entities, which should be defined as classes annotated as per the
      * TypeORM documentation.
      */

+ 19 - 0
yarn.lock

@@ -125,6 +125,18 @@
   version "4.0.0"
   resolved "https://registry.yarnpkg.com/@types/is-glob/-/is-glob-4.0.0.tgz#fb8a2bff539025d4dcd6d5efe7689e03341b876d"
 
+"@types/klaw-sync@^6.0.0":
+  version "6.0.0"
+  resolved "https://registry.yarnpkg.com/@types/klaw-sync/-/klaw-sync-6.0.0.tgz#ff0b36601efaaa109d513c4ced109311fd06ba36"
+  integrity sha512-Ibfb2jgpjYUxnl7RSVvUzOrv/vhkTVKEfPwQf9ZlDDsSyWVDp/2JtTBxO4eRrKBYtxc3cZQabdR38i8R0o1uww==
+  dependencies:
+    "@types/node" "*"
+
+"@types/node@*":
+  version "10.12.19"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.19.tgz#ca1018c26be01f07e66ac7fefbeb6407e4490c61"
+  integrity sha512-2NVovndCjJQj6fUUn9jCgpP4WSqr+u1SoUZMZyJkhGeBFsm6dE46l31S7lPUYt9uQ28XI+ibrJA1f5XyH5HNtA==
+
 "@types/node@^10.11.5":
   version "10.11.5"
   resolved "https://registry.yarnpkg.com/@types/node/-/node-10.11.5.tgz#6489ebda4452592d3fd37aefa57eedc01ed13378"
@@ -1667,6 +1679,13 @@ kind-of@^6.0.0, kind-of@^6.0.2:
   version "6.0.2"
   resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"
 
+klaw-sync@^6.0.0:
+  version "6.0.0"
+  resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c"
+  integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==
+  dependencies:
+    graceful-fs "^4.1.11"
+
 kuler@1.0.x:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/kuler/-/kuler-1.0.0.tgz#904ad31c373b781695854d32be33818bf1d60250"