apps 0.0.1-beta.14 → 0.0.1-beta.140
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 +60 -42
- package/framework-reference.json +1 -1
- package/js/{chunk-M3B3DE4K.js → chunk-2XDCAXAR.js} +612 -246
- package/js/{chunk-IPI4MFSN.js → chunk-34RH47V5.js} +2 -2
- package/js/chunk-5JBDHSLK.js +449 -0
- package/js/{chunk-KUMBKVJD.js → chunk-6QZVXLF2.js} +2 -2
- package/js/chunk-7MPPHKRW.js +5418 -0
- package/js/chunk-DQ6FIDC3.js +335 -0
- package/js/{chunk-5T57N25Q.js → chunk-EKXBHVMR.js} +697 -70
- package/js/chunk-EYZHR4UA.js +1945 -0
- package/js/chunk-GJG5G6CH.js +1022 -0
- package/js/chunk-H2K7OZ47.js +90 -0
- package/js/chunk-I6QAWNUM.js +161 -0
- package/js/{chunk-ODEIDRGW.js → chunk-JH3MOQZR.js} +1166 -504
- package/js/{chunk-QS6CAHKC.js → chunk-JHAHT26O.js} +4 -3
- package/js/{chunk-RFVIONFX.js → chunk-JIXIOWZP.js} +136 -45
- package/js/chunk-LSOHA2RH.js +88 -0
- package/js/{chunk-UK573G7W.js → chunk-MB6L5YZE.js} +1817 -632
- package/js/chunk-OBT33ZDK.js +95 -0
- package/js/{chunk-JU7VHODU.js → chunk-QTX7OUFH.js} +65 -10
- package/js/chunk-RBSXSRPU.js +175 -0
- package/js/chunk-SB2DNKDL.js +593 -0
- package/js/{chunk-VFZKSM3T.js → chunk-VX36SA7Y.js} +3 -3
- package/js/chunk-YF7TYPDS.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-YFSOSNF3.js} +17265 -12477
- package/js/{chunk-IJX4CYZO.js → chunk-YVN2AMAU.js} +976 -447
- package/js/chunk-Z6DSU4VL.js +724 -0
- package/js/client.js +333 -98
- package/js/contracts.js +154 -21
- package/js/effect.js +18 -19
- package/js/graphql.js +231 -188
- package/js/host.js +138 -80
- package/js/index.js +153 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4950 -4201
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +220 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +9 -8
- package/js/ui/serving.js +8618 -235
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +56 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +40 -2
- package/types/apps/src/contracts/help-text.d.ts +31 -0
- package/types/apps/src/contracts/host.d.ts +1493 -20
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +47 -8
- package/types/apps/src/contracts/operations.d.ts +14 -7
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +513 -15
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/13.d.ts +6001 -0
- package/types/apps/src/contracts/protocols/2.d.ts +9 -8
- package/types/apps/src/contracts/protocols/3.d.ts +73 -15
- package/types/apps/src/contracts/protocols/4.d.ts +22 -15
- package/types/apps/src/contracts/protocols/5.d.ts +37 -11
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +7114 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +56 -0
- package/types/apps/src/contracts/router.d.ts +2 -1
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +20 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +16 -13
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/help-text.d.ts +5 -0
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +33 -5
- package/types/apps/src/implementation/openapi-document.d.ts +35 -18
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +2 -1
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/operations.d.ts +58 -7
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +20 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +22 -97
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +148 -17
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +3 -3
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +38 -12
- package/types/apps/src/implementation/upstream-error.d.ts +17 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +67 -17
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -2
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +3 -2
- package/types/telemetry/src/keepalive.d.ts +53 -0
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +6 -2
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +32 -7
- package/types/telemetry/src/span-attributes.d.ts +22 -3
- package/types/telemetry/src/transport.d.ts +10 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/legacy-keys.d.ts +20 -0
- package/types/utils/src/random-uuid.d.ts +6 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-4ASNKGCV.js +0 -242
- package/js/chunk-4DWF4ZWI.js +0 -1280
- package/js/chunk-57RKNWL2.js +0 -75
- package/js/chunk-6HSH75OI.js +0 -2688
- package/js/chunk-G4FT53I7.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-S73JGVR5.js +0 -507
- package/js/chunk-TG6DOCRO.js +0 -299
- package/js/chunk-YPKG2QO5.js +0 -209
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/implementation/ui-watch.d.ts +0 -2
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DeclarationInvalid,
|
|
2
3
|
JsonObject,
|
|
3
4
|
ValidationError
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-H2K7OZ47.js";
|
|
5
6
|
import {
|
|
6
7
|
Cause_exports,
|
|
7
8
|
Effect_exports,
|
|
@@ -10,7 +11,7 @@ import {
|
|
|
10
11
|
SchemaIssue_exports,
|
|
11
12
|
SchemaParser_exports,
|
|
12
13
|
Schema_exports
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YFSOSNF3.js";
|
|
14
15
|
|
|
15
16
|
// ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
16
17
|
function deepCompareStrict(a, b) {
|
|
@@ -62,6 +63,19 @@ function escapePointer(p) {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
// ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
|
|
66
|
+
var schemaKeyword = {
|
|
67
|
+
additionalItems: true,
|
|
68
|
+
unevaluatedItems: true,
|
|
69
|
+
items: true,
|
|
70
|
+
contains: true,
|
|
71
|
+
additionalProperties: true,
|
|
72
|
+
unevaluatedProperties: true,
|
|
73
|
+
propertyNames: true,
|
|
74
|
+
not: true,
|
|
75
|
+
if: true,
|
|
76
|
+
then: true,
|
|
77
|
+
else: true
|
|
78
|
+
};
|
|
65
79
|
var schemaArrayKeyword = {
|
|
66
80
|
prefixItems: true,
|
|
67
81
|
items: true,
|
|
@@ -107,9 +121,9 @@ var ignoredKeyword = {
|
|
|
107
121
|
var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
|
|
108
122
|
function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseURI = initialBaseURI, basePointer = "") {
|
|
109
123
|
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
const url = new URL(
|
|
124
|
+
const id = schema.$id || schema.id;
|
|
125
|
+
if (id) {
|
|
126
|
+
const url = new URL(id, baseURI.href);
|
|
113
127
|
if (url.hash.length > 1) {
|
|
114
128
|
lookup[url.href] = schema;
|
|
115
129
|
} else {
|
|
@@ -175,8 +189,14 @@ function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseU
|
|
|
175
189
|
for (let subKey in subSchema) {
|
|
176
190
|
dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
177
191
|
}
|
|
178
|
-
} else {
|
|
192
|
+
} else if (schemaKeyword[key]) {
|
|
179
193
|
dereference(subSchema, lookup, baseURI, keyBase);
|
|
194
|
+
} else if (key === "dependencies" && subSchema && typeof subSchema === "object") {
|
|
195
|
+
for (let subKey in subSchema) {
|
|
196
|
+
if (!Array.isArray(subSchema[subKey])) {
|
|
197
|
+
dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
180
200
|
}
|
|
181
201
|
}
|
|
182
202
|
return lookup;
|
|
@@ -345,7 +365,7 @@ function validate(instance, schema, draft = "2019-09", lookup = dereference(sche
|
|
|
345
365
|
if ($recursiveAnchor === true && recursiveAnchor === null) {
|
|
346
366
|
recursiveAnchor = schema;
|
|
347
367
|
}
|
|
348
|
-
if ($recursiveRef
|
|
368
|
+
if ($recursiveRef !== void 0) {
|
|
349
369
|
const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
|
|
350
370
|
const keywordLocation = `${schemaLocation}/$recursiveRef`;
|
|
351
371
|
const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
|
|
@@ -1069,40 +1089,57 @@ function schemaPattern(pattern) {
|
|
|
1069
1089
|
}
|
|
1070
1090
|
|
|
1071
1091
|
// src/implementation/schema.ts
|
|
1072
|
-
var StorageField = /* @__PURE__ */ Symbol("apps.StorageField");
|
|
1073
1092
|
var Decoder = /* @__PURE__ */ Symbol("apps.Schema");
|
|
1074
1093
|
var decoderOf = (schema) => schema[Decoder];
|
|
1075
1094
|
var isSchema = (value) => typeof value === "object" && value !== null && Decoder in value;
|
|
1095
|
+
var schemaArgument = (value, role) => {
|
|
1096
|
+
if (isSchema(value)) return value;
|
|
1097
|
+
const received = value;
|
|
1098
|
+
throw new TypeError(
|
|
1099
|
+
`${role} must be a schema, such as string() or object({ ... }), but ${typeof received === "function" ? "it is a function. Call it, as in string()." : received === void 0 ? "it is undefined. Check that it is defined and imported before this declaration." : typeof received === "object" && received !== null && Object.getPrototypeOf(received) === Object.prototype ? "it is a plain object. Wrap its fields in object({ ... })." : "no apps schema constructor created it."}`
|
|
1100
|
+
);
|
|
1101
|
+
};
|
|
1076
1102
|
var parse = (decoder, input) => Effect_exports.suspend(() => Schema_exports.decodeUnknownEffect(decoder)(input)).pipe(
|
|
1077
1103
|
Effect_exports.mapError(() => new ValidationError())
|
|
1078
1104
|
);
|
|
1079
|
-
|
|
1105
|
+
var declarationIssues = SchemaIssue_exports.makeFormatterStandardSchemaV1({
|
|
1106
|
+
leafHook: SchemaIssue_exports.defaultLeafHook
|
|
1107
|
+
});
|
|
1108
|
+
var parseDeclaration = (decoder, input, declaration, intended = () => decoder) => Effect_exports.suspend(() => Schema_exports.decodeUnknownEffect(decoder)(input)).pipe(
|
|
1109
|
+
Effect_exports.catch(
|
|
1110
|
+
(failed) => Effect_exports.suspend(
|
|
1111
|
+
() => Schema_exports.decodeUnknownEffect(intended(input))(input, { errors: "all" })
|
|
1112
|
+
).pipe(
|
|
1113
|
+
Effect_exports.flip,
|
|
1114
|
+
Effect_exports.orElseSucceed(() => failed),
|
|
1115
|
+
Effect_exports.flatMap(
|
|
1116
|
+
(error) => Effect_exports.fail(
|
|
1117
|
+
new DeclarationInvalid({
|
|
1118
|
+
declaration,
|
|
1119
|
+
issues: declarationIssues(error.issue).issues.map((issue) => ({
|
|
1120
|
+
path: (issue.path ?? []).map(
|
|
1121
|
+
(segment) => String(typeof segment === "object" ? segment.key : segment)
|
|
1122
|
+
),
|
|
1123
|
+
message: issue.message
|
|
1124
|
+
}))
|
|
1125
|
+
})
|
|
1126
|
+
)
|
|
1127
|
+
)
|
|
1128
|
+
)
|
|
1129
|
+
)
|
|
1130
|
+
);
|
|
1131
|
+
function wrap(decoder, optionalValue) {
|
|
1080
1132
|
return {
|
|
1081
1133
|
[Decoder]: decoder,
|
|
1082
|
-
...field === void 0 ? {} : { [StorageField]: field },
|
|
1083
1134
|
optionalValue,
|
|
1084
1135
|
parse: (input) => Effect_exports.runSync(parse(decoder, input)),
|
|
1085
|
-
optional: () => wrap(
|
|
1086
|
-
Schema_exports.optional(decoder),
|
|
1087
|
-
true,
|
|
1088
|
-
field === void 0 ? void 0 : { ...field, optional: true }
|
|
1089
|
-
),
|
|
1136
|
+
optional: () => wrap(Schema_exports.optional(decoder), true),
|
|
1090
1137
|
default: (value) => {
|
|
1091
1138
|
const parsed = Effect_exports.runSync(parse(decoder, value));
|
|
1092
1139
|
return {
|
|
1093
1140
|
...wrap(
|
|
1094
1141
|
decoder.annotate({ default: parsed }).pipe(Schema_exports.withDecodingDefault(Effect_exports.succeed(parsed))),
|
|
1095
|
-
false
|
|
1096
|
-
field === void 0 || parsed === void 0 ? void 0 : {
|
|
1097
|
-
...field,
|
|
1098
|
-
default: Schema_exports.decodeUnknownSync(
|
|
1099
|
-
Schema_exports.Union([
|
|
1100
|
-
Schema_exports.String,
|
|
1101
|
-
Schema_exports.Finite,
|
|
1102
|
-
Schema_exports.Boolean
|
|
1103
|
-
])
|
|
1104
|
-
)(parsed)
|
|
1105
|
-
}
|
|
1142
|
+
false
|
|
1106
1143
|
),
|
|
1107
1144
|
hasDefault: true,
|
|
1108
1145
|
inputOptional: optionalValue
|
|
@@ -1110,17 +1147,29 @@ function wrap(decoder, optionalValue, field) {
|
|
|
1110
1147
|
}
|
|
1111
1148
|
};
|
|
1112
1149
|
}
|
|
1150
|
+
var annotated = (schema, { title, description }) => title === void 0 && description === void 0 ? schema : schema.annotate({
|
|
1151
|
+
...title === void 0 ? {} : { title },
|
|
1152
|
+
...description === void 0 ? {} : { description }
|
|
1153
|
+
});
|
|
1113
1154
|
function string(options = {}) {
|
|
1114
1155
|
return wrap(
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1156
|
+
annotated(
|
|
1157
|
+
options.minLength === void 0 ? Schema_exports.String : Schema_exports.String.check(Schema_exports.isMinLength(options.minLength)),
|
|
1158
|
+
options
|
|
1159
|
+
),
|
|
1160
|
+
false
|
|
1118
1161
|
);
|
|
1119
1162
|
}
|
|
1120
|
-
var number = () => wrap(Schema_exports.Finite,
|
|
1121
|
-
var boolean = () => wrap(Schema_exports.Boolean,
|
|
1163
|
+
var number = (options = {}) => wrap(annotated(Schema_exports.Finite, options), false);
|
|
1164
|
+
var boolean = (options = {}) => wrap(annotated(Schema_exports.Boolean, options), false);
|
|
1122
1165
|
var json = () => wrap(Schema_exports.Json, false);
|
|
1123
|
-
var record = (value) => wrap(
|
|
1166
|
+
var record = (value) => wrap(
|
|
1167
|
+
Schema_exports.Record(
|
|
1168
|
+
Schema_exports.String,
|
|
1169
|
+
decoderOf(schemaArgument(value, "The record() value"))
|
|
1170
|
+
),
|
|
1171
|
+
false
|
|
1172
|
+
);
|
|
1124
1173
|
function literal(value) {
|
|
1125
1174
|
if (typeof value === "number") Effect_exports.runSync(parse(Schema_exports.Finite, value));
|
|
1126
1175
|
return wrap(
|
|
@@ -1128,10 +1177,13 @@ function literal(value) {
|
|
|
1128
1177
|
false
|
|
1129
1178
|
);
|
|
1130
1179
|
}
|
|
1131
|
-
var array = (item) => wrap(Schema_exports.Array(decoderOf(item)), false);
|
|
1180
|
+
var array = (item) => wrap(Schema_exports.Array(decoderOf(schemaArgument(item, "The array() item"))), false);
|
|
1132
1181
|
function object(fields) {
|
|
1133
1182
|
const entries = Object.entries(fields).map(
|
|
1134
|
-
([key, field]) => [
|
|
1183
|
+
([key, field]) => [
|
|
1184
|
+
key,
|
|
1185
|
+
decoderOf(schemaArgument(field, `The object() field ${JSON.stringify(key)}`))
|
|
1186
|
+
]
|
|
1135
1187
|
);
|
|
1136
1188
|
const decoder = entries.length === 0 ? withJsonSchemaDocument(
|
|
1137
1189
|
// Native Struct({}) accepts every non-null value and retains undeclared fields.
|
|
@@ -1145,6 +1197,25 @@ function object(fields) {
|
|
|
1145
1197
|
) : Schema_exports.Struct(Object.fromEntries(entries));
|
|
1146
1198
|
return { ...wrap(decoder, false), fields: Object.freeze({ ...fields }) };
|
|
1147
1199
|
}
|
|
1200
|
+
var Exposure = /* @__PURE__ */ Symbol("apps.FieldExposure");
|
|
1201
|
+
var exposureOf = (schema) => Exposure in schema && (schema[Exposure] === "plain" || schema[Exposure] === "raw") ? schema[Exposure] : void 0;
|
|
1202
|
+
var expose = (schema, exposure) => (
|
|
1203
|
+
// SAFETY: the copy keeps every member of S, and `optional` and `default` keep the marking.
|
|
1204
|
+
{
|
|
1205
|
+
...schema,
|
|
1206
|
+
[Exposure]: exposure,
|
|
1207
|
+
optional: () => expose(schema.optional(), exposure),
|
|
1208
|
+
default: (value) => expose(schema.default(value), exposure)
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1211
|
+
var plain = (schema) => expose(schema, "plain");
|
|
1212
|
+
var raw = (schema) => expose(schema, "raw");
|
|
1213
|
+
var fieldExposure = (fields) => Object.fromEntries(
|
|
1214
|
+
Object.entries(fields).flatMap(([name, field]) => {
|
|
1215
|
+
const exposure = exposureOf(field);
|
|
1216
|
+
return exposure === void 0 ? [] : [[name, exposure]];
|
|
1217
|
+
})
|
|
1218
|
+
);
|
|
1148
1219
|
var ImportedJsonSchema = /* @__PURE__ */ Symbol("apps.JsonSchemaDocument");
|
|
1149
1220
|
var importedJsonSchema = (decoder) => ImportedJsonSchema in decoder ? decoder[ImportedJsonSchema] : void 0;
|
|
1150
1221
|
var withJsonSchemaDocument = (decoder, document) => Object.assign(decoder, { [ImportedJsonSchema]: document });
|
|
@@ -1160,7 +1231,7 @@ var withLazyJsonSchemaDocument = (decoder, document) => Object.defineProperty(de
|
|
|
1160
1231
|
var nestJsonSchema = (input, pointer) => {
|
|
1161
1232
|
const document = structuredClone(input);
|
|
1162
1233
|
const lookup = dereference(document);
|
|
1163
|
-
const
|
|
1234
|
+
const evaluated = evaluatedSchemas(document, lookup);
|
|
1164
1235
|
const pointers = /* @__PURE__ */ new Map();
|
|
1165
1236
|
const locate = (value, path) => {
|
|
1166
1237
|
if (!pointers.has(value)) pointers.set(value, path);
|
|
@@ -1174,8 +1245,7 @@ var nestJsonSchema = (input, pointer) => {
|
|
|
1174
1245
|
};
|
|
1175
1246
|
locate(document, pointer);
|
|
1176
1247
|
const references = /* @__PURE__ */ new Map();
|
|
1177
|
-
for (const schema of
|
|
1178
|
-
if (typeof schema === "boolean") continue;
|
|
1248
|
+
for (const schema of evaluated) {
|
|
1179
1249
|
const refs = {};
|
|
1180
1250
|
for (const [key, absolute] of [
|
|
1181
1251
|
["$ref", schema.__absolute_ref__],
|
|
@@ -1201,6 +1271,109 @@ var nestJsonSchema = (input, pointer) => {
|
|
|
1201
1271
|
Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
|
|
1202
1272
|
)(rewrite(document));
|
|
1203
1273
|
};
|
|
1274
|
+
var identifiers = /* @__PURE__ */ new Set([
|
|
1275
|
+
"$id",
|
|
1276
|
+
"id",
|
|
1277
|
+
"$anchor",
|
|
1278
|
+
"$recursiveAnchor",
|
|
1279
|
+
"$recursiveRef",
|
|
1280
|
+
"$dynamicAnchor",
|
|
1281
|
+
"$dynamicRef"
|
|
1282
|
+
]);
|
|
1283
|
+
var ownDefinition = (reference) => {
|
|
1284
|
+
if (typeof reference !== "string" || !reference.startsWith("#/$defs/")) return void 0;
|
|
1285
|
+
const segments = pointerSegments(reference);
|
|
1286
|
+
return segments.length === 2 ? segments[1] : void 0;
|
|
1287
|
+
};
|
|
1288
|
+
var definitionReferences = (schema) => {
|
|
1289
|
+
const names = /* @__PURE__ */ new Set();
|
|
1290
|
+
const pending = [schema];
|
|
1291
|
+
for (let value = pending.pop(); value !== void 0; value = pending.pop()) {
|
|
1292
|
+
if (!isSchemaObject(value)) continue;
|
|
1293
|
+
for (const [key, item] of Object.entries(value)) {
|
|
1294
|
+
if (identifiers.has(key)) return void 0;
|
|
1295
|
+
if (key === "$ref") {
|
|
1296
|
+
const name = ownDefinition(item);
|
|
1297
|
+
if (name === void 0) return void 0;
|
|
1298
|
+
names.add(name);
|
|
1299
|
+
} else if (Array.isArray(item)) {
|
|
1300
|
+
if (schemaArrays.has(key) || key === "items") pending.push(...item);
|
|
1301
|
+
} else if (schemaMaps.has(key) || key === "dependencies") {
|
|
1302
|
+
if (isJsonRecord(item)) pending.push(...Object.values(item));
|
|
1303
|
+
} else if (schemaNodes.has(key)) pending.push(item);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
return names;
|
|
1307
|
+
};
|
|
1308
|
+
var schemaMemo = () => {
|
|
1309
|
+
const ids = /* @__PURE__ */ new Map();
|
|
1310
|
+
const objectIds = /* @__PURE__ */ new WeakMap();
|
|
1311
|
+
const textId = (definition) => {
|
|
1312
|
+
const known = typeof definition === "object" && definition !== null ? objectIds.get(definition) : void 0;
|
|
1313
|
+
if (known !== void 0) return known;
|
|
1314
|
+
const text = JSON.stringify(definition);
|
|
1315
|
+
let id = ids.get(text);
|
|
1316
|
+
if (id === void 0) ids.set(text, id = ids.size);
|
|
1317
|
+
if (typeof definition === "object" && definition !== null) objectIds.set(definition, id);
|
|
1318
|
+
return id;
|
|
1319
|
+
};
|
|
1320
|
+
const referenced2 = /* @__PURE__ */ new WeakMap();
|
|
1321
|
+
const references = (definition) => {
|
|
1322
|
+
if (typeof definition !== "object" || definition === null)
|
|
1323
|
+
return definitionReferences(definition);
|
|
1324
|
+
if (referenced2.has(definition)) return referenced2.get(definition);
|
|
1325
|
+
const names = definitionReferences(definition);
|
|
1326
|
+
referenced2.set(definition, names);
|
|
1327
|
+
return names;
|
|
1328
|
+
};
|
|
1329
|
+
return { textId, references };
|
|
1330
|
+
};
|
|
1331
|
+
var rootDefinitions = (schema, memo) => {
|
|
1332
|
+
const definitions = schema.$defs ?? {};
|
|
1333
|
+
if (!isJsonRecord(definitions)) return void 0;
|
|
1334
|
+
const { $defs: _, ...root } = schema;
|
|
1335
|
+
for (const names of [
|
|
1336
|
+
definitionReferences(root),
|
|
1337
|
+
...Object.values(definitions).map(memo.references)
|
|
1338
|
+
]) {
|
|
1339
|
+
if (names === void 0) return void 0;
|
|
1340
|
+
for (const name of names) if (!Object.hasOwn(definitions, name)) return void 0;
|
|
1341
|
+
}
|
|
1342
|
+
return definitions;
|
|
1343
|
+
};
|
|
1344
|
+
var schemaIdentity = (schema, memo) => JSON.stringify(
|
|
1345
|
+
Object.entries(schema).map(
|
|
1346
|
+
([key, value]) => key === "$defs" && isJsonRecord(value) ? [key, Object.entries(value).map(([name, definition]) => [name, memo.textId(definition)])] : [key, value]
|
|
1347
|
+
)
|
|
1348
|
+
);
|
|
1349
|
+
var combineJsonSchemas = (schemas, pointer, memo = schemaMemo()) => {
|
|
1350
|
+
const shared = {};
|
|
1351
|
+
const kept = /* @__PURE__ */ new Map();
|
|
1352
|
+
const differs = (name, definition) => {
|
|
1353
|
+
if (!kept.has(name)) return false;
|
|
1354
|
+
const first = kept.get(name) ?? null;
|
|
1355
|
+
return first !== definition && memo.textId(first) !== memo.textId(definition);
|
|
1356
|
+
};
|
|
1357
|
+
const combined = schemas.map((schema, index) => {
|
|
1358
|
+
const definitions = rootDefinitions(schema, memo);
|
|
1359
|
+
const entries = Object.entries(definitions ?? {});
|
|
1360
|
+
if (definitions === void 0 || entries.some(([name, definition]) => differs(name, definition)))
|
|
1361
|
+
return nestJsonSchema(schema, pointer(index));
|
|
1362
|
+
for (const [name, definition] of entries) {
|
|
1363
|
+
if (kept.has(name)) continue;
|
|
1364
|
+
kept.set(name, definition);
|
|
1365
|
+
Object.defineProperty(shared, name, {
|
|
1366
|
+
value: definition,
|
|
1367
|
+
enumerable: true,
|
|
1368
|
+
writable: true,
|
|
1369
|
+
configurable: true
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
const { $defs: _, ...rest } = schema;
|
|
1373
|
+
return rest;
|
|
1374
|
+
});
|
|
1375
|
+
return kept.size === 0 ? { schemas: combined } : { $defs: shared, schemas: combined };
|
|
1376
|
+
};
|
|
1204
1377
|
var schemaMaps = /* @__PURE__ */ new Set([
|
|
1205
1378
|
"$defs",
|
|
1206
1379
|
"definitions",
|
|
@@ -1222,6 +1395,27 @@ var schemaNodes = /* @__PURE__ */ new Set([
|
|
|
1222
1395
|
"unevaluatedItems",
|
|
1223
1396
|
"propertyNames"
|
|
1224
1397
|
]);
|
|
1398
|
+
var isSchemaObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1399
|
+
var evaluatedSchemas = (root, lookup) => {
|
|
1400
|
+
const found = /* @__PURE__ */ new Set();
|
|
1401
|
+
const pending = [root];
|
|
1402
|
+
for (let value = pending.pop(); value !== void 0; value = pending.pop()) {
|
|
1403
|
+
if (!isSchemaObject(value) || found.has(value)) continue;
|
|
1404
|
+
found.add(value);
|
|
1405
|
+
for (const target of [value.__absolute_ref__, value.__absolute_recursive_ref__]) {
|
|
1406
|
+
const schema = target === void 0 ? void 0 : lookup[target];
|
|
1407
|
+
if (schema !== void 0) pending.push(schema);
|
|
1408
|
+
}
|
|
1409
|
+
for (const [key, item] of Object.entries(value)) {
|
|
1410
|
+
if (Array.isArray(item)) {
|
|
1411
|
+
if (schemaArrays.has(key) || key === "items") pending.push(...item);
|
|
1412
|
+
} else if (schemaMaps.has(key) || key === "dependencies") {
|
|
1413
|
+
if (isJsonRecord(item)) pending.push(...Object.values(item));
|
|
1414
|
+
} else if (schemaNodes.has(key)) pending.push(item);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
return found;
|
|
1418
|
+
};
|
|
1225
1419
|
function interpretedDocument(value) {
|
|
1226
1420
|
if (typeof value === "boolean") return value;
|
|
1227
1421
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
@@ -1274,18 +1468,425 @@ var containerKeywords = /* @__PURE__ */ new Set([
|
|
|
1274
1468
|
"else",
|
|
1275
1469
|
"dependentSchemas"
|
|
1276
1470
|
]);
|
|
1277
|
-
var
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1471
|
+
var echoableKey = (key) => /^[A-Za-z_$][\w$-]{0,63}$/.test(key);
|
|
1472
|
+
var schemaKey = (name) => echoableKey(name) ? name : JSON.stringify(name.slice(0, 64));
|
|
1473
|
+
var maxShapeKeys = 24;
|
|
1474
|
+
var objectShape = (keys, open, limit = maxShapeKeys) => {
|
|
1475
|
+
const listed = keys.slice(0, limit).map(({ name, optional }) => `${schemaKey(name)}${optional ? "?" : ""}`);
|
|
1476
|
+
const parts = [
|
|
1477
|
+
...listed,
|
|
1478
|
+
...keys.length > limit ? [`${keys.length - limit} more`] : [],
|
|
1479
|
+
...open ? ["..."] : []
|
|
1480
|
+
];
|
|
1481
|
+
return parts.length === 0 ? "object {} with no keys" : `object {${parts.join(", ")}}`;
|
|
1482
|
+
};
|
|
1483
|
+
var maxListedValues = 10;
|
|
1484
|
+
var maxValuesText = 200;
|
|
1485
|
+
var valueText = (value) => typeof value === "bigint" ? `${value}n` : JSON.stringify(value);
|
|
1486
|
+
var allowedValues = (values) => {
|
|
1487
|
+
const texts = [...new Set(values.map(valueText))];
|
|
1488
|
+
const listed = [];
|
|
1489
|
+
for (const text of texts) {
|
|
1490
|
+
if (listed.length === maxListedValues || [...listed, text].join(", ").length > maxValuesText)
|
|
1491
|
+
break;
|
|
1492
|
+
listed.push(text);
|
|
1493
|
+
}
|
|
1494
|
+
const [only] = listed;
|
|
1495
|
+
if (texts.length === 0) return "no value, since the schema allows none";
|
|
1496
|
+
if (only === void 0)
|
|
1497
|
+
return texts.length === 1 ? "a fixed value too long to list" : `one of ${texts.length} values too long to list`;
|
|
1498
|
+
if (texts.length === 1) return only;
|
|
1499
|
+
const rest = texts.length - listed.length;
|
|
1500
|
+
return `one of ${listed.join(", ")}${rest > 0 ? ` and ${rest} more` : ""}`;
|
|
1501
|
+
};
|
|
1502
|
+
var maxAlternativeKeys = 8;
|
|
1503
|
+
var maxAlternativesText = 360;
|
|
1504
|
+
var unionShape = (alternatives, selector) => {
|
|
1505
|
+
const listed = [];
|
|
1506
|
+
for (const alternative of alternatives) {
|
|
1507
|
+
if (listed.length > 0 && [...listed, alternative].join(" or ").length > maxAlternativesText)
|
|
1508
|
+
break;
|
|
1509
|
+
listed.push(alternative);
|
|
1510
|
+
}
|
|
1511
|
+
const rest = alternatives.length - listed.length;
|
|
1512
|
+
return `${[...listed, ...rest > 0 ? [`${rest} more`] : []].join(" or ")}${selector === void 0 ? "" : `, told apart by ${schemaKey(selector)}`}`;
|
|
1513
|
+
};
|
|
1514
|
+
var missingKey = (expected) => expected === void 0 ? missingKeyText : `${missingKeyText}. Expected ${expected}`;
|
|
1515
|
+
var missingKeyText = "Missing key";
|
|
1516
|
+
var isJsonRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1517
|
+
var pointerSegments = (pointer) => pointer === "#" || pointer === "" ? [] : pointer.replace(/^#?\//, "").split("/").map((segment) => decodeURIComponent(segment).replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
1518
|
+
var resolved = (lookup, uri2) => typeof uri2 === "string" && Object.hasOwn(lookup, uri2) ? lookup[uri2] : void 0;
|
|
1519
|
+
var referenced = (lookup, node) => isJsonRecord(node) ? resolved(lookup, Reflect.get(node, "__absolute_ref__") ?? node.$ref) : void 0;
|
|
1520
|
+
var memberKeywords = /* @__PURE__ */ new Set([...schemaMaps, ...schemaArrays, "dependencies"]);
|
|
1521
|
+
var combinators = /* @__PURE__ */ new Set(["allOf", "anyOf", "oneOf"]);
|
|
1522
|
+
var schemaAt = (document, lookup, segments) => {
|
|
1523
|
+
const anchoredAt = (node2, anchor2) => anchor2 === null && isJsonRecord(node2) && node2.$recursiveAnchor === true ? node2 : anchor2;
|
|
1524
|
+
const pending = [...segments];
|
|
1525
|
+
let node = document;
|
|
1526
|
+
let anchor = anchoredAt(document, null);
|
|
1527
|
+
for (let keyword = pending.shift(); keyword !== void 0; keyword = pending.shift()) {
|
|
1528
|
+
if (!isJsonRecord(node)) return void 0;
|
|
1529
|
+
if (keyword === "$recursiveRef") {
|
|
1530
|
+
const target = anchor === null ? resolved(lookup, Reflect.get(node, "__absolute_recursive_ref__")) : anchor;
|
|
1531
|
+
if (anchor !== null) node = anchor;
|
|
1532
|
+
anchor = target;
|
|
1533
|
+
continue;
|
|
1534
|
+
}
|
|
1535
|
+
if (keyword === "$ref") node = referenced(lookup, node);
|
|
1536
|
+
else {
|
|
1537
|
+
const value = Object.hasOwn(node, keyword) ? node[keyword] : void 0;
|
|
1538
|
+
if (memberKeywords.has(keyword) || keyword === "items" && Array.isArray(value)) {
|
|
1539
|
+
const member = pending.shift();
|
|
1540
|
+
if (member === void 0) return value;
|
|
1541
|
+
if (combinators.has(keyword) && node.$recursiveAnchor !== true) anchor = null;
|
|
1542
|
+
node = Array.isArray(value) ? /^\d+$/.test(member) ? value[Number(member)] : void 0 : isJsonRecord(value) && Object.hasOwn(value, member) ? value[member] : void 0;
|
|
1543
|
+
} else node = value;
|
|
1544
|
+
}
|
|
1545
|
+
anchor = anchoredAt(node, anchor);
|
|
1546
|
+
}
|
|
1547
|
+
return node;
|
|
1548
|
+
};
|
|
1549
|
+
var jsonObjectShape = (node) => {
|
|
1550
|
+
if (!isJsonRecord(node)) return "object";
|
|
1551
|
+
const properties = isJsonRecord(node.properties) ? Object.keys(node.properties) : [];
|
|
1552
|
+
const required = new Set(Array.isArray(node.required) ? node.required : []);
|
|
1553
|
+
const open = node.additionalProperties !== false || isJsonRecord(node.patternProperties) && Object.keys(node.patternProperties).length > 0;
|
|
1554
|
+
return properties.length === 0 && open ? "object" : objectShape(
|
|
1555
|
+
properties.map((name) => ({ name, optional: !required.has(name) })),
|
|
1556
|
+
open
|
|
1557
|
+
);
|
|
1558
|
+
};
|
|
1559
|
+
var locationKey = (segments) => JSON.stringify(segments);
|
|
1560
|
+
var emptyOutline = {
|
|
1561
|
+
types: void 0,
|
|
1562
|
+
properties: /* @__PURE__ */ new Map(),
|
|
1563
|
+
required: /* @__PURE__ */ new Set(),
|
|
1564
|
+
closed: false,
|
|
1565
|
+
values: void 0
|
|
1566
|
+
};
|
|
1567
|
+
var commonValues = (a, b) => a === void 0 ? b : b === void 0 ? a : a.filter((value) => b.some((other) => deepCompareStrict(value, other)));
|
|
1568
|
+
var strings = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
1569
|
+
var commonTypes = (a, b) => new Set(
|
|
1570
|
+
[...a].flatMap(
|
|
1571
|
+
(type) => b.has(type) ? [type] : type === "number" && b.has("integer") || type === "integer" && b.has("number") ? ["integer"] : []
|
|
1572
|
+
)
|
|
1573
|
+
);
|
|
1574
|
+
var mergeOutlines = (a, b) => ({
|
|
1575
|
+
types: a.types === void 0 ? b.types : b.types === void 0 ? a.types : commonTypes(a.types, b.types),
|
|
1576
|
+
properties: new Map([...a.properties, ...b.properties]),
|
|
1577
|
+
required: /* @__PURE__ */ new Set([...a.required, ...b.required]),
|
|
1578
|
+
closed: a.closed || b.closed,
|
|
1579
|
+
values: commonValues(a.values, b.values)
|
|
1580
|
+
});
|
|
1581
|
+
var outlineOf = (node, inspection, seen = /* @__PURE__ */ new Set()) => {
|
|
1582
|
+
if (!isJsonRecord(node) || seen.has(node)) return emptyOutline;
|
|
1583
|
+
const within = /* @__PURE__ */ new Set([...seen, node]);
|
|
1584
|
+
const own = {
|
|
1585
|
+
types: typeof node.type === "string" ? /* @__PURE__ */ new Set([node.type]) : Array.isArray(node.type) ? new Set(strings(node.type)) : void 0,
|
|
1586
|
+
properties: new Map(isJsonRecord(node.properties) ? Object.entries(node.properties) : []),
|
|
1587
|
+
required: new Set(strings(node.required)),
|
|
1588
|
+
closed: (node.additionalProperties === false || node.unevaluatedProperties === false) && !(isJsonRecord(node.patternProperties) && Object.keys(node.patternProperties).length > 0),
|
|
1589
|
+
values: commonValues(
|
|
1590
|
+
Object.hasOwn(node, "const") ? [node.const] : void 0,
|
|
1591
|
+
Array.isArray(node.enum) ? node.enum : void 0
|
|
1592
|
+
)
|
|
1593
|
+
};
|
|
1594
|
+
return [inspection.referenced(node), ...Array.isArray(node.allOf) ? node.allOf : []].reduce(
|
|
1595
|
+
(outline, member) => mergeOutlines(outline, outlineOf(member, inspection, within)),
|
|
1596
|
+
own
|
|
1597
|
+
);
|
|
1598
|
+
};
|
|
1599
|
+
var otherConstraints = "a value with other constraints";
|
|
1600
|
+
var outlineText = (outline, limit) => {
|
|
1601
|
+
if (outline.values !== void 0) return allowedValues(outline.values);
|
|
1602
|
+
const names = [
|
|
1603
|
+
...outline.properties.keys(),
|
|
1604
|
+
...[...outline.required].filter((name) => !outline.properties.has(name))
|
|
1605
|
+
];
|
|
1606
|
+
const shape = names.length === 0 && !outline.closed ? "object" : objectShape(
|
|
1607
|
+
names.map((name) => ({ name, optional: !outline.required.has(name) })),
|
|
1608
|
+
!outline.closed,
|
|
1609
|
+
limit
|
|
1610
|
+
);
|
|
1611
|
+
if (outline.types === void 0)
|
|
1612
|
+
return names.length > 0 || outline.closed ? shape : otherConstraints;
|
|
1613
|
+
return [...outline.types].map((type) => type === "object" ? shape : type).join(" or ");
|
|
1614
|
+
};
|
|
1615
|
+
var describeOutline = (outline) => outlineText(outline, maxAlternativeKeys);
|
|
1616
|
+
var typed = (outline) => outline.values !== void 0 || outline.types !== void 0;
|
|
1617
|
+
var describeProperty = (node, inspection) => {
|
|
1618
|
+
const target = inspection.referenced(node) ?? node;
|
|
1619
|
+
if (isJsonRecord(target) && Object.hasOwn(target, "oneOf")) return void 0;
|
|
1620
|
+
const outline = outlineOf(node, inspection);
|
|
1621
|
+
if (typed(outline)) return outlineText(outline, maxShapeKeys);
|
|
1622
|
+
const members = isJsonRecord(target) && Array.isArray(target.anyOf) ? target.anyOf : [];
|
|
1623
|
+
const outlines = members.filter((member) => member !== false).map((member) => outlineOf(member, inspection));
|
|
1624
|
+
return outlines.length === 0 || !outlines.every(typed) ? void 0 : unionShape([...new Set(outlines.map(describeOutline))], void 0);
|
|
1625
|
+
};
|
|
1626
|
+
var maxPatternText = 160;
|
|
1627
|
+
var count = (amount, noun) => `${amount} ${noun}${amount === 1 ? "" : "s"}`;
|
|
1628
|
+
var constraintProblem = (keyword, node) => {
|
|
1629
|
+
if (!isJsonRecord(node)) return void 0;
|
|
1630
|
+
const value = node[keyword];
|
|
1631
|
+
if (keyword === "pattern")
|
|
1632
|
+
return typeof value !== "string" ? void 0 : value.length <= maxPatternText ? `Expected a string matching the pattern ${JSON.stringify(value)}` : "Expected a string matching the schema's pattern, which is too long to show";
|
|
1633
|
+
if (keyword === "format")
|
|
1634
|
+
return typeof value === "string" ? `Expected a string in the ${JSON.stringify(value.slice(0, 64))} format` : void 0;
|
|
1635
|
+
if (keyword === "uniqueItems") return "Expected an array without repeated items";
|
|
1636
|
+
if (typeof value !== "number") return void 0;
|
|
1637
|
+
switch (keyword) {
|
|
1638
|
+
// Draft 4's boolean `exclusiveMinimum` is not applied: imported schemas validate as draft 7
|
|
1639
|
+
// or 2020-12, where `minimum` and `maximum` always include their bound.
|
|
1640
|
+
case "minimum":
|
|
1641
|
+
return `Expected a number of at least ${value}`;
|
|
1642
|
+
case "maximum":
|
|
1643
|
+
return `Expected a number of at most ${value}`;
|
|
1644
|
+
case "exclusiveMinimum":
|
|
1645
|
+
return `Expected a number greater than ${value}`;
|
|
1646
|
+
case "exclusiveMaximum":
|
|
1647
|
+
return `Expected a number less than ${value}`;
|
|
1648
|
+
case "multipleOf":
|
|
1649
|
+
return `Expected a multiple of ${value}`;
|
|
1650
|
+
case "minLength":
|
|
1651
|
+
return `Expected a string of at least ${count(value, "character")}`;
|
|
1652
|
+
case "maxLength":
|
|
1653
|
+
return `Expected a string of at most ${count(value, "character")}`;
|
|
1654
|
+
case "minItems":
|
|
1655
|
+
return `Expected an array of at least ${count(value, "item")}`;
|
|
1656
|
+
case "maxItems":
|
|
1657
|
+
return `Expected an array of at most ${count(value, "item")}`;
|
|
1658
|
+
case "minProperties":
|
|
1659
|
+
return `Expected an object with at least ${count(value, "key")}`;
|
|
1660
|
+
case "maxProperties":
|
|
1661
|
+
return `Expected an object with at most ${count(value, "key")}`;
|
|
1662
|
+
default:
|
|
1663
|
+
return void 0;
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
var overlap = (outline, value, inspection, depth = 0) => !isJsonRecord(value) || depth > 16 ? 0 : Object.entries(value).reduce((total, [key, item]) => {
|
|
1667
|
+
const property = outline.properties.get(key);
|
|
1668
|
+
return property === void 0 ? total : total + 1 + overlap(outlineOf(property, inspection), item, inspection, depth + 1);
|
|
1669
|
+
}, 0);
|
|
1670
|
+
var jsonType = (value) => value === null ? "null" : Array.isArray(value) ? "array" : typeof value === "object" ? "object" : typeof value;
|
|
1671
|
+
var accepted = (outline, value) => {
|
|
1672
|
+
const type = jsonType(value);
|
|
1673
|
+
if (outline.values !== void 0)
|
|
1674
|
+
return outline.values.some((allowed) => jsonType(allowed) === type);
|
|
1675
|
+
if (outline.types === void 0) return true;
|
|
1676
|
+
return outline.types.has(type) || type === "number" && outline.types.has("integer") && Number.isInteger(value);
|
|
1677
|
+
};
|
|
1678
|
+
var valueAt = (input, location2) => location2.reduce(
|
|
1679
|
+
(value, segment) => Array.isArray(value) ? value[Number(segment)] : isJsonRecord(value) && Object.hasOwn(value, segment) ? value[segment] : void 0,
|
|
1680
|
+
input
|
|
1681
|
+
);
|
|
1682
|
+
var discriminatorOf = (holder) => isJsonRecord(holder) && isJsonRecord(holder.discriminator) ? holder.discriminator : void 0;
|
|
1683
|
+
var definitionName = (reference) => {
|
|
1684
|
+
if (typeof reference !== "string" || !reference.startsWith("#/")) return void 0;
|
|
1685
|
+
const segments = pointerSegments(reference);
|
|
1686
|
+
const container = segments.at(-2);
|
|
1687
|
+
return container === "$defs" || container === "definitions" || container === "schemas" && segments.at(-3) === "components" ? segments.at(-1) : void 0;
|
|
1688
|
+
};
|
|
1689
|
+
var discriminatedName = (holder, value) => {
|
|
1690
|
+
const discriminator = discriminatorOf(holder);
|
|
1691
|
+
if (discriminator === void 0 || typeof value !== "string") return void 0;
|
|
1692
|
+
const { mapping } = discriminator;
|
|
1693
|
+
const target = isJsonRecord(mapping) && Object.hasOwn(mapping, value) ? mapping[value] : value;
|
|
1694
|
+
if (typeof target !== "string") return void 0;
|
|
1695
|
+
return /^[\w.-]+$/.test(target) ? target : definitionName(target);
|
|
1696
|
+
};
|
|
1697
|
+
var selectorOf = (holder, alternatives, inspection) => {
|
|
1698
|
+
const declared = discriminatorOf(holder)?.propertyName;
|
|
1699
|
+
if (typeof declared === "string") return declared;
|
|
1700
|
+
const [first] = alternatives;
|
|
1701
|
+
if (first === void 0 || alternatives.length < 2) return void 0;
|
|
1702
|
+
return [...first.properties.keys()].find(
|
|
1703
|
+
(key) => alternatives.every(
|
|
1704
|
+
(alternative) => alternative.properties.has(key) && outlineOf(alternative.properties.get(key), inspection).values !== void 0
|
|
1705
|
+
)
|
|
1706
|
+
);
|
|
1707
|
+
};
|
|
1708
|
+
var alternativeErrors = (errors, head, schemas) => {
|
|
1709
|
+
const prefix = `${errors[head]?.keywordLocation}/`;
|
|
1710
|
+
const alternatives = /* @__PURE__ */ new Map();
|
|
1711
|
+
const settle = (current2, next) => {
|
|
1712
|
+
const collected = alternatives.get(current2);
|
|
1713
|
+
const rejected = Array.isArray(schemas) ? schemas.slice(current2 + 1, next).filter((schema) => schema === false).length : 0;
|
|
1714
|
+
if (collected !== void 0) collected.splice(collected.length - rejected, rejected);
|
|
1715
|
+
};
|
|
1716
|
+
let index = head + 1;
|
|
1717
|
+
let current = -1;
|
|
1718
|
+
for (; index < errors.length; index++) {
|
|
1719
|
+
const error = errors[index];
|
|
1720
|
+
if (error === void 0) break;
|
|
1721
|
+
if (error.keywordLocation.startsWith(prefix)) {
|
|
1722
|
+
const alternative = Number(error.keywordLocation.slice(prefix.length).split("/")[0]);
|
|
1723
|
+
if (alternative !== current) settle(current, alternative);
|
|
1724
|
+
current = alternative;
|
|
1725
|
+
} else if (error.keyword !== "false") break;
|
|
1726
|
+
if (current >= 0) alternatives.set(current, [...alternatives.get(current) ?? [], error]);
|
|
1727
|
+
}
|
|
1728
|
+
settle(current, Array.isArray(schemas) ? schemas.length : current);
|
|
1729
|
+
return { alternatives, end: index };
|
|
1730
|
+
};
|
|
1731
|
+
var pathOf = (location2) => location2.map((segment) => /^\d+$/.test(segment) ? Number(segment) : segment);
|
|
1732
|
+
var unionProblems = (union, schemas, errorsByAlternative, inspection) => {
|
|
1733
|
+
const location2 = pointerSegments(union.instanceLocation);
|
|
1734
|
+
const path = pathOf(location2);
|
|
1735
|
+
if (!Array.isArray(schemas))
|
|
1736
|
+
return [
|
|
1737
|
+
{ path, issue: `Failed the "${union.keyword}" constraint` },
|
|
1738
|
+
...[...errorsByAlternative.values()].flatMap((errors) => problemsOf(errors, inspection))
|
|
1739
|
+
];
|
|
1740
|
+
const alternatives = schemas.flatMap(
|
|
1741
|
+
(schema, index) => schema === false ? [] : [
|
|
1742
|
+
{
|
|
1743
|
+
schema,
|
|
1744
|
+
matched: !errorsByAlternative.has(index),
|
|
1745
|
+
problems: () => problemsOf(errorsByAlternative.get(index) ?? [], inspection)
|
|
1746
|
+
}
|
|
1747
|
+
]
|
|
1748
|
+
);
|
|
1749
|
+
const [only] = alternatives;
|
|
1750
|
+
if (only === void 0) return [{ path, issue: "No value is allowed here" }];
|
|
1751
|
+
if (alternatives.length === 1) return only.problems();
|
|
1752
|
+
const holder = inspection.schemaAt(pointerSegments(union.keywordLocation).slice(0, -1));
|
|
1753
|
+
const shared = outlineOf(holder, inspection);
|
|
1754
|
+
const own = alternatives.map(({ schema }) => outlineOf(schema, inspection));
|
|
1755
|
+
const outlines = own.map((outline) => mergeOutlines(shared, outline));
|
|
1756
|
+
const selector = selectorOf(holder, own, inspection);
|
|
1757
|
+
const expected = `Expected ${unionShape(outlines.map(describeOutline), selector)}`;
|
|
1758
|
+
const matched = alternatives.filter((alternative) => alternative.matched).length;
|
|
1759
|
+
if (union.keyword === "oneOf" && matched > 1)
|
|
1760
|
+
return [{ path, issue: `${expected}. Exactly one may match, but ${matched} do` }];
|
|
1761
|
+
const fixed = outlines.flatMap(({ values }) => values === void 0 ? [] : [values]);
|
|
1762
|
+
if (fixed.length === outlines.length)
|
|
1763
|
+
return [
|
|
1764
|
+
{
|
|
1765
|
+
path,
|
|
1766
|
+
issue: union.keyword === "oneOf" ? `${expected}. Exactly one alternative must match` : `Expected ${allowedValues(fixed.flat())}`
|
|
1767
|
+
}
|
|
1768
|
+
];
|
|
1769
|
+
const value = valueAt(inspection.input, location2);
|
|
1770
|
+
const selectorValue = selector !== void 0 && isJsonRecord(value) && Object.hasOwn(value, selector) ? { value: value[selector] } : void 0;
|
|
1771
|
+
const named = discriminatedName(holder, selectorValue?.value);
|
|
1772
|
+
const ranked = alternatives.map(({ schema, problems }, index) => {
|
|
1773
|
+
const outline = outlines[index] ?? emptyOutline;
|
|
1774
|
+
const property = own[index]?.properties.get(selector ?? "");
|
|
1775
|
+
return {
|
|
1776
|
+
index,
|
|
1777
|
+
problems: problems(),
|
|
1778
|
+
selected: selectorValue !== void 0 && (named !== void 0 && isJsonRecord(schema) && definitionName(schema.$ref) === named || property !== void 0 && outlineOf(property, inspection).values !== void 0 && inspection.accepts(property, selectorValue.value)),
|
|
1779
|
+
typed: accepted(outline, value),
|
|
1780
|
+
overlap: overlap(outline, value, inspection)
|
|
1286
1781
|
};
|
|
1287
|
-
return [issue];
|
|
1288
1782
|
});
|
|
1783
|
+
const closest = ranked.reduce(
|
|
1784
|
+
(best, candidate) => ([
|
|
1785
|
+
Number(candidate.selected) - Number(best.selected),
|
|
1786
|
+
Number(candidate.typed) - Number(best.typed),
|
|
1787
|
+
candidate.overlap - best.overlap,
|
|
1788
|
+
best.problems.length - candidate.problems.length
|
|
1789
|
+
].find((difference) => difference !== 0) ?? 0) > 0 ? candidate : best
|
|
1790
|
+
);
|
|
1791
|
+
return closest.selected || closest.typed ? [
|
|
1792
|
+
{
|
|
1793
|
+
path,
|
|
1794
|
+
issue: `${expected}. Closest is alternative ${closest.index + 1}, whose problems follow`
|
|
1795
|
+
},
|
|
1796
|
+
...closest.problems
|
|
1797
|
+
] : [{ path, issue: expected }];
|
|
1798
|
+
};
|
|
1799
|
+
var problemsOf = (errors, inspection) => {
|
|
1800
|
+
const closed = /* @__PURE__ */ new Map();
|
|
1801
|
+
const problems = [];
|
|
1802
|
+
for (let index = 0; index < errors.length; index++) {
|
|
1803
|
+
const error = errors[index];
|
|
1804
|
+
if (error === void 0) break;
|
|
1805
|
+
const { keyword, instanceLocation, keywordLocation } = error;
|
|
1806
|
+
if (keyword === "anyOf" || keyword === "oneOf") {
|
|
1807
|
+
const schemas = inspection.schemaAt(pointerSegments(keywordLocation));
|
|
1808
|
+
const { alternatives, end } = alternativeErrors(errors, index, schemas);
|
|
1809
|
+
problems.push(...unionProblems(error, schemas, alternatives, inspection));
|
|
1810
|
+
index = end - 1;
|
|
1811
|
+
continue;
|
|
1812
|
+
}
|
|
1813
|
+
const location2 = pointerSegments(instanceLocation);
|
|
1814
|
+
const path = pathOf(location2);
|
|
1815
|
+
const problem = (issue, at = path) => problems.push({ path: at, issue });
|
|
1816
|
+
const node = () => inspection.schemaAt(pointerSegments(keywordLocation).slice(0, -1));
|
|
1817
|
+
if (keyword === "additionalProperties" || keyword === "unevaluatedProperties") {
|
|
1818
|
+
closed.set(locationKey(location2), node());
|
|
1819
|
+
continue;
|
|
1820
|
+
}
|
|
1821
|
+
if (containerKeywords.has(keyword)) continue;
|
|
1822
|
+
if (keyword === "false") {
|
|
1823
|
+
const key = location2.at(-1);
|
|
1824
|
+
const parent = locationKey(location2.slice(0, -1));
|
|
1825
|
+
if (key === void 0 || !closed.has(parent)) problem("No value is allowed here");
|
|
1826
|
+
else
|
|
1827
|
+
problem(
|
|
1828
|
+
`Unexpected key${echoableKey(key) ? ` "${key}"` : ""}. Expected ${jsonObjectShape(closed.get(parent))}`,
|
|
1829
|
+
path.slice(0, -1)
|
|
1830
|
+
);
|
|
1831
|
+
continue;
|
|
1832
|
+
}
|
|
1833
|
+
const required = keyword === "required" ? /required property "([^"]*)"/.exec(error.error) : null;
|
|
1834
|
+
if (required !== null) {
|
|
1835
|
+
const name = required[1] ?? "";
|
|
1836
|
+
const property = outlineOf(node(), inspection).properties.get(name);
|
|
1837
|
+
problem(
|
|
1838
|
+
missingKey(property === void 0 ? void 0 : describeProperty(property, inspection)),
|
|
1839
|
+
[...path, name]
|
|
1840
|
+
);
|
|
1841
|
+
continue;
|
|
1842
|
+
}
|
|
1843
|
+
const expected = keyword === "type" ? /Expected "([^.]*)"\.?$/.exec(error.error) : null;
|
|
1844
|
+
if (expected !== null) {
|
|
1845
|
+
const types = (expected[1] ?? "").split('", "').map((type) => type === "object" ? jsonObjectShape(node()) : type);
|
|
1846
|
+
problem(`Expected ${types.join(" or ")}`);
|
|
1847
|
+
continue;
|
|
1848
|
+
}
|
|
1849
|
+
if (keyword === "const" || keyword === "enum") {
|
|
1850
|
+
const schema = node();
|
|
1851
|
+
const values = !isJsonRecord(schema) ? void 0 : keyword === "const" ? Object.hasOwn(schema, "const") ? [schema.const] : void 0 : Array.isArray(schema.enum) ? schema.enum : void 0;
|
|
1852
|
+
problem(
|
|
1853
|
+
values === void 0 ? "Expected one of the allowed values" : `Expected ${allowedValues(values)}`
|
|
1854
|
+
);
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1857
|
+
problem(constraintProblem(keyword, node()) ?? `Failed the "${keyword}" constraint`);
|
|
1858
|
+
}
|
|
1859
|
+
return problems;
|
|
1860
|
+
};
|
|
1861
|
+
var documentKeys = (document) => {
|
|
1862
|
+
const named = /* @__PURE__ */ new Set();
|
|
1863
|
+
let any = false;
|
|
1864
|
+
const visit = (node, depth) => {
|
|
1865
|
+
if (depth > 64 || typeof node !== "object" || node === null) return;
|
|
1866
|
+
if (Array.isArray(node)) {
|
|
1867
|
+
for (const item of node) visit(item, depth + 1);
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
const record2 = node;
|
|
1871
|
+
if (isJsonRecord(record2.properties))
|
|
1872
|
+
for (const name of Object.keys(record2.properties)) named.add(name);
|
|
1873
|
+
for (const name of strings(record2.required)) named.add(name);
|
|
1874
|
+
if (isJsonRecord(record2.dependentRequired))
|
|
1875
|
+
for (const [name, names] of Object.entries(record2.dependentRequired)) {
|
|
1876
|
+
named.add(name);
|
|
1877
|
+
for (const other of strings(names)) named.add(other);
|
|
1878
|
+
}
|
|
1879
|
+
if (isJsonRecord(record2.patternProperties) && Object.keys(record2.patternProperties).length > 0 || isJsonRecord(record2.additionalProperties) || isJsonRecord(record2.unevaluatedProperties))
|
|
1880
|
+
any = true;
|
|
1881
|
+
for (const value of Object.values(record2)) visit(value, depth + 1);
|
|
1882
|
+
};
|
|
1883
|
+
visit(document, 0);
|
|
1884
|
+
return (key) => any || named.has(key);
|
|
1885
|
+
};
|
|
1886
|
+
var importedKeys = /* @__PURE__ */ new WeakMap();
|
|
1887
|
+
var importedSchemaKeys = (check) => importedKeys.get(check);
|
|
1888
|
+
var jsonSchemaProblems = (errors, inspection) => {
|
|
1889
|
+
const problems = problemsOf(errors, inspection);
|
|
1289
1890
|
return problems.length === 0 ? false : problems;
|
|
1290
1891
|
};
|
|
1291
1892
|
var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
|
|
@@ -1296,8 +1897,7 @@ var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
|
|
|
1296
1897
|
if (normalized === null || typeof normalized !== "object" || Array.isArray(normalized))
|
|
1297
1898
|
throw new ValidationError();
|
|
1298
1899
|
const lookup = dereference(normalized);
|
|
1299
|
-
for (const schema of
|
|
1300
|
-
if (typeof schema === "boolean") continue;
|
|
1900
|
+
for (const schema of evaluatedSchemas(normalized, lookup)) {
|
|
1301
1901
|
for (const pattern of [schema.pattern, ...Object.keys(schema.patternProperties ?? {})]) {
|
|
1302
1902
|
if (pattern === void 0) continue;
|
|
1303
1903
|
try {
|
|
@@ -1312,28 +1912,42 @@ var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
|
|
|
1312
1912
|
throw new ValidationError();
|
|
1313
1913
|
}
|
|
1314
1914
|
}
|
|
1915
|
+
const inspection = (input) => ({
|
|
1916
|
+
schemaAt: (segments) => schemaAt(normalized, lookup, segments),
|
|
1917
|
+
referenced: (node) => referenced(lookup, node),
|
|
1918
|
+
accepts: (node, value) => {
|
|
1919
|
+
if (typeof node !== "boolean" && !isJsonRecord(node)) return false;
|
|
1920
|
+
try {
|
|
1921
|
+
return validate(value, node, draft, lookup).valid;
|
|
1922
|
+
} catch {
|
|
1923
|
+
return false;
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
input
|
|
1927
|
+
});
|
|
1315
1928
|
return {
|
|
1316
|
-
validate: (input) => validate(input, normalized, draft, lookup)
|
|
1929
|
+
validate: (input) => validate(input, normalized, draft, lookup),
|
|
1930
|
+
inspection
|
|
1317
1931
|
};
|
|
1318
1932
|
},
|
|
1319
1933
|
catch: () => new ValidationError()
|
|
1320
1934
|
});
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
{ expected: "a value matching a supported imported JSON Schema" }
|
|
1332
|
-
)
|
|
1935
|
+
const check = Schema_exports.makeFilter(
|
|
1936
|
+
(value) => {
|
|
1937
|
+
try {
|
|
1938
|
+
const result = validator.validate(value);
|
|
1939
|
+
return result.valid || jsonSchemaProblems(result.errors, validator.inspection(value));
|
|
1940
|
+
} catch {
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
},
|
|
1944
|
+
{ expected: "a value matching a supported imported JSON Schema" }
|
|
1333
1945
|
);
|
|
1946
|
+
importedKeys.set(check, documentKeys(document));
|
|
1947
|
+
const decoder = Schema_exports.Json.check(check);
|
|
1334
1948
|
return Object.assign(decoder, { [ImportedJsonSchema]: document });
|
|
1335
1949
|
});
|
|
1336
|
-
var
|
|
1950
|
+
var lazyCompiledDecoder = (document) => {
|
|
1337
1951
|
const read = once(document);
|
|
1338
1952
|
let compiled;
|
|
1339
1953
|
const compile = Effect_exports.suspend(
|
|
@@ -1353,9 +1967,11 @@ var lazyDecoder = (document) => {
|
|
|
1353
1967
|
Effect_exports.flatMap((schema) => SchemaParser_exports.decodeUnknownEffect(schema)(input, options))
|
|
1354
1968
|
)
|
|
1355
1969
|
);
|
|
1356
|
-
return withLazyJsonSchemaDocument(decoder, read);
|
|
1970
|
+
return { decoder: withLazyJsonSchemaDocument(decoder, read), compile };
|
|
1357
1971
|
};
|
|
1972
|
+
var lazyDecoder = (document) => lazyCompiledDecoder(document).decoder;
|
|
1358
1973
|
var lazyJsonSchemaDecoder = (document) => Effect_exports.sync(() => lazyDecoder(document));
|
|
1974
|
+
var preparedJsonSchemaDecoder = (document) => lazyCompiledDecoder(() => document);
|
|
1359
1975
|
var isJsonValue = Schema_exports.is(Schema_exports.Json);
|
|
1360
1976
|
var jsonDocument = (input) => {
|
|
1361
1977
|
if (typeof input !== "object" || input === null || Array.isArray(input)) return void 0;
|
|
@@ -1385,9 +2001,6 @@ var jsonSchema = (input) => {
|
|
|
1385
2001
|
false
|
|
1386
2002
|
);
|
|
1387
2003
|
};
|
|
1388
|
-
var storageFieldOf = (schema) => schema[StorageField];
|
|
1389
|
-
var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
|
|
1390
|
-
var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
|
|
1391
2004
|
var jsonSchemaDocument = (decoder) => {
|
|
1392
2005
|
const imported = importedJsonSchema(decoder);
|
|
1393
2006
|
if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
|
|
@@ -1402,7 +2015,9 @@ var jsonSchemaDocument = (decoder) => {
|
|
|
1402
2015
|
export {
|
|
1403
2016
|
decoderOf,
|
|
1404
2017
|
isSchema,
|
|
2018
|
+
schemaArgument,
|
|
1405
2019
|
parse,
|
|
2020
|
+
parseDeclaration,
|
|
1406
2021
|
wrap,
|
|
1407
2022
|
string,
|
|
1408
2023
|
number,
|
|
@@ -1412,16 +2027,28 @@ export {
|
|
|
1412
2027
|
literal,
|
|
1413
2028
|
array,
|
|
1414
2029
|
object,
|
|
2030
|
+
plain,
|
|
2031
|
+
raw,
|
|
2032
|
+
fieldExposure,
|
|
1415
2033
|
importedJsonSchema,
|
|
1416
2034
|
once,
|
|
1417
2035
|
withLazyJsonSchemaDocument,
|
|
1418
2036
|
nestJsonSchema,
|
|
2037
|
+
schemaMemo,
|
|
2038
|
+
schemaIdentity,
|
|
2039
|
+
combineJsonSchemas,
|
|
2040
|
+
echoableKey,
|
|
2041
|
+
objectShape,
|
|
2042
|
+
allowedValues,
|
|
2043
|
+
maxAlternativeKeys,
|
|
2044
|
+
unionShape,
|
|
2045
|
+
missingKey,
|
|
2046
|
+
missingKeyText,
|
|
2047
|
+
importedSchemaKeys,
|
|
1419
2048
|
compileJsonSchemaDecoder,
|
|
1420
2049
|
lazyJsonSchemaDecoder,
|
|
2050
|
+
preparedJsonSchemaDecoder,
|
|
1421
2051
|
jsonSchemaDecoder,
|
|
1422
2052
|
jsonSchema,
|
|
1423
|
-
storageFieldOf,
|
|
1424
|
-
id,
|
|
1425
|
-
userId,
|
|
1426
2053
|
jsonSchemaDocument
|
|
1427
2054
|
};
|