@knocklabs/cli 0.2.0 → 0.2.2
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 +258 -36
- package/dist/commands/branch/create.js +56 -0
- package/dist/commands/branch/delete.js +60 -0
- package/dist/commands/branch/list.js +89 -0
- package/dist/commands/commit/get.js +4 -4
- package/dist/commands/commit/index.js +47 -2
- package/dist/commands/commit/list.js +61 -13
- package/dist/commands/guide/activate.js +48 -4
- package/dist/commands/guide/generate-types.js +4 -1
- package/dist/commands/guide/get.js +46 -3
- package/dist/commands/guide/list.js +46 -3
- package/dist/commands/guide/pull.js +6 -4
- package/dist/commands/guide/push.js +4 -3
- package/dist/commands/guide/validate.js +4 -3
- package/dist/commands/layout/get.js +46 -1
- package/dist/commands/layout/list.js +46 -1
- package/dist/commands/layout/pull.js +6 -2
- package/dist/commands/layout/push.js +4 -1
- package/dist/commands/layout/validate.js +4 -1
- package/dist/commands/login.js +1 -0
- package/dist/commands/logout.js +1 -0
- package/dist/commands/message-type/get.js +46 -3
- package/dist/commands/message-type/list.js +46 -3
- package/dist/commands/message-type/pull.js +6 -4
- package/dist/commands/message-type/push.js +4 -3
- package/dist/commands/message-type/validate.js +4 -3
- package/dist/commands/partial/get.js +46 -1
- package/dist/commands/partial/list.js +46 -1
- package/dist/commands/partial/pull.js +6 -2
- package/dist/commands/partial/push.js +4 -1
- package/dist/commands/partial/validate.js +6 -1
- package/dist/commands/pull.js +28 -8
- package/dist/commands/push.js +27 -8
- package/dist/commands/translation/get.js +5 -1
- package/dist/commands/translation/list.js +5 -1
- package/dist/commands/translation/pull.js +8 -3
- package/dist/commands/translation/push.js +4 -1
- package/dist/commands/translation/validate.js +4 -1
- package/dist/commands/whoami.js +7 -8
- package/dist/commands/workflow/activate.js +47 -3
- package/dist/commands/workflow/generate-types.js +4 -1
- package/dist/commands/workflow/get.js +9 -4
- package/dist/commands/workflow/list.js +5 -1
- package/dist/commands/workflow/pull.js +6 -2
- package/dist/commands/workflow/push.js +4 -1
- package/dist/commands/workflow/run.js +46 -2
- package/dist/commands/workflow/validate.js +4 -1
- package/dist/lib/api-v1.js +57 -20
- package/dist/lib/helpers/arg.js +24 -0
- package/dist/lib/helpers/command.js +14 -0
- package/dist/lib/helpers/flag.js +18 -0
- package/dist/lib/helpers/request.js +48 -2
- package/dist/lib/helpers/string.js +4 -0
- package/dist/lib/marshal/commit/index.js +0 -1
- package/dist/lib/marshal/index.isomorphic.js +8 -4
- package/dist/lib/marshal/reusable-step/helpers.js +72 -0
- package/dist/lib/marshal/reusable-step/index.js +19 -0
- package/dist/lib/marshal/reusable-step/processor.isomorphic.js +86 -0
- package/dist/lib/marshal/{commit → reusable-step}/types.js +0 -1
- package/dist/lib/resources.js +6 -1
- package/dist/lib/urls.js +4 -0
- package/oclif.manifest.json +489 -50
- package/package.json +16 -5
- package/dist/commands/ping.js +0 -37
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -102,7 +103,8 @@ class GuideValidate extends _basecommand.default {
|
|
|
102
103
|
_ux.spinner.stop();
|
|
103
104
|
// 3. Display a success message.
|
|
104
105
|
const guideKeys = guides.map((g)=>g.key);
|
|
105
|
-
|
|
106
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
107
|
+
this.log(`‣ Successfully validated ${guides.length} guide(s) using ${scope}:\n` + (0, _string.indentString)(guideKeys.join("\n"), 4));
|
|
106
108
|
}
|
|
107
109
|
static async validateAll(api, props, guides) {
|
|
108
110
|
// TODO: Throw an error if a non validation error (e.g. authentication error)
|
|
@@ -121,8 +123,6 @@ class GuideValidate extends _basecommand.default {
|
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
_define_property(GuideValidate, "summary", "Validate one or more guides from a local file system.");
|
|
124
|
-
// Hide until guides are released in GA.
|
|
125
|
-
_define_property(GuideValidate, "hidden", true);
|
|
126
126
|
_define_property(GuideValidate, "flags", {
|
|
127
127
|
environment: _core.Flags.string({
|
|
128
128
|
summary: "Validating a guide is only done in the development environment",
|
|
@@ -131,6 +131,7 @@ _define_property(GuideValidate, "flags", {
|
|
|
131
131
|
_const.KnockEnv.Development
|
|
132
132
|
]
|
|
133
133
|
}),
|
|
134
|
+
branch: _flag.branch,
|
|
134
135
|
all: _core.Flags.boolean({
|
|
135
136
|
summary: "Whether to validate all guides from the target directory."
|
|
136
137
|
}),
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
16
|
const _request = require("../../lib/helpers/request");
|
|
15
17
|
function _define_property(obj, key, value) {
|
|
16
18
|
if (key in obj) {
|
|
@@ -30,6 +32,47 @@ function _interop_require_default(obj) {
|
|
|
30
32
|
default: obj
|
|
31
33
|
};
|
|
32
34
|
}
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
36
|
+
if (typeof WeakMap !== "function") return null;
|
|
37
|
+
var cacheBabelInterop = new WeakMap();
|
|
38
|
+
var cacheNodeInterop = new WeakMap();
|
|
39
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
41
|
+
})(nodeInterop);
|
|
42
|
+
}
|
|
43
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
44
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
48
|
+
return {
|
|
49
|
+
default: obj
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
53
|
+
if (cache && cache.has(obj)) {
|
|
54
|
+
return cache.get(obj);
|
|
55
|
+
}
|
|
56
|
+
var newObj = {
|
|
57
|
+
__proto__: null
|
|
58
|
+
};
|
|
59
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
60
|
+
for(var key in obj){
|
|
61
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
62
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
63
|
+
if (desc && (desc.get || desc.set)) {
|
|
64
|
+
Object.defineProperty(newObj, key, desc);
|
|
65
|
+
} else {
|
|
66
|
+
newObj[key] = obj[key];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
newObj.default = obj;
|
|
71
|
+
if (cache) {
|
|
72
|
+
cache.set(obj, newObj);
|
|
73
|
+
}
|
|
74
|
+
return newObj;
|
|
75
|
+
}
|
|
33
76
|
class EmailLayoutGet extends _basecommand.default {
|
|
34
77
|
async run() {
|
|
35
78
|
const { flags } = this.props;
|
|
@@ -41,7 +84,8 @@ class EmailLayoutGet extends _basecommand.default {
|
|
|
41
84
|
const { emailLayoutKey } = this.props.args;
|
|
42
85
|
const { environment: env, "hide-uncommitted-changes": commitedOnly } = this.props.flags;
|
|
43
86
|
const qualifier = env === "development" && !commitedOnly ? "(including uncommitted)" : "";
|
|
44
|
-
|
|
87
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
88
|
+
this.log(`‣ Showing email layout \`${emailLayoutKey}\` in ${scope} ${qualifier}\n`);
|
|
45
89
|
/*
|
|
46
90
|
* Email layout table
|
|
47
91
|
*/ const rows = [
|
|
@@ -97,6 +141,7 @@ _define_property(EmailLayoutGet, "flags", {
|
|
|
97
141
|
default: "development",
|
|
98
142
|
summary: "The environment to use."
|
|
99
143
|
}),
|
|
144
|
+
branch: _flag.branch,
|
|
100
145
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
101
146
|
summary: "Hide any uncommitted changes."
|
|
102
147
|
})
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
16
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
15
17
|
const _page = require("../../lib/helpers/page");
|
|
16
18
|
const _request = require("../../lib/helpers/request");
|
|
@@ -32,6 +34,47 @@ function _interop_require_default(obj) {
|
|
|
32
34
|
default: obj
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
38
|
+
if (typeof WeakMap !== "function") return null;
|
|
39
|
+
var cacheBabelInterop = new WeakMap();
|
|
40
|
+
var cacheNodeInterop = new WeakMap();
|
|
41
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
42
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
43
|
+
})(nodeInterop);
|
|
44
|
+
}
|
|
45
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
46
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
50
|
+
return {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
55
|
+
if (cache && cache.has(obj)) {
|
|
56
|
+
return cache.get(obj);
|
|
57
|
+
}
|
|
58
|
+
var newObj = {
|
|
59
|
+
__proto__: null
|
|
60
|
+
};
|
|
61
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
62
|
+
for(var key in obj){
|
|
63
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
64
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
65
|
+
if (desc && (desc.get || desc.set)) {
|
|
66
|
+
Object.defineProperty(newObj, key, desc);
|
|
67
|
+
} else {
|
|
68
|
+
newObj[key] = obj[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
newObj.default = obj;
|
|
73
|
+
if (cache) {
|
|
74
|
+
cache.set(obj, newObj);
|
|
75
|
+
}
|
|
76
|
+
return newObj;
|
|
77
|
+
}
|
|
35
78
|
class EmailLayoutList extends _basecommand.default {
|
|
36
79
|
async run() {
|
|
37
80
|
const resp = await this.request();
|
|
@@ -51,7 +94,8 @@ class EmailLayoutList extends _basecommand.default {
|
|
|
51
94
|
const { entries } = data;
|
|
52
95
|
const { environment: env, "hide-uncommitted-changes": commitedOnly } = this.props.flags;
|
|
53
96
|
const qualifier = env === "development" && !commitedOnly ? "(including uncommitted)" : "";
|
|
54
|
-
|
|
97
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
98
|
+
this.log(`‣ Showing ${entries.length} email layouts in ${scope} ${qualifier}\n`);
|
|
55
99
|
/*
|
|
56
100
|
* Email layouts table
|
|
57
101
|
*/ _core.ux.table(entries, {
|
|
@@ -89,6 +133,7 @@ _define_property(EmailLayoutList, "flags", {
|
|
|
89
133
|
default: "development",
|
|
90
134
|
summary: "The environment to use."
|
|
91
135
|
}),
|
|
136
|
+
branch: _flag.branch,
|
|
92
137
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
93
138
|
summary: "Hide any uncommitted changes."
|
|
94
139
|
}),
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
12
12
|
const _core = require("@oclif/core");
|
|
13
13
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
14
|
+
const _command = require("../../lib/helpers/command");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
16
17
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
@@ -110,7 +111,8 @@ class EmailLayoutPull extends _basecommand.default {
|
|
|
110
111
|
});
|
|
111
112
|
await _emaillayout.writeEmailLayoutDirFromData(dirContext, resp.data);
|
|
112
113
|
const action = dirContext.exists ? "updated" : "created";
|
|
113
|
-
|
|
114
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
115
|
+
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
114
116
|
}
|
|
115
117
|
// Pull all email layouts
|
|
116
118
|
async pullAllEmailLayouts() {
|
|
@@ -128,7 +130,8 @@ class EmailLayoutPull extends _basecommand.default {
|
|
|
128
130
|
await _emaillayout.writeEmailLayoutIndexDir(targetDirCtx, emailLayouts);
|
|
129
131
|
_ux.spinner.stop();
|
|
130
132
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
131
|
-
|
|
133
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
134
|
+
this.log(`‣ Successfully ${action} the layouts directory at ${targetDirCtx.abspath} using ${scope}`);
|
|
132
135
|
}
|
|
133
136
|
async listAllEmailLayouts(pageParams = {}, emailLayoutsFetchedSoFar = []) {
|
|
134
137
|
const props = (0, _objectisomorphic.merge)(this.props, {
|
|
@@ -186,6 +189,7 @@ _define_property(EmailLayoutPull, "flags", {
|
|
|
186
189
|
default: "development",
|
|
187
190
|
summary: "The environment to use."
|
|
188
191
|
}),
|
|
192
|
+
branch: _flag.branch,
|
|
189
193
|
all: _core.Flags.boolean({
|
|
190
194
|
summary: "Whether to pull all email layouts from the specified environment."
|
|
191
195
|
}),
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -130,7 +131,8 @@ class EmailLayoutPush extends _basecommand.default {
|
|
|
130
131
|
// 4. Display a success message.
|
|
131
132
|
const layoutKeys = layouts.map((l)=>l.key);
|
|
132
133
|
const actioned = flags.commit ? "pushed and committed" : "pushed";
|
|
133
|
-
|
|
134
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
135
|
+
this.log(`‣ Successfully ${actioned} ${layouts.length} layout(s) to ${scope}:\n` + (0, _string.indentString)(layoutKeys.join("\n"), 4));
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
_define_property(EmailLayoutPush, "summary", "Push one or more email layouts from a local file system to Knock.");
|
|
@@ -142,6 +144,7 @@ _define_property(EmailLayoutPush, "flags", {
|
|
|
142
144
|
_const.KnockEnv.Development
|
|
143
145
|
]
|
|
144
146
|
}),
|
|
147
|
+
branch: _flag.branch,
|
|
145
148
|
all: _core.Flags.boolean({
|
|
146
149
|
summary: "Whether to push all layouts from the target directory."
|
|
147
150
|
}),
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -102,7 +103,8 @@ class EmailLayoutValidate extends _basecommand.default {
|
|
|
102
103
|
_ux.spinner.stop();
|
|
103
104
|
// 3. Display a success message.
|
|
104
105
|
const layoutsKey = layouts.map((l)=>l.key);
|
|
105
|
-
|
|
106
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
107
|
+
this.log(`‣ Successfully validated ${layouts.length} layout(s) using ${scope}:\n` + (0, _string.indentString)(layoutsKey.join("\n"), 4));
|
|
106
108
|
}
|
|
107
109
|
static async validateAll(api, props, layouts) {
|
|
108
110
|
const errorPromises = layouts.map(async (layout)=>{
|
|
@@ -127,6 +129,7 @@ _define_property(EmailLayoutValidate, "flags", {
|
|
|
127
129
|
_const.KnockEnv.Development
|
|
128
130
|
]
|
|
129
131
|
}),
|
|
132
|
+
branch: _flag.branch,
|
|
130
133
|
all: _core.Flags.boolean({
|
|
131
134
|
summary: "Whether to validate all layouts from the target directory."
|
|
132
135
|
}),
|
package/dist/commands/login.js
CHANGED
package/dist/commands/logout.js
CHANGED
|
@@ -10,8 +10,10 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
16
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
15
17
|
const _request = require("../../lib/helpers/request");
|
|
16
18
|
const _ux = require("../../lib/helpers/ux");
|
|
17
19
|
function _define_property(obj, key, value) {
|
|
@@ -32,6 +34,47 @@ function _interop_require_default(obj) {
|
|
|
32
34
|
default: obj
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
38
|
+
if (typeof WeakMap !== "function") return null;
|
|
39
|
+
var cacheBabelInterop = new WeakMap();
|
|
40
|
+
var cacheNodeInterop = new WeakMap();
|
|
41
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
42
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
43
|
+
})(nodeInterop);
|
|
44
|
+
}
|
|
45
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
46
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
50
|
+
return {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
55
|
+
if (cache && cache.has(obj)) {
|
|
56
|
+
return cache.get(obj);
|
|
57
|
+
}
|
|
58
|
+
var newObj = {
|
|
59
|
+
__proto__: null
|
|
60
|
+
};
|
|
61
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
62
|
+
for(var key in obj){
|
|
63
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
64
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
65
|
+
if (desc && (desc.get || desc.set)) {
|
|
66
|
+
Object.defineProperty(newObj, key, desc);
|
|
67
|
+
} else {
|
|
68
|
+
newObj[key] = obj[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
newObj.default = obj;
|
|
73
|
+
if (cache) {
|
|
74
|
+
cache.set(obj, newObj);
|
|
75
|
+
}
|
|
76
|
+
return newObj;
|
|
77
|
+
}
|
|
35
78
|
class MessageTypeGet extends _basecommand.default {
|
|
36
79
|
async run() {
|
|
37
80
|
_ux.spinner.start("‣ Loading");
|
|
@@ -55,7 +98,8 @@ class MessageTypeGet extends _basecommand.default {
|
|
|
55
98
|
const { messageTypeKey } = this.props.args;
|
|
56
99
|
const { environment: env, "hide-uncommitted-changes": commitedOnly } = this.props.flags;
|
|
57
100
|
const qualifier = env === "development" && !commitedOnly ? "(including uncommitted)" : "";
|
|
58
|
-
|
|
101
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
102
|
+
this.log(`‣ Showing in-app message type \`${messageTypeKey}\` in ${scope} ${qualifier}\n`);
|
|
59
103
|
/*
|
|
60
104
|
* Message type table
|
|
61
105
|
*/ const rows = [
|
|
@@ -104,14 +148,13 @@ class MessageTypeGet extends _basecommand.default {
|
|
|
104
148
|
});
|
|
105
149
|
}
|
|
106
150
|
}
|
|
107
|
-
// Hide until guides are released in GA.
|
|
108
|
-
_define_property(MessageTypeGet, "hidden", true);
|
|
109
151
|
_define_property(MessageTypeGet, "summary", "Display a single in-app message type from an environment.");
|
|
110
152
|
_define_property(MessageTypeGet, "flags", {
|
|
111
153
|
environment: _core.Flags.string({
|
|
112
154
|
default: "development",
|
|
113
155
|
summary: "The environment to use."
|
|
114
156
|
}),
|
|
157
|
+
branch: _flag.branch,
|
|
115
158
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
116
159
|
summary: "Hide any uncommitted changes."
|
|
117
160
|
})
|
|
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
14
16
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
15
17
|
const _page = require("../../lib/helpers/page");
|
|
16
18
|
const _request = require("../../lib/helpers/request");
|
|
@@ -32,6 +34,47 @@ function _interop_require_default(obj) {
|
|
|
32
34
|
default: obj
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
38
|
+
if (typeof WeakMap !== "function") return null;
|
|
39
|
+
var cacheBabelInterop = new WeakMap();
|
|
40
|
+
var cacheNodeInterop = new WeakMap();
|
|
41
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
42
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
43
|
+
})(nodeInterop);
|
|
44
|
+
}
|
|
45
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
46
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
50
|
+
return {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
55
|
+
if (cache && cache.has(obj)) {
|
|
56
|
+
return cache.get(obj);
|
|
57
|
+
}
|
|
58
|
+
var newObj = {
|
|
59
|
+
__proto__: null
|
|
60
|
+
};
|
|
61
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
62
|
+
for(var key in obj){
|
|
63
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
64
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
65
|
+
if (desc && (desc.get || desc.set)) {
|
|
66
|
+
Object.defineProperty(newObj, key, desc);
|
|
67
|
+
} else {
|
|
68
|
+
newObj[key] = obj[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
newObj.default = obj;
|
|
73
|
+
if (cache) {
|
|
74
|
+
cache.set(obj, newObj);
|
|
75
|
+
}
|
|
76
|
+
return newObj;
|
|
77
|
+
}
|
|
35
78
|
class MessageTypeList extends _basecommand.default {
|
|
36
79
|
async run() {
|
|
37
80
|
const resp = await this.request();
|
|
@@ -51,7 +94,8 @@ class MessageTypeList extends _basecommand.default {
|
|
|
51
94
|
const { entries } = data;
|
|
52
95
|
const { environment: env, "hide-uncommitted-changes": committedOnly } = this.props.flags;
|
|
53
96
|
const qualifier = env === "development" && !committedOnly ? "(including uncommitted)" : "";
|
|
54
|
-
|
|
97
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
98
|
+
this.log(`‣ Showing ${entries.length} in-app message types in ${scope} ${qualifier}\n`);
|
|
55
99
|
/*
|
|
56
100
|
* Message types list table
|
|
57
101
|
*/ _core.ux.table(entries, {
|
|
@@ -85,14 +129,13 @@ class MessageTypeList extends _basecommand.default {
|
|
|
85
129
|
}
|
|
86
130
|
}
|
|
87
131
|
}
|
|
88
|
-
// Hide until guides are released in GA.
|
|
89
|
-
_define_property(MessageTypeList, "hidden", true);
|
|
90
132
|
_define_property(MessageTypeList, "summary", "Display all in-app message types for an environment.");
|
|
91
133
|
_define_property(MessageTypeList, "flags", {
|
|
92
134
|
environment: _core.Flags.string({
|
|
93
135
|
default: "development",
|
|
94
136
|
summary: "The environment to use."
|
|
95
137
|
}),
|
|
138
|
+
branch: _flag.branch,
|
|
96
139
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
97
140
|
summary: "Hide any uncommitted changes."
|
|
98
141
|
}),
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
12
12
|
const _core = require("@oclif/core");
|
|
13
13
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
14
|
+
const _command = require("../../lib/helpers/command");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
16
17
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
@@ -113,7 +114,8 @@ class MessageTypePull extends _basecommand.default {
|
|
|
113
114
|
});
|
|
114
115
|
await _messagetype.writeMessageTypeDirFromData(dirContext, resp.data);
|
|
115
116
|
const action = dirContext.exists ? "updated" : "created";
|
|
116
|
-
|
|
117
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
118
|
+
this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath} using ${scope}`);
|
|
117
119
|
}
|
|
118
120
|
async getMessageTypeDirContext() {
|
|
119
121
|
const { messageTypeKey } = this.props.args;
|
|
@@ -162,7 +164,8 @@ class MessageTypePull extends _basecommand.default {
|
|
|
162
164
|
await _messagetype.writeMessageTypesIndexDir(targetDirCtx, messageTypes);
|
|
163
165
|
_ux.spinner.stop();
|
|
164
166
|
const action = targetDirCtx.exists ? "updated" : "created";
|
|
165
|
-
|
|
167
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
168
|
+
this.log(`‣ Successfully ${action} the message types directory at ${targetDirCtx.abspath} using ${scope}`);
|
|
166
169
|
}
|
|
167
170
|
async listAllMessageTypes(pageParams = {}, messageTypesFetchedSoFar = []) {
|
|
168
171
|
const props = (0, _objectisomorphic.merge)(this.props, {
|
|
@@ -187,14 +190,13 @@ class MessageTypePull extends _basecommand.default {
|
|
|
187
190
|
}, messageTypes) : messageTypes;
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
|
-
// Hide until guides are released in GA.
|
|
191
|
-
_define_property(MessageTypePull, "hidden", true);
|
|
192
193
|
_define_property(MessageTypePull, "summary", "Pull one or more in-app message types from an environment into a local file system.");
|
|
193
194
|
_define_property(MessageTypePull, "flags", {
|
|
194
195
|
environment: _core.Flags.string({
|
|
195
196
|
default: "development",
|
|
196
197
|
summary: "The environment to use."
|
|
197
198
|
}),
|
|
199
|
+
branch: _flag.branch,
|
|
198
200
|
all: _core.Flags.boolean({
|
|
199
201
|
summary: "Whether to pull all in-app message types from the specified environment."
|
|
200
202
|
}),
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -130,11 +131,10 @@ class MessageTypePush extends _basecommand.default {
|
|
|
130
131
|
// 4. Display a success message.
|
|
131
132
|
const messageTypeKeys = messageTypes.map((w)=>w.key);
|
|
132
133
|
const actioned = flags.commit ? "pushed and committed" : "pushed";
|
|
133
|
-
|
|
134
|
+
const scope = (0, _command.formatCommandScope)(flags);
|
|
135
|
+
this.log(`‣ Successfully ${actioned} ${messageTypes.length} message type(s) to ${scope}:\n` + (0, _string.indentString)(messageTypeKeys.join("\n"), 4));
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
|
-
// Hide until guides are released in GA.
|
|
137
|
-
_define_property(MessageTypePush, "hidden", true);
|
|
138
138
|
_define_property(MessageTypePush, "summary", "Push one or more message types from a local file system to Knock.");
|
|
139
139
|
_define_property(MessageTypePush, "flags", {
|
|
140
140
|
environment: _core.Flags.string({
|
|
@@ -144,6 +144,7 @@ _define_property(MessageTypePush, "flags", {
|
|
|
144
144
|
_const.KnockEnv.Development
|
|
145
145
|
]
|
|
146
146
|
}),
|
|
147
|
+
branch: _flag.branch,
|
|
147
148
|
all: _core.Flags.boolean({
|
|
148
149
|
summary: "Whether to push all message types from the target directory."
|
|
149
150
|
}),
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _const = require("../../lib/helpers/const");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
15
16
|
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
@@ -102,7 +103,8 @@ class MessageTypeValidate extends _basecommand.default {
|
|
|
102
103
|
_ux.spinner.stop();
|
|
103
104
|
// 3. Display a success message.
|
|
104
105
|
const messageTypeKeys = messageTypes.map((w)=>w.key);
|
|
105
|
-
|
|
106
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
107
|
+
this.log(`‣ Successfully validated ${messageTypes.length} message type(s) using ${scope}:\n` + (0, _string.indentString)(messageTypeKeys.join("\n"), 4));
|
|
106
108
|
}
|
|
107
109
|
static async validateAll(api, props, messageTypes) {
|
|
108
110
|
// TODO: Throw an error if a non validation error (e.g. authentication error)
|
|
@@ -120,8 +122,6 @@ class MessageTypeValidate extends _basecommand.default {
|
|
|
120
122
|
return errors;
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
|
-
// Hide until guides are released in GA.
|
|
124
|
-
_define_property(MessageTypeValidate, "hidden", true);
|
|
125
125
|
_define_property(MessageTypeValidate, "summary", "Validate one or more message types from a local file system.");
|
|
126
126
|
_define_property(MessageTypeValidate, "flags", {
|
|
127
127
|
environment: _core.Flags.string({
|
|
@@ -131,6 +131,7 @@ _define_property(MessageTypeValidate, "flags", {
|
|
|
131
131
|
_const.KnockEnv.Development
|
|
132
132
|
]
|
|
133
133
|
}),
|
|
134
|
+
branch: _flag.branch,
|
|
134
135
|
all: _core.Flags.boolean({
|
|
135
136
|
summary: "Whether to validate all message types from the target directory."
|
|
136
137
|
}),
|
|
@@ -10,8 +10,10 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _core = require("@oclif/core");
|
|
12
12
|
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _command = require("../../lib/helpers/command");
|
|
13
14
|
const _date = require("../../lib/helpers/date");
|
|
14
15
|
const _error = require("../../lib/helpers/error");
|
|
16
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
15
17
|
const _request = require("../../lib/helpers/request");
|
|
16
18
|
const _ux = require("../../lib/helpers/ux");
|
|
17
19
|
function _define_property(obj, key, value) {
|
|
@@ -32,6 +34,47 @@ function _interop_require_default(obj) {
|
|
|
32
34
|
default: obj
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
38
|
+
if (typeof WeakMap !== "function") return null;
|
|
39
|
+
var cacheBabelInterop = new WeakMap();
|
|
40
|
+
var cacheNodeInterop = new WeakMap();
|
|
41
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
42
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
43
|
+
})(nodeInterop);
|
|
44
|
+
}
|
|
45
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
46
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
50
|
+
return {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
55
|
+
if (cache && cache.has(obj)) {
|
|
56
|
+
return cache.get(obj);
|
|
57
|
+
}
|
|
58
|
+
var newObj = {
|
|
59
|
+
__proto__: null
|
|
60
|
+
};
|
|
61
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
62
|
+
for(var key in obj){
|
|
63
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
64
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
65
|
+
if (desc && (desc.get || desc.set)) {
|
|
66
|
+
Object.defineProperty(newObj, key, desc);
|
|
67
|
+
} else {
|
|
68
|
+
newObj[key] = obj[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
newObj.default = obj;
|
|
73
|
+
if (cache) {
|
|
74
|
+
cache.set(obj, newObj);
|
|
75
|
+
}
|
|
76
|
+
return newObj;
|
|
77
|
+
}
|
|
35
78
|
class PartialGet extends _basecommand.default {
|
|
36
79
|
async run() {
|
|
37
80
|
_ux.spinner.start("‣ Loading");
|
|
@@ -55,7 +98,8 @@ class PartialGet extends _basecommand.default {
|
|
|
55
98
|
const { partialKey } = this.props.args;
|
|
56
99
|
const { environment: env, "hide-uncommitted-changes": commitedOnly } = this.props.flags;
|
|
57
100
|
const qualifier = env === "development" && !commitedOnly ? "(including uncommitted)" : "";
|
|
58
|
-
|
|
101
|
+
const scope = (0, _command.formatCommandScope)(this.props.flags);
|
|
102
|
+
this.log(`‣ Showing partial \`${partialKey}\` in ${scope} ${qualifier}\n`);
|
|
59
103
|
/*
|
|
60
104
|
* Partial table
|
|
61
105
|
*/ const rows = [
|
|
@@ -112,6 +156,7 @@ _define_property(PartialGet, "flags", {
|
|
|
112
156
|
default: "development",
|
|
113
157
|
summary: "The environment to use."
|
|
114
158
|
}),
|
|
159
|
+
branch: _flag.branch,
|
|
115
160
|
"hide-uncommitted-changes": _core.Flags.boolean({
|
|
116
161
|
summary: "Hide any uncommitted changes."
|
|
117
162
|
})
|