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 +0 -2
- package/package.json +1 -1
- package/src/commands/campaign/widget/archive.mjs +1 -1
- package/src/commands/widget/get.mjs +0 -1
- package/src/commands/widget/update/external.mjs +5 -0
- package/src/commands/widget/{update.mjs → update/index.mjs} +1 -3
- package/src/commands/widget/update/name.mjs +1 -1
- package/src/procaCommand.mjs +6 -5
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -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 {
|
|
@@ -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";
|
package/src/procaCommand.mjs
CHANGED
|
@@ -100,10 +100,11 @@ class ProcaCommand extends Command {
|
|
|
100
100
|
].filter(Boolean).length;
|
|
101
101
|
|
|
102
102
|
if (identified === 0) {
|
|
103
|
-
|
|
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.
|
|
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}`, {
|
|
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.
|
|
154
|
+
this.error(err.message, { exit: err.code || 1 });
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
flatten = (obj, prefix = "", result = {}) => {
|