@knocklabs/cli 0.1.0-rc.0

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.
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ApiError: ()=>ApiError,
13
+ JsonError: ()=>JsonError,
14
+ formatErrors: ()=>formatErrors
15
+ });
16
+ const _string = require("./string");
17
+ // Extends the built-in Error class while maintaining a prototype chain, to
18
+ // provide a base class for creating custom error classes.
19
+ // Reference: https://stackoverflow.com/a/58417721/3479934
20
+ class CustomError extends Error {
21
+ constructor(message){
22
+ // Error breaks the prototype chain here.
23
+ super(message);
24
+ // Restore the prototype chain.
25
+ Object.setPrototypeOf(this, new.target.prototype);
26
+ this.name = new.target.name;
27
+ }
28
+ }
29
+ class ApiError extends CustomError {
30
+ }
31
+ class JsonError extends CustomError {
32
+ constructor(message, path){
33
+ super(message);
34
+ this.path = path;
35
+ }
36
+ }
37
+ /*
38
+ * Returns a formatted error message string from a single error instance.
39
+ *
40
+ * Note, primarily used to print out multiple errors below. When only need to
41
+ * surface a single error, the oclif error helper takes an error instance.
42
+ */ const formatError = (error)=>{
43
+ switch(true){
44
+ case error instanceof ApiError:
45
+ case error instanceof SyntaxError:
46
+ return `${error.name}: ${error.message}`;
47
+ case error instanceof JsonError:
48
+ {
49
+ const e = error;
50
+ return e.path === "" ? `${e.name}: ${e.message}` : `${e.name}: data at "${e.path}" ${e.message}`;
51
+ }
52
+ default:
53
+ throw new Error(`Unhandled error type: ${error}`);
54
+ }
55
+ };
56
+ const formatErrors = (errors, opts = {})=>{
57
+ const { joinBy ="\n\n" , indentBy =0 } = opts;
58
+ const formatted = errors.map((e)=>formatError(e)).join(joinBy);
59
+ return (0, _string.indentString)(formatted, indentBy);
60
+ };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ DOUBLE_SPACES: ()=>DOUBLE_SPACES,
13
+ readJson: ()=>readJson
14
+ });
15
+ const _jsonlint = /*#__PURE__*/ _interopRequireWildcard(require("@prantlf/jsonlint"));
16
+ const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
17
+ function _getRequireWildcardCache(nodeInterop) {
18
+ if (typeof WeakMap !== "function") return null;
19
+ var cacheBabelInterop = new WeakMap();
20
+ var cacheNodeInterop = new WeakMap();
21
+ return (_getRequireWildcardCache = function(nodeInterop) {
22
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
23
+ })(nodeInterop);
24
+ }
25
+ function _interopRequireWildcard(obj, nodeInterop) {
26
+ if (!nodeInterop && obj && obj.__esModule) {
27
+ return obj;
28
+ }
29
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
30
+ return {
31
+ default: obj
32
+ };
33
+ }
34
+ var cache = _getRequireWildcardCache(nodeInterop);
35
+ if (cache && cache.has(obj)) {
36
+ return cache.get(obj);
37
+ }
38
+ var newObj = {};
39
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
+ for(var key in obj){
41
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
42
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
43
+ if (desc && (desc.get || desc.set)) {
44
+ Object.defineProperty(newObj, key, desc);
45
+ } else {
46
+ newObj[key] = obj[key];
47
+ }
48
+ }
49
+ }
50
+ newObj.default = obj;
51
+ if (cache) {
52
+ cache.set(obj, newObj);
53
+ }
54
+ return newObj;
55
+ }
56
+ const DOUBLE_SPACES = " ";
57
+ const readJson = async (filePath)=>{
58
+ const json = await _fsExtra.readFile(filePath, "utf8");
59
+ let payload;
60
+ const errors = [];
61
+ try {
62
+ payload = _jsonlint.parse(json);
63
+ } catch (error) {
64
+ // https://github.com/prantlf/jsonlint#error-handling
65
+ if (!(error instanceof SyntaxError)) throw error;
66
+ errors.push(error);
67
+ }
68
+ return [
69
+ payload,
70
+ errors
71
+ ];
72
+ };
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ split: ()=>split,
13
+ omitDeep: ()=>omitDeep,
14
+ prune: ()=>prune,
15
+ merge: ()=>merge,
16
+ ObjPath: ()=>ObjPath
17
+ });
18
+ const _lodash = require("lodash");
19
+ const split = (obj, paths)=>{
20
+ const picked = (0, _lodash.pick)(obj, paths);
21
+ const remainder = (0, _lodash.omit)(obj, paths);
22
+ return [
23
+ picked,
24
+ remainder
25
+ ];
26
+ };
27
+ const omitDeep = (input, paths)=>{
28
+ const omitDeepOnOwnProps = (item)=>{
29
+ if (Array.isArray(item)) {
30
+ return item.map((i)=>omitDeepOnOwnProps(i));
31
+ }
32
+ if ((0, _lodash.isPlainObject)(item)) {
33
+ const obj = (0, _lodash.omit)(item, paths);
34
+ for (const [k, v] of Object.entries(obj)){
35
+ obj[k] = omitDeep(v, paths);
36
+ }
37
+ return obj;
38
+ }
39
+ return item;
40
+ };
41
+ return Array.isArray(input) ? input.map((i)=>omitDeepOnOwnProps(i)) : omitDeepOnOwnProps(input);
42
+ };
43
+ const prune = (obj)=>(0, _lodash.omitBy)(obj, _lodash.isNil);
44
+ const merge = (obj, ...sources)=>(0, _lodash.merge)({}, obj, ...sources);
45
+ class ObjPath {
46
+ // Pushes a new path part to its inner state, moving down into an obj tree.
47
+ push(part) {
48
+ this.parts = [
49
+ ...this.parts,
50
+ part
51
+ ];
52
+ return this;
53
+ }
54
+ // Pops the last path part from its inner state, moving up in an obj tree.
55
+ pop() {
56
+ this.parts = this.parts.slice(0, -1);
57
+ return this;
58
+ }
59
+ // Resets its inner parts state to the given path parts.
60
+ reset(parts) {
61
+ this.parts = [
62
+ ...parts
63
+ ];
64
+ return this;
65
+ }
66
+ // Returns the current state in a NEW array, mainly used to bookmark a certain
67
+ // point in the path so we can reset to.
68
+ checkout() {
69
+ return [
70
+ ...this.parts
71
+ ];
72
+ }
73
+ // Takes one or multiple path parts, then returns a single purpose object with
74
+ // a `str` lambda method that's hardcoded to format a path string based on the
75
+ // latest parts state plus given parts. Useful when formatting a path string
76
+ // looking ahead without pushing/popping.
77
+ to(forward) {
78
+ const temp = Array.isArray(forward) ? forward : [
79
+ forward
80
+ ];
81
+ const parts = [
82
+ ...this.parts,
83
+ ...temp
84
+ ];
85
+ return {
86
+ get str () {
87
+ return ObjPath.stringify(parts);
88
+ }
89
+ };
90
+ }
91
+ // Getter method that calls stringify on its current path parts state, to
92
+ // return the formatted object path.
93
+ get str() {
94
+ return ObjPath.stringify(this.parts);
95
+ }
96
+ // Takes an array of path parts, then returns a json path notation string,
97
+ // useful in displaying a helpful reference to users in error messages as well
98
+ // as reading/updating objects (e.g. via the lodash get or set method).
99
+ static stringify(parts) {
100
+ return parts.map((part, idx)=>{
101
+ if (typeof part === "string") return idx === 0 ? part : `.${part}`;
102
+ if (typeof part === "number") return `[${part}]`;
103
+ throw new Error(`Unhandled path part type: ${part}`);
104
+ }).join("");
105
+ }
106
+ constructor(parts = []){
107
+ this.parts = [
108
+ ...parts
109
+ ];
110
+ }
111
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ PageAction: ()=>PageAction,
13
+ pageFlags: ()=>pageFlags,
14
+ toPageParams: ()=>toPageParams,
15
+ maybePromptPageAction: ()=>maybePromptPageAction,
16
+ paramsForPageAction: ()=>paramsForPageAction,
17
+ formatPageActionPrompt: ()=>formatPageActionPrompt,
18
+ validatePageActionInput: ()=>validatePageActionInput
19
+ });
20
+ const _core = require("@oclif/core");
21
+ const _enquirer = /*#__PURE__*/ _interopRequireDefault(require("enquirer"));
22
+ const _lodash = require("lodash");
23
+ function _interopRequireDefault(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
+ };
27
+ }
28
+ const pageFlags = {
29
+ after: _core.Flags.string(),
30
+ before: _core.Flags.string(),
31
+ limit: _core.Flags.integer({
32
+ max: 100
33
+ })
34
+ };
35
+ const toPageParams = (flags)=>{
36
+ return (0, _lodash.pick)(flags, Object.keys(pageFlags));
37
+ };
38
+ var PageAction;
39
+ (function(PageAction) {
40
+ PageAction["Previous"] = "p";
41
+ PageAction["Next"] = "n";
42
+ })(PageAction || (PageAction = {}));
43
+ /*
44
+ * Format a prompt text to show available page actions.
45
+ * e.g. [p: preview, n: next]
46
+ */ const formatPageActionPrompt = (pageInfo)=>{
47
+ const options = [
48
+ pageInfo.before && `${PageAction.Previous}: previous page`,
49
+ pageInfo.after && `${PageAction.Next}: next page`
50
+ ].filter((x)=>x);
51
+ return options.length > 0 ? `[${options.join(", ")}]` : undefined;
52
+ };
53
+ /*
54
+ * Validate a prompt input for a page action based on available options and
55
+ * return if valid.
56
+ */ const validatePageActionInput = (input, pageInfo)=>{
57
+ const val = input.toLowerCase().trim();
58
+ if (pageInfo.after && val === PageAction.Next) {
59
+ return PageAction.Next;
60
+ }
61
+ if (pageInfo.before && val === PageAction.Previous) {
62
+ return PageAction.Previous;
63
+ }
64
+ };
65
+ const maybePromptPageAction = async (pageInfo)=>{
66
+ const message = formatPageActionPrompt(pageInfo);
67
+ if (!message) return;
68
+ try {
69
+ const answer = await _enquirer.default.prompt({
70
+ type: "input",
71
+ name: "input",
72
+ message
73
+ });
74
+ return validatePageActionInput(answer.input, pageInfo);
75
+ } catch (error) {
76
+ console.log(error);
77
+ return undefined;
78
+ }
79
+ };
80
+ const paramsForPageAction = (pageAction, pageInfo)=>{
81
+ switch(pageAction){
82
+ case PageAction.Previous:
83
+ return {
84
+ before: pageInfo.before
85
+ };
86
+ case PageAction.Next:
87
+ return {
88
+ after: pageInfo.after
89
+ };
90
+ default:
91
+ }
92
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "withSpinner", {
6
+ enumerable: true,
7
+ get: ()=>withSpinner
8
+ });
9
+ const _core = require("@oclif/core");
10
+ const _env = require("./env");
11
+ const _error = require("./error");
12
+ const isSuccessResp = (resp)=>resp.status >= 200 && resp.status < 300;
13
+ /*
14
+ * Returns a formatted error message from an error response based on status code.
15
+ */ const formatErrorRespMessage = ({ status , data })=>{
16
+ if (status === 500) {
17
+ return "An internal server error occurred";
18
+ }
19
+ const { message , errors =[] } = data;
20
+ if (status >= 400) {
21
+ const errs = errors.map((e)=>new _error.JsonError(e.message, e.field));
22
+ return errs.length === 0 ? message : message + "\n\n" + (0, _error.formatErrors)(errs);
23
+ }
24
+ return message;
25
+ };
26
+ const withSpinner = async (requestFn, opts = {})=>{
27
+ const { action ="‣ Loading" , ensureSuccess =true } = opts;
28
+ // Suppress printing the spinner in tests, oclif doesn't for some reasons.
29
+ if (!_env.isTestEnv) _core.CliUx.ux.action.start(action);
30
+ const resp = await requestFn();
31
+ // Error out before the action stop so the spinner can update accordingly.
32
+ if (ensureSuccess && !isSuccessResp(resp)) {
33
+ const message = formatErrorRespMessage(resp);
34
+ _core.CliUx.ux.error(new _error.ApiError(message));
35
+ }
36
+ _core.CliUx.ux.action.stop();
37
+ return resp;
38
+ };
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Indent each line in a string, useful when printing out nested errors.
3
+ *
4
+ * NOTE: Copied over from https://github.com/sindresorhus/indent-string for now,
5
+ * because getting an "[ERR_REQUIRE_ESM]: Must use import to load ES Module"
6
+ * error when pulling in the package.
7
+ */ "use strict";
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ Object.defineProperty(exports, "indentString", {
12
+ enumerable: true,
13
+ get: ()=>indentString
14
+ });
15
+ const indentString = (string, count = 0, options = {})=>{
16
+ const { indent =" " , includeEmptyLines =false } = options;
17
+ if (typeof string !== "string") {
18
+ throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof string}\``);
19
+ }
20
+ if (typeof count !== "number") {
21
+ throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof count}\``);
22
+ }
23
+ if (count < 0) {
24
+ throw new RangeError(`Expected \`count\` to be at least 0, got \`${count}\``);
25
+ }
26
+ if (typeof indent !== "string") {
27
+ throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``);
28
+ }
29
+ if (count === 0) {
30
+ return string;
31
+ }
32
+ const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
33
+ return string.replace(regex, indent.repeat(count));
34
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "formatConditions", {
6
+ enumerable: true,
7
+ get: ()=>formatConditions
8
+ });
9
+ 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 , all })=>{
11
+ if (any) return formatConditionsList(any, "or");
12
+ if (all) return formatConditionsList(all, "and");
13
+ throw new Error(`Invalid nested conditions: ${nestedConds}`);
14
+ }).join(`\n ${joinedBy.toUpperCase()}\n`) + appendedBy;
15
+ const formatConditions = (conditions)=>{
16
+ const { any , all } = conditions;
17
+ if (any) {
18
+ const [condition] = any;
19
+ return "variable" in condition ? formatConditionsList(any, "or", "\n") : formatNestedConditions(any, "or", "\n");
20
+ }
21
+ if (all) {
22
+ const [condition] = all;
23
+ return "variable" in condition ? formatConditionsList(all, "and", "\n") : formatNestedConditions(all, "and", "\n");
24
+ }
25
+ throw new Error(`Invalid conditions: ${conditions}`);
26
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _exportStar(require("./helpers"), exports);
6
+ _exportStar(require("./types"), exports);
7
+ function _exportStar(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ });
16
+ return from;
17
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ WORKFLOW_JSON: ()=>WORKFLOW_JSON,
13
+ FILEPATH_MARKER: ()=>FILEPATH_MARKER,
14
+ FILEPATH_MARKED_RE: ()=>FILEPATH_MARKED_RE,
15
+ lsWorkflowJson: ()=>lsWorkflowJson,
16
+ isWorkflowDir: ()=>isWorkflowDir,
17
+ formatCategories: ()=>formatCategories,
18
+ formatStepSummary: ()=>formatStepSummary,
19
+ formatStatus: ()=>formatStatus
20
+ });
21
+ const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
22
+ const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
23
+ const _lodash = require("lodash");
24
+ const _types = require("./types");
25
+ function _getRequireWildcardCache(nodeInterop) {
26
+ if (typeof WeakMap !== "function") return null;
27
+ var cacheBabelInterop = new WeakMap();
28
+ var cacheNodeInterop = new WeakMap();
29
+ return (_getRequireWildcardCache = function(nodeInterop) {
30
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
31
+ })(nodeInterop);
32
+ }
33
+ function _interopRequireWildcard(obj, nodeInterop) {
34
+ if (!nodeInterop && obj && obj.__esModule) {
35
+ return obj;
36
+ }
37
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
38
+ return {
39
+ default: obj
40
+ };
41
+ }
42
+ var cache = _getRequireWildcardCache(nodeInterop);
43
+ if (cache && cache.has(obj)) {
44
+ return cache.get(obj);
45
+ }
46
+ var newObj = {};
47
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
+ for(var key in obj){
49
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
50
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
51
+ if (desc && (desc.get || desc.set)) {
52
+ Object.defineProperty(newObj, key, desc);
53
+ } else {
54
+ newObj[key] = obj[key];
55
+ }
56
+ }
57
+ }
58
+ newObj.default = obj;
59
+ if (cache) {
60
+ cache.set(obj, newObj);
61
+ }
62
+ return newObj;
63
+ }
64
+ const WORKFLOW_JSON = "workflow.json";
65
+ const FILEPATH_MARKER = "@";
66
+ const FILEPATH_MARKED_RE = new RegExp(`${FILEPATH_MARKER}$`);
67
+ const lsWorkflowJson = async (dirPath)=>{
68
+ const workflowJsonPath = _nodePath.join(dirPath, WORKFLOW_JSON);
69
+ const exists = await _fsExtra.pathExists(workflowJsonPath);
70
+ return exists ? workflowJsonPath : undefined;
71
+ };
72
+ const isWorkflowDir = async (dirPath)=>Boolean(await lsWorkflowJson(dirPath));
73
+ const formatCategories = (workflow, opts = {})=>{
74
+ const { categories } = workflow;
75
+ const { truncateAfter: limit , emptyDisplay ="" } = opts;
76
+ if (!categories) return emptyDisplay;
77
+ const count = categories.length;
78
+ if (!limit || limit >= count) return categories.join(", ");
79
+ return (0, _lodash.take)(categories, limit).join(", ") + ` (+ ${count - limit} more)`;
80
+ };
81
+ /*
82
+ * Returns a formatted string of workflow steps.
83
+ */ const channelStepSummaryLines = (step)=>{
84
+ if (step.type !== _types.StepType.Channel) return [];
85
+ const { channel_key , channel_group_key } = step;
86
+ return [
87
+ channel_key && `Channel: ${channel_key}`,
88
+ channel_group_key && `Channel group: ${channel_group_key}`
89
+ ].filter((x)=>x);
90
+ };
91
+ const batchStepSummaryLines = (step)=>{
92
+ if (step.type !== _types.StepType.Batch) return [];
93
+ const { batch_key , batch_window: duration , batch_until_field_path: field_path , batch_order } = step.settings;
94
+ return [
95
+ batch_key && `Batch key: ${batch_key}`,
96
+ duration && `Batch window: ${duration.value} ${duration.unit}`,
97
+ field_path && `Batch window: "${field_path}"`,
98
+ `Batch order: ${batch_order}`
99
+ ];
100
+ };
101
+ const delayStepSummaryLines = (step)=>{
102
+ if (step.type !== _types.StepType.Delay) return [];
103
+ const { delay_for: duration , delay_until_field_path: field_path } = step.settings;
104
+ return [
105
+ duration && `Delay duration: ${duration.value} ${duration.unit}`,
106
+ field_path && `Delay duration: "${field_path}"`
107
+ ];
108
+ };
109
+ const httpFetchStepSummaryLines = (step)=>{
110
+ if (step.type !== _types.StepType.HttpFetch) return [];
111
+ const { method , url , headers , query_params , body } = step.settings;
112
+ const reqHeaders = (headers || []).map((h)=>`${h.key}: ${h.value}`);
113
+ const params = (query_params || []).map((p)=>`${p.key}: ${p.value}`);
114
+ return [
115
+ `Method: ${method.toUpperCase()}`,
116
+ `URL: ${url}`,
117
+ reqHeaders.length > 0 && `Headers: \n ${reqHeaders.join("\n ")}`,
118
+ params.length > 0 && `Params: \n ${params.join("\n ")}`,
119
+ body && `Body: \n${body}`
120
+ ];
121
+ };
122
+ const formatStepSummary = (step)=>{
123
+ const lines = [
124
+ // Common step attributes.
125
+ step.name && `Name: ${step.name}`,
126
+ step.description && `Description: ${step.description}`,
127
+ // Step type specific attributes.
128
+ ...channelStepSummaryLines(step),
129
+ ...batchStepSummaryLines(step),
130
+ ...delayStepSummaryLines(step),
131
+ ...httpFetchStepSummaryLines(step),
132
+ // Extra line between step rows to make it easier on the eye.
133
+ " "
134
+ ].filter((x)=>x);
135
+ return lines.join("\n");
136
+ };
137
+ const formatStatus = (workflow)=>{
138
+ return workflow.active ? "active" : "inactive";
139
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _exportStar(require("./helpers"), exports);
6
+ _exportStar(require("./reader"), exports);
7
+ _exportStar(require("./types"), exports);
8
+ _exportStar(require("./writer"), exports);
9
+ function _exportStar(from, to) {
10
+ Object.keys(from).forEach(function(k) {
11
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
12
+ enumerable: true,
13
+ get: function() {
14
+ return from[k];
15
+ }
16
+ });
17
+ });
18
+ return from;
19
+ }