@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
@@ -9,13 +9,21 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- DOUBLE_SPACES: ()=>DOUBLE_SPACES,
13
- parseJson: ()=>parseJson,
14
- tryJsonParse: ()=>tryJsonParse,
15
- readJson: ()=>readJson
12
+ DOUBLE_SPACES: function() {
13
+ return DOUBLE_SPACES;
14
+ },
15
+ parseJson: function() {
16
+ return parseJson;
17
+ },
18
+ readJson: function() {
19
+ return readJson;
20
+ },
21
+ tryJsonParse: function() {
22
+ return tryJsonParse;
23
+ }
16
24
  });
17
- const _jsonlint = /*#__PURE__*/ _interopRequireWildcard(require("@prantlf/jsonlint"));
18
- const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
25
+ const _jsonlint = /*#__PURE__*/ _interop_require_wildcard(require("@prantlf/jsonlint"));
26
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
19
27
  const _error = require("./error");
20
28
  function _getRequireWildcardCache(nodeInterop) {
21
29
  if (typeof WeakMap !== "function") return null;
@@ -25,7 +33,7 @@ function _getRequireWildcardCache(nodeInterop) {
25
33
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
26
34
  })(nodeInterop);
27
35
  }
28
- function _interopRequireWildcard(obj, nodeInterop) {
36
+ function _interop_require_wildcard(obj, nodeInterop) {
29
37
  if (!nodeInterop && obj && obj.__esModule) {
30
38
  return obj;
31
39
  }
@@ -38,7 +46,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
38
46
  if (cache && cache.has(obj)) {
39
47
  return cache.get(obj);
40
48
  }
41
- var newObj = {};
49
+ var newObj = {
50
+ __proto__: null
51
+ };
42
52
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
53
  for(var key in obj){
44
54
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -81,6 +91,6 @@ const tryJsonParse = (maybeJson)=>{
81
91
  }
82
92
  };
83
93
  const readJson = async (filePath)=>{
84
- const json = await _fsExtra.readFile(filePath, "utf8");
94
+ const json = await _fsextra.readFile(filePath, "utf8");
85
95
  return parseJson(json);
86
96
  };
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "validateLiquidSyntax", {
6
6
  enumerable: true,
7
- get: ()=>validateLiquidSyntax
7
+ get: function() {
8
+ return validateLiquidSyntax;
9
+ }
8
10
  });
9
11
  const _liquidjs = require("liquidjs");
10
12
  const _error = require("./error");
@@ -16,15 +16,42 @@ function _export(target, all) {
16
16
  });
17
17
  }
18
18
  _export(exports, {
19
- split: ()=>split,
20
- omitDeep: ()=>omitDeep,
21
- mapValuesDeep: ()=>mapValuesDeep,
22
- getLastFound: ()=>getLastFound,
23
- prune: ()=>prune,
24
- merge: ()=>merge,
25
- ObjPath: ()=>ObjPath
19
+ ObjPath: function() {
20
+ return ObjPath;
21
+ },
22
+ getLastFound: function() {
23
+ return getLastFound;
24
+ },
25
+ mapValuesDeep: function() {
26
+ return mapValuesDeep;
27
+ },
28
+ merge: function() {
29
+ return merge;
30
+ },
31
+ omitDeep: function() {
32
+ return omitDeep;
33
+ },
34
+ prune: function() {
35
+ return prune;
36
+ },
37
+ split: function() {
38
+ return split;
39
+ }
26
40
  });
27
41
  const _lodash = require("lodash");
42
+ function _define_property(obj, key, value) {
43
+ if (key in obj) {
44
+ Object.defineProperty(obj, key, {
45
+ value: value,
46
+ enumerable: true,
47
+ configurable: true,
48
+ writable: true
49
+ });
50
+ } else {
51
+ obj[key] = value;
52
+ }
53
+ return obj;
54
+ }
28
55
  const split = (obj, paths)=>{
29
56
  const picked = (0, _lodash.pick)(obj, paths);
30
57
  const remainder = (0, _lodash.omit)(obj, paths);
@@ -154,6 +181,7 @@ class ObjPath {
154
181
  }).join("");
155
182
  }
156
183
  constructor(parts = []){
184
+ _define_property(this, "parts", void 0);
157
185
  this.parts = [
158
186
  ...parts
159
187
  ];
@@ -9,19 +9,35 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- PageAction: ()=>PageAction,
13
- MAX_PAGINATION_LIMIT: ()=>MAX_PAGINATION_LIMIT,
14
- pageFlags: ()=>pageFlags,
15
- toPageParams: ()=>toPageParams,
16
- maybePromptPageAction: ()=>maybePromptPageAction,
17
- paramsForPageAction: ()=>paramsForPageAction,
18
- formatPageActionPrompt: ()=>formatPageActionPrompt,
19
- validatePageActionInput: ()=>validatePageActionInput
12
+ MAX_PAGINATION_LIMIT: function() {
13
+ return MAX_PAGINATION_LIMIT;
14
+ },
15
+ PageAction: function() {
16
+ return PageAction;
17
+ },
18
+ formatPageActionPrompt: function() {
19
+ return formatPageActionPrompt;
20
+ },
21
+ maybePromptPageAction: function() {
22
+ return maybePromptPageAction;
23
+ },
24
+ pageFlags: function() {
25
+ return pageFlags;
26
+ },
27
+ paramsForPageAction: function() {
28
+ return paramsForPageAction;
29
+ },
30
+ toPageParams: function() {
31
+ return toPageParams;
32
+ },
33
+ validatePageActionInput: function() {
34
+ return validatePageActionInput;
35
+ }
20
36
  });
21
37
  const _core = require("@oclif/core");
22
- const _enquirer = /*#__PURE__*/ _interopRequireDefault(require("enquirer"));
38
+ const _enquirer = /*#__PURE__*/ _interop_require_default(require("enquirer"));
23
39
  const _lodash = require("lodash");
24
- function _interopRequireDefault(obj) {
40
+ function _interop_require_default(obj) {
25
41
  return obj && obj.__esModule ? obj : {
26
42
  default: obj
27
43
  };
@@ -52,8 +68,8 @@ var PageAction;
52
68
  * e.g. [p: preview, n: next]
53
69
  */ const formatPageActionPrompt = (pageInfo)=>{
54
70
  const options = [
55
- pageInfo.before && `${PageAction.Previous}: previous page`,
56
- pageInfo.after && `${PageAction.Next}: next page`
71
+ pageInfo.before && `${"p"}: previous page`,
72
+ pageInfo.after && `${"n"}: next page`
57
73
  ].filter((x)=>x);
58
74
  return options.length > 0 ? `[${options.join(", ")}]` : undefined;
59
75
  };
@@ -62,11 +78,11 @@ var PageAction;
62
78
  * return if valid.
63
79
  */ const validatePageActionInput = (input, pageInfo)=>{
64
80
  const val = input.toLowerCase().trim();
65
- if (pageInfo.after && val === PageAction.Next) {
66
- return PageAction.Next;
81
+ if (pageInfo.after && val === "n") {
82
+ return "n";
67
83
  }
68
- if (pageInfo.before && val === PageAction.Previous) {
69
- return PageAction.Previous;
84
+ if (pageInfo.before && val === "p") {
85
+ return "p";
70
86
  }
71
87
  };
72
88
  const maybePromptPageAction = async (pageInfo)=>{
@@ -86,11 +102,11 @@ const maybePromptPageAction = async (pageInfo)=>{
86
102
  };
87
103
  const paramsForPageAction = (pageAction, pageInfo)=>{
88
104
  switch(pageAction){
89
- case PageAction.Previous:
105
+ case "p":
90
106
  return {
91
107
  before: pageInfo.before
92
108
  };
93
- case PageAction.Next:
109
+ case "n":
94
110
  return {
95
111
  after: pageInfo.after
96
112
  };
@@ -9,19 +9,25 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- isSuccessResp: ()=>isSuccessResp,
13
- formatErrorRespMessage: ()=>formatErrorRespMessage,
14
- withSpinner: ()=>withSpinner
12
+ formatErrorRespMessage: function() {
13
+ return formatErrorRespMessage;
14
+ },
15
+ isSuccessResp: function() {
16
+ return isSuccessResp;
17
+ },
18
+ withSpinner: function() {
19
+ return withSpinner;
20
+ }
15
21
  });
16
22
  const _core = require("@oclif/core");
17
23
  const _error = require("./error");
18
24
  const _ux = require("./ux");
19
25
  const isSuccessResp = (resp)=>resp.status >= 200 && resp.status < 300;
20
- const formatErrorRespMessage = ({ status , data })=>{
26
+ const formatErrorRespMessage = ({ status, data })=>{
21
27
  if (status === 500) {
22
28
  return "An internal server error occurred";
23
29
  }
24
- const { message , errors =[] } = data;
30
+ const { message, errors = [] } = data;
25
31
  if (status >= 400) {
26
32
  const errs = errors.map((e)=>new _error.JsonDataError(e.message, e.field));
27
33
  return errs.length === 0 ? message : message + "\n\n" + (0, _error.formatErrors)(errs, {
@@ -31,7 +37,7 @@ const formatErrorRespMessage = ({ status , data })=>{
31
37
  return message;
32
38
  };
33
39
  const withSpinner = async (requestFn, opts = {})=>{
34
- const { action ="‣ Loading" , ensureSuccess =true } = opts;
40
+ const { action = "‣ Loading", ensureSuccess = true } = opts;
35
41
  // Suppress printing the spinner in tests, oclif doesn't for some reasons.
36
42
  _ux.spinner.start(action);
37
43
  const resp = await requestFn();
@@ -11,17 +11,21 @@ function _export(target, all) {
11
11
  });
12
12
  }
13
13
  _export(exports, {
14
- checkSlugifiedFormat: ()=>checkSlugifiedFormat,
15
- indentString: ()=>indentString
14
+ checkSlugifiedFormat: function() {
15
+ return checkSlugifiedFormat;
16
+ },
17
+ indentString: function() {
18
+ return indentString;
19
+ }
16
20
  });
17
21
  const SLUG_FORMAT_RE = /^[\w-]+$/;
18
22
  const SLUG_LOWERCASE_FORMAT_RE = /^[\d_a-z-]+$/;
19
23
  const checkSlugifiedFormat = (input, opts = {})=>{
20
- const { onlyLowerCase =true } = opts;
24
+ const { onlyLowerCase = true } = opts;
21
25
  return onlyLowerCase ? SLUG_LOWERCASE_FORMAT_RE.test(input) : SLUG_FORMAT_RE.test(input);
22
26
  };
23
27
  const indentString = (string, count = 0, options = {})=>{
24
- const { indent =" " , includeEmptyLines =false } = options;
28
+ const { indent = " ", includeEmptyLines = false } = options;
25
29
  if (typeof string !== "string") {
26
30
  throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof string}\``);
27
31
  }
@@ -9,20 +9,24 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- promptToConfirm: ()=>promptToConfirm,
13
- spinner: ()=>spinner
12
+ promptToConfirm: function() {
13
+ return promptToConfirm;
14
+ },
15
+ spinner: function() {
16
+ return spinner;
17
+ }
14
18
  });
15
19
  const _core = require("@oclif/core");
16
- const _enquirer = /*#__PURE__*/ _interopRequireDefault(require("enquirer"));
20
+ const _enquirer = /*#__PURE__*/ _interop_require_default(require("enquirer"));
17
21
  const _const = require("./const");
18
- function _interopRequireDefault(obj) {
22
+ function _interop_require_default(obj) {
19
23
  return obj && obj.__esModule ? obj : {
20
24
  default: obj
21
25
  };
22
26
  }
23
27
  const promptToConfirm = async (message)=>{
24
28
  try {
25
- const { input } = await _enquirer.default.prompt({
29
+ const { input } = await _enquirer.default.prompt({
26
30
  type: "confirm",
27
31
  name: "input",
28
32
  message
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "formatCommitAuthor", {
6
6
  enumerable: true,
7
- get: ()=>formatCommitAuthor
7
+ get: function() {
8
+ return formatCommitAuthor;
9
+ }
8
10
  });
9
11
  function formatCommitAuthor(commit) {
10
12
  const email = commit.author.email;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./helpers"), exports);
6
+ _export_star(require("./types"), exports);
7
+ function _export_star(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
+ Object.defineProperty(to, k, {
11
+ enumerable: true,
12
+ get: function() {
13
+ return from[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ return from;
19
+ }
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "formatConditions", {
6
6
  enumerable: true,
7
- get: ()=>formatConditions
7
+ get: function() {
8
+ return formatConditions;
9
+ }
8
10
  });
9
11
  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 })=>{
12
+ const formatNestedConditions = (nestedConds, joinedBy, appendedBy = "")=>nestedConds.map(({ any, all })=>{
11
13
  if (any) return formatConditionsList(any, "or");
12
14
  if (all) return formatConditionsList(all, "and");
13
15
  throw new Error(`Invalid nested conditions: ${nestedConds}`);
14
16
  }).join(`\n ${joinedBy.toUpperCase()}\n`) + appendedBy;
15
17
  const formatConditions = (conditions)=>{
16
- const { any , all } = conditions;
18
+ const { any, all } = conditions;
17
19
  if (any) {
18
20
  const [condition] = any;
19
21
  return "variable" in condition ? formatConditionsList(any, "or", "\n") : formatNestedConditions(any, "or", "\n");
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./helpers"), exports);
6
+ _export_star(require("./types"), exports);
7
+ function _export_star(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
+ Object.defineProperty(to, k, {
11
+ enumerable: true,
12
+ get: function() {
13
+ return from[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ return from;
19
+ }
@@ -9,15 +9,23 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- emailLayoutJsonPath: ()=>emailLayoutJsonPath,
13
- isEmailLayoutDir: ()=>isEmailLayoutDir,
14
- lsEmailLayoutJson: ()=>lsEmailLayoutJson,
15
- ensureValidCommandTarget: ()=>ensureValidCommandTarget
12
+ emailLayoutJsonPath: function() {
13
+ return emailLayoutJsonPath;
14
+ },
15
+ ensureValidCommandTarget: function() {
16
+ return ensureValidCommandTarget;
17
+ },
18
+ isEmailLayoutDir: function() {
19
+ return isEmailLayoutDir;
20
+ },
21
+ lsEmailLayoutJson: function() {
22
+ return lsEmailLayoutJson;
23
+ }
16
24
  });
17
- const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
25
+ const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
18
26
  const _core = require("@oclif/core");
19
- const _fsExtra = /*#__PURE__*/ _interopRequireWildcard(require("fs-extra"));
20
- const _processorIsomorphic = require("./processor.isomorphic");
27
+ const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
28
+ const _processorisomorphic = require("./processor.isomorphic");
21
29
  function _getRequireWildcardCache(nodeInterop) {
22
30
  if (typeof WeakMap !== "function") return null;
23
31
  var cacheBabelInterop = new WeakMap();
@@ -26,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) {
26
34
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
35
  })(nodeInterop);
28
36
  }
29
- function _interopRequireWildcard(obj, nodeInterop) {
37
+ function _interop_require_wildcard(obj, nodeInterop) {
30
38
  if (!nodeInterop && obj && obj.__esModule) {
31
39
  return obj;
32
40
  }
@@ -39,7 +47,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
39
47
  if (cache && cache.has(obj)) {
40
48
  return cache.get(obj);
41
49
  }
42
- var newObj = {};
50
+ var newObj = {
51
+ __proto__: null
52
+ };
43
53
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
54
  for(var key in obj){
45
55
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -57,16 +67,16 @@ function _interopRequireWildcard(obj, nodeInterop) {
57
67
  }
58
68
  return newObj;
59
69
  }
60
- const emailLayoutJsonPath = (layoutDirCtx)=>_nodePath.resolve(layoutDirCtx.abspath, _processorIsomorphic.LAYOUT_JSON);
70
+ const emailLayoutJsonPath = (layoutDirCtx)=>_nodepath.resolve(layoutDirCtx.abspath, _processorisomorphic.LAYOUT_JSON);
61
71
  const isEmailLayoutDir = async (dirPath)=>Boolean(await lsEmailLayoutJson(dirPath));
62
72
  const lsEmailLayoutJson = async (dirPath)=>{
63
- const emailLayoutJsonPath = _nodePath.resolve(dirPath, _processorIsomorphic.LAYOUT_JSON);
64
- const exists = await _fsExtra.pathExists(emailLayoutJsonPath);
73
+ const emailLayoutJsonPath = _nodepath.resolve(dirPath, _processorisomorphic.LAYOUT_JSON);
74
+ const exists = await _fsextra.pathExists(emailLayoutJsonPath);
65
75
  return exists ? emailLayoutJsonPath : undefined;
66
76
  };
67
77
  const ensureValidCommandTarget = async (props, runContext)=>{
68
- const { args , flags } = props;
69
- const { commandId , resourceDir: resourceDirCtx , cwd: runCwd } = runContext;
78
+ const { args, flags } = props;
79
+ const { commandId, resourceDir: resourceDirCtx, cwd: runCwd } = runContext;
70
80
  // If the target resource is a different type than the current resource dir
71
81
  // type, error out.
72
82
  if (resourceDirCtx && resourceDirCtx.type !== "email_layout") {
@@ -99,7 +109,7 @@ const ensureValidCommandTarget = async (props, runContext)=>{
99
109
  if (resourceDirCtx && resourceDirCtx.key !== args.emailLayoutKey) {
100
110
  return _core.ux.error(`Cannot run ${commandId} \`${args.emailLayoutKey}\` inside another layout directory:\n${resourceDirCtx.key}`);
101
111
  }
102
- const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodePath.resolve(runCwd, args.emailLayoutKey);
112
+ const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodepath.resolve(runCwd, args.emailLayoutKey);
103
113
  const layoutDirCtx = {
104
114
  type: "email_layout",
105
115
  key: args.emailLayoutKey,
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./helpers"), exports);
6
+ _export_star(require("./processor.isomorphic"), exports);
7
+ _export_star(require("./reader"), exports);
8
+ _export_star(require("./types"), exports);
9
+ _export_star(require("./writer"), exports);
10
+ function _export_star(from, to) {
11
+ Object.keys(from).forEach(function(k) {
12
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
13
+ Object.defineProperty(to, k, {
14
+ enumerable: true,
15
+ get: function() {
16
+ return from[k];
17
+ }
18
+ });
19
+ }
20
+ });
21
+ return from;
22
+ }
@@ -9,13 +9,19 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- LAYOUT_JSON: ()=>LAYOUT_JSON,
13
- buildEmailLayoutDirBundle: ()=>buildEmailLayoutDirBundle,
14
- toEmailLayoutJson: ()=>toEmailLayoutJson
12
+ LAYOUT_JSON: function() {
13
+ return LAYOUT_JSON;
14
+ },
15
+ buildEmailLayoutDirBundle: function() {
16
+ return buildEmailLayoutDirBundle;
17
+ },
18
+ toEmailLayoutJson: function() {
19
+ return toEmailLayoutJson;
20
+ }
15
21
  });
16
22
  const _lodash = require("lodash");
17
- const _objectIsomorphic = require("../../helpers/object.isomorphic");
18
- const _constIsomorphic = require("../shared/const.isomorphic");
23
+ const _objectisomorphic = require("../../helpers/object.isomorphic");
24
+ const _constisomorphic = require("../shared/const.isomorphic");
19
25
  const LAYOUT_JSON = "layout.json";
20
26
  /*
21
27
  * Sanitize the email layout content into a format that's appropriate for reading
@@ -25,13 +31,13 @@ const LAYOUT_JSON = "layout.json";
25
31
  var _emailLayout___annotation;
26
32
  // Move read only field under the dedicated field "__readonly".
27
33
  const readonlyFields = ((_emailLayout___annotation = emailLayout.__annotation) === null || _emailLayout___annotation === void 0 ? void 0 : _emailLayout___annotation.readonly_fields) || [];
28
- const [readonly, remainder] = (0, _objectIsomorphic.split)(emailLayout, readonlyFields);
34
+ const [readonly, remainder] = (0, _objectisomorphic.split)(emailLayout, readonlyFields);
29
35
  const emailLayoutjson = {
30
36
  ...remainder,
31
37
  __readonly: readonly
32
38
  };
33
39
  // Strip out all schema annotations, so not to expose them to end users.
34
- return (0, _objectIsomorphic.omitDeep)(emailLayoutjson, [
40
+ return (0, _objectisomorphic.omitDeep)(emailLayoutjson, [
35
41
  "__annotation"
36
42
  ]);
37
43
  };
@@ -65,9 +71,9 @@ const buildEmailLayoutDirBundle = (remoteEmailLayout, localEmailLayout = {})=>{
65
71
  if (!(0, _lodash.has)(mutRemoteEmailLayout, objPathParts)) continue;
66
72
  // If the field at this path is extracted in the local layout, then
67
73
  // always extract; otherwise extract based on the field settings default.
68
- const objPathStr = _objectIsomorphic.ObjPath.stringify(objPathParts);
69
- const extractedFilePath = (0, _lodash.get)(localEmailLayout, `${objPathStr}${_constIsomorphic.FILEPATH_MARKER}`);
70
- const { default: extractByDefault , file_ext: fileExt } = extractionSettings;
74
+ const objPathStr = _objectisomorphic.ObjPath.stringify(objPathParts);
75
+ const extractedFilePath = (0, _lodash.get)(localEmailLayout, `${objPathStr}${_constisomorphic.FILEPATH_MARKER}`);
76
+ const { default: extractByDefault, file_ext: fileExt } = extractionSettings;
71
77
  if (!extractedFilePath && !extractByDefault) continue;
72
78
  // By this point, we have a field where we need to extract its content.
73
79
  const data = (0, _lodash.get)(mutRemoteEmailLayout, objPathParts);
@@ -82,7 +88,7 @@ const buildEmailLayoutDirBundle = (remoteEmailLayout, localEmailLayout = {})=>{
82
88
  (0, _lodash.set)(bundle, [
83
89
  relpath
84
90
  ], data);
85
- (0, _lodash.set)(mutRemoteEmailLayout, `${objPathStr}${_constIsomorphic.FILEPATH_MARKER}`, relpath);
91
+ (0, _lodash.set)(mutRemoteEmailLayout, `${objPathStr}${_constisomorphic.FILEPATH_MARKER}`, relpath);
86
92
  (0, _lodash.unset)(mutRemoteEmailLayout, objPathStr);
87
93
  }
88
94
  // At this point the bundle contains all extractable files, so we finally add