Skip to content

Commit

Permalink
3.0.0-rc8
Browse files Browse the repository at this point in the history
  • Loading branch information
pozylon committed Dec 20, 2024
1 parent 63b38a0 commit 21116b8
Show file tree
Hide file tree
Showing 38 changed files with 358 additions and 334 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Unchained Engine v3.0 RC7 ("Odi")
# Unchained Engine v3.0 RC8 ("Odi")

We are thrilled to announce Unchained Engine v3.0, 5 years after the first version. We started with an overloaded framework approach using Meteor and gradually removed dependency by dependency, getting closer to the metal and in-line with today's standards. Unchained Engine...
- ...is 100% ESM and self-hosted
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "docs",
"description": "Docs for Unchained Engine",
"private": true,
"version": "3.0.0-rc7",
"version": "3.0.0-rc8",
"license": "ISC",
"scripts": {
"dev": "docusaurus start",
Expand Down
14 changes: 7 additions & 7 deletions examples/kitchensink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "example-kitchensink",
"description": "Kitchensink for Unchained Engine",
"private": true,
"version": "3.0.0-rc7",
"version": "3.0.0-rc8",
"license": "EUPL-1.2",
"type": "module",
"homepage": "https://unchained.shop",
Expand Down Expand Up @@ -35,12 +35,12 @@
},
"dependencies": {
"@graphql-yoga/plugin-response-cache": "^3.12.6",
"@unchainedshop/api": "^3.0.0-rc7",
"@unchainedshop/core-delivery": "^3.0.0-rc7",
"@unchainedshop/core-payment": "^3.0.0-rc7",
"@unchainedshop/platform": "^3.0.0-rc7",
"@unchainedshop/plugins": "^3.0.0-rc7",
"@unchainedshop/ticketing": "^3.0.0-rc7",
"@unchainedshop/api": "^3.0.0-rc8",
"@unchainedshop/core-delivery": "^3.0.0-rc8",
"@unchainedshop/core-payment": "^3.0.0-rc8",
"@unchainedshop/platform": "^3.0.0-rc8",
"@unchainedshop/plugins": "^3.0.0-rc8",
"@unchainedshop/ticketing": "^3.0.0-rc8",
"bip32": "^4.0.0",
"bitcoinjs-lib": "^6.1.7",
"dotenv-extended": "^2.9.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@unchainedshop/minimal",
"description": "Kitchensink for Unchained Engine",
"private": true,
"version": "3.0.0-rc7",
"version": "3.0.0-rc8",
"license": "EUPL-1.2",
"type": "module",
"homepage": "https://unchained.shop",
Expand Down Expand Up @@ -36,8 +36,8 @@
"dependencies": {
"@fastify/cookie": "^11.0.1",
"@fastify/session": "^11.0.2",
"@unchainedshop/platform": "^3.0.0-rc7",
"@unchainedshop/plugins": "^3.0.0-rc7",
"@unchainedshop/platform": "^3.0.0-rc8",
"@unchainedshop/plugins": "^3.0.0-rc8",
"connect-mongo": "^5.1.0",
"fastify": "^5.2.0"
},
Expand Down
81 changes: 53 additions & 28 deletions migration-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@
Add the env `UNCHAINED_TOKEN_SECRET`, use any random string secret to the server.

## Schema Changes
Checkout the Changelog for a list. We encourage you to use codegen to have statically typed queries and mutations for frontend projects.

Checkout the Changelog for a list. We encourage you to use codegen to have statically typed queries and
mutations for frontend projects.

## Apollo to Yoga

Boot.ts files need to be migrated in order to work with the new Yoga GraphQL Server.

First: Dependencies
`npm install @graphql-yoga/plugin-response-cache graphql-yoga`
First: Dependencies `npm install @graphql-yoga/plugin-response-cache graphql-yoga`
`npm uninstall @apollo/server-plugin-response-cache @apollo/server apollo-graphiql-playground`

Remove

```js
import {
startPlatform,
withAccessToken,
setAccessToken,
connectPlatformToExpress4,
} from "@unchainedshop/platform";
import { ApolloServerPluginCacheControl } from "@apollo/server/plugin/cacheControl";
import { ApolloServerPluginDrainHttpServer } from "@apollo/server/plugin/drainHttpServer";
import { ApolloServerPluginLandingPageGraphiQLPlayground } from "apollo-graphiql-playground";
import responseCachePlugin from "@apollo/server-plugin-response-cache";
} from '@unchainedshop/platform';
import { ApolloServerPluginCacheControl } from '@apollo/server/plugin/cacheControl';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import { ApolloServerPluginLandingPageGraphiQLPlayground } from 'apollo-graphiql-playground';
import responseCachePlugin from '@apollo/server-plugin-response-cache';
```

Add

```js
import { useExecutionCancellation } from 'graphql-yoga';
import { useResponseCache } from '@graphql-yoga/plugin-response-cache';
Expand All @@ -36,6 +40,7 @@ import { defaultModules, connectDefaultPluginsToExpress4 } from '@unchainedshop/
```

Change startPlatform from:

```js
const engine = await startPlatform({
introspection: true,
Expand Down Expand Up @@ -65,47 +70,65 @@ connectPlatformToExpress4(app, engine, { corsOrigins: [] });
```

to:

```js
const engine = await startPlatform({
plugins: [
useExecutionCancellation(),
useResponseCache({
ttl: 0,
session(req) {
const auth = req.headers.get('authorization');
const cookies = cookie.parse(req.headers.get('cookie') || '');
return auth || cookies[UNCHAINED_COOKIE_NAME] || null;
},
enabled() {
return process.env.NODE_ENV === 'production';
},
}),
],
plugins: [
useExecutionCancellation(),
useResponseCache({
ttl: 0,
session(req) {
const auth = req.headers.get('authorization');
const cookies = cookie.parse(req.headers.get('cookie') || '');
return auth || cookies[UNCHAINED_COOKIE_NAME] || null;
},
enabled() {
return process.env.NODE_ENV === 'production';
},
}),
],
});
connect(app, engine);
```

## Remove types

Remove all imports from `@unchainedshop/types` and find the types in the according core modules, core and platform.
Remove all imports from `@unchainedshop/types` and find the types in the according core modules, core and
platform.

## Migrate Removed Module Functions

`modules.products.prices.userPrice`: `services.products.simulateProductPricing`

`modules.orders.pricingSheet`:
```js
OrderPricingSheet(order);`
```

`modules.orders.positions.pricingSheet`:
```js
ProductPricingSheet({
...item,
currency: order.currency,
});`
```

`modules.orders.delivery.pricingSheet`:
```js
DeliveryPricingSheet(delivery);`
```

`modules.orders.payment.pricingSheet`:
```js
PaymentPricingSheet(payment);`
```

`modules.accounts.findUserByEmail` => `modules.users.findUserByEmail`

`modules.accounts.setUsername` => `modules.users.setUsername`

`modules.accounts.createUser` => `modules.users.createUser` (password does not take a hashed password anymore, provide plain password here it will hash it on it's own)
`modules.accounts.createUser` => `modules.users.createUser` (password does not take a hashed password
anymore, provide plain password here it will hash it on it's own)

`modules.accounts.sendEnrollmentEmail(...)` => `modules.users.sendResetPasswordEmail(..., true);`

Expand All @@ -126,9 +149,11 @@ Remove all imports from `@unchainedshop/types` and find the types in the accordi
Dependency Hell:

Minimal v2 without optional and without dev (production setup):
* 449 Packages in node_modules
* 205M

- 449 Packages in node_modules
- 205M

Minimal v3 without optional and without dev (production setup):
* 245 Packages in node_modules
* 76M

- 245 Packages in node_modules
- 76M
Loading

0 comments on commit 21116b8

Please sign in to comment.