@@ -59,7 +59,7 @@ import ts from 'typescript';
5959import { ActionSchema as SpecActionSchema } from '@objectstack/spec/ui' ;
6060import * as crudZod from '../zod/crud.zod.js' ;
6161import * as zodBarrel from '../zod/index.zod.js' ;
62- import { ActionSchema , DetailSchema } from '../zod/crud.zod.js' ;
62+ import { CRUDActionSchema , DetailSchema } from '../zod/crud.zod.js' ;
6363import { BaseSchema } from '../zod/base.zod.js' ;
6464import { safeValidateSchema } from '../zod/index.zod.js' ;
6565import type { ActionSchema as ActionSchemaTS } from '../crud.js' ;
@@ -105,9 +105,9 @@ type Issue = { code: string; path: PropertyKey[]; message: string; expected?: st
105105const flatIssues = ( issues : Issue [ ] ) : Issue [ ] =>
106106 issues . flatMap ( ( i ) => ( i . code === 'invalid_union' && i . errors ? i . errors . flat ( ) . flatMap ( ( e ) => flatIssues ( [ e ] ) ) : [ i ] ) ) ;
107107
108- /** The lazy mirror's object shape — `ActionSchema ` is `z.lazy(() => BaseSchema.extend(…))`. */
108+ /** The lazy mirror's object shape — `CRUDActionSchema ` is `z.lazy(() => BaseSchema.extend(…))`. */
109109const actionShape = ( ) : Record < string , { description ?: string } > =>
110- ( ActionSchema as unknown as { _def : { getter : ( ) => { shape : Record < string , { description ?: string } > } } } ) . _def . getter ( ) . shape ;
110+ ( CRUDActionSchema as unknown as { _def : { getter : ( ) => { shape : Record < string , { description ?: string } > } } } ) . _def . getter ( ) . shape ;
111111
112112/* ── the Zod half: refused BY NAME, with the guidance in the message ─────── */
113113
@@ -120,7 +120,7 @@ describe.each([
120120 // .optional()`). Asserting the ENVELOPE — code, path, expected and the exact
121121 // message — so the pin cannot be satisfied by an unrelated rejection, and a
122122 // WELL-FORMED callback so it is the KEY that is refused, not its members.
123- const result = ActionSchema . safeParse ( { ...LEGACY_ACTION , [ key ] : value } ) ;
123+ const result = CRUDActionSchema . safeParse ( { ...LEGACY_ACTION , [ key ] : value } ) ;
124124 expect ( result . success , `an authored \`${ key } \` was ACCEPTED` ) . toBe ( false ) ;
125125 if ( result . success ) return ;
126126
@@ -157,7 +157,7 @@ describe.each([
157157 // exactly this acceptance, kept the callback unvalidated, and stayed green.
158158 const doc = { ...LEGACY_ACTION , [ key ] : CALLBACKS [ 0 ] [ 1 ] } ;
159159 expect ( BaseSchema . safeParse ( doc ) . success ) . toBe ( true ) ;
160- expect ( ActionSchema . safeParse ( doc ) . success ) . toBe ( false ) ;
160+ expect ( CRUDActionSchema . safeParse ( doc ) . success ) . toBe ( false ) ;
161161 } ) ;
162162
163163 it ( 'keeps the key DECLARED, with the same guidance on `.describe()` — one string, both channels' , ( ) => {
@@ -171,34 +171,34 @@ describe.each([
171171
172172describe ( 'the retirement narrows exactly `onSuccess` / `onFailure` (objectui#7068)' , ( ) => {
173173 it ( 'a legacy action WITHOUT the two keys still parses, and its values survive' , ( ) => {
174- const result = ActionSchema . safeParse ( LEGACY_ACTION ) ;
174+ const result = CRUDActionSchema . safeParse ( LEGACY_ACTION ) ;
175175 expect ( result . success ) . toBe ( true ) ;
176176 if ( ! result . success ) return ;
177177 expect ( result . data . api ) . toBe ( '/api/data' ) ;
178178 } ) ;
179179
180180 it ( 'control: the adjacent `successMessage` / `errorMessage` — NOT retired — still parse and survive' , ( ) => {
181- const result = ActionSchema . safeParse ( { ...LEGACY_ACTION , successMessage : 'Loaded' , errorMessage : 'Failed' } ) ;
181+ const result = CRUDActionSchema . safeParse ( { ...LEGACY_ACTION , successMessage : 'Loaded' , errorMessage : 'Failed' } ) ;
182182 expect ( result . success ) . toBe ( true ) ;
183183 if ( ! result . success ) return ;
184184 expect ( result . data . successMessage ) . toBe ( 'Loaded' ) ;
185185 expect ( result . data . errorMessage ) . toBe ( 'Failed' ) ;
186186 } ) ;
187187
188188 it ( 'control: the mirror did not stop validating — a wrong-typed `successMessage` is still refused' , ( ) => {
189- const result = ActionSchema . safeParse ( { ...LEGACY_ACTION , successMessage : 42 } ) ;
189+ const result = CRUDActionSchema . safeParse ( { ...LEGACY_ACTION , successMessage : 42 } ) ;
190190 expect ( result . success ) . toBe ( false ) ;
191191 if ( result . success ) return ;
192192 expect ( result . error . issues . map ( ( i ) => i . path . join ( '.' ) ) ) . toContain ( 'successMessage' ) ;
193193 } ) ;
194194
195195 it ( 'control: `chain` and `redirect` — the declared follow-up and post-action keys — still parse' , ( ) => {
196- const result = ActionSchema . safeParse ( { ...LEGACY_ACTION , chain : [ { type : 'action' , label : 'Next' } ] , redirect : '/done' } ) ;
196+ const result = CRUDActionSchema . safeParse ( { ...LEGACY_ACTION , chain : [ { type : 'action' , label : 'Next' } ] , redirect : '/done' } ) ;
197197 expect ( result . success ) . toBe ( true ) ;
198198 } ) ;
199199
200200 it ( 'an UNDECLARED key still rides `.passthrough()` — the contrast the tombstones exist for, measured live' , ( ) => {
201- const result = ActionSchema . safeParse ( { ...LEGACY_ACTION , notAKeyAtAll : 'anything' } ) ;
201+ const result = CRUDActionSchema . safeParse ( { ...LEGACY_ACTION , notAKeyAtAll : 'anything' } ) ;
202202 expect ( result . success ) . toBe ( true ) ;
203203 if ( ! result . success ) return ;
204204 expect ( ( result . data as unknown as Record < string , unknown > ) . notAKeyAtAll ) . toBe ( 'anything' ) ;
@@ -212,7 +212,7 @@ describe('`ActionCallback` / `ActionCallbackSchema` are DELETED, not tombstoned
212212 expect ( 'ActionCallbackSchema' in crudZod ) . toBe ( false ) ;
213213 expect ( 'ActionCallbackSchema' in zodBarrel ) . toBe ( false ) ;
214214 // Non-vacuity: the neighbours the barrel still carries.
215- expect ( 'ActionSchema ' in crudZod ) . toBe ( true ) ;
215+ expect ( 'CRUDActionSchema ' in crudZod ) . toBe ( true ) ;
216216 expect ( 'ActionExecutionModeSchema' in zodBarrel ) . toBe ( true ) ;
217217 } ) ;
218218
0 commit comments