@salesforce/test-plugin117 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Salesforce CLI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ testPlugin117
2
+ =============
3
+
4
+
5
+
6
+ [![Version](https://img.shields.io/npm/v/testPlugin117.svg)](https://npmjs.org/package/testPlugin117)
7
+ [![CircleCI](https://circleci.com/gh/vmundra/testPlugin117/tree/master.svg?style=shield)](https://circleci.com/gh/vmundra/testPlugin117/tree/master)
8
+ [![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/vmundra/testPlugin117?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/testPlugin117/branch/master)
9
+ [![Greenkeeper](https://badges.greenkeeper.io/vmundra/testPlugin117.svg)](https://greenkeeper.io/)
10
+ [![Known Vulnerabilities](https://snyk.io/test/github/vmundra/testPlugin117/badge.svg)](https://snyk.io/test/github/vmundra/testPlugin117)
11
+ [![Downloads/week](https://img.shields.io/npm/dw/testPlugin117.svg)](https://npmjs.org/package/testPlugin117)
12
+ [![License](https://img.shields.io/npm/l/testPlugin117.svg)](https://github.com/vmundra/testPlugin117/blob/master/package.json)
13
+
14
+ <!-- toc -->
15
+ * [Debugging your plugin](#debugging-your-plugin)
16
+ <!-- tocstop -->
17
+ <!-- install -->
18
+ <!-- usage -->
19
+ ```sh-session
20
+ $ npm install -g @salesforce/test-plugin117
21
+ $ sfdx COMMAND
22
+ running command...
23
+ $ sfdx (-v|--version|version)
24
+ @salesforce/test-plugin117/1.0.0 linux-x64 node-v16.16.0
25
+ $ sfdx --help [COMMAND]
26
+ USAGE
27
+ $ sfdx COMMAND
28
+ ...
29
+ ```
30
+ <!-- usagestop -->
31
+ <!-- commands -->
32
+ * [`sfdx hello:org [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-helloorg--n-string--f--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
33
+
34
+ ## `sfdx hello:org [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
35
+
36
+ print a greeting and your org IDs
37
+
38
+ ```
39
+ USAGE
40
+ $ sfdx hello:org [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
41
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
42
+
43
+ OPTIONS
44
+ -f, --force example boolean flag
45
+ -n, --name=name name to print
46
+
47
+ -u, --targetusername=targetusername username or alias for the target
48
+ org; overrides default target org
49
+
50
+ -v, --targetdevhubusername=targetdevhubusername username or alias for the dev hub
51
+ org; overrides default dev hub org
52
+
53
+ --apiversion=apiversion override the api version used for
54
+ api requests made by this command
55
+
56
+ --json format output as json
57
+
58
+ --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
59
+ this command invocation
60
+
61
+ EXAMPLES
62
+ sfdx hello:org --targetusername myOrg@example.com --targetdevhubusername devhub@org.com
63
+ sfdx hello:org --name myname --targetusername myOrg@example.com
64
+ ```
65
+
66
+ _See code: [src/commands/hello/org.ts](https://github.com/vmundra/testPlugin117/blob/v1.0.0/src/commands/hello/org.ts)_
67
+ <!-- commandsstop -->
68
+ <!-- debugging-your-plugin -->
69
+ # Debugging your plugin
70
+ We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the `.vscode` directory of this plugin is a `launch.json` config file, which allows you to attach a debugger to the node process when running your commands.
71
+
72
+ To debug the `hello:org` command:
73
+ 1. Start the inspector
74
+
75
+ If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
76
+ ```sh-session
77
+ $ sfdx hello:org -u myOrg@example.com --dev-suspend
78
+ ```
79
+
80
+ Alternatively, to call your command using the `bin/run` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
81
+ ```sh-session
82
+ $ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
83
+ ```
84
+
85
+ 2. Set some breakpoints in your command code
86
+ 3. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
87
+ 4. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
88
+ 5. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
89
+ 6. Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
90
+ <br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
91
+ Congrats, you are debugging!
@@ -0,0 +1,17 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class Org extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ name: flags.Discriminated<flags.String>;
11
+ force: flags.Discriminated<flags.Boolean<boolean>>;
12
+ };
13
+ protected static requiresUsername: boolean;
14
+ protected static supportsDevhubUsername: boolean;
15
+ protected static requiresProject: boolean;
16
+ run(): Promise<AnyJson>;
17
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ * Copyright (c) 2020, salesforce.com, inc.
5
+ * All rights reserved.
6
+ * Licensed under the BSD 3-Clause license.
7
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
+ */
9
+ const os = require("os");
10
+ const command_1 = require("@salesforce/command");
11
+ const core_1 = require("@salesforce/core");
12
+ // Initialize Messages with the current plugin directory
13
+ core_1.Messages.importMessagesDirectory(__dirname);
14
+ // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
15
+ // or any library that is using the messages framework can also be loaded this way.
16
+ const messages = core_1.Messages.loadMessages('@salesforce/test-plugin117', 'org');
17
+ class Org extends command_1.SfdxCommand {
18
+ async run() {
19
+ const name = (this.flags.name || 'world');
20
+ // this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
21
+ const conn = this.org.getConnection();
22
+ const query = 'Select Name, TrialExpirationDate from Organization';
23
+ // Query the org
24
+ const result = await conn.query(query);
25
+ // Organization will always return one result, but this is an example of throwing an error
26
+ // The output and --json will automatically be handled for you.
27
+ if (!result.records || result.records.length <= 0) {
28
+ throw new core_1.SfdxError(messages.getMessage('errorNoOrgResults', [this.org.getOrgId()]));
29
+ }
30
+ // Organization always only returns one result
31
+ const orgName = result.records[0].Name;
32
+ const trialExpirationDate = result.records[0].TrialExpirationDate;
33
+ let outputString = `Hello ${name}! This is org: ${orgName}`;
34
+ if (trialExpirationDate) {
35
+ const date = new Date(trialExpirationDate).toDateString();
36
+ outputString = `${outputString} and I will be around until ${date}!`;
37
+ }
38
+ this.ux.log(outputString);
39
+ // this.hubOrg is NOT guaranteed because supportsHubOrgUsername=true, as opposed to requiresHubOrgUsername.
40
+ if (this.hubOrg) {
41
+ const hubOrgId = this.hubOrg.getOrgId();
42
+ this.ux.log(`My hub org id is: ${hubOrgId}`);
43
+ }
44
+ if (this.flags.force && this.args.file) {
45
+ this.ux.log(`You input --force and a file: ${this.args.file}`);
46
+ }
47
+ // Return an object to be displayed with --json
48
+ return { orgId: this.org.getOrgId(), outputString };
49
+ }
50
+ }
51
+ exports.default = Org;
52
+ Org.description = messages.getMessage('commandDescription');
53
+ Org.examples = messages.getMessage('examples').split(os.EOL);
54
+ Org.args = [{ name: 'file' }];
55
+ Org.flagsConfig = {
56
+ // flag with a value (-n, --name=VALUE)
57
+ name: command_1.flags.string({
58
+ char: 'n',
59
+ description: messages.getMessage('nameFlagDescription'),
60
+ }),
61
+ force: command_1.flags.boolean({
62
+ char: 'f',
63
+ description: messages.getMessage('forceFlagDescription'),
64
+ }),
65
+ };
66
+ // Comment this out if your command does not require an org username
67
+ Org.requiresUsername = true;
68
+ // Comment this out if your command does not support a hub org username
69
+ Org.supportsDevhubUsername = true;
70
+ // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
71
+ Org.requiresProject = false;
72
+ //# sourceMappingURL=org.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.js","sourceRoot":"","sources":["../../../src/commands/hello/org.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAAuD;AAGvD,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4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(exports, "__esModule", { value: true });
3
+ exports.default = {};
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,kBAAe,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "commandDescription": "print a greeting and your org IDs",
3
+ "nameFlagDescription": "name to print",
4
+ "forceFlagDescription": "example boolean flag",
5
+ "errorNoOrgResults": "No results found for the org '%s'.",
6
+ "examples": [
7
+ "sfdx hello:org --targetusername myOrg@example.com --targetdevhubusername devhub@org.com",
8
+ "sfdx hello:org --name myname --targetusername myOrg@example.com"
9
+ ]
10
+ }
@@ -0,0 +1 @@
1
+ {"version":"1.0.0","commands":{"hello:org":{"id":"hello:org","description":"print a greeting and your org IDs","usage":"<%= command.id %> [-n <string>] [-f] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"@salesforce/test-plugin117","pluginType":"core","aliases":[],"examples":["sfdx hello:org --targetusername myOrg@example.com --targetdevhubusername devhub@org.com","sfdx hello:org --name myname --targetusername myOrg@example.com"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"},"targetdevhubusername":{"name":"targetdevhubusername","type":"option","char":"v","description":"username or alias for the dev hub org; overrides default dev hub org"},"targetusername":{"name":"targetusername","type":"option","char":"u","description":"username or alias for the target org; overrides default target org"},"apiversion":{"name":"apiversion","type":"option","description":"override the api version used for api requests made by this command"},"name":{"name":"name","type":"option","char":"n","description":"name to print"},"force":{"name":"force","type":"boolean","char":"f","description":"example boolean flag","allowNo":false}},"args":[{"name":"file"}]}}}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@salesforce/test-plugin117",
3
+ "version": "1.0.0",
4
+ "author": "Vamsi-Mundra-Salesforce",
5
+ "bugs": "https://github.com/vmundra/testPlugin117/issues",
6
+ "dependencies": {
7
+ "@oclif/core": "^1",
8
+ "@salesforce/command": "^5.2.6",
9
+ "@salesforce/core": "^3.26.2",
10
+ "tslib": "^2"
11
+ },
12
+ "devDependencies": {
13
+ "@salesforce/dev-config": "^2",
14
+ "@salesforce/dev-scripts": "^3.1.0",
15
+ "@salesforce/prettier-config": "^0",
16
+ "@salesforce/ts-sinon": "^1",
17
+ "@types/chai": "^4",
18
+ "@types/mocha": "^8",
19
+ "@typescript-eslint/eslint-plugin": "^4",
20
+ "@typescript-eslint/parser": "^4",
21
+ "chai": "^4",
22
+ "eslint": "^7",
23
+ "eslint-config-prettier": "^8",
24
+ "eslint-config-salesforce": "^0",
25
+ "eslint-config-salesforce-typescript": "^0",
26
+ "eslint-plugin-header": "^3",
27
+ "eslint-plugin-import": "^2",
28
+ "eslint-plugin-jsdoc": "^35",
29
+ "eslint-plugin-typescript": "^0",
30
+ "globby": "^11",
31
+ "husky": "^4",
32
+ "mocha": "^8",
33
+ "nyc": "^15",
34
+ "oclif": "^2.7.0",
35
+ "prettier": "^2",
36
+ "pretty-quick": "^3",
37
+ "sinon": "10.0.0",
38
+ "ts-node": "^10",
39
+ "typescript": "4"
40
+ },
41
+ "engines": {
42
+ "node": ">=12.0.0"
43
+ },
44
+ "files": [
45
+ "/lib",
46
+ "/messages",
47
+ "/npm-shrinkwrap.json",
48
+ "/oclif.manifest.json"
49
+ ],
50
+ "homepage": "https://github.com/vmundra/testPlugin117",
51
+ "keywords": [
52
+ "sfdx-plugin"
53
+ ],
54
+ "license": "MIT",
55
+ "oclif": {
56
+ "commands": "./lib/commands",
57
+ "bin": "sfdx",
58
+ "topics": {
59
+ "hello": {
60
+ "description": "Commands to say hello."
61
+ }
62
+ },
63
+ "devPlugins": [
64
+ "@oclif/plugin-help"
65
+ ]
66
+ },
67
+ "repository": "vmundra/testPlugin117",
68
+ "scripts": {
69
+ "build": "tsc -p .",
70
+ "lint": "eslint src/**/*.ts test/**/*.ts",
71
+ "postpack": "rm -f oclif.manifest.json",
72
+ "posttest": "eslint src/**/*.ts test/**/*.ts",
73
+ "prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
74
+ "test": "nyc --extension .ts --require ts-node/register mocha --forbid-only \"test/**/*.test.ts\"",
75
+ "version": "oclif-dev readme && git add README.md"
76
+ },
77
+ "publishConfig": {
78
+ "access": "public"
79
+ }
80
+ }