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

Sm/parking-orbit #595

Merged
merged 37 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fe70446
feat!: no hardcoded api version
mshanemc Mar 21, 2022
3348840
feat: componentSet can omit version
mshanemc Mar 21, 2022
9266701
chore: adding types for SDR
mshanemc Mar 21, 2022
df4d1dd
feat: export currentApiVersion
mshanemc Mar 21, 2022
5ddeec0
fix: set version from org, coverageReport
mshanemc Mar 21, 2022
f482bda
test: retrieve uses connection apiVersion
mshanemc Mar 21, 2022
9a51c9d
Merge remote-tracking branch 'origin/main' into sm/no-hardcoded-apiVe…
mshanemc Mar 24, 2022
acd1a18
feat: async versions of getObject and getPackageXml
mshanemc Mar 24, 2022
0faa8b0
test: updates for breaking changes
mshanemc Mar 24, 2022
1b409dc
chore: adding types for SDR
mshanemc Mar 24, 2022
d2866ea
refactor: async write (pr feedback)
mshanemc Mar 25, 2022
65350f7
chore: adding types for SDR
mshanemc Mar 25, 2022
faba505
Merge remote-tracking branch 'origin/main' into sm/no-hardcoded-apiVe…
mshanemc Mar 28, 2022
9aab12a
Merge remote-tracking branch 'origin/main' into sm/no-hardcoded-apiVe…
mshanemc Mar 28, 2022
470d31a
Merge remote-tracking branch 'origin/main' into sm/no-hardcoded-apiVe…
mshanemc Mar 28, 2022
c78625b
Wr/corev3 (#598)
WillieRuemmele Mar 29, 2022
70b7028
chore: fix deploy cancel method
WillieRuemmele Mar 29, 2022
773a978
fix: handle BooleanString properly
mshanemc Mar 29, 2022
5013cbc
fix: reverse false value
mshanemc Mar 29, 2022
26dcab2
fix: another place allowing BooleanString
mshanemc Mar 29, 2022
4e766db
chore: adding types for SDR
mshanemc Mar 29, 2022
db10a1c
fix: type array and destructure tasks
mshanemc Mar 30, 2022
387e228
chore: adding types for SDR
mshanemc Mar 31, 2022
2d7199c
test: correct stub for fs
mshanemc Mar 31, 2022
0b5665a
refactor: pr and cleanup
mshanemc Mar 31, 2022
2024e0e
feat: use core error/messages
mshanemc May 2, 2022
b117e86
chore: resolve conflicts
WillieRuemmele May 4, 2022
7a674f9
Merge remote-tracking branch 'origin/main' into sm/no-hardcoded-apiVe…
mshanemc May 13, 2022
a3a6f79
feat: use jsforce2 rest deploys
mshanemc May 13, 2022
5c00c30
chore: auto-update metadata coverage in METADATA_SUPPORT.md
mshanemc May 13, 2022
a802b53
ci: external nuts
mshanemc May 13, 2022
ca38199
chore: bump kit
mshanemc May 18, 2022
324fcb0
fix: don't send rest param to mdapi
mshanemc May 19, 2022
5c58319
chore: bump jsforce
mshanemc May 19, 2022
6ff5ef2
test: adjust ut for the new jsforce mdapi
mshanemc May 19, 2022
54f3773
chore: auto-update metadata coverage in METADATA_SUPPORT.md
mshanemc May 19, 2022
8f0438b
chore: update core lib
shetzel May 20, 2022
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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ jobs:
yarn install
npm install shx -g
shx rm -rf node_modules/@salesforce/kit
shx rm -rf node_modules/@salesforce/core
# until plugin is parking-orbited, they'll need 2 different major versions of core
# shx rm -rf node_modules/@salesforce/core
shx rm -rf node_modules/@typescript-eslint
shx rm -rf node_modules/eslint-plugin-header
shx rm -rf node_modules/eslint-plugin-import
Expand Down
7 changes: 4 additions & 3 deletions METADATA_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This list compares metadata types found in Salesforce v55 with the [metadata reg

This repository is used by both the Salesforce CLIs and Salesforce's VSCode Extensions.

Currently, there are 458/491 supported metadata types.
Currently, there are 459/491 supported metadata types.
For status on any existing gaps, please search or file an issue in the [Salesforce CLI issues only repo](https://github.com/forcedotcom/cli/issues).
To contribute a new metadata type, please see the [Contributing Metadata Types to the Registry](./contributing/metadata.md)

Expand Down Expand Up @@ -71,7 +71,7 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
|BlockchainSettings|✅||
|Bot|✅||
|BotSettings|✅||
|BotTemplate|❌|Not supported, but support could be added|
|BotTemplate|✅||
|BotVersion|✅||
|BranchManagementSettings|✅||
|BrandingSet|✅||
Expand Down Expand Up @@ -509,7 +509,8 @@ v56 introduces the following new types. Here's their current level of support

|Metadata Type|Support|Notes|
|:---|:---|:---|
|ForecastingColumnDefinition|❌|Not supported, but support could be added|
|CollectionsDashboardSettings|✅||
|MfgServiceConsoleSettings|✅||

## Additional Types

Expand Down
191 changes: 191 additions & 0 deletions messages/sdr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# md_request_fail

Metadata API request failed: %s

# md_request_timeout

Metadata API request timed out

# registry_error_missing_type_definition

Missing metadata type definition for %s

# registry_error_file_not_found

File not found %s

# registry_error_missing_metadata_xml

Metadata xml file missing for %s

# registry_error_unsupported_type

Types missing a defined suffix are currently unsupported

# beta_tapi_mdcontainer_error

Unexpected error creating metadata container

# beta_tapi_membertype_error

Unexpected error creating %s member

# beta_tapi_car_error

Unexpected error creating container async request

# beta_tapi_queue_status

The deploy is still in the queue

# beta_tapi_membertype_unsupported_error

'%s' type not supported

# error_convert_invalid_format

Invalid conversion format '%s'

# error_convert_not_implemented

%s format conversion not yet implemented for type %s

# error_could_not_infer_type

%s: Could not infer a metadata type

# error_unexpected_child_type

Unexpected child metadata [%s] found for parent type [%s]

# error_expected_source_files

%s: Expected source files for type '%s'

# error_failed_convert

Component conversion failed: %s

# error_merge_metadata_target_unsupported

Merge convert for metadata target format currently unsupported

# error_in_tooling_retrieve

Unexpected error while retrieving using Tooling API. Stack trace: %s

# error_md_not_present_in_org

%s was not found in org

# error_missing_adapter

Missing adapter '%s' for metadata type '%s'

# error_missing_transformer

Missing transformer '%s' for metadata type '%s'

# error_missing_metadata_xml

%s: Metadata xml file missing for '%s'

# error_unsupported_content_metadata_xml

%s: Unsupported content xml file for '%s'

# error_missing_type_definition

Missing metadata type definition in registry for id '%s'.

# error_missing_child_type_definition

Type %s does not have a child type definition %s.

# error_no_metadata_xml_ignore

Metadata xml file %s is forceignored but is required for %s.

# error_no_source_ignore

%s metadata types require source files, but %s is forceignored.

# error_no_source_ignore.actions

- Metadata types with content are composed of two files: a content file (ie MyApexClass.cls) and a -meta.xml file (i.e MyApexClass.cls-meta.xml). You must include both files in your .forceignore file. Or try appending “\*” to your existing .forceignore entry.

# error_path_not_found

%s: File or folder not found

# tapi_retrieve_component_limit_error

This retrieve method only supports retrieving one metadata component at a time

# error_on_manifest_creation

Unexpected error while creating manifest for '%s'. Stack trace: %s

# error_creating_metadata_type

Unexpected error creating '%s'

# error_updating_metadata_type

Unexpected error updating '%s'

# error_parsing_metadata_file

Error parsing metadata file

# error_parsing_xml

SourceComponent %s does not have an associated metadata xml to parse

# error_expected_file_path

%s: path is to a directory, expected a file

# error_expected_directory_path

%s: path is to a file, expected a directory

# error_no_directory_stream

%s doesn't support readable streams on directories.

# error_no_source_to_deploy

No source-backed components present in the package.

# error_no_components_to_retrieve

No components in the package to retrieve.

# error_invalid_package

The metadata package wasn't properly initialized.

# error_static_resource_expected_archive_type

A StaticResource directory must have a content type of application/zip or application/jar - found %s for %s.

# error_static_resource_missing_resource_file

A StaticResource must have an associated .resource file, missing %s.resource-meta.xml

# error_no_job_id

The %s operation is missing a job ID. Initialize an operation with an ID, or start a new job.

# tapi_deploy_component_limit_error

This deploy method only supports deploying one metadata component at a time

# warn_unresolved_source_for_components

The following components will not be deployed due to unresolved source: %s

# invalid_xml_parsing

error parsing %s due to:\n message: %s\n line: %s\n code: %s
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@salesforce/source-deploy-retrieve",
"version": "5.15.0",
"version": "6.0.0",
"description": "JavaScript library to run Salesforce metadata deploys and retrieves",
"main": "lib/src/index.js",
"author": "Salesforce",
Expand All @@ -18,15 +18,16 @@
"retrieve"
],
"files": [
"lib/src"
"lib/src",
"messages"
],
"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},
"dependencies": {
"@salesforce/core": "^2.37.1",
"@salesforce/core": "^3.19.0",
"@salesforce/kit": "^1.5.41",
"@salesforce/ts-types": "^1.4.2",
"@salesforce/ts-types": "^1.5.20",
"archiver": "^5.3.0",
"fast-xml-parser": "^3.17.4",
"graceful-fs": "^4.2.8",
Expand All @@ -36,13 +37,12 @@
"xmldom-sfdx-encoding": "^0.1.29"
},
"devDependencies": {
"@salesforce/dev-config": "^2.1.3",
"@salesforce/dev-scripts": "^1.0.2",
"@salesforce/dev-config": "^3.0.1",
"@salesforce/dev-scripts": "^2.0.1",
"@salesforce/prettier-config": "^0.0.2",
"@salesforce/ts-sinon": "^1.1.2",
"@types/archiver": "^5.1.1",
"@types/deep-equal-in-any-order": "^1.0.1",
"@types/jsforce": "^1.9.38",
"@types/mime": "2.0.3",
"@types/mkdirp": "0.5.2",
"@types/shelljs": "^0.8.9",
Expand All @@ -65,8 +65,9 @@
"eslint-plugin-prettier": "^4.0.0",
"got": "^11.8.2",
"husky": "^7.0.4",
"jsforce": "2.0.0-beta.10",
"lint-staged": "^10.2.11",
"mocha": "^8.4.0",
"mocha": "^9.1.3",
"mocha-junit-reporter": "^1.23.3",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
Expand Down
29 changes: 16 additions & 13 deletions src/client/deployStrategies/baseDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
*/
/* eslint @typescript-eslint/no-unsafe-assignment:0, @typescript-eslint/no-unsafe-call:0, @typescript-eslint/no-unsafe-member-access:0 */
import { sep } from 'path';
import { Connection } from '@salesforce/core';
import { Connection, Messages, SfError } from '@salesforce/core';
import { readFileSync } from 'graceful-fs';
import { DeployError } from '../../errors';
import { SaveResult } from 'jsforce';
import { SourceComponent } from '../../resolve';
import { SourceDeployResult, ToolingCreateResult } from '../types';
import { SourceDeployResult } from '../types';

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
const DOMParser = require('xmldom-sfdx-encoding').DOMParser;

Messages.importMessagesDirectory(__dirname);
const messages = Messages.load('@salesforce/source-deploy-retrieve', 'sdr', [
'error_parsing_metadata_file',
'error_creating_metadata_type',
]);

export abstract class BaseDeploy {
private static readonly TOOLING_PATH_SEP = '/';

Expand Down Expand Up @@ -49,24 +55,21 @@ export abstract class BaseDeploy {
...(labelNode ? { label: labelNode.textContent } : {}),
};
} catch (e) {
throw new DeployError('error_parsing_metadata_file');
throw new SfError(messages.getMessage('error_parsing_metadata_file'), 'DeployError');
}
}

// If bundle already exists then use Id and update existing
// else, create a new bundle
public async upsertBundle(Id?: string): Promise<ToolingCreateResult> {
public async upsertBundle(Id?: string): Promise<SaveResult> {
const metadataContent = readFileSync(this.component.xml, 'utf8');
const metadataField = this.buildMetadataField(metadataContent);

let bundleResult: ToolingCreateResult;
let bundleResult: SaveResult;
if (Id) {
const bundleObject = { Id, Metadata: metadataField };

bundleResult = (await this.connection.tooling.update(
this.component.type.name,
bundleObject
)) as ToolingCreateResult;
bundleResult = await this.connection.tooling.update(this.component.type.name, bundleObject);
} else {
const bundleObject = {
FullName: this.component.fullName,
Expand All @@ -77,14 +80,14 @@ export abstract class BaseDeploy {
}

if (!bundleResult.success) {
throw new DeployError('error_creating_metadata_type', this.component.type.name);
throw new SfError(messages.getMessage('error_creating_metadata_type', [this.component.type.name]), 'DeployError');
}

return bundleResult;
}

protected async toolingCreate(type: string, record: Record<string, unknown>): Promise<ToolingCreateResult> {
return (await this.connection.tooling.create(type, record)) as ToolingCreateResult;
protected async toolingCreate(type: string, record: Record<string, unknown>): Promise<SaveResult> {
return await this.connection.tooling.create(type, record);
}

protected getFormattedPaths(filepath: string): string[] {
Expand Down
Loading