@knocklabs/cli 0.1.10 → 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.
Files changed (90) hide show
  1. package/README.md +68 -531
  2. package/bin/dev.js +6 -0
  3. package/bin/run.js +7 -0
  4. package/dist/{commands → src/commands}/commit/get.js +24 -9
  5. package/dist/{commands → src/commands}/commit/index.js +23 -8
  6. package/dist/{commands → src/commands}/commit/list.js +29 -14
  7. package/dist/{commands → src/commands}/commit/promote.js +26 -11
  8. package/dist/{commands → src/commands}/knock.js +21 -6
  9. package/dist/{commands → src/commands}/layout/get.js +28 -13
  10. package/dist/{commands → src/commands}/layout/list.js +29 -14
  11. package/dist/{commands → src/commands}/layout/pull.js +47 -30
  12. package/dist/{commands → src/commands}/layout/push.js +38 -21
  13. package/dist/{commands → src/commands}/layout/validate.js +33 -16
  14. package/dist/src/commands/ping.js +37 -0
  15. package/dist/{commands → src/commands}/translation/get.js +33 -16
  16. package/dist/{commands → src/commands}/translation/list.js +34 -17
  17. package/dist/{commands → src/commands}/translation/pull.js +36 -19
  18. package/dist/{commands → src/commands}/translation/push.js +33 -15
  19. package/dist/{commands → src/commands}/translation/validate.js +30 -13
  20. package/dist/{commands → src/commands}/whoami.js +22 -7
  21. package/dist/{commands → src/commands}/workflow/activate.js +27 -12
  22. package/dist/{commands → src/commands}/workflow/get.js +35 -18
  23. package/dist/{commands → src/commands}/workflow/list.js +34 -17
  24. package/dist/{commands → src/commands}/workflow/new.js +37 -20
  25. package/dist/{commands → src/commands}/workflow/pull.js +44 -27
  26. package/dist/{commands → src/commands}/workflow/push.js +34 -17
  27. package/dist/{commands → src/commands}/workflow/run.js +25 -10
  28. package/dist/{commands → src/commands}/workflow/validate.js +30 -13
  29. package/dist/{index.js → src/index.js} +3 -1
  30. package/dist/{isomorphic.js → src/isomorphic.js} +8 -4
  31. package/dist/{lib → src/lib}/api-v1.js +57 -41
  32. package/dist/{lib → src/lib}/base-command.js +38 -15
  33. package/dist/{lib → src/lib}/helpers/const.js +18 -10
  34. package/dist/{lib → src/lib}/helpers/date.js +9 -5
  35. package/dist/{lib → src/lib}/helpers/error.js +42 -8
  36. package/dist/{lib → src/lib}/helpers/flag.js +24 -12
  37. package/dist/{lib → src/lib}/helpers/fs.js +10 -6
  38. package/dist/{lib → src/lib}/helpers/json.js +19 -9
  39. package/dist/{lib → src/lib}/helpers/liquid.js +3 -1
  40. package/dist/{lib → src/lib}/helpers/object.isomorphic.js +35 -7
  41. package/dist/{lib → src/lib}/helpers/page.js +34 -18
  42. package/dist/{lib → src/lib}/helpers/request.js +12 -6
  43. package/dist/{lib → src/lib}/helpers/string.js +8 -4
  44. package/dist/{lib → src/lib}/helpers/ux.js +9 -5
  45. package/dist/{lib → src/lib}/marshal/commit/helpers.js +3 -1
  46. package/dist/src/lib/marshal/commit/index.js +19 -0
  47. package/dist/{lib → src/lib}/marshal/conditions/helpers.js +5 -3
  48. package/dist/src/lib/marshal/conditions/index.js +19 -0
  49. package/dist/{lib → src/lib}/marshal/email-layout/helpers.js +25 -15
  50. package/dist/src/lib/marshal/email-layout/index.js +22 -0
  51. package/dist/{lib → src/lib}/marshal/email-layout/processor.isomorphic.js +17 -11
  52. package/dist/{lib → src/lib}/marshal/email-layout/reader.js +29 -23
  53. package/dist/{lib → src/lib}/marshal/email-layout/writer.js +38 -30
  54. package/dist/src/lib/marshal/index.isomorphic.js +26 -0
  55. package/dist/{lib → src/lib}/marshal/shared/const.isomorphic.js +6 -2
  56. package/dist/{lib → src/lib}/marshal/shared/helpers.js +22 -14
  57. package/dist/{lib → src/lib}/marshal/translation/helpers.js +52 -30
  58. package/dist/src/lib/marshal/translation/index.js +22 -0
  59. package/dist/{lib → src/lib}/marshal/translation/processor.isomorphic.js +9 -3
  60. package/dist/{lib → src/lib}/marshal/translation/reader.js +14 -10
  61. package/dist/{lib → src/lib}/marshal/translation/writer.js +21 -15
  62. package/dist/{lib → src/lib}/marshal/workflow/generator.js +23 -15
  63. package/dist/{lib → src/lib}/marshal/workflow/helpers.js +47 -27
  64. package/dist/src/lib/marshal/workflow/index.js +23 -0
  65. package/dist/{lib → src/lib}/marshal/workflow/processor.isomorphic.js +35 -23
  66. package/dist/{lib → src/lib}/marshal/workflow/reader.js +30 -24
  67. package/dist/{lib → src/lib}/marshal/workflow/types.js +3 -1
  68. package/dist/{lib → src/lib}/marshal/workflow/writer.js +40 -30
  69. package/dist/{lib → src/lib}/run-context/helpers.js +3 -1
  70. package/dist/src/lib/run-context/index.js +26 -0
  71. package/dist/{lib → src/lib}/run-context/loader.js +17 -13
  72. package/dist/{lib → src/lib}/user-config.js +13 -9
  73. package/oclif.manifest.json +2 -1386
  74. package/package.json +15 -15
  75. package/bin/dev +0 -17
  76. package/bin/run +0 -5
  77. package/dist/commands/ping.js +0 -22
  78. package/dist/lib/marshal/commit/index.js +0 -17
  79. package/dist/lib/marshal/conditions/index.js +0 -17
  80. package/dist/lib/marshal/email-layout/index.js +0 -20
  81. package/dist/lib/marshal/index.isomorphic.js +0 -20
  82. package/dist/lib/marshal/translation/index.js +0 -20
  83. package/dist/lib/marshal/workflow/index.js +0 -21
  84. package/dist/lib/run-context/index.js +0 -22
  85. /package/dist/{lib → src/lib}/marshal/commit/types.js +0 -0
  86. /package/dist/{lib → src/lib}/marshal/conditions/types.js +0 -0
  87. /package/dist/{lib → src/lib}/marshal/email-layout/types.js +0 -0
  88. /package/dist/{lib → src/lib}/marshal/shared/types.js +0 -0
  89. /package/dist/{lib → src/lib}/marshal/translation/types.js +0 -0
  90. /package/dist/{lib → src/lib}/run-context/types.js +0 -0
@@ -4,16 +4,31 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>WorkflowList
7
+ get: function() {
8
+ return WorkflowList;
9
+ }
8
10
  });
9
11
  const _core = require("@oclif/core");
10
- const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
12
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
11
13
  const _date = require("../../lib/helpers/date");
12
- const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
14
+ const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
13
15
  const _page = require("../../lib/helpers/page");
14
16
  const _request = require("../../lib/helpers/request");
15
- const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/workflow"));
16
- function _interopRequireDefault(obj) {
17
+ const _workflow = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/workflow"));
18
+ function _define_property(obj, key, value) {
19
+ if (key in obj) {
20
+ Object.defineProperty(obj, key, {
21
+ value: value,
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true
25
+ });
26
+ } else {
27
+ obj[key] = value;
28
+ }
29
+ return obj;
30
+ }
31
+ function _interop_require_default(obj) {
17
32
  return obj && obj.__esModule ? obj : {
18
33
  default: obj
19
34
  };
@@ -26,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) {
26
41
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
42
  })(nodeInterop);
28
43
  }
29
- function _interopRequireWildcard(obj, nodeInterop) {
44
+ function _interop_require_wildcard(obj, nodeInterop) {
30
45
  if (!nodeInterop && obj && obj.__esModule) {
31
46
  return obj;
32
47
  }
@@ -39,7 +54,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
39
54
  if (cache && cache.has(obj)) {
40
55
  return cache.get(obj);
41
56
  }
42
- var newObj = {};
57
+ var newObj = {
58
+ __proto__: null
59
+ };
43
60
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
61
  for(var key in obj){
45
62
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -57,15 +74,15 @@ function _interopRequireWildcard(obj, nodeInterop) {
57
74
  }
58
75
  return newObj;
59
76
  }
60
- class WorkflowList extends _baseCommand.default {
77
+ class WorkflowList extends _basecommand.default {
61
78
  async run() {
62
79
  const resp = await this.request();
63
- const { flags } = this.props;
80
+ const { flags } = this.props;
64
81
  if (flags.json) return resp.data;
65
82
  this.render(resp.data);
66
83
  }
67
84
  async request(pageParams = {}) {
68
- const props = (0, _objectIsomorphic.merge)(this.props, {
85
+ const props = (0, _objectisomorphic.merge)(this.props, {
69
86
  flags: {
70
87
  ...pageParams
71
88
  }
@@ -73,8 +90,8 @@ class WorkflowList extends _baseCommand.default {
73
90
  return (0, _request.withSpinner)(()=>this.apiV1.listWorkflows(props));
74
91
  }
75
92
  async render(data) {
76
- const { entries } = data;
77
- const { environment: env , "hide-uncommitted-changes": commitedOnly } = this.props.flags;
93
+ const { entries } = data;
94
+ const { environment: env, "hide-uncommitted-changes": commitedOnly } = this.props.flags;
78
95
  const qualifier = env === "development" && !commitedOnly ? "(including uncommitted)" : "";
79
96
  this.log(`‣ Showing ${entries.length} workflows in \`${env}\` environment ${qualifier}\n`);
80
97
  /*
@@ -111,7 +128,7 @@ class WorkflowList extends _baseCommand.default {
111
128
  return this.prompt(data);
112
129
  }
113
130
  async prompt(data) {
114
- const { page_info } = data;
131
+ const { page_info } = data;
115
132
  const pageAction = await (0, _page.maybePromptPageAction)(page_info);
116
133
  const pageParams = pageAction && (0, _page.paramsForPageAction)(pageAction, page_info);
117
134
  if (pageParams) {
@@ -121,8 +138,8 @@ class WorkflowList extends _baseCommand.default {
121
138
  }
122
139
  }
123
140
  }
124
- WorkflowList.summary = "Display all workflows for an environment.";
125
- WorkflowList.flags = {
141
+ _define_property(WorkflowList, "summary", "Display all workflows for an environment.");
142
+ _define_property(WorkflowList, "flags", {
126
143
  environment: _core.Flags.string({
127
144
  default: "development",
128
145
  summary: "The environment to use."
@@ -131,5 +148,5 @@ WorkflowList.flags = {
131
148
  summary: "Hide any uncommitted changes."
132
149
  }),
133
150
  ..._page.pageFlags
134
- };
135
- WorkflowList.enableJsonFlag = true;
151
+ });
152
+ _define_property(WorkflowList, "enableJsonFlag", true);
@@ -4,16 +4,31 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>WorkflowNew
7
+ get: function() {
8
+ return WorkflowNew;
9
+ }
8
10
  });
9
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
11
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
10
12
  const _core = require("@oclif/core");
11
- const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
12
- const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
13
- const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
13
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
14
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
15
+ const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
14
16
  const _ux = require("../../lib/helpers/ux");
15
- const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/workflow"));
16
- function _interopRequireDefault(obj) {
17
+ const _workflow = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/workflow"));
18
+ function _define_property(obj, key, value) {
19
+ if (key in obj) {
20
+ Object.defineProperty(obj, key, {
21
+ value: value,
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true
25
+ });
26
+ } else {
27
+ obj[key] = value;
28
+ }
29
+ return obj;
30
+ }
31
+ function _interop_require_default(obj) {
17
32
  return obj && obj.__esModule ? obj : {
18
33
  default: obj
19
34
  };
@@ -26,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) {
26
41
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
42
  })(nodeInterop);
28
43
  }
29
- function _interopRequireWildcard(obj, nodeInterop) {
44
+ function _interop_require_wildcard(obj, nodeInterop) {
30
45
  if (!nodeInterop && obj && obj.__esModule) {
31
46
  return obj;
32
47
  }
@@ -39,7 +54,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
39
54
  if (cache && cache.has(obj)) {
40
55
  return cache.get(obj);
41
56
  }
42
- var newObj = {};
57
+ var newObj = {
58
+ __proto__: null
59
+ };
43
60
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
61
  for(var key in obj){
45
62
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -57,10 +74,10 @@ function _interopRequireWildcard(obj, nodeInterop) {
57
74
  }
58
75
  return newObj;
59
76
  }
60
- class WorkflowNew extends _baseCommand.default {
77
+ class WorkflowNew extends _basecommand.default {
61
78
  async run() {
62
- const { args , flags } = this.props;
63
- const { cwd , resourceDir } = this.runContext;
79
+ const { args, flags } = this.props;
80
+ const { cwd, resourceDir } = this.runContext;
64
81
  _ux.spinner.start("‣ Validating");
65
82
  // 1. Ensure we aren't in any existing resource directory already.
66
83
  // TODO: In the future, maybe check for the project context and if we are in
@@ -79,8 +96,8 @@ class WorkflowNew extends _baseCommand.default {
79
96
  return this.error(`Invalid --steps \`${flags.steps}\` (${stepsError})`);
80
97
  }
81
98
  // 4. Ensure not to overwrite any existing path accidentally.
82
- const newWorkflowDirPath = _nodePath.resolve(cwd, args.workflowKey);
83
- const pathExists = await _fsExtra.pathExists(newWorkflowDirPath);
99
+ const newWorkflowDirPath = _nodepath.resolve(cwd, args.workflowKey);
100
+ const pathExists = await _fsextra.pathExists(newWorkflowDirPath);
84
101
  if (pathExists && !flags.force) {
85
102
  return this.error(`Cannot overwrite an existing path at ${newWorkflowDirPath}` + " (use --force to overwrite)");
86
103
  }
@@ -106,7 +123,7 @@ class WorkflowNew extends _baseCommand.default {
106
123
  }
107
124
  }
108
125
  async checkExistingWorkflow() {
109
- const props = (0, _objectIsomorphic.merge)(this.props, {
126
+ const props = (0, _objectisomorphic.merge)(this.props, {
110
127
  flags: {
111
128
  environment: "development"
112
129
  }
@@ -117,18 +134,18 @@ class WorkflowNew extends _baseCommand.default {
117
134
  } catch {}
118
135
  }
119
136
  }
120
- WorkflowNew.flags = {
137
+ _define_property(WorkflowNew, "flags", {
121
138
  steps: _core.Flags.string({
122
139
  aliases: [
123
140
  "step"
124
141
  ]
125
142
  }),
126
143
  force: _core.Flags.boolean()
127
- };
128
- WorkflowNew.args = {
144
+ });
145
+ _define_property(WorkflowNew, "args", {
129
146
  workflowKey: _core.Args.string({
130
147
  required: true
131
148
  })
132
- };
149
+ });
133
150
  // TODO(KNO-3072): Unhide after we move the generator logic to the backend.
134
- WorkflowNew.hidden = true;
151
+ _define_property(WorkflowNew, "hidden", true);
@@ -4,20 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>WorkflowPull
7
+ get: function() {
8
+ return WorkflowPull;
9
+ }
8
10
  });
9
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
11
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
10
12
  const _core = require("@oclif/core");
11
- const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
13
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
12
14
  const _error = require("../../lib/helpers/error");
13
- const _flag = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/helpers/flag"));
14
- const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
15
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
16
+ const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
15
17
  const _page = require("../../lib/helpers/page");
16
18
  const _request = require("../../lib/helpers/request");
17
19
  const _ux = require("../../lib/helpers/ux");
18
- const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/workflow"));
19
- const _runContext = require("../../lib/run-context");
20
- function _interopRequireDefault(obj) {
20
+ const _workflow = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/workflow"));
21
+ const _runcontext = require("../../lib/run-context");
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) {
21
36
  return obj && obj.__esModule ? obj : {
22
37
  default: obj
23
38
  };
@@ -30,7 +45,7 @@ function _getRequireWildcardCache(nodeInterop) {
30
45
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
31
46
  })(nodeInterop);
32
47
  }
33
- function _interopRequireWildcard(obj, nodeInterop) {
48
+ function _interop_require_wildcard(obj, nodeInterop) {
34
49
  if (!nodeInterop && obj && obj.__esModule) {
35
50
  return obj;
36
51
  }
@@ -43,7 +58,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
43
58
  if (cache && cache.has(obj)) {
44
59
  return cache.get(obj);
45
60
  }
46
- var newObj = {};
61
+ var newObj = {
62
+ __proto__: null
63
+ };
47
64
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
65
  for(var key in obj){
49
66
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -61,9 +78,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
61
78
  }
62
79
  return newObj;
63
80
  }
64
- class WorkflowPull extends _baseCommand.default {
81
+ class WorkflowPull extends _basecommand.default {
65
82
  async run() {
66
- const { args , flags } = this.props;
83
+ const { args, flags } = this.props;
67
84
  if (flags.all && args.workflowKey) {
68
85
  return this.error(`workflowKey arg \`${args.workflowKey}\` cannot also be provided when using --all`);
69
86
  }
@@ -72,7 +89,7 @@ class WorkflowPull extends _baseCommand.default {
72
89
  /*
73
90
  * Pull one workflow
74
91
  */ async pullOneWorkflow() {
75
- const { flags } = this.props;
92
+ const { flags } = this.props;
76
93
  // 1. Retrieve or build a new workflow directory context.
77
94
  const dirContext = await this.getWorkflowDirContext();
78
95
  if (dirContext.exists) {
@@ -84,7 +101,7 @@ class WorkflowPull extends _baseCommand.default {
84
101
  }
85
102
  // 2. Fetch the workflow with annotations.
86
103
  const resp = await (0, _request.withSpinner)(()=>{
87
- const props = (0, _objectIsomorphic.merge)(this.props, {
104
+ const props = (0, _objectisomorphic.merge)(this.props, {
88
105
  args: {
89
106
  workflowKey: dirContext.key
90
107
  },
@@ -100,21 +117,21 @@ class WorkflowPull extends _baseCommand.default {
100
117
  this.log(`‣ Successfully ${action} \`${dirContext.key}\` at ${dirContext.abspath}`);
101
118
  }
102
119
  async getWorkflowDirContext() {
103
- const { workflowKey } = this.props.args;
104
- const { resourceDir , cwd: runCwd } = this.runContext;
120
+ const { workflowKey } = this.props.args;
121
+ const { resourceDir, cwd: runCwd } = this.runContext;
105
122
  // Inside an existing resource dir, use it if valid for the target workflow.
106
123
  if (resourceDir) {
107
124
  const target = {
108
- commandId: _baseCommand.default.id,
125
+ commandId: _basecommand.default.id,
109
126
  type: "workflow",
110
127
  key: workflowKey
111
128
  };
112
- return (0, _runContext.ensureResourceDirForTarget)(resourceDir, target);
129
+ return (0, _runcontext.ensureResourceDirForTarget)(resourceDir, target);
113
130
  }
114
131
  // Not inside any existing workflow directory, which means either create a
115
132
  // new worfklow directory in the cwd, or update it if there is one already.
116
133
  if (workflowKey) {
117
- const dirPath = _nodePath.resolve(runCwd, workflowKey);
134
+ const dirPath = _nodepath.resolve(runCwd, workflowKey);
118
135
  const exists = await _workflow.isWorkflowDir(dirPath);
119
136
  return {
120
137
  type: "workflow",
@@ -129,7 +146,7 @@ class WorkflowPull extends _baseCommand.default {
129
146
  /*
130
147
  * Pull all workflows
131
148
  */ async pullAllWorkflows() {
132
- const { flags } = this.props;
149
+ const { flags } = this.props;
133
150
  // TODO: In the future we should default to the knock project config first
134
151
  // if present, before defaulting to the cwd.
135
152
  const defaultToCwd = {
@@ -149,7 +166,7 @@ class WorkflowPull extends _baseCommand.default {
149
166
  this.log(`‣ Successfully ${action} the workflows directory at ${targetDirCtx.abspath}`);
150
167
  }
151
168
  async listAllWorkflows(pageParams = {}, workflowsFetchedSoFar = []) {
152
- const props = (0, _objectIsomorphic.merge)(this.props, {
169
+ const props = (0, _objectisomorphic.merge)(this.props, {
153
170
  flags: {
154
171
  ...pageParams,
155
172
  annotate: true,
@@ -161,7 +178,7 @@ class WorkflowPull extends _baseCommand.default {
161
178
  const message = (0, _request.formatErrorRespMessage)(resp);
162
179
  this.error(new _error.ApiError(message));
163
180
  }
164
- const { entries , page_info: pageInfo } = resp.data;
181
+ const { entries, page_info: pageInfo } = resp.data;
165
182
  const workflows = [
166
183
  ...workflowsFetchedSoFar,
167
184
  ...entries
@@ -171,8 +188,8 @@ class WorkflowPull extends _baseCommand.default {
171
188
  }, workflows) : workflows;
172
189
  }
173
190
  }
174
- WorkflowPull.summary = "Pull one or more workflows from an environment into a local file system.";
175
- WorkflowPull.flags = {
191
+ _define_property(WorkflowPull, "summary", "Pull one or more workflows from an environment into a local file system.");
192
+ _define_property(WorkflowPull, "flags", {
176
193
  environment: _core.Flags.string({
177
194
  default: "development",
178
195
  summary: "The environment to use."
@@ -192,9 +209,9 @@ WorkflowPull.flags = {
192
209
  force: _core.Flags.boolean({
193
210
  summary: "Remove the confirmation prompt."
194
211
  })
195
- };
196
- WorkflowPull.args = {
212
+ });
213
+ _define_property(WorkflowPull, "args", {
197
214
  workflowKey: _core.Args.string({
198
215
  required: false
199
216
  })
200
- };
217
+ });
@@ -4,20 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>WorkflowPush
7
+ get: function() {
8
+ return WorkflowPush;
9
+ }
8
10
  });
9
11
  const _core = require("@oclif/core");
10
- const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
12
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
11
13
  const _const = require("../../lib/helpers/const");
12
14
  const _error = require("../../lib/helpers/error");
13
- const _flag = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/helpers/flag"));
14
- const _objectIsomorphic = require("../../lib/helpers/object.isomorphic");
15
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
16
+ const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
15
17
  const _request = require("../../lib/helpers/request");
16
18
  const _string = require("../../lib/helpers/string");
17
19
  const _ux = require("../../lib/helpers/ux");
18
- const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/workflow"));
19
- const _validate = /*#__PURE__*/ _interopRequireDefault(require("./validate"));
20
- function _interopRequireDefault(obj) {
20
+ const _workflow = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/workflow"));
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) {
21
36
  return obj && obj.__esModule ? obj : {
22
37
  default: obj
23
38
  };
@@ -30,7 +45,7 @@ function _getRequireWildcardCache(nodeInterop) {
30
45
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
31
46
  })(nodeInterop);
32
47
  }
33
- function _interopRequireWildcard(obj, nodeInterop) {
48
+ function _interop_require_wildcard(obj, nodeInterop) {
34
49
  if (!nodeInterop && obj && obj.__esModule) {
35
50
  return obj;
36
51
  }
@@ -43,7 +58,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
43
58
  if (cache && cache.has(obj)) {
44
59
  return cache.get(obj);
45
60
  }
46
- var newObj = {};
61
+ var newObj = {
62
+ __proto__: null
63
+ };
47
64
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
48
65
  for(var key in obj){
49
66
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -61,9 +78,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
61
78
  }
62
79
  return newObj;
63
80
  }
64
- class WorkflowPush extends _baseCommand.default {
81
+ class WorkflowPush extends _basecommand.default {
65
82
  async run() {
66
- const { flags } = this.props;
83
+ const { flags } = this.props;
67
84
  // 1. First read all workflow directories found for the given command.
68
85
  const target = await _workflow.ensureValidCommandTarget(this.props, this.runContext);
69
86
  const [workflows, readErrors] = await _workflow.readAllForCommandTarget(target, {
@@ -89,7 +106,7 @@ class WorkflowPush extends _baseCommand.default {
89
106
  // 3. Finally push up each workflow, abort on the first error.
90
107
  _ux.spinner.start(`‣ Pushing`);
91
108
  for (const workflow of workflows){
92
- const props = (0, _objectIsomorphic.merge)(this.props, {
109
+ const props = (0, _objectisomorphic.merge)(this.props, {
93
110
  flags: {
94
111
  annotate: true
95
112
  }
@@ -116,8 +133,8 @@ class WorkflowPush extends _baseCommand.default {
116
133
  this.log(`‣ Successfully ${actioned} ${workflows.length} workflow(s):\n` + (0, _string.indentString)(workflowKeys.join("\n"), 4));
117
134
  }
118
135
  }
119
- WorkflowPush.summary = "Push one or more workflows from a local file system to Knock.";
120
- WorkflowPush.flags = {
136
+ _define_property(WorkflowPush, "summary", "Push one or more workflows from a local file system to Knock.");
137
+ _define_property(WorkflowPush, "flags", {
121
138
  environment: _core.Flags.string({
122
139
  summary: "Pushing a workflow is only allowed in the development environment",
123
140
  default: _const.KnockEnv.Development,
@@ -144,9 +161,9 @@ WorkflowPush.flags = {
144
161
  "commit"
145
162
  ]
146
163
  })
147
- };
148
- WorkflowPush.args = {
164
+ });
165
+ _define_property(WorkflowPush, "args", {
149
166
  workflowKey: _core.Args.string({
150
167
  required: false
151
168
  })
152
- };
169
+ });
@@ -4,21 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>WorkflowRun
7
+ get: function() {
8
+ return WorkflowRun;
9
+ }
8
10
  });
9
11
  const _core = require("@oclif/core");
10
- const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
12
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
11
13
  const _flag = require("../../lib/helpers/flag");
12
14
  const _request = require("../../lib/helpers/request");
13
15
  const _string = require("../../lib/helpers/string");
14
- function _interopRequireDefault(obj) {
16
+ function _define_property(obj, key, value) {
17
+ if (key in obj) {
18
+ Object.defineProperty(obj, key, {
19
+ value: value,
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true
23
+ });
24
+ } else {
25
+ obj[key] = value;
26
+ }
27
+ return obj;
28
+ }
29
+ function _interop_require_default(obj) {
15
30
  return obj && obj.__esModule ? obj : {
16
31
  default: obj
17
32
  };
18
33
  }
19
- class WorkflowRun extends _baseCommand.default {
34
+ class WorkflowRun extends _basecommand.default {
20
35
  async run() {
21
- const { args , flags } = this.props;
36
+ const { args, flags } = this.props;
22
37
  const resp = await (0, _request.withSpinner)(()=>this.apiV1.runWorkflow(this.props), {
23
38
  action: "‣ Running"
24
39
  });
@@ -26,8 +41,8 @@ class WorkflowRun extends _baseCommand.default {
26
41
  this.log((0, _string.indentString)(`Workflow run id: ${resp.data.workflow_run_id}`, 4));
27
42
  }
28
43
  }
29
- WorkflowRun.summary = "Test run a workflow using the latest version from Knock.";
30
- WorkflowRun.flags = {
44
+ _define_property(WorkflowRun, "summary", "Test run a workflow using the latest version from Knock.");
45
+ _define_property(WorkflowRun, "flags", {
31
46
  environment: _core.Flags.string({
32
47
  default: "development",
33
48
  summary: "The environment in which to run the workflow"
@@ -48,9 +63,9 @@ WorkflowRun.flags = {
48
63
  data: (0, _flag.jsonStr)({
49
64
  summary: "A JSON string of the data for this workflow"
50
65
  })
51
- };
52
- WorkflowRun.args = {
66
+ });
67
+ _define_property(WorkflowRun, "args", {
53
68
  workflowKey: _core.Args.string({
54
69
  required: true
55
70
  })
56
- };
71
+ });
@@ -4,18 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>WorkflowValidate
7
+ get: function() {
8
+ return WorkflowValidate;
9
+ }
8
10
  });
9
11
  const _core = require("@oclif/core");
10
- const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
12
+ const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
11
13
  const _const = require("../../lib/helpers/const");
12
14
  const _error = require("../../lib/helpers/error");
13
- const _flag = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/helpers/flag"));
15
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
14
16
  const _request = require("../../lib/helpers/request");
15
17
  const _string = require("../../lib/helpers/string");
16
18
  const _ux = require("../../lib/helpers/ux");
17
- const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../../lib/marshal/workflow"));
18
- function _interopRequireDefault(obj) {
19
+ const _workflow = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/marshal/workflow"));
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) {
19
34
  return obj && obj.__esModule ? obj : {
20
35
  default: obj
21
36
  };
@@ -28,7 +43,7 @@ function _getRequireWildcardCache(nodeInterop) {
28
43
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
29
44
  })(nodeInterop);
30
45
  }
31
- function _interopRequireWildcard(obj, nodeInterop) {
46
+ function _interop_require_wildcard(obj, nodeInterop) {
32
47
  if (!nodeInterop && obj && obj.__esModule) {
33
48
  return obj;
34
49
  }
@@ -41,7 +56,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
41
56
  if (cache && cache.has(obj)) {
42
57
  return cache.get(obj);
43
58
  }
44
- var newObj = {};
59
+ var newObj = {
60
+ __proto__: null
61
+ };
45
62
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
46
63
  for(var key in obj){
47
64
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -59,7 +76,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
59
76
  }
60
77
  return newObj;
61
78
  }
62
- class WorkflowValidate extends _baseCommand.default {
79
+ class WorkflowValidate extends _basecommand.default {
63
80
  async run() {
64
81
  // 1. Read all workflow directories found for the given command.
65
82
  const target = await _workflow.ensureValidCommandTarget(this.props, this.runContext);
@@ -103,8 +120,8 @@ class WorkflowValidate extends _baseCommand.default {
103
120
  return errors;
104
121
  }
105
122
  }
106
- WorkflowValidate.summary = "Validate one or more workflows from a local file system.";
107
- WorkflowValidate.flags = {
123
+ _define_property(WorkflowValidate, "summary", "Validate one or more workflows from a local file system.");
124
+ _define_property(WorkflowValidate, "flags", {
108
125
  environment: _core.Flags.string({
109
126
  summary: "Validating a workflow is only done in the development environment",
110
127
  default: _const.KnockEnv.Development,
@@ -121,9 +138,9 @@ WorkflowValidate.flags = {
121
138
  "all"
122
139
  ]
123
140
  })
124
- };
125
- WorkflowValidate.args = {
141
+ });
142
+ _define_property(WorkflowValidate, "args", {
126
143
  workflowKey: _core.Args.string({
127
144
  required: false
128
145
  })
129
- };
146
+ });
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "run", {
6
6
  enumerable: true,
7
- get: ()=>_core.run
7
+ get: function() {
8
+ return _core.run;
9
+ }
8
10
  });
9
11
  const _core = require("@oclif/core");