@sudobility/ratelimit_service 1.0.20 → 1.0.22

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.
Files changed (2) hide show
  1. package/CLAUDE.md +47 -0
  2. package/package.json +3 -3
package/CLAUDE.md CHANGED
@@ -159,3 +159,50 @@ Consumers must:
159
159
  1. Copy schema from `@sudobility/ratelimit_service/schema` to their db/schema.ts
160
160
  2. Run migrations to create the `rate_limit_counters` table
161
161
  3. Configure middleware with their RevenueCat API key and rate limits config
162
+
163
+ ## Workspace Context
164
+
165
+ This project is part of the **ShapeShyft** multi-project workspace at the parent directory. See `../CLAUDE.md` for the full architecture, dependency graph, and build order.
166
+
167
+ ## Downstream Impact
168
+
169
+ | Downstream Consumer | Relationship |
170
+ |---------------------|-------------|
171
+ | `shapeshyft_api` | Direct dependency - uses rate limit middleware and schema |
172
+
173
+ After making changes:
174
+ 1. `bun run verify` in this project (includes tests)
175
+ 2. `npm publish`
176
+ 3. In `shapeshyft_api`: `bun update @sudobility/ratelimit_service` then rebuild
177
+
178
+ If you change the Drizzle schema template, downstream consumers must update their copied schema and run database migrations.
179
+
180
+ ## Local Dev Workflow
181
+
182
+ ```bash
183
+ # In this project:
184
+ bun link
185
+
186
+ # In shapeshyft_api:
187
+ bun link @sudobility/ratelimit_service
188
+
189
+ # Rebuild after changes:
190
+ bun run build
191
+
192
+ # When done, unlink:
193
+ bun unlink @sudobility/ratelimit_service && bun install
194
+ ```
195
+
196
+ ## Pre-Commit Checklist
197
+
198
+ ```bash
199
+ bun run verify # Runs: typecheck -> lint -> test -> build
200
+ ```
201
+
202
+ ## Gotchas
203
+
204
+ - **The title at the top of this file says "Subscription Service" but this is the Rate Limit Service** -- known copy-paste error.
205
+ - **Schema is a template, not a migration** -- consumers must copy it to their own `db/schema.ts`. Changes here do NOT automatically propagate.
206
+ - **`undefined` means unlimited** -- in rate limit configs, `undefined` for a period means no limit. Do not confuse with `0` (zero allowed).
207
+ - **Monthly periods are subscription-relative, not calendar-relative** -- intentional. Calendar-month fallback only applies when `subscriptionStartedAt` is null.
208
+ - **Multiple entitlements resolve to upper bound** -- the most permissive limit wins.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/ratelimit_service",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Shared rate limiting library based on RevenueCat entitlements",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -48,14 +48,14 @@
48
48
  "author": "Sudobility",
49
49
  "license": "BUSL-1.1",
50
50
  "peerDependencies": {
51
- "@sudobility/types": "^1.9.50",
51
+ "@sudobility/types": "^1.9.52",
52
52
  "drizzle-orm": "^0.45.0",
53
53
  "hono": "^4.0.0",
54
54
  "postgres": "^3.4.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "vitest": "^4.0.4",
58
- "@sudobility/types": "^1.9.50",
58
+ "@sudobility/types": "^1.9.52",
59
59
  "@types/bun": "latest",
60
60
  "@types/node": "^24.10.1",
61
61
  "@typescript-eslint/eslint-plugin": "^8.50.0",