@sharinpix/sharinpix-sf-cli 1.1.0 → 1.2.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/README.md +19 -69
- package/lib/commands/sharinpix/form/pull.d.ts +2 -0
- package/lib/commands/sharinpix/form/pull.js +17 -35
- package/lib/commands/sharinpix/form/pull.js.map +1 -1
- package/messages/sharinpix.form.pull.md +29 -0
- package/oclif.manifest.json +7 -65
- package/package.json +2 -6
- package/lib/commands/hello/world.d.ts +0 -13
- package/lib/commands/hello/world.js +0 -55
- package/lib/commands/hello/world.js.map +0 -1
- package/messages/hello.world.md +0 -29
package/README.md
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SharinPix Salesforce CLI Plugin
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@sharinpix/sharinpix-sf-cli) [](https://npmjs.org/package/@sharinpix/sharinpix-sf-cli) [](https://raw.githubusercontent.com/sharinpix/sharinpix-sf-cli/main/LICENSE.txt)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
|
|
8
|
-
|
|
9
|
-
1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
|
|
10
|
-
2. Generate your plugin:
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
sf plugins install dev
|
|
14
|
-
sf dev generate plugin
|
|
15
|
-
|
|
16
|
-
git init -b main
|
|
17
|
-
git add . && git commit -m "chore: initial commit"
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
3. Create your plugin's repo in the salesforcecli github org
|
|
21
|
-
4. When you're ready, replace the contents of this README with the information you want.
|
|
5
|
+
The SharinPix Salesforce CLI plugin provides tools to interact with SharinPix form templates in your Salesforce orgs. This plugin allows you to pull form templates from your Salesforce org and save them as local JSON files for version control and deployment management.
|
|
22
6
|
|
|
23
7
|
## Learn about `sf` plugins
|
|
24
8
|
|
|
@@ -53,12 +37,12 @@ We always recommend using the latest version of these commands bundled with the
|
|
|
53
37
|
## Install
|
|
54
38
|
|
|
55
39
|
```bash
|
|
56
|
-
sf plugins install sharinpix-sf-cli@x.y.z
|
|
40
|
+
sf plugins install @sharinpix/sharinpix-sf-cli@x.y.z
|
|
57
41
|
```
|
|
58
42
|
|
|
59
43
|
## Issues
|
|
60
44
|
|
|
61
|
-
Please report any issues at https://github.com/
|
|
45
|
+
Please report any issues at https://github.com/sharinpix/sharinpix-sf-cli/issues
|
|
62
46
|
|
|
63
47
|
## Contributing
|
|
64
48
|
|
|
@@ -85,17 +69,17 @@ To build the plugin locally, make sure to have npm installed and run the followi
|
|
|
85
69
|
|
|
86
70
|
```bash
|
|
87
71
|
# Clone the repository
|
|
88
|
-
git clone git@github.com:
|
|
72
|
+
git clone git@github.com:sharinpix/sharinpix-sf-cli
|
|
89
73
|
|
|
90
74
|
# Install the dependencies and compile
|
|
91
|
-
npm && npm run build
|
|
75
|
+
npm install && npm run build
|
|
92
76
|
```
|
|
93
77
|
|
|
94
78
|
To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
|
|
95
79
|
|
|
96
80
|
```bash
|
|
97
81
|
# Run using local run file.
|
|
98
|
-
./bin/dev
|
|
82
|
+
./bin/dev sharinpix form pull --target-org myorg@example.com
|
|
99
83
|
```
|
|
100
84
|
|
|
101
85
|
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
|
|
@@ -110,76 +94,42 @@ sf plugins
|
|
|
110
94
|
## Commands
|
|
111
95
|
|
|
112
96
|
<!-- commands -->
|
|
113
|
-
* [`sf hello world`](#sf-hello-world)
|
|
114
97
|
* [`sf sharinpix form pull`](#sf-sharinpix-form-pull)
|
|
115
98
|
|
|
116
|
-
## `sf hello world`
|
|
117
|
-
|
|
118
|
-
Say hello.
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
USAGE
|
|
122
|
-
$ sf hello world -o <value> [--json] [--flags-dir <value>]
|
|
123
|
-
|
|
124
|
-
FLAGS
|
|
125
|
-
-o, --org=<value> (required) The name of the person you'd like to say hello to.
|
|
126
|
-
|
|
127
|
-
GLOBAL FLAGS
|
|
128
|
-
--flags-dir=<value> Import flag values from a directory.
|
|
129
|
-
--json Format output as json.
|
|
130
|
-
|
|
131
|
-
DESCRIPTION
|
|
132
|
-
Say hello.
|
|
133
|
-
|
|
134
|
-
Say hello either to the world or someone you know.
|
|
135
|
-
|
|
136
|
-
EXAMPLES
|
|
137
|
-
Say hello to the world:
|
|
138
|
-
|
|
139
|
-
$ sf hello world
|
|
140
|
-
|
|
141
|
-
Say hello to someone you know:
|
|
142
|
-
|
|
143
|
-
$ sf hello world --name Astro
|
|
144
|
-
|
|
145
|
-
FLAG DESCRIPTIONS
|
|
146
|
-
-o, --org=<value> The name of the person you'd like to say hello to.
|
|
147
|
-
|
|
148
|
-
This person can be anyone in the world!
|
|
149
|
-
```
|
|
150
|
-
|
|
151
99
|
## `sf sharinpix form pull`
|
|
152
100
|
|
|
153
|
-
|
|
101
|
+
Pull SharinPix form templates from Salesforce org.
|
|
154
102
|
|
|
155
103
|
```
|
|
156
104
|
USAGE
|
|
157
105
|
$ sf sharinpix form pull -o <value> [--json] [--flags-dir <value>]
|
|
158
106
|
|
|
159
107
|
FLAGS
|
|
160
|
-
-o, --org=<value> (required) The
|
|
108
|
+
-o, --org=<value> (required) The Salesforce org to pull form templates from.
|
|
161
109
|
|
|
162
110
|
GLOBAL FLAGS
|
|
163
111
|
--flags-dir=<value> Import flag values from a directory.
|
|
164
112
|
--json Format output as json.
|
|
165
113
|
|
|
166
114
|
DESCRIPTION
|
|
167
|
-
|
|
115
|
+
Pull SharinPix form templates from Salesforce org.
|
|
168
116
|
|
|
169
|
-
|
|
117
|
+
Retrieves all SharinPix form templates from the connected Salesforce org and saves them as JSON files in the local
|
|
118
|
+
sharinpix/forms directory. This command fetches the form template metadata and downloads the actual form definition
|
|
119
|
+
files.
|
|
170
120
|
|
|
171
121
|
EXAMPLES
|
|
172
|
-
|
|
122
|
+
Pull all form templates from the default org:
|
|
173
123
|
|
|
174
124
|
$ sf sharinpix form pull
|
|
175
125
|
|
|
176
|
-
|
|
126
|
+
Pull form templates from a specific org:
|
|
177
127
|
|
|
178
|
-
$ sf sharinpix form pull --
|
|
128
|
+
$ sf sharinpix form pull --target-org myorg@example.com
|
|
179
129
|
|
|
180
130
|
FLAG DESCRIPTIONS
|
|
181
|
-
-o, --org=<value> The
|
|
131
|
+
-o, --org=<value> The Salesforce org to pull form templates from.
|
|
182
132
|
|
|
183
|
-
|
|
133
|
+
The target Salesforce org containing the SharinPix form templates to be pulled.
|
|
184
134
|
```
|
|
185
135
|
<!-- commandsstop -->
|
|
@@ -4,7 +4,7 @@ import fs from 'node:fs';
|
|
|
4
4
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
5
5
|
import { Messages } from '@salesforce/core';
|
|
6
6
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
7
|
-
const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', '
|
|
7
|
+
const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'sharinpix.form.pull');
|
|
8
8
|
export default class Pull extends SfCommand {
|
|
9
9
|
static summary = messages.getMessage('summary');
|
|
10
10
|
static description = messages.getMessage('description');
|
|
@@ -20,53 +20,35 @@ export default class Pull extends SfCommand {
|
|
|
20
20
|
const { flags } = await this.parse(Pull);
|
|
21
21
|
const connection = flags.org.getConnection('63.0');
|
|
22
22
|
fs.mkdirSync('sharinpix/forms', { recursive: true });
|
|
23
|
-
const records = (await connection.query('SELECT Id, sharinpix__FormUrl__c, Name, sharinpix__Description__c FROM sharinpix__FormTemplate__c order by LastModifiedDate desc')).records
|
|
23
|
+
const records = (await connection.query('SELECT Id, sharinpix__FormUrl__c, Name, sharinpix__Description__c FROM sharinpix__FormTemplate__c order by LastModifiedDate desc')).records;
|
|
24
|
+
let formsDownloaded = 0;
|
|
25
|
+
let formsFailed = 0;
|
|
24
26
|
for (const record of records) {
|
|
25
27
|
try {
|
|
26
|
-
const
|
|
28
|
+
const response = await fetch(record.sharinpix__FormUrl__c + '.json', {
|
|
27
29
|
headers: {
|
|
28
30
|
'Accept': 'application/json',
|
|
29
31
|
}
|
|
30
|
-
})
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
35
|
+
}
|
|
36
|
+
const form = await response.json();
|
|
31
37
|
fs.writeFileSync(`sharinpix/forms/${record.Name}.json`, JSON.stringify(form, null, 2));
|
|
32
38
|
this.log(messages.getMessage('info.hello', [record.Name, record.sharinpix__FormUrl__c]));
|
|
39
|
+
formsDownloaded++;
|
|
33
40
|
}
|
|
34
41
|
catch (error) {
|
|
35
|
-
//
|
|
36
|
-
|
|
42
|
+
// Skip forms that can't be fetched (e.g., network errors, invalid URLs)
|
|
43
|
+
this.warn(`Failed to fetch form template ${record.Name}: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
44
|
+
formsFailed++;
|
|
37
45
|
}
|
|
38
|
-
// return [record.Id, record.sharinpix__FormUrl__c, record.Name, record.sharinpix__Description__c].join(',')
|
|
39
46
|
}
|
|
40
|
-
|
|
41
|
-
/* const result2 = (await connection.query('SELECT Id, Name FROM sharinpix__FormTemplate__c LIMIT 50')).records
|
|
42
|
-
.map((record) => [record.Id, record.Name].join(','))
|
|
43
|
-
.join('\n');
|
|
44
|
-
this.log(messages.getMessage('info.hello', [result2, flags.org.getOrgId()]));*/
|
|
45
|
-
/* await connection.apex.post('/sharinpix/FormTemplateImport', {
|
|
46
|
-
recordId: 'a0WJ6000001Ya27MAC',
|
|
47
|
-
name: 'Super CLI IMPORT',
|
|
48
|
-
description: 'From the cli',
|
|
49
|
-
url: 'https://google.com',
|
|
50
|
-
formTemplateJson: JSON.stringify({
|
|
51
|
-
submit: {
|
|
52
|
-
label: 'Submit',
|
|
53
|
-
},
|
|
54
|
-
elements: [
|
|
55
|
-
{
|
|
56
|
-
elemType: 'question',
|
|
57
|
-
inputType: 'string',
|
|
58
|
-
label: 'Name tega',
|
|
59
|
-
id: '0198844b-db9d-710d-8919-63d84a6663cc',
|
|
60
|
-
apiName: 'name_tega',
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
});*/
|
|
65
|
-
// this.log(messages.getMessage('info.hello', [exec.logs.join(','), time]));
|
|
66
|
-
// this.log(messages.getMessage('info.hello', [exec.exceptionMessage, time]));
|
|
67
|
-
// this.log(messages.getMessage('info.hello', [await connection.tooling.executeAnonymous('System.debug(\'Hello Pull\');'), time]));
|
|
47
|
+
this.log(`Successfully downloaded ${formsDownloaded} form template(s). ${formsFailed} failed.`);
|
|
68
48
|
return {
|
|
69
49
|
name: 'OK',
|
|
50
|
+
formsDownloaded,
|
|
51
|
+
formsFailed,
|
|
70
52
|
};
|
|
71
53
|
}
|
|
72
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/form/pull.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,6BAA6B,EAAE,
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../../src/commands/sharinpix/form/pull.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB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
+
|
|
3
|
+
Pull SharinPix form templates from Salesforce org.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Retrieves all SharinPix form templates from the connected Salesforce org and saves them as JSON files in the local sharinpix/forms directory. This command fetches the form template metadata and downloads the actual form definition files.
|
|
8
|
+
|
|
9
|
+
# flags.org.summary
|
|
10
|
+
|
|
11
|
+
The Salesforce org to pull form templates from.
|
|
12
|
+
|
|
13
|
+
# flags.org.description
|
|
14
|
+
|
|
15
|
+
The target Salesforce org containing the SharinPix form templates to be pulled.
|
|
16
|
+
|
|
17
|
+
# examples
|
|
18
|
+
|
|
19
|
+
- Pull all form templates from the default org:
|
|
20
|
+
|
|
21
|
+
<%= config.bin %> <%= command.id %>
|
|
22
|
+
|
|
23
|
+
- Pull form templates from a specific org:
|
|
24
|
+
|
|
25
|
+
<%= config.bin %> <%= command.id %> --target-org myorg@example.com
|
|
26
|
+
|
|
27
|
+
# info.hello
|
|
28
|
+
|
|
29
|
+
Pulled form template %s from %s
|
package/oclif.manifest.json
CHANGED
|
@@ -1,70 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
-
"hello:world": {
|
|
4
|
-
"aliases": [],
|
|
5
|
-
"args": {},
|
|
6
|
-
"description": "Say hello either to the world or someone you know.",
|
|
7
|
-
"examples": [
|
|
8
|
-
"Say hello to the world:\n<%= config.bin %> <%= command.id %>",
|
|
9
|
-
"Say hello to someone you know:\n<%= config.bin %> <%= command.id %> --name Astro"
|
|
10
|
-
],
|
|
11
|
-
"flags": {
|
|
12
|
-
"json": {
|
|
13
|
-
"description": "Format output as json.",
|
|
14
|
-
"helpGroup": "GLOBAL",
|
|
15
|
-
"name": "json",
|
|
16
|
-
"allowNo": false,
|
|
17
|
-
"type": "boolean"
|
|
18
|
-
},
|
|
19
|
-
"flags-dir": {
|
|
20
|
-
"helpGroup": "GLOBAL",
|
|
21
|
-
"name": "flags-dir",
|
|
22
|
-
"summary": "Import flag values from a directory.",
|
|
23
|
-
"hasDynamicHelp": false,
|
|
24
|
-
"multiple": false,
|
|
25
|
-
"type": "option"
|
|
26
|
-
},
|
|
27
|
-
"org": {
|
|
28
|
-
"char": "o",
|
|
29
|
-
"description": "This person can be anyone in the world!",
|
|
30
|
-
"name": "org",
|
|
31
|
-
"noCacheDefault": true,
|
|
32
|
-
"required": true,
|
|
33
|
-
"summary": "The name of the person you'd like to say hello to.",
|
|
34
|
-
"hasDynamicHelp": true,
|
|
35
|
-
"multiple": false,
|
|
36
|
-
"type": "option"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"hasDynamicHelp": true,
|
|
40
|
-
"hiddenAliases": [],
|
|
41
|
-
"id": "hello:world",
|
|
42
|
-
"pluginAlias": "@sharinpix/sharinpix-sf-cli",
|
|
43
|
-
"pluginName": "@sharinpix/sharinpix-sf-cli",
|
|
44
|
-
"pluginType": "core",
|
|
45
|
-
"strict": true,
|
|
46
|
-
"summary": "Say hello.",
|
|
47
|
-
"enableJsonFlag": true,
|
|
48
|
-
"isESM": true,
|
|
49
|
-
"relativePath": [
|
|
50
|
-
"lib",
|
|
51
|
-
"commands",
|
|
52
|
-
"hello",
|
|
53
|
-
"world.js"
|
|
54
|
-
],
|
|
55
|
-
"aliasPermutations": [],
|
|
56
|
-
"permutations": [
|
|
57
|
-
"hello:world",
|
|
58
|
-
"world:hello"
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
3
|
"sharinpix:form:pull": {
|
|
62
4
|
"aliases": [],
|
|
63
5
|
"args": {},
|
|
64
|
-
"description": "
|
|
6
|
+
"description": "Retrieves all SharinPix form templates from the connected Salesforce org and saves them as JSON files in the local sharinpix/forms directory. This command fetches the form template metadata and downloads the actual form definition files.",
|
|
65
7
|
"examples": [
|
|
66
|
-
"
|
|
67
|
-
"
|
|
8
|
+
"Pull all form templates from the default org:\n<%= config.bin %> <%= command.id %>",
|
|
9
|
+
"Pull form templates from a specific org:\n<%= config.bin %> <%= command.id %> --target-org myorg@example.com"
|
|
68
10
|
],
|
|
69
11
|
"flags": {
|
|
70
12
|
"json": {
|
|
@@ -84,11 +26,11 @@
|
|
|
84
26
|
},
|
|
85
27
|
"org": {
|
|
86
28
|
"char": "o",
|
|
87
|
-
"description": "
|
|
29
|
+
"description": "The target Salesforce org containing the SharinPix form templates to be pulled.",
|
|
88
30
|
"name": "org",
|
|
89
31
|
"noCacheDefault": true,
|
|
90
32
|
"required": true,
|
|
91
|
-
"summary": "The
|
|
33
|
+
"summary": "The Salesforce org to pull form templates from.",
|
|
92
34
|
"hasDynamicHelp": true,
|
|
93
35
|
"multiple": false,
|
|
94
36
|
"type": "option"
|
|
@@ -101,7 +43,7 @@
|
|
|
101
43
|
"pluginName": "@sharinpix/sharinpix-sf-cli",
|
|
102
44
|
"pluginType": "core",
|
|
103
45
|
"strict": true,
|
|
104
|
-
"summary": "
|
|
46
|
+
"summary": "Pull SharinPix form templates from Salesforce org.",
|
|
105
47
|
"enableJsonFlag": true,
|
|
106
48
|
"isESM": true,
|
|
107
49
|
"relativePath": [
|
|
@@ -122,5 +64,5 @@
|
|
|
122
64
|
]
|
|
123
65
|
}
|
|
124
66
|
},
|
|
125
|
-
"version": "1.
|
|
67
|
+
"version": "1.2.0"
|
|
126
68
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharinpix/sharinpix-sf-cli",
|
|
3
3
|
"description": "SharinPix salesforce cli plugin",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4",
|
|
7
7
|
"@salesforce/core": "^8",
|
|
@@ -45,11 +45,7 @@
|
|
|
45
45
|
"devPlugins": [
|
|
46
46
|
"@oclif/plugin-help"
|
|
47
47
|
],
|
|
48
|
-
"topics": {
|
|
49
|
-
"hello": {
|
|
50
|
-
"description": "Commands to say hello."
|
|
51
|
-
}
|
|
52
|
-
},
|
|
48
|
+
"topics": {},
|
|
53
49
|
"flexibleTaxonomy": true
|
|
54
50
|
},
|
|
55
51
|
"scripts": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
export type HelloWorldResult = {
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
5
|
-
export default class World extends SfCommand<HelloWorldResult> {
|
|
6
|
-
static readonly summary: string;
|
|
7
|
-
static readonly description: string;
|
|
8
|
-
static readonly examples: string[];
|
|
9
|
-
static readonly flags: {
|
|
10
|
-
org: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
};
|
|
12
|
-
run(): Promise<HelloWorldResult>;
|
|
13
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { Messages } from '@salesforce/core';
|
|
3
|
-
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
4
|
-
const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'hello.world');
|
|
5
|
-
export default class World extends SfCommand {
|
|
6
|
-
static summary = messages.getMessage('summary');
|
|
7
|
-
static description = messages.getMessage('description');
|
|
8
|
-
static examples = messages.getMessages('examples');
|
|
9
|
-
static flags = {
|
|
10
|
-
org: Flags.requiredOrg({
|
|
11
|
-
char: 'o',
|
|
12
|
-
summary: messages.getMessage('flags.org.summary'),
|
|
13
|
-
description: messages.getMessage('flags.org.description'),
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
|
-
async run() {
|
|
17
|
-
const { flags } = await this.parse(World);
|
|
18
|
-
const connection = flags.org.getConnection('63.0');
|
|
19
|
-
const result = (await connection.query('SELECT Id, sharinpix__FormUrl__c, Name, sharinpix__Description__c FROM sharinpix__FormTemplate__c LIMIT 50')).records
|
|
20
|
-
.map((record) => [record.Id, record.sharinpix__FormUrl__c, record.Name, record.sharinpix__Description__c].join(','))
|
|
21
|
-
.join('\n');
|
|
22
|
-
this.log(messages.getMessage('info.hello', [result, flags.org.getOrgId()]));
|
|
23
|
-
const result2 = (await connection.query('SELECT Id, Name FROM sharinpix__FormTemplate__c LIMIT 50')).records
|
|
24
|
-
.map((record) => [record.Id, record.Name].join(','))
|
|
25
|
-
.join('\n');
|
|
26
|
-
this.log(messages.getMessage('info.hello', [result2, flags.org.getOrgId()]));
|
|
27
|
-
await connection.apex.post('/sharinpix/FormTemplateImport', {
|
|
28
|
-
recordId: 'a0WJ6000001Ya27MAC',
|
|
29
|
-
name: 'Super CLI IMPORT',
|
|
30
|
-
description: 'From the cli',
|
|
31
|
-
url: 'https://google.com',
|
|
32
|
-
formTemplateJson: JSON.stringify({
|
|
33
|
-
submit: {
|
|
34
|
-
label: 'Submit',
|
|
35
|
-
},
|
|
36
|
-
elements: [
|
|
37
|
-
{
|
|
38
|
-
elemType: 'question',
|
|
39
|
-
inputType: 'string',
|
|
40
|
-
label: 'Name tega',
|
|
41
|
-
id: '0198844b-db9d-710d-8919-63d84a6663cc',
|
|
42
|
-
apiName: 'name_tega',
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
}),
|
|
46
|
-
});
|
|
47
|
-
// this.log(messages.getMessage('info.hello', [exec.logs.join(','), time]));
|
|
48
|
-
// this.log(messages.getMessage('info.hello', [exec.exceptionMessage, time]));
|
|
49
|
-
// this.log(messages.getMessage('info.hello', [await connection.tooling.executeAnonymous('System.debug(\'Hello World\');'), time]));
|
|
50
|
-
return {
|
|
51
|
-
name: 'OK',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=world.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"world.js","sourceRoot":"","sources":["../../../src/commands/hello/world.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAA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
# description
|
|
6
|
-
|
|
7
|
-
Say hello either to the world or someone you know.
|
|
8
|
-
|
|
9
|
-
# flags.org.summary
|
|
10
|
-
|
|
11
|
-
The name of the person you'd like to say hello to.
|
|
12
|
-
|
|
13
|
-
# flags.org.description
|
|
14
|
-
|
|
15
|
-
This person can be anyone in the world!
|
|
16
|
-
|
|
17
|
-
# examples
|
|
18
|
-
|
|
19
|
-
- Say hello to the world:
|
|
20
|
-
|
|
21
|
-
<%= config.bin %> <%= command.id %>
|
|
22
|
-
|
|
23
|
-
- Say hello to someone you know:
|
|
24
|
-
|
|
25
|
-
<%= config.bin %> <%= command.id %> --name Astro
|
|
26
|
-
|
|
27
|
-
# info.hello
|
|
28
|
-
|
|
29
|
-
Hello %s at %s
|