@salesforce/plugin-schema
Version:
Commands to interact with salesforce sobject schemas
43 lines • 1.85 kB
JavaScript
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { SfCommand, Flags, orgApiVersionFlagWithDeprecations, requiredOrgFlagWithDeprecations, loglevel, } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-schema', 'describe');
export class SObjectDescribe extends SfCommand {
static summary = messages.getMessage('summary');
static description = messages.getMessage('description');
static examples = messages.getMessages('examples');
static aliases = ['force:schema:sobject:describe'];
static deprecateAliases = true;
static flags = {
'target-org': requiredOrgFlagWithDeprecations,
'api-version': orgApiVersionFlagWithDeprecations,
loglevel,
sobject: Flags.string({
char: 's',
required: true,
summary: messages.getMessage('flags.sobject.summary'),
aliases: ['sobjecttype'],
}),
'use-tooling-api': Flags.boolean({
char: 't',
summary: messages.getMessage('flags.use-tooling-api.summary'),
aliases: ['usetoolingapi'],
}),
};
async run() {
const { flags } = await this.parse(SObjectDescribe);
const conn = flags['target-org'].getConnection(flags['api-version']);
const description = flags['use-tooling-api']
? await conn.tooling.describe(flags.sobject)
: await conn.describe(flags.sobject);
this.styledJSON(description);
return description;
}
}
//# sourceMappingURL=describe.js.map