hunk.code_window:         return queryBuilder().criteria(criteria).updateFirst(update).flatMap(count -> {
               if (count == 0) {
                   DatasourceStorageStructure dss = new DatasourceStorageStructure();
                   dss.setDatasourceId(datasourceId);
                   dss.setEnvironmentId(environmentId);
                   dss.setStructure(structure);
                   return repository.save(dss).then();
               }
               return Mono.empty();
           });
       }
   }
hunk.labels: keep replace replace replace replace replace replace replace replace replace replace keep keep
hunk.after_edit:     @Override
       public Mono<Integer> updateStructure(String datasourceId, String environmentId, DatasourceStructure structure) {
           return mongoOperations
                   .upsert(
                           new Query().addCriteria(getDatasourceIdAndEnvironmentIdCriteria(datasourceId, environmentId)),
                           Update.update(DatasourceStorageStructure.Fields.structure, structure),
                           DatasourceStorageStructure.class)
                   .map(updateResult -> Math.toIntExact(updateResult.getModifiedCount()));
  
hunk.file_path: app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/CustomDatasourceStorageStructureRepositoryCEImpl.java
hunk.type: replace
file: import type { EntityItem } from "@appsmith/entities/IDE/constants";
  import { jsCollectionIdURL } from "@appsmith/RouteBuilder";
  
  export const getJSEntityItemUrl = (
    item: EntityItem,
    pageId: string,
  ): string => {
    return jsCollectionIdURL({
      collectionId: item.key,
      pageId,
    });
  };
  