@versionzero/schema 1.0.0 → 1.0.1

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 CHANGED
@@ -227,7 +227,7 @@ You can think of it like having a toolkit for composing rich runtime-enforced in
227
227
  with reflection; embracing the dynamic nature of JavaScript, rather than pretending it has
228
228
  static types.
229
229
 
230
- _Read more about this [in the full documentation](https://docs.v0.net/schema/rationale)._
230
+ _Read more about this [in the full documentation](https://docs.v0.net/schema/guide/rationale)._
231
231
 
232
232
  ## License
233
233
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versionzero/schema",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A composable schema library that supports asynchronous processing",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -63,7 +63,7 @@
63
63
  "test:browser": "playwright test",
64
64
  "test:all": "npm test && npm run test:browser",
65
65
  "clean": "rm -rf types docs-output* processors-output* .mdrun .c8 .nyc_output",
66
- "release:dry": "npx -p semantic-release@24 -p @semantic-release/exec@7 semantic-release --dry-run --no-ci"
66
+ "release:dry": "npx -p semantic-release@24 -p @semantic-release/exec@7 -p @semantic-release/changelog@6 -p @semantic-release/git@10 semantic-release --dry-run --no-ci"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@playwright/test": "^1.60.0",
@@ -144,16 +144,16 @@ export class CompiledSchema
144
144
  }
145
145
 
146
146
  /**
147
- * Handlers are associated with asynchronous value processors.
147
+ * Handlers are associated with value processors.
148
148
  *
149
- * The "friendly" handler definitions from the source Schema are each compiled into asynchronous functions
150
- * that run as a pipeline.
149
+ * The "friendly" handler definitions from the source Schema are each compiled into an array
150
+ * of functions (sync or async) that run as a pipeline.
151
151
  *
152
- * All handlers have the same async signature, receiving:
152
+ * All value processors have the same signature, receiving:
153
153
  * 1. a value to be processed by the current schema
154
- * 2. a reference to the top-level aggregate target being built or processed by the entire schema hierarchy
155
- * 3. a location defining the current schema and the traversal path to where it was encountered
156
- * 5. any (unmanaged / developer defined) options passed to whatever invoked the handler processing
154
+ * 2. the top-level aggregate target value being built or processed by the entire schema hierarchy
155
+ * 3. a location cursor referencing the associated schema and the traversal path to where it was encountered
156
+ * 4. any (unmanaged / developer defined) options passed to whatever invoked the handler processing
157
157
  *
158
158
  * The compiled handlers may vary in their return types and exception handling behavior.
159
159
  *
@@ -617,7 +617,7 @@ export class CompiledSchema
617
617
 
618
618
  /**
619
619
  * Use the registered discriminator to return a matching union schema, or undefined if the union cannot be resolved.
620
- * Discriminator functions must return either one of the unionSchema members, a unionSchema key, or undefined.
620
+ * Discriminator functions must return either a unionSchema key or (compiled) member reference, or undefined.
621
621
  *
622
622
  * (This is an executor function that may return synchronous or asynchronous results.)
623
623
  *
@@ -668,7 +668,7 @@ export class CompiledSchema
668
668
  }
669
669
  /**
670
670
  * Use the registered discriminator to return a matching union schema, or undefined if the union cannot be resolved.
671
- * Discriminator functions must return either one of the unionSchema members, a unionSchema key, or undefined.
671
+ * Discriminator functions must return either a unionSchema key or (compiled) member reference, or undefined.
672
672
  *
673
673
  * (This an async wrapper around the internal `_discriminateUnion` executor function.)
674
674
  *
@@ -899,7 +899,7 @@ export class CompiledSchema
899
899
  * Finalize a transformed input value by running any necessary post-processing steps.
900
900
  *
901
901
  * Runs all finalizer value processors in a pipeline until one returns undefined or throws an error.
902
- * - The input to the pipeline is be assumed to be transformed.
902
+ * - The input to the pipeline is assumed to be transformed.
903
903
  * - Finalizers are generally only required for incremental schemas that need to check child values.
904
904
  * - A finalizer on the root schema (or that checks for the root path, if the root schema is shared)
905
905
  * can act as an "entire output" finalizer.
@@ -950,7 +950,7 @@ export class CompiledSchema
950
950
  * Finalize a transformed input value by running any necessary post-processing steps.
951
951
  *
952
952
  * Runs all finalizer value processors in a pipeline until one returns undefined or throws an error.
953
- * - The input to the pipeline is be assumed to be transformed.
953
+ * - The input to the pipeline is assumed to be transformed.
954
954
  * - Finalizers are generally only required for incremental schemas that need to check child values.
955
955
  * - A finalizer on the root schema (or that checks for the root path, if the root schema is shared)
956
956
  * can act as an "entire output" finalizer.
package/src/schema.js CHANGED
@@ -459,7 +459,7 @@ export class Schema
459
459
  }
460
460
 
461
461
  /**
462
- * The discriminator handler returns the key or schema of the union member that should be used
462
+ * The discriminator handler returns the key or schema of the union member that should be used.
463
463
  * This function appends a single value processor to the handler pipeline.
464
464
  *
465
465
  * @param {ValueProcessorSpec} spec
@@ -470,7 +470,7 @@ export class Schema
470
470
  }
471
471
 
472
472
  /**
473
- * The discriminator handler returns the key or schema of the union member that should be used
473
+ * The discriminator handler returns the key or schema of the union member that should be used.
474
474
  * This function applies multiple value processors to the handler pipeline.
475
475
  * (Note that it would be highly unusual to want more than one!)
476
476
  *
@@ -71,16 +71,16 @@ export class CompiledSchema {
71
71
  */
72
72
  get propertyEntries(): IteratorObject<[string, CompiledSchema]>;
73
73
  /**
74
- * Handlers are associated with asynchronous value processors.
74
+ * Handlers are associated with value processors.
75
75
  *
76
- * The "friendly" handler definitions from the source Schema are each compiled into asynchronous functions
77
- * that run as a pipeline.
76
+ * The "friendly" handler definitions from the source Schema are each compiled into an array
77
+ * of functions (sync or async) that run as a pipeline.
78
78
  *
79
- * All handlers have the same async signature, receiving:
79
+ * All value processors have the same signature, receiving:
80
80
  * 1. a value to be processed by the current schema
81
- * 2. a reference to the top-level aggregate target being built or processed by the entire schema hierarchy
82
- * 3. a location defining the current schema and the traversal path to where it was encountered
83
- * 5. any (unmanaged / developer defined) options passed to whatever invoked the handler processing
81
+ * 2. the top-level aggregate target value being built or processed by the entire schema hierarchy
82
+ * 3. a location cursor referencing the associated schema and the traversal path to where it was encountered
83
+ * 4. any (unmanaged / developer defined) options passed to whatever invoked the handler processing
84
84
  *
85
85
  * The compiled handlers may vary in their return types and exception handling behavior.
86
86
  *
@@ -386,7 +386,7 @@ export class CompiledSchema {
386
386
  _checkValue(value: any, ErrorClass: any): any;
387
387
  /**
388
388
  * Use the registered discriminator to return a matching union schema, or undefined if the union cannot be resolved.
389
- * Discriminator functions must return either one of the unionSchema members, a unionSchema key, or undefined.
389
+ * Discriminator functions must return either a unionSchema key or (compiled) member reference, or undefined.
390
390
  *
391
391
  * (This is an executor function that may return synchronous or asynchronous results.)
392
392
  *
@@ -400,7 +400,7 @@ export class CompiledSchema {
400
400
  _discriminateUnion(value: any, target?: any, location?: SchemaLocation, options?: object): CompiledSchema | undefined | Promise<CompiledSchema | undefined>;
401
401
  /**
402
402
  * Use the registered discriminator to return a matching union schema, or undefined if the union cannot be resolved.
403
- * Discriminator functions must return either one of the unionSchema members, a unionSchema key, or undefined.
403
+ * Discriminator functions must return either a unionSchema key or (compiled) member reference, or undefined.
404
404
  *
405
405
  * (This an async wrapper around the internal `_discriminateUnion` executor function.)
406
406
  *
@@ -526,7 +526,7 @@ export class CompiledSchema {
526
526
  * Finalize a transformed input value by running any necessary post-processing steps.
527
527
  *
528
528
  * Runs all finalizer value processors in a pipeline until one returns undefined or throws an error.
529
- * - The input to the pipeline is be assumed to be transformed.
529
+ * - The input to the pipeline is assumed to be transformed.
530
530
  * - Finalizers are generally only required for incremental schemas that need to check child values.
531
531
  * - A finalizer on the root schema (or that checks for the root path, if the root schema is shared)
532
532
  * can act as an "entire output" finalizer.
@@ -545,7 +545,7 @@ export class CompiledSchema {
545
545
  * Finalize a transformed input value by running any necessary post-processing steps.
546
546
  *
547
547
  * Runs all finalizer value processors in a pipeline until one returns undefined or throws an error.
548
- * - The input to the pipeline is be assumed to be transformed.
548
+ * - The input to the pipeline is assumed to be transformed.
549
549
  * - Finalizers are generally only required for incremental schemas that need to check child values.
550
550
  * - A finalizer on the root schema (or that checks for the root path, if the root schema is shared)
551
551
  * can act as an "entire output" finalizer.
package/types/schema.d.ts CHANGED
@@ -234,7 +234,7 @@ export class Schema {
234
234
  */
235
235
  addMetadata(metadata: object, policy?: symbol): Schema;
236
236
  /**
237
- * The discriminator handler returns the key or schema of the union member that should be used
237
+ * The discriminator handler returns the key or schema of the union member that should be used.
238
238
  * This function appends a single value processor to the handler pipeline.
239
239
  *
240
240
  * @param {ValueProcessorSpec} spec
@@ -242,7 +242,7 @@ export class Schema {
242
242
  */
243
243
  unionDiscriminator(spec: ValueProcessorSpec): Schema;
244
244
  /**
245
- * The discriminator handler returns the key or schema of the union member that should be used
245
+ * The discriminator handler returns the key or schema of the union member that should be used.
246
246
  * This function applies multiple value processors to the handler pipeline.
247
247
  * (Note that it would be highly unusual to want more than one!)
248
248
  *