@@ -171,16 +171,18 @@ function fileUniqueId(
171171 return [ btoa ( fileUrl ) , fileUrl ] ;
172172}
173173
174- let lastId = 0 ;
175- export const newSchemaBuilder = ( initial : SchemaData ) : SchemaBuilder => {
174+ export const newSchemaBuilder = (
175+ initial : SchemaData ,
176+ revision : string ,
177+ ) : SchemaBuilder => {
176178 return {
177179 data : initial ,
178180 withBlockSchema ( schema : BlockModule | EntrypointModule ) : SchemaBuilder {
179181 if ( isEntrypoint ( schema ) ) {
180182 return newSchemaBuilder ( {
181183 ...initial ,
182184 entrypoints : [ ...initial . entrypoints , schema ] ,
183- } ) ;
185+ } , revision ) ;
184186 }
185187 // routes is always entrypoints
186188 if ( schema . blockType === "routes" && schema . inputSchema ) {
@@ -193,15 +195,14 @@ export const newSchemaBuilder = (initial: SchemaData): SchemaBuilder => {
193195 config : schema . inputSchema ,
194196 } ,
195197 ] ,
196- } ) ;
198+ } , revision ) ;
197199 }
198200 return newSchemaBuilder ( {
199201 ...initial ,
200202 blockModules : [ ...initial . blockModules , schema ] ,
201- } ) ;
203+ } , revision ) ;
202204 } ,
203205 build ( ) {
204- // lastId = 0;
205206 const schemeableId = (
206207 schemeable : Schemeable ,
207208 resolvePath = true ,
@@ -371,7 +372,7 @@ export const newSchemaBuilder = (initial: SchemaData): SchemaBuilder => {
371372
372373 const finalDefsWith$id = Object . fromEntries (
373374 Object . entries ( finalDefs ) . map ( ( entry , idx ) => {
374- entry [ 1 ] = { ...entry [ 1 ] , $id : `#/${ idx } -${ lastId } ` } ;
375+ entry [ 1 ] = { ...entry [ 1 ] , $id : `#/${ idx } -${ revision } ` } ;
375376 return entry ;
376377 } ) ,
377378 ) ;
0 commit comments