@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.
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { SourceRefSchema, EditPlanSchema } from './source.js';
3
+ import { RnStylePatchSchema } from './styles.js';
4
+ export const LayoutMutationSchema = z.object({ elementId: z.string().min(1), patch: RnStylePatchSchema }).strict();
5
+ export const EditScopeSchema = z.object({ kind: z.enum(['local', 'branch', 'shared', 'nativewind', 'pressable-state']), branch: z.enum(['consequent', 'alternate']).optional(), state: z.enum(['pressed', 'rest']).optional(), acknowledgeInstances: z.boolean().optional() }).strict().refine(scope => (scope.kind === 'pressable-state') === (scope.state !== undefined), 'Pressable-state scope requires a state; other scopes do not accept state');
6
+ export const SharedConsumerSchema = z.object({ source: SourceRefSchema, mountedIds: z.array(z.string()), requiredScenarios: z.array(z.string()) }).strict();
7
+ export const BlastRadiusSchema = z.object({ consumers: z.array(SharedConsumerSchema), unresolvedReferences: z.array(z.string()) }).strict();
8
+ export const SourceMutationSchema = z.object({ source: SourceRefSchema, patch: RnStylePatchSchema, scope: EditScopeSchema.optional() }).strict();
9
+ export const TransactionPlanSchema = z.object({ intentId: z.string().min(1).optional(), files: z.array(EditPlanSchema).min(1), blastRadius: BlastRadiusSchema }).strict();
10
+ export const TransactionReceiptSchema = z.object({ commitId: z.string(), files: z.array(z.object({ path: z.string(), oldHash: z.string(), newHash: z.string(), diff: z.string() }).strict()).min(1), nativeStatus: z.enum(['pending', 'passed', 'failed']), revertsCommitId: z.string().optional() }).strict();
11
+ export const TextFitEvidenceSchema = z.object({ status: z.enum(['supported', 'unavailable']), fullLineCount: z.number().int().nonnegative().optional(), limitedLineCount: z.number().int().nonnegative().optional(), fullHeight: z.number().nonnegative().optional(), availableHeight: z.number().nonnegative().optional(), reason: z.string().optional() }).strict();
12
+ export const NativeTargetSchema = z.object({ targetId: z.string().min(1), platform: z.enum(['android', 'ios']), kind: z.enum(['physical', 'emulator', 'simulator']) }).strict();
13
+ export const SuggestionCandidateSchema = z.object({ mutations: z.array(LayoutMutationSchema), reason: z.string(), constraintIds: z.array(z.string()) }).strict();
14
+ export const InferenceOptionsSchema = z.object({ tolerance: z.number().nonnegative().optional(), includeRectangles: z.boolean().optional() }).strict();
15
+ export const RuleFindingSchema = z.object({ code: z.string(), severity: z.enum(['advisory', 'confirmed', 'unavailable']), elementIds: z.array(z.string()), message: z.string() }).strict();
16
+ export const ScenarioActionSchema = z.discriminatedUnion('type', [z.object({ type: z.literal('navigate'), url: z.string() }), z.object({ type: z.literal('tap'), elementId: z.string() }), z.object({ type: z.literal('press'), elementId: z.string(), phase: z.enum(['down', 'up']) }), z.object({ type: z.literal('input'), elementId: z.string(), text: z.string(), mode: z.enum(['replace', 'append']).default('replace') }), z.object({ type: z.literal('swipe'), elementId: z.string(), direction: z.enum(['UP', 'DOWN', 'LEFT', 'RIGHT']) }), z.object({ type: z.literal('scroll'), elementId: z.string(), x: z.number(), y: z.number() }), z.object({ type: z.literal('keyboard'), visible: z.boolean() }), z.object({ type: z.literal('wait'), elementId: z.string(), timeoutMs: z.number().positive().max(30000).default(5000) }), z.object({ type: z.literal('hook'), name: z.string(), value: z.unknown().optional() })]);
17
+ export const ScenarioScriptSchema = z.object({ scenarioId: z.string(), reset: z.array(ScenarioActionSchema), actions: z.array(ScenarioActionSchema) }).strict();
18
+ export const MatrixCellSchema = z.object({ targetId: z.string(), scenarioId: z.string(), orientation: z.enum(['portrait', 'landscape']), fontScale: z.number().positive(), status: z.enum(['passed', 'failed', 'unsupported', 'unavailable']), snapshotId: z.string().optional(), message: z.string().optional() }).strict();
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@nativemason/contracts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "default": "./dist/index.js"
9
+ }
10
+ },
11
+ "scripts": {
12
+ "build": "tsc -p tsconfig.build.json"
13
+ },
14
+ "dependencies": {
15
+ "zod": "^3.25.76"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "files": [
19
+ "dist",
20
+ "bin",
21
+ "LICENSE",
22
+ "README.md"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/gauravsaini/nativemason.git",
27
+ "directory": "packages/contracts"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "provenance": true
32
+ },
33
+ "devDependencies": {
34
+ "typescript": "^5.9.3"
35
+ }
6
36
  }