proca 2.1.0 → 2.1.1

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
@@ -1980,8 +1980,6 @@ DESCRIPTION
1980
1980
  Update a widget's properties
1981
1981
 
1982
1982
  EXAMPLES
1983
- $ proca widget update -i 42 --rename campaign/new_name
1984
-
1985
1983
  $ proca widget update -name campaign/widget --locale fr
1986
1984
 
1987
1985
  $ proca widget update 42 --confirm-optin
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "proca",
3
3
  "description": "Access the proca api",
4
- "version": "2.1.0",
4
+ "version": "2.1.1",
5
5
  "author": "Xavier",
6
6
  "bin": {
7
7
  "proca": "proca-cli"
@@ -2,7 +2,7 @@ import { Flags } from "@oclif/core";
2
2
  import prompts from "prompts";
3
3
  import CampaignGet from "#src/commands/campaign/get.mjs";
4
4
  import WidgetList from "#src/commands/widget/list.mjs";
5
- import WidgetUpdate from "#src/commands/widget/update.mjs";
5
+ import WidgetUpdate from "#src/commands/widget/update/index.mjs";
6
6
  import Command from "#src/procaCommand.mjs";
7
7
 
8
8
  export default class CampaignWidgetArchive extends Command {
@@ -10,7 +10,6 @@ export const getWidget = (params) => {
10
10
 
11
11
  export default class WidgetGet extends Command {
12
12
  static description = "view a widget";
13
-
14
13
  static args = this.multiid();
15
14
 
16
15
  static flags = {
@@ -2,6 +2,11 @@ import { Flags } from "@oclif/core";
2
2
  import Command from "#src/procaCommand.mjs";
3
3
  import { gql, mutation } from "#src/urql.mjs";
4
4
 
5
+ export const updateCounter = (id, counter) => {
6
+ const d = new CounterUpdate([]);
7
+ return d.updateCounter(id, counter);
8
+ };
9
+
5
10
  export default class CounterUpdate extends Command {
6
11
  static description =
7
12
  "Update the global counter to add the actions collected elsewhere";
@@ -6,9 +6,7 @@ import { gql, mutation } from "#src/urql.mjs";
6
6
 
7
7
  export default class WidgetUpdate extends Command {
8
8
  static description = "Update a widget's properties";
9
-
10
9
  static examples = [
11
- "<%= config.bin %> <%= command.id %> -i 42 --rename campaign/new_name",
12
10
  "<%= config.bin %> <%= command.id %> -name campaign/widget --locale fr",
13
11
  "<%= config.bin %> <%= command.id %> 42 --confirm-optin",
14
12
  "<%= config.bin %> <%= command.id %> --dxid=pnc -confirm-optin --dry-run",
@@ -16,8 +14,8 @@ export default class WidgetUpdate extends Command {
16
14
 
17
15
  static args = this.multiid();
18
16
 
17
+ // @ivana, let's make separate update xxx than inherit, check external
19
18
  static flags = {
20
- // flag with no value (-f, --force)
21
19
  ...this.flagify({ multiid: true }),
22
20
  rename: Flags.string({
23
21
  hidden: true, // use proca widget update name instead
@@ -1,6 +1,6 @@
1
1
  import { Flags } from "@oclif/core";
2
2
  import { getWidget } from "#src/commands/widget/get.mjs";
3
- import UpdateCommand from "#src/commands/widget/update.mjs";
3
+ import UpdateCommand from "#src/commands/widget/update/index.mjs";
4
4
 
5
5
  export default class CounterUpdate extends UpdateCommand {
6
6
  static description = "Update the name of a widget";
@@ -100,10 +100,11 @@ class ProcaCommand extends Command {
100
100
  ].filter(Boolean).length;
101
101
 
102
102
  if (identified === 0) {
103
- this.error("One of --name, --id, or --dxid is required");
103
+ super.error("One of --name, --id, or --dxid is required", {
104
+ code: 1,
105
+ });
104
106
  }
105
107
 
106
- await super.parse(); // check that either the first arg or the name/id/dxid are set
107
108
  return parsed;
108
109
  }
109
110
 
@@ -143,14 +144,14 @@ class ProcaCommand extends Command {
143
144
 
144
145
  if (err.networkError) {
145
146
  this.info("Looks like there’s a problem with your internet connection");
146
- this.error(err.networkError.cause, { exit: err.exitCode || 1 });
147
+ this.error(err.networkError.cause, { exit: err.code || 1 });
147
148
  }
148
149
  if (err instanceof SyntaxError) {
149
- this.error(`Syntax error: ${err.message}`, { exit: 1 });
150
+ this.error(`Syntax error: ${err.message}`, { code: 1 });
150
151
  }
151
152
 
152
153
  // Default error handling
153
- this.error(err.message, { exit: err.exitCode || 1 });
154
+ this.error(err.message, { exit: err.code || 1 });
154
155
  }
155
156
 
156
157
  flatten = (obj, prefix = "", result = {}) => {