diff --git a/notNeededPackages.json b/notNeededPackages.json index bfdec875d2..f95e6c25bb 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4632,6 +4632,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/yn", "asOfVersion": "3.1.0" }, + { + "libraryName": "z-schema", + "typingsPackageName": "z-schema", + "sourceRepoURL": "https://github.com/zaggino/z-schema", + "asOfVersion": "3.24.0" + }, { "libraryName": "zapier-platform-core", "typingsPackageName": "zapier-platform-core", diff --git a/types/z-schema/index.d.ts b/types/z-schema/index.d.ts deleted file mode 100644 index 1be4dc4f1c..0000000000 --- a/types/z-schema/index.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -// Type definitions for z-schema v3.16.0 -// Project: https://github.com/zaggino/z-schema -// Definitions by: pgonzal -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace Validator { - export interface Options { - asyncTimeout?: number; - forceAdditional?: boolean; - assumeAdditional?: boolean; - forceItems?: boolean; - forceMinItems?: boolean; - forceMaxItems?: boolean; - forceMinLength?: boolean; - forceMaxLength?: boolean; - forceProperties?: boolean; - ignoreUnresolvableReferences?: boolean; - noExtraKeywords?: boolean; - noTypeless?: boolean; - noEmptyStrings?: boolean; - noEmptyArrays?: boolean; - strictUris?: boolean; - strictMode?: boolean; - reportPathAsArray?: boolean; - breakOnFirstError?: boolean; - pedanticCheck?: boolean; - ignoreUnknownFormats?: boolean; - customValidator?: (report: Report, schema: any, json: any) => void; - } - - export interface SchemaError extends Error { - /** - * Implements the Error.name contract. The value is always "z-schema validation error". - */ - name: string; - - /** - * An identifier indicating the type of error. - * Example: "JSON_OBJECT_VALIDATION_FAILED" - */ - message: string; - - /** - * Returns details for each error that occurred during validation. - * See Options.breakOnFirstError. - */ - details: SchemaErrorDetail[]; - } - - export interface SchemaErrorDetail { - /** - * Example: "Expected type string but found type array" - */ - message: string; - /** - * An error identifier that can be used to format a custom error message. - * Example: "INVALID_TYPE" - */ - code: string; - /** - * Format parameters that can be used to format a custom error message. - * Example: ["string","array"] - */ - params: Array; - /** - * A JSON path indicating the location of the error. - * Example: "#/projects/1" - */ - path: string; - /** - * The schema rule description, which is included for certain errors where - * this information is useful (e.g. to describe a constraint). - */ - description: string; - - /** - * Returns details for sub-schemas that failed to match. For example, if the schema - * uses the "oneOf" constraint to accept several alternative possibilities, each - * alternative will have its own inner detail object explaining why it failed to match. - */ - inner: SchemaErrorDetail[]; - } -} - -declare class Validator { - /** - * Register a custom format. - * - * @param name - name of the custom format - * @param validatorFunction - custom format validator function. - * Returns `true` if `value` matches the custom format. - */ - public static registerFormat(formatName: string, validatorFunction: (value: any) => boolean): void; - - /** - * Unregister a format. - * - * @param name - name of the custom format - */ - public static unregisterFormat(name: string): void; - - /** - * Get the list of all registered formats. - * - * Both the names of the burned-in formats and the custom format names are - * returned by this function. - * - * @returns {string[]} the list of all registered format names. - */ - public static getRegisteredFormats(): string[]; - - public static getDefaultOptions(): Validator.Options; - - constructor(options: Validator.Options); - - /** - * @param schema - JSON object representing schema - * @returns {boolean} true if schema is valid. - */ - validateSchema(schema: any): boolean; - - /** - * @param json - either a JSON string or a parsed JSON object - * @param schema - the JSON object representing the schema - * @returns true if json matches schema - */ - validate(json: any, schema: any): boolean; - - /** - * @param json - either a JSON string or a parsed JSON object - * @param schema - the JSON object representing the schema - */ - validate(json: any, schema: any, callback: (err: any, valid: boolean) => void): void; - - /** - * Returns an Error object for the most recent failed validation, or null if the validation was successful. - */ - getLastError(): Validator.SchemaError; - - /** - * Returns the error details for the most recent validation, or undefined if the validation was successful. - * This is the same list as the SchemaError.details property. - */ - getLastErrors(): Validator.SchemaErrorDetail[]; -} - -/** - * Basic representation of the Report class -- just enough to support customValidator - */ -declare class Report { - /** - * @param errorCode - a string representing the code for the custom error, e.g. INVALID_VALUE_SET - * @param errorMessage - string with the message to be returned in the error - * @param params - an array of relevant params for the error, e.g. [fieldName, fieldValue] - * @param subReports - sub-schema involved in the error - * @param schemaDescription - description from the schema used in the validation - * Adds custom error to the errors array in the validation instance and sets valid to false if it is not already set as false - */ - addCustomError: (errorCode: string, errorMessage: string, params: string[], subReports: string, schemaDescription: string) => void; -} - -export = Validator; diff --git a/types/z-schema/tsconfig.json b/types/z-schema/tsconfig.json deleted file mode 100644 index 38880df79d..0000000000 --- a/types/z-schema/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "z-schema-tests.ts" - ] -} diff --git a/types/z-schema/tslint.json b/types/z-schema/tslint.json deleted file mode 100644 index 3d59f55fda..0000000000 --- a/types/z-schema/tslint.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "npm-naming": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/z-schema/z-schema-tests.ts b/types/z-schema/z-schema-tests.ts deleted file mode 100644 index 9f1c81ff7f..0000000000 --- a/types/z-schema/z-schema-tests.ts +++ /dev/null @@ -1,34 +0,0 @@ - -import Validator = require('z-schema'); - -var options: Validator.Options = { - noTypeless: true, - forceItems: true, -}; - -var validator: Validator = new Validator(options); -var json: any = { - foo: 'bar', -}; - -var schema: any = { - 'type': 'object', - properties: { - foo: { - 'type': 'string', - }, - }, -}; - -validator.validateSchema(schema); -validator.validate(json, schema); -validator.validate(json, schema, function (err: any, valid: boolean) { - if (err) { - console.log(err); - } else { - console.log('valid = ' + valid); - } -}); - -var error: Validator.SchemaError = validator.getLastError(); -var errors: Validator.SchemaErrorDetail[] = validator.getLastErrors();