Skip to content

Commit 9bbaac2

Browse files
authored
Add missing changeset, add more description for changes (#406)
* Add missing changeset * Update changesets description, change scope * CR: Update examples
1 parent 853abaa commit 9bbaac2

6 files changed

+140
-4
lines changed

.changeset/hip-queens-roll.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@saleor/app-sdk": patch
2+
"@saleor/app-sdk": major
33
---
44

55
Removed `/middlewares`, you should use `/handlers` instead.

.changeset/kind-zoos-raise.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
Removed deprecated fields fields and methods in `/handlers`:
66

7-
- `SaleorAsyncWebhook` and `SaleorSyncWebhook` - removed `asyncEvent` and `subscriptionQueryAst`
8-
- Removed `processSaleorWebhook` and `processProtectedHandler` methods
7+
- `SaleorAsyncWebhook` and `SaleorSyncWebhook` - removed deprecated `asyncEvent` and `subscriptionQueryAst`
8+
- Removed `processSaleorWebhook` and `processProtectedHandler` methods in favor of `SaleorSyncWebhook`, `SaleorAsyncWebhook` classes and `createProtectedHandler` handler
99
- Some types were moved from `/next` to `/shared`

.changeset/rare-tools-change.md

+42
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,45 @@
33
---
44

55
Added handlers for Web API: Request and Response
6+
7+
## Example
8+
9+
This example uses Next.js app router
10+
11+
```ts
12+
/* /app/api/manifest/route.ts */
13+
import { createManifestHandler } from "@saleor/app-sdk/handlers/fetch-api";
14+
// or
15+
import { createManifestHandler } from "@saleor/app-sdk/handlers/next-app-router";
16+
17+
export const GET = createManifestHandler({
18+
manifestFactory({ appBaseUrl, request }) {
19+
return {
20+
name: "Saleor App Template",
21+
tokenTargetUrl: `${appBaseUrl}/api/register`,
22+
appUrl: appBaseUrl,
23+
permissions: ["MANAGE_ORDERS"],
24+
id: "saleor.app",
25+
version: "0.0.1",
26+
webhooks: [orderCreatedWebhook.getWebhookManifest(apiBaseURL)],
27+
author: "Saleor Commerce",
28+
};
29+
},
30+
});
31+
```
32+
33+
```ts
34+
/* /app/api/register/route.ts */
35+
import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/fetch-api";
36+
37+
export const POST = createAppRegisterHandler({
38+
apl: saleorApp.apl,
39+
});
40+
```
41+
42+
To see more details check these examples:
43+
44+
- [Hono on Deno Deploy](https://github.com/witoszekdev/saleor-app-hono-deno-template)
45+
- [Hono on Cloudflare Pages](https://github.com/witoszekdev/saleor-app-hono-cf-pages-template)
46+
- [Hono on AWS Lambda](https://github.com/witoszekdev/saleor-app-hono-aws-lambda-template)
47+
- [Next.js Edge Runtime](https://github.com/saleor/saleor-app-template/pull/267)

.changeset/serious-lamps-rhyme.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
---
44

55
Added AWS Lambda platform handlers
6+
7+
Check [this example on how to use it](https://github.com/witoszekdev/saleor-app-lambda-template).

.changeset/silent-walls-heal.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
"@saleor/app-sdk": major
3+
---
4+
5+
`createManifestHandler` will now require `saleor-schema-version` header, sent by Saleor when fetching manifest.
6+
`schemaVersion` parameter passed to factory method will be always defined
7+
8+
### Previously:
9+
10+
```ts
11+
const handler = createManifestHandler({
12+
manifestFactory({ schemaVersion }) {
13+
schemaVersion -> null or number
14+
return {
15+
// ...
16+
}
17+
}
18+
})
19+
```
20+
21+
Example request:
22+
23+
```http
24+
GET /api/manifest
25+
host: my-app.com
26+
```
27+
28+
```http
29+
GET /api/manifest
30+
host: my-app.com
31+
saleor-schema-version: 3.20
32+
```
33+
34+
Example response:
35+
36+
```http
37+
Content-Type: application/json
38+
39+
{
40+
"name": "Example Saleor App"
41+
...
42+
}
43+
```
44+
45+
### Now:
46+
47+
```ts
48+
const handler = createManifestHandler({
49+
manifestFactory({ schemaVersion }) {
50+
schemaVersion -> number
51+
return {
52+
// ...
53+
}
54+
}
55+
})
56+
```
57+
58+
### Invalid request
59+
60+
```http
61+
GET /api/manifest
62+
host: my-app.com
63+
```
64+
65+
Response:
66+
67+
```http
68+
HTTP 400
69+
Content-Type: text/plain
70+
71+
Missing schema version header
72+
```
73+
74+
### Valid request
75+
76+
```http
77+
GET /api/manifest
78+
host: my-app.com
79+
saleor-schema-version: 3.20
80+
```
81+
82+
Response:
83+
84+
```http
85+
HTTP 200
86+
Content-Type: application/json
87+
88+
{
89+
"name": "Example Saleor App"
90+
...
91+
}
92+
```

.changeset/sixty-taxis-glow.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@saleor/app-sdk": patch
2+
"@saleor/app-sdk": minor
33
---
44

55
Added abstract `PlatformAdapterInterface` and `ActionHandlerInterface` to enable cross-framework handler implementations.

0 commit comments

Comments
 (0)