@getstrata/core 0.5.54 → 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 +14 -13
- package/dist/core/http/index.d.ts +5 -10
- package/dist/core/http/response.d.ts +6 -0
- package/dist/entries/http/response.js +880 -0
- package/dist/framework/public-api.d.ts +2 -1
- package/dist/index.js +244 -244
- package/package.json +7 -2
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 **
|
|
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,10 +58,12 @@ 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 (all
|
|
61
|
+
bundles are built with generated `--external @getstrata/core/*` flags (all 144+ subpaths) so framework
|
|
63
62
|
source can import shared modules via package self-imports (`scripts/codemod-core-self-imports.ts`).
|
|
64
63
|
Bootstrap subpath builds externalize all `@getstrata/bootstrap/*` and `@getstrata/core/*` entries.
|
|
65
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.
|
|
66
67
|
`scripts/audit-public-api-surface.ts` reports root exports with no in-repo root import usage.
|
|
67
68
|
`scripts/verify-bundled-subpaths.ts` ensures entries like `http/webFormRequest` do not inline
|
|
68
69
|
`ValidationError`.
|
|
@@ -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 };
|