Skip to content

Commit

Permalink
Sm/sf-ification (#408)
Browse files Browse the repository at this point in the history
* chore: updates from devScripts

* refactor: command flag errors

* feat: uses sf-plugins-core

* chore: bump pluginCore and core

* test: all nuts as passing

* refactor: small pruning

* refactor: current tsconfig; tests build but fail

* chore: bump sfCommand

* chore: remove mkdir types

* test: ut all working as before

* chore: snapshot

* chore: use sf commandRef

* test: refactor tests

* docs: description on bulk delete

* refactor: convert messages to md

* refactor: simplify examples

* test: use static run method where not awaiting results

* test: use testsession's new huborg prop

* chore: bump core

* refactor: reorganize command tree

* test: reorganize test folders to match commands

* refactor: message files flags start with flags

* feat: apiVersion on connections

* chore: swc

* feat: tighter checks on salesforce IDs

* style: loadMessages for examples

* docs: sf-ify messages, dynamic bin/command

* refactor: use new versioned connection from core

* chore: bump core for versioned connections

* test: harden nuts for bulk checks

* test: remove ut for unstubbable bulk

* chore: bump core, sf-plugins

* refactor: flags from sf-plugins

* chore: snapshot

* docs: redo topic structure

* docs: subtopics

* chore: revert tsconfig

* refactor: import paths for link error

* docs: remove perflog references in help

* chore: bump sf-plugins-core

* chore: lockfile dedupe

* refactor: use array flag from sf-plugins-core

* chore: deprecate cmd aliases

* chore: dependency bumps and strict null checks

* refactor: test null exceptions

* chore: bump linter

* docs: modernize messages

* chore(dev-deps): bump @salesforce/ts-sinon from 1.4.1 to 1.4.2

Bumps [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/forcedotcom/ts-sinon/releases)
- [Changelog](https://github.com/forcedotcom/ts-sinon/blob/main/CHANGELOG.md)
- [Commits](forcedotcom/ts-sinon@1.4.1...1.4.2)

---
updated-dependencies:
- dependency-name: "@salesforce/ts-sinon"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix(deps): bump @salesforce/command from 5.2.20 to 5.2.25

Bumps [@salesforce/command](https://github.com/salesforcecli/command) from 5.2.20 to 5.2.25.
- [Release notes](https://github.com/salesforcecli/command/releases)
- [Changelog](https://github.com/salesforcecli/command/blob/main/CHANGELOG.md)
- [Commits](salesforcecli/command@5.2.20...5.2.25)

---
updated-dependencies:
- dependency-name: "@salesforce/command"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(release): 2.1.12 [skip ci]

* chore(dev-deps): bump @oclif/plugin-command-snapshot

Bumps [@oclif/plugin-command-snapshot](https://github.com/oclif/plugin-command-snapshot) from 3.1.3 to 3.2.10.
- [Release notes](https://github.com/oclif/plugin-command-snapshot/releases)
- [Changelog](https://github.com/oclif/plugin-command-snapshot/blob/main/CHANGELOG.md)
- [Commits](oclif/plugin-command-snapshot@v3.1.3...3.2.10)

---
updated-dependencies:
- dependency-name: "@oclif/plugin-command-snapshot"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: parking orbit cleanup (#413)

* chore(dev-deps): bump @salesforce/plugin-command-reference

Bumps [@salesforce/plugin-command-reference](https://github.com/forcedotcom/plugin-command-reference) from 1.5.0 to 1.5.2.
- [Release notes](https://github.com/forcedotcom/plugin-command-reference/releases)
- [Commits](https://github.com/forcedotcom/plugin-command-reference/commits)

---
updated-dependencies:
- dependency-name: "@salesforce/plugin-command-reference"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix(deps): bump @salesforce/command from 5.2.25 to 5.2.27

Bumps [@salesforce/command](https://github.com/salesforcecli/command) from 5.2.25 to 5.2.27.
- [Release notes](https://github.com/salesforcecli/command/releases)
- [Changelog](https://github.com/salesforcecli/command/blob/main/CHANGELOG.md)
- [Commits](salesforcecli/command@5.2.25...5.2.27)

---
updated-dependencies:
- dependency-name: "@salesforce/command"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(release): 2.1.13 [skip ci]

* chore(dev-deps): bump typescript from 4.8.4 to 4.9.3

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.4 to 4.9.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.8.4...v4.9.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(dev-deps): bump prettier from 2.7.1 to 2.8.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.7.1 to 2.8.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.7.1...2.8.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(dev-deps): bump @salesforce/plugin-command-reference

Bumps [@salesforce/plugin-command-reference](https://github.com/forcedotcom/plugin-command-reference) from 1.5.2 to 1.5.3.
- [Release notes](https://github.com/forcedotcom/plugin-command-reference/releases)
- [Commits](https://github.com/forcedotcom/plugin-command-reference/commits)

---
updated-dependencies:
- dependency-name: "@salesforce/plugin-command-reference"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix(deps): bump @salesforce/command from 5.2.27 to 5.2.28

Bumps [@salesforce/command](https://github.com/salesforcecli/command) from 5.2.27 to 5.2.28.
- [Release notes](https://github.com/salesforcecli/command/releases)
- [Changelog](https://github.com/salesforcecli/command/blob/main/CHANGELOG.md)
- [Commits](salesforcecli/command@5.2.27...5.2.28)

---
updated-dependencies:
- dependency-name: "@salesforce/command"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(release): 2.1.14 [skip ci]

* chore: add some unit tests for dataCommand class (#428)

* chore: add some unit tests for dataCommand class

* chore: whoops, remove .only

* fix: edit messages for "data query"

* fix: allow single quotes in key=value pairs (#427)

* fix: allow single quotes in key=value pairs

This lets you use force:data:record:create and force:data:record:update with values that have single quotes

* fix: check if key=value pairs have a quoted string vs just a quote in the value

* chore: change regex exec() to test()

Co-authored-by: peternhale <[email protected]>

Co-authored-by: peternhale <[email protected]>

* chore(release): 2.1.15 [skip ci]

* fix: edit "data record" messages

* fix: edit messages for "data import/export tree" commands

and other error files.

* fix: edit messages for "data bulk upsert"

* fix(deps): bump @salesforce/core from 3.32.6 to 3.32.9

Bumps [@salesforce/core](https://github.com/forcedotcom/sfdx-core) from 3.32.6 to 3.32.9.
- [Release notes](https://github.com/forcedotcom/sfdx-core/releases)
- [Changelog](https://github.com/forcedotcom/sfdx-core/blob/main/CHANGELOG.md)
- [Commits](forcedotcom/sfdx-core@3.32.6...3.32.9)

---
updated-dependencies:
- dependency-name: "@salesforce/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(release): 2.1.16 [skip ci]

* fix(deps): bump @salesforce/command from 5.2.28 to 5.2.30

Bumps [@salesforce/command](https://github.com/salesforcecli/command) from 5.2.28 to 5.2.30.
- [Release notes](https://github.com/salesforcecli/command/releases)
- [Changelog](https://github.com/salesforcecli/command/blob/main/CHANGELOG.md)
- [Commits](salesforcecli/command@5.2.28...5.2.30)

---
updated-dependencies:
- dependency-name: "@salesforce/command"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(dev-deps): bump oclif from 3.2.28 to 3.4.2

Bumps [oclif](https://github.com/oclif/oclif) from 3.2.28 to 3.4.2.
- [Release notes](https://github.com/oclif/oclif/releases)
- [Changelog](https://github.com/oclif/oclif/blob/main/CHANGELOG.md)
- [Commits](oclif/oclif@3.2.28...3.4.2)

---
updated-dependencies:
- dependency-name: oclif
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(dev-deps): bump @swc/core from 1.3.16 to 1.3.22

Bumps [@swc/core](https://github.com/swc-project/swc) from 1.3.16 to 1.3.22.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](swc-project/swc@v1.3.16...v1.3.22)

---
updated-dependencies:
- dependency-name: "@swc/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(release): 2.1.17 [skip ci]

* fix: edit messages for "data bulk upsert"

* fix: edit "data bulk" messages

* fix: edit "data query resume" messages

* fix: fix tests that hard-code error messages

* chore(dev-deps): bump @swc/core from 1.3.22 to 1.3.23

Bumps [@swc/core](https://github.com/swc-project/swc) from 1.3.22 to 1.3.23.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](swc-project/swc@v1.3.22...v1.3.23)

---
updated-dependencies:
- dependency-name: "@swc/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: cleanup from messages audit

* test: avoid hardcoding messages in tests

* chore: remove unused flag

* fix: edit based on Shane's feedback

* fix: input Shane's feedback

* fix: update --sobject flag description to say "api name..."

* chore: deprecate cmd aliases

* chore: dependency bumps and strict null checks

* refactor: test null exceptions

* chore: bump linter

* test: nuts don't hardcode command name

* chore: bump csv-stringify

* chore: lockfile and snapshot

* chore: bump testkit

* test: nut with more generic command message

* refactor: make flags readonly

* chore: bump linter

* test: fix regex output validation

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: svc-cli-bot <[email protected]>
Co-authored-by: svc-cli-bot <[email protected]>
Co-authored-by: Willhoit <[email protected]>
Co-authored-by: Rodrigo Espinosa de los Monteros <[email protected]>
Co-authored-by: peternhale <[email protected]>
Co-authored-by: mshanemc <[email protected]>

* chore: add schema check

* fix: messages not used in help can't reference command's config/id

* style: typo from qa

* style: more message template fixes

* style: readme and more typos from QA

* style: better message for multiple record scenario

* fix: message, then error name

* style: markdown formatting

* test: assert message that's really a message message

* doc: try fixing in web UI

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: SF-CLI-BOT <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: svc-cli-bot <[email protected]>
Co-authored-by: svc-cli-bot <[email protected]>
Co-authored-by: Willhoit <[email protected]>
Co-authored-by: Rodrigo Espinosa de los Monteros <[email protected]>
Co-authored-by: peternhale <[email protected]>
Co-authored-by: Willie Ruemmele <[email protected]>
  • Loading branch information
10 people authored Jan 10, 2023
1 parent bac20b0 commit e3e845a
Show file tree
Hide file tree
Showing 103 changed files with 5,554 additions and 5,587 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/recommended'],
};
12 changes: 9 additions & 3 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"require": "ts-node/register,source-map-support/register",
"watch-extensions": "ts",
"watch-files": ["src", "test"],
"extensions": [".ts", "json"],
"watch-files": [
"src",
"test"
],
"extensions": [
".ts",
"json"
],
"recursive": true,
"reporter": "spec",
"timeout": 5000
"timeout": 10000
}
211 changes: 46 additions & 165 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022, Salesforce.com, Inc.
Copyright (c) 2023, Salesforce.com, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
1,267 changes: 947 additions & 320 deletions README.md

Large diffs are not rendered by default.

136 changes: 59 additions & 77 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,130 +1,112 @@
[
{
"command": "force:data:bulk:delete",
"command": "data:create:record",
"plugin": "@salesforce/plugin-data",
"flags": ["apiversion", "csvfile", "json", "loglevel", "sobjecttype", "targetusername", "wait"],
"alias": []
"flags": ["api-version", "json", "loglevel", "perflog", "sobject", "target-org", "use-tooling-api", "values"],
"alias": ["force:data:record:create"]
},
{
"command": "force:data:bulk:status",
"command": "data:delete:bulk",
"plugin": "@salesforce/plugin-data",
"flags": ["apiversion", "batchid", "jobid", "json", "loglevel", "targetusername"],
"alias": []
"flags": ["api-version", "file", "json", "loglevel", "sobject", "target-org", "wait"],
"alias": ["force:data:bulk:delete"]
},
{
"command": "force:data:bulk:upsert",
"command": "data:delete:record",
"plugin": "@salesforce/plugin-data",
"flags": [
"apiversion",
"csvfile",
"externalid",
"json",
"loglevel",
"serial",
"sobjecttype",
"targetusername",
"wait"
],
"alias": []
},
{
"command": "force:data:record:create",
"plugin": "@salesforce/plugin-data",
"flags": ["apiversion", "json", "loglevel", "perflog", "sobjecttype", "targetusername", "usetoolingapi", "values"],
"alias": []
},
{
"command": "force:data:record:delete",
"plugin": "@salesforce/plugin-data",
"flags": [
"apiversion",
"api-version",
"json",
"loglevel",
"perflog",
"sobjectid",
"sobjecttype",
"targetusername",
"usetoolingapi",
"record-id",
"sobject",
"target-org",
"use-tooling-api",
"where"
],
"alias": []
"alias": ["force:data:record:delete"]
},
{
"command": "force:data:record:get",
"command": "data:export:tree",
"plugin": "@salesforce/plugin-data",
"flags": [
"apiversion",
"json",
"loglevel",
"perflog",
"sobjectid",
"sobjecttype",
"targetusername",
"usetoolingapi",
"where"
],
"alias": []
"flags": ["api-version", "json", "loglevel", "output-dir", "plan", "prefix", "query", "target-org"],
"alias": ["force:data:tree:export"]
},
{
"command": "force:data:record:update",
"command": "data:get:record",
"plugin": "@salesforce/plugin-data",
"flags": [
"apiversion",
"api-version",
"json",
"loglevel",
"perflog",
"sobjectid",
"sobjecttype",
"targetusername",
"usetoolingapi",
"values",
"record-id",
"sobject",
"target-org",
"use-tooling-api",
"where"
],
"alias": []
"alias": ["force:data:record:get"]
},
{
"command": "force:data:soql:bulk:report",
"command": "data:import:tree",
"plugin": "@salesforce/plugin-data",
"flags": ["apiversion", "bulkqueryid", "json", "loglevel", "resultformat", "targetusername"],
"alias": []
"flags": ["api-version", "config-help", "content-type", "files", "json", "loglevel", "plan", "target-org"],
"alias": ["force:data:tree:import"]
},
{
"command": "force:data:soql:query",
"command": "data:query",
"plugin": "@salesforce/plugin-data",
"flags": [
"apiversion",
"api-version",
"async",
"bulk",
"file",
"json",
"loglevel",
"perflog",
"query",
"resultformat",
"soqlqueryfile",
"targetusername",
"usetoolingapi",
"result-format",
"target-org",
"use-tooling-api",
"wait"
],
"alias": []
"alias": ["force:data:soql:query"]
},
{
"command": "data:query:resume",
"plugin": "@salesforce/plugin-data",
"flags": ["api-version", "bulk-query-id", "json", "loglevel", "result-format", "target-org"],
"alias": ["force:data:soql:bulk:report"]
},
{
"command": "force:data:tree:export",
"command": "data:resume",
"plugin": "@salesforce/plugin-data",
"flags": ["apiversion", "json", "loglevel", "outputdir", "plan", "prefix", "query", "targetusername"],
"alias": []
"flags": ["api-version", "batch-id", "job-id", "json", "loglevel", "target-org"],
"alias": ["force:data:bulk:status"]
},
{
"command": "force:data:tree:import",
"command": "data:update:record",
"plugin": "@salesforce/plugin-data",
"flags": [
"apiversion",
"confighelp",
"contenttype",
"api-version",
"json",
"loglevel",
"plan",
"sobjecttreefiles",
"targetusername"
"perflog",
"record-id",
"sobject",
"target-org",
"use-tooling-api",
"values",
"where"
],
"alias": []
"alias": ["force:data:record:update"]
},
{
"command": "data:upsert:bulk",
"plugin": "@salesforce/plugin-data",
"flags": ["api-version", "external-id", "file", "json", "loglevel", "serial", "sobject", "target-org", "wait"],
"alias": ["force:data:bulk:upsert"]
}
]
12 changes: 0 additions & 12 deletions messages/batcher.json

This file was deleted.

39 changes: 39 additions & 0 deletions messages/batcher.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# BulkBatch

Batch #%s

# BulkError

Upsert errors

# BulkJobStatus

Job Status

# BatchStatus

Batch Status

# PollingInfo

Will poll the batch statuses every %s seconds.
To fetch the status on your own, press CTRL+C and use the command:
sfdx data resume -i %s -b [<batchId>]

# ExternalIdRequired

An External ID is required on %s to perform an upsert.

# TimeOut

The operation timed out. Check the status with command:
sfdx data resume -i %s -b %s

# CheckStatusCommand

Check batch #%s’s status with the command:
sfdx data resume -i %s -b %s

# BatchQueued

Batch #%s queued (Batch ID: %s).
12 changes: 0 additions & 12 deletions messages/bulk.delete.json

This file was deleted.

31 changes: 31 additions & 0 deletions messages/bulk.delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# summary

Bulk delete records from an org using a CSV file.

# description

The CSV file must have only one column ("Id") and then the list of record IDs you want to delete, one ID per line.

When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with the "<%= config.bin %> data resume" command. A single job can contain many batches, depending on the length of the CSV file.

# examples

- Bulk delete Account records using the list of IDs in the "files/delete.csv" file:

<%= config.bin %> <%= command.id %> --sobject Account --file files/delete.csv

- Bulk delete records from a custom object and wait 5 minutes for the command to complete:

<%= config.bin %> <%= command.id %> --sobject MyObject__c --file files/delete.csv --wait 5

# flags.sobjecttype

API name of the Salesforce object, either standard or custom, that you want to delete records from.

# flags.csvfile

CSV file that contains the IDs of the records to delete.

# flags.wait

Number of minutes to wait for the command to complete before displaying the results.
7 changes: 0 additions & 7 deletions messages/bulk.report.json

This file was deleted.

17 changes: 17 additions & 0 deletions messages/bulk.report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# summary

View the status of a bulk query.

# description

Run this command using the job ID returned from the "<%= config.bin %> data query --bulk" command.

# examples

- View the status of a bulk query with the specified ID:

<%= config.bin %> <%= command.id %> --bulk-query-id 7500x000005BdFzXXX

# flags.bulkQueryId

Job ID of the bulk query.
12 changes: 0 additions & 12 deletions messages/bulk.status.json

This file was deleted.

29 changes: 29 additions & 0 deletions messages/bulk.status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# summary

View the status of a bulk data load job or batch.

# description

Run this command using the job ID or batch ID returned from the "<%= config.bin %> data delete bulk" or "<%= config.bin %> data upsert bulk" commands.

# examples

- View the status of a bulk load job:

<%= config.bin %> <%= command.id %> --job-id 750xx000000005sAAA

- View the status of a bulk load job and a specific batches:

<%= config.bin %> <%= command.id %> --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA

# flags.jobid

ID of the job whose status you want to view.

# flags.batchid

ID of the batch whose status you want to view; you must also specify the job ID.

# NoBatchFound

Unable to find batch %s for job %s.
Loading

0 comments on commit e3e845a

Please sign in to comment.