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

feat: support retrieves in metadata format #313

Merged
merged 16 commits into from Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions command-snapshot.json
Expand Up @@ -2,7 +2,7 @@
{
"command": "deploy",
"plugin": "@salesforce/plugin-deploy-retrieve",
"flags": ["interactive"],
"flags": ["interactive", "json"],
"alias": []
},
{
Expand Down Expand Up @@ -85,9 +85,13 @@
"manifest",
"metadata",
"package-name",
"single-package",
"source-dir",
"target-metadata-dir",
"target-org",
"wait"
"unzip",
"wait",
"zip-file-name"
],
"alias": []
}
Expand Down
30 changes: 29 additions & 1 deletion messages/retrieve.metadata.md
Expand Up @@ -65,7 +65,7 @@ Ignore conflicts and retrieve and save files to your local filesystem, even if t

# flags.ignore-conflicts.description

This flag applies only to orgs that allow source tracking. It has no effect on orgs that don't allow it, such as production orgs.
This flag applies only to orgs that allow source tracking. It has no effect on orgs that don't allow it, such as production orgs.

# flags.manifest.summary

Expand Down Expand Up @@ -107,6 +107,26 @@ Number of minutes to wait for the command to complete and display results to the

If the command continues to run after the wait period, the CLI returns control of the terminal window to you.

# flags.metadata-dir.summary

Root of directory or zip file of metadata formatted files to retrieve.

# flags.single-package.summary

Indicates that the zip file points to a directory structure for a single package.

# flags.target-metadata-dir.summary

Directory root for the retrieved files.

# flags.unzip.summary

Extract all files from the retrieved zip file.

# flags.zip-file-name.summary

File name to use for the retrieved zip file.

# spinner.start

Preparing retrieve request
Expand All @@ -128,3 +148,11 @@ There are changes in your local files that conflict with the org changes you're
- To overwrite the local changes, rerun this command with the --ignore-conflicts flag.

- To overwrite the remote changes, run the "sf deploy metadata" command with the --ignore-conflicts flag.

# info.WroteZipFile

Wrote retrieve zip file to %s.

# info.ExtractedZipFile

Extracted %s to $s.
15 changes: 15 additions & 0 deletions messages/validation.md
@@ -0,0 +1,15 @@
# error.InvalidFlagPath

The %s command parameter specifies an invalid path: %s\n%s

# error.ExpectedDirectory

Expected a directory but found a file.

# error.ExpectedFile

Expected a file but found a directory.

# error.PathNotFound

No such file or directory.
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -5,10 +5,10 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^1.9.0",
"@salesforce/core": "^3.22.1",
"@oclif/core": "^1.13.1",
"@salesforce/core": "^3.25.1",
"@salesforce/kit": "^1.5.41",
"@salesforce/sf-plugins-core": "^1.13.0",
"@salesforce/sf-plugins-core": "^1.13.1",
"@salesforce/source-deploy-retrieve": "^6.1.0",
"@salesforce/source-tracking": "^2.2.0",
"chalk": "^4.1.2",
Expand Down Expand Up @@ -62,8 +62,8 @@
"typescript": "^4.6.2"
},
"resolutions": {
"@oclif/core": "^1.6.4",
"@salesforce/sf-plugins-core": "^1.11.0"
"@oclif/core": "^1.13.1",
"@salesforce/sf-plugins-core": "^1.13.1"
},
"config": {
"commitizen": {
Expand Down
173 changes: 121 additions & 52 deletions schemas/retrieve-metadata.json
Expand Up @@ -3,66 +3,73 @@
"$ref": "#/definitions/RetrieveResultJson",
"definitions": {
"RetrieveResultJson": {
"type": "object",
"additionalProperties": false,
"properties": {
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/FileResponse"
}
},
"done": {
"type": "boolean"
},
"fileProperties": {
"anyOf": [
{
"$ref": "#/definitions/FileProperties"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/FileProperties"
}
}
]
},
"id": {
"type": "string"
},
"status": {
"$ref": "#/definitions/RequestStatus"
},
"success": {
"type": "boolean"
},
"messages": {
"anyOf": [
{
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/RetrieveMessage"
"$ref": "#/definitions/FileResponse"
}
},
{
"$ref": "#/definitions/RetrieveMessage"
"done": {
"type": "boolean"
},
"fileProperties": {
"anyOf": [
{
"$ref": "#/definitions/FileProperties"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/FileProperties"
}
}
]
},
"id": {
"type": "string"
},
"status": {
"$ref": "#/definitions/RequestStatus"
},
"success": {
"type": "boolean"
},
"messages": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/RetrieveMessage"
}
},
{
"$ref": "#/definitions/RetrieveMessage"
}
]
},
"zipFile": {
"type": "string",
"description": "`base64` encoded string"
}
},
"required": [
"done",
"fileProperties",
"files",
"id",
"status",
"success",
"zipFile"
]
},
"zipFile": {
"type": "string",
"description": "`base64` encoded string"
{
"$ref": "#/definitions/MetadataRetrieveResultJson"
}
},
"required": [
"done",
"fileProperties",
"files",
"id",
"status",
"success",
"zipFile"
]
},
"FileResponse": {
Expand Down Expand Up @@ -231,6 +238,68 @@
"problem"
],
"additionalProperties": false
},
"MetadataRetrieveResultJson": {
"type": "object",
"additionalProperties": false,
"properties": {
"zipFilePath": {
"type": "string"
},
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/FileResponse"
}
},
"done": {
"type": "boolean"
},
"fileProperties": {
"anyOf": [
{
"$ref": "#/definitions/FileProperties"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/FileProperties"
}
}
]
},
"id": {
"type": "string"
},
"status": {
"$ref": "#/definitions/RequestStatus"
},
"success": {
"type": "boolean"
},
"messages": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/RetrieveMessage"
}
},
{
"$ref": "#/definitions/RetrieveMessage"
}
]
}
},
"required": [
"done",
"fileProperties",
"files",
"id",
"status",
"success",
"zipFilePath"
]
}
}
}
1 change: 1 addition & 0 deletions src/commands/deploy/metadata.ts
Expand Up @@ -21,6 +21,7 @@ Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata');

const exclusiveFlags = ['manifest', 'source-dir', 'metadata', 'metadata-dir'];

export default class DeployMetadata extends SfCommand<DeployResultJson> {
public static readonly description = messages.getMessage('description');
public static readonly summary = messages.getMessage('summary');
Expand Down