@getstrata/core 0.5.53 → 0.5.55

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
@@ -14,17 +14,16 @@ Set `DATABASE_URL` before importing (connection is created lazily on first query
14
14
  ```typescript
15
15
  process.env.DATABASE_URL ??= "postgresql://postgres:postgres@localhost:5432/myapp";
16
16
 
17
- import {
18
- AdminResourceRegistry,
19
- BaseRepository,
20
- EtaViewEngine,
21
- FormRequest,
22
- Policy,
23
- formatAdminValue,
24
- mailer,
25
- storage,
26
- withErrorHandling,
27
- } from "@getstrata/core";
17
+ import { AdminResourceRegistry } from "@getstrata/core/admin/registry";
18
+ import { formatAdminValue } from "@getstrata/core/admin/formatValue";
19
+ import { Policy } from "@getstrata/core/auth/policy";
20
+ import { BaseRepository } from "@getstrata/core/database/baseRepository";
21
+ import { mail } from "@getstrata/core/facades";
22
+ import { FormRequest } from "@getstrata/core/http/formRequest";
23
+ import { withErrorHandling } from "@getstrata/core/http/response";
24
+ import { mailer } from "@getstrata/core/mail/mailer";
25
+ import { storage } from "@getstrata/core/facades";
26
+ import { EtaViewEngine } from "@getstrata/core/view";
28
27
  ```
29
28
 
30
29
  **Dependency:** `eta` is bundled as a direct dependency of `@getstrata/core`. Apps do not need to list it separately. The database driver is your app's choice. WorkHub and getstrata use **Bun's built-in `Bun.sql`** client; bind it with `bindDatabaseConnection()`.
@@ -49,7 +48,7 @@ bun run verify:shared-subpaths # after build: confirm singleton shims
49
48
 
50
49
  ## Subpath imports
51
50
 
52
- `@getstrata/core` publishes **143+ subpaths** (for example `@getstrata/core/http/authMiddleware`,
51
+ `@getstrata/core` publishes **144+ subpaths** (for example `@getstrata/core/http/authMiddleware`,
53
52
  `@getstrata/core/database/migrations`). Prefer subpaths over the root import in apps, bootstrap, and tests.
54
53
 
55
54
  Some subpaths **re-export the main bundle** so singleton state stays shared (database pool binding,
@@ -59,8 +58,13 @@ Some subpaths **re-export the main bundle** so singleton state stays shared (dat
59
58
 
60
59
  When adding a subpath that owns process-wide state or base classes used with `instanceof`, append it to
61
60
  `CORE_SHARED_SUBPATHS`, run `bun scripts/sync-package-subpaths.ts`, and rebuild. Non-shared subpath
62
- bundles are built with generated `--external @getstrata/core/*` flags so framework source can import
63
- shared modules via package self-imports (`scripts/codemod-core-self-imports.ts`).
61
+ bundles are built with generated `--external @getstrata/core/*` flags (all 144+ subpaths) so framework
62
+ source can import shared modules via package self-imports (`scripts/codemod-core-self-imports.ts`).
63
+ Bootstrap subpath builds externalize all `@getstrata/bootstrap/*` and `@getstrata/core/*` entries.
64
+ `scripts/verify-no-root-imports.ts` blocks root `@getstrata/core` imports in application source.
65
+ `scripts/verify-no-shared-barrel-imports.ts` blocks `@getstrata/core/database` and
66
+ `@getstrata/core/http` barrel imports in application source.
67
+ `scripts/audit-public-api-surface.ts` reports root exports with no in-repo root import usage.
64
68
  `scripts/verify-bundled-subpaths.ts` ensures entries like `http/webFormRequest` do not inline
65
69
  `ValidationError`.
66
70
 
@@ -9,19 +9,14 @@ export { FormRequest, QueryFormRequest } from "./formRequest";
9
9
  export type { Middleware, RouteHandler } from "./middleware";
10
10
  export { applyMiddlewareToRoutes, composeMiddleware, requestIdMiddleware, wrapRouteHandler, } from "./middleware";
11
11
  export { buildPaginationMeta, DEFAULT_PER_PAGE, MAX_PER_PAGE, paginatedResponse, parsePaginationQuery, } from "./pagination";
12
+ export type { ParsedUpload } from "./parseMultipartUpload";
13
+ export { parseMultipartUpload, sanitizeUploadFileName } from "./parseMultipartUpload";
12
14
  export { createRequireAuthMiddleware } from "./requireAuthMiddleware";
13
15
  export { serializeDate, toPaginatedResourceCollection, toResourceCollection } from "./resources";
16
+ export { createdResponse, errorResponse, jsonResponse, noContentResponse, withErrorHandling, } from "./response";
17
+ export type { RouteRequest } from "./route";
18
+ export { getRouteParams } from "./route";
14
19
  export { withMiddleware } from "./routeMiddleware";
15
20
  export { bindRouteModel } from "./routeModelBinding";
16
21
  export { securedBindRouteModel, securedBindRouteModelByKey, } from "./securedRouteModelBinding";
17
22
  export { buildRequestCacheKey, expectObject, getQueryParams, parseJsonBody, parseOptionalBooleanQueryParam, parseOptionalEnumQueryParam, parseOptionalPositiveIntQueryParam, parsePositiveIntParam, readOptionalEnum, readOptionalPositiveInt, readOptionalString, readRequiredEnum, readRequiredPositiveInt, readRequiredString, } from "./validation";
18
- declare function jsonResponse(data: unknown, init?: ResponseInit): Response;
19
- declare function createdResponse(data: unknown, init?: ResponseInit): Response;
20
- declare function noContentResponse(): Response;
21
- declare function errorResponse(error: unknown): Response;
22
- declare function withErrorHandling<TArgs extends unknown[]>(handler: (...args: TArgs) => Response | Promise<Response>): (...args: TArgs) => Promise<Response>;
23
- export type { ParsedUpload } from "./parseMultipartUpload";
24
- export { parseMultipartUpload, sanitizeUploadFileName } from "./parseMultipartUpload";
25
- export type { RouteRequest } from "./route";
26
- export { getRouteParams } from "./route";
27
- export { createdResponse, errorResponse, jsonResponse, noContentResponse, withErrorHandling };
@@ -0,0 +1,6 @@
1
+ declare function jsonResponse(data: unknown, init?: ResponseInit): Response;
2
+ declare function createdResponse(data: unknown, init?: ResponseInit): Response;
3
+ declare function noContentResponse(): Response;
4
+ declare function errorResponse(error: unknown): Response;
5
+ declare function withErrorHandling<TArgs extends unknown[]>(handler: (...args: TArgs) => Response | Promise<Response>): (...args: TArgs) => Promise<Response>;
6
+ export { createdResponse, errorResponse, jsonResponse, noContentResponse, withErrorHandling };
@@ -1,4 +1,4 @@
1
- import { BaseRepository } from "@getstrata/core/database";
1
+ import { BaseRepository } from "@getstrata/core/database/baseRepository";
2
2
  import type { FailedJobRecord } from "./types";
3
3
  declare class FailedJobRepository extends BaseRepository<FailedJobRecord, "id"> {
4
4
  constructor();
@@ -1,3 +1,3 @@
1
1
  import type { FailedJobRecord } from "./types";
2
- declare const failedJobTable: import("@getstrata/core/database").TableDefinition<FailedJobRecord, "id">;
2
+ declare const failedJobTable: import("@getstrata/core/database/table").TableDefinition<FailedJobRecord, "id">;
3
3
  export { failedJobTable };
@@ -76,7 +76,7 @@ function isFeatureEnabled(feature) {
76
76
  }
77
77
 
78
78
  // ../../src/modules/user/apiTokenRepository.ts
79
- import { BaseRepository } from "@getstrata/core/database";
79
+ import { BaseRepository } from "@getstrata/core/database/baseRepository";
80
80
 
81
81
  // ../../src/config/database.ts
82
82
  function readInteger(name, fallback) {
@@ -202,7 +202,7 @@ var db = new Proxy(function database() {}, {
202
202
  var connection_default = db;
203
203
 
204
204
  // ../../src/modules/user/apiTokenTable.ts
205
- import { defineTable } from "@getstrata/core/database";
205
+ import { defineTable } from "@getstrata/core/database/table";
206
206
  var apiTokenTable = defineTable({
207
207
  name: "api_token",
208
208
  primaryKey: "id",
@@ -320,10 +320,10 @@ class AuthService {
320
320
  }
321
321
 
322
322
  // ../../src/modules/user/notificationRepository.ts
323
- import { BaseRepository as BaseRepository2 } from "@getstrata/core/database";
323
+ import { BaseRepository as BaseRepository2 } from "@getstrata/core/database/baseRepository";
324
324
 
325
325
  // ../../src/modules/user/notificationTable.ts
326
- import { defineTable as defineTable2 } from "@getstrata/core/database";
326
+ import { defineTable as defineTable2 } from "@getstrata/core/database/table";
327
327
  var notificationTable = defineTable2({
328
328
  name: "notification",
329
329
  primaryKey: "id",
@@ -335,7 +335,8 @@ var notificationTable = defineTable2({
335
335
  import { NotFoundError } from "@getstrata/core/errors/http";
336
336
 
337
337
  // ../../src/modules/user/oauthIdentityRepository.ts
338
- import { BaseRepository as BaseRepository3, defineTable as defineTable3 } from "@getstrata/core/database";
338
+ import { BaseRepository as BaseRepository3 } from "@getstrata/core/database/baseRepository";
339
+ import { defineTable as defineTable3 } from "@getstrata/core/database/table";
339
340
  var oauthIdentityTable = defineTable3({
340
341
  name: "oauth_identity",
341
342
  primaryKey: "id",
@@ -349,11 +350,11 @@ import {
349
350
  revealEmail
350
351
  } from "@getstrata/core/crypto/fieldEncryption";
351
352
  import { revealMfaSecret as revealMfaSecret2 } from "@getstrata/core/crypto/mfaSecret";
352
- import { BaseRepository as BaseRepository4 } from "@getstrata/core/database";
353
+ import { BaseRepository as BaseRepository4 } from "@getstrata/core/database/baseRepository";
353
354
  import { currentTenantId as currentTenantId2 } from "@getstrata/core/tenant/tenantContext";
354
355
 
355
356
  // ../../src/modules/user/table.ts
356
- import { defineTable as defineTable4 } from "@getstrata/core/database";
357
+ import { defineTable as defineTable4 } from "@getstrata/core/database/table";
357
358
  var userTable = defineTable4({
358
359
  name: "users",
359
360
  primaryKey: "id",