xdbc 1.0.216 → 1.0.217

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.
package/README.md CHANGED
@@ -149,6 +149,7 @@ XDBC ships with **16 contracts** organized into core validators and derived spec
149
149
  | **`JSON_Parse`** | String must be valid JSON; optionally forwards parsed result | `new JSON_Parse(receptor?: (json) => void)` |
150
150
  | **`DEFINED`** | Value must not be `null` or `undefined` | — |
151
151
  | **`UNDEFINED`** | Value must be `undefined` | — |
152
+ | **`ARRAY`** | Value must be an array | — |
152
153
  | **`HasAttribute`** | HTMLElement must possess a named attribute | `HasAttribute.PRE(attrName, invert?)` |
153
154
  | **`ZOD`** | Value must validate against a Zod schema | `new ZOD(schema: z.ZodType)` |
154
155
 
@@ -161,6 +162,7 @@ XDBC ships with **16 contracts** organized into core validators and derived spec
161
162
  | **`LESS`** | `COMPARISON` | `value < reference` |
162
163
  | **`LESS_OR_EQUAL`** | `COMPARISON` | `value <= reference` |
163
164
  | **`DIFFERENT`** | `EQ` | `value !== reference` |
165
+ | **`PLAIN_OBJECT`** | `ARRAY` | Value must be a non-null, non-array object |
164
166
 
165
167
  ### Built-in Regular Expressions
166
168
 
@@ -60,7 +60,7 @@ export declare class PLAIN_OBJECT extends ARRAY {
60
60
  * @returns The **CANDIDATE** **toCheck** if this {@link PLAIN_OBJECT } is fulfilled.
61
61
  *
62
62
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link PLAIN_OBJECT }. */
63
- static tsCheck<CANDIDATE extends object = object>(toCheck: CANDIDATE | undefined | null, hint?: string | undefined, id?: string | undefined): CANDIDATE;
63
+ static tsCheck<CANDIDATE extends object = object>(toCheck: CANDIDATE | undefined | null, hint?: string | undefined, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
64
64
  /**
65
65
  * Creates this {@link PLAIN_OBJECT } instance. No parameters needed — the check is always the same. */
66
66
  constructor();
@@ -59,7 +59,7 @@ export declare class ARRAY extends DBC {
59
59
  * @returns The **CANDIDATE** **toCheck** if this {@link ARRAY } is fulfilled.
60
60
  *
61
61
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link ARRAY }. */
62
- static tsCheck<CANDIDATE extends unknown[] = unknown[]>(toCheck: CANDIDATE | undefined | null, hint?: string | undefined, id?: string | undefined): CANDIDATE;
62
+ static tsCheck<CANDIDATE extends unknown[] = unknown[]>(toCheck: CANDIDATE | undefined | null, hint?: string | undefined, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
63
63
  /**
64
64
  * Creates this {@link ARRAY } instance. No parameters needed — the check is always {@link Array.isArray }. */
65
65
  constructor();
@@ -58,5 +58,5 @@ export declare class DEFINED extends DBC {
58
58
  * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link DEFINED }.
59
59
  *
60
60
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }.*/
61
- static tsCheck<CANDIDATE = unknown>(toCheck: CANDIDATE | undefined | null, hint?: string | undefined, id?: string | undefined): CANDIDATE;
61
+ static tsCheck<CANDIDATE = unknown>(toCheck: CANDIDATE | undefined | null, hint?: string | undefined, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
62
62
  }
package/dist/DBC/EQ.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare class EQ extends DBC {
61
61
  * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link EQ }.
62
62
  *
63
63
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link EQ }.*/
64
- static tsCheck<CANDIDATE>(toCheck: CANDIDATE | undefined | null, equivalent: any, hint?: string | undefined, id?: string | undefined): CANDIDATE;
64
+ static tsCheck<CANDIDATE>(toCheck: CANDIDATE | undefined | null, equivalent: any, hint?: string | undefined, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
65
65
  /**
66
66
  * Creates this {@link EQ } by setting the protected property {@link EQ.equivalent } used by {@link EQ.check }.
67
67
  *
@@ -63,7 +63,7 @@ export declare class INSTANCE extends DBC {
63
63
  * @returns The **CANDIDATE** **toCheck** if it fulfills this {@link INSTANCE }.
64
64
  *
65
65
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link INSTANCE }. */
66
- static tsCheck<CANDIDATE = unknown>(toCheck: any, reference: any, hint?: string, id?: string | undefined): CANDIDATE;
66
+ static tsCheck<CANDIDATE = unknown>(toCheck: any, reference: any, hint?: string, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
67
67
  /**
68
68
  * Invokes the {@link INSTANCE.checkAlgorithm } passing the value **toCheck** and the {@link INSTANCE.reference } .
69
69
  *
@@ -75,7 +75,7 @@ export declare class INSTANCE extends DBC {
75
75
  * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link INSTANCE }.
76
76
  *
77
77
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }. */
78
- static tsCheckMulti<CANDIDATE = unknown>(toCheck: any, references: any[], hint?: string, id?: string | undefined): CANDIDATE;
78
+ static tsCheckMulti<CANDIDATE = unknown>(toCheck: any, references: any[], hint?: string, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
79
79
  /**
80
80
  * Creates this {@link INSTANCE } by setting the protected property {@link INSTANCE.reference } used by {@link INSTANCE.check }.
81
81
  *
@@ -90,5 +90,5 @@ export declare class JSON_OP extends DBC {
90
90
  static check(toCheck: any, necessaryProperties: Array<{
91
91
  name: string;
92
92
  type: string;
93
- }>, checkElements?: boolean): void;
93
+ }>, checkElements?: boolean, dbc?: string | undefined): void;
94
94
  }
@@ -65,5 +65,5 @@ export declare class JSON_Parse extends DBC {
65
65
  * @param necessaryProperties See {@link JSON_Parse.checkAlgorithm} }.
66
66
  * @param checkElements See {@link JSON_Parse.checkAlgorithm} }.
67
67
  */
68
- static check(toCheck: any, receptor: (json: object) => void): void;
68
+ static check(toCheck: any, receptor: (json: object) => void, dbc?: string | undefined): void;
69
69
  }
package/dist/DBC/OR.d.ts CHANGED
@@ -93,7 +93,7 @@ export declare class OR extends DBC {
93
93
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link OR }.*/
94
94
  static tsCheck<CANDIDATE>(toCheck: unknown | undefined | null, conditions: Array<{
95
95
  check: (toCheck: unknown | undefined | null | object) => boolean | string;
96
- }>, hint?: string, id?: string | undefined): CANDIDATE;
96
+ }>, hint?: string, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
97
97
  /**
98
98
  * Creates this {@link OR } by setting the protected property {@link OR.conditions } used by {@link OR.check }.
99
99
  *
@@ -80,7 +80,7 @@ export declare class REGEX extends DBC {
80
80
  * @returns The validated value cast to the CANDIDATE type.
81
81
  *
82
82
  * @throws {@link DBC.Infringement} if the value does not match the regular expression. */
83
- static tsCheck<CANDIDATE = unknown>(toCheck: any, expression: RegExp, hint?: string | undefined, id?: string | undefined): CANDIDATE;
83
+ static tsCheck<CANDIDATE = unknown>(toCheck: any, expression: RegExp, hint?: string | undefined, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
84
84
  /**
85
85
  * Creates this {@link REGEX } by setting the protected property {@link REGEX.expression } used by {@link REGEX.check }.
86
86
  *
@@ -92,5 +92,5 @@ export declare class REGEX extends DBC {
92
92
  * @param toCheck See {@link REGEX.checkAlgorithm}.
93
93
  * @param expression See {@link REGEX.checkAlgorithm}.
94
94
  */
95
- static check(toCheck: unknown | null | undefined, expression: RegExp): void;
95
+ static check(toCheck: unknown | null | undefined, expression: RegExp, dbc?: string | undefined): void;
96
96
  }
@@ -66,7 +66,7 @@ export declare class TYPE extends DBC {
66
66
  * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link TYPE }.
67
67
  *
68
68
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }. */
69
- static tsCheck<CANDIDATE = unknown>(toCheck: any, type: string, hint?: string | undefined, id?: string | undefined): CANDIDATE;
69
+ static tsCheck<CANDIDATE = unknown>(toCheck: any, type: string, hint?: string | undefined, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
70
70
  /**
71
71
  * Creates this {@link TYPE } by setting the protected property {@link TYPE.type } used by {@link TYPE.check }.
72
72
  *
@@ -58,5 +58,5 @@ export declare class UNDEFINED extends DBC {
58
58
  * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link UNDEFINED }.
59
59
  *
60
60
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link UNDEFINED }.*/
61
- static tsCheck<CANDIDATE = unknown>(toCheck: CANDIDATE | undefined | null, id?: string | undefined): CANDIDATE;
61
+ static tsCheck<CANDIDATE = unknown>(toCheck: CANDIDATE | undefined | null, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
62
62
  }
package/dist/DBC/ZOD.d.ts CHANGED
@@ -63,7 +63,7 @@ export declare class ZOD extends DBC {
63
63
  * @returns The **CANDIDATE** **toCheck** doesn't fulfill this {@link ZOD }.
64
64
  *
65
65
  * @throws A {@link DBC.Infringement } if the **CANDIDATE** **toCheck** does not fulfill this {@link DEFINED }. */
66
- static tsCheck<CANDIDATE = unknown>(toCheck: any, schema: z.ZodType, id?: string | undefined): CANDIDATE;
66
+ static tsCheck<CANDIDATE = unknown>(toCheck: any, schema: z.ZodType, id?: string | undefined, dbc?: string | undefined): CANDIDATE;
67
67
  /**
68
68
  * Creates this {@link ZOD } by setting the protected property {@link ZOD.schema } used by {@link ZOD.check }.
69
69
  *
package/dist/DBC.d.ts CHANGED
@@ -185,6 +185,15 @@ export declare class DBC {
185
185
  * @param method The {@link string } describing or naming the violator.
186
186
  * @param value The parameter's value. */
187
187
  reportReturnvalueInfringement(message: string, target: object, path: string | undefined, method: string, value: any, hint?: string | undefined): void;
188
+ /**
189
+ * Routes an imperative infringement (from {@link tsCheck } or static {@link check } calls) through the
190
+ * registered DBC instance's {@link infringementSettings }, respecting whether to throw, log, or both.
191
+ * Falls back to throwing {@link DBC.Infringement } directly if no DBC instance is registered at the
192
+ * specified path, preserving the pre-existing behaviour for code that does not register a DBC instance.
193
+ *
194
+ * @param message The fully formatted infringement message.
195
+ * @param dbc The path to the DBC instance. Defaults to `"WaXCode.DBC"`. */
196
+ static reportTsCheckInfringement(message: string, dbc?: string | undefined): void;
188
197
  /** An {@link Error } to be thrown whenever an infringement is detected. */
189
198
  static Infringement: {
190
199
  new (message: string): {