xdbc 1.0.95 → 1.0.96

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.95",
2
+ "version": "1.0.96",
3
3
  "name": "xdbc",
4
4
  "scripts": {
5
5
  "docs": "typedoc",
@@ -25,7 +25,8 @@
25
25
  "typescript": "^5.8.3",
26
26
  "undici-types": "^7.8.0",
27
27
  "webpack": "^5.99.8",
28
- "webpack-cli": "^6.0.1"
28
+ "webpack-cli": "^6.0.1",
29
+ "webpack-dev-server": "^5.2.1"
29
30
  },
30
31
  "dependencies": {
31
32
  "@types/reflect-metadata": "^0.1.0",
@@ -37,7 +38,11 @@
37
38
  "type": "git",
38
39
  "url": "git+https://github.com/CallariS/XDBC.git"
39
40
  },
40
- "keywords": ["DbC", "DesignByContract", "Typescript"],
41
+ "keywords": [
42
+ "DbC",
43
+ "DesignByContract",
44
+ "Typescript"
45
+ ],
41
46
  "author": "Callari, Salvatore",
42
47
  "license": "MIT",
43
48
  "bugs": {
@@ -20,7 +20,7 @@ export class COMPARISON extends DBC {
20
20
  }
21
21
 
22
22
  if (equalityPermitted && invert && toCheck > equivalent) {
23
- return `Value must not to be less than or equal to "${equivalent}"`;
23
+ return `Value has to be less than or equal to "${equivalent}"`;
24
24
  }
25
25
 
26
26
  if (!equalityPermitted && !invert && toCheck <= equivalent) {
@@ -28,7 +28,7 @@ export class COMPARISON extends DBC {
28
28
  }
29
29
 
30
30
  if (!equalityPermitted && invert && toCheck >= equivalent) {
31
- return `Value must not to be less than "${equivalent}"`;
31
+ return `Value has to be less than "${equivalent}"`;
32
32
  }
33
33
 
34
34
  return true;
@@ -0,0 +1,35 @@
1
+ import { EQ } from "../EQ";
2
+ /** See {@link COMPARISON }. */
3
+ export class DIFFERENT extends EQ {
4
+ /** See {@link COMPARISON.PRE }. */
5
+ public static override PRE(
6
+ equivalent,
7
+ invert = false,
8
+ path: string = undefined,
9
+ dbc = "WaXCode.DBC",
10
+ ) {
11
+ return EQ.PRE(equivalent, true, path, dbc);
12
+ }
13
+ /** See {@link COMPARISON.POST }. */
14
+ public static override POST(
15
+ equivalent,
16
+ invert = false,
17
+ path: string = undefined,
18
+ dbc = "WaXCode.DBC",
19
+ ) {
20
+ return EQ.POST(equivalent, true, path, dbc);
21
+ }
22
+ /** See {@link COMPARISON.INVARIANT }. */
23
+ public static INVARIANT(
24
+ equivalent,
25
+ invert = false,
26
+ path: string = undefined,
27
+ dbc = "WaXCode.DBC",
28
+ ) {
29
+ return EQ.INVARIANT(equivalent, true, path, dbc);
30
+ }
31
+ /** See {@link COMPARISON.constructor }. */
32
+ constructor(public equivalent) {
33
+ super(equivalent, true);
34
+ }
35
+ }
@@ -0,0 +1,140 @@
1
+ import { DBC } from "../DBC";
2
+ /**
3
+ * A {@link DBC } defining that a {@link HTMLElement } gotta have a certain attribute set.
4
+ *
5
+ * @remarks
6
+ * Maintainer: Callari, Salvatore (XDBC@WaXCode.net) */
7
+ export class HasAttribute extends DBC {
8
+ // #region Condition checking.
9
+ /**
10
+ * Checks if the {@link HTMLElement } **toCheck** has the attribute **toCheckFor**.
11
+ *
12
+ * @param toCheckFor name of the attribute to check for whether it is set or not.
13
+ *
14
+ * @returns TRUE if the {@link HTMLElement } **toCheck** has set the attribute **toCheckFor**,
15
+ * otherwise a proper errormessage. */
16
+ public static checkAlgorithm(
17
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
18
+ toCheck: any,
19
+ toCheckFor: string,
20
+ invert,
21
+ ): boolean | string {
22
+ if(!( toCheck instanceof HTMLElement )) {
23
+ return `The object to check for whether it has the attribute "${ toCheckFor }" is not a HTMLElement. It is of type "${ typeof toCheck }".`;
24
+ }
25
+
26
+ if (!invert && !( toCheck as HTMLElement ).hasAttribute( toCheckFor )) {
27
+ return `Required Attribute "${ toCheckFor }" is not set.`;
28
+ }
29
+
30
+ if (invert && ( toCheck as HTMLElement ).hasAttribute( toCheckFor )) {
31
+ return `Forbidden Attribute "${ toCheckFor }" is set.`;
32
+ }
33
+
34
+ return true;
35
+ }
36
+ /**
37
+ * A parameter-decorator factory using the {@link HasAttribute.checkAlgorithm } to determine whether this {@link DBC } is fulfilled
38
+ * by the tagged parameter.
39
+ *
40
+ * @param toCheckFor See {@link HasAttribute.checkAlgorithm }.
41
+ * @param path See {@link DBC.decPrecondition }.
42
+ * @param dbc See {@link DBC.decPrecondition }.
43
+ *
44
+ * @returns See {@link DBC.decPrecondition }. */
45
+ public static PRE(
46
+ toCheckFor: string,
47
+ invert = false,
48
+ path: string | undefined = undefined,
49
+ dbc = "WaXCode.DBC",
50
+ ): (
51
+ target: object,
52
+ methodName: string | symbol,
53
+ parameterIndex: number,
54
+ ) => void {
55
+ return DBC.decPrecondition(
56
+ (
57
+ value: object,
58
+ target: object,
59
+ methodName: string,
60
+ parameterIndex: number,
61
+ ) => {
62
+ return HasAttribute.checkAlgorithm(value, toCheckFor, invert);
63
+ },
64
+ dbc,
65
+ path,
66
+ );
67
+ }
68
+ /**
69
+ * A method-decorator factory using the {@link HasAttribute.checkAlgorithm } to determine whether this {@link DBC } is
70
+ * fulfilled by the tagged method's returnvalue.
71
+ *
72
+ * @param toCheckFor See {@link HasAttribute.checkAlgorithm }.
73
+ * @param path See {@link DBC.Postcondition }.
74
+ * @param dbc See {@link DBC.decPostcondition }.
75
+ *
76
+ * @returns See {@link DBC.decPostcondition }. */
77
+ public static POST(
78
+ toCheckFor: string,
79
+ invert = false,
80
+ path: string | undefined = undefined,
81
+ dbc = "WaXCode.DBC",
82
+ ): (
83
+ target: object,
84
+ propertyKey: string,
85
+ descriptor: PropertyDescriptor,
86
+ ) => PropertyDescriptor {
87
+ return DBC.decPostcondition(
88
+ (value: object, target: object, propertyKey: string) => {
89
+ return HasAttribute.checkAlgorithm(value, toCheckFor, invert);
90
+ },
91
+ dbc,
92
+ path,
93
+ );
94
+ }
95
+ /**
96
+ * A field-decorator factory using the {@link hasAttribute.checkAlgorithm } to determine whether this {@link DBC } is
97
+ * fulfilled by the tagged field.
98
+ *
99
+ * @param toCheckFor See {@link hasAttribute.checkAlgorithm }.
100
+ * @param path See {@link DBC.decInvariant }.
101
+ * @param dbc See {@link DBC.decInvariant }.
102
+ *
103
+ * @returns See {@link DBC.decInvariant }. */
104
+ public static INVARIANT(
105
+ toCheckFor: any,
106
+ invert = false,
107
+ path: string | undefined = undefined,
108
+ dbc = "WaXCode.DBC",
109
+ ) {
110
+ return DBC.decInvariant([new HasAttribute(toCheckFor, invert)], path, dbc);
111
+ }
112
+ // #endregion Condition checking.
113
+ // #region Referenced Condition checking.
114
+ //
115
+ // For usage in dynamic scenarios (like with AE-DBC).
116
+ //
117
+ /**
118
+ * Invokes the {@link hasAttribute.checkAlgorithm } passing the value **toCheck**, {@link hasAttribute.equivalent } and
119
+ * {@link hasAttribute.invert }.
120
+ *
121
+ * @param toCheck See {@link EQ.checkAlgorithm }.
122
+ *
123
+ * @returns See {@link EQ.checkAlgorithm}. */
124
+ // biome-ignore lint/suspicious/noExplicitAny: Necessary to check against NULL & UNDEFINED.
125
+ public check(toCheck: any) {
126
+ return HasAttribute.checkAlgorithm(toCheck, this.toCheckFor, this.invert);
127
+ }
128
+ /**
129
+ * Creates this {@link DBC } by setting the protected property {@link hasAttribute.equivalent } used by
130
+ * {@link hasAttribute.check }.
131
+ *
132
+ * @param toCheckFor See {@link hasAttribute.check }. */
133
+ public constructor(
134
+ protected toCheckFor: string,
135
+ protected invert = false,
136
+ ) {
137
+ super();
138
+ }
139
+ // #endregion Referenced Condition checking.
140
+ }
package/src/DBC.ts CHANGED
@@ -141,11 +141,20 @@ export class DBC {
141
141
  dbc = "WaXCode.DBC",
142
142
  ) {
143
143
  return (target: unknown, propertyKey: string | symbol) => {
144
+ if (!DBC.resolveDBCPath(window, dbc).executionSettings.checkInvariants) {
145
+ return;
146
+ }
144
147
  // biome-ignore lint/suspicious/noExplicitAny: Necessary to intercept UNDEFINED and NULL.
145
148
  let value: any;
146
149
  // #region Replace original property.
147
150
  Object.defineProperty(target, propertyKey, {
148
151
  set(newValue) {
152
+ if (
153
+ !DBC.resolveDBCPath(window, dbc).executionSettings.checkInvariants
154
+ ) {
155
+ return;
156
+ }
157
+
149
158
  const realValue = path ? DBC.resolve(newValue, path) : newValue;
150
159
  // #region Check if all "contracts" are fulfilled.
151
160
  for (const contract of contracts) {
@@ -196,6 +205,11 @@ export class DBC {
196
205
  const originalMethod = descriptor.value;
197
206
  // biome-ignore lint/suspicious/noExplicitAny: Necessary to intercept UNDEFINED and NULL.
198
207
  descriptor.value = (...args: any[]) => {
208
+ if (
209
+ !DBC.resolveDBCPath(window, dbc).executionSettings.checkPostconditions
210
+ ) {
211
+ return;
212
+ }
199
213
  // biome-ignore lint/complexity/noThisInStatic: <explanation>
200
214
  const result = originalMethod.apply(this, args);
201
215
  const realValue = path ? DBC.resolve(result, path) : result;
@@ -249,6 +263,13 @@ export class DBC {
249
263
  methodName,
250
264
  parameterIndex,
251
265
  (value: unknown) => {
266
+ if (
267
+ !DBC.resolveDBCPath(window, dbc).executionSettings
268
+ .checkPreconditions
269
+ ) {
270
+ return;
271
+ }
272
+
252
273
  const realValue = path ? DBC.resolve(value, path) : value;
253
274
  const result = check(realValue, target, methodName, parameterIndex);
254
275
 
@@ -268,6 +289,18 @@ export class DBC {
268
289
  }
269
290
  // #endregion Precondition
270
291
  // #endregion Decorator
292
+ // #region Execution Handling
293
+ /** Stores settings concerning the execution of checks. */
294
+ public executionSettings: {
295
+ checkPreconditions: boolean;
296
+ checkPostconditions: boolean;
297
+ checkInvariants: boolean;
298
+ } = {
299
+ checkPreconditions: true,
300
+ checkPostconditions: true,
301
+ checkInvariants: true,
302
+ };
303
+ // #endregion Execution Handling
271
304
  // #region Warning handling.
272
305
  /** Stores settings concerning warnings. */
273
306
  public warningSettings: {
@@ -412,12 +445,22 @@ export class DBC {
412
445
  * Constructs this {@link DBC } by setting the {@link DBC.infringementSettings }, define the **WaXCode** namespace in
413
446
  * **window** if not yet available and setting the property **DBC** in there to the instance of this {@link DBC }.
414
447
  *
415
- * @param infringementSettings See {@link DBC.infringementSettings }. */
448
+ * @param infringementSettings See {@link DBC.infringementSettings }.
449
+ * @param executionSettings See {@link DBC.executionSettings }. */
416
450
  constructor(
417
451
  infringementSettings: {
418
452
  throwException: boolean;
419
453
  logToConsole: boolean;
420
454
  } = { throwException: true, logToConsole: false },
455
+ executionSettings: {
456
+ checkPreconditions: boolean;
457
+ checkPostconditions: boolean;
458
+ checkInvariants: boolean;
459
+ } = {
460
+ checkPreconditions: true,
461
+ checkPostconditions: true,
462
+ checkInvariants: true,
463
+ },
421
464
  ) {
422
465
  this.infringementSettings = infringementSettings;
423
466
 
package/src/Demo.ts CHANGED
@@ -4,6 +4,11 @@ import { EQ } from "./DBC/EQ";
4
4
  import { TYPE } from "./DBC/TYPE";
5
5
  import { AE } from "./DBC/AE";
6
6
  import { INSTANCE } from "./DBC/INSTANCE";
7
+ import { GREATER } from "./DBC/COMPARISON/GREATER";
8
+ import { GREATER_OR_EQUAL } from "./DBC/COMPARISON/GREATER_OR_EQUAL";
9
+ import { LESS } from "./DBC/COMPARISON/LESS";
10
+ import { LESS_OR_EQUAL } from "./DBC/COMPARISON/LESS_OR_EQUAL";
11
+ import { DIFFERENT } from "./DBC/EQ/DIFFERENT";
7
12
  /** Demonstrative use of **D**esign **B**y **C**ontract Decorators */
8
13
  export class Demo {
9
14
  // #region Check Property Decorator
@@ -66,6 +71,22 @@ export class Demo {
66
71
  @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1) x: Array<unknown>,
67
72
  ) {}
68
73
  // #endregion Check AE Index
74
+ // #region Check Comparison
75
+ @DBC.ParamvalueProvider
76
+ public testGREATER(@GREATER.PRE(2) input: number) {}
77
+
78
+ @DBC.ParamvalueProvider
79
+ public testGREATER_OR_EQUAL(@GREATER_OR_EQUAL.PRE(2) input: number) {}
80
+
81
+ @DBC.ParamvalueProvider
82
+ public testLESS(@LESS.PRE(20) input: number) {}
83
+
84
+ @DBC.ParamvalueProvider
85
+ public testLESS_OR_EQUAL(@LESS_OR_EQUAL.PRE(20) input: number) {}
86
+
87
+ @DBC.ParamvalueProvider
88
+ public testDIFFERENT(@DIFFERENT.PRE(20) input: number) {}
89
+ // #endregion Check Comparison
69
90
  }
70
91
 
71
92
  const demo = new Demo();
@@ -76,18 +97,18 @@ try {
76
97
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
77
98
  console.log("INVARIANT Infringement", "OK");
78
99
  console.log(X);
79
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
100
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
80
101
  }
81
102
 
82
103
  demo.testProperty = "a";
83
104
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
84
105
  console.log("INVARIANT OK");
85
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
106
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
86
107
 
87
108
  demo.testParamvalueAndReturnvalue("holla");
88
109
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
89
110
  console.log("PARAMETER- & RETURNVALUE OK");
90
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
111
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
91
112
 
92
113
  try {
93
114
  demo.testParamvalueAndReturnvalue("yyyy");
@@ -95,13 +116,13 @@ try {
95
116
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
96
117
  console.log("PARAMETER- & RETURNVALUE Infringement", "OK");
97
118
  console.log(X);
98
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
119
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
99
120
  }
100
121
 
101
122
  demo.testReturnvalue("xxxx");
102
123
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
103
124
  console.log("RETURNVALUE OK");
104
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
125
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
105
126
 
106
127
  try {
107
128
  demo.testReturnvalue("yyyy");
@@ -109,13 +130,13 @@ try {
109
130
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
110
131
  console.log("RETURNVALUE Infringement", "OK");
111
132
  console.log(X);
112
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
133
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
113
134
  }
114
135
 
115
136
  demo.testEQAndPath(document.createElement("select"));
116
137
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
117
138
  console.log("EQ with Path Infringement OK");
118
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
139
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
119
140
 
120
141
  try {
121
142
  demo.testEQAndPathWithInversion(document.createElement("select"));
@@ -123,13 +144,13 @@ try {
123
144
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
124
145
  console.log("EQ with Path and Inversion Infringement OK");
125
146
  console.log(X);
126
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
147
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
127
148
  }
128
149
 
129
150
  demo.testTYPE("x");
130
151
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
131
152
  console.log("TYPE OK");
132
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
153
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
133
154
 
134
155
  try {
135
156
  demo.testTYPE(0);
@@ -137,13 +158,13 @@ try {
137
158
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
138
159
  console.log("TYPE Infringement OK");
139
160
  console.log(X);
140
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
161
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
141
162
  }
142
163
 
143
164
  demo.testAE(["11", "10", "b"]);
144
165
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
145
166
  console.log("AE OK");
146
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
167
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
147
168
 
148
169
  try {
149
170
  demo.testAE(["11", 11, "b"]);
@@ -151,13 +172,13 @@ try {
151
172
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
152
173
  console.log("AE Infringement OK");
153
174
  console.log(X);
154
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
175
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
155
176
  }
156
177
 
157
178
  demo.testREGEXWithAE(["+1d", "NOW", "-10y"]);
158
179
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
159
180
  console.log("REGEX with AE OK");
160
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
181
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
161
182
 
162
183
  try {
163
184
  demo.testREGEXWithAE(["+1d", "+5d", "-x10y"]);
@@ -165,13 +186,13 @@ try {
165
186
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
166
187
  console.log("REGEX with AE Infringement OK");
167
188
  console.log(X);
168
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
189
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
169
190
  }
170
191
 
171
192
  demo.testINSTANCE(new Date());
172
193
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
173
194
  console.log("INSTANCE OK");
174
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
195
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
175
196
 
176
197
  try {
177
198
  demo.testINSTANCE(demo);
@@ -179,13 +200,13 @@ try {
179
200
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
180
201
  console.log("INSTANCE Infringement OK");
181
202
  console.log(X);
182
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
203
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
183
204
  }
184
205
 
185
206
  demo.testAERange([11, "abc", "abc"]);
186
207
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
187
208
  console.log("AE Range OK");
188
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
209
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
189
210
 
190
211
  try {
191
212
  demo.testAERange([11, "abc", /a/g]);
@@ -193,13 +214,13 @@ try {
193
214
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
194
215
  console.log("AE Range Infringement OK");
195
216
  console.log(X);
196
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
217
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
197
218
  }
198
219
 
199
220
  demo.testAEIndex([11, "abc", "abc"]);
200
221
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
201
222
  console.log("AE Index OK");
202
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
223
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
203
224
 
204
225
  try {
205
226
  demo.testAEIndex(["11", 12, "/a/g"]);
@@ -207,5 +228,127 @@ try {
207
228
  console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
208
229
  console.log("AE Index Infringement OK");
209
230
  console.log(X);
210
- console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
231
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
232
+ }
233
+
234
+ demo.testGREATER(11);
235
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
236
+ console.log("GREATER OK");
237
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
238
+
239
+ try {
240
+ demo.testGREATER(2);
241
+ } catch (X) {
242
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
243
+ console.log("GREATER Infringement OK");
244
+ console.log(X);
245
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
246
+ }
247
+
248
+ demo.testGREATER_OR_EQUAL(2);
249
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
250
+ console.log("GREATER_OR_EQUAL OK");
251
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
252
+
253
+ try {
254
+ demo.testGREATER_OR_EQUAL(1);
255
+ } catch (X) {
256
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
257
+ console.log("GREATER_OR_EQUAL Infringement OK");
258
+ console.log(X);
259
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
260
+ }
261
+
262
+ demo.testLESS(10);
263
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
264
+ console.log("LESS OK");
265
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
266
+
267
+ try {
268
+ demo.testLESS(20);
269
+ } catch (X) {
270
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
271
+ console.log("LESS Infringement OK");
272
+ console.log(X);
273
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
274
+ }
275
+
276
+ demo.testLESS_OR_EQUAL(20);
277
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
278
+ console.log("LESS OK");
279
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
280
+
281
+ try {
282
+ demo.testLESS_OR_EQUAL(21);
283
+ } catch (X) {
284
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
285
+ console.log("LESS_OR_EQUAL Infringement OK");
286
+ console.log(X);
287
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
288
+ }
289
+
290
+ demo.testDIFFERENT(21);
291
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
292
+ console.log("DIFFERENT OK");
293
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
294
+
295
+ try {
296
+ demo.testDIFFERENT(20);
297
+ } catch (X) {
298
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
299
+ console.log("DIFFERENT Infringement OK");
300
+ console.log(X);
301
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
302
+ }
303
+ // #region Inactivity Checks
304
+ (
305
+ window as unknown as { [key: string]: { DBC: DBC } }
306
+ ).WaXCode.DBC.executionSettings.checkPreconditions = false;
307
+
308
+ try {
309
+ demo.testLESS_OR_EQUAL(21);
310
+
311
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
312
+ console.log("INACTIVE PRECONDITIONS OK");
313
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
314
+ } catch (X) {
315
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
316
+ console.log("INACTIVE PRECONDITIONS FAILED");
317
+ console.log(X);
318
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
319
+ }
320
+
321
+ (
322
+ window as unknown as { [key: string]: { DBC: DBC } }
323
+ ).WaXCode.DBC.executionSettings.checkPostconditions = false;
324
+
325
+ try {
326
+ demo.testReturnvalue("qqqqq");
327
+
328
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
329
+ console.log("INACTIVE POSTCONDITIONS OK");
330
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
331
+ } catch (X) {
332
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
333
+ console.log("INACTIVE POSTCONDITIONS FAILED");
334
+ console.log(X);
335
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
336
+ }
337
+
338
+ (
339
+ window as unknown as { [key: string]: { DBC: DBC } }
340
+ ).WaXCode.DBC.executionSettings.checkInvariants = false;
341
+
342
+ try {
343
+ demo.testProperty = "b";
344
+
345
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
346
+ console.log("INACTIVE INVARIANTS OK");
347
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
348
+ } catch (X) {
349
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
350
+ console.log("INACTIVE INVARIANTS FAILED");
351
+ console.log(X);
352
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
211
353
  }
354
+ // #endregion Inactivity Checks
package/webpack.config.js CHANGED
@@ -13,6 +13,7 @@ module.exports = {
13
13
  },
14
14
  ],
15
15
  },
16
+
16
17
  resolve: {
17
18
  extensions: [".tsx", ".ts", ".js"],
18
19
  },