solana-auth-oauth2-server 0.0.0 → 0.1.0-canary-20260124204405
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -55
- package/dist/cli.cjs +178 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +178 -8
- package/dist/cli.js.map +1 -1
- package/package.json +20 -5
package/README.md
CHANGED
|
@@ -1,74 +1,42 @@
|
|
|
1
1
|
# solana-auth-oauth2-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Solana Auth OAuth2 Server implementation.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
* **Bun-first development**: Leverages Bun for lightning-fast installs, runs, and tests.
|
|
8
|
-
* **TypeScript support**: Write type-safe code from the start.
|
|
9
|
-
* **Linting & Formatting**: Enforced with [Biome](https://biomejs.dev/) for consistent code style.
|
|
10
|
-
* **Bundling**: Uses [tsup](https://tsup.js.org/) for efficient bundling into ESM and CJS formats, with type declarations.
|
|
11
|
-
* **Testing**: Built-in unit testing with `bun test`.
|
|
12
|
-
* **Versioning & Publishing**: Managed with [Changesets](https://github.com/changesets/changesets) for streamlined releases to npm.
|
|
13
|
-
* **GitHub Actions**: Continuous Integration (CI) workflows for automated build, test, lint, and publish processes.
|
|
14
|
-
|
|
15
|
-
## Getting Started
|
|
16
|
-
|
|
17
|
-
To use this template, you typically would use a scaffolding tool like `bunx create-something -t solana-auth-oauth2-server`.
|
|
18
|
-
|
|
19
|
-
### Installation
|
|
20
|
-
|
|
21
|
-
If you're using this template directly (e.g., after cloning), you can install dependencies with Bun:
|
|
5
|
+
## Installation
|
|
22
6
|
|
|
23
7
|
```bash
|
|
24
8
|
bun install
|
|
25
9
|
```
|
|
26
10
|
|
|
27
|
-
|
|
11
|
+
## Usage
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
* **Type Check**: `bun run check-types`
|
|
31
|
-
* **Lint**: `bun run lint`
|
|
32
|
-
* **Lint & Fix**: `bun run lint:fix`
|
|
33
|
-
* **Test**: `bun test`
|
|
34
|
-
* **Test (Watch Mode)**: `bun run test:watch`
|
|
13
|
+
Start the server:
|
|
35
14
|
|
|
36
|
-
|
|
15
|
+
```bash
|
|
16
|
+
bun run src/cli.ts start
|
|
17
|
+
```
|
|
37
18
|
|
|
38
|
-
|
|
19
|
+
Options:
|
|
20
|
+
- `-p, --port <number>`: Port to run the server on (default: 3000)
|
|
21
|
+
- `--admin`: Enable admin API endpoints at `/admin` (optional)
|
|
39
22
|
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
bun changeset
|
|
43
|
-
```
|
|
44
|
-
Follow the prompts to describe your changes. This will create a markdown file in `.changeset/`.
|
|
23
|
+
## Database
|
|
45
24
|
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
bun run version
|
|
49
|
-
```
|
|
50
|
-
This command reads the changeset files, updates package versions, updates `CHANGELOG.md`, and deletes the used changeset files. It also runs `bun lint:fix`.
|
|
25
|
+
This project uses Drizzle ORM and Turso (SQLite).
|
|
51
26
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
- **Generate migrations**: `bun run db:generate`
|
|
28
|
+
- **Push schema to DB**: `bun run db:push` (useful for local development)
|
|
29
|
+
- **Run migrations**: `bun run db:migrate`
|
|
30
|
+
- **Seed database**: `bun run db:seed`
|
|
31
|
+
- **Drizzle Studio**: `bun run db:studio`
|
|
57
32
|
|
|
58
|
-
##
|
|
33
|
+
## Development
|
|
59
34
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
├── test/ # Unit tests
|
|
65
|
-
│ └── index.test.ts # Example test file
|
|
66
|
-
├── tsup.config.ts # Configuration for tsup (bundling)
|
|
67
|
-
├── biome.json # Biome linter/formatter configuration
|
|
68
|
-
├── package.json # Project metadata and scripts
|
|
69
|
-
└── ... (other config files and GitHub workflows)
|
|
70
|
-
```
|
|
35
|
+
- **Build**: `bun run build`
|
|
36
|
+
- **Test**: `bun test`
|
|
37
|
+
- **Lint**: `bun run lint`
|
|
38
|
+
- **Type Check**: `bun run check-types`
|
|
71
39
|
|
|
72
40
|
## License
|
|
73
41
|
|
|
74
|
-
MIT
|
|
42
|
+
MIT
|
package/dist/cli.cjs
CHANGED
|
@@ -1,15 +1,185 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __export = (target, all) => {
|
|
5
|
+
for (var name in all)
|
|
6
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
+
};
|
|
3
8
|
|
|
4
|
-
// src/
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
// src/cli.ts
|
|
10
|
+
var import_commander = require("commander");
|
|
11
|
+
|
|
12
|
+
// package.json
|
|
13
|
+
var package_default = {
|
|
14
|
+
bin: {
|
|
15
|
+
"solana-auth-oauth2-server": "dist/cli.js"
|
|
16
|
+
},
|
|
17
|
+
dependencies: {
|
|
18
|
+
"@libsql/client": "^0.17.0",
|
|
19
|
+
commander: "^14.0.2",
|
|
20
|
+
"drizzle-orm": "^0.45.1",
|
|
21
|
+
hono: "^4.11.5",
|
|
22
|
+
libsql: "^0.5.22"
|
|
23
|
+
},
|
|
24
|
+
devDependencies: {
|
|
25
|
+
"@biomejs/biome": "^2.3.11",
|
|
26
|
+
"@changesets/cli": "^2.29.8",
|
|
27
|
+
"@types/bun": "latest",
|
|
28
|
+
"drizzle-kit": "^0.31.8",
|
|
29
|
+
"pkg-pr-new": "^0.0.62",
|
|
30
|
+
publint: "^0.3.16",
|
|
31
|
+
tsup: "^8.5.1"
|
|
32
|
+
},
|
|
33
|
+
exports: {
|
|
34
|
+
".": {
|
|
35
|
+
import: {
|
|
36
|
+
types: "./dist/index.d.ts",
|
|
37
|
+
default: "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
require: {
|
|
40
|
+
types: "./dist/index.d.cts",
|
|
41
|
+
default: "./dist/index.cjs"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
files: ["dist"],
|
|
46
|
+
license: "MIT",
|
|
47
|
+
main: "./dist/index.cjs",
|
|
48
|
+
module: "./dist/index.js",
|
|
49
|
+
name: "solana-auth-oauth2-server",
|
|
50
|
+
description: "Solana Auth OAuth2 Server",
|
|
51
|
+
repository: {
|
|
52
|
+
type: "git",
|
|
53
|
+
url: "git+https://github.com/solana-auth/solana-auth-oauth2-server.git"
|
|
54
|
+
},
|
|
55
|
+
peerDependencies: {
|
|
56
|
+
typescript: "^5"
|
|
57
|
+
},
|
|
58
|
+
scripts: {
|
|
59
|
+
build: "tsup",
|
|
60
|
+
changeset: "changeset",
|
|
61
|
+
"check-types": "tsc -b --noEmit",
|
|
62
|
+
"db:generate": "drizzle-kit generate",
|
|
63
|
+
"db:migrate": "drizzle-kit migrate",
|
|
64
|
+
"db:push": "drizzle-kit push",
|
|
65
|
+
"db:seed": "bun src/seed.ts",
|
|
66
|
+
"db:studio": "drizzle-kit studio",
|
|
67
|
+
lint: "biome check --error-on-warnings",
|
|
68
|
+
"lint:fix": "biome check --error-on-warnings --write",
|
|
69
|
+
release: "changeset publish",
|
|
70
|
+
test: "bun test ./test/",
|
|
71
|
+
"test:watch": "bun test --watch ./test/",
|
|
72
|
+
version: "changeset version && bun lint:fix"
|
|
73
|
+
},
|
|
74
|
+
type: "module",
|
|
75
|
+
types: "./dist/index.d.ts",
|
|
76
|
+
version: "0.0.0"
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/api.ts
|
|
80
|
+
var import_hono2 = require("hono");
|
|
81
|
+
|
|
82
|
+
// src/api-admin.ts
|
|
83
|
+
var import_drizzle_orm2 = require("drizzle-orm");
|
|
84
|
+
var import_hono = require("hono");
|
|
85
|
+
|
|
86
|
+
// src/db/index.ts
|
|
87
|
+
var import_client = require("@libsql/client");
|
|
88
|
+
var import_libsql = require("drizzle-orm/libsql");
|
|
89
|
+
|
|
90
|
+
// src/db/schema/index.ts
|
|
91
|
+
var schema_exports = {};
|
|
92
|
+
__export(schema_exports, {
|
|
93
|
+
users: () => users
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// src/db/schema/users.ts
|
|
97
|
+
var import_drizzle_orm = require("drizzle-orm");
|
|
98
|
+
var import_sqlite_core = require("drizzle-orm/sqlite-core");
|
|
99
|
+
var users = (0, import_sqlite_core.sqliteTable)("users", {
|
|
100
|
+
createdAt: (0, import_sqlite_core.integer)("created_at", { mode: "timestamp_ms" }).default(import_drizzle_orm.sql`(cast(unixepoch('subsecond') * 1000 as integer))`).notNull(),
|
|
101
|
+
email: (0, import_sqlite_core.text)("email").notNull().unique(),
|
|
102
|
+
id: (0, import_sqlite_core.text)("id").primaryKey(),
|
|
103
|
+
name: (0, import_sqlite_core.text)("name").notNull(),
|
|
104
|
+
updatedAt: (0, import_sqlite_core.integer)("updated_at", { mode: "timestamp_ms" }).default(import_drizzle_orm.sql`(cast(unixepoch('subsecond') * 1000 as integer))`).$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// src/db/index.ts
|
|
108
|
+
var client = (0, import_client.createClient)({
|
|
109
|
+
authToken: process.env.DATABASE_AUTH_TOKEN,
|
|
110
|
+
url: process.env.DATABASE_URL || "file:local.db"
|
|
111
|
+
});
|
|
112
|
+
var db = (0, import_libsql.drizzle)(client, { schema: schema_exports });
|
|
113
|
+
|
|
114
|
+
// src/api-admin.ts
|
|
115
|
+
var apiAdmin = new import_hono.Hono();
|
|
116
|
+
apiAdmin.get("/users", async (c) => {
|
|
117
|
+
const result = await db.select().from(users).all();
|
|
118
|
+
return c.json(result);
|
|
119
|
+
});
|
|
120
|
+
apiAdmin.get("/users/:id", async (c) => {
|
|
121
|
+
const id = c.req.param("id");
|
|
122
|
+
const result = await db.select().from(users).where((0, import_drizzle_orm2.eq)(users.id, id)).get();
|
|
123
|
+
if (!result) {
|
|
124
|
+
return c.json({ error: "User not found" }, 404);
|
|
125
|
+
}
|
|
126
|
+
return c.json(result);
|
|
127
|
+
});
|
|
128
|
+
apiAdmin.post("/users", async (c) => {
|
|
129
|
+
const body = await c.req.json();
|
|
130
|
+
if (!body.id || !body.email || !body.name) {
|
|
131
|
+
return c.json({ error: "Missing required fields: id, name, email" }, 400);
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
const result = await db.insert(users).values({
|
|
135
|
+
email: body.email,
|
|
136
|
+
id: body.id,
|
|
137
|
+
name: body.name
|
|
138
|
+
}).returning().get();
|
|
139
|
+
return c.json(result, 201);
|
|
140
|
+
} catch (err) {
|
|
141
|
+
if (err instanceof Error) {
|
|
142
|
+
if (err.message?.includes("UNIQUE constraint failed")) {
|
|
143
|
+
return c.json({ error: "User already exists" }, 409);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return c.json({ error: "Failed to create user" }, 500);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
apiAdmin.delete("/users/:id", async (c) => {
|
|
150
|
+
const id = c.req.param("id");
|
|
151
|
+
const result = await db.delete(users).where((0, import_drizzle_orm2.eq)(users.id, id)).returning().get();
|
|
152
|
+
if (!result) {
|
|
153
|
+
return c.json({ error: "User not found" }, 404);
|
|
154
|
+
}
|
|
155
|
+
return c.json({ message: "User deleted" });
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// src/api.ts
|
|
159
|
+
function startServer(port = 3e3, options = {}) {
|
|
160
|
+
const app = new import_hono2.Hono();
|
|
161
|
+
app.get("/", (c) => {
|
|
162
|
+
return c.text("Hello Hono!");
|
|
163
|
+
});
|
|
164
|
+
if (options.enableAdmin) {
|
|
165
|
+
app.route("/admin", apiAdmin);
|
|
166
|
+
console.log("Admin API enabled at /admin");
|
|
167
|
+
}
|
|
168
|
+
console.log(`Server is running on port ${port}`);
|
|
169
|
+
return {
|
|
170
|
+
app,
|
|
171
|
+
port
|
|
172
|
+
};
|
|
7
173
|
}
|
|
8
174
|
|
|
9
175
|
// src/cli.ts
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
176
|
+
var program = new import_commander.Command();
|
|
177
|
+
program.name(package_default.name).description(package_default.description).version(package_default.version);
|
|
178
|
+
program.command("start").description("Start the API server").option("--admin", "Enable admin API endpoints", false).option("-p, --port <number>", "Port to run the server on", "3000").action((options) => {
|
|
179
|
+
const { app, port } = startServer(parseInt(options.port, 10), {
|
|
180
|
+
enableAdmin: options.admin
|
|
181
|
+
});
|
|
182
|
+
Bun.serve({ fetch: app.fetch, port });
|
|
183
|
+
});
|
|
184
|
+
program.parse(process.argv);
|
|
15
185
|
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../package.json","../src/api.ts","../src/api-admin.ts","../src/db/index.ts","../src/db/schema/index.ts","../src/db/schema/users.ts"],"sourcesContent":["#!/usr/bin/env bun\nimport { Command } from 'commander'\nimport packageJson from '../package.json' with { type: 'json' }\nimport { startServer } from './api.ts'\n\nconst program = new Command()\n\nprogram.name(packageJson.name).description(packageJson.description).version(packageJson.version)\n\nprogram\n .command('start')\n .description('Start the API server')\n .option('--admin', 'Enable admin API endpoints', false)\n .option('-p, --port <number>', 'Port to run the server on', '3000')\n .action((options) => {\n const { app, port } = startServer(parseInt(options.port, 10), {\n enableAdmin: options.admin,\n })\n\n Bun.serve({ fetch: app.fetch, port })\n })\n\nprogram.parse(process.argv)\n","{\n \"bin\": {\n \"solana-auth-oauth2-server\": \"dist/cli.js\"\n },\n \"dependencies\": {\n \"@libsql/client\": \"^0.17.0\",\n \"commander\": \"^14.0.2\",\n \"drizzle-orm\": \"^0.45.1\",\n \"hono\": \"^4.11.5\",\n \"libsql\": \"^0.5.22\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.3.11\",\n \"@changesets/cli\": \"^2.29.8\",\n \"@types/bun\": \"latest\",\n \"drizzle-kit\": \"^0.31.8\",\n \"pkg-pr-new\": \"^0.0.62\",\n \"publint\": \"^0.3.16\",\n \"tsup\": \"^8.5.1\"\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n }\n },\n \"files\": [\"dist\"],\n \"license\": \"MIT\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"name\": \"solana-auth-oauth2-server\",\n \"description\": \"Solana Auth OAuth2 Server\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/solana-auth/solana-auth-oauth2-server.git\"\n },\n \"peerDependencies\": {\n \"typescript\": \"^5\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"changeset\": \"changeset\",\n \"check-types\": \"tsc -b --noEmit\",\n \"db:generate\": \"drizzle-kit generate\",\n \"db:migrate\": \"drizzle-kit migrate\",\n \"db:push\": \"drizzle-kit push\",\n \"db:seed\": \"bun src/seed.ts\",\n \"db:studio\": \"drizzle-kit studio\",\n \"lint\": \"biome check --error-on-warnings\",\n \"lint:fix\": \"biome check --error-on-warnings --write\",\n \"release\": \"changeset publish\",\n \"test\": \"bun test ./test/\",\n \"test:watch\": \"bun test --watch ./test/\",\n \"version\": \"changeset version && bun lint:fix\"\n },\n \"type\": \"module\",\n \"types\": \"./dist/index.d.ts\",\n \"version\": \"0.0.0\"\n}\n","import { Hono } from 'hono'\nimport { apiAdmin } from './api-admin.ts'\n\nexport function startServer(port: number = 3000, options: { enableAdmin?: boolean } = {}) {\n const app = new Hono()\n\n app.get('/', (c) => {\n return c.text('Hello Hono!')\n })\n\n if (options.enableAdmin) {\n app.route('/admin', apiAdmin)\n console.log('Admin API enabled at /admin')\n }\n\n console.log(`Server is running on port ${port}`)\n\n return {\n app,\n port,\n }\n}\n","import { eq } from 'drizzle-orm'\nimport { Hono } from 'hono'\nimport { db } from './db/index.ts'\nimport { users } from './db/schema/index.ts'\n\nexport const apiAdmin = new Hono()\n\n// List users\napiAdmin.get('/users', async (c) => {\n const result = await db.select().from(users).all()\n return c.json(result)\n})\n\n// Get user by ID\napiAdmin.get('/users/:id', async (c) => {\n const id = c.req.param('id')\n const result = await db.select().from(users).where(eq(users.id, id)).get()\n\n if (!result) {\n return c.json({ error: 'User not found' }, 404)\n }\n\n return c.json(result)\n})\n\n// Create user\napiAdmin.post('/users', async (c) => {\n const body = await c.req.json()\n\n if (!body.id || !body.email || !body.name) {\n return c.json({ error: 'Missing required fields: id, name, email' }, 400)\n }\n\n try {\n const result = await db\n .insert(users)\n .values({\n email: body.email,\n id: body.id,\n name: body.name,\n })\n .returning()\n .get()\n\n return c.json(result, 201)\n } catch (err) {\n if (err instanceof Error) {\n if (err.message?.includes('UNIQUE constraint failed')) {\n return c.json({ error: 'User already exists' }, 409)\n }\n }\n return c.json({ error: 'Failed to create user' }, 500)\n }\n})\n\n// Delete user\napiAdmin.delete('/users/:id', async (c) => {\n const id = c.req.param('id')\n\n const result = await db.delete(users).where(eq(users.id, id)).returning().get()\n\n if (!result) {\n return c.json({ error: 'User not found' }, 404)\n }\n\n return c.json({ message: 'User deleted' })\n})\n","import { createClient } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport * as schema from './schema/index.ts'\n\nconst client = createClient({\n authToken: process.env.DATABASE_AUTH_TOKEN,\n url: process.env.DATABASE_URL || 'file:local.db',\n})\n\nexport const db = drizzle(client, { schema })\n","export * from './users.ts'\n","import { sql } from 'drizzle-orm'\nimport { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const users = sqliteTable('users', {\n createdAt: integer('created_at', { mode: 'timestamp_ms' })\n .default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)\n .notNull(),\n email: text('email').notNull().unique(),\n id: text('id').primaryKey(),\n name: text('name').notNull(),\n updatedAt: integer('updated_at', { mode: 'timestamp_ms' })\n .default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)\n .$onUpdate(() => new Date())\n .notNull(),\n})\n"],"mappings":";;;;;;;;;AACA,uBAAwB;;;ACDxB;AAAA,EACE,KAAO;AAAA,IACL,6BAA6B;AAAA,EAC/B;AAAA,EACA,cAAgB;AAAA,IACd,kBAAkB;AAAA,IAClB,WAAa;AAAA,IACb,eAAe;AAAA,IACf,MAAQ;AAAA,IACR,QAAU;AAAA,EACZ;AAAA,EACA,iBAAmB;AAAA,IACjB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,cAAc;AAAA,IACd,SAAW;AAAA,IACX,MAAQ;AAAA,EACV;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,QAAU;AAAA,QACR,OAAS;AAAA,QACT,SAAW;AAAA,MACb;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,SAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAS,CAAC,MAAM;AAAA,EAChB,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,kBAAoB;AAAA,IAClB,YAAc;AAAA,EAChB;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,WAAa;AAAA,IACb,eAAe;AAAA,IACf,eAAe;AAAA,IACf,cAAc;AAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,IACX,aAAa;AAAA,IACb,MAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAW;AAAA,IACX,MAAQ;AAAA,IACR,cAAc;AAAA,IACd,SAAW;AAAA,EACb;AAAA,EACA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AC7B,CAAC;AAED,MAAI,QAAQ,aAAa;AACvB,QAAI,MAAM,UAAU,QAAQ;AAC5B,YAAQ,IAAI,6BAA6B;AAAA,EAC3C;AAEA,UAAQ,IAAI,6BAA6B,IAAI,EAAE;AAE/C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;;;AFhBA,IAAM,UAAU,IAAI,yBAAQ;AAE5B,QAAQ,KAAK,gBAAY,IAAI,EAAE,YAAY,gBAAY,WAAW,EAAE,QAAQ,gBAAY,OAAO;AAE/F,QACG,QAAQ,OAAO,EACf,YAAY,sBAAsB,EAClC,OAAO,WAAW,8BAA8B,KAAK,EACrD,OAAO,uBAAuB,6BAA6B,MAAM,EACjE,OAAO,CAAC,YAAY;AACnB,QAAM,EAAE,KAAK,KAAK,IAAI,YAAY,SAAS,QAAQ,MAAM,EAAE,GAAG;AAAA,IAC5D,aAAa,QAAQ;AAAA,EACvB,CAAC;AAED,MAAI,MAAM,EAAE,OAAO,IAAI,OAAO,KAAK,CAAC;AACtC,CAAC;AAEH,QAAQ,MAAM,QAAQ,IAAI;","names":["import_hono","import_drizzle_orm"]}
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,184 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
2
7
|
|
|
3
|
-
// src/
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
// src/cli.ts
|
|
9
|
+
import { Command } from "commander";
|
|
10
|
+
|
|
11
|
+
// package.json
|
|
12
|
+
var package_default = {
|
|
13
|
+
bin: {
|
|
14
|
+
"solana-auth-oauth2-server": "dist/cli.js"
|
|
15
|
+
},
|
|
16
|
+
dependencies: {
|
|
17
|
+
"@libsql/client": "^0.17.0",
|
|
18
|
+
commander: "^14.0.2",
|
|
19
|
+
"drizzle-orm": "^0.45.1",
|
|
20
|
+
hono: "^4.11.5",
|
|
21
|
+
libsql: "^0.5.22"
|
|
22
|
+
},
|
|
23
|
+
devDependencies: {
|
|
24
|
+
"@biomejs/biome": "^2.3.11",
|
|
25
|
+
"@changesets/cli": "^2.29.8",
|
|
26
|
+
"@types/bun": "latest",
|
|
27
|
+
"drizzle-kit": "^0.31.8",
|
|
28
|
+
"pkg-pr-new": "^0.0.62",
|
|
29
|
+
publint: "^0.3.16",
|
|
30
|
+
tsup: "^8.5.1"
|
|
31
|
+
},
|
|
32
|
+
exports: {
|
|
33
|
+
".": {
|
|
34
|
+
import: {
|
|
35
|
+
types: "./dist/index.d.ts",
|
|
36
|
+
default: "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
require: {
|
|
39
|
+
types: "./dist/index.d.cts",
|
|
40
|
+
default: "./dist/index.cjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
files: ["dist"],
|
|
45
|
+
license: "MIT",
|
|
46
|
+
main: "./dist/index.cjs",
|
|
47
|
+
module: "./dist/index.js",
|
|
48
|
+
name: "solana-auth-oauth2-server",
|
|
49
|
+
description: "Solana Auth OAuth2 Server",
|
|
50
|
+
repository: {
|
|
51
|
+
type: "git",
|
|
52
|
+
url: "git+https://github.com/solana-auth/solana-auth-oauth2-server.git"
|
|
53
|
+
},
|
|
54
|
+
peerDependencies: {
|
|
55
|
+
typescript: "^5"
|
|
56
|
+
},
|
|
57
|
+
scripts: {
|
|
58
|
+
build: "tsup",
|
|
59
|
+
changeset: "changeset",
|
|
60
|
+
"check-types": "tsc -b --noEmit",
|
|
61
|
+
"db:generate": "drizzle-kit generate",
|
|
62
|
+
"db:migrate": "drizzle-kit migrate",
|
|
63
|
+
"db:push": "drizzle-kit push",
|
|
64
|
+
"db:seed": "bun src/seed.ts",
|
|
65
|
+
"db:studio": "drizzle-kit studio",
|
|
66
|
+
lint: "biome check --error-on-warnings",
|
|
67
|
+
"lint:fix": "biome check --error-on-warnings --write",
|
|
68
|
+
release: "changeset publish",
|
|
69
|
+
test: "bun test ./test/",
|
|
70
|
+
"test:watch": "bun test --watch ./test/",
|
|
71
|
+
version: "changeset version && bun lint:fix"
|
|
72
|
+
},
|
|
73
|
+
type: "module",
|
|
74
|
+
types: "./dist/index.d.ts",
|
|
75
|
+
version: "0.0.0"
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/api.ts
|
|
79
|
+
import { Hono as Hono2 } from "hono";
|
|
80
|
+
|
|
81
|
+
// src/api-admin.ts
|
|
82
|
+
import { eq } from "drizzle-orm";
|
|
83
|
+
import { Hono } from "hono";
|
|
84
|
+
|
|
85
|
+
// src/db/index.ts
|
|
86
|
+
import { createClient } from "@libsql/client";
|
|
87
|
+
import { drizzle } from "drizzle-orm/libsql";
|
|
88
|
+
|
|
89
|
+
// src/db/schema/index.ts
|
|
90
|
+
var schema_exports = {};
|
|
91
|
+
__export(schema_exports, {
|
|
92
|
+
users: () => users
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// src/db/schema/users.ts
|
|
96
|
+
import { sql } from "drizzle-orm";
|
|
97
|
+
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
98
|
+
var users = sqliteTable("users", {
|
|
99
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`).notNull(),
|
|
100
|
+
email: text("email").notNull().unique(),
|
|
101
|
+
id: text("id").primaryKey(),
|
|
102
|
+
name: text("name").notNull(),
|
|
103
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`).$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// src/db/index.ts
|
|
107
|
+
var client = createClient({
|
|
108
|
+
authToken: process.env.DATABASE_AUTH_TOKEN,
|
|
109
|
+
url: process.env.DATABASE_URL || "file:local.db"
|
|
110
|
+
});
|
|
111
|
+
var db = drizzle(client, { schema: schema_exports });
|
|
112
|
+
|
|
113
|
+
// src/api-admin.ts
|
|
114
|
+
var apiAdmin = new Hono();
|
|
115
|
+
apiAdmin.get("/users", async (c) => {
|
|
116
|
+
const result = await db.select().from(users).all();
|
|
117
|
+
return c.json(result);
|
|
118
|
+
});
|
|
119
|
+
apiAdmin.get("/users/:id", async (c) => {
|
|
120
|
+
const id = c.req.param("id");
|
|
121
|
+
const result = await db.select().from(users).where(eq(users.id, id)).get();
|
|
122
|
+
if (!result) {
|
|
123
|
+
return c.json({ error: "User not found" }, 404);
|
|
124
|
+
}
|
|
125
|
+
return c.json(result);
|
|
126
|
+
});
|
|
127
|
+
apiAdmin.post("/users", async (c) => {
|
|
128
|
+
const body = await c.req.json();
|
|
129
|
+
if (!body.id || !body.email || !body.name) {
|
|
130
|
+
return c.json({ error: "Missing required fields: id, name, email" }, 400);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const result = await db.insert(users).values({
|
|
134
|
+
email: body.email,
|
|
135
|
+
id: body.id,
|
|
136
|
+
name: body.name
|
|
137
|
+
}).returning().get();
|
|
138
|
+
return c.json(result, 201);
|
|
139
|
+
} catch (err) {
|
|
140
|
+
if (err instanceof Error) {
|
|
141
|
+
if (err.message?.includes("UNIQUE constraint failed")) {
|
|
142
|
+
return c.json({ error: "User already exists" }, 409);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return c.json({ error: "Failed to create user" }, 500);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
apiAdmin.delete("/users/:id", async (c) => {
|
|
149
|
+
const id = c.req.param("id");
|
|
150
|
+
const result = await db.delete(users).where(eq(users.id, id)).returning().get();
|
|
151
|
+
if (!result) {
|
|
152
|
+
return c.json({ error: "User not found" }, 404);
|
|
153
|
+
}
|
|
154
|
+
return c.json({ message: "User deleted" });
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// src/api.ts
|
|
158
|
+
function startServer(port = 3e3, options = {}) {
|
|
159
|
+
const app = new Hono2();
|
|
160
|
+
app.get("/", (c) => {
|
|
161
|
+
return c.text("Hello Hono!");
|
|
162
|
+
});
|
|
163
|
+
if (options.enableAdmin) {
|
|
164
|
+
app.route("/admin", apiAdmin);
|
|
165
|
+
console.log("Admin API enabled at /admin");
|
|
166
|
+
}
|
|
167
|
+
console.log(`Server is running on port ${port}`);
|
|
168
|
+
return {
|
|
169
|
+
app,
|
|
170
|
+
port
|
|
171
|
+
};
|
|
6
172
|
}
|
|
7
173
|
|
|
8
174
|
// src/cli.ts
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
175
|
+
var program = new Command();
|
|
176
|
+
program.name(package_default.name).description(package_default.description).version(package_default.version);
|
|
177
|
+
program.command("start").description("Start the API server").option("--admin", "Enable admin API endpoints", false).option("-p, --port <number>", "Port to run the server on", "3000").action((options) => {
|
|
178
|
+
const { app, port } = startServer(parseInt(options.port, 10), {
|
|
179
|
+
enableAdmin: options.admin
|
|
180
|
+
});
|
|
181
|
+
Bun.serve({ fetch: app.fetch, port });
|
|
182
|
+
});
|
|
183
|
+
program.parse(process.argv);
|
|
14
184
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../package.json","../src/api.ts","../src/api-admin.ts","../src/db/index.ts","../src/db/schema/index.ts","../src/db/schema/users.ts"],"sourcesContent":["#!/usr/bin/env bun\nimport { Command } from 'commander'\nimport packageJson from '../package.json' with { type: 'json' }\nimport { startServer } from './api.ts'\n\nconst program = new Command()\n\nprogram.name(packageJson.name).description(packageJson.description).version(packageJson.version)\n\nprogram\n .command('start')\n .description('Start the API server')\n .option('--admin', 'Enable admin API endpoints', false)\n .option('-p, --port <number>', 'Port to run the server on', '3000')\n .action((options) => {\n const { app, port } = startServer(parseInt(options.port, 10), {\n enableAdmin: options.admin,\n })\n\n Bun.serve({ fetch: app.fetch, port })\n })\n\nprogram.parse(process.argv)\n","{\n \"bin\": {\n \"solana-auth-oauth2-server\": \"dist/cli.js\"\n },\n \"dependencies\": {\n \"@libsql/client\": \"^0.17.0\",\n \"commander\": \"^14.0.2\",\n \"drizzle-orm\": \"^0.45.1\",\n \"hono\": \"^4.11.5\",\n \"libsql\": \"^0.5.22\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.3.11\",\n \"@changesets/cli\": \"^2.29.8\",\n \"@types/bun\": \"latest\",\n \"drizzle-kit\": \"^0.31.8\",\n \"pkg-pr-new\": \"^0.0.62\",\n \"publint\": \"^0.3.16\",\n \"tsup\": \"^8.5.1\"\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n }\n },\n \"files\": [\"dist\"],\n \"license\": \"MIT\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"name\": \"solana-auth-oauth2-server\",\n \"description\": \"Solana Auth OAuth2 Server\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/solana-auth/solana-auth-oauth2-server.git\"\n },\n \"peerDependencies\": {\n \"typescript\": \"^5\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"changeset\": \"changeset\",\n \"check-types\": \"tsc -b --noEmit\",\n \"db:generate\": \"drizzle-kit generate\",\n \"db:migrate\": \"drizzle-kit migrate\",\n \"db:push\": \"drizzle-kit push\",\n \"db:seed\": \"bun src/seed.ts\",\n \"db:studio\": \"drizzle-kit studio\",\n \"lint\": \"biome check --error-on-warnings\",\n \"lint:fix\": \"biome check --error-on-warnings --write\",\n \"release\": \"changeset publish\",\n \"test\": \"bun test ./test/\",\n \"test:watch\": \"bun test --watch ./test/\",\n \"version\": \"changeset version && bun lint:fix\"\n },\n \"type\": \"module\",\n \"types\": \"./dist/index.d.ts\",\n \"version\": \"0.0.0\"\n}\n","import { Hono } from 'hono'\nimport { apiAdmin } from './api-admin.ts'\n\nexport function startServer(port: number = 3000, options: { enableAdmin?: boolean } = {}) {\n const app = new Hono()\n\n app.get('/', (c) => {\n return c.text('Hello Hono!')\n })\n\n if (options.enableAdmin) {\n app.route('/admin', apiAdmin)\n console.log('Admin API enabled at /admin')\n }\n\n console.log(`Server is running on port ${port}`)\n\n return {\n app,\n port,\n }\n}\n","import { eq } from 'drizzle-orm'\nimport { Hono } from 'hono'\nimport { db } from './db/index.ts'\nimport { users } from './db/schema/index.ts'\n\nexport const apiAdmin = new Hono()\n\n// List users\napiAdmin.get('/users', async (c) => {\n const result = await db.select().from(users).all()\n return c.json(result)\n})\n\n// Get user by ID\napiAdmin.get('/users/:id', async (c) => {\n const id = c.req.param('id')\n const result = await db.select().from(users).where(eq(users.id, id)).get()\n\n if (!result) {\n return c.json({ error: 'User not found' }, 404)\n }\n\n return c.json(result)\n})\n\n// Create user\napiAdmin.post('/users', async (c) => {\n const body = await c.req.json()\n\n if (!body.id || !body.email || !body.name) {\n return c.json({ error: 'Missing required fields: id, name, email' }, 400)\n }\n\n try {\n const result = await db\n .insert(users)\n .values({\n email: body.email,\n id: body.id,\n name: body.name,\n })\n .returning()\n .get()\n\n return c.json(result, 201)\n } catch (err) {\n if (err instanceof Error) {\n if (err.message?.includes('UNIQUE constraint failed')) {\n return c.json({ error: 'User already exists' }, 409)\n }\n }\n return c.json({ error: 'Failed to create user' }, 500)\n }\n})\n\n// Delete user\napiAdmin.delete('/users/:id', async (c) => {\n const id = c.req.param('id')\n\n const result = await db.delete(users).where(eq(users.id, id)).returning().get()\n\n if (!result) {\n return c.json({ error: 'User not found' }, 404)\n }\n\n return c.json({ message: 'User deleted' })\n})\n","import { createClient } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport * as schema from './schema/index.ts'\n\nconst client = createClient({\n authToken: process.env.DATABASE_AUTH_TOKEN,\n url: process.env.DATABASE_URL || 'file:local.db',\n})\n\nexport const db = drizzle(client, { schema })\n","export * from './users.ts'\n","import { sql } from 'drizzle-orm'\nimport { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'\n\nexport const users = sqliteTable('users', {\n createdAt: integer('created_at', { mode: 'timestamp_ms' })\n .default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)\n .notNull(),\n email: text('email').notNull().unique(),\n id: text('id').primaryKey(),\n name: text('name').notNull(),\n updatedAt: integer('updated_at', { mode: 'timestamp_ms' })\n .default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)\n .$onUpdate(() => new Date())\n .notNull(),\n})\n"],"mappings":";;;;;;;;AACA,SAAS,eAAe;;;ACDxB;AAAA,EACE,KAAO;AAAA,IACL,6BAA6B;AAAA,EAC/B;AAAA,EACA,cAAgB;AAAA,IACd,kBAAkB;AAAA,IAClB,WAAa;AAAA,IACb,eAAe;AAAA,IACf,MAAQ;AAAA,IACR,QAAU;AAAA,EACZ;AAAA,EACA,iBAAmB;AAAA,IACjB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,cAAc;AAAA,IACd,SAAW;AAAA,IACX,MAAQ;AAAA,EACV;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,QAAU;AAAA,QACR,OAAS;AAAA,QACT,SAAW;AAAA,MACb;AAAA,MACA,SAAW;AAAA,QACT,OAAS;AAAA,QACT,SAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAS,CAAC,MAAM;AAAA,EAChB,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,kBAAoB;AAAA,IAClB,YAAc;AAAA,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AI,CAAC,QAAQ;AACX,WAAO,EAAE,KAAK,EAAE,OAAO,iBAAiB,GAAG,GAAG;AAAA,EAChD;AAEA,SAAO,EAAE,KAAK,EAAE,SAAS,eAAe,CAAC;AAC3C,CAAC;;;AD/DM,SAAS,YAAY,OAAe,KAAM,UAAqC,CAAC,GAAG;AACxF,QAAM,MAAM,IAAIC,MAAK;AAErB,MAAI,IAAI,KAAK,CAAC,MAAM;AAClB,WAAO,EAAE,KAAK,aAAa;AAAA,EAC7B,CAAC;AAED,MAAI,QAAQ,aAAa;AACvB,QAAI,MAAM,UAAU,QAAQ;AAC5B,YAAQ,IAAI,6BAA6B;AAAA,EAC3C;AAEA,UAAQ,IAAI,6BAA6B,IAAI,EAAE;AAE/C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;;;AFhBA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QAAQ,KAAK,gBAAY,IAAI,EAAE,YAAY,gBAAY,WAAW,EAAE,QAAQ,gBAAY,OAAO;AAE/F,QACG,QAAQ,OAAO,EACf,YAAY,sBAAsB,EAClC,OAAO,WAAW,8BAA8B,KAAK,EACrD,OAAO,uBAAuB,6BAA6B,MAAM,EACjE,OAAO,CAAC,YAAY;AACnB,QAAM,EAAE,KAAK,KAAK,IAAI,YAAY,SAAS,QAAQ,MAAM,EAAE,GAAG;AAAA,IAC5D,aAAa,QAAQ;AAAA,EACvB,CAAC;AAED,MAAI,MAAM,EAAE,OAAO,IAAI,OAAO,KAAK,CAAC;AACtC,CAAC;AAEH,QAAQ,MAAM,QAAQ,IAAI;","names":["Hono","Hono"]}
|
package/package.json
CHANGED
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
"bin": {
|
|
3
3
|
"solana-auth-oauth2-server": "dist/cli.js"
|
|
4
4
|
},
|
|
5
|
-
"dependencies": {
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@libsql/client": "^0.17.0",
|
|
7
|
+
"commander": "^14.0.2",
|
|
8
|
+
"drizzle-orm": "^0.45.1",
|
|
9
|
+
"hono": "^4.11.5",
|
|
10
|
+
"libsql": "^0.5.22"
|
|
11
|
+
},
|
|
6
12
|
"devDependencies": {
|
|
7
13
|
"@biomejs/biome": "^2.3.11",
|
|
8
14
|
"@changesets/cli": "^2.29.8",
|
|
9
15
|
"@types/bun": "latest",
|
|
16
|
+
"drizzle-kit": "^0.31.8",
|
|
10
17
|
"pkg-pr-new": "^0.0.62",
|
|
11
18
|
"publint": "^0.3.16",
|
|
12
19
|
"tsup": "^8.5.1"
|
|
@@ -23,11 +30,14 @@
|
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
32
|
},
|
|
26
|
-
"files": [
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
27
36
|
"license": "MIT",
|
|
28
37
|
"main": "./dist/index.cjs",
|
|
29
38
|
"module": "./dist/index.js",
|
|
30
39
|
"name": "solana-auth-oauth2-server",
|
|
40
|
+
"description": "Solana Auth OAuth2 Server",
|
|
31
41
|
"repository": {
|
|
32
42
|
"type": "git",
|
|
33
43
|
"url": "git+https://github.com/solana-auth/solana-auth-oauth2-server.git"
|
|
@@ -39,14 +49,19 @@
|
|
|
39
49
|
"build": "tsup",
|
|
40
50
|
"changeset": "changeset",
|
|
41
51
|
"check-types": "tsc -b --noEmit",
|
|
52
|
+
"db:generate": "drizzle-kit generate",
|
|
53
|
+
"db:migrate": "drizzle-kit migrate",
|
|
54
|
+
"db:push": "drizzle-kit push",
|
|
55
|
+
"db:seed": "bun src/seed.ts",
|
|
56
|
+
"db:studio": "drizzle-kit studio",
|
|
42
57
|
"lint": "biome check --error-on-warnings",
|
|
43
58
|
"lint:fix": "biome check --error-on-warnings --write",
|
|
44
59
|
"release": "changeset publish",
|
|
45
|
-
"test": "bun test",
|
|
46
|
-
"test:watch": "bun test --watch",
|
|
60
|
+
"test": "bun test ./test/",
|
|
61
|
+
"test:watch": "bun test --watch ./test/",
|
|
47
62
|
"version": "changeset version && bun lint:fix"
|
|
48
63
|
},
|
|
49
64
|
"type": "module",
|
|
50
65
|
"types": "./dist/index.d.ts",
|
|
51
|
-
"version": "0.
|
|
66
|
+
"version": "0.1.0-canary-20260124204405"
|
|
52
67
|
}
|