@knocklabs/cli 0.1.9 → 0.1.11
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 +68 -531
- package/bin/dev.js +6 -0
- package/bin/run.js +7 -0
- package/dist/{commands → src/commands}/commit/get.js +24 -9
- package/dist/{commands → src/commands}/commit/index.js +23 -8
- package/dist/{commands → src/commands}/commit/list.js +29 -14
- package/dist/{commands → src/commands}/commit/promote.js +26 -11
- package/dist/{commands → src/commands}/knock.js +21 -6
- package/dist/{commands → src/commands}/layout/get.js +28 -13
- package/dist/{commands → src/commands}/layout/list.js +29 -14
- package/dist/{commands → src/commands}/layout/pull.js +47 -30
- package/dist/{commands → src/commands}/layout/push.js +38 -21
- package/dist/{commands → src/commands}/layout/validate.js +33 -16
- package/dist/src/commands/ping.js +37 -0
- package/dist/{commands → src/commands}/translation/get.js +33 -16
- package/dist/{commands → src/commands}/translation/list.js +35 -18
- package/dist/{commands → src/commands}/translation/pull.js +36 -19
- package/dist/{commands → src/commands}/translation/push.js +33 -15
- package/dist/{commands → src/commands}/translation/validate.js +30 -13
- package/dist/{commands → src/commands}/whoami.js +22 -7
- package/dist/{commands → src/commands}/workflow/activate.js +27 -12
- package/dist/{commands → src/commands}/workflow/get.js +35 -18
- package/dist/{commands → src/commands}/workflow/list.js +34 -17
- package/dist/{commands → src/commands}/workflow/new.js +37 -20
- package/dist/{commands → src/commands}/workflow/pull.js +44 -27
- package/dist/{commands → src/commands}/workflow/push.js +34 -17
- package/dist/{commands → src/commands}/workflow/run.js +25 -10
- package/dist/{commands → src/commands}/workflow/validate.js +30 -13
- package/dist/{index.js → src/index.js} +3 -1
- package/dist/{isomorphic.js → src/isomorphic.js} +8 -4
- package/dist/{lib → src/lib}/api-v1.js +57 -41
- package/dist/{lib → src/lib}/base-command.js +38 -15
- package/dist/{lib → src/lib}/helpers/const.js +18 -10
- package/dist/{lib → src/lib}/helpers/date.js +9 -5
- package/dist/{lib → src/lib}/helpers/error.js +42 -8
- package/dist/{lib → src/lib}/helpers/flag.js +24 -12
- package/dist/{lib → src/lib}/helpers/fs.js +10 -6
- package/dist/{lib → src/lib}/helpers/json.js +19 -9
- package/dist/{lib → src/lib}/helpers/liquid.js +3 -1
- package/dist/{lib → src/lib}/helpers/object.isomorphic.js +35 -7
- package/dist/{lib → src/lib}/helpers/page.js +34 -18
- package/dist/{lib → src/lib}/helpers/request.js +12 -6
- package/dist/{lib → src/lib}/helpers/string.js +8 -4
- package/dist/{lib → src/lib}/helpers/ux.js +9 -5
- package/dist/{lib → src/lib}/marshal/commit/helpers.js +3 -1
- package/dist/src/lib/marshal/commit/index.js +19 -0
- package/dist/{lib → src/lib}/marshal/conditions/helpers.js +5 -3
- package/dist/src/lib/marshal/conditions/index.js +19 -0
- package/dist/{lib → src/lib}/marshal/email-layout/helpers.js +25 -15
- package/dist/src/lib/marshal/email-layout/index.js +22 -0
- package/dist/{lib → src/lib}/marshal/email-layout/processor.isomorphic.js +17 -11
- package/dist/{lib → src/lib}/marshal/email-layout/reader.js +29 -23
- package/dist/{lib → src/lib}/marshal/email-layout/writer.js +38 -30
- package/dist/src/lib/marshal/index.isomorphic.js +26 -0
- package/dist/{lib → src/lib}/marshal/shared/const.isomorphic.js +6 -2
- package/dist/{lib → src/lib}/marshal/shared/helpers.js +22 -14
- package/dist/{lib → src/lib}/marshal/translation/helpers.js +52 -30
- package/dist/src/lib/marshal/translation/index.js +22 -0
- package/dist/src/lib/marshal/translation/processor.isomorphic.js +39 -0
- package/dist/{lib → src/lib}/marshal/translation/reader.js +14 -10
- package/dist/{lib → src/lib}/marshal/translation/writer.js +21 -15
- package/dist/{lib → src/lib}/marshal/workflow/generator.js +23 -15
- package/dist/{lib → src/lib}/marshal/workflow/helpers.js +47 -27
- package/dist/src/lib/marshal/workflow/index.js +23 -0
- package/dist/{lib → src/lib}/marshal/workflow/processor.isomorphic.js +35 -23
- package/dist/{lib → src/lib}/marshal/workflow/reader.js +30 -24
- package/dist/{lib → src/lib}/marshal/workflow/types.js +3 -1
- package/dist/{lib → src/lib}/marshal/workflow/writer.js +40 -30
- package/dist/{lib → src/lib}/run-context/helpers.js +3 -1
- package/dist/src/lib/run-context/index.js +26 -0
- package/dist/{lib → src/lib}/run-context/loader.js +17 -13
- package/dist/{lib → src/lib}/user-config.js +13 -9
- package/oclif.manifest.json +2 -1386
- package/package.json +17 -17
- package/bin/dev +0 -17
- package/bin/run +0 -5
- package/dist/commands/ping.js +0 -22
- package/dist/lib/marshal/commit/index.js +0 -17
- package/dist/lib/marshal/conditions/index.js +0 -17
- package/dist/lib/marshal/email-layout/index.js +0 -20
- package/dist/lib/marshal/index.isomorphic.js +0 -18
- package/dist/lib/marshal/translation/index.js +0 -19
- package/dist/lib/marshal/workflow/index.js +0 -21
- package/dist/lib/run-context/index.js +0 -22
- /package/dist/{lib → src/lib}/marshal/commit/types.js +0 -0
- /package/dist/{lib → src/lib}/marshal/conditions/types.js +0 -0
- /package/dist/{lib → src/lib}/marshal/email-layout/types.js +0 -0
- /package/dist/{lib → src/lib}/marshal/shared/types.js +0 -0
- /package/dist/{lib → src/lib}/marshal/translation/types.js +0 -0
- /package/dist/{lib → src/lib}/run-context/types.js +0 -0
|
@@ -9,15 +9,42 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ApiError: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
ApiError: function() {
|
|
13
|
+
return ApiError;
|
|
14
|
+
},
|
|
15
|
+
JsonDataError: function() {
|
|
16
|
+
return JsonDataError;
|
|
17
|
+
},
|
|
18
|
+
JsonSyntaxError: function() {
|
|
19
|
+
return JsonSyntaxError;
|
|
20
|
+
},
|
|
21
|
+
LiquidParseError: function() {
|
|
22
|
+
return LiquidParseError;
|
|
23
|
+
},
|
|
24
|
+
SourceError: function() {
|
|
25
|
+
return SourceError;
|
|
26
|
+
},
|
|
27
|
+
formatError: function() {
|
|
28
|
+
return formatError;
|
|
29
|
+
},
|
|
30
|
+
formatErrors: function() {
|
|
31
|
+
return formatErrors;
|
|
32
|
+
}
|
|
19
33
|
});
|
|
20
34
|
const _string = require("./string");
|
|
35
|
+
function _define_property(obj, key, value) {
|
|
36
|
+
if (key in obj) {
|
|
37
|
+
Object.defineProperty(obj, key, {
|
|
38
|
+
value: value,
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
obj[key] = value;
|
|
45
|
+
}
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
21
48
|
// Extends the built-in Error class while maintaining a prototype chain, to
|
|
22
49
|
// provide a base class for creating custom error classes.
|
|
23
50
|
// Reference: https://stackoverflow.com/a/58417721/3479934
|
|
@@ -37,18 +64,25 @@ class JsonSyntaxError extends CustomError {
|
|
|
37
64
|
class JsonDataError extends CustomError {
|
|
38
65
|
constructor(message, objPath){
|
|
39
66
|
super(message);
|
|
67
|
+
// For example: `foo.bar[2].baz`
|
|
68
|
+
_define_property(this, "objPath", void 0);
|
|
40
69
|
this.objPath = objPath;
|
|
41
70
|
}
|
|
42
71
|
}
|
|
43
72
|
class LiquidParseError extends CustomError {
|
|
44
73
|
constructor(message, context){
|
|
45
74
|
super(message);
|
|
75
|
+
// Shows the erroneous liquid content with line numbers, should be taken
|
|
76
|
+
// directly from a LiquidError.
|
|
77
|
+
_define_property(this, "context", void 0);
|
|
46
78
|
this.context = context;
|
|
47
79
|
}
|
|
48
80
|
}
|
|
49
81
|
class SourceError extends CustomError {
|
|
50
82
|
constructor(message, source, tag){
|
|
51
83
|
super(tag ? `${tag}: ${message}` : message);
|
|
84
|
+
// Arbitrary string to describe the identifying source of the error message.
|
|
85
|
+
_define_property(this, "source", void 0);
|
|
52
86
|
this.source = source;
|
|
53
87
|
}
|
|
54
88
|
}
|
|
@@ -77,7 +111,7 @@ const formatError = (error)=>{
|
|
|
77
111
|
}
|
|
78
112
|
};
|
|
79
113
|
const formatErrors = (errors, opts = {})=>{
|
|
80
|
-
const { prependBy =""
|
|
114
|
+
const { prependBy = "", joinBy = "\n\n", indentBy = 0 } = opts;
|
|
81
115
|
const formatted = errors.map((e)=>formatError(e)).join(joinBy);
|
|
82
116
|
return (0, _string.indentString)(prependBy + formatted, indentBy);
|
|
83
117
|
};
|
|
@@ -9,15 +9,25 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
booleanStr: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
booleanStr: function() {
|
|
13
|
+
return booleanStr;
|
|
14
|
+
},
|
|
15
|
+
dirPath: function() {
|
|
16
|
+
return dirPath;
|
|
17
|
+
},
|
|
18
|
+
jsonStr: function() {
|
|
19
|
+
return jsonStr;
|
|
20
|
+
},
|
|
21
|
+
maybeJsonStr: function() {
|
|
22
|
+
return maybeJsonStr;
|
|
23
|
+
},
|
|
24
|
+
maybeJsonStrAsList: function() {
|
|
25
|
+
return maybeJsonStrAsList;
|
|
26
|
+
}
|
|
17
27
|
});
|
|
18
|
-
const
|
|
28
|
+
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
19
29
|
const _core = require("@oclif/core");
|
|
20
|
-
const
|
|
30
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
21
31
|
const _json = require("./json");
|
|
22
32
|
function _getRequireWildcardCache(nodeInterop) {
|
|
23
33
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -27,7 +37,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
27
37
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
28
38
|
})(nodeInterop);
|
|
29
39
|
}
|
|
30
|
-
function
|
|
40
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
31
41
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
32
42
|
return obj;
|
|
33
43
|
}
|
|
@@ -40,7 +50,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
40
50
|
if (cache && cache.has(obj)) {
|
|
41
51
|
return cache.get(obj);
|
|
42
52
|
}
|
|
43
|
-
var newObj = {
|
|
53
|
+
var newObj = {
|
|
54
|
+
__proto__: null
|
|
55
|
+
};
|
|
44
56
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
57
|
for(var key in obj){
|
|
46
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -67,9 +79,9 @@ const booleanStr = _core.Flags.custom({
|
|
|
67
79
|
});
|
|
68
80
|
const dirPath = _core.Flags.custom({
|
|
69
81
|
parse: async (input)=>{
|
|
70
|
-
const abspath =
|
|
71
|
-
const exists = await
|
|
72
|
-
if (exists && !(await
|
|
82
|
+
const abspath = _nodepath.isAbsolute(input) ? input : _nodepath.resolve(process.cwd(), input);
|
|
83
|
+
const exists = await _fsextra.pathExists(abspath);
|
|
84
|
+
if (exists && !(await _fsextra.lstat(abspath)).isDirectory()) {
|
|
73
85
|
throw new Error(`${input} exists but is not a directory`);
|
|
74
86
|
}
|
|
75
87
|
return {
|
|
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "isDirectory", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return isDirectory;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
11
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
10
12
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
13
|
if (typeof WeakMap !== "function") return null;
|
|
12
14
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -15,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
15
17
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
16
18
|
})(nodeInterop);
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
19
21
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
20
22
|
return obj;
|
|
21
23
|
}
|
|
@@ -28,7 +30,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
28
30
|
if (cache && cache.has(obj)) {
|
|
29
31
|
return cache.get(obj);
|
|
30
32
|
}
|
|
31
|
-
var newObj = {
|
|
33
|
+
var newObj = {
|
|
34
|
+
__proto__: null
|
|
35
|
+
};
|
|
32
36
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
33
37
|
for(var key in obj){
|
|
34
38
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -47,6 +51,6 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
47
51
|
return newObj;
|
|
48
52
|
}
|
|
49
53
|
const isDirectory = async (abspath)=>{
|
|
50
|
-
const exists = await
|
|
51
|
-
return exists && (await
|
|
54
|
+
const exists = await _fsextra.pathExists(abspath);
|
|
55
|
+
return exists && (await _fsextra.lstat(abspath)).isDirectory();
|
|
52
56
|
};
|
|
@@ -9,13 +9,21 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
DOUBLE_SPACES: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
DOUBLE_SPACES: function() {
|
|
13
|
+
return DOUBLE_SPACES;
|
|
14
|
+
},
|
|
15
|
+
parseJson: function() {
|
|
16
|
+
return parseJson;
|
|
17
|
+
},
|
|
18
|
+
readJson: function() {
|
|
19
|
+
return readJson;
|
|
20
|
+
},
|
|
21
|
+
tryJsonParse: function() {
|
|
22
|
+
return tryJsonParse;
|
|
23
|
+
}
|
|
16
24
|
});
|
|
17
|
-
const _jsonlint = /*#__PURE__*/
|
|
18
|
-
const
|
|
25
|
+
const _jsonlint = /*#__PURE__*/ _interop_require_wildcard(require("@prantlf/jsonlint"));
|
|
26
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
19
27
|
const _error = require("./error");
|
|
20
28
|
function _getRequireWildcardCache(nodeInterop) {
|
|
21
29
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -25,7 +33,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
25
33
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
26
34
|
})(nodeInterop);
|
|
27
35
|
}
|
|
28
|
-
function
|
|
36
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
29
37
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
30
38
|
return obj;
|
|
31
39
|
}
|
|
@@ -38,7 +46,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
38
46
|
if (cache && cache.has(obj)) {
|
|
39
47
|
return cache.get(obj);
|
|
40
48
|
}
|
|
41
|
-
var newObj = {
|
|
49
|
+
var newObj = {
|
|
50
|
+
__proto__: null
|
|
51
|
+
};
|
|
42
52
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
53
|
for(var key in obj){
|
|
44
54
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -81,6 +91,6 @@ const tryJsonParse = (maybeJson)=>{
|
|
|
81
91
|
}
|
|
82
92
|
};
|
|
83
93
|
const readJson = async (filePath)=>{
|
|
84
|
-
const json = await
|
|
94
|
+
const json = await _fsextra.readFile(filePath, "utf8");
|
|
85
95
|
return parseJson(json);
|
|
86
96
|
};
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "validateLiquidSyntax", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return validateLiquidSyntax;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _liquidjs = require("liquidjs");
|
|
10
12
|
const _error = require("./error");
|
|
@@ -16,15 +16,42 @@ function _export(target, all) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
_export(exports, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
getLastFound: ()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
ObjPath: function() {
|
|
20
|
+
return ObjPath;
|
|
21
|
+
},
|
|
22
|
+
getLastFound: function() {
|
|
23
|
+
return getLastFound;
|
|
24
|
+
},
|
|
25
|
+
mapValuesDeep: function() {
|
|
26
|
+
return mapValuesDeep;
|
|
27
|
+
},
|
|
28
|
+
merge: function() {
|
|
29
|
+
return merge;
|
|
30
|
+
},
|
|
31
|
+
omitDeep: function() {
|
|
32
|
+
return omitDeep;
|
|
33
|
+
},
|
|
34
|
+
prune: function() {
|
|
35
|
+
return prune;
|
|
36
|
+
},
|
|
37
|
+
split: function() {
|
|
38
|
+
return split;
|
|
39
|
+
}
|
|
26
40
|
});
|
|
27
41
|
const _lodash = require("lodash");
|
|
42
|
+
function _define_property(obj, key, value) {
|
|
43
|
+
if (key in obj) {
|
|
44
|
+
Object.defineProperty(obj, key, {
|
|
45
|
+
value: value,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
obj[key] = value;
|
|
52
|
+
}
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
28
55
|
const split = (obj, paths)=>{
|
|
29
56
|
const picked = (0, _lodash.pick)(obj, paths);
|
|
30
57
|
const remainder = (0, _lodash.omit)(obj, paths);
|
|
@@ -154,6 +181,7 @@ class ObjPath {
|
|
|
154
181
|
}).join("");
|
|
155
182
|
}
|
|
156
183
|
constructor(parts = []){
|
|
184
|
+
_define_property(this, "parts", void 0);
|
|
157
185
|
this.parts = [
|
|
158
186
|
...parts
|
|
159
187
|
];
|
|
@@ -9,19 +9,35 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
formatPageActionPrompt: ()
|
|
19
|
-
|
|
12
|
+
MAX_PAGINATION_LIMIT: function() {
|
|
13
|
+
return MAX_PAGINATION_LIMIT;
|
|
14
|
+
},
|
|
15
|
+
PageAction: function() {
|
|
16
|
+
return PageAction;
|
|
17
|
+
},
|
|
18
|
+
formatPageActionPrompt: function() {
|
|
19
|
+
return formatPageActionPrompt;
|
|
20
|
+
},
|
|
21
|
+
maybePromptPageAction: function() {
|
|
22
|
+
return maybePromptPageAction;
|
|
23
|
+
},
|
|
24
|
+
pageFlags: function() {
|
|
25
|
+
return pageFlags;
|
|
26
|
+
},
|
|
27
|
+
paramsForPageAction: function() {
|
|
28
|
+
return paramsForPageAction;
|
|
29
|
+
},
|
|
30
|
+
toPageParams: function() {
|
|
31
|
+
return toPageParams;
|
|
32
|
+
},
|
|
33
|
+
validatePageActionInput: function() {
|
|
34
|
+
return validatePageActionInput;
|
|
35
|
+
}
|
|
20
36
|
});
|
|
21
37
|
const _core = require("@oclif/core");
|
|
22
|
-
const _enquirer = /*#__PURE__*/
|
|
38
|
+
const _enquirer = /*#__PURE__*/ _interop_require_default(require("enquirer"));
|
|
23
39
|
const _lodash = require("lodash");
|
|
24
|
-
function
|
|
40
|
+
function _interop_require_default(obj) {
|
|
25
41
|
return obj && obj.__esModule ? obj : {
|
|
26
42
|
default: obj
|
|
27
43
|
};
|
|
@@ -52,8 +68,8 @@ var PageAction;
|
|
|
52
68
|
* e.g. [p: preview, n: next]
|
|
53
69
|
*/ const formatPageActionPrompt = (pageInfo)=>{
|
|
54
70
|
const options = [
|
|
55
|
-
pageInfo.before && `${
|
|
56
|
-
pageInfo.after && `${
|
|
71
|
+
pageInfo.before && `${"p"}: previous page`,
|
|
72
|
+
pageInfo.after && `${"n"}: next page`
|
|
57
73
|
].filter((x)=>x);
|
|
58
74
|
return options.length > 0 ? `[${options.join(", ")}]` : undefined;
|
|
59
75
|
};
|
|
@@ -62,11 +78,11 @@ var PageAction;
|
|
|
62
78
|
* return if valid.
|
|
63
79
|
*/ const validatePageActionInput = (input, pageInfo)=>{
|
|
64
80
|
const val = input.toLowerCase().trim();
|
|
65
|
-
if (pageInfo.after && val ===
|
|
66
|
-
return
|
|
81
|
+
if (pageInfo.after && val === "n") {
|
|
82
|
+
return "n";
|
|
67
83
|
}
|
|
68
|
-
if (pageInfo.before && val ===
|
|
69
|
-
return
|
|
84
|
+
if (pageInfo.before && val === "p") {
|
|
85
|
+
return "p";
|
|
70
86
|
}
|
|
71
87
|
};
|
|
72
88
|
const maybePromptPageAction = async (pageInfo)=>{
|
|
@@ -86,11 +102,11 @@ const maybePromptPageAction = async (pageInfo)=>{
|
|
|
86
102
|
};
|
|
87
103
|
const paramsForPageAction = (pageAction, pageInfo)=>{
|
|
88
104
|
switch(pageAction){
|
|
89
|
-
case
|
|
105
|
+
case "p":
|
|
90
106
|
return {
|
|
91
107
|
before: pageInfo.before
|
|
92
108
|
};
|
|
93
|
-
case
|
|
109
|
+
case "n":
|
|
94
110
|
return {
|
|
95
111
|
after: pageInfo.after
|
|
96
112
|
};
|
|
@@ -9,19 +9,25 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
formatErrorRespMessage: function() {
|
|
13
|
+
return formatErrorRespMessage;
|
|
14
|
+
},
|
|
15
|
+
isSuccessResp: function() {
|
|
16
|
+
return isSuccessResp;
|
|
17
|
+
},
|
|
18
|
+
withSpinner: function() {
|
|
19
|
+
return withSpinner;
|
|
20
|
+
}
|
|
15
21
|
});
|
|
16
22
|
const _core = require("@oclif/core");
|
|
17
23
|
const _error = require("./error");
|
|
18
24
|
const _ux = require("./ux");
|
|
19
25
|
const isSuccessResp = (resp)=>resp.status >= 200 && resp.status < 300;
|
|
20
|
-
const formatErrorRespMessage = ({ status
|
|
26
|
+
const formatErrorRespMessage = ({ status, data })=>{
|
|
21
27
|
if (status === 500) {
|
|
22
28
|
return "An internal server error occurred";
|
|
23
29
|
}
|
|
24
|
-
const { message
|
|
30
|
+
const { message, errors = [] } = data;
|
|
25
31
|
if (status >= 400) {
|
|
26
32
|
const errs = errors.map((e)=>new _error.JsonDataError(e.message, e.field));
|
|
27
33
|
return errs.length === 0 ? message : message + "\n\n" + (0, _error.formatErrors)(errs, {
|
|
@@ -31,7 +37,7 @@ const formatErrorRespMessage = ({ status , data })=>{
|
|
|
31
37
|
return message;
|
|
32
38
|
};
|
|
33
39
|
const withSpinner = async (requestFn, opts = {})=>{
|
|
34
|
-
const { action ="‣ Loading"
|
|
40
|
+
const { action = "‣ Loading", ensureSuccess = true } = opts;
|
|
35
41
|
// Suppress printing the spinner in tests, oclif doesn't for some reasons.
|
|
36
42
|
_ux.spinner.start(action);
|
|
37
43
|
const resp = await requestFn();
|
|
@@ -11,17 +11,21 @@ function _export(target, all) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
_export(exports, {
|
|
14
|
-
checkSlugifiedFormat: ()
|
|
15
|
-
|
|
14
|
+
checkSlugifiedFormat: function() {
|
|
15
|
+
return checkSlugifiedFormat;
|
|
16
|
+
},
|
|
17
|
+
indentString: function() {
|
|
18
|
+
return indentString;
|
|
19
|
+
}
|
|
16
20
|
});
|
|
17
21
|
const SLUG_FORMAT_RE = /^[\w-]+$/;
|
|
18
22
|
const SLUG_LOWERCASE_FORMAT_RE = /^[\d_a-z-]+$/;
|
|
19
23
|
const checkSlugifiedFormat = (input, opts = {})=>{
|
|
20
|
-
const { onlyLowerCase =true
|
|
24
|
+
const { onlyLowerCase = true } = opts;
|
|
21
25
|
return onlyLowerCase ? SLUG_LOWERCASE_FORMAT_RE.test(input) : SLUG_FORMAT_RE.test(input);
|
|
22
26
|
};
|
|
23
27
|
const indentString = (string, count = 0, options = {})=>{
|
|
24
|
-
const { indent =" "
|
|
28
|
+
const { indent = " ", includeEmptyLines = false } = options;
|
|
25
29
|
if (typeof string !== "string") {
|
|
26
30
|
throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof string}\``);
|
|
27
31
|
}
|
|
@@ -9,20 +9,24 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
promptToConfirm: ()
|
|
13
|
-
|
|
12
|
+
promptToConfirm: function() {
|
|
13
|
+
return promptToConfirm;
|
|
14
|
+
},
|
|
15
|
+
spinner: function() {
|
|
16
|
+
return spinner;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
19
|
const _core = require("@oclif/core");
|
|
16
|
-
const _enquirer = /*#__PURE__*/
|
|
20
|
+
const _enquirer = /*#__PURE__*/ _interop_require_default(require("enquirer"));
|
|
17
21
|
const _const = require("./const");
|
|
18
|
-
function
|
|
22
|
+
function _interop_require_default(obj) {
|
|
19
23
|
return obj && obj.__esModule ? obj : {
|
|
20
24
|
default: obj
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
27
|
const promptToConfirm = async (message)=>{
|
|
24
28
|
try {
|
|
25
|
-
const { input
|
|
29
|
+
const { input } = await _enquirer.default.prompt({
|
|
26
30
|
type: "confirm",
|
|
27
31
|
name: "input",
|
|
28
32
|
message
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "formatCommitAuthor", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return formatCommitAuthor;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function formatCommitAuthor(commit) {
|
|
10
12
|
const email = commit.author.email;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./helpers"), exports);
|
|
6
|
+
_export_star(require("./types"), exports);
|
|
7
|
+
function _export_star(from, to) {
|
|
8
|
+
Object.keys(from).forEach(function(k) {
|
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
+
Object.defineProperty(to, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return from[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return from;
|
|
19
|
+
}
|
|
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "formatConditions", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return formatConditions;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const formatConditionsList = (conditions, joinedBy, appendedBy = "")=>conditions.map((c)=>`"${c.variable}" ${c.operator} "${c.argument}"`).join(`; ${joinedBy.toUpperCase()}\n`) + appendedBy;
|
|
10
|
-
const formatNestedConditions = (nestedConds, joinedBy, appendedBy = "")=>nestedConds.map(({ any
|
|
12
|
+
const formatNestedConditions = (nestedConds, joinedBy, appendedBy = "")=>nestedConds.map(({ any, all })=>{
|
|
11
13
|
if (any) return formatConditionsList(any, "or");
|
|
12
14
|
if (all) return formatConditionsList(all, "and");
|
|
13
15
|
throw new Error(`Invalid nested conditions: ${nestedConds}`);
|
|
14
16
|
}).join(`\n ${joinedBy.toUpperCase()}\n`) + appendedBy;
|
|
15
17
|
const formatConditions = (conditions)=>{
|
|
16
|
-
const { any
|
|
18
|
+
const { any, all } = conditions;
|
|
17
19
|
if (any) {
|
|
18
20
|
const [condition] = any;
|
|
19
21
|
return "variable" in condition ? formatConditionsList(any, "or", "\n") : formatNestedConditions(any, "or", "\n");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./helpers"), exports);
|
|
6
|
+
_export_star(require("./types"), exports);
|
|
7
|
+
function _export_star(from, to) {
|
|
8
|
+
Object.keys(from).forEach(function(k) {
|
|
9
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
+
Object.defineProperty(to, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return from[k];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return from;
|
|
19
|
+
}
|
|
@@ -9,15 +9,23 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
emailLayoutJsonPath: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ensureValidCommandTarget: ()
|
|
12
|
+
emailLayoutJsonPath: function() {
|
|
13
|
+
return emailLayoutJsonPath;
|
|
14
|
+
},
|
|
15
|
+
ensureValidCommandTarget: function() {
|
|
16
|
+
return ensureValidCommandTarget;
|
|
17
|
+
},
|
|
18
|
+
isEmailLayoutDir: function() {
|
|
19
|
+
return isEmailLayoutDir;
|
|
20
|
+
},
|
|
21
|
+
lsEmailLayoutJson: function() {
|
|
22
|
+
return lsEmailLayoutJson;
|
|
23
|
+
}
|
|
16
24
|
});
|
|
17
|
-
const
|
|
25
|
+
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
18
26
|
const _core = require("@oclif/core");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
27
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
28
|
+
const _processorisomorphic = require("./processor.isomorphic");
|
|
21
29
|
function _getRequireWildcardCache(nodeInterop) {
|
|
22
30
|
if (typeof WeakMap !== "function") return null;
|
|
23
31
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -26,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
26
34
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
27
35
|
})(nodeInterop);
|
|
28
36
|
}
|
|
29
|
-
function
|
|
37
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
30
38
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
31
39
|
return obj;
|
|
32
40
|
}
|
|
@@ -39,7 +47,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
39
47
|
if (cache && cache.has(obj)) {
|
|
40
48
|
return cache.get(obj);
|
|
41
49
|
}
|
|
42
|
-
var newObj = {
|
|
50
|
+
var newObj = {
|
|
51
|
+
__proto__: null
|
|
52
|
+
};
|
|
43
53
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
54
|
for(var key in obj){
|
|
45
55
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -57,16 +67,16 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
57
67
|
}
|
|
58
68
|
return newObj;
|
|
59
69
|
}
|
|
60
|
-
const emailLayoutJsonPath = (layoutDirCtx)=>
|
|
70
|
+
const emailLayoutJsonPath = (layoutDirCtx)=>_nodepath.resolve(layoutDirCtx.abspath, _processorisomorphic.LAYOUT_JSON);
|
|
61
71
|
const isEmailLayoutDir = async (dirPath)=>Boolean(await lsEmailLayoutJson(dirPath));
|
|
62
72
|
const lsEmailLayoutJson = async (dirPath)=>{
|
|
63
|
-
const emailLayoutJsonPath =
|
|
64
|
-
const exists = await
|
|
73
|
+
const emailLayoutJsonPath = _nodepath.resolve(dirPath, _processorisomorphic.LAYOUT_JSON);
|
|
74
|
+
const exists = await _fsextra.pathExists(emailLayoutJsonPath);
|
|
65
75
|
return exists ? emailLayoutJsonPath : undefined;
|
|
66
76
|
};
|
|
67
77
|
const ensureValidCommandTarget = async (props, runContext)=>{
|
|
68
|
-
const { args
|
|
69
|
-
const { commandId
|
|
78
|
+
const { args, flags } = props;
|
|
79
|
+
const { commandId, resourceDir: resourceDirCtx, cwd: runCwd } = runContext;
|
|
70
80
|
// If the target resource is a different type than the current resource dir
|
|
71
81
|
// type, error out.
|
|
72
82
|
if (resourceDirCtx && resourceDirCtx.type !== "email_layout") {
|
|
@@ -99,7 +109,7 @@ const ensureValidCommandTarget = async (props, runContext)=>{
|
|
|
99
109
|
if (resourceDirCtx && resourceDirCtx.key !== args.emailLayoutKey) {
|
|
100
110
|
return _core.ux.error(`Cannot run ${commandId} \`${args.emailLayoutKey}\` inside another layout directory:\n${resourceDirCtx.key}`);
|
|
101
111
|
}
|
|
102
|
-
const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath :
|
|
112
|
+
const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodepath.resolve(runCwd, args.emailLayoutKey);
|
|
103
113
|
const layoutDirCtx = {
|
|
104
114
|
type: "email_layout",
|
|
105
115
|
key: args.emailLayoutKey,
|