@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.
- package/CHANGELOG.md +10 -0
- package/build/.spruce/events/events.contract.d.ts +159 -0
- package/build/.spruce/events/events.contract.js +5 -1
- package/build/.spruce/events/events.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.d.ts +46 -0
- package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.js +57 -0
- package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.js.map +1 -0
- package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.d.ts +68 -0
- package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.js +78 -0
- package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.js.map +1 -0
- package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.d.ts +40 -0
- package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.js +51 -0
- package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.js.map +1 -0
- package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.d.ts +9 -0
- package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.js +17 -0
- package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.js.map +1 -0
- package/build/.spruce/schemas/schemas.types.d.ts +158 -55
- package/build/.spruce/schemas/schemas.types.js.map +1 -1
- package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.d.ts +3 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.js +70 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.js.map +1 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.d.ts +3 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.js +35 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.js.map +1 -0
- package/build/.spruce/settings.json +2 -1
- package/build/GlobalEmitter.d.ts +13 -38
- package/build/GlobalEmitter.js +3 -6
- package/build/GlobalEmitter.js.map +1 -1
- package/build/__tests__/behavioral/TestingAConversation.test.d.ts +2 -1
- package/build/__tests__/behavioral/TestingAConversation.test.js +74 -84
- package/build/__tests__/behavioral/TestingAConversation.test.js.map +1 -1
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +38 -13
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
- package/build/__tests__/behavioral/events/EventWriter.test.d.ts +4 -0
- package/build/__tests__/behavioral/events/EventWriter.test.js +116 -0
- package/build/__tests__/behavioral/events/EventWriter.test.js.map +1 -0
- package/build/__tests__/behavioral/{ListeningToCoreEvents.test.d.ts → events/ListeningToCoreEvents.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{ListeningToCoreEvents.test.js → events/ListeningToCoreEvents.test.js} +1 -1
- package/build/__tests__/behavioral/events/ListeningToCoreEvents.test.js.map +1 -0
- package/build/__tests__/behavioral/{RegisteringEventsOnBoot.test.d.ts → events/RegisteringEventsOnBoot.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{RegisteringEventsOnBoot.test.js → events/RegisteringEventsOnBoot.test.js} +2 -2
- package/build/__tests__/behavioral/events/RegisteringEventsOnBoot.test.js.map +1 -0
- package/build/__tests__/behavioral/{RegisteringGlobalEvents.test.d.ts → events/RegisteringGlobalEvents.test.d.ts} +2 -3
- package/build/__tests__/behavioral/{RegisteringGlobalEvents.test.js → events/RegisteringGlobalEvents.test.js} +45 -70
- package/build/__tests__/behavioral/events/RegisteringGlobalEvents.test.js.map +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.d.ts +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +16 -9
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
- package/build/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.d.ts → events/SyncingEventsOnlyFromDependencies.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.js → events/SyncingEventsOnlyFromDependencies.test.js} +1 -1
- package/build/__tests__/behavioral/events/SyncingEventsOnlyFromDependencies.test.js.map +1 -0
- package/build/__tests__/behavioral/permissions/CreatingPermissions.test.d.ts +2 -2
- package/build/__tests__/behavioral/permissions/CreatingPermissions.test.js +7 -7
- package/build/__tests__/behavioral/permissions/CreatingPermissions.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/PermissionPlugin.test.d.ts +6 -0
- package/build/__tests__/behavioral/permissions/PermissionPlugin.test.js +85 -0
- package/build/__tests__/behavioral/permissions/PermissionPlugin.test.js.map +1 -0
- package/build/__tests__/behavioral/permissions/PermissionStore.test.d.ts +5 -4
- package/build/__tests__/behavioral/permissions/PermissionStore.test.js +97 -63
- package/build/__tests__/behavioral/permissions/PermissionStore.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/PermissionWriter.test.d.ts +5 -0
- package/build/__tests__/behavioral/permissions/PermissionWriter.test.js +88 -0
- package/build/__tests__/behavioral/permissions/PermissionWriter.test.js.map +1 -0
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.d.ts +15 -4
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js +325 -28
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/support/AbstractPermissionsTest.d.ts +11 -0
- package/build/__tests__/behavioral/permissions/{AbstractPermissionsTest.js → support/AbstractPermissionsTest.js} +34 -2
- package/build/__tests__/behavioral/permissions/support/AbstractPermissionsTest.js.map +1 -0
- package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.d.ts +1 -0
- package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.js +11 -0
- package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.js.map +1 -0
- package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.d.ts +1 -0
- package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.js +17 -0
- package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.js.map +1 -0
- package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.d.ts +5 -0
- package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.js +10 -0
- package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.js.map +1 -0
- package/build/__tests__/behavioral/{CreatingSchemasWithGenerics.test.d.ts → schemas/CreatingSchemasWithGenerics.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{CreatingSchemasWithGenerics.test.js → schemas/CreatingSchemasWithGenerics.test.js} +2 -2
- package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js.map +1 -0
- package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.d.ts +1 -1
- package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js +46 -46
- package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js.map +1 -1
- package/build/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.d.ts → schemas/SettingUpSchemasForModuleDistribution.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.js → schemas/SettingUpSchemasForModuleDistribution.test.js} +3 -3
- package/build/__tests__/behavioral/schemas/SettingUpSchemasForModuleDistribution.test.js.map +1 -0
- package/build/__tests__/behavioral/{InstallingASkillAtAnOrg.test.d.ts → skill/InstallingASkillAtAnOrg.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{InstallingASkillAtAnOrg.test.js → skill/InstallingASkillAtAnOrg.test.js} +2 -2
- package/build/__tests__/behavioral/skill/InstallingASkillAtAnOrg.test.js.map +1 -0
- package/build/__tests__/behavioral/{LoggingInAsASkill.test.d.ts → skill/LoggingInAsASkill.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{LoggingInAsASkill.test.js → skill/LoggingInAsASkill.test.js} +2 -2
- package/build/__tests__/behavioral/skill/LoggingInAsASkill.test.js.map +1 -0
- package/build/__tests__/behavioral/{RebuildingASkill.test.d.ts → skill/RebuildingASkill.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{RebuildingASkill.test.js → skill/RebuildingASkill.test.js} +2 -2
- package/build/__tests__/behavioral/skill/RebuildingASkill.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/CreatingATest.test.js +2 -2
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- package/build/__tests__/behavioral/{SettingUpASkillForTesting.test.d.ts → tests/SettingUpASkillForTesting.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{SettingUpASkillForTesting.test.js → tests/SettingUpASkillForTesting.test.js} +2 -2
- package/build/__tests__/behavioral/tests/SettingUpASkillForTesting.test.js.map +1 -0
- package/build/__tests__/behavioral/{TestReporterSettingsRemembered.test.d.ts → tests/TestReporterSettingsRemembered.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{TestReporterSettingsRemembered.test.js → tests/TestReporterSettingsRemembered.test.js} +1 -1
- package/build/__tests__/behavioral/tests/TestReporterSettingsRemembered.test.js.map +1 -0
- package/build/__tests__/behavioral/{TestingDataStores.test.d.ts → tests/TestingDataStores.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{TestingDataStores.test.js → tests/TestingDataStores.test.js} +3 -3
- package/build/__tests__/behavioral/tests/TestingDataStores.test.js.map +1 -0
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js +7 -3
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js +2 -2
- package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js.map +1 -1
- package/build/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.d.ts → views/RegisteringSkillViewOnBoot.test.d.ts} +4 -4
- package/build/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.js → views/RegisteringSkillViewOnBoot.test.js} +2 -2
- package/build/__tests__/behavioral/views/RegisteringSkillViewOnBoot.test.js.map +1 -0
- package/build/__tests__/behavioral/{WatchingSkillViews.test.d.ts → views/WatchingSkillViews.test.d.ts} +1 -1
- package/build/__tests__/behavioral/{WatchingSkillViews.test.js → views/WatchingSkillViews.test.js} +2 -2
- package/build/__tests__/behavioral/views/WatchingSkillViews.test.js.map +1 -0
- package/build/__tests__/implementation/ActionExecuter2.test.d.ts +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js +23 -11
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/__tests__/implementation/GlobalEmitter.test.d.ts +1 -0
- package/build/__tests__/implementation/GlobalEmitter.test.js +40 -3
- package/build/__tests__/implementation/GlobalEmitter.test.js.map +1 -1
- package/build/__tests__/implementation/SkillStore.test.js +3 -4
- package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
- package/build/features/AbstractAction.d.ts +1 -1
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/AbstractFeature.d.ts +3 -3
- package/build/features/AbstractFeature.js +8 -8
- package/build/features/AbstractFeature.js.map +1 -1
- package/build/features/ActionExecuter.d.ts +1 -1
- package/build/features/ActionExecuter.js +3 -4
- package/build/features/ActionExecuter.js.map +1 -1
- package/build/features/ActionFactory.d.ts +12 -5
- package/build/features/ActionFactory.js +27 -6
- package/build/features/ActionFactory.js.map +1 -1
- package/build/features/ActionQuestionAsker.d.ts +1 -1
- package/build/features/ActionQuestionAsker.js +6 -6
- package/build/features/ActionQuestionAsker.js.map +1 -1
- package/build/features/conversation/ConversationFeature.js +1 -1
- package/build/features/conversation/ConversationFeature.js.map +1 -1
- package/build/features/dependencies/DependencyFeature.js +1 -1
- package/build/features/dependencies/DependencyFeature.js.map +1 -1
- package/build/features/deploy/actions/HerokuAction.js +31 -33
- package/build/features/deploy/actions/HerokuAction.js.map +1 -1
- package/build/features/error/ErrorFeature.js +4 -4
- package/build/features/error/ErrorFeature.js.map +1 -1
- package/build/features/event/EventFeature.d.ts +8 -8
- package/build/features/event/EventFeature.js +7 -4
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/event/actions/CreateAction.js.map +1 -1
- package/build/features/event/actions/ListenAction.js.map +1 -1
- package/build/features/event/stores/EventStore.d.ts +9 -9
- package/build/features/event/stores/EventStore.js +26 -26
- package/build/features/event/stores/EventStore.js.map +1 -1
- package/build/features/eventContract/EventContractFeature.js +4 -1
- package/build/features/eventContract/EventContractFeature.js.map +1 -1
- package/build/features/eventContract/actions/PullAction.js +10 -5
- package/build/features/eventContract/actions/PullAction.js.map +1 -1
- package/build/features/features.types.d.ts +2 -37
- package/build/features/features.types.js +0 -41
- package/build/features/features.types.js.map +1 -1
- package/build/features/log/LogFeature.js +1 -1
- package/build/features/log/LogFeature.js.map +1 -1
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/organization/actions/InstallAction.js.map +1 -1
- package/build/features/permission/PermissionFeature.d.ts +12 -2
- package/build/features/permission/PermissionFeature.js +138 -15
- package/build/features/permission/PermissionFeature.js.map +1 -1
- package/build/features/permission/actions/CreateAction.js +4 -1
- package/build/features/permission/actions/CreateAction.js.map +1 -1
- package/build/features/permission/actions/SyncAction.d.ts +5 -1
- package/build/features/permission/actions/SyncAction.js +28 -10
- package/build/features/permission/actions/SyncAction.js.map +1 -1
- package/build/features/permission/stores/PermissionStore.d.ts +6 -1
- package/build/features/permission/stores/PermissionStore.js +43 -31
- package/build/features/permission/stores/PermissionStore.js.map +1 -1
- package/build/features/permission/writers/PermissionWriter.d.ts +7 -1
- package/build/features/permission/writers/PermissionWriter.js +67 -18
- package/build/features/permission/writers/PermissionWriter.js.map +1 -1
- package/build/features/person/PersonFeature.js +1 -1
- package/build/features/person/PersonFeature.js.map +1 -1
- package/build/features/sandbox/SandboxFeature.js +1 -1
- package/build/features/sandbox/SandboxFeature.js.map +1 -1
- package/build/features/schema/SchemaFeature.d.ts +8 -8
- package/build/features/schema/SchemaFeature.js +4 -4
- package/build/features/schema/SchemaFeature.js.map +1 -1
- package/build/features/schema/writers/SchemaWriter.d.ts +12 -12
- package/build/features/schema/writers/SchemaWriter.js.map +1 -1
- package/build/features/skill/SkillFeature.d.ts +11 -11
- package/build/features/skill/SkillFeature.js +2 -2
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/skill/actions/RebuildAction.js.map +1 -1
- package/build/features/skill/actions/RegisterAction.js.map +1 -1
- package/build/features/skill/stores/SkillStore.js +1 -2
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/store/StoreFeature.js +1 -1
- package/build/features/store/StoreFeature.js.map +1 -1
- package/build/features/store/actions/SyncAction.d.ts +1 -1
- package/build/features/store/actions/SyncAction.js.map +1 -1
- package/build/features/test/TestFeature.js +1 -1
- package/build/features/test/TestFeature.js.map +1 -1
- package/build/features/view/ViewFeature.js +1 -1
- package/build/features/view/ViewFeature.js.map +1 -1
- package/build/schemas/v2020_07_22/actionResponse.builder.d.ts +85 -0
- package/build/schemas/v2020_07_22/actionResponse.builder.js +70 -0
- package/build/schemas/v2020_07_22/actionResponse.builder.js.map +1 -0
- package/build/schemas/v2020_07_22/generatedFile.builder.d.ts +27 -0
- package/build/schemas/v2020_07_22/generatedFile.builder.js +45 -0
- package/build/schemas/v2020_07_22/generatedFile.builder.js.map +1 -0
- package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js +4 -40
- package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js.map +1 -1
- package/build/services/CommandService.d.ts +2 -2
- package/build/services/CommandService.js +6 -6
- package/build/services/CommandService.js.map +1 -1
- package/build/services/PkgService.d.ts +1 -0
- package/build/services/PkgService.js +5 -0
- package/build/services/PkgService.js.map +1 -1
- package/build/tests/AbstractCliTest.d.ts +7 -3
- package/build/tests/AbstractCliTest.js +81 -45
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/buildTestCache.js +7 -0
- package/build/tests/buildTestCache.js.map +1 -1
- package/build/tests/fixtures/FeatureFixture.js +1 -0
- package/build/tests/fixtures/FeatureFixture.js.map +1 -1
- package/build/tests/utilities/test.utility.d.ts +2 -0
- package/build/tests/utilities/test.utility.js +6 -0
- package/build/tests/utilities/test.utility.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts +4 -2
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js +13 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts +2 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js +3 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +20 -2
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +20 -2
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js +2 -0
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +15 -3
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +63 -49
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +65 -33
- package/src/.spruce/events/events.contract.ts +24 -0
- package/src/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.ts +54 -0
- package/src/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.ts +79 -0
- package/src/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.ts +48 -0
- package/src/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.ts +13 -0
- package/src/.spruce/schemas/schemas.types.ts +171 -52
- package/src/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.ts +58 -0
- package/src/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.ts +33 -0
- package/src/.spruce/settings.json +2 -1
- package/src/GlobalEmitter.ts +2 -7
- package/src/__tests__/behavioral/TestingAConversation.test.ts +20 -37
- package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +14 -2
- package/src/__tests__/behavioral/events/EventWriter.test.ts +75 -0
- package/src/__tests__/behavioral/{ListeningToCoreEvents.test.ts → events/ListeningToCoreEvents.test.ts} +1 -1
- package/src/__tests__/behavioral/{RegisteringEventsOnBoot.test.ts → events/RegisteringEventsOnBoot.test.ts} +2 -2
- package/src/__tests__/behavioral/{RegisteringGlobalEvents.test.ts → events/RegisteringGlobalEvents.test.ts} +4 -12
- package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +6 -0
- package/src/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.ts → events/SyncingEventsOnlyFromDependencies.test.ts} +2 -2
- package/src/__tests__/behavioral/permissions/CreatingPermissions.test.ts +2 -2
- package/src/__tests__/behavioral/permissions/PermissionPlugin.test.ts +24 -0
- package/src/__tests__/behavioral/permissions/PermissionStore.test.ts +96 -38
- package/src/__tests__/behavioral/permissions/PermissionWriter.test.ts +24 -0
- package/src/__tests__/behavioral/permissions/SyncingPermissions.test.ts +125 -8
- package/src/__tests__/behavioral/permissions/support/AbstractPermissionsTest.ts +38 -0
- package/src/__tests__/behavioral/permissions/support/generateShortAlphaId.ts +5 -0
- package/src/__tests__/behavioral/permissions/support/renderPermissionTestFile.ts +27 -0
- package/src/__tests__/behavioral/permissions/support/sortPermissionContracts.ts +3 -0
- package/src/__tests__/behavioral/{CreatingSchemasWithGenerics.test.ts → schemas/CreatingSchemasWithGenerics.test.ts} +2 -2
- package/src/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.ts +12 -12
- package/src/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.ts → schemas/SettingUpSchemasForModuleDistribution.test.ts} +4 -4
- package/src/__tests__/behavioral/{InstallingASkillAtAnOrg.test.ts → skill/InstallingASkillAtAnOrg.test.ts} +2 -2
- package/src/__tests__/behavioral/{LoggingInAsASkill.test.ts → skill/LoggingInAsASkill.test.ts} +3 -3
- package/src/__tests__/behavioral/{RebuildingASkill.test.ts → skill/RebuildingASkill.test.ts} +2 -2
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -2
- package/src/__tests__/behavioral/{SettingUpASkillForTesting.test.ts → tests/SettingUpASkillForTesting.test.ts} +2 -2
- package/src/__tests__/behavioral/{TestReporterSettingsRemembered.test.ts → tests/TestReporterSettingsRemembered.test.ts} +2 -2
- package/src/__tests__/behavioral/{TestingDataStores.test.ts → tests/TestingDataStores.test.ts} +3 -3
- package/src/__tests__/behavioral/upgrading/UpgradingANodeModule.test.ts +3 -0
- package/src/__tests__/behavioral/upgrading/UpgradingASkill3.test.ts +3 -2
- package/src/__tests__/behavioral/upgrading/UpgradingASkill4.test.ts +1 -1
- package/src/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.ts → views/RegisteringSkillViewOnBoot.test.ts} +2 -2
- package/src/__tests__/behavioral/{WatchingSkillViews.test.ts → views/WatchingSkillViews.test.ts} +3 -3
- package/src/__tests__/implementation/ActionExecuter2.test.ts +13 -6
- package/src/__tests__/implementation/GlobalEmitter.test.ts +22 -1
- package/src/__tests__/implementation/SkillStore.test.ts +1 -2
- package/src/features/AbstractAction.ts +2 -2
- package/src/features/AbstractFeature.ts +8 -8
- package/src/features/ActionExecuter.ts +4 -5
- package/src/features/ActionFactory.ts +44 -20
- package/src/features/ActionQuestionAsker.ts +17 -17
- package/src/features/conversation/ConversationFeature.ts +1 -1
- package/src/features/dependencies/DependencyFeature.ts +1 -1
- package/src/features/deploy/actions/HerokuAction.ts +2 -2
- package/src/features/error/ErrorFeature.ts +4 -4
- package/src/features/event/EventFeature.ts +15 -14
- package/src/features/event/actions/CreateAction.ts +1 -1
- package/src/features/event/actions/ListenAction.ts +1 -1
- package/src/features/event/stores/EventStore.ts +37 -37
- package/src/features/eventContract/EventContractFeature.ts +6 -1
- package/src/features/eventContract/actions/PullAction.ts +7 -3
- package/src/features/features.types.ts +4 -41
- package/src/features/log/LogFeature.ts +1 -1
- package/src/features/node/NodeFeature.ts +1 -1
- package/src/features/organization/actions/InstallAction.ts +1 -1
- package/src/features/permission/PermissionFeature.ts +68 -11
- package/src/features/permission/actions/CreateAction.ts +2 -0
- package/src/features/permission/actions/SyncAction.ts +22 -3
- package/src/features/permission/stores/PermissionStore.ts +27 -8
- package/src/features/permission/writers/PermissionWriter.ts +62 -4
- package/src/features/person/PersonFeature.ts +1 -1
- package/src/features/sandbox/SandboxFeature.ts +1 -3
- package/src/features/schema/SchemaFeature.ts +14 -14
- package/src/features/schema/writers/SchemaWriter.ts +14 -15
- package/src/features/skill/SkillFeature.ts +18 -18
- package/src/features/skill/actions/RebuildAction.ts +1 -1
- package/src/features/skill/actions/RegisterAction.ts +1 -1
- package/src/features/skill/stores/SkillStore.ts +1 -2
- package/src/features/store/StoreFeature.ts +1 -1
- package/src/features/store/actions/SyncAction.ts +1 -1
- package/src/features/test/TestFeature.ts +1 -1
- package/src/features/view/ViewFeature.ts +1 -1
- package/src/schemas/v2020_07_22/actionResponse.builder.ts +62 -0
- package/src/schemas/v2020_07_22/generatedFile.builder.ts +44 -0
- package/src/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.ts +3 -46
- package/src/services/CommandService.ts +5 -5
- package/src/services/PkgService.ts +4 -0
- package/src/tests/AbstractCliTest.ts +31 -13
- package/src/tests/buildTestCache.ts +7 -0
- package/src/tests/fixtures/FeatureFixture.ts +2 -0
- package/src/tests/utilities/test.utility.ts +13 -0
- package/build/__tests__/behavioral/CreatingSchemasWithGenerics.test.js.map +0 -1
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +0 -1
- package/build/__tests__/behavioral/ListeningToCoreEvents.test.js.map +0 -1
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +0 -1
- package/build/__tests__/behavioral/RebuildingASkill.test.js.map +0 -1
- package/build/__tests__/behavioral/RegisteringEventsOnBoot.test.js.map +0 -1
- package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js.map +0 -1
- package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js.map +0 -1
- package/build/__tests__/behavioral/SettingUpASkillForTesting.test.js.map +0 -1
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js.map +0 -1
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +0 -1
- package/build/__tests__/behavioral/TestReporterSettingsRemembered.test.js.map +0 -1
- package/build/__tests__/behavioral/TestingDataStores.test.js.map +0 -1
- package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +0 -1
- package/build/__tests__/behavioral/permissions/AbstractPermissionsTest.d.ts +0 -8
- package/build/__tests__/behavioral/permissions/AbstractPermissionsTest.js.map +0 -1
- package/src/__tests__/behavioral/permissions/AbstractPermissionsTest.ts +0 -20
|
@@ -22,43 +22,6 @@ import AbstractStore from '../../../stores/AbstractStore'
|
|
|
22
22
|
import { InternalUpdateHandler } from '../../../types/cli.types'
|
|
23
23
|
import { eventContractCleanerUtil } from '../../../utilities/eventContractCleaner.utility'
|
|
24
24
|
|
|
25
|
-
export interface EventStoreFetchEventContractsResponse {
|
|
26
|
-
errors: SpruceError[]
|
|
27
|
-
contracts: EventContract[]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type Options = Omit<
|
|
31
|
-
EventSignature,
|
|
32
|
-
| 'responsePayloadSchema'
|
|
33
|
-
| 'emitPayloadSchema'
|
|
34
|
-
| 'listenPermissionContract'
|
|
35
|
-
| 'emitPermissionContract'
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
interface EventImport {
|
|
39
|
-
options?: Options
|
|
40
|
-
emitPayload?: Schema
|
|
41
|
-
emitTarget?: Schema
|
|
42
|
-
responsePayload?: Schema
|
|
43
|
-
emitPermissions?: PermissionContract
|
|
44
|
-
listenPermissions?: PermissionContract
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const eventFileNamesImportKeyMap = {
|
|
48
|
-
'event.options.ts': { key: 'options', isSchema: false },
|
|
49
|
-
'emitPayload.builder.ts': { key: 'emitPayload', isSchema: true },
|
|
50
|
-
'emitTarget.builder.ts': { key: 'emitTarget', isSchema: true },
|
|
51
|
-
'responsePayload.builder.ts': { key: 'responsePayload', isSchema: true },
|
|
52
|
-
'emitPermissions.builder.ts': { key: 'emitPermissions', isSchema: false },
|
|
53
|
-
'listenPermissions.builder.ts': { key: 'listenPermissions', isSchema: false },
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface FetchContractsOptions {
|
|
57
|
-
localNamespace?: string
|
|
58
|
-
namespaces?: string[]
|
|
59
|
-
didUpdateHandler?: InternalUpdateHandler
|
|
60
|
-
}
|
|
61
|
-
|
|
62
25
|
export default class EventStore extends AbstractStore {
|
|
63
26
|
public name = 'event'
|
|
64
27
|
protected static contractCache: Record<string, any> = {}
|
|
@@ -314,3 +277,40 @@ export default class EventStore extends AbstractStore {
|
|
|
314
277
|
EventStore.contractCache = {}
|
|
315
278
|
}
|
|
316
279
|
}
|
|
280
|
+
|
|
281
|
+
export interface EventStoreFetchEventContractsResponse {
|
|
282
|
+
errors: SpruceError[]
|
|
283
|
+
contracts: EventContract[]
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
type Options = Omit<
|
|
287
|
+
EventSignature,
|
|
288
|
+
| 'responsePayloadSchema'
|
|
289
|
+
| 'emitPayloadSchema'
|
|
290
|
+
| 'listenPermissionContract'
|
|
291
|
+
| 'emitPermissionContract'
|
|
292
|
+
>
|
|
293
|
+
|
|
294
|
+
interface EventImport {
|
|
295
|
+
options?: Options
|
|
296
|
+
emitPayload?: Schema
|
|
297
|
+
emitTarget?: Schema
|
|
298
|
+
responsePayload?: Schema
|
|
299
|
+
emitPermissions?: PermissionContract
|
|
300
|
+
listenPermissions?: PermissionContract
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const eventFileNamesImportKeyMap = {
|
|
304
|
+
'event.options.ts': { key: 'options', isSchema: false },
|
|
305
|
+
'emitPayload.builder.ts': { key: 'emitPayload', isSchema: true },
|
|
306
|
+
'emitTarget.builder.ts': { key: 'emitTarget', isSchema: true },
|
|
307
|
+
'responsePayload.builder.ts': { key: 'responsePayload', isSchema: true },
|
|
308
|
+
'emitPermissions.builder.ts': { key: 'emitPermissions', isSchema: false },
|
|
309
|
+
'listenPermissions.builder.ts': { key: 'listenPermissions', isSchema: false },
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface FetchContractsOptions {
|
|
313
|
+
localNamespace?: string
|
|
314
|
+
namespaces?: string[]
|
|
315
|
+
didUpdateHandler?: InternalUpdateHandler
|
|
316
|
+
}
|
|
@@ -14,7 +14,12 @@ export default class EventContractFeature extends AbstractFeature {
|
|
|
14
14
|
public nameReadable = 'Event Contract'
|
|
15
15
|
public description =
|
|
16
16
|
'Pull core Mercury events down and write to single, portable, dependency-free, strongly typed contract.'
|
|
17
|
-
public dependencies: FeatureDependency[] = [
|
|
17
|
+
public dependencies: FeatureDependency[] = [
|
|
18
|
+
{
|
|
19
|
+
code: 'permission',
|
|
20
|
+
isRequired: true,
|
|
21
|
+
},
|
|
22
|
+
]
|
|
18
23
|
public packageDependencies = []
|
|
19
24
|
|
|
20
25
|
public actionsDir = diskUtil.resolvePath(__dirname, 'actions')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildSchema, SchemaValues } from '@sprucelabs/schema'
|
|
2
2
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
|
+
import actionUtil from '../../../utilities/action.utility'
|
|
3
4
|
import AbstractAction from '../../AbstractAction'
|
|
4
5
|
import { FeatureActionResponse } from '../../features.types'
|
|
5
6
|
|
|
@@ -30,7 +31,8 @@ export default class PullAction extends AbstractAction<PullOptionsSchema> {
|
|
|
30
31
|
destination = diskUtil.resolvePath(this.cwd, destination, filename)
|
|
31
32
|
|
|
32
33
|
const { contracts } = await this.Store('event').fetchEventContracts()
|
|
33
|
-
let buildEventContractImport = `import { buildEventContract } from '@sprucelabs/mercury-types'
|
|
34
|
+
let buildEventContractImport = `import { buildEventContract } from '@sprucelabs/mercury-types'
|
|
35
|
+
import '${'#spruce'}/permissions/permissions.types'`
|
|
34
36
|
|
|
35
37
|
const contents = `${buildEventContractImport}
|
|
36
38
|
const eventContracts = [${contracts
|
|
@@ -48,7 +50,9 @@ export type CoreEventContract = ${contracts
|
|
|
48
50
|
|
|
49
51
|
diskUtil.writeFile(destination, contents)
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
const results = await this.Action('permission', 'sync').execute({})
|
|
54
|
+
|
|
55
|
+
return actionUtil.mergeActionResults(results, {
|
|
52
56
|
files: [
|
|
53
57
|
{
|
|
54
58
|
name: filename,
|
|
@@ -57,6 +61,6 @@ export type CoreEventContract = ${contracts
|
|
|
57
61
|
description: 'All your Mercury core events ready for testing!',
|
|
58
62
|
},
|
|
59
63
|
],
|
|
60
|
-
}
|
|
64
|
+
})
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SpruceSchemas } from '@sprucelabs/mercury-types'
|
|
2
|
+
import { Schema, SchemaValues } from '@sprucelabs/schema'
|
|
2
3
|
import { Templates } from '@sprucelabs/spruce-templates'
|
|
3
|
-
import generatedFileSchema from '#spruce/schemas/spruceCli/v2020_07_22/generatedFile.schema'
|
|
4
4
|
import { GlobalEmitter } from '../GlobalEmitter'
|
|
5
5
|
import ServiceFactory from '../services/ServiceFactory'
|
|
6
6
|
import StoreFactory from '../stores/StoreFactory'
|
|
@@ -58,50 +58,13 @@ export interface InstallFeatureOptions {
|
|
|
58
58
|
didUpdateHandler?: InternalUpdateHandler
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export const actionResponseSchema = buildSchema({
|
|
62
|
-
id: 'actionResponse',
|
|
63
|
-
fields: {
|
|
64
|
-
files: {
|
|
65
|
-
type: 'schema',
|
|
66
|
-
isArray: true,
|
|
67
|
-
options: {
|
|
68
|
-
schema: generatedFileSchema,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
headline: {
|
|
72
|
-
type: 'text',
|
|
73
|
-
},
|
|
74
|
-
hints: {
|
|
75
|
-
type: 'text',
|
|
76
|
-
isArray: true,
|
|
77
|
-
},
|
|
78
|
-
summaryLines: {
|
|
79
|
-
type: 'text',
|
|
80
|
-
isArray: true,
|
|
81
|
-
},
|
|
82
|
-
errors: {
|
|
83
|
-
type: 'raw',
|
|
84
|
-
isArray: true,
|
|
85
|
-
options: {
|
|
86
|
-
valueType: 'SpruceError<any>',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
meta: {
|
|
90
|
-
type: 'raw',
|
|
91
|
-
options: {
|
|
92
|
-
valueType: 'Record<string, any>',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
})
|
|
97
|
-
|
|
98
61
|
export interface FeatureInstallResponse {
|
|
99
62
|
files?: GeneratedFile[]
|
|
100
63
|
packagesInstalled?: NpmPackage[]
|
|
101
64
|
}
|
|
102
65
|
|
|
103
|
-
export type FeatureActionResponse =
|
|
104
|
-
FeatureInstallResponse
|
|
66
|
+
export type FeatureActionResponse =
|
|
67
|
+
SpruceSchemas.SpruceCli.v2020_07_22.ActionResponse & FeatureInstallResponse
|
|
105
68
|
|
|
106
69
|
export interface FeatureAction<S extends Schema = Schema> {
|
|
107
70
|
optionsSchema?: S
|
|
@@ -1,24 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { PermissionContractMap } from '@sprucelabs/mercury-types'
|
|
2
|
+
import { diskUtil, NpmPackage } from '@sprucelabs/spruce-skill-utils'
|
|
3
|
+
import AbstractFeature, {
|
|
4
|
+
FeatureDependency,
|
|
5
|
+
FeatureOptions,
|
|
6
|
+
InstallResults,
|
|
7
|
+
} from '../AbstractFeature'
|
|
3
8
|
import { FeatureCode } from '../features.types'
|
|
9
|
+
import PermissionWriter from './writers/PermissionWriter'
|
|
4
10
|
|
|
5
11
|
export default class PermissionFeature extends AbstractFeature {
|
|
6
12
|
public code: FeatureCode = 'permission'
|
|
7
13
|
public nameReadable = 'permission'
|
|
8
14
|
public description = 'Manage permissions for your skill'
|
|
9
|
-
public dependencies: FeatureDependency[] = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
isRequired: true,
|
|
13
|
-
},
|
|
15
|
+
public dependencies: FeatureDependency[] = []
|
|
16
|
+
public actionsDir = diskUtil.resolvePath(__dirname, 'actions')
|
|
17
|
+
public packageDependencies: NpmPackage[] = [
|
|
14
18
|
{
|
|
15
|
-
|
|
16
|
-
isRequired: true,
|
|
19
|
+
name: '@sprucelabs/spruce-permission-plugin@latest',
|
|
17
20
|
},
|
|
18
21
|
]
|
|
19
|
-
|
|
22
|
+
private writer: PermissionWriter
|
|
20
23
|
|
|
21
|
-
public
|
|
24
|
+
public constructor(options: FeatureOptions) {
|
|
25
|
+
super(options)
|
|
26
|
+
this.writer = this.Writer('permission')
|
|
27
|
+
|
|
28
|
+
void this.emitter.on(
|
|
29
|
+
'feature.did-execute',
|
|
30
|
+
this.handleDidExecuteAction.bind(this)
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public async handleDidExecuteAction({
|
|
35
|
+
featureCode,
|
|
36
|
+
actionCode,
|
|
37
|
+
}: {
|
|
38
|
+
featureCode: string
|
|
39
|
+
actionCode: string
|
|
40
|
+
}) {
|
|
41
|
+
const isInstalled = await this.features.isInstalled('permission')
|
|
42
|
+
const isSkillInstalled = await this.features.isInstalled('skill')
|
|
43
|
+
|
|
44
|
+
if (
|
|
45
|
+
isSkillInstalled &&
|
|
46
|
+
isInstalled &&
|
|
47
|
+
featureCode === 'node' &&
|
|
48
|
+
actionCode === 'upgrade'
|
|
49
|
+
) {
|
|
50
|
+
const combinedFile = await this.writePlugin()
|
|
51
|
+
const results = await this.Action('permission', 'sync').execute({})
|
|
52
|
+
|
|
53
|
+
results.files = [...(results.files ?? []), ...combinedFile]
|
|
54
|
+
return results
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return {}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public async afterPackageInstall(): Promise<InstallResults> {
|
|
61
|
+
const files = await this.writePlugin()
|
|
62
|
+
const combinedFile = await this.writeTypesFile()
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
files: [...files, ...combinedFile],
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private async writeTypesFile() {
|
|
70
|
+
return await this.writer.writeTypesFile(
|
|
71
|
+
this.cwd,
|
|
72
|
+
{} as PermissionContractMap
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private async writePlugin() {
|
|
77
|
+
return this.writer.writePlugin(this.cwd)
|
|
78
|
+
}
|
|
22
79
|
}
|
|
23
80
|
|
|
24
81
|
declare module '../../features/features.types' {
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
import { buildSchema } from '@sprucelabs/schema'
|
|
2
2
|
import AbstractAction from '../../AbstractAction'
|
|
3
|
-
import { FeatureActionResponse } from '../../features.types'
|
|
3
|
+
import { ActionOptions, FeatureActionResponse } from '../../features.types'
|
|
4
|
+
import PermissionStore from '../stores/PermissionStore'
|
|
5
|
+
import PermissionWriter from '../writers/PermissionWriter'
|
|
4
6
|
|
|
5
7
|
export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
6
8
|
public invocationMessage = 'Syncing permissions... 🛡'
|
|
7
9
|
public optionsSchema = schema
|
|
10
|
+
public readonly commandAliases: string[] = ['sync.permissions']
|
|
11
|
+
|
|
12
|
+
private permissions: PermissionStore
|
|
13
|
+
private writer: PermissionWriter
|
|
14
|
+
|
|
15
|
+
public constructor(options: ActionOptions) {
|
|
16
|
+
super(options)
|
|
17
|
+
this.permissions = this.Store('permission')
|
|
18
|
+
this.writer = this.Writer('permission')
|
|
19
|
+
}
|
|
8
20
|
|
|
9
21
|
public async execute(): Promise<FeatureActionResponse> {
|
|
10
|
-
const
|
|
22
|
+
const map = await this.permissions.fetchContracts()
|
|
23
|
+
const typesFiles = await this.writer.writeTypesFile(this.cwd, map)
|
|
24
|
+
|
|
25
|
+
const local = await this.permissions.loadLocalPermissions()
|
|
26
|
+
const combinedFiles = await this.writer.writeCombinedFile(this.cwd, {
|
|
27
|
+
contracts: local,
|
|
28
|
+
})
|
|
11
29
|
|
|
12
30
|
return {
|
|
13
|
-
files,
|
|
31
|
+
files: [...typesFiles, ...combinedFiles],
|
|
32
|
+
summaryLines: ['Permissions synced'],
|
|
14
33
|
}
|
|
15
34
|
}
|
|
16
35
|
}
|
|
@@ -9,28 +9,43 @@ import AbstractStore from '../../../stores/AbstractStore'
|
|
|
9
9
|
export default class PermissionStore extends AbstractStore {
|
|
10
10
|
public name = 'permission'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
public async loadLocalPermissions() {
|
|
13
13
|
const matches = await globby('**/*.permissions.ts', {
|
|
14
14
|
cwd: this.cwd,
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const namespace = this.Service('pkg').getSkillNamespace()
|
|
18
|
+
const imported: ImportedPermission[] = []
|
|
18
19
|
|
|
19
20
|
for (const file of matches) {
|
|
21
|
+
const path = diskUtil.resolvePath(this.cwd, file)
|
|
20
22
|
const contract = (await this.Service('import').importDefault(
|
|
21
|
-
|
|
23
|
+
path
|
|
22
24
|
)) as PermissionContract
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
imported.push({
|
|
27
|
+
id: `${namespace}.${contract.id}`,
|
|
28
|
+
permissions: contract.permissions.map((p) => p.id),
|
|
29
|
+
path,
|
|
30
|
+
})
|
|
25
31
|
}
|
|
26
32
|
|
|
27
|
-
return
|
|
33
|
+
return imported
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
public async fetchContracts() {
|
|
31
|
-
const client = await this.connectToApi()
|
|
37
|
+
const client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })
|
|
32
38
|
const deps = this.Service('dependency').get()
|
|
33
39
|
|
|
40
|
+
const local = await this.loadLocalPermissions()
|
|
41
|
+
const map: PermissionContractMap = local.reduce<PermissionContractMap>(
|
|
42
|
+
(map, local) => {
|
|
43
|
+
map[local.id] = local.permissions
|
|
44
|
+
return map
|
|
45
|
+
},
|
|
46
|
+
{} as any
|
|
47
|
+
)
|
|
48
|
+
|
|
34
49
|
const [{ permissionContracts }] = await client.emitAndFlattenResponses(
|
|
35
50
|
'list-permission-contracts::v2020_12_25',
|
|
36
51
|
{
|
|
@@ -40,8 +55,6 @@ export default class PermissionStore extends AbstractStore {
|
|
|
40
55
|
}
|
|
41
56
|
)
|
|
42
57
|
|
|
43
|
-
const map: PermissionContractMap = await this.loadLocalPermissions()
|
|
44
|
-
|
|
45
58
|
for (const result of permissionContracts) {
|
|
46
59
|
map[result.contract.id] = result.contract.permissions.map((p) => p.id)
|
|
47
60
|
}
|
|
@@ -49,3 +62,9 @@ export default class PermissionStore extends AbstractStore {
|
|
|
49
62
|
return map
|
|
50
63
|
}
|
|
51
64
|
}
|
|
65
|
+
|
|
66
|
+
export interface ImportedPermission {
|
|
67
|
+
id: string
|
|
68
|
+
permissions: string[]
|
|
69
|
+
path: string
|
|
70
|
+
}
|
|
@@ -1,23 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PermissionContractMap } from '@sprucelabs/mercury-types'
|
|
2
|
+
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
3
|
import AbstractWriter from '../../../writers/AbstractWriter'
|
|
4
|
+
import { ImportedPermission } from '../stores/PermissionStore'
|
|
3
5
|
|
|
4
6
|
export default class PermissionWriter extends AbstractWriter {
|
|
5
|
-
public async writeTypesFile(
|
|
7
|
+
public async writeTypesFile(cwd: string, map: PermissionContractMap) {
|
|
6
8
|
const destination = diskUtil.resolveHashSprucePath(
|
|
7
|
-
|
|
9
|
+
cwd,
|
|
8
10
|
'permissions',
|
|
9
11
|
'permissions.types.ts'
|
|
10
12
|
)
|
|
11
13
|
|
|
14
|
+
const contents = this.templates.permissionTypes({ contracts: map })
|
|
15
|
+
|
|
12
16
|
const files = await this.writeFileIfChangedMixinResults(
|
|
13
17
|
destination,
|
|
14
|
-
|
|
18
|
+
contents,
|
|
15
19
|
'Types file for any permission contracts you created or depend on.'
|
|
16
20
|
)
|
|
17
21
|
|
|
18
22
|
return files
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
public async writeCombinedFile(
|
|
26
|
+
destinationDir: string,
|
|
27
|
+
options: {
|
|
28
|
+
contracts: ImportedPermission[]
|
|
29
|
+
}
|
|
30
|
+
) {
|
|
31
|
+
const { contracts } = options
|
|
32
|
+
|
|
33
|
+
const destinationPath = diskUtil.resolveHashSprucePath(
|
|
34
|
+
destinationDir,
|
|
35
|
+
'permissions'
|
|
36
|
+
)
|
|
37
|
+
const destinationFile = diskUtil.resolvePath(
|
|
38
|
+
destinationPath,
|
|
39
|
+
'permissions.ts'
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const local = contracts.map((c) => ({
|
|
43
|
+
nameCamel: namesUtil.toCamel(c.id),
|
|
44
|
+
path: diskUtil.resolveRelativePath(
|
|
45
|
+
destinationPath,
|
|
46
|
+
c.path.replace('.ts', '')
|
|
47
|
+
),
|
|
48
|
+
}))
|
|
49
|
+
|
|
50
|
+
const content = this.templates.permissions({ contracts: local })
|
|
51
|
+
|
|
52
|
+
const files = await this.writeFileIfChangedMixinResults(
|
|
53
|
+
destinationFile,
|
|
54
|
+
content,
|
|
55
|
+
'Import of all permission contracts for loading on boot!'
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
return files
|
|
59
|
+
}
|
|
60
|
+
|
|
21
61
|
public async writeContract(
|
|
22
62
|
destinationDir: string,
|
|
23
63
|
options: {
|
|
@@ -51,4 +91,22 @@ export default class PermissionWriter extends AbstractWriter {
|
|
|
51
91
|
|
|
52
92
|
return files
|
|
53
93
|
}
|
|
94
|
+
|
|
95
|
+
public writePlugin(cwd: string) {
|
|
96
|
+
const destination = diskUtil.resolveHashSprucePath(
|
|
97
|
+
cwd,
|
|
98
|
+
'features',
|
|
99
|
+
'permission.plugin.ts'
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
const pluginContents = this.templates.permissionPlugin()
|
|
103
|
+
|
|
104
|
+
const results = this.writeFileIfChangedMixinResults(
|
|
105
|
+
destination,
|
|
106
|
+
pluginContents,
|
|
107
|
+
'Enable permission support in your skill.'
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return results
|
|
111
|
+
}
|
|
54
112
|
}
|
|
@@ -17,7 +17,7 @@ export default class PersonFeature extends AbstractFeature {
|
|
|
17
17
|
public actionsDir = diskUtil.resolvePath(__dirname, 'actions')
|
|
18
18
|
|
|
19
19
|
public isInstalled = () => {
|
|
20
|
-
return this.
|
|
20
|
+
return this.features.isInstalled('skill')
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -27,9 +27,7 @@ export default class SandboxFeature extends AbstractFeature {
|
|
|
27
27
|
super(options)
|
|
28
28
|
|
|
29
29
|
void this.emitter.on('feature.will-execute', async (payload) => {
|
|
30
|
-
const isSkillInstalled = await this.
|
|
31
|
-
'sandbox'
|
|
32
|
-
)
|
|
30
|
+
const isSkillInstalled = await this.features.isInstalled('sandbox')
|
|
33
31
|
if (
|
|
34
32
|
isSkillInstalled &&
|
|
35
33
|
payload.featureCode === 'node' &&
|
|
@@ -7,16 +7,6 @@ import AbstractFeature, {
|
|
|
7
7
|
} from '../AbstractFeature'
|
|
8
8
|
import { FeatureCode } from '../features.types'
|
|
9
9
|
|
|
10
|
-
declare module '../../features/features.types' {
|
|
11
|
-
interface FeatureMap {
|
|
12
|
-
schema: SchemaFeature
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface FeatureOptionsMap {
|
|
16
|
-
schema: undefined
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
10
|
export default class SchemaFeature extends AbstractFeature {
|
|
21
11
|
public nameReadable = 'Schema'
|
|
22
12
|
public description = 'Define, validate, and normalize everything.'
|
|
@@ -59,8 +49,8 @@ export default class SchemaFeature extends AbstractFeature {
|
|
|
59
49
|
actionCode: string
|
|
60
50
|
featureCode: string
|
|
61
51
|
}) {
|
|
62
|
-
const isInstalled = await this.
|
|
63
|
-
const isSkillInstalled = await this.
|
|
52
|
+
const isInstalled = await this.features.isInstalled('schema')
|
|
53
|
+
const isSkillInstalled = await this.features.isInstalled('skill')
|
|
64
54
|
|
|
65
55
|
if (
|
|
66
56
|
payload.featureCode === 'node' &&
|
|
@@ -79,7 +69,7 @@ export default class SchemaFeature extends AbstractFeature {
|
|
|
79
69
|
actionCode: string
|
|
80
70
|
featureCode: string
|
|
81
71
|
}) {
|
|
82
|
-
const isInstalled = await this.
|
|
72
|
+
const isInstalled = await this.features.isInstalled('schema')
|
|
83
73
|
|
|
84
74
|
if (
|
|
85
75
|
payload.featureCode === 'node' &&
|
|
@@ -98,7 +88,7 @@ export default class SchemaFeature extends AbstractFeature {
|
|
|
98
88
|
}
|
|
99
89
|
|
|
100
90
|
public async afterPackageInstall(): Promise<InstallResults> {
|
|
101
|
-
const isSkillInstalled = await this.
|
|
91
|
+
const isSkillInstalled = await this.features.isInstalled('skill')
|
|
102
92
|
|
|
103
93
|
if (!isSkillInstalled) {
|
|
104
94
|
return {}
|
|
@@ -115,3 +105,13 @@ export default class SchemaFeature extends AbstractFeature {
|
|
|
115
105
|
return this.Writer('schema').writePlugin(this.cwd)
|
|
116
106
|
}
|
|
117
107
|
}
|
|
108
|
+
|
|
109
|
+
declare module '../../features/features.types' {
|
|
110
|
+
interface FeatureMap {
|
|
111
|
+
schema: SchemaFeature
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface FeatureOptionsMap {
|
|
115
|
+
schema: undefined
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -15,21 +15,6 @@ import SpruceError from '../../../errors/SpruceError'
|
|
|
15
15
|
import AbstractWriter, { WriteResults } from '../../../writers/AbstractWriter'
|
|
16
16
|
import schemaDiskUtil from '../utilities/schemaDisk.utility'
|
|
17
17
|
|
|
18
|
-
interface WriteFieldTypesOptions {
|
|
19
|
-
fieldTemplateItems: FieldTemplateItem[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line no-redeclare
|
|
23
|
-
export interface GenerateSchemaTypesOptions {
|
|
24
|
-
fieldTemplateItems: FieldTemplateItem[]
|
|
25
|
-
schemaTemplateItems: SchemaTemplateItem[]
|
|
26
|
-
valueTypes: ValueTypes
|
|
27
|
-
globalSchemaNamespace?: string
|
|
28
|
-
typesTemplate?: string
|
|
29
|
-
registerBuiltSchemas?: boolean
|
|
30
|
-
shouldImportCoreSchemas: boolean
|
|
31
|
-
}
|
|
32
|
-
|
|
33
18
|
export default class SchemaWriter extends AbstractWriter {
|
|
34
19
|
private readonly fieldTemplates: {
|
|
35
20
|
filename: string
|
|
@@ -289,3 +274,17 @@ export default class SchemaWriter extends AbstractWriter {
|
|
|
289
274
|
return results
|
|
290
275
|
}
|
|
291
276
|
}
|
|
277
|
+
|
|
278
|
+
interface WriteFieldTypesOptions {
|
|
279
|
+
fieldTemplateItems: FieldTemplateItem[]
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface GenerateSchemaTypesOptions {
|
|
283
|
+
fieldTemplateItems: FieldTemplateItem[]
|
|
284
|
+
schemaTemplateItems: SchemaTemplateItem[]
|
|
285
|
+
valueTypes: ValueTypes
|
|
286
|
+
globalSchemaNamespace?: string
|
|
287
|
+
typesTemplate?: string
|
|
288
|
+
registerBuiltSchemas?: boolean
|
|
289
|
+
shouldImportCoreSchemas: boolean
|
|
290
|
+
}
|