mailschema 0.1.2 → 0.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 CHANGED
@@ -18,11 +18,17 @@ Node.js 22 or newer is required. The package is ESM and includes TypeScript decl
18
18
  ## Validate MAP documents
19
19
 
20
20
  ```js
21
- import { assertMapDocument, assertContentReviewRequest, getMapSchema } from 'mailschema';
21
+ import {
22
+ assertMapDocument,
23
+ assertContentReviewRequest,
24
+ getContentReviewContract,
25
+ getMapSchema,
26
+ } from 'mailschema';
22
27
 
23
28
  assertMapDocument(description);
24
29
  assertContentReviewRequest(request);
25
30
  const mapSchema = getMapSchema();
31
+ const contentReviewContract = getContentReviewContract();
26
32
  ```
27
33
 
28
34
  The CLI performs the same checks against local JSON files:
@@ -56,8 +62,13 @@ Raw Draft 2020-12 schemas are exported as:
56
62
 
57
63
  - `mailschema/map-0.1.schema.json`
58
64
  - `mailschema/content-review-0.1.schema.json`
65
+ - `mailschema/content-review-0.1.contract.json`
66
+ - `mailschema/content-review-0.2.schema.json`
67
+ - `mailschema/content-review-0.2.contract.json`
59
68
  - `mailschema/contribution.schema.json`
60
69
 
70
+ The unversioned Content Review helpers use 0.2. The `*ContentReview01*` helpers and 0.1 raw exports remain available for implementations pinned to the earlier draft.
71
+
61
72
  ## Trust boundary
62
73
 
63
74
  A valid document is structured input. Validation does not authenticate a service, grant authority, approve an action or establish product conformance. Implementations must apply their own endpoint trust, credentials, permissions and policy before executing a request.
@@ -0,0 +1,58 @@
1
+ {
2
+ "kind": "MapTypeContract",
3
+ "id": "https://mailschema.org/types/content-review",
4
+ "version": "0.1",
5
+ "profile": "https://mailschema.org/profiles/map/0.1",
6
+ "target": "Service-owned content at the exact revision and digest named in the request.",
7
+ "requestSchema": {
8
+ "url": "https://mailschema.org/schemas/content-review-0.1.schema.json",
9
+ "canonicalDigest": "sha-256:cdad1149ab193d1bf71cb9463e3c4b7331ed56b0123e225adf68f70a2022b29d"
10
+ },
11
+ "operations": [
12
+ {
13
+ "id": "request-changes",
14
+ "effect": "Record review feedback on the named revision.",
15
+ "results": [
16
+ {
17
+ "state": "accepted",
18
+ "outputSchema": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "feedbackRecorded": { "const": true }
23
+ },
24
+ "required": ["feedbackRecorded"]
25
+ }
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "id": "approve",
31
+ "effect": "Record approval of the named revision.",
32
+ "results": [
33
+ {
34
+ "state": "approval-required",
35
+ "outputSchema": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "properties": {
39
+ "approvalUrl": { "type": "string", "format": "uri", "pattern": "^https://" }
40
+ },
41
+ "required": ["approvalUrl"]
42
+ }
43
+ },
44
+ {
45
+ "state": "completed",
46
+ "outputSchema": {
47
+ "type": "object",
48
+ "additionalProperties": false,
49
+ "properties": {
50
+ "decision": { "const": "approved" }
51
+ },
52
+ "required": ["decision"]
53
+ }
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ }
@@ -1,52 +1,54 @@
1
1
  {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://mailschema.org/schemas/content-review-0.1.schema.json",
4
- "title": "Content Review 0.1 MAP request",
5
- "allOf": [
6
- { "$ref": "https://mailschema.org/schemas/map-0.1.schema.json#/$defs/request" },
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mailschema.org/schemas/content-review-0.1.schema.json",
4
+ "title": "Content Review 0.1 MAP request binding",
5
+ "allOf": [
6
+ { "$ref": "https://mailschema.org/schemas/map-0.1.schema.json#/$defs/request" },
7
+ {
8
+ "type": "object",
9
+ "properties": {
10
+ "type": {
11
+ "type": "object",
12
+ "properties": {
13
+ "id": { "const": "https://mailschema.org/types/content-review" },
14
+ "version": { "const": "0.1" }
15
+ }
16
+ }
17
+ }
18
+ },
19
+ {
20
+ "oneOf": [
7
21
  {
8
- "type": "object",
9
- "properties": {
10
- "type": {
11
- "type": "object",
12
- "properties": {
13
- "id": { "const": "https://mailschema.org/types/content-review" },
14
- "version": { "const": "0.1" },
15
- "recordDigest": {
16
- "const": "sha-256:0e6365df1bf904f2475f972ec66a5561edc0bfaae69fd7a1b41f53b40bf8ac1c"
17
- }
18
- }
22
+ "type": "object",
23
+ "properties": {
24
+ "operation": { "const": "request-changes" },
25
+ "input": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "properties": {
29
+ "feedback": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 12000,
33
+ "pattern": "\\S"
19
34
  }
35
+ },
36
+ "required": ["feedback"]
20
37
  }
38
+ }
21
39
  },
22
40
  {
23
- "oneOf": [
24
- {
25
- "type": "object",
26
- "properties": {
27
- "operation": { "const": "request-changes" },
28
- "input": {
29
- "type": "object",
30
- "additionalProperties": false,
31
- "properties": {
32
- "feedback": { "type": "string", "minLength": 1, "maxLength": 12000 }
33
- },
34
- "required": ["feedback"]
35
- }
36
- }
37
- },
38
- {
39
- "type": "object",
40
- "properties": {
41
- "operation": { "const": "approve" },
42
- "input": {
43
- "type": "object",
44
- "additionalProperties": false,
45
- "maxProperties": 0
46
- }
47
- }
48
- }
49
- ]
41
+ "type": "object",
42
+ "properties": {
43
+ "operation": { "const": "approve" },
44
+ "input": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "maxProperties": 0
48
+ }
49
+ }
50
50
  }
51
- ]
51
+ ]
52
+ }
53
+ ]
52
54
  }
@@ -0,0 +1,91 @@
1
+ {
2
+ "kind": "MapTypeContract",
3
+ "id": "https://mailschema.org/types/content-review",
4
+ "version": "0.2",
5
+ "profile": "https://mailschema.org/profiles/map/0.1",
6
+ "target": "Service-owned content at the exact revision and digest named in the request.",
7
+ "requestSchema": {
8
+ "url": "https://mailschema.org/schemas/content-review-0.2.schema.json",
9
+ "canonicalDigest": "sha-256:43a01e620e0730e47755694bdf5d086f8d0a1d3d8328fb0c7d2a4b70c6e62e25"
10
+ },
11
+ "operations": [
12
+ {
13
+ "id": "request-changes",
14
+ "effect": "Record review feedback on the named revision.",
15
+ "results": [
16
+ {
17
+ "state": "accepted",
18
+ "outputSchema": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "feedbackRecorded": {
23
+ "const": true
24
+ }
25
+ },
26
+ "required": [
27
+ "feedbackRecorded"
28
+ ]
29
+ }
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "id": "approve",
35
+ "effect": "Record approval of the named revision, or record why a proposed approval ended without approval.",
36
+ "results": [
37
+ {
38
+ "state": "approval-required",
39
+ "outputSchema": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "properties": {
43
+ "approvalUrl": {
44
+ "type": "string",
45
+ "format": "uri",
46
+ "pattern": "^https://"
47
+ }
48
+ },
49
+ "required": [
50
+ "approvalUrl"
51
+ ]
52
+ }
53
+ },
54
+ {
55
+ "state": "completed",
56
+ "outputSchema": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "properties": {
60
+ "decision": {
61
+ "const": "approved"
62
+ }
63
+ },
64
+ "required": [
65
+ "decision"
66
+ ]
67
+ }
68
+ },
69
+ {
70
+ "state": "failed",
71
+ "outputSchema": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "properties": {
75
+ "reason": {
76
+ "enum": [
77
+ "declined",
78
+ "stale-target",
79
+ "expired"
80
+ ]
81
+ }
82
+ },
83
+ "required": [
84
+ "reason"
85
+ ]
86
+ }
87
+ }
88
+ ]
89
+ }
90
+ ]
91
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mailschema.org/schemas/content-review-0.2.schema.json",
4
+ "title": "Content Review 0.2 MAP request binding",
5
+ "allOf": [
6
+ { "$ref": "https://mailschema.org/schemas/map-0.1.schema.json#/$defs/request" },
7
+ {
8
+ "type": "object",
9
+ "properties": {
10
+ "type": {
11
+ "type": "object",
12
+ "properties": {
13
+ "id": { "const": "https://mailschema.org/types/content-review" },
14
+ "version": { "const": "0.2" }
15
+ }
16
+ }
17
+ }
18
+ },
19
+ {
20
+ "oneOf": [
21
+ {
22
+ "type": "object",
23
+ "properties": {
24
+ "operation": { "const": "request-changes" },
25
+ "input": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "properties": {
29
+ "feedback": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 12000,
33
+ "pattern": "\\S"
34
+ }
35
+ },
36
+ "required": ["feedback"]
37
+ }
38
+ }
39
+ },
40
+ {
41
+ "type": "object",
42
+ "properties": {
43
+ "operation": { "const": "approve" },
44
+ "input": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "maxProperties": 0
48
+ }
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ }