@reso-standards/reso-validation 0.1.0 → 0.1.2

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 (2) hide show
  1. package/README.md +14 -12
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,12 +1,16 @@
1
- # @reso-standards/validation
1
+ # @reso-standards/reso-validation
2
2
 
3
- Isomorphic TypeScript validation library for RESO Data Dictionary records. Validates field types, lengths, and ranges against metadata, plus resource-specific business rules with cross-field constraints. Zero external dependencies.
3
+ Isomorphic TypeScript validation library for RESO Data Dictionary records. Validates field types, lengths and ranges against metadata, plus resource-specific business rules with cross-field constraints. Zero external dependencies.
4
4
 
5
- > **[User Guide](doc/GUIDE.md)** – a task-oriented walkthrough with realistic examples.
5
+ > **[User Guide](https://tools.reso.org/guides/reso-validation/)** – a task-oriented walk-through with realistic examples.
6
6
 
7
7
  ## Install
8
8
 
9
- This package isn't on npm yet. Install from the [`reso-tools`](https://github.com/RESOStandards/reso-tools) monorepo on GitHub:
9
+ ```bash
10
+ npm install @reso-standards/reso-validation
11
+ ```
12
+
13
+ Or work from the [`reso-tools`](https://github.com/RESOStandards/reso-tools) monorepo:
10
14
 
11
15
  ```bash
12
16
  git clone https://github.com/RESOStandards/reso-tools.git
@@ -14,15 +18,13 @@ cd reso-tools/reso-validation
14
18
  npm install
15
19
  ```
16
20
 
17
- This package has no sibling dependencies — `npm install` just runs. To bootstrap every package at once, run `npm run bootstrap` from the repo root instead.
18
-
19
- To consume the SDK from another project, link it locally with `npm link` or use a `file:` dependency.
21
+ This package has no sibling dependencies – `npm install` just runs. To bootstrap every package at once, run `npm run bootstrap` from the repo root instead.
20
22
 
21
23
  ## Usage
22
24
 
23
25
  ```typescript
24
- import { validateRecord, validateBusinessRules, getBusinessRules } from '@reso-standards/validation';
25
- import type { ResoField, ValidationFailure } from '@reso-standards/validation';
26
+ import { validateRecord, validateBusinessRules, getBusinessRules } from '@reso-standards/reso-validation';
27
+ import type { ResoField, ValidationFailure } from '@reso-standards/reso-validation';
26
28
 
27
29
  // Validate a record against field metadata
28
30
  const failures = validateRecord(record, fields);
@@ -49,7 +51,7 @@ Validates a record payload against RESO field metadata. Checks:
49
51
  - **Enum fields** – must be string or number
50
52
  - **Business rules** – delegates to `validateBusinessRules()` for range/relationship checks
51
53
 
52
- Null, undefined, and empty string values are silently skipped unless the field is required. Fields starting with `@` (OData annotations) are ignored.
54
+ Null, undefined and empty string values are silently skipped unless the field is required. Fields starting with `@` (OData annotations) are ignored.
53
55
 
54
56
  ### `validateBusinessRules(resourceName, body): ValidationFailure[]`
55
57
 
@@ -60,7 +62,7 @@ Validates resource-specific constraints:
60
62
  - Price fields (> 0 to $1B): ListPrice, OriginalListPrice, PreviousListPrice, ClosePrice, ListPriceLow
61
63
  - Room counts (0 to 100): BedroomsTotal, BathroomsFull, BathroomsHalf, etc.
62
64
  - Expense/fee/amount fields ($0 to $10K): matched via `fieldPattern` regex `/(?:Expense|Amount|Fee\d?)$/`
63
- - Latitude and Longitude are exempt from the non-negative rule (negative coordinates are valid)
65
+ - Latitude and Longitude are exempt from the nonnegative rule (negative coordinates are valid)
64
66
  - Cross-field: `BathroomsTotalInteger = sum(BathroomsFull + BathroomsHalf + ...)`
65
67
 
66
68
  **Member:** Required MemberCity, MemberStateOrProvince, MemberPostalCode, MemberCountry
@@ -102,7 +104,7 @@ interface CrossFieldRule {
102
104
 
103
105
  ## Integration
104
106
 
105
- Used by both the reference server (request body validation on POST/PATCH) and the React UI (client-side form validation). Also used by `@reso-standards/certification` for payload validation in compliance testing.
107
+ Used by both the reference server (request body validation on POST/PATCH) and the React UI (client-side form validation). Also used by `@reso-standards/reso-certification` for payload validation in compliance testing.
106
108
 
107
109
  ## License
108
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reso-standards/reso-validation",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/RESOStandards/reso-tools.git",
@@ -40,8 +40,8 @@
40
40
  "node": ">=22"
41
41
  },
42
42
  "devDependencies": {
43
- "@vitest/coverage-v8": "^4.1.9",
43
+ "@vitest/coverage-v8": "^4.1.12",
44
44
  "typescript": "^5.7.0",
45
- "vitest": "^4.1.9"
45
+ "vitest": "^4.1.12"
46
46
  }
47
47
  }