@brickkit/core 0.15.0 → 0.16.0-beta.0
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 +6 -3
- package/dist/chunks/client.js +22 -4
- package/dist/chunks/client.js.map +1 -1
- package/dist/chunks/server.d.ts +17 -13
- package/dist/chunks/server.js +2699 -679
- package/dist/chunks/server.js.map +1 -1
- package/dist/chunks/types.d.ts +1123 -298
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +210 -14
- package/dist/index.js +253 -252
- package/dist/index.js.map +1 -1
- package/dist/pg.d.ts +2 -3
- package/dist/pg.js +1 -1
- package/dist/tanstack-query.d.ts +1 -2
- package/dist/testing.d.ts +1 -2
- package/dist/testing.js +1 -1
- package/dist/workflow.d.ts +2 -3
- package/package.json +11 -11
package/dist/chunks/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as BrickSocketClient, It as StandardErrorCode, Q as BrickClientSocket, c as ActionExecutionError, ri as HttpMethod, s as ActionErrorDefinition, t as Action, tt as BrickSocketConnectOptions } from "./types.js";
|
|
2
2
|
import { Static, TSchema } from "@sinclair/typebox";
|
|
3
3
|
/**
|
|
4
4
|
* The URL segment for a declared name: `orderBilling` becomes `order-billing`,
|
|
@@ -21,6 +21,10 @@ declare const ATTR: {
|
|
|
21
21
|
readonly urlPath: "url.path";
|
|
22
22
|
readonly service: "brick.service";
|
|
23
23
|
readonly action: "brick.action";
|
|
24
|
+
/** A webhook delivery: the webhook's name, its event id and what became of it. Never the body or the signature. */
|
|
25
|
+
readonly webhook: "brick.webhook";
|
|
26
|
+
readonly webhookEventId: "brick.webhook.event_id";
|
|
27
|
+
readonly webhookOutcome: "brick.webhook.outcome";
|
|
24
28
|
readonly traceId: "brick.trace_id";
|
|
25
29
|
readonly errorCode: "brick.error.code";
|
|
26
30
|
readonly errorMessage: "brick.error.message";
|
|
@@ -270,5 +274,4 @@ declare function createBrickClient<TApp extends Record<string, any>>(options: Br
|
|
|
270
274
|
contract: TApp;
|
|
271
275
|
}): BrickClient<TApp>;
|
|
272
276
|
declare function createBrickClient<TApp extends Record<string, any>>(options: BrickClientOptions): BrickClient<TApp>;
|
|
273
|
-
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 };
|
|
274
|
-
//# sourceMappingURL=client.d.ts.map
|
|
277
|
+
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 };
|
package/dist/chunks/client.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Kind, TransformKind } from "@sinclair/typebox";
|
|
2
2
|
import { Check } from "@sinclair/typebox/value";
|
|
3
3
|
// src/types.ts
|
|
4
|
+
function withoutRejectedValue({ path, message, type }) {
|
|
5
|
+
return {
|
|
6
|
+
path,
|
|
7
|
+
message,
|
|
8
|
+
type
|
|
9
|
+
};
|
|
10
|
+
}
|
|
4
11
|
var ValidationError = class extends Error {
|
|
5
12
|
code = "VALIDATION_FAILED";
|
|
6
13
|
status;
|
|
@@ -9,7 +16,7 @@ var ValidationError = class extends Error {
|
|
|
9
16
|
super(message);
|
|
10
17
|
this.name = "ValidationError";
|
|
11
18
|
this.status = status;
|
|
12
|
-
this.errors = errors;
|
|
19
|
+
this.errors = errors.map(withoutRejectedValue);
|
|
13
20
|
}
|
|
14
21
|
toJSON() {
|
|
15
22
|
return {
|
|
@@ -70,6 +77,10 @@ const ATTR = {
|
|
|
70
77
|
urlPath: "url.path",
|
|
71
78
|
service: "brick.service",
|
|
72
79
|
action: "brick.action",
|
|
80
|
+
/** A webhook delivery: the webhook's name, its event id and what became of it. Never the body or the signature. */
|
|
81
|
+
webhook: "brick.webhook",
|
|
82
|
+
webhookEventId: "brick.webhook.event_id",
|
|
83
|
+
webhookOutcome: "brick.webhook.outcome",
|
|
73
84
|
traceId: "brick.trace_id",
|
|
74
85
|
errorCode: "brick.error.code",
|
|
75
86
|
errorMessage: "brick.error.message",
|
|
@@ -120,6 +131,10 @@ const STANDARD_ERRORS = {
|
|
|
120
131
|
status: 409,
|
|
121
132
|
message: "Conflict"
|
|
122
133
|
},
|
|
134
|
+
RATE_LIMITED: {
|
|
135
|
+
status: 429,
|
|
136
|
+
message: "Too Many Requests"
|
|
137
|
+
},
|
|
123
138
|
INTERNAL_SERVER_ERROR: {
|
|
124
139
|
status: 500,
|
|
125
140
|
message: "Internal Server Error"
|
|
@@ -129,7 +144,7 @@ const STANDARD_ERRORS = {
|
|
|
129
144
|
function decodeError(body, status) {
|
|
130
145
|
if (body === null || typeof body !== "object") return void 0;
|
|
131
146
|
const record = body;
|
|
132
|
-
if (record.name === "ValidationError") return new ValidationError(typeof record.message === "string" ? record.message : "Validation failed", Array.isArray(record.errors) ? record.errors : [], typeof record.status === "number" ? record.status : status);
|
|
147
|
+
if (record.name === "ValidationError") return new ValidationError(typeof record.message === "string" ? record.message : "Validation failed", Array.isArray(record.errors) ? record.errors.filter((item) => item !== null && typeof item === "object") : [], typeof record.status === "number" ? record.status : status);
|
|
133
148
|
if (typeof record.code !== "string") return void 0;
|
|
134
149
|
return new ActionExecutionError(record.code, typeof record.message === "string" ? record.message : record.code, typeof record.status === "number" ? record.status : status, record.details ?? void 0);
|
|
135
150
|
}
|
|
@@ -310,6 +325,9 @@ function getPluginActionRoute(action, prefix = DEFAULT_PREFIX) {
|
|
|
310
325
|
function getActionRoute(action, prefix = DEFAULT_PREFIX) {
|
|
311
326
|
return actionRoute(action, action.serviceName ?? "", prefix);
|
|
312
327
|
}
|
|
328
|
+
function actionMethod(action) {
|
|
329
|
+
return actionMeta(action).route?.method ?? action.config.method ?? "POST";
|
|
330
|
+
}
|
|
313
331
|
/** `getActionRoute` for an action that may not be registered yet, under `service`. */
|
|
314
332
|
function actionRoute(action, service, prefix) {
|
|
315
333
|
const plugin = getPluginActionRoute(action, prefix);
|
|
@@ -318,7 +336,7 @@ function actionRoute(action, service, prefix) {
|
|
|
318
336
|
method: plugin.method,
|
|
319
337
|
path: plugin.path
|
|
320
338
|
};
|
|
321
|
-
const method = action
|
|
339
|
+
const method = actionMethod(action);
|
|
322
340
|
const { resourceAction } = actionMeta(action);
|
|
323
341
|
if (resourceAction) {
|
|
324
342
|
const base = ownerPath(prefix, service, resourceAction.resource);
|
|
@@ -1030,6 +1048,6 @@ function createBrickClient(options) {
|
|
|
1030
1048
|
timeoutMs: options.timeoutMs
|
|
1031
1049
|
}, [], options.contract);
|
|
1032
1050
|
}
|
|
1033
|
-
export {
|
|
1051
|
+
export { STANDARD_ERRORS as A, signSeq as B, actionMeta as C, SOCKET_MAX_BYTES as D, SOCKET_CONTROL as E, isSocketEnvelope as F, ActionExecutionError as G, ATTR as H, isSocketRoom as I, DuplicateNameError as K, isSocketSeq as L, compareSocketSeq as M, encodeFrame as N, SOCKET_PROTOCOL as O, isControlEvent as P, replayFrame as R, kebabCase as S, SOCKET_CLOSE as T, GLOBAL_SYMBOL as U, splitSeq as V, SPAN as W, ownerPath as _, isBrickTransportError as a, routeKey as b, DEFAULT_PREFIX as c, checkSegments as d, getActionRoute as f, joinRoute as g, isReadLike as h, isBrickServerError as i, byteLength as j, SOCKET_TOKEN_PROTOCOL as k, actionMethod as l, inputSource as m, BrickTransportError as n, BrickSocketError as o, getPluginActionRoute as p, ValidationError as q, createBrickClient as r, serializeSocketSchema as s, BrickServerError as t, actionOwners as u, pathParamNames as v, SOCKET_BUFFER_BYTES as w, toOpenApiPath as x, pluginRoutePath as y, replayHeadroom as z };
|
|
1034
1052
|
|
|
1035
1053
|
//# sourceMappingURL=client.js.map
|