@knocklabs/cli 0.1.22 → 0.1.23

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 (55) hide show
  1. package/README.md +102 -43
  2. package/dist/commands/commit/list.js +21 -1
  3. package/dist/commands/guide/activate.js +121 -0
  4. package/dist/commands/guide/generate-types.js +148 -0
  5. package/dist/commands/guide/get.js +139 -0
  6. package/dist/commands/guide/list.js +112 -0
  7. package/dist/commands/guide/pull.js +209 -0
  8. package/dist/commands/guide/push.js +171 -0
  9. package/dist/commands/guide/validate.js +148 -0
  10. package/dist/commands/workflow/generate-types.js +6 -5
  11. package/dist/lib/api-v1.js +61 -0
  12. package/dist/lib/helpers/const.js +4 -4
  13. package/dist/lib/helpers/date.js +3 -3
  14. package/dist/lib/helpers/error.js +8 -8
  15. package/dist/lib/helpers/flag.js +7 -7
  16. package/dist/lib/helpers/json.js +5 -5
  17. package/dist/lib/helpers/object.isomorphic.js +8 -8
  18. package/dist/lib/helpers/page.js +9 -9
  19. package/dist/lib/helpers/request.js +4 -4
  20. package/dist/lib/helpers/string.js +3 -3
  21. package/dist/lib/helpers/typegen.js +59 -0
  22. package/dist/lib/helpers/ux.js +3 -3
  23. package/dist/lib/marshal/email-layout/helpers.js +5 -5
  24. package/dist/lib/marshal/email-layout/processor.isomorphic.js +3 -3
  25. package/dist/lib/marshal/email-layout/reader.js +5 -5
  26. package/dist/lib/marshal/email-layout/writer.js +4 -4
  27. package/dist/lib/marshal/guide/helpers.js +283 -0
  28. package/dist/lib/marshal/guide/index.js +3 -0
  29. package/dist/lib/marshal/guide/processor.isomorphic.js +3 -3
  30. package/dist/lib/marshal/guide/reader.js +193 -0
  31. package/dist/lib/marshal/guide/writer.js +175 -0
  32. package/dist/lib/marshal/index.isomorphic.js +7 -7
  33. package/dist/lib/marshal/message-type/helpers.js +5 -5
  34. package/dist/lib/marshal/message-type/processor.isomorphic.js +3 -3
  35. package/dist/lib/marshal/message-type/reader.js +5 -5
  36. package/dist/lib/marshal/message-type/writer.js +4 -4
  37. package/dist/lib/marshal/partial/helpers.js +5 -5
  38. package/dist/lib/marshal/partial/processor.isomorphic.js +3 -3
  39. package/dist/lib/marshal/partial/reader.js +5 -5
  40. package/dist/lib/marshal/partial/writer.js +4 -4
  41. package/dist/lib/marshal/shared/const.isomorphic.js +3 -3
  42. package/dist/lib/marshal/shared/helpers.isomorphic.js +9 -2
  43. package/dist/lib/marshal/shared/helpers.js +4 -4
  44. package/dist/lib/marshal/translation/helpers.js +10 -10
  45. package/dist/lib/marshal/translation/processor.isomorphic.js +6 -6
  46. package/dist/lib/marshal/translation/writer.js +3 -3
  47. package/dist/lib/marshal/workflow/generator.js +4 -4
  48. package/dist/lib/marshal/workflow/helpers.js +53 -10
  49. package/dist/lib/marshal/workflow/processor.isomorphic.js +5 -5
  50. package/dist/lib/marshal/workflow/reader.js +5 -5
  51. package/dist/lib/marshal/workflow/writer.js +5 -5
  52. package/dist/lib/resources.js +3 -3
  53. package/oclif.manifest.json +615 -54
  54. package/package.json +8 -8
  55. package/dist/lib/type-generator.js +0 -100
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/cli",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Knock CLI",
5
5
  "author": "@knocklabs",
6
6
  "bin": {
@@ -20,30 +20,30 @@
20
20
  "@oclif/core": "^3",
21
21
  "@oclif/plugin-help": "^6",
22
22
  "@prantlf/jsonlint": "^14.1.0",
23
- "axios": "^1.9.0",
23
+ "axios": "^1.10.0",
24
24
  "date-fns": "^2.30.0",
25
25
  "enquirer": "^2.4.1",
26
- "fs-extra": "^11.3.0",
26
+ "fs-extra": "^11.3.1",
27
27
  "liquidjs": "^10.21.1",
28
28
  "locale-codes": "^1.3.1",
29
29
  "lodash": "^4.17.21",
30
- "quicktype-core": "^23.0.171",
30
+ "quicktype-core": "^23.2.6",
31
31
  "yup": "^1.6.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@oclif/test": "^3",
35
- "@swc/cli": "^0.7.7",
36
- "@swc/core": "^1.11.24",
35
+ "@swc/cli": "^0.7.8",
36
+ "@swc/core": "^1.13.5",
37
37
  "@swc/helpers": "^0.5.17",
38
38
  "@types/chai": "^4",
39
39
  "@types/fs-extra": "^11.0.4",
40
40
  "@types/mocha": "^10.0.10",
41
- "@types/node": "^20.19.0",
41
+ "@types/node": "^20.19.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.10.0",
46
+ "eslint-config-prettier": "^8.10.2",
47
47
  "eslint-plugin-prettier": "^4.2.1",
48
48
  "eslint-plugin-simple-import-sort": "^10.0.0",
49
49
  "mocha": "^10",
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- generateWorkflowTypes: function() {
13
- return generateWorkflowTypes;
14
- },
15
- getLanguageFromExtension: function() {
16
- return getLanguageFromExtension;
17
- }
18
- });
19
- const _quicktypecore = require("quicktype-core");
20
- function getLanguageFromExtension(extension) {
21
- switch(extension){
22
- case "ts":
23
- return "typescript";
24
- case "py":
25
- return "python";
26
- case "go":
27
- return "go";
28
- case "rb":
29
- return "ruby";
30
- default:
31
- return undefined;
32
- }
33
- }
34
- /**
35
- * Transforms the schema to add additionalProperties to all objects.
36
- *
37
- * TODO: handle refs, union types, and more.
38
- *
39
- * @param schema The schema to transform
40
- * @returns The transformed schema
41
- */ function transformSchema(schema) {
42
- if (schema.type === "object" && !schema.additionalProperties) {
43
- schema.additionalProperties = false;
44
- }
45
- var _schema_properties;
46
- for (const key of Object.keys((_schema_properties = schema.properties) !== null && _schema_properties !== void 0 ? _schema_properties : {})){
47
- const property = schema.properties[key];
48
- if (property.type === "object") {
49
- const transformedProperty = transformSchema(property);
50
- schema.properties[key] = transformedProperty;
51
- }
52
- }
53
- return schema;
54
- }
55
- /**
56
- * Given a set of workflows, will go through and generated types for each workflow.
57
- *
58
- * If the workflow has no trigger data JSON schema, will return empty lines.
59
- *
60
- * @param workflows List of workflows to generate types for
61
- * @param targetLanguage Target programming language for type generation
62
- * @returns Generated type definitions for the workflows
63
- */ async function generateWorkflowTypes(workflows, targetLanguage) {
64
- const validWorkflows = workflows.filter((workflow)=>workflow.trigger_data_json_schema);
65
- if (validWorkflows.length === 0) {
66
- return {
67
- result: undefined,
68
- workflows: []
69
- };
70
- }
71
- const schemaInput = new _quicktypecore.JSONSchemaInput(new _quicktypecore.FetchingJSONSchemaStore());
72
- for (const workflow of validWorkflows){
73
- const pascalCaseWorkflowKey = workflow.key.split(/[_-]/).map((part)=>part.charAt(0).toUpperCase() + part.slice(1)).join("");
74
- const schema = transformSchema({
75
- ...workflow.trigger_data_json_schema,
76
- title: `${pascalCaseWorkflowKey}Data`
77
- });
78
- schemaInput.addSource({
79
- name: `${pascalCaseWorkflowKey}Data`,
80
- schema: JSON.stringify(schema)
81
- });
82
- }
83
- const inputData = new _quicktypecore.InputData();
84
- inputData.addInput(schemaInput);
85
- const result = await (0, _quicktypecore.quicktype)({
86
- inputData,
87
- lang: targetLanguage,
88
- allPropertiesOptional: false,
89
- alphabetizeProperties: true,
90
- rendererOptions: {
91
- "just-types": true,
92
- "no-extra-properties": true,
93
- "no-optional-null": true
94
- }
95
- });
96
- return {
97
- result,
98
- workflows: validWorkflows
99
- };
100
- }