@brickkit/core 0.12.0 → 0.13.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.
- package/dist/chunks/client.d.ts +54 -13
- package/dist/chunks/client.js +382 -91
- package/dist/chunks/client.js.map +1 -1
- package/dist/chunks/server.d.ts +444 -0
- package/dist/chunks/server.js +1138 -1744
- package/dist/chunks/server.js.map +1 -1
- package/dist/chunks/types.d.ts +434 -630
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/index.d.ts +766 -5
- package/dist/index.js +532 -302
- package/dist/index.js.map +1 -1
- package/dist/tanstack-query.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -3
- package/dist/testing.js.map +1 -1
- package/dist/workflow.d.ts +74 -2
- package/package.json +2 -1
- package/dist/chunks/index.d.ts +0 -1106
- package/dist/chunks/workflow.d.ts +0 -74
package/dist/chunks/client.d.ts
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as BrickSocketConnectOptions, X as BrickSocketClient, Y as BrickClientSocket, bt as StandardErrorCode, c as ActionExecutionError, dr as HttpMethod, s as ActionErrorDefinition, t as Action } from "./types.js";
|
|
2
2
|
import { Static, TSchema } from "@sinclair/typebox";
|
|
3
|
+
/**
|
|
4
|
+
* The URL segment for a declared name: `orderBilling` becomes `order-billing`,
|
|
5
|
+
* `importCSV` becomes `import-csv`. Dots and existing dashes stay.
|
|
6
|
+
*/
|
|
7
|
+
declare function kebabCase(name: string): string;
|
|
8
|
+
declare const SPAN: {
|
|
9
|
+
/** `action <service>.<action>` */
|
|
10
|
+
readonly actionPrefix: "action ";
|
|
11
|
+
/** `rpc <service>.<action>` */
|
|
12
|
+
readonly rpcPrefix: "rpc ";
|
|
13
|
+
readonly exceptionEvent: "exception";
|
|
14
|
+
/** The span event a `ctx.logger` line becomes. */
|
|
15
|
+
readonly logEvent: "log";
|
|
16
|
+
};
|
|
17
|
+
declare const ATTR: {
|
|
18
|
+
readonly httpMethod: "http.request.method";
|
|
19
|
+
readonly httpRoute: "http.route";
|
|
20
|
+
readonly httpStatus: "http.response.status_code";
|
|
21
|
+
readonly urlPath: "url.path";
|
|
22
|
+
readonly service: "brick.service";
|
|
23
|
+
readonly action: "brick.action";
|
|
24
|
+
readonly traceId: "brick.trace_id";
|
|
25
|
+
readonly errorCode: "brick.error.code";
|
|
26
|
+
readonly errorMessage: "brick.error.message";
|
|
27
|
+
readonly errorStatus: "brick.error.status";
|
|
28
|
+
readonly logsDropped: "brick.logs.dropped";
|
|
29
|
+
readonly dbStatement: "db.statement";
|
|
30
|
+
readonly dbSystem: "db.system";
|
|
31
|
+
readonly dbOperation: "db.operation";
|
|
32
|
+
readonly exceptionMessage: "exception.message";
|
|
33
|
+
readonly exceptionStack: "exception.stacktrace";
|
|
34
|
+
readonly logLevel: "log.level";
|
|
35
|
+
readonly logMessage: "log.message";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* `Symbol.for` names shared through globalThis, because the CLI and the app may
|
|
39
|
+
* each hold their own copy of core.
|
|
40
|
+
*/
|
|
41
|
+
declare const GLOBAL_SYMBOL: {
|
|
42
|
+
/** Set by the CLI while a dashboard collects logs. */
|
|
43
|
+
readonly logsCapture: "brickkit.logs.capture";
|
|
44
|
+
/** Core's function that records a log line on the running span. */
|
|
45
|
+
readonly logsRecord: "brickkit.logs.record";
|
|
46
|
+
/** The set of running event hubs, so the CLI can stop them all. */
|
|
47
|
+
readonly eventsStarted: "brickkit.events.started";
|
|
48
|
+
};
|
|
3
49
|
/**
|
|
4
50
|
* Eden/tRPC-style typed HTTP client inferred from Brick-TS application contracts.
|
|
5
51
|
*
|
|
@@ -45,18 +91,13 @@ import { Static, TSchema } from "@sinclair/typebox";
|
|
|
45
91
|
*
|
|
46
92
|
* ## URL mapping
|
|
47
93
|
*
|
|
48
|
-
* A client path is a namespace walk ending in an action call.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* | Client call | HTTP request |
|
|
52
|
-
* |---|---|
|
|
53
|
-
* Generated browser contracts carry each action's HTTP method and path,
|
|
54
|
-
* including plugin routes, resource routes and consumer overrides. Without
|
|
94
|
+
* A client path is a namespace walk ending in an action call. Generated
|
|
95
|
+
* browser contracts carry each action's HTTP method and path, including
|
|
96
|
+
* plugin routes, resource routes and consumer overrides. Without
|
|
55
97
|
* runtime metadata, callers use `POST /api/<service>/<action>` with the names
|
|
56
98
|
* in kebab-case (`getSummary` → `get-summary`); resource and plugin routes
|
|
57
99
|
* need the contract.
|
|
58
100
|
* GET/DELETE input is serialized as a query string; other methods send JSON.
|
|
59
|
-
|
|
60
101
|
*/
|
|
61
102
|
interface BrickClientOptions {
|
|
62
103
|
/** Server origin, e.g. `"http://localhost:4000"`. No trailing slash required. */
|
|
@@ -96,11 +137,11 @@ interface BrickClientAction<TInput = unknown, TOutput = unknown, TErrors = {}> {
|
|
|
96
137
|
serviceName: string;
|
|
97
138
|
/** Owning plugin descriptor name for plugin actions (e.g. `@brickkit/crud`). */
|
|
98
139
|
plugin?: string;
|
|
99
|
-
/** Owning resource name for resource
|
|
140
|
+
/** Owning resource name for resource actions (e.g. `page`). */
|
|
100
141
|
resource?: string;
|
|
101
142
|
config: {
|
|
102
143
|
path: string;
|
|
103
|
-
method:
|
|
144
|
+
method: HttpMethod;
|
|
104
145
|
};
|
|
105
146
|
/** Type information only; never emitted at runtime. */
|
|
106
147
|
readonly __types?: {
|
|
@@ -207,7 +248,7 @@ type InferActionErrorCodes<A> = A extends BrickClientAction<any, any, infer E> ?
|
|
|
207
248
|
* (Standard framework codes are always possible alongside declared ones.)
|
|
208
249
|
*/
|
|
209
250
|
type InferActionFailure<A> = ActionExecutionError & {
|
|
210
|
-
code: InferActionErrorCodes<A> |
|
|
251
|
+
code: InferActionErrorCodes<A> | StandardErrorCode | "VALIDATION_FAILED";
|
|
211
252
|
};
|
|
212
253
|
/**
|
|
213
254
|
* Typed caller for one action. Required inputs stay required; actions whose
|
|
@@ -227,5 +268,5 @@ declare function createBrickClient<TApp extends Record<string, any>>(options: Br
|
|
|
227
268
|
contract: TApp;
|
|
228
269
|
}): BrickClient<TApp>;
|
|
229
270
|
declare function createBrickClient<TApp extends Record<string, any>>(options: BrickClientOptions): BrickClient<TApp>;
|
|
230
|
-
export { BrickClientOptions as a, BrickTransportError as c, InferActionInput as d, InferActionOutput as f, isBrickTransportError as h, BrickClientAction as i, InferActionErrorCodes as l, isBrickServerError as m, BrickCallOptions as n, BrickServerError as o, createBrickClient as p, BrickClient as r, BrickServices as s, BrickActionCaller as t, InferActionFailure as u };
|
|
271
|
+
export { GLOBAL_SYMBOL as _, BrickClientOptions as a, BrickTransportError as c, InferActionInput as d, InferActionOutput as f, ATTR as g, isBrickTransportError as h, BrickClientAction as i, InferActionErrorCodes as l, isBrickServerError as m, BrickCallOptions as n, BrickServerError as o, createBrickClient as p, BrickClient as r, BrickServices as s, BrickActionCaller as t, InferActionFailure as u, SPAN as v, kebabCase as y };
|
|
231
272
|
//# sourceMappingURL=client.d.ts.map
|