Skip to content
Merged
2 changes: 1 addition & 1 deletion messages/importApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/api/data/tree/importPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataPlanPart> & {
export type EnrichedPlanPart = DataPlanPart & {
filePath: string;
sobject: string;
records: SObjectTreeInput[];
};
/** an accumulator for api results. Fingerprints exist to break recursion */
Expand All @@ -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<ImportStatus> => {
const resolvedPlanPath = path.resolve(process.cwd(), planFilePath);
const logger = Logger.childFromRoot('data:import:tree:importFromPlan');
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type SObjectTreeInput = Omit<BasicRecord, 'attributes'> & {
};
export type DataPlanPart = {
sobject: string;
files: Array<string | (DataPlanPart & { file: string })>;
files: string[];
};

export type SObjectTreeFileContents = {
Expand Down