CHANGELOG_v1.md
order query (93b8601), closes #1664Zone.members field (3b67e61)This release corrects a publishing error with the @vendure/admin-ui packages. There are no code changes in this release.
includeCustomerId metadata key to Braintree (a94fc22)LOG env var (5f5d133)deleteProductOption mutation to Admin API (d77de9b)runMigrations() util function (ca72de5)languageCode field on ShippingMethod type (4fab7cf)handlers config option (0dfa9d0)ctx in Stripe webhook (cb13e99), closes #1643getMany() method with ListQueryBuilder (6be93b8), closes #1586metadataModifiers for low-level DB entity config (16e52f2), closes #1506 #1502previewCollectionVariants query in Admin API (1c3b38c), closes #1530SearchEvent & publish when search query is executed, closes #1553SearchEvent when search query is executed, closes #1553inList op to enable filtering on custom field lists (94da850), closes #1332populate() function (03b9fe1), closes #877create() method (335dfb5)Unknown type "ShippingMethodCustomFields" error (d810450)pendingSearchIndexUpdates query (152e64b)nullable property of CustomFieldConfig (9ec6b90), closes #1083withTransaction method on TransactionalConnection (861ef29), closes #1129ID (45c5b2d)This release fixes an error in the publishing of the TypeScript definitions from v1.2.2.
collections field to SearchResponse, closes #943collections field to SearchResponse, closes #943.setOptionalAddressFields() - cc, bcc, replyTo (8e9b72f), closes #921Vendure v1.0 is here! 🎉
Note with this release, all deprecated APIs have been removed. If you were still using any, you'll have a very small amount of work to do in switching over to their replacements. Removed deprecated APIs:
EventBus.sucscribe(), use EventBus.ofType() instead.getEntityOrThrow() helper. Use TransactionalConnection.getEntityOrThrow() instead.Injector.getConnection(). Use Injector.get(TransactionalConnection) instead.PriceCalculationStrategy. Use OrderItemPriceCalculationStrategy instead.TaxCalculationStrategy. Use ProductVariantPriceCalculationStrategy instead.VendureConfig.authOptions.sessionSecret. Use VendureConfig.authOptions.cookieOptions.secret instead.region option of the S3AssetStorageStrategy should be moved into the nativeS3Configuration object.SearchResult type - productPreview & productVariantPreview fields. Use productAsset.preview, productVariantAsset.preview instead.Order.adjustments. Use Order.discounts instead.OrderItem.unitPriceIncludesTax. This is removed as redundant - unitPrice is always without tax.OrderLine.totalPrice. Use OrderLine.linePriceWithTax instead.OrderLine.adjustments. Use OrderLine.discounts instead.Product.priceIncludesTax. This is removed as redundant - price is always without tax.code field to ShippingMethodQuote (847b4e2), closes #780Order.discounts and
OrderLine.discounts fields now return amount and amountWithTax. Previously they only had
amount, which was actually the tax-inclusive value. So if you want to show discount amounts with
tax, use amountWithTax and otherwise use amount.Order.taxSummary now includes shipping taxesdeleteAsset and deleteAssets have changed their argument signature.initialListPrice, used to better
handle price changes to items in an active Order. This schema change will require a DB migration.deletedAt column
which will require a DB migration.OrderMergeStrategy.merge() method has changed. If you have
implemented a custom OrderMergeStrategy, you'll need to update it to return the expected type.isDefault property, requiring a DB migration.cancelJob mutation (2d099cf), closes #614amount argument into createPayment method (0c85c76)A change to the relation between OrderItems and Fulfillments means a database migration will be required to preserve fulfillment data of existing Orders. See the release blog post for details.
In order to support order modification, a couple of new default order states
have been created - Modifying and ArrangingAdditionalPayment. Also a new DB entity,
OrderModification has been created.
The OrderLine.pendingAdjustments field has been renamed to adjustments, tax
adjustments are now stored in a new field, taxLines. This will require a DB migration to
preserve data from existing Orders (see guide in release blog post)
The PaymentMethodHandler.createPayment() method now takes a new amount
argument. Update any custom PaymentMethodHandlers to use account for this new parameter and use
it instead of order.total when creating a new payment.
// before
createPayment: async (ctx, order, args, metadata) {
const transactionAmount = order.total;
// ...
}
// after
createPayment: async (ctx, order, amount, args, metadata) {
const transactionAmount = amount;
// ...
}
The TaxCalculationStrategy has been renamed to
ProductVariantPriceCalculationStrategy and moved in the VendureConfig from taxOptions to
catalogOptions and its API has been simplified.
The PriceCalculationStrategy has been renamed to OrderItemPriceCalculationStrategy.
The Fulfillment and ShippingMethod entities have new fields relating to FulfillmentHandlers. This will require a DB migration, though no custom data migration will be needed for this particular change.
The addFulfillmentToOrder mutation input has changed: the method & trackingCode fields
have been replaced by a handler field which accepts a FulfillmentHandler code, and any
expected arguments defined by that handler.
The ProductTranslation entity has had a constraint removed, requiring a schema migration.
The return object of the ShippingCalculator class has changed:
// before
return {
price: 500,
priceWithTax: 600,
};
// after
return {
price: 500,
taxRate: 20,
priceIncludesTax: false,
};
This change will require you to update any custom ShippingCalculator implementations, and also to update any ShippingMethods by removing and re-selecting the ShippingCalculator.
The Shop API mutations setOrderShippingAddress, setOrderBillingAddress
setOrderCustomFields now return a union type which includes a new NoActiveOrderError.
Code which refers to these mutations will need to be updated to account for the union
with the fragment spread syntax ...on Order {...}.
The TaxCalculationStrategy return value has been simplified - it now only need
return the price and priceIncludesTax properties. The ProductVariant entity has also been
refactored to bring it into line with the corrected tax handling of the OrderItem entity. This
will require a DB migration. See release blog post for details.
The way shipping charges on Orders are represented has been changed - an Order now contains multiple ShippingLine entities, each of which has a reference to a ShippingMethod. This will require a database migration with manual queries to preserve existing order data. See release blog post for details.
There have been some major changes to the way that Order taxes and discounts are handled. For a full discussion of the issues behind these changes see #573. These changes will require a DB migration as well as possible custom scripts to port existing Orders to the new format. See the release blog post for details.
The following GraphQL Order type properties have changed:
subTotalBeforeTax has been removed, subTotal now excludes tax, and
subTotalWithTax has been added.totalBeforeTax has been removed, total now excludes tax, and
totalWithTax has been added.This release fixes an error in publishing the last release. No changes have been made.
activeAdministrator query to Admin API (70e14f2)updateActiveAdministrator mutation (73ab736)shouldRunCheck function to ShippingEligibilityChecker (3b7e7db), closes #536in string filter for PaginatedList queries (7c7dcf2), closes #543regex string filter for PaginatedList queries (0a33441), closes #543Deletions of Orders or Customers now cascade to any associated HistoryEntries, thus preserving referential integrity. This involves a DB schema change which will necessitate a migration.
Fulfillments now start in the new "Created" state, and then immediately transition to the "Pending" state. This allows e.g. event listeners to pick up newly-created Fulfillments.
Orders now start in the new "Created" state, and then immediately transition to the "AddingItems" state. This allows e.g. event listeners to pick up newly-created Orders.
The AuthenticationStrategy.onLogOut() function
signature has changed: the first argument is now the RequestContext of the current request.
The OrderItem.unitPrice is now always given as the net (without tax) price
of the related ProductVariant. Formerly, it was either the net or gross price, depending on
the pricesIncludeTax setting of the Channel. If you have existing Orders where
unitPriceIncludesTax = true, you will need to manually update the unitPrice value before
running any other migrations for this release. The query will look like:
UPDATE order_item SET unitPrice = ROUND(unitPrice / ((taxRate + 100) / 100)) WHERE unitPriceIncludesTax = 1
The OrderLine.totalPrice field has been deprecated and will be removed in a
future release. Use the new OrderLine.linePriceWithTax field instead.
The PaymentMethodHandler function signatures have changed:
createPayment(), settlePayment() & createRefund() now all get passed the
RequestContext object as the first argument.
The PriceCalculationStrategy.calculateUnitPrice() function
signature has changed: the first argument is now the RequestContext of the current request.
The ProductVariant.trackInventory field is now an Enum rather than a boolean, allowing explicit inheritance of the value set in GlobalSettings. This will require a DB migration with a custom query to transform the previous boolean values to the new enum (string) values of "TRUE", "FALSE" or "INHERIT". Check the release blog post for more details.
The ShippingMethod entity is now translatable. This change will require a DB
migration to be performed, including custom queries to migrate any existing ShippingMethods
to the new table structure (see release blog post for details).
The AssetNamingStrategy generateSourceFileName() & generatePreviewFileName()
function signatures have changed: the first argument is now the
RequestContext of the current request.
The AssetPreviewStrategy generatePreviewImage()
function signature has changed: the first argument is now the
RequestContext of the current request.
The internal handling of stock movements has been refined, which required changes to the DB schema. This will require a migration.
The OrderMergeStrategy merge()
function signature has changed: the first argument is now the
RequestContext of the current request.
The PromotionAction execute()
function signature has changed: the first argument is now the
RequestContext of the current request.
The ShippingCalculator calculate()
function signature has changed: the first argument is now the
RequestContext of the current request.
The ShippingEligibilityChecker check()
function signature has changed: the first argument is now the
RequestContext of the current request.
The TaxZoneStrategy determineTaxZone()
function signature has changed: the first argument is now the
RequestContext of the current request.
loadData() function after filters run (e22db7e), closes #518updateAdministrator mutation (4b55288)All Vendure packages are now built on TypeScript v4.0.3. With new TypeScript versions come the possibility that its improved type-checking abilities will uncover new errors that it had not detected previously.
If you are using the .loadData() method of an EmailEventHandler, the callback signature has changed to provide an instance of the Injector class, rather than an inject() function.
The orderOptions.generateOrderCode config option has been replaced with orderOptions.orderCodeStrategy. This change allows order code generation to take advantage of the InjectableStrategy interface, i.e. to be able to inject Vendure services and other providers (e.g. the database connection). See the OrderCodeStrategy documentation for guidance on how to use the new API.
The Payment.metadata field is not private by default, meaning that it can only be read via the Admin API. Data required in the Shop API can be accessed by putting it in a field named public. Example: Payment.metadata.public.redirectUrl
The TypeORM Connection should no longer be directly used. Instead, inject the new TransactionalConnection class, which wraps the TypeORM connection and enables database transactions to be used in conjunction with the new @Transaction decorator.
The getEntityOrThrow() and findOneInChannel() helper functions have been deprecated and replaced by methods with the same name (but slightly different signature) on the TransactionalConnection class.
The upgrade of the Admin UI to Angular v10 means that if you are using the @vendure/ui-devkit package to compile an extended version of the Admin UI, you need to have at least TypeScript v3.9.2 installed.
totalQuantity field to Order type (829ac96), closes #465productVariant query to Admin API (72b6ccd)customFieldConfig property has been renamed to config and a required readonly: boolean; field should be added. This is part of an effort to unify the way custom input components work across different parts of the Admin UI.// Assuming the ID of the default Channel is 1. If you are using a UUID strategy,
// replace 1 with the ID of the default channel.
await queryRunner.query(
'INSERT INTO `order_channels_channel` (orderId, channelId) SELECT id, 1 FROM `order`',
undefined,
);
'facetValueIds' type has been removed from the ConfigArgType type, and replaced by 'ID' and the list option. This change only affects you if you have created custom CollectionFilters of PromotionActions/Conditions using the 'facetValueIds' type for an argument.ID type in @vendure/common/lib/generated-types & @vendure/common/lib/generated-shop-types is now correctly typed as string | number, whereas previously it was string. If you are using any generated types in your plugin code, this may lead to TypeScript compiler errors which will need to be corrected.loginUrl option (5a95476)loginUrl option to support external login pages (2745146), closes #215ProductOption.group field & resolver (f20e108), closes #378ProductVariant.product field & resolver (0334848), closes #378nextStates on Order type in Admin API (ece0bbe)serverConfig type (0a77438)authenticate mutation for Admin API (357f878)deleteAdministrator mutation (dc82b2c), closes #384setOrderCustomFields in Admin API (ad89fc9), closes #404setOrderCustomFields in Shop API (3a12dc5), closes #404transitionOrderToState in Admin API (3196b52){{ user.verificationToken }} becomes {{ verificationToken }} and so on.AuthenticationMethod entity has been added, with a one-to-many relation to the existing User entities. Several properties that were formerly part of the User entity have now moved to the AuthenticationMethod entity. Upgrading with therefore require a careful database migration to ensure that no data is lost. On release, a migration script will be provided for this.AttemptedLoginEvent.identifier property is now optional, since it will only be sent when using the "native" authentication strategy. Code that listens for this event should now check that the identifier property is defined before attempting to use it.RequestContext.session object is no longer a Session entity. Instead it is a new type, SerializedSession which contains a subset of data pertaining to the current session. For example, if you have custom code which references ctx.session.activeOrder you will now get an error, since activeOrder does not exist on SerializedSession. Instead you would use SerializedSession.activeOrderId and then lookup the order in a separate query.The reason for this change is to enable efficient session caching.
deletedAt field, which will require a non-destructive database migration.VendureConfig.orderOptions.process property now accepts an array of objects implementing the CustomerOrderProcess interface. This interface is more-or-less the same as the old OrderProcessOptions object, but the use of an array now allows better composition, and since CustomerOrderProcess inherits from InjectableStrategy, this means providers can now be injected and used in the custom order process logic.createCollection mutation, each translation must include a slug.Fixes broken publish of admin-ui-plugin
Options in the VendureConfig related to the API have been moved into a new location: VendureConfig.apiOptions. The affected options are hostname, port, adminApiPath, shopApiPath, channelTokenKey, cors, middleware and apolloServerPlugins.
// before
const config: VendureConfig = {
port: 3000,
middleware: [/*...*/],
// ...
}
// after
const config: VendureConfig = {
apiOptions: {
port: 3000,
middleware: [/*...*/],
},
// ...
}
This also applies to the ConfigService, in case you are using it in a custom plugin.
The customer and user tables have received some non-destructive modifications, requiring a DB migration.
The graphql-playground for the Shop and Admin APIs are now turned off by default, and the Apollo server debug option is also set to false by default (it was formerly true). You can manually configure these values using the VendureConfig.apiOptions object.
bootstrap method to TestServer (dab9e21)(If using the DefaultJobQueuePlugin) A new JobRecord entity has been added, so a DB migration will be needed.
In order to accommodate Asset deletion, some non-destructive DB modifications have been made which will require a migration.
Nestjs has been updated to v7. If you make use of any of the Nest internals in your plugins, this may cause some breaking changes. Please see the Nest migration guide for details.
This release also includes updates to many dependencies which in turn have dropped support for Node.js v8. Therefore Vendure now supports Node.js v10 or higher.
The CollectionAsset entity had a cascade delete defined, which will require a DB migration.
The JobQueueService has been completely re-designed. In the event that you are using this service in your Plugins, please see the API documentation on how to use it now.
This release introduces a re-architected solution for handling extensions to the Admin UI. If you do not use the ui extensions feature, you will not need to change anything. For those already using ui extensions, these are the changes:
The @vendure/admin-ui-plugin now contains only the default admin ui app.
To create extensions, you will need to install @vendure/ui-devkit, which exposes a compileUiExtensions() function.
Here is an example of how the config differs:
// before
AdminUiPlugin.init({
port: 3002,
extensions: [
ReviewsPlugin.uiExtensions,
RewardsPlugin.uiExtensions,
],
watch: true,
}),
// after
import { compileUiExtensions } from '@vendure/ui-devkit/compiler';
// ...
AdminUiPlugin.init({
port: 3002,
app: compileUiExtensions({
// The source files of the admin ui, extended with your extensions,
// will be output and compiled from this location
outputPath: path.join(__dirname, '../admin-ui'),
extensions: [
ReviewsPlugin.uiExtensions,
RewardsPlugin.uiExtensions,
],
watch: true,
}),
}),
For lazy-loaded extension modules, you must now specify a route property. This allows us to lazy-load each extension individually, whereas previously all extensions were bundled into a single lazy-loaded chunk.
export class ReviewsPlugin {
static uiExtensions: AdminUiExtension = {
extensionPath: path.join(__dirname, 'ui'),
id: 'reviews-plugin',
ngModules: [{
type: 'lazy',
+ route: 'product-reviews',
ngModuleFileName: 'reviews-ui-lazy.module.ts',
ngModuleName: 'ReviewsUiLazyModule',
}],
};
}
// in the route config of the lazy-loaded module
{
- path: 'product-reviews',
+ path: '',
+ pathMatch: 'full',
component: AllProductReviewsListComponent,
},
The CustomFieldControl interface changed slightly:
import {
- CustomFieldConfig,
+ CustomFieldConfigType,
CustomFieldControl,
} from '@vendure/admin-ui/core';
@Component({
// ...
})
export class ReviewCountComponent implements CustomFieldControl {
- customFieldConfig: CustomFieldConfig;
+ customFieldConfig: CustomFieldConfigType;
formControl: FormControl;
// ...
}
NOTE: if you run into errors with Angular dependencies in the wrong place (e.g. nested inside the node_modules of another dependency), try running yarn upgrade --check-files, or failing that, remove the node_modules directory, delete the lockfile, and re-install.
focalPoint field to Asset entity (1666e22), closes #93focalPoint has been added to the Asset entity which will require a database migration to add.LocalAssetStorageStrategy class has been removed from @vendure/core and now lives in the @vendure/asset-server-plugin package.search query's SearchResult type has had two properties deprecated: productPreview and productVariantPreview. They are replaced by productAsset.preview and productVariantAsset.preview respectively. The deprecated properties still work but will be removed from a future release.namingStrategy: new DefaultAssetNamingStrategy() in the AssetServerPlugin.init() method.requiresPermission for ActionBar items (292e6d4)@vendure/testing package now requires you to explicitly register initializers for the databases you with to test against. This change enables e2e tests to be run against any database supported by TypeORM. The dataDir option has been removed from the call to the TestServer.init() method, as it is specific to the SqljsInitializer:before:
import { createTestEnvironment, testConfig } from '@vendure/testing';
describe('my e2e test suite', () => {
const { server, adminClient } = createTestEnvironment(testConfig);
beforeAll(() => {
await server.init({
dataDir: path.join(__dirname, '__data__'),
initialData,
productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'),
customerCount: 1,
});
});
//...
});
after:
import { createTestEnvironment, registerInitializer, SqljsInitializer, testConfig } from '@vendure/testing';
registerInitializer('sqljs', new SqljsInitializer(path.join(__dirname, '__data__')));
describe('my e2e test suite', () => {
const { server, adminClient } = createTestEnvironment(testConfig);
beforeAll(() => {
await server.init({
initialData,
productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'),
customerCount: 1,
});
});
//...
});
OrderItem.taxRate column type in the database has been changed from int to decimal. You will need to perform a migration to update this column and depending on your database type, you may need to manually edit the migration script in order to preserve the old values.TaxRate.value column type in the database has been changed from int to decimal. You will need to perform a migration to update this column and depending on your database type, you may need to manually edit the migration script in order to preserve the old values.dbConnectionOptions.timezone setting is now set to 'Z' (UTC). If you have not explicitly set the timezone in your project, then up until now it would have defaulted to 'local'. To preserve this behavior you can override this new default by setting dbConnectionOptions.timezone: 'local' in your VendureConfig.onClick function signature of any custom ActionBarItems has changed - the second parameter used to be the ActivatedRoute - it is now an object containing ActivatedRoute plus an instance of DataService and NotificationService.reload: false to .save() operations (3c33f33)Order entity now has a new column, taxZoneId. This is used to more efficiently track changes to the active tax zone, and therefore reduce the number of tax calculations to be performed on an Order. This change will require a migration which should be routine.notify() function (085c7cf)Note: only the @vendure/email-plugin package was updated in this release, as v0.6.2 included a critical bug which prevented installation via @vendure/create
assignProductsToChannel mutation (5fda66b), closes #12CatalogModificationEvent which was previously published whenever changes were made to Product or ProductVariant entities has been replaced with a ProductEvent and ProductVariantEvent, including the type of event ('created', 'updated', 'deleted').SearchIndexItem entity used by the DefaultSearchPlugin has a couple of new fields related to Channel handling. Once the schema is updated (either by synchronizing or running a migration), the search index should be rebuilt.@vendute/testing package, closes #198Here's how to update:
// Old API
extensions: [
{
type: 'lazy',
ngModulePath: path.join(__dirname, 'ui-extensions/greeter'),
ngModuleFileName: 'greeter-extension.module.ts',
ngModuleName: 'GreeterModule',
}
],
// New API
extensions: [
{
extensionPath: path.join(__dirname, 'ui-extensions/greeter'),
ngModules: [{
type: 'lazy',
ngModuleFileName: 'greeter-extension.module.ts',
ngModuleName: 'GreeterModule',
}],
}
],
couponCodes column is added to the Order table, which will require a DB migration.promotions relation has been added to the order table, and a perCustomerUsageLimit column to the promotion table. This will require a DB migration.atLeastNOfProduct from defaultPromotionConditions and itemPercentageDiscount & buy1Get1Free from defaultPromotionActions. They are either not useful or need to be re-implemented in a way that works correctly.Note only the @vendure/admin-ui, @vendure/admin-ui-plugin & @vendure/email-plugin packages were updated in this release.
query & mutation method on DataService (09250a8)from field to the email config (#168) (09eb34e), closes #168adjustmentOperations query has been replaced by promotionConditions and promotionActions
ConfigurableOperations (ShippingEligibilityChecker, ShippingCalculator, CollectionFilter, PromotionCondition, PromotionAction, PaymentMethodHandler) have a new API for defining their arguments. For existing Vendure installations, any Shipping Methods, Promotions and Collection will need to be re-configured after the update by removing any checker/calculator/filter/condition/action and re-adding it.
ConfigurableOperations descriptions must now be specified as an array of LocalizedString rather than just a plain string. This allows the descriptions to be adapted to other locales.
languageCode argument has been removed from all Shop API queries, namely product, products, collection and collections. Instead, LanguageCode should be specified as a query param.All languageCode GraphQL arguments have been removed from queries and instead, a "languageCode" query param may be attached to the API URL to specify the language of any translatable entities.
Vendure plugins are now defined as Nestjs modules. For existing installations, the VendureConfig will need to be modified so that plugins are not instantiated, but use the static .init() method to pass options to the plugin, e.g.:
// before
plugins: [ new AdminUiPlugin({ port: 3002 }) ],
// after
plugins: [ AdminUiPlugin.init({ port: 3002 }) ],
generateVariantsForProduct mutation has been removedreindex mutation now returns a JobInfo type, which has an id that can then be polled via the new job query as to its progress and status.