@hasna/shortlinks 0.1.23 → 0.1.24
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 +26 -1
- package/dist/cli/index.js +2601 -2380
- package/dist/cloudflare.js +141 -4
- package/dist/db/migrations.d.ts +20 -0
- package/dist/generated/storage-kit/health.d.ts +19 -0
- package/dist/generated/storage-kit/index.d.ts +7 -0
- package/dist/generated/storage-kit/migrations.d.ts +47 -0
- package/dist/generated/storage-kit/mode.d.ts +47 -0
- package/dist/generated/storage-kit/pool.d.ts +33 -0
- package/dist/generated/storage-kit/query.d.ts +35 -0
- package/dist/generated/storage-kit/tls.d.ts +25 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3124 -486
- package/dist/mcp/http.d.ts +16 -0
- package/dist/mcp/index.d.ts +14 -0
- package/dist/mcp/index.js +1493 -0
- package/dist/pg-store.d.ts +10 -0
- package/dist/pg-store.js +355 -40
- package/dist/runtime.js +33 -0
- package/dist/sdk/generated.d.ts +178 -0
- package/dist/sdk/index.d.ts +12 -0
- package/dist/sdk/index.js +500 -0
- package/dist/serve/app.d.ts +21 -0
- package/dist/serve/index.d.ts +14 -0
- package/dist/serve/index.js +8817 -0
- package/dist/serve/openapi.d.ts +8 -0
- package/dist/server.js +33 -0
- package/package.json +17 -4
package/README.md
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
# @hasna/shortlinks
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shortlink management for custom domains — CLI, MCP server, REST API, and a generated SDK.
|
|
4
4
|
|
|
5
5
|
`shortlinks` creates Bitly-style short URLs, supports multiple domains, records click analytics, can run a tiny redirect server, and includes helper commands for Cloudflare DNS/Workers and `@hasna/domains`. It defaults to local SQLite and can serve from an app-owned PostgreSQL database when `HASNA_SHORTLINKS_STORE=postgres` and `HASNA_SHORTLINKS_DATABASE_URL` are configured.
|
|
6
6
|
|
|
7
|
+
## Surfaces
|
|
8
|
+
|
|
9
|
+
Four surfaces share one core library:
|
|
10
|
+
|
|
11
|
+
| Surface | Bin / package | Purpose |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| CLI | `shortlinks` | Interactive/scriptable link + domain management (`--json` for agents). |
|
|
14
|
+
| MCP | `shortlinks-mcp` | Model Context Protocol server (stdio or `--http`) exposing link/domain tools to agents. |
|
|
15
|
+
| REST API | `shortlinks-serve` | HTTP service: `GET /health`, `/ready`, `/version`, `/openapi.json`, and a versioned `/v1` CRUD API guarded by API-key auth. |
|
|
16
|
+
| SDK | `@hasna/shortlinks-sdk` (+ `@hasna/shortlinks/sdk`) | Typed fetch client generated from the serve OpenAPI (`bun run sdk:generate`). |
|
|
17
|
+
|
|
18
|
+
### Cloud service (PURE REMOTE, Amendment A1)
|
|
19
|
+
|
|
20
|
+
`shortlinks-serve` reads/writes the shared cloud Postgres directly via the vendored `@hasna/contracts` storage kit — no sync engine or cache in the service. API-key auth comes from `@hasna/contracts/auth`; mint keys with `contracts issue-key --app shortlinks --scopes 'shortlinks:read,shortlinks:write'`.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
HASNA_SHORTLINKS_STORAGE_MODE=cloud \
|
|
24
|
+
HASNA_SHORTLINKS_DATABASE_URL=postgres://user:pass@host:5432/shortlinks?sslmode=require \
|
|
25
|
+
HASNA_SHORTLINKS_API_SIGNING_KEY=... \
|
|
26
|
+
shortlinks-serve # migrate (idempotent) then serve on :8080
|
|
27
|
+
shortlinks-serve migrate # one-shot migration task
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Client self_hosted mode uses `SHORTLINKS_API_URL` + `SHORTLINKS_API_KEY` (never a DSN).
|
|
31
|
+
|
|
7
32
|
[](https://www.npmjs.com/package/@hasna/shortlinks)
|
|
8
33
|
[](LICENSE)
|
|
9
34
|
|