@xml-auditfile/auditfile 0.0.0-stage → 0.0.2-alpha.3

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.
Files changed (83) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +183 -2
  3. package/package.json +62 -4
  4. package/src/auditfile.js +186 -0
  5. package/src/definitions/dialect.js +40 -0
  6. package/src/definitions/element-definition.js +27 -0
  7. package/src/definitions/localized-text.js +41 -0
  8. package/src/definitions/manifest.js +160 -0
  9. package/src/definitions/names.js +42 -0
  10. package/src/definitions/resources.js +29 -0
  11. package/src/definitions/view-definition.js +160 -0
  12. package/src/diagnostics/collector.js +139 -0
  13. package/src/diagnostics/diagnostic.js +53 -0
  14. package/src/diagnostics/report.js +56 -0
  15. package/src/generated/spec.js +74 -0
  16. package/src/index.js +20 -0
  17. package/src/internal/composite-key.js +2 -0
  18. package/src/internal/decimal.js +193 -0
  19. package/src/internal/encoding.js +118 -0
  20. package/src/internal/json.js +106 -0
  21. package/src/internal/sha256.js +147 -0
  22. package/src/internal/streams.js +232 -0
  23. package/src/internal/xml-reader.js +247 -0
  24. package/src/memory/memory-sink.js +68 -0
  25. package/src/reading/mapping-plan.js +91 -0
  26. package/src/reading/read-options.js +136 -0
  27. package/src/reading/read-session.js +446 -0
  28. package/src/reading/row-loader.js +362 -0
  29. package/src/reading/row.js +123 -0
  30. package/src/reading/source.js +146 -0
  31. package/src/reading/value-converter.js +136 -0
  32. package/src/schema/schema.js +256 -0
  33. package/src/sinks/sink.js +53 -0
  34. package/src/validation/reference-checker.js +146 -0
  35. package/src/validation/xaf-rules.js +167 -0
  36. package/src/versioning/version-resolver.js +119 -0
  37. package/src/versioning/version.js +217 -0
  38. package/src/views/view-result.js +20 -0
  39. package/src/views/view-runner.js +449 -0
  40. package/src/xsd/datatypes.js +141 -0
  41. package/src/xsd/regex.js +121 -0
  42. package/src/xsd/schema-set.js +555 -0
  43. package/src/xsd/validator.js +484 -0
  44. package/types/auditfile.d.ts +57 -0
  45. package/types/definitions/dialect.d.ts +27 -0
  46. package/types/definitions/element-definition.d.ts +16 -0
  47. package/types/definitions/localized-text.d.ts +25 -0
  48. package/types/definitions/manifest.d.ts +118 -0
  49. package/types/definitions/names.d.ts +25 -0
  50. package/types/definitions/resources.d.ts +9 -0
  51. package/types/definitions/view-definition.d.ts +85 -0
  52. package/types/diagnostics/collector.d.ts +38 -0
  53. package/types/diagnostics/diagnostic.d.ts +37 -0
  54. package/types/diagnostics/report.d.ts +32 -0
  55. package/types/generated/spec.d.ts +6 -0
  56. package/types/index.d.ts +18 -0
  57. package/types/internal/composite-key.d.ts +2 -0
  58. package/types/internal/decimal.d.ts +55 -0
  59. package/types/internal/encoding.d.ts +43 -0
  60. package/types/internal/json.d.ts +17 -0
  61. package/types/internal/sha256.d.ts +17 -0
  62. package/types/internal/streams.d.ts +35 -0
  63. package/types/internal/xml-reader.d.ts +50 -0
  64. package/types/memory/memory-sink.d.ts +29 -0
  65. package/types/reading/mapping-plan.d.ts +45 -0
  66. package/types/reading/read-options.d.ts +69 -0
  67. package/types/reading/read-session.d.ts +28 -0
  68. package/types/reading/row-loader.d.ts +18 -0
  69. package/types/reading/row.d.ts +53 -0
  70. package/types/reading/source.d.ts +73 -0
  71. package/types/reading/value-converter.d.ts +15 -0
  72. package/types/schema/schema.d.ts +116 -0
  73. package/types/sinks/sink.d.ts +59 -0
  74. package/types/validation/reference-checker.d.ts +11 -0
  75. package/types/validation/xaf-rules.d.ts +13 -0
  76. package/types/versioning/version-resolver.d.ts +25 -0
  77. package/types/versioning/version.d.ts +71 -0
  78. package/types/views/view-result.d.ts +13 -0
  79. package/types/views/view-runner.d.ts +1 -0
  80. package/types/xsd/datatypes.d.ts +40 -0
  81. package/types/xsd/regex.d.ts +6 -0
  82. package/types/xsd/schema-set.d.ts +20 -0
  83. package/types/xsd/validator.d.ts +48 -0
@@ -0,0 +1,40 @@
1
+ import { Decimal } from '../internal/decimal.js';
2
+ declare function decimal(value: any): Decimal | null;
3
+ /**
4
+ * Built-in types: whitespace handling, whether the value space is numeric (for numeric facets),
5
+ * and a parser that returns the value or null when the text is not valid.
6
+ */
7
+ export declare const BUILTINS: Map<string, {
8
+ whiteSpace: string;
9
+ numeric: boolean;
10
+ parse: (value: any) => any;
11
+ id?: undefined;
12
+ decimal?: undefined;
13
+ } | {
14
+ whiteSpace: string;
15
+ numeric: boolean;
16
+ parse: (value: any) => any;
17
+ id: boolean;
18
+ decimal?: undefined;
19
+ } | {
20
+ id?: undefined;
21
+ whiteSpace: string;
22
+ numeric: boolean;
23
+ decimal: boolean;
24
+ parse: typeof decimal;
25
+ }>;
26
+ /**
27
+ * Applies a whiteSpace facet value.
28
+ * @param {string} value
29
+ * @param {'preserve' | 'replace' | 'collapse'} mode
30
+ */
31
+ export declare function normalizeWhiteSpace(value: string, mode: 'preserve' | 'replace' | 'collapse'): string;
32
+ /**
33
+ * Total and fraction digits of a decimal, as the XSD facets count them.
34
+ * @param {Decimal} value
35
+ */
36
+ export declare function digitsOf(value: Decimal): {
37
+ total: number;
38
+ fraction: number;
39
+ };
40
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {string} pattern
3
+ * @returns {RegExp}
4
+ * @throws {Error} The pattern uses a construct this validator does not support.
5
+ */
6
+ export declare function translatePattern(pattern: string): RegExp;
@@ -0,0 +1,20 @@
1
+ export declare const XS = "http://www.w3.org/2001/XMLSchema";
2
+ /** @param {string} ns @param {string} local */
3
+ export declare const qualified: (ns: string, local: string) => string;
4
+ /** Accepts any content; used for elements without a type. */
5
+ export declare const ANY_TYPE: Readonly<{
6
+ kind: "any";
7
+ }>;
8
+ /** A compiled XSD: the global element declarations of all its documents. */
9
+ export declare class SchemaSet {
10
+ #private;
11
+ /** @type {Map<string, object>} Global element declarations by "{ns}local". */
12
+ elements: Map<string, object>;
13
+ /** Number of schema documents. */
14
+ count: number;
15
+ /**
16
+ * @param {string} mainName
17
+ * @param {(name: string) => string | undefined} load Returns the text of a schema document, or undefined.
18
+ */
19
+ static compile(mainName: string, load: (name: string) => string | undefined): Readonly<SchemaSet>;
20
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Validates a simple value against a compiled simple type.
3
+ * @returns {{ value: string } | { error: string }}
4
+ */
5
+ export declare function validateSimple(type: any, raw: any): {
6
+ value: string;
7
+ } | {
8
+ error: string;
9
+ };
10
+ /**
11
+ * Streaming validator for a compiled {@link SchemaSet}. Feed it the element events of a document in order;
12
+ * it reports every violation through `report(message, line, column)` and never stops on its own.
13
+ */
14
+ export declare class XsdValidator {
15
+ #private;
16
+ /**
17
+ * @param {number} [maxValueLength] Longer values are not kept and not checked; the reader reports them (XAF-S008).
18
+ * @param {boolean} [identityConstraints] Evaluate key, unique and keyref; off when another check does that work.
19
+ */
20
+ constructor(set: any, report: any, maxValueLength?: number, identityConstraints?: boolean);
21
+ /** @param {{ ns: string, local: string, attributes: { ns: string, local: string, value: string }[], line: number, column: number, depth: number }} event */
22
+ start(event: {
23
+ ns: string;
24
+ local: string;
25
+ attributes: {
26
+ ns: string;
27
+ local: string;
28
+ value: string;
29
+ }[];
30
+ line: number;
31
+ column: number;
32
+ depth: number;
33
+ }): void;
34
+ /** @param {{ text: string, line: number, column: number }} event */
35
+ text(event: {
36
+ text: string;
37
+ line: number;
38
+ column: number;
39
+ }): void;
40
+ /** @param {{ ns: string, local: string, line: number, column: number, depth: number }} event */
41
+ end(event: {
42
+ ns: string;
43
+ local: string;
44
+ line: number;
45
+ column: number;
46
+ depth: number;
47
+ }): void;
48
+ }