@@ -106,6 +106,33 @@ export function calculateRequiredArangoSearchViewDropOperations(
106106 return viewsToDrop . map ( value => new DropArangoSearchViewMigration ( { viewName : value . name } ) ) ;
107107}
108108
109+ /**
110+ * Configures the inBackground flag
111+ *
112+ * We don'd to this initially because it won't be present in the actual view definition, and we would always see a
113+ * pending change in the migration analyzer (because it would want to add inBackground).
114+ */
115+ export function configureForBackgroundCreation (
116+ definition : ArangoSearchViewPropertiesOptions
117+ ) : ArangoSearchViewPropertiesOptions {
118+ return {
119+ ...definition ,
120+ links : definition . links
121+ ? Object . fromEntries (
122+ Object . entries ( definition . links ) . map ( ( [ key , value ] ) => [
123+ key ,
124+ {
125+ ...value ,
126+ // missing in types, see https://github.com/arangodb/arangojs/issues/759
127+ // if this is not set, creating the view would acquire an exclusive lock on the collections
128+ inBackground : true
129+ }
130+ ] )
131+ )
132+ : definition . links
133+ } ;
134+ }
135+
109136function getPropertiesFromDefinition (
110137 definition : ArangoSearchDefinition ,
111138 configuration ?: ArangoSearchConfiguration
@@ -118,11 +145,7 @@ function getPropertiesFromDefinition(
118145 includeAllFields : false ,
119146 storeValues : 'id' ,
120147 trackListPositions : false ,
121- fields : fieldDefinitionsFor ( definition . rootEntityType . fields ) ,
122-
123- // missing in types, see https://github.com/arangodb/arangojs/issues/759
124- // if this is not set, creating the view would acquire an exclusive lock on the collections
125- inBackground : true
148+ fields : fieldDefinitionsFor ( definition . rootEntityType . fields )
126149 } as ArangoSearchViewLink
127150 } ,
128151 commitIntervalMsec : configuration ?. commitIntervalMsec ? configuration . commitIntervalMsec : 1000 ,
0 commit comments