UNPKG

@salesforce/plugin-schema

Version:

Commands to interact with salesforce sobject schemas

52 lines 2.22 kB
/* * Copyright 2025, Salesforce, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 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