diff --git a/dist/lib/draft/index.d.ts b/dist/lib/draft/index.d.ts index 6e50b5f..2fbd0a9 100644 --- a/dist/lib/draft/index.d.ts +++ b/dist/lib/draft/index.d.ts @@ -83,7 +83,7 @@ export declare class Draft { */ each(data: any, callback: EachCallback, schema?: JsonSchema, pointer?: JsonPointer): void; eachSchema(callback: EachSchemaCallback, schema?: JsonSchema): void; - getChildSchemaSelection(property: string | number, schema?: JsonSchema): JsonSchema[] | JsonError; + getChildSchemaSelection(property: string | number, schema?: JsonSchema): JsonError | JsonSchema[]; /** * Returns the json-schema of a data-json-pointer. * diff --git a/dist/module/lib/validation/format.js b/dist/module/lib/validation/format.js index 2b584c7..60357d1 100644 --- a/dist/module/lib/validation/format.js +++ b/dist/module/lib/validation/format.js @@ -1,15 +1,10 @@ import validUrl from "valid-url"; import { parse as parseIdnEmail } from "smtp-address-parser"; import getTypeOf from "../getTypeOf"; -// referenced -// https://github.com/cfworker/cfworker/blob/main/packages/json-schema/src/format.ts -// https://gist.github.com/marcelotmelo/b67f58a08bee6c2468f8 -const isValidDateTime = new RegExp("^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\\.[0-9]+)?(([Zz])|([\\+|\\-]([01][0-9]|2[0-3]):[0-5][0-9]))$"); const isValidIPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/; const isValidIPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i; const isValidHostname = /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/; const matchDate = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; -// const matchTime = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i; const matchTime = /^(?