diff --git a/messages/importApi.md b/messages/importApi.md index b06c76da..65085753 100644 --- a/messages/importApi.md +++ b/messages/importApi.md @@ -20,7 +20,7 @@ Data plan file %s did not validate against the schema. Errors: %s. - Make sure you're importing a plan definition file. -- Get help with the import plan schema by running "sf data import beta tree --help". +- Get help with the import plan schema by running "sf data import tree --help". # error.NonStringFiles diff --git a/src/api/data/tree/importPlan.ts b/src/api/data/tree/importPlan.ts index 253bfe09..6978532d 100644 --- a/src/api/data/tree/importPlan.ts +++ b/src/api/data/tree/importPlan.ts @@ -37,9 +37,8 @@ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-data', 'importApi'); // the "new" type for these. We're ignoring saveRefs/resolveRefs -export type EnrichedPlanPart = Partial & { +export type EnrichedPlanPart = DataPlanPart & { filePath: string; - sobject: string; records: SObjectTreeInput[]; }; /** an accumulator for api results. Fingerprints exist to break recursion */ @@ -51,6 +50,7 @@ type ResultsSoFar = { const TREE_API_LIMIT = 200; const refRegex = (object: string): RegExp => new RegExp(`^@${object}Ref\\d+$`); + export const importFromPlan = async (conn: Connection, planFilePath: string): Promise => { const resolvedPlanPath = path.resolve(process.cwd(), planFilePath); const logger = Logger.childFromRoot('data:import:tree:importFromPlan'); @@ -197,7 +197,7 @@ export function validatePlanContents( if (parseResults.error) { throw messages.createError('error.InvalidDataImport', [ planPath, - parseResults.error.issues.map((e) => e.message).join('\n'), + parseResults.error.issues.map((e) => JSON.stringify(e, null, 2)).join('\n'), ]); } const parsedPlans: DataImportPlanArray = parseResults.data; diff --git a/src/types.ts b/src/types.ts index 48af7583..d3914180 100644 --- a/src/types.ts +++ b/src/types.ts @@ -62,7 +62,7 @@ export type SObjectTreeInput = Omit & { }; export type DataPlanPart = { sobject: string; - files: Array; + files: string[]; }; export type SObjectTreeFileContents = {