@effected/schemastore 0.2.0 → 0.3.0
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/AnnotationCarriers.js +1 -1
- package/CanonicalJson.js +2 -2
- package/README.md +14 -3
- package/SchemaFile.js +3 -3
- package/SchemaPipeline.js +1 -1
- package/SchemaValidator.js +1 -1
- package/SchemaVersioning.js +1 -1
- package/StoreDocument.js +1 -1
- package/package.json +3 -3
package/AnnotationCarriers.js
CHANGED
|
@@ -11,7 +11,7 @@ import { Effect, Result, Schema } from "effect";
|
|
|
11
11
|
*
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
var CarrierDepthExceededError = class extends Schema.
|
|
14
|
+
var CarrierDepthExceededError = class extends Schema.TaggedError()("CarrierDepthExceededError", {
|
|
15
15
|
/** JSON pointer (in the lowered document's coordinates) where the cap was hit. */
|
|
16
16
|
path: Schema.String,
|
|
17
17
|
/** The nesting cap that was exceeded. */
|
package/CanonicalJson.js
CHANGED
|
@@ -13,7 +13,7 @@ import { Effect, Result, Schema } from "effect";
|
|
|
13
13
|
*
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
var NonJsonValueError = class extends Schema.
|
|
16
|
+
var NonJsonValueError = class extends Schema.TaggedError()("NonJsonValueError", {
|
|
17
17
|
/** JSON pointer to the offending value (`""` is the document root). */
|
|
18
18
|
path: Schema.String,
|
|
19
19
|
/** The `typeof`/structural description of the rejected value. */
|
|
@@ -32,7 +32,7 @@ var NonJsonValueError = class extends Schema.TaggedErrorClass()("NonJsonValueErr
|
|
|
32
32
|
*
|
|
33
33
|
* @public
|
|
34
34
|
*/
|
|
35
|
-
var JsonDepthExceededError = class extends Schema.
|
|
35
|
+
var JsonDepthExceededError = class extends Schema.TaggedError()("JsonDepthExceededError", {
|
|
36
36
|
/** JSON pointer to the node where the cap was hit. */
|
|
37
37
|
path: Schema.String,
|
|
38
38
|
/** The nesting cap that was exceeded. */
|
package/README.md
CHANGED
|
@@ -240,15 +240,26 @@ const targets = [
|
|
|
240
240
|
}),
|
|
241
241
|
];
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
// One named layer, composed once, provided at the boundary.
|
|
244
|
+
const AppLayer = Layer.mergeAll(SchemaFile.layer, SchemaValidator.layer).pipe(
|
|
245
|
+
Layer.provide(NodeServices.layer),
|
|
246
246
|
);
|
|
247
247
|
|
|
248
|
+
const program = SchemaPipeline.run(targets).pipe(Effect.provide(AppLayer));
|
|
249
|
+
|
|
248
250
|
Effect.runPromise(program).then(console.log);
|
|
249
251
|
// => [{ $id, path, outcome: "written", change: "created", findings: [] }]
|
|
250
252
|
```
|
|
251
253
|
|
|
254
|
+
`NodeServices` is composed **into** the layer with `Layer.provide` rather than
|
|
255
|
+
stacked onto the program with a second `Effect.provide`. Both run correctly
|
|
256
|
+
here — `SchemaFile` holds no state, so nothing observes the difference — but
|
|
257
|
+
the composed form is the shape to copy. Stacking `Effect.provide` calls at the
|
|
258
|
+
call site is how a layer ends up built more than once, and the first stateful
|
|
259
|
+
service you add is where that starts to matter. Binding the composition to a
|
|
260
|
+
named `const` also makes it reusable: a drift test and the generator that
|
|
261
|
+
provide the same value cannot disagree about what the layer contains.
|
|
262
|
+
|
|
252
263
|
A target names its schema, its `$id` and where the file goes. `name` is optional and only catalog naming reads it, so a file-only target like the one above does not repeat its path's basename; supply it when you also pass a `version`, since versioned naming is `<name>-<version>.json`.
|
|
253
264
|
|
|
254
265
|
Both gates' findings normalize into one `PipelineFinding` shape, so a single predicate judges them. Gating is **policy, not mechanism**: `blocking` defaults to `severity === "warning"`, which is what `UnresolvedRef`, `UnknownKeyword` and `DepthExceeded` are. Replace the predicate rather than the loop when you disagree.
|
package/SchemaFile.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Context, Effect, FileSystem, Layer, Path, Schema } from "effect";
|
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
var SchemaFileReadError = class extends Schema.
|
|
11
|
+
var SchemaFileReadError = class extends Schema.TaggedError()("SchemaFileReadError", {
|
|
12
12
|
/** The path that could not be read. */
|
|
13
13
|
path: Schema.String,
|
|
14
14
|
/** The underlying filesystem failure, preserved structurally. */
|
|
@@ -24,7 +24,7 @@ var SchemaFileReadError = class extends Schema.TaggedErrorClass()("SchemaFileRea
|
|
|
24
24
|
*
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
var SchemaFileNotFoundError = class extends Schema.
|
|
27
|
+
var SchemaFileNotFoundError = class extends Schema.TaggedError()("SchemaFileNotFoundError", {
|
|
28
28
|
/** The path where the schema file was expected. */
|
|
29
29
|
path: Schema.String }) {
|
|
30
30
|
get message() {
|
|
@@ -38,7 +38,7 @@ path: Schema.String }) {
|
|
|
38
38
|
*
|
|
39
39
|
* @public
|
|
40
40
|
*/
|
|
41
|
-
var SchemaFileWriteError = class extends Schema.
|
|
41
|
+
var SchemaFileWriteError = class extends Schema.TaggedError()("SchemaFileWriteError", {
|
|
42
42
|
/** The path that could not be written. */
|
|
43
43
|
path: Schema.String,
|
|
44
44
|
/** The underlying filesystem failure, preserved structurally. */
|
package/SchemaPipeline.js
CHANGED
|
@@ -45,7 +45,7 @@ var PipelineFinding = class extends Schema.Class("PipelineFinding")({
|
|
|
45
45
|
*
|
|
46
46
|
* @public
|
|
47
47
|
*/
|
|
48
|
-
var SchemaGateError = class extends Schema.
|
|
48
|
+
var SchemaGateError = class extends Schema.TaggedError()("SchemaGateError", {
|
|
49
49
|
/** The `$id` of the target that failed the gate. */
|
|
50
50
|
$id: Schema.String,
|
|
51
51
|
/** Every finding that blocked, in discovery order. */
|
package/SchemaValidator.js
CHANGED
|
@@ -14,7 +14,7 @@ import { Ajv } from "ajv";
|
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
var SchemaValidatorError = class extends Schema.
|
|
17
|
+
var SchemaValidatorError = class extends Schema.TaggedError()("SchemaValidatorError", {
|
|
18
18
|
/** The underlying engine failure, preserved structurally. */
|
|
19
19
|
cause: Schema.Defect() }) {
|
|
20
20
|
get message() {
|
package/SchemaVersioning.js
CHANGED
|
@@ -14,7 +14,7 @@ const isVersionLabel = (input) => {
|
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
var InvalidSchemaVersionError = class extends Schema.
|
|
17
|
+
var InvalidSchemaVersionError = class extends Schema.TaggedError()("InvalidSchemaVersionError", {
|
|
18
18
|
/** The raw input string that failed to parse. */
|
|
19
19
|
input: Schema.String }) {
|
|
20
20
|
get message() {
|
package/StoreDocument.js
CHANGED
|
@@ -24,7 +24,7 @@ const DRAFT_07_META_SCHEMA = "http://json-schema.org/draft-07/schema#";
|
|
|
24
24
|
*
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
var SchemaConversionError = class extends Schema.
|
|
27
|
+
var SchemaConversionError = class extends Schema.TaggedError()("SchemaConversionError", {
|
|
28
28
|
/** The `$id` of the document that failed to build. */
|
|
29
29
|
$id: Schema.String,
|
|
30
30
|
/** The underlying conversion failure. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/schemastore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Build, validate, version and publish SchemaStore-shaped Draft-07 JSON Schema documents from Effect Schema sources: document assembly, ajv strict-mode validation, structural lints, catalog entries, canonical JSON and a content-comparing emit pipeline.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"./package.json": "./package.json"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@effected/semver": "^0.
|
|
41
|
+
"@effected/semver": "^0.4.0",
|
|
42
42
|
"ajv": "^8.20.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"effect": "4.0.0-beta.
|
|
45
|
+
"effect": "4.0.0-beta.107"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24.11.0"
|