reliant-type 2.1.3 → 2.1.5

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.
@@ -1,10 +1,11 @@
1
1
  # Getting Started with ReliantType
2
2
 
3
3
  Welcome to ReliantType! This guide will get you up and running in minutes with TypeScript-first validation using interface-native syntax.
4
-
4
+
5
5
  ## 🚀 Installation
6
6
 
7
7
  ### Requirements
8
+
8
9
  - **TypeScript 4.5+** or **JavaScript ES2020+**
9
10
  - **Node.js 14+** (for Node.js projects)
10
11
  - **Modern browser** (for browser projects)
@@ -31,7 +32,7 @@ For the best development experience, install our VS Code extension:
31
32
 
32
33
  ```bash
33
34
  # Download and install
34
- curl -L https://sdk.nehonix.space/pkgs/mods/vscode/latest/reliant-type.vsix -o reliant-type.vsix
35
+ curl -L https://dll.nehonix.com/pkgs/mods/vscode/latest/reliant-type.vsix -o reliant-type.vsix
35
36
  code --install-extension reliant-type.vsix
36
37
  ```
37
38
 
@@ -52,8 +53,8 @@ const UserSchema = Interface({
52
53
  id: "number",
53
54
  email: "email",
54
55
  name: "string",
55
- age: "number?", // Optional field
56
- isActive: "boolean"
56
+ age: "number?", // Optional field
57
+ isActive: "boolean",
57
58
  });
58
59
  ```
59
60
 
@@ -66,7 +67,7 @@ const userData = {
66
67
  email: "john@example.com",
67
68
  name: "John Doe",
68
69
  age: 30,
69
- isActive: true
70
+ isActive: true,
70
71
  };
71
72
 
72
73
  // Validate with safeParse (recommended)
@@ -91,13 +92,13 @@ ReliantType uses familiar TypeScript interface syntax:
91
92
  ```typescript
92
93
  // Looks like a TypeScript interface!
93
94
  const ProductSchema = Interface({
94
- id: "uuid", // UUID validation
95
- name: "string(1,100)", // String with length constraints
95
+ id: "uuid", // UUID validation
96
+ name: "string(1,100)", // String with length constraints
96
97
  price: "number(0.01,9999.99)", // Number with range constraints
97
98
  category: "electronics|books|clothing", // Union types
98
99
  inStock: "boolean",
99
- tags: "string[]?", // Optional array
100
- createdAt: "date" // Date validation
100
+ tags: "string[]?", // Optional array
101
+ createdAt: "date", // Date validation
101
102
  });
102
103
  ```
103
104
 
@@ -149,17 +150,17 @@ const BasicSchema = Interface({
149
150
  age: "number",
150
151
  active: "boolean",
151
152
  birthday: "date",
152
-
153
+
153
154
  // Optional types (add ?)
154
155
  nickname: "string?",
155
156
  bio: "string?",
156
-
157
+
157
158
  // Arrays
158
159
  tags: "string[]",
159
160
  scores: "number[]?",
160
-
161
+
161
162
  // Any type (use sparingly)
162
- metadata: "any"
163
+ metadata: "any",
163
164
  });
164
165
  ```
165
166
 
@@ -168,18 +169,18 @@ const BasicSchema = Interface({
168
169
  ```typescript
169
170
  const ConstrainedSchema = Interface({
170
171
  // String constraints
171
- username: "string(3,20)", // 3-20 characters
172
- password: "string(8,)", // Minimum 8 characters
173
- code: "string(6,6)", // Exactly 6 characters
174
-
172
+ username: "string(3,20)", // 3-20 characters
173
+ password: "string(8,)", // Minimum 8 characters
174
+ code: "string(6,6)", // Exactly 6 characters
175
+
175
176
  // Number constraints
176
- age: "number(0,120)", // Range 0-120
177
- price: "number(0.01,)", // Minimum 0.01
178
- discount: "number(,0.5)", // Maximum 0.5
179
-
177
+ age: "number(0,120)", // Range 0-120
178
+ price: "number(0.01,)", // Minimum 0.01
179
+ discount: "number(,0.5)", // Maximum 0.5
180
+
180
181
  // Array constraints
181
- tags: "string[](1,5)", // 1-5 items
182
- scores: "number[](,10)" // Maximum 10 items
182
+ tags: "string[](1,5)", // 1-5 items
183
+ scores: "number[](,10)", // Maximum 10 items
183
184
  });
184
185
  ```
185
186
 
@@ -191,10 +192,10 @@ const FormatSchema = Interface({
191
192
  website: "url",
192
193
  phone: "phone",
193
194
  userId: "uuid",
194
-
195
+
195
196
  // Custom regex patterns
196
197
  zipCode: "string(/^\\d{5}(-\\d{4})?$/)",
197
- productCode: "string(/^[A-Z]{2}\\d{4}$/)"
198
+ productCode: "string(/^[A-Z]{2}\\d{4}$/)",
198
199
  });
199
200
  ```
200
201
 
@@ -205,10 +206,10 @@ const UnionSchema = Interface({
205
206
  status: "active|inactive|pending",
206
207
  role: "admin|user|guest|moderator",
207
208
  theme: "light|dark|auto",
208
-
209
+
209
210
  // Mixed type unions
210
211
  id: "string|number",
211
- value: "string|number|boolean"
212
+ value: "string|number|boolean",
212
213
  });
213
214
  ```
214
215
 
@@ -222,11 +223,11 @@ ReliantType V2 introduces powerful conditional validation with runtime property
222
223
  const ConditionalSchema = Interface({
223
224
  role: "admin|user|guest",
224
225
  config: "any?",
225
-
226
+
226
227
  // V2 Runtime Methods
227
228
  hasPermissions: "when config.permissions.$exists() *? boolean : =false",
228
229
  isAdmin: "when role=admin *? boolean : =false",
229
- canEdit: "when role.$in(admin,moderator) *? boolean : =false"
230
+ canEdit: "when role.$in(admin,moderator) *? boolean : =false",
230
231
  });
231
232
  ```
232
233
 
@@ -235,26 +236,28 @@ const ConditionalSchema = Interface({
235
236
  ```typescript
236
237
  const V2MethodsSchema = Interface({
237
238
  data: "any?",
238
-
239
+
239
240
  // Property existence
240
241
  hasData: "when data.field.$exists() *? boolean : =false",
241
-
242
+
242
243
  // Empty checking
243
244
  isEmpty: "when data.list.$empty() *? boolean : =true",
244
-
245
+
245
246
  // Null checking
246
247
  isNull: "when data.value.$null() *? boolean : =false",
247
-
248
+
248
249
  // String methods
249
- containsText: "when data.description.$contains(important) *? boolean : =false",
250
+ containsText:
251
+ "when data.description.$contains(important) *? boolean : =false",
250
252
  startsWithPrefix: "when data.code.$startsWith(PRE) *? boolean : =false",
251
253
  endsWithSuffix: "when data.filename.$endsWith(.pdf) *? boolean : =false",
252
-
254
+
253
255
  // Numeric range
254
256
  inRange: "when data.score.$between(0,100) *? boolean : =false",
255
-
257
+
256
258
  // Value inclusion
257
- isValidStatus: "when data.status.$in(active,pending,inactive) *? boolean : =false"
259
+ isValidStatus:
260
+ "when data.status.$in(active,pending,inactive) *? boolean : =false",
258
261
  });
259
262
  ```
260
263
 
@@ -270,15 +273,15 @@ const UserRegistrationSchema = Interface({
270
273
  email: "email",
271
274
  password: "string(8,128)",
272
275
  confirmPassword: "string(8,128)",
273
-
276
+
274
277
  // Profile
275
278
  profile: {
276
279
  firstName: "string(1,50)",
277
280
  lastName: "string(1,50)",
278
281
  dateOfBirth: "date?",
279
- avatar: "url?"
282
+ avatar: "url?",
280
283
  },
281
-
284
+
282
285
  // Preferences
283
286
  preferences: {
284
287
  theme: "light|dark|auto",
@@ -286,23 +289,23 @@ const UserRegistrationSchema = Interface({
286
289
  notifications: {
287
290
  email: "boolean",
288
291
  push: "boolean",
289
- sms: "boolean"
290
- }
292
+ sms: "boolean",
293
+ },
291
294
  },
292
-
295
+
293
296
  // Terms and conditions
294
297
  acceptedTerms: "boolean",
295
298
  acceptedPrivacy: "boolean",
296
-
299
+
297
300
  // Optional marketing consent
298
301
  marketingConsent: "boolean?",
299
-
302
+
300
303
  // Runtime configuration for conditional validation
301
304
  config: "any?",
302
-
305
+
303
306
  // Conditional fields based on configuration
304
307
  betaFeatures: "when config.beta.$exists() *? string[] : =[]",
305
- premiumFeatures: "when config.premium.$exists() *? any : =null"
308
+ premiumFeatures: "when config.premium.$exists() *? any : =null",
306
309
  });
307
310
 
308
311
  // Usage
@@ -313,7 +316,7 @@ const registrationData = {
313
316
  profile: {
314
317
  firstName: "John",
315
318
  lastName: "Doe",
316
- dateOfBirth: new Date("1990-01-01")
319
+ dateOfBirth: new Date("1990-01-01"),
317
320
  },
318
321
  preferences: {
319
322
  theme: "dark",
@@ -321,12 +324,12 @@ const registrationData = {
321
324
  notifications: {
322
325
  email: true,
323
326
  push: false,
324
- sms: false
325
- }
327
+ sms: false,
328
+ },
326
329
  },
327
330
  acceptedTerms: true,
328
331
  acceptedPrivacy: true,
329
- marketingConsent: false
332
+ marketingConsent: false,
330
333
  };
331
334
 
332
335
  const result = UserRegistrationSchema.safeParse(registrationData);
@@ -336,8 +339,8 @@ if (result.success) {
336
339
  // Process registration with result.data
337
340
  } else {
338
341
  console.log("❌ Validation errors:");
339
- result.errors.forEach(error => {
340
- console.log(`- ${error.path.join('.')}: ${error.message}`);
342
+ result.errors.forEach((error) => {
343
+ console.log(`- ${error.path.join(".")}: ${error.message}`);
341
344
  });
342
345
  }
343
346
  ```
@@ -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://sdk.nehonix.space/pkgs/mods/vscode/latest/reliant-type.vsix -o reliant-type.vsix
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", // Type highlighting
68
- email: "email", // Format highlighting
69
- name: "string(2,50)", // Constraint highlighting
70
- role: "admin|user|guest", // Union highlighting
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|" // Triggers: email, empty (if in conditional)
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.$|" // Shows all 8 V2 methods
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|" // Suggests: profile
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(,)", // Underlined in red
157
-
165
+ name: "string(,)", // Underlined in red
166
+
158
167
  // ❌ Error: Unknown type
159
- id: "unknowntype", // Underlined in red
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", // Underlined in yellow
173
-
181
+ email: "string", // Underlined in yellow
182
+
174
183
  // ⚠️ Warning: Large array constraint
175
- items: "string[](1,10000)" // Performance warning
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", // No warning shown
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" // Hover shows: Email validation with RFC 5322 compliance
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 // 1MB
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 | Description |
331
- |---------|-------------|
332
- | `Fortify: Validate Schema` | Manually validate current file |
333
- | `Fortify: Apply Color Scheme` | Choose and apply color theme |
334
- | `Fortify: List Color Schemes` | View available themes |
335
- | `Fortify: Cleanup Themes` | Reset theme settings |
336
- | `Fortify: Generate Types` | Generate TypeScript types (coming soon) |
337
- | `Fortify: Format Schema` | Format schema syntax (coming soon) |
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 | Command |
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` | Go to Definition |
348
- | `Ctrl+Space` | Trigger Completion |
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, // 512KB
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.space
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",
3
+ "version": "2.1.5",
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.space> (https://nehonix.space)",
181
+ "author": "Nehonix Team <support@nehonix.com> (https://nehonix.com)",
182
182
  "license": "MIT License",
183
183
  "repository": {
184
184
  "type": "git",