reliant-type 2.1.3 → 2.1.4
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 +113 -688
- package/dist/cjs/core/schema/mode/interfaces/validators/mods/securityValidator.js +1 -1
- package/dist/cjs/core/schema/mode/interfaces/validators/mods/securityValidator.js.map +1 -1
- package/dist/esm/core/schema/mode/interfaces/validators/mods/securityValidator.js +1 -1
- package/dist/esm/core/schema/mode/interfaces/validators/mods/securityValidator.js.map +1 -1
- package/docs/GETTING-STARTED.md +56 -53
- package/docs/VSCODE-EXTENSION.md +58 -47
- package/package.json +2 -2
- package/src/core/schema/mode/interfaces/validators/mods/securityValidator.ts +1 -1
package/docs/VSCODE-EXTENSION.md
CHANGED
|
@@ -8,19 +8,20 @@ Complete guide to the ReliantType VS Code extension - your professional developm
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# Download the latest extension
|
|
11
|
-
curl -L https://
|
|
11
|
+
curl -L https://dll.nehonix.com/pkgs/mods/vscode/latest/reliant-type.vsix -o reliant-type.vsix
|
|
12
12
|
|
|
13
13
|
# Install in VS Code
|
|
14
14
|
code --install-extension reliant-type.vsix
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
### Method 2: VS Code Marketplace
|
|
17
|
+
### Method 2: VS Code Marketplace
|
|
18
18
|
|
|
19
19
|
The extension will be available on the VS Code Marketplace soon. For now, use the direct download method.
|
|
20
20
|
|
|
21
21
|
### Verification
|
|
22
22
|
|
|
23
23
|
After installation, you should see:
|
|
24
|
+
|
|
24
25
|
- ✅ "ReliantType extension loaded!" notification
|
|
25
26
|
- ✅ Enhanced syntax highlighting in TypeScript files
|
|
26
27
|
- ✅ IntelliSense suggestions in `Interface({...})` blocks
|
|
@@ -28,29 +29,34 @@ After installation, you should see:
|
|
|
28
29
|
## ✨ Features Overview
|
|
29
30
|
|
|
30
31
|
### 🎨 Smart Syntax Highlighting
|
|
32
|
+
|
|
31
33
|
- **Context-aware highlighting** - Only activates within `Interface({...})` blocks
|
|
32
34
|
- **Semantic token support** - Rich colors for types, operators, and conditional logic
|
|
33
35
|
- **Professional color themes** - Multiple color schemes to choose from
|
|
34
36
|
|
|
35
37
|
### 🧠 Intelligent IntelliSense
|
|
38
|
+
|
|
36
39
|
- **Type autocompletion** - All ReliantType types with constraints
|
|
37
40
|
- **V2 method completion** - Smart suggestions for `.$method()` syntax
|
|
38
41
|
- **Property suggestions** - Auto-complete schema properties in conditionals
|
|
39
42
|
- **Context-aware** - Only suggests relevant completions
|
|
40
43
|
|
|
41
44
|
### 🔍 Real-time Validation
|
|
45
|
+
|
|
42
46
|
- **Instant error detection** - Catch syntax errors as you type
|
|
43
47
|
- **Detailed diagnostics** - Clear error messages with suggestions
|
|
44
48
|
- **@fortify-ignore support** - Suppress specific warnings
|
|
45
49
|
- **Performance optimized** - No impact on non-Fortify code
|
|
46
50
|
|
|
47
51
|
### 📖 Rich Documentation
|
|
52
|
+
|
|
48
53
|
- **Hover information** - Detailed docs for types and operators
|
|
49
54
|
- **Method documentation** - Complete V2 method reference on hover
|
|
50
55
|
- **Example snippets** - See usage examples without leaving your editor
|
|
51
56
|
- **Quick reference** - Access documentation instantly
|
|
52
57
|
|
|
53
58
|
### 🔗 Navigation Features
|
|
59
|
+
|
|
54
60
|
- **Go-to-definition** - Navigate to property definitions (Ctrl+click)
|
|
55
61
|
- **Variable highlighting** - Highlight conditional variables
|
|
56
62
|
- **Property references** - Find all uses of schema properties
|
|
@@ -64,11 +70,11 @@ The extension provides professional syntax highlighting that activates only with
|
|
|
64
70
|
```typescript
|
|
65
71
|
const UserSchema = Interface({
|
|
66
72
|
// ✨ Rich highlighting for all these elements:
|
|
67
|
-
id: "uuid",
|
|
68
|
-
email: "email",
|
|
69
|
-
name: "string(2,50)",
|
|
70
|
-
role: "admin|user|guest",
|
|
71
|
-
|
|
73
|
+
id: "uuid", // Type highlighting
|
|
74
|
+
email: "email", // Format highlighting
|
|
75
|
+
name: "string(2,50)", // Constraint highlighting
|
|
76
|
+
role: "admin|user|guest", // Union highlighting
|
|
77
|
+
|
|
72
78
|
// V2 conditional syntax highlighting
|
|
73
79
|
hasPermissions: "when config.permissions.$exists() *? boolean : =false",
|
|
74
80
|
// ^^^^ ^^^^^^^^ ^^ ^
|
|
@@ -77,6 +83,7 @@ const UserSchema = Interface({
|
|
|
77
83
|
```
|
|
78
84
|
|
|
79
85
|
**Highlighted Elements:**
|
|
86
|
+
|
|
80
87
|
- **Keywords**: `when`, `Interface`
|
|
81
88
|
- **Types**: `string`, `number`, `boolean`, `email`, `uuid`, etc.
|
|
82
89
|
- **Operators**: `*?`, `:`, `=`, `|`, `&&`, `||`
|
|
@@ -92,12 +99,13 @@ Press `Ctrl+Space` to get intelligent type suggestions:
|
|
|
92
99
|
|
|
93
100
|
```typescript
|
|
94
101
|
const Schema = Interface({
|
|
95
|
-
email: "em|"
|
|
102
|
+
email: "em|", // Triggers: email, empty (if in conditional)
|
|
96
103
|
// ^ Cursor position - shows email completion
|
|
97
104
|
});
|
|
98
105
|
```
|
|
99
106
|
|
|
100
107
|
**Available Completions:**
|
|
108
|
+
|
|
101
109
|
- **Basic Types**: `string`, `number`, `boolean`, `date`, `any`
|
|
102
110
|
- **Format Types**: `email`, `url`, `uuid`, `phone`, `ip`, `json`
|
|
103
111
|
- **Constraint Types**: `positive`, `negative`, `int`
|
|
@@ -110,12 +118,13 @@ Type `.$` to trigger V2 method completions:
|
|
|
110
118
|
```typescript
|
|
111
119
|
const Schema = Interface({
|
|
112
120
|
config: "any?",
|
|
113
|
-
hasData: "when config.data.$|"
|
|
121
|
+
hasData: "when config.data.$|", // Shows all 8 V2 methods
|
|
114
122
|
// ^ Cursor - triggers method completion
|
|
115
123
|
});
|
|
116
124
|
```
|
|
117
125
|
|
|
118
126
|
**Available V2 Methods:**
|
|
127
|
+
|
|
119
128
|
- `$exists()` - Check if property exists
|
|
120
129
|
- `$empty()` - Check if property is empty
|
|
121
130
|
- `$null()` - Check if property is null
|
|
@@ -134,12 +143,12 @@ const Schema = Interface({
|
|
|
134
143
|
user: {
|
|
135
144
|
profile: {
|
|
136
145
|
name: "string",
|
|
137
|
-
email: "email"
|
|
138
|
-
}
|
|
146
|
+
email: "email",
|
|
147
|
+
},
|
|
139
148
|
},
|
|
140
|
-
|
|
149
|
+
|
|
141
150
|
// Type "user." to get property suggestions
|
|
142
|
-
hasProfile: "when user.pr|"
|
|
151
|
+
hasProfile: "when user.pr|", // Suggests: profile
|
|
143
152
|
// ^ Shows property completions
|
|
144
153
|
});
|
|
145
154
|
```
|
|
@@ -153,13 +162,13 @@ The extension provides instant feedback on schema syntax:
|
|
|
153
162
|
```typescript
|
|
154
163
|
const Schema = Interface({
|
|
155
164
|
// ❌ Error: Invalid constraint syntax
|
|
156
|
-
name: "string(,)",
|
|
157
|
-
|
|
165
|
+
name: "string(,)", // Underlined in red
|
|
166
|
+
|
|
158
167
|
// ❌ Error: Unknown type
|
|
159
|
-
id: "unknowntype",
|
|
160
|
-
|
|
168
|
+
id: "unknowntype", // Underlined in red
|
|
169
|
+
|
|
161
170
|
// ❌ Error: Invalid V2 method
|
|
162
|
-
hasData: "when config.data.$invalid() *? boolean : =false"
|
|
171
|
+
hasData: "when config.data.$invalid() *? boolean : =false",
|
|
163
172
|
// ^^^^^^^^ Underlined in red
|
|
164
173
|
});
|
|
165
174
|
```
|
|
@@ -169,10 +178,10 @@ const Schema = Interface({
|
|
|
169
178
|
```typescript
|
|
170
179
|
const Schema = Interface({
|
|
171
180
|
// ⚠️ Warning: Consider using email type
|
|
172
|
-
email: "string",
|
|
173
|
-
|
|
181
|
+
email: "string", // Underlined in yellow
|
|
182
|
+
|
|
174
183
|
// ⚠️ Warning: Large array constraint
|
|
175
|
-
items: "string[](1,10000)"
|
|
184
|
+
items: "string[](1,10000)", // Performance warning
|
|
176
185
|
});
|
|
177
186
|
```
|
|
178
187
|
|
|
@@ -183,8 +192,8 @@ Suppress specific warnings:
|
|
|
183
192
|
```typescript
|
|
184
193
|
const Schema = Interface({
|
|
185
194
|
// @fortify-ignore - suppress email type warning
|
|
186
|
-
email: "string",
|
|
187
|
-
|
|
195
|
+
email: "string", // No warning shown
|
|
196
|
+
|
|
188
197
|
id: "string", // @fortify-ignore - inline ignore
|
|
189
198
|
});
|
|
190
199
|
```
|
|
@@ -197,7 +206,7 @@ Hover over any ReliantType element for detailed information:
|
|
|
197
206
|
|
|
198
207
|
```typescript
|
|
199
208
|
const Schema = Interface({
|
|
200
|
-
email: "email"
|
|
209
|
+
email: "email", // Hover shows: Email validation with RFC 5322 compliance
|
|
201
210
|
// ^^^^^^^ Hover here for documentation
|
|
202
211
|
});
|
|
203
212
|
```
|
|
@@ -207,12 +216,13 @@ const Schema = Interface({
|
|
|
207
216
|
```typescript
|
|
208
217
|
const Schema = Interface({
|
|
209
218
|
config: "any?",
|
|
210
|
-
hasData: "when config.data.$exists() *? boolean : =false"
|
|
219
|
+
hasData: "when config.data.$exists() *? boolean : =false",
|
|
211
220
|
// ^^^^^^^^ Hover for method docs
|
|
212
221
|
});
|
|
213
222
|
```
|
|
214
223
|
|
|
215
224
|
**Hover Information Includes:**
|
|
225
|
+
|
|
216
226
|
- **Description** - What the type/method does
|
|
217
227
|
- **Syntax** - How to use it correctly
|
|
218
228
|
- **Examples** - Real usage examples
|
|
@@ -227,11 +237,11 @@ Navigate through your schemas with Ctrl+click:
|
|
|
227
237
|
const UserSchema = Interface({
|
|
228
238
|
profile: {
|
|
229
239
|
name: "string",
|
|
230
|
-
email: "email"
|
|
240
|
+
email: "email",
|
|
231
241
|
},
|
|
232
|
-
|
|
242
|
+
|
|
233
243
|
// Ctrl+click on "profile" jumps to definition above
|
|
234
|
-
hasProfile: "when profile.$exists() *? boolean : =false"
|
|
244
|
+
hasProfile: "when profile.$exists() *? boolean : =false",
|
|
235
245
|
// ^^^^^^^ Ctrl+click here
|
|
236
246
|
});
|
|
237
247
|
```
|
|
@@ -292,18 +302,18 @@ Configure the extension in VS Code settings:
|
|
|
292
302
|
"fortify.enableCompletion": true,
|
|
293
303
|
"fortify.enableHover": true,
|
|
294
304
|
"fortify.enableSemanticTokens": true,
|
|
295
|
-
|
|
305
|
+
|
|
296
306
|
// Color scheme
|
|
297
307
|
"fortify.colorScheme": "professional",
|
|
298
|
-
|
|
308
|
+
|
|
299
309
|
// Validation settings
|
|
300
310
|
"fortify.validateOnType": true,
|
|
301
311
|
"fortify.showWarnings": true,
|
|
302
312
|
"fortify.maxDiagnostics": 100,
|
|
303
|
-
|
|
313
|
+
|
|
304
314
|
// Performance settings
|
|
305
315
|
"fortify.debounceTime": 300,
|
|
306
|
-
"fortify.maxFileSize": 1048576
|
|
316
|
+
"fortify.maxFileSize": 1048576 // 1MB
|
|
307
317
|
}
|
|
308
318
|
```
|
|
309
319
|
|
|
@@ -327,25 +337,25 @@ For project-specific settings, add to `.vscode/settings.json`:
|
|
|
327
337
|
|
|
328
338
|
Access via Command Palette (`Ctrl+Shift+P`):
|
|
329
339
|
|
|
330
|
-
| Command
|
|
331
|
-
|
|
332
|
-
| `Fortify: Validate Schema`
|
|
333
|
-
| `Fortify: Apply Color Scheme` | Choose and apply color theme
|
|
334
|
-
| `Fortify: List Color Schemes` | View available themes
|
|
335
|
-
| `Fortify: Cleanup Themes`
|
|
336
|
-
| `Fortify: Generate Types`
|
|
337
|
-
| `Fortify: Format Schema`
|
|
340
|
+
| Command | Description |
|
|
341
|
+
| ----------------------------- | --------------------------------------- |
|
|
342
|
+
| `Fortify: Validate Schema` | Manually validate current file |
|
|
343
|
+
| `Fortify: Apply Color Scheme` | Choose and apply color theme |
|
|
344
|
+
| `Fortify: List Color Schemes` | View available themes |
|
|
345
|
+
| `Fortify: Cleanup Themes` | Reset theme settings |
|
|
346
|
+
| `Fortify: Generate Types` | Generate TypeScript types (coming soon) |
|
|
347
|
+
| `Fortify: Format Schema` | Format schema syntax (coming soon) |
|
|
338
348
|
|
|
339
349
|
### Keyboard Shortcuts
|
|
340
350
|
|
|
341
351
|
Default shortcuts (can be customized):
|
|
342
352
|
|
|
343
|
-
| Shortcut
|
|
344
|
-
|
|
345
|
-
| `Ctrl+Shift+V` | Validate Schema
|
|
353
|
+
| Shortcut | Command |
|
|
354
|
+
| -------------- | ------------------ |
|
|
355
|
+
| `Ctrl+Shift+V` | Validate Schema |
|
|
346
356
|
| `Ctrl+Shift+T` | Apply Color Scheme |
|
|
347
|
-
| `F12`
|
|
348
|
-
| `Ctrl+Space`
|
|
357
|
+
| `F12` | Go to Definition |
|
|
358
|
+
| `Ctrl+Space` | Trigger Completion |
|
|
349
359
|
|
|
350
360
|
## 🐛 Troubleshooting
|
|
351
361
|
|
|
@@ -379,7 +389,7 @@ Default shortcuts (can be customized):
|
|
|
379
389
|
// Optimize performance
|
|
380
390
|
{
|
|
381
391
|
"fortify.debounceTime": 500,
|
|
382
|
-
"fortify.maxFileSize": 524288,
|
|
392
|
+
"fortify.maxFileSize": 524288, // 512KB
|
|
383
393
|
"fortify.maxDiagnostics": 50
|
|
384
394
|
}
|
|
385
395
|
```
|
|
@@ -414,6 +424,7 @@ If you uninstall the extension and want to clean up settings:
|
|
|
414
424
|
### Reset Workspace Settings
|
|
415
425
|
|
|
416
426
|
Remove from `.vscode/settings.json`:
|
|
427
|
+
|
|
417
428
|
```json
|
|
418
429
|
{
|
|
419
430
|
// Remove these lines:
|
|
@@ -455,4 +466,4 @@ Remove from `.vscode/settings.json`:
|
|
|
455
466
|
|
|
456
467
|
- **[GitHub Issues](https://github.com/Nehonix-Team/reliant-type/issues)** - Bug reports and feature requests
|
|
457
468
|
- **[GitHub Discussions](https://github.com/Nehonix-Team/reliant-type/discussions)** - Community Q&A
|
|
458
|
-
- **Email**: support@nehonix.
|
|
469
|
+
- **Email**: support@nehonix.com
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reliant-type",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A modern TypeScript validation library designed around familiar interface syntax and powerful conditional validation. Experience schema validation that feels natural to TypeScript developers while unlocking advanced runtime validation capabilities.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"robust",
|
|
179
179
|
"scalable"
|
|
180
180
|
],
|
|
181
|
-
"author": "Nehonix Team <support@nehonix.
|
|
181
|
+
"author": "Nehonix Team <support@nehonix.com> (https://nehonix.com)",
|
|
182
182
|
"license": "MIT License",
|
|
183
183
|
"repository": {
|
|
184
184
|
"type": "git",
|
|
@@ -44,7 +44,7 @@ export class SecurityValidators {
|
|
|
44
44
|
// security schema with more comprehensive protections
|
|
45
45
|
this.ajv.addSchema(
|
|
46
46
|
{
|
|
47
|
-
$id: "https://nehonix.
|
|
47
|
+
$id: "https://nehonix.com/lib/v/reliant-type",
|
|
48
48
|
type: ["object", "array", "string", "number", "boolean", "null"],
|
|
49
49
|
definitions: {
|
|
50
50
|
secureObject: {
|