@cdmx/n8n-nodes-schema-validator 0.1.15 → 0.1.16

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.
@@ -1,31 +1,56 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseSchema = parseSchema;
4
- exports.parseMultipleSchemas = parseMultipleSchemas;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // nodes/SchemaValidator/lib/schemaParser.ts
21
+ var schemaParser_exports = {};
22
+ __export(schemaParser_exports, {
23
+ parseMultipleSchemas: () => parseMultipleSchemas,
24
+ parseSchema: () => parseSchema
25
+ });
26
+ module.exports = __toCommonJS(schemaParser_exports);
5
27
  function parseSchema(schemaJson) {
6
- if (typeof schemaJson === 'string') {
7
- try {
8
- return JSON.parse(schemaJson);
9
- }
10
- catch (error) {
11
- throw new Error(`Invalid JSON schema format: ${error instanceof Error ? error.message : String(error)}`);
12
- }
28
+ if (typeof schemaJson === "string") {
29
+ try {
30
+ return JSON.parse(schemaJson);
31
+ } catch (error) {
32
+ throw new Error(`Invalid JSON schema format: ${error instanceof Error ? error.message : String(error)}`);
13
33
  }
14
- return schemaJson;
34
+ }
35
+ return schemaJson;
15
36
  }
16
37
  function parseMultipleSchemas(schemasJson) {
17
- if (typeof schemasJson === 'string') {
18
- try {
19
- const parsed = JSON.parse(schemasJson);
20
- if (!Array.isArray(parsed)) {
21
- throw new Error('Expected an array of schemas');
22
- }
23
- return parsed;
24
- }
25
- catch (error) {
26
- throw new Error(`Invalid schemas format: ${error instanceof Error ? error.message : String(error)}`);
27
- }
38
+ if (typeof schemasJson === "string") {
39
+ try {
40
+ const parsed = JSON.parse(schemasJson);
41
+ if (!Array.isArray(parsed)) {
42
+ throw new Error("Expected an array of schemas");
43
+ }
44
+ return parsed;
45
+ } catch (error) {
46
+ throw new Error(`Invalid schemas format: ${error instanceof Error ? error.message : String(error)}`);
28
47
  }
29
- return schemasJson;
48
+ }
49
+ return schemasJson;
30
50
  }
31
- //# sourceMappingURL=schemaParser.js.map
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ parseMultipleSchemas,
54
+ parseSchema
55
+ });
56
+ //# sourceMappingURL=schemaParser.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"schemaParser.js","sourceRoot":"","sources":["../../../../nodes/SchemaValidator/lib/schemaParser.ts"],"names":[],"mappings":";;AAMA,kCASC;AAQD,oDAaC;AA9BD,SAAgB,WAAW,CAAC,UAA2B;IACtD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACpC,IAAI,CAAC;YACJ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1G,CAAC;IACF,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC;AAQD,SAAgB,oBAAoB,CAAC,WAA8B;IAClE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;IACF,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../nodes/SchemaValidator/lib/schemaParser.ts"],
4
+ "sourcesContent": ["/**\n * Parses JSON schema from string or object.\n * @param schemaJson Schema as string or object\n * @returns Parsed schema object\n * @throws Error if JSON is invalid\n */\nexport function parseSchema(schemaJson: string | object): object {\n\tif (typeof schemaJson === 'string') {\n\t\ttry {\n\t\t\treturn JSON.parse(schemaJson);\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Invalid JSON schema format: ${error instanceof Error ? error.message : String(error)}`);\n\t\t}\n\t}\n\treturn schemaJson;\n}\n\n/**\n * Parses multiple schemas from a JSON array string or array of objects.\n * @param schemasJson Schemas as string or array\n * @returns Array of parsed schema objects\n * @throws Error if JSON is invalid\n */\nexport function parseMultipleSchemas(schemasJson: string | object[]): object[] {\n\tif (typeof schemasJson === 'string') {\n\t\ttry {\n\t\t\tconst parsed = JSON.parse(schemasJson);\n\t\t\tif (!Array.isArray(parsed)) {\n\t\t\t\tthrow new Error('Expected an array of schemas');\n\t\t\t}\n\t\t\treturn parsed;\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Invalid schemas format: ${error instanceof Error ? error.message : String(error)}`);\n\t\t}\n\t}\n\treturn schemasJson;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,SAAS,YAAY,YAAqC;AAChE,MAAI,OAAO,eAAe,UAAU;AACnC,QAAI;AACH,aAAO,KAAK,MAAM,UAAU;AAAA,IAC7B,SAAS,OAAO;AACf,YAAM,IAAI,MAAM,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAAA,IACxG;AAAA,EACD;AACA,SAAO;AACR;AAQO,SAAS,qBAAqB,aAA0C;AAC9E,MAAI,OAAO,gBAAgB,UAAU;AACpC,QAAI;AACH,YAAM,SAAS,KAAK,MAAM,WAAW;AACrC,UAAI,CAAC,MAAM,QAAQ,MAAM,GAAG;AAC3B,cAAM,IAAI,MAAM,8BAA8B;AAAA,MAC/C;AACA,aAAO;AAAA,IACR,SAAS,OAAO;AACf,YAAM,IAAI,MAAM,2BAA2B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAAA,IACpG;AAAA,EACD;AACA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,11 +1,11 @@
1
1
  import Ajv, { type ValidateFunction } from 'ajv';
2
2
  import type { ValidationError, ValidationResult, ValidatorOptions } from '../types';
3
3
  export declare function createAjvInstance(options: ValidatorOptions): Ajv;
4
- export declare function isValidJsonSchema(schema: object, ajvInstance?: Ajv): {
4
+ export declare function isValidJsonSchema(schema: object, ajvInstance: Ajv): {
5
5
  isValid: boolean;
6
6
  error?: string;
7
7
  };
8
- export declare function createValidator(schema: object, ajvInstance?: Ajv): ValidateFunction;
8
+ export declare function createValidator(schema: object, ajvInstance: Ajv): ValidateFunction;
9
9
  export declare function transformValidationErrors(validator: ValidateFunction): ValidationError[];
10
10
  export declare function validateData(validator: ValidateFunction, data: unknown): ValidationResult;
11
11
  export declare function formatValidationErrorMessage(errors: ValidationError[]): string;