@@ -171,16 +171,18 @@ function fileUniqueId(
171
171
return [ btoa ( fileUrl ) , fileUrl ] ;
172
172
}
173
173
174
- let lastId = 0 ;
175
- export const newSchemaBuilder = ( initial : SchemaData ) : SchemaBuilder => {
174
+ export const newSchemaBuilder = (
175
+ initial : SchemaData ,
176
+ revision : string ,
177
+ ) : SchemaBuilder => {
176
178
return {
177
179
data : initial ,
178
180
withBlockSchema ( schema : BlockModule | EntrypointModule ) : SchemaBuilder {
179
181
if ( isEntrypoint ( schema ) ) {
180
182
return newSchemaBuilder ( {
181
183
...initial ,
182
184
entrypoints : [ ...initial . entrypoints , schema ] ,
183
- } ) ;
185
+ } , revision ) ;
184
186
}
185
187
// routes is always entrypoints
186
188
if ( schema . blockType === "routes" && schema . inputSchema ) {
@@ -193,15 +195,14 @@ export const newSchemaBuilder = (initial: SchemaData): SchemaBuilder => {
193
195
config : schema . inputSchema ,
194
196
} ,
195
197
] ,
196
- } ) ;
198
+ } , revision ) ;
197
199
}
198
200
return newSchemaBuilder ( {
199
201
...initial ,
200
202
blockModules : [ ...initial . blockModules , schema ] ,
201
- } ) ;
203
+ } , revision ) ;
202
204
} ,
203
205
build ( ) {
204
- // lastId = 0;
205
206
const schemeableId = (
206
207
schemeable : Schemeable ,
207
208
resolvePath = true ,
@@ -371,7 +372,7 @@ export const newSchemaBuilder = (initial: SchemaData): SchemaBuilder => {
371
372
372
373
const finalDefsWith$id = Object . fromEntries (
373
374
Object . entries ( finalDefs ) . map ( ( entry , idx ) => {
374
- entry [ 1 ] = { ...entry [ 1 ] , $id : `#/${ idx } -${ lastId } ` } ;
375
+ entry [ 1 ] = { ...entry [ 1 ] , $id : `#/${ idx } -${ revision } ` } ;
375
376
return entry ;
376
377
} ) ,
377
378
) ;
0 commit comments