Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running env import, add a default "objects" property to the package object #510

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/mdctl-import-adapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const EventEmitter = require('events'),
_ = require('lodash'),
pluralize = require('pluralize'),
{ ImportSection } = require('@medable/mdctl-core/streams/section'),
{ parseString, isCustomName } = require('@medable/mdctl-core-utils/values'),
{ isSet, parseString, isCustomName } = require('@medable/mdctl-core-utils/values'),
{ md5FileHash } = require('@medable/mdctl-node-utils/crypto'),
{ privatesAccessor } = require('@medable/mdctl-core-utils/privates'),
{ OutputStream } = require('@medable/mdctl-core/streams/chunk-stream'),
Expand Down Expand Up @@ -102,8 +102,11 @@ class ImportFileTreeAdapter extends EventEmitter {

async loadPackageFromObject() {
const { packageData, input, format } = privatesAccessor(this),
section = new ImportSection(packageData, 'package', `package.${format}`, input)
return { results: [section.content], blobResults: [] }
{ content } = new ImportSection(packageData, 'package', `package.${format}`, input)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the only effect of the new ImportSection call here is to map packageData to the new object's content property, so lines 104-105 could be replaced with just:

const { packageData: content, input, format } = privatesAccessor(this)

if (!isSet(content.object)) {
content.object = 'package'
}
return { results: [content], blobResults: [] }
}

async loadFileContent(f) {
Expand Down
Loading