@beff/cli 0.0.94 → 0.0.96

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @beff/cli
2
2
 
3
+ ## 0.0.96
4
+
5
+ ### Patch Changes
6
+
7
+ - add .describe
8
+
9
+ ## 0.0.95
10
+
11
+ ### Patch Changes
12
+
13
+ - Add b.ReadOnlyArray
14
+
3
15
  ## 0.0.94
4
16
 
5
17
  ### Patch Changes
package/dist-cli/cli.js CHANGED
@@ -45781,7 +45781,7 @@ var fs = __toESM(require("fs"));
45781
45781
  var path = __toESM(require("path"));
45782
45782
 
45783
45783
  // ts-node/generated/bundle.ts
45784
- var bundle_default = { "build-parsers.js": '\n\nfunction buildParsers(args) {\n const stringFormats = args?.stringFormats ?? {};\n \n for (const k of RequiredStringFormats) {\n if (stringFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n\n Object.keys(stringFormats).forEach((k) => {\n const v = stringFormats[k];\n \n registerStringFormatter(k, v);\n });\n\n const numberFormats = args?.numberFormats ?? {};\n \n for (const k of RequiredNumberFormats) {\n if (numberFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n\n Object.keys(numberFormats).forEach((k) => {\n const v = numberFormats[k];\n \n registerNumberFormatter(k, v);\n });\n\n let decoders = {};\n \n Object.keys(buildValidatorsInput).forEach((k) => {\n \n let v = buildValidatorsInput[k];\n const validate = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ctx = { disallowExtraProperties };\n const ok = v(ctx, input);\n if (typeof ok !== "boolean") {\n throw new Error("INTERNAL ERROR: Expected boolean");\n }\n return ok;\n };\n\n \n const schemaFn = buildSchemaInput[k];\n const schema = () => {\n const ctx = {\n path: [],\n seen: {},\n };\n return schemaFn(ctx);\n };\n\n const safeParse = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ok = validate(input, options);\n if (ok) {\n \n let p = buildParsersInput[k];\n let ctx = { disallowExtraProperties };\n const parsed = p(ctx, input);\n return { success: true, data: parsed };\n }\n \n let e = buildReportersInput[k];\n let ctx = { path: [], disallowExtraProperties };\n return {\n success: false,\n errors: e(ctx, input).slice(0, 10),\n };\n };\n const parse = (input, options) => {\n const safe = safeParse(input, options);\n if (safe.success) {\n return safe.data;\n }\n \n const explained = printErrors(safe.errors, []);\n throw new Error(`Failed to parse ${k} - ${explained}`);\n };\n const zod = () => {\n \n return z.custom(\n (data) => safeParse(data).success,\n (val) => {\n const errors = safeParse(val).errors;\n \n return printErrors(errors, []);\n },\n );\n };\n decoders[k] = {\n parse,\n safeParse,\n zod,\n name: k,\n validate,\n schema,\n };\n });\n return decoders;\n}\n', "decoders.js": '\n\n\n\n\n\nconst JSON_PROTO = Object.getPrototypeOf({});\n\nfunction deepmergeConstructor(options) {\n function isNotPrototypeKey(value) {\n return value !== "constructor" && value !== "prototype" && value !== "__proto__";\n }\n\n function cloneArray(value) {\n let i = 0;\n const il = value.length;\n const result = new Array(il);\n for (i; i < il; ++i) {\n result[i] = clone(value[i]);\n }\n return result;\n }\n\n function cloneObject(target) {\n const result = {};\n\n if (cloneProtoObject && Object.getPrototypeOf(target) !== JSON_PROTO) {\n return cloneProtoObject(target);\n }\n\n const targetKeys = getKeys(target);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey((key = targetKeys[i])) && (result[key] = clone(target[key]));\n }\n return result;\n }\n\n function concatArrays(target, source) {\n const tl = target.length;\n const sl = source.length;\n let i = 0;\n const result = new Array(tl + sl);\n for (i; i < tl; ++i) {\n result[i] = clone(target[i]);\n }\n for (i = 0; i < sl; ++i) {\n result[i + tl] = clone(source[i]);\n }\n return result;\n }\n\n const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;\n function getSymbolsAndKeys(value) {\n const result = Object.keys(value);\n const keys = Object.getOwnPropertySymbols(value);\n for (let i = 0, il = keys.length; i < il; ++i) {\n \n propertyIsEnumerable.call(value, keys[i]) && result.push(keys[i]);\n }\n return result;\n }\n\n const getKeys = options?.symbols ? getSymbolsAndKeys : Object.keys;\n\n const cloneProtoObject =\n typeof options?.cloneProtoObject === "function" ? options.cloneProtoObject : undefined;\n\n function isMergeableObject(value) {\n return (\n typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date)\n );\n }\n\n function isPrimitive(value) {\n return typeof value !== "object" || value === null;\n }\n\n const isPrimitiveOrBuiltIn =\n \n typeof Buffer !== "undefined"\n ? (value) =>\n typeof value !== "object" ||\n value === null ||\n value instanceof RegExp ||\n value instanceof Date ||\n \n value instanceof Buffer\n : (value) =>\n typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date;\n\n const mergeArray =\n options && typeof options.mergeArray === "function"\n ? options.mergeArray({ clone, deepmerge: _deepmerge, getKeys, isMergeableObject })\n : concatArrays;\n\n function clone(entry) {\n return isMergeableObject(entry) ? (Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry)) : entry;\n }\n\n function mergeObject(target, source) {\n const result = {};\n const targetKeys = getKeys(target);\n const sourceKeys = getKeys(source);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey((key = targetKeys[i])) &&\n sourceKeys.indexOf(key) === -1 &&\n (result[key] = clone(target[key]));\n }\n\n for (i = 0, il = sourceKeys.length; i < il; ++i) {\n if (!isNotPrototypeKey((key = sourceKeys[i]))) {\n continue;\n }\n\n if (key in target) {\n if (targetKeys.indexOf(key) !== -1) {\n if (\n cloneProtoObject &&\n isMergeableObject(source[key]) &&\n Object.getPrototypeOf(source[key]) !== JSON_PROTO\n ) {\n result[key] = cloneProtoObject(source[key]);\n } else {\n result[key] = _deepmerge(target[key], source[key]);\n }\n }\n } else {\n result[key] = clone(source[key]);\n }\n }\n return result;\n }\n\n function _deepmerge(target, source) {\n const sourceIsArray = Array.isArray(source);\n const targetIsArray = Array.isArray(target);\n\n if (isPrimitive(source)) {\n return source;\n } else if (isPrimitiveOrBuiltIn(target)) {\n return clone(source);\n } else if (sourceIsArray && targetIsArray) {\n return mergeArray(target, source);\n } else if (sourceIsArray !== targetIsArray) {\n return clone(source);\n } else {\n return mergeObject(target, source);\n }\n }\n\n function _deepmergeAll() {\n switch (arguments.length) {\n case 0:\n return {};\n case 1:\n return clone(arguments[0]);\n case 2:\n return _deepmerge(arguments[0], arguments[1]);\n }\n let result;\n for (let i = 0, il = arguments.length; i < il; ++i) {\n result = _deepmerge(result, arguments[i]);\n }\n return result;\n }\n\n return options?.all ? _deepmergeAll : _deepmerge;\n}\n\nfunction deepmergeArray(options) {\n const deepmerge = options.deepmerge;\n const clone = options.clone;\n return function (target, source) {\n let i = 0;\n const tl = target.length;\n const sl = source.length;\n const il = Math.max(target.length, source.length);\n const result = new Array(il);\n for (i = 0; i < il; ++i) {\n if (i < sl) {\n result[i] = deepmerge(target[i], source[i]);\n } else {\n result[i] = clone(target[i]);\n }\n }\n return result;\n };\n}\n\nconst deepmerge = deepmergeConstructor({ all: true, mergeArray: deepmergeArray });\n\nconst stringFormatters = {};\n\nfunction registerStringFormatter(name, validator) {\n stringFormatters[name] = validator;\n}\n\nconst numberFormatters = {};\n\nfunction registerNumberFormatter(name, validator) {\n numberFormatters[name] = validator;\n}\n\nfunction pushPath(ctx, key) {\n ctx.path.push(key);\n}\nfunction popPath(ctx) {\n ctx.path.pop();\n}\nfunction printPath(ctx) {\n return ctx.path.join(".");\n}\nfunction buildSchemaErrorMessage(ctx, message) {\n return `Failed to print schema. At ${printPath(ctx)}: ${message}`;\n}\nfunction buildError(ctx, message, received) {\n return [\n {\n message,\n path: [...ctx.path],\n received,\n },\n ];\n}\n\nfunction buildUnionError(ctx, errors, received) {\n return [\n {\n path: [...ctx.path],\n received,\n errors,\n isUnionError: true,\n message: "expected one of",\n },\n ];\n}\n\nfunction parseIdentity(ctx, input) {\n return input;\n}\n\nfunction validateString(ctx, input) {\n return typeof input === "string";\n}\n\nfunction reportString(ctx, input) {\n return buildError(ctx, "expected string", input);\n}\n\nfunction schemaString(ctx) {\n return {\n type: "string",\n };\n}\n\nfunction validateNumber(ctx, input) {\n return typeof input === "number";\n}\n\nfunction reportNumber(ctx, input) {\n return buildError(ctx, "expected number", input);\n}\n\nfunction schemaNumber(ctx) {\n return {\n type: "number",\n };\n}\n\nfunction validateBoolean(ctx, input) {\n return typeof input === "boolean";\n}\n\nfunction reportBoolean(ctx, input) {\n return buildError(ctx, "expected boolean", input);\n}\n\nfunction schemaBoolean(ctx) {\n return {\n type: "boolean",\n };\n}\n\nfunction validateAny(ctx, input) {\n return true;\n}\n\nfunction reportAny(ctx, input) {\n return buildError(ctx, "expected any", input);\n}\n\nfunction schemaAny(ctx) {\n return {};\n}\n\nfunction validateNull(ctx, input) {\n if (input == null) {\n return true;\n }\n return false;\n}\n\nfunction reportNull(ctx, input) {\n return buildError(ctx, "expected nullish value", input);\n}\n\nfunction schemaNull(ctx) {\n return {\n type: "null",\n };\n}\n\nfunction validateNever(ctx, input) {\n return false;\n}\n\nfunction reportNever(ctx, input) {\n return buildError(ctx, "expected never", input);\n}\n\nfunction schemaNever(ctx) {\n return {\n anyOf: [],\n };\n}\n\nfunction validateFunction(ctx, input) {\n return typeof input === "function";\n}\n\nfunction reportFunction(ctx, input) {\n return buildError(ctx, "expected function", input);\n}\n\nfunction schemaFunction(ctx) {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for function"));\n}\n\nclass ConstDecoder {\n constructor(value) {\n this.value = value;\n }\n\n validateConstDecoder(ctx, input) {\n return input === this.value;\n }\n\n parseConstDecoder(ctx, input) {\n return input;\n }\n\n reportConstDecoder(ctx, input) {\n return buildError(ctx, `expected ${JSON.stringify(this.value)}`, input);\n }\n\n schemaConstDecoder(ctx) {\n return {\n const: this.value,\n };\n }\n}\n\nclass RegexDecoder {\n constructor(regex, description) {\n this.regex = regex;\n this.description = description;\n }\n\n validateRegexDecoder(ctx, input) {\n if (typeof input === "string") {\n return this.regex.test(input);\n }\n return false;\n }\n\n parseRegexDecoder(ctx, input) {\n return input;\n }\n\n reportRegexDecoder(ctx, input) {\n return buildError(ctx, `expected string matching ${this.description}`, input);\n }\n\n schemaRegexDecoder(ctx) {\n return {\n type: "string",\n pattern: this.description,\n };\n }\n}\n\nclass CodecDecoder {\n constructor(codec) {\n this.codec = codec;\n }\n validateCodecDecoder(ctx, input) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n return input instanceof Date;\n }\n case "Codec::BigInt": {\n return typeof input === "bigint";\n }\n }\n return false;\n }\n parseCodecDecoder(ctx, input) {\n return input;\n }\n\n reportCodecDecoder(ctx, input) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n return buildError(ctx, `expected Date`, input);\n }\n case "Codec::BigInt": {\n return buildError(ctx, `expected BigInt`, input);\n }\n }\n\n return buildError(ctx, `expected ${this.codec}`, input);\n }\n\n schemaCodecDecoder(ctx) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for Date"));\n }\n case "Codec::BigInt": {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for BigInt"));\n }\n }\n\n throw new Error("INTERNAL ERROR: Unrecognized codec: " + this.codec);\n }\n}\n\nclass StringWithFormatsDecoder {\n constructor(...formats) {\n this.formats = formats;\n }\n\n validateStringWithFormatsDecoder(ctx, input) {\n if (typeof input !== "string") {\n return false;\n }\n\n for (const f of this.formats) {\n const validator = stringFormatters[f];\n\n if (validator == null) {\n return false;\n }\n\n if (!validator(input)) {\n return false;\n }\n }\n\n return true;\n }\n parseStringWithFormatsDecoder(ctx, input) {\n return input;\n }\n reportStringWithFormatsDecoder(ctx, input) {\n return buildError(ctx, `expected string with format "${this.formats.join(" and ")}"`, input);\n }\n schemaStringWithFormatsDecoder(ctx) {\n return {\n type: "string",\n format: this.formats.join(" and "),\n };\n }\n}\nclass NumberWithFormatsDecoder {\n constructor(...formats) {\n this.formats = formats;\n }\n\n validateNumberWithFormatsDecoder(ctx, input) {\n if (typeof input !== "number") {\n return false;\n }\n\n for (const f of this.formats) {\n const validator = numberFormatters[f];\n\n if (validator == null) {\n return false;\n }\n\n if (!validator(input)) {\n return false;\n }\n }\n\n return true;\n }\n parseNumberWithFormatsDecoder(ctx, input) {\n return input;\n }\n reportNumberWithFormatsDecoder(ctx, input) {\n return buildError(ctx, `expected number with format "${this.formats.join(" and ")}"`, input);\n }\n schemaNumberWithFormatsDecoder(ctx) {\n return {\n type: "number",\n format: this.formats.join(" and "),\n };\n }\n}\n\nconst limitedCommaJoinJson = (arr) => {\n const limit = 3;\n if (arr.length < limit) {\n return arr.map((it) => JSON.stringify(it)).join(", ");\n }\n return (\n arr\n .slice(0, limit)\n .map((it) => JSON.stringify(it))\n .join(", ") + `...`\n );\n};\nclass AnyOfConstsDecoder {\n constructor(consts) {\n this.consts = consts;\n }\n validateAnyOfConstsDecoder(ctx, input) {\n if (input == null) {\n if (this.consts.includes(null) || this.consts.includes(undefined)) {\n return true;\n }\n }\n return this.consts.includes(input);\n }\n parseAnyOfConstsDecoder(ctx, input) {\n return input;\n }\n reportAnyOfConstsDecoder(ctx, input) {\n return buildError(ctx, `expected one of ${limitedCommaJoinJson(this.consts)}`, input);\n }\n schemaAnyOfConstsDecoder(ctx) {\n return {\n enum: this.consts,\n };\n }\n}\n\nclass ObjectValidator {\n constructor(data, rest) {\n this.data = data;\n this.rest = rest;\n }\n\n validateObjectValidator(ctx, input) {\n if (typeof input === "object" && !Array.isArray(input) && input !== null) {\n const configKeys = Object.keys(this.data);\n for (const k of configKeys) {\n const validator = this.data[k];\n if (!validator(ctx, input[k])) {\n return false;\n }\n }\n\n if (this.rest != null) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n const v = input[k];\n if (!this.rest(ctx, v)) {\n return false;\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n\n if (extraKeys.length > 0) {\n return false;\n }\n }\n }\n\n return true;\n }\n return false;\n }\n}\n\nclass ObjectReporter {\n constructor(dataValidator, restValidator, dataReporter, restReporter) {\n this.dataValidator = dataValidator;\n this.restValidator = restValidator;\n this.dataReporter = dataReporter;\n this.restReporter = restReporter;\n }\n\n reportObjectReporter(ctx, input) {\n if (typeof input !== "object" || Array.isArray(input) || input === null) {\n return buildError(ctx, "expected object", input);\n }\n\n let acc = [];\n\n const configKeys = Object.keys(this.dataReporter);\n\n for (const k of configKeys) {\n const ok = this.dataValidator[k](ctx, input[k]);\n if (!ok) {\n pushPath(ctx, k);\n const arr2 = this.dataReporter[k](ctx, input[k]);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n\n if (this.restReporter != null) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n const ok = this.restValidator(ctx, input[k]);\n if (!ok) {\n pushPath(ctx, k);\n const arr2 = this.restReporter(ctx, input[k]);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n if (extraKeys.length > 0) {\n \n return extraKeys.flatMap((k) => {\n pushPath(ctx, k);\n const err = buildError(ctx, `extra property`, input[k]);\n popPath(ctx);\n return err;\n });\n }\n }\n }\n\n return acc;\n }\n}\nclass ObjectParser {\n constructor(data, rest) {\n this.data = data;\n this.rest = rest;\n }\n\n parseObjectParser(ctx, input) {\n let acc = {};\n\n const inputKeys = Object.keys(input);\n\n for (const k of inputKeys) {\n const v = input[k];\n if (k in this.data) {\n const itemParsed = this.data[k](ctx, v);\n acc[k] = itemParsed;\n } else if (this.rest != null) {\n const restParsed = this.rest(ctx, v);\n acc[k] = restParsed;\n }\n }\n\n return acc;\n }\n}\n\nclass ObjectSchema {\n constructor(data, rest) {\n this.data = data;\n this.rest = rest;\n }\n\n schemaObjectSchema(ctx) {\n const properties = {};\n for (const k in this.data) {\n pushPath(ctx, k);\n properties[k] = this.data[k](ctx);\n popPath(ctx);\n }\n\n const required = Object.keys(this.data);\n\n const additionalProperties = this.rest != null ? this.rest(ctx) : false;\n\n return {\n type: "object",\n properties,\n required,\n additionalProperties,\n };\n }\n}\n\nclass MappedRecordValidator {\n constructor(keyValidator, valueValidator) {\n this.keyValidator = keyValidator;\n this.valueValidator = valueValidator;\n }\n\n validateMappedRecordValidator(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return false;\n }\n\n for (const k in input) {\n const v = input[k];\n if (!this.keyValidator(ctx, k) || !this.valueValidator(ctx, v)) {\n return false;\n }\n }\n\n return true;\n }\n}\n\nclass MappedRecordParser {\n constructor(keyParser, valueParser) {\n this.keyParser = keyParser;\n this.valueParser = valueParser;\n }\n\n parseMappedRecordParser(ctx, input) {\n const result = {};\n for (const k in input) {\n const parsedKey = this.keyParser(ctx, k);\n const parsedValue = this.valueParser(ctx, input[k]);\n result[parsedKey] = parsedValue;\n }\n return result;\n }\n}\n\nclass MappedRecordSchema {\n constructor(keySchema, valueSchema) {\n this.keySchema = keySchema;\n this.valueSchema = valueSchema;\n }\n\n schemaMappedRecordSchema(ctx) {\n return {\n type: "object",\n additionalProperties: this.valueSchema(ctx),\n propertyNames: this.keySchema(ctx),\n };\n }\n}\n\nclass MappedRecordReporter {\n constructor(keyValidator, valueValidator, keyReporter, valueReporter) {\n this.keyValidator = keyValidator;\n this.valueValidator = valueValidator;\n this.keyReporter = keyReporter;\n this.valueReporter = valueReporter;\n }\n\n reportMappedRecordReporter(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return buildError(ctx, "expected object", input);\n }\n\n let acc = [];\n for (const k in input) {\n const v = input[k];\n const okKey = this.keyValidator(ctx, k);\n if (!okKey) {\n pushPath(ctx, k);\n const errs = this.keyReporter(ctx, k);\n acc.push(...errs);\n popPath(ctx);\n }\n const okValue = this.valueValidator(ctx, v);\n if (!okValue) {\n pushPath(ctx, k);\n const errs = this.valueReporter(ctx, v);\n acc.push(...errs);\n popPath(ctx);\n }\n }\n return acc;\n }\n}\n\nclass AnyOfDiscriminatedValidator {\n constructor(discriminator, mapping) {\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n\n validateAnyOfDiscriminatedValidator(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return false;\n }\n const d = input[this.discriminator];\n if (d == null) {\n return false;\n }\n const v = this.mapping[d];\n if (v == null) {\n \n return false;\n }\n\n return v(ctx, input);\n }\n}\n\nclass AnyOfDiscriminatedParser {\n constructor(discriminator, mapping) {\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n\n parseAnyOfDiscriminatedParser(ctx, input) {\n const parser = this.mapping[input[this.discriminator]];\n if (parser == null) {\n throw new Error(\n "INTERNAL ERROR: Missing parser for discriminator " + JSON.stringify(input[this.discriminator]),\n );\n }\n return {\n ...parser(ctx, input),\n [this.discriminator]: input[this.discriminator],\n };\n }\n}\n\nclass AnyOfDiscriminatedReporter {\n constructor(discriminator, mapping) {\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n\n reportAnyOfDiscriminatedReporter(ctx, input) {\n if (input == null || typeof input !== "object") {\n return buildError(ctx, "expected object", input);\n }\n\n const d = input[this.discriminator];\n if (d == null) {\n return buildError(ctx, "expected discriminator key " + JSON.stringify(this.discriminator), input);\n }\n const v = this.mapping[d];\n if (v == null) {\n pushPath(ctx, this.discriminator);\n const errs = buildError(\n ctx,\n "expected one of " +\n Object.keys(this.mapping)\n .map((it) => JSON.stringify(it))\n .join(", "),\n d,\n );\n popPath(ctx);\n return errs;\n }\n return v(ctx, input);\n }\n}\n\nclass AnyOfDiscriminatedSchema {\n constructor(vs) {\n this.vs = vs;\n }\n\n schemaAnyOfDiscriminatedSchema(ctx) {\n \n return {\n anyOf: this.vs.map((v) => v(ctx)),\n };\n }\n}\n\nclass ArrayParser {\n constructor(innerParser) {\n this.innerParser = innerParser;\n }\n\n parseArrayParser(ctx, input) {\n return input.map((v) => this.innerParser(ctx, v));\n }\n}\n\nclass ArrayValidator {\n constructor(innerValidator) {\n this.innerValidator = innerValidator;\n }\n\n validateArrayValidator(ctx, input) {\n if (Array.isArray(input)) {\n for (let i = 0; i < input.length; i++) {\n const v = input[i];\n const ok = this.innerValidator(ctx, v);\n if (!ok) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n}\n\nclass ArrayReporter {\n constructor(innerValidator, innerReporter) {\n this.innerValidator = innerValidator;\n this.innerReporter = innerReporter;\n }\n\n reportArrayReporter(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected array", input);\n }\n\n let acc = [];\n for (let i = 0; i < input.length; i++) {\n const ok = this.innerValidator(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const v = input[i];\n const arr2 = this.innerReporter(ctx, v);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n\n return acc;\n }\n}\n\nclass ArraySchema {\n constructor(innerSchema) {\n this.innerSchema = innerSchema;\n }\n\n schemaArraySchema(ctx) {\n pushPath(ctx, "[]");\n const items = this.innerSchema(ctx);\n popPath(ctx);\n return {\n type: "array",\n items,\n };\n }\n}\n\nclass AnyOfValidator {\n constructor(vs) {\n this.vs = vs;\n }\n validateAnyOfValidator(ctx, input) {\n for (const v of this.vs) {\n if (v(ctx, input)) {\n return true;\n }\n }\n return false;\n }\n}\nclass AnyOfParser {\n constructor(validators, parsers) {\n this.validators = validators;\n this.parsers = parsers;\n }\n parseAnyOfParser(ctx, input) {\n const items = [];\n for (let i = 0; i < this.validators.length; i++) {\n if (this.validators[i](ctx, input)) {\n items.push(this.parsers[i](ctx, input));\n }\n }\n return deepmerge(...items);\n }\n}\nclass AnyOfReporter {\n constructor(validators, reporters) {\n this.validators = validators;\n this.reporters = reporters;\n }\n reportAnyOfReporter(ctx, input) {\n const acc = [];\n const oldPaths = ctx.path;\n ctx.path = [];\n for (const v of this.reporters) {\n const errors = v(ctx, input);\n acc.push(...errors);\n }\n ctx.path = oldPaths;\n return buildUnionError(ctx, acc, input);\n }\n}\n\nclass AnyOfSchema {\n constructor(schemas) {\n this.schemas = schemas;\n }\n schemaAnyOfSchema(ctx) {\n return {\n anyOf: this.schemas.map((s) => s(ctx)),\n };\n }\n}\n\nclass AllOfValidator {\n constructor(vs) {\n this.vs = vs;\n }\n validateAllOfValidator(ctx, input) {\n for (const v of this.vs) {\n const isObj = typeof input === "object";\n if (!isObj) {\n return false;\n }\n if (!v(ctx, input)) {\n return false;\n }\n }\n return true;\n }\n}\n\nclass AllOfParser {\n constructor(validators, parsers) {\n this.validators = validators;\n this.parsers = parsers;\n }\n parseAllOfParser(ctx, input) {\n let acc = {};\n for (let i = 0; i < this.validators.length; i++) {\n const p = this.parsers[i];\n const parsed = p(ctx, input);\n if (typeof parsed !== "object") {\n throw new Error("INTERNAL ERROR: AllOfParser: Expected object");\n }\n acc = { ...acc, ...parsed };\n }\n return acc;\n }\n}\n\nclass AllOfReporter {\n constructor(validators, reporters) {\n this.validators = validators;\n this.reporters = reporters;\n }\n reportAllOfReporter(ctx, input) {\n const acc = [];\n for (const v of this.reporters) {\n const errors = v(ctx, input);\n acc.push(...errors);\n }\n return acc;\n }\n}\n\nclass AllOfSchema {\n constructor(schemas) {\n this.schemas = schemas;\n }\n schemaAllOfSchema(ctx) {\n return {\n allOf: this.schemas.map((s) => s(ctx)),\n };\n }\n}\n\nclass TupleValidator {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n validateTupleValidator(ctx, input) {\n if (Array.isArray(input)) {\n let idx = 0;\n for (const prefixVal of this.prefix) {\n if (!prefixVal(ctx, input[idx])) {\n return false;\n }\n idx++;\n }\n const itemVal = this.rest;\n if (itemVal != null) {\n for (let i = idx; i < input.length; i++) {\n if (!itemVal(ctx, input[i])) {\n return false;\n }\n }\n } else {\n if (input.length > idx) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n}\n\nclass TupleParser {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n parseTupleParser(ctx, input) {\n let idx = 0;\n let acc = [];\n for (const prefixParser of this.prefix) {\n acc.push(prefixParser(ctx, input[idx]));\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n acc.push(this.rest(ctx, input[i]));\n }\n }\n return acc;\n }\n}\n\nclass TupleReporter {\n constructor(prefixValidator, restValidator, prefixReporter, restReporter) {\n this.prefixValidator = prefixValidator;\n this.restValidator = restValidator;\n this.prefixReporter = prefixReporter;\n this.restReporter = restReporter;\n }\n reportTupleReporter(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected tuple", input);\n }\n\n let idx = 0;\n\n let acc = [];\n\n for (const prefixReporter of this.prefixReporter) {\n const ok = this.prefixValidator[idx](ctx, input[idx]);\n if (!ok) {\n pushPath(ctx, `[${idx}]`);\n const errors = prefixReporter(ctx, input[idx]);\n acc.push(...errors);\n popPath(ctx);\n }\n idx++;\n }\n\n const restReporter = this.restReporter;\n if (restReporter != null) {\n for (let i = idx; i < input.length; i++) {\n const ok = this.restValidator(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const errors = restReporter(ctx, input[i]);\n acc.push(...errors);\n popPath(ctx);\n }\n }\n }\n\n return acc;\n }\n}\n\nclass TupleSchema {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n\n schemaTupleSchema(ctx) {\n pushPath(ctx, "[]");\n const prefixItems = this.prefix.map((s) => s(ctx));\n const items = this.rest != null ? this.rest(ctx) : false;\n popPath(ctx);\n return {\n type: "array",\n prefixItems,\n items,\n };\n }\n}\n', "parser.d.ts": 'import { BuildParserFunction } from "@beff/client";\n\ndeclare const _exports: {\n buildParsers: BuildParserFunction;\n};\n\nexport default _exports;\n' };
45784
+ var bundle_default = { "build-parsers.js": '\n\nfunction buildParsers(args) {\n const stringFormats = args?.stringFormats ?? {};\n \n for (const k of RequiredStringFormats) {\n if (stringFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n\n Object.keys(stringFormats).forEach((k) => {\n const v = stringFormats[k];\n \n registerStringFormatter(k, v);\n });\n\n const numberFormats = args?.numberFormats ?? {};\n \n for (const k of RequiredNumberFormats) {\n if (numberFormats[k] == null) {\n throw new Error(`Missing custom format ${k}`);\n }\n }\n\n Object.keys(numberFormats).forEach((k) => {\n const v = numberFormats[k];\n \n registerNumberFormatter(k, v);\n });\n\n let decoders = {};\n \n Object.keys(buildValidatorsInput).forEach((k) => {\n \n let v = buildValidatorsInput[k];\n const validate = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ctx = { disallowExtraProperties };\n const ok = v(ctx, input);\n if (typeof ok !== "boolean") {\n throw new Error("INTERNAL ERROR: Expected boolean");\n }\n return ok;\n };\n\n \n const schemaFn = buildSchemaInput[k];\n const schema = () => {\n const ctx = {\n path: [],\n seen: {},\n };\n return schemaFn(ctx);\n };\n\n \n const describeFn = buildDescribeInput[k];\n const describe = () => {\n const ctx = {\n deps: {},\n };\n const out = describeFn(ctx);\n let sortedDepsKeys = Object.keys(ctx.deps).sort();\n \n \n \n \n const depsPart = sortedDepsKeys\n .map((key) => {\n return `type ${key} = ${ctx.deps[key]};`;\n })\n .join("\\n\\n");\n \n \n \n const outPart = `type Codec${k} = ${out};`;\n return [depsPart, outPart].filter((it) => it != null && it.length > 0).join("\\n\\n");\n };\n\n const safeParse = (input, options) => {\n const disallowExtraProperties = options?.disallowExtraProperties ?? false;\n const ok = validate(input, options);\n if (ok) {\n \n let p = buildParsersInput[k];\n let ctx = { disallowExtraProperties };\n const parsed = p(ctx, input);\n return { success: true, data: parsed };\n }\n \n let e = buildReportersInput[k];\n let ctx = { path: [], disallowExtraProperties };\n return {\n success: false,\n errors: e(ctx, input).slice(0, 10),\n };\n };\n const parse = (input, options) => {\n const safe = safeParse(input, options);\n if (safe.success) {\n return safe.data;\n }\n \n const explained = printErrors(safe.errors, []);\n throw new Error(`Failed to parse ${k} - ${explained}`);\n };\n const zod = () => {\n \n return z.custom(\n (data) => safeParse(data).success,\n (val) => {\n const errors = safeParse(val).errors;\n \n return printErrors(errors, []);\n },\n );\n };\n decoders[k] = {\n parse,\n safeParse,\n zod,\n name: k,\n validate,\n schema,\n describe,\n };\n });\n return decoders;\n}\n', "decoders.js": '\n\n\n\n\n\nconst JSON_PROTO = Object.getPrototypeOf({});\n\nfunction deepmergeConstructor(options) {\n function isNotPrototypeKey(value) {\n return value !== "constructor" && value !== "prototype" && value !== "__proto__";\n }\n\n function cloneArray(value) {\n let i = 0;\n const il = value.length;\n const result = new Array(il);\n for (i; i < il; ++i) {\n result[i] = clone(value[i]);\n }\n return result;\n }\n\n function cloneObject(target) {\n const result = {};\n\n if (cloneProtoObject && Object.getPrototypeOf(target) !== JSON_PROTO) {\n return cloneProtoObject(target);\n }\n\n const targetKeys = getKeys(target);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey((key = targetKeys[i])) && (result[key] = clone(target[key]));\n }\n return result;\n }\n\n function concatArrays(target, source) {\n const tl = target.length;\n const sl = source.length;\n let i = 0;\n const result = new Array(tl + sl);\n for (i; i < tl; ++i) {\n result[i] = clone(target[i]);\n }\n for (i = 0; i < sl; ++i) {\n result[i + tl] = clone(source[i]);\n }\n return result;\n }\n\n const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;\n function getSymbolsAndKeys(value) {\n const result = Object.keys(value);\n const keys = Object.getOwnPropertySymbols(value);\n for (let i = 0, il = keys.length; i < il; ++i) {\n \n propertyIsEnumerable.call(value, keys[i]) && result.push(keys[i]);\n }\n return result;\n }\n\n const getKeys = options?.symbols ? getSymbolsAndKeys : Object.keys;\n\n const cloneProtoObject =\n typeof options?.cloneProtoObject === "function" ? options.cloneProtoObject : undefined;\n\n function isMergeableObject(value) {\n return (\n typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date)\n );\n }\n\n function isPrimitive(value) {\n return typeof value !== "object" || value === null;\n }\n\n const isPrimitiveOrBuiltIn =\n \n typeof Buffer !== "undefined"\n ? (value) =>\n typeof value !== "object" ||\n value === null ||\n value instanceof RegExp ||\n value instanceof Date ||\n \n value instanceof Buffer\n : (value) =>\n typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date;\n\n const mergeArray =\n options && typeof options.mergeArray === "function"\n ? options.mergeArray({ clone, deepmerge: _deepmerge, getKeys, isMergeableObject })\n : concatArrays;\n\n function clone(entry) {\n return isMergeableObject(entry) ? (Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry)) : entry;\n }\n\n function mergeObject(target, source) {\n const result = {};\n const targetKeys = getKeys(target);\n const sourceKeys = getKeys(source);\n let i, il, key;\n for (i = 0, il = targetKeys.length; i < il; ++i) {\n isNotPrototypeKey((key = targetKeys[i])) &&\n sourceKeys.indexOf(key) === -1 &&\n (result[key] = clone(target[key]));\n }\n\n for (i = 0, il = sourceKeys.length; i < il; ++i) {\n if (!isNotPrototypeKey((key = sourceKeys[i]))) {\n continue;\n }\n\n if (key in target) {\n if (targetKeys.indexOf(key) !== -1) {\n if (\n cloneProtoObject &&\n isMergeableObject(source[key]) &&\n Object.getPrototypeOf(source[key]) !== JSON_PROTO\n ) {\n result[key] = cloneProtoObject(source[key]);\n } else {\n result[key] = _deepmerge(target[key], source[key]);\n }\n }\n } else {\n result[key] = clone(source[key]);\n }\n }\n return result;\n }\n\n function _deepmerge(target, source) {\n const sourceIsArray = Array.isArray(source);\n const targetIsArray = Array.isArray(target);\n\n if (isPrimitive(source)) {\n return source;\n } else if (isPrimitiveOrBuiltIn(target)) {\n return clone(source);\n } else if (sourceIsArray && targetIsArray) {\n return mergeArray(target, source);\n } else if (sourceIsArray !== targetIsArray) {\n return clone(source);\n } else {\n return mergeObject(target, source);\n }\n }\n\n function _deepmergeAll() {\n switch (arguments.length) {\n case 0:\n return {};\n case 1:\n return clone(arguments[0]);\n case 2:\n return _deepmerge(arguments[0], arguments[1]);\n }\n let result;\n for (let i = 0, il = arguments.length; i < il; ++i) {\n result = _deepmerge(result, arguments[i]);\n }\n return result;\n }\n\n return options?.all ? _deepmergeAll : _deepmerge;\n}\n\nfunction deepmergeArray(options) {\n const deepmerge = options.deepmerge;\n const clone = options.clone;\n return function (target, source) {\n let i = 0;\n const tl = target.length;\n const sl = source.length;\n const il = Math.max(target.length, source.length);\n const result = new Array(il);\n for (i = 0; i < il; ++i) {\n if (i < sl) {\n result[i] = deepmerge(target[i], source[i]);\n } else {\n result[i] = clone(target[i]);\n }\n }\n return result;\n };\n}\n\nconst deepmerge = deepmergeConstructor({ all: true, mergeArray: deepmergeArray });\n\nconst stringFormatters = {};\n\nfunction registerStringFormatter(name, validator) {\n stringFormatters[name] = validator;\n}\n\nconst numberFormatters = {};\n\nfunction registerNumberFormatter(name, validator) {\n numberFormatters[name] = validator;\n}\n\nfunction pushPath(ctx, key) {\n ctx.path.push(key);\n}\nfunction popPath(ctx) {\n ctx.path.pop();\n}\nfunction printPath(ctx) {\n return ctx.path.join(".");\n}\nfunction buildSchemaErrorMessage(ctx, message) {\n return `Failed to print schema. At ${printPath(ctx)}: ${message}`;\n}\nfunction buildError(ctx, message, received) {\n return [\n {\n message,\n path: [...ctx.path],\n received,\n },\n ];\n}\n\nfunction buildUnionError(ctx, errors, received) {\n return [\n {\n path: [...ctx.path],\n received,\n errors,\n isUnionError: true,\n message: "expected one of",\n },\n ];\n}\n\nfunction parseIdentity(ctx, input) {\n return input;\n}\n\nfunction validateString(ctx, input) {\n return typeof input === "string";\n}\n\nfunction reportString(ctx, input) {\n return buildError(ctx, "expected string", input);\n}\n\nfunction schemaString(ctx) {\n return {\n type: "string",\n };\n}\n\nfunction describeString(ctx) {\n return "string";\n}\n\nfunction validateNumber(ctx, input) {\n return typeof input === "number";\n}\n\nfunction reportNumber(ctx, input) {\n return buildError(ctx, "expected number", input);\n}\n\nfunction schemaNumber(ctx) {\n return {\n type: "number",\n };\n}\n\nfunction describeNumber(ctx) {\n return "number";\n}\n\nfunction validateBoolean(ctx, input) {\n return typeof input === "boolean";\n}\n\nfunction reportBoolean(ctx, input) {\n return buildError(ctx, "expected boolean", input);\n}\n\nfunction schemaBoolean(ctx) {\n return {\n type: "boolean",\n };\n}\n\nfunction describeBoolean(ctx) {\n return "boolean";\n}\n\nfunction validateAny(ctx, input) {\n return true;\n}\n\nfunction reportAny(ctx, input) {\n return buildError(ctx, "expected any", input);\n}\n\nfunction schemaAny(ctx) {\n return {};\n}\n\nfunction describeAny(ctx) {\n return "any";\n}\n\nfunction validateNull(ctx, input) {\n if (input == null) {\n return true;\n }\n return false;\n}\n\nfunction reportNull(ctx, input) {\n return buildError(ctx, "expected nullish value", input);\n}\n\nfunction schemaNull(ctx) {\n return {\n type: "null",\n };\n}\n\nfunction describeNull(ctx) {\n return "null";\n}\n\nfunction validateNever(ctx, input) {\n return false;\n}\n\nfunction reportNever(ctx, input) {\n return buildError(ctx, "expected never", input);\n}\n\nfunction schemaNever(ctx) {\n return {\n anyOf: [],\n };\n}\n\nfunction describeNever(ctx) {\n return "never";\n}\n\nfunction validateFunction(ctx, input) {\n return typeof input === "function";\n}\n\nfunction reportFunction(ctx, input) {\n return buildError(ctx, "expected function", input);\n}\n\nfunction schemaFunction(ctx) {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for function"));\n}\n\nfunction describeFunction(ctx) {\n return "function";\n}\n\nclass ConstDecoder {\n constructor(value) {\n this.value = value;\n }\n\n validateConstDecoder(ctx, input) {\n return input === this.value;\n }\n\n parseConstDecoder(ctx, input) {\n return input;\n }\n\n reportConstDecoder(ctx, input) {\n return buildError(ctx, `expected ${JSON.stringify(this.value)}`, input);\n }\n\n schemaConstDecoder(ctx) {\n return {\n const: this.value,\n };\n }\n describeConstDecoder(ctx) {\n return JSON.stringify(this.value);\n }\n}\n\nclass RegexDecoder {\n constructor(regex, description) {\n this.regex = regex;\n this.description = description;\n }\n\n validateRegexDecoder(ctx, input) {\n if (typeof input === "string") {\n return this.regex.test(input);\n }\n return false;\n }\n\n parseRegexDecoder(ctx, input) {\n return input;\n }\n\n reportRegexDecoder(ctx, input) {\n return buildError(ctx, `expected string matching ${this.description}`, input);\n }\n\n schemaRegexDecoder(ctx) {\n return {\n type: "string",\n pattern: this.description,\n };\n }\n describeRegexDecoder(ctx) {\n return this.description;\n }\n}\n\nclass CodecDecoder {\n constructor(codec) {\n this.codec = codec;\n }\n validateCodecDecoder(ctx, input) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n return input instanceof Date;\n }\n case "Codec::BigInt": {\n return typeof input === "bigint";\n }\n }\n return false;\n }\n parseCodecDecoder(ctx, input) {\n return input;\n }\n\n reportCodecDecoder(ctx, input) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n return buildError(ctx, `expected Date`, input);\n }\n case "Codec::BigInt": {\n return buildError(ctx, `expected BigInt`, input);\n }\n }\n\n return buildError(ctx, `expected ${this.codec}`, input);\n }\n\n schemaCodecDecoder(ctx) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for Date"));\n }\n case "Codec::BigInt": {\n throw new Error(buildSchemaErrorMessage(ctx, "Cannot generate JSON Schema for BigInt"));\n }\n }\n\n throw new Error("INTERNAL ERROR: Unrecognized codec: " + this.codec);\n }\n describeCodecDecoder(ctx) {\n switch (this.codec) {\n case "Codec::ISO8061": {\n return "Date";\n }\n case "Codec::BigInt": {\n return "BigInt";\n }\n }\n throw new Error("INTERNAL ERROR: Unrecognized codec: " + this.codec);\n }\n}\n\nclass StringWithFormatsDecoder {\n constructor(...formats) {\n this.formats = formats;\n }\n\n validateStringWithFormatsDecoder(ctx, input) {\n if (typeof input !== "string") {\n return false;\n }\n\n for (const f of this.formats) {\n const validator = stringFormatters[f];\n\n if (validator == null) {\n return false;\n }\n\n if (!validator(input)) {\n return false;\n }\n }\n\n return true;\n }\n parseStringWithFormatsDecoder(ctx, input) {\n return input;\n }\n reportStringWithFormatsDecoder(ctx, input) {\n return buildError(ctx, `expected string with format "${this.formats.join(" and ")}"`, input);\n }\n schemaStringWithFormatsDecoder(ctx) {\n return {\n type: "string",\n format: this.formats.join(" and "),\n };\n }\n describeStringWithFormatsDecoder(ctx) {\n if (this.formats.length === 0) {\n throw new Error("INTERNAL ERROR: No formats provided");\n }\n const [first, ...rest] = this.formats;\n let acc = `StringFormat<"${first}">`;\n for (const r of rest) {\n acc = `StringFormatExtends<${acc}, "${r}">`;\n }\n return acc;\n }\n}\nclass NumberWithFormatsDecoder {\n constructor(...formats) {\n this.formats = formats;\n }\n\n validateNumberWithFormatsDecoder(ctx, input) {\n if (typeof input !== "number") {\n return false;\n }\n\n for (const f of this.formats) {\n const validator = numberFormatters[f];\n\n if (validator == null) {\n return false;\n }\n\n if (!validator(input)) {\n return false;\n }\n }\n\n return true;\n }\n parseNumberWithFormatsDecoder(ctx, input) {\n return input;\n }\n reportNumberWithFormatsDecoder(ctx, input) {\n return buildError(ctx, `expected number with format "${this.formats.join(" and ")}"`, input);\n }\n schemaNumberWithFormatsDecoder(ctx) {\n return {\n type: "number",\n format: this.formats.join(" and "),\n };\n }\n describeNumberWithFormatsDecoder(ctx) {\n if (this.formats.length === 0) {\n throw new Error("INTERNAL ERROR: No formats provided");\n }\n const [first, ...rest] = this.formats;\n let acc = `NumberFormat<"${first}">`;\n for (const r of rest) {\n acc = `NumberFormatExtends<${acc}, "${r}">`;\n }\n return acc;\n }\n}\n\nconst limitedCommaJoinJson = (arr) => {\n const limit = 3;\n if (arr.length < limit) {\n return arr.map((it) => JSON.stringify(it)).join(", ");\n }\n return (\n arr\n .slice(0, limit)\n .map((it) => JSON.stringify(it))\n .join(", ") + `...`\n );\n};\nclass AnyOfConstsDecoder {\n constructor(consts) {\n this.consts = consts;\n }\n validateAnyOfConstsDecoder(ctx, input) {\n if (input == null) {\n if (this.consts.includes(null) || this.consts.includes(undefined)) {\n return true;\n }\n }\n return this.consts.includes(input);\n }\n parseAnyOfConstsDecoder(ctx, input) {\n return input;\n }\n reportAnyOfConstsDecoder(ctx, input) {\n return buildError(ctx, `expected one of ${limitedCommaJoinJson(this.consts)}`, input);\n }\n schemaAnyOfConstsDecoder(ctx) {\n return {\n enum: this.consts,\n };\n }\n describeAnyOfConstsDecoder(ctx) {\n const parts = this.consts.map((it) => JSON.stringify(it));\n return parts.join(" | ");\n }\n}\n\nclass ObjectValidator {\n constructor(data, rest) {\n this.data = data;\n this.rest = rest;\n }\n\n validateObjectValidator(ctx, input) {\n if (typeof input === "object" && !Array.isArray(input) && input !== null) {\n const configKeys = Object.keys(this.data);\n for (const k of configKeys) {\n const validator = this.data[k];\n if (!validator(ctx, input[k])) {\n return false;\n }\n }\n\n if (this.rest != null) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n const v = input[k];\n if (!this.rest(ctx, v)) {\n return false;\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n\n if (extraKeys.length > 0) {\n return false;\n }\n }\n }\n\n return true;\n }\n return false;\n }\n}\n\nclass ObjectReporter {\n constructor(dataValidator, restValidator, dataReporter, restReporter) {\n this.dataValidator = dataValidator;\n this.restValidator = restValidator;\n this.dataReporter = dataReporter;\n this.restReporter = restReporter;\n }\n\n reportObjectReporter(ctx, input) {\n if (typeof input !== "object" || Array.isArray(input) || input === null) {\n return buildError(ctx, "expected object", input);\n }\n\n let acc = [];\n\n const configKeys = Object.keys(this.dataReporter);\n\n for (const k of configKeys) {\n const ok = this.dataValidator[k](ctx, input[k]);\n if (!ok) {\n pushPath(ctx, k);\n const arr2 = this.dataReporter[k](ctx, input[k]);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n\n if (this.restReporter != null) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n for (const k of extraKeys) {\n const ok = this.restValidator(ctx, input[k]);\n if (!ok) {\n pushPath(ctx, k);\n const arr2 = this.restReporter(ctx, input[k]);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n } else {\n if (ctx.disallowExtraProperties) {\n const inputKeys = Object.keys(input);\n const extraKeys = inputKeys.filter((k) => !configKeys.includes(k));\n if (extraKeys.length > 0) {\n \n return extraKeys.flatMap((k) => {\n pushPath(ctx, k);\n const err = buildError(ctx, `extra property`, input[k]);\n popPath(ctx);\n return err;\n });\n }\n }\n }\n\n return acc;\n }\n}\nclass ObjectParser {\n constructor(data, rest) {\n this.data = data;\n this.rest = rest;\n }\n\n parseObjectParser(ctx, input) {\n let acc = {};\n\n const inputKeys = Object.keys(input);\n\n for (const k of inputKeys) {\n const v = input[k];\n if (k in this.data) {\n const itemParsed = this.data[k](ctx, v);\n acc[k] = itemParsed;\n } else if (this.rest != null) {\n const restParsed = this.rest(ctx, v);\n acc[k] = restParsed;\n }\n }\n\n return acc;\n }\n}\n\nclass ObjectSchema {\n constructor(data, rest) {\n this.data = data;\n this.rest = rest;\n }\n\n schemaObjectSchema(ctx) {\n const properties = {};\n for (const k in this.data) {\n pushPath(ctx, k);\n properties[k] = this.data[k](ctx);\n popPath(ctx);\n }\n\n const required = Object.keys(this.data);\n\n const additionalProperties = this.rest != null ? this.rest(ctx) : false;\n\n return {\n type: "object",\n properties,\n required,\n additionalProperties,\n };\n }\n}\n\nclass ObjectDescribe {\n constructor(dataDescriber, restDescriber) {\n this.dataDescriber = dataDescriber;\n this.restDescriber = restDescriber;\n }\n describeObjectDescribe(ctx) {\n const sortedKeys = Object.keys(this.dataDescriber).sort();\n const props = sortedKeys\n .map((k) => {\n const describer = this.dataDescriber[k];\n return `${k}: ${describer(ctx)}`;\n })\n .join(", ");\n\n const rest = this.restDescriber != null ? `[K in string]: ${this.restDescriber(ctx)}` : null;\n\n const content = [props, rest].filter((it) => it != null && it.length > 0).join(", ");\n return `{ ${content} }`;\n }\n}\n\nclass MappedRecordValidator {\n constructor(keyValidator, valueValidator) {\n this.keyValidator = keyValidator;\n this.valueValidator = valueValidator;\n }\n\n validateMappedRecordValidator(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return false;\n }\n\n for (const k in input) {\n const v = input[k];\n if (!this.keyValidator(ctx, k) || !this.valueValidator(ctx, v)) {\n return false;\n }\n }\n\n return true;\n }\n}\n\nclass MappedRecordParser {\n constructor(keyParser, valueParser) {\n this.keyParser = keyParser;\n this.valueParser = valueParser;\n }\n\n parseMappedRecordParser(ctx, input) {\n const result = {};\n for (const k in input) {\n const parsedKey = this.keyParser(ctx, k);\n const parsedValue = this.valueParser(ctx, input[k]);\n result[parsedKey] = parsedValue;\n }\n return result;\n }\n}\n\nclass MappedRecordSchema {\n constructor(keySchema, valueSchema) {\n this.keySchema = keySchema;\n this.valueSchema = valueSchema;\n }\n\n schemaMappedRecordSchema(ctx) {\n return {\n type: "object",\n additionalProperties: this.valueSchema(ctx),\n propertyNames: this.keySchema(ctx),\n };\n }\n}\n\nclass MappedRecordDescribe {\n constructor(keyDescriber, valueDescriber) {\n this.keyDescriber = keyDescriber;\n this.valueDescriber = valueDescriber;\n }\n describeMappedRecordDescribe(ctx) {\n const k = this.keyDescriber(ctx);\n const v = this.valueDescriber(ctx);\n return `Record<${k}, ${v}>`;\n }\n}\n\nclass MappedRecordReporter {\n constructor(keyValidator, valueValidator, keyReporter, valueReporter) {\n this.keyValidator = keyValidator;\n this.valueValidator = valueValidator;\n this.keyReporter = keyReporter;\n this.valueReporter = valueReporter;\n }\n\n reportMappedRecordReporter(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return buildError(ctx, "expected object", input);\n }\n\n let acc = [];\n for (const k in input) {\n const v = input[k];\n const okKey = this.keyValidator(ctx, k);\n if (!okKey) {\n pushPath(ctx, k);\n const errs = this.keyReporter(ctx, k);\n acc.push(...errs);\n popPath(ctx);\n }\n const okValue = this.valueValidator(ctx, v);\n if (!okValue) {\n pushPath(ctx, k);\n const errs = this.valueReporter(ctx, v);\n acc.push(...errs);\n popPath(ctx);\n }\n }\n return acc;\n }\n}\n\nclass AnyOfDiscriminatedValidator {\n constructor(discriminator, mapping) {\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n\n validateAnyOfDiscriminatedValidator(ctx, input) {\n if (typeof input !== "object" || input == null) {\n return false;\n }\n const d = input[this.discriminator];\n if (d == null) {\n return false;\n }\n const v = this.mapping[d];\n if (v == null) {\n \n return false;\n }\n\n return v(ctx, input);\n }\n}\n\nclass AnyOfDiscriminatedParser {\n constructor(discriminator, mapping) {\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n\n parseAnyOfDiscriminatedParser(ctx, input) {\n const parser = this.mapping[input[this.discriminator]];\n if (parser == null) {\n throw new Error(\n "INTERNAL ERROR: Missing parser for discriminator " + JSON.stringify(input[this.discriminator]),\n );\n }\n return {\n ...parser(ctx, input),\n [this.discriminator]: input[this.discriminator],\n };\n }\n}\n\nclass AnyOfDiscriminatedReporter {\n constructor(discriminator, mapping) {\n this.discriminator = discriminator;\n this.mapping = mapping;\n }\n\n reportAnyOfDiscriminatedReporter(ctx, input) {\n if (input == null || typeof input !== "object") {\n return buildError(ctx, "expected object", input);\n }\n\n const d = input[this.discriminator];\n if (d == null) {\n return buildError(ctx, "expected discriminator key " + JSON.stringify(this.discriminator), input);\n }\n const v = this.mapping[d];\n if (v == null) {\n pushPath(ctx, this.discriminator);\n const errs = buildError(\n ctx,\n "expected one of " +\n Object.keys(this.mapping)\n .map((it) => JSON.stringify(it))\n .join(", "),\n d,\n );\n popPath(ctx);\n return errs;\n }\n return v(ctx, input);\n }\n}\n\nclass AnyOfDiscriminatedSchema {\n constructor(vs) {\n this.vs = vs;\n }\n\n schemaAnyOfDiscriminatedSchema(ctx) {\n \n return {\n anyOf: this.vs.map((v) => v(ctx)),\n };\n }\n}\n\nclass AnyOfDiscriminatedDescribe {\n constructor(vs) {\n this.vs = vs;\n }\n\n describeAnyOfDiscriminatedDescribe(ctx) {\n \n return `(${this.vs.map((v) => v(ctx)).join(" | ")})`;\n }\n}\n\nclass ArrayParser {\n constructor(innerParser) {\n this.innerParser = innerParser;\n }\n\n parseArrayParser(ctx, input) {\n return input.map((v) => this.innerParser(ctx, v));\n }\n}\n\nclass ArrayValidator {\n constructor(innerValidator) {\n this.innerValidator = innerValidator;\n }\n\n validateArrayValidator(ctx, input) {\n if (Array.isArray(input)) {\n for (let i = 0; i < input.length; i++) {\n const v = input[i];\n const ok = this.innerValidator(ctx, v);\n if (!ok) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n}\n\nclass ArrayReporter {\n constructor(innerValidator, innerReporter) {\n this.innerValidator = innerValidator;\n this.innerReporter = innerReporter;\n }\n\n reportArrayReporter(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected array", input);\n }\n\n let acc = [];\n for (let i = 0; i < input.length; i++) {\n const ok = this.innerValidator(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const v = input[i];\n const arr2 = this.innerReporter(ctx, v);\n acc.push(...arr2);\n popPath(ctx);\n }\n }\n\n return acc;\n }\n}\n\nclass ArraySchema {\n constructor(innerSchema) {\n this.innerSchema = innerSchema;\n }\n\n schemaArraySchema(ctx) {\n pushPath(ctx, "[]");\n const items = this.innerSchema(ctx);\n popPath(ctx);\n return {\n type: "array",\n items,\n };\n }\n}\n\nclass ArrayDescribe {\n constructor(innerDescriber) {\n this.innerDescriber = innerDescriber;\n }\n describeArrayDescribe(ctx) {\n return `Array<${this.innerDescriber(ctx)}>`;\n }\n}\n\nclass AnyOfValidator {\n constructor(vs) {\n this.vs = vs;\n }\n validateAnyOfValidator(ctx, input) {\n for (const v of this.vs) {\n if (v(ctx, input)) {\n return true;\n }\n }\n return false;\n }\n}\nclass AnyOfParser {\n constructor(validators, parsers) {\n this.validators = validators;\n this.parsers = parsers;\n }\n parseAnyOfParser(ctx, input) {\n const items = [];\n for (let i = 0; i < this.validators.length; i++) {\n if (this.validators[i](ctx, input)) {\n items.push(this.parsers[i](ctx, input));\n }\n }\n return deepmerge(...items);\n }\n}\nclass AnyOfReporter {\n constructor(validators, reporters) {\n this.validators = validators;\n this.reporters = reporters;\n }\n reportAnyOfReporter(ctx, input) {\n const acc = [];\n const oldPaths = ctx.path;\n ctx.path = [];\n for (const v of this.reporters) {\n const errors = v(ctx, input);\n acc.push(...errors);\n }\n ctx.path = oldPaths;\n return buildUnionError(ctx, acc, input);\n }\n}\n\nclass AnyOfSchema {\n constructor(schemas) {\n this.schemas = schemas;\n }\n schemaAnyOfSchema(ctx) {\n return {\n anyOf: this.schemas.map((s) => s(ctx)),\n };\n }\n}\n\nclass AnyOfDescribe {\n constructor(describers) {\n this.describers = describers;\n }\n describeAnyOfDescribe(ctx) {\n return `(${this.describers.map((v) => v(ctx)).join(" | ")})`;\n }\n}\n\nclass AllOfValidator {\n constructor(vs) {\n this.vs = vs;\n }\n validateAllOfValidator(ctx, input) {\n for (const v of this.vs) {\n const isObj = typeof input === "object";\n if (!isObj) {\n return false;\n }\n if (!v(ctx, input)) {\n return false;\n }\n }\n return true;\n }\n}\n\nclass AllOfParser {\n constructor(validators, parsers) {\n this.validators = validators;\n this.parsers = parsers;\n }\n parseAllOfParser(ctx, input) {\n let acc = {};\n for (let i = 0; i < this.validators.length; i++) {\n const p = this.parsers[i];\n const parsed = p(ctx, input);\n if (typeof parsed !== "object") {\n throw new Error("INTERNAL ERROR: AllOfParser: Expected object");\n }\n acc = { ...acc, ...parsed };\n }\n return acc;\n }\n}\n\nclass AllOfReporter {\n constructor(validators, reporters) {\n this.validators = validators;\n this.reporters = reporters;\n }\n reportAllOfReporter(ctx, input) {\n const acc = [];\n for (const v of this.reporters) {\n const errors = v(ctx, input);\n acc.push(...errors);\n }\n return acc;\n }\n}\n\nclass AllOfSchema {\n constructor(schemas) {\n this.schemas = schemas;\n }\n schemaAllOfSchema(ctx) {\n return {\n allOf: this.schemas.map((s) => s(ctx)),\n };\n }\n}\n\nclass AllOfDescribe {\n constructor(describers) {\n this.describers = describers;\n }\n describeAllOfDescribe(ctx) {\n return `(${this.describers.map((v) => v(ctx)).join(" & ")})`;\n }\n}\n\nclass TupleValidator {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n validateTupleValidator(ctx, input) {\n if (Array.isArray(input)) {\n let idx = 0;\n for (const prefixVal of this.prefix) {\n if (!prefixVal(ctx, input[idx])) {\n return false;\n }\n idx++;\n }\n const itemVal = this.rest;\n if (itemVal != null) {\n for (let i = idx; i < input.length; i++) {\n if (!itemVal(ctx, input[i])) {\n return false;\n }\n }\n } else {\n if (input.length > idx) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n}\n\nclass TupleParser {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n parseTupleParser(ctx, input) {\n let idx = 0;\n let acc = [];\n for (const prefixParser of this.prefix) {\n acc.push(prefixParser(ctx, input[idx]));\n idx++;\n }\n if (this.rest != null) {\n for (let i = idx; i < input.length; i++) {\n acc.push(this.rest(ctx, input[i]));\n }\n }\n return acc;\n }\n}\n\nclass TupleReporter {\n constructor(prefixValidator, restValidator, prefixReporter, restReporter) {\n this.prefixValidator = prefixValidator;\n this.restValidator = restValidator;\n this.prefixReporter = prefixReporter;\n this.restReporter = restReporter;\n }\n reportTupleReporter(ctx, input) {\n if (!Array.isArray(input)) {\n return buildError(ctx, "expected tuple", input);\n }\n\n let idx = 0;\n\n let acc = [];\n\n for (const prefixReporter of this.prefixReporter) {\n const ok = this.prefixValidator[idx](ctx, input[idx]);\n if (!ok) {\n pushPath(ctx, `[${idx}]`);\n const errors = prefixReporter(ctx, input[idx]);\n acc.push(...errors);\n popPath(ctx);\n }\n idx++;\n }\n\n const restReporter = this.restReporter;\n if (restReporter != null) {\n for (let i = idx; i < input.length; i++) {\n const ok = this.restValidator(ctx, input[i]);\n if (!ok) {\n pushPath(ctx, `[${i}]`);\n const errors = restReporter(ctx, input[i]);\n acc.push(...errors);\n popPath(ctx);\n }\n }\n }\n\n return acc;\n }\n}\n\nclass TupleSchema {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n\n schemaTupleSchema(ctx) {\n pushPath(ctx, "[]");\n const prefixItems = this.prefix.map((s) => s(ctx));\n const items = this.rest != null ? this.rest(ctx) : false;\n popPath(ctx);\n return {\n type: "array",\n prefixItems,\n items,\n };\n }\n}\n\nclass TupleDescribe {\n constructor(prefix, rest) {\n this.prefix = prefix;\n this.rest = rest;\n }\n describeTupleDescribe(ctx) {\n const prefix = this.prefix.map((d) => d(ctx)).join(", ");\n const rest = this.rest != null ? `...${this.rest(ctx)}` : null;\n\n const inner = [prefix, rest].filter((it) => it != null && it.length > 0).join(", ");\n return `[${inner}]`;\n }\n}\n', "parser.d.ts": 'import { BuildParserFunction } from "@beff/client";\n\ndeclare const _exports: {\n buildParsers: BuildParserFunction;\n};\n\nexport default _exports;\n' };
45785
45785
 
45786
45786
  // ts-node/bundle-to-disk.ts
45787
45787
  var decodersExported = [
@@ -45844,7 +45844,22 @@ var decodersExported = [
45844
45844
  "AnyOfSchema",
45845
45845
  "AllOfSchema",
45846
45846
  "AnyOfDiscriminatedSchema",
45847
- "MappedRecordSchema"
45847
+ "MappedRecordSchema",
45848
+ //
45849
+ "describeString",
45850
+ "describeNumber",
45851
+ "describeBoolean",
45852
+ "describeNull",
45853
+ "describeAny",
45854
+ "describeNever",
45855
+ "describeFunction",
45856
+ "ArrayDescribe",
45857
+ "ObjectDescribe",
45858
+ "TupleDescribe",
45859
+ "AnyOfDescribe",
45860
+ "AllOfDescribe",
45861
+ "AnyOfDiscriminatedDescribe",
45862
+ "MappedRecordDescribe"
45848
45863
  ];
45849
45864
  var esmTag = (mod) => {
45850
45865
  if (mod === "cjs") {
@@ -45858,7 +45873,14 @@ Object.defineProperty(exports, "__esModule", {
45858
45873
  };
45859
45874
  var exportCode = (mod) => mod === "esm" ? "export default" : "exports.default =";
45860
45875
  var finalizeValidatorsCode = (wasmCode, mod) => {
45861
- const exportedItems = [...decodersExported, "validators", "parsers", "reporters", "schemas"].join(", ");
45876
+ const exportedItems = [
45877
+ ...decodersExported,
45878
+ "validators",
45879
+ "parsers",
45880
+ "reporters",
45881
+ "schemas",
45882
+ "describers"
45883
+ ].join(", ");
45862
45884
  const exports2 = [exportCode(mod), `{ ${exportedItems} };`].join(" ");
45863
45885
  return [
45864
45886
  //
@@ -45870,7 +45892,9 @@ var finalizeValidatorsCode = (wasmCode, mod) => {
45870
45892
  ].join("\n");
45871
45893
  };
45872
45894
  var importValidators = (mod) => {
45873
- const i = [...decodersExported, "validators", "parsers", "reporters", "schemas", "c"].join(", ");
45895
+ const i = [...decodersExported, "validators", "parsers", "reporters", "schemas", "describers", "c"].join(
45896
+ ", "
45897
+ );
45874
45898
  const importRest = mod === "esm" ? `import {printErrors} from '@beff/client';
45875
45899
  import {z} from 'zod';
45876
45900
  import validatorsMod from "./validators.js"; const { ${i} } = validatorsMod;` : `const {printErrors} = require('beff/client');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beff/cli",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "beff": "./bin/index.js"
@@ -1,10 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {boolean} verbose
5
- */
6
- export function init(verbose: boolean): void;
7
- /**
8
4
  * @param {string} parser_entry_point
9
5
  * @param {any} settings
10
6
  * @returns {any}
@@ -21,3 +17,7 @@ export function bundle_to_diagnostics(parser_entry_point: string, settings: any)
21
17
  * @param {string} content
22
18
  */
23
19
  export function update_file_content(file_name: string, content: string): void;
20
+ /**
21
+ * @param {boolean} verbose
22
+ */
23
+ export function init(verbose: boolean): void;
package/pkg/beff_wasm.js CHANGED
@@ -101,15 +101,6 @@ function getInt32Memory0() {
101
101
  return cachedInt32Memory0;
102
102
  }
103
103
 
104
- function addHeapObject(obj) {
105
- if (heap_next === heap.length) heap.push(heap.length + 1);
106
- const idx = heap_next;
107
- heap_next = heap[idx];
108
-
109
- heap[idx] = obj;
110
- return idx;
111
- }
112
-
113
104
  let cachedFloat64Memory0 = null;
114
105
 
115
106
  function getFloat64Memory0() {
@@ -128,6 +119,15 @@ function getStringFromWasm0(ptr, len) {
128
119
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
129
120
  }
130
121
 
122
+ function addHeapObject(obj) {
123
+ if (heap_next === heap.length) heap.push(heap.length + 1);
124
+ const idx = heap_next;
125
+ heap_next = heap[idx];
126
+
127
+ heap[idx] = obj;
128
+ return idx;
129
+ }
130
+
131
131
  function debugString(val) {
132
132
  // primitive types
133
133
  const type = typeof val;
@@ -192,13 +192,6 @@ function debugString(val) {
192
192
  // TODO we could test for more things here, like `Set`s and `Map`s.
193
193
  return className;
194
194
  }
195
- /**
196
- * @param {boolean} verbose
197
- */
198
- module.exports.init = function(verbose) {
199
- wasm.init(verbose);
200
- };
201
-
202
195
  /**
203
196
  * @param {string} parser_entry_point
204
197
  * @param {any} settings
@@ -235,6 +228,13 @@ module.exports.update_file_content = function(file_name, content) {
235
228
  wasm.update_file_content(ptr0, len0, ptr1, len1);
236
229
  };
237
230
 
231
+ /**
232
+ * @param {boolean} verbose
233
+ */
234
+ module.exports.init = function(verbose) {
235
+ wasm.init(verbose);
236
+ };
237
+
238
238
  function handleError(f, args) {
239
239
  try {
240
240
  return f.apply(this, args);
@@ -292,11 +292,6 @@ module.exports.__wbindgen_is_object = function(arg0) {
292
292
  return ret;
293
293
  };
294
294
 
295
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
296
- const ret = getObject(arg0);
297
- return addHeapObject(ret);
298
- };
299
-
300
295
  module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
301
296
  const ret = getObject(arg0) == getObject(arg1);
302
297
  return ret;
@@ -320,58 +315,53 @@ module.exports.__wbindgen_error_new = function(arg0, arg1) {
320
315
  return addHeapObject(ret);
321
316
  };
322
317
 
323
- module.exports.__wbindgen_number_new = function(arg0) {
324
- const ret = arg0;
318
+ module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
319
+ const ret = getObject(arg0)[getObject(arg1)];
325
320
  return addHeapObject(ret);
326
321
  };
327
322
 
328
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
329
- const ret = BigInt.asUintN(64, arg0);
330
- return addHeapObject(ret);
323
+ module.exports.__wbg_set_f975102236d3c502 = function(arg0, arg1, arg2) {
324
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
331
325
  };
332
326
 
333
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
334
- const ret = getStringFromWasm0(arg0, arg1);
327
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
328
+ const ret = getObject(arg0);
335
329
  return addHeapObject(ret);
336
330
  };
337
331
 
338
- module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
339
- const ret = getObject(arg0)[getObject(arg1)];
332
+ module.exports.__wbindgen_number_new = function(arg0) {
333
+ const ret = arg0;
340
334
  return addHeapObject(ret);
341
335
  };
342
336
 
343
- module.exports.__wbg_set_f975102236d3c502 = function(arg0, arg1, arg2) {
344
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
337
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
338
+ const ret = getStringFromWasm0(arg0, arg1);
339
+ return addHeapObject(ret);
345
340
  };
346
341
 
347
- module.exports.__wbg_debug_9a6b3243fbbebb61 = function(arg0) {
348
- console.debug(getObject(arg0));
342
+ module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
343
+ const ret = BigInt.asUintN(64, arg0);
344
+ return addHeapObject(ret);
349
345
  };
350
346
 
351
- module.exports.__wbg_error_788ae33f81d3b84b = function(arg0) {
352
- console.error(getObject(arg0));
347
+ module.exports.__wbg_log_1d3ae0273d8f4f8a = function(arg0) {
348
+ console.log(getObject(arg0));
353
349
  };
354
350
 
355
351
  module.exports.__wbg_info_2e30e8204b29d91d = function(arg0) {
356
352
  console.info(getObject(arg0));
357
353
  };
358
354
 
359
- module.exports.__wbg_log_1d3ae0273d8f4f8a = function(arg0) {
360
- console.log(getObject(arg0));
361
- };
362
-
363
355
  module.exports.__wbg_warn_d60e832f9882c1b2 = function(arg0) {
364
356
  console.warn(getObject(arg0));
365
357
  };
366
358
 
367
- module.exports.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
368
- const ret = getObject(arg0)[arg1 >>> 0];
369
- return addHeapObject(ret);
359
+ module.exports.__wbg_debug_9a6b3243fbbebb61 = function(arg0) {
360
+ console.debug(getObject(arg0));
370
361
  };
371
362
 
372
- module.exports.__wbg_length_cd7af8117672b8b8 = function(arg0) {
373
- const ret = getObject(arg0).length;
374
- return ret;
363
+ module.exports.__wbg_error_788ae33f81d3b84b = function(arg0) {
364
+ console.error(getObject(arg0));
375
365
  };
376
366
 
377
367
  module.exports.__wbg_new_16b304a2cfa7ff4a = function() {
@@ -379,20 +369,29 @@ module.exports.__wbg_new_16b304a2cfa7ff4a = function() {
379
369
  return addHeapObject(ret);
380
370
  };
381
371
 
382
- module.exports.__wbindgen_is_function = function(arg0) {
383
- const ret = typeof(getObject(arg0)) === 'function';
384
- return ret;
372
+ module.exports.__wbg_new_72fb9a18b5ae2624 = function() {
373
+ const ret = new Object();
374
+ return addHeapObject(ret);
385
375
  };
386
376
 
387
- module.exports.__wbg_next_40fc327bfc8770e6 = function(arg0) {
388
- const ret = getObject(arg0).next;
377
+ module.exports.__wbg_new_63b92bc8671ed464 = function(arg0) {
378
+ const ret = new Uint8Array(getObject(arg0));
389
379
  return addHeapObject(ret);
390
380
  };
391
381
 
392
- module.exports.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
393
- const ret = getObject(arg0).next();
382
+ module.exports.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
383
+ const ret = getObject(arg0).buffer;
394
384
  return addHeapObject(ret);
395
- }, arguments) };
385
+ };
386
+
387
+ module.exports.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
388
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
389
+ };
390
+
391
+ module.exports.__wbg_length_c20a40f15020d68a = function(arg0) {
392
+ const ret = getObject(arg0).length;
393
+ return ret;
394
+ };
396
395
 
397
396
  module.exports.__wbg_done_298b57d23c0fc80c = function(arg0) {
398
397
  const ret = getObject(arg0).done;
@@ -404,32 +403,14 @@ module.exports.__wbg_value_d93c65011f51a456 = function(arg0) {
404
403
  return addHeapObject(ret);
405
404
  };
406
405
 
407
- module.exports.__wbg_iterator_2cee6dadfd956dfa = function() {
408
- const ret = Symbol.iterator;
409
- return addHeapObject(ret);
410
- };
411
-
412
- module.exports.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
413
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
414
- return addHeapObject(ret);
415
- }, arguments) };
416
-
417
- module.exports.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
418
- const ret = getObject(arg0).call(getObject(arg1));
419
- return addHeapObject(ret);
420
- }, arguments) };
421
-
422
- module.exports.__wbg_new_72fb9a18b5ae2624 = function() {
423
- const ret = new Object();
424
- return addHeapObject(ret);
425
- };
426
-
427
- module.exports.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
428
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
429
- };
430
-
431
- module.exports.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
432
- const ret = Array.isArray(getObject(arg0));
406
+ module.exports.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
407
+ let result;
408
+ try {
409
+ result = getObject(arg0) instanceof Uint8Array;
410
+ } catch (_) {
411
+ result = false;
412
+ }
413
+ const ret = result;
433
414
  return ret;
434
415
  };
435
416
 
@@ -444,36 +425,55 @@ module.exports.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
444
425
  return ret;
445
426
  };
446
427
 
447
- module.exports.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
448
- const ret = getObject(arg0).buffer;
428
+ module.exports.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
429
+ const ret = getObject(arg0)[arg1 >>> 0];
449
430
  return addHeapObject(ret);
450
431
  };
451
432
 
452
- module.exports.__wbg_new_63b92bc8671ed464 = function(arg0) {
453
- const ret = new Uint8Array(getObject(arg0));
454
- return addHeapObject(ret);
433
+ module.exports.__wbg_set_d4638f722068f043 = function(arg0, arg1, arg2) {
434
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
455
435
  };
456
436
 
457
- module.exports.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
458
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
437
+ module.exports.__wbg_length_cd7af8117672b8b8 = function(arg0) {
438
+ const ret = getObject(arg0).length;
439
+ return ret;
459
440
  };
460
441
 
461
- module.exports.__wbg_length_c20a40f15020d68a = function(arg0) {
462
- const ret = getObject(arg0).length;
442
+ module.exports.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
443
+ const ret = Array.isArray(getObject(arg0));
463
444
  return ret;
464
445
  };
465
446
 
466
- module.exports.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
467
- let result;
468
- try {
469
- result = getObject(arg0) instanceof Uint8Array;
470
- } catch (_) {
471
- result = false;
472
- }
473
- const ret = result;
447
+ module.exports.__wbg_iterator_2cee6dadfd956dfa = function() {
448
+ const ret = Symbol.iterator;
449
+ return addHeapObject(ret);
450
+ };
451
+
452
+ module.exports.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
453
+ const ret = getObject(arg0).call(getObject(arg1));
454
+ return addHeapObject(ret);
455
+ }, arguments) };
456
+
457
+ module.exports.__wbindgen_is_function = function(arg0) {
458
+ const ret = typeof(getObject(arg0)) === 'function';
474
459
  return ret;
475
460
  };
476
461
 
462
+ module.exports.__wbg_next_40fc327bfc8770e6 = function(arg0) {
463
+ const ret = getObject(arg0).next;
464
+ return addHeapObject(ret);
465
+ };
466
+
467
+ module.exports.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
468
+ const ret = getObject(arg0).next();
469
+ return addHeapObject(ret);
470
+ }, arguments) };
471
+
472
+ module.exports.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
473
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
474
+ return addHeapObject(ret);
475
+ }, arguments) };
476
+
477
477
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
478
478
  const ret = new Error();
479
479
  return addHeapObject(ret);
@@ -499,21 +499,21 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
499
499
  }
500
500
  };
501
501
 
502
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
503
- const ret = debugString(getObject(arg1));
504
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
505
- const len1 = WASM_VECTOR_LEN;
506
- getInt32Memory0()[arg0 / 4 + 1] = len1;
507
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
502
+ module.exports.__wbindgen_memory = function() {
503
+ const ret = wasm.memory;
504
+ return addHeapObject(ret);
508
505
  };
509
506
 
510
507
  module.exports.__wbindgen_throw = function(arg0, arg1) {
511
508
  throw new Error(getStringFromWasm0(arg0, arg1));
512
509
  };
513
510
 
514
- module.exports.__wbindgen_memory = function() {
515
- const ret = wasm.memory;
516
- return addHeapObject(ret);
511
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
512
+ const ret = debugString(getObject(arg1));
513
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
514
+ const len1 = WASM_VECTOR_LEN;
515
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
516
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
517
517
  };
518
518
 
519
519
  const path = require('path').join(__dirname, 'beff_wasm_bg.wasm');
Binary file
@@ -1,9 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function init(a: number): void;
5
- export function bundle_to_string(a: number, b: number, c: number): number;
6
4
  export function bundle_to_diagnostics(a: number, b: number, c: number): number;
5
+ export function bundle_to_string(a: number, b: number, c: number): number;
6
+ export function init(a: number): void;
7
7
  export function update_file_content(a: number, b: number, c: number, d: number): void;
8
8
  export function __wbindgen_malloc(a: number, b: number): number;
9
9
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;