brass-runtime 1.15.0 → 1.16.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.
Files changed (93) hide show
  1. package/README.md +409 -137
  2. package/dist/agent/cli/main.cjs +40 -35
  3. package/dist/agent/cli/main.js +9 -4
  4. package/dist/agent/cli/main.mjs +9 -4
  5. package/dist/agent/index.cjs +8 -4
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +7 -3
  8. package/dist/agent/index.mjs +7 -3
  9. package/dist/{chunk-PPUXIH5R.js → chunk-2WC63LJK.mjs} +11 -7
  10. package/dist/chunk-3RG5ZIWI.js +10 -0
  11. package/dist/chunk-45F7OKGT.cjs +104 -0
  12. package/dist/chunk-5YOQOXEQ.cjs +2491 -0
  13. package/dist/{chunk-STVLQ3XD.cjs → chunk-7HUOJA4W.cjs} +78 -74
  14. package/dist/{chunk-BMH5AV44.js → chunk-7LVI2GIN.js} +251 -370
  15. package/dist/chunk-7TL2LHQJ.js +2491 -0
  16. package/dist/chunk-7V4KY4RL.mjs +104 -0
  17. package/dist/chunk-7XOPAB5Q.js +2143 -0
  18. package/dist/chunk-CCKHV5BT.mjs +193 -0
  19. package/dist/{chunk-AR22SXML.js → chunk-CY33PGEX.mjs} +488 -421
  20. package/dist/chunk-DJQ7OMMB.cjs +144 -0
  21. package/dist/chunk-F5EUMJL7.mjs +2143 -0
  22. package/dist/chunk-FM4W4QPL.js +193 -0
  23. package/dist/{chunk-TO7IKXYT.js → chunk-G3XGCZDQ.js} +1 -1
  24. package/dist/{chunk-BDF4AMWX.mjs → chunk-G6IQOE4P.mjs} +251 -370
  25. package/dist/chunk-GOV47PPB.mjs +552 -0
  26. package/dist/chunk-H55LI6WY.js +93 -0
  27. package/dist/chunk-IJT6RRQ5.cjs +93 -0
  28. package/dist/{chunk-ELOOF35R.mjs → chunk-J3H54ZRV.mjs} +1 -1
  29. package/dist/chunk-JF4XXPZ5.cjs +552 -0
  30. package/dist/chunk-JNFRRJYH.cjs +2143 -0
  31. package/dist/chunk-JX3LZQJH.cjs +354 -0
  32. package/dist/chunk-K2T3DV26.mjs +93 -0
  33. package/dist/chunk-KCPT2D6G.js +552 -0
  34. package/dist/chunk-MWXMNYJS.cjs +1110 -0
  35. package/dist/{chunk-VEZNF5GZ.cjs → chunk-N6VHMOWB.cjs} +130 -126
  36. package/dist/{chunk-3QMOKAS5.js → chunk-NC5SDRYE.js} +9 -5
  37. package/dist/chunk-NOYZIMUJ.mjs +144 -0
  38. package/dist/{chunk-R3R2FVLG.cjs → chunk-NYL4D7SK.cjs} +5 -5
  39. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  40. package/dist/{chunk-4NHES7VK.mjs → chunk-OOGJ73B6.js} +11 -7
  41. package/dist/chunk-PNVFW245.js +144 -0
  42. package/dist/chunk-PRWCB3QL.mjs +2491 -0
  43. package/dist/{chunk-JFPU5GQI.mjs → chunk-QY5FKYEQ.js} +488 -421
  44. package/dist/chunk-ROJC3NBJ.js +104 -0
  45. package/dist/chunk-SPUEME2B.cjs +343 -0
  46. package/dist/chunk-TDVMADDN.js +343 -0
  47. package/dist/chunk-TVN5I4U6.cjs +193 -0
  48. package/dist/chunk-U5KWK3PX.mjs +343 -0
  49. package/dist/chunk-VFIUZG7J.mjs +354 -0
  50. package/dist/{chunk-TGIFUAK4.cjs → chunk-WQ5QNU5R.cjs} +459 -578
  51. package/dist/chunk-XDZOO4L5.js +354 -0
  52. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  53. package/dist/{chunk-K6M7MDZ4.mjs → chunk-ZGLD4TVZ.mjs} +9 -5
  54. package/dist/client-CtFmoDvM.d.ts +645 -0
  55. package/dist/core/index.cjs +72 -4
  56. package/dist/core/index.d.ts +92 -198
  57. package/dist/core/index.js +106 -38
  58. package/dist/core/index.mjs +106 -38
  59. package/dist/{effect-CMOQKX8y.d.ts → effect-CGNl5Rqp.d.ts} +107 -1
  60. package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
  61. package/dist/effectRunner-A4CHJXJI.js +8 -0
  62. package/dist/effectRunner-OPUF6QRN.mjs +8 -0
  63. package/dist/http/index.cjs +2189 -1271
  64. package/dist/http/index.d.ts +830 -270
  65. package/dist/http/index.js +2008 -1090
  66. package/dist/http/index.mjs +2008 -1090
  67. package/dist/http/testing.cjs +159 -0
  68. package/dist/http/testing.d.ts +42 -0
  69. package/dist/http/testing.js +159 -0
  70. package/dist/http/testing.mjs +159 -0
  71. package/dist/index.cjs +246 -178
  72. package/dist/index.d.ts +9 -35
  73. package/dist/index.js +120 -52
  74. package/dist/index.mjs +120 -52
  75. package/dist/observability/index.cjs +677 -0
  76. package/dist/observability/index.d.ts +79 -0
  77. package/dist/observability/index.js +677 -0
  78. package/dist/observability/index.mjs +677 -0
  79. package/dist/schedule-Fque9Abz.d.ts +70 -0
  80. package/dist/schema/index.cjs +25 -0
  81. package/dist/schema/index.d.ts +177 -0
  82. package/dist/schema/index.js +25 -0
  83. package/dist/schema/index.mjs +25 -0
  84. package/dist/server-C8hDXA74.d.ts +674 -0
  85. package/dist/{stream-FQm9h4Mg.d.ts → stream-dvSs0QS5.d.ts} +1 -1
  86. package/dist/tracer-B5tRH9H7.d.ts +230 -0
  87. package/dist/tracing-Dt9S_6V8.d.ts +148 -0
  88. package/package.json +27 -1
  89. package/dist/chunk-BDYEENHT.js +0 -224
  90. package/dist/chunk-MS34J5LY.cjs +0 -224
  91. package/dist/chunk-UMAZLXAB.mjs +0 -224
  92. package/dist/chunk-XPZNXSVN.cjs +0 -1043
  93. package/dist/tracing-DNT9jEbr.d.ts +0 -106
@@ -0,0 +1,104 @@
1
+ import {
2
+ unsafeGetCurrentRuntime
3
+ } from "./chunk-7LVI2GIN.js";
4
+ import {
5
+ asyncEffect,
6
+ asyncFail,
7
+ asyncFlatMap,
8
+ asyncFold,
9
+ asyncSucceed
10
+ } from "./chunk-PNVFW245.js";
11
+
12
+ // src/core/runtime/combinators.ts
13
+ function sleep(ms) {
14
+ return asyncEffect((_env, cb) => {
15
+ const delay = Math.max(0, Math.floor(ms));
16
+ const id = setTimeout(() => cb({ _tag: "Success", value: void 0 }), delay);
17
+ return () => clearTimeout(id);
18
+ });
19
+ }
20
+ function timeout(effect, ms) {
21
+ return asyncEffect((env, cb) => {
22
+ let done = false;
23
+ let timerId;
24
+ let effectRunning = true;
25
+ timerId = setTimeout(() => {
26
+ if (done) return;
27
+ done = true;
28
+ effectRunning = false;
29
+ cb({
30
+ _tag: "Failure",
31
+ cause: { _tag: "Fail", error: { _tag: "TimeoutError", ms } }
32
+ });
33
+ }, Math.max(0, Math.floor(ms)));
34
+ const runtime = unsafeGetCurrentRuntime();
35
+ const fiber = runtime.fork(effect);
36
+ fiber.join((exit) => {
37
+ if (done) return;
38
+ done = true;
39
+ clearTimeout(timerId);
40
+ cb(exit);
41
+ });
42
+ return () => {
43
+ if (done) return;
44
+ done = true;
45
+ clearTimeout(timerId);
46
+ fiber.interrupt();
47
+ };
48
+ });
49
+ }
50
+ function retry(effect, policy) {
51
+ const shouldRetry = policy.shouldRetry ?? (() => true);
52
+ const jitter = policy.jitter ?? "full";
53
+ const maxElapsedMs = policy.maxElapsedMs;
54
+ const computeDelay = (attempt) => {
55
+ const exp = policy.baseDelayMs * Math.pow(2, attempt);
56
+ const capped = Math.min(exp, policy.maxDelayMs);
57
+ if (jitter === "none") return capped;
58
+ return Math.floor(Math.random() * capped);
59
+ };
60
+ const loop = (attempt, startedAt) => asyncFold(
61
+ effect,
62
+ (error) => {
63
+ if (attempt >= policy.maxRetries) return asyncFail(error);
64
+ if (!shouldRetry(error, attempt)) return asyncFail(error);
65
+ if (maxElapsedMs !== void 0) {
66
+ const elapsed = performance.now() - startedAt;
67
+ if (elapsed >= maxElapsedMs) return asyncFail(error);
68
+ }
69
+ const delay = computeDelay(attempt);
70
+ return asyncFlatMap(sleep(delay), () => loop(attempt + 1, startedAt));
71
+ },
72
+ (value) => asyncSucceed(value)
73
+ );
74
+ return asyncFlatMap(
75
+ { _tag: "Sync", thunk: () => performance.now() },
76
+ (startedAt) => loop(0, startedAt)
77
+ );
78
+ }
79
+ function retryN(effect, n) {
80
+ return retry(effect, {
81
+ maxRetries: n,
82
+ baseDelayMs: 0,
83
+ maxDelayMs: 0,
84
+ jitter: "none"
85
+ });
86
+ }
87
+ function retryWithBackoff(effect, opts = {}) {
88
+ return retry(effect, {
89
+ maxRetries: opts.maxRetries ?? 3,
90
+ baseDelayMs: opts.baseDelayMs ?? 100,
91
+ maxDelayMs: opts.maxDelayMs ?? 1e4,
92
+ maxElapsedMs: opts.maxElapsedMs,
93
+ shouldRetry: opts.shouldRetry,
94
+ jitter: "full"
95
+ });
96
+ }
97
+
98
+ export {
99
+ sleep,
100
+ timeout,
101
+ retry,
102
+ retryN,
103
+ retryWithBackoff
104
+ };
@@ -0,0 +1,343 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;// src/schema/index.ts
2
+ var SchemaValidationException = class extends Error {
3
+
4
+ constructor(issues) {
5
+ super(formatIssues(issues));
6
+ this.name = "SchemaValidationException";
7
+ this.issues = issues;
8
+ }
9
+ };
10
+ var ConfigValidationError = (_class = class extends Error {
11
+ __init() {this._tag = "ConfigValidationError"}
12
+
13
+
14
+ constructor(configName, issues) {
15
+ super(`${configName} failed validation: ${formatIssues(issues)}`);_class.prototype.__init.call(this);;
16
+ this.name = "ConfigValidationError";
17
+ this.configName = configName;
18
+ this.issues = issues;
19
+ }
20
+ }, _class);
21
+ var ok = (data) => ({ success: true, data });
22
+ var fail = (issues) => ({ success: false, issues });
23
+ var receivedKind = (value) => {
24
+ if (value === null) return "null";
25
+ if (value === void 0) return "undefined";
26
+ if (Array.isArray(value)) return "array";
27
+ if (typeof value === "number" && Number.isNaN(value)) return "NaN";
28
+ return typeof value;
29
+ };
30
+ var pathLabel = (path) => path.length === 0 ? "$" : path.reduce((acc, part) => typeof part === "number" ? `${acc}[${part}]` : `${acc}.${part}`, "$");
31
+ var makeSchemaIssue = (path, expected, received, message) => ({
32
+ path,
33
+ expected,
34
+ received: receivedKind(received),
35
+ message: _nullishCoalesce(message, () => ( `Expected ${expected} at ${pathLabel(path)}, received ${receivedKind(received)}`))
36
+ });
37
+ function formatIssues(issues) {
38
+ if (issues.length === 0) return "Validation failed";
39
+ const preview = issues.slice(0, 3).map((issue) => `${pathLabel(issue.path)}: ${issue.message}`).join("; ");
40
+ return issues.length > 3 ? `${preview}; +${issues.length - 3} more` : preview;
41
+ }
42
+ function makeSchema(kind, isOptional, parser, name) {
43
+ const self = {
44
+ _tag: "Schema",
45
+ kind,
46
+ name,
47
+ isOptional,
48
+ _parse: parser,
49
+ safeParse: (input) => parser(input, []),
50
+ parse: (input) => {
51
+ const result = parser(input, []);
52
+ if (result.success) return result.data;
53
+ throw new SchemaValidationException(result.issues);
54
+ },
55
+ optional: () => makeSchema(
56
+ `${kind}.optional`,
57
+ true,
58
+ (input, path) => input === void 0 ? ok(void 0) : parser(input, path),
59
+ name
60
+ ),
61
+ nullable: () => makeSchema(
62
+ `${kind}.nullable`,
63
+ isOptional,
64
+ (input, path) => input === null ? ok(null) : parser(input, path),
65
+ name
66
+ ),
67
+ array: () => arraySchema(self),
68
+ refine: (predicate, message) => makeSchema(
69
+ `${kind}.refine`,
70
+ isOptional,
71
+ (input, path) => {
72
+ const result = parser(input, path);
73
+ if (!result.success) return result;
74
+ return predicate(result.data) ? result : fail([makeSchemaIssue(path, _nullishCoalesce(name, () => ( kind)), result.data, _nullishCoalesce(message, () => ( `Failed refinement for ${_nullishCoalesce(name, () => ( kind))}`)))]);
75
+ },
76
+ name
77
+ ),
78
+ transform: (fn, expected) => makeSchema(
79
+ `${kind}.transform`,
80
+ false,
81
+ (input, path) => {
82
+ const result = parser(input, path);
83
+ if (!result.success) return result;
84
+ try {
85
+ return ok(fn(result.data));
86
+ } catch (error) {
87
+ return fail([
88
+ makeSchemaIssue(
89
+ path,
90
+ _nullishCoalesce(expected, () => ( `transform(${_nullishCoalesce(name, () => ( kind))})`)),
91
+ result.data,
92
+ error instanceof Error ? error.message : String(error)
93
+ )
94
+ ]);
95
+ }
96
+ },
97
+ _nullishCoalesce(expected, () => ( name))
98
+ )
99
+ };
100
+ return self;
101
+ }
102
+ function stringSchema(options = {}) {
103
+ return makeSchema("string", false, (input, path) => {
104
+ if (typeof input !== "string") return fail([makeSchemaIssue(path, _nullishCoalesce(options.name, () => ( "string")), input)]);
105
+ if (options.minLength !== void 0 && input.length < options.minLength) {
106
+ return fail([makeSchemaIssue(path, `string length >= ${options.minLength}`, input, `Expected at least ${options.minLength} characters`)]);
107
+ }
108
+ if (options.maxLength !== void 0 && input.length > options.maxLength) {
109
+ return fail([makeSchemaIssue(path, `string length <= ${options.maxLength}`, input, `Expected at most ${options.maxLength} characters`)]);
110
+ }
111
+ if (options.pattern && !options.pattern.test(input)) {
112
+ return fail([makeSchemaIssue(path, `string matching ${String(options.pattern)}`, input)]);
113
+ }
114
+ return ok(input);
115
+ }, options.name);
116
+ }
117
+ function nonEmptyStringSchema(options = {}) {
118
+ return stringSchema({
119
+ ...options,
120
+ minLength: 1,
121
+ name: _nullishCoalesce(options.name, () => ( "non-empty string"))
122
+ });
123
+ }
124
+ var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
125
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
126
+ var ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;
127
+ function emailSchema() {
128
+ return stringSchema({ pattern: EMAIL_PATTERN, name: "email" });
129
+ }
130
+ function uuidSchema() {
131
+ return stringSchema({ pattern: UUID_PATTERN, name: "uuid" });
132
+ }
133
+ function urlSchema() {
134
+ return stringSchema({ name: "url" }).refine((value) => {
135
+ try {
136
+ new URL(value);
137
+ return true;
138
+ } catch (e) {
139
+ return false;
140
+ }
141
+ }, "Expected valid URL");
142
+ }
143
+ function dateIsoSchema() {
144
+ return stringSchema({ pattern: ISO_DATE_PATTERN, name: "ISO date" }).refine((value) => Number.isFinite(Date.parse(value)), "Expected valid ISO date string");
145
+ }
146
+ function numberSchema(options = {}) {
147
+ const finite = _nullishCoalesce(options.finite, () => ( true));
148
+ return makeSchema("number", false, (input, path) => {
149
+ if (typeof input !== "number" || Number.isNaN(input)) return fail([makeSchemaIssue(path, _nullishCoalesce(options.name, () => ( "number")), input)]);
150
+ if (finite && !Number.isFinite(input)) return fail([makeSchemaIssue(path, "finite number", input)]);
151
+ if (options.int && !Number.isInteger(input)) return fail([makeSchemaIssue(path, "integer", input)]);
152
+ if (options.min !== void 0 && input < options.min) return fail([makeSchemaIssue(path, `number >= ${options.min}`, input)]);
153
+ if (options.max !== void 0 && input > options.max) return fail([makeSchemaIssue(path, `number <= ${options.max}`, input)]);
154
+ return ok(input);
155
+ }, options.name);
156
+ }
157
+ function intSchema(options = {}) {
158
+ return numberSchema({
159
+ ...options,
160
+ int: true,
161
+ name: _nullishCoalesce(options.name, () => ( "integer"))
162
+ });
163
+ }
164
+ function positiveSchema(options = {}) {
165
+ const min = Math.max(_nullishCoalesce(options.min, () => ( 0)), 0);
166
+ return numberSchema({
167
+ ...options,
168
+ min,
169
+ name: _nullishCoalesce(options.name, () => ( "positive number"))
170
+ }).refine((value) => value > 0, "Expected positive number");
171
+ }
172
+ function booleanSchema(name) {
173
+ return makeSchema(
174
+ "boolean",
175
+ false,
176
+ (input, path) => typeof input === "boolean" ? ok(input) : fail([makeSchemaIssue(path, _nullishCoalesce(name, () => ( "boolean")), input)]),
177
+ name
178
+ );
179
+ }
180
+ function unknownSchema() {
181
+ return makeSchema("unknown", false, (input) => ok(input));
182
+ }
183
+ function anySchema() {
184
+ return makeSchema("any", false, (input) => ok(input));
185
+ }
186
+ function literalSchema(value) {
187
+ return makeSchema(
188
+ `literal(${JSON.stringify(value)})`,
189
+ false,
190
+ (input, path) => Object.is(input, value) ? ok(value) : fail([makeSchemaIssue(path, JSON.stringify(value), input)])
191
+ );
192
+ }
193
+ function enumSchema(values) {
194
+ const allowed = new Set(values);
195
+ const expected = values.map((value) => JSON.stringify(value)).join(" | ");
196
+ return makeSchema(
197
+ `enum(${expected})`,
198
+ false,
199
+ (input, path) => (typeof input === "string" || typeof input === "number") && allowed.has(input) ? ok(input) : fail([makeSchemaIssue(path, expected, input)])
200
+ );
201
+ }
202
+ function arraySchema(item) {
203
+ return makeSchema("array", false, (input, path) => {
204
+ if (!Array.isArray(input)) return fail([makeSchemaIssue(path, "array", input)]);
205
+ const out = [];
206
+ const issues = [];
207
+ input.forEach((value, index) => {
208
+ const result = item._parse(value, [...path, index]);
209
+ if (result.success) {
210
+ out.push(result.data);
211
+ } else {
212
+ issues.push(...result.issues);
213
+ }
214
+ });
215
+ return issues.length > 0 ? fail(issues) : ok(out);
216
+ });
217
+ }
218
+ function objectSchema(shape, options = {}) {
219
+ const unknownKeys = _nullishCoalesce(options.unknownKeys, () => ( "strip"));
220
+ return makeSchema("object", false, (input, path) => {
221
+ if (typeof input !== "object" || input === null || Array.isArray(input)) {
222
+ return fail([makeSchemaIssue(path, _nullishCoalesce(options.name, () => ( "object")), input)]);
223
+ }
224
+ const source = input;
225
+ const out = unknownKeys === "passthrough" ? { ...source } : {};
226
+ const issues = [];
227
+ const knownKeys = new Set(Object.keys(shape));
228
+ for (const [key, fieldSchema] of Object.entries(shape)) {
229
+ if (!(key in source)) {
230
+ if (!fieldSchema.isOptional) {
231
+ issues.push(makeSchemaIssue([...path, key], _nullishCoalesce(fieldSchema.name, () => ( fieldSchema.kind)), void 0, "Required field is missing"));
232
+ }
233
+ continue;
234
+ }
235
+ const result = fieldSchema._parse(source[key], [...path, key]);
236
+ if (result.success) {
237
+ out[key] = result.data;
238
+ } else {
239
+ issues.push(...result.issues);
240
+ }
241
+ }
242
+ if (unknownKeys === "strict") {
243
+ for (const key of Object.keys(source)) {
244
+ if (!knownKeys.has(key)) {
245
+ issues.push(makeSchemaIssue([...path, key], "known key", source[key], "Unknown key is not allowed"));
246
+ }
247
+ }
248
+ }
249
+ return issues.length > 0 ? fail(issues) : ok(out);
250
+ }, options.name);
251
+ }
252
+ function recordSchema(valueSchema) {
253
+ return makeSchema("record", false, (input, path) => {
254
+ if (typeof input !== "object" || input === null || Array.isArray(input)) {
255
+ return fail([makeSchemaIssue(path, "record", input)]);
256
+ }
257
+ const out = {};
258
+ const issues = [];
259
+ for (const [key, value] of Object.entries(input)) {
260
+ const result = valueSchema._parse(value, [...path, key]);
261
+ if (result.success) {
262
+ out[key] = result.data;
263
+ } else {
264
+ issues.push(...result.issues);
265
+ }
266
+ }
267
+ return issues.length > 0 ? fail(issues) : ok(out);
268
+ });
269
+ }
270
+ function unionSchema(members) {
271
+ const expected = members.map((member) => _nullishCoalesce(member.name, () => ( member.kind))).join(" | ");
272
+ return makeSchema("union", false, (input, path) => {
273
+ const branchIssues = [];
274
+ for (const member of members) {
275
+ const result = member._parse(input, path);
276
+ if (result.success) return ok(result.data);
277
+ branchIssues.push(result.issues);
278
+ }
279
+ const mostSpecific = branchIssues.flatMap((issues) => issues).filter((issue) => issue.path.length > path.length).sort((a, b) => b.path.length - a.path.length);
280
+ if (mostSpecific.length > 0) return fail(mostSpecific);
281
+ return fail([makeSchemaIssue(path, expected, input)]);
282
+ });
283
+ }
284
+ function customSchema(guard, expected, message) {
285
+ return makeSchema(
286
+ expected,
287
+ false,
288
+ (input, path) => guard(input) ? ok(input) : fail([makeSchemaIssue(path, expected, input, message)]),
289
+ expected
290
+ );
291
+ }
292
+ var schema = Object.freeze({
293
+ string: stringSchema,
294
+ nonEmptyString: nonEmptyStringSchema,
295
+ email: emailSchema,
296
+ url: urlSchema,
297
+ uuid: uuidSchema,
298
+ dateIso: dateIsoSchema,
299
+ number: numberSchema,
300
+ int: intSchema,
301
+ positive: positiveSchema,
302
+ boolean: booleanSchema,
303
+ literal: literalSchema,
304
+ enum: enumSchema,
305
+ array: arraySchema,
306
+ object: objectSchema,
307
+ record: recordSchema,
308
+ union: unionSchema,
309
+ optional: (inner) => inner.optional(),
310
+ nullable: (inner) => inner.nullable(),
311
+ unknown: unknownSchema,
312
+ any: anySchema,
313
+ custom: customSchema
314
+ });
315
+ var s = schema;
316
+ var Schema = schema;
317
+ function isSchema(value) {
318
+ return typeof value === "object" && value !== null && value._tag === "Schema" && typeof value.safeParse === "function" && typeof value._parse === "function";
319
+ }
320
+ function validateValue(data, validator) {
321
+ if (isSchema(validator)) return validator.safeParse(data);
322
+ const result = validator(data);
323
+ if (result.success) return ok(result.data);
324
+ return fail(_nullishCoalesce(result.issues, () => ( [makeSchemaIssue([], "valid JSON shape", data, result.error)])));
325
+ }
326
+ function parseConfig(configName, validator, value) {
327
+ const result = validateValue(value, validator);
328
+ if (result.success) return result.data;
329
+ throw new ConfigValidationError(configName, result.issues);
330
+ }
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+ exports.SchemaValidationException = SchemaValidationException; exports.ConfigValidationError = ConfigValidationError; exports.makeSchemaIssue = makeSchemaIssue; exports.formatIssues = formatIssues; exports.schema = schema; exports.s = s; exports.Schema = Schema; exports.isSchema = isSchema; exports.validateValue = validateValue; exports.parseConfig = parseConfig;