@getstrata/core 0.5.47 → 0.5.49

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 CHANGED
@@ -44,6 +44,29 @@ Exports for admin dashboards and queue recovery:
44
44
  ```bash
45
45
  bun run build:framework
46
46
  bun run verify:framework # build + public API tests
47
+ bun run verify:shared-subpaths # after build: confirm singleton shims
48
+ ```
49
+
50
+ ## Subpath imports
51
+
52
+ `@getstrata/core` publishes **139+ subpaths** (for example `@getstrata/core/http/authMiddleware`,
53
+ `@getstrata/core/database/migrations`). Prefer subpaths over the root import in apps, bootstrap, and tests.
54
+
55
+ Some subpaths **re-export the main bundle** so singleton state stays shared (database pool binding,
56
+ `AsyncLocalStorage` auth/tenant context, global registries, `HttpError` / `Notification` classes for
57
+ `instanceof`). The canonical list lives in `scripts/core-shared-subpaths.ts` and is verified by
58
+ `scripts/verify-core-shared-subpaths.ts` after each framework build.
59
+
60
+ When adding a subpath that owns process-wide state or base classes used with `instanceof`, append it to
61
+ `CORE_SHARED_SUBPATHS`, run `bun scripts/sync-package-subpaths.ts`, and rebuild. Non-shared subpath
62
+ bundles are built with `--external @getstrata/core` so explicit package imports resolve through the
63
+ same entry graph at runtime.
64
+
65
+ ```typescript
66
+ import { createAuthMiddleware } from "@getstrata/core/http/authMiddleware";
67
+ import { bindDatabaseConnection } from "@getstrata/core/database/bindConnection";
68
+ import { ValidationError } from "@getstrata/core/errors/http";
69
+ import type { Migration } from "@getstrata/core/database/migrations/types";
47
70
  ```
48
71
 
49
72
  ## Publish to npm
@@ -174,9 +174,6 @@ function runWithTenant(tenant, callback) {
174
174
  function currentTenant() {
175
175
  return tenantContext.getStore() ?? null;
176
176
  }
177
- function currentTenantId() {
178
- return currentTenant()?.id ?? 1;
179
- }
180
177
  function rateLimitMultiplierForPlan(plan) {
181
178
  switch (plan) {
182
179
  case "enterprise":