Skip to content

Commit

Permalink
update sdk and implement vercel kv example (#265)
Browse files Browse the repository at this point in the history
* update sdk and implement vercel kv example

* update vercel kv example

* fix switchcase

* update sdk
  • Loading branch information
lkostrowski authored Dec 17, 2024
1 parent ab116fb commit 4faddf3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"pnpm": ">=9.0.0 <10.0.0"
},
"dependencies": {
"@saleor/app-sdk": "0.50.0",
"@saleor/app-sdk": "0.51.0",
"@saleor/macaw-ui": "1.1.10",
"@urql/exchange-auth": "^1.0.0",
"@vitejs/plugin-react": "4.2.1",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/saleor-app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SaleorApp } from "@saleor/app-sdk/saleor-app";
import { APL, FileAPL, UpstashAPL } from "@saleor/app-sdk/APL";
import { VercelKvApl } from "@saleor/app-sdk/APL/vercel-kv";

/**
* By default auth data are stored in the `.auth-data.json` (FileAPL).
Expand All @@ -10,6 +11,21 @@ import { APL, FileAPL, UpstashAPL } from "@saleor/app-sdk/APL";
*/
export let apl: APL;
switch (process.env.APL) {
case "vercel-kv":
/**
* Following envs are required
*
* KV_URL
* KV_REST_API_URL
* KV_REST_API_TOKEN
* KV_REST_API_READ_ONLY_TOKEN
* KV_STORAGE_NAMESPACE
*
* Additionally, you need
* pnpm i @vercel/kv
*/
apl = new VercelKvApl();
break;
case "upstash":
// Require `UPSTASH_URL` and `UPSTASH_TOKEN` environment variables
apl = new UpstashAPL();
Expand Down

0 comments on commit 4faddf3

Please sign in to comment.