@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.
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 +16 -16
  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,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "readAllForCommandTarget", {
6
6
  enumerable: true,
7
- get: ()=>readAllForCommandTarget
7
+ get: function() {
8
+ return readAllForCommandTarget;
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"));
13
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
12
14
  const _error = require("../../helpers/error");
13
15
  const _json = require("../../helpers/json");
14
16
  const _helpers = require("./helpers");
@@ -20,7 +22,7 @@ function _getRequireWildcardCache(nodeInterop) {
20
22
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
21
23
  })(nodeInterop);
22
24
  }
23
- function _interopRequireWildcard(obj, nodeInterop) {
25
+ function _interop_require_wildcard(obj, nodeInterop) {
24
26
  if (!nodeInterop && obj && obj.__esModule) {
25
27
  return obj;
26
28
  }
@@ -33,7 +35,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
33
35
  if (cache && cache.has(obj)) {
34
36
  return cache.get(obj);
35
37
  }
36
- var newObj = {};
38
+ var newObj = {
39
+ __proto__: null
40
+ };
37
41
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
38
42
  for(var key in obj){
39
43
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -63,10 +67,10 @@ function _interopRequireWildcard(obj, nodeInterop) {
63
67
  const translations = [];
64
68
  const errors = [];
65
69
  for (const abspath of filePaths){
66
- const { name: translationRef } = _nodePath.parse(abspath);
70
+ const { name: translationRef } = _nodepath.parse(abspath);
67
71
  const parsedRef = (0, _helpers.parseTranslationRef)(translationRef);
68
72
  if (!parsedRef) continue;
69
- const { localeCode , namespace } = parsedRef;
73
+ const { localeCode, namespace } = parsedRef;
70
74
  // eslint-disable-next-line no-await-in-loop
71
75
  const [content, readJsonErrors] = await (0, _json.readJson)(abspath);
72
76
  if (readJsonErrors.length > 0) {
@@ -89,7 +93,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
89
93
  ];
90
94
  };
91
95
  const readAllForCommandTarget = async (target)=>{
92
- const { type: targetType , context: targetCtx } = target;
96
+ const { type: targetType, context: targetCtx } = target;
93
97
  if (!targetCtx.exists) {
94
98
  const subject = targetType === "translationFile" ? "a translation file at" : "translation files in";
95
99
  return _core.ux.error(`Cannot locate ${subject} \`${targetCtx.abspath}\``);
@@ -108,10 +112,10 @@ const readAllForCommandTarget = async (target)=>{
108
112
  }
109
113
  case "translationsIndexDir":
110
114
  {
111
- const dirents = await _fsExtra.readdir(targetCtx.abspath, {
115
+ const dirents = await _fsextra.readdir(targetCtx.abspath, {
112
116
  withFileTypes: true
113
117
  });
114
- const translationDirPaths = dirents.filter((dirent)=>dirent.isDirectory() && (0, _helpers.isTranslationDir)(dirent.name)).map((dirent)=>_nodePath.resolve(targetCtx.abspath, dirent.name));
118
+ const translationDirPaths = dirents.filter((dirent)=>dirent.isDirectory() && (0, _helpers.isTranslationDir)(dirent.name)).map((dirent)=>_nodepath.resolve(targetCtx.abspath, dirent.name));
115
119
  const translationFilePaths = (await Promise.all(translationDirPaths.map(async (abspath)=>(0, _helpers.lsTranslationDir)(abspath)))).flat();
116
120
  return readTranslationFiles(translationFilePaths);
117
121
  }
@@ -9,11 +9,15 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- writeTranslationFile: ()=>writeTranslationFile,
13
- writeTranslationFiles: ()=>writeTranslationFiles
12
+ writeTranslationFile: function() {
13
+ return writeTranslationFile;
14
+ },
15
+ writeTranslationFiles: function() {
16
+ return writeTranslationFiles;
17
+ }
14
18
  });
15
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
16
- const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
19
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
20
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
17
21
  const _lodash = require("lodash");
18
22
  const _const = require("../../helpers/const");
19
23
  const _json = require("../../helpers/json");
@@ -26,7 +30,7 @@ function _getRequireWildcardCache(nodeInterop) {
26
30
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
31
  })(nodeInterop);
28
32
  }
29
- function _interopRequireWildcard(obj, nodeInterop) {
33
+ function _interop_require_wildcard(obj, nodeInterop) {
30
34
  if (!nodeInterop && obj && obj.__esModule) {
31
35
  return obj;
32
36
  }
@@ -39,7 +43,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
39
43
  if (cache && cache.has(obj)) {
40
44
  return cache.get(obj);
41
45
  }
42
- var newObj = {};
46
+ var newObj = {
47
+ __proto__: null
48
+ };
43
49
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
50
  for(var key in obj){
45
51
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -57,24 +63,24 @@ function _interopRequireWildcard(obj, nodeInterop) {
57
63
  }
58
64
  return newObj;
59
65
  }
60
- const writeTranslationFile = async (translationFileCtx, translation)=>_fsExtra.outputJson(translationFileCtx.abspath, JSON.parse(translation.content), {
66
+ const writeTranslationFile = async (translationFileCtx, translation)=>_fsextra.outputJson(translationFileCtx.abspath, JSON.parse(translation.content), {
61
67
  spaces: _json.DOUBLE_SPACES
62
68
  });
63
69
  const writeTranslationFiles = async (targetDirCtx, translations)=>{
64
- const backupDirPath = _nodePath.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
70
+ const backupDirPath = _nodepath.resolve(_const.sandboxDir, (0, _lodash.uniqueId)("backup"));
65
71
  try {
66
72
  // If the index directory already exists, back it up in the temp sandbox
67
73
  // before wiping it clean.
68
74
  if (targetDirCtx.exists) {
69
- await _fsExtra.copy(targetDirCtx.abspath, backupDirPath);
70
- await _fsExtra.emptyDir(targetDirCtx.abspath);
75
+ await _fsextra.copy(targetDirCtx.abspath, backupDirPath);
76
+ await _fsextra.emptyDir(targetDirCtx.abspath);
71
77
  }
72
78
  // Write given remote translations into the given translations directory path.
73
79
  const writeTranslationDirPromises = translations.map(async (translation)=>{
74
80
  // If TranslationDirContext, then that is the locale directory we want
75
81
  // to write translation files in; otherwise for translations index
76
82
  // directory, we want to nest translation files under each locale dir.
77
- const localeDirPath = "key" in targetDirCtx ? targetDirCtx.abspath : _nodePath.resolve(targetDirCtx.abspath, translation.locale_code);
83
+ const localeDirPath = "key" in targetDirCtx ? targetDirCtx.abspath : _nodepath.resolve(targetDirCtx.abspath, translation.locale_code);
78
84
  const translationFileCtx = await (0, _helpers.buildTranslationFileCtx)(localeDirPath, translation.locale_code, translation.namespace);
79
85
  return writeTranslationFile(translationFileCtx, translation);
80
86
  });
@@ -83,14 +89,14 @@ const writeTranslationFiles = async (targetDirCtx, translations)=>{
83
89
  // In case of any error, wipe the index directory that is likely in a bad
84
90
  // state then restore the backup if one existed before.
85
91
  if (targetDirCtx.exists) {
86
- await _fsExtra.emptyDir(targetDirCtx.abspath);
87
- await _fsExtra.copy(backupDirPath, targetDirCtx.abspath);
92
+ await _fsextra.emptyDir(targetDirCtx.abspath);
93
+ await _fsextra.copy(backupDirPath, targetDirCtx.abspath);
88
94
  } else {
89
- await _fsExtra.remove(targetDirCtx.abspath);
95
+ await _fsextra.remove(targetDirCtx.abspath);
90
96
  }
91
97
  throw error;
92
98
  } finally{
93
99
  // Always clean up the backup directory in the temp sandbox.
94
- await _fsExtra.remove(backupDirPath);
100
+ await _fsextra.remove(backupDirPath);
95
101
  }
96
102
  };
@@ -9,14 +9,20 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- parseStepsInput: ()=>parseStepsInput,
13
- generateWorkflowDir: ()=>generateWorkflowDir,
14
- scaffoldWorkflowDirBundle: ()=>scaffoldWorkflowDirBundle
12
+ generateWorkflowDir: function() {
13
+ return generateWorkflowDir;
14
+ },
15
+ parseStepsInput: function() {
16
+ return parseStepsInput;
17
+ },
18
+ scaffoldWorkflowDirBundle: function() {
19
+ return scaffoldWorkflowDirBundle;
20
+ }
15
21
  });
16
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
22
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
17
23
  const _lodash = require("lodash");
18
- const _constIsomorphic = require("../shared/const.isomorphic");
19
- const _processorIsomorphic = require("./processor.isomorphic");
24
+ const _constisomorphic = require("../shared/const.isomorphic");
25
+ const _processorisomorphic = require("./processor.isomorphic");
20
26
  const _types = require("./types");
21
27
  const _writer = require("./writer");
22
28
  function _getRequireWildcardCache(nodeInterop) {
@@ -27,7 +33,7 @@ function _getRequireWildcardCache(nodeInterop) {
27
33
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
28
34
  })(nodeInterop);
29
35
  }
30
- function _interopRequireWildcard(obj, nodeInterop) {
36
+ function _interop_require_wildcard(obj, nodeInterop) {
31
37
  if (!nodeInterop && obj && obj.__esModule) {
32
38
  return obj;
33
39
  }
@@ -40,7 +46,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
40
46
  if (cache && cache.has(obj)) {
41
47
  return cache.get(obj);
42
48
  }
43
- var newObj = {};
49
+ var newObj = {
50
+ __proto__: null
51
+ };
44
52
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
45
53
  for(var key in obj){
46
54
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -58,7 +66,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
58
66
  }
59
67
  return newObj;
60
68
  }
61
- const newTemplateFilePath = (stepRef, fileName, fileExt)=>_nodePath.join(stepRef, `${fileName}.${fileExt}`).toLowerCase();
69
+ const newTemplateFilePath = (stepRef, fileName, fileExt)=>_nodepath.join(stepRef, `${fileName}.${fileExt}`).toLowerCase();
62
70
  const scaffoldDelayStep = (refSuffix)=>{
63
71
  const scaffoldedStep = {
64
72
  ref: `${_types.StepType.Delay}_${refSuffix}`,
@@ -119,7 +127,7 @@ const scaffoldEmailChannelStep = (refSuffix)=>{
119
127
  layout_key: "default"
120
128
  },
121
129
  subject: "You've got mail!",
122
- ["html_body" + _constIsomorphic.FILEPATH_MARKER]: templateFilePath
130
+ ["html_body" + _constisomorphic.FILEPATH_MARKER]: templateFilePath
123
131
  }
124
132
  };
125
133
  const bundleFragment = {
@@ -139,7 +147,7 @@ const scaffoldInAppFeedChannelStep = (refSuffix)=>{
139
147
  channel_key: "<IN-APP-FEED CHANNEL KEY>",
140
148
  template: {
141
149
  action_url: "{{ vars.app_url }}",
142
- ["markdown_body" + _constIsomorphic.FILEPATH_MARKER]: templateFilePath
150
+ ["markdown_body" + _constisomorphic.FILEPATH_MARKER]: templateFilePath
143
151
  }
144
152
  };
145
153
  const bundleFragment = {
@@ -158,7 +166,7 @@ const scaffoldSmsChannelStep = (refSuffix)=>{
158
166
  type: _types.StepType.Channel,
159
167
  channel_key: "<SMS CHANNEL KEY>",
160
168
  template: {
161
- ["text_body" + _constIsomorphic.FILEPATH_MARKER]: templateFilePath
169
+ ["text_body" + _constisomorphic.FILEPATH_MARKER]: templateFilePath
162
170
  }
163
171
  };
164
172
  const bundleFragment = {
@@ -180,7 +188,7 @@ const scaffoldPushChannelStep = (refSuffix)=>{
180
188
  settings: {
181
189
  delivery_type: "content"
182
190
  },
183
- ["text_body" + _constIsomorphic.FILEPATH_MARKER]: templateFilePath
191
+ ["text_body" + _constisomorphic.FILEPATH_MARKER]: templateFilePath
184
192
  }
185
193
  };
186
194
  const bundleFragment = {
@@ -199,7 +207,7 @@ const scaffoldChatChannelStep = (refSuffix)=>{
199
207
  type: _types.StepType.Channel,
200
208
  channel_key: "<CHAT CHANNEL KEY>",
201
209
  template: {
202
- ["markdown_body" + _constIsomorphic.FILEPATH_MARKER]: templateFilePath
210
+ ["markdown_body" + _constisomorphic.FILEPATH_MARKER]: templateFilePath
203
211
  }
204
212
  };
205
213
  const bundleFragment = {
@@ -264,7 +272,7 @@ const scaffoldWorkflowDirBundle = (attrs)=>{
264
272
  steps: scaffoldedSteps
265
273
  };
266
274
  return (0, _lodash.assign)({
267
- [_processorIsomorphic.WORKFLOW_JSON]: workflowJson
275
+ [_processorisomorphic.WORKFLOW_JSON]: workflowJson
268
276
  }, ...bundleFragments);
269
277
  };
270
278
  const generateWorkflowDir = async (workflowDirCtx, attrs)=>{
@@ -9,22 +9,40 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- workflowJsonPath: ()=>workflowJsonPath,
13
- validateWorkflowKey: ()=>validateWorkflowKey,
14
- lsWorkflowJson: ()=>lsWorkflowJson,
15
- isWorkflowDir: ()=>isWorkflowDir,
16
- formatCategories: ()=>formatCategories,
17
- formatStepSummary: ()=>formatStepSummary,
18
- formatStatus: ()=>formatStatus,
19
- ensureValidCommandTarget: ()=>ensureValidCommandTarget,
20
- countSteps: ()=>countSteps
12
+ countSteps: function() {
13
+ return countSteps;
14
+ },
15
+ ensureValidCommandTarget: function() {
16
+ return ensureValidCommandTarget;
17
+ },
18
+ formatCategories: function() {
19
+ return formatCategories;
20
+ },
21
+ formatStatus: function() {
22
+ return formatStatus;
23
+ },
24
+ formatStepSummary: function() {
25
+ return formatStepSummary;
26
+ },
27
+ isWorkflowDir: function() {
28
+ return isWorkflowDir;
29
+ },
30
+ lsWorkflowJson: function() {
31
+ return lsWorkflowJson;
32
+ },
33
+ validateWorkflowKey: function() {
34
+ return validateWorkflowKey;
35
+ },
36
+ workflowJsonPath: function() {
37
+ return workflowJsonPath;
38
+ }
21
39
  });
22
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
40
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
23
41
  const _core = require("@oclif/core");
24
- const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
42
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
25
43
  const _lodash = require("lodash");
26
44
  const _string = require("../../helpers/string");
27
- const _processorIsomorphic = require("./processor.isomorphic");
45
+ const _processorisomorphic = require("./processor.isomorphic");
28
46
  const _types = require("./types");
29
47
  function _getRequireWildcardCache(nodeInterop) {
30
48
  if (typeof WeakMap !== "function") return null;
@@ -34,7 +52,7 @@ function _getRequireWildcardCache(nodeInterop) {
34
52
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
35
53
  })(nodeInterop);
36
54
  }
37
- function _interopRequireWildcard(obj, nodeInterop) {
55
+ function _interop_require_wildcard(obj, nodeInterop) {
38
56
  if (!nodeInterop && obj && obj.__esModule) {
39
57
  return obj;
40
58
  }
@@ -47,7 +65,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
47
65
  if (cache && cache.has(obj)) {
48
66
  return cache.get(obj);
49
67
  }
50
- var newObj = {};
68
+ var newObj = {
69
+ __proto__: null
70
+ };
51
71
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
52
72
  for(var key in obj){
53
73
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -65,7 +85,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
65
85
  }
66
86
  return newObj;
67
87
  }
68
- const workflowJsonPath = (workflowDirCtx)=>_nodePath.resolve(workflowDirCtx.abspath, _processorIsomorphic.WORKFLOW_JSON);
88
+ const workflowJsonPath = (workflowDirCtx)=>_nodepath.resolve(workflowDirCtx.abspath, _processorisomorphic.WORKFLOW_JSON);
69
89
  const validateWorkflowKey = (input)=>{
70
90
  if (!(0, _string.checkSlugifiedFormat)(input, {
71
91
  onlyLowerCase: true
@@ -75,14 +95,14 @@ const validateWorkflowKey = (input)=>{
75
95
  return undefined;
76
96
  };
77
97
  const lsWorkflowJson = async (dirPath)=>{
78
- const workflowJsonPath = _nodePath.resolve(dirPath, _processorIsomorphic.WORKFLOW_JSON);
79
- const exists = await _fsExtra.pathExists(workflowJsonPath);
98
+ const workflowJsonPath = _nodepath.resolve(dirPath, _processorisomorphic.WORKFLOW_JSON);
99
+ const exists = await _fsextra.pathExists(workflowJsonPath);
80
100
  return exists ? workflowJsonPath : undefined;
81
101
  };
82
102
  const isWorkflowDir = async (dirPath)=>Boolean(await lsWorkflowJson(dirPath));
83
103
  const formatCategories = (workflow, opts = {})=>{
84
- const { categories } = workflow;
85
- const { truncateAfter: limit , emptyDisplay ="" } = opts;
104
+ const { categories } = workflow;
105
+ const { truncateAfter: limit, emptyDisplay = "" } = opts;
86
106
  if (!categories) return emptyDisplay;
87
107
  const count = categories.length;
88
108
  if (!limit || limit >= count) return categories.join(", ");
@@ -92,7 +112,7 @@ const formatCategories = (workflow, opts = {})=>{
92
112
  * Returns a formatted string of workflow steps.
93
113
  */ const channelStepSummaryLines = (step)=>{
94
114
  if (step.type !== _types.StepType.Channel) return [];
95
- const { channel_key , channel_group_key } = step;
115
+ const { channel_key, channel_group_key } = step;
96
116
  return [
97
117
  channel_key && `Channel: ${channel_key}`,
98
118
  channel_group_key && `Channel group: ${channel_group_key}`
@@ -100,7 +120,7 @@ const formatCategories = (workflow, opts = {})=>{
100
120
  };
101
121
  const batchStepSummaryLines = (step)=>{
102
122
  if (step.type !== _types.StepType.Batch) return [];
103
- const { batch_key , batch_window_type , batch_window: duration , batch_window_extension_limit , batch_until_field_path: field_path , batch_order } = step.settings;
123
+ const { batch_key, batch_window_type, batch_window: duration, batch_window_extension_limit, batch_until_field_path: field_path, batch_order } = step.settings;
104
124
  return [
105
125
  batch_key && `Batch key: ${batch_key}`,
106
126
  duration && `Batch window: ${duration.value} ${duration.unit}`,
@@ -112,7 +132,7 @@ const batchStepSummaryLines = (step)=>{
112
132
  };
113
133
  const throttleStepSummaryLines = (step)=>{
114
134
  if (step.type !== _types.StepType.Throttle) return [];
115
- const { throttle_key , throttle_window: duration , throttle_window_field_path: field_path , throttle_limit } = step.settings;
135
+ const { throttle_key, throttle_window: duration, throttle_window_field_path: field_path, throttle_limit } = step.settings;
116
136
  return [
117
137
  throttle_key && `Throttle key: ${throttle_key}`,
118
138
  duration && `Throttle window: ${duration.value} ${duration.unit}`,
@@ -133,7 +153,7 @@ const branchStepSummaryLines = (step)=>{
133
153
  };
134
154
  const delayStepSummaryLines = (step)=>{
135
155
  if (step.type !== _types.StepType.Delay) return [];
136
- const { delay_for: duration , delay_until_field_path: field_path } = step.settings;
156
+ const { delay_for: duration, delay_until_field_path: field_path } = step.settings;
137
157
  return [
138
158
  duration && `Delay duration: ${duration.value} ${duration.unit}`,
139
159
  field_path && `Delay duration: "${field_path}"`
@@ -141,7 +161,7 @@ const delayStepSummaryLines = (step)=>{
141
161
  };
142
162
  const httpFetchStepSummaryLines = (step)=>{
143
163
  if (step.type !== _types.StepType.HttpFetch) return [];
144
- const { method , url , headers , query_params , body } = step.settings;
164
+ const { method, url, headers, query_params, body } = step.settings;
145
165
  const reqHeaders = (headers || []).map((h)=>`${h.key}: ${h.value}`);
146
166
  const params = (query_params || []).map((p)=>`${p.key}: ${p.value}`);
147
167
  return [
@@ -173,8 +193,8 @@ const formatStatus = (workflow)=>{
173
193
  return workflow.active ? "active" : "inactive";
174
194
  };
175
195
  const ensureValidCommandTarget = async (props, runContext)=>{
176
- const { args , flags } = props;
177
- const { commandId , resourceDir: resourceDirCtx , cwd: runCwd } = runContext;
196
+ const { args, flags } = props;
197
+ const { commandId, resourceDir: resourceDirCtx, cwd: runCwd } = runContext;
178
198
  // If the target resource is a different type than the current resource dir
179
199
  // type, error out.
180
200
  if (resourceDirCtx && resourceDirCtx.type !== "workflow") {
@@ -208,7 +228,7 @@ const ensureValidCommandTarget = async (props, runContext)=>{
208
228
  if (resourceDirCtx && resourceDirCtx.key !== args.workflowKey) {
209
229
  return _core.ux.error(`Cannot run ${commandId} \`${args.workflowKey}\` inside another workflow directory:\n${resourceDirCtx.key}`);
210
230
  }
211
- const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodePath.resolve(runCwd, args.workflowKey);
231
+ const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodepath.resolve(runCwd, args.workflowKey);
212
232
  const workflowDirCtx = {
213
233
  type: "workflow",
214
234
  key: args.workflowKey,
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./generator"), exports);
6
+ _export_star(require("./helpers"), exports);
7
+ _export_star(require("./processor.isomorphic"), exports);
8
+ _export_star(require("./reader"), exports);
9
+ _export_star(require("./types"), exports);
10
+ _export_star(require("./writer"), exports);
11
+ function _export_star(from, to) {
12
+ Object.keys(from).forEach(function(k) {
13
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
14
+ Object.defineProperty(to, k, {
15
+ enumerable: true,
16
+ get: function() {
17
+ return from[k];
18
+ }
19
+ });
20
+ }
21
+ });
22
+ return from;
23
+ }
@@ -16,16 +16,26 @@ function _export(target, all) {
16
16
  });
17
17
  }
18
18
  _export(exports, {
19
- WORKFLOW_JSON: ()=>WORKFLOW_JSON,
20
- VISUAL_BLOCKS_JSON: ()=>VISUAL_BLOCKS_JSON,
21
- buildWorkflowDirBundle: ()=>buildWorkflowDirBundle,
22
- formatExtractedFilePath: ()=>formatExtractedFilePath,
23
- toWorkflowJson: ()=>toWorkflowJson
19
+ VISUAL_BLOCKS_JSON: function() {
20
+ return VISUAL_BLOCKS_JSON;
21
+ },
22
+ WORKFLOW_JSON: function() {
23
+ return WORKFLOW_JSON;
24
+ },
25
+ buildWorkflowDirBundle: function() {
26
+ return buildWorkflowDirBundle;
27
+ },
28
+ formatExtractedFilePath: function() {
29
+ return formatExtractedFilePath;
30
+ },
31
+ toWorkflowJson: function() {
32
+ return toWorkflowJson;
33
+ }
24
34
  });
25
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
35
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
26
36
  const _lodash = require("lodash");
27
- const _objectIsomorphic = require("../../helpers/object.isomorphic");
28
- const _constIsomorphic = require("../shared/const.isomorphic");
37
+ const _objectisomorphic = require("../../helpers/object.isomorphic");
38
+ const _constisomorphic = require("../shared/const.isomorphic");
29
39
  const _types = require("./types");
30
40
  function _getRequireWildcardCache(nodeInterop) {
31
41
  if (typeof WeakMap !== "function") return null;
@@ -35,7 +45,7 @@ function _getRequireWildcardCache(nodeInterop) {
35
45
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
46
  })(nodeInterop);
37
47
  }
38
- function _interopRequireWildcard(obj, nodeInterop) {
48
+ function _interop_require_wildcard(obj, nodeInterop) {
39
49
  if (!nodeInterop && obj && obj.__esModule) {
40
50
  return obj;
41
51
  }
@@ -48,7 +58,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
48
58
  if (cache && cache.has(obj)) {
49
59
  return cache.get(obj);
50
60
  }
51
- var newObj = {};
61
+ var newObj = {
62
+ __proto__: null
63
+ };
52
64
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
53
65
  for(var key in obj){
54
66
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -76,18 +88,18 @@ const VISUAL_BLOCKS_JSON = "visual_blocks.json";
76
88
  var _workflow___annotation;
77
89
  // Move read only fields of a workflow under the dedicated field "__readonly".
78
90
  const readonlyFields = ((_workflow___annotation = workflow.__annotation) === null || _workflow___annotation === void 0 ? void 0 : _workflow___annotation.readonly_fields) || [];
79
- const [readonly, remainder] = (0, _objectIsomorphic.split)(workflow, readonlyFields);
91
+ const [readonly, remainder] = (0, _objectisomorphic.split)(workflow, readonlyFields);
80
92
  const worklfowJson = {
81
93
  ...remainder,
82
94
  __readonly: readonly
83
95
  };
84
96
  // Strip out all schema annotations, so not to expose them to end users.
85
- return (0, _objectIsomorphic.omitDeep)(worklfowJson, [
97
+ return (0, _objectisomorphic.omitDeep)(worklfowJson, [
86
98
  "__annotation"
87
99
  ]);
88
100
  };
89
101
  const formatExtractedFilePath = (objPathParts, fileExt, opts = {})=>{
90
- const { unnestDirsBy =0 , nestIntoDirs =[] } = opts;
102
+ const { unnestDirsBy = 0, nestIntoDirs = [] } = opts;
91
103
  // 1. Unnest the obj path parts by the given depths, if the option is given.
92
104
  const maxUnnestableDepth = Math.min(Math.max(objPathParts.length - 1, 0), unnestDirsBy);
93
105
  const unnestedObjPathParts = objPathParts.slice(maxUnnestableDepth, objPathParts.length);
@@ -123,7 +135,7 @@ const formatExtractedFilePath = (objPathParts, fileExt, opts = {})=>{
123
135
  ...filePathParts,
124
136
  `${fileName}.${fileExt}`
125
137
  ];
126
- return _nodePath.join(...paths).toLowerCase();
138
+ return _nodepath.join(...paths).toLowerCase();
127
139
  };
128
140
  const NON_RECURSIVELY_TRAVERSABLE_FIELDS_FOR_EXTRACTION = new Set([
129
141
  "branches"
@@ -208,9 +220,9 @@ const recursivelyBuildWorkflowDirBundle = (bundle, steps, localWorkflowStepsByRe
208
220
  if (!(0, _lodash.has)(step, objPathParts)) continue;
209
221
  // If the field at this path is extracted in the local workflow, then
210
222
  // always extract; otherwise extract based on the field settings default.
211
- const objPathStr = _objectIsomorphic.ObjPath.stringify(objPathParts);
212
- const extractedFilePath = (0, _lodash.get)(localWorkflowStepsByRef, `${step.ref}.${objPathStr}${_constIsomorphic.FILEPATH_MARKER}`);
213
- const { default: extractByDefault , file_ext: fileExt } = extractionSettings;
223
+ const objPathStr = _objectisomorphic.ObjPath.stringify(objPathParts);
224
+ const extractedFilePath = (0, _lodash.get)(localWorkflowStepsByRef, `${step.ref}.${objPathStr}${_constisomorphic.FILEPATH_MARKER}`);
225
+ const { default: extractByDefault, file_ext: fileExt } = extractionSettings;
214
226
  if (!extractedFilePath && !extractByDefault) continue;
215
227
  // By this point, we have a field where we need to extract its content.
216
228
  // First figure out the relative file path (within the workflow directory)
@@ -225,15 +237,15 @@ const recursivelyBuildWorkflowDirBundle = (bundle, steps, localWorkflowStepsByRe
225
237
  // In case we are about to extract a field that has children rather than
226
238
  // string content (e.g. visual blocks), prepare the data to strip out any
227
239
  // annotations.
228
- let data = (0, _objectIsomorphic.omitDeep)((0, _lodash.get)(step, objPathParts), [
240
+ let data = (0, _objectisomorphic.omitDeep)((0, _lodash.get)(step, objPathParts), [
229
241
  "__annotation"
230
242
  ]);
231
243
  // Also, if the extractable data contains extracted file paths in itself
232
244
  // then rebase those file paths to be relative to its referenced file.
233
- data = (0, _objectIsomorphic.mapValuesDeep)(data, (value, key)=>{
234
- if (!_constIsomorphic.FILEPATH_MARKED_RE.test(key)) return value;
235
- const rebaseRootDir = _nodePath.dirname(relpath);
236
- const rebasedFilePath = _nodePath.relative(rebaseRootDir, value);
245
+ data = (0, _objectisomorphic.mapValuesDeep)(data, (value, key)=>{
246
+ if (!_constisomorphic.FILEPATH_MARKED_RE.test(key)) return value;
247
+ const rebaseRootDir = _nodepath.dirname(relpath);
248
+ const rebasedFilePath = _nodepath.relative(rebaseRootDir, value);
237
249
  return rebasedFilePath;
238
250
  });
239
251
  const content = typeof data === "string" ? data : JSON.stringify(data, null, 2);
@@ -247,7 +259,7 @@ const recursivelyBuildWorkflowDirBundle = (bundle, steps, localWorkflowStepsByRe
247
259
  (0, _lodash.set)(bundle, [
248
260
  relpath
249
261
  ], content);
250
- (0, _lodash.set)(step, `${objPathStr}${_constIsomorphic.FILEPATH_MARKER}`, relpath);
262
+ (0, _lodash.set)(step, `${objPathStr}${_constisomorphic.FILEPATH_MARKER}`, relpath);
251
263
  (0, _lodash.unset)(step, objPathParts);
252
264
  }
253
265
  // Lastly, recurse thru any branches that exist in the workflow tree