@brickkit/core 0.15.0 → 0.16.0-beta.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.
@@ -1,4 +1,4 @@
1
- import { E as Logger, J as ValidationErrorItem, Nn as PluginInstance, Nt as DatabaseHandle, R as Service, Vn as SecretSource, _n as ServicePort, ht as EventsHub, jr as HttpMethod, mt as EventsDefinition, nn as InstalledPlugin, or as EventsOptions, ot as SocketBroker, rt as BrickSocketSchema, t as Action, wt as DashboardUser } from "./types.js";
1
+ import { Gt as DatabaseHandle, Nn as ServicePort, O as Logger, V as Service, Vt as Sensitivity, Xr as SecretSource, Z as ValidationErrorItem, _t as EventsDefinition, jt as DashboardUser, lt as SocketBroker, mn as InstalledPlugin, ot as BrickSocketSchema, ri as HttpMethod, t as Action, tr as PluginInstance, vt as EventsHub, wt as ClientIp, yr as EventsOptions } from "./types.js";
2
2
  import { Elysia } from "elysia";
3
3
  type RouteMethod = HttpMethod;
4
4
  /** How a string from a query or form field becomes the schema's type; objects travel as JSON. */
@@ -8,7 +8,8 @@ interface RouteIR {
8
8
  readonly path: string;
9
9
  readonly service: string;
10
10
  readonly action: string;
11
- readonly kind: "action";
11
+ /** A `webhook` has a verified raw body; see `service.webhook`. */
12
+ readonly kind: "action" | "webhook";
12
13
  /** The plugin that registered the action, if one did. */
13
14
  readonly plugin?: string;
14
15
  readonly input: boolean;
@@ -25,7 +26,7 @@ interface RouteIR {
25
26
  /** How each item of an `array` field is coerced. */
26
27
  readonly items?: Exclude<Coercion, "array">;
27
28
  }[];
28
- /** The most bytes a multipart body may declare (`Content-Length`) for an input with `t.File` fields. */
29
+ /** The most bytes a body may have: multipart bodies with `t.File` fields (by `Content-Length`), and a webhook's (counted as read). */
29
30
  readonly bodyLimit?: number;
30
31
  /** JSON projection for inspection and stale-artifact detection, not runtime validation. */
31
32
  readonly inputSchema?: unknown;
@@ -264,6 +265,7 @@ interface CompiledRoutePlan {
264
265
  readonly contextHook?: (baseCtx: any) => unknown;
265
266
  readonly inputChecker?: Checker;
266
267
  readonly outputChecker?: Checker;
268
+ readonly sensitive?: Sensitivity;
267
269
  /** A plugin's check that runs before `inputChecker`. */
268
270
  readonly checkInput?: (input: unknown) => ValidationErrorItem[] | undefined;
269
271
  readonly errorBuilder: unknown;
@@ -409,12 +411,6 @@ interface CreateServerOptions {
409
411
  broker?: SocketBroker;
410
412
  secret?: string;
411
413
  };
412
- /**
413
- * The values of the services' declared `deps` (`port<T>()`), by name. Every
414
- * declared dep must be provided, and every provided one declared. Actions read
415
- * them as `ctx.deps`, listeners and workflow steps with `useDeps()`.
416
- */
417
- deps?: Record<string, unknown>;
418
414
  /**
419
415
  * App-wide plugins from `definePlugin`, in install order: their `app` part
420
416
  * adds start/stop lifecycle, middleware and listeners. Plugins installed with
@@ -428,6 +424,15 @@ interface CreateServerOptions {
428
424
  * Other origins get no `Access-Control-Allow-Origin`. Preflights are answered.
429
425
  */
430
426
  cors?: false | CorsOptions;
427
+ /**
428
+ * Where the client address is, for `rateLimit: { per: "ip" }`. By default it
429
+ * is the socket peer; behind a proxy, read the header your proxy sets. Brick
430
+ * never reads `X-Forwarded-For` or any other header itself.
431
+ *
432
+ * @example
433
+ * clientIp: ({ request, peer }) => request.headers.get("fly-client-ip") ?? peer,
434
+ */
435
+ clientIp?: ClientIp;
431
436
  }
432
437
  /**
433
438
  * Create the HTTP application: an Elysia app that serves every service's
@@ -443,11 +448,11 @@ interface CreateServerOptions {
443
448
  * @param options - `prefix` for action routes (default `/api`), `services`,
444
449
  * `title`, `version`, and `description` for the OpenAPI document, `docs` and the
445
450
  * paths of its pages, `requestLogging`, `reference`, `endpoints`, `secrets`,
446
- * `telemetry`, `documentation`, `dashboard`, and `deps`. See `CreateServerOptions`.
451
+ * `telemetry`, `documentation`, and `dashboard`. See `CreateServerOptions`.
447
452
  * @returns The app, with `definition` (its services, prefix, and routes),
448
453
  * `endpoint()` to add raw routes, and `listEndpoints()` to list them.
449
454
  * @throws When a required secret is missing, `documentation` or `dashboard`
450
- * is invalid, or `deps` misses a dep a service declares or has one none declares.
455
+ * is invalid, or `deps` is passed (it moved to `defineService({ deps })`).
451
456
  * @example
452
457
  * import { brick } from "@brickkit/core";
453
458
  * import { pagesService } from "./services/pages";
@@ -459,5 +464,4 @@ interface CreateServerOptions {
459
464
  * });
460
465
  */
461
466
  declare function brick(options?: CreateServerOptions): BrickApp;
462
- export { scalarDocsHTML as A, ApiDocument as C, ReferenceOptions as D, ReferenceDocument as E, RouteIR as M, RouteMethod as N, referencePlugin as O, DashboardOptions as S, OpenApiDocument as T, EndpointContext as _, RequestLoggingOptions as a, EndpointMethod as b, CompiledRoute as c, loadCompiledBrickApp as d, CompiledHandler as f, BrickApp as g, deny as h, CorsOrigin as i, BrickIR as j, registerReferenceRoute as k, bindCompiledApplication as l, HandlerFactory as m, brick as n, requestLoggingPlugin as o, CompiledRoutePlan as p, CorsOptions as r, CompiledApplication as s, CreateServerOptions as t, compileBrickApplication as u, EndpointDefinition as v, DocumentationOptions as w, DashboardAuth as x, EndpointLogger as y };
463
- //# sourceMappingURL=server.d.ts.map
467
+ export { scalarDocsHTML as A, ApiDocument as C, ReferenceOptions as D, ReferenceDocument as E, RouteIR as M, RouteMethod as N, referencePlugin as O, DashboardOptions as S, OpenApiDocument as T, EndpointContext as _, RequestLoggingOptions as a, EndpointMethod as b, CompiledRoute as c, loadCompiledBrickApp as d, CompiledHandler as f, BrickApp as g, deny as h, CorsOrigin as i, BrickIR as j, registerReferenceRoute as k, bindCompiledApplication as l, HandlerFactory as m, brick as n, requestLoggingPlugin as o, CompiledRoutePlan as p, CorsOptions as r, CompiledApplication as s, CreateServerOptions as t, compileBrickApplication as u, EndpointDefinition as v, DocumentationOptions as w, DashboardAuth as x, EndpointLogger as y };