mailschema 0.2.2 → 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.
Files changed (52) hide show
  1. package/README.md +25 -119
  2. package/bin/mailschema.js +40 -53
  3. package/dist/context.jsonld +50 -0
  4. package/dist/contract.schema.json +206 -0
  5. package/dist/core/artifacts.d.ts +11 -36
  6. package/dist/core/artifacts.js +21 -69
  7. package/dist/core/bundled.d.ts +4 -4
  8. package/dist/core/bundled.js +7 -7
  9. package/dist/core/contract.d.ts +59 -56
  10. package/dist/core/contract.js +224 -298
  11. package/dist/core/description.d.ts +45 -0
  12. package/dist/core/description.js +47 -0
  13. package/dist/core/implementation.d.ts +32 -0
  14. package/dist/core/implementation.js +25 -0
  15. package/dist/core/index.d.ts +7 -6
  16. package/dist/core/index.js +9 -9
  17. package/dist/core/json.d.ts +23 -0
  18. package/dist/core/{document.js → json.js} +61 -51
  19. package/dist/core/patterns.d.ts +12 -0
  20. package/dist/core/patterns.js +165 -0
  21. package/dist/core/sha256.d.ts +2 -0
  22. package/dist/core/sha256.js +59 -0
  23. package/dist/core.schema.json +210 -0
  24. package/dist/implementation.schema.json +173 -0
  25. package/dist/index.d.ts +4 -9
  26. package/dist/index.js +2 -14
  27. package/dist/profile.json +27 -0
  28. package/package.json +9 -10
  29. package/dist/contribution.schema.json +0 -874
  30. package/dist/core/binding.d.ts +0 -24
  31. package/dist/core/binding.js +0 -50
  32. package/dist/core/document.d.ts +0 -24
  33. package/dist/core/documents.d.ts +0 -68
  34. package/dist/core/documents.js +0 -145
  35. package/dist/core/limits.d.ts +0 -19
  36. package/dist/core/limits.js +0 -55
  37. package/dist/core/pointer.d.ts +0 -12
  38. package/dist/core/pointer.js +0 -48
  39. package/dist/core/schemas.d.ts +0 -21
  40. package/dist/core/schemas.js +0 -125
  41. package/dist/core/types.d.ts +0 -127
  42. package/dist/core/types.js +0 -2
  43. package/dist/forms-0.1.schema.json +0 -329
  44. package/dist/map-0.2.jsonld +0 -91
  45. package/dist/map-0.2.schema.json +0 -1033
  46. package/dist/map.d.ts +0 -8
  47. package/dist/map.js +0 -18
  48. package/dist/model.d.ts +0 -95
  49. package/dist/model.js +0 -5
  50. package/dist/type-contract-0.2.schema.json +0 -179
  51. package/dist/validation.d.ts +0 -15
  52. package/dist/validation.js +0 -64
@@ -0,0 +1,210 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mailschema.org/artifacts/map-0.3/schemas/core.schema.json",
4
+ "title": "MAP 0.3 description shape; semantic checks in Core are additionally required",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "@context",
9
+ "@type",
10
+ "@id",
11
+ "profile",
12
+ "type",
13
+ "issuedAt",
14
+ "expiresAt",
15
+ "inLanguage",
16
+ "service",
17
+ "recipient",
18
+ "subject",
19
+ "terms",
20
+ "details",
21
+ "operations",
22
+ "human"
23
+ ],
24
+ "properties": {
25
+ "@context": {
26
+ "const": "https://mailschema.org/contexts/map-0.3.jsonld"
27
+ },
28
+ "@type": {
29
+ "const": "MailAction"
30
+ },
31
+ "@id": {
32
+ "type": "string",
33
+ "minLength": 1,
34
+ "format": "uri",
35
+ "maxLength": 2048
36
+ },
37
+ "profile": {
38
+ "const": "https://mailschema.org/profiles/map/0.3"
39
+ },
40
+ "type": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": [
44
+ "id",
45
+ "version",
46
+ "contractDigest"
47
+ ],
48
+ "properties": {
49
+ "id": {
50
+ "type": "string",
51
+ "minLength": 1,
52
+ "format": "uri",
53
+ "pattern": "^https://",
54
+ "maxLength": 2048
55
+ },
56
+ "version": {
57
+ "type": "string",
58
+ "minLength": 1,
59
+ "maxLength": 64
60
+ },
61
+ "contractDigest": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "pattern": "^sha-256:[0-9a-f]{64}$"
65
+ }
66
+ }
67
+ },
68
+ "issuedAt": {
69
+ "type": "string",
70
+ "minLength": 1,
71
+ "format": "date-time",
72
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\dZ$"
73
+ },
74
+ "expiresAt": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "format": "date-time",
78
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\dZ$"
79
+ },
80
+ "inLanguage": {
81
+ "type": "string",
82
+ "minLength": 1,
83
+ "maxLength": 255
84
+ },
85
+ "service": {
86
+ "type": "object",
87
+ "additionalProperties": false,
88
+ "required": [
89
+ "id"
90
+ ],
91
+ "properties": {
92
+ "id": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "format": "uri",
96
+ "pattern": "^https://(?![0-9.]+(:[0-9]+)?$)[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(:[0-9]{1,5})?$",
97
+ "maxLength": 2048
98
+ },
99
+ "tenant": {
100
+ "type": "string",
101
+ "minLength": 1,
102
+ "format": "uri",
103
+ "maxLength": 2048
104
+ }
105
+ }
106
+ },
107
+ "recipient": {
108
+ "type": "string",
109
+ "minLength": 1,
110
+ "maxLength": 320
111
+ },
112
+ "subject": {
113
+ "type": "object",
114
+ "additionalProperties": false,
115
+ "required": [
116
+ "id",
117
+ "title"
118
+ ],
119
+ "properties": {
120
+ "id": {
121
+ "type": "string",
122
+ "minLength": 1,
123
+ "format": "uri",
124
+ "maxLength": 2048
125
+ },
126
+ "title": {
127
+ "type": "string",
128
+ "minLength": 1,
129
+ "maxLength": 2048
130
+ }
131
+ }
132
+ },
133
+ "terms": {
134
+ "type": "object",
135
+ "additionalProperties": false,
136
+ "required": [
137
+ "id",
138
+ "version"
139
+ ],
140
+ "properties": {
141
+ "id": {
142
+ "type": "string",
143
+ "minLength": 1,
144
+ "format": "uri",
145
+ "maxLength": 2048
146
+ },
147
+ "version": {
148
+ "type": "string",
149
+ "minLength": 1,
150
+ "pattern": "^[ -~]+$",
151
+ "maxLength": 1024
152
+ }
153
+ }
154
+ },
155
+ "details": {
156
+ "type": "object"
157
+ },
158
+ "operations": {
159
+ "type": "array",
160
+ "items": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "required": [
164
+ "id"
165
+ ],
166
+ "properties": {
167
+ "id": {
168
+ "type": "string",
169
+ "minLength": 1,
170
+ "pattern": "^[a-z][a-z0-9-]{0,63}$"
171
+ },
172
+ "capability": {
173
+ "type": "object",
174
+ "additionalProperties": false,
175
+ "required": [
176
+ "url"
177
+ ],
178
+ "properties": {
179
+ "url": {
180
+ "type": "string",
181
+ "minLength": 1,
182
+ "format": "uri",
183
+ "pattern": "^https://[^/?#@]+([/?][^#]*)?$",
184
+ "maxLength": 4096
185
+ }
186
+ }
187
+ }
188
+ }
189
+ },
190
+ "minItems": 1,
191
+ "maxItems": 32
192
+ },
193
+ "human": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "required": [
197
+ "url"
198
+ ],
199
+ "properties": {
200
+ "url": {
201
+ "type": "string",
202
+ "minLength": 1,
203
+ "format": "uri",
204
+ "pattern": "^https://[^/?#@]+([/?][^#]*)?$",
205
+ "maxLength": 4096
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
@@ -0,0 +1,173 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mailschema.org/artifacts/map-0.3/schemas/implementation.schema.json",
4
+ "title": "MAP implementation record",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "service",
9
+ "maintainer",
10
+ "type",
11
+ "operations",
12
+ "binding",
13
+ "status",
14
+ "documentation",
15
+ "evidence"
16
+ ],
17
+ "dependentRequired": {
18
+ "artifact": ["format"],
19
+ "format": ["artifact"]
20
+ },
21
+ "properties": {
22
+ "service": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "format": "uri",
26
+ "pattern": "^https://"
27
+ },
28
+ "maintainer": {
29
+ "type": "object",
30
+ "additionalProperties": false,
31
+ "required": [
32
+ "name",
33
+ "url"
34
+ ],
35
+ "properties": {
36
+ "name": {
37
+ "type": "string",
38
+ "minLength": 1
39
+ },
40
+ "url": {
41
+ "type": "string",
42
+ "minLength": 1,
43
+ "format": "uri",
44
+ "pattern": "^https://"
45
+ }
46
+ }
47
+ },
48
+ "type": {
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": [
52
+ "id",
53
+ "version",
54
+ "contractDigest"
55
+ ],
56
+ "properties": {
57
+ "id": {
58
+ "type": "string",
59
+ "minLength": 1,
60
+ "format": "uri",
61
+ "pattern": "^https://"
62
+ },
63
+ "version": {
64
+ "type": "string",
65
+ "minLength": 1
66
+ },
67
+ "contractDigest": {
68
+ "type": "string",
69
+ "pattern": "^sha-256:[0-9a-f]{64}$"
70
+ }
71
+ }
72
+ },
73
+ "operations": {
74
+ "type": "array",
75
+ "minItems": 1,
76
+ "uniqueItems": true,
77
+ "items": {
78
+ "type": "string",
79
+ "minLength": 1
80
+ }
81
+ },
82
+ "binding": {
83
+ "type": "string",
84
+ "format": "uri",
85
+ "pattern": "^https://",
86
+ "description": "Identifier of the binding specification or documented service binding. It is not a request destination. Clients must explicitly support it."
87
+ },
88
+ "artifact": {
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": [
92
+ "url",
93
+ "digest",
94
+ "digestMode"
95
+ ],
96
+ "properties": {
97
+ "url": {
98
+ "type": "string",
99
+ "minLength": 1,
100
+ "format": "uri",
101
+ "pattern": "^https://"
102
+ },
103
+ "digest": {
104
+ "type": "string",
105
+ "pattern": "^sha-256:[0-9a-f]{64}$"
106
+ },
107
+ "digestMode": {
108
+ "enum": [
109
+ "canonical-json",
110
+ "bytes"
111
+ ],
112
+ "description": "canonical-json hashes the RFC 8785 representation; bytes hashes the exact downloaded artifact. Both use SHA-256."
113
+ }
114
+ }
115
+ },
116
+ "format": {
117
+ "type": "string",
118
+ "minLength": 1
119
+ },
120
+ "status": {
121
+ "enum": [
122
+ "Draft",
123
+ "Experimental",
124
+ "Stable",
125
+ "Deprecated",
126
+ "Superseded"
127
+ ]
128
+ },
129
+ "documentation": {
130
+ "type": "string",
131
+ "minLength": 1,
132
+ "format": "uri",
133
+ "pattern": "^https://"
134
+ },
135
+ "evidence": {
136
+ "type": "array",
137
+ "minItems": 1,
138
+ "items": {
139
+ "type": "object",
140
+ "additionalProperties": false,
141
+ "required": [
142
+ "kind",
143
+ "url",
144
+ "summary"
145
+ ],
146
+ "properties": {
147
+ "kind": {
148
+ "enum": [
149
+ "declaration",
150
+ "test-report"
151
+ ]
152
+ },
153
+ "url": {
154
+ "type": "string",
155
+ "minLength": 1,
156
+ "format": "uri",
157
+ "pattern": "^https://"
158
+ },
159
+ "summary": {
160
+ "type": "string",
161
+ "minLength": 1
162
+ }
163
+ }
164
+ }
165
+ },
166
+ "successor": {
167
+ "type": "string",
168
+ "minLength": 1,
169
+ "format": "uri",
170
+ "pattern": "^https://"
171
+ }
172
+ }
173
+ }
package/dist/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
+ /**
2
+ * Mail Action Protocol 0.3 processing: parse and check descriptions, type contracts and
3
+ * implementation records, and compute the RFC 8785 digests that identify contracts.
4
+ */
1
5
  export * from './core/index.js';
2
- export { contributionErrors, assertContribution, assertTypeRecord, referenceErrors, } from './validation.js';
3
- export type { CatalogView } from './validation.js';
4
- export { typeStages } from './model.js';
5
- export type { Party, TypeDefinition, TypeRecord, Contribution, Implementation } from './model.js';
6
- export { getMapSchema, getMapContext, getContractFormatSchema, getFormsSchema } from './map.js';
7
- /** Return an independent copy of the contribution JSON Schema (Draft 2020-12). */
8
- export declare function getContributionSchema(): Record<string, unknown>;
9
- /** Return the schema for an expanded Registry record, including attribution and history. */
10
- export declare function getRecordSchema(): Record<string, unknown>;
package/dist/index.js CHANGED
@@ -1,17 +1,5 @@
1
1
  /**
2
- * Mail Action Protocol 0.2 processing and core artifacts, and validation tools for MailSchema
3
- * Registry contributions.
2
+ * Mail Action Protocol 0.3 processing: parse and check descriptions, type contracts and
3
+ * implementation records, and compute the RFC 8785 digests that identify contracts.
4
4
  */
5
- import schema from './contribution.schema.json' with { type: 'json' };
6
5
  export * from './core/index.js';
7
- export { contributionErrors, assertContribution, assertTypeRecord, referenceErrors, } from './validation.js';
8
- export { typeStages } from './model.js';
9
- export { getMapSchema, getMapContext, getContractFormatSchema, getFormsSchema } from './map.js';
10
- /** Return an independent copy of the contribution JSON Schema (Draft 2020-12). */
11
- export function getContributionSchema() {
12
- return structuredClone(schema);
13
- }
14
- /** Return the schema for an expanded Registry record, including attribution and history. */
15
- export function getRecordSchema() {
16
- return { $schema: schema.$schema, $defs: structuredClone(schema.$defs), $ref: '#/$defs/record' };
17
- }
@@ -0,0 +1,27 @@
1
+ {
2
+ "id": "https://mailschema.org/profiles/map/0.3",
3
+ "name": "Mail Action Protocol 0.3",
4
+ "status": "working-draft",
5
+ "description": "An action description carried in Structured Email. A trusted service binding maps each decision to the service's existing operations, and the service enforces permission and exact terms. Types are defined by digest-bound contracts.",
6
+ "context": "https://mailschema.org/contexts/map-0.3.jsonld",
7
+ "schema": "https://mailschema.org/artifacts/map-0.3/schemas/core.schema.json",
8
+ "contractFormat": "https://mailschema.org/artifacts/map-0.3/schemas/contract.schema.json",
9
+ "specification": "https://mailschema.org/specification/core",
10
+ "artifacts": {
11
+ "context": {
12
+ "url": "https://mailschema.org/contexts/map-0.3.jsonld",
13
+ "sha256": "a51490d1fe8af695c14ea508aad88fd0429d18564791b6b52f3ab07d5c51aab3"
14
+ },
15
+ "schema": {
16
+ "url": "https://mailschema.org/artifacts/map-0.3/schemas/core.schema.json",
17
+ "sha256": "0ad09a6955a47e7a2c1c1eec0747a3e0b15c08a79860e90ce4e65da11983aeb3"
18
+ },
19
+ "contractFormat": {
20
+ "url": "https://mailschema.org/artifacts/map-0.3/schemas/contract.schema.json",
21
+ "sha256": "86bf057529c4fd2c7f0a880825774afeed31e9f7ba1d99760858a585fe28d18d"
22
+ },
23
+ "conformance": {
24
+ "url": "https://github.com/mailschema/mailschema/blob/main/conformance/map-0.3/README.md"
25
+ }
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mailschema",
3
- "version": "0.2.2",
4
- "description": "Mail Action Protocol 0.2 processing and core artifacts, and MailSchema Registry validation",
3
+ "version": "0.3.0",
4
+ "description": "Mail Action Protocol 0.3: parse and check descriptions, type contracts and implementation records",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "MailSchema contributors",
@@ -21,11 +21,11 @@
21
21
  "types": "./dist/index.d.ts",
22
22
  "import": "./dist/index.js"
23
23
  },
24
- "./contribution.schema.json": "./dist/contribution.schema.json",
25
- "./map-0.2.schema.json": "./dist/map-0.2.schema.json",
26
- "./map-0.2.jsonld": "./dist/map-0.2.jsonld",
27
- "./type-contract-0.2.schema.json": "./dist/type-contract-0.2.schema.json",
28
- "./forms-0.1.schema.json": "./dist/forms-0.1.schema.json",
24
+ "./profile.json": "./dist/profile.json",
25
+ "./context.jsonld": "./dist/context.jsonld",
26
+ "./core.schema.json": "./dist/core.schema.json",
27
+ "./contract.schema.json": "./dist/contract.schema.json",
28
+ "./implementation.schema.json": "./dist/implementation.schema.json",
29
29
  "./package.json": "./package.json"
30
30
  },
31
31
  "types": "./dist/index.d.ts",
@@ -52,10 +52,9 @@
52
52
  },
53
53
  "keywords": [
54
54
  "email",
55
- "schema",
55
+ "mail-action-protocol",
56
56
  "json-schema",
57
- "agents",
58
- "registry"
57
+ "agents"
59
58
  ],
60
59
  "publishConfig": {
61
60
  "access": "public",