|
|
@ -26,12 +26,14 @@ async function readAllData({ |
|
|
|
fields, |
|
|
|
fields, |
|
|
|
atBase, |
|
|
|
atBase, |
|
|
|
logBasic = (_str) => {}, |
|
|
|
logBasic = (_str) => {}, |
|
|
|
|
|
|
|
logWarning = (_str) => {}, |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
table: { title?: string }; |
|
|
|
table: { title?: string }; |
|
|
|
fields?; |
|
|
|
fields?; |
|
|
|
atBase: AirtableBase; |
|
|
|
atBase: AirtableBase; |
|
|
|
logBasic?: (string) => void; |
|
|
|
logBasic?: (string) => void; |
|
|
|
logDetailed?: (string) => void; |
|
|
|
logDetailed?: (string) => void; |
|
|
|
|
|
|
|
logWarning?: (string) => void; |
|
|
|
}): Promise<EntityMap> { |
|
|
|
}): Promise<EntityMap> { |
|
|
|
return new Promise((resolve) => { |
|
|
|
return new Promise((resolve) => { |
|
|
|
let data = null; |
|
|
|
let data = null; |
|
|
@ -78,8 +80,8 @@ async function readAllData({ |
|
|
|
async function done(err) { |
|
|
|
async function done(err) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
logger.error(err); |
|
|
|
logger.error(err); |
|
|
|
logBasic( |
|
|
|
logWarning( |
|
|
|
`:: There were errors on reading '${table.title}' data :: ${err}`, |
|
|
|
`There were errors on reading '${table.title}' data :: ${err}`, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
resolve(data); |
|
|
|
resolve(data); |
|
|
@ -94,8 +96,9 @@ export async function importData({ |
|
|
|
atBase, |
|
|
|
atBase, |
|
|
|
nocoBaseDataProcessing_v2, |
|
|
|
nocoBaseDataProcessing_v2, |
|
|
|
sDB, |
|
|
|
sDB, |
|
|
|
logDetailed = (_str) => {}, |
|
|
|
|
|
|
|
logBasic = (_str) => {}, |
|
|
|
logBasic = (_str) => {}, |
|
|
|
|
|
|
|
logDetailed = (_str) => {}, |
|
|
|
|
|
|
|
logWarning = (_str) => {}, |
|
|
|
services, |
|
|
|
services, |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
baseName: string; |
|
|
|
baseName: string; |
|
|
@ -104,6 +107,7 @@ export async function importData({ |
|
|
|
atBase: AirtableBase; |
|
|
|
atBase: AirtableBase; |
|
|
|
logBasic: (string) => void; |
|
|
|
logBasic: (string) => void; |
|
|
|
logDetailed: (string) => void; |
|
|
|
logDetailed: (string) => void; |
|
|
|
|
|
|
|
logWarning: (string) => void; |
|
|
|
nocoBaseDataProcessing_v2; |
|
|
|
nocoBaseDataProcessing_v2; |
|
|
|
sDB; |
|
|
|
sDB; |
|
|
|
services: AirtableImportContext; |
|
|
|
services: AirtableImportContext; |
|
|
@ -179,8 +183,8 @@ export async function importData({ |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
logger.error(e); |
|
|
|
logger.error(e); |
|
|
|
logBasic( |
|
|
|
logWarning( |
|
|
|
`:: There were errors on importing '${table.title}' data :: ${e}`, |
|
|
|
`There were errors on importing '${table.title}' data :: ${e}`, |
|
|
|
); |
|
|
|
); |
|
|
|
readable.resume(); |
|
|
|
readable.resume(); |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
@ -217,8 +221,8 @@ export async function importData({ |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
logger.error(e); |
|
|
|
logger.error(e); |
|
|
|
logBasic( |
|
|
|
logWarning( |
|
|
|
`:: There were errors on importing '${table.title}' data :: ${e}`, |
|
|
|
`There were errors on importing '${table.title}' data :: ${e}`, |
|
|
|
); |
|
|
|
); |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
} |
|
|
|
} |
|
|
@ -237,20 +241,19 @@ export async function importLTARData({ |
|
|
|
atBase, |
|
|
|
atBase, |
|
|
|
baseName, |
|
|
|
baseName, |
|
|
|
insertedAssocRef = {}, |
|
|
|
insertedAssocRef = {}, |
|
|
|
logDetailed = (_str) => {}, |
|
|
|
|
|
|
|
logBasic = (_str) => {}, |
|
|
|
|
|
|
|
records, |
|
|
|
records, |
|
|
|
atNcAliasRef, |
|
|
|
atNcAliasRef, |
|
|
|
ncLinkMappingTable, |
|
|
|
ncLinkMappingTable, |
|
|
|
syncDB, |
|
|
|
syncDB, |
|
|
|
services, |
|
|
|
services, |
|
|
|
|
|
|
|
logBasic = (_str) => {}, |
|
|
|
|
|
|
|
logDetailed = (_str) => {}, |
|
|
|
|
|
|
|
logWarning = (_str) => {}, |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
baseName: string; |
|
|
|
baseName: string; |
|
|
|
table: { title?: string; id?: string }; |
|
|
|
table: { title?: string; id?: string }; |
|
|
|
fields; |
|
|
|
fields; |
|
|
|
atBase: AirtableBase; |
|
|
|
atBase: AirtableBase; |
|
|
|
logDetailed: (string) => void; |
|
|
|
|
|
|
|
logBasic: (string) => void; |
|
|
|
|
|
|
|
insertedAssocRef: { [assocTableId: string]: boolean }; |
|
|
|
insertedAssocRef: { [assocTableId: string]: boolean }; |
|
|
|
records?: EntityMap; |
|
|
|
records?: EntityMap; |
|
|
|
atNcAliasRef: { |
|
|
|
atNcAliasRef: { |
|
|
@ -261,6 +264,9 @@ export async function importLTARData({ |
|
|
|
ncLinkMappingTable: Record<string, Record<string, any>>[]; |
|
|
|
ncLinkMappingTable: Record<string, Record<string, any>>[]; |
|
|
|
syncDB; |
|
|
|
syncDB; |
|
|
|
services: AirtableImportContext; |
|
|
|
services: AirtableImportContext; |
|
|
|
|
|
|
|
logBasic: (string) => void; |
|
|
|
|
|
|
|
logDetailed: (string) => void; |
|
|
|
|
|
|
|
logWarning: (string) => void; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const assocTableMetas: Array<{ |
|
|
|
const assocTableMetas: Array<{ |
|
|
|
modelMeta: { id?: string; title?: string }; |
|
|
|
modelMeta: { id?: string; title?: string }; |
|
|
@ -379,8 +385,8 @@ export async function importLTARData({ |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
logger.error(e); |
|
|
|
logger.error(e); |
|
|
|
logBasic( |
|
|
|
logWarning( |
|
|
|
`:: There were errors on importing '${table.title}' LTAR data :: ${e}`, |
|
|
|
`There were errors on importing '${table.title}' LTAR data :: ${e}`, |
|
|
|
); |
|
|
|
); |
|
|
|
readable.resume(); |
|
|
|
readable.resume(); |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
@ -418,8 +424,8 @@ export async function importLTARData({ |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
logger.error(e); |
|
|
|
logger.error(e); |
|
|
|
logBasic( |
|
|
|
logWarning( |
|
|
|
`:: There were errors on importing '${table.title}' LTAR data :: ${e}`, |
|
|
|
`There were errors on importing '${table.title}' LTAR data :: ${e}`, |
|
|
|
); |
|
|
|
); |
|
|
|
resolve(true); |
|
|
|
resolve(true); |
|
|
|
} |
|
|
|
} |
|
|
|