@knocklabs/cli 0.1.22 → 0.1.23
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 +102 -43
- package/dist/commands/commit/list.js +21 -1
- package/dist/commands/guide/activate.js +121 -0
- package/dist/commands/guide/generate-types.js +148 -0
- package/dist/commands/guide/get.js +139 -0
- package/dist/commands/guide/list.js +112 -0
- package/dist/commands/guide/pull.js +209 -0
- package/dist/commands/guide/push.js +171 -0
- package/dist/commands/guide/validate.js +148 -0
- package/dist/commands/workflow/generate-types.js +6 -5
- package/dist/lib/api-v1.js +61 -0
- package/dist/lib/helpers/const.js +4 -4
- package/dist/lib/helpers/date.js +3 -3
- package/dist/lib/helpers/error.js +8 -8
- package/dist/lib/helpers/flag.js +7 -7
- package/dist/lib/helpers/json.js +5 -5
- package/dist/lib/helpers/object.isomorphic.js +8 -8
- package/dist/lib/helpers/page.js +9 -9
- package/dist/lib/helpers/request.js +4 -4
- package/dist/lib/helpers/string.js +3 -3
- package/dist/lib/helpers/typegen.js +59 -0
- package/dist/lib/helpers/ux.js +3 -3
- package/dist/lib/marshal/email-layout/helpers.js +5 -5
- package/dist/lib/marshal/email-layout/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/email-layout/reader.js +5 -5
- package/dist/lib/marshal/email-layout/writer.js +4 -4
- package/dist/lib/marshal/guide/helpers.js +283 -0
- package/dist/lib/marshal/guide/index.js +3 -0
- package/dist/lib/marshal/guide/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/guide/reader.js +193 -0
- package/dist/lib/marshal/guide/writer.js +175 -0
- package/dist/lib/marshal/index.isomorphic.js +7 -7
- package/dist/lib/marshal/message-type/helpers.js +5 -5
- package/dist/lib/marshal/message-type/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/message-type/reader.js +5 -5
- package/dist/lib/marshal/message-type/writer.js +4 -4
- package/dist/lib/marshal/partial/helpers.js +5 -5
- package/dist/lib/marshal/partial/processor.isomorphic.js +3 -3
- package/dist/lib/marshal/partial/reader.js +5 -5
- package/dist/lib/marshal/partial/writer.js +4 -4
- package/dist/lib/marshal/shared/const.isomorphic.js +3 -3
- package/dist/lib/marshal/shared/helpers.isomorphic.js +9 -2
- package/dist/lib/marshal/shared/helpers.js +4 -4
- package/dist/lib/marshal/translation/helpers.js +10 -10
- package/dist/lib/marshal/translation/processor.isomorphic.js +6 -6
- package/dist/lib/marshal/translation/writer.js +3 -3
- package/dist/lib/marshal/workflow/generator.js +4 -4
- package/dist/lib/marshal/workflow/helpers.js +53 -10
- package/dist/lib/marshal/workflow/processor.isomorphic.js +5 -5
- package/dist/lib/marshal/workflow/reader.js +5 -5
- package/dist/lib/marshal/workflow/writer.js +5 -5
- package/dist/lib/resources.js +3 -3
- package/oclif.manifest.json +615 -54
- package/package.json +8 -8
- package/dist/lib/type-generator.js +0 -100
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return GuidePush;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@oclif/core");
|
|
12
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _const = require("../../lib/helpers/const");
|
|
14
|
+
const _error = require("../../lib/helpers/error");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
16
|
+
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
17
|
+
const _request = require("../../lib/helpers/request");
|
|
18
|
+
const _string = require("../../lib/helpers/string");
|
|
19
|
+
const _ux = require("../../lib/helpers/ux");
|
|
20
|
+
const _guide = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/guide"));
|
|
21
|
+
const _validate = /*#__PURE__*/ _interop_require_default(require("./validate"));
|
|
22
|
+
function _define_property(obj, key, value) {
|
|
23
|
+
if (key in obj) {
|
|
24
|
+
Object.defineProperty(obj, key, {
|
|
25
|
+
value: value,
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
obj[key] = value;
|
|
32
|
+
}
|
|
33
|
+
return obj;
|
|
34
|
+
}
|
|
35
|
+
function _interop_require_default(obj) {
|
|
36
|
+
return obj && obj.__esModule ? obj : {
|
|
37
|
+
default: obj
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
41
|
+
if (typeof WeakMap !== "function") return null;
|
|
42
|
+
var cacheBabelInterop = new WeakMap();
|
|
43
|
+
var cacheNodeInterop = new WeakMap();
|
|
44
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
45
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
46
|
+
})(nodeInterop);
|
|
47
|
+
}
|
|
48
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
49
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
53
|
+
return {
|
|
54
|
+
default: obj
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
58
|
+
if (cache && cache.has(obj)) {
|
|
59
|
+
return cache.get(obj);
|
|
60
|
+
}
|
|
61
|
+
var newObj = {
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
64
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
65
|
+
for(var key in obj){
|
|
66
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
67
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
68
|
+
if (desc && (desc.get || desc.set)) {
|
|
69
|
+
Object.defineProperty(newObj, key, desc);
|
|
70
|
+
} else {
|
|
71
|
+
newObj[key] = obj[key];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
newObj.default = obj;
|
|
76
|
+
if (cache) {
|
|
77
|
+
cache.set(obj, newObj);
|
|
78
|
+
}
|
|
79
|
+
return newObj;
|
|
80
|
+
}
|
|
81
|
+
class GuidePush extends _basecommand.default {
|
|
82
|
+
async run() {
|
|
83
|
+
const { flags } = this.props;
|
|
84
|
+
// 1. First read all guide directories found for the given command.
|
|
85
|
+
const target = await _guide.ensureValidCommandTarget(this.props, this.runContext);
|
|
86
|
+
const [guides, readErrors] = await _guide.readAllForCommandTarget(target, {
|
|
87
|
+
withExtractedFiles: true
|
|
88
|
+
});
|
|
89
|
+
if (readErrors.length > 0) {
|
|
90
|
+
this.error((0, _error.formatErrors)(readErrors, {
|
|
91
|
+
prependBy: "\n\n"
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
if (guides.length === 0) {
|
|
95
|
+
this.error(`No guide directories found in ${target.context.abspath}`);
|
|
96
|
+
}
|
|
97
|
+
// 2. Then validate them all ahead of pushing them.
|
|
98
|
+
_ux.spinner.start(`‣ Validating`);
|
|
99
|
+
const apiErrors = await _validate.default.validateAll(this.apiV1, this.props, guides);
|
|
100
|
+
if (apiErrors.length > 0) {
|
|
101
|
+
this.error((0, _error.formatErrors)(apiErrors, {
|
|
102
|
+
prependBy: "\n\n"
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
_ux.spinner.stop();
|
|
106
|
+
// 3. Finally push up each guide, abort on the first error.
|
|
107
|
+
_ux.spinner.start(`‣ Pushing`);
|
|
108
|
+
for (const guide of guides){
|
|
109
|
+
const props = (0, _objectisomorphic.merge)(this.props, {
|
|
110
|
+
flags: {
|
|
111
|
+
annotate: true
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
// eslint-disable-next-line no-await-in-loop
|
|
115
|
+
const resp = await this.apiV1.upsertGuide(props, {
|
|
116
|
+
...guide.content,
|
|
117
|
+
key: guide.key
|
|
118
|
+
});
|
|
119
|
+
if ((0, _request.isSuccessResp)(resp)) {
|
|
120
|
+
// Update the guide directory with the successfully pushed guide
|
|
121
|
+
// payload from the server.
|
|
122
|
+
// eslint-disable-next-line no-await-in-loop
|
|
123
|
+
await _guide.writeGuideDirFromData(guide, resp.data.guide);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _guide.guideJsonPath(guide), "ApiError");
|
|
127
|
+
this.error((0, _error.formatError)(error));
|
|
128
|
+
}
|
|
129
|
+
_ux.spinner.stop();
|
|
130
|
+
// 4. Display a success message.
|
|
131
|
+
const guideKeys = guides.map((g)=>g.key);
|
|
132
|
+
const actioned = flags.commit ? "pushed and committed" : "pushed";
|
|
133
|
+
this.log(`‣ Successfully ${actioned} ${guides.length} guide(s):\n` + (0, _string.indentString)(guideKeys.join("\n"), 4));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Hide until guides are released in GA.
|
|
137
|
+
_define_property(GuidePush, "hidden", true);
|
|
138
|
+
_define_property(GuidePush, "summary", "Push one or more guides from a local file system to Knock.");
|
|
139
|
+
_define_property(GuidePush, "flags", {
|
|
140
|
+
environment: _core.Flags.string({
|
|
141
|
+
summary: "Pushing a guide is only allowed in the development environment",
|
|
142
|
+
default: _const.KnockEnv.Development,
|
|
143
|
+
options: [
|
|
144
|
+
_const.KnockEnv.Development
|
|
145
|
+
]
|
|
146
|
+
}),
|
|
147
|
+
all: _core.Flags.boolean({
|
|
148
|
+
summary: "Whether to push all guides from the target directory."
|
|
149
|
+
}),
|
|
150
|
+
"guides-dir": _flag.dirPath({
|
|
151
|
+
summary: "The target directory path to find all guides to push.",
|
|
152
|
+
dependsOn: [
|
|
153
|
+
"all"
|
|
154
|
+
]
|
|
155
|
+
}),
|
|
156
|
+
commit: _core.Flags.boolean({
|
|
157
|
+
summary: "Push and commit the guide(s) at the same time"
|
|
158
|
+
}),
|
|
159
|
+
"commit-message": _core.Flags.string({
|
|
160
|
+
summary: "Use the given value as the commit message",
|
|
161
|
+
char: "m",
|
|
162
|
+
dependsOn: [
|
|
163
|
+
"commit"
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
_define_property(GuidePush, "args", {
|
|
168
|
+
guideKey: _core.Args.string({
|
|
169
|
+
required: false
|
|
170
|
+
})
|
|
171
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return GuideValidate;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@oclif/core");
|
|
12
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _const = require("../../lib/helpers/const");
|
|
14
|
+
const _error = require("../../lib/helpers/error");
|
|
15
|
+
const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
|
|
16
|
+
const _request = require("../../lib/helpers/request");
|
|
17
|
+
const _string = require("../../lib/helpers/string");
|
|
18
|
+
const _ux = require("../../lib/helpers/ux");
|
|
19
|
+
const _guide = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/guide"));
|
|
20
|
+
function _define_property(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
function _interop_require_default(obj) {
|
|
34
|
+
return obj && obj.__esModule ? obj : {
|
|
35
|
+
default: obj
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
39
|
+
if (typeof WeakMap !== "function") return null;
|
|
40
|
+
var cacheBabelInterop = new WeakMap();
|
|
41
|
+
var cacheNodeInterop = new WeakMap();
|
|
42
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
43
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
44
|
+
})(nodeInterop);
|
|
45
|
+
}
|
|
46
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
47
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
51
|
+
return {
|
|
52
|
+
default: obj
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
+
if (cache && cache.has(obj)) {
|
|
57
|
+
return cache.get(obj);
|
|
58
|
+
}
|
|
59
|
+
var newObj = {
|
|
60
|
+
__proto__: null
|
|
61
|
+
};
|
|
62
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
63
|
+
for(var key in obj){
|
|
64
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
+
if (desc && (desc.get || desc.set)) {
|
|
67
|
+
Object.defineProperty(newObj, key, desc);
|
|
68
|
+
} else {
|
|
69
|
+
newObj[key] = obj[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
newObj.default = obj;
|
|
74
|
+
if (cache) {
|
|
75
|
+
cache.set(obj, newObj);
|
|
76
|
+
}
|
|
77
|
+
return newObj;
|
|
78
|
+
}
|
|
79
|
+
class GuideValidate extends _basecommand.default {
|
|
80
|
+
async run() {
|
|
81
|
+
// 1. Read all guide directories found for the given command.
|
|
82
|
+
const target = await _guide.ensureValidCommandTarget(this.props, this.runContext);
|
|
83
|
+
const [guides, readErrors] = await _guide.readAllForCommandTarget(target, {
|
|
84
|
+
withExtractedFiles: true
|
|
85
|
+
});
|
|
86
|
+
if (readErrors.length > 0) {
|
|
87
|
+
this.error((0, _error.formatErrors)(readErrors, {
|
|
88
|
+
prependBy: "\n\n"
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
if (guides.length === 0) {
|
|
92
|
+
this.error(`No guide directories found in ${target.context.abspath}`);
|
|
93
|
+
}
|
|
94
|
+
// 2. Validate each guide data.
|
|
95
|
+
_ux.spinner.start(`‣ Validating`);
|
|
96
|
+
const apiErrors = await GuideValidate.validateAll(this.apiV1, this.props, guides);
|
|
97
|
+
if (apiErrors.length > 0) {
|
|
98
|
+
this.error((0, _error.formatErrors)(apiErrors, {
|
|
99
|
+
prependBy: "\n\n"
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
_ux.spinner.stop();
|
|
103
|
+
// 3. Display a success message.
|
|
104
|
+
const guideKeys = guides.map((g)=>g.key);
|
|
105
|
+
this.log(`‣ Successfully validated ${guides.length} guide(s):\n` + (0, _string.indentString)(guideKeys.join("\n"), 4));
|
|
106
|
+
}
|
|
107
|
+
static async validateAll(api, props, guides) {
|
|
108
|
+
// TODO: Throw an error if a non validation error (e.g. authentication error)
|
|
109
|
+
// instead of printing out same error messages repeatedly.
|
|
110
|
+
const errorPromises = guides.map(async (guide)=>{
|
|
111
|
+
const resp = await api.validateGuide(props, {
|
|
112
|
+
...guide.content,
|
|
113
|
+
key: guide.key
|
|
114
|
+
});
|
|
115
|
+
if ((0, _request.isSuccessResp)(resp)) return;
|
|
116
|
+
const error = new _error.SourceError((0, _request.formatErrorRespMessage)(resp), _guide.guideJsonPath(guide), "ApiError");
|
|
117
|
+
return error;
|
|
118
|
+
});
|
|
119
|
+
const errors = (await Promise.all(errorPromises)).filter((e)=>Boolean(e));
|
|
120
|
+
return errors;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
_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
|
+
_define_property(GuideValidate, "flags", {
|
|
127
|
+
environment: _core.Flags.string({
|
|
128
|
+
summary: "Validating a guide is only done in the development environment",
|
|
129
|
+
default: _const.KnockEnv.Development,
|
|
130
|
+
options: [
|
|
131
|
+
_const.KnockEnv.Development
|
|
132
|
+
]
|
|
133
|
+
}),
|
|
134
|
+
all: _core.Flags.boolean({
|
|
135
|
+
summary: "Whether to validate all guides from the target directory."
|
|
136
|
+
}),
|
|
137
|
+
"guides-dir": _flag.dirPath({
|
|
138
|
+
summary: "The target directory path to find all guides to validate.",
|
|
139
|
+
dependsOn: [
|
|
140
|
+
"all"
|
|
141
|
+
]
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
_define_property(GuideValidate, "args", {
|
|
145
|
+
guideKey: _core.Args.string({
|
|
146
|
+
required: false
|
|
147
|
+
})
|
|
148
|
+
});
|
|
@@ -17,8 +17,9 @@ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers
|
|
|
17
17
|
const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
|
|
18
18
|
const _page = require("../../lib/helpers/page");
|
|
19
19
|
const _request = require("../../lib/helpers/request");
|
|
20
|
+
const _typegen = require("../../lib/helpers/typegen");
|
|
20
21
|
const _ux = require("../../lib/helpers/ux");
|
|
21
|
-
const
|
|
22
|
+
const _workflow = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/workflow"));
|
|
22
23
|
function _define_property(obj, key, value) {
|
|
23
24
|
if (key in obj) {
|
|
24
25
|
Object.defineProperty(obj, key, {
|
|
@@ -82,17 +83,17 @@ class WorkflowGenerateTypes extends _basecommand.default {
|
|
|
82
83
|
async run() {
|
|
83
84
|
const { flags } = this.props;
|
|
84
85
|
const fileExtension = flags["output-file"].abspath.split(".").pop();
|
|
85
|
-
const targetLanguage = (0,
|
|
86
|
+
const targetLanguage = (0, _typegen.getLanguageFromExtension)(fileExtension);
|
|
86
87
|
if (!targetLanguage) {
|
|
87
88
|
this.error(new _error.ApiError(`Unsupported file extension: ${fileExtension}. We currently support .ts, .rb, .go, .py files only.`));
|
|
88
89
|
}
|
|
89
90
|
_ux.spinner.start(`‣ Loading workflows`);
|
|
90
|
-
// 1. List all workflows in the
|
|
91
|
+
// 1. List all workflows in the target environment.
|
|
91
92
|
const workflows = await this.listAllWorkflows();
|
|
92
93
|
_ux.spinner.stop();
|
|
93
94
|
// 2. Generate types for all workflows.
|
|
94
95
|
_ux.spinner.start(`‣ Generating types`);
|
|
95
|
-
const { result, workflows: workflowsWithValidTypes } = await
|
|
96
|
+
const { result, workflows: workflowsWithValidTypes } = await _workflow.generateWorkflowTypes(workflows, targetLanguage);
|
|
96
97
|
_ux.spinner.stop();
|
|
97
98
|
if (!result) {
|
|
98
99
|
this.log(`‣ No workflows with valid trigger data JSON schema found, skipping type generation`);
|
|
@@ -125,7 +126,7 @@ class WorkflowGenerateTypes extends _basecommand.default {
|
|
|
125
126
|
}, workflows) : workflows;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
|
-
_define_property(WorkflowGenerateTypes, "description", "Generate types for all workflows in
|
|
129
|
+
_define_property(WorkflowGenerateTypes, "description", "Generate types for all workflows in an environment and write them to a file.");
|
|
129
130
|
_define_property(WorkflowGenerateTypes, "flags", {
|
|
130
131
|
environment: _core.Flags.string({
|
|
131
132
|
summary: "Select the environment to generate types for.",
|
package/dist/lib/api-v1.js
CHANGED
|
@@ -113,6 +113,8 @@ class ApiV1 {
|
|
|
113
113
|
const params = (0, _objectisomorphic.prune)({
|
|
114
114
|
environment: flags.environment,
|
|
115
115
|
promoted: flags.promoted,
|
|
116
|
+
resource_type: flags["resource-type"],
|
|
117
|
+
resource_id: flags["resource-id"],
|
|
116
118
|
...(0, _page.toPageParams)(flags)
|
|
117
119
|
});
|
|
118
120
|
return this.get("/commits", {
|
|
@@ -333,6 +335,65 @@ class ApiV1 {
|
|
|
333
335
|
params
|
|
334
336
|
});
|
|
335
337
|
}
|
|
338
|
+
// By resources: Guides
|
|
339
|
+
async listGuides({ flags }) {
|
|
340
|
+
const params = (0, _objectisomorphic.prune)({
|
|
341
|
+
environment: flags.environment,
|
|
342
|
+
annotate: flags.annotate,
|
|
343
|
+
hide_uncommitted_changes: flags["hide-uncommitted-changes"],
|
|
344
|
+
include_json_schema: flags["include-json-schema"],
|
|
345
|
+
...(0, _page.toPageParams)(flags)
|
|
346
|
+
});
|
|
347
|
+
return this.get("/guides", {
|
|
348
|
+
params
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
async getGuide({ args, flags }) {
|
|
352
|
+
const params = (0, _objectisomorphic.prune)({
|
|
353
|
+
environment: flags.environment,
|
|
354
|
+
annotate: flags.annotate,
|
|
355
|
+
hide_uncommitted_changes: flags["hide-uncommitted-changes"]
|
|
356
|
+
});
|
|
357
|
+
return this.get(`/guides/${args.guideKey}`, {
|
|
358
|
+
params
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
async validateGuide({ flags }, guide) {
|
|
362
|
+
const params = (0, _objectisomorphic.prune)({
|
|
363
|
+
environment: flags.environment
|
|
364
|
+
});
|
|
365
|
+
const data = {
|
|
366
|
+
guide
|
|
367
|
+
};
|
|
368
|
+
return this.put(`/guides/${guide.key}/validate`, data, {
|
|
369
|
+
params
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
async upsertGuide({ flags }, guide) {
|
|
373
|
+
const params = (0, _objectisomorphic.prune)({
|
|
374
|
+
environment: flags.environment,
|
|
375
|
+
annotate: flags.annotate,
|
|
376
|
+
commit: flags.commit,
|
|
377
|
+
commit_message: flags["commit-message"]
|
|
378
|
+
});
|
|
379
|
+
const data = {
|
|
380
|
+
guide
|
|
381
|
+
};
|
|
382
|
+
return this.put(`/guides/${guide.key}`, data, {
|
|
383
|
+
params
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
async activateGuide({ args, flags }) {
|
|
387
|
+
const params = (0, _objectisomorphic.prune)({
|
|
388
|
+
environment: flags.environment,
|
|
389
|
+
status: flags.status,
|
|
390
|
+
from: flags.from,
|
|
391
|
+
until: flags.until
|
|
392
|
+
});
|
|
393
|
+
return this.put(`/guides/${args.guideKey}/activate`, {}, {
|
|
394
|
+
params
|
|
395
|
+
});
|
|
396
|
+
}
|
|
336
397
|
// By methods:
|
|
337
398
|
async get(subpath, config) {
|
|
338
399
|
return this.client.get(`/${API_VERSION}` + subpath, config);
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
KnockEnv
|
|
12
|
+
get KnockEnv () {
|
|
13
13
|
return KnockEnv;
|
|
14
14
|
},
|
|
15
|
-
isTestEnv
|
|
15
|
+
get isTestEnv () {
|
|
16
16
|
return isTestEnv;
|
|
17
17
|
},
|
|
18
|
-
sandboxDir
|
|
18
|
+
get sandboxDir () {
|
|
19
19
|
return sandboxDir;
|
|
20
20
|
}
|
|
21
21
|
});
|
package/dist/lib/helpers/date.js
CHANGED
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
formatDate
|
|
12
|
+
get formatDate () {
|
|
13
13
|
return formatDate;
|
|
14
14
|
},
|
|
15
|
-
formatDateTime
|
|
15
|
+
get formatDateTime () {
|
|
16
16
|
return formatDateTime;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -5,29 +5,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ApiError
|
|
12
|
+
get ApiError () {
|
|
13
13
|
return ApiError;
|
|
14
14
|
},
|
|
15
|
-
JsonDataError
|
|
15
|
+
get JsonDataError () {
|
|
16
16
|
return JsonDataError;
|
|
17
17
|
},
|
|
18
|
-
JsonSyntaxError
|
|
18
|
+
get JsonSyntaxError () {
|
|
19
19
|
return JsonSyntaxError;
|
|
20
20
|
},
|
|
21
|
-
LiquidParseError
|
|
21
|
+
get LiquidParseError () {
|
|
22
22
|
return LiquidParseError;
|
|
23
23
|
},
|
|
24
|
-
SourceError
|
|
24
|
+
get SourceError () {
|
|
25
25
|
return SourceError;
|
|
26
26
|
},
|
|
27
|
-
formatError
|
|
27
|
+
get formatError () {
|
|
28
28
|
return formatError;
|
|
29
29
|
},
|
|
30
|
-
formatErrors
|
|
30
|
+
get formatErrors () {
|
|
31
31
|
return formatErrors;
|
|
32
32
|
}
|
|
33
33
|
});
|
package/dist/lib/helpers/flag.js
CHANGED
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
booleanStr
|
|
12
|
+
get booleanStr () {
|
|
13
13
|
return booleanStr;
|
|
14
14
|
},
|
|
15
|
-
dirPath
|
|
15
|
+
get dirPath () {
|
|
16
16
|
return dirPath;
|
|
17
17
|
},
|
|
18
|
-
filePath
|
|
18
|
+
get filePath () {
|
|
19
19
|
return filePath;
|
|
20
20
|
},
|
|
21
|
-
jsonStr
|
|
21
|
+
get jsonStr () {
|
|
22
22
|
return jsonStr;
|
|
23
23
|
},
|
|
24
|
-
maybeJsonStr
|
|
24
|
+
get maybeJsonStr () {
|
|
25
25
|
return maybeJsonStr;
|
|
26
26
|
},
|
|
27
|
-
maybeJsonStrAsList
|
|
27
|
+
get maybeJsonStrAsList () {
|
|
28
28
|
return maybeJsonStrAsList;
|
|
29
29
|
}
|
|
30
30
|
});
|
package/dist/lib/helpers/json.js
CHANGED
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
DOUBLE_SPACES
|
|
12
|
+
get DOUBLE_SPACES () {
|
|
13
13
|
return DOUBLE_SPACES;
|
|
14
14
|
},
|
|
15
|
-
parseJson
|
|
15
|
+
get parseJson () {
|
|
16
16
|
return parseJson;
|
|
17
17
|
},
|
|
18
|
-
readJson
|
|
18
|
+
get readJson () {
|
|
19
19
|
return readJson;
|
|
20
20
|
},
|
|
21
|
-
tryJsonParse
|
|
21
|
+
get tryJsonParse () {
|
|
22
22
|
return tryJsonParse;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -12,29 +12,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
12
12
|
function _export(target, all) {
|
|
13
13
|
for(var name in all)Object.defineProperty(target, name, {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: all
|
|
15
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
_export(exports, {
|
|
19
|
-
ObjPath
|
|
19
|
+
get ObjPath () {
|
|
20
20
|
return ObjPath;
|
|
21
21
|
},
|
|
22
|
-
getLastFound
|
|
22
|
+
get getLastFound () {
|
|
23
23
|
return getLastFound;
|
|
24
24
|
},
|
|
25
|
-
mapValuesDeep
|
|
25
|
+
get mapValuesDeep () {
|
|
26
26
|
return mapValuesDeep;
|
|
27
27
|
},
|
|
28
|
-
merge
|
|
28
|
+
get merge () {
|
|
29
29
|
return merge;
|
|
30
30
|
},
|
|
31
|
-
omitDeep
|
|
31
|
+
get omitDeep () {
|
|
32
32
|
return omitDeep;
|
|
33
33
|
},
|
|
34
|
-
prune
|
|
34
|
+
get prune () {
|
|
35
35
|
return prune;
|
|
36
36
|
},
|
|
37
|
-
split
|
|
37
|
+
get split () {
|
|
38
38
|
return split;
|
|
39
39
|
}
|
|
40
40
|
});
|
package/dist/lib/helpers/page.js
CHANGED
|
@@ -5,32 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
MAX_PAGINATION_LIMIT
|
|
12
|
+
get MAX_PAGINATION_LIMIT () {
|
|
13
13
|
return MAX_PAGINATION_LIMIT;
|
|
14
14
|
},
|
|
15
|
-
PageAction
|
|
15
|
+
get PageAction () {
|
|
16
16
|
return PageAction;
|
|
17
17
|
},
|
|
18
|
-
formatPageActionPrompt
|
|
18
|
+
get formatPageActionPrompt () {
|
|
19
19
|
return formatPageActionPrompt;
|
|
20
20
|
},
|
|
21
|
-
maybePromptPageAction
|
|
21
|
+
get maybePromptPageAction () {
|
|
22
22
|
return maybePromptPageAction;
|
|
23
23
|
},
|
|
24
|
-
pageFlags
|
|
24
|
+
get pageFlags () {
|
|
25
25
|
return pageFlags;
|
|
26
26
|
},
|
|
27
|
-
paramsForPageAction
|
|
27
|
+
get paramsForPageAction () {
|
|
28
28
|
return paramsForPageAction;
|
|
29
29
|
},
|
|
30
|
-
toPageParams
|
|
30
|
+
get toPageParams () {
|
|
31
31
|
return toPageParams;
|
|
32
32
|
},
|
|
33
|
-
validatePageActionInput
|
|
33
|
+
get validatePageActionInput () {
|
|
34
34
|
return validatePageActionInput;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
formatErrorRespMessage
|
|
12
|
+
get formatErrorRespMessage () {
|
|
13
13
|
return formatErrorRespMessage;
|
|
14
14
|
},
|
|
15
|
-
isSuccessResp
|
|
15
|
+
get isSuccessResp () {
|
|
16
16
|
return isSuccessResp;
|
|
17
17
|
},
|
|
18
|
-
withSpinner
|
|
18
|
+
get withSpinner () {
|
|
19
19
|
return withSpinner;
|
|
20
20
|
}
|
|
21
21
|
});
|