@sprucelabs/spruce-cli 14.28.8 → 14.29.3
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/CHANGELOG.md +35 -0
- package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js +13 -9
- package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.d.ts +1 -1
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js +24 -14
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +1 -1
- package/build/__tests__/behavioral/TestingDataStores.test.js +15 -11
- package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +3 -1
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAListener.test.d.ts +3 -0
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +200 -81
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingListenersInSync.test.d.ts +7 -0
- package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js +171 -0
- package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js.map +1 -0
- package/build/__tests__/behavioral/{ListeningToAnEventYouCreate.test.d.ts → events/ListeningToAnEventYouCreate.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{ListeningToAnEventYouCreate.test.js → events/ListeningToAnEventYouCreate.test.js} +2 -2
- package/build/__tests__/behavioral/events/ListeningToAnEventYouCreate.test.js.map +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.d.ts +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +53 -21
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.d.ts +5 -0
- package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.js +137 -0
- package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.js.map +1 -0
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.d.ts +3 -0
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js +105 -16
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/CreatingATest.test.js +14 -10
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- package/build/__tests__/behavioral/views/TestingViewControllers.test.d.ts +1 -0
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js +67 -35
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
- package/build/__tests__/implementation/AuthService.test.d.ts +1 -0
- package/build/__tests__/implementation/AuthService.test.js +8 -0
- package/build/__tests__/implementation/AuthService.test.js.map +1 -1
- package/build/__tests__/implementation/EventStore.test.js +3 -1
- package/build/__tests__/implementation/EventStore.test.js.map +1 -1
- package/build/__tests__/implementation/LintService.test.d.ts +5 -0
- package/build/__tests__/implementation/LintService.test.js +130 -0
- package/build/__tests__/implementation/LintService.test.js.map +1 -0
- package/build/__tests__/implementation/StoreFeature.test.d.ts +4 -0
- package/build/__tests__/implementation/StoreFeature.test.js +132 -0
- package/build/__tests__/implementation/StoreFeature.test.js.map +1 -0
- package/build/errors/SpruceError.js +8 -4
- package/build/errors/SpruceError.js.map +1 -1
- package/build/features/event/EventFeature.d.ts +2 -2
- package/build/features/event/EventFeature.js +53 -13
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/event/actions/ListenAction.d.ts +1 -0
- package/build/features/event/actions/ListenAction.js +60 -31
- package/build/features/event/actions/ListenAction.js.map +1 -1
- package/build/features/event/actions/SyncListenersAction.d.ts +15 -0
- package/build/features/event/actions/SyncListenersAction.js +115 -0
- package/build/features/event/actions/SyncListenersAction.js.map +1 -0
- package/build/features/event/builders/ListenerTemplateItemBuilder.d.ts +8 -0
- package/build/features/event/builders/ListenerTemplateItemBuilder.js +65 -0
- package/build/features/event/builders/ListenerTemplateItemBuilder.js.map +1 -0
- package/build/features/event/stores/EventStore.js +2 -2
- package/build/features/event/stores/EventStore.js.map +1 -1
- package/build/features/event/stores/ListenerStore.d.ts +9 -0
- package/build/features/event/stores/ListenerStore.js +122 -0
- package/build/features/event/stores/ListenerStore.js.map +1 -0
- package/build/features/event/writers/EventWriter.d.ts +4 -1
- package/build/features/event/writers/EventWriter.js +42 -8
- package/build/features/event/writers/EventWriter.js.map +1 -1
- package/build/features/node/NodeFeature.js +1 -1
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/skill/SkillFeature.js +1 -1
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/skill/stores/SkillStore.js +4 -8
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/store/StoreFeature.d.ts +1 -1
- package/build/features/store/StoreFeature.js +16 -11
- package/build/features/store/StoreFeature.js.map +1 -1
- package/build/schemas/v2020_07_22/personWithToken.builder.js +1 -0
- package/build/schemas/v2020_07_22/personWithToken.builder.js.map +1 -1
- package/build/services/AuthService.d.ts +4 -1
- package/build/services/AuthService.js +15 -4
- package/build/services/AuthService.js.map +1 -1
- package/build/services/GameService.js +14 -10
- package/build/services/GameService.js.map +1 -1
- package/build/services/LintService.d.ts +5 -2
- package/build/services/LintService.js +137 -92
- package/build/services/LintService.js.map +1 -1
- package/build/services/ServiceFactory.js +9 -3
- package/build/services/ServiceFactory.js.map +1 -1
- package/build/stores/StoreFactory.d.ts +2 -0
- package/build/stores/StoreFactory.js +4 -1
- package/build/stores/StoreFactory.js.map +1 -1
- package/build/tests/AbstractCliTest.js +3 -3
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/writers/AbstractWriter.d.ts +0 -3
- package/build/writers/AbstractWriter.js +2 -18
- package/build/writers/AbstractWriter.js.map +1 -1
- package/package.json +11 -9
- package/src/__tests__/behavioral/SettingLogTransportsInASkill.test.ts +2 -0
- package/src/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.ts +10 -5
- package/src/__tests__/behavioral/TestingDataStores.test.ts +2 -0
- package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +1 -0
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +48 -9
- package/src/__tests__/behavioral/events/KeepingListenersInSync.test.ts +47 -0
- package/src/__tests__/behavioral/{ListeningToAnEventYouCreate.test.ts → events/ListeningToAnEventYouCreate.test.ts} +2 -2
- package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +6 -0
- package/src/__tests__/behavioral/skill/UpgradingWithListeners.test.ts +59 -0
- package/src/__tests__/behavioral/stores/KeepingDataStoresInSync.test.ts +31 -2
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -0
- package/src/__tests__/behavioral/views/TestingViewControllers.test.ts +6 -0
- package/src/__tests__/implementation/AuthService.test.ts +6 -0
- package/src/__tests__/implementation/EventStore.test.ts +1 -0
- package/src/__tests__/implementation/LintService.test.ts +34 -0
- package/src/__tests__/implementation/StoreFeature.test.ts +40 -0
- package/src/errors/SpruceError.ts +9 -5
- package/src/features/event/EventFeature.ts +21 -4
- package/src/features/event/actions/ListenAction.ts +9 -3
- package/src/features/event/actions/SyncListenersAction.ts +38 -0
- package/src/features/event/builders/ListenerTemplateItemBuilder.ts +27 -0
- package/src/features/event/stores/EventStore.ts +1 -1
- package/src/features/event/stores/ListenerStore.ts +32 -0
- package/src/features/event/writers/EventWriter.ts +19 -0
- package/src/features/node/NodeFeature.ts +2 -1
- package/src/features/skill/SkillFeature.ts +1 -1
- package/src/features/skill/stores/SkillStore.ts +4 -3
- package/src/features/store/StoreFeature.ts +7 -4
- package/src/schemas/v2020_07_22/personWithToken.builder.ts +1 -0
- package/src/services/AuthService.ts +15 -5
- package/src/services/GameService.ts +1 -0
- package/src/services/LintService.ts +34 -5
- package/src/services/ServiceFactory.ts +8 -3
- package/src/stores/StoreFactory.ts +3 -0
- package/src/tests/AbstractCliTest.ts +2 -2
- package/src/writers/AbstractWriter.ts +2 -13
- package/build/__tests__/behavioral/ListeningToAnEventYouCreate.test.js.map +0 -1
- package/build/__tests__/behavioral/README.md +0 -8
- package/build/__tests__/implementation/README.md +0 -5
- package/build/components/README.md +0 -5
- package/src/__tests__/behavioral/README.md +0 -8
- package/src/__tests__/implementation/README.md +0 -5
- package/src/components/README.md +0 -5
|
@@ -54,35 +54,39 @@ var GameService = /*#__PURE__*/function () {
|
|
|
54
54
|
case 0:
|
|
55
55
|
introductionSentences = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
56
56
|
sentencesToPlay = (0, _toConsumableArray2["default"])(introductionSentences);
|
|
57
|
+
_context.next = 4;
|
|
58
|
+
return this.ui.stopLoading();
|
|
59
|
+
|
|
60
|
+
case 4:
|
|
57
61
|
this.killed = false;
|
|
58
62
|
|
|
59
|
-
case
|
|
63
|
+
case 5:
|
|
60
64
|
if (!(sentencesToPlay.length > 0)) {
|
|
61
|
-
_context.next =
|
|
65
|
+
_context.next = 14;
|
|
62
66
|
break;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
next = sentencesToPlay.shift();
|
|
66
70
|
this.ui.renderLine(next);
|
|
67
|
-
_context.next =
|
|
71
|
+
_context.next = 10;
|
|
68
72
|
return new Promise(function (r) {
|
|
69
73
|
return setTimeout(r, 2000);
|
|
70
74
|
});
|
|
71
75
|
|
|
72
|
-
case
|
|
76
|
+
case 10:
|
|
73
77
|
if (!this.killed) {
|
|
74
|
-
_context.next =
|
|
78
|
+
_context.next = 12;
|
|
75
79
|
break;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
return _context.abrupt("return");
|
|
79
83
|
|
|
80
|
-
case
|
|
81
|
-
_context.next =
|
|
84
|
+
case 12:
|
|
85
|
+
_context.next = 5;
|
|
82
86
|
break;
|
|
83
87
|
|
|
84
|
-
case
|
|
85
|
-
_context.next =
|
|
88
|
+
case 14:
|
|
89
|
+
_context.next = 16;
|
|
86
90
|
return this.command.execute('node ./node_modules/.bin/js-tetris-cli', {
|
|
87
91
|
spawnOptions: {
|
|
88
92
|
stdio: [process.stdin, 'pipe', 'pipe']
|
|
@@ -110,7 +114,7 @@ var GameService = /*#__PURE__*/function () {
|
|
|
110
114
|
}
|
|
111
115
|
});
|
|
112
116
|
|
|
113
|
-
case
|
|
117
|
+
case 16:
|
|
114
118
|
case "end":
|
|
115
119
|
return _context.stop();
|
|
116
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/GameService.ts"],"names":["GameService","command","ui","cwd","diskUtil","resolvePath","__dirname","message","statusMessage","introductionSentences","sentencesToPlay","killed","length","next","shift","renderLine","Promise","r","setTimeout","execute","spawnOptions","stdio","process","stdin","onData","data","stdout","write","saveCursor","moveCursorTo","clearBelowCursor","restoreCursor","kill","clear"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;IAIqBA,W;AAMpB,uBAAmBC,OAAnB,EAA4CC,EAA5C,EAAmE;AAAA;AAAA;AAAA;AAAA;AAAA,qDAFlD,KAEkD;AAClE,SAAKD,OAAL,GAAeA,OAAf;AACA,SAAKC,EAAL,GAAUA,EAAV;AACA,SAAKD,OAAL,CAAaE,GAAb,GAAmBC,2BAASC,WAAT,CAAqBC,SAArB,EAAgC,QAAhC,CAAnB;AACA;;;;WAED,0BAAwBC,OAAxB,EAAyC;AACxC,WAAKC,aAAL,GAAqBD,OAArB;AACA;;;;gGAED;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkBE,gBAAAA,qBAAlB,2DAAoD,EAApD;AACOC,gBAAAA,eADP,uCAC6BD,qBAD7B;
|
|
1
|
+
{"version":3,"sources":["../../src/services/GameService.ts"],"names":["GameService","command","ui","cwd","diskUtil","resolvePath","__dirname","message","statusMessage","introductionSentences","sentencesToPlay","stopLoading","killed","length","next","shift","renderLine","Promise","r","setTimeout","execute","spawnOptions","stdio","process","stdin","onData","data","stdout","write","saveCursor","moveCursorTo","clearBelowCursor","restoreCursor","kill","clear"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;IAIqBA,W;AAMpB,uBAAmBC,OAAnB,EAA4CC,EAA5C,EAAmE;AAAA;AAAA;AAAA;AAAA;AAAA,qDAFlD,KAEkD;AAClE,SAAKD,OAAL,GAAeA,OAAf;AACA,SAAKC,EAAL,GAAUA,EAAV;AACA,SAAKD,OAAL,CAAaE,GAAb,GAAmBC,2BAASC,WAAT,CAAqBC,SAArB,EAAgC,QAAhC,CAAnB;AACA;;;;WAED,0BAAwBC,OAAxB,EAAyC;AACxC,WAAKC,aAAL,GAAqBD,OAArB;AACA;;;;gGAED;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkBE,gBAAAA,qBAAlB,2DAAoD,EAApD;AACOC,gBAAAA,eADP,uCAC6BD,qBAD7B;AAAA;AAAA,uBAEO,KAAKP,EAAL,CAAQS,WAAR,EAFP;;AAAA;AAGC,qBAAKC,MAAL,GAAc,KAAd;;AAHD;AAAA,sBAKQF,eAAe,CAACG,MAAhB,GAAyB,CALjC;AAAA;AAAA;AAAA;;AAMQC,gBAAAA,IANR,GAMeJ,eAAe,CAACK,KAAhB,EANf;AAOE,qBAAKb,EAAL,CAAQc,UAAR,CAAmBF,IAAnB;AAPF;AAAA,uBAQQ,IAAIG,OAAJ,CAAY,UAACC,CAAD;AAAA,yBAAOC,UAAU,CAACD,CAAD,EAAI,IAAJ,CAAjB;AAAA,iBAAZ,CARR;;AAAA;AAAA,qBASM,KAAKN,MATX;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,uBAcO,KAAKX,OAAL,CAAamB,OAAb,CAAqB,wCAArB,EAA+D;AACpEC,kBAAAA,YAAY,EAAE;AACbC,oBAAAA,KAAK,EAAE,CAACC,OAAO,CAACC,KAAT,EAAgB,MAAhB,EAAwB,MAAxB;AADM,mBADsD;AAIpEC,kBAAAA,MAAM,EAAE,gBAACC,IAAD,EAAkB;AACzB,wBAAI,CAAC,KAAI,CAACd,MAAV,EAAkB;AAAA;;AACjB,yCAAAW,OAAO,CAACI,MAAR,oEAAgBC,KAAhB,CAAsBF,IAAtB;;AACA,0BAAI,KAAI,CAAClB,aAAT,EAAwB;AAAA;;AACvB,wBAAA,KAAI,CAACN,EAAL,CAAQ2B,UAAR;;AACA,wBAAA,KAAI,CAAC3B,EAAL,CAAQ4B,YAAR,CAAqB,CAArB,EAAwB,EAAxB;;AACA,wBAAA,KAAI,CAAC5B,EAAL,CAAQ6B,gBAAR;;AACA,4CAAAR,OAAO,CAACI,MAAR,sEAAgBC,KAAhB,CAAsB,KAAI,CAACpB,aAA3B;;AACA,wBAAA,KAAI,CAACN,EAAL,CAAQ8B,aAAR;AACA;AACD;AACD;AAfmE,iBAA/D,CAdP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAiCA,gBAAc;AACb,WAAKpB,MAAL,GAAc,IAAd;AACA,WAAKX,OAAL,CAAagC,IAAb;AACA,WAAK/B,EAAL,CAAQgC,KAAR;AACA","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport TerminalInterface from '../interfaces/TerminalInterface'\nimport CommandService from './CommandService'\n\nexport default class GameService {\n\tprivate command: CommandService\n\tprivate ui: TerminalInterface\n\tprivate statusMessage?: string\n\tprivate killed = false\n\n\tpublic constructor(command: CommandService, ui: TerminalInterface) {\n\t\tthis.command = command\n\t\tthis.ui = ui\n\t\tthis.command.cwd = diskUtil.resolvePath(__dirname, '../../')\n\t}\n\n\tpublic setStatusMessage(message: string) {\n\t\tthis.statusMessage = message\n\t}\n\n\tpublic async play(introductionSentences: string[] = []) {\n\t\tconst sentencesToPlay = [...introductionSentences]\n\t\tawait this.ui.stopLoading()\n\t\tthis.killed = false\n\n\t\twhile (sentencesToPlay.length > 0) {\n\t\t\tconst next = sentencesToPlay.shift() as string\n\t\t\tthis.ui.renderLine(next)\n\t\t\tawait new Promise((r) => setTimeout(r, 2000))\n\t\t\tif (this.killed) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tawait this.command.execute('node ./node_modules/.bin/js-tetris-cli', {\n\t\t\tspawnOptions: {\n\t\t\t\tstdio: [process.stdin, 'pipe', 'pipe'],\n\t\t\t},\n\t\t\tonData: (data: string) => {\n\t\t\t\tif (!this.killed) {\n\t\t\t\t\tprocess.stdout?.write(data)\n\t\t\t\t\tif (this.statusMessage) {\n\t\t\t\t\t\tthis.ui.saveCursor()\n\t\t\t\t\t\tthis.ui.moveCursorTo(0, 25)\n\t\t\t\t\t\tthis.ui.clearBelowCursor()\n\t\t\t\t\t\tprocess.stdout?.write(this.statusMessage)\n\t\t\t\t\t\tthis.ui.restoreCursor()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n\n\tpublic kill() {\n\t\tthis.killed = true\n\t\tthis.command.kill()\n\t\tthis.ui.clear()\n\t}\n}\n"],"file":"GameService.js"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import CommandService from './CommandService';
|
|
2
2
|
export default class LintService {
|
|
3
3
|
cwd: string;
|
|
4
|
-
private
|
|
5
|
-
|
|
4
|
+
private getCommand;
|
|
5
|
+
private static isLintingEnabled;
|
|
6
|
+
static disableLinting(): void;
|
|
7
|
+
static enableLinting(): void;
|
|
8
|
+
constructor(cwd: string, commandServiceFactory: () => CommandService);
|
|
6
9
|
fix: (pattern: string) => Promise<string[]>;
|
|
7
10
|
}
|
|
@@ -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,149 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
21
23
|
|
|
22
24
|
var _SpruceError = _interopRequireDefault(require("../errors/SpruceError"));
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!fixedFiles) {
|
|
76
|
-
_context.next = 27;
|
|
26
|
+
// import { ESLint } from 'eslint'
|
|
27
|
+
var LintService = /*#__PURE__*/function () {
|
|
28
|
+
function LintService(cwd, commandServiceFactory) {
|
|
29
|
+
var _this = this;
|
|
30
|
+
|
|
31
|
+
(0, _classCallCheck2["default"])(this, LintService);
|
|
32
|
+
(0, _defineProperty2["default"])(this, "cwd", void 0);
|
|
33
|
+
(0, _defineProperty2["default"])(this, "getCommand", 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$getComma, 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.getCommand().execute('node', {
|
|
69
|
+
args: ['-e', script]
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
case 10:
|
|
73
|
+
_yield$_this$getComma = _context.sent;
|
|
74
|
+
stdout = _yield$_this$getComma.stdout;
|
|
75
|
+
fixedFiles = JSON.parse(stdout);
|
|
76
|
+
_context.next = 18;
|
|
77
77
|
break;
|
|
78
|
-
}
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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 = 33;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
i = 0;
|
|
95
|
+
|
|
96
|
+
case 20:
|
|
97
|
+
if (!(i < fixedFiles.length)) {
|
|
98
|
+
_context.next = 33;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
fixedFile = fixedFiles[i];
|
|
103
|
+
|
|
104
|
+
if (!(fixedFile !== null && fixedFile !== void 0 && fixedFile.output)) {
|
|
105
|
+
_context.next = 28;
|
|
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
|
+
_context.next = 30;
|
|
85
115
|
break;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fixedFile = fixedFiles[i];
|
|
89
116
|
|
|
90
|
-
|
|
91
|
-
|
|
117
|
+
case 28:
|
|
118
|
+
if (!(fixedFile !== null && fixedFile !== void 0 && fixedFile.messages && (fixedFile === null || fixedFile === void 0 ? void 0 : fixedFile.errorCount) > 0)) {
|
|
119
|
+
_context.next = 30;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
throw new _SpruceError["default"]({
|
|
124
|
+
code: 'LINT_FAILED',
|
|
125
|
+
pattern: pattern,
|
|
126
|
+
friendlyMessage: "Lint error with '".concat(fixedFile.filePath, "':\n\n").concat(fixedFile.messages.map(function (m) {
|
|
127
|
+
return m === null || m === void 0 ? void 0 : m.message;
|
|
128
|
+
}).join('\n'))
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
case 30:
|
|
132
|
+
i += 1;
|
|
133
|
+
_context.next = 20;
|
|
92
134
|
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
135
|
|
|
106
|
-
|
|
107
|
-
|
|
136
|
+
case 33:
|
|
137
|
+
return _context.abrupt("return", fixedPaths);
|
|
108
138
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
139
|
+
case 34:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context.stop();
|
|
142
|
+
}
|
|
112
143
|
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
}, _callee, null, [[6, 15]]);
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
return function (_x) {
|
|
148
|
+
return _ref.apply(this, arguments);
|
|
149
|
+
};
|
|
150
|
+
}());
|
|
151
|
+
this.cwd = cwd;
|
|
152
|
+
this.getCommand = commandServiceFactory;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
(0, _createClass2["default"])(LintService, null, [{
|
|
156
|
+
key: "disableLinting",
|
|
157
|
+
value: function disableLinting() {
|
|
158
|
+
this.isLintingEnabled = false;
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "enableLinting",
|
|
162
|
+
value: function enableLinting() {
|
|
163
|
+
this.isLintingEnabled = true;
|
|
164
|
+
}
|
|
165
|
+
}]);
|
|
166
|
+
return LintService;
|
|
167
|
+
}();
|
|
124
168
|
|
|
125
169
|
exports["default"] = LintService;
|
|
170
|
+
(0, _defineProperty2["default"])(LintService, "isLintingEnabled", true);
|
|
126
171
|
//# sourceMappingURL=LintService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/LintService.ts"],"names":["LintService","cwd","
|
|
1
|
+
{"version":3,"sources":["../../src/services/LintService.ts"],"names":["LintService","cwd","commandServiceFactory","pattern","SchemaError","code","parameters","isLintingEnabled","fixedFiles","fixedPaths","script","getCommand","execute","args","stdout","JSON","parse","SpruceError","originalError","i","length","fixedFile","output","fs","writeFile","filePath","push","messages","errorCount","friendlyMessage","map","m","message","join"],"mappings":"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","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 getCommand: () => 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, commandServiceFactory: () => CommandService) {\n\t\tthis.cwd = cwd\n\t\tthis.getCommand = commandServiceFactory\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\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.getCommand().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\n\t\t\t\tif (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} else if (fixedFile?.messages && fixedFile?.errorCount > 0) {\n\t\t\t\t\tthrow new SpruceError({\n\t\t\t\t\t\tcode: 'LINT_FAILED',\n\t\t\t\t\t\tpattern,\n\t\t\t\t\t\tfriendlyMessage: `Lint error with '${\n\t\t\t\t\t\t\tfixedFile.filePath\n\t\t\t\t\t\t}':\\n\\n${fixedFile.messages\n\t\t\t\t\t\t\t.map((m: any) => m?.message)\n\t\t\t\t\t\t\t.join('\\n')}`,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn fixedPaths\n\t}\n}\n"],"file":"LintService.js"}
|
|
@@ -55,9 +55,11 @@ var ServiceFactory = /*#__PURE__*/function () {
|
|
|
55
55
|
|
|
56
56
|
return Service;
|
|
57
57
|
}(function (cwd, type) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
|
|
58
60
|
switch (type) {
|
|
59
61
|
case 'auth':
|
|
60
|
-
return new _AuthService["default"](new _spruceSkillUtils.EnvService(cwd));
|
|
62
|
+
return new _AuthService["default"](new _spruceSkillUtils.EnvService(cwd), new _PkgService["default"](cwd));
|
|
61
63
|
|
|
62
64
|
case 'pkg':
|
|
63
65
|
return new _PkgService["default"](cwd);
|
|
@@ -75,7 +77,9 @@ var ServiceFactory = /*#__PURE__*/function () {
|
|
|
75
77
|
});
|
|
76
78
|
|
|
77
79
|
case 'lint':
|
|
78
|
-
return new _LintService["default"](cwd,
|
|
80
|
+
return new _LintService["default"](cwd, function () {
|
|
81
|
+
return _this.Service(cwd, 'command');
|
|
82
|
+
});
|
|
79
83
|
|
|
80
84
|
case 'command':
|
|
81
85
|
{
|
|
@@ -100,7 +104,9 @@ var ServiceFactory = /*#__PURE__*/function () {
|
|
|
100
104
|
case 'build':
|
|
101
105
|
{
|
|
102
106
|
var commandService = new _CommandService["default"](cwd);
|
|
103
|
-
return new _BuildService["default"](commandService, new _LintService["default"](cwd,
|
|
107
|
+
return new _BuildService["default"](commandService, new _LintService["default"](cwd, function () {
|
|
108
|
+
return _this.Service(cwd, 'command');
|
|
109
|
+
}));
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
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;;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,
|
|
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;AAAA;;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,CAAgBT,GAAhB,EAAqB;AAAA,mBAC3B,KAAI,CAACU,OAAL,CAAaV,GAAb,EAAkB,SAAlB,CAD2B;AAAA,WAArB,CAAP;;AAGD,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;AAAA,qBAAM,KAAI,CAACU,OAAL,CAAaV,GAAb,EAAkB,SAAlB,CAAN;AAAA,aAArB,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;AAlDF;AAoDA,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(cwd, () =>\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;;
|
|
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
|
-
|
|
132
|
+
_LintService["default"].disableLinting();
|
|
133
133
|
|
|
134
134
|
_ImportService["default"].setCacheDir(_spruceSkillUtils.diskUtil.createRandomTempDir());
|
|
135
135
|
|