Skip to content

Commit

Permalink
Updated import syntax to support new flat library
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbrazzatti committed Oct 11, 2023
1 parent 7f78247 commit f48d902
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions typescript/api/controllers/VocabController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare var module;
declare var sails;
declare var _;
import { Observable } from 'rxjs/Rx';
import * as flat from 'flat';
import { unflatten } from 'flat'
declare var VocabService;
/**
* Package that contains all Controllers.
Expand Down Expand Up @@ -115,7 +115,7 @@ export module Controllers {
if (_.startsWith(key, flattened_prefix)) {
const targetKey = key.substring(flattened_prefix.length);
const objVal = JSON.parse(val);
doc[targetKey] = flat.unflatten(objVal)[key];
doc[targetKey] = unflatten(objVal)[key];
}
});
});
Expand Down
6 changes: 3 additions & 3 deletions typescript/api/services/SolrSearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
declare var sails: Sails;
declare var _;
declare var _this;
import * as flat from 'flat';
import { flatten } from 'flat'
import * as luceneEscapeQuery from "lucene-escape-query";

declare var RecordsService;
Expand Down Expand Up @@ -327,15 +327,15 @@ export module Services {
_.each(sails.config.solr.preIndex.flatten.special, (specialFlattenConfig:any) => {
_.unset(processedData, specialFlattenConfig.field);
});
processedData = flat.flatten(processedData, sails.config.solr.preIndex.flatten.options);
processedData = flatten(processedData, sails.config.solr.preIndex.flatten.options);
_.each(sails.config.solr.preIndex.flatten.special, (specialFlattenConfig:any) => {
const dataToFlatten:any = {};
if (specialFlattenConfig.dest) {
_.set(dataToFlatten, specialFlattenConfig.dest, _.get(data, specialFlattenConfig.source));
} else {
_.set(dataToFlatten, specialFlattenConfig.source, _.get(data, specialFlattenConfig.source));
}
let flattened:any = flat.flatten(dataToFlatten, specialFlattenConfig.options);
let flattened:any = flatten(dataToFlatten, specialFlattenConfig.options);
_.merge(processedData, flattened);
});

Expand Down
2 changes: 1 addition & 1 deletion typescript/api/services/UsersService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
} from "sails";
import * as request from "request-promise";
import * as crypto from 'crypto';
import * as flat from 'flat';


declare var sails: Sails;
declare var User, Role, UserAudit, Record: Model;
Expand Down

0 comments on commit f48d902

Please sign in to comment.