@knocklabs/cli 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +416 -9
- package/dist/commands/layout/get.js +98 -0
- package/dist/commands/layout/list.js +86 -0
- package/dist/commands/layout/pull.js +199 -0
- package/dist/commands/layout/push.js +159 -0
- package/dist/commands/layout/validate.js +134 -0
- package/dist/commands/workflow/get.js +39 -7
- package/dist/commands/workflow/list.js +4 -1
- package/dist/commands/workflow/run.js +6 -8
- package/dist/lib/api-v1.js +51 -2
- package/dist/lib/helpers/flag.js +19 -1
- package/dist/lib/helpers/json.js +9 -0
- package/dist/lib/marshal/email-layout/helpers.js +124 -0
- package/dist/lib/marshal/email-layout/index.js +19 -0
- package/dist/lib/marshal/email-layout/reader.js +193 -0
- package/dist/lib/marshal/email-layout/types.js +4 -0
- package/dist/lib/marshal/email-layout/writer.js +240 -0
- package/dist/lib/marshal/shared/helpers.js +135 -0
- package/dist/lib/marshal/workflow/generator.js +4 -2
- package/dist/lib/marshal/workflow/helpers.js +41 -6
- package/dist/lib/marshal/workflow/reader.js +8 -106
- package/dist/lib/marshal/workflow/types.js +2 -0
- package/dist/lib/marshal/workflow/writer.js +76 -40
- package/dist/lib/run-context/loader.js +11 -0
- package/oclif.manifest.json +338 -7
- package/package.json +13 -10
|
@@ -23,8 +23,10 @@ const _lodash = require("lodash");
|
|
|
23
23
|
const _const = require("../../helpers/const");
|
|
24
24
|
const _json = require("../../helpers/json");
|
|
25
25
|
const _object = require("../../helpers/object");
|
|
26
|
-
const _helpers = require("
|
|
26
|
+
const _helpers = require("../shared/helpers");
|
|
27
|
+
const _helpers1 = require("./helpers");
|
|
27
28
|
const _reader = require("./reader");
|
|
29
|
+
const _types = require("./types");
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) {
|
|
29
31
|
if (typeof WeakMap !== "function") return null;
|
|
30
32
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -121,6 +123,9 @@ const formatExtractedFilePath = (objPathParts, fileExt, opts = {})=>{
|
|
|
121
123
|
];
|
|
122
124
|
return _nodePath.join(...paths).toLowerCase();
|
|
123
125
|
};
|
|
126
|
+
const NON_RECURSIVELY_TRAVERSABLE_FIELDS_FOR_EXTRACTION = new Set([
|
|
127
|
+
"branches"
|
|
128
|
+
]);
|
|
124
129
|
const compileExtractionSettings = (node, objPathParts = [])=>{
|
|
125
130
|
const map = new Map();
|
|
126
131
|
const compileRecursively = (item, parts)=>{
|
|
@@ -138,10 +143,14 @@ const compileExtractionSettings = (node, objPathParts = [])=>{
|
|
|
138
143
|
key
|
|
139
144
|
], extractableFields[key]);
|
|
140
145
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
// Recursively exam current field for any additionally extractable data
|
|
147
|
+
// within, except for disallowed fields
|
|
148
|
+
if (!NON_RECURSIVELY_TRAVERSABLE_FIELDS_FOR_EXTRACTION.has(key)) {
|
|
149
|
+
compileRecursively(val, [
|
|
150
|
+
...parts,
|
|
151
|
+
key
|
|
152
|
+
]);
|
|
153
|
+
}
|
|
145
154
|
}
|
|
146
155
|
return;
|
|
147
156
|
}
|
|
@@ -167,35 +176,23 @@ const compileExtractionSettings = (node, objPathParts = [])=>{
|
|
|
167
176
|
return 0;
|
|
168
177
|
}));
|
|
169
178
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* The way this function works and handles the content extraction is by:
|
|
188
|
-
* 1. Traversing the given step node, and compiling all annotated extraction
|
|
189
|
-
* settings by the object path in the node *ordered from leaf to root*.
|
|
190
|
-
* 2. Iterate over compiled extraction settings from leaf to root, and start
|
|
191
|
-
* extracting out the field as needed. In case the node that needs to be
|
|
192
|
-
* extracted out contains extracted file paths, then those file paths get
|
|
193
|
-
* rebased to relative to the referenced file.
|
|
194
|
-
*/ const buildWorkflowDirBundle = (remoteWorkflow, localWorkflow = {})=>{
|
|
195
|
-
const bundle = {};
|
|
196
|
-
const mutWorkflow = (0, _lodash.cloneDeep)(remoteWorkflow);
|
|
197
|
-
const localWorkflowStepsByRef = (0, _lodash.keyBy)(localWorkflow.steps || [], "ref");
|
|
198
|
-
for (const step of mutWorkflow.steps){
|
|
179
|
+
const keyLocalWorkflowStepsByRef = (steps, result = {})=>{
|
|
180
|
+
if (!Array.isArray(steps)) return result;
|
|
181
|
+
for (const step of steps){
|
|
182
|
+
if (!(0, _lodash.isPlainObject)(step)) continue;
|
|
183
|
+
if (!step.ref) continue;
|
|
184
|
+
result[step.ref] = step;
|
|
185
|
+
if (step.type === _types.StepType.Branch && Array.isArray(step.branches)) {
|
|
186
|
+
for (const branch of step.branches){
|
|
187
|
+
if (!(0, _lodash.isPlainObject)(branch)) continue;
|
|
188
|
+
result = keyLocalWorkflowStepsByRef(branch.steps, result);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
};
|
|
194
|
+
const recursivelyBuildWorkflowDirBundle = (bundle, steps, localWorkflowStepsByRef)=>{
|
|
195
|
+
for (const step of steps){
|
|
199
196
|
// A compiled map of extraction settings of every field in the step where
|
|
200
197
|
// we support content extraction, organized by each field's object path.
|
|
201
198
|
const compiledExtractionSettings = compileExtractionSettings(step);
|
|
@@ -217,7 +214,7 @@ const compileExtractionSettings = (node, objPathParts = [])=>{
|
|
|
217
214
|
// First figure out the relative file path (within the workflow directory)
|
|
218
215
|
// for the extracted file. If already extracted in the local workflow,
|
|
219
216
|
// then use that; otherwise format a new file path.
|
|
220
|
-
const relpath = extractedFilePath
|
|
217
|
+
const relpath = typeof extractedFilePath === "string" ? extractedFilePath : formatExtractedFilePath(objPathParts, fileExt, {
|
|
221
218
|
unnestDirsBy: 1,
|
|
222
219
|
nestIntoDirs: [
|
|
223
220
|
step.ref
|
|
@@ -242,6 +239,7 @@ const compileExtractionSettings = (node, objPathParts = [])=>{
|
|
|
242
239
|
// bundle for writing to the file system later. Then replace the field
|
|
243
240
|
// content with the extracted file path and mark the field as extracted
|
|
244
241
|
// with @ suffix.
|
|
242
|
+
//
|
|
245
243
|
// TODO: Consider guarding against an edge case, and check if the relpath
|
|
246
244
|
// already exists in the bundle, and if so make the relpath unique.
|
|
247
245
|
(0, _lodash.set)(bundle, [
|
|
@@ -250,10 +248,48 @@ const compileExtractionSettings = (node, objPathParts = [])=>{
|
|
|
250
248
|
(0, _lodash.set)(step, `${objPathStr}${_helpers.FILEPATH_MARKER}`, relpath);
|
|
251
249
|
(0, _lodash.unset)(step, objPathParts);
|
|
252
250
|
}
|
|
251
|
+
// Lastly, recurse thru any branches that exist in the workflow tree
|
|
252
|
+
if (step.type === _types.StepType.Branch) {
|
|
253
|
+
for (const branch of step.branches){
|
|
254
|
+
recursivelyBuildWorkflowDirBundle(bundle, branch.steps, localWorkflowStepsByRef);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
253
257
|
}
|
|
254
|
-
|
|
258
|
+
};
|
|
259
|
+
/*
|
|
260
|
+
* For a given workflow payload (and its local workflow reference), this function
|
|
261
|
+
* builds a "workflow directory bundle", which is an obj made up of all the
|
|
262
|
+
* relative file paths (within the workflow directory) and its file content to
|
|
263
|
+
* write the workflow directory.
|
|
264
|
+
*
|
|
265
|
+
* Every workflow will always have a workflow.json file, so every bundle includes
|
|
266
|
+
* it and its content at minimum. To the extent the workflow includes any
|
|
267
|
+
* extractable fields, those fields content get extracted out and added to the
|
|
268
|
+
* bundle.
|
|
269
|
+
*
|
|
270
|
+
* Important things to keep in mind re: content extraction:
|
|
271
|
+
* 1. There can be multiple places in workflow json where content extraction
|
|
272
|
+
* happens.
|
|
273
|
+
* 2. There can be multiple levels of content extraction happening, currently
|
|
274
|
+
* at a maximum of 2 levels.
|
|
275
|
+
*
|
|
276
|
+
* The way this function works and handles the content extraction is by:
|
|
277
|
+
* 1. Traversing the given step node, and compiling all annotated extraction
|
|
278
|
+
* settings by the object path in the node *ordered from leaf to root*.
|
|
279
|
+
* 2. Iterate over compiled extraction settings from leaf to root, and start
|
|
280
|
+
* extracting out the field as needed. In case the node that needs to be
|
|
281
|
+
* extracted out contains extracted file paths, then those file paths get
|
|
282
|
+
* rebased to relative to the referenced file.
|
|
283
|
+
*/ const buildWorkflowDirBundle = (remoteWorkflow, localWorkflow = {})=>{
|
|
284
|
+
const bundle = {};
|
|
285
|
+
const mutWorkflow = (0, _lodash.cloneDeep)(remoteWorkflow);
|
|
286
|
+
const localWorkflowStepsByRef = keyLocalWorkflowStepsByRef(localWorkflow.steps);
|
|
287
|
+
// Recursively traverse the workflow step tree, mutating it and the bundle
|
|
288
|
+
// along the way
|
|
289
|
+
recursivelyBuildWorkflowDirBundle(bundle, mutWorkflow.steps, localWorkflowStepsByRef);
|
|
290
|
+
// Then, prepare the workflow data to be written into a workflow json file.
|
|
255
291
|
return (0, _lodash.set)(bundle, [
|
|
256
|
-
|
|
292
|
+
_helpers1.WORKFLOW_JSON
|
|
257
293
|
], toWorkflowJson(mutWorkflow));
|
|
258
294
|
};
|
|
259
295
|
const writeWorkflowDirFromData = async (workflowDirCtx, remoteWorkflow)=>{
|
|
@@ -274,7 +310,7 @@ const writeWorkflowDirFromBundle = async (workflowDirCtx, workflowDirBundle)=>{
|
|
|
274
310
|
}
|
|
275
311
|
const promises = Object.entries(workflowDirBundle).map(([relpath, fileContent])=>{
|
|
276
312
|
const filePath = _nodePath.resolve(workflowDirCtx.abspath, relpath);
|
|
277
|
-
return relpath ===
|
|
313
|
+
return relpath === _helpers1.WORKFLOW_JSON ? _fsExtra.outputJson(filePath, fileContent, {
|
|
278
314
|
spaces: _json.DOUBLE_SPACES
|
|
279
315
|
}) : _fsExtra.outputFile(filePath, fileContent);
|
|
280
316
|
});
|
|
@@ -310,7 +346,7 @@ const writeWorkflowDirFromBundle = async (workflowDirCtx, workflowDirBundle)=>{
|
|
|
310
346
|
const promises = dirents.map(async (dirent)=>{
|
|
311
347
|
const direntName = dirent.name.toLowerCase();
|
|
312
348
|
const direntPath = _nodePath.resolve(indexDirCtx.abspath, direntName);
|
|
313
|
-
if (await (0,
|
|
349
|
+
if (await (0, _helpers1.isWorkflowDir)(direntPath) && workflowsByKey[direntName]) {
|
|
314
350
|
return;
|
|
315
351
|
}
|
|
316
352
|
await _fsExtra.remove(direntPath);
|
|
@@ -333,7 +369,7 @@ const writeWorkflowsIndexDir = async (indexDirCtx, remoteWorkflows)=>{
|
|
|
333
369
|
type: "workflow",
|
|
334
370
|
key: workflow.key,
|
|
335
371
|
abspath: workflowDirPath,
|
|
336
|
-
exists: indexDirCtx.exists ? await (0,
|
|
372
|
+
exists: indexDirCtx.exists ? await (0, _helpers1.isWorkflowDir)(workflowDirPath) : false
|
|
337
373
|
};
|
|
338
374
|
return writeWorkflowDirFromData(workflowDirCtx, workflow);
|
|
339
375
|
});
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "load", {
|
|
|
11
11
|
get: ()=>load
|
|
12
12
|
});
|
|
13
13
|
const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
|
|
14
|
+
const _emailLayout = /*#__PURE__*/ _interopRequireWildcard(require("../marshal/email-layout"));
|
|
14
15
|
const _translation = /*#__PURE__*/ _interopRequireWildcard(require("../marshal/translation"));
|
|
15
16
|
const _workflow = /*#__PURE__*/ _interopRequireWildcard(require("../marshal/workflow"));
|
|
16
17
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -63,6 +64,16 @@ const evaluateRecursively = async (ctx, currDir)=>{
|
|
|
63
64
|
exists: true
|
|
64
65
|
};
|
|
65
66
|
}
|
|
67
|
+
// Check if we are inside a layout directory, and if so update the context.
|
|
68
|
+
const isEmailLayoutDir = await _emailLayout.isEmailLayoutDir(currDir);
|
|
69
|
+
if (!ctx.resourceDir && isEmailLayoutDir) {
|
|
70
|
+
ctx.resourceDir = {
|
|
71
|
+
type: "email_layout",
|
|
72
|
+
key: _nodePath.basename(currDir),
|
|
73
|
+
abspath: currDir,
|
|
74
|
+
exists: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
66
77
|
// NOTE: Must keep this check as last in the order of directory-type checks
|
|
67
78
|
// since the `isTranslationDir` only checks that the directory name is a
|
|
68
79
|
// valid locale name.
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.5",
|
|
3
3
|
"commands": {
|
|
4
4
|
"knock": {
|
|
5
5
|
"id": "knock",
|
|
@@ -174,6 +174,338 @@
|
|
|
174
174
|
},
|
|
175
175
|
"args": {}
|
|
176
176
|
},
|
|
177
|
+
"layout:get": {
|
|
178
|
+
"id": "layout:get",
|
|
179
|
+
"summary": "Display a single email layout from an environment.",
|
|
180
|
+
"strict": true,
|
|
181
|
+
"pluginName": "@knocklabs/cli",
|
|
182
|
+
"pluginAlias": "@knocklabs/cli",
|
|
183
|
+
"pluginType": "core",
|
|
184
|
+
"aliases": [
|
|
185
|
+
"email-layout:get",
|
|
186
|
+
"email_layout:get"
|
|
187
|
+
],
|
|
188
|
+
"flags": {
|
|
189
|
+
"service-token": {
|
|
190
|
+
"name": "service-token",
|
|
191
|
+
"type": "option",
|
|
192
|
+
"summary": "The service token to authenticate with.",
|
|
193
|
+
"required": true,
|
|
194
|
+
"multiple": false
|
|
195
|
+
},
|
|
196
|
+
"api-origin": {
|
|
197
|
+
"name": "api-origin",
|
|
198
|
+
"type": "option",
|
|
199
|
+
"hidden": true,
|
|
200
|
+
"required": false,
|
|
201
|
+
"multiple": false
|
|
202
|
+
},
|
|
203
|
+
"environment": {
|
|
204
|
+
"name": "environment",
|
|
205
|
+
"type": "option",
|
|
206
|
+
"summary": "The environment to use.",
|
|
207
|
+
"multiple": false,
|
|
208
|
+
"default": "development"
|
|
209
|
+
},
|
|
210
|
+
"hide-uncommitted-changes": {
|
|
211
|
+
"name": "hide-uncommitted-changes",
|
|
212
|
+
"type": "boolean",
|
|
213
|
+
"summary": "Hide any uncommitted changes.",
|
|
214
|
+
"allowNo": false
|
|
215
|
+
},
|
|
216
|
+
"json": {
|
|
217
|
+
"name": "json",
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"description": "Format output as json.",
|
|
220
|
+
"helpGroup": "GLOBAL",
|
|
221
|
+
"allowNo": false
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"args": {
|
|
225
|
+
"emailLayoutKey": {
|
|
226
|
+
"name": "emailLayoutKey",
|
|
227
|
+
"required": true
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"layout:list": {
|
|
232
|
+
"id": "layout:list",
|
|
233
|
+
"summary": "Display all email layouts for an environment.",
|
|
234
|
+
"strict": true,
|
|
235
|
+
"pluginName": "@knocklabs/cli",
|
|
236
|
+
"pluginAlias": "@knocklabs/cli",
|
|
237
|
+
"pluginType": "core",
|
|
238
|
+
"aliases": [
|
|
239
|
+
"email-layout:list",
|
|
240
|
+
"email_layout:list"
|
|
241
|
+
],
|
|
242
|
+
"flags": {
|
|
243
|
+
"service-token": {
|
|
244
|
+
"name": "service-token",
|
|
245
|
+
"type": "option",
|
|
246
|
+
"summary": "The service token to authenticate with.",
|
|
247
|
+
"required": true,
|
|
248
|
+
"multiple": false
|
|
249
|
+
},
|
|
250
|
+
"api-origin": {
|
|
251
|
+
"name": "api-origin",
|
|
252
|
+
"type": "option",
|
|
253
|
+
"hidden": true,
|
|
254
|
+
"required": false,
|
|
255
|
+
"multiple": false
|
|
256
|
+
},
|
|
257
|
+
"environment": {
|
|
258
|
+
"name": "environment",
|
|
259
|
+
"type": "option",
|
|
260
|
+
"summary": "The environment to use.",
|
|
261
|
+
"multiple": false,
|
|
262
|
+
"default": "development"
|
|
263
|
+
},
|
|
264
|
+
"hide-uncommitted-changes": {
|
|
265
|
+
"name": "hide-uncommitted-changes",
|
|
266
|
+
"type": "boolean",
|
|
267
|
+
"summary": "Hide any uncommitted changes.",
|
|
268
|
+
"allowNo": false
|
|
269
|
+
},
|
|
270
|
+
"after": {
|
|
271
|
+
"name": "after",
|
|
272
|
+
"type": "option",
|
|
273
|
+
"summary": "The cursor after which to fetch the next page.",
|
|
274
|
+
"multiple": false
|
|
275
|
+
},
|
|
276
|
+
"before": {
|
|
277
|
+
"name": "before",
|
|
278
|
+
"type": "option",
|
|
279
|
+
"summary": "The cursor before which to fetch the previous page.",
|
|
280
|
+
"multiple": false
|
|
281
|
+
},
|
|
282
|
+
"limit": {
|
|
283
|
+
"name": "limit",
|
|
284
|
+
"type": "option",
|
|
285
|
+
"summary": "The total number of entries to fetch per page.",
|
|
286
|
+
"multiple": false
|
|
287
|
+
},
|
|
288
|
+
"json": {
|
|
289
|
+
"name": "json",
|
|
290
|
+
"type": "boolean",
|
|
291
|
+
"description": "Format output as json.",
|
|
292
|
+
"helpGroup": "GLOBAL",
|
|
293
|
+
"allowNo": false
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"args": {}
|
|
297
|
+
},
|
|
298
|
+
"layout:pull": {
|
|
299
|
+
"id": "layout:pull",
|
|
300
|
+
"summary": "Pull one or more email layouts from an environment into a local file system.",
|
|
301
|
+
"strict": true,
|
|
302
|
+
"pluginName": "@knocklabs/cli",
|
|
303
|
+
"pluginAlias": "@knocklabs/cli",
|
|
304
|
+
"pluginType": "core",
|
|
305
|
+
"aliases": [
|
|
306
|
+
"email-layout:pull",
|
|
307
|
+
"email_layout:pull"
|
|
308
|
+
],
|
|
309
|
+
"flags": {
|
|
310
|
+
"service-token": {
|
|
311
|
+
"name": "service-token",
|
|
312
|
+
"type": "option",
|
|
313
|
+
"summary": "The service token to authenticate with.",
|
|
314
|
+
"required": true,
|
|
315
|
+
"multiple": false
|
|
316
|
+
},
|
|
317
|
+
"api-origin": {
|
|
318
|
+
"name": "api-origin",
|
|
319
|
+
"type": "option",
|
|
320
|
+
"hidden": true,
|
|
321
|
+
"required": false,
|
|
322
|
+
"multiple": false
|
|
323
|
+
},
|
|
324
|
+
"environment": {
|
|
325
|
+
"name": "environment",
|
|
326
|
+
"type": "option",
|
|
327
|
+
"summary": "The environment to use.",
|
|
328
|
+
"multiple": false,
|
|
329
|
+
"default": "development"
|
|
330
|
+
},
|
|
331
|
+
"all": {
|
|
332
|
+
"name": "all",
|
|
333
|
+
"type": "boolean",
|
|
334
|
+
"summary": "Whether to pull all email layouts from the specified environment.",
|
|
335
|
+
"allowNo": false
|
|
336
|
+
},
|
|
337
|
+
"layouts-dir": {
|
|
338
|
+
"name": "layouts-dir",
|
|
339
|
+
"type": "option",
|
|
340
|
+
"summary": "The target directory path to pull all email layouts into.",
|
|
341
|
+
"multiple": false,
|
|
342
|
+
"dependsOn": [
|
|
343
|
+
"all"
|
|
344
|
+
],
|
|
345
|
+
"aliases": [
|
|
346
|
+
"email-layouts-dir"
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
"hide-uncommitted-changes": {
|
|
350
|
+
"name": "hide-uncommitted-changes",
|
|
351
|
+
"type": "boolean",
|
|
352
|
+
"summary": "Hide any uncommitted changes.",
|
|
353
|
+
"allowNo": false
|
|
354
|
+
},
|
|
355
|
+
"force": {
|
|
356
|
+
"name": "force",
|
|
357
|
+
"type": "boolean",
|
|
358
|
+
"summary": "Remove the confirmation prompt.",
|
|
359
|
+
"allowNo": false
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"args": {
|
|
363
|
+
"emailLayoutKey": {
|
|
364
|
+
"name": "emailLayoutKey",
|
|
365
|
+
"required": false
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"layout:push": {
|
|
370
|
+
"id": "layout:push",
|
|
371
|
+
"summary": "Push one or more email layouts from a local file system to Knock.",
|
|
372
|
+
"strict": true,
|
|
373
|
+
"pluginName": "@knocklabs/cli",
|
|
374
|
+
"pluginAlias": "@knocklabs/cli",
|
|
375
|
+
"pluginType": "core",
|
|
376
|
+
"aliases": [
|
|
377
|
+
"email-layout:push",
|
|
378
|
+
"email_layout:push"
|
|
379
|
+
],
|
|
380
|
+
"flags": {
|
|
381
|
+
"service-token": {
|
|
382
|
+
"name": "service-token",
|
|
383
|
+
"type": "option",
|
|
384
|
+
"summary": "The service token to authenticate with.",
|
|
385
|
+
"required": true,
|
|
386
|
+
"multiple": false
|
|
387
|
+
},
|
|
388
|
+
"api-origin": {
|
|
389
|
+
"name": "api-origin",
|
|
390
|
+
"type": "option",
|
|
391
|
+
"hidden": true,
|
|
392
|
+
"required": false,
|
|
393
|
+
"multiple": false
|
|
394
|
+
},
|
|
395
|
+
"environment": {
|
|
396
|
+
"name": "environment",
|
|
397
|
+
"type": "option",
|
|
398
|
+
"summary": "Pushing an email layout is only allowed in the development environment",
|
|
399
|
+
"multiple": false,
|
|
400
|
+
"options": [
|
|
401
|
+
"development"
|
|
402
|
+
],
|
|
403
|
+
"default": "development"
|
|
404
|
+
},
|
|
405
|
+
"all": {
|
|
406
|
+
"name": "all",
|
|
407
|
+
"type": "boolean",
|
|
408
|
+
"summary": "Whether to push all layouts from the target directory.",
|
|
409
|
+
"allowNo": false
|
|
410
|
+
},
|
|
411
|
+
"layouts-dir": {
|
|
412
|
+
"name": "layouts-dir",
|
|
413
|
+
"type": "option",
|
|
414
|
+
"summary": "The target directory path to find all layouts to push.",
|
|
415
|
+
"multiple": false,
|
|
416
|
+
"dependsOn": [
|
|
417
|
+
"all"
|
|
418
|
+
],
|
|
419
|
+
"aliases": [
|
|
420
|
+
"email-layouts-dir"
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
"commit": {
|
|
424
|
+
"name": "commit",
|
|
425
|
+
"type": "boolean",
|
|
426
|
+
"summary": "Push and commit the layout(s) at the same time",
|
|
427
|
+
"allowNo": false
|
|
428
|
+
},
|
|
429
|
+
"commit-message": {
|
|
430
|
+
"name": "commit-message",
|
|
431
|
+
"type": "option",
|
|
432
|
+
"char": "m",
|
|
433
|
+
"summary": "Use the given value as the commit message",
|
|
434
|
+
"multiple": false,
|
|
435
|
+
"dependsOn": [
|
|
436
|
+
"commit"
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"args": {
|
|
441
|
+
"emailLayoutKey": {
|
|
442
|
+
"name": "emailLayoutKey",
|
|
443
|
+
"required": false
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"layout:validate": {
|
|
448
|
+
"id": "layout:validate",
|
|
449
|
+
"summary": "Validate one or more layouts from a local file system.",
|
|
450
|
+
"strict": true,
|
|
451
|
+
"pluginName": "@knocklabs/cli",
|
|
452
|
+
"pluginAlias": "@knocklabs/cli",
|
|
453
|
+
"pluginType": "core",
|
|
454
|
+
"aliases": [
|
|
455
|
+
"email-layout:validate",
|
|
456
|
+
"email_layout:validate"
|
|
457
|
+
],
|
|
458
|
+
"flags": {
|
|
459
|
+
"service-token": {
|
|
460
|
+
"name": "service-token",
|
|
461
|
+
"type": "option",
|
|
462
|
+
"summary": "The service token to authenticate with.",
|
|
463
|
+
"required": true,
|
|
464
|
+
"multiple": false
|
|
465
|
+
},
|
|
466
|
+
"api-origin": {
|
|
467
|
+
"name": "api-origin",
|
|
468
|
+
"type": "option",
|
|
469
|
+
"hidden": true,
|
|
470
|
+
"required": false,
|
|
471
|
+
"multiple": false
|
|
472
|
+
},
|
|
473
|
+
"environment": {
|
|
474
|
+
"name": "environment",
|
|
475
|
+
"type": "option",
|
|
476
|
+
"summary": "Validating a layout is only done in the development environment",
|
|
477
|
+
"multiple": false,
|
|
478
|
+
"options": [
|
|
479
|
+
"development"
|
|
480
|
+
],
|
|
481
|
+
"default": "development"
|
|
482
|
+
},
|
|
483
|
+
"all": {
|
|
484
|
+
"name": "all",
|
|
485
|
+
"type": "boolean",
|
|
486
|
+
"summary": "Whether to validate all layouts from the target directory.",
|
|
487
|
+
"allowNo": false
|
|
488
|
+
},
|
|
489
|
+
"layouts-dir": {
|
|
490
|
+
"name": "layouts-dir",
|
|
491
|
+
"type": "option",
|
|
492
|
+
"summary": "The target directory path to find all layouts to validate.",
|
|
493
|
+
"multiple": false,
|
|
494
|
+
"dependsOn": [
|
|
495
|
+
"all"
|
|
496
|
+
],
|
|
497
|
+
"aliases": [
|
|
498
|
+
"email-layouts-dir"
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
"args": {
|
|
503
|
+
"emailLayoutKey": {
|
|
504
|
+
"name": "emailLayoutKey",
|
|
505
|
+
"required": false
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
},
|
|
177
509
|
"translation:get": {
|
|
178
510
|
"id": "translation:get",
|
|
179
511
|
"summary": "Display a single translation from an environment.",
|
|
@@ -840,7 +1172,7 @@
|
|
|
840
1172
|
},
|
|
841
1173
|
"workflow:run": {
|
|
842
1174
|
"id": "workflow:run",
|
|
843
|
-
"summary": "Test run a workflow using the latest version from Knock
|
|
1175
|
+
"summary": "Test run a workflow using the latest version from Knock.",
|
|
844
1176
|
"strict": true,
|
|
845
1177
|
"pluginName": "@knocklabs/cli",
|
|
846
1178
|
"pluginAlias": "@knocklabs/cli",
|
|
@@ -871,18 +1203,17 @@
|
|
|
871
1203
|
"recipients": {
|
|
872
1204
|
"name": "recipients",
|
|
873
1205
|
"type": "option",
|
|
874
|
-
"summary": "One or more recipient ids for this workflow run
|
|
1206
|
+
"summary": "One or more recipient user ids separated by comma, or a JSON string containing one or more recipient object references for this workflow run.",
|
|
875
1207
|
"required": true,
|
|
876
|
-
"multiple":
|
|
1208
|
+
"multiple": false,
|
|
877
1209
|
"aliases": [
|
|
878
1210
|
"recipient"
|
|
879
|
-
]
|
|
880
|
-
"delimiter": ","
|
|
1211
|
+
]
|
|
881
1212
|
},
|
|
882
1213
|
"actor": {
|
|
883
1214
|
"name": "actor",
|
|
884
1215
|
"type": "option",
|
|
885
|
-
"summary": "An actor id for the workflow run.",
|
|
1216
|
+
"summary": "An actor id, or a JSON string of an actor object reference for the workflow run.",
|
|
886
1217
|
"multiple": false
|
|
887
1218
|
},
|
|
888
1219
|
"tenant": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knocklabs/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Knock CLI",
|
|
5
5
|
"author": "@knocklabs",
|
|
6
6
|
"bin": {
|
|
@@ -23,27 +23,27 @@
|
|
|
23
23
|
"@prantlf/jsonlint": "^14.0.3",
|
|
24
24
|
"axios": "^1.4.0",
|
|
25
25
|
"date-fns": "^2.30.0",
|
|
26
|
-
"enquirer": "^2.
|
|
26
|
+
"enquirer": "^2.4.1",
|
|
27
27
|
"fs-extra": "^11.1.1",
|
|
28
|
-
"liquidjs": "^10.
|
|
28
|
+
"liquidjs": "^10.8.4",
|
|
29
29
|
"locale-codes": "^1.3.1",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
|
-
"yup": "^1.
|
|
31
|
+
"yup": "^1.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@oclif/test": "^2.3.
|
|
34
|
+
"@oclif/test": "^2.3.23",
|
|
35
35
|
"@swc/cli": "^0.1.62",
|
|
36
36
|
"@swc/core": "^1.3.37",
|
|
37
37
|
"@swc/helpers": "^0.4.14",
|
|
38
38
|
"@types/chai": "^4",
|
|
39
39
|
"@types/fs-extra": "^11.0.1",
|
|
40
40
|
"@types/mocha": "^10.0.1",
|
|
41
|
-
"@types/node": "^20.
|
|
41
|
+
"@types/node": "^20.4.1",
|
|
42
42
|
"chai": "^4",
|
|
43
43
|
"eslint": "^7.32.0",
|
|
44
44
|
"eslint-config-oclif": "^4",
|
|
45
45
|
"eslint-config-oclif-typescript": "^1.0.3",
|
|
46
|
-
"eslint-config-prettier": "^8.
|
|
46
|
+
"eslint-config-prettier": "^8.10.0",
|
|
47
47
|
"eslint-plugin-prettier": "^4.2.1",
|
|
48
48
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
49
49
|
"mocha": "^10",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"oclif": "^3",
|
|
52
52
|
"prettier": "2.8.8",
|
|
53
53
|
"shx": "^0.3.4",
|
|
54
|
-
"sinon": "^15.
|
|
54
|
+
"sinon": "^15.2.0",
|
|
55
55
|
"ts-node": "^10.9.1",
|
|
56
56
|
"tsconfig-paths": "^4.2.0",
|
|
57
|
-
"tslib": "^2.
|
|
58
|
-
"typescript": "^5.
|
|
57
|
+
"tslib": "^2.6.0",
|
|
58
|
+
"typescript": "^5.1.6"
|
|
59
59
|
},
|
|
60
60
|
"oclif": {
|
|
61
61
|
"bin": "knock",
|
|
@@ -75,6 +75,9 @@
|
|
|
75
75
|
},
|
|
76
76
|
"translation": {
|
|
77
77
|
"description": "Manage translation files."
|
|
78
|
+
},
|
|
79
|
+
"layout": {
|
|
80
|
+
"description": "Manage email layouts."
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
},
|