@openplanr/protocol 0.14.0 → 0.15.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/README.md +15 -1
- package/package.json +2 -2
- package/registries/commands.json +10 -10
- package/registries/roles.json +43 -133
- package/registries/skills.json +14 -14
- package/registries/task-kinds.json +2 -2
- package/schemas/v1.22.0/design-document.schema.json +506 -0
- package/schemas/v1.22.0/design-review-bundle.schema.json +822 -0
- package/schemas/v1.5.0/role-registry.schema.json +4 -1
- package/src/contracts.mjs +15 -0
- package/src/design-contracts.d.mts +15 -1
- package/src/design-contracts.mjs +141 -2
- package/src/generated/canonical-registries.mjs +69 -159
- package/src/json-schema.mjs +4 -0
- package/src/registries.mjs +20 -4
- package/src/review-experience-contracts.d.mts +1 -0
- package/src/review-experience-contracts.mjs +47 -5
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import { canonicalizeJson, sha256Hex } from './canonical-json.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
DESIGN_DOCUMENT_SCHEMA,
|
|
6
|
+
DESIGN_DOCUMENT_V120_SCHEMA,
|
|
7
|
+
validateDesignProps,
|
|
8
|
+
} from './design-contracts.mjs';
|
|
5
9
|
import { validateJson } from './json-schema.mjs';
|
|
6
10
|
import { DESIGN_REVIEW_BUNDLE_SCHEMA } from './workspace-contracts.mjs';
|
|
7
11
|
|
|
@@ -119,15 +123,36 @@ bundleCurrent.allOf = [
|
|
|
119
123
|
const currentDesign = /** @type {MutableSchema} */ (bundleCurrent.properties.design);
|
|
120
124
|
for (const key of ['frames', 'layout'])
|
|
121
125
|
currentDesign.properties[key] = /** @type {Record<string, unknown>} */ (
|
|
122
|
-
|
|
126
|
+
DESIGN_DOCUMENT_V120_SCHEMA.properties
|
|
123
127
|
)[key];
|
|
124
|
-
bundleCurrent.$defs = structuredClone(
|
|
128
|
+
bundleCurrent.$defs = structuredClone(DESIGN_DOCUMENT_V120_SCHEMA.$defs);
|
|
125
129
|
const currentEntries = /** @type {{ items: { properties: Record<string, unknown> } }} */ (
|
|
126
130
|
bundleCurrent.properties.entries
|
|
127
131
|
);
|
|
128
132
|
currentEntries.items.properties.height = { const: 'auto' };
|
|
133
|
+
/** @type {typeof import('./review-experience-contracts.d.mts').DESIGN_REVIEW_BUNDLE_V120_SCHEMA} */
|
|
134
|
+
export const DESIGN_REVIEW_BUNDLE_V120_SCHEMA = bundleCurrent;
|
|
135
|
+
|
|
136
|
+
const bundleProps = /** @type {MutableSchema} */ (structuredClone(bundleCurrent));
|
|
137
|
+
bundleProps.$id = 'https://openplanr.dev/schemas/v1.22.0/design-review-bundle.schema.json';
|
|
138
|
+
bundleProps['x-openplanr-contract'] = { id: 'design-review-bundle', version: '1.22.0' };
|
|
139
|
+
const propsDesign = /** @type {MutableSchema} */ (bundleProps.properties.design);
|
|
140
|
+
const authoredProperties = /** @type {Record<string, unknown>} */ (
|
|
141
|
+
DESIGN_DOCUMENT_SCHEMA.properties
|
|
142
|
+
);
|
|
143
|
+
propsDesign.properties.schemaVersion = authoredProperties.schemaVersion;
|
|
144
|
+
for (const key of ['screens', 'variants']) {
|
|
145
|
+
const projected = /** @type {{ items: { properties: Record<string, unknown> } }} */ (
|
|
146
|
+
propsDesign.properties[key]
|
|
147
|
+
);
|
|
148
|
+
const authored = /** @type {{ items: { properties: Record<string, unknown> } }} */ (
|
|
149
|
+
authoredProperties[key]
|
|
150
|
+
);
|
|
151
|
+
projected.items.properties.props = authored.items.properties.props;
|
|
152
|
+
}
|
|
153
|
+
propsDesign.allOf = structuredClone(DESIGN_DOCUMENT_SCHEMA.allOf);
|
|
129
154
|
/** @type {typeof import('./review-experience-contracts.d.mts').DESIGN_REVIEW_BUNDLE_CURRENT_SCHEMA} */
|
|
130
|
-
export const DESIGN_REVIEW_BUNDLE_CURRENT_SCHEMA =
|
|
155
|
+
export const DESIGN_REVIEW_BUNDLE_CURRENT_SCHEMA = bundleProps;
|
|
131
156
|
|
|
132
157
|
const item = closed(
|
|
133
158
|
{
|
|
@@ -261,9 +286,24 @@ export function assertDesignReviewMetadata(value) {
|
|
|
261
286
|
}
|
|
262
287
|
/** @returns {ReturnType<typeof import('./review-experience-contracts.d.mts').assertDesignReviewBundle>} */
|
|
263
288
|
export function assertDesignReviewBundle(value) {
|
|
289
|
+
if (
|
|
290
|
+
value?.design?.schemaVersion !== '1.1.0' &&
|
|
291
|
+
['screens', 'variants'].some(
|
|
292
|
+
(field) =>
|
|
293
|
+
Array.isArray(value?.design?.[field]) &&
|
|
294
|
+
value.design[field].some((item) => item && Object.hasOwn(item, 'props')),
|
|
295
|
+
)
|
|
296
|
+
)
|
|
297
|
+
throw new TypeError('Invalid design props: props require design.schemaVersion "1.1.0"');
|
|
264
298
|
assertReviewExperience(
|
|
265
299
|
value,
|
|
266
|
-
value?.design?.
|
|
300
|
+
value?.design?.schemaVersion !== undefined ||
|
|
301
|
+
['screens', 'variants'].some(
|
|
302
|
+
(field) =>
|
|
303
|
+
Array.isArray(value?.design?.[field]) &&
|
|
304
|
+
value.design[field].some((item) => item && Object.hasOwn(item, 'props')),
|
|
305
|
+
) ||
|
|
306
|
+
value?.design?.layout !== undefined ||
|
|
267
307
|
(Array.isArray(value?.design?.frames) &&
|
|
268
308
|
value.design.frames.some(({ height }) => height === 'auto'))
|
|
269
309
|
? DESIGN_REVIEW_BUNDLE_CURRENT_SCHEMA
|
|
@@ -273,6 +313,8 @@ export function assertDesignReviewBundle(value) {
|
|
|
273
313
|
? DESIGN_REVIEW_BUNDLE_V11_SCHEMA
|
|
274
314
|
: DESIGN_REVIEW_BUNDLE_SCHEMA,
|
|
275
315
|
);
|
|
316
|
+
const propErrors = validateDesignProps(value.design);
|
|
317
|
+
if (propErrors.length) throw new TypeError(`Invalid design props:\n${propErrors.join('\n')}`);
|
|
276
318
|
if (['1.1.0', '1.2.0'].includes(value.schemaVersion)) {
|
|
277
319
|
if (
|
|
278
320
|
value.reviewContext.designId !== value.design.id ||
|