@sharinpix/sharinpix-sf-cli 1.0.0 → 1.1.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 CHANGED
@@ -81,14 +81,14 @@ Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
81
81
 
82
82
  ### Build
83
83
 
84
- To build the plugin locally, make sure to have yarn installed and run the following commands:
84
+ To build the plugin locally, make sure to have npm installed and run the following commands:
85
85
 
86
86
  ```bash
87
87
  # Clone the repository
88
88
  git clone git@github.com:salesforcecli/sharinpix-sf-cli
89
89
 
90
90
  # Install the dependencies and compile
91
- yarn && yarn build
91
+ npm && npm run build
92
92
  ```
93
93
 
94
94
  To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
@@ -110,25 +110,26 @@ sf plugins
110
110
  ## Commands
111
111
 
112
112
  <!-- commands -->
113
-
114
- - [`sf hello world`](#sf-hello-world)
113
+ * [`sf hello world`](#sf-hello-world)
114
+ * [`sf sharinpix form pull`](#sf-sharinpix-form-pull)
115
115
 
116
116
  ## `sf hello world`
117
117
 
118
- Say hello either to the world or someone you know.
118
+ Say hello.
119
119
 
120
120
  ```
121
121
  USAGE
122
- $ sf hello world [--json] [-n <value>]
122
+ $ sf hello world -o <value> [--json] [--flags-dir <value>]
123
123
 
124
124
  FLAGS
125
- -n, --name=<value> [default: World] The name of the person you'd like to say hello to.
125
+ -o, --org=<value> (required) The name of the person you'd like to say hello to.
126
126
 
127
127
  GLOBAL FLAGS
128
- --json Format output as json.
128
+ --flags-dir=<value> Import flag values from a directory.
129
+ --json Format output as json.
129
130
 
130
131
  DESCRIPTION
131
- Say hello either to the world or someone you know.
132
+ Say hello.
132
133
 
133
134
  Say hello either to the world or someone you know.
134
135
 
@@ -140,6 +141,45 @@ EXAMPLES
140
141
  Say hello to someone you know:
141
142
 
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!
143
149
  ```
144
150
 
151
+ ## `sf sharinpix form pull`
152
+
153
+ Say hello.
154
+
155
+ ```
156
+ USAGE
157
+ $ sf sharinpix form pull -o <value> [--json] [--flags-dir <value>]
158
+
159
+ FLAGS
160
+ -o, --org=<value> (required) The name of the person you'd like to say hello to.
161
+
162
+ GLOBAL FLAGS
163
+ --flags-dir=<value> Import flag values from a directory.
164
+ --json Format output as json.
165
+
166
+ DESCRIPTION
167
+ Say hello.
168
+
169
+ Say hello either to the world or someone you know.
170
+
171
+ EXAMPLES
172
+ Say hello to the world:
173
+
174
+ $ sf sharinpix form pull
175
+
176
+ Say hello to someone you know:
177
+
178
+ $ sf sharinpix form pull --name Astro
179
+
180
+ FLAG DESCRIPTIONS
181
+ -o, --org=<value> The name of the person you'd like to say hello to.
182
+
183
+ This person can be anyone in the world!
184
+ ```
145
185
  <!-- commandsstop -->
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,55 @@
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
@@ -0,0 +1 @@
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,OAAO,EAAE,QAAQ,EAAE,MAAM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AAU,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAE5E,MAAM,OAAO,GAAG,CAAC,MAAM,UAAU,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC,CAAC,OAAO;aACzG,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACnD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAE7E,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE;YAC1D,QAAQ,EAAE,oBAAoB;YAC9B,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,cAAc;YAC3B,GAAG,EAAE,oBAAoB;YACzB,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC;gBAC/B,MAAM,EAAE;oBACN,KAAK,EAAE,QAAQ;iBAChB;gBACD,QAAQ,EAAE;oBACR;wBACE,QAAQ,EAAE,UAAU;wBACpB,SAAS,EAAE,QAAQ;wBACnB,KAAK,EAAE,WAAW;wBAClB,EAAE,EAAE,sCAAsC;wBAC1C,OAAO,EAAE,WAAW;qBACrB;iBACF;aACF,CAAC;SACH,CAAC,CAAC;QACH,4EAA4E;QAC5E,8EAA8E;QAC9E,oIAAoI;QACpI,OAAO;YACL,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type PullResult = {
3
+ name: string;
4
+ };
5
+ export default class Pull extends SfCommand<PullResult> {
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<PullResult>;
13
+ }
@@ -0,0 +1,73 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint-disable no-await-in-loop */
3
+ import fs from 'node:fs';
4
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
5
+ import { Messages } from '@salesforce/core';
6
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
7
+ const messages = Messages.loadMessages('@sharinpix/sharinpix-sf-cli', 'hello.world');
8
+ export default class Pull extends SfCommand {
9
+ static summary = messages.getMessage('summary');
10
+ static description = messages.getMessage('description');
11
+ static examples = messages.getMessages('examples');
12
+ static flags = {
13
+ org: Flags.requiredOrg({
14
+ char: 'o',
15
+ summary: messages.getMessage('flags.org.summary'),
16
+ description: messages.getMessage('flags.org.description'),
17
+ }),
18
+ };
19
+ async run() {
20
+ const { flags } = await this.parse(Pull);
21
+ const connection = flags.org.getConnection('63.0');
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.map((record) => record);
24
+ for (const record of records) {
25
+ try {
26
+ const form = (await (await fetch(record.sharinpix__FormUrl__c + '.json', {
27
+ headers: {
28
+ 'Accept': 'application/json',
29
+ }
30
+ })).json());
31
+ fs.writeFileSync(`sharinpix/forms/${record.Name}.json`, JSON.stringify(form, null, 2));
32
+ this.log(messages.getMessage('info.hello', [record.Name, record.sharinpix__FormUrl__c]));
33
+ }
34
+ catch (error) {
35
+ // eslint-disable-next-line no-console
36
+ // console.log('SKIP', record.Name, error);
37
+ }
38
+ // return [record.Id, record.sharinpix__FormUrl__c, record.Name, record.sharinpix__Description__c].join(',')
39
+ }
40
+ // this.log(messages.getMessage('info.hello', [result, flags.org.getOrgId()]));
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]));
68
+ return {
69
+ name: 'OK',
70
+ };
71
+ }
72
+ }
73
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +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,aAAa,CAAC,CAAC;AAMrF,MAAM,CAAC,OAAO,OAAO,IAAK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OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACvF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAC3F,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,sCAAsC;gBACtC,2CAA2C;YAC7C,CAAC;YACD,4GAA4G;QAC9G,CAAC;QACD,+EAA+E;QAE/E;;;uFAG+E;QAE/E;;;;;;;;;;;;;;;;;;;aAmBK;QACL,4EAA4E;QAC5E,8EAA8E;QAC9E,mIAAmI;QACnI,OAAO;YACL,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export default {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe,EAAE,CAAC"}