{"version":3,"sources":["webpack://web/./node_modules/fluent-json-schema/src/ArraySchema.js","webpack://web/./node_modules/fluent-json-schema/src/BaseSchema.js","webpack://web/./node_modules/fluent-json-schema/src/BooleanSchema.js","webpack://web/./node_modules/fluent-json-schema/src/FluentJSONSchema.js","webpack://web/./node_modules/fluent-json-schema/src/IntegerSchema.js","webpack://web/./node_modules/fluent-json-schema/src/MixedSchema.js","webpack://web/./node_modules/fluent-json-schema/src/NullSchema.js","webpack://web/./node_modules/fluent-json-schema/src/NumberSchema.js","webpack://web/./node_modules/fluent-json-schema/src/ObjectSchema.js","webpack://web/./node_modules/fluent-json-schema/src/RawSchema.js","webpack://web/./node_modules/fluent-json-schema/src/StringSchema.js","webpack://web/./node_modules/fluent-json-schema/src/utils.js"],"names":["BaseSchema","setAttribute","isFluentSchema","FluentSchemaError","initialState","type","definitions","properties","required","ArraySchema","schema","options","generateIds","factory","items","Array","isArray","filter","v","length","values","map","$schema","rest","valueOf","additionalItems","contains","value","uniqueItems","boolean","minItems","min","Number","isInteger","maxItems","max","module","exports","default","flat","omit","last","isUniq","patchIdsWithParentId","REQUIRED","setRaw","setComposeType","FLUENT_SCHEMA","isFluentJSONSchema","id","title","description","examples","ref","enum","const","defaults","readOnly","isReadOnly","undefined","writeOnly","isWriteOnly","props","currentProp","name","not","notSchema","parentId","anyOf","schemas","prop","allOf","oneOf","as","ifThen","ifClause","thenClause","ifClauseSchema","thenClauseSchema","if","then","ifThenElse","elseClause","elseClauseSchema","else","raw","fragment","_getState","isRoot","every","Object","assign","keys","BooleanSchema","FORMATS","TYPES","NullSchema","StringSchema","NumberSchema","IntegerSchema","ObjectSchema","MixedSchema","RawSchema","S","string","number","integer","array","object","baseSchema","null","mixed","types","t","includes","join","fluentSchema","withOptions","STRING","NUMBER","BOOLEAN","INTEGER","OBJECT","ARRAY","NULL","minimum","exclusiveMinimum","maximum","exclusiveMaximum","multipleOf","multiple","merge","hasCombiningKeywords","appendRequired","combineMerge","additionalProperties","maxProperties","minProperties","patternProperties","opts","entries","reduce","memo","pattern","dependencies","dependentRequired","dependentSchemas","propertyNames","JSON","stringify","target","def","attributes","$id","schemaPatched","attributesPatched","$ref","key","extend","base","src","extended","arrayMerge","only","p","definition","toArray","minLength","maxLength","format","RegExp","flags","toString","substr","replace","contentEncoding","encoding","contentMediaType","mediaType","obj","Error","constructor","message","super","this","reverse","i","a","indexOf","Symbol","for","schemaRequired","attributeRequired","item","patchedRequired","attribute","source","destination","slice","forEach","index","find","attr","cloneUnlessOtherwiseSpecified","isMergeableObject","propIndex","findIndex","push","RELATIVE_JSON_POINTER","JSON_POINTER","UUID","REGEX","IPV6","IPV4","HOSTNAME","EMAIL","URL","URI_TEMPLATE","URI_REFERENCE","URI","TIME","DATE","DATE_TIME"],"mappings":"qHACA,MAAM,WAAEA,GAAe,EAAQ,OACzB,aAAEC,EAAY,eAAEC,EAAc,kBAAEC,GAAsB,EAAQ,OAE9DC,EAAe,CAEnBC,KAAM,QACNC,YAAa,GACbC,WAAY,GACZC,SAAU,IAYNC,EAAc,EAAGC,SAASN,KAAiBO,GAAY,MAC3DA,EAAU,CACRC,aAAa,EACbC,QAASJ,KACNE,GAEE,IACFX,EAAW,IAAKW,EAASD,WAa5BI,MAAOA,IACL,KACGZ,EAAeY,IAEdC,MAAMC,QAAQF,IACdA,EAAMG,QAAOC,GAAKhB,EAAegB,KAAIC,OAAS,GAGhD,MAAM,IAAIhB,EAAkB,wCAC9B,GAAIY,MAAMC,QAAQF,GAAQ,CACxB,MAAMM,EAASN,EAAMO,KAAIH,IACvB,MAAM,QAAEI,KAAYC,GAASL,EAAEM,UAC/B,OAAOD,KAET,OAAOtB,EAAa,CAAES,YAAWC,GAAW,CAAC,QAASS,EAAQ,UAEhE,MAAM,QAAEE,KAAYC,GAAST,EAAMU,UACnC,OAAOvB,EAAa,CAAES,YAAWC,GAAW,CAC1C,QACA,IAAKY,GACL,WAYJE,gBAAiBX,IACf,GAAqB,kBAAVA,IAAwBZ,EAAeY,GAChD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Jc,CACdkH,sBAjB4B,wBAkB5BC,aAjBmB,eAkBnBC,KAjBW,OAkBXC,MAjBY,QAkBZC,KAjBW,OAkBXC,KAjBW,OAkBXC,SAjBe,WAkBfC,MAjBY,QAkBZC,IAjBU,MAkBVC,aAjBmB,eAkBnBC,cAjBoB,gBAkBpBC,IAjBU,MAkBVC,KAjBW,OAkBXC,KAjBW,OAkBXC,UAjBgB,aA0JhB/H,MA9HY,CACZuB,OATa,SAUbC,OATa,SAUbC,QATc,UAUdC,QATc,UAUdC,OATa,SAUbC,MATY,QAUZC,KATW,QAiIX7E","file":"npm.fluent-json-schema.322d838c8fcba2cc3521.react.bundle.js","sourcesContent":["'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { setAttribute, isFluentSchema, FluentSchemaError } = require('./utils')\n\nconst initialState = {\n // $schema: 'http://json-schema.org/draft-07/schema#',\n type: 'array',\n definitions: [],\n properties: [],\n required: [],\n}\n\n/**\n * Represents a ArraySchema.\n * @param {Object} [options] - Options\n * @param {StringSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {ArraySchema}\n */\n// https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1\n// Factory Functions for Mixin Composition withBaseSchema\nconst ArraySchema = ({ schema = initialState, ...options } = {}) => {\n options = {\n generateIds: false,\n factory: ArraySchema,\n ...options,\n }\n return {\n ...BaseSchema({ ...options, schema }),\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * If \"items\" is a schema, validation succeeds if all elements in the array successfully validate against that schema.\n * If \"items\" is an array of schemas, validation succeeds if each element of the instance validates against the schema at the same position, if any.\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.1|reference}\n * @param {FluentSchema|FluentSchema[]} items\n * @returns {FluentSchema}\n */\n\n items: items => {\n if (\n !isFluentSchema(items) &&\n !(\n Array.isArray(items) &&\n items.filter(v => isFluentSchema(v)).length > 0\n )\n )\n throw new FluentSchemaError(\"'items' must be a S or an array of S\")\n if (Array.isArray(items)) {\n const values = items.map(v => {\n const { $schema, ...rest } = v.valueOf()\n return rest\n })\n return setAttribute({ schema, ...options }, ['items', values, 'array'])\n }\n const { $schema, ...rest } = items.valueOf()\n return setAttribute({ schema, ...options }, [\n 'items',\n { ...rest },\n 'array',\n ])\n },\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.2|reference}\n * @param {FluentSchema|boolean} items\n * @returns {FluentSchema}\n */\n\n additionalItems: items => {\n if (typeof items !== 'boolean' && !isFluentSchema(items))\n throw new FluentSchemaError(\n \"'additionalItems' must be a boolean or a S\"\n )\n if (items === false) {\n return setAttribute({ schema, ...options }, [\n 'additionalItems',\n false,\n 'array',\n ])\n }\n const { $schema, ...rest } = items.valueOf()\n return setAttribute({ schema, ...options }, [\n 'additionalItems',\n { ...rest },\n 'array',\n ])\n },\n\n /**\n * An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.6|reference}\n * @param {FluentSchema} value\n * @returns {FluentSchema}\n */\n\n contains: value => {\n if (!isFluentSchema(value))\n throw new FluentSchemaError(\"'contains' must be a S\")\n const {\n $schema,\n definitions,\n properties,\n required,\n ...rest\n } = value.valueOf()\n return setAttribute({ schema, ...options }, [\n 'contains',\n { ...rest },\n 'array',\n ])\n },\n\n /**\n * If this keyword has boolean value false, the instance validates successfully.\n * If it has boolean value true, the instance validates successfully if all of its elements are unique.\n * Omitting this keyword has the same behavior as a value of false.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.5|reference}\n * @param {boolean} boolean\n * @returns {FluentSchema}\n */\n\n uniqueItems: boolean => {\n if (typeof boolean !== 'boolean')\n throw new FluentSchemaError(\"'uniqueItems' must be a boolean\")\n return setAttribute({ schema, ...options }, [\n 'uniqueItems',\n boolean,\n 'array',\n ])\n },\n\n /**\n * An array instance is valid against \"minItems\" if its size is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.4|reference}\n * @param {number} min\n * @returns {FluentSchema}\n */\n\n minItems: min => {\n if (!Number.isInteger(min))\n throw new FluentSchemaError(\"'minItems' must be a integer\")\n return setAttribute({ schema, ...options }, ['minItems', min, 'array'])\n },\n\n /**\n * An array instance is valid against \"minItems\" if its size is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4.3|reference}\n * @param {number} max\n * @returns {FluentSchema}\n */\n\n maxItems: max => {\n if (!Number.isInteger(max))\n throw new FluentSchemaError(\"'maxItems' must be a integer\")\n return setAttribute({ schema, ...options }, ['maxItems', max, 'array'])\n },\n }\n}\n\nmodule.exports = {\n ArraySchema,\n default: ArraySchema,\n}\n","'use strict'\nconst {\n flat,\n omit,\n isFluentSchema,\n last,\n isUniq,\n patchIdsWithParentId,\n REQUIRED,\n setAttribute,\n setRaw,\n setComposeType,\n FluentSchemaError,\n FLUENT_SCHEMA,\n} = require('./utils')\n\nconst initialState = {\n properties: [],\n required: [],\n}\n\n/**\n * Represents a BaseSchema.\n * @param {Object} [options] - Options\n * @param {BaseSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {BaseSchema}\n */\n\nconst BaseSchema = (\n { schema = initialState, ...options } = {\n generateIds: false,\n factory: BaseSchema,\n }\n) => ({\n [FLUENT_SCHEMA]: true,\n isFluentSchema: true,\n isFluentJSONSchema: true,\n\n /**\n * It defines a URI for the schema, and the base URI that other URI references within the schema are resolved against.\n *\n * {@link https://tools.ietf.org/html/draft-handrews-json-schema-01#section-8.2|reference}\n * @param {string} id - an #id\n * @returns {BaseSchema}\n */\n\n id: id => {\n if (!id)\n throw new FluentSchemaError(\n `id should not be an empty fragment <#> or an empty string <> (e.g. #myId)`\n )\n return setAttribute({ schema, ...options }, ['$id', id, 'any'])\n },\n\n /**\n * It can be used to decorate a user interface with information about the data produced by this user interface. A title will preferably be short.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1|reference}\n * @param {string} title\n * @returns {BaseSchema}\n */\n\n title: title => {\n return setAttribute({ schema, ...options }, ['title', title, 'any'])\n },\n\n /**\n * It can be used to decorate a user interface with information about the data\n * produced by this user interface. A description provides explanation about\n * the purpose of the instance described by the schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.1|reference}\n * @param {string} description\n * @returns {BaseSchema}\n */\n description: description => {\n return setAttribute({ schema, ...options }, [\n 'description',\n description,\n 'any',\n ])\n },\n\n /**\n * The value of this keyword MUST be an array.\n * There are no restrictions placed on the values within the array.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.4|reference}\n * @param {string} examples\n * @returns {BaseSchema}\n */\n\n examples: examples => {\n if (!Array.isArray(examples))\n throw new FluentSchemaError(\n \"'examples' must be an array e.g. ['1', 'one', 'foo']\"\n )\n return setAttribute({ schema, ...options }, ['examples', examples, 'any'])\n },\n\n /**\n * The value must be a valid id e.g. #properties/foo\n *\n * @param {string} ref\n * @returns {BaseSchema}\n */\n\n ref: ref => {\n return setAttribute({ schema, ...options }, ['$ref', ref, 'any'])\n },\n\n /**\n * The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.2|reference}\n * @param {array} values\n * @returns {BaseSchema}\n */\n\n enum: values => {\n if (!Array.isArray(values))\n throw new FluentSchemaError(\n \"'enums' must be an array with at least an element e.g. ['1', 'one', 'foo']\"\n )\n return setAttribute({ schema, ...options }, ['enum', values, 'any'])\n },\n\n /**\n * The value of this keyword MAY be of any type, including null.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.3|reference}\n * @param value\n * @returns {BaseSchema}\n */\n\n const: value => {\n return setAttribute({ schema, ...options }, ['const', value, 'any'])\n },\n\n /**\n * There are no restrictions placed on the value of this keyword.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.2|reference}\n * @param defaults\n * @returns {BaseSchema}\n */\n\n default: defaults => {\n return setAttribute({ schema, ...options }, ['default', defaults, 'any'])\n },\n\n /**\n * The value of readOnly can be left empty to indicate the property is readOnly.\n * It takes an optional boolean which can be used to explicitly set readOnly true/false.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3|reference}\n * @param {boolean|undefined} isReadOnly\n * @returns {BaseSchema}\n */\n\n readOnly: isReadOnly => {\n const value = isReadOnly !== undefined ? isReadOnly : true\n return setAttribute({ schema, ...options }, ['readOnly', value, 'boolean'])\n },\n\n /**\n * The value of writeOnly can be left empty to indicate the property is writeOnly.\n * It takes an optional boolean which can be used to explicitly set writeOnly true/false.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.10.3|reference}\n * @param {boolean|undefined} isWriteOnly\n * @returns {BaseSchema}\n */\n\n writeOnly: isWriteOnly => {\n const value = isWriteOnly !== undefined ? isWriteOnly : true\n return setAttribute({ schema, ...options }, ['writeOnly', value, 'boolean'])\n },\n\n /**\n * Required has to be chained to a property:\n * Examples:\n * - S.prop('prop').required()\n * - S.prop('prop', S.number()).required()\n * - S.required(['foo', 'bar'])\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.3|reference}\n * @returns {FluentSchema}\n */\n required: props => {\n const currentProp = last(schema.properties)\n const required = Array.isArray(props)\n ? [...schema.required, ...props]\n : currentProp\n ? [...schema.required, currentProp.name]\n : [REQUIRED]\n\n if(!isUniq(required)){\n throw new FluentSchemaError(\"'required' has repeated keys, check your calls to .required()\")\n }\n\n return options.factory({\n schema: { ...schema, required },\n ...options,\n })\n },\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n * An instance is valid against this keyword if it fails to validate successfully against the schema defined by this keyword.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.4|reference}\n * @param {FluentSchema} not\n * @returns {BaseSchema}\n */\n not: not => {\n if (!isFluentSchema(not))\n throw new FluentSchemaError(\"'not' must be a BaseSchema\")\n const notSchema = omit(not.valueOf(), ['$schema', 'definitions'])\n\n return BaseSchema({\n schema: {\n ...schema,\n not: patchIdsWithParentId({\n schema: notSchema,\n ...options,\n parentId: '#not',\n }),\n },\n ...options,\n })\n },\n // return setAttribute({ schema, ...options }, ['defaults', defaults, 'any'])\n\n /**\n * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.2|reference}\n * @param {array} schemas\n * @returns {BaseSchema}\n */\n\n anyOf: schemas => setComposeType({ prop: 'anyOf', schemas, schema, options }),\n\n /**\n * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.1|reference}\n * @param {array} schemas\n * @returns {BaseSchema}\n */\n\n allOf: schemas => setComposeType({ prop: 'allOf', schemas, schema, options }),\n\n /**\n * It MUST be a non-empty array. Each item of the array MUST be a valid JSON Schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7.3|reference}\n * @param {array} schemas\n * @returns {BaseSchema}\n */\n\n oneOf: schemas => setComposeType({ prop: 'oneOf', schemas, schema, options }),\n\n /**\n * @private set a property to a type. Use string number etc.\n * @returns {BaseSchema}\n */\n as: type => setAttribute({ schema, ...options }, ['type', type]),\n\n /**\n * This validation outcome of this keyword's subschema has no direct effect on the overall validation result.\n * Rather, it controls which of the \"then\" or \"else\" keywords are evaluated.\n * When \"if\" is present, and the instance successfully validates against its subschema, then\n * validation succeeds against this keyword if the instance also successfully validates against this keyword's subschema.\n *\n * @param {BaseSchema} ifClause\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.1|reference}\n * @param {BaseSchema} thenClause\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.2|reference}\n * @returns {BaseSchema}\n */\n\n ifThen: (ifClause, thenClause) => {\n if (!isFluentSchema(ifClause))\n throw new FluentSchemaError(\"'ifClause' must be a BaseSchema\")\n if (!isFluentSchema(thenClause))\n throw new FluentSchemaError(\"'thenClause' must be a BaseSchema\")\n\n const ifClauseSchema = omit(ifClause.valueOf(), [\n '$schema',\n 'definitions',\n 'type',\n ])\n const thenClauseSchema = omit(thenClause.valueOf(), [\n '$schema',\n 'definitions',\n 'type',\n ])\n\n return options.factory({\n schema: {\n ...schema,\n if: patchIdsWithParentId({\n schema: ifClauseSchema,\n ...options,\n parentId: '#if',\n }),\n then: patchIdsWithParentId({\n schema: thenClauseSchema,\n ...options,\n parentId: '#then',\n }),\n },\n ...options,\n })\n },\n\n /**\n * When \"if\" is present, and the instance fails to validate against its subschema,\n * then validation succeeds against this keyword if the instance successfully validates against this keyword's subschema.\n *\n * @param {BaseSchema} ifClause\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.1|reference}\n * @param {BaseSchema} thenClause\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.2|reference}\n * @param {BaseSchema} elseClause\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.6.3|reference}\n * @returns {BaseSchema}\n */\n\n ifThenElse: (ifClause, thenClause, elseClause) => {\n if (!isFluentSchema(ifClause))\n throw new FluentSchemaError(\"'ifClause' must be a BaseSchema\")\n if (!isFluentSchema(thenClause))\n throw new FluentSchemaError(\"'thenClause' must be a BaseSchema\")\n if (!isFluentSchema(elseClause))\n throw new FluentSchemaError(\n \"'elseClause' must be a BaseSchema or a false boolean value\"\n )\n const ifClauseSchema = omit(ifClause.valueOf(), [\n '$schema',\n 'definitions',\n 'type',\n ])\n const thenClauseSchema = omit(thenClause.valueOf(), [\n '$schema',\n 'definitions',\n 'type',\n ])\n const elseClauseSchema = omit(elseClause.valueOf(), [\n '$schema',\n 'definitions',\n 'type',\n ])\n\n return options.factory({\n schema: {\n ...schema,\n if: patchIdsWithParentId({\n schema: ifClauseSchema,\n ...options,\n parentId: '#if',\n }),\n then: patchIdsWithParentId({\n schema: thenClauseSchema,\n ...options,\n parentId: '#then',\n }),\n else: patchIdsWithParentId({\n schema: elseClauseSchema,\n ...options,\n parentId: '#else',\n }),\n },\n ...options,\n })\n },\n\n /**\n * Because the differences between JSON Schemas and Open API (Swagger)\n * it can be handy to arbitrary modify the schema injecting a fragment\n *\n * * Examples:\n * - S.number().raw({ nullable:true })\n * - S.string().format('date').raw({ formatMaximum: '2020-01-01' })\n *\n * @param {string} fragment an arbitrary JSON Schema to inject\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.3|reference}\n * @returns {BaseSchema}\n */\n raw: fragment => {\n return setRaw({ schema, ...options }, fragment)\n },\n\n /**\n * @private It returns the internal schema data structure\n * @returns {object}\n */\n // TODO LS if we implement S.raw() we can drop this hack because from a JSON we can rebuild a fluent-json-schema\n _getState: () => {\n return schema\n },\n\n /**\n * It returns all the schema values\n *\n * @param {Object} [options] - Options\n * @param {boolean} [options.isRoot = true] - Is a root level schema\n * @returns {object}\n */\n valueOf: ({ isRoot } = { isRoot: true }) => {\n const { properties, definitions, required, $schema, ...rest } = schema\n\n if (isRoot && required && !required.every((v) => typeof v === 'string')) {\n throw new FluentSchemaError(\"'required' has called on root-level schema, check your calls to .required()\")\n }\n\n return Object.assign(\n $schema ? { $schema } : {},\n Object.keys(definitions || []).length > 0\n ? { definitions: flat(definitions) }\n : undefined,\n { ...omit(rest, ['if', 'then', 'else']) },\n Object.keys(properties || []).length > 0\n ? { properties: flat(properties) }\n : undefined,\n required && required.length > 0 ? { required } : undefined,\n schema.if ? { if: schema.if } : undefined,\n schema.then ? { then: schema.then } : undefined,\n schema.else ? { else: schema.else } : undefined\n )\n },\n})\n\nmodule.exports = {\n BaseSchema,\n default: BaseSchema,\n}\n","'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { setAttribute } = require('./utils')\n\nconst initialState = {\n type: 'boolean',\n}\n\n/**\n * Represents a BooleanSchema.\n * @param {Object} [options] - Options\n * @param {StringSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {StringSchema}\n */\n\nconst BooleanSchema = ({ schema = initialState, ...options } = {}) => {\n options = {\n generateIds: false,\n factory: BaseSchema,\n ...options,\n }\n return {\n ...BaseSchema({ ...options, schema }),\n }\n}\n\nmodule.exports = {\n BooleanSchema,\n default: BooleanSchema,\n}\n","'use strict'\n\nconst { FORMATS, TYPES, FluentSchemaError } = require('./utils')\n\nconst { BaseSchema } = require('./BaseSchema')\nconst { NullSchema } = require('./NullSchema')\nconst { BooleanSchema } = require('./BooleanSchema')\nconst { StringSchema } = require('./StringSchema')\nconst { NumberSchema } = require('./NumberSchema')\nconst { IntegerSchema } = require('./IntegerSchema')\nconst { ObjectSchema } = require('./ObjectSchema')\nconst { ArraySchema } = require('./ArraySchema')\nconst { MixedSchema } = require('./MixedSchema')\nconst { RawSchema } = require('./RawSchema')\n\nconst initialState = {\n $schema: 'http://json-schema.org/draft-07/schema#',\n definitions: [],\n properties: [],\n required: [],\n}\n\n/**\n * Represents a S.\n * @param {Object} [options] - Options\n * @param {S} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {S}\n */\n\nconst S = (\n { schema = initialState, ...options } = {\n generateIds: false,\n factory: BaseSchema,\n }\n) => ({\n ...BaseSchema({ ...options, schema }),\n\n /**\n * Set a property to type string\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3|reference}\n * @returns {StringSchema}\n */\n\n string: () =>\n StringSchema({\n ...options,\n schema,\n factory: StringSchema,\n }).as('string'),\n\n /**\n * Set a property to type number\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric|reference}\n * @returns {NumberSchema}\n */\n\n number: () =>\n NumberSchema({\n ...options,\n schema,\n factory: NumberSchema,\n }).as('number'),\n\n /**\n * Set a property to type integer\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#numeric|reference}\n * @returns {IntegerSchema}\n */\n\n integer: () =>\n IntegerSchema({\n ...options,\n schema,\n factory: IntegerSchema,\n }).as('integer'),\n\n /**\n * Set a property to type boolean\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.7|reference}\n * @returns {BooleanSchema}\n */\n\n boolean: () =>\n BooleanSchema({\n ...options,\n schema,\n factory: BooleanSchema,\n }).as('boolean'),\n\n /**\n * Set a property to type array\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.4|reference}\n * @returns {ArraySchema}\n */\n\n array: () =>\n ArraySchema({\n ...options,\n schema,\n factory: ArraySchema,\n }).as('array'),\n\n /**\n * Set a property to type object\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5|reference}\n * @returns {ObjectSchema}\n */\n\n object: baseSchema =>\n ObjectSchema({\n ...options,\n schema: baseSchema || schema,\n factory: ObjectSchema,\n }).as('object'),\n\n /**\n * Set a property to type null\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#general|reference}\n * @returns {NullSchema}\n */\n\n null: () =>\n NullSchema({\n ...options,\n schema,\n factory: NullSchema,\n }).null(),\n\n /**\n * A mixed schema is the union of multiple types (e.g. ['string', 'integer']\n *\n * @param {Array.} types\n * @returns {MixedSchema}\n */\n\n mixed: types => {\n if (\n !Array.isArray(types) ||\n (Array.isArray(types) &&\n types.filter(t => !Object.values(TYPES).includes(t)).length > 0)\n ) {\n throw new FluentSchemaError(\n `Invalid 'types'. It must be an array of types. Valid types are ${Object.values(\n TYPES\n ).join(' | ')}`\n )\n }\n\n return MixedSchema({\n ...options,\n schema: {\n ...schema,\n type: types,\n },\n factory: MixedSchema,\n })\n },\n\n /**\n * Because the differences between JSON Schemas and Open API (Swagger)\n * it can be handy to arbitrary modify the schema injecting a fragment\n *\n * * Examples:\n * - S.raw({ nullable:true, format: 'date', formatMaximum: '2020-01-01' })\n * - S.string().format('date').raw({ formatMaximum: '2020-01-01' })\n *\n * @param {string} fragment an arbitrary JSON Schema to inject\n * @returns {BaseSchema}\n */\n\n raw: fragment => {\n return RawSchema(fragment)\n },\n})\n\nconst fluentSchema = {\n ...BaseSchema(),\n FORMATS,\n TYPES,\n FluentSchemaError,\n withOptions: S,\n string: () => S().string(),\n mixed: types => S().mixed(types),\n object: () => S().object(),\n array: () => S().array(),\n boolean: () => S().boolean(),\n integer: () => S().integer(),\n number: () => S().number(),\n null: () => S().null(),\n raw: fragment => S().raw(fragment),\n}\nmodule.exports = fluentSchema\nmodule.exports.default = fluentSchema\n","'use strict'\nconst { NumberSchema } = require('./NumberSchema')\n\nconst initialState = {\n type: 'integer',\n}\n\n/**\n * Represents a NumberSchema.\n * @param {Object} [options] - Options\n * @param {NumberSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {NumberSchema}\n */\n// https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1\n// Factory Functions for Mixin Composition withBaseSchema\nconst IntegerSchema = (\n { schema, ...options } = {\n schema: initialState,\n generateIds: false,\n factory: IntegerSchema,\n }\n) => ({\n ...NumberSchema({ ...options, schema }),\n})\n\nmodule.exports = {\n IntegerSchema,\n default: IntegerSchema,\n}\n","'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { NullSchema } = require('./NullSchema')\nconst { BooleanSchema } = require('./BooleanSchema')\nconst { StringSchema } = require('./StringSchema')\nconst { NumberSchema } = require('./NumberSchema')\nconst { IntegerSchema } = require('./IntegerSchema')\nconst { ObjectSchema } = require('./ObjectSchema')\nconst { ArraySchema } = require('./ArraySchema')\n\nconst { TYPES, setAttribute, FLUENT_SCHEMA } = require('./utils')\n\nconst initialState = {\n type: [],\n definitions: [],\n properties: [],\n required: [],\n}\n\n/**\n * Represents a MixedSchema.\n * @param {Object} [options] - Options\n * @param {MixedSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {StringSchema}\n */\n\nconst MixedSchema = ({ schema = initialState, ...options } = {}) => {\n options = {\n generateIds: false,\n factory: MixedSchema,\n ...options,\n }\n return {\n [FLUENT_SCHEMA]: true,\n ...(schema.type.includes(TYPES.STRING)\n ? StringSchema({ ...options, schema, factory: MixedSchema })\n : {}),\n ...(schema.type.includes(TYPES.NUMBER)\n ? NumberSchema({ ...options, schema, factory: MixedSchema })\n : {}),\n ...(schema.type.includes(TYPES.BOOLEAN)\n ? BooleanSchema({ ...options, schema, factory: MixedSchema })\n : {}),\n ...(schema.type.includes(TYPES.INTEGER)\n ? IntegerSchema({ ...options, schema, factory: MixedSchema })\n : {}),\n ...(schema.type.includes(TYPES.OBJECT)\n ? ObjectSchema({ ...options, schema, factory: MixedSchema })\n : {}),\n ...(schema.type.includes(TYPES.ARRAY)\n ? ArraySchema({ ...options, schema, factory: MixedSchema })\n : {}),\n ...(schema.type.includes(TYPES.NULL)\n ? NullSchema({ ...options, schema, factory: MixedSchema })\n : {}),\n }\n}\n\nmodule.exports = {\n MixedSchema,\n default: MixedSchema,\n}\n","'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { setAttribute, FLUENT_SCHEMA } = require('./utils')\n\nconst initialState = {\n type: 'null',\n}\n\n/**\n * Represents a NullSchema.\n * @param {Object} [options] - Options\n * @param {StringSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {StringSchema}\n */\n\nconst NullSchema = ({ schema = initialState, ...options } = {}) => {\n options = {\n generateIds: false,\n factory: NullSchema,\n ...options,\n }\n const { valueOf, raw } = BaseSchema({ ...options, schema })\n return {\n valueOf,\n raw,\n [FLUENT_SCHEMA]: true,\n isFluentSchema: true,\n\n /**\n * Set a property to type null\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.1.1|reference}\n * @returns {FluentSchema}\n */\n null: () => setAttribute({ schema, ...options }, ['type', 'null']),\n }\n}\n\nmodule.exports = {\n NullSchema,\n default: NullSchema,\n}\n","'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { setAttribute, FluentSchemaError } = require('./utils')\n\nconst initialState = {\n type: 'number',\n}\n\n/**\n * Represents a NumberSchema.\n * @param {Object} [options] - Options\n * @param {NumberSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {NumberSchema}\n */\n// https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1\n// Factory Functions for Mixin Composition withBaseSchema\nconst NumberSchema = (\n { schema, ...options } = {\n schema: initialState,\n generateIds: false,\n factory: NumberSchema,\n }\n) => ({\n ...BaseSchema({ ...options, schema }),\n\n /**\n * It represents an inclusive lower limit for a numeric instance.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.4|reference}\n * @param {number} min\n * @returns {FluentSchema}\n */\n\n minimum: min => {\n if (typeof min !== 'number')\n throw new FluentSchemaError(\"'minimum' must be a Number\")\n if (schema.type === 'integer' && !Number.isInteger(min))\n throw new FluentSchemaError(\"'minimum' must be an Integer\")\n return setAttribute({ schema, ...options }, ['minimum', min, 'number'])\n },\n\n /**\n * It represents an exclusive lower limit for a numeric instance.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.5|reference}\n * @param {number} min\n * @returns {FluentSchema}\n */\n\n exclusiveMinimum: min => {\n if (typeof min !== 'number')\n throw new FluentSchemaError(\"'exclusiveMinimum' must be a Number\")\n if (schema.type === 'integer' && !Number.isInteger(min))\n throw new FluentSchemaError(\"'exclusiveMinimum' must be an Integer\")\n return setAttribute({ schema, ...options }, [\n 'exclusiveMinimum',\n min,\n 'number',\n ])\n },\n\n /**\n * It represents an inclusive upper limit for a numeric instance.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.2|reference}\n * @param {number} max\n * @returns {FluentSchema}\n */\n\n maximum: max => {\n if (typeof max !== 'number')\n throw new FluentSchemaError(\"'maximum' must be a Number\")\n if (schema.type === 'integer' && !Number.isInteger(max))\n throw new FluentSchemaError(\"'maximum' must be an Integer\")\n return setAttribute({ schema, ...options }, ['maximum', max, 'number'])\n },\n\n /**\n * It represents an exclusive upper limit for a numeric instance.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.3|reference}\n * @param {number} max\n * @returns {FluentSchema}\n */\n\n exclusiveMaximum: max => {\n if (typeof max !== 'number')\n throw new FluentSchemaError(\"'exclusiveMaximum' must be a Number\")\n if (schema.type === 'integer' && !Number.isInteger(max))\n throw new FluentSchemaError(\"'exclusiveMaximum' must be an Integer\")\n return setAttribute({ schema, ...options }, [\n 'exclusiveMaximum',\n max,\n 'number',\n ])\n },\n\n /**\n * It's strictly greater than 0.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.2.1|reference}\n * @param {number} multiple\n * @returns {FluentSchema}\n */\n\n multipleOf: multiple => {\n if (typeof multiple !== 'number')\n throw new FluentSchemaError(\"'multipleOf' must be a Number\")\n if (schema.type === 'integer' && !Number.isInteger(multiple))\n throw new FluentSchemaError(\"'multipleOf' must be an Integer\")\n return setAttribute({ schema, ...options }, [\n 'multipleOf',\n multiple,\n 'number',\n ])\n },\n})\n\nmodule.exports = {\n NumberSchema,\n default: NumberSchema,\n}\n","'use strict'\nconst merge = require('deepmerge')\nconst { BaseSchema } = require('./BaseSchema')\nconst {\n omit,\n setAttribute,\n isFluentSchema,\n hasCombiningKeywords,\n patchIdsWithParentId,\n appendRequired,\n FluentSchemaError,\n combineMerge,\n} = require('./utils')\n\nconst initialState = {\n type: 'object',\n definitions: [],\n properties: [],\n required: [],\n}\n\n/**\n * Represents a ObjectSchema.\n * @param {Object} [options] - Options\n * @param {StringSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {StringSchema}\n */\n\nconst ObjectSchema = ({ schema = initialState, ...options } = {}) => {\n // TODO LS think about default values and how pass all of them through the functions\n options = {\n generateIds: false,\n factory: ObjectSchema,\n ...options,\n }\n return {\n ...BaseSchema({ ...options, schema }),\n\n /**\n * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.\n * Validation with \"additionalProperties\" applies only to the child values of instance names that do not match any names in \"properties\",\n * and do not match any regular expression in \"patternProperties\".\n * For all such properties, validation succeeds if the child instance validates against the \"additionalProperties\" schema.\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.6|reference}\n * @param {FluentSchema|boolean} value\n * @returns {FluentSchema}\n */\n\n additionalProperties: value => {\n if (typeof value === 'boolean') {\n return setAttribute({ schema, ...options }, [\n 'additionalProperties',\n value,\n 'object',\n ])\n }\n if (isFluentSchema(value)) {\n const { $schema, ...rest } = value.valueOf({ isRoot: false })\n return setAttribute({ schema, ...options }, [\n 'additionalProperties',\n { ...rest },\n 'array',\n ])\n }\n\n throw new FluentSchemaError(\n \"'additionalProperties' must be a boolean or a S\"\n )\n },\n\n /**\n * An object instance is valid against \"maxProperties\" if its number of properties is less than, or equal to, the value of this keyword.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.1|reference}\n * @param {number} max\n * @returns {FluentSchema}\n */\n\n maxProperties: max => {\n if (!Number.isInteger(max))\n throw new FluentSchemaError(\"'maxProperties' must be a Integer\")\n return setAttribute({ schema, ...options }, [\n 'maxProperties',\n max,\n 'object',\n ])\n },\n\n /**\n * An object instance is valid against \"minProperties\" if its number of properties is greater than, or equal to, the value of this keyword.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.2|reference}\n * @param {number} min\n * @returns {FluentSchema}\n */\n\n minProperties: min => {\n if (!Number.isInteger(min))\n throw new FluentSchemaError(\"'minProperties' must be a Integer\")\n return setAttribute({ schema, ...options }, [\n 'minProperties',\n min,\n 'object',\n ])\n },\n\n /**\n * Each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect.\n * Each property value of this object MUST be a valid JSON Schema.\n * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.\n * Validation of the primitive instance type against this keyword always succeeds.\n * Validation succeeds if, for each instance name that matches any regular expressions that appear as a property name in this keyword's value, the child instance for that name successfully validates against each schema that corresponds to a matching regular expression.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.5|reference}\n * @param {object} opts\n * @returns {FluentSchema}\n */\n\n patternProperties: opts => {\n const values = Object.entries(opts).reduce((memo, [pattern, schema]) => {\n if (!isFluentSchema(schema))\n throw new FluentSchemaError(\n \"'patternProperties' invalid options. Provide a valid map e.g. { '^fo.*$': S.string() }\"\n )\n return {\n ...memo,\n [pattern]: omit(schema.valueOf({ isRoot: false }), ['$schema']),\n }\n }, {})\n return setAttribute({ schema, ...options }, [\n 'patternProperties',\n values,\n 'object',\n ])\n },\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.\n * This keyword's value MUST be an object. Each property specifies a dependency. Each dependency value MUST be an array or a valid JSON Schema.\n * If the dependency value is a subschema, and the dependency key is a property in the instance, the entire instance must validate against the dependency value.\n * If the dependency value is an array, each element in the array, if any, MUST be a string, and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.7|reference}\n * @param {object} opts\n * @returns {FluentSchema}\n */\n\n dependencies: opts => {\n const values = Object.entries(opts).reduce((memo, [prop, schema]) => {\n if (!isFluentSchema(schema) && !Array.isArray(schema))\n throw new FluentSchemaError(\n \"'dependencies' invalid options. Provide a valid map e.g. { 'foo': ['bar'] } or { 'foo': S.string() }\"\n )\n return {\n ...memo,\n [prop]: Array.isArray(schema)\n ? schema\n : omit(schema.valueOf({ isRoot: false }), ['$schema', 'type', 'definitions']),\n }\n }, {})\n return setAttribute({ schema, ...options }, [\n 'dependencies',\n values,\n 'object',\n ])\n },\n\n /**\n * The value of \"properties\" MUST be an object. Each dependency value MUST be an array.\n * Each element in the array MUST be a string and MUST be unique. If the dependency key is a property in the instance, each of the items in the dependency value must be a property that exists in the instance.\n * \n * {@link https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5.4|reference}\n * @param {object} opts\n * @returns {FluentSchema}\n */\n\n dependentRequired: opts => {\n const values = Object.entries(opts).reduce((memo, [prop, schema]) => {\n if (!Array.isArray(schema))\n throw new FluentSchemaError(\n \"'dependentRequired' invalid options. Provide a valid array e.g. { 'foo': ['bar'] }\"\n )\n return {\n ...memo,\n [prop]: schema,\n }\n }, {})\n\n return setAttribute({ schema, ...options }, [\n 'dependentRequired',\n values,\n 'object',\n ])\n },\n\n /**\n * The value of \"properties\" MUST be an object. The dependency value MUST be a valid JSON Schema.\n * Each dependency key is a property in the instance and the entire instance must validate against the dependency value.\n * \n * {@link https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.2.4|reference}\n * @param {object} opts\n * @returns {FluentSchema}\n */\n dependentSchemas: opts => {\n const values = Object.entries(opts).reduce((memo, [prop, schema]) => {\n if (!isFluentSchema(schema))\n throw new FluentSchemaError(\n \"'dependentSchemas' invalid options. Provide a valid schema e.g. { 'foo': S.string() }\"\n )\n\n return {\n ...memo,\n [prop]: omit(schema.valueOf({ isRoot: false }), ['$schema', 'type', 'definitions']),\n }\n }, {})\n\n return setAttribute({ schema, ...options }, [\n 'dependentSchemas',\n values,\n 'object',\n ])\n },\n\n /**\n * If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a string.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.8|reference}\n * @param {FluentSchema} value\n * @returns {FluentSchema}\n */\n\n propertyNames: value => {\n if (!isFluentSchema(value))\n throw new FluentSchemaError(\"'propertyNames' must be a S\")\n return setAttribute({ schema, ...options }, [\n 'propertyNames',\n omit(value.valueOf({ isRoot: false }), ['$schema']),\n 'object',\n ])\n },\n\n /**\n * The value of \"properties\" MUST be an object. Each value of this object MUST be a valid JSON Schema.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.5.4|reference}\n * @param {string} name\n * @param {FluentSchema} props\n * @returns {FluentSchema}\n */\n\n prop: (name, props = {}) => {\n if (Array.isArray(props) || typeof props !== 'object')\n throw new FluentSchemaError(\n `'${name}' doesn't support value '${JSON.stringify(\n props\n )}'. Pass a FluentSchema object`\n )\n const target = props.def ? 'definitions' : 'properties'\n let attributes = props.valueOf({ isRoot: false })\n const $id =\n attributes.$id ||\n (options.generateIds ? `#${target}/${name}` : undefined)\n if (isFluentSchema(props)) {\n attributes = patchIdsWithParentId({\n schema: attributes,\n parentId: $id,\n ...options,\n })\n\n const [schemaPatched, attributesPatched] = appendRequired({\n schema,\n attributes: {\n ...attributes,\n name,\n },\n })\n\n schema = schemaPatched\n attributes = attributesPatched\n }\n\n const type = hasCombiningKeywords(attributes)\n ? undefined\n : attributes.type\n\n const $ref = attributes.$ref\n\n // strip undefined values or empty arrays or internals\n attributes = Object.entries({ ...attributes, $id, type }).reduce(\n (memo, [key, value]) => {\n return key === '$schema' ||\n key === 'def' ||\n value === undefined ||\n (Array.isArray(value) && value.length === 0 && key !== 'default')\n ? memo\n : { ...memo, [key]: value }\n },\n {}\n )\n\n return ObjectSchema({\n schema: {\n ...schema,\n [target]: [\n ...schema[target],\n $ref ? { name, $ref } : Object.assign({}, { name }, attributes),\n ],\n },\n ...options,\n })\n },\n\n extend: base => {\n if (!base) {\n throw new FluentSchemaError(\"Schema can't be null or undefined\")\n }\n if (!base.isFluentSchema) {\n throw new FluentSchemaError(\"Schema isn't FluentSchema type\")\n }\n const src = base._getState()\n const extended = merge(src, schema, { arrayMerge: combineMerge })\n const {\n valueOf,\n isFluentSchema,\n FLUENT_SCHEMA,\n _getState,\n extend,\n ...rest\n } = ObjectSchema({ schema: extended, ...options })\n return { valueOf, isFluentSchema, FLUENT_SCHEMA, _getState, extend }\n },\n\n /**\n * Returns an object schema with only a subset of keys provided\n *\n * @param properties a list of properties you want to keep\n * @returns {ObjectSchema}\n */\n only: properties => {\n return ObjectSchema({\n schema: {\n ...schema,\n properties: schema.properties.filter(p =>\n properties.includes(p.name)\n ),\n required: schema.required.filter(p => properties.includes(p)),\n },\n ...options,\n })\n },\n\n /**\n * The \"definitions\" keywords provides a standardized location for schema authors to inline re-usable JSON Schemas into a more general schema.\n * There are no restrictions placed on the values within the array.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.9|reference}\n * @param {string} name\n * @param {FluentSchema} props\n * @returns {FluentSchema}\n */\n // FIXME LS move to BaseSchema and remove .prop\n // TODO LS Is a definition a proper schema?\n definition: (name, props = {}) =>\n ObjectSchema({ schema, ...options }).prop(name, {\n ...props.valueOf({ isRoot: false }),\n def: true,\n }),\n }\n}\n\nmodule.exports = {\n ObjectSchema,\n default: ObjectSchema,\n}\n","'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { BooleanSchema } = require('./BooleanSchema')\nconst { StringSchema } = require('./StringSchema')\nconst { NumberSchema } = require('./NumberSchema')\nconst { IntegerSchema } = require('./IntegerSchema')\nconst { ObjectSchema } = require('./ObjectSchema')\nconst { ArraySchema } = require('./ArraySchema')\nconst { toArray, FluentSchemaError } = require('./utils')\n\n/**\n * Represents a raw JSON Schema that will be parsed\n * @param {Object} schema\n * @returns {FluentSchema}\n */\n\nconst RawSchema = (schema = {}) => {\n if (typeof schema !== 'object') {\n throw new FluentSchemaError('A fragment must be a JSON object')\n }\n const { type, definitions, properties, required, ...props } = schema\n switch (schema.type) {\n case 'string': {\n const schema = {\n type,\n ...props,\n }\n return StringSchema({ schema, factory: StringSchema })\n }\n\n case 'integer': {\n const schema = {\n type,\n ...props,\n }\n return IntegerSchema({ schema, factory: NumberSchema })\n }\n case 'number': {\n const schema = {\n type,\n ...props,\n }\n return NumberSchema({ schema, factory: NumberSchema })\n }\n\n case 'boolean': {\n const schema = {\n type,\n ...props,\n }\n return BooleanSchema({ schema, factory: BooleanSchema })\n }\n\n case 'object': {\n const schema = {\n type,\n definitions: toArray(definitions) || [],\n properties: toArray(properties) || [],\n required: required || [],\n ...props,\n }\n return ObjectSchema({ schema, factory: ObjectSchema })\n }\n\n case 'array': {\n const schema = {\n type,\n ...props,\n }\n return ArraySchema({ schema, factory: ArraySchema })\n }\n\n default: {\n const schema = {\n ...props,\n }\n\n return BaseSchema({\n schema,\n factory: BaseSchema,\n })\n }\n }\n}\n\nmodule.exports = {\n RawSchema,\n default: RawSchema,\n}\n","'use strict'\nconst { BaseSchema } = require('./BaseSchema')\nconst { FORMATS, setAttribute, FluentSchemaError } = require('./utils')\n\nconst initialState = {\n type: 'string',\n // properties: [], //FIXME it shouldn't be set for a string because it has only attributes\n required: [],\n}\n\n/**\n * Represents a StringSchema.\n * @param {Object} [options] - Options\n * @param {StringSchema} [options.schema] - Default schema\n * @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo\n * @returns {StringSchema}\n */\n// https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1\n// Factory Functions for Mixin Composition withBaseSchema\nconst StringSchema = (\n { schema, ...options } = {\n schema: initialState,\n generateIds: false,\n factory: StringSchema,\n }\n) => ({\n ...BaseSchema({ ...options, schema }),\n /*/!**\n * Set a property to type string\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3|reference}\n * @returns {StringSchema}\n *!/\n\n string: () =>\n StringSchema({ schema: { ...schema }, ...options }).as('string'),*/\n\n /**\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.2|reference}\n * @param {number} min\n * @returns {StringSchema}\n */\n\n minLength: min => {\n if (!Number.isInteger(min))\n throw new FluentSchemaError(\"'minLength' must be an Integer\")\n return setAttribute({ schema, ...options }, ['minLength', min, 'string'])\n },\n\n /**\n * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.\n * The length of a string instance is defined as the number of its characters as defined by RFC 7159 [RFC7159].\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.1|reference}\n * @param {number} max\n * @returns {StringSchema}\n */\n\n maxLength: max => {\n if (!Number.isInteger(max))\n throw new FluentSchemaError(\"'maxLength' must be an Integer\")\n return setAttribute({ schema, ...options }, ['maxLength', max, 'string'])\n },\n\n /**\n * A string value can be RELATIVE_JSON_POINTER, JSON_POINTER, UUID, REGEX, IPV6, IPV4, HOSTNAME, EMAIL, URL, URI_TEMPLATE, URI_REFERENCE, URI, TIME, DATE,\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.7.3|reference}\n * @param {string} format\n * @returns {StringSchema}\n */\n\n format: format => {\n if (!Object.values(FORMATS).includes(format))\n throw new FluentSchemaError(\n `'format' must be one of ${Object.values(FORMATS).join(', ')}`\n )\n return setAttribute({ schema, ...options }, ['format', format, 'string'])\n },\n\n /**\n * This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect.\n * A string instance is considered valid if the regular expression matches the instance successfully.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.6.3.3|reference}\n * @param {string} pattern\n * @returns {StringSchema}\n */\n pattern: pattern => {\n if (!(typeof pattern === 'string') && !(pattern instanceof RegExp))\n throw new FluentSchemaError(\n `'pattern' must be a string or a RegEx (e.g. /.*/)`\n )\n\n if (pattern instanceof RegExp) {\n const flags = new RegExp(pattern).flags\n pattern = pattern\n .toString()\n .substr(1)\n .replace(new RegExp(`/${flags}$`), '')\n }\n\n return setAttribute({ schema, ...options }, ['pattern', pattern, 'string'])\n },\n\n /**\n * If the instance value is a string, this property defines that the string SHOULD\n * be interpreted as binary data and decoded using the encoding named by this property.\n * RFC 2045, Sec 6.1 [RFC2045] lists the possible values for this property.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.8.3|reference}\n * @param {string} encoding\n * @returns {StringSchema}\n */\n\n contentEncoding: encoding => {\n if (!(typeof encoding === 'string'))\n throw new FluentSchemaError(`'contentEncoding' must be a string`)\n return setAttribute({ schema, ...options }, [\n 'contentEncoding',\n encoding,\n 'string',\n ])\n },\n\n /**\n * The value of this property must be a media type, as defined by RFC 2046 [RFC2046].\n * This property defines the media type of instances which this schema defines.\n *\n * {@link https://tools.ietf.org/id/draft-handrews-json-schema-validation-01.html#rfc.section.8.4|reference}\n * @param {string} mediaType\n * @returns {StringSchema}\n */\n\n contentMediaType: mediaType => {\n if (!(typeof mediaType === 'string'))\n throw new FluentSchemaError(`'contentMediaType' must be a string`)\n return setAttribute({ schema, ...options }, [\n 'contentMediaType',\n mediaType,\n 'string',\n ])\n },\n})\n\nmodule.exports = {\n StringSchema,\n FORMATS,\n default: StringSchema,\n}\n","'use strict'\nconst merge = require('deepmerge')\nconst isFluentSchema = obj => obj && obj.isFluentSchema\n\nconst hasCombiningKeywords = attributes =>\n attributes.allOf || attributes.anyOf || attributes.oneOf || attributes.not\n\nclass FluentSchemaError extends Error {\n constructor(message) {\n super(message)\n this.name = 'FluentSchemaError'\n }\n}\n\nconst last = array => {\n if (!array) return\n const [prop] = [...array].reverse()\n return prop\n}\n\nconst isUniq = array => array.filter((v, i, a) => a.indexOf(v) === i).length === array.length;\n\nconst omit = (obj, props) =>\n Object.entries(obj).reduce((memo, [key, value]) => {\n if (props.includes(key)) return memo\n return {\n ...memo,\n [key]: value,\n }\n }, {})\n\nconst flat = array =>\n array.reduce((memo, prop) => {\n const { name, ...rest } = prop\n return {\n ...memo,\n [name]: rest,\n }\n }, {})\n\nconst combineMerge = (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n const prop = target.find(attr => attr.name === item.name)\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options.isMergeableObject(prop)) {\n const propIndex = target.findIndex(prop => prop.name === item.name)\n destination[propIndex] = merge(prop, item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n}\n\nconst toArray = obj =>\n obj && Object.entries(obj).map(([key, value]) => ({ name: key, ...value }))\n\nconst REQUIRED = Symbol('required')\nconst FLUENT_SCHEMA = Symbol.for('fluent-schema-object')\n\nconst RELATIVE_JSON_POINTER = 'relative-json-pointer'\nconst JSON_POINTER = 'json-pointer'\nconst UUID = 'uuid'\nconst REGEX = 'regex'\nconst IPV6 = 'ipv6'\nconst IPV4 = 'ipv4'\nconst HOSTNAME = 'hostname'\nconst EMAIL = 'email'\nconst URL = 'url'\nconst URI_TEMPLATE = 'uri-template'\nconst URI_REFERENCE = 'uri-reference'\nconst URI = 'uri'\nconst TIME = 'time'\nconst DATE = 'date'\nconst DATE_TIME = 'date-time'\n\nconst FORMATS = {\n RELATIVE_JSON_POINTER,\n JSON_POINTER,\n UUID,\n REGEX,\n IPV6,\n IPV4,\n HOSTNAME,\n EMAIL,\n URL,\n URI_TEMPLATE,\n URI_REFERENCE,\n URI,\n TIME,\n DATE,\n DATE_TIME,\n}\n\nconst STRING = 'string'\nconst NUMBER = 'number'\nconst BOOLEAN = 'boolean'\nconst INTEGER = 'integer'\nconst OBJECT = 'object'\nconst ARRAY = 'array'\nconst NULL = 'null'\n\nconst TYPES = {\n STRING,\n NUMBER,\n BOOLEAN,\n INTEGER,\n OBJECT,\n ARRAY,\n NULL,\n}\n\nconst patchIdsWithParentId = ({ schema, generateIds, parentId }) => {\n const properties = Object.entries(schema.properties || {})\n if (properties.length === 0) return schema\n return {\n ...schema,\n properties: properties.reduce((memo, [key, props]) => {\n const target = props.def ? 'definitions' : 'properties'\n const $id = props.$id || (generateIds ? `#${target}/${key}` : undefined)\n return {\n ...memo,\n [key]: {\n ...props,\n $id:\n generateIds && parentId\n ? `${parentId}/${$id.replace('#', '')}`\n : $id, // e.g. #properties/foo/properties/bar\n },\n }\n }, {}),\n }\n}\n\nconst appendRequired = ({\n attributes: { name, required, ...attributes },\n schema,\n}) => {\n const { schemaRequired, attributeRequired } = (required || []).reduce(\n (memo, item) => {\n return item === REQUIRED\n ? {\n ...memo,\n // append prop name to the schema.required\n schemaRequired: [...memo.schemaRequired, name],\n }\n : {\n ...memo,\n // propagate required attributes\n attributeRequired: [...memo.attributeRequired, item],\n }\n },\n { schemaRequired: [], attributeRequired: [] }\n )\n\n const patchedRequired = [...schema.required, ...schemaRequired];\n if(!isUniq(patchedRequired)){\n throw new FluentSchemaError(\"'required' has repeated keys, check your calls to .required()\")\n }\n\n const schemaPatched = {\n ...schema,\n required: patchedRequired,\n }\n const attributesPatched = {\n ...attributes,\n required: attributeRequired,\n }\n return [schemaPatched, attributesPatched]\n}\n\nconst setAttribute = ({ schema, ...options }, attribute) => {\n const [key, value] = attribute\n const currentProp = last(schema.properties)\n if (currentProp) {\n const { name, ...props } = currentProp\n return options.factory({ schema, ...options }).prop(name, {\n [key]: value,\n ...props,\n })\n }\n return options.factory({ schema: { ...schema, [key]: value }, ...options })\n}\n\nconst setRaw = ({ schema, ...options }, raw) => {\n const currentProp = last(schema.properties)\n if (currentProp) {\n const { name, ...props } = currentProp\n return options.factory({ schema, ...options }).prop(name, {\n ...raw,\n ...props,\n })\n }\n return options.factory({ schema: { ...schema, ...raw }, ...options })\n}\n// TODO LS maybe we can just use setAttribute and remove this one\nconst setComposeType = ({ prop, schemas, schema, options }) => {\n if (!(Array.isArray(schemas) && schemas.every(v => isFluentSchema(v)))) {\n throw new FluentSchemaError(\n `'${prop}' must be a an array of FluentSchema rather than a '${typeof schemas}'`\n )\n }\n\n const values = schemas.map(schema => {\n const { $schema, ...props } = schema.valueOf({ isRoot: false })\n return props\n })\n\n return options.factory({ schema: { ...schema, [prop]: values }, ...options })\n}\n\nmodule.exports = {\n isFluentSchema,\n hasCombiningKeywords,\n FluentSchemaError,\n last,\n isUniq,\n flat,\n toArray,\n omit,\n REQUIRED,\n patchIdsWithParentId,\n appendRequired,\n setRaw,\n setAttribute,\n setComposeType,\n combineMerge,\n FORMATS,\n TYPES,\n FLUENT_SCHEMA,\n}\n"],"sourceRoot":""}