Skip to content

Commit

Permalink
feat: use new wsdl types (#610)
Browse files Browse the repository at this point in the history
* fix: use new salesforce/types

* chore: lockfile

* chore: use new types library
  • Loading branch information
mshanemc authored May 6, 2024
1 parent b55d3d3 commit 8f5a61e
Show file tree
Hide file tree
Showing 22 changed files with 231 additions and 343 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@inquirer/confirm": "^2.0.17",
"@inquirer/input": "^1.2.16",
"@inquirer/select": "^1.3.3",
"@oclif/core": "^3.26.3",
"@salesforce/core": "^7.3.1",
"@inquirer/confirm": "^3.1.6",
"@inquirer/input": "^2.1.6",
"@inquirer/select": "^2.3.2",
"@oclif/core": "^3.26.5",
"@salesforce/core": "^7.3.3",
"@salesforce/kit": "^3.1.0",
"@salesforce/sf-plugins-core": "^9.0.7",
"fast-glob": "^3.3.2",
Expand All @@ -21,7 +21,7 @@
"@salesforce/cli-plugins-testkit": "^5.3.2",
"@salesforce/dev-scripts": "^9.0.0",
"@salesforce/plugin-command-reference": "^3.0.82",
"@types/inquirer": "^8.2.0",
"@salesforce/types": "^1.1.0",
"eslint-plugin-sf-plugin": "^1.18.3",
"oclif": "^4.10.2",
"ts-node": "^10.9.2",
Expand Down
73 changes: 54 additions & 19 deletions schemas/schema-generate-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,56 @@
"type": "object",
"additionalProperties": false,
"properties": {
"displayLocationInDecimal": {
"type": "boolean"
},
"type": {
"type": ["string", "null"]
"$ref": "#/definitions/FieldType"
},
"label": {
"type": ["string", "null"]
"type": "string"
},
"description": {
"type": ["string", "null"]
"type": "string"
},
"trackHistory": {
"type": ["boolean", "null"]
"type": "boolean"
},
"inlineHelpText": {
"type": ["string", "null"]
"type": "string"
},
"required": {
"type": ["boolean", "null"]
"type": "boolean"
},
"fullName": {
"type": ["string", "null"]
"type": "string"
},
"scale": {
"type": ["number", "null"]
"type": "number"
},
"precision": {
"type": ["number", "null"]
"type": "number"
},
"visibleLines": {
"type": ["number", "null"]
"type": "number"
},
"length": {
"type": ["number", "null"]
"type": "number"
},
"unique": {
"type": ["boolean", "null"]
"type": "boolean"
},
"externalId": {
"type": ["boolean", "null"]
"type": "boolean"
},
"startingNumber": {
"type": ["number", "null"]
"type": "number"
},
"defaultValue": {
"type": ["string", "null"]
"type": "string"
},
"securityClassification": {
"type": ["string", "null"]
"type": "string"
},
"displayLocationInDecimal": {
"type": "boolean"
}
},
"required": ["type"]
Expand All @@ -69,6 +69,41 @@
},
"required": ["field", "path"],
"additionalProperties": false
},
"FieldType": {
"type": "string",
"enum": [
"AutoNumber",
"Lookup",
"MasterDetail",
"Checkbox",
"Currency",
"Date",
"DateTime",
"Email",
"Number",
"Percent",
"Phone",
"Picklist",
"MultiselectPicklist",
"Text",
"TextArea",
"LongTextArea",
"Html",
"Url",
"EncryptedText",
"Summary",
"Hierarchy",
"File",
"MetadataRelationship",
"Location",
"ExternalLookup",
"IndirectLookup",
"CustomDataType",
"Time",
"Address",
"Array"
]
}
}
}
28 changes: 20 additions & 8 deletions schemas/schema-generate-platformevent.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,41 @@
"type": "object",
"properties": {
"fullName": {
"type": ["string", "null"]
"type": "string"
},
"label": {
"type": ["string", "null"]
"type": "string"
},
"deploymentStatus": {
"type": ["string", "null"]
"$ref": "#/definitions/DeploymentStatus"
},
"description": {
"type": ["string", "null"]
"type": "string"
},
"pluralLabel": {
"type": ["string", "null"]
"type": "string"
},
"eventType": {
"type": ["string", "null"]
"$ref": "#/definitions/PlatformEventType"
},
"publishBehavior": {
"type": ["string", "null"]
"$ref": "#/definitions/PlatformEventPublishBehavior"
}
},
"additionalProperties": false,
"description": "There are a lot of properties that we don't, and some that jsforce thinks are mandatory that aren't. Many apply to the various sub-species (mdt, external, events)\n\nThis type represents a PlatformEvent that can deploy."
"description": "This type represents a PlatformEvent that can deploy."
},
"DeploymentStatus": {
"type": "string",
"enum": ["InDevelopment", "Deployed"]
},
"PlatformEventType": {
"type": "string",
"enum": ["HighVolume", "StandardVolume", "ExternalEvent"]
},
"PlatformEventPublishBehavior": {
"type": "string",
"enum": ["PublishAfterCommit", "PublishImmediately"]
}
}
}
89 changes: 71 additions & 18 deletions schemas/schema-generate-sobject.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,119 @@
"$ref": "#/definitions/NameField"
},
"label": {
"type": ["string", "null"]
"type": "string"
},
"deploymentStatus": {
"type": ["string", "null"]
"$ref": "#/definitions/DeploymentStatus"
},
"description": {
"type": ["string", "null"]
"type": "string"
},
"enableHistory": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableActivities": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableBulkApi": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableFeeds": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableReports": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableSearch": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableStreamingApi": {
"type": ["boolean", "null"]
"type": "boolean"
},
"enableSharing": {
"type": ["boolean", "null"]
"type": "boolean"
},
"pluralLabel": {
"type": ["string", "null"]
"type": "string"
},
"sharingModel": {
"type": ["string", "null"]
"$ref": "#/definitions/SharingModel"
},
"fullName": {
"type": ["string", "null"]
"type": "string"
}
},
"required": ["nameField"],
"description": "There are a lot of properties that we don't, and some that jsforce thinks are mandatory that aren't. Many apply to the various sub-species (mdt, external, events)\n\nThis type represents a \"classical\" CustomObject subset that can deploy."
"description": "This type represents a \"classical\" CustomObject subset that can deploy."
},
"NameField": {
"type": "object",
"properties": {
"label": {
"type": ["string", "null"]
"type": "string"
},
"type": {
"type": ["string", "null"]
"$ref": "#/definitions/FieldType"
},
"displayFormat": {
"type": ["string", "null"]
"type": "string"
}
},
"additionalProperties": false,
"description": "Used by classical CustomObject"
},
"FieldType": {
"type": "string",
"enum": [
"AutoNumber",
"Lookup",
"MasterDetail",
"Checkbox",
"Currency",
"Date",
"DateTime",
"Email",
"Number",
"Percent",
"Phone",
"Picklist",
"MultiselectPicklist",
"Text",
"TextArea",
"LongTextArea",
"Html",
"Url",
"EncryptedText",
"Summary",
"Hierarchy",
"File",
"MetadataRelationship",
"Location",
"ExternalLookup",
"IndirectLookup",
"CustomDataType",
"Time",
"Address",
"Array"
]
},
"DeploymentStatus": {
"type": "string",
"enum": ["InDevelopment", "Deployed"]
},
"SharingModel": {
"type": "string",
"enum": [
"Private",
"Read",
"ReadSelect",
"ReadWrite",
"ReadWriteTransfer",
"FullAccess",
"ControlledByParent",
"ControlledByLeadOrContact",
"ControlledByCampaign"
]
}
}
}
4 changes: 2 additions & 2 deletions schemas/schema-generate-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"type": "object",
"properties": {
"customObject": {
"type": ["boolean", "null"]
"type": "boolean"
},
"motif": {
"type": ["string", "null"]
"type": "string"
}
},
"additionalProperties": false
Expand Down
5 changes: 2 additions & 3 deletions src/commands/schema/generate/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import confirm from '@inquirer/confirm';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import type { AnyJson } from '@salesforce/ts-types';
import type { CustomField } from '@jsforce/jsforce-node/lib/api/metadata.js';
import type { CustomField } from '../../../../node_modules/@salesforce/types/lib/metadata.js';
import { convertJsonToXml } from '../../../shared/convert.js';
import { picklistPrompts } from '../../../shared/prompts/picklist.js';
import { integerValidation } from '../../../shared/prompts/functions.js';
Expand Down Expand Up @@ -73,9 +73,8 @@ type SaveableCustomField = Pick<
| 'startingNumber'
| 'defaultValue'
| 'securityClassification'
| 'displayLocationInDecimal'
> & {
// TODO: get displayLocationInDecimal into jsforce2 typings
displayLocationInDecimal?: boolean;
type: (typeof supportedFieldTypesCustomObject)[number];
};

Expand Down
4 changes: 2 additions & 2 deletions src/commands/schema/generate/platformevent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { dirname } from 'node:path';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import { Messages } from '@salesforce/core/messages';
import select from '@inquirer/select';
import type { AnyJson } from '@salesforce/ts-types';
import { apiNamePrompt } from '../../../shared/prompts/apiName.js';
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class PlatformEventGenerate extends SfCommand<PlatformEventGenera
description: await descriptionPrompt(),
publishBehavior: await select({
message: messages.getMessage('prompts.publishBehavior'),
choices: ['PublishImmediately', 'PublishAfterCommit'].map(toSelectOption),
choices: (['PublishImmediately', 'PublishAfterCommit'] as const).map(toSelectOption),
}),
deploymentStatus: 'Deployed',
eventType: 'HighVolume',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/schema/generate/sobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { dirname } from 'node:path';
import select from '@inquirer/select';
import confirm from '@inquirer/confirm';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import { Messages } from '@salesforce/core/messages';
import { nameFieldPrompts } from '../../../shared/prompts/nameField.js';
import { apiNamePrompt } from '../../../shared/prompts/apiName.js';
import { pluralPrompt } from '../../../shared/prompts/plural.js';
Expand Down
Loading

0 comments on commit 8f5a61e

Please sign in to comment.