Skip to content

Commit 03127e3

Browse files
committed
feat: add redis pkg
1 parent 0088ac0 commit 03127e3

File tree

11 files changed

+505
-1
lines changed

11 files changed

+505
-1
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
@storybooker/azure \
3232
@storybooker/gcp \
3333
@storybooker/ui \
34+
@storybooker/redis \
3435
storybooker
3536
cp tsconfig.base.json out/tsconfig.base.json
3637
cp .oxlintrc.json out/.oxlintrc.json

apps/website/docs/redis/index.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
tags:
3+
- database
4+
---
5+
6+
# Redis Database
7+
8+
The Redis database can be used as database for StoryBooker.
9+
10+
## Install
11+
12+
```sh
13+
npm i @storybooker/redis redis
14+
```
15+
16+
## Usage
17+
18+
```js
19+
import { RedisDatabaseService } from "@storybooker/redis";
20+
import { createClient } from "redis";
21+
22+
// Your connection string
23+
const connectionString = process.env["REDIS_CONNECTION_STRING"];
24+
// Initialize the Redis client
25+
const client = createClient({ url: connectionString });
26+
// Create the service adapter
27+
const database = new RedisDatabaseService(client);
28+
29+
// use as `database` in StoryBooker hosting options.
30+
```

apps/website/sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ const sidebars: SidebarsConfig = {
4343
label: "Auth",
4444
type: "link",
4545
},
46+
{
47+
href: "/docs/tags/ui",
48+
label: "UI",
49+
type: "link",
50+
},
4651
],
4752
},
4853
],

packages/azure/src/easy-auth.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ import type {
99
StoryBookerUser,
1010
} from "@storybooker/core/adapter";
1111

12-
export type { AuthAdapterAuthorise } from "@storybooker/core/adapter";
12+
export type {
13+
AuthAdapterAuthorise,
14+
StoryBookerPermission,
15+
StoryBookerPermissionAction,
16+
StoryBookerPermissionKey,
17+
StoryBookerPermissionResource,
18+
StoryBookerPermissionWithKey,
19+
} from "@storybooker/core/adapter";
1320

1421
export interface AzureEasyAuthClientPrincipal {
1522
claims: { typ: string; val: string }[];

packages/redis/.oxlintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": ["../../.oxlintrc.json"],
3+
"env": {
4+
"builtin": true,
5+
"node": true
6+
},
7+
"rules": {
8+
"typescript/require-await": "allow",
9+
"typescript/no-unsafe-assignment": "allow"
10+
}
11+
}

packages/redis/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# StoryBooker adapter for Redis services
2+
3+
Create service adapters for Redis services.
4+
5+
Adapter Docs: https://storybooker.js.org/docs/redis

packages/redis/package.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"name": "@storybooker/redis",
3+
"version": "0.17.1",
4+
"type": "module",
5+
"description": "StoryBooker Adapter for interacting with Redis services.",
6+
"author": {
7+
"name": "Siddhant Gupta",
8+
"url": "https://guptasiddhant.com"
9+
},
10+
"homepage": "https://storybooker.js.org",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/guptasiddhant/storybooker",
14+
"directory": "packages/redis"
15+
},
16+
"license": "MIT",
17+
"bugs": {
18+
"url": "https://github.com/guptasiddhant/storybooker/issues"
19+
},
20+
"files": [
21+
"src",
22+
"dist"
23+
],
24+
"engines": {
25+
"node": ">=22.0.0"
26+
},
27+
"sideEffects": false,
28+
"keywords": [
29+
"functions",
30+
"storybook",
31+
"storybooks",
32+
"storybooker",
33+
"chromatic",
34+
"storage",
35+
"blob",
36+
"upload",
37+
"table",
38+
"compress",
39+
"builds",
40+
"labels",
41+
"projects",
42+
"redis",
43+
"valkey",
44+
"database"
45+
],
46+
"exports": {
47+
"./big-table": {
48+
"source": "./src/big-table.ts",
49+
"default": "./dist/big-table.js"
50+
},
51+
"./firestore": {
52+
"source": "./src/firestore.ts",
53+
"default": "./dist/firestore.js"
54+
},
55+
"./storage": {
56+
"source": "./src/storage.ts",
57+
"default": "./dist/storage.js"
58+
},
59+
"./package.json": "./package.json"
60+
},
61+
"scripts": {
62+
"build": "tsdown",
63+
"check": "tsgo --noEmit",
64+
"dev": "tsdown -w ./src",
65+
"fmt": "prettier src --write --config ../../.prettierrc",
66+
"lint": "oxlint --type-aware ./src",
67+
"lint:fix": "yarn lint --fix"
68+
},
69+
"dependencies": {
70+
"@storybooker/core": "workspace:"
71+
},
72+
"devDependencies": {
73+
"@types/node": "^22.0.0",
74+
"@typescript/native-preview": "^7.0.0-dev.20251024.1",
75+
"oxlint": "^1.24.0",
76+
"oxlint-tsgolint": "^0.3.0",
77+
"prettier": "^3.6.2",
78+
"redis": "^5.10.0",
79+
"tsdown": "^0.15.9"
80+
},
81+
"peerDependencies": {
82+
"redis": "^5.10.0"
83+
},
84+
"peerDependenciesMeta": {
85+
"redis": {
86+
"optional": true
87+
}
88+
},
89+
"main": "./dist/storage.cjs",
90+
"module": "./dist/storage.js",
91+
"types": "./dist/storage.d.cts",
92+
"publishConfig": {
93+
"exports": {
94+
"./big-table": "./dist/big-table.js",
95+
"./firestore": "./dist/firestore.js",
96+
"./storage": "./dist/storage.js",
97+
"./package.json": "./package.json"
98+
}
99+
}
100+
}

0 commit comments

Comments
 (0)