@nativemason/contracts 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +4 -2
- package/dist/accessibility.d.ts +194 -0
- package/dist/accessibility.js +21 -0
- package/dist/constraints.d.ts +804 -0
- package/dist/constraints.js +16 -0
- package/dist/design.d.ts +1652 -0
- package/dist/design.js +29 -0
- package/dist/diagnostics.d.ts +3395 -0
- package/dist/diagnostics.js +35 -0
- package/dist/evidence.d.ts +10431 -0
- package/dist/evidence.js +44 -0
- package/dist/geometry.d.ts +122 -0
- package/dist/geometry.js +4 -0
- package/dist/graph.d.ts +1916 -0
- package/dist/graph.js +36 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/native-protocol.d.ts +1726 -0
- package/dist/native-protocol.js +11 -0
- package/dist/source.d.ts +221 -0
- package/dist/source.js +17 -0
- package/dist/styles.d.ts +249 -0
- package/dist/styles.js +3 -0
- package/dist/tools.d.ts +45345 -0
- package/dist/tools.js +53 -0
- package/dist/workflow.d.ts +2391 -0
- package/dist/workflow.js +18 -0
- package/package.json +33 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DeviceProfileSchema } from './geometry.js';
|
|
3
|
+
import { ConstraintResultSchema } from './constraints.js';
|
|
4
|
+
import { BridgeErrorSchema } from './source.js';
|
|
5
|
+
import { SpatialSnapshotSchema } from './graph.js';
|
|
6
|
+
import { ScenarioScriptSchema } from './workflow.js';
|
|
7
|
+
/** Browser trials across explicit device profiles; native acceptance remains separate. */
|
|
8
|
+
export const SuggestionProfileSchema = z.object({ id: z.string().min(1), profile: DeviceProfileSchema, script: ScenarioScriptSchema.optional() }).strict();
|
|
9
|
+
export const SuggestionProfilesSchema = z.array(SuggestionProfileSchema).min(1).max(6).refine(profiles => new Set(profiles.map(profile => profile.id)).size === profiles.length && !profiles.some(profile => profile.id === 'baseline'), 'Profile IDs must be unique; baseline is reserved');
|
|
10
|
+
export const SuggestionProfileEvidenceSchema = z.object({
|
|
11
|
+
profileId: z.string(), platform: z.literal('web'), profile: DeviceProfileSchema, scenarioState: z.enum(['baseline', 'scripted', 'initial']).optional(),
|
|
12
|
+
status: z.enum(['passed', 'failed', 'unsupported', 'unavailable']),
|
|
13
|
+
snapshotId: z.string().optional(), results: z.array(ConstraintResultSchema),
|
|
14
|
+
regressions: z.number().int().nonnegative(), warnings: z.number().int().nonnegative(),
|
|
15
|
+
error: BridgeErrorSchema.optional(),
|
|
16
|
+
}).strict();
|
|
17
|
+
/** Fresh native baseline seeds proposals only; candidates are still browser trials. */
|
|
18
|
+
export const NativeSuggestionEvidenceSchema = z.object({
|
|
19
|
+
status: z.enum(['captured', 'unsupported', 'unavailable']), snapshot: SpatialSnapshotSchema.optional(),
|
|
20
|
+
results: z.array(ConstraintResultSchema), error: BridgeErrorSchema.optional(),
|
|
21
|
+
}).strict().superRefine((value, ctx) => {
|
|
22
|
+
if (value.status === 'captured' && (!value.snapshot || value.snapshot.platform === 'web'))
|
|
23
|
+
ctx.addIssue({ code: 'custom', message: 'Captured native evidence requires a native snapshot' });
|
|
24
|
+
if (value.status !== 'captured' && value.snapshot)
|
|
25
|
+
ctx.addIssue({ code: 'custom', message: 'Unavailable native evidence cannot contain a snapshot' });
|
|
26
|
+
});
|
|
27
|
+
/** Required callback interaction evidence, checked again after reload and on native. */
|
|
28
|
+
export const InteractionRequirementSchema = z.object({ elementId: z.string().min(1), pressed: z.boolean() }).strict();
|
|
29
|
+
/** Bounded native-driver failure output; a failed process is never acceptance evidence. */
|
|
30
|
+
export const NativeScenarioFailureEvidenceSchema = z.object({
|
|
31
|
+
driver: z.literal('maestro'), message: z.string().max(2048),
|
|
32
|
+
exitCode: z.union([z.number().int(), z.string().min(1).max(64), z.null()]),
|
|
33
|
+
signal: z.string().max(64).nullable(), terminated: z.boolean(),
|
|
34
|
+
stdout: z.string().max(16384), stderr: z.string().max(16384), outputTruncated: z.boolean(),
|
|
35
|
+
}).strict();
|