@hasna/shortlinks 0.1.24 → 0.2.1
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 -21
- package/dist/cli/index.js +7886 -2010
- package/dist/client-store.d.ts +48 -0
- package/dist/cloud-store.d.ts +47 -0
- package/dist/db/migrations.d.ts +2 -2
- package/dist/generated/storage-kit/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7242 -921
- package/dist/mcp/http.d.ts +20 -5
- package/dist/mcp/index.d.ts +3 -2
- package/dist/mcp/index.js +6856 -848
- package/dist/pg-store.d.ts +8 -11
- package/dist/pg-store.js +7 -258
- package/dist/sdk/generated.d.ts +6 -0
- package/dist/sdk/index.js +25 -0
- package/dist/serve/index.js +42 -266
- package/dist/server.js +11 -0
- package/dist/store-interface.d.ts +42 -0
- package/dist/store.d.ts +1 -0
- package/package.json +4 -8
- package/dist/pg-migrations.d.ts +0 -1
- package/dist/runtime.d.ts +0 -65
- package/dist/runtime.js +0 -214
package/README.md
CHANGED
|
@@ -114,6 +114,12 @@ shortlinks domain add go.example.com --provider cloudflare
|
|
|
114
114
|
|
|
115
115
|
Generated links use the default domain unless `--domain` is passed.
|
|
116
116
|
|
|
117
|
+
Remove a domain (this also deletes all of its links and clicks):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
shortlinks domain remove go.example.com
|
|
121
|
+
```
|
|
122
|
+
|
|
117
123
|
## Cloudflare
|
|
118
124
|
|
|
119
125
|
Create a dry-run plan:
|
|
@@ -149,32 +155,28 @@ shortlinks domain buy new-short-domain.ai --dry-run
|
|
|
149
155
|
|
|
150
156
|
This package does not install or call any removed `connect-*` packages.
|
|
151
157
|
|
|
152
|
-
##
|
|
158
|
+
## Storage modes
|
|
153
159
|
|
|
154
|
-
|
|
160
|
+
The client resolves ONE `Store` from the environment — there is no DSN on any client:
|
|
155
161
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
- **local** (default): on-box SQLite. Every command, MCP tool, and SDK call reads
|
|
163
|
+
and writes the local database.
|
|
164
|
+
- **self_hosted / cloud**: set `HASNA_SHORTLINKS_API_URL` + `HASNA_SHORTLINKS_API_KEY`
|
|
165
|
+
(and optionally `HASNA_SHORTLINKS_STORAGE_MODE`) to route every call to the cloud
|
|
166
|
+
`/v1` HTTP API with a bearer key. `self_hosted` and `cloud` are identical client
|
|
167
|
+
code; only the URL/key differ.
|
|
160
168
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
shortlinks
|
|
164
|
-
|
|
169
|
+
```bash
|
|
170
|
+
# Route the client to the self-hosted cloud API (bearer key, never a DSN):
|
|
171
|
+
export HASNA_SHORTLINKS_API_URL=https://shortlinks.hasna.xyz
|
|
172
|
+
export HASNA_SHORTLINKS_API_KEY=hsk_...
|
|
173
|
+
export HASNA_SHORTLINKS_STORAGE_MODE=self_hosted
|
|
174
|
+
shortlinks doctor
|
|
165
175
|
```
|
|
166
176
|
|
|
167
|
-
The
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
For an apex domain that needs stable A records, `infra/aws-ec2-user-data.sh` bootstraps a small EC2 redirect origin with:
|
|
172
|
-
|
|
173
|
-
- `@hasna/shortlinks` installed through Bun
|
|
174
|
-
- direct reads and click writes against the app-owned `shortlinks` PostgreSQL database
|
|
175
|
-
- Caddy terminating HTTPS and proxying to `shortlinks serve`
|
|
176
|
-
|
|
177
|
-
The script reads the connection settings from AWS Secrets Manager through the instance role; it does not contain secret values.
|
|
177
|
+
The cloud server (`shortlinks-serve`, run on ECS Fargate) is the only component
|
|
178
|
+
that holds a Postgres connection, and it opens its pool server-side through the
|
|
179
|
+
sanctioned storage kit — the raw RDS DSN is never distributed to clients.
|
|
178
180
|
|
|
179
181
|
## Development
|
|
180
182
|
|