@knocklabs/cli 0.1.10 → 0.1.12
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 +34 -17
- 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/{lib → src/lib}/marshal/translation/processor.isomorphic.js +9 -3
- 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 +16 -16
- 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 -20
- package/dist/lib/marshal/translation/index.js +0 -20
- 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
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "marshal", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: ()
|
|
9
|
+
get: function() {
|
|
10
|
+
return _indexisomorphic;
|
|
11
|
+
}
|
|
10
12
|
});
|
|
11
|
-
const
|
|
13
|
+
const _indexisomorphic = /*#__PURE__*/ _interop_require_wildcard(require("./lib/marshal/index.isomorphic"));
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
13
15
|
if (typeof WeakMap !== "function") return null;
|
|
14
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -17,7 +19,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
17
19
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
18
20
|
})(nodeInterop);
|
|
19
21
|
}
|
|
20
|
-
function
|
|
22
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
21
23
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
22
24
|
return obj;
|
|
23
25
|
}
|
|
@@ -30,7 +32,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
30
32
|
if (cache && cache.has(obj)) {
|
|
31
33
|
return cache.get(obj);
|
|
32
34
|
}
|
|
33
|
-
var newObj = {
|
|
35
|
+
var newObj = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
};
|
|
34
38
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
35
39
|
for(var key in obj){
|
|
36
40
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -4,12 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return ApiV1;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _axios = /*#__PURE__*/
|
|
10
|
-
const
|
|
11
|
+
const _axios = /*#__PURE__*/ _interop_require_default(require("axios"));
|
|
12
|
+
const _objectisomorphic = require("./helpers/object.isomorphic");
|
|
11
13
|
const _page = require("./helpers/page");
|
|
12
|
-
function
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
function _interop_require_default(obj) {
|
|
13
28
|
return obj && obj.__esModule ? obj : {
|
|
14
29
|
default: obj
|
|
15
30
|
};
|
|
@@ -24,8 +39,8 @@ class ApiV1 {
|
|
|
24
39
|
return this.get("/whoami");
|
|
25
40
|
}
|
|
26
41
|
// By resources: Workflows
|
|
27
|
-
async listWorkflows({ flags
|
|
28
|
-
const params = (0,
|
|
42
|
+
async listWorkflows({ flags }) {
|
|
43
|
+
const params = (0, _objectisomorphic.prune)({
|
|
29
44
|
environment: flags.environment,
|
|
30
45
|
annotate: flags.annotate,
|
|
31
46
|
hide_uncommitted_changes: flags["hide-uncommitted-changes"],
|
|
@@ -35,8 +50,8 @@ class ApiV1 {
|
|
|
35
50
|
params
|
|
36
51
|
});
|
|
37
52
|
}
|
|
38
|
-
async getWorkflow({ args
|
|
39
|
-
const params = (0,
|
|
53
|
+
async getWorkflow({ args, flags }) {
|
|
54
|
+
const params = (0, _objectisomorphic.prune)({
|
|
40
55
|
environment: flags.environment,
|
|
41
56
|
annotate: flags.annotate,
|
|
42
57
|
hide_uncommitted_changes: flags["hide-uncommitted-changes"]
|
|
@@ -45,8 +60,8 @@ class ApiV1 {
|
|
|
45
60
|
params
|
|
46
61
|
});
|
|
47
62
|
}
|
|
48
|
-
async upsertWorkflow({ flags
|
|
49
|
-
const params = (0,
|
|
63
|
+
async upsertWorkflow({ flags }, workflow) {
|
|
64
|
+
const params = (0, _objectisomorphic.prune)({
|
|
50
65
|
environment: flags.environment,
|
|
51
66
|
annotate: flags.annotate,
|
|
52
67
|
commit: flags.commit,
|
|
@@ -59,8 +74,8 @@ class ApiV1 {
|
|
|
59
74
|
params
|
|
60
75
|
});
|
|
61
76
|
}
|
|
62
|
-
async validateWorkflow({ flags
|
|
63
|
-
const params = (0,
|
|
77
|
+
async validateWorkflow({ flags }, workflow) {
|
|
78
|
+
const params = (0, _objectisomorphic.prune)({
|
|
64
79
|
environment: flags.environment
|
|
65
80
|
});
|
|
66
81
|
const data = {
|
|
@@ -70,8 +85,8 @@ class ApiV1 {
|
|
|
70
85
|
params
|
|
71
86
|
});
|
|
72
87
|
}
|
|
73
|
-
async activateWorkflow({ args
|
|
74
|
-
const params = (0,
|
|
88
|
+
async activateWorkflow({ args, flags }) {
|
|
89
|
+
const params = (0, _objectisomorphic.prune)({
|
|
75
90
|
environment: flags.environment,
|
|
76
91
|
status: flags.status
|
|
77
92
|
});
|
|
@@ -79,11 +94,11 @@ class ApiV1 {
|
|
|
79
94
|
params
|
|
80
95
|
});
|
|
81
96
|
}
|
|
82
|
-
async runWorkflow({ args
|
|
83
|
-
const params = (0,
|
|
97
|
+
async runWorkflow({ args, flags }) {
|
|
98
|
+
const params = (0, _objectisomorphic.prune)({
|
|
84
99
|
environment: flags.environment
|
|
85
100
|
});
|
|
86
|
-
const data = (0,
|
|
101
|
+
const data = (0, _objectisomorphic.prune)({
|
|
87
102
|
recipients: flags.recipients,
|
|
88
103
|
tenant: flags.tenant,
|
|
89
104
|
data: flags.data,
|
|
@@ -94,8 +109,8 @@ class ApiV1 {
|
|
|
94
109
|
});
|
|
95
110
|
}
|
|
96
111
|
// By resources: Commits
|
|
97
|
-
async listCommits({ flags
|
|
98
|
-
const params = (0,
|
|
112
|
+
async listCommits({ flags }) {
|
|
113
|
+
const params = (0, _objectisomorphic.prune)({
|
|
99
114
|
environment: flags.environment,
|
|
100
115
|
promoted: flags.promoted,
|
|
101
116
|
...(0, _page.toPageParams)(flags)
|
|
@@ -104,11 +119,11 @@ class ApiV1 {
|
|
|
104
119
|
params
|
|
105
120
|
});
|
|
106
121
|
}
|
|
107
|
-
async getCommit({ args
|
|
122
|
+
async getCommit({ args }) {
|
|
108
123
|
return this.get(`/commits/${args.id}`);
|
|
109
124
|
}
|
|
110
|
-
async commitAllChanges({ flags
|
|
111
|
-
const params = (0,
|
|
125
|
+
async commitAllChanges({ flags }) {
|
|
126
|
+
const params = (0, _objectisomorphic.prune)({
|
|
112
127
|
environment: flags.environment,
|
|
113
128
|
commit_message: flags["commit-message"]
|
|
114
129
|
});
|
|
@@ -116,20 +131,20 @@ class ApiV1 {
|
|
|
116
131
|
params
|
|
117
132
|
});
|
|
118
133
|
}
|
|
119
|
-
async promoteAllChanges({ flags
|
|
120
|
-
const params = (0,
|
|
134
|
+
async promoteAllChanges({ flags }) {
|
|
135
|
+
const params = (0, _objectisomorphic.prune)({
|
|
121
136
|
to_environment: flags.to
|
|
122
137
|
});
|
|
123
138
|
return this.put(`/commits/promote`, {}, {
|
|
124
139
|
params
|
|
125
140
|
});
|
|
126
141
|
}
|
|
127
|
-
async promoteOneChange({ flags
|
|
142
|
+
async promoteOneChange({ flags }) {
|
|
128
143
|
return this.put(`/commits/${flags.only}/promote`);
|
|
129
144
|
}
|
|
130
145
|
// By resources: Translations
|
|
131
|
-
async listTranslations({ flags
|
|
132
|
-
const params = (0,
|
|
146
|
+
async listTranslations({ flags }, filters = {}) {
|
|
147
|
+
const params = (0, _objectisomorphic.prune)({
|
|
133
148
|
environment: flags.environment,
|
|
134
149
|
hide_uncommitted_changes: flags["hide-uncommitted-changes"],
|
|
135
150
|
locale_code: filters.localeCode,
|
|
@@ -140,8 +155,8 @@ class ApiV1 {
|
|
|
140
155
|
params
|
|
141
156
|
});
|
|
142
157
|
}
|
|
143
|
-
async getTranslation({ flags
|
|
144
|
-
const params = (0,
|
|
158
|
+
async getTranslation({ flags }, translation) {
|
|
159
|
+
const params = (0, _objectisomorphic.prune)({
|
|
145
160
|
environment: flags.environment,
|
|
146
161
|
hide_uncommitted_changes: flags["hide-uncommitted-changes"],
|
|
147
162
|
namespace: translation.namespace
|
|
@@ -150,8 +165,8 @@ class ApiV1 {
|
|
|
150
165
|
params
|
|
151
166
|
});
|
|
152
167
|
}
|
|
153
|
-
async upsertTranslation({ flags
|
|
154
|
-
const params = (0,
|
|
168
|
+
async upsertTranslation({ flags }, translation) {
|
|
169
|
+
const params = (0, _objectisomorphic.prune)({
|
|
155
170
|
environment: flags.environment,
|
|
156
171
|
commit: flags.commit,
|
|
157
172
|
commit_message: flags["commit-message"],
|
|
@@ -163,8 +178,8 @@ class ApiV1 {
|
|
|
163
178
|
params
|
|
164
179
|
});
|
|
165
180
|
}
|
|
166
|
-
async validateTranslation({ flags
|
|
167
|
-
const params = (0,
|
|
181
|
+
async validateTranslation({ flags }, translation) {
|
|
182
|
+
const params = (0, _objectisomorphic.prune)({
|
|
168
183
|
environment: flags.environment,
|
|
169
184
|
namespace: translation.namespace
|
|
170
185
|
});
|
|
@@ -176,8 +191,8 @@ class ApiV1 {
|
|
|
176
191
|
});
|
|
177
192
|
}
|
|
178
193
|
// By resources: Email layouts
|
|
179
|
-
async listEmailLayouts({ flags
|
|
180
|
-
const params = (0,
|
|
194
|
+
async listEmailLayouts({ flags }) {
|
|
195
|
+
const params = (0, _objectisomorphic.prune)({
|
|
181
196
|
environment: flags.environment,
|
|
182
197
|
annotate: flags.annotate,
|
|
183
198
|
hide_uncommitted_changes: flags["hide-uncommitted-changes"],
|
|
@@ -187,8 +202,8 @@ class ApiV1 {
|
|
|
187
202
|
params
|
|
188
203
|
});
|
|
189
204
|
}
|
|
190
|
-
async getEmailLayout({ args
|
|
191
|
-
const params = (0,
|
|
205
|
+
async getEmailLayout({ args, flags }) {
|
|
206
|
+
const params = (0, _objectisomorphic.prune)({
|
|
192
207
|
environment: flags.environment,
|
|
193
208
|
annotate: flags.annotate,
|
|
194
209
|
hide_uncommitted_changes: flags["hide-uncommitted-changes"]
|
|
@@ -197,8 +212,8 @@ class ApiV1 {
|
|
|
197
212
|
params
|
|
198
213
|
});
|
|
199
214
|
}
|
|
200
|
-
async upsertEmailLayout({ flags
|
|
201
|
-
const params = (0,
|
|
215
|
+
async upsertEmailLayout({ flags }, layout) {
|
|
216
|
+
const params = (0, _objectisomorphic.prune)({
|
|
202
217
|
environment: flags.environment,
|
|
203
218
|
annotate: flags.annotate,
|
|
204
219
|
commit: flags.commit,
|
|
@@ -211,8 +226,8 @@ class ApiV1 {
|
|
|
211
226
|
params
|
|
212
227
|
});
|
|
213
228
|
}
|
|
214
|
-
async validateEmailLayout({ flags
|
|
215
|
-
const params = (0,
|
|
229
|
+
async validateEmailLayout({ flags }, layout) {
|
|
230
|
+
const params = (0, _objectisomorphic.prune)({
|
|
216
231
|
environment: flags.environment
|
|
217
232
|
});
|
|
218
233
|
const data = {
|
|
@@ -230,6 +245,7 @@ class ApiV1 {
|
|
|
230
245
|
return this.client.put(`/${API_VERSION}` + subpath, data, config);
|
|
231
246
|
}
|
|
232
247
|
constructor(flags, config){
|
|
248
|
+
_define_property(this, "client", void 0);
|
|
233
249
|
const baseURL = flags["api-origin"] || DEFAULT_ORIGIN;
|
|
234
250
|
this.client = _axios.default.create({
|
|
235
251
|
baseURL,
|
|
@@ -4,13 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _core = require("@oclif/core");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
function
|
|
12
|
+
const _apiv1 = /*#__PURE__*/ _interop_require_default(require("./api-v1"));
|
|
13
|
+
const _runcontext = /*#__PURE__*/ _interop_require_wildcard(require("./run-context"));
|
|
14
|
+
const _userconfig = /*#__PURE__*/ _interop_require_default(require("./user-config"));
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
function _interop_require_default(obj) {
|
|
14
29
|
return obj && obj.__esModule ? obj : {
|
|
15
30
|
default: obj
|
|
16
31
|
};
|
|
@@ -23,7 +38,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
23
38
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
24
39
|
})(nodeInterop);
|
|
25
40
|
}
|
|
26
|
-
function
|
|
41
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
27
42
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
28
43
|
return obj;
|
|
29
44
|
}
|
|
@@ -36,7 +51,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
36
51
|
if (cache && cache.has(obj)) {
|
|
37
52
|
return cache.get(obj);
|
|
38
53
|
}
|
|
39
|
-
var newObj = {
|
|
54
|
+
var newObj = {
|
|
55
|
+
__proto__: null
|
|
56
|
+
};
|
|
40
57
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
58
|
for(var key in obj){
|
|
42
59
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -58,21 +75,27 @@ class BaseCommand extends _core.Command {
|
|
|
58
75
|
async init() {
|
|
59
76
|
await super.init();
|
|
60
77
|
// 1. Load user's config from the config dir, as available.
|
|
61
|
-
await
|
|
78
|
+
await _userconfig.default.load(this.config.configDir);
|
|
62
79
|
// 2. Parse flags and args, must come after the user config load.
|
|
63
|
-
const { args
|
|
80
|
+
const { args, flags } = await this.parse(this.ctor);
|
|
64
81
|
this.props = {
|
|
65
82
|
args: args,
|
|
66
83
|
flags: flags
|
|
67
84
|
};
|
|
68
85
|
// 3. Instantiate a knock api client.
|
|
69
|
-
this.apiV1 = new
|
|
86
|
+
this.apiV1 = new _apiv1.default(this.props.flags, this.config);
|
|
70
87
|
// 4. Load the run context of the invoked command.
|
|
71
|
-
this.runContext = await
|
|
88
|
+
this.runContext = await _runcontext.load(this.id);
|
|
89
|
+
}
|
|
90
|
+
constructor(...args){
|
|
91
|
+
super(...args);
|
|
92
|
+
_define_property(this, "props", void 0);
|
|
93
|
+
_define_property(this, "apiV1", void 0);
|
|
94
|
+
_define_property(this, "runContext", void 0);
|
|
72
95
|
}
|
|
73
96
|
}
|
|
74
97
|
// Base flags are inherited by any command that extends BaseCommand.
|
|
75
|
-
BaseCommand
|
|
98
|
+
_define_property(BaseCommand, "baseFlags", {
|
|
76
99
|
// Evaluated in the following precedence:
|
|
77
100
|
// - service token flag passed into the command
|
|
78
101
|
// - if not provided, fall back to env variable
|
|
@@ -82,14 +105,14 @@ BaseCommand.baseFlags = {
|
|
|
82
105
|
required: true,
|
|
83
106
|
multiple: false,
|
|
84
107
|
env: "KNOCK_SERVICE_TOKEN",
|
|
85
|
-
default: async ()=>
|
|
108
|
+
default: async ()=>_userconfig.default.get().serviceToken
|
|
86
109
|
}),
|
|
87
110
|
// Hidden flag to use a different api base url for development purposes.
|
|
88
111
|
"api-origin": _core.Flags.string({
|
|
89
112
|
hidden: true,
|
|
90
113
|
required: false,
|
|
91
114
|
multiple: false,
|
|
92
|
-
default: async ()=>
|
|
115
|
+
default: async ()=>_userconfig.default.get().apiOrigin
|
|
93
116
|
})
|
|
94
|
-
};
|
|
117
|
+
});
|
|
95
118
|
const _default = BaseCommand;
|
|
@@ -9,14 +9,20 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
KnockEnv: ()
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
KnockEnv: function() {
|
|
13
|
+
return KnockEnv;
|
|
14
|
+
},
|
|
15
|
+
isTestEnv: function() {
|
|
16
|
+
return isTestEnv;
|
|
17
|
+
},
|
|
18
|
+
sandboxDir: function() {
|
|
19
|
+
return sandboxDir;
|
|
20
|
+
}
|
|
15
21
|
});
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
function
|
|
22
|
+
const _nodeos = /*#__PURE__*/ _interop_require_default(require("node:os"));
|
|
23
|
+
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
24
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
25
|
+
function _interop_require_default(obj) {
|
|
20
26
|
return obj && obj.__esModule ? obj : {
|
|
21
27
|
default: obj
|
|
22
28
|
};
|
|
@@ -29,7 +35,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
29
35
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
30
36
|
})(nodeInterop);
|
|
31
37
|
}
|
|
32
|
-
function
|
|
38
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
33
39
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
34
40
|
return obj;
|
|
35
41
|
}
|
|
@@ -42,7 +48,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
42
48
|
if (cache && cache.has(obj)) {
|
|
43
49
|
return cache.get(obj);
|
|
44
50
|
}
|
|
45
|
-
var newObj = {
|
|
51
|
+
var newObj = {
|
|
52
|
+
__proto__: null
|
|
53
|
+
};
|
|
46
54
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
47
55
|
for(var key in obj){
|
|
48
56
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -66,4 +74,4 @@ var KnockEnv;
|
|
|
66
74
|
KnockEnv["Production"] = "production";
|
|
67
75
|
})(KnockEnv || (KnockEnv = {}));
|
|
68
76
|
const isTestEnv = process.env.NODE_ENV === "test";
|
|
69
|
-
const sandboxDir =
|
|
77
|
+
const sandboxDir = _nodepath.resolve(_fsextra.realpathSync(_nodeos.default.tmpdir()), ".knock");
|
|
@@ -9,13 +9,17 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
formatDate: ()
|
|
13
|
-
|
|
12
|
+
formatDate: function() {
|
|
13
|
+
return formatDate;
|
|
14
|
+
},
|
|
15
|
+
formatDateTime: function() {
|
|
16
|
+
return formatDateTime;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
19
|
+
const _datefns = require("date-fns");
|
|
16
20
|
function formatDate(input) {
|
|
17
|
-
return (0,
|
|
21
|
+
return (0, _datefns.format)((0, _datefns.parseISO)(input), "MMM d, yyyy");
|
|
18
22
|
}
|
|
19
23
|
function formatDateTime(input) {
|
|
20
|
-
return (0,
|
|
24
|
+
return (0, _datefns.format)((0, _datefns.parseISO)(input), "MMM d, yyyy HH:mm:ss");
|
|
21
25
|
}
|
|
@@ -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
|
};
|