@sprucelabs/spruce-cli 14.28.8 → 14.29.0

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 (112) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js +13 -9
  3. package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js.map +1 -1
  4. package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.d.ts +1 -1
  5. package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js +24 -14
  6. package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +1 -1
  7. package/build/__tests__/behavioral/TestingDataStores.test.js +15 -11
  8. package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
  9. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +3 -1
  10. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
  11. package/build/__tests__/behavioral/events/CreatingAListener.test.d.ts +2 -0
  12. package/build/__tests__/behavioral/events/CreatingAListener.test.js +157 -81
  13. package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
  14. package/build/__tests__/behavioral/events/KeepingListenersInSync.test.d.ts +7 -0
  15. package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js +171 -0
  16. package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js.map +1 -0
  17. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.d.ts +1 -0
  18. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +53 -21
  19. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
  20. package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.d.ts +5 -0
  21. package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.js +137 -0
  22. package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.js.map +1 -0
  23. package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.d.ts +3 -0
  24. package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js +105 -16
  25. package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -1
  26. package/build/__tests__/behavioral/tests/CreatingATest.test.js +14 -10
  27. package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
  28. package/build/__tests__/behavioral/views/TestingViewControllers.test.d.ts +1 -0
  29. package/build/__tests__/behavioral/views/TestingViewControllers.test.js +67 -35
  30. package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
  31. package/build/__tests__/implementation/AuthService.test.d.ts +1 -0
  32. package/build/__tests__/implementation/AuthService.test.js +8 -0
  33. package/build/__tests__/implementation/AuthService.test.js.map +1 -1
  34. package/build/__tests__/implementation/EventStore.test.js +3 -1
  35. package/build/__tests__/implementation/EventStore.test.js.map +1 -1
  36. package/build/__tests__/implementation/StoreFeature.test.d.ts +4 -0
  37. package/build/__tests__/implementation/StoreFeature.test.js +132 -0
  38. package/build/__tests__/implementation/StoreFeature.test.js.map +1 -0
  39. package/build/features/event/EventFeature.d.ts +2 -2
  40. package/build/features/event/EventFeature.js +53 -13
  41. package/build/features/event/EventFeature.js.map +1 -1
  42. package/build/features/event/actions/ListenAction.d.ts +1 -0
  43. package/build/features/event/actions/ListenAction.js +60 -31
  44. package/build/features/event/actions/ListenAction.js.map +1 -1
  45. package/build/features/event/actions/SyncListenersAction.d.ts +15 -0
  46. package/build/features/event/actions/SyncListenersAction.js +115 -0
  47. package/build/features/event/actions/SyncListenersAction.js.map +1 -0
  48. package/build/features/event/builders/ListenerTemplateItemBuilder.d.ts +8 -0
  49. package/build/features/event/builders/ListenerTemplateItemBuilder.js +65 -0
  50. package/build/features/event/builders/ListenerTemplateItemBuilder.js.map +1 -0
  51. package/build/features/event/stores/EventStore.js +2 -2
  52. package/build/features/event/stores/EventStore.js.map +1 -1
  53. package/build/features/event/stores/ListenerStore.d.ts +9 -0
  54. package/build/features/event/stores/ListenerStore.js +122 -0
  55. package/build/features/event/stores/ListenerStore.js.map +1 -0
  56. package/build/features/event/writers/EventWriter.d.ts +4 -1
  57. package/build/features/event/writers/EventWriter.js +42 -8
  58. package/build/features/event/writers/EventWriter.js.map +1 -1
  59. package/build/features/skill/SkillFeature.js +1 -1
  60. package/build/features/skill/SkillFeature.js.map +1 -1
  61. package/build/features/skill/stores/SkillStore.js +4 -8
  62. package/build/features/skill/stores/SkillStore.js.map +1 -1
  63. package/build/features/store/StoreFeature.d.ts +1 -1
  64. package/build/features/store/StoreFeature.js +6 -6
  65. package/build/features/store/StoreFeature.js.map +1 -1
  66. package/build/services/AuthService.d.ts +4 -1
  67. package/build/services/AuthService.js +15 -4
  68. package/build/services/AuthService.js.map +1 -1
  69. package/build/services/LintService.d.ts +4 -1
  70. package/build/services/LintService.js +123 -94
  71. package/build/services/LintService.js.map +1 -1
  72. package/build/services/ServiceFactory.js +3 -3
  73. package/build/services/ServiceFactory.js.map +1 -1
  74. package/build/stores/StoreFactory.d.ts +2 -0
  75. package/build/stores/StoreFactory.js +4 -1
  76. package/build/stores/StoreFactory.js.map +1 -1
  77. package/build/tests/AbstractCliTest.js +3 -3
  78. package/build/tests/AbstractCliTest.js.map +1 -1
  79. package/build/writers/AbstractWriter.d.ts +0 -3
  80. package/build/writers/AbstractWriter.js +2 -18
  81. package/build/writers/AbstractWriter.js.map +1 -1
  82. package/package.json +11 -9
  83. package/src/__tests__/behavioral/SettingLogTransportsInASkill.test.ts +2 -0
  84. package/src/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.ts +10 -5
  85. package/src/__tests__/behavioral/TestingDataStores.test.ts +2 -0
  86. package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +1 -0
  87. package/src/__tests__/behavioral/events/CreatingAListener.test.ts +28 -9
  88. package/src/__tests__/behavioral/events/KeepingListenersInSync.test.ts +47 -0
  89. package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +6 -0
  90. package/src/__tests__/behavioral/skill/UpgradingWithListeners.test.ts +59 -0
  91. package/src/__tests__/behavioral/stores/KeepingDataStoresInSync.test.ts +31 -2
  92. package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -0
  93. package/src/__tests__/behavioral/views/TestingViewControllers.test.ts +6 -0
  94. package/src/__tests__/implementation/AuthService.test.ts +6 -0
  95. package/src/__tests__/implementation/EventStore.test.ts +1 -0
  96. package/src/__tests__/implementation/StoreFeature.test.ts +40 -0
  97. package/src/features/event/EventFeature.ts +21 -4
  98. package/src/features/event/actions/ListenAction.ts +9 -3
  99. package/src/features/event/actions/SyncListenersAction.ts +38 -0
  100. package/src/features/event/builders/ListenerTemplateItemBuilder.ts +27 -0
  101. package/src/features/event/stores/EventStore.ts +1 -1
  102. package/src/features/event/stores/ListenerStore.ts +32 -0
  103. package/src/features/event/writers/EventWriter.ts +19 -0
  104. package/src/features/skill/SkillFeature.ts +1 -1
  105. package/src/features/skill/stores/SkillStore.ts +4 -3
  106. package/src/features/store/StoreFeature.ts +3 -3
  107. package/src/services/AuthService.ts +15 -5
  108. package/src/services/LintService.ts +19 -2
  109. package/src/services/ServiceFactory.ts +9 -3
  110. package/src/stores/StoreFactory.ts +3 -0
  111. package/src/tests/AbstractCliTest.ts +2 -2
  112. package/src/writers/AbstractWriter.ts +2 -13
@@ -13,6 +13,8 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
15
 
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
16
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
19
 
18
20
  var _schema = require("@sprucelabs/schema");
@@ -21,106 +23,133 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
21
23
 
22
24
  var _SpruceError = _interopRequireDefault(require("../errors/SpruceError"));
23
25
 
24
- var LintService = function LintService(cwd, command) {
25
- var _this = this;
26
-
27
- (0, _classCallCheck2["default"])(this, LintService);
28
- (0, _defineProperty2["default"])(this, "cwd", void 0);
29
- (0, _defineProperty2["default"])(this, "command", void 0);
30
- (0, _defineProperty2["default"])(this, "fix", /*#__PURE__*/function () {
31
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(pattern) {
32
- var fixedFiles, fixedPaths, script, _yield$_this$command$, stdout, i, fixedFile;
33
-
34
- return _regenerator["default"].wrap(function _callee$(_context) {
35
- while (1) {
36
- switch (_context.prev = _context.next) {
37
- case 0:
38
- if (pattern) {
39
- _context.next = 2;
40
- break;
41
- }
42
-
43
- throw new _schema.SchemaError({
44
- code: 'MISSING_PARAMETERS',
45
- parameters: ['pattern']
46
- });
47
-
48
- case 2:
49
- fixedFiles = {};
50
- fixedPaths = [];
51
- _context.prev = 4;
52
- script = "\"(async function lint() { try { const { ESLint } = require('eslint'); const cli = new ESLint({ fix: true, cwd: '".concat(_this.cwd, "', }); const result = await cli.lintFiles(['").concat(pattern, "']); console.log(JSON.stringify(result)); } catch (err) { console.log(err.toString()); }})()\"");
53
- _context.next = 8;
54
- return _this.command.execute('node', {
55
- args: ['-e', script]
56
- });
57
-
58
- case 8:
59
- _yield$_this$command$ = _context.sent;
60
- stdout = _yield$_this$command$.stdout;
61
- fixedFiles = JSON.parse(stdout);
62
- _context.next = 16;
63
- break;
64
-
65
- case 13:
66
- _context.prev = 13;
67
- _context.t0 = _context["catch"](4);
68
- throw new _SpruceError["default"]({
69
- code: 'LINT_FAILED',
70
- pattern: pattern,
71
- originalError: _context.t0
72
- });
73
-
74
- case 16:
75
- if (!fixedFiles) {
76
- _context.next = 27;
26
+ // import { ESLint } from 'eslint'
27
+ var LintService = /*#__PURE__*/function () {
28
+ function LintService(cwd, commandService) {
29
+ var _this = this;
30
+
31
+ (0, _classCallCheck2["default"])(this, LintService);
32
+ (0, _defineProperty2["default"])(this, "cwd", void 0);
33
+ (0, _defineProperty2["default"])(this, "command", void 0);
34
+ (0, _defineProperty2["default"])(this, "fix", /*#__PURE__*/function () {
35
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(pattern) {
36
+ var fixedFiles, fixedPaths, script, _yield$_this$command$, stdout, i, fixedFile;
37
+
38
+ return _regenerator["default"].wrap(function _callee$(_context) {
39
+ while (1) {
40
+ switch (_context.prev = _context.next) {
41
+ case 0:
42
+ if (pattern) {
43
+ _context.next = 2;
44
+ break;
45
+ }
46
+
47
+ throw new _schema.SchemaError({
48
+ code: 'MISSING_PARAMETERS',
49
+ parameters: ['pattern']
50
+ });
51
+
52
+ case 2:
53
+ if (LintService.isLintingEnabled) {
54
+ _context.next = 4;
55
+ break;
56
+ }
57
+
58
+ return _context.abrupt("return", []);
59
+
60
+ case 4:
61
+ fixedFiles = {};
62
+ fixedPaths = [];
63
+ _context.prev = 6;
64
+ // const cli = new ESLint({ fix: true, cwd: this.cwd, cache: true })
65
+ // fixedFiles = await cli.lintFiles([pattern])
66
+ script = "\"(async function lint() { try { const { ESLint } = require('eslint'); const cli = new ESLint({ fix: true, cwd: '".concat(_this.cwd, "', }); const result = await cli.lintFiles(['").concat(pattern, "']); console.log(JSON.stringify(result)); } catch (err) { console.log(err.toString()); }})()\"");
67
+ _context.next = 10;
68
+ return _this.command.execute('node', {
69
+ args: ['-e', script]
70
+ });
71
+
72
+ case 10:
73
+ _yield$_this$command$ = _context.sent;
74
+ stdout = _yield$_this$command$.stdout;
75
+ fixedFiles = JSON.parse(stdout);
76
+ _context.next = 18;
77
77
  break;
78
- }
79
-
80
- i = 0;
81
78
 
82
- case 18:
83
- if (!(i < fixedFiles.length)) {
84
- _context.next = 27;
79
+ case 15:
80
+ _context.prev = 15;
81
+ _context.t0 = _context["catch"](6);
82
+ throw new _SpruceError["default"]({
83
+ code: 'LINT_FAILED',
84
+ pattern: pattern,
85
+ originalError: _context.t0
86
+ });
87
+
88
+ case 18:
89
+ if (!fixedFiles) {
90
+ _context.next = 29;
91
+ break;
92
+ }
93
+
94
+ i = 0;
95
+
96
+ case 20:
97
+ if (!(i < fixedFiles.length)) {
98
+ _context.next = 29;
99
+ break;
100
+ }
101
+
102
+ fixedFile = fixedFiles[i];
103
+
104
+ if (!(fixedFile && fixedFile.output)) {
105
+ _context.next = 26;
106
+ break;
107
+ }
108
+
109
+ _context.next = 25;
110
+ return _fsExtra["default"].writeFile(fixedFile.filePath, fixedFile.output);
111
+
112
+ case 25:
113
+ fixedPaths.push(fixedFile.filePath);
114
+
115
+ case 26:
116
+ i += 1;
117
+ _context.next = 20;
85
118
  break;
86
- }
87
-
88
- fixedFile = fixedFiles[i];
89
-
90
- if (!(fixedFile && fixedFile.output)) {
91
- _context.next = 24;
92
- break;
93
- }
94
-
95
- _context.next = 23;
96
- return _fsExtra["default"].writeFile(fixedFile.filePath, fixedFile.output);
97
-
98
- case 23:
99
- fixedPaths.push(fixedFile.filePath);
100
-
101
- case 24:
102
- i += 1;
103
- _context.next = 18;
104
- break;
105
119
 
106
- case 27:
107
- return _context.abrupt("return", fixedPaths);
120
+ case 29:
121
+ return _context.abrupt("return", fixedPaths);
108
122
 
109
- case 28:
110
- case "end":
111
- return _context.stop();
123
+ case 30:
124
+ case "end":
125
+ return _context.stop();
126
+ }
112
127
  }
113
- }
114
- }, _callee, null, [[4, 13]]);
115
- }));
116
-
117
- return function (_x) {
118
- return _ref.apply(this, arguments);
119
- };
120
- }());
121
- this.cwd = cwd;
122
- this.command = command;
123
- };
128
+ }, _callee, null, [[6, 15]]);
129
+ }));
130
+
131
+ return function (_x) {
132
+ return _ref.apply(this, arguments);
133
+ };
134
+ }());
135
+ this.cwd = cwd;
136
+ this.command = commandService;
137
+ }
138
+
139
+ (0, _createClass2["default"])(LintService, null, [{
140
+ key: "disableLinting",
141
+ value: function disableLinting() {
142
+ this.isLintingEnabled = false;
143
+ }
144
+ }, {
145
+ key: "enableLinting",
146
+ value: function enableLinting() {
147
+ this.isLintingEnabled = true;
148
+ }
149
+ }]);
150
+ return LintService;
151
+ }();
124
152
 
125
153
  exports["default"] = LintService;
154
+ (0, _defineProperty2["default"])(LintService, "isLintingEnabled", true);
126
155
  //# sourceMappingURL=LintService.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/LintService.ts"],"names":["LintService","cwd","command","pattern","SchemaError","code","parameters","fixedFiles","fixedPaths","script","execute","args","stdout","JSON","parse","SpruceError","originalError","i","length","fixedFile","output","fs","writeFile","filePath","push"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;IAGqBA,W,GAIpB,qBAAmBC,GAAnB,EAAgCC,OAAhC,EAAyD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,6FAK5C,iBAAOC,OAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,kBACPA,OADO;AAAA;AAAA;AAAA;;AAAA,oBAEL,IAAIC,mBAAJ,CAAgB;AACrBC,gBAAAA,IAAI,EAAE,oBADe;AAErBC,gBAAAA,UAAU,EAAE,CAAC,SAAD;AAFS,eAAhB,CAFK;;AAAA;AAQRC,cAAAA,UARQ,GAQU,EARV;AASNC,cAAAA,UATM,GASiB,EATjB;AAAA;AAWLC,cAAAA,MAXK,8HAWuH,KAAI,CAACR,GAX5H,yDAW8KE,OAX9K;AAAA;AAAA,qBAac,KAAI,CAACD,OAAL,CAAaQ,OAAb,CAAqB,MAArB,EAA6B;AACrDC,gBAAAA,IAAI,EAAE,CAAC,IAAD,EAAOF,MAAP;AAD+C,eAA7B,CAbd;;AAAA;AAAA;AAaHG,cAAAA,MAbG,yBAaHA,MAbG;AAiBXL,cAAAA,UAAU,GAAGM,IAAI,CAACC,KAAL,CAAWF,MAAX,CAAb;AAjBW;AAAA;;AAAA;AAAA;AAAA;AAAA,oBAmBL,IAAIG,uBAAJ,CAAgB;AACrBV,gBAAAA,IAAI,EAAE,aADe;AAErBF,gBAAAA,OAAO,EAAPA,OAFqB;AAGrBa,gBAAAA,aAAa;AAHQ,eAAhB,CAnBK;;AAAA;AAAA,mBA0BRT,UA1BQ;AAAA;AAAA;AAAA;;AA2BFU,cAAAA,CA3BE,GA2BE,CA3BF;;AAAA;AAAA,oBA2BKA,CAAC,GAAGV,UAAU,CAACW,MA3BpB;AAAA;AAAA;AAAA;;AA4BJC,cAAAA,SA5BI,GA4BQZ,UAAU,CAACU,CAAD,CA5BlB;;AAAA,oBA6BNE,SAAS,IAAIA,SAAS,CAACC,MA7BjB;AAAA;AAAA;AAAA;;AAAA;AAAA,qBA8BHC,oBAAGC,SAAH,CAAaH,SAAS,CAACI,QAAvB,EAAiCJ,SAAS,CAACC,MAA3C,CA9BG;;AAAA;AA+BTZ,cAAAA,UAAU,CAACgB,IAAX,CAAgBL,SAAS,CAACI,QAA1B;;AA/BS;AA2B4BN,cAAAA,CAAC,IAAI,CA3BjC;AAAA;AAAA;;AAAA;AAAA,+CAoCLT,UApCK;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAL4C;;AAAA;AAAA;AAAA;AAAA;AACxD,OAAKP,GAAL,GAAWA,GAAX;AACA,OAAKC,OAAL,GAAeA,OAAf;AACA,C","sourcesContent":["import { SchemaError } from '@sprucelabs/schema'\nimport fs from 'fs-extra'\nimport SpruceError from '../errors/SpruceError'\nimport CommandService from './CommandService'\n\nexport default class LintService {\n\tpublic cwd: string\n\tprivate command: CommandService\n\n\tpublic constructor(cwd: string, command: CommandService) {\n\t\tthis.cwd = cwd\n\t\tthis.command = command\n\t}\n\n\tpublic fix = async (pattern: string): Promise<string[]> => {\n\t\tif (!pattern) {\n\t\t\tthrow new SchemaError({\n\t\t\t\tcode: 'MISSING_PARAMETERS',\n\t\t\t\tparameters: ['pattern'],\n\t\t\t})\n\t\t}\n\n\t\tlet fixedFiles: any = {}\n\t\tconst fixedPaths: string[] = []\n\t\ttry {\n\t\t\tconst script = `\"(async function lint() { try { const { ESLint } = require('eslint'); const cli = new ESLint({ fix: true, cwd: '${this.cwd}', }); const result = await cli.lintFiles(['${pattern}']); console.log(JSON.stringify(result)); } catch (err) { console.log(err.toString()); }})()\"`\n\n\t\t\tconst { stdout } = await this.command.execute('node', {\n\t\t\t\targs: ['-e', script],\n\t\t\t})\n\n\t\t\tfixedFiles = JSON.parse(stdout)\n\t\t} catch (err: any) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'LINT_FAILED',\n\t\t\t\tpattern,\n\t\t\t\toriginalError: err,\n\t\t\t})\n\t\t}\n\n\t\tif (fixedFiles) {\n\t\t\tfor (let i = 0; i < fixedFiles.length; i += 1) {\n\t\t\t\tconst fixedFile = fixedFiles[i]\n\t\t\t\tif (fixedFile && fixedFile.output) {\n\t\t\t\t\tawait fs.writeFile(fixedFile.filePath, fixedFile.output)\n\t\t\t\t\tfixedPaths.push(fixedFile.filePath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn fixedPaths\n\t}\n}\n"],"file":"LintService.js"}
1
+ {"version":3,"sources":["../../src/services/LintService.ts"],"names":["LintService","cwd","commandService","pattern","SchemaError","code","parameters","isLintingEnabled","fixedFiles","fixedPaths","script","command","execute","args","stdout","JSON","parse","SpruceError","originalError","i","length","fixedFile","output","fs","writeFile","filePath","push"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAFA;IAKqBA,W;AAcpB,uBAAmBC,GAAnB,EAAgCC,cAAhC,EAAgE;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,+FAKnD,iBAAOC,OAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,oBACPA,OADO;AAAA;AAAA;AAAA;;AAAA,sBAEL,IAAIC,mBAAJ,CAAgB;AACrBC,kBAAAA,IAAI,EAAE,oBADe;AAErBC,kBAAAA,UAAU,EAAE,CAAC,SAAD;AAFS,iBAAhB,CAFK;;AAAA;AAAA,oBAQPN,WAAW,CAACO,gBARL;AAAA;AAAA;AAAA;;AAAA,iDASJ,EATI;;AAAA;AAYRC,gBAAAA,UAZQ,GAY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GAAWA,GAAX;AACA,SAAKU,OAAL,GAAeT,cAAf;AACA;;;;WAXD,0BAA+B;AAC9B,WAAKK,gBAAL,GAAwB,KAAxB;AACA;;;WAED,yBAA8B;AAC7B,WAAKA,gBAAL,GAAwB,IAAxB;AACA;;;;;;iCAZmBP,W,sBAIc,I","sourcesContent":["import { SchemaError } from '@sprucelabs/schema'\n// import { ESLint } from 'eslint'\nimport fs from 'fs-extra'\nimport SpruceError from '../errors/SpruceError'\nimport CommandService from './CommandService'\n\nexport default class LintService {\n\tpublic cwd: string\n\tprivate command: CommandService\n\n\tprivate static isLintingEnabled = true\n\n\tpublic static disableLinting() {\n\t\tthis.isLintingEnabled = false\n\t}\n\n\tpublic static enableLinting() {\n\t\tthis.isLintingEnabled = true\n\t}\n\n\tpublic constructor(cwd: string, commandService: CommandService) {\n\t\tthis.cwd = cwd\n\t\tthis.command = commandService\n\t}\n\n\tpublic fix = async (pattern: string): Promise<string[]> => {\n\t\tif (!pattern) {\n\t\t\tthrow new SchemaError({\n\t\t\t\tcode: 'MISSING_PARAMETERS',\n\t\t\t\tparameters: ['pattern'],\n\t\t\t})\n\t\t}\n\n\t\tif (!LintService.isLintingEnabled) {\n\t\t\treturn []\n\t\t}\n\n\t\tlet fixedFiles: any = {}\n\t\tconst fixedPaths: string[] = []\n\t\ttry {\n\t\t\t// const cli = new ESLint({ fix: true, cwd: this.cwd, cache: true })\n\t\t\t// fixedFiles = await cli.lintFiles([pattern])\n\t\t\tconst script = `\"(async function lint() { try { const { ESLint } = require('eslint'); const cli = new ESLint({ fix: true, cwd: '${this.cwd}', }); const result = await cli.lintFiles(['${pattern}']); console.log(JSON.stringify(result)); } catch (err) { console.log(err.toString()); }})()\"`\n\n\t\t\tconst { stdout } = await this.command.execute('node', {\n\t\t\t\targs: ['-e', script],\n\t\t\t})\n\n\t\t\tfixedFiles = JSON.parse(stdout)\n\t\t} catch (err: any) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'LINT_FAILED',\n\t\t\t\tpattern,\n\t\t\t\toriginalError: err,\n\t\t\t})\n\t\t}\n\n\t\tif (fixedFiles) {\n\t\t\tfor (let i = 0; i < fixedFiles.length; i += 1) {\n\t\t\t\tconst fixedFile = fixedFiles[i]\n\t\t\t\tif (fixedFile && fixedFile.output) {\n\t\t\t\t\tawait fs.writeFile(fixedFile.filePath, fixedFile.output)\n\t\t\t\t\tfixedPaths.push(fixedFile.filePath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn fixedPaths\n\t}\n}\n"],"file":"LintService.js"}
@@ -57,7 +57,7 @@ var ServiceFactory = /*#__PURE__*/function () {
57
57
  }(function (cwd, type) {
58
58
  switch (type) {
59
59
  case 'auth':
60
- return new _AuthService["default"](new _spruceSkillUtils.EnvService(cwd));
60
+ return new _AuthService["default"](new _spruceSkillUtils.EnvService(cwd), new _PkgService["default"](cwd));
61
61
 
62
62
  case 'pkg':
63
63
  return new _PkgService["default"](cwd);
@@ -75,7 +75,7 @@ var ServiceFactory = /*#__PURE__*/function () {
75
75
  });
76
76
 
77
77
  case 'lint':
78
- return new _LintService["default"](cwd, new _CommandService["default"](cwd));
78
+ return new _LintService["default"](cwd, this.Service(cwd, 'command'));
79
79
 
80
80
  case 'command':
81
81
  {
@@ -100,7 +100,7 @@ var ServiceFactory = /*#__PURE__*/function () {
100
100
  case 'build':
101
101
  {
102
102
  var commandService = new _CommandService["default"](cwd);
103
- return new _BuildService["default"](commandService, new _LintService["default"](cwd, commandService));
103
+ return new _BuildService["default"](commandService, new _LintService["default"](cwd, this.Service(cwd, 'command')));
104
104
  }
105
105
 
106
106
  case 'eventSettings':
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/ServiceFactory.ts"],"names":["ServiceFactory","cwd","type","AuthService","EnvService","PkgService","VsCodeService","SchemaService","command","CommandService","LintService","RemoteService","TypeCheckerService","buildImportService","SettingsService","DependencyService","commandService","BuildService","EventSettingsService","Error","ImportService"],"mappings":";;;;;;;;;;;;;AAAA;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P;;AACD,aAAK,OAAL;AAAc;AACb,gBAAMe,cAAc,GAAG,IAAIP,0BAAJ,CAAmBR,GAAnB,CAAvB;AACA,mBAAO,IAAIgB,wBAAJ,CACND,cADM,EAEN,IAAIN,uBAAJ,CAAgBT,GAAhB,EAAqBe,cAArB,CAFM,CAAP;AAIA;;AACD,aAAK,eAAL;AACC,iBAAO,IAAIE,gCAAJ,CACN,IAAIJ,iCAAJ,CAAoBb,GAApB,CADM,CAAP;;AAGD;AACC,gBAAM,IAAIkB,KAAJ,qBAAsBjB,IAAtB,kBAAN;AA7CF;AA+CA,K;;;WAED,4BAA2BD,GAA3B,EAAuD;AACtD,aAAO,IAAImB,yBAAJ,CAAkB;AACxBnB,QAAAA,GAAG,EAAHA,GADwB;AAExBO,QAAAA,OAAO,EAAE,IAAIC,0BAAJ,CAAmBR,GAAnB;AAFe,OAAlB,CAAP;AAIA","sourcesContent":["import { SettingsService, EnvService } from '@sprucelabs/spruce-skill-utils'\nimport EventSettingsService from '../features/event/services/EventSettingsService'\nimport RemoteService from '../features/event/services/RemoteService'\nimport { FeatureCode } from '../features/features.types'\nimport SchemaService from '../features/schema/services/SchemaService'\nimport VsCodeService from '../features/vscode/services/VsCodeService'\nimport AuthService from './AuthService'\nimport BuildService from './BuildService'\nimport CommandService from './CommandService'\nimport DependencyService from './DependencyService'\nimport ImportService from './ImportService'\nimport LintService from './LintService'\nimport PkgService from './PkgService'\nimport TypeCheckerService from './TypeCheckerService'\n\nexport interface ServiceMap {\n\tpkg: PkgService\n\tvsCode: VsCodeService\n\tschema: SchemaService\n\tlint: LintService\n\tcommand: CommandService\n\ttypeChecker: TypeCheckerService\n\timport: ImportService\n\tbuild: BuildService\n\tsettings: SettingsService\n\tenv: EnvService\n\tauth: AuthService\n\tremote: RemoteService\n\teventSettings: EventSettingsService\n\tdependency: DependencyService\n}\n\nexport type Service = keyof ServiceMap\n\nexport interface ServiceProvider {\n\tService<S extends Service>(type: S, cwd?: string): ServiceMap[S]\n}\nexport default class ServiceFactory {\n\tpublic Service<S extends Service>(cwd: string, type: S): ServiceMap[S] {\n\t\tswitch (type) {\n\t\t\tcase 'auth':\n\t\t\t\treturn new AuthService(new EnvService(cwd)) as ServiceMap[S]\n\t\t\tcase 'pkg':\n\t\t\t\treturn new PkgService(cwd) as ServiceMap[S]\n\t\t\tcase 'env':\n\t\t\t\treturn new EnvService(cwd) as ServiceMap[S]\n\t\t\tcase 'vsCode':\n\t\t\t\treturn new VsCodeService(cwd) as ServiceMap[S]\n\t\t\tcase 'schema':\n\t\t\t\treturn new SchemaService({\n\t\t\t\t\tcwd,\n\t\t\t\t\tcommand: new CommandService(cwd),\n\t\t\t\t}) as ServiceMap[S]\n\t\t\tcase 'lint':\n\t\t\t\treturn new LintService(cwd, new CommandService(cwd)) as ServiceMap[S]\n\t\t\tcase 'command': {\n\t\t\t\treturn new CommandService(cwd) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'remote':\n\t\t\t\treturn new RemoteService(new EnvService(cwd)) as ServiceMap[S]\n\t\t\tcase 'typeChecker':\n\t\t\t\treturn new TypeCheckerService(\n\t\t\t\t\tthis.buildImportService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'settings':\n\t\t\t\treturn new SettingsService<FeatureCode>(cwd) as ServiceMap[S]\n\t\t\tcase 'dependency':\n\t\t\t\treturn new DependencyService(\n\t\t\t\t\tnew SettingsService<FeatureCode>(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'import':\n\t\t\t\treturn this.buildImportService(cwd) as ServiceMap[S]\n\t\t\tcase 'build': {\n\t\t\t\tconst commandService = new CommandService(cwd)\n\t\t\t\treturn new BuildService(\n\t\t\t\t\tcommandService,\n\t\t\t\t\tnew LintService(cwd, commandService)\n\t\t\t\t) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'eventSettings':\n\t\t\t\treturn new EventSettingsService(\n\t\t\t\t\tnew SettingsService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Service \"${type}\" not found`)\n\t\t}\n\t}\n\n\tprivate buildImportService(cwd: string): ImportService {\n\t\treturn new ImportService({\n\t\t\tcwd,\n\t\t\tcommand: new CommandService(cwd),\n\t\t})\n\t}\n}\n"],"file":"ServiceFactory.js"}
1
+ {"version":3,"sources":["../../src/services/ServiceFactory.ts"],"names":["ServiceFactory","cwd","type","AuthService","EnvService","PkgService","VsCodeService","SchemaService","command","CommandService","LintService","Service","RemoteService","TypeCheckerService","buildImportService","SettingsService","DependencyService","commandService","BuildService","EventSettingsService","Error","ImportService"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;IAwBqBA,c;;;;;;;;;;;;;;;;;MACpB,UAAkCC,GAAlC,EAA+CC,IAA/C,EAAuE;AACtE,cAAQA,IAAR;AACC,aAAK,MAAL;AACC,iBAAO,IAAIC,uBAAJ,CACN,IAAIC,4BAAJ,CAAeH,GAAf,CADM,EAEN,IAAII,sBAAJ,CAAeJ,GAAf,CAFM,CAAP;;AAID,aAAK,KAAL;AACC,iBAAO,IAAII,sBAAJ,CAAeJ,GAAf,CAAP;;AACD,aAAK,KAAL;AACC,iBAAO,IAAIG,4BAAJ,CAAeH,GAAf,CAAP;;AACD,aAAK,QAAL;AACC,iBAAO,IAAIK,yBAAJ,CAAkBL,GAAlB,CAAP;;AACD,aAAK,QAAL;AACC,iBAAO,IAAIM,yBAAJ,CAAkB;AACxBN,YAAAA,GAAG,EAAHA,GADwB;AAExBO,YAAAA,OAAO,EAAE,IAAIC,0BAAJ,CAAmBR,GAAnB;AAFe,WAAlB,CAAP;;AAID,aAAK,MAAL;AACC,iBAAO,IAAIS,uBAAJ,CACNT,GADM,EAEN,KAAKU,OAAL,CAAaV,GAAb,EAAkB,SAAlB,CAFM,CAAP;;AAID,aAAK,SAAL;AAAgB;AACf,mBAAO,IAAIQ,0BAAJ,CAAmBR,GAAnB,CAAP;AACA;;AACD,aAAK,QAAL;AACC,iBAAO,IAAIW,yBAAJ,CAAkB,IAAIR,4BAAJ,CAAeH,GAAf,CAAlB,CAAP;;AACD,aAAK,aAAL;AACC,iBAAO,IAAIY,8BAAJ,CACN,KAAKC,kBAAL,CAAwBb,GAAxB,CADM,CAAP;;AAGD,aAAK,UAAL;AACC,iBAAO,IAAIc,iCAAJ,CAAiCd,GAAjC,CAAP;;AACD,aAAK,YAAL;AACC,iBAAO,IAAIe,6BAAJ,CACN,IAAID,iCAAJ,CAAiCd,GAAjC,CADM,CAAP;;AAGD,aAAK,QAAL;AACC,iBAAO,KAAKa,kBAAL,CAAwBb,GAAxB,CAAP;;AACD,aAAK,OAAL;AAAc;AACb,gBAAMgB,cAAc,GAAG,IAAIR,0BAAJ,CAAmBR,GAAnB,CAAvB;AACA,mBAAO,IAAIiB,wBAAJ,CACND,cADM,EAEN,IAAIP,uBAAJ,CAAgBT,GAAhB,EAAqB,KAAKU,OAAL,CAAaV,GAAb,EAAkB,SAAlB,CAArB,CAFM,CAAP;AAIA;;AACD,aAAK,eAAL;AACC,iBAAO,IAAIkB,gCAAJ,CACN,IAAIJ,iCAAJ,CAAoBd,GAApB,CADM,CAAP;;AAGD;AACC,gBAAM,IAAImB,KAAJ,qBAAsBlB,IAAtB,kBAAN;AAnDF;AAqDA,K;;;WAED,4BAA2BD,GAA3B,EAAuD;AACtD,aAAO,IAAIoB,yBAAJ,CAAkB;AACxBpB,QAAAA,GAAG,EAAHA,GADwB;AAExBO,QAAAA,OAAO,EAAE,IAAIC,0BAAJ,CAAmBR,GAAnB;AAFe,OAAlB,CAAP;AAIA","sourcesContent":["import { SettingsService, EnvService } from '@sprucelabs/spruce-skill-utils'\nimport EventSettingsService from '../features/event/services/EventSettingsService'\nimport RemoteService from '../features/event/services/RemoteService'\nimport { FeatureCode } from '../features/features.types'\nimport SchemaService from '../features/schema/services/SchemaService'\nimport VsCodeService from '../features/vscode/services/VsCodeService'\nimport AuthService from './AuthService'\nimport BuildService from './BuildService'\nimport CommandService from './CommandService'\nimport DependencyService from './DependencyService'\nimport ImportService from './ImportService'\nimport LintService from './LintService'\nimport PkgService from './PkgService'\nimport TypeCheckerService from './TypeCheckerService'\n\nexport interface ServiceMap {\n\tpkg: PkgService\n\tvsCode: VsCodeService\n\tschema: SchemaService\n\tlint: LintService\n\tcommand: CommandService\n\ttypeChecker: TypeCheckerService\n\timport: ImportService\n\tbuild: BuildService\n\tsettings: SettingsService\n\tenv: EnvService\n\tauth: AuthService\n\tremote: RemoteService\n\teventSettings: EventSettingsService\n\tdependency: DependencyService\n}\n\nexport type Service = keyof ServiceMap\n\nexport interface ServiceProvider {\n\tService<S extends Service>(type: S, cwd?: string): ServiceMap[S]\n}\nexport default class ServiceFactory {\n\tpublic Service<S extends Service>(cwd: string, type: S): ServiceMap[S] {\n\t\tswitch (type) {\n\t\t\tcase 'auth':\n\t\t\t\treturn new AuthService(\n\t\t\t\t\tnew EnvService(cwd),\n\t\t\t\t\tnew PkgService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'pkg':\n\t\t\t\treturn new PkgService(cwd) as ServiceMap[S]\n\t\t\tcase 'env':\n\t\t\t\treturn new EnvService(cwd) as ServiceMap[S]\n\t\t\tcase 'vsCode':\n\t\t\t\treturn new VsCodeService(cwd) as ServiceMap[S]\n\t\t\tcase 'schema':\n\t\t\t\treturn new SchemaService({\n\t\t\t\t\tcwd,\n\t\t\t\t\tcommand: new CommandService(cwd),\n\t\t\t\t}) as ServiceMap[S]\n\t\t\tcase 'lint':\n\t\t\t\treturn new LintService(\n\t\t\t\t\tcwd,\n\t\t\t\t\tthis.Service(cwd, 'command')\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'command': {\n\t\t\t\treturn new CommandService(cwd) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'remote':\n\t\t\t\treturn new RemoteService(new EnvService(cwd)) as ServiceMap[S]\n\t\t\tcase 'typeChecker':\n\t\t\t\treturn new TypeCheckerService(\n\t\t\t\t\tthis.buildImportService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'settings':\n\t\t\t\treturn new SettingsService<FeatureCode>(cwd) as ServiceMap[S]\n\t\t\tcase 'dependency':\n\t\t\t\treturn new DependencyService(\n\t\t\t\t\tnew SettingsService<FeatureCode>(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'import':\n\t\t\t\treturn this.buildImportService(cwd) as ServiceMap[S]\n\t\t\tcase 'build': {\n\t\t\t\tconst commandService = new CommandService(cwd)\n\t\t\t\treturn new BuildService(\n\t\t\t\t\tcommandService,\n\t\t\t\t\tnew LintService(cwd, this.Service(cwd, 'command'))\n\t\t\t\t) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'eventSettings':\n\t\t\t\treturn new EventSettingsService(\n\t\t\t\t\tnew SettingsService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Service \"${type}\" not found`)\n\t\t}\n\t}\n\n\tprivate buildImportService(cwd: string): ImportService {\n\t\treturn new ImportService({\n\t\t\tcwd,\n\t\t\tcommand: new CommandService(cwd),\n\t\t})\n\t}\n}\n"],"file":"ServiceFactory.js"}
@@ -1,5 +1,6 @@
1
1
  import ConversationStore from '../features/conversation/stores/ConversationStore';
2
2
  import EventStore from '../features/event/stores/EventStore';
3
+ import ListenerStore from '../features/event/stores/ListenerStore';
3
4
  import OnboardingStore from '../features/onboard/stores/OnboardingStore';
4
5
  import OrganizationStore from '../features/organization/stores/OrganizationStore';
5
6
  import SchemaStore from '../features/schema/stores/SchemaStore';
@@ -18,6 +19,7 @@ export interface StoreMap {
18
19
  conversation: ConversationStore;
19
20
  store: StoreStore;
20
21
  view: ViewStore;
22
+ listener: ListenerStore;
21
23
  }
22
24
  export declare type StoreCode = keyof StoreMap;
23
25
  export interface StoreFactoryMethodOptions {
@@ -17,6 +17,8 @@ var _ConversationStore = _interopRequireDefault(require("../features/conversatio
17
17
 
18
18
  var _EventStore = _interopRequireDefault(require("../features/event/stores/EventStore"));
19
19
 
20
+ var _ListenerStore = _interopRequireDefault(require("../features/event/stores/ListenerStore"));
21
+
20
22
  var _OnboardingStore = _interopRequireDefault(require("../features/onboard/stores/OnboardingStore"));
21
23
 
22
24
  var _OrganizationStore = _interopRequireDefault(require("../features/organization/stores/OrganizationStore"));
@@ -37,7 +39,8 @@ var storeMap = {
37
39
  organization: _OrganizationStore["default"],
38
40
  conversation: _ConversationStore["default"],
39
41
  store: _StoreStore["default"],
40
- view: _ViewStore["default"]
42
+ view: _ViewStore["default"],
43
+ listener: _ListenerStore["default"]
41
44
  };
42
45
 
43
46
  var StoreFactory = /*#__PURE__*/function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/stores/StoreFactory.ts"],"names":["storeMap","onboarding","OnboardingStore","schema","SchemaStore","event","EventStore","skill","SkillStore","organization","OrganizationStore","conversation","ConversationStore","store","StoreStore","view","ViewStore","StoreFactory","options","cwd","serviceFactory","homeDir","apiClientFactory","emitter","code","storeOptions","Error"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAmBA,IAAMA,QAAQ,GAAG;AAChBC,EAAAA,UAAU,EAAEC,2BADI;AAEhBC,EAAAA,MAAM,EAAEC,uBAFQ;AAGhBC,EAAAA,KAAK,EAAEC,sBAHS;AAIhBC,EAAAA,KAAK,EAAEC,sBAJS;AAKhBC,EAAAA,YAAY,EAAEC,6BALE;AAMhBC,EAAAA,YAAY,EAAEC,6BANE;AAOhBC,EAAAA,KAAK,EAAEC,sBAPS;AAQhBC,EAAAA,IAAI,EAAEC;AARU,CAAjB;;IAwBqBC,Y;AAOpB,wBAAmBC,OAAnB,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAChD,QAAQC,GAAR,GAAoED,OAApE,CAAQC,GAAR;AAAA,QAAaC,cAAb,GAAoEF,OAApE,CAAaE,cAAb;AAAA,QAA6BC,OAA7B,GAAoEH,OAApE,CAA6BG,OAA7B;AAAA,QAAsCC,gBAAtC,GAAoEJ,OAApE,CAAsCI,gBAAtC;AAAA,QAAwDC,OAAxD,GAAoEL,OAApE,CAAwDK,OAAxD;AAEA,SAAKJ,GAAL,GAAWA,GAAX;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACA,SAAKC,OAAL,GAAeA,OAAf;AACA,SAAKC,gBAAL,GAAwBA,gBAAxB;AACA,SAAKC,OAAL,GAAeA,OAAf;AACA;;;;WAED,eACCC,IADD,EAECN,OAFD,EAGe;AAAA;;AACd,UAAMO,YAA0B,GAAG;AAClCN,QAAAA,GAAG,kBAAED,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEC,GAAX,uDAAkB,KAAKA,GADQ;AAElCC,QAAAA,cAAc,EAAE,KAAKA,cAFa;AAGlCC,QAAAA,OAAO,EAAE,KAAKA,OAHoB;AAIlCC,QAAAA,gBAAgB,2BAAEJ,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEI,gBAAX,yEAA+B,KAAKA,gBAJlB;AAKlCC,QAAAA,OAAO,EAAE,KAAKA;AALoB,OAAnC;;AAQA,UAAI,CAACvB,QAAQ,CAACwB,IAAD,CAAb,EAAqB;AACpB,cAAM,IAAIE,KAAJ,2CAA6CF,IAA7C,QAAN;AACA;;AAED,UAAMX,KAAK,GAAG,IAAIb,QAAQ,CAACwB,IAAD,CAAZ,CAAmBC,YAAnB,CAAd;AAEA,aAAOZ,KAAP;AACA","sourcesContent":["import ConversationStore from '../features/conversation/stores/ConversationStore'\nimport EventStore from '../features/event/stores/EventStore'\nimport OnboardingStore from '../features/onboard/stores/OnboardingStore'\nimport OrganizationStore from '../features/organization/stores/OrganizationStore'\nimport SchemaStore from '../features/schema/stores/SchemaStore'\nimport SkillStore from '../features/skill/stores/SkillStore'\nimport StoreStore from '../features/store/stores/StoreStore'\nimport ViewStore from '../features/view/stores/ViewStore'\nimport { GlobalEmitter } from '../GlobalEmitter'\nimport ServiceFactory from '../services/ServiceFactory'\nimport { ApiClientFactory } from '../types/apiClient.types'\nimport { StoreOptions } from './AbstractStore'\n\nexport interface StoreMap {\n\tonboarding: OnboardingStore\n\tschema: SchemaStore\n\tevent: EventStore\n\tskill: SkillStore\n\torganization: OrganizationStore\n\tconversation: ConversationStore\n\tstore: StoreStore\n\tview: ViewStore\n}\n\nexport type StoreCode = keyof StoreMap\n\nconst storeMap = {\n\tonboarding: OnboardingStore,\n\tschema: SchemaStore,\n\tevent: EventStore,\n\tskill: SkillStore,\n\torganization: OrganizationStore,\n\tconversation: ConversationStore,\n\tstore: StoreStore,\n\tview: ViewStore,\n}\n\nexport interface StoreFactoryMethodOptions {\n\tcwd?: string\n\tapiClientFactory?: ApiClientFactory\n}\n\nexport interface StoreFactoryOptions {\n\tcwd: string\n\tserviceFactory: ServiceFactory\n\thomeDir: string\n\tapiClientFactory: ApiClientFactory\n\temitter: GlobalEmitter\n}\n\nexport default class StoreFactory {\n\tprivate serviceFactory: ServiceFactory\n\tprivate cwd: string\n\tprivate homeDir: string\n\tprivate apiClientFactory: ApiClientFactory\n\tprivate emitter: GlobalEmitter\n\n\tpublic constructor(options: StoreFactoryOptions) {\n\t\tconst { cwd, serviceFactory, homeDir, apiClientFactory, emitter } = options\n\n\t\tthis.cwd = cwd\n\t\tthis.serviceFactory = serviceFactory\n\t\tthis.homeDir = homeDir\n\t\tthis.apiClientFactory = apiClientFactory\n\t\tthis.emitter = emitter\n\t}\n\n\tpublic Store<C extends StoreCode>(\n\t\tcode: C,\n\t\toptions?: StoreFactoryMethodOptions\n\t): StoreMap[C] {\n\t\tconst storeOptions: StoreOptions = {\n\t\t\tcwd: options?.cwd ?? this.cwd,\n\t\t\tserviceFactory: this.serviceFactory,\n\t\t\thomeDir: this.homeDir,\n\t\t\tapiClientFactory: options?.apiClientFactory ?? this.apiClientFactory,\n\t\t\temitter: this.emitter,\n\t\t}\n\n\t\tif (!storeMap[code]) {\n\t\t\tthrow new Error(`Could not find store with code '${code}'.`)\n\t\t}\n\n\t\tconst store = new storeMap[code](storeOptions)\n\n\t\treturn store as StoreMap[C]\n\t}\n}\n"],"file":"StoreFactory.js"}
1
+ {"version":3,"sources":["../../src/stores/StoreFactory.ts"],"names":["storeMap","onboarding","OnboardingStore","schema","SchemaStore","event","EventStore","skill","SkillStore","organization","OrganizationStore","conversation","ConversationStore","store","StoreStore","view","ViewStore","listener","ListenerStore","StoreFactory","options","cwd","serviceFactory","homeDir","apiClientFactory","emitter","code","storeOptions","Error"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAoBA,IAAMA,QAAQ,GAAG;AAChBC,EAAAA,UAAU,EAAEC,2BADI;AAEhBC,EAAAA,MAAM,EAAEC,uBAFQ;AAGhBC,EAAAA,KAAK,EAAEC,sBAHS;AAIhBC,EAAAA,KAAK,EAAEC,sBAJS;AAKhBC,EAAAA,YAAY,EAAEC,6BALE;AAMhBC,EAAAA,YAAY,EAAEC,6BANE;AAOhBC,EAAAA,KAAK,EAAEC,sBAPS;AAQhBC,EAAAA,IAAI,EAAEC,qBARU;AAShBC,EAAAA,QAAQ,EAAEC;AATM,CAAjB;;IAyBqBC,Y;AAOpB,wBAAmBC,OAAnB,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAChD,QAAQC,GAAR,GAAoED,OAApE,CAAQC,GAAR;AAAA,QAAaC,cAAb,GAAoEF,OAApE,CAAaE,cAAb;AAAA,QAA6BC,OAA7B,GAAoEH,OAApE,CAA6BG,OAA7B;AAAA,QAAsCC,gBAAtC,GAAoEJ,OAApE,CAAsCI,gBAAtC;AAAA,QAAwDC,OAAxD,GAAoEL,OAApE,CAAwDK,OAAxD;AAEA,SAAKJ,GAAL,GAAWA,GAAX;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACA,SAAKC,OAAL,GAAeA,OAAf;AACA,SAAKC,gBAAL,GAAwBA,gBAAxB;AACA,SAAKC,OAAL,GAAeA,OAAf;AACA;;;;WAED,eACCC,IADD,EAECN,OAFD,EAGe;AAAA;;AACd,UAAMO,YAA0B,GAAG;AAClCN,QAAAA,GAAG,kBAAED,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEC,GAAX,uDAAkB,KAAKA,GADQ;AAElCC,QAAAA,cAAc,EAAE,KAAKA,cAFa;AAGlCC,QAAAA,OAAO,EAAE,KAAKA,OAHoB;AAIlCC,QAAAA,gBAAgB,2BAAEJ,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEI,gBAAX,yEAA+B,KAAKA,gBAJlB;AAKlCC,QAAAA,OAAO,EAAE,KAAKA;AALoB,OAAnC;;AAQA,UAAI,CAACzB,QAAQ,CAAC0B,IAAD,CAAb,EAAqB;AACpB,cAAM,IAAIE,KAAJ,2CAA6CF,IAA7C,QAAN;AACA;;AAED,UAAMb,KAAK,GAAG,IAAIb,QAAQ,CAAC0B,IAAD,CAAZ,CAAmBC,YAAnB,CAAd;AAEA,aAAOd,KAAP;AACA","sourcesContent":["import ConversationStore from '../features/conversation/stores/ConversationStore'\nimport EventStore from '../features/event/stores/EventStore'\nimport ListenerStore from '../features/event/stores/ListenerStore'\nimport OnboardingStore from '../features/onboard/stores/OnboardingStore'\nimport OrganizationStore from '../features/organization/stores/OrganizationStore'\nimport SchemaStore from '../features/schema/stores/SchemaStore'\nimport SkillStore from '../features/skill/stores/SkillStore'\nimport StoreStore from '../features/store/stores/StoreStore'\nimport ViewStore from '../features/view/stores/ViewStore'\nimport { GlobalEmitter } from '../GlobalEmitter'\nimport ServiceFactory from '../services/ServiceFactory'\nimport { ApiClientFactory } from '../types/apiClient.types'\nimport { StoreOptions } from './AbstractStore'\n\nexport interface StoreMap {\n\tonboarding: OnboardingStore\n\tschema: SchemaStore\n\tevent: EventStore\n\tskill: SkillStore\n\torganization: OrganizationStore\n\tconversation: ConversationStore\n\tstore: StoreStore\n\tview: ViewStore\n\tlistener: ListenerStore\n}\n\nexport type StoreCode = keyof StoreMap\n\nconst storeMap = {\n\tonboarding: OnboardingStore,\n\tschema: SchemaStore,\n\tevent: EventStore,\n\tskill: SkillStore,\n\torganization: OrganizationStore,\n\tconversation: ConversationStore,\n\tstore: StoreStore,\n\tview: ViewStore,\n\tlistener: ListenerStore,\n}\n\nexport interface StoreFactoryMethodOptions {\n\tcwd?: string\n\tapiClientFactory?: ApiClientFactory\n}\n\nexport interface StoreFactoryOptions {\n\tcwd: string\n\tserviceFactory: ServiceFactory\n\thomeDir: string\n\tapiClientFactory: ApiClientFactory\n\temitter: GlobalEmitter\n}\n\nexport default class StoreFactory {\n\tprivate serviceFactory: ServiceFactory\n\tprivate cwd: string\n\tprivate homeDir: string\n\tprivate apiClientFactory: ApiClientFactory\n\tprivate emitter: GlobalEmitter\n\n\tpublic constructor(options: StoreFactoryOptions) {\n\t\tconst { cwd, serviceFactory, homeDir, apiClientFactory, emitter } = options\n\n\t\tthis.cwd = cwd\n\t\tthis.serviceFactory = serviceFactory\n\t\tthis.homeDir = homeDir\n\t\tthis.apiClientFactory = apiClientFactory\n\t\tthis.emitter = emitter\n\t}\n\n\tpublic Store<C extends StoreCode>(\n\t\tcode: C,\n\t\toptions?: StoreFactoryMethodOptions\n\t): StoreMap[C] {\n\t\tconst storeOptions: StoreOptions = {\n\t\t\tcwd: options?.cwd ?? this.cwd,\n\t\t\tserviceFactory: this.serviceFactory,\n\t\t\thomeDir: this.homeDir,\n\t\t\tapiClientFactory: options?.apiClientFactory ?? this.apiClientFactory,\n\t\t\temitter: this.emitter,\n\t\t}\n\n\t\tif (!storeMap[code]) {\n\t\t\tthrow new Error(`Could not find store with code '${code}'.`)\n\t\t}\n\n\t\tconst store = new storeMap[code](storeOptions)\n\n\t\treturn store as StoreMap[C]\n\t}\n}\n"],"file":"StoreFactory.js"}
@@ -63,12 +63,12 @@ var _CommandService = _interopRequireDefault(require("../services/CommandService
63
63
 
64
64
  var _ImportService = _interopRequireDefault(require("../services/ImportService"));
65
65
 
66
+ var _LintService = _interopRequireDefault(require("../services/LintService"));
67
+
66
68
  var _ServiceFactory2 = _interopRequireDefault(require("../services/ServiceFactory"));
67
69
 
68
70
  var _StoreFactory2 = _interopRequireDefault(require("../stores/StoreFactory"));
69
71
 
70
- var _AbstractWriter = _interopRequireDefault(require("../writers/AbstractWriter"));
71
-
72
72
  var _WriterFactory2 = _interopRequireDefault(require("../writers/WriterFactory"));
73
73
 
74
74
  var _FeatureFixture2 = _interopRequireDefault(require("./fixtures/FeatureFixture"));
@@ -129,7 +129,7 @@ var AbstractCliTest = /*#__PURE__*/function (_AbstractSpruceTest) {
129
129
  return this.cleanTestDirsAndFiles();
130
130
 
131
131
  case 4:
132
- _AbstractWriter["default"].disableLinting();
132
+ _LintService["default"].disableLinting();
133
133
 
134
134
  _ImportService["default"].setCacheDir(_spruceSkillUtils.diskUtil.createRandomTempDir());
135
135
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/tests/AbstractCliTest.ts"],"names":["AbstractCliTest","cleanTestDirsAndFiles","AbstractWriter","disableLinting","ImportService","setCacheDir","diskUtil","createRandomTempDir","enableCaching","process","env","ENABLE_INSTALL_INTERTAINMENT","originalEnv","testUtil","startLogTimer","SchemaRegistry","getInstance","forgetAllSchemas","cwd","freshTmpDir","homeDir","emitter","undefined","featureInstaller","OnboardingStore","overrideCwd","ui","reset","invocations","setCursorPosition","x","y","clearFixtures","clearCache","SkillStore","clearCurrentSkill","EventStore","CommandService","clearMockResponses","organizationFixture","clearAllOrgs","mercuryFixture","disconnectAll","_ui","isWaitingForInput","Error","doesDirExist","shouldClearCache","deleteDir","shouldCleanupTestSkillDirs","FeatureFixture","deleteOldSkillDirs","pattern","resolveTestPath","matches","match","deleteFile","personFixture","skillFixture","viewFixture","tmpDirectory","resolveTestDir","uuid","v4","fs","ensureDirSync","SpyInterface","CliGlobalEmitter","Emitter","pathAfterTestDirsAndFiles","pathUtil","join","cliRoot","options","Cli","fixture","linkLocalPackages","type","sf","ServiceFactory","Service","getEmitter","serviceFactory","apiClientFactory","getMercuryFixture","getApiClientFactory","getFeatureInstaller","MercuryFixture","PersonFixture","writerFactory","WriterFactory","viewWriter","Writer","fileDescriptions","ViewFixture","Action","templates","settings","execute","promise","waitForInput","sendInput","results","OrganizationFixture","getPersonFixture","StoreFactory","SkillFixture","filePath","resolveHashSprucePath","storeFactory","actionExecuter","ActionExecuter","FeatureInstallerFactory","WithAllFeatures","code","Store","isInstalled","assert","isTrue","files","file","checker","check","path","connectToApi","all","dir","wait","timeout","log","featureCode","actionCode","executer","shouldThrowOnListenerError","actionFactory","ActionFactory","optionOverrides","shouldInstallMissingDependencies","featureInstallerFactory","shouldAutoHandleDependencies","label","last","getLastInvocation","doesInclude","choices","find","o","value","AbstractSpruceTest","__dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAGA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;IAM8BA,e;;;;;;;;;;;;;qGAc7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,uBAEO,KAAKC,qBAAL,EAFP;;AAAA;AAICC,2CAAeC,cAAf;;AAEAC,0CAAcC,WAAd,CAA0BC,2BAASC,mBAAT,EAA1B;;AACAH,0CAAcI,aAAd;;AAEAC,gBAAAA,OAAO,CAACC,GAAR,CAAYC,4BAAZ,GAA2C,OAA3C;AAEA,qBAAKC,WAAL,qBAAwBH,OAAO,CAACC,GAAhC;;AAXD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;sGAcA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAGC;AACAD,gBAAAA,OAAO,CAACC,GA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IAA7B,CACb,UAACC,CAAD;AAAA,eAAYA,CAAC,CAACN,KAAF,KAAYA,KAAxB;AAAA,OADa,CAAd;AAIA,WAAK,KAAKlH,EAAL,CAAQ2E,SAAR,WAAqB9C,KAAK,CAAC4F,KAA3B,EAAL;AACA;;;EA3aoDC,gB;;;iCAAxBpJ,e,aACFsE,iBAASC,IAAT,CAAc8E,SAAd,EAAyB,IAAzB,C;iCADErJ,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e","sourcesContent":["import pathUtil from 'path'\nimport { SchemaRegistry } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { templates } from '@sprucelabs/spruce-templates'\nimport AbstractSpruceTest, { assert } from '@sprucelabs/test'\nimport fs from 'fs-extra'\nimport globby from 'globby'\nimport * as uuid from 'uuid'\nimport { CliBootOptions } from '../cli'\nimport AbstractAction from '../features/AbstractAction'\nimport { FeatureOptions } from '../features/AbstractFeature'\nimport ActionExecuter, {\n\tActionExecuterOptions,\n} from '../features/ActionExecuter'\nimport ActionFactory from '../features/ActionFactory'\nimport EventStore from '../features/event/stores/EventStore'\nimport FeatureInstaller from '../features/FeatureInstaller'\nimport FeatureInstallerFactory from '../features/FeatureInstallerFactory'\nimport { FeatureActionResponse, FeatureCode } from '../features/features.types'\nimport OnboardingStore from '../features/onboard/stores/OnboardingStore'\nimport SkillStore from '../features/skill/stores/SkillStore'\nimport CliGlobalEmitter, { GlobalEmitter } from '../GlobalEmitter'\nimport SpyInterface from '../interfaces/SpyInterface'\nimport CommandService from '../services/CommandService'\nimport ImportService from '../services/ImportService'\nimport ServiceFactory, { Service, ServiceMap } from '../services/ServiceFactory'\nimport StoreFactory, {\n\tStoreCode,\n\tStoreFactoryMethodOptions,\n\tStoreFactoryOptions,\n\tStoreMap,\n} from '../stores/StoreFactory'\nimport { ApiClientFactoryOptions } from '../types/apiClient.types'\nimport { OptionOverrides } from '../types/cli.types'\nimport AbstractWriter from '../writers/AbstractWriter'\nimport WriterFactory from '../writers/WriterFactory'\nimport FeatureFixture, {\n\tFeatureFixtureOptions,\n} from './fixtures/FeatureFixture'\nimport MercuryFixture from './fixtures/MercuryFixture'\nimport OrganizationFixture from './fixtures/OrganizationFixture'\nimport PersonFixture from './fixtures/PersonFixture'\nimport SkillFixture from './fixtures/SkillFixture'\nimport ViewFixture from './fixtures/ViewFixture'\nimport testUtil from './utilities/test.utility'\n\ntype ExecuterOptions = Partial<ActionExecuterOptions> & {\n\toptionOverrides?: OptionOverrides\n}\n\nexport default abstract class AbstractCliTest extends AbstractSpruceTest {\n\tprotected static cliRoot = pathUtil.join(__dirname, '..')\n\tprotected static homeDir: string\n\n\tprivate static _ui: SpyInterface\n\tprivate static emitter?: GlobalEmitter\n\tprivate static mercuryFixture?: MercuryFixture\n\tprivate static personFixture?: PersonFixture\n\tprivate static organizationFixture?: OrganizationFixture\n\tprivate static skillFixture?: SkillFixture\n\tprivate static featureInstaller?: FeatureInstaller\n\tprivate static viewFixture?: ViewFixture\n\tprivate static originalEnv: { [x: string]: string | undefined }\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tawait this.cleanTestDirsAndFiles()\n\n\t\tAbstractWriter.disableLinting()\n\n\t\tImportService.setCacheDir(diskUtil.createRandomTempDir())\n\t\tImportService.enableCaching()\n\n\t\tprocess.env.ENABLE_INSTALL_INTERTAINMENT = 'false'\n\n\t\tthis.originalEnv = { ...process.env }\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\n\t\t//@ts-ignore\n\t\tprocess.env = { ...this.originalEnv }\n\n\t\ttestUtil.startLogTimer()\n\n\t\tSchemaRegistry.getInstance().forgetAllSchemas()\n\n\t\tthis.cwd = this.freshTmpDir()\n\t\tthis.homeDir = this.freshTmpDir()\n\n\t\tthis.emitter = undefined\n\t\tthis.featureInstaller = undefined\n\n\t\tOnboardingStore.overrideCwd(diskUtil.createRandomTempDir())\n\n\t\tthis.ui.reset()\n\t\tthis.ui.invocations = []\n\t\tthis.ui.setCursorPosition({ x: 0, y: 0 })\n\n\t\tthis.clearFixtures()\n\n\t\tImportService.clearCache()\n\t\tSkillStore.clearCurrentSkill()\n\t\tEventStore.clearCache()\n\t\tCommandService.clearMockResponses()\n\t}\n\n\tprotected static async afterEach() {\n\t\tawait super.afterEach()\n\n\t\tawait this.organizationFixture?.clearAllOrgs()\n\t\tawait this.mercuryFixture?.disconnectAll()\n\n\t\tthis.clearFixtures()\n\n\t\tif (this._ui?.isWaitingForInput()) {\n\t\t\tthrow new Error(\n\t\t\t\t`Terminal interface is waiting for input. Make sure you are invoking this.term.sendInput() as many times as needed.`\n\t\t\t)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.cwd) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.cwd)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.homeDir) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.homeDir)\n\t\t}\n\t}\n\n\tprotected static async afterAll() {\n\t\tawait super.afterAll()\n\t\tif (testUtil.shouldCleanupTestSkillDirs()) {\n\t\t\tFeatureFixture.deleteOldSkillDirs()\n\t\t}\n\t}\n\n\tprivate static async cleanTestDirsAndFiles() {\n\t\tconst pattern = this.resolveTestPath('**/*.d.ts')\n\t\tconst matches = await globby(pattern)\n\n\t\tfor (const match of matches) {\n\t\t\tdiskUtil.deleteFile(match)\n\t\t}\n\t}\n\n\tprivate static clearFixtures() {\n\t\tthis.emitter = undefined\n\t\tthis.mercuryFixture = undefined\n\t\tthis.organizationFixture = undefined\n\t\tthis.personFixture = undefined\n\t\tthis.skillFixture = undefined\n\t\tthis.viewFixture = undefined\n\t}\n\n\tprotected static freshTmpDir() {\n\t\tconst tmpDirectory = testUtil.resolveTestDir(uuid.v4())\n\t\tfs.ensureDirSync(tmpDirectory)\n\t\treturn tmpDirectory\n\t}\n\n\tprotected static get ui() {\n\t\tif (!this._ui) {\n\t\t\tthis._ui = new SpyInterface()\n\t\t}\n\n\t\treturn this._ui\n\t}\n\n\tprotected static getEmitter() {\n\t\tif (!this.emitter) {\n\t\t\tthis.emitter = CliGlobalEmitter.Emitter()\n\t\t}\n\t\treturn this.emitter\n\t}\n\n\tprotected static resolveTestPath(...pathAfterTestDirsAndFiles: string[]) {\n\t\treturn pathUtil.join(\n\t\t\tthis.cliRoot,\n\t\t\t'__tests__',\n\t\t\t'testDirsAndFiles',\n\t\t\t...pathAfterTestDirsAndFiles\n\t\t)\n\t}\n\n\tprotected static async Cli(options?: CliBootOptions) {\n\t\treturn this.FeatureFixture(options).Cli({\n\t\t\tcwd: this.cwd,\n\t\t\thomeDir: this.homeDir,\n\t\t\t...(options ?? {}),\n\t\t})\n\t}\n\n\tprotected static async linkLocalPackages() {\n\t\tconst fixture = this.FeatureFixture()\n\t\tawait fixture.linkLocalPackages()\n\t}\n\n\tprotected static Service<S extends Service>(\n\t\ttype: S,\n\t\tcwd?: string\n\t): ServiceMap[S] {\n\t\tconst sf = this.ServiceFactory()\n\t\treturn sf.Service(cwd ?? this.cwd, type)\n\t}\n\n\tprotected static ServiceFactory() {\n\t\treturn new ServiceFactory()\n\t}\n\n\tprotected static FeatureFixture(options?: Partial<FeatureFixtureOptions>) {\n\t\tconst emitter = options?.emitter ?? this.getEmitter()\n\n\t\treturn new FeatureFixture({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory: this.ServiceFactory(),\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tfeatureInstaller: this.getFeatureInstaller({ emitter }),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static getMercuryFixture() {\n\t\tif (!this.mercuryFixture) {\n\t\t\tthis.mercuryFixture = new MercuryFixture(this.cwd, this.ServiceFactory())\n\t\t}\n\n\t\treturn this.mercuryFixture\n\t}\n\n\tprotected static getPersonFixture() {\n\t\tif (!this.personFixture) {\n\t\t\tthis.personFixture = new PersonFixture(\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.personFixture\n\t}\n\n\tprotected static getViewFixture() {\n\t\tif (!this.viewFixture) {\n\t\t\tconst writerFactory = this.WriterFactory()\n\n\t\t\tconst viewWriter = writerFactory.Writer('view', { fileDescriptions: [] })\n\t\t\tthis.viewFixture = new ViewFixture(\n\t\t\t\tthis.cwd,\n\t\t\t\tviewWriter,\n\t\t\t\tthis.Action('view', 'sync')\n\t\t\t)\n\t\t}\n\n\t\treturn this.viewFixture\n\t}\n\n\tprivate static WriterFactory() {\n\t\treturn new WriterFactory({\n\t\t\ttemplates,\n\t\t\tui: this.ui,\n\t\t\tsettings: this.Service('settings'),\n\t\t})\n\t}\n\n\tprotected static async skipInstallSkillPrompts<\n\t\tE extends () => Promise<FeatureActionResponse>\n\t>(\n\t\texecute?: E\n\t): Promise<E extends undefined ? undefined : FeatureActionResponse> {\n\t\tconst promise = execute?.()\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('n')\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('')\n\n\t\tconst results = await promise\n\n\t\treturn results as any\n\t}\n\n\tprotected static getOrganizationFixture() {\n\t\tif (!this.organizationFixture) {\n\t\t\tthis.organizationFixture = new OrganizationFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.organizationFixture\n\t}\n\n\tprotected static getSkillFixture() {\n\t\tif (!this.skillFixture) {\n\t\t\tthis.skillFixture = new SkillFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory(),\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.skillFixture\n\t}\n\n\tprotected static resolveHashSprucePath(...filePath: string[]) {\n\t\treturn diskUtil.resolveHashSprucePath(this.cwd, ...filePath)\n\t}\n\n\tprotected static getFeatureInstaller(options?: Partial<FeatureOptions>) {\n\t\tif (!this.featureInstaller) {\n\t\t\tconst serviceFactory = this.ServiceFactory()\n\t\t\tconst storeFactory = this.StoreFactory(options)\n\t\t\tconst emitter = this.getEmitter()\n\t\t\tconst apiClientFactory = this.getMercuryFixture().getApiClientFactory()\n\n\t\t\tconst actionExecuter = this.ActionExecuter()\n\n\t\t\tthis.featureInstaller = FeatureInstallerFactory.WithAllFeatures({\n\t\t\t\tcwd: this.cwd,\n\t\t\t\tserviceFactory,\n\t\t\t\tstoreFactory,\n\t\t\t\tui: this.ui,\n\t\t\t\temitter,\n\t\t\t\tapiClientFactory,\n\t\t\t\tactionExecuter,\n\t\t\t\t...options,\n\t\t\t})\n\t\t}\n\n\t\treturn this.featureInstaller\n\t}\n\n\tprotected static StoreFactory(options?: Partial<StoreFactoryOptions>) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\n\t\treturn new StoreFactory({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\thomeDir: this.homeDir,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\temitter: this.getEmitter(),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static Store<C extends StoreCode>(\n\t\tcode: C,\n\t\toptions?: StoreFactoryMethodOptions\n\t): StoreMap[C] {\n\t\treturn this.StoreFactory().Store(code, {\n\t\t\tcwd: this.cwd,\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static async waitForInput() {\n\t\treturn this.ui.waitForInput()\n\t}\n\n\tprotected static async assertIsFeatureInstalled(code: FeatureCode) {\n\t\tconst featureInstaller = this.getFeatureInstaller()\n\t\tconst isInstalled = await featureInstaller.isInstalled(code)\n\n\t\tassert.isTrue(isInstalled)\n\t}\n\n\tprotected static async assertValidActionResponseFiles(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tfor (const file of results.files ?? []) {\n\t\t\tconst checker = this.Service('typeChecker')\n\t\t\tawait checker.check(file.path)\n\t\t}\n\n\t\t// await Promise.all(\n\t\t// \t(results.files ?? []).map((file) => {\n\t\t// \t\tconst checker = this.Service('typeChecker')\n\t\t// \t\treturn checker.check(file.path)\n\t\t// \t})\n\t\t// )\n\t}\n\n\tprotected static async connectToApi(options?: ApiClientFactoryOptions) {\n\t\treturn this.getMercuryFixture().connectToApi(options)\n\t}\n\n\tprotected static async openInVsCode(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Action('vscode', 'setup').execute({ all: true })\n\n\t\tawait this.Service('command').execute(\n\t\t\t`code ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static async openInFinder(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Service('command').execute(\n\t\t\t`open ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static log(...args: any[]) {\n\t\ttestUtil.log(...args)\n\t}\n\n\tprotected static Action<\n\t\tAction extends AbstractAction = AbstractAction,\n\t\tF extends FeatureCode = FeatureCode\n\t>(featureCode: F, actionCode: string, options?: ExecuterOptions): Action {\n\t\tconst executer = this.ActionExecuter({\n\t\t\tshouldThrowOnListenerError: true,\n\t\t\t...options,\n\t\t}).Action(featureCode, actionCode)\n\n\t\treturn executer as any\n\t}\n\n\tprotected static ActionExecuter(options?: ExecuterOptions) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\t\tconst writerFactory = this.WriterFactory()\n\n\t\tconst emitter = this.getEmitter()\n\n\t\tconst actionFactory = new ActionFactory({\n\t\t\twriterFactory,\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\tstoreFactory: this.StoreFactory(),\n\t\t\ttemplates,\n\t\t\toptionOverrides: {\n\t\t\t\t'sync.schemas': {\n\t\t\t\t\tshouldInstallMissingDependencies: true,\n\t\t\t\t},\n\t\t\t\t...options?.optionOverrides,\n\t\t\t},\n\t\t})\n\n\t\tconst executer = new ActionExecuter({\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tactionFactory,\n\t\t\tfeatureInstallerFactory: () => {\n\t\t\t\treturn this.getFeatureInstaller()\n\t\t\t},\n\t\t\tshouldAutoHandleDependencies: false,\n\t\t\t...options,\n\t\t})\n\n\t\treturn executer\n\t}\n\n\tprotected static selectOptionBasedOnLabel(label: string) {\n\t\tconst last = this.ui.getLastInvocation()\n\t\tassert.doesInclude(last.options.options.choices, {\n\t\t\tlabel,\n\t\t})\n\n\t\tconst match = last.options.options.choices.find(\n\t\t\t(o: any) => o.label === label\n\t\t)\n\n\t\tvoid this.ui.sendInput(`${match.value}`)\n\t}\n}\n"],"file":"AbstractCliTest.js"}
1
+ {"version":3,"sources":["../../src/tests/AbstractCliTest.ts"],"names":["AbstractCliTest","cleanTestDirsAndFiles","LintService","disableLinting","ImportService","setCacheDir","diskUtil","createRandomTempDir","enableCaching","process","env","ENABLE_INSTALL_INTERTAINMENT","originalEnv","testUtil","startLogTimer","SchemaRegistry","getInstance","forgetAllSchemas","cwd","freshTmpDir","homeDir","emitter","undefined","featureInstaller","OnboardingStore","overrideCwd","ui","reset","invocations","setCursorPosition","x","y","clearFixtures","clearCache","SkillStore","clearCurrentSkill","EventStore","CommandService","clearMockResponses","organizationFixture","clearAllOrgs","mercuryFixture","disconnectAll","_ui","isWaitingForInput","Error","doesDirExist","shouldClearCache","deleteDir","shouldCleanupTestSkillDirs","FeatureFixture","deleteOldSkillDirs","pattern","resolveTestPath","matches","match","deleteFile","personFixture","skillFixture","viewFixture","tmpDirectory","resolveTestDir","uuid","v4","fs","ensureDirSync","SpyInterface","CliGlobalEmitter","Emitter","pathAfterTestDirsAndFiles","pathUtil","join","cliRoot","options","Cli","fixture","linkLocalPackages","type","sf","ServiceFactory","Service","getEmitter","serviceFactory","apiClientFactory","getMercuryFixture","getApiClientFactory","getFeatureInstaller","MercuryFixture","PersonFixture","writerFactory","WriterFactory","viewWriter","Writer","fileDescriptions","ViewFixture","Action","templates","settings","execute","promise","waitForInput","sendInput","results","OrganizationFixture","getPersonFixture","StoreFactory","SkillFixture","filePath","resolveHashSprucePath","storeFactory","actionExecuter","ActionExecuter","FeatureInstallerFactory","WithAllFeatures","code","Store","isInstalled","assert","isTrue","files","file","checker","check","path","connectToApi","all","dir","wait","timeout","log","featureCode","actionCode","executer","shouldThrowOnListenerError","actionFactory","ActionFactory","optionOverrides","shouldInstallMissingDependencies","featureInstallerFactory","shouldAutoHandleDependencies","label","last","getLastInvocation","doesInclude","choices","find","o","value","AbstractSpruceTest","__dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAGA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;IAM8BA,e;;;;;;;;;;;;;qGAc7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,uBAEO,KAAKC,qBAAL,EAFP;;AAAA;AAICC,wCAAYC,cAAZ;;AAEAC,0CAAcC,WAAd,CAA0BC,2BAASC,mBAAT,EAA1B;;AACAH,0CAAcI,aAAd;;AAEAC,gBAAAA,OAAO,CAACC,GAAR,CAAYC,4BAAZ,GAA2C,OAA3C;AAEA,qBAAKC,WAAL,qBAAwBH,OAAO,CAACC,GAAhC;;AAXD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;sGAcA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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E,OAAL,CAAaA,OAAb,CAAqBuE,OAArB,CAA6BC,IAA7B,CACb,UAACC,CAAD;AAAA,eAAYA,CAAC,CAACN,KAAF,KAAYA,KAAxB;AAAA,OADa,CAAd;AAIA,WAAK,KAAKlH,EAAL,CAAQ2E,SAAR,WAAqB9C,KAAK,CAAC4F,KAA3B,EAAL;AACA;;;EA3aoDC,gB;;;iCAAxBpJ,e,aACFsE,iBAASC,IAAT,CAAc8E,SAAd,EAAyB,IAAzB,C;iCADErJ,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e","sourcesContent":["import pathUtil from 'path'\nimport { SchemaRegistry } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { templates } from '@sprucelabs/spruce-templates'\nimport AbstractSpruceTest, { assert } from '@sprucelabs/test'\nimport fs from 'fs-extra'\nimport globby from 'globby'\nimport * as uuid from 'uuid'\nimport { CliBootOptions } from '../cli'\nimport AbstractAction from '../features/AbstractAction'\nimport { FeatureOptions } from '../features/AbstractFeature'\nimport ActionExecuter, {\n\tActionExecuterOptions,\n} from '../features/ActionExecuter'\nimport ActionFactory from '../features/ActionFactory'\nimport EventStore from '../features/event/stores/EventStore'\nimport FeatureInstaller from '../features/FeatureInstaller'\nimport FeatureInstallerFactory from '../features/FeatureInstallerFactory'\nimport { FeatureActionResponse, FeatureCode } from '../features/features.types'\nimport OnboardingStore from '../features/onboard/stores/OnboardingStore'\nimport SkillStore from '../features/skill/stores/SkillStore'\nimport CliGlobalEmitter, { GlobalEmitter } from '../GlobalEmitter'\nimport SpyInterface from '../interfaces/SpyInterface'\nimport CommandService from '../services/CommandService'\nimport ImportService from '../services/ImportService'\nimport LintService from '../services/LintService'\nimport ServiceFactory, { Service, ServiceMap } from '../services/ServiceFactory'\nimport StoreFactory, {\n\tStoreCode,\n\tStoreFactoryMethodOptions,\n\tStoreFactoryOptions,\n\tStoreMap,\n} from '../stores/StoreFactory'\nimport { ApiClientFactoryOptions } from '../types/apiClient.types'\nimport { OptionOverrides } from '../types/cli.types'\nimport WriterFactory from '../writers/WriterFactory'\nimport FeatureFixture, {\n\tFeatureFixtureOptions,\n} from './fixtures/FeatureFixture'\nimport MercuryFixture from './fixtures/MercuryFixture'\nimport OrganizationFixture from './fixtures/OrganizationFixture'\nimport PersonFixture from './fixtures/PersonFixture'\nimport SkillFixture from './fixtures/SkillFixture'\nimport ViewFixture from './fixtures/ViewFixture'\nimport testUtil from './utilities/test.utility'\n\ntype ExecuterOptions = Partial<ActionExecuterOptions> & {\n\toptionOverrides?: OptionOverrides\n}\n\nexport default abstract class AbstractCliTest extends AbstractSpruceTest {\n\tprotected static cliRoot = pathUtil.join(__dirname, '..')\n\tprotected static homeDir: string\n\n\tprivate static _ui: SpyInterface\n\tprivate static emitter?: GlobalEmitter\n\tprivate static mercuryFixture?: MercuryFixture\n\tprivate static personFixture?: PersonFixture\n\tprivate static organizationFixture?: OrganizationFixture\n\tprivate static skillFixture?: SkillFixture\n\tprivate static featureInstaller?: FeatureInstaller\n\tprivate static viewFixture?: ViewFixture\n\tprivate static originalEnv: { [x: string]: string | undefined }\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tawait this.cleanTestDirsAndFiles()\n\n\t\tLintService.disableLinting()\n\n\t\tImportService.setCacheDir(diskUtil.createRandomTempDir())\n\t\tImportService.enableCaching()\n\n\t\tprocess.env.ENABLE_INSTALL_INTERTAINMENT = 'false'\n\n\t\tthis.originalEnv = { ...process.env }\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\n\t\t//@ts-ignore\n\t\tprocess.env = { ...this.originalEnv }\n\n\t\ttestUtil.startLogTimer()\n\n\t\tSchemaRegistry.getInstance().forgetAllSchemas()\n\n\t\tthis.cwd = this.freshTmpDir()\n\t\tthis.homeDir = this.freshTmpDir()\n\n\t\tthis.emitter = undefined\n\t\tthis.featureInstaller = undefined\n\n\t\tOnboardingStore.overrideCwd(diskUtil.createRandomTempDir())\n\n\t\tthis.ui.reset()\n\t\tthis.ui.invocations = []\n\t\tthis.ui.setCursorPosition({ x: 0, y: 0 })\n\n\t\tthis.clearFixtures()\n\n\t\tImportService.clearCache()\n\t\tSkillStore.clearCurrentSkill()\n\t\tEventStore.clearCache()\n\t\tCommandService.clearMockResponses()\n\t}\n\n\tprotected static async afterEach() {\n\t\tawait super.afterEach()\n\n\t\tawait this.organizationFixture?.clearAllOrgs()\n\t\tawait this.mercuryFixture?.disconnectAll()\n\n\t\tthis.clearFixtures()\n\n\t\tif (this._ui?.isWaitingForInput()) {\n\t\t\tthrow new Error(\n\t\t\t\t`Terminal interface is waiting for input. Make sure you are invoking this.term.sendInput() as many times as needed.`\n\t\t\t)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.cwd) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.cwd)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.homeDir) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.homeDir)\n\t\t}\n\t}\n\n\tprotected static async afterAll() {\n\t\tawait super.afterAll()\n\t\tif (testUtil.shouldCleanupTestSkillDirs()) {\n\t\t\tFeatureFixture.deleteOldSkillDirs()\n\t\t}\n\t}\n\n\tprivate static async cleanTestDirsAndFiles() {\n\t\tconst pattern = this.resolveTestPath('**/*.d.ts')\n\t\tconst matches = await globby(pattern)\n\n\t\tfor (const match of matches) {\n\t\t\tdiskUtil.deleteFile(match)\n\t\t}\n\t}\n\n\tprivate static clearFixtures() {\n\t\tthis.emitter = undefined\n\t\tthis.mercuryFixture = undefined\n\t\tthis.organizationFixture = undefined\n\t\tthis.personFixture = undefined\n\t\tthis.skillFixture = undefined\n\t\tthis.viewFixture = undefined\n\t}\n\n\tprotected static freshTmpDir() {\n\t\tconst tmpDirectory = testUtil.resolveTestDir(uuid.v4())\n\t\tfs.ensureDirSync(tmpDirectory)\n\t\treturn tmpDirectory\n\t}\n\n\tprotected static get ui() {\n\t\tif (!this._ui) {\n\t\t\tthis._ui = new SpyInterface()\n\t\t}\n\n\t\treturn this._ui\n\t}\n\n\tprotected static getEmitter() {\n\t\tif (!this.emitter) {\n\t\t\tthis.emitter = CliGlobalEmitter.Emitter()\n\t\t}\n\t\treturn this.emitter\n\t}\n\n\tprotected static resolveTestPath(...pathAfterTestDirsAndFiles: string[]) {\n\t\treturn pathUtil.join(\n\t\t\tthis.cliRoot,\n\t\t\t'__tests__',\n\t\t\t'testDirsAndFiles',\n\t\t\t...pathAfterTestDirsAndFiles\n\t\t)\n\t}\n\n\tprotected static async Cli(options?: CliBootOptions) {\n\t\treturn this.FeatureFixture(options).Cli({\n\t\t\tcwd: this.cwd,\n\t\t\thomeDir: this.homeDir,\n\t\t\t...(options ?? {}),\n\t\t})\n\t}\n\n\tprotected static async linkLocalPackages() {\n\t\tconst fixture = this.FeatureFixture()\n\t\tawait fixture.linkLocalPackages()\n\t}\n\n\tprotected static Service<S extends Service>(\n\t\ttype: S,\n\t\tcwd?: string\n\t): ServiceMap[S] {\n\t\tconst sf = this.ServiceFactory()\n\t\treturn sf.Service(cwd ?? this.cwd, type)\n\t}\n\n\tprotected static ServiceFactory() {\n\t\treturn new ServiceFactory()\n\t}\n\n\tprotected static FeatureFixture(options?: Partial<FeatureFixtureOptions>) {\n\t\tconst emitter = options?.emitter ?? this.getEmitter()\n\n\t\treturn new FeatureFixture({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory: this.ServiceFactory(),\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tfeatureInstaller: this.getFeatureInstaller({ emitter }),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static getMercuryFixture() {\n\t\tif (!this.mercuryFixture) {\n\t\t\tthis.mercuryFixture = new MercuryFixture(this.cwd, this.ServiceFactory())\n\t\t}\n\n\t\treturn this.mercuryFixture\n\t}\n\n\tprotected static getPersonFixture() {\n\t\tif (!this.personFixture) {\n\t\t\tthis.personFixture = new PersonFixture(\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.personFixture\n\t}\n\n\tprotected static getViewFixture() {\n\t\tif (!this.viewFixture) {\n\t\t\tconst writerFactory = this.WriterFactory()\n\n\t\t\tconst viewWriter = writerFactory.Writer('view', { fileDescriptions: [] })\n\t\t\tthis.viewFixture = new ViewFixture(\n\t\t\t\tthis.cwd,\n\t\t\t\tviewWriter,\n\t\t\t\tthis.Action('view', 'sync')\n\t\t\t)\n\t\t}\n\n\t\treturn this.viewFixture\n\t}\n\n\tprivate static WriterFactory() {\n\t\treturn new WriterFactory({\n\t\t\ttemplates,\n\t\t\tui: this.ui,\n\t\t\tsettings: this.Service('settings'),\n\t\t})\n\t}\n\n\tprotected static async skipInstallSkillPrompts<\n\t\tE extends () => Promise<FeatureActionResponse>\n\t>(\n\t\texecute?: E\n\t): Promise<E extends undefined ? undefined : FeatureActionResponse> {\n\t\tconst promise = execute?.()\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('n')\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('')\n\n\t\tconst results = await promise\n\n\t\treturn results as any\n\t}\n\n\tprotected static getOrganizationFixture() {\n\t\tif (!this.organizationFixture) {\n\t\t\tthis.organizationFixture = new OrganizationFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.organizationFixture\n\t}\n\n\tprotected static getSkillFixture() {\n\t\tif (!this.skillFixture) {\n\t\t\tthis.skillFixture = new SkillFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory(),\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.skillFixture\n\t}\n\n\tprotected static resolveHashSprucePath(...filePath: string[]) {\n\t\treturn diskUtil.resolveHashSprucePath(this.cwd, ...filePath)\n\t}\n\n\tprotected static getFeatureInstaller(options?: Partial<FeatureOptions>) {\n\t\tif (!this.featureInstaller) {\n\t\t\tconst serviceFactory = this.ServiceFactory()\n\t\t\tconst storeFactory = this.StoreFactory(options)\n\t\t\tconst emitter = this.getEmitter()\n\t\t\tconst apiClientFactory = this.getMercuryFixture().getApiClientFactory()\n\n\t\t\tconst actionExecuter = this.ActionExecuter()\n\n\t\t\tthis.featureInstaller = FeatureInstallerFactory.WithAllFeatures({\n\t\t\t\tcwd: this.cwd,\n\t\t\t\tserviceFactory,\n\t\t\t\tstoreFactory,\n\t\t\t\tui: this.ui,\n\t\t\t\temitter,\n\t\t\t\tapiClientFactory,\n\t\t\t\tactionExecuter,\n\t\t\t\t...options,\n\t\t\t})\n\t\t}\n\n\t\treturn this.featureInstaller\n\t}\n\n\tprotected static StoreFactory(options?: Partial<StoreFactoryOptions>) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\n\t\treturn new StoreFactory({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\thomeDir: this.homeDir,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\temitter: this.getEmitter(),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static Store<C extends StoreCode>(\n\t\tcode: C,\n\t\toptions?: StoreFactoryMethodOptions\n\t): StoreMap[C] {\n\t\treturn this.StoreFactory().Store(code, {\n\t\t\tcwd: this.cwd,\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static async waitForInput() {\n\t\treturn this.ui.waitForInput()\n\t}\n\n\tprotected static async assertIsFeatureInstalled(code: FeatureCode) {\n\t\tconst featureInstaller = this.getFeatureInstaller()\n\t\tconst isInstalled = await featureInstaller.isInstalled(code)\n\n\t\tassert.isTrue(isInstalled)\n\t}\n\n\tprotected static async assertValidActionResponseFiles(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tfor (const file of results.files ?? []) {\n\t\t\tconst checker = this.Service('typeChecker')\n\t\t\tawait checker.check(file.path)\n\t\t}\n\n\t\t// await Promise.all(\n\t\t// \t(results.files ?? []).map((file) => {\n\t\t// \t\tconst checker = this.Service('typeChecker')\n\t\t// \t\treturn checker.check(file.path)\n\t\t// \t})\n\t\t// )\n\t}\n\n\tprotected static async connectToApi(options?: ApiClientFactoryOptions) {\n\t\treturn this.getMercuryFixture().connectToApi(options)\n\t}\n\n\tprotected static async openInVsCode(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Action('vscode', 'setup').execute({ all: true })\n\n\t\tawait this.Service('command').execute(\n\t\t\t`code ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static async openInFinder(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Service('command').execute(\n\t\t\t`open ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static log(...args: any[]) {\n\t\ttestUtil.log(...args)\n\t}\n\n\tprotected static Action<\n\t\tAction extends AbstractAction = AbstractAction,\n\t\tF extends FeatureCode = FeatureCode\n\t>(featureCode: F, actionCode: string, options?: ExecuterOptions): Action {\n\t\tconst executer = this.ActionExecuter({\n\t\t\tshouldThrowOnListenerError: true,\n\t\t\t...options,\n\t\t}).Action(featureCode, actionCode)\n\n\t\treturn executer as any\n\t}\n\n\tprotected static ActionExecuter(options?: ExecuterOptions) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\t\tconst writerFactory = this.WriterFactory()\n\n\t\tconst emitter = this.getEmitter()\n\n\t\tconst actionFactory = new ActionFactory({\n\t\t\twriterFactory,\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\tstoreFactory: this.StoreFactory(),\n\t\t\ttemplates,\n\t\t\toptionOverrides: {\n\t\t\t\t'sync.schemas': {\n\t\t\t\t\tshouldInstallMissingDependencies: true,\n\t\t\t\t},\n\t\t\t\t...options?.optionOverrides,\n\t\t\t},\n\t\t})\n\n\t\tconst executer = new ActionExecuter({\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tactionFactory,\n\t\t\tfeatureInstallerFactory: () => {\n\t\t\t\treturn this.getFeatureInstaller()\n\t\t\t},\n\t\t\tshouldAutoHandleDependencies: false,\n\t\t\t...options,\n\t\t})\n\n\t\treturn executer\n\t}\n\n\tprotected static selectOptionBasedOnLabel(label: string) {\n\t\tconst last = this.ui.getLastInvocation()\n\t\tassert.doesInclude(last.options.options.choices, {\n\t\t\tlabel,\n\t\t})\n\n\t\tconst match = last.options.options.choices.find(\n\t\t\t(o: any) => o.label === label\n\t\t)\n\n\t\tvoid this.ui.sendInput(`${match.value}`)\n\t}\n}\n"],"file":"AbstractCliTest.js"}
@@ -28,14 +28,11 @@ export default abstract class AbstractWriter {
28
28
  private upgradeMode;
29
29
  private fileDescriptions;
30
30
  private shouldConfirmBeforeWriting;
31
- private static isLintingEnabled;
32
31
  private firstFileWriteMessage?;
33
32
  private hasShownFirstWriteMessage;
34
33
  private settings;
35
34
  constructor(options: WriterOptions);
36
35
  protected lint(file: string): Promise<void>;
37
- static disableLinting(): void;
38
- static enableLinting(): void;
39
36
  protected writeDirectoryTemplate(options: WriteDirectoryTemplateOptions): Promise<WriteResults>;
40
37
  protected writeFileIfChangedMixinResults(destination: string, contents: string, description: string, results?: WriteResults, cwd?: string): Promise<WriteResults>;
41
38
  private isFileDifferent;
@@ -65,16 +65,11 @@ var AbstractWriter = /*#__PURE__*/function () {
65
65
  while (1) {
66
66
  switch (_context.prev = _context.next) {
67
67
  case 0:
68
- if (!AbstractWriter.isLintingEnabled) {
69
- _context.next = 4;
70
- break;
71
- }
72
-
73
68
  this.ui.startLoading("Linting ".concat(_path["default"].basename(file), "..."));
74
- _context.next = 4;
69
+ _context.next = 3;
75
70
  return (_this$linter = this.linter) === null || _this$linter === void 0 ? void 0 : _this$linter.fix(file)["catch"](function () {});
76
71
 
77
- case 4:
72
+ case 3:
78
73
  case "end":
79
74
  return _context.stop();
80
75
  }
@@ -409,20 +404,9 @@ var AbstractWriter = /*#__PURE__*/function () {
409
404
  var isDir = _spruceSkillUtils.diskUtil.doesDirExist(dirOrFile) && _fs["default"].lstatSync(dirOrFile).isDirectory() && _path["default"].extname(dirOrFile).length === 0;
410
405
  return isDir ? _spruceSkillUtils.diskUtil.resolvePath(dirOrFile, fallbackFileName) : dirOrFile;
411
406
  }
412
- }], [{
413
- key: "disableLinting",
414
- value: function disableLinting() {
415
- this.isLintingEnabled = false;
416
- }
417
- }, {
418
- key: "enableLinting",
419
- value: function enableLinting() {
420
- this.isLintingEnabled = true;
421
- }
422
407
  }]);
423
408
  return AbstractWriter;
424
409
  }();
425
410
 
426
411
  exports["default"] = AbstractWriter;
427
- (0, _defineProperty2["default"])(AbstractWriter, "isLintingEnabled", true);
428
412
  //# sourceMappingURL=AbstractWriter.js.map