Skip to content

Commit

Permalink
Merge branch 'master' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Dec 14, 2023
2 parents ab03bb9 + e5ecd1f commit f83455c
Show file tree
Hide file tree
Showing 121 changed files with 2,869 additions and 249 deletions.
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ You can add screenshots here if applicable.

# Checklist

:pushpin: Always:
📌 Always:
- [ ] I have set a clear title
- [ ] My PR is small and contains a single feature
- [ ] I have [checked my own PR](## "Fix typo's and remove unused or commented out code")

:zap: Most of the time:
👍 Most of the time:
- [ ] I have added or updated test cases
- [ ] I have updated the README if needed
- [ ] I have updated the README if needed
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## <small>2.1.5 (2023-12-14)</small>


#### Fixes

* **admin-ui** Fix display of asset detail focal point buttons ([1b58aa7](https://github.com/vendure-ecommerce/vendure/commit/1b58aa7))
* **core** Export VendureEntityEvent abstract class from index (#2556) ([c46cf74](https://github.com/vendure-ecommerce/vendure/commit/c46cf74)), closes [#2556](https://github.com/vendure-ecommerce/vendure/issues/2556)
* **core** Fix bug when instantiating entity from object with getter ([d09452e](https://github.com/vendure-ecommerce/vendure/commit/d09452e)), closes [#2574](https://github.com/vendure-ecommerce/vendure/issues/2574)
* **core** Fix loading multiple customField relations (#2566) ([99e04d1](https://github.com/vendure-ecommerce/vendure/commit/99e04d1)), closes [#2566](https://github.com/vendure-ecommerce/vendure/issues/2566) [#2555](https://github.com/vendure-ecommerce/vendure/issues/2555)
* **core** OrderLineEvent includes ID of deleted OrderLine ([ee04032](https://github.com/vendure-ecommerce/vendure/commit/ee04032)), closes [#2574](https://github.com/vendure-ecommerce/vendure/issues/2574)
* **core** Remove redundant constraint when creating allocations ([52c0841](https://github.com/vendure-ecommerce/vendure/commit/52c0841)), closes [#2563](https://github.com/vendure-ecommerce/vendure/issues/2563)
* **core** Send the correct amount to `refundOrder` (#2559) ([b5a265f](https://github.com/vendure-ecommerce/vendure/commit/b5a265f)), closes [#2559](https://github.com/vendure-ecommerce/vendure/issues/2559)
* **elasticsearch-plugin** Fix type to allow the promise on custom mapping definition (#2562) ([8e9ee07](https://github.com/vendure-ecommerce/vendure/commit/8e9ee07)), closes [#2562](https://github.com/vendure-ecommerce/vendure/issues/2562)
* **payments-plugin** Fix Mollie channel awareness (#2575) ([cc4826d](https://github.com/vendure-ecommerce/vendure/commit/cc4826d)), closes [#2575](https://github.com/vendure-ecommerce/vendure/issues/2575)
* **payments-plugin** Mollie - ignore completed state to prevent unneccesary error throwing (#2569) ([ed80c68](https://github.com/vendure-ecommerce/vendure/commit/ed80c68)), closes [#2569](https://github.com/vendure-ecommerce/vendure/issues/2569)
* **stellate-plugin** Add stellate plugin ([2254576](https://github.com/vendure-ecommerce/vendure/commit/2254576))

## <small>2.1.4 (2023-11-24)</small>


Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ The root directory has a `package.json` which contains build-related dependencie
* Generating TypeScript types from the GraphQL schema
* Linting, formatting & testing tasks to run on git commit & push

> Note:
> When you do `yarn` for the first time, you will need to manually create the `package` folder under [/packages/admin-ui](/packages/admin-ui).
### 2. Build all packages

`yarn build`
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/developer-guide/custom-fields/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ The following types are available for custom fields:
| `string` | Short string data | url, label |
| `localeString` | Localized short strings | localized url |
| `text` | Long text data | extended product info, json config object |
| `localText` | Localized long text | localized extended product info |
| `localeText` | Localized long text | localized extended product info |
| `int` | Integer | product weight, customer loyalty points, monetary values |
| `float` | Floating point number | product review rating |
| `boolean` | Boolean | isDownloadable flag on product |
Expand Down
27 changes: 27 additions & 0 deletions docs/docs/guides/developer-guide/error-handling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,33 @@ Here's how a response would look in both the success and error result cases:
</TabItem>
</Tabs>

### Handling ErrorResults in plugin code

If you are writing a plugin which deals with internal Vendure service methods that may return ErrorResults,
then you can use the `isGraphQlErrorResult()` function to check whether the result is an ErrorResult:

```ts
import { Injectable} from '@nestjs/common';
import { isGraphQlErrorResult, Order, OrderService, OrderState, RequestContext } from '@vendure/core';

@Injectable()
export class MyService {

constructor(private orderService: OrderService) {}

async myMethod(ctx: RequestContext, order: Order, newState: OrderState) {
const transitionResult = await this.orderService.transitionToState(ctx, order.id, newState);
if (isGraphQlErrorResult(transitionResult)) {
// The transition failed with an ErrorResult
throw transitionResult;
} else {
// TypeScript will correctly infer the type of `transitionResult` to be `Order`
return transitionResult;
}
}
}
```

### Handling ErrorResults in client code

Because we know all possible ErrorResult that may occur for a given mutation, we can handle them in an exhaustive manner. In other
Expand Down
5 changes: 2 additions & 3 deletions docs/docs/guides/developer-guide/plugins/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class MyPlugin implements NestModule {

In Vendure **plugins** are used to extend the core functionality of the server. Plugins can be pre-made functionality that you can install via npm, or they can be custom plugins that you write yourself.

For any unit of functionality that you need to add to your project, you'll be writing creating a Vendure plugin. By convention, plugins are stored in the `plugins` directory of your project. However, this is not a requirement, and you are free to arrange your plugin files in any way you like.
For any unit of functionality that you need to add to your project, you'll be creating a Vendure plugin. By convention, plugins are stored in the `plugins` directory of your project. However, this is not a requirement, and you are free to arrange your plugin files in any way you like.

```txt
├──src
Expand Down Expand Up @@ -281,7 +281,6 @@ In order to make use of this custom field in a type-safe way, we can tell TypeSc
```

```ts title="src/plugins/wishlist-plugin/types.ts"
import { CustomCustomerFields } from '@vendure/core/dist/entity/custom-entity-fields';
import { WishlistItem } from './entities/wishlist-item.entity';

declare module '@vendure/core/dist/entity/custom-entity-fields' {
Expand Down Expand Up @@ -312,7 +311,7 @@ Let's create a service to handle the wishlist functionality:
├── wishlist.service.ts
```

```ts title="src/plugins/wishlist-plugin/wishlist.service.ts"
```ts title="src/plugins/wishlist-plugin/services/wishlist.service.ts"
import { Injectable } from '@nestjs/common';
import {
Customer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ This is the standard layout for any list view. The main functionality is provide
/>

<!-- Here we define all the available columns -->
<vdr-dt2-column [heading]="'common.id' | translate" [hiddenByDefault]="true">
<vdr-dt2-column id="id" [heading]="'common.id' | translate" [hiddenByDefault]="true">
<ng-template let-review="item">
{{ review.id }}
</ng-template>
</vdr-dt2-column>
<vdr-dt2-column
id="created-at"
[heading]="'common.created-at' | translate"
[hiddenByDefault]="true"
[sort]="sorts.get('createdAt')"
Expand All @@ -200,6 +201,7 @@ This is the standard layout for any list view. The main functionality is provide
</ng-template>
</vdr-dt2-column>
<vdr-dt2-column
id="updated-at"
[heading]="'common.updated-at' | translate"
[hiddenByDefault]="true"
[sort]="sorts.get('updatedAt')"
Expand All @@ -208,18 +210,18 @@ This is the standard layout for any list view. The main functionality is provide
{{ review.updatedAt | localeDate : 'short' }}
</ng-template>
</vdr-dt2-column>
<vdr-dt2-column heading="Title" [optional]="false" [sort]="sorts.get('title')">
<vdr-dt2-column id="title" heading="Title" [optional]="false" [sort]="sorts.get('title')">
<ng-template let-review="item">
<a class="button-ghost" [routerLink]="['./', review.id]"
><span>{{ review.title }}</span>
<clr-icon shape="arrow right"></clr-icon>
</a>
</ng-template>
</vdr-dt2-column>
<vdr-dt2-column heading="Rating" [sort]="sorts.get('rating')">
<vdr-dt2-column id="rating" heading="Rating" [sort]="sorts.get('rating')">
<ng-template let-review="item"><my-star-rating-component [rating]="review.rating" /></ng-template>
</vdr-dt2-column>
<vdr-dt2-column heading="Author" [sort]="sorts.get('authorName')">
<vdr-dt2-column id="author" heading="Author" [sort]="sorts.get('authorName')">
<ng-template let-review="item">{{ review.authorName }}</ng-template>
</vdr-dt2-column>
</vdr-data-table-2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## ActionBarContext

<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="78" packageName="@vendure/admin-ui" />
<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="89" packageName="@vendure/admin-ui" />

Providers available to the onClick handler of an <a href='/reference/admin-ui-api/action-bar/action-bar-item#actionbaritem'>ActionBarItem</a> or <a href='/reference/admin-ui-api/nav-menu/nav-menu-item#navmenuitem'>NavMenuItem</a>.

Expand Down
13 changes: 12 additions & 1 deletion docs/docs/reference/admin-ui-api/action-bar/action-bar-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## ActionBarItem

<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="96" packageName="@vendure/admin-ui" />
<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="107" packageName="@vendure/admin-ui" />

A button in the ActionBar area at the top of one of the list or detail views.

Expand Down Expand Up @@ -88,7 +88,18 @@ dynamically enable/disable or show/hide the button.

<MemberInfo kind="property" type={`string | string[]`} />

Control the display of this item based on the user permissions. Note: if you attempt to pass a
<a href='/reference/typescript-api/auth/permission-definition#permissiondefinition'>PermissionDefinition</a> object, you will get a compilation error. Instead, pass the plain
string version. For example, if the permission is defined as:
```ts
export const MyPermission = new PermissionDefinition('ProductReview');
```
then the generated permission strings will be:

- `CreateProductReview`
- `ReadProductReview`
- `UpdateProductReview`
- `DeleteProductReview`


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

## RouterLinkDefinition

<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="128" packageName="@vendure/admin-ui" />
<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/nav-builder/nav-builder-types.ts" sourceLine="154" packageName="@vendure/admin-ui" />

A function which returns the router link for an <a href='/reference/admin-ui-api/action-bar/action-bar-item#actionbaritem'>ActionBarItem</a> or <a href='/reference/admin-ui-api/nav-menu/nav-menu-item#navmenuitem'>NavMenuItem</a>.

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

## addNavMenuItem

<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/add-nav-menu-item.ts" sourceLine="64" packageName="@vendure/admin-ui" />
<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/add-nav-menu-item.ts" sourceLine="68" packageName="@vendure/admin-ui" />

Add a menu item to an existing section specified by `sectionId`. The id of the section
can be found by inspecting the DOM and finding the `data-section-id` attribute.
Expand All @@ -24,6 +24,8 @@ This should be used in the NgModule `providers` array of your ui extension modul
*Example*

```ts title="providers.ts"
import { addNavMenuItem } from '@vendure/admin-ui/core';

export default [
addNavMenuItem({
id: 'reviews',
Expand All @@ -33,7 +35,7 @@ export default [
},
'marketing'),
];
``
```

```ts title="Signature"
function addNavMenuItem(config: NavMenuItem, sectionId: string, before?: string): Provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MemberDescription from '@site/src/components/MemberDescription';

## addNavMenuSection

<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/add-nav-menu-item.ts" sourceLine="28" packageName="@vendure/admin-ui" />
<GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/extension/add-nav-menu-item.ts" sourceLine="30" packageName="@vendure/admin-ui" />

Add a section to the main nav menu. Providing the `before` argument will
move the section before any existing section with the specified id. If
Expand All @@ -22,6 +22,8 @@ This should be used in the NgModule `providers` array of your ui extension modul
*Example*

```ts title="providers.ts"
import { addNavMenuSection } from '@vendure/admin-ui/core';

export default [
addNavMenuSection({
id: 'reports',
Expand Down
13 changes: 12 additions & 1 deletion docs/docs/reference/admin-ui-api/nav-menu/nav-menu-section.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ interface NavMenuSection {

<MemberInfo kind="property" type={`string | ((userPermissions: string[]) =&#62; boolean)`} />

Control the display of this item based on the user permissions.
Control the display of this item based on the user permissions. Note: if you attempt to pass a
<a href='/reference/typescript-api/auth/permission-definition#permissiondefinition'>PermissionDefinition</a> object, you will get a compilation error. Instead, pass the plain
string version. For example, if the permission is defined as:
```ts
export const MyPermission = new PermissionDefinition('ProductReview');
```
then the generated permission strings will be:

- `CreateProductReview`
- `ReadProductReview`
- `UpdateProductReview`
- `DeleteProductReview`
### collapsible

<MemberInfo kind="property" type={`boolean`} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default [
tableId: 'product-list',
columnId: 'slug',
props: {
foo: 'bar',
foo: 'bar',
},
}),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ in processing jobs.

## Installation

`yarn add @vendure/job-queue-plugin bullmq@1`
`yarn add @vendure/job-queue-plugin bullmq`

or

`npm install @vendure/job-queue-plugin bullmq@1`
`npm install @vendure/job-queue-plugin bullmq`

**Note:** The v1.x version of this plugin is designed to work with bullmq v1.x.
**Note:** The v1.x version of this plugin is designed to work with bullmq v1.x, etc.

*Example*

Expand Down
Loading

0 comments on commit f83455c

Please sign in to comment.