xdbc 1.0.93 → 1.0.95

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 (97) hide show
  1. package/.parcel-cache/bf96c58b6061a62a-BundleGraph +0 -0
  2. package/.parcel-cache/d7c812d65aeeac59-AssetGraph +0 -0
  3. package/.parcel-cache/data.mdb +0 -0
  4. package/.parcel-cache/e81759c1f106a17f-RequestGraph +0 -0
  5. package/.parcel-cache/fe0db3c4eb428be2-AssetGraph +0 -0
  6. package/.parcel-cache/lock.mdb +0 -0
  7. package/.parcel-cache/snapshot-e81759c1f106a17f.txt +4609 -0
  8. package/CODE_OF_CONDUCT.md +128 -0
  9. package/CONTRIBUTING.md +40 -0
  10. package/FUNDING.yml +3 -0
  11. package/LICENSE +21 -0
  12. package/README.md +96 -0
  13. package/SECURITY.md +36 -0
  14. package/Test.html +1 -1
  15. package/__tests__/DBC/AE.test.ts +62 -0
  16. package/__tests__/DBC/EQ.test.ts +13 -0
  17. package/__tests__/DBC/GREATER.test.ts +29 -0
  18. package/__tests__/DBC/INSTANCE.test.ts +13 -0
  19. package/__tests__/DBC/JSON.OP.test.ts +47 -0
  20. package/__tests__/DBC/JSON.Parse.test.ts +17 -0
  21. package/__tests__/DBC/OR.test.ts +14 -0
  22. package/__tests__/DBC/REGEX.test.ts +13 -0
  23. package/__tests__/DBC/TYPE.test.ts +13 -0
  24. package/babel.rc +12 -0
  25. package/dist/DBC/AE.js +39 -23
  26. package/dist/DBC/COMPARISON/GREATER.js +22 -0
  27. package/dist/DBC/COMPARISON.js +99 -0
  28. package/dist/DBC/EQ.js +21 -7
  29. package/dist/DBC/GREATER.js +19 -6
  30. package/dist/DBC/INSTANCE.js +22 -9
  31. package/dist/DBC/JSON.OP.js +19 -7
  32. package/dist/DBC/JSON.Parse.js +19 -7
  33. package/dist/DBC/OR.js +35 -23
  34. package/dist/DBC/REGEX.js +21 -9
  35. package/dist/DBC/TYPE.js +19 -7
  36. package/dist/DBC.js +112 -39
  37. package/dist/Demo.js +267 -0
  38. package/dist/bundle.js +1329 -0
  39. package/docs/.nojekyll +1 -0
  40. package/docs/assets/hierarchy.js +1 -0
  41. package/docs/assets/highlight.css +22 -0
  42. package/docs/assets/icons.js +18 -0
  43. package/docs/assets/icons.svg +1 -0
  44. package/docs/assets/main.js +60 -0
  45. package/docs/assets/navigation.js +1 -0
  46. package/docs/assets/search.js +1 -0
  47. package/docs/assets/style.css +1640 -0
  48. package/docs/classes/DBC.DBC.html +98 -0
  49. package/docs/classes/DBC_AE.AE.html +160 -0
  50. package/docs/classes/DBC_EQ.EQ.html +131 -0
  51. package/docs/classes/DBC_GREATER.GREATER.html +139 -0
  52. package/docs/classes/DBC_INSTANCE.INSTANCE.html +130 -0
  53. package/docs/classes/DBC_JSON.OP.JSON_OP.html +138 -0
  54. package/docs/classes/DBC_JSON.Parse.JSON_Parse.html +129 -0
  55. package/docs/classes/DBC_OR.OR.html +137 -0
  56. package/docs/classes/DBC_REGEX.REGEX.html +136 -0
  57. package/docs/classes/DBC_TYPE.TYPE.html +130 -0
  58. package/docs/classes/Demo.Demo.html +14 -0
  59. package/docs/hierarchy.html +1 -0
  60. package/docs/index.html +1 -0
  61. package/docs/modules/DBC.html +1 -0
  62. package/docs/modules/DBC_AE.html +1 -0
  63. package/docs/modules/DBC_EQ.html +1 -0
  64. package/docs/modules/DBC_GREATER.html +1 -0
  65. package/docs/modules/DBC_INSTANCE.html +1 -0
  66. package/docs/modules/DBC_JSON.OP.html +1 -0
  67. package/docs/modules/DBC_JSON.Parse.html +1 -0
  68. package/docs/modules/DBC_OR.html +1 -0
  69. package/docs/modules/DBC_REGEX.html +1 -0
  70. package/docs/modules/DBC_TYPE.html +1 -0
  71. package/docs/modules/Demo.html +1 -0
  72. package/jest.config.ts +20 -0
  73. package/package.json +23 -5
  74. package/src/DBC/AE.ts +49 -24
  75. package/src/DBC/COMPARISON/GREATER.ts +38 -0
  76. package/src/DBC/COMPARISON/GREATER_OR_EQUAL.ts +38 -0
  77. package/src/DBC/COMPARISON/LESS.ts +38 -0
  78. package/src/DBC/COMPARISON/LESS_OR_EQUAL.ts +38 -0
  79. package/src/DBC/COMPARISON.ts +150 -0
  80. package/src/DBC/EQ.ts +26 -8
  81. package/src/DBC/GREATER.ts +30 -7
  82. package/src/DBC/INSTANCE.ts +26 -10
  83. package/src/DBC/JSON.OP.ts +29 -8
  84. package/src/DBC/JSON.Parse.ts +24 -8
  85. package/src/DBC/OR.ts +42 -24
  86. package/src/DBC/REGEX.ts +26 -10
  87. package/src/DBC/TYPE.ts +24 -8
  88. package/src/DBC.ts +138 -46
  89. package/src/Demo.ts +211 -0
  90. package/tsconfig.json +3 -1
  91. package/typedoc.json +16 -0
  92. package/webpack.config.js +26 -0
  93. package/dist/DBC.min.js +0 -2
  94. package/dist/test.js +0 -110
  95. package/src/test.ts +0 -61
  96. package/test.js +0 -14
  97. package/test.ts +0 -11
package/src/Demo.ts ADDED
@@ -0,0 +1,211 @@
1
+ import { DBC } from "./DBC";
2
+ import { REGEX } from "./DBC/REGEX";
3
+ import { EQ } from "./DBC/EQ";
4
+ import { TYPE } from "./DBC/TYPE";
5
+ import { AE } from "./DBC/AE";
6
+ import { INSTANCE } from "./DBC/INSTANCE";
7
+ /** Demonstrative use of **D**esign **B**y **C**ontract Decorators */
8
+ export class Demo {
9
+ // #region Check Property Decorator
10
+ @REGEX.INVARIANT(/^a$/)
11
+ public testProperty = "a";
12
+ // #endregion Check Property Decorator
13
+ // #region Check Parameter. & Returnvalue Decorator
14
+ @REGEX.POST(/^xxxx.*$/)
15
+ @DBC.ParamvalueProvider
16
+ public testParamvalueAndReturnvalue(@REGEX.PRE(/holla*/g) a: string): string {
17
+ return `xxxx${a}`;
18
+ }
19
+ // #endregion Check Parameter. & Returnvalue Decorator
20
+ // #region Check Returnvalue Decorator
21
+ @REGEX.POST(/^xxxx.*$/)
22
+ public testReturnvalue(a: string): string {
23
+ return a;
24
+ }
25
+ // #endregion Check Returnvalue Decorator
26
+ // #region Check EQ-DBC & Path to property of Parameter-value
27
+ @DBC.ParamvalueProvider
28
+ public testEQAndPath(
29
+ @EQ.PRE("SELECT" as unknown as object, false, "tagName") o: HTMLElement,
30
+ ) {}
31
+ // #endregion Check EQ-DBC & Path to property of Parameter-value
32
+ // #region Check EQ-DBC & Path to property of Parameter-value with Inversion
33
+ @DBC.ParamvalueProvider
34
+ public testEQAndPathWithInversion(
35
+ @EQ.PRE("SELECT" as unknown as object, true, "tagName") o: HTMLElement,
36
+ ) {}
37
+ // #endregion Check EQ-DBC & Path to property of Parameter-value with Inversion
38
+ // #region Check TYPE
39
+ @DBC.ParamvalueProvider
40
+ public testTYPE(@TYPE.PRE("string") o: unknown) {}
41
+ // #endregion Check TYPE
42
+ // #region Check AE
43
+ @DBC.ParamvalueProvider
44
+ public testAE(@AE.PRE([new TYPE("string")]) x: Array<unknown>) {}
45
+ // #endregion Check AE
46
+ // #region Check REGEX with AE
47
+ @DBC.ParamvalueProvider
48
+ public testREGEXWithAE(
49
+ @AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i)) x: Array<string>,
50
+ ) {}
51
+ // #endregion Check REGEX with AE
52
+ // #region Check INSTANCE
53
+ @DBC.ParamvalueProvider
54
+ // biome-ignore lint/suspicious/noExplicitAny: Test
55
+ public testINSTANCE(@INSTANCE.PRE(Date) candidate: any): undefined {}
56
+ // #endregion Check INSTANCE
57
+ // #region Check AE Range
58
+ @DBC.ParamvalueProvider
59
+ public testAERange(
60
+ @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1, 2) x: Array<unknown>,
61
+ ) {}
62
+ // #endregion Check AE Range
63
+ // #region Check AE Index
64
+ @DBC.ParamvalueProvider
65
+ public testAEIndex(
66
+ @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1) x: Array<unknown>,
67
+ ) {}
68
+ // #endregion Check AE Index
69
+ }
70
+
71
+ const demo = new Demo();
72
+
73
+ try {
74
+ demo.testProperty = "abd";
75
+ } catch (X) {
76
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
77
+ console.log("INVARIANT Infringement", "OK");
78
+ console.log(X);
79
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
80
+ }
81
+
82
+ demo.testProperty = "a";
83
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
84
+ console.log("INVARIANT OK");
85
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
86
+
87
+ demo.testParamvalueAndReturnvalue("holla");
88
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
89
+ console.log("PARAMETER- & RETURNVALUE OK");
90
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
91
+
92
+ try {
93
+ demo.testParamvalueAndReturnvalue("yyyy");
94
+ } catch (X) {
95
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
96
+ console.log("PARAMETER- & RETURNVALUE Infringement", "OK");
97
+ console.log(X);
98
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
99
+ }
100
+
101
+ demo.testReturnvalue("xxxx");
102
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
103
+ console.log("RETURNVALUE OK");
104
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
105
+
106
+ try {
107
+ demo.testReturnvalue("yyyy");
108
+ } catch (X) {
109
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
110
+ console.log("RETURNVALUE Infringement", "OK");
111
+ console.log(X);
112
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
113
+ }
114
+
115
+ demo.testEQAndPath(document.createElement("select"));
116
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
117
+ console.log("EQ with Path Infringement OK");
118
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
119
+
120
+ try {
121
+ demo.testEQAndPathWithInversion(document.createElement("select"));
122
+ } catch (X) {
123
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
124
+ console.log("EQ with Path and Inversion Infringement OK");
125
+ console.log(X);
126
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
127
+ }
128
+
129
+ demo.testTYPE("x");
130
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
131
+ console.log("TYPE OK");
132
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
133
+
134
+ try {
135
+ demo.testTYPE(0);
136
+ } catch (X) {
137
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
138
+ console.log("TYPE Infringement OK");
139
+ console.log(X);
140
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
141
+ }
142
+
143
+ demo.testAE(["11", "10", "b"]);
144
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
145
+ console.log("AE OK");
146
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
147
+
148
+ try {
149
+ demo.testAE(["11", 11, "b"]);
150
+ } catch (X) {
151
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
152
+ console.log("AE Infringement OK");
153
+ console.log(X);
154
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
155
+ }
156
+
157
+ demo.testREGEXWithAE(["+1d", "NOW", "-10y"]);
158
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
159
+ console.log("REGEX with AE OK");
160
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
161
+
162
+ try {
163
+ demo.testREGEXWithAE(["+1d", "+5d", "-x10y"]);
164
+ } catch (X) {
165
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
166
+ console.log("REGEX with AE Infringement OK");
167
+ console.log(X);
168
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
169
+ }
170
+
171
+ demo.testINSTANCE(new Date());
172
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
173
+ console.log("INSTANCE OK");
174
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
175
+
176
+ try {
177
+ demo.testINSTANCE(demo);
178
+ } catch (X) {
179
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
180
+ console.log("INSTANCE Infringement OK");
181
+ console.log(X);
182
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
183
+ }
184
+
185
+ demo.testAERange([11, "abc", "abc"]);
186
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
187
+ console.log("AE Range OK");
188
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
189
+
190
+ try {
191
+ demo.testAERange([11, "abc", /a/g]);
192
+ } catch (X) {
193
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
194
+ console.log("AE Range Infringement OK");
195
+ console.log(X);
196
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
197
+ }
198
+
199
+ demo.testAEIndex([11, "abc", "abc"]);
200
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
201
+ console.log("AE Index OK");
202
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
203
+
204
+ try {
205
+ demo.testAEIndex(["11", 12, "/a/g"]);
206
+ } catch (X) {
207
+ console.log("⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄");
208
+ console.log("AE Index Infringement OK");
209
+ console.log(X);
210
+ console.log("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
211
+ }
package/tsconfig.json CHANGED
@@ -4,12 +4,14 @@
4
4
  "experimentalDecorators": true,
5
5
  "emitDecoratorMetadata": true,
6
6
  "outDir": "./dist",
7
+ "esModuleInterop": true,
7
8
  "module": "es6",
9
+ "moduleResolution": "node",
8
10
  "typeRoots": []
9
11
  },
10
12
 
11
13
  "include": [
12
14
  "./src/**/*.ts" // or your source directories
13
15
  ],
14
- "exclude": ["node_modules"]
16
+ "exclude": ["node_modules", "__tests__"]
15
17
  }
package/typedoc.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "entryPoints": ["./src/**/*.ts"],
3
+ "out": "./docs",
4
+ "name": "CodBi",
5
+ "exclude": ["./node_modules"],
6
+ "theme": "default",
7
+ "hideGenerator": true,
8
+ "disableSources": false,
9
+ "tsconfig": "./tsconfig.json",
10
+ "options": {
11
+ "excludePrivate": true,
12
+ "excludeProtected": false,
13
+ "excludeExternals": false,
14
+ "disableOutputCheck": true
15
+ }
16
+ }
@@ -0,0 +1,26 @@
1
+ const path = require("path");
2
+
3
+ module.exports = {
4
+ mode: "development", // or 'production' for optimized builds
5
+ entry: "./src/Demo.ts", // Your main TypeScript entry point
6
+ devtool: "inline-source-map", // For easier debugging
7
+ module: {
8
+ rules: [
9
+ {
10
+ test: /\.tsx?$/,
11
+ use: "ts-loader",
12
+ exclude: /node_modules/,
13
+ },
14
+ ],
15
+ },
16
+ resolve: {
17
+ extensions: [".tsx", ".ts", ".js"],
18
+ },
19
+ output: {
20
+ filename: "bundle.js", // The output bundle file
21
+ path: path.resolve(__dirname, "dist"), // Output directory
22
+ },
23
+ devServer: {
24
+ static: "./dist", // Serve files from the output directory
25
+ },
26
+ };
package/dist/DBC.min.js DELETED
@@ -1,2 +0,0 @@
1
- // @ts-nocheck
2
- export class DBC{constructor(){this.g=0}static decPrecondition(t){return(t,e,o)=>{console.log(`X:${DBC.parameterValues.get(t).get(e)}`),console.log(t)}}static log(t,e,o){const n=o.value;return o.value=function(...o){console.log(`Calling ${t.constructor.name}.${e} with arguments: ${JSON.stringify(o)}`);const s=n.apply(this,o);return console.log(`Result: ${s}`),s},o}}DBC.parameterValues=new Map;
package/dist/test.js DELETED
@@ -1,110 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { DBC } from "./DBC.js";
14
- import { REGEX } from "./DBC/REGEX.js";
15
- import { EQ } from "./DBC/EQ.js";
16
- import { TYPE } from "./DBC/TYPE.js";
17
- import { AE } from "./DBC/AE.js";
18
- import { INSTANCE } from "./DBC/INSTANCE.js";
19
- export class Calculator {
20
- divide(a, b) {
21
- console.log(a);
22
- return a;
23
- }
24
- HT(o) { }
25
- type(o) { }
26
- array(x) { }
27
- regex(x) { }
28
- index(x) { }
29
- instance(candidate) { }
30
- range(x) { }
31
- // biome-ignore lint/suspicious/noExplicitAny: Test
32
- invert(g) {
33
- return null;
34
- }
35
- }
36
- __decorate([
37
- REGEX.POST(/xxxx*/g),
38
- DBC.ParamvalueProvider,
39
- __param(0, REGEX.PRE(/holla*/g)),
40
- __metadata("design:type", Function),
41
- __metadata("design:paramtypes", [String, Number]),
42
- __metadata("design:returntype", String)
43
- ], Calculator.prototype, "divide", null);
44
- __decorate([
45
- DBC.ParamvalueProvider,
46
- __param(0, EQ.PRE("SELECT", true, "tagName")),
47
- __metadata("design:type", Function),
48
- __metadata("design:paramtypes", [HTMLElement]),
49
- __metadata("design:returntype", void 0)
50
- ], Calculator.prototype, "HT", null);
51
- __decorate([
52
- DBC.ParamvalueProvider,
53
- __param(0, TYPE.PRE("string")),
54
- __metadata("design:type", Function),
55
- __metadata("design:paramtypes", [Object]),
56
- __metadata("design:returntype", void 0)
57
- ], Calculator.prototype, "type", null);
58
- __decorate([
59
- DBC.ParamvalueProvider,
60
- __param(0, AE.PRE([new TYPE("string")])),
61
- __metadata("design:type", Function),
62
- __metadata("design:paramtypes", [Array]),
63
- __metadata("design:returntype", void 0)
64
- ], Calculator.prototype, "array", null);
65
- __decorate([
66
- DBC.ParamvalueProvider,
67
- __param(0, AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i))),
68
- __metadata("design:type", Function),
69
- __metadata("design:paramtypes", [Array]),
70
- __metadata("design:returntype", void 0)
71
- ], Calculator.prototype, "regex", null);
72
- __decorate([
73
- DBC.ParamvalueProvider,
74
- __param(0, AE.PRE(new REGEX(/^\d$/i), 0)),
75
- __param(0, AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i), 1)),
76
- __metadata("design:type", Function),
77
- __metadata("design:paramtypes", [Array]),
78
- __metadata("design:returntype", void 0)
79
- ], Calculator.prototype, "index", null);
80
- __decorate([
81
- DBC.ParamvalueProvider
82
- // biome-ignore lint/suspicious/noExplicitAny: Test
83
- ,
84
- __param(0, INSTANCE.PRE(Date)),
85
- __metadata("design:type", Function),
86
- __metadata("design:paramtypes", [Object]),
87
- __metadata("design:returntype", void 0)
88
- ], Calculator.prototype, "instance", null);
89
- __decorate([
90
- DBC.ParamvalueProvider,
91
- __param(0, AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1, 2)),
92
- __metadata("design:type", Function),
93
- __metadata("design:paramtypes", [Array]),
94
- __metadata("design:returntype", void 0)
95
- ], Calculator.prototype, "range", null);
96
- __decorate([
97
- AE.POST(new EQ(null, true), 0),
98
- __metadata("design:type", Function),
99
- __metadata("design:paramtypes", [String]),
100
- __metadata("design:returntype", void 0)
101
- ], Calculator.prototype, "invert", null);
102
- console.log("s");
103
- //new Calculator().divide("xxxx", 1);
104
- //new Calculator().HT(document.createElement("select"));
105
- //new Calculator().type("10");
106
- //new Calculator().array([11, "10", "b"]);
107
- //new Calculator().index(["1a", "+d1m", "-x10y"]);
108
- //new Calculator().instance(new Date());
109
- //new Calculator().range([11, "abc", "abc"]);
110
- new Calculator().invert("");
package/src/test.ts DELETED
@@ -1,61 +0,0 @@
1
- import { DBC } from "./DBC.js";
2
- import { REGEX } from "./DBC/REGEX.js";
3
- import { EQ } from "./DBC/EQ.js";
4
- import { TYPE } from "./DBC/TYPE.js";
5
- import { AE } from "./DBC/AE.js";
6
- import { INSTANCE } from "./DBC/INSTANCE.js";
7
-
8
- export class Calculator {
9
- @REGEX.POST(/xxxx*/g)
10
- @DBC.ParamvalueProvider
11
- public divide(@REGEX.PRE(/holla*/g) a: string, b: number): string {
12
- console.log(a);
13
-
14
- return a;
15
- }
16
- @DBC.ParamvalueProvider
17
- public HT(
18
- @EQ.PRE("SELECT" as unknown as object, true, "tagName") o: HTMLElement,
19
- ) {}
20
- @DBC.ParamvalueProvider
21
- public type(@TYPE.PRE("string") o: unknown) {}
22
-
23
- @DBC.ParamvalueProvider
24
- public array(@AE.PRE([new TYPE("string")]) x: Array<unknown>) {}
25
-
26
- @DBC.ParamvalueProvider
27
- public regex(
28
- @AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i)) x: Array<string>,
29
- ) {}
30
-
31
- @DBC.ParamvalueProvider
32
- public index(
33
- @AE.PRE(new REGEX(/^\d$/i), 0)
34
- @AE.PRE(new REGEX(/^(?i:(NOW)|([+-]\d+[dmy]))$/i), 1)
35
- x: Array<string>,
36
- ) {}
37
-
38
- @DBC.ParamvalueProvider
39
- // biome-ignore lint/suspicious/noExplicitAny: Test
40
- public instance(@INSTANCE.PRE(Date) candidate: any): undefined {}
41
- @DBC.ParamvalueProvider
42
- public range(
43
- // biome-ignore lint/suspicious/noExplicitAny: Test
44
- @AE.PRE([new TYPE("string"), new REGEX(/^abc$/)], 1, 2) x: Array<any>,
45
- ) {}
46
- // biome-ignore lint/suspicious/noExplicitAny: Test
47
- @AE.POST(new EQ(null, true), 0)
48
- public invert(g: string) {
49
- return null;
50
- }
51
- }
52
-
53
- console.log("s");
54
- //new Calculator().divide("xxxx", 1);
55
- //new Calculator().HT(document.createElement("select"));
56
- //new Calculator().type("10");
57
- //new Calculator().array([11, "10", "b"]);
58
- //new Calculator().index(["1a", "+d1m", "-x10y"]);
59
- //new Calculator().instance(new Date());
60
- //new Calculator().range([11, "abc", "abc"]);
61
- new Calculator().invert("");
package/test.js DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Calculator = void 0;
4
- var Calculator = /** @class */ (function () {
5
- function Calculator() {
6
- }
7
- // @DBC.log
8
- Calculator.prototype.divide = function (@REGEX.PRE("r") a, b) {
9
- return a / b;
10
- };
11
- return Calculator;
12
- }());
13
- exports.Calculator = Calculator;
14
- alert(new Calculator().divide(2, 1));
package/test.ts DELETED
@@ -1,11 +0,0 @@
1
- import { DBC } from "./DBC.js";
2
- import { REGEX } from "./DBC/REGEX.js";
3
-
4
- export class Calculator {
5
- @DBC.log
6
- public divide(@REGEX.PRE("r") a: number, b: number): number {
7
- return a / b;
8
- }
9
- }
10
-
11
- alert(new Calculator().divide(2, 1));