@kumwe/studio-testkit 0.1.0-alpha.7 → 0.1.0-beta.2
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 +122 -23
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/conformance/authoring-web/non-drag-move-equivalence.json +199 -0
- package/conformance/renderer-web/blob-default-deny.json +62 -0
- package/conformance/renderer-web/chart-fallback.json +54 -0
- package/conformance/renderer-web/complete-catalog.json +649 -0
- package/conformance/renderer-web/escaped-heading.json +43 -0
- package/conformance/renderer-web/interactive-behaviors.json +284 -0
- package/conformance/renderer-web/presentation-capabilities.json +104 -0
- package/conformance/renderer-web/responsive-grid.json +48 -0
- package/conformance/renderer-web/security-fallbacks.json +184 -0
- package/conformance/rich-text/advanced.first-party.json +67 -0
- package/corpus-manifest.json +571 -37
- package/dist/contextual-conformance.d.ts +81 -0
- package/dist/contextual-conformance.d.ts.map +1 -0
- package/dist/contextual-conformance.js +1 -0
- package/dist/host-testbed.d.ts +68 -5
- package/dist/host-testbed.d.ts.map +1 -1
- package/dist/host-testbed.js +1 -547
- package/dist/http-authoring-contract.d.ts +3 -0
- package/dist/http-authoring-contract.d.ts.map +1 -0
- package/dist/http-authoring-contract.js +1 -0
- package/dist/http-host-adapter.d.ts +12 -64
- package/dist/http-host-adapter.d.ts.map +1 -1
- package/dist/http-host-adapter.js +1 -256
- package/dist/http-host-responder.d.ts +58 -0
- package/dist/http-host-responder.d.ts.map +1 -0
- package/dist/http-host-responder.js +1 -0
- package/dist/index.d.ts +88 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -140
- package/dist/web-conformance.d.ts +112 -0
- package/dist/web-conformance.d.ts.map +1 -0
- package/dist/web-conformance.js +1 -0
- package/fixtures/authoring-message-catalog.en.json +1093 -0
- package/fixtures/authoring-save.plan.example.json +48 -0
- package/fixtures/authoring-session.example.json +212 -0
- package/fixtures/authoring-target.example.json +34 -0
- package/fixtures/host-capabilities.example.json +2 -2
- package/fixtures/host-operations.example.json +77 -0
- package/fixtures/plugin.example.json +12 -0
- package/fixtures/preview.render.example.json +1 -0
- package/fixtures/reusable-content-type.example.json +26 -0
- package/fixtures/studio-config.example.json +3 -3
- package/fixtures/studio-deployment.hosted.example.json +152 -0
- package/fixtures/studio-deployment.standalone.example.json +9 -0
- package/invalid/authoring-save.plan-missing-coordinates.json +16 -0
- package/invalid/authoring-save.plan-missing-successor-context.json +28 -0
- package/invalid/authoring-save.request-plan-missing-successor-context.json +26 -0
- package/invalid/authoring-session.missing-entry-state.json +9 -0
- package/invalid/authoring-target.missing-resource-types.json +24 -0
- package/invalid/binding-projection-vector.unknown-status.json +85 -0
- package/invalid/host-capabilities.invalid-protocol-version.json +1 -1
- package/invalid/host-error.retry-delay-without-retry.json +16 -0
- package/invalid/host-error.retry-delay-wrong-category.json +16 -0
- package/invalid/host-error.revision-without-conflict.json +16 -0
- package/invalid/host-sequence.pending-expectation.json +52 -0
- package/invalid/host-sequence.preview-render-missing-request-id.json +50 -0
- package/invalid/preview-message.activated-unknown-interaction.json +1 -1
- package/invalid/preview-message.duplicate-marker.json +24 -0
- package/invalid/preview-message.invalid-digest.json +1 -0
- package/invalid/preview-message.invalid-marker-grammar.json +19 -0
- package/invalid/preview-message.missing-marker-map.json +20 -0
- package/invalid/preview-message.missing-render-request-id.json +18 -0
- package/invalid/preview-message.unknown-type.json +13 -0
- package/invalid/preview-message.viewport-height-too-small.json +13 -0
- package/invalid/preview-message.viewport-unsafe-role.json +13 -0
- package/invalid/reusable-content-type.entry-values.json +32 -0
- package/invalid/studio-chart.script-config.json +10 -0
- package/invalid/studio-deployment.long-lived-token.json +24 -0
- package/invalid/studio-deployment.missing-required.json +5 -0
- package/invalid/studio-deployment.unknown-member.json +15 -0
- package/invalid/studio-drawing.svg-payload.json +10 -0
- package/invalid/studio-money.float.json +8 -0
- package/invalid/studio-presentation.css-injection.json +8 -0
- package/invalid/studio-table.html-cell.json +8 -0
- package/package.json +8 -4
- package/studio-release.json +35 -0
- package/vectors/authoring-http/transport-matrix.json +237 -0
- package/vectors/binding-projection/app-content-fields.resolved.json +286 -0
- package/vectors/binding-projection/field-removed.diagnostic.json +135 -0
- package/vectors/binding-projection/model-revision-mismatch.diagnostic.json +124 -0
- package/vectors/host/artifact.dependencies.result.json +2 -2
- package/vectors/host/artifact.load.stored.json +2 -2
- package/vectors/host/artifact.load.unknown.error.json +2 -2
- package/vectors/host/artifact.publish.accepted.json +2 -2
- package/vectors/host/artifact.publish.forbidden.error.json +1 -1
- package/vectors/host/artifact.publish.stale.error.json +2 -2
- package/vectors/host/artifact.save.accepted.json +2 -2
- package/vectors/host/artifact.save.forbidden.error.json +1 -1
- package/vectors/host/artifact.save.stale.error.json +2 -2
- package/vectors/host/artifact.unpublish.stale.error.json +2 -2
- package/vectors/host/envelope.malformed-context.error.json +2 -2
- package/vectors/host/envelope.protocol-version.error.json +1 -1
- package/vectors/host/envelope.stale-generation.error.json +2 -2
- package/vectors/host/localization.messages.unknown-locale.error.json +2 -2
- package/vectors/host/media.abort-upload.unknown.error.json +1 -1
- package/vectors/host/media.authorize-upload.granted.json +1 -1
- package/vectors/host/media.authorize-upload.path-filename.error.json +1 -1
- package/vectors/host/media.authorize-upload.too-large.error.json +1 -1
- package/vectors/host/media.complete-upload.unknown.error.json +1 -1
- package/vectors/host/media.get.unknown.json +2 -2
- package/vectors/host/media.import-external.private-host.error.json +1 -1
- package/vectors/host/media.list.cursor.error.json +2 -2
- package/vectors/host/media.list.limit.error.json +2 -2
- package/vectors/host/media.upload-status.unknown.error.json +1 -1
- package/vectors/host/model.get.stored.json +37 -0
- package/vectors/host/model.list.authorized.json +31 -0
- package/vectors/host/permission.explain.withheld.json +2 -2
- package/vectors/host/permission.refresh.snapshot.json +2 -2
- package/vectors/host/recovery.load.absent.json +2 -2
- package/vectors/host/telemetry.emit.accepted.json +2 -2
- package/vectors/host/telemetry.emit.non-primitive.error.json +2 -2
- package/vectors/host-sequence/artifact.publish.changed-intent.sequence.json +75 -0
- package/vectors/host-sequence/artifact.publish.idempotent-replay.sequence.json +111 -0
- package/vectors/host-sequence/preview.cancel.cross-context.sequence.json +78 -0
- package/vectors/host-sequence/preview.render.cancelled.sequence.json +75 -0
- package/vectors/host-sequence/recovery.store.canonical-number.sequence.json +72 -0
- package/vectors/host-sequence/recovery.store.changed-context.sequence.json +61 -0
- package/vectors/host-sequence/recovery.store.rate-limited.sequence.json +93 -0
- package/vectors/host-sequence/recovery.store.resource-scope.sequence.json +61 -0
- package/vectors/host-sequence/recovery.store.wrong-operation-id.sequence.json +56 -0
- package/vectors/preview/canonical-preorder.json +102 -0
- package/vectors/preview/empty-draft.json +36 -0
- package/vectors/schema-profile/alternative-limit.accepted.json +95 -0
- package/vectors/schema-profile/alternative-limit.rejected.json +92 -0
- package/vectors/schema-profile/array-composition.accepted.json +35 -0
- package/vectors/schema-profile/byte-limit.accepted.json +30 -0
- package/vectors/schema-profile/byte-limit.rejected.json +26 -0
- package/vectors/schema-profile/closed-object.accepted.json +38 -0
- package/vectors/schema-profile/decimal-multiple.accepted.json +54 -0
- package/vectors/schema-profile/depth-limit.accepted.json +90 -0
- package/vectors/schema-profile/depth-limit.rejected.json +88 -0
- package/vectors/schema-profile/description-limit.accepted.json +29 -0
- package/vectors/schema-profile/description-limit.rejected.json +25 -0
- package/vectors/schema-profile/diagnostic-precedence.rejected.json +26 -0
- package/vectors/schema-profile/duplicate-dependent-required.rejected.json +21 -0
- package/vectors/schema-profile/duplicate-required.rejected.json +18 -0
- package/vectors/schema-profile/empty-combinator.rejected.json +17 -0
- package/vectors/schema-profile/empty-enum.rejected.json +17 -0
- package/vectors/schema-profile/enum-limit.accepted.json +89 -0
- package/vectors/schema-profile/enum-limit.rejected.json +84 -0
- package/vectors/schema-profile/examples-limit.accepted.json +35 -0
- package/vectors/schema-profile/examples-limit.rejected.json +31 -0
- package/vectors/schema-profile/format-keyword.rejected.json +17 -0
- package/vectors/schema-profile/forward-reference-path-precedence.rejected.json +20 -0
- package/vectors/schema-profile/invalid-pointer.rejected.json +18 -0
- package/vectors/schema-profile/json-depth-limit.accepted.json +278 -0
- package/vectors/schema-profile/json-depth-limit.rejected.json +276 -0
- package/vectors/schema-profile/json-item-limit.accepted.json +686 -0
- package/vectors/schema-profile/json-item-limit.rejected.json +682 -0
- package/vectors/schema-profile/json-property-limit.accepted.json +1031 -0
- package/vectors/schema-profile/json-property-limit.rejected.json +1028 -0
- package/vectors/schema-profile/local-reference.accepted.json +28 -0
- package/vectors/schema-profile/memoized-diagnostic.accepted.json +31 -0
- package/vectors/schema-profile/node-limit.accepted.json +1097 -0
- package/vectors/schema-profile/node-limit.rejected.json +1094 -0
- package/vectors/schema-profile/non-object-root.rejected.json +9 -0
- package/vectors/schema-profile/non-schema-reference.rejected.json +21 -0
- package/vectors/schema-profile/object-key-limit.accepted.json +32 -0
- package/vectors/schema-profile/object-key-limit.rejected.json +28 -0
- package/vectors/schema-profile/open-root.rejected.json +13 -0
- package/vectors/schema-profile/percent-encoded-pointer.rejected.json +26 -0
- package/vectors/schema-profile/property-name-limit.accepted.json +543 -0
- package/vectors/schema-profile/property-name-limit.rejected.json +536 -0
- package/vectors/schema-profile/recursive-diagnostic-precedence.rejected.json +30 -0
- package/vectors/schema-profile/recursive-reference.rejected.json +24 -0
- package/vectors/schema-profile/reference-fanout.accepted.json +662 -0
- package/vectors/schema-profile/reference-length-limit.accepted.json +45 -0
- package/vectors/schema-profile/reference-length-limit.rejected.json +39 -0
- package/vectors/schema-profile/reference-limit.accepted.json +416 -0
- package/vectors/schema-profile/reference-limit.rejected.json +415 -0
- package/vectors/schema-profile/reference-vs-keyword-precedence.rejected.json +22 -0
- package/vectors/schema-profile/reserved-pointer.rejected.json +26 -0
- package/vectors/schema-profile/root-diagnostic-precedence.rejected.json +16 -0
- package/vectors/schema-profile/root-vs-reference-precedence.rejected.json +19 -0
- package/vectors/schema-profile/schema-map-limit.accepted.json +539 -0
- package/vectors/schema-profile/schema-map-limit.rejected.json +536 -0
- package/vectors/schema-profile/semantic-recursion-precedence.rejected.json +21 -0
- package/vectors/schema-profile/semantic-reference-precedence.rejected.json +21 -0
- package/vectors/schema-profile/title-limit.accepted.json +29 -0
- package/vectors/schema-profile/title-limit.rejected.json +25 -0
- package/vectors/schema-profile/unresolved-reference.rejected.json +17 -0
- package/vectors/schema-profile/unsafe-dependent-required.rejected.json +24 -0
- package/vectors/schema-profile/unsafe-member.rejected.json +17 -0
- package/vectors/schema-profile/unsafe-required.rejected.json +17 -0
- package/dist/host-testbed.js.map +0 -1
- package/dist/http-host-adapter.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,140 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export { createHostRequestContextFixture, createTestbedHost, TestbedHostError, } from './host-testbed.js';
|
|
4
|
-
export { createHttpHostAdapter, } from './http-host-adapter.js';
|
|
5
|
-
export function createBlueprintFixture(options = {}) {
|
|
6
|
-
return {
|
|
7
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
8
|
-
dependencyLock: {
|
|
9
|
-
blocks: cloneValue(options.blockLocks ?? []),
|
|
10
|
-
theme: { id: 'studio.test/theme', revision: 'theme-r1', version: '1.0.0' },
|
|
11
|
-
},
|
|
12
|
-
id: options.id ?? 'test.blueprint',
|
|
13
|
-
kind: 'blueprint',
|
|
14
|
-
label: { defaultMessage: 'Test Blueprint', key: 'studio.test/blueprint' },
|
|
15
|
-
model: { id: 'studio.test/model', revision: 'model-r1', version: '1.0.0' },
|
|
16
|
-
owner: { id: 'studio.test/testkit', version: '0.1.0-alpha.0' },
|
|
17
|
-
revision: options.revision ?? 'blueprint-r1',
|
|
18
|
-
roots: cloneValue(options.roots ?? []),
|
|
19
|
-
status: 'draft',
|
|
20
|
-
version: '1.0.0',
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export function defineTestBlock(options) {
|
|
24
|
-
const label = options.label ?? 'Test block';
|
|
25
|
-
return {
|
|
26
|
-
accessibility: {
|
|
27
|
-
accessibleName: 'not-applicable',
|
|
28
|
-
category: 'structural',
|
|
29
|
-
keyboard: { defaultMessage: 'Use outline commands.', key: 'studio.test/block-keyboard' },
|
|
30
|
-
outputChecks: ['studio.check/test-block'],
|
|
31
|
-
reducedMotion: 'not-applicable',
|
|
32
|
-
},
|
|
33
|
-
category: 'studio.category/test',
|
|
34
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
35
|
-
editingModes: ['blueprint', 'content'],
|
|
36
|
-
kind: 'block-definition',
|
|
37
|
-
label: { defaultMessage: label, key: 'studio.test/block-label' },
|
|
38
|
-
owner: { id: 'studio.test/testkit', version: '0.1.0-alpha.0' },
|
|
39
|
-
ports: [],
|
|
40
|
-
propertySchema: cloneValue(options.propertySchema ?? { type: 'object' }),
|
|
41
|
-
rendererRequirements: [
|
|
42
|
-
{ capability: 'studio.renderer/test', surface: 'preview', versions: '^0.1.0' },
|
|
43
|
-
],
|
|
44
|
-
revision: 'block-r1',
|
|
45
|
-
slots: cloneValue(options.slots ?? []),
|
|
46
|
-
themeControls: [],
|
|
47
|
-
type: options.type,
|
|
48
|
-
version: options.version ?? '1.0.0',
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export function createStudioConfigurationFixture(options = {}) {
|
|
52
|
-
return {
|
|
53
|
-
actor: { displayName: 'Test Author', id: 'users/test-author' },
|
|
54
|
-
artifacts: {},
|
|
55
|
-
blocks: [],
|
|
56
|
-
composite: options.composite ?? 'single',
|
|
57
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
58
|
-
displayPreferences: {
|
|
59
|
-
calendar: 'gregory',
|
|
60
|
-
hourCycle: 'h23',
|
|
61
|
-
measurementSystem: 'metric',
|
|
62
|
-
numberingSystem: 'latn',
|
|
63
|
-
},
|
|
64
|
-
features: {
|
|
65
|
-
clipboardMediaUpload: false,
|
|
66
|
-
collaboration: false,
|
|
67
|
-
customInspectors: false,
|
|
68
|
-
executablePlugins: false,
|
|
69
|
-
externalMediaImport: false,
|
|
70
|
-
offlineRecovery: false,
|
|
71
|
-
},
|
|
72
|
-
hostCapabilities: {
|
|
73
|
-
capabilities: [],
|
|
74
|
-
contractVersion: STUDIO_CONTRACT_VERSION,
|
|
75
|
-
host: { generation: 'host-r1', id: 'studio.test/host', version: '1.0.0' },
|
|
76
|
-
kind: 'host-capabilities',
|
|
77
|
-
ports: [],
|
|
78
|
-
protocolVersions: [STUDIO_WIRE_PROTOCOL_VERSION],
|
|
79
|
-
},
|
|
80
|
-
limits: {
|
|
81
|
-
maxChildrenPerSlot: 1_000,
|
|
82
|
-
maxCommandBatch: 100,
|
|
83
|
-
maxContributionsPerPlugin: 500,
|
|
84
|
-
maxDepth: 32,
|
|
85
|
-
maxExtensionBytes: 1_048_576,
|
|
86
|
-
maxHistoryEntries: 100,
|
|
87
|
-
maxLocaleBytes: 1_048_576,
|
|
88
|
-
maxMediaBatch: 50,
|
|
89
|
-
maxMediaUploadBytes: 1_073_741_824,
|
|
90
|
-
maxNodes: 5_000,
|
|
91
|
-
maxPluginCount: 20,
|
|
92
|
-
maxPreviewBytes: 10_485_760,
|
|
93
|
-
maxPreviewRequestsPerMinute: 120,
|
|
94
|
-
maxPropertyBytes: 1_048_576,
|
|
95
|
-
maxRichTextBytes: 1_048_576,
|
|
96
|
-
maxRichTextDepth: 32,
|
|
97
|
-
maxSlotsPerNode: 20,
|
|
98
|
-
},
|
|
99
|
-
locale: {
|
|
100
|
-
direction: 'ltr',
|
|
101
|
-
fallbacks: [],
|
|
102
|
-
requested: 'en',
|
|
103
|
-
resolved: 'en',
|
|
104
|
-
timeZone: 'UTC',
|
|
105
|
-
},
|
|
106
|
-
mode: options.mode ?? 'blueprint',
|
|
107
|
-
permissions: [],
|
|
108
|
-
plugins: [],
|
|
109
|
-
protocolVersion: STUDIO_WIRE_PROTOCOL_VERSION,
|
|
110
|
-
preview: { allowApproximateRenderer: false, enabled: false, sameOriginRequired: true },
|
|
111
|
-
sessionGeneration: 'session-r1',
|
|
112
|
-
sessionId: 'session-test',
|
|
113
|
-
sessionState: options.sessionState ?? 'editable',
|
|
114
|
-
resourceContext: {
|
|
115
|
-
key: 'contexts/test',
|
|
116
|
-
scopes: [],
|
|
117
|
-
surface: 'studio.test/fixture',
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
export function assertBlueprintConforms(blueprint, definitions) {
|
|
122
|
-
const result = validateBlueprint(blueprint, new BlockRegistry(definitions));
|
|
123
|
-
if (!result.valid) {
|
|
124
|
-
throw new StudioConformanceError(result.diagnostics);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
export class StudioConformanceError extends Error {
|
|
128
|
-
diagnostics;
|
|
129
|
-
constructor(diagnostics) {
|
|
130
|
-
super(diagnostics
|
|
131
|
-
.map((entry) => `${entry.code}: ${entry.message.defaultMessage ?? entry.message.key}`)
|
|
132
|
-
.join('\n'));
|
|
133
|
-
this.name = 'StudioConformanceError';
|
|
134
|
-
this.diagnostics = cloneValue(diagnostics);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function cloneValue(value) {
|
|
138
|
-
return JSON.parse(JSON.stringify(value));
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{BlockRegistry as e,compileStudioPropertySchema as t,projectBlueprintFieldBindings as n,StudioSchemaProfileError as r,validateBlueprint as i}from"@kumwe/studio-core";import{STUDIO_CONTRACT_VERSION as a,STUDIO_WIRE_PROTOCOL_VERSION as o}from"@kumwe/studio-protocol";export{createHostRequestContextFixture,createTestbedHost,TestbedHostError}from"./host-testbed.js";export{createHttpHostAdapter,HTTP_HOST_OPERATION_ROUTES}from"./http-host-adapter.js";export{AUTHORING_HTTP_OPERATIONS,AUTHORING_HTTP_OPERATIONS_BY_ROUTE,AUTHORING_HTTP_SCHEMA_ID}from"./http-authoring-contract.js";export{createAuthoringHttpResponder}from"./http-host-responder.js";export{runAuthoringWebVector}from"./web-conformance.js";export{runContextualAuthoringStrideVector}from"./contextual-conformance.js";export function runBindingProjectionVector(e){let t=n(e.blueprint,e.model,e.blockDefinitions);return s({diagnostics:t.diagnostics.map(e=>({code:e.code,...e.location===void 0?{}:{location:e.location},severity:e.severity})),model:t.model,nodes:t.nodes.map(e=>({nodeId:e.nodeId,ports:e.ports.map(e=>({...e.binding===void 0?{}:{bindingSourceKind:e.binding.source.kind},...e.boundFieldPath===void 0?{}:{boundFieldPath:[...e.boundFieldPath]},candidates:e.candidates.map(e=>({cardinality:e.cardinality,...e.control===void 0?{}:{control:e.control},fieldPath:[...e.fieldPath],...e.itemKind===void 0?{}:{itemKind:e.itemKind},kind:e.kind})),...e.multiple===void 0?{}:{multiple:e.multiple},port:e.port,...e.required===void 0?{}:{required:e.required},status:e.status,...e.valueType===void 0?{}:{valueType:e.valueType}}))}))})}export function runSchemaProfileVector(e){try{let n=t(e.schema);return{instances:(e.expect.instances??[]).map(e=>{let t=n.validate(e.value),r=n.errors?.[0];return{...r===void 0?{}:{diagnostic:{instancePath:r.instancePath,keyword:r.keyword}},valid:t,value:e.value}}),outcome:`accepted`}}catch(e){if(e instanceof r)return{code:e.code,outcome:`rejected`,schemaPath:e.schemaPath};throw e}}export function createBlueprintFixture(e={}){return{contractVersion:a,dependencyLock:{blocks:s(e.blockLocks??[]),theme:{id:`studio.test/theme`,revision:`theme-r1`,version:`1.0.0`}},id:e.id??`test.blueprint`,kind:`blueprint`,label:{defaultMessage:`Test Blueprint`,key:`studio.test/blueprint`},model:{id:`studio.test/model`,revision:`model-r1`,version:`1.0.0`},owner:{id:`studio.test/testkit`,version:`0.1.0-alpha.0`},revision:e.revision??`blueprint-r1`,roots:s(e.roots??[]),status:`draft`,version:`1.0.0`}}export function defineTestBlock(e){let t=e.label??`Test block`;return{accessibility:{accessibleName:`not-applicable`,category:`structural`,keyboard:{defaultMessage:`Use outline commands.`,key:`studio.test/block-keyboard`},outputChecks:[`studio.check/test-block`],reducedMotion:`not-applicable`},category:`studio.category/test`,contractVersion:a,editingModes:[`blueprint`,`content`],kind:`block-definition`,label:{defaultMessage:t,key:`studio.test/block-label`},owner:{id:`studio.test/testkit`,version:`0.1.0-alpha.0`},ports:[],propertySchema:s(e.propertySchema??{additionalProperties:!1,type:`object`}),rendererRequirements:[{capability:`studio.renderer/test`,surface:`preview`,versions:`^0.1.0`}],revision:`block-r1`,slots:s(e.slots??[]),themeControls:[],type:e.type,version:e.version??`1.0.0`}}export function createStudioConfigurationFixture(e={}){return{actor:{displayName:`Test Author`,id:`users/test-author`},artifacts:{},blocks:[],composite:e.composite??`single`,contractVersion:a,displayPreferences:{calendar:`gregory`,hourCycle:`h23`,measurementSystem:`metric`,numberingSystem:`latn`},features:{clipboardMediaUpload:!1,collaboration:!1,customInspectors:!1,executablePlugins:!1,externalMediaImport:!1,offlineRecovery:!1},hostCapabilities:{capabilities:[],contractVersion:a,host:{generation:`host-r1`,id:`studio.test/host`,version:`1.0.0`},kind:`host-capabilities`,ports:[],protocolVersions:[o]},limits:{maxChildrenPerSlot:1e3,maxCommandBatch:100,maxContributionsPerPlugin:500,maxDepth:32,maxExtensionBytes:1048576,maxHistoryEntries:100,maxLocaleBytes:1048576,maxMediaBatch:50,maxMediaUploadBytes:1073741824,maxNodes:5e3,maxPluginCount:20,maxPreviewBytes:10485760,maxPreviewRequestsPerMinute:120,maxPropertyBytes:1048576,maxRichTextBytes:1048576,maxRichTextDepth:32,maxSlotsPerNode:20},locale:{direction:`ltr`,fallbacks:[],requested:`en`,resolved:`en`,timeZone:`UTC`},mode:e.mode??`blueprint`,permissions:[],plugins:[],protocolVersion:o,preview:{allowApproximateRenderer:!1,enabled:!1,sameOriginRequired:!0},sessionGeneration:`session-r1`,sessionId:`session-test`,sessionState:e.sessionState??`editable`,resourceContext:{key:`contexts/test`,scopes:[],surface:`studio.test/fixture`}}}export function assertBlueprintConforms(t,n){let r=i(t,new e(n));if(!r.valid)throw new StudioConformanceError(r.diagnostics)}export class StudioConformanceError extends Error{diagnostics;constructor(e){super(e.map(e=>`${e.code}: ${e.message.defaultMessage??e.message.key}`).join(`
|
|
2
|
+
`)),this.name=`StudioConformanceError`,this.diagnostics=s(e)}}function s(e){return JSON.parse(JSON.stringify(e))}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
/**
|
|
95
|
+
* Blueprint interaction vectors are one executable part of authoring-web,
|
|
96
|
+
* not a claim that the complete contextual product profile has passed.
|
|
97
|
+
*/
|
|
98
|
+
completeProfile: false;
|
|
99
|
+
lanes: AuthoringWebLaneResult[];
|
|
100
|
+
mismatches: string[];
|
|
101
|
+
passed: boolean;
|
|
102
|
+
profile: 'studio.profile/authoring-web';
|
|
103
|
+
requirements: string[];
|
|
104
|
+
vectorId: QualifiedName;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Replay every interaction lane from an independent copy of the same initial
|
|
108
|
+
* state. The adapter owns browser automation; this runner owns fixture
|
|
109
|
+
* isolation and deterministic observation comparison.
|
|
110
|
+
*/
|
|
111
|
+
export declare function runAuthoringWebVector(vector: Readonly<AuthoringWebVector>, adapter: Readonly<AuthoringWebConformanceAdapter>): Promise<AuthoringWebVectorResult>;
|
|
112
|
+
//# 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;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QAAQ,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACrE;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,CACF,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAC/B,OAAO,CAAC,8BAA8B,CAAC,GAAG,8BAA8B,CAAC;CAC7E;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,eAAe,EAAE,KAAK,CAAC;IACvB,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,8BAA8B,CAAC;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;CACzB;AAQD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EACpC,OAAO,EAAE,QAAQ,CAAC,8BAA8B,CAAC,GAChD,OAAO,CAAC,wBAAwB,CAAC,CAsCnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Object.freeze([`keyboard`,`pointer`,`structural-control`]);export async function runAuthoringWebVector(e,t){let i=o(e),s=n(e),c=[];for(let n of e.lanes){let s=await t.open(a(e.given),a(n)),l;try{for(let e of n.steps)await s.perform(a(e));l=a(await s.observe())}finally{await s.dispose?.()}let u=r(l,e.expect);o(e)!==i&&u.push(`adapter mutated the conformance vector`),c.push({mismatches:u,name:n.name,observation:l,passed:u.length===0,surface:n.surface})}return{completeProfile:!1,lanes:c,mismatches:s,passed:s.length===0&&c.every(e=>e.passed),profile:`studio.profile/authoring-web`,requirements:[...e.requirements],vectorId:e.id}}function n(t){let n=[],r=new Set,i=new Set;for(let e of t.lanes)r.has(e.name)&&n.push(`lane name ${e.name} is duplicated`),r.add(e.name),i.add(e.surface);for(let t of e)i.has(t)||n.push(`missing ${t} interaction lane`);return n}function r(e,t){let n=[];return i(n,`announcements`,e.announcements,t.announcements),i(n,`commands`,e.commands,t.commands),i(n,`dirty`,e.dirty,t.dirty),i(n,`document`,e.document,t.document),i(n,`focus`,e.focus,t.focus),i(n,`selection`,e.selection,t.selection),n}function i(e,t,n,r){o(n)!==o(r)&&e.push(`${t} differs from the vector expectation`)}function a(e){return JSON.parse(JSON.stringify(e))}function o(e){return JSON.stringify(s(e))??`undefined`}function s(e){return Array.isArray(e)?e.map(e=>s(e)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e<t?-1:+(e>t)).map(([e,t])=>[e,s(t)])):e}
|