@sprucelabs/spruce-cli 18.2.0 → 18.3.1

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 (368) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/.spruce/events/events.contract.d.ts +159 -0
  3. package/build/.spruce/events/events.contract.js +5 -1
  4. package/build/.spruce/events/events.contract.js.map +1 -1
  5. package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.d.ts +46 -0
  6. package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.js +57 -0
  7. package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.js.map +1 -0
  8. package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.d.ts +68 -0
  9. package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.js +78 -0
  10. package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.js.map +1 -0
  11. package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.d.ts +40 -0
  12. package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.js +51 -0
  13. package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.js.map +1 -0
  14. package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.d.ts +9 -0
  15. package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.js +17 -0
  16. package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.js.map +1 -0
  17. package/build/.spruce/schemas/schemas.types.d.ts +158 -55
  18. package/build/.spruce/schemas/schemas.types.js.map +1 -1
  19. package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.d.ts +3 -0
  20. package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.js +70 -0
  21. package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.js.map +1 -0
  22. package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.d.ts +3 -0
  23. package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.js +35 -0
  24. package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.js.map +1 -0
  25. package/build/.spruce/settings.json +2 -1
  26. package/build/GlobalEmitter.d.ts +13 -38
  27. package/build/GlobalEmitter.js +3 -6
  28. package/build/GlobalEmitter.js.map +1 -1
  29. package/build/__tests__/behavioral/TestingAConversation.test.d.ts +2 -1
  30. package/build/__tests__/behavioral/TestingAConversation.test.js +74 -84
  31. package/build/__tests__/behavioral/TestingAConversation.test.js.map +1 -1
  32. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +38 -13
  33. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
  34. package/build/__tests__/behavioral/events/EventWriter.test.d.ts +4 -0
  35. package/build/__tests__/behavioral/events/EventWriter.test.js +116 -0
  36. package/build/__tests__/behavioral/events/EventWriter.test.js.map +1 -0
  37. package/build/__tests__/behavioral/{ListeningToCoreEvents.test.d.ts → events/ListeningToCoreEvents.test.d.ts} +1 -1
  38. package/build/__tests__/behavioral/{ListeningToCoreEvents.test.js → events/ListeningToCoreEvents.test.js} +1 -1
  39. package/build/__tests__/behavioral/events/ListeningToCoreEvents.test.js.map +1 -0
  40. package/build/__tests__/behavioral/{RegisteringEventsOnBoot.test.d.ts → events/RegisteringEventsOnBoot.test.d.ts} +1 -1
  41. package/build/__tests__/behavioral/{RegisteringEventsOnBoot.test.js → events/RegisteringEventsOnBoot.test.js} +2 -2
  42. package/build/__tests__/behavioral/events/RegisteringEventsOnBoot.test.js.map +1 -0
  43. package/build/__tests__/behavioral/{RegisteringGlobalEvents.test.d.ts → events/RegisteringGlobalEvents.test.d.ts} +2 -3
  44. package/build/__tests__/behavioral/{RegisteringGlobalEvents.test.js → events/RegisteringGlobalEvents.test.js} +45 -70
  45. package/build/__tests__/behavioral/events/RegisteringGlobalEvents.test.js.map +1 -0
  46. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.d.ts +1 -0
  47. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +16 -9
  48. package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
  49. package/build/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.d.ts → events/SyncingEventsOnlyFromDependencies.test.d.ts} +1 -1
  50. package/build/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.js → events/SyncingEventsOnlyFromDependencies.test.js} +1 -1
  51. package/build/__tests__/behavioral/events/SyncingEventsOnlyFromDependencies.test.js.map +1 -0
  52. package/build/__tests__/behavioral/permissions/CreatingPermissions.test.d.ts +2 -2
  53. package/build/__tests__/behavioral/permissions/CreatingPermissions.test.js +7 -7
  54. package/build/__tests__/behavioral/permissions/CreatingPermissions.test.js.map +1 -1
  55. package/build/__tests__/behavioral/permissions/PermissionPlugin.test.d.ts +6 -0
  56. package/build/__tests__/behavioral/permissions/PermissionPlugin.test.js +85 -0
  57. package/build/__tests__/behavioral/permissions/PermissionPlugin.test.js.map +1 -0
  58. package/build/__tests__/behavioral/permissions/PermissionStore.test.d.ts +5 -4
  59. package/build/__tests__/behavioral/permissions/PermissionStore.test.js +97 -63
  60. package/build/__tests__/behavioral/permissions/PermissionStore.test.js.map +1 -1
  61. package/build/__tests__/behavioral/permissions/PermissionWriter.test.d.ts +5 -0
  62. package/build/__tests__/behavioral/permissions/PermissionWriter.test.js +88 -0
  63. package/build/__tests__/behavioral/permissions/PermissionWriter.test.js.map +1 -0
  64. package/build/__tests__/behavioral/permissions/SyncingPermissions.test.d.ts +15 -4
  65. package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js +325 -28
  66. package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js.map +1 -1
  67. package/build/__tests__/behavioral/permissions/support/AbstractPermissionsTest.d.ts +11 -0
  68. package/build/__tests__/behavioral/permissions/{AbstractPermissionsTest.js → support/AbstractPermissionsTest.js} +34 -2
  69. package/build/__tests__/behavioral/permissions/support/AbstractPermissionsTest.js.map +1 -0
  70. package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.d.ts +1 -0
  71. package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.js +11 -0
  72. package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.js.map +1 -0
  73. package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.d.ts +1 -0
  74. package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.js +17 -0
  75. package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.js.map +1 -0
  76. package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.d.ts +5 -0
  77. package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.js +10 -0
  78. package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.js.map +1 -0
  79. package/build/__tests__/behavioral/{CreatingSchemasWithGenerics.test.d.ts → schemas/CreatingSchemasWithGenerics.test.d.ts} +1 -1
  80. package/build/__tests__/behavioral/{CreatingSchemasWithGenerics.test.js → schemas/CreatingSchemasWithGenerics.test.js} +2 -2
  81. package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js.map +1 -0
  82. package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.d.ts +1 -1
  83. package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js +46 -46
  84. package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js.map +1 -1
  85. package/build/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.d.ts → schemas/SettingUpSchemasForModuleDistribution.test.d.ts} +1 -1
  86. package/build/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.js → schemas/SettingUpSchemasForModuleDistribution.test.js} +3 -3
  87. package/build/__tests__/behavioral/schemas/SettingUpSchemasForModuleDistribution.test.js.map +1 -0
  88. package/build/__tests__/behavioral/{InstallingASkillAtAnOrg.test.d.ts → skill/InstallingASkillAtAnOrg.test.d.ts} +1 -1
  89. package/build/__tests__/behavioral/{InstallingASkillAtAnOrg.test.js → skill/InstallingASkillAtAnOrg.test.js} +2 -2
  90. package/build/__tests__/behavioral/skill/InstallingASkillAtAnOrg.test.js.map +1 -0
  91. package/build/__tests__/behavioral/{LoggingInAsASkill.test.d.ts → skill/LoggingInAsASkill.test.d.ts} +1 -1
  92. package/build/__tests__/behavioral/{LoggingInAsASkill.test.js → skill/LoggingInAsASkill.test.js} +2 -2
  93. package/build/__tests__/behavioral/skill/LoggingInAsASkill.test.js.map +1 -0
  94. package/build/__tests__/behavioral/{RebuildingASkill.test.d.ts → skill/RebuildingASkill.test.d.ts} +1 -1
  95. package/build/__tests__/behavioral/{RebuildingASkill.test.js → skill/RebuildingASkill.test.js} +2 -2
  96. package/build/__tests__/behavioral/skill/RebuildingASkill.test.js.map +1 -0
  97. package/build/__tests__/behavioral/tests/CreatingATest.test.js +2 -2
  98. package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
  99. package/build/__tests__/behavioral/{SettingUpASkillForTesting.test.d.ts → tests/SettingUpASkillForTesting.test.d.ts} +1 -1
  100. package/build/__tests__/behavioral/{SettingUpASkillForTesting.test.js → tests/SettingUpASkillForTesting.test.js} +2 -2
  101. package/build/__tests__/behavioral/tests/SettingUpASkillForTesting.test.js.map +1 -0
  102. package/build/__tests__/behavioral/{TestReporterSettingsRemembered.test.d.ts → tests/TestReporterSettingsRemembered.test.d.ts} +1 -1
  103. package/build/__tests__/behavioral/{TestReporterSettingsRemembered.test.js → tests/TestReporterSettingsRemembered.test.js} +1 -1
  104. package/build/__tests__/behavioral/tests/TestReporterSettingsRemembered.test.js.map +1 -0
  105. package/build/__tests__/behavioral/{TestingDataStores.test.d.ts → tests/TestingDataStores.test.d.ts} +1 -1
  106. package/build/__tests__/behavioral/{TestingDataStores.test.js → tests/TestingDataStores.test.js} +3 -3
  107. package/build/__tests__/behavioral/tests/TestingDataStores.test.js.map +1 -0
  108. package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js +7 -3
  109. package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js.map +1 -1
  110. package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js +2 -2
  111. package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js.map +1 -1
  112. package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js +1 -1
  113. package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js.map +1 -1
  114. package/build/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.d.ts → views/RegisteringSkillViewOnBoot.test.d.ts} +4 -4
  115. package/build/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.js → views/RegisteringSkillViewOnBoot.test.js} +2 -2
  116. package/build/__tests__/behavioral/views/RegisteringSkillViewOnBoot.test.js.map +1 -0
  117. package/build/__tests__/behavioral/{WatchingSkillViews.test.d.ts → views/WatchingSkillViews.test.d.ts} +1 -1
  118. package/build/__tests__/behavioral/{WatchingSkillViews.test.js → views/WatchingSkillViews.test.js} +2 -2
  119. package/build/__tests__/behavioral/views/WatchingSkillViews.test.js.map +1 -0
  120. package/build/__tests__/implementation/ActionExecuter2.test.d.ts +1 -1
  121. package/build/__tests__/implementation/ActionExecuter2.test.js +23 -11
  122. package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
  123. package/build/__tests__/implementation/GlobalEmitter.test.d.ts +1 -0
  124. package/build/__tests__/implementation/GlobalEmitter.test.js +40 -3
  125. package/build/__tests__/implementation/GlobalEmitter.test.js.map +1 -1
  126. package/build/__tests__/implementation/SkillStore.test.js +3 -4
  127. package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
  128. package/build/features/AbstractAction.d.ts +1 -1
  129. package/build/features/AbstractAction.js.map +1 -1
  130. package/build/features/AbstractFeature.d.ts +3 -3
  131. package/build/features/AbstractFeature.js +8 -8
  132. package/build/features/AbstractFeature.js.map +1 -1
  133. package/build/features/ActionExecuter.d.ts +1 -1
  134. package/build/features/ActionExecuter.js +3 -4
  135. package/build/features/ActionExecuter.js.map +1 -1
  136. package/build/features/ActionFactory.d.ts +12 -5
  137. package/build/features/ActionFactory.js +27 -6
  138. package/build/features/ActionFactory.js.map +1 -1
  139. package/build/features/ActionQuestionAsker.d.ts +1 -1
  140. package/build/features/ActionQuestionAsker.js +6 -6
  141. package/build/features/ActionQuestionAsker.js.map +1 -1
  142. package/build/features/conversation/ConversationFeature.js +1 -1
  143. package/build/features/conversation/ConversationFeature.js.map +1 -1
  144. package/build/features/dependencies/DependencyFeature.js +1 -1
  145. package/build/features/dependencies/DependencyFeature.js.map +1 -1
  146. package/build/features/deploy/actions/HerokuAction.js +31 -33
  147. package/build/features/deploy/actions/HerokuAction.js.map +1 -1
  148. package/build/features/error/ErrorFeature.js +4 -4
  149. package/build/features/error/ErrorFeature.js.map +1 -1
  150. package/build/features/event/EventFeature.d.ts +8 -8
  151. package/build/features/event/EventFeature.js +7 -4
  152. package/build/features/event/EventFeature.js.map +1 -1
  153. package/build/features/event/actions/CreateAction.js.map +1 -1
  154. package/build/features/event/actions/ListenAction.js.map +1 -1
  155. package/build/features/event/stores/EventStore.d.ts +9 -9
  156. package/build/features/event/stores/EventStore.js +26 -26
  157. package/build/features/event/stores/EventStore.js.map +1 -1
  158. package/build/features/eventContract/EventContractFeature.js +4 -1
  159. package/build/features/eventContract/EventContractFeature.js.map +1 -1
  160. package/build/features/eventContract/actions/PullAction.js +10 -5
  161. package/build/features/eventContract/actions/PullAction.js.map +1 -1
  162. package/build/features/features.types.d.ts +2 -37
  163. package/build/features/features.types.js +0 -41
  164. package/build/features/features.types.js.map +1 -1
  165. package/build/features/log/LogFeature.js +1 -1
  166. package/build/features/log/LogFeature.js.map +1 -1
  167. package/build/features/node/NodeFeature.js.map +1 -1
  168. package/build/features/organization/actions/InstallAction.js.map +1 -1
  169. package/build/features/permission/PermissionFeature.d.ts +12 -2
  170. package/build/features/permission/PermissionFeature.js +138 -15
  171. package/build/features/permission/PermissionFeature.js.map +1 -1
  172. package/build/features/permission/actions/CreateAction.js +4 -1
  173. package/build/features/permission/actions/CreateAction.js.map +1 -1
  174. package/build/features/permission/actions/SyncAction.d.ts +5 -1
  175. package/build/features/permission/actions/SyncAction.js +28 -10
  176. package/build/features/permission/actions/SyncAction.js.map +1 -1
  177. package/build/features/permission/stores/PermissionStore.d.ts +6 -1
  178. package/build/features/permission/stores/PermissionStore.js +43 -31
  179. package/build/features/permission/stores/PermissionStore.js.map +1 -1
  180. package/build/features/permission/writers/PermissionWriter.d.ts +7 -1
  181. package/build/features/permission/writers/PermissionWriter.js +67 -18
  182. package/build/features/permission/writers/PermissionWriter.js.map +1 -1
  183. package/build/features/person/PersonFeature.js +1 -1
  184. package/build/features/person/PersonFeature.js.map +1 -1
  185. package/build/features/sandbox/SandboxFeature.js +1 -1
  186. package/build/features/sandbox/SandboxFeature.js.map +1 -1
  187. package/build/features/schema/SchemaFeature.d.ts +8 -8
  188. package/build/features/schema/SchemaFeature.js +4 -4
  189. package/build/features/schema/SchemaFeature.js.map +1 -1
  190. package/build/features/schema/writers/SchemaWriter.d.ts +12 -12
  191. package/build/features/schema/writers/SchemaWriter.js.map +1 -1
  192. package/build/features/skill/SkillFeature.d.ts +11 -11
  193. package/build/features/skill/SkillFeature.js +2 -2
  194. package/build/features/skill/SkillFeature.js.map +1 -1
  195. package/build/features/skill/actions/RebuildAction.js.map +1 -1
  196. package/build/features/skill/actions/RegisterAction.js.map +1 -1
  197. package/build/features/skill/stores/SkillStore.js +1 -2
  198. package/build/features/skill/stores/SkillStore.js.map +1 -1
  199. package/build/features/store/StoreFeature.js +1 -1
  200. package/build/features/store/StoreFeature.js.map +1 -1
  201. package/build/features/store/actions/SyncAction.d.ts +1 -1
  202. package/build/features/store/actions/SyncAction.js.map +1 -1
  203. package/build/features/test/TestFeature.js +1 -1
  204. package/build/features/test/TestFeature.js.map +1 -1
  205. package/build/features/view/ViewFeature.js +1 -1
  206. package/build/features/view/ViewFeature.js.map +1 -1
  207. package/build/schemas/v2020_07_22/actionResponse.builder.d.ts +85 -0
  208. package/build/schemas/v2020_07_22/actionResponse.builder.js +70 -0
  209. package/build/schemas/v2020_07_22/actionResponse.builder.js.map +1 -0
  210. package/build/schemas/v2020_07_22/generatedFile.builder.d.ts +27 -0
  211. package/build/schemas/v2020_07_22/generatedFile.builder.js +45 -0
  212. package/build/schemas/v2020_07_22/generatedFile.builder.js.map +1 -0
  213. package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js +4 -40
  214. package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js.map +1 -1
  215. package/build/services/CommandService.d.ts +2 -2
  216. package/build/services/CommandService.js +6 -6
  217. package/build/services/CommandService.js.map +1 -1
  218. package/build/services/PkgService.d.ts +1 -0
  219. package/build/services/PkgService.js +5 -0
  220. package/build/services/PkgService.js.map +1 -1
  221. package/build/tests/AbstractCliTest.d.ts +7 -3
  222. package/build/tests/AbstractCliTest.js +81 -45
  223. package/build/tests/AbstractCliTest.js.map +1 -1
  224. package/build/tests/buildTestCache.js +7 -0
  225. package/build/tests/buildTestCache.js.map +1 -1
  226. package/build/tests/fixtures/FeatureFixture.js +1 -0
  227. package/build/tests/fixtures/FeatureFixture.js.map +1 -1
  228. package/build/tests/utilities/test.utility.d.ts +2 -0
  229. package/build/tests/utilities/test.utility.js +6 -0
  230. package/build/tests/utilities/test.utility.js.map +1 -1
  231. package/node_modules/@typescript-eslint/parser/package.json +5 -5
  232. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts +4 -2
  233. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts.map +1 -1
  234. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js +13 -5
  235. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js.map +1 -1
  236. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts +2 -1
  237. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts.map +1 -1
  238. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js +3 -0
  239. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js.map +1 -1
  240. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  241. package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +20 -2
  242. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +20 -2
  243. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
  244. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js +2 -0
  245. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
  246. package/node_modules/@typescript-eslint/types/package.json +2 -2
  247. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +2 -0
  248. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +2 -0
  249. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
  250. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +15 -3
  251. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
  252. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +2 -0
  253. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
  254. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts +2 -0
  255. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts.map +1 -1
  256. package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
  257. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.d.ts.map +1 -1
  258. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +63 -49
  259. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
  260. package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
  261. package/package.json +65 -33
  262. package/src/.spruce/events/events.contract.ts +24 -0
  263. package/src/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.ts +54 -0
  264. package/src/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.ts +79 -0
  265. package/src/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.ts +48 -0
  266. package/src/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.ts +13 -0
  267. package/src/.spruce/schemas/schemas.types.ts +171 -52
  268. package/src/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.ts +58 -0
  269. package/src/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.ts +33 -0
  270. package/src/.spruce/settings.json +2 -1
  271. package/src/GlobalEmitter.ts +2 -7
  272. package/src/__tests__/behavioral/TestingAConversation.test.ts +20 -37
  273. package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +14 -2
  274. package/src/__tests__/behavioral/events/EventWriter.test.ts +75 -0
  275. package/src/__tests__/behavioral/{ListeningToCoreEvents.test.ts → events/ListeningToCoreEvents.test.ts} +1 -1
  276. package/src/__tests__/behavioral/{RegisteringEventsOnBoot.test.ts → events/RegisteringEventsOnBoot.test.ts} +2 -2
  277. package/src/__tests__/behavioral/{RegisteringGlobalEvents.test.ts → events/RegisteringGlobalEvents.test.ts} +4 -12
  278. package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +6 -0
  279. package/src/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.ts → events/SyncingEventsOnlyFromDependencies.test.ts} +2 -2
  280. package/src/__tests__/behavioral/permissions/CreatingPermissions.test.ts +2 -2
  281. package/src/__tests__/behavioral/permissions/PermissionPlugin.test.ts +24 -0
  282. package/src/__tests__/behavioral/permissions/PermissionStore.test.ts +96 -38
  283. package/src/__tests__/behavioral/permissions/PermissionWriter.test.ts +24 -0
  284. package/src/__tests__/behavioral/permissions/SyncingPermissions.test.ts +125 -8
  285. package/src/__tests__/behavioral/permissions/support/AbstractPermissionsTest.ts +38 -0
  286. package/src/__tests__/behavioral/permissions/support/generateShortAlphaId.ts +5 -0
  287. package/src/__tests__/behavioral/permissions/support/renderPermissionTestFile.ts +27 -0
  288. package/src/__tests__/behavioral/permissions/support/sortPermissionContracts.ts +3 -0
  289. package/src/__tests__/behavioral/{CreatingSchemasWithGenerics.test.ts → schemas/CreatingSchemasWithGenerics.test.ts} +2 -2
  290. package/src/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.ts +12 -12
  291. package/src/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.ts → schemas/SettingUpSchemasForModuleDistribution.test.ts} +4 -4
  292. package/src/__tests__/behavioral/{InstallingASkillAtAnOrg.test.ts → skill/InstallingASkillAtAnOrg.test.ts} +2 -2
  293. package/src/__tests__/behavioral/{LoggingInAsASkill.test.ts → skill/LoggingInAsASkill.test.ts} +3 -3
  294. package/src/__tests__/behavioral/{RebuildingASkill.test.ts → skill/RebuildingASkill.test.ts} +2 -2
  295. package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -2
  296. package/src/__tests__/behavioral/{SettingUpASkillForTesting.test.ts → tests/SettingUpASkillForTesting.test.ts} +2 -2
  297. package/src/__tests__/behavioral/{TestReporterSettingsRemembered.test.ts → tests/TestReporterSettingsRemembered.test.ts} +2 -2
  298. package/src/__tests__/behavioral/{TestingDataStores.test.ts → tests/TestingDataStores.test.ts} +3 -3
  299. package/src/__tests__/behavioral/upgrading/UpgradingANodeModule.test.ts +3 -0
  300. package/src/__tests__/behavioral/upgrading/UpgradingASkill3.test.ts +3 -2
  301. package/src/__tests__/behavioral/upgrading/UpgradingASkill4.test.ts +1 -1
  302. package/src/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.ts → views/RegisteringSkillViewOnBoot.test.ts} +2 -2
  303. package/src/__tests__/behavioral/{WatchingSkillViews.test.ts → views/WatchingSkillViews.test.ts} +3 -3
  304. package/src/__tests__/implementation/ActionExecuter2.test.ts +13 -6
  305. package/src/__tests__/implementation/GlobalEmitter.test.ts +22 -1
  306. package/src/__tests__/implementation/SkillStore.test.ts +1 -2
  307. package/src/features/AbstractAction.ts +2 -2
  308. package/src/features/AbstractFeature.ts +8 -8
  309. package/src/features/ActionExecuter.ts +4 -5
  310. package/src/features/ActionFactory.ts +44 -20
  311. package/src/features/ActionQuestionAsker.ts +17 -17
  312. package/src/features/conversation/ConversationFeature.ts +1 -1
  313. package/src/features/dependencies/DependencyFeature.ts +1 -1
  314. package/src/features/deploy/actions/HerokuAction.ts +2 -2
  315. package/src/features/error/ErrorFeature.ts +4 -4
  316. package/src/features/event/EventFeature.ts +15 -14
  317. package/src/features/event/actions/CreateAction.ts +1 -1
  318. package/src/features/event/actions/ListenAction.ts +1 -1
  319. package/src/features/event/stores/EventStore.ts +37 -37
  320. package/src/features/eventContract/EventContractFeature.ts +6 -1
  321. package/src/features/eventContract/actions/PullAction.ts +7 -3
  322. package/src/features/features.types.ts +4 -41
  323. package/src/features/log/LogFeature.ts +1 -1
  324. package/src/features/node/NodeFeature.ts +1 -1
  325. package/src/features/organization/actions/InstallAction.ts +1 -1
  326. package/src/features/permission/PermissionFeature.ts +68 -11
  327. package/src/features/permission/actions/CreateAction.ts +2 -0
  328. package/src/features/permission/actions/SyncAction.ts +22 -3
  329. package/src/features/permission/stores/PermissionStore.ts +27 -8
  330. package/src/features/permission/writers/PermissionWriter.ts +62 -4
  331. package/src/features/person/PersonFeature.ts +1 -1
  332. package/src/features/sandbox/SandboxFeature.ts +1 -3
  333. package/src/features/schema/SchemaFeature.ts +14 -14
  334. package/src/features/schema/writers/SchemaWriter.ts +14 -15
  335. package/src/features/skill/SkillFeature.ts +18 -18
  336. package/src/features/skill/actions/RebuildAction.ts +1 -1
  337. package/src/features/skill/actions/RegisterAction.ts +1 -1
  338. package/src/features/skill/stores/SkillStore.ts +1 -2
  339. package/src/features/store/StoreFeature.ts +1 -1
  340. package/src/features/store/actions/SyncAction.ts +1 -1
  341. package/src/features/test/TestFeature.ts +1 -1
  342. package/src/features/view/ViewFeature.ts +1 -1
  343. package/src/schemas/v2020_07_22/actionResponse.builder.ts +62 -0
  344. package/src/schemas/v2020_07_22/generatedFile.builder.ts +44 -0
  345. package/src/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.ts +3 -46
  346. package/src/services/CommandService.ts +5 -5
  347. package/src/services/PkgService.ts +4 -0
  348. package/src/tests/AbstractCliTest.ts +31 -13
  349. package/src/tests/buildTestCache.ts +7 -0
  350. package/src/tests/fixtures/FeatureFixture.ts +2 -0
  351. package/src/tests/utilities/test.utility.ts +13 -0
  352. package/build/__tests__/behavioral/CreatingSchemasWithGenerics.test.js.map +0 -1
  353. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +0 -1
  354. package/build/__tests__/behavioral/ListeningToCoreEvents.test.js.map +0 -1
  355. package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +0 -1
  356. package/build/__tests__/behavioral/RebuildingASkill.test.js.map +0 -1
  357. package/build/__tests__/behavioral/RegisteringEventsOnBoot.test.js.map +0 -1
  358. package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js.map +0 -1
  359. package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js.map +0 -1
  360. package/build/__tests__/behavioral/SettingUpASkillForTesting.test.js.map +0 -1
  361. package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js.map +0 -1
  362. package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +0 -1
  363. package/build/__tests__/behavioral/TestReporterSettingsRemembered.test.js.map +0 -1
  364. package/build/__tests__/behavioral/TestingDataStores.test.js.map +0 -1
  365. package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +0 -1
  366. package/build/__tests__/behavioral/permissions/AbstractPermissionsTest.d.ts +0 -8
  367. package/build/__tests__/behavioral/permissions/AbstractPermissionsTest.js.map +0 -1
  368. package/src/__tests__/behavioral/permissions/AbstractPermissionsTest.ts +0 -20
@@ -19,8 +19,8 @@ export default class CreatingBehavioralTestsTest extends AbstractTestTest {
19
19
  const candidates = await testFeature.buildParentClassCandidates()
20
20
 
21
21
  assert.doesInclude(candidates, {
22
- label: 'AbstractSpruceFixtureTest (requires install)',
23
- name: 'AbstractSpruceFixtureTest',
22
+ label: 'AbstractStoreTest (requires install)',
23
+ name: 'AbstractStoreTest',
24
24
  })
25
25
  }
26
26
 
@@ -1,6 +1,6 @@
1
1
  import { test, assert } from '@sprucelabs/test-utils'
2
- import AbstractSkillTest from '../../tests/AbstractSkillTest'
3
- import { DEMO_NUMBER } from '../../tests/constants'
2
+ import AbstractSkillTest from '../../../tests/AbstractSkillTest'
3
+ import { DEMO_NUMBER } from '../../../tests/constants'
4
4
 
5
5
  export default class SettingUpASkillForTestingTest extends AbstractSkillTest {
6
6
  protected static skillCacheKey = 'tests'
@@ -1,6 +1,6 @@
1
1
  import { test, assert } from '@sprucelabs/test-utils'
2
- import TestAction from '../../features/test/actions/TestAction'
3
- import AbstractTestTest from '../../tests/AbstractTestTest'
2
+ import TestAction from '../../../features/test/actions/TestAction'
3
+ import AbstractTestTest from '../../../tests/AbstractTestTest'
4
4
 
5
5
  export default class TestReporterSettingsRememberedTest extends AbstractTestTest {
6
6
  @test()
@@ -1,8 +1,8 @@
1
1
  import { diskUtil } from '@sprucelabs/spruce-skill-utils'
2
2
  import { test, assert } from '@sprucelabs/test-utils'
3
- import LintService from '../../services/LintService'
4
- import AbstractSkillTest from '../../tests/AbstractSkillTest'
5
- import testUtil from '../../tests/utilities/test.utility'
3
+ import LintService from '../../../services/LintService'
4
+ import AbstractSkillTest from '../../../tests/AbstractSkillTest'
5
+ import testUtil from '../../../tests/utilities/test.utility'
6
6
 
7
7
  export default class TestingDataStoresTest extends AbstractSkillTest {
8
8
  protected static skillCacheKey = 'storesWithTests'
@@ -33,7 +33,10 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
33
33
 
34
34
  @test()
35
35
  protected static async upgradingWritesExpectedFiles() {
36
+ CommandService.fakeCommand(/build/gis, { code: 0 })
37
+
36
38
  const shouldNotBeFound = ['src/.spruce/skill.ts', 'src/.spruce/features']
39
+ diskUtil.deleteDir(this.resolveHashSprucePath('features'))
37
40
 
38
41
  const results = await this.Action('node', 'upgrade').execute({})
39
42
 
@@ -8,6 +8,7 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
8
8
  import testUtil from '../../../tests/utilities/test.utility'
9
9
  export default class UpgradingASkill3Test extends AbstractCliTest {
10
10
  private static originalErrorSyncExecute: any
11
+
11
12
  protected static async beforeEach() {
12
13
  if (!this.originalErrorSyncExecute) {
13
14
  this.originalErrorSyncExecute = SyncAction.prototype.execute
@@ -23,7 +24,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
23
24
 
24
25
  @test()
25
26
  protected static async doesNotAddResolvePathAliasesToDependenciesAfterUpgrade() {
26
- CommandService.clearMockResponses()
27
+ CommandService.clearFakedResponses()
27
28
  await this.FeatureFixture().installCachedFeatures('views')
28
29
 
29
30
  await this.Action('node', 'upgrade').execute({})
@@ -35,7 +36,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
35
36
 
36
37
  @test()
37
38
  protected static async featuresNotEnabledDontInstall() {
38
- CommandService.clearMockResponses()
39
+ CommandService.clearFakedResponses()
39
40
  await this.FeatureFixture().installCachedFeatures('schemas')
40
41
 
41
42
  const results = await this.Action('node', 'upgrade').execute({})
@@ -7,7 +7,7 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
7
7
  export default class UpgradingASkill4Test extends AbstractCliTest {
8
8
  protected static async beforeEach() {
9
9
  await super.beforeEach()
10
- CommandService.fakeCommand(new RegExp(/yarn rebuild/gis), {
10
+ CommandService.fakeCommand(new RegExp(/rebuild/gis), {
11
11
  code: 0,
12
12
  })
13
13
  }
@@ -1,6 +1,6 @@
1
1
  import { test, assert } from '@sprucelabs/test-utils'
2
- import AbstractSkillTest from '../../tests/AbstractSkillTest'
3
- import { DEMO_NUMBER_VIEWS_ON_BOOT } from '../../tests/constants'
2
+ import AbstractSkillTest from '../../../tests/AbstractSkillTest'
3
+ import { DEMO_NUMBER_VIEWS_ON_BOOT } from '../../../tests/constants'
4
4
 
5
5
  export default class RegisteringSkillViewOnBootTest extends AbstractSkillTest {
6
6
  protected static skillCacheKey = 'views'
@@ -1,7 +1,7 @@
1
1
  import { test, assert } from '@sprucelabs/test-utils'
2
- import WatchAction from '../../features/view/actions/WatchAction'
3
- import CommandService from '../../services/CommandService'
4
- import AbstractSkillTest from '../../tests/AbstractSkillTest'
2
+ import WatchAction from '../../../features/view/actions/WatchAction'
3
+ import CommandService from '../../../services/CommandService'
4
+ import AbstractSkillTest from '../../../tests/AbstractSkillTest'
5
5
 
6
6
  export default class WatchingSkillViewsTest extends AbstractSkillTest {
7
7
  protected static skillCacheKey = 'views'
@@ -31,7 +31,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
31
31
 
32
32
  @test()
33
33
  protected static async shouldEmitExecutionEvents() {
34
- this.setupMockCommands()
34
+ this.fakeInstallCommands()
35
35
 
36
36
  const executer = this.Action('skill', 'create', {
37
37
  shouldAutoHandleDependencies: true,
@@ -129,7 +129,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
129
129
 
130
130
  @test()
131
131
  protected static async shouldReturnProperSummary() {
132
- this.setupMockCommands()
132
+ this.fakeInstallCommands()
133
133
 
134
134
  const executer = this.Action('skill', 'create', {
135
135
  shouldAutoHandleDependencies: true,
@@ -148,7 +148,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
148
148
 
149
149
  @test()
150
150
  protected static async shouldAskInstallDependentFeatures() {
151
- this.setupMockCommands()
151
+ this.fakeInstallCommands()
152
152
 
153
153
  const executer = this.Action('schema', 'create', {
154
154
  shouldAutoHandleDependencies: true,
@@ -169,7 +169,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
169
169
 
170
170
  @test()
171
171
  protected static async shouldAddListenerWithoutBreakingOnSkill() {
172
- this.setupMockCommands()
172
+ this.fakeInstallCommands()
173
173
 
174
174
  await this.FeatureFixture().installCachedFeatures('schemas')
175
175
 
@@ -180,7 +180,14 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
180
180
 
181
181
  await this.waitForInput()
182
182
 
183
+ await this.ui.sendInput('Y')
184
+ await this.waitForInput()
185
+ await this.ui.sendInput('\n')
186
+
187
+ await this.waitForInput()
188
+
183
189
  await this.ui.sendInput('skill')
190
+
184
191
  await this.ui.sendInput('will-boot')
185
192
 
186
193
  const results = await promise
@@ -264,8 +271,8 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
264
271
  return { promise }
265
272
  }
266
273
 
267
- private static setupMockCommands() {
268
- CommandService.fakeCommand(new RegExp(/npm.*?install .*?/gis), {
274
+ private static fakeInstallCommands() {
275
+ CommandService.fakeCommand(new RegExp(/yarn|npm/gis), {
269
276
  code: 0,
270
277
  })
271
278
  }
@@ -1,4 +1,4 @@
1
- import { test, assert } from '@sprucelabs/test-utils'
1
+ import { test, assert, generateId } from '@sprucelabs/test-utils'
2
2
  import AbstractCliTest from '../../tests/AbstractCliTest'
3
3
 
4
4
  export default class GlobalEmitterTest extends AbstractCliTest {
@@ -7,4 +7,25 @@ export default class GlobalEmitterTest extends AbstractCliTest {
7
7
  //@ts-ignore
8
8
  assert.isTrue(this.emitter.shouldEmitSequentally)
9
9
  }
10
+
11
+ @test()
12
+ protected static async didExecuteAcceptsInstalledPackages() {
13
+ await this.emitter.on('feature.did-execute', () => {
14
+ return {
15
+ packagesInstalled: [
16
+ {
17
+ isDev: true,
18
+ name: generateId(),
19
+ version: generateId(),
20
+ },
21
+ ],
22
+ }
23
+ })
24
+
25
+ await this.emitter.emitAndFlattenResponses('feature.did-execute', {
26
+ actionCode: generateId(),
27
+ featureCode: 'permission',
28
+ results: {},
29
+ })
30
+ }
10
31
  }
@@ -109,8 +109,7 @@ export default class SkillStoreTest extends AbstractCliTest {
109
109
 
110
110
  errorAssert.assertError(err, 'GENERIC')
111
111
 
112
- const pkg = this.Service('pkg')
113
- const namespace = pkg.get('skill.namespace')
112
+ const namespace = this.Service('pkg').getSkillNamespace()
114
113
  assert.isEqual(namespace, slug)
115
114
  }
116
115
 
@@ -69,8 +69,8 @@ export default abstract class AbstractAction<S extends Schema = Schema>
69
69
  options: SchemaValues<S>
70
70
  ): Promise<FeatureActionResponse>
71
71
 
72
- protected Action(featureCode: string, actionCode: string) {
73
- return this.actionExecuter.Action(featureCode as any, actionCode)
72
+ protected Action(featureCode: FeatureCode, actionCode: string) {
73
+ return this.actionExecuter.Action(featureCode, actionCode)
74
74
  }
75
75
 
76
76
  public Service<S extends Service>(type: S, cwd?: string): ServiceMap[S] {
@@ -47,15 +47,15 @@ export default abstract class AbstractFeature<
47
47
  public cwd: string
48
48
  public scripts: Record<string, any> = {}
49
49
  public actionsDir: string | undefined
50
- protected actionFactory?: ActionFactory
50
+ protected actions?: ActionFactory
51
51
  protected templates: Templates
52
52
  protected emitter: GlobalEmitter
53
- protected featureInstaller: FeatureInstaller
53
+ protected features: FeatureInstaller
54
54
  protected ui: GraphicsInterface
55
55
 
56
56
  private serviceFactory: ServiceFactory
57
57
  private storeFactory: StoreFactory
58
- private writerFactory: WriterFactory
58
+ private writers: WriterFactory
59
59
  private apiClientFactory: ApiClientFactory
60
60
  private actionExecuter: ActionExecuter
61
61
  private actionCodes?: string[]
@@ -64,16 +64,16 @@ export default abstract class AbstractFeature<
64
64
  this.cwd = options.cwd
65
65
  this.serviceFactory = options.serviceFactory
66
66
  this.templates = options.templates
67
- this.actionFactory = options.actionFactory
67
+ this.actions = options.actionFactory
68
68
  this.storeFactory = options.storeFactory
69
- this.writerFactory = new WriterFactory({
69
+ this.writers = new WriterFactory({
70
70
  templates: this.templates,
71
71
  ui: options.ui,
72
72
  settings: this.Service('settings'),
73
73
  linter: this.Service('lint'),
74
74
  })
75
75
  this.emitter = options.emitter
76
- this.featureInstaller = options.featureInstaller
76
+ this.features = options.featureInstaller
77
77
  this.ui = options.ui
78
78
  this.apiClientFactory = options.apiClientFactory
79
79
  this.actionExecuter = options.actionExecuter
@@ -103,7 +103,7 @@ export default abstract class AbstractFeature<
103
103
  code: C,
104
104
  options?: Partial<WriterOptions>
105
105
  ): WriterMap[C] {
106
- return this.writerFactory.Writer(code, {
106
+ return this.writers.Writer(code, {
107
107
  fileDescriptions: this.fileDescriptions,
108
108
  linter: this.Service('lint'),
109
109
  ...options,
@@ -111,7 +111,7 @@ export default abstract class AbstractFeature<
111
111
  }
112
112
 
113
113
  public getFeature<Code extends FeatureCode>(code: Code) {
114
- return this.featureInstaller.getFeature(code)
114
+ return this.features.getFeature(code)
115
115
  }
116
116
 
117
117
  public async getAvailableActionCodes(): Promise<string[]> {
@@ -17,7 +17,7 @@ import {
17
17
  export default class ActionExecuter {
18
18
  private emitter: GlobalEmitter
19
19
  private ui: GraphicsInterface
20
- private actionFactory: ActionFactory
20
+ private actions: ActionFactory
21
21
  private featureInstallerFactory: () => FeatureInstaller
22
22
  private shouldAutoHandleDependencies: boolean
23
23
  private shouldThrowOnListenerError: boolean
@@ -26,7 +26,7 @@ export default class ActionExecuter {
26
26
  this.featureInstallerFactory = options.featureInstallerFactory
27
27
  this.emitter = options.emitter
28
28
  this.ui = options.ui
29
- this.actionFactory = options.actionFactory
29
+ this.actions = options.actionFactory
30
30
  this.shouldAutoHandleDependencies =
31
31
  options.shouldAutoHandleDependencies ?? true
32
32
 
@@ -122,7 +122,7 @@ export default class ActionExecuter {
122
122
  executeResults = await originalExecute({
123
123
  ...answers,
124
124
  })
125
- } catch (err) {
125
+ } catch (err: any) {
126
126
  executeResults.errors = [err]
127
127
  }
128
128
 
@@ -169,8 +169,7 @@ export default class ActionExecuter {
169
169
  ): FeatureAction {
170
170
  const featureInstaller = this.getFeatureInstaller()
171
171
 
172
- const actionFactory = this.actionFactory
173
- const action = actionFactory.Action({
172
+ const action = this.actions.Action({
174
173
  featureCode,
175
174
  actionCode,
176
175
  actionExecuter: this,
@@ -14,20 +14,11 @@ import ActionExecuter from './ActionExecuter'
14
14
  import FeatureInstaller from './FeatureInstaller'
15
15
  import OverrideActionDecorator from './OverrideActionDecorator'
16
16
 
17
- export interface FeatureActionFactoryOptions
18
- extends Omit<
19
- ActionOptions,
20
- 'parent' | 'actionExecuter' | 'featureInstaller'
21
- > {
22
- emitter: GlobalEmitter
23
- blockedCommands?: BlockedCommands
24
- optionOverrides?: OptionOverrides
25
- }
26
-
27
17
  export default class ActionFactory {
28
18
  private actionOptions: FeatureActionFactoryOptions
29
19
  private blockedCommands?: BlockedCommands
30
20
  private optionOverrides?: OptionOverrides
21
+ private static overrides: Record<string, ActionConstructor> = {}
31
22
 
32
23
  public constructor(options: FeatureActionFactoryOptions) {
33
24
  const { blockedCommands, optionOverrides, ...actionOptions } = options
@@ -53,19 +44,23 @@ export default class ActionFactory {
53
44
  )
54
45
  }
55
46
 
56
- const classPath = diskUtil.resolvePath(
57
- feature.actionsDir,
58
- `${namesUtil.toPascal(actionCode)}Action`
59
- )
60
-
61
47
  let Class: new (options: ActionOptions) => AbstractAction | undefined
62
48
  let originalError: Error | undefined
63
49
 
64
- try {
65
- Class = require(classPath).default
66
- // eslint-disable-next-line no-empty
67
- } catch (err: any) {
68
- originalError = err
50
+ const key = ActionFactory.overrideKey(featureCode, actionCode)
51
+ if (ActionFactory.overrides[key]) {
52
+ Class = ActionFactory.overrides[key]
53
+ } else {
54
+ const classPath = diskUtil.resolvePath(
55
+ feature.actionsDir,
56
+ `${namesUtil.toPascal(actionCode)}Action`
57
+ )
58
+ try {
59
+ Class = require(classPath).default
60
+ // eslint-disable-next-line no-empty
61
+ } catch (err: any) {
62
+ originalError = err
63
+ }
69
64
  }
70
65
 
71
66
  //@ts-ignore
@@ -109,4 +104,33 @@ export default class ActionFactory {
109
104
 
110
105
  return actionDecorator as FeatureAction<S>
111
106
  }
107
+
108
+ public static setActionClass(
109
+ featureCode: FeatureCode,
110
+ action: string,
111
+ ExecuteTrackingAction: ActionConstructor
112
+ ) {
113
+ this.overrides[ActionFactory.overrideKey(featureCode, action)] =
114
+ ExecuteTrackingAction
115
+ }
116
+
117
+ private static overrideKey(featureCode: string, action: string) {
118
+ return `${featureCode}${action}`
119
+ }
120
+
121
+ public static clearActionOverrides() {
122
+ this.overrides = {}
123
+ }
124
+ }
125
+
126
+ export interface FeatureActionFactoryOptions
127
+ extends Omit<
128
+ ActionOptions,
129
+ 'parent' | 'actionExecuter' | 'featureInstaller'
130
+ > {
131
+ emitter: GlobalEmitter
132
+ blockedCommands?: BlockedCommands
133
+ optionOverrides?: OptionOverrides
112
134
  }
135
+
136
+ type ActionConstructor = new (options: ActionOptions) => AbstractAction
@@ -15,23 +15,6 @@ import {
15
15
  FeatureMap,
16
16
  } from './features.types'
17
17
 
18
- type FeatureCommandExecuteOptions<
19
- F extends FeatureCode,
20
- S extends Schema | undefined = FeatureMap[F]['optionsSchema']
21
- > = S extends Schema ? SchemaPartialValues<S> : undefined
22
-
23
- type FeatureDependencyWithFeature = FeatureDependency & {
24
- feature: AbstractFeature
25
- }
26
-
27
- function s(array: any[]) {
28
- return array.length === 1 ? '' : ''
29
- }
30
-
31
- function areIs(array: any[]) {
32
- return array.length === 1 ? 'is' : 'are'
33
- }
34
-
35
18
  export default class ActionOptionAsker<F extends FeatureCode = FeatureCode> {
36
19
  private ui: GraphicsInterface
37
20
  private featureInstaller: FeatureInstaller
@@ -388,3 +371,20 @@ export default class ActionOptionAsker<F extends FeatureCode = FeatureCode> {
388
371
  return `Before you can run \`${this.getCommandName()}\`, ${message} Don't worry, I'll walk you through it!`
389
372
  }
390
373
  }
374
+
375
+ type FeatureCommandExecuteOptions<
376
+ F extends FeatureCode,
377
+ S extends Schema | undefined = FeatureMap[F]['optionsSchema']
378
+ > = S extends Schema ? SchemaPartialValues<S> : undefined
379
+
380
+ type FeatureDependencyWithFeature = FeatureDependency & {
381
+ feature: AbstractFeature
382
+ }
383
+
384
+ function s(array: any[]) {
385
+ return array.length === 1 ? '' : ''
386
+ }
387
+
388
+ function areIs(array: any[]) {
389
+ return array.length === 1 ? 'is' : 'are'
390
+ }
@@ -42,7 +42,7 @@ export default class ConversationFeature extends AbstractFeature {
42
42
  actionCode: string
43
43
  featureCode: string
44
44
  }) {
45
- const isInstalled = await this.featureInstaller.isInstalled('conversation')
45
+ const isInstalled = await this.features.isInstalled('conversation')
46
46
 
47
47
  if (
48
48
  payload.featureCode === 'node' &&
@@ -22,6 +22,6 @@ export default class DependencyFeature extends AbstractFeature {
22
22
  public packageDependencies = []
23
23
 
24
24
  public async isInstalled() {
25
- return this.featureInstaller.isInstalled('skill')
25
+ return this.features.isInstalled('skill')
26
26
  }
27
27
  }
@@ -41,7 +41,7 @@ export default class DeployAction extends AbstractAction<OptionsSchema> {
41
41
  let results: FeatureActionResponse = {}
42
42
 
43
43
  try {
44
- await this.assertRegisteredSkill()
44
+ this.assertRegisteredSkill()
45
45
  await this.assertDependencies()
46
46
  await this.assertLoggedInToHeroku()
47
47
  await this.setupGitRepo()
@@ -51,7 +51,7 @@ export default class DeployAction extends AbstractAction<OptionsSchema> {
51
51
  results = actionUtil.mergeActionResults(results, procResults)
52
52
 
53
53
  await this.assertNoPendingGitChanges()
54
- } catch (err) {
54
+ } catch (err: any) {
55
55
  return {
56
56
  errors: [err],
57
57
  }
@@ -43,7 +43,7 @@ export default class ErrorFeature extends AbstractFeature {
43
43
  )
44
44
 
45
45
  void this.emitter.on('skill.will-write-directory-template', async () => {
46
- const isInstalled = await this.featureInstaller.isInstalled('error')
46
+ const isInstalled = await this.features.isInstalled('error')
47
47
  if (isInstalled) {
48
48
  return {
49
49
  filesToSkip: ['options.types.ts'],
@@ -55,7 +55,7 @@ export default class ErrorFeature extends AbstractFeature {
55
55
  }
56
56
 
57
57
  public async afterPackageInstall(): Promise<InstallResults> {
58
- const isSkillInstalled = await this.featureInstaller.isInstalled('skill')
58
+ const isSkillInstalled = await this.features.isInstalled('skill')
59
59
 
60
60
  if (!isSkillInstalled) {
61
61
  return {}
@@ -74,9 +74,9 @@ export default class ErrorFeature extends AbstractFeature {
74
74
  }) {
75
75
  const { featureCode, actionCode } = payload
76
76
 
77
- const isInstalled = await this.featureInstaller.isInstalled('error')
77
+ const isInstalled = await this.features.isInstalled('error')
78
78
 
79
- const isSkillInstalled = await this.featureInstaller.isInstalled('skill')
79
+ const isSkillInstalled = await this.features.isInstalled('skill')
80
80
 
81
81
  if (isInstalled && featureCode === 'node' && actionCode === 'upgrade') {
82
82
  const results = await this.Action('error', 'sync').execute({})
@@ -12,22 +12,13 @@ import { FeatureActionResponse, FeatureCode } from '../features.types'
12
12
  import EventContractBuilder from './builders/EventContractBuilder'
13
13
  import EventStore from './stores/EventStore'
14
14
 
15
- declare module '../../features/features.types' {
16
- interface FeatureMap {
17
- event: EventFeature
18
- }
19
-
20
- interface FeatureOptionsMap {
21
- event: undefined
22
- }
23
- }
24
-
25
15
  export default class EventFeature extends AbstractFeature {
26
16
  public code: FeatureCode = 'event'
27
17
  public nameReadable = 'Events'
28
18
  public description = 'Connect to the Mercury Event Engine.'
29
19
  public dependencies: FeatureDependency[] = [
30
20
  { code: 'schema', isRequired: true },
21
+ { code: 'permission', isRequired: true },
31
22
  ]
32
23
  public packageDependencies = [
33
24
  {
@@ -74,7 +65,7 @@ export default class EventFeature extends AbstractFeature {
74
65
 
75
66
  public async afterPackageInstall() {
76
67
  diskUtil.createDir(diskUtil.resolvePath(this.cwd, 'src', 'events'))
77
- const isSkillInstalled = await this.featureInstaller.isInstalled('skill')
68
+ const isSkillInstalled = await this.features.isInstalled('skill')
78
69
  if (isSkillInstalled) {
79
70
  return await this.Action('event', 'sync.listeners').execute({})
80
71
  }
@@ -101,7 +92,7 @@ export default class EventFeature extends AbstractFeature {
101
92
  settings.clearListenerCache()
102
93
  }
103
94
 
104
- const isInstalled = await this.featureInstaller.isInstalled('event')
95
+ const isInstalled = await this.features.isInstalled('event')
105
96
  const isRemoteRelevant =
106
97
  isInstalled &&
107
98
  (featureCode === 'event' ||
@@ -128,7 +119,7 @@ export default class EventFeature extends AbstractFeature {
128
119
  actionCode: string
129
120
  }) {
130
121
  const { featureCode, actionCode } = payload
131
- const isInstalled = await this.featureInstaller.isInstalled('event')
122
+ const isInstalled = await this.features.isInstalled('event')
132
123
 
133
124
  let results = {}
134
125
 
@@ -178,7 +169,7 @@ export default class EventFeature extends AbstractFeature {
178
169
  }
179
170
 
180
171
  private async handleDidFetchSchemas(payload: { schemas?: Schema[] | null }) {
181
- const isInstalled = await this.featureInstaller.isInstalled(this.code)
172
+ const isInstalled = await this.features.isInstalled(this.code)
182
173
 
183
174
  const lastSync = this.Service('eventSettings').getLastSyncOptions()
184
175
 
@@ -225,3 +216,13 @@ export default class EventFeature extends AbstractFeature {
225
216
  return false
226
217
  }
227
218
  }
219
+
220
+ declare module '../../features/features.types' {
221
+ interface FeatureMap {
222
+ event: EventFeature
223
+ }
224
+
225
+ interface FeatureOptionsMap {
226
+ event: undefined
227
+ }
228
+ }
@@ -102,7 +102,7 @@ export default class CreateAction extends AbstractAction<OptionsSchema> {
102
102
  { files, meta: { fqen } },
103
103
  syncResponse
104
104
  )
105
- } catch (err) {
105
+ } catch (err: any) {
106
106
  return {
107
107
  errors: [err],
108
108
  }
@@ -148,7 +148,7 @@ export default class ListenAction extends AbstractAction<OptionsSchema> {
148
148
  }
149
149
 
150
150
  return response
151
- } catch (err) {
151
+ } catch (err: any) {
152
152
  return {
153
153
  errors: [err],
154
154
  }