1+ import { z } from 'zod'
12import sha256 from 'fast-sha256'
23
34import {
@@ -26,7 +27,6 @@ import {
2627} from '$promptl/types'
2728import { Node as LogicalExpression } from 'estree'
2829import yaml , { Node as YAMLItem } from 'yaml'
29- import { z } from 'zod'
3030
3131import { updateScopeContextForNode } from './logic'
3232import { ScopeContext } from './scope'
@@ -49,6 +49,8 @@ function copyScopeContext(scopeContext: ScopeContext): ScopeContext {
4949 }
5050}
5151
52+ export type ScanSchema = unknown
53+
5254export class Scan {
5355 includedPromptPaths : Set < string >
5456
@@ -57,7 +59,7 @@ export class Scan {
5759 private fullPath : string
5860 private withParameters ?: string [ ]
5961 private requireConfig : boolean
60- private configSchema ?: z . ZodTypeAny
62+ private configSchema ?: ScanSchema
6163 private builtins : Record < string , ( ) => any >
6264
6365 private config ?: Config
@@ -86,7 +88,7 @@ export class Scan {
8688 document : Document
8789 referenceFn ?: ReferencePromptFn
8890 withParameters ?: string [ ]
89- configSchema ?: z . ZodType
91+ configSchema ?: ScanSchema
9092 requireConfig ?: boolean
9193 serialized ?: Fragment
9294 } ) {
@@ -315,8 +317,9 @@ export class Scan {
315317 let parsedObj = { }
316318
317319 try {
320+ const configSchema = this . configSchema as z . ZodType
318321 parsedObj = parsedYaml . toJS ( ) ?? { }
319- this . configSchema ?. parse ( parsedObj )
322+ configSchema ?. parse ( parsedObj )
320323 } catch ( err ) {
321324 if ( isZodError ( err ) ) {
322325 err . errors . forEach ( ( error ) => {
0 commit comments