@openplanr/protocol 0.11.0 → 0.12.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.
@@ -0,0 +1,278 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openplanr.dev/schemas/v1.19.0/enterprise-review-projection.schema.json",
4
+ "x-openplanr-contract": {
5
+ "id": "enterprise-review-projection",
6
+ "version": "1.19.0"
7
+ },
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "kind": {
12
+ "const": "openplanr-enterprise-review-projection"
13
+ },
14
+ "schemaVersion": {
15
+ "const": "1.0.0"
16
+ },
17
+ "protocolVersion": {
18
+ "const": "1.19.0"
19
+ },
20
+ "query": {
21
+ "oneOf": [
22
+ {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "properties": {
26
+ "organizationId": {
27
+ "type": "string",
28
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
29
+ },
30
+ "actorId": {
31
+ "type": "string",
32
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
33
+ },
34
+ "scope": {
35
+ "const": "organization-reviews"
36
+ },
37
+ "filter": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "kind": {
42
+ "enum": [
43
+ "all",
44
+ "diagram",
45
+ "design",
46
+ "artifact"
47
+ ]
48
+ },
49
+ "contentFormat": {
50
+ "enum": [
51
+ "all",
52
+ "diagram-authoring",
53
+ "design-review",
54
+ "planning-document",
55
+ "generic-artifact"
56
+ ]
57
+ },
58
+ "status": {
59
+ "enum": [
60
+ "all",
61
+ "active",
62
+ "archived"
63
+ ]
64
+ },
65
+ "search": {
66
+ "type": "string",
67
+ "maxLength": 240
68
+ }
69
+ },
70
+ "required": [
71
+ "kind",
72
+ "status",
73
+ "search"
74
+ ]
75
+ }
76
+ },
77
+ "required": [
78
+ "organizationId",
79
+ "actorId",
80
+ "scope",
81
+ "filter"
82
+ ]
83
+ },
84
+ {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "properties": {
88
+ "organizationId": {
89
+ "type": "string",
90
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
91
+ },
92
+ "projectId": {
93
+ "type": "string",
94
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
95
+ },
96
+ "actorId": {
97
+ "type": "string",
98
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
99
+ },
100
+ "scope": {
101
+ "const": "project-reviews"
102
+ },
103
+ "filter": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "properties": {
107
+ "kind": {
108
+ "enum": [
109
+ "all",
110
+ "diagram",
111
+ "design",
112
+ "artifact"
113
+ ]
114
+ },
115
+ "contentFormat": {
116
+ "enum": [
117
+ "all",
118
+ "diagram-authoring",
119
+ "design-review",
120
+ "planning-document",
121
+ "generic-artifact"
122
+ ]
123
+ },
124
+ "status": {
125
+ "enum": [
126
+ "all",
127
+ "active",
128
+ "archived"
129
+ ]
130
+ },
131
+ "search": {
132
+ "type": "string",
133
+ "maxLength": 240
134
+ }
135
+ },
136
+ "required": [
137
+ "kind",
138
+ "status",
139
+ "search"
140
+ ]
141
+ }
142
+ },
143
+ "required": [
144
+ "organizationId",
145
+ "projectId",
146
+ "actorId",
147
+ "scope",
148
+ "filter"
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ "items": {
154
+ "type": "array",
155
+ "items": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "properties": {
159
+ "organizationId": {
160
+ "type": "string",
161
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
162
+ },
163
+ "projectId": {
164
+ "type": "string",
165
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
166
+ },
167
+ "artifactId": {
168
+ "type": "string",
169
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
170
+ },
171
+ "threadId": {
172
+ "type": "string",
173
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
174
+ },
175
+ "revisionId": {
176
+ "type": "string",
177
+ "pattern": "^[A-Za-z0-9_-]{1,128}(?![\\s\\S])"
178
+ },
179
+ "publicationId": {
180
+ "type": "string",
181
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}(?![\\s\\S])"
182
+ },
183
+ "category": {
184
+ "enum": [
185
+ "question",
186
+ "suggestion",
187
+ "change-request",
188
+ "blocker"
189
+ ]
190
+ },
191
+ "status": {
192
+ "enum": [
193
+ "open",
194
+ "addressed",
195
+ "resolved"
196
+ ]
197
+ },
198
+ "updatedAt": {
199
+ "type": "string",
200
+ "format": "date-time",
201
+ "maxLength": 40,
202
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z(?![\\s\\S])"
203
+ }
204
+ },
205
+ "required": [
206
+ "organizationId",
207
+ "projectId",
208
+ "artifactId",
209
+ "threadId",
210
+ "revisionId",
211
+ "publicationId",
212
+ "category",
213
+ "status",
214
+ "updatedAt"
215
+ ]
216
+ },
217
+ "maxItems": 100,
218
+ "minItems": 0
219
+ },
220
+ "nextCursor": {
221
+ "oneOf": [
222
+ {
223
+ "type": "object",
224
+ "additionalProperties": false,
225
+ "properties": {
226
+ "token": {
227
+ "type": "string",
228
+ "minLength": 1,
229
+ "maxLength": 2048
230
+ },
231
+ "queryDigest": {
232
+ "type": "string",
233
+ "pattern": "^[a-f0-9]{64}(?![\\s\\S])"
234
+ }
235
+ },
236
+ "required": [
237
+ "token",
238
+ "queryDigest"
239
+ ]
240
+ },
241
+ {
242
+ "type": "null"
243
+ }
244
+ ]
245
+ },
246
+ "index": {
247
+ "type": "object",
248
+ "additionalProperties": false,
249
+ "properties": {
250
+ "status": {
251
+ "enum": [
252
+ "current",
253
+ "lagging"
254
+ ]
255
+ },
256
+ "watermark": {
257
+ "type": "string",
258
+ "format": "date-time",
259
+ "maxLength": 40,
260
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z(?![\\s\\S])"
261
+ }
262
+ },
263
+ "required": [
264
+ "status",
265
+ "watermark"
266
+ ]
267
+ }
268
+ },
269
+ "required": [
270
+ "kind",
271
+ "schemaVersion",
272
+ "protocolVersion",
273
+ "query",
274
+ "items",
275
+ "nextCursor",
276
+ "index"
277
+ ]
278
+ }
@@ -30,3 +30,9 @@ export declare function validateDiagramReviewArtifact(
30
30
  export declare const PROTOCOL_V116_CONTRACTS: Readonly<Record<string, string>>;
31
31
 
32
32
  export declare const PROTOCOL_V117_CONTRACTS: Readonly<Record<string, string>>;
33
+
34
+ export declare const PROTOCOL_V119_CONTRACTS: Readonly<Record<string, string>>;
35
+ export declare function validateEnterpriseJourneyArtifact(
36
+ kind: string,
37
+ value: unknown,
38
+ ): { path: string; rule: string; detail: string }[];
@@ -8,6 +8,10 @@ import {
8
8
  assertDiagramWorkspaceContract,
9
9
  DIAGRAM_REVIEW_SCHEMAS,
10
10
  } from './diagram-review-contracts.mjs';
11
+ import {
12
+ assertEnterpriseJourneyContract,
13
+ ENTERPRISE_JOURNEY_SCHEMAS,
14
+ } from './enterprise-journey-contracts.mjs';
11
15
  import { LARGE_OBJECT_SCHEMAS } from './large-object-contracts.mjs';
12
16
  import {
13
17
  PROTOCOL_V16_CONTRACT_FILES,
@@ -87,6 +91,27 @@ export const PROTOCOL_V117_CONTRACTS = Object.freeze(
87
91
  ),
88
92
  );
89
93
 
94
+ export const PROTOCOL_V119_CONTRACTS = Object.freeze(
95
+ Object.fromEntries(
96
+ Object.keys(ENTERPRISE_JOURNEY_SCHEMAS).map((kind) => [kind, `${kind}.schema.json`]),
97
+ ),
98
+ );
99
+
100
+ export function validateEnterpriseJourneyArtifact(kind, value) {
101
+ try {
102
+ assertEnterpriseJourneyContract(value, kind);
103
+ return [];
104
+ } catch (error) {
105
+ return [
106
+ {
107
+ path: '$',
108
+ rule: 'company-journey-contract',
109
+ detail: error instanceof Error ? error.message : 'Invalid company journey data.',
110
+ },
111
+ ];
112
+ }
113
+ }
114
+
90
115
  const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
91
116
  '1.5.0': PROTOCOL_V15_CONTRACTS,
92
117
  '1.6.0': PROTOCOL_V16_CONTRACTS,
@@ -97,6 +122,7 @@ const PROTOCOL_CONTRACTS_BY_VERSION = Object.freeze({
97
122
  '1.15.0': PROTOCOL_V115_CONTRACTS,
98
123
  '1.16.0': PROTOCOL_V116_CONTRACTS,
99
124
  '1.17.0': PROTOCOL_V117_CONTRACTS,
125
+ '1.19.0': PROTOCOL_V119_CONTRACTS,
100
126
  });
101
127
 
102
128
  /**
package/src/contracts.mjs CHANGED
@@ -20,6 +20,10 @@ import {
20
20
  validateDiagramAuthoringArtifact,
21
21
  } from './diagram-authoring-contracts.mjs';
22
22
  import { ENTERPRISE_SCHEMAS } from './enterprise-contracts.mjs';
23
+ import {
24
+ assertEnterpriseJourneyContract,
25
+ ENTERPRISE_JOURNEY_SCHEMAS,
26
+ } from './enterprise-journey-contracts.mjs';
23
27
  import { PipelineError } from './errors.mjs';
24
28
  import { OPERATE_CONTRACT_CATALOG_V2 } from './generated/contract-catalog-v2.mjs';
25
29
  import { validateJson } from './json-schema.mjs';
@@ -265,6 +269,13 @@ const foundationPaths = {
265
269
  };
266
270
 
267
271
  // Authoring successors are additive; preserve every legacy diagram registration.
272
+ for (const kind of Object.keys(ENTERPRISE_JOURNEY_SCHEMAS)) {
273
+ foundationPaths[kind] = {
274
+ ...foundationPaths[kind],
275
+ '1.19.0': `schemas/v1.19.0/${kind}.schema.json`,
276
+ };
277
+ }
278
+
268
279
  for (const [kind, filename] of Object.entries(DIAGRAM_AUTHORING_CONTRACT_FILES)) {
269
280
  foundationPaths[kind] = { ...foundationPaths[kind], '1.13.0': `schemas/v1.13.0/${filename}` };
270
281
  }
@@ -1235,6 +1246,8 @@ function guidedQuestionnaireCompatibilityErrors(value) {
1235
1246
 
1236
1247
  /** @type {typeof import('./contracts.d.mts').validateProtocolArtifact} */
1237
1248
  export function validateProtocolArtifact(kind, value, { protocolVersion } = {}) {
1249
+ const journeyErrors = validateCompanyJourneyArtifact(kind, value, protocolVersion);
1250
+ if (journeyErrors) return journeyErrors;
1238
1251
  const studioKind = Object.hasOwn(LARGE_OBJECT_SCHEMAS, kind);
1239
1252
  if (studioKind && protocolVersion === '1.17.0') {
1240
1253
  return validateStudioArtifact(kind, value, sharedProtocolSchema(kind, protocolVersion));
@@ -1287,6 +1300,31 @@ export function validateProtocolArtifact(kind, value, { protocolVersion } = {})
1287
1300
  }
1288
1301
  return validateGenericArtifact(kind, value, sharedProtocolSchema(kind, version));
1289
1302
  }
1303
+ function validateCompanyJourneyArtifact(kind, value, protocolVersion) {
1304
+ if (Object.hasOwn(ENTERPRISE_JOURNEY_SCHEMAS, kind)) {
1305
+ try {
1306
+ assertLargeObjectData(value);
1307
+ if (
1308
+ protocolVersion === '1.19.0' ||
1309
+ (!protocolVersion &&
1310
+ Object.getOwnPropertyDescriptor(value ?? {}, 'protocolVersion')?.value === '1.19.0')
1311
+ ) {
1312
+ sharedProtocolSchema(kind, '1.19.0');
1313
+ assertEnterpriseJourneyContract(value, kind);
1314
+ return [];
1315
+ }
1316
+ } catch (error) {
1317
+ return [
1318
+ {
1319
+ path: '$',
1320
+ rule: 'company-journey-contract',
1321
+ detail: error instanceof Error ? error.message : 'Invalid company journey data.',
1322
+ },
1323
+ ];
1324
+ }
1325
+ }
1326
+ return null;
1327
+ }
1290
1328
  function invalidStudioData() {
1291
1329
  return [
1292
1330
  { path: '$', rule: 'studio-protocol-contract', detail: 'Expected bounded inert JSON data.' },