brass-runtime 1.17.0 → 1.18.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/README.md +36 -3
- package/dist/agent/cli/main.cjs +31 -32
- package/dist/agent/cli/main.js +3 -4
- package/dist/agent/cli/main.mjs +3 -4
- package/dist/agent/index.cjs +4 -5
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +3 -4
- package/dist/agent/index.mjs +3 -4
- package/dist/{chunk-GYM3LLGS.mjs → chunk-2QNREG6K.mjs} +188 -5
- package/dist/{chunk-4ROBZFL6.cjs → chunk-2SLT3X6G.cjs} +6 -8
- package/dist/{chunk-KZJQ723N.cjs → chunk-3PFZGP23.cjs} +13 -15
- package/dist/{chunk-VWIPB6I5.js → chunk-3PHU7FWS.js} +528 -23
- package/dist/{chunk-BKK77SBA.js → chunk-4YQHPIWJ.js} +32 -11
- package/dist/chunk-5XADBMSU.cjs +33 -0
- package/dist/{chunk-DNFJLJMW.mjs → chunk-6MLAZPBL.mjs} +48 -24
- package/dist/chunk-7TKI527D.cjs +123 -0
- package/dist/{chunk-AGR5B2BC.cjs → chunk-7TXQJFZX.cjs} +564 -12
- package/dist/{chunk-RKGKFN2A.js → chunk-AADFFVYS.js} +1 -1
- package/dist/{chunk-52PPNNI4.cjs → chunk-AJMKZXRB.cjs} +2 -2
- package/dist/{chunk-3AYM6WPJ.js → chunk-BG5RNEA2.js} +20 -299
- package/dist/{chunk-2HQTDLHF.mjs → chunk-ELLF55ER.mjs} +555 -3
- package/dist/{chunk-EOC4UHBS.mjs → chunk-G5JTCFMI.mjs} +2 -2
- package/dist/chunk-H5GYX7RZ.js +6126 -0
- package/dist/{chunk-C3MDXTRZ.js → chunk-HCJ4S3YB.js} +48 -24
- package/dist/{chunk-6IXXWIUM.js → chunk-IBRHSH5H.js} +555 -3
- package/dist/{chunk-Q2I37RP3.cjs → chunk-IFRBVMWJ.cjs} +44 -323
- package/dist/{chunk-52OB2ROS.js → chunk-ITG6I7ZS.js} +2 -4
- package/dist/chunk-ITZQ526U.mjs +33 -0
- package/dist/{chunk-7JIJOVCT.js → chunk-JH4GI3DW.js} +2 -4
- package/dist/{chunk-F6XWZQY4.cjs → chunk-KHACHFBQ.cjs} +583 -78
- package/dist/{chunk-4P2HHGAX.mjs → chunk-KRYP6CAE.mjs} +32 -11
- package/dist/chunk-KTGDLBLD.mjs +123 -0
- package/dist/{chunk-WBGRHGBP.cjs → chunk-LXBU5E77.cjs} +114 -93
- package/dist/{chunk-PD4EJTQC.cjs → chunk-N6QNSTWD.cjs} +5 -5
- package/dist/{chunk-6RY2FFN4.mjs → chunk-OI4ESUMC.mjs} +9 -11
- package/dist/{chunk-EJ6BPYVR.mjs → chunk-OT2TESZU.mjs} +1 -1
- package/dist/{chunk-7X3K5RMS.js → chunk-PSEU65ND.js} +9 -11
- package/dist/{chunk-SK7UZRNI.mjs → chunk-QCOLAHU3.mjs} +528 -23
- package/dist/{chunk-KH4SYAOS.mjs → chunk-QZ6QFJNM.mjs} +20 -299
- package/dist/{chunk-MBEJI5HF.mjs → chunk-R6WDSZA6.mjs} +2 -4
- package/dist/{chunk-FHQGHPMO.mjs → chunk-RREBJX2S.mjs} +2 -4
- package/dist/{chunk-5QC7LRZ3.js → chunk-S4HHFUYP.js} +2 -2
- package/dist/{chunk-GLE2WY7Z.cjs → chunk-SSQJKDN3.cjs} +194 -11
- package/dist/{chunk-CZIVE6NT.cjs → chunk-UUMKZJRJ.cjs} +48 -24
- package/dist/chunk-VIFA4DPN.cjs +6126 -0
- package/dist/chunk-W6WR37HN.js +33 -0
- package/dist/{chunk-FH2X7BVP.js → chunk-XSAHV5HQ.js} +188 -5
- package/dist/chunk-YM3EDNYD.js +123 -0
- package/dist/{chunk-7ZPEZ57L.cjs → chunk-YTX2JYYP.cjs} +18 -20
- package/dist/chunk-Z3PSSXP3.mjs +6126 -0
- package/dist/core/index.cjs +31 -9
- package/dist/core/index.d.ts +19 -152
- package/dist/core/index.js +80 -58
- package/dist/core/index.mjs +80 -58
- package/dist/defaultClient-DhpCQW9m.d.ts +1623 -0
- package/dist/{effect-DIUHZ9IN.d.ts → effect-CtUDl5M5.d.ts} +1 -1
- package/dist/http/index.cjs +202 -59
- package/dist/http/index.d.ts +55 -819
- package/dist/http/index.js +216 -73
- package/dist/http/index.mjs +216 -73
- package/dist/http/testing.cjs +31 -10
- package/dist/http/testing.d.ts +16 -5
- package/dist/http/testing.js +29 -8
- package/dist/http/testing.mjs +29 -8
- package/dist/index.cjs +110 -88
- package/dist/index.d.ts +9 -8
- package/dist/index.js +81 -59
- package/dist/index.mjs +81 -59
- package/dist/{schedule-CK3Ml_7p.d.ts → layer-BalPI6cN.d.ts} +176 -2
- package/dist/observability/index.cjs +20 -7
- package/dist/observability/index.d.ts +32 -8
- package/dist/observability/index.js +19 -6
- package/dist/observability/index.mjs +19 -6
- package/dist/perf/cli.cjs +26 -28
- package/dist/perf/cli.js +11 -13
- package/dist/perf/cli.mjs +11 -13
- package/dist/perf/index.cjs +13 -15
- package/dist/perf/index.js +11 -13
- package/dist/perf/index.mjs +11 -13
- package/dist/schema/index.cjs +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/index.mjs +1 -1
- package/dist/{server-D6JZ15_e.d.ts → server-C1zVmqE6.d.ts} +5 -5
- package/dist/{stream-B4oK9JFP.d.ts → stream-Bb4FTejt.d.ts} +1 -1
- package/dist/{tracer-Hwt1cl7h.d.ts → tracer-DzfuE6um.d.ts} +2 -2
- package/dist/{tracing-DqbTKGcf.d.ts → tracing-BABA5arE.d.ts} +1 -1
- package/docs/README.md +2 -0
- package/docs/ai/PUBLIC_API.md +28 -7
- package/docs/articles/brass-runtime-http-observability.md +467 -0
- package/docs/frameworks/angular.md +51 -0
- package/docs/frameworks/express.md +58 -0
- package/docs/frameworks/fastify.md +49 -0
- package/docs/frameworks/nestjs.md +53 -0
- package/docs/frameworks/nextjs.md +55 -0
- package/docs/frameworks/react.md +44 -0
- package/docs/frameworks/vanilla.md +56 -0
- package/docs/guides/layers.md +130 -0
- package/docs/http-recipes.md +31 -1
- package/docs/http.md +50 -1
- package/docs/observability.md +132 -0
- package/docs/performance-profiler.md +6 -2
- package/docs/recipes/layers.md +46 -2
- package/docs/recipes/testing.md +25 -0
- package/package.json +4 -1
- package/dist/chunk-3LOYJFRR.cjs +0 -300
- package/dist/chunk-3Y2RIUMM.js +0 -300
- package/dist/chunk-5EC274J5.cjs +0 -2874
- package/dist/chunk-5VRJNBLZ.mjs +0 -2874
- package/dist/chunk-62AZW6UT.cjs +0 -313
- package/dist/chunk-74ZTY6CP.js +0 -2871
- package/dist/chunk-7CMJS3QE.mjs +0 -2871
- package/dist/chunk-A2OM6NEH.mjs +0 -194
- package/dist/chunk-B33ICAKP.js +0 -313
- package/dist/chunk-JF5WGYJJ.cjs +0 -194
- package/dist/chunk-KN32XNTH.mjs +0 -313
- package/dist/chunk-KQLYONSE.cjs +0 -2871
- package/dist/chunk-L2SYFEBS.js +0 -194
- package/dist/chunk-MIIYDLGM.js +0 -2874
- package/dist/chunk-PWC3RBQE.mjs +0 -300
- package/dist/client-CZHU674n.d.ts +0 -820
|
@@ -29,6 +29,7 @@ function formatConfigError(error) {
|
|
|
29
29
|
}
|
|
30
30
|
var ok = (data) => ({ success: true, data });
|
|
31
31
|
var fail = (issues) => ({ success: false, issues });
|
|
32
|
+
var EMPTY_PATH = Object.freeze([]);
|
|
32
33
|
var receivedKind = (value) => {
|
|
33
34
|
if (value === null) return "null";
|
|
34
35
|
if (value === void 0) return "undefined";
|
|
@@ -37,12 +38,16 @@ var receivedKind = (value) => {
|
|
|
37
38
|
return typeof value;
|
|
38
39
|
};
|
|
39
40
|
var pathLabel = (path) => path.length === 0 ? "$" : path.reduce((acc, part) => typeof part === "number" ? `${acc}[${part}]` : `${acc}.${part}`, "$");
|
|
40
|
-
var makeSchemaIssue = (path, expected, received, message) =>
|
|
41
|
-
path
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
var makeSchemaIssue = (path, expected, received, message) => {
|
|
42
|
+
const issuePath = path.length === 0 ? EMPTY_PATH : [...path];
|
|
43
|
+
const receivedLabel = receivedKind(received);
|
|
44
|
+
return {
|
|
45
|
+
path: issuePath,
|
|
46
|
+
expected,
|
|
47
|
+
received: receivedLabel,
|
|
48
|
+
message: _nullishCoalesce(message, () => ( `Expected ${expected} at ${pathLabel(issuePath)}, received ${receivedLabel}`))
|
|
49
|
+
};
|
|
50
|
+
};
|
|
46
51
|
function formatIssues(issues) {
|
|
47
52
|
if (issues.length === 0) return "Validation failed";
|
|
48
53
|
const preview = issues.slice(0, 3).map((issue) => `${pathLabel(issue.path)}: ${issue.message}`).join("; ");
|
|
@@ -55,9 +60,9 @@ function makeSchema(kind, isOptional, parser, name) {
|
|
|
55
60
|
name,
|
|
56
61
|
isOptional,
|
|
57
62
|
_parse: parser,
|
|
58
|
-
safeParse: (input) => parser(input,
|
|
63
|
+
safeParse: (input) => parser(input, EMPTY_PATH),
|
|
59
64
|
parse: (input) => {
|
|
60
|
-
const result = parser(input,
|
|
65
|
+
const result = parser(input, EMPTY_PATH);
|
|
61
66
|
if (result.success) return result.data;
|
|
62
67
|
throw new SchemaValidationException(result.issues);
|
|
63
68
|
},
|
|
@@ -212,50 +217,65 @@ function arraySchema(item) {
|
|
|
212
217
|
return makeSchema("array", false, (input, path) => {
|
|
213
218
|
if (!Array.isArray(input)) return fail([makeSchemaIssue(path, "array", input)]);
|
|
214
219
|
const out = [];
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
const childPath = path.length === 0 ? [] : [...path];
|
|
221
|
+
let issues;
|
|
222
|
+
for (let index = 0; index < input.length; index += 1) {
|
|
223
|
+
if (!(index in input)) continue;
|
|
224
|
+
childPath.push(index);
|
|
225
|
+
const result = item._parse(input[index], childPath);
|
|
226
|
+
childPath.pop();
|
|
218
227
|
if (result.success) {
|
|
219
228
|
out.push(result.data);
|
|
220
229
|
} else {
|
|
230
|
+
issues ??= [];
|
|
221
231
|
issues.push(...result.issues);
|
|
222
232
|
}
|
|
223
|
-
}
|
|
224
|
-
return issues
|
|
233
|
+
}
|
|
234
|
+
return issues ? fail(issues) : ok(out);
|
|
225
235
|
});
|
|
226
236
|
}
|
|
227
237
|
function objectSchema(shape, options = {}) {
|
|
228
238
|
const unknownKeys = _nullishCoalesce(options.unknownKeys, () => ( "strip"));
|
|
239
|
+
const shapeEntries = Object.entries(shape);
|
|
240
|
+
const knownKeys = unknownKeys === "strict" ? new Set(shapeEntries.map(([key]) => key)) : void 0;
|
|
229
241
|
return makeSchema("object", false, (input, path) => {
|
|
230
242
|
if (typeof input !== "object" || input === null || Array.isArray(input)) {
|
|
231
243
|
return fail([makeSchemaIssue(path, _nullishCoalesce(options.name, () => ( "object")), input)]);
|
|
232
244
|
}
|
|
233
245
|
const source = input;
|
|
234
246
|
const out = unknownKeys === "passthrough" ? { ...source } : {};
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
for (const [key, fieldSchema] of
|
|
247
|
+
const childPath = path.length === 0 ? [] : [...path];
|
|
248
|
+
let issues;
|
|
249
|
+
for (const [key, fieldSchema] of shapeEntries) {
|
|
250
|
+
childPath.push(key);
|
|
238
251
|
if (!(key in source)) {
|
|
239
252
|
if (!fieldSchema.isOptional) {
|
|
240
|
-
issues
|
|
253
|
+
issues ??= [];
|
|
254
|
+
issues.push(makeSchemaIssue(childPath, _nullishCoalesce(fieldSchema.name, () => ( fieldSchema.kind)), void 0, "Required field is missing"));
|
|
241
255
|
}
|
|
256
|
+
childPath.pop();
|
|
242
257
|
continue;
|
|
243
258
|
}
|
|
244
|
-
const result = fieldSchema._parse(source[key],
|
|
259
|
+
const result = fieldSchema._parse(source[key], childPath);
|
|
260
|
+
childPath.pop();
|
|
245
261
|
if (result.success) {
|
|
246
262
|
out[key] = result.data;
|
|
247
263
|
} else {
|
|
264
|
+
issues ??= [];
|
|
248
265
|
issues.push(...result.issues);
|
|
249
266
|
}
|
|
250
267
|
}
|
|
251
|
-
if (
|
|
268
|
+
if (knownKeys) {
|
|
252
269
|
for (const key of Object.keys(source)) {
|
|
253
270
|
if (!knownKeys.has(key)) {
|
|
254
|
-
|
|
271
|
+
childPath.push(key);
|
|
272
|
+
issues ??= [];
|
|
273
|
+
issues.push(makeSchemaIssue(childPath, "known key", source[key], "Unknown key is not allowed"));
|
|
274
|
+
childPath.pop();
|
|
255
275
|
}
|
|
256
276
|
}
|
|
257
277
|
}
|
|
258
|
-
return issues
|
|
278
|
+
return issues ? fail(issues) : ok(out);
|
|
259
279
|
}, options.name);
|
|
260
280
|
}
|
|
261
281
|
function recordSchema(valueSchema) {
|
|
@@ -264,16 +284,20 @@ function recordSchema(valueSchema) {
|
|
|
264
284
|
return fail([makeSchemaIssue(path, "record", input)]);
|
|
265
285
|
}
|
|
266
286
|
const out = {};
|
|
267
|
-
const
|
|
287
|
+
const childPath = path.length === 0 ? [] : [...path];
|
|
288
|
+
let issues;
|
|
268
289
|
for (const [key, value] of Object.entries(input)) {
|
|
269
|
-
|
|
290
|
+
childPath.push(key);
|
|
291
|
+
const result = valueSchema._parse(value, childPath);
|
|
292
|
+
childPath.pop();
|
|
270
293
|
if (result.success) {
|
|
271
294
|
out[key] = result.data;
|
|
272
295
|
} else {
|
|
296
|
+
issues ??= [];
|
|
273
297
|
issues.push(...result.issues);
|
|
274
298
|
}
|
|
275
299
|
}
|
|
276
|
-
return issues
|
|
300
|
+
return issues ? fail(issues) : ok(out);
|
|
277
301
|
});
|
|
278
302
|
}
|
|
279
303
|
function unionSchema(members) {
|