@kumwe/studio-testkit 0.1.0-alpha.10

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 (304) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/THIRD_PARTY_NOTICES.md +9 -0
  4. package/conformance/authoring-web/non-drag-move-equivalence.json +199 -0
  5. package/conformance/renderer-web/blob-default-deny.json +47 -0
  6. package/conformance/renderer-web/chart-fallback.json +39 -0
  7. package/conformance/renderer-web/complete-catalog.json +634 -0
  8. package/conformance/renderer-web/escaped-heading.json +28 -0
  9. package/conformance/renderer-web/interactive-behaviors.json +226 -0
  10. package/conformance/renderer-web/presentation-capabilities.json +76 -0
  11. package/conformance/renderer-web/responsive-grid.json +33 -0
  12. package/conformance/renderer-web/security-fallbacks.json +169 -0
  13. package/conformance/rich-text/advanced.first-party.json +67 -0
  14. package/conformance/rich-text/blocks.structural.json +57 -0
  15. package/conformance/rich-text/document.multi-block.json +74 -0
  16. package/conformance/rich-text/embed.hard-break.json +24 -0
  17. package/conformance/rich-text/marks.nested.json +29 -0
  18. package/conformance/rich-text/offsets.astral.json +24 -0
  19. package/conformance/rich-text/paragraph.plain.json +20 -0
  20. package/conformance/rich-text/spans.adjacent.json +27 -0
  21. package/corpus-manifest.json +1212 -0
  22. package/dist/host-testbed.d.ts +71 -0
  23. package/dist/host-testbed.d.ts.map +1 -0
  24. package/dist/host-testbed.js +782 -0
  25. package/dist/host-testbed.js.map +1 -0
  26. package/dist/http-host-adapter.d.ts +74 -0
  27. package/dist/http-host-adapter.d.ts.map +1 -0
  28. package/dist/http-host-adapter.js +264 -0
  29. package/dist/http-host-adapter.js.map +1 -0
  30. package/dist/index.d.ts +112 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +211 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/web-conformance.d.ts +105 -0
  35. package/dist/web-conformance.d.ts.map +1 -0
  36. package/dist/web-conformance.js +72 -0
  37. package/dist/web-conformance.js.map +1 -0
  38. package/fixtures/authoring-message-catalog.en.json +649 -0
  39. package/fixtures/block.grid.example.json +76 -0
  40. package/fixtures/block.price.example.json +69 -0
  41. package/fixtures/blueprint.product.example.json +92 -0
  42. package/fixtures/command.move-node.example.json +18 -0
  43. package/fixtures/content-model.product.example.json +141 -0
  44. package/fixtures/design-vocabulary.example.json +85 -0
  45. package/fixtures/entry.product.example.json +55 -0
  46. package/fixtures/field-adapter.example.json +27 -0
  47. package/fixtures/host-capabilities.example.json +42 -0
  48. package/fixtures/host-error.conflict.example.json +23 -0
  49. package/fixtures/host-operations.example.json +270 -0
  50. package/fixtures/inspector.example.json +17 -0
  51. package/fixtures/media-asset.example.json +29 -0
  52. package/fixtures/media-asset.processing.example.json +15 -0
  53. package/fixtures/media-reference.example.json +26 -0
  54. package/fixtures/media-upload-grant.example.json +14 -0
  55. package/fixtures/media-upload-session.transferring.example.json +22 -0
  56. package/fixtures/migration.example.json +22 -0
  57. package/fixtures/pattern.example.json +49 -0
  58. package/fixtures/plugin.example.json +49 -0
  59. package/fixtures/preview.render.example.json +15 -0
  60. package/fixtures/provenance.example.json +38 -0
  61. package/fixtures/rich-text.example.json +48 -0
  62. package/fixtures/studio-config.example.json +139 -0
  63. package/fixtures/theme.example.json +123 -0
  64. package/fixtures/unresolved-contribution.example.json +23 -0
  65. package/invalid/binding-projection-vector.unknown-status.json +85 -0
  66. package/invalid/blueprint.control-character-member.json +59 -0
  67. package/invalid/blueprint.forbidden-property-member.json +61 -0
  68. package/invalid/blueprint.invalid-node-id.json +57 -0
  69. package/invalid/blueprint.invalid-slot-name.json +59 -0
  70. package/invalid/blueprint.published-empty-roots.json +45 -0
  71. package/invalid/blueprint.revoking-slot-marker.json +57 -0
  72. package/invalid/blueprint.unknown-member.json +58 -0
  73. package/invalid/command-vector.unknown-error-code.json +103 -0
  74. package/invalid/command.empty-batch.json +17 -0
  75. package/invalid/command.forbidden-id-map-member.json +20 -0
  76. package/invalid/command.malformed-size-role.json +18 -0
  77. package/invalid/command.negative-position.json +20 -0
  78. package/invalid/command.nested-batch.json +24 -0
  79. package/invalid/command.pattern-in-batch.json +40 -0
  80. package/invalid/command.reset-inherited-property-in-batch.json +24 -0
  81. package/invalid/command.unknown-member.json +23 -0
  82. package/invalid/command.wrong-contract-version.json +22 -0
  83. package/invalid/content-model.published-empty.json +22 -0
  84. package/invalid/design-vocabulary.unknown-control-kind.json +38 -0
  85. package/invalid/entry.forbidden-value-member.json +23 -0
  86. package/invalid/entry.invalid-locale.json +59 -0
  87. package/invalid/host-capabilities.invalid-protocol-version.json +40 -0
  88. package/invalid/host-sequence.pending-expectation.json +52 -0
  89. package/invalid/host-sequence.preview-render-missing-request-id.json +50 -0
  90. package/invalid/inspector.empty-block-types.json +20 -0
  91. package/invalid/media-reference.missing-accessibility.json +25 -0
  92. package/invalid/media-upload-grant.insecure-url.json +14 -0
  93. package/invalid/media-upload-session.complete-without-asset.json +20 -0
  94. package/invalid/migration.empty-artifact-kinds.json +22 -0
  95. package/invalid/preview-message.activated-unknown-interaction.json +16 -0
  96. package/invalid/preview-message.duplicate-marker.json +24 -0
  97. package/invalid/preview-message.invalid-digest.json +19 -0
  98. package/invalid/preview-message.invalid-marker-grammar.json +19 -0
  99. package/invalid/preview-message.missing-marker-map.json +20 -0
  100. package/invalid/preview-message.missing-render-request-id.json +18 -0
  101. package/invalid/preview-message.unknown-type.json +13 -0
  102. package/invalid/preview-message.viewport-height-too-small.json +13 -0
  103. package/invalid/preview-message.viewport-role-and-size.json +16 -0
  104. package/invalid/preview-message.viewport-unsafe-role.json +13 -0
  105. package/invalid/rich-text.embedded-html.json +13 -0
  106. package/invalid/rich-text.unknown-mark.json +19 -0
  107. package/invalid/studio-chart.script-config.json +10 -0
  108. package/invalid/studio-drawing.svg-payload.json +10 -0
  109. package/invalid/studio-money.float.json +8 -0
  110. package/invalid/studio-presentation.css-injection.json +8 -0
  111. package/invalid/studio-table.html-cell.json +8 -0
  112. package/invalid/theme.unknown-member.json +128 -0
  113. package/package.json +54 -0
  114. package/studio-release.json +18 -0
  115. package/vectors/binding-projection/app-content-fields.resolved.json +286 -0
  116. package/vectors/binding-projection/field-removed.diagnostic.json +135 -0
  117. package/vectors/binding-projection/model-revision-mismatch.diagnostic.json +124 -0
  118. package/vectors/canonical/array-order.json +13 -0
  119. package/vectors/canonical/control-characters.json +13 -0
  120. package/vectors/canonical/depth-exceeded.json +21 -0
  121. package/vectors/canonical/empty-containers.json +14 -0
  122. package/vectors/canonical/forbidden-member.json +14 -0
  123. package/vectors/canonical/member-order.json +16 -0
  124. package/vectors/canonical/negative-zero.json +13 -0
  125. package/vectors/canonical/nested-order.json +19 -0
  126. package/vectors/canonical/non-ascii.json +13 -0
  127. package/vectors/canonical/numbers.json +16 -0
  128. package/vectors/canonical/string-escapes.json +13 -0
  129. package/vectors/canonical/surrogate-pair.json +13 -0
  130. package/vectors/command/apply-pattern.colliding-id.error.json +97 -0
  131. package/vectors/command/apply-pattern.incomplete-id-map.error.json +111 -0
  132. package/vectors/command/apply-pattern.two-roots.json +259 -0
  133. package/vectors/command/batch.atomic-failure.error.json +100 -0
  134. package/vectors/command/batch.insert-and-configure.json +197 -0
  135. package/vectors/command/batch.size-roles.json +180 -0
  136. package/vectors/command/duplicate-node.existing-id.error.json +88 -0
  137. package/vectors/command/duplicate-node.explicit-destination.json +183 -0
  138. package/vectors/command/duplicate-node.incomplete-id-map.error.json +91 -0
  139. package/vectors/command/duplicate-node.subtree.json +201 -0
  140. package/vectors/command/insert-node.duplicate-id.error.json +87 -0
  141. package/vectors/command/insert-node.inner-duplicate-id.error.json +115 -0
  142. package/vectors/command/insert-node.invalid-index.error.json +87 -0
  143. package/vectors/command/insert-node.root.json +162 -0
  144. package/vectors/command/insert-node.slot.json +167 -0
  145. package/vectors/command/mode.blueprint.set-field-value.error.json +76 -0
  146. package/vectors/command/mode.blueprint.set-property.json +131 -0
  147. package/vectors/command/mode.content.insert-node.error.json +88 -0
  148. package/vectors/command/mode.hybrid.batch-atomic.error.json +158 -0
  149. package/vectors/command/mode.hybrid.insert-allowed.json +263 -0
  150. package/vectors/command/mode.hybrid.insert-designer-slot.error.json +145 -0
  151. package/vectors/command/mode.hybrid.insert-disallowed-type.error.json +145 -0
  152. package/vectors/command/mode.hybrid.insert-roots.error.json +143 -0
  153. package/vectors/command/mode.hybrid.remove-locked.error.json +130 -0
  154. package/vectors/command/mode.hybrid.reorder-with-locked.json +239 -0
  155. package/vectors/command/mode.hybrid.set-property.error.json +132 -0
  156. package/vectors/command/mode.hybrid.slot-marker-disallowed.error.json +125 -0
  157. package/vectors/command/mode.hybrid.slot-marker-insert.json +223 -0
  158. package/vectors/command/mode.hybrid.slot-marker-other-slot.error.json +125 -0
  159. package/vectors/command/mode.model.remove-node.error.json +75 -0
  160. package/vectors/command/mode.read-only.set-property.error.json +77 -0
  161. package/vectors/command/move-node.into-self.error.json +95 -0
  162. package/vectors/command/move-node.reparent.json +196 -0
  163. package/vectors/command/move-node.within-roots.json +188 -0
  164. package/vectors/command/remove-binding.base.json +159 -0
  165. package/vectors/command/remove-binding.missing.error.json +75 -0
  166. package/vectors/command/remove-node.empties-slot.json +167 -0
  167. package/vectors/command/remove-node.missing.error.json +74 -0
  168. package/vectors/command/remove-node.nested.json +192 -0
  169. package/vectors/command/reorder-children.not-permutation.error.json +85 -0
  170. package/vectors/command/reorder-children.roots.json +182 -0
  171. package/vectors/command/reorder-children.slot.json +192 -0
  172. package/vectors/command/reset-inherited-property.missing.error.json +82 -0
  173. package/vectors/command/reset-inherited-property.single-viewport.json +151 -0
  174. package/vectors/command/reset-inherited-property.two-viewports.json +168 -0
  175. package/vectors/command/restore-node.inner-duplicate-id.error.json +115 -0
  176. package/vectors/command/restore-node.subtree-into-slot.json +195 -0
  177. package/vectors/command/set-binding.add.json +159 -0
  178. package/vectors/command/set-binding.replace.json +178 -0
  179. package/vectors/command/set-property.add.json +143 -0
  180. package/vectors/command/set-property.replace.json +146 -0
  181. package/vectors/command/set-property.viewport-add.json +148 -0
  182. package/vectors/command/set-size-role.base.json +144 -0
  183. package/vectors/command/set-size-role.duplicate.json +148 -0
  184. package/vectors/command/set-size-role.viewport-add.json +154 -0
  185. package/vectors/command/unset-property.base.json +143 -0
  186. package/vectors/command/unset-property.missing.error.json +75 -0
  187. package/vectors/command/unset-property.viewport.json +154 -0
  188. package/vectors/command/unset-size-role.missing.error.json +78 -0
  189. package/vectors/command/unset-size-role.viewport.json +154 -0
  190. package/vectors/host/artifact.dependencies.result.json +35 -0
  191. package/vectors/host/artifact.load.stored.json +36 -0
  192. package/vectors/host/artifact.load.unknown.error.json +37 -0
  193. package/vectors/host/artifact.publish.accepted.json +37 -0
  194. package/vectors/host/artifact.publish.forbidden.error.json +37 -0
  195. package/vectors/host/artifact.publish.stale.error.json +38 -0
  196. package/vectors/host/artifact.save.accepted.json +38 -0
  197. package/vectors/host/artifact.save.forbidden.error.json +38 -0
  198. package/vectors/host/artifact.save.stale.error.json +39 -0
  199. package/vectors/host/artifact.unpublish.stale.error.json +38 -0
  200. package/vectors/host/envelope.malformed-context.error.json +36 -0
  201. package/vectors/host/envelope.protocol-version.error.json +36 -0
  202. package/vectors/host/envelope.stale-generation.error.json +36 -0
  203. package/vectors/host/localization.messages.unknown-locale.error.json +36 -0
  204. package/vectors/host/media.abort-upload.unknown.error.json +35 -0
  205. package/vectors/host/media.authorize-upload.granted.json +37 -0
  206. package/vectors/host/media.authorize-upload.path-filename.error.json +39 -0
  207. package/vectors/host/media.authorize-upload.too-large.error.json +38 -0
  208. package/vectors/host/media.complete-upload.unknown.error.json +36 -0
  209. package/vectors/host/media.get.unknown.json +34 -0
  210. package/vectors/host/media.import-external.private-host.error.json +36 -0
  211. package/vectors/host/media.list.cursor.error.json +36 -0
  212. package/vectors/host/media.list.limit.error.json +35 -0
  213. package/vectors/host/media.upload-status.unknown.error.json +35 -0
  214. package/vectors/host/model.get.stored.json +37 -0
  215. package/vectors/host/model.list.authorized.json +31 -0
  216. package/vectors/host/permission.explain.withheld.json +34 -0
  217. package/vectors/host/permission.refresh.snapshot.json +31 -0
  218. package/vectors/host/recovery.load.absent.json +31 -0
  219. package/vectors/host/telemetry.emit.accepted.json +37 -0
  220. package/vectors/host/telemetry.emit.non-primitive.error.json +40 -0
  221. package/vectors/host-sequence/artifact.publish.changed-intent.sequence.json +75 -0
  222. package/vectors/host-sequence/artifact.publish.idempotent-replay.sequence.json +111 -0
  223. package/vectors/host-sequence/preview.cancel.cross-context.sequence.json +78 -0
  224. package/vectors/host-sequence/preview.render.cancelled.sequence.json +75 -0
  225. package/vectors/host-sequence/recovery.store.canonical-number.sequence.json +72 -0
  226. package/vectors/host-sequence/recovery.store.changed-context.sequence.json +61 -0
  227. package/vectors/host-sequence/recovery.store.rate-limited.sequence.json +93 -0
  228. package/vectors/host-sequence/recovery.store.resource-scope.sequence.json +61 -0
  229. package/vectors/host-sequence/recovery.store.wrong-operation-id.sequence.json +56 -0
  230. package/vectors/media/accept.plan-deterministic.json +26 -0
  231. package/vectors/media/accept.size-at-boundary.json +26 -0
  232. package/vectors/media/cancel.complete-noop.json +30 -0
  233. package/vectors/media/cancel.requested.json +30 -0
  234. package/vectors/media/cancel.transferring.json +30 -0
  235. package/vectors/media/cancel.verifying.json +30 -0
  236. package/vectors/media/reject.disallowed-kind.json +23 -0
  237. package/vectors/media/reject.filename-empty.json +22 -0
  238. package/vectors/media/reject.filename-path.json +23 -0
  239. package/vectors/media/reject.size-one-byte-over.json +23 -0
  240. package/vectors/media/retry.fresh-session.json +26 -0
  241. package/vectors/preview/canonical-preorder.json +102 -0
  242. package/vectors/preview/empty-draft.json +36 -0
  243. package/vectors/schema-profile/alternative-limit.accepted.json +95 -0
  244. package/vectors/schema-profile/alternative-limit.rejected.json +92 -0
  245. package/vectors/schema-profile/array-composition.accepted.json +35 -0
  246. package/vectors/schema-profile/byte-limit.accepted.json +30 -0
  247. package/vectors/schema-profile/byte-limit.rejected.json +26 -0
  248. package/vectors/schema-profile/closed-object.accepted.json +38 -0
  249. package/vectors/schema-profile/decimal-multiple.accepted.json +54 -0
  250. package/vectors/schema-profile/depth-limit.accepted.json +90 -0
  251. package/vectors/schema-profile/depth-limit.rejected.json +88 -0
  252. package/vectors/schema-profile/description-limit.accepted.json +29 -0
  253. package/vectors/schema-profile/description-limit.rejected.json +25 -0
  254. package/vectors/schema-profile/diagnostic-precedence.rejected.json +26 -0
  255. package/vectors/schema-profile/duplicate-dependent-required.rejected.json +21 -0
  256. package/vectors/schema-profile/duplicate-required.rejected.json +18 -0
  257. package/vectors/schema-profile/empty-combinator.rejected.json +17 -0
  258. package/vectors/schema-profile/empty-enum.rejected.json +17 -0
  259. package/vectors/schema-profile/enum-limit.accepted.json +89 -0
  260. package/vectors/schema-profile/enum-limit.rejected.json +84 -0
  261. package/vectors/schema-profile/examples-limit.accepted.json +35 -0
  262. package/vectors/schema-profile/examples-limit.rejected.json +31 -0
  263. package/vectors/schema-profile/format-keyword.rejected.json +17 -0
  264. package/vectors/schema-profile/forward-reference-path-precedence.rejected.json +20 -0
  265. package/vectors/schema-profile/invalid-pointer.rejected.json +18 -0
  266. package/vectors/schema-profile/json-depth-limit.accepted.json +278 -0
  267. package/vectors/schema-profile/json-depth-limit.rejected.json +276 -0
  268. package/vectors/schema-profile/json-item-limit.accepted.json +686 -0
  269. package/vectors/schema-profile/json-item-limit.rejected.json +682 -0
  270. package/vectors/schema-profile/json-property-limit.accepted.json +1031 -0
  271. package/vectors/schema-profile/json-property-limit.rejected.json +1028 -0
  272. package/vectors/schema-profile/local-reference.accepted.json +28 -0
  273. package/vectors/schema-profile/memoized-diagnostic.accepted.json +31 -0
  274. package/vectors/schema-profile/node-limit.accepted.json +1097 -0
  275. package/vectors/schema-profile/node-limit.rejected.json +1094 -0
  276. package/vectors/schema-profile/non-object-root.rejected.json +9 -0
  277. package/vectors/schema-profile/non-schema-reference.rejected.json +21 -0
  278. package/vectors/schema-profile/object-key-limit.accepted.json +32 -0
  279. package/vectors/schema-profile/object-key-limit.rejected.json +28 -0
  280. package/vectors/schema-profile/open-root.rejected.json +13 -0
  281. package/vectors/schema-profile/percent-encoded-pointer.rejected.json +26 -0
  282. package/vectors/schema-profile/property-name-limit.accepted.json +543 -0
  283. package/vectors/schema-profile/property-name-limit.rejected.json +536 -0
  284. package/vectors/schema-profile/recursive-diagnostic-precedence.rejected.json +30 -0
  285. package/vectors/schema-profile/recursive-reference.rejected.json +24 -0
  286. package/vectors/schema-profile/reference-fanout.accepted.json +662 -0
  287. package/vectors/schema-profile/reference-length-limit.accepted.json +45 -0
  288. package/vectors/schema-profile/reference-length-limit.rejected.json +39 -0
  289. package/vectors/schema-profile/reference-limit.accepted.json +416 -0
  290. package/vectors/schema-profile/reference-limit.rejected.json +415 -0
  291. package/vectors/schema-profile/reference-vs-keyword-precedence.rejected.json +22 -0
  292. package/vectors/schema-profile/reserved-pointer.rejected.json +26 -0
  293. package/vectors/schema-profile/root-diagnostic-precedence.rejected.json +16 -0
  294. package/vectors/schema-profile/root-vs-reference-precedence.rejected.json +19 -0
  295. package/vectors/schema-profile/schema-map-limit.accepted.json +539 -0
  296. package/vectors/schema-profile/schema-map-limit.rejected.json +536 -0
  297. package/vectors/schema-profile/semantic-recursion-precedence.rejected.json +21 -0
  298. package/vectors/schema-profile/semantic-reference-precedence.rejected.json +21 -0
  299. package/vectors/schema-profile/title-limit.accepted.json +29 -0
  300. package/vectors/schema-profile/title-limit.rejected.json +25 -0
  301. package/vectors/schema-profile/unresolved-reference.rejected.json +17 -0
  302. package/vectors/schema-profile/unsafe-dependent-required.rejected.json +24 -0
  303. package/vectors/schema-profile/unsafe-member.rejected.json +17 -0
  304. package/vectors/schema-profile/unsafe-required.rejected.json +17 -0
package/dist/index.js ADDED
@@ -0,0 +1,211 @@
1
+ import { BlockRegistry, compileStudioPropertySchema, projectBlueprintFieldBindings, StudioSchemaProfileError, validateBlueprint, } from '@kumwe/studio-core';
2
+ import { STUDIO_CONTRACT_VERSION, STUDIO_WIRE_PROTOCOL_VERSION, } from '@kumwe/studio-protocol';
3
+ export { createHostRequestContextFixture, createTestbedHost, TestbedHostError, } from './host-testbed.js';
4
+ export { createHttpHostAdapter, } from './http-host-adapter.js';
5
+ export { runAuthoringWebVector, } from './web-conformance.js';
6
+ /**
7
+ * Replays a binding vector without consulting its expected projection. The
8
+ * normalized result intentionally excludes localized labels and prose so a
9
+ * non-TypeScript host compares stable coordinates, controls, outcomes, and
10
+ * diagnostic locations rather than an English rendering.
11
+ */
12
+ export function runBindingProjectionVector(vector) {
13
+ const projection = projectBlueprintFieldBindings(vector.blueprint, vector.model, vector.blockDefinitions);
14
+ return cloneValue({
15
+ diagnostics: projection.diagnostics.map((entry) => ({
16
+ code: entry.code,
17
+ ...(entry.location === undefined ? {} : { location: entry.location }),
18
+ severity: entry.severity,
19
+ })),
20
+ model: projection.model,
21
+ nodes: projection.nodes.map((node) => ({
22
+ nodeId: node.nodeId,
23
+ ports: node.ports.map((port) => ({
24
+ ...(port.binding === undefined ? {} : { bindingSourceKind: port.binding.source.kind }),
25
+ ...(port.boundFieldPath === undefined ? {} : { boundFieldPath: [...port.boundFieldPath] }),
26
+ candidates: port.candidates.map((candidate) => ({
27
+ cardinality: candidate.cardinality,
28
+ ...(candidate.control === undefined ? {} : { control: candidate.control }),
29
+ fieldPath: [...candidate.fieldPath],
30
+ ...(candidate.itemKind === undefined ? {} : { itemKind: candidate.itemKind }),
31
+ kind: candidate.kind,
32
+ })),
33
+ ...(port.multiple === undefined ? {} : { multiple: port.multiple }),
34
+ port: port.port,
35
+ ...(port.required === undefined ? {} : { required: port.required }),
36
+ status: port.status,
37
+ ...(port.valueType === undefined ? {} : { valueType: port.valueType }),
38
+ })),
39
+ })),
40
+ });
41
+ }
42
+ /**
43
+ * Replay a portable `studio.profile/schema-property` vector against the
44
+ * reference implementation. Only each case's input `value` is read from the
45
+ * accepted expectation; expected verdicts and diagnostics are not consulted.
46
+ * Callers compare this independently produced outcome with the published
47
+ * `expect` member.
48
+ */
49
+ export function runSchemaProfileVector(vector) {
50
+ try {
51
+ const validator = compileStudioPropertySchema(vector.schema);
52
+ const instances = (vector.expect.instances ?? []).map((entry) => {
53
+ const valid = validator.validate(entry.value);
54
+ const first = validator.errors?.[0];
55
+ return {
56
+ ...(first === undefined
57
+ ? {}
58
+ : { diagnostic: { instancePath: first.instancePath, keyword: first.keyword } }),
59
+ valid,
60
+ value: entry.value,
61
+ };
62
+ });
63
+ return { instances, outcome: 'accepted' };
64
+ }
65
+ catch (error) {
66
+ if (error instanceof StudioSchemaProfileError) {
67
+ return {
68
+ code: error.code,
69
+ outcome: 'rejected',
70
+ schemaPath: error.schemaPath,
71
+ };
72
+ }
73
+ throw error;
74
+ }
75
+ }
76
+ export function createBlueprintFixture(options = {}) {
77
+ return {
78
+ contractVersion: STUDIO_CONTRACT_VERSION,
79
+ dependencyLock: {
80
+ blocks: cloneValue(options.blockLocks ?? []),
81
+ theme: { id: 'studio.test/theme', revision: 'theme-r1', version: '1.0.0' },
82
+ },
83
+ id: options.id ?? 'test.blueprint',
84
+ kind: 'blueprint',
85
+ label: { defaultMessage: 'Test Blueprint', key: 'studio.test/blueprint' },
86
+ model: { id: 'studio.test/model', revision: 'model-r1', version: '1.0.0' },
87
+ owner: { id: 'studio.test/testkit', version: '0.1.0-alpha.0' },
88
+ revision: options.revision ?? 'blueprint-r1',
89
+ roots: cloneValue(options.roots ?? []),
90
+ status: 'draft',
91
+ version: '1.0.0',
92
+ };
93
+ }
94
+ export function defineTestBlock(options) {
95
+ const label = options.label ?? 'Test block';
96
+ return {
97
+ accessibility: {
98
+ accessibleName: 'not-applicable',
99
+ category: 'structural',
100
+ keyboard: { defaultMessage: 'Use outline commands.', key: 'studio.test/block-keyboard' },
101
+ outputChecks: ['studio.check/test-block'],
102
+ reducedMotion: 'not-applicable',
103
+ },
104
+ category: 'studio.category/test',
105
+ contractVersion: STUDIO_CONTRACT_VERSION,
106
+ editingModes: ['blueprint', 'content'],
107
+ kind: 'block-definition',
108
+ label: { defaultMessage: label, key: 'studio.test/block-label' },
109
+ owner: { id: 'studio.test/testkit', version: '0.1.0-alpha.0' },
110
+ ports: [],
111
+ propertySchema: cloneValue(options.propertySchema ?? { additionalProperties: false, type: 'object' }),
112
+ rendererRequirements: [
113
+ { capability: 'studio.renderer/test', surface: 'preview', versions: '^0.1.0' },
114
+ ],
115
+ revision: 'block-r1',
116
+ slots: cloneValue(options.slots ?? []),
117
+ themeControls: [],
118
+ type: options.type,
119
+ version: options.version ?? '1.0.0',
120
+ };
121
+ }
122
+ export function createStudioConfigurationFixture(options = {}) {
123
+ return {
124
+ actor: { displayName: 'Test Author', id: 'users/test-author' },
125
+ artifacts: {},
126
+ blocks: [],
127
+ composite: options.composite ?? 'single',
128
+ contractVersion: STUDIO_CONTRACT_VERSION,
129
+ displayPreferences: {
130
+ calendar: 'gregory',
131
+ hourCycle: 'h23',
132
+ measurementSystem: 'metric',
133
+ numberingSystem: 'latn',
134
+ },
135
+ features: {
136
+ clipboardMediaUpload: false,
137
+ collaboration: false,
138
+ customInspectors: false,
139
+ executablePlugins: false,
140
+ externalMediaImport: false,
141
+ offlineRecovery: false,
142
+ },
143
+ hostCapabilities: {
144
+ capabilities: [],
145
+ contractVersion: STUDIO_CONTRACT_VERSION,
146
+ host: { generation: 'host-r1', id: 'studio.test/host', version: '1.0.0' },
147
+ kind: 'host-capabilities',
148
+ ports: [],
149
+ protocolVersions: [STUDIO_WIRE_PROTOCOL_VERSION],
150
+ },
151
+ limits: {
152
+ maxChildrenPerSlot: 1_000,
153
+ maxCommandBatch: 100,
154
+ maxContributionsPerPlugin: 500,
155
+ maxDepth: 32,
156
+ maxExtensionBytes: 1_048_576,
157
+ maxHistoryEntries: 100,
158
+ maxLocaleBytes: 1_048_576,
159
+ maxMediaBatch: 50,
160
+ maxMediaUploadBytes: 1_073_741_824,
161
+ maxNodes: 5_000,
162
+ maxPluginCount: 20,
163
+ maxPreviewBytes: 10_485_760,
164
+ maxPreviewRequestsPerMinute: 120,
165
+ maxPropertyBytes: 1_048_576,
166
+ maxRichTextBytes: 1_048_576,
167
+ maxRichTextDepth: 32,
168
+ maxSlotsPerNode: 20,
169
+ },
170
+ locale: {
171
+ direction: 'ltr',
172
+ fallbacks: [],
173
+ requested: 'en',
174
+ resolved: 'en',
175
+ timeZone: 'UTC',
176
+ },
177
+ mode: options.mode ?? 'blueprint',
178
+ permissions: [],
179
+ plugins: [],
180
+ protocolVersion: STUDIO_WIRE_PROTOCOL_VERSION,
181
+ preview: { allowApproximateRenderer: false, enabled: false, sameOriginRequired: true },
182
+ sessionGeneration: 'session-r1',
183
+ sessionId: 'session-test',
184
+ sessionState: options.sessionState ?? 'editable',
185
+ resourceContext: {
186
+ key: 'contexts/test',
187
+ scopes: [],
188
+ surface: 'studio.test/fixture',
189
+ },
190
+ };
191
+ }
192
+ export function assertBlueprintConforms(blueprint, definitions) {
193
+ const result = validateBlueprint(blueprint, new BlockRegistry(definitions));
194
+ if (!result.valid) {
195
+ throw new StudioConformanceError(result.diagnostics);
196
+ }
197
+ }
198
+ export class StudioConformanceError extends Error {
199
+ diagnostics;
200
+ constructor(diagnostics) {
201
+ super(diagnostics
202
+ .map((entry) => `${entry.code}: ${entry.message.defaultMessage ?? entry.message.key}`)
203
+ .join('\n'));
204
+ this.name = 'StudioConformanceError';
205
+ this.diagnostics = cloneValue(diagnostics);
206
+ }
207
+ }
208
+ function cloneValue(value) {
209
+ return JSON.parse(JSON.stringify(value));
210
+ }
211
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,uBAAuB,EACvB,4BAA4B,GAc7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,g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AAC;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/B,WAAW,CAAqB;IAEhD,YAAmB,WAA+B;QAChD,KAAK,CACH,WAAW;aACR,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;aACrF,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,SAAS,UAAU,CAAI,KAAQ;IAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAM,CAAC;AAChD,CAAC"}
@@ -0,0 +1,105 @@
1
+ import type { BlueprintDocument, JsonObject, JsonValue, QualifiedName, StableId } from '@kumwe/studio-protocol';
2
+ export type AuthoringWebRegion = 'canvas' | 'command-palette' | 'inspector' | 'outline' | 'palette' | 'preview' | 'viewport';
3
+ export type AuthoringWebAction = {
4
+ kind: 'focus-node';
5
+ nodeId: StableId;
6
+ region: AuthoringWebRegion;
7
+ } | {
8
+ key: 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'Delete' | 'End' | 'Enter' | 'Escape' | 'Home' | 'Tab' | 'd' | 'y' | 'z';
9
+ kind: 'key';
10
+ modifiers: ('Alt' | 'Control' | 'Meta' | 'Shift')[];
11
+ region: AuthoringWebRegion;
12
+ } | {
13
+ destination: {
14
+ parentNodeId?: StableId;
15
+ position: number;
16
+ slot?: string;
17
+ };
18
+ kind: 'drag-node';
19
+ nodeId: StableId;
20
+ } | {
21
+ kind: 'activate-command';
22
+ payload: JsonObject;
23
+ region: AuthoringWebRegion;
24
+ type: QualifiedName;
25
+ } | {
26
+ kind: 'edit-property';
27
+ nodeId: StableId;
28
+ property: string;
29
+ value: JsonValue;
30
+ viewport?: string;
31
+ };
32
+ export interface AuthoringWebGiven {
33
+ direction: 'ltr' | 'rtl';
34
+ document: BlueprintDocument;
35
+ locale: string;
36
+ readOnly: boolean;
37
+ reducedMotion: boolean;
38
+ selection: StableId | null;
39
+ viewport: {
40
+ height: number;
41
+ width: number;
42
+ zoomPercent: number;
43
+ };
44
+ }
45
+ export interface AuthoringWebCommandObservation {
46
+ payload: JsonObject;
47
+ type: QualifiedName;
48
+ }
49
+ export interface AuthoringWebObservation {
50
+ announcements: {
51
+ key: QualifiedName;
52
+ politeness: 'assertive' | 'polite';
53
+ }[];
54
+ commands: AuthoringWebCommandObservation[];
55
+ dirty: boolean;
56
+ document: BlueprintDocument;
57
+ focus: {
58
+ nodeId?: StableId;
59
+ region: AuthoringWebRegion;
60
+ };
61
+ selection: StableId | null;
62
+ }
63
+ export interface AuthoringWebLane {
64
+ name: string;
65
+ steps: AuthoringWebAction[];
66
+ surface: 'keyboard' | 'pointer' | 'structural-control';
67
+ }
68
+ export interface AuthoringWebVector {
69
+ contractVersion: string;
70
+ description: string;
71
+ expect: AuthoringWebObservation;
72
+ given: AuthoringWebGiven;
73
+ id: QualifiedName;
74
+ kind: 'authoring-web-vector';
75
+ lanes: AuthoringWebLane[];
76
+ requirements: string[];
77
+ }
78
+ export interface AuthoringWebConformanceSession {
79
+ dispose?(): Promise<void> | void;
80
+ observe(): Promise<AuthoringWebObservation> | AuthoringWebObservation;
81
+ perform(action: Readonly<AuthoringWebAction>): Promise<void> | void;
82
+ }
83
+ export interface AuthoringWebConformanceAdapter {
84
+ open(given: Readonly<AuthoringWebGiven>, lane: Readonly<AuthoringWebLane>): Promise<AuthoringWebConformanceSession> | AuthoringWebConformanceSession;
85
+ }
86
+ export interface AuthoringWebLaneResult {
87
+ mismatches: string[];
88
+ name: string;
89
+ observation: AuthoringWebObservation;
90
+ passed: boolean;
91
+ surface: AuthoringWebLane['surface'];
92
+ }
93
+ export interface AuthoringWebVectorResult {
94
+ lanes: AuthoringWebLaneResult[];
95
+ passed: boolean;
96
+ profile: 'studio.profile/authoring-web';
97
+ vectorId: QualifiedName;
98
+ }
99
+ /**
100
+ * Replay every interaction lane from an independent copy of the same initial
101
+ * state. The adapter owns browser automation; this runner owns fixture
102
+ * isolation and deterministic observation comparison.
103
+ */
104
+ export declare function runAuthoringWebVector(vector: Readonly<AuthoringWebVector>, adapter: Readonly<AuthoringWebConformanceAdapter>): Promise<AuthoringWebVectorResult>;
105
+ //# sourceMappingURL=web-conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-conformance.d.ts","sourceRoot":"","sources":["../src/web-conformance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAC5B,QAAQ,GAAG,iBAAiB,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAE9F,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,GACpE;IACE,GAAG,EACC,WAAW,GACX,WAAW,GACX,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,KAAK,GACL,GAAG,GACH,GAAG,GACH,GAAG,CAAC;IACR,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IACpD,MAAM,EAAE,kBAAkB,CAAC;CAC5B,GACD;IACE,WAAW,EAAE;QAAE,YAAY,CAAC,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAA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E,OAAO,CAAC;IAChB,OAAO,EAAE,8BAA8B,CAAC;IACxC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EACpC,OAAO,EAAE,QAAQ,CAAC,8BAA8B,CAAC,GAChD,OAAO,CAAC,wBAAwB,CAAC,CAkCnC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Replay every interaction lane from an independent copy of the same initial
3
+ * state. The adapter owns browser automation; this runner owns fixture
4
+ * isolation and deterministic observation comparison.
5
+ */
6
+ export async function runAuthoringWebVector(vector, adapter) {
7
+ const pristine = stableJson(vector);
8
+ const lanes = [];
9
+ for (const lane of vector.lanes) {
10
+ const session = await adapter.open(cloneJson(vector.given), cloneJson(lane));
11
+ let observation;
12
+ try {
13
+ for (const action of lane.steps) {
14
+ await session.perform(cloneJson(action));
15
+ }
16
+ observation = cloneJson(await session.observe());
17
+ }
18
+ finally {
19
+ await session.dispose?.();
20
+ }
21
+ const mismatches = compareAuthoringObservation(observation, vector.expect);
22
+ if (stableJson(vector) !== pristine) {
23
+ mismatches.push('adapter mutated the conformance vector');
24
+ }
25
+ lanes.push({
26
+ mismatches,
27
+ name: lane.name,
28
+ observation,
29
+ passed: mismatches.length === 0,
30
+ surface: lane.surface,
31
+ });
32
+ }
33
+ return {
34
+ lanes,
35
+ passed: lanes.every((lane) => lane.passed),
36
+ profile: 'studio.profile/authoring-web',
37
+ vectorId: vector.id,
38
+ };
39
+ }
40
+ function compareAuthoringObservation(actual, expected) {
41
+ const mismatches = [];
42
+ compareExact(mismatches, 'announcements', actual.announcements, expected.announcements);
43
+ compareExact(mismatches, 'commands', actual.commands, expected.commands);
44
+ compareExact(mismatches, 'dirty', actual.dirty, expected.dirty);
45
+ compareExact(mismatches, 'document', actual.document, expected.document);
46
+ compareExact(mismatches, 'focus', actual.focus, expected.focus);
47
+ compareExact(mismatches, 'selection', actual.selection, expected.selection);
48
+ return mismatches;
49
+ }
50
+ function compareExact(mismatches, field, actual, expected) {
51
+ if (stableJson(actual) !== stableJson(expected)) {
52
+ mismatches.push(`${field} differs from the vector expectation`);
53
+ }
54
+ }
55
+ function cloneJson(value) {
56
+ return JSON.parse(JSON.stringify(value));
57
+ }
58
+ function stableJson(value) {
59
+ return JSON.stringify(sortJson(value)) ?? 'undefined';
60
+ }
61
+ function sortJson(value) {
62
+ if (Array.isArray(value)) {
63
+ return value.map((member) => sortJson(member));
64
+ }
65
+ if (value !== null && typeof value === 'object') {
66
+ return Object.fromEntries(Object.entries(value)
67
+ .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
68
+ .map(([key, member]) => [key, sortJson(member)]));
69
+ }
70
+ return value;
71
+ }
72
+ //# sourceMappingURL=web-conformance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-conformance.js","sourceRoot":"","sources":["../src/web-conformance.ts"],"names":[],"mappings":"AAwHA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAoC,EACpC,OAAiD;IAEjD,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,KAAK,GAA6B,EAAE,CAAC;IAE3C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7E,IAAI,WAAoC,CAAC;QACzC,IAAI,CAAC;YACH,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAChC,MAAM,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3C,CAAC;YACD,WAAW,GAAG,SAAS,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,CAA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