From f48d902d353552bbc08121c6e381610a44498e7d Mon Sep 17 00:00:00 2001 From: Andrew Brazzatti Date: Wed, 11 Oct 2023 22:07:04 +0000 Subject: [PATCH] Updated import syntax to support new flat library --- typescript/api/controllers/VocabController.ts | 4 ++-- typescript/api/services/SolrSearchService.ts | 6 +++--- typescript/api/services/UsersService.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/typescript/api/controllers/VocabController.ts b/typescript/api/controllers/VocabController.ts index 1b15c61cc2..75ac7c478b 100644 --- a/typescript/api/controllers/VocabController.ts +++ b/typescript/api/controllers/VocabController.ts @@ -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. @@ -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]; } }); }); diff --git a/typescript/api/services/SolrSearchService.ts b/typescript/api/services/SolrSearchService.ts index aa98fd3159..0b47f19a4d 100644 --- a/typescript/api/services/SolrSearchService.ts +++ b/typescript/api/services/SolrSearchService.ts @@ -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; @@ -327,7 +327,7 @@ 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) { @@ -335,7 +335,7 @@ export module Services { } 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); }); diff --git a/typescript/api/services/UsersService.ts b/typescript/api/services/UsersService.ts index 11502c4bb4..cad280796d 100644 --- a/typescript/api/services/UsersService.ts +++ b/typescript/api/services/UsersService.ts @@ -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;