@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { versionUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
3
|
import dotenv from 'dotenv'
|
|
4
|
-
import AbstractSkillTest from '
|
|
5
|
-
import { DEMO_NUMBER_GLOBAL_EVENTS } from '
|
|
6
|
-
import testUtil from '
|
|
7
|
-
import { RegisteredSkill } from '
|
|
4
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
|
+
import { DEMO_NUMBER_GLOBAL_EVENTS } from '../../../tests/constants'
|
|
6
|
+
import testUtil from '../../../tests/utilities/test.utility'
|
|
7
|
+
import { RegisteredSkill } from '../../../types/cli.types'
|
|
8
8
|
dotenv.config()
|
|
9
9
|
|
|
10
10
|
const stamp = new Date().getTime()
|
|
@@ -21,8 +21,6 @@ export default class RegisteringGlobalEventsTest extends AbstractSkillTest {
|
|
|
21
21
|
|
|
22
22
|
await this.people.loginAsDemoPerson(DEMO_NUMBER_GLOBAL_EVENTS)
|
|
23
23
|
|
|
24
|
-
await this.resetAccount()
|
|
25
|
-
|
|
26
24
|
const orgFixture = this.getOrganizationFixture()
|
|
27
25
|
const skillFixture = this.getSkillFixture()
|
|
28
26
|
|
|
@@ -37,12 +35,6 @@ export default class RegisteringGlobalEventsTest extends AbstractSkillTest {
|
|
|
37
35
|
|
|
38
36
|
protected static async afterAll() {
|
|
39
37
|
await super.afterAll()
|
|
40
|
-
await this.resetAccount()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private static async resetAccount() {
|
|
44
|
-
// await this.getOrganizationFixture().clearAllOrgs()
|
|
45
|
-
// await this.getSkillFixture().clearAllSkills()
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
@test()
|
|
@@ -30,6 +30,7 @@ export default class SkillEmitsBootEventsTest extends AbstractEventTest {
|
|
|
30
30
|
@test()
|
|
31
31
|
protected static async skillEmitsDidBootEventsThatErrorAfterBoot() {
|
|
32
32
|
await this.installEventFeature('events')
|
|
33
|
+
this.disablePermissionSyncing()
|
|
33
34
|
const version = 'v2020_01_01'
|
|
34
35
|
|
|
35
36
|
await this.Action('event', 'listen').execute({
|
|
@@ -44,4 +45,9 @@ export default class SkillEmitsBootEventsTest extends AbstractEventTest {
|
|
|
44
45
|
const err = await assert.doesThrowAsync(() => response.meta?.promise)
|
|
45
46
|
errorAssert.assertError(err, 'LISTENER_NOT_IMPLEMENTED')
|
|
46
47
|
}
|
|
48
|
+
|
|
49
|
+
private static disablePermissionSyncing() {
|
|
50
|
+
const env = this.Service('env')
|
|
51
|
+
env.set('SHOULD_REGISTER_PERMISSIONS', 'false')
|
|
52
|
+
}
|
|
47
53
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
3
|
import fsUtil from 'fs-extra'
|
|
4
|
-
import AbstractSkillTest from '
|
|
5
|
-
import { RegisteredSkill } from '
|
|
4
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
|
+
import { RegisteredSkill } from '../../../types/cli.types'
|
|
6
6
|
|
|
7
7
|
export default class SyncingEventsOnlyFromDependenciesTest extends AbstractSkillTest {
|
|
8
8
|
protected static skillCacheKey = 'events'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
3
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
4
|
-
import AbstractPermissionsTest from './AbstractPermissionsTest'
|
|
4
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
5
5
|
|
|
6
6
|
export default class CreatingPermissionsTest extends AbstractPermissionsTest {
|
|
7
7
|
@test('can create permission contract named booking', 'booking')
|
|
@@ -16,7 +16,7 @@ export default class CreatingPermissionsTest extends AbstractPermissionsTest {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@test()
|
|
19
|
-
protected static async
|
|
19
|
+
protected static async generatesExpectedPermissionContract() {
|
|
20
20
|
const { contractPath } = await this.executeAndGetContract()
|
|
21
21
|
const contents = diskUtil.readFile(contractPath)
|
|
22
22
|
assert.doesInclude(
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import { assert, test } from '@sprucelabs/test-utils'
|
|
3
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
4
|
+
|
|
5
|
+
export default class PermissionPluginTest extends AbstractPermissionsTest {
|
|
6
|
+
@test()
|
|
7
|
+
protected static async createsPluginWithExpectedContent() {
|
|
8
|
+
const expected = this.getPluginPath()
|
|
9
|
+
await this.assertFilePassesTypeChecks(expected)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@test()
|
|
13
|
+
protected static async pluginIsExpectedContent() {
|
|
14
|
+
const content = diskUtil.readFile(this.getPluginPath())
|
|
15
|
+
assert.isEqual(
|
|
16
|
+
content.trim(),
|
|
17
|
+
`export { plugin as default } from '@sprucelabs/spruce-permission-plugin'`
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private static getPluginPath() {
|
|
22
|
+
return this.resolveHashSprucePath('features', 'permission.plugin.ts')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,54 +1,84 @@
|
|
|
1
1
|
import { MercuryClientFactory } from '@sprucelabs/mercury-client'
|
|
2
|
-
import {
|
|
2
|
+
import { SpruceSchemas } from '@sprucelabs/mercury-types'
|
|
3
3
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
4
4
|
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
5
|
-
import PermissionStore
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '
|
|
9
|
-
import
|
|
5
|
+
import PermissionStore, {
|
|
6
|
+
ImportedPermission,
|
|
7
|
+
} from '../../../features/permission/stores/PermissionStore'
|
|
8
|
+
import { ApiClientFactoryOptions } from '../../../types/apiClient.types'
|
|
9
|
+
import { ListPermContractsTargetAndPayload } from '../../support/EventFaker'
|
|
10
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
11
|
+
import generateShortAlphaId from './support/generateShortAlphaId'
|
|
12
|
+
import { sortPermissionContracts } from './support/sortPermissionContracts'
|
|
10
13
|
|
|
11
14
|
export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
12
|
-
protected static skillCacheKey = 'permissions'
|
|
13
15
|
private static permissions: PermissionStore
|
|
14
16
|
private static contractName1: string
|
|
15
17
|
private static contractName2: string
|
|
16
|
-
private static
|
|
18
|
+
private static fqid1: string
|
|
19
|
+
private static fqid2: string
|
|
20
|
+
private static namespace: string
|
|
17
21
|
|
|
18
22
|
protected static async beforeAll() {
|
|
19
23
|
await super.beforeAll()
|
|
24
|
+
const namespace = await this.Service('pkg').getSkillNamespace()
|
|
25
|
+
this.namespace = namespace
|
|
26
|
+
|
|
20
27
|
this.contractName1 = generateShortAlphaId()
|
|
28
|
+
this.fqid1 = `${namespace}.${this.contractName1}`
|
|
29
|
+
|
|
21
30
|
this.contractName2 = generateShortAlphaId()
|
|
31
|
+
const contractId = this.contractName2
|
|
32
|
+
this.fqid2 = buildPermissionContractId(contractId, namespace)
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
protected static async beforeEach() {
|
|
25
36
|
await super.beforeEach()
|
|
26
37
|
MercuryClientFactory.setIsTestMode(true)
|
|
27
38
|
this.permissions = this.Store('permission')
|
|
28
|
-
this.eventFaker
|
|
39
|
+
await this.eventFaker.fakeListPermissionContracts(() => {})
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
@test()
|
|
32
43
|
protected static async loadsNoLocalByDefault() {
|
|
33
44
|
const permissions = await this.loadLocalPermissions()
|
|
34
|
-
assert.isEqualDeep(permissions,
|
|
45
|
+
assert.isEqualDeep(permissions, [])
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
@test()
|
|
38
49
|
protected static async loadsOneContract() {
|
|
39
50
|
await this.createPermissionContract(this.contractName1)
|
|
40
|
-
await this.assertLocalPermissionsEqual(
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
await this.assertLocalPermissionsEqual([
|
|
52
|
+
{
|
|
53
|
+
id: this.fqid1,
|
|
54
|
+
permissions: ['can-high-five'],
|
|
55
|
+
path: this.resolvePath(
|
|
56
|
+
`src/permissions/${this.contractName1}.permissions.ts`
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
])
|
|
43
60
|
}
|
|
44
61
|
|
|
45
62
|
@test()
|
|
46
63
|
protected static async loadsSecondContract() {
|
|
47
64
|
await this.createPermissionContract(this.contractName2)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
|
|
66
|
+
await this.assertLocalPermissionsEqual([
|
|
67
|
+
{
|
|
68
|
+
id: this.fqid2,
|
|
69
|
+
permissions: ['can-high-five'],
|
|
70
|
+
path: this.resolvePath(
|
|
71
|
+
`src/permissions/${this.contractName2}.permissions.ts`
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: this.fqid1,
|
|
76
|
+
permissions: ['can-high-five'],
|
|
77
|
+
path: this.resolvePath(
|
|
78
|
+
`src/permissions/${this.contractName1}.permissions.ts`
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
])
|
|
52
82
|
}
|
|
53
83
|
|
|
54
84
|
@test()
|
|
@@ -59,22 +89,22 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
59
89
|
|
|
60
90
|
this.updateFirstContractBuilder(contractId, perm1Id, perm2Id)
|
|
61
91
|
|
|
62
|
-
await this.assertLocalPermissionsEqual(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
await this.assertLocalPermissionsEqual([
|
|
93
|
+
{
|
|
94
|
+
id: this.fqid2,
|
|
95
|
+
permissions: ['can-high-five'],
|
|
96
|
+
path: this.resolvePath(
|
|
97
|
+
`src/permissions/${this.contractName2}.permissions.ts`
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: buildPermissionContractId(contractId, this.namespace),
|
|
102
|
+
permissions: [perm1Id, perm2Id],
|
|
103
|
+
path: this.resolvePath(
|
|
104
|
+
`src/permissions/${this.contractName1}.permissions.ts`
|
|
105
|
+
),
|
|
106
|
+
},
|
|
107
|
+
])
|
|
78
108
|
}
|
|
79
109
|
|
|
80
110
|
@test()
|
|
@@ -113,14 +143,34 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
113
143
|
})
|
|
114
144
|
|
|
115
145
|
const map = await this.fetchContracts()
|
|
146
|
+
//@ts-ignore
|
|
116
147
|
assert.isEqualDeep(map, {
|
|
117
148
|
[contractId]: [perm.id, perm2.id],
|
|
118
149
|
[contractId2]: [perm3.id],
|
|
119
|
-
[this.
|
|
120
|
-
'oeu-aoeuao': [
|
|
150
|
+
[this.fqid2]: ['can-high-five'],
|
|
151
|
+
[buildPermissionContractId('oeu-aoeuao', this.namespace)]: [
|
|
152
|
+
'what-the',
|
|
153
|
+
'go-dogs',
|
|
154
|
+
],
|
|
121
155
|
})
|
|
122
156
|
}
|
|
123
157
|
|
|
158
|
+
@test()
|
|
159
|
+
protected static async connectsAsSkill() {
|
|
160
|
+
let passedOptions: ApiClientFactoryOptions | undefined
|
|
161
|
+
|
|
162
|
+
//@ts-ignore
|
|
163
|
+
const old = this.permissions.connectToApi.bind(this.permissions)
|
|
164
|
+
//@ts-ignore
|
|
165
|
+
this.permissions.connectToApi = (options) => {
|
|
166
|
+
passedOptions = options
|
|
167
|
+
return old(passedOptions)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
await this.fetchContracts()
|
|
171
|
+
assert.isEqualDeep(passedOptions, { shouldAuthAsCurrentSkill: true })
|
|
172
|
+
}
|
|
173
|
+
|
|
124
174
|
private static updateFirstContractBuilder(
|
|
125
175
|
contractId: string,
|
|
126
176
|
perm1Id: string,
|
|
@@ -177,9 +227,13 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
177
227
|
}
|
|
178
228
|
|
|
179
229
|
private static async assertLocalPermissionsEqual(
|
|
180
|
-
expected:
|
|
230
|
+
expected: ImportedPermission[]
|
|
181
231
|
) {
|
|
182
232
|
const perms = await this.loadLocalPermissions()
|
|
233
|
+
|
|
234
|
+
perms.sort(sortPermissionContracts)
|
|
235
|
+
expected.sort(sortPermissionContracts)
|
|
236
|
+
|
|
183
237
|
assert.isEqualDeep(perms, expected)
|
|
184
238
|
}
|
|
185
239
|
|
|
@@ -188,8 +242,12 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
188
242
|
return await this.permissions.loadLocalPermissions()
|
|
189
243
|
}
|
|
190
244
|
}
|
|
191
|
-
|
|
192
|
-
|
|
245
|
+
|
|
246
|
+
function buildPermissionContractId(
|
|
247
|
+
contractId: string,
|
|
248
|
+
namespace?: string
|
|
249
|
+
): string {
|
|
250
|
+
return `${namespace}.${contractId}`
|
|
193
251
|
}
|
|
194
252
|
|
|
195
253
|
function generateContractBuilder(
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PermissionContractMap } from '@sprucelabs/mercury-types'
|
|
2
|
+
import { test, generateId } from '@sprucelabs/test-utils'
|
|
3
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
4
|
+
|
|
5
|
+
export default class PermissionWriterTest extends AbstractPermissionsTest {
|
|
6
|
+
@test()
|
|
7
|
+
protected static async writesProperContractId() {
|
|
8
|
+
const contractId = generateId()
|
|
9
|
+
const perm1 = generateId()
|
|
10
|
+
const perm2 = generateId()
|
|
11
|
+
|
|
12
|
+
//@ts-ignore
|
|
13
|
+
await this.writeTypesFile({
|
|
14
|
+
[contractId]: [perm1, perm2],
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
await this.writeTestFileAndAssertValid(contractId, perm1, perm2)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private static async writeTypesFile(map: PermissionContractMap) {
|
|
21
|
+
const writer = this.writers.Writer('permission', { fileDescriptions: [] })
|
|
22
|
+
await writer.writeTypesFile(this.cwd, map)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,25 +1,142 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MercuryClientFactory } from '@sprucelabs/mercury-client'
|
|
2
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
|
+
import { assert, test } from '@sprucelabs/test-utils'
|
|
4
|
+
import ActionFactory from '../../../features/ActionFactory'
|
|
2
5
|
import SyncAction from '../../../features/permission/actions/SyncAction'
|
|
3
|
-
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
4
6
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
7
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
8
|
+
import generateShortAlphaId from './support/generateShortAlphaId'
|
|
9
|
+
import { sortPermissionContracts } from './support/sortPermissionContracts'
|
|
5
10
|
|
|
6
|
-
export default class SyncingPermissionsTest extends
|
|
7
|
-
|
|
8
|
-
private static
|
|
11
|
+
export default class SyncingPermissionsTest extends AbstractPermissionsTest {
|
|
12
|
+
private static syncAction: SyncAction
|
|
13
|
+
private static contractId1: string
|
|
14
|
+
private static contractId2: string
|
|
15
|
+
|
|
16
|
+
protected static async beforeAll() {
|
|
17
|
+
await super.beforeAll()
|
|
18
|
+
this.contractId1 = generateShortAlphaId()
|
|
19
|
+
this.contractId2 = generateShortAlphaId()
|
|
20
|
+
}
|
|
9
21
|
|
|
10
22
|
protected static async beforeEach() {
|
|
11
23
|
await super.beforeEach()
|
|
12
|
-
this.
|
|
24
|
+
this.syncAction = this.Action('permission', 'sync')
|
|
25
|
+
MercuryClientFactory.setIsTestMode(true)
|
|
26
|
+
ExecuteTrackingAction.wasExecuteInvoked = false
|
|
27
|
+
await this.eventFaker.fakeListPermissionContracts()
|
|
13
28
|
}
|
|
14
29
|
|
|
15
30
|
@test()
|
|
16
31
|
protected static async generatesExpectedTypesFile() {
|
|
17
|
-
const results = await this.sync
|
|
32
|
+
const results = await this.sync()
|
|
33
|
+
|
|
18
34
|
const expected = this.resolveHashSprucePath(
|
|
19
35
|
`permissions/permissions.types.ts`
|
|
20
36
|
)
|
|
21
37
|
|
|
22
38
|
testUtil.assertFileByPathInGeneratedFiles(expected, results.files)
|
|
23
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@test()
|
|
42
|
+
protected static async syncsNewPermissionsWhenMade() {
|
|
43
|
+
await this.createPermissionContract(this.contractId1)
|
|
44
|
+
await this.writeTestFileAndAssertValid(
|
|
45
|
+
`testing-permissions.${this.contractId1}`
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@test()
|
|
50
|
+
protected static async upgradingSyncsPermissions() {
|
|
51
|
+
this.beginTrackingExecute()
|
|
52
|
+
await this.emitDidExecuteUpgrade()
|
|
53
|
+
assert.isTrue(ExecuteTrackingAction.wasExecuteInvoked)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@test()
|
|
57
|
+
protected static async doesNotSyncIfNotInstalled() {
|
|
58
|
+
this.beginTrackingExecute()
|
|
59
|
+
this.featureInstaller.isInstalled = async (code) => code === 'node'
|
|
60
|
+
|
|
61
|
+
await this.emitDidExecuteUpgrade()
|
|
62
|
+
assert.isFalse(ExecuteTrackingAction.wasExecuteInvoked)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@test()
|
|
66
|
+
protected static async generatesCombinedFile() {
|
|
67
|
+
assert.isTrue(diskUtil.doesFileExist(this.getCombinedPath()))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@test()
|
|
71
|
+
protected static async combinedFileImportsAllPermissions() {
|
|
72
|
+
await this.createPermissionContract(this.contractId2)
|
|
73
|
+
|
|
74
|
+
const imported = await this.Service('import').importDefault(
|
|
75
|
+
this.getCombinedPath()
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
assert.isEqualDeep(
|
|
79
|
+
imported.sort(sortPermissionContracts),
|
|
80
|
+
[
|
|
81
|
+
{
|
|
82
|
+
id: this.contractId1,
|
|
83
|
+
name: this.contractId1,
|
|
84
|
+
description: '',
|
|
85
|
+
requireAllPermissions: false,
|
|
86
|
+
permissions: [
|
|
87
|
+
{
|
|
88
|
+
id: 'can-high-five',
|
|
89
|
+
name: 'Can give high five',
|
|
90
|
+
description: 'Will this person be allowed to high five?',
|
|
91
|
+
defaults: { skill: false },
|
|
92
|
+
requireAllStatuses: false,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: this.contractId2,
|
|
98
|
+
name: this.contractId2,
|
|
99
|
+
description: '',
|
|
100
|
+
requireAllPermissions: false,
|
|
101
|
+
permissions: [
|
|
102
|
+
{
|
|
103
|
+
id: 'can-high-five',
|
|
104
|
+
name: 'Can give high five',
|
|
105
|
+
description: 'Will this person be allowed to high five?',
|
|
106
|
+
defaults: { skill: false },
|
|
107
|
+
requireAllStatuses: false,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
].sort(sortPermissionContracts)
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private static getCombinedPath() {
|
|
116
|
+
return this.resolveHashSprucePath('permissions', 'permissions.ts')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private static beginTrackingExecute() {
|
|
120
|
+
ActionFactory.setActionClass('permission', 'sync', ExecuteTrackingAction)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private static async sync() {
|
|
124
|
+
return await this.syncAction.execute()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private static async emitDidExecuteUpgrade() {
|
|
128
|
+
await this.emitter.emitAndFlattenResponses('feature.did-execute', {
|
|
129
|
+
actionCode: 'upgrade',
|
|
130
|
+
featureCode: 'node',
|
|
131
|
+
results: {},
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class ExecuteTrackingAction extends SyncAction {
|
|
137
|
+
public static wasExecuteInvoked = false
|
|
138
|
+
public async execute() {
|
|
139
|
+
ExecuteTrackingAction.wasExecuteInvoked = true
|
|
140
|
+
return {}
|
|
24
141
|
}
|
|
25
142
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import CreateAction from '../../../../features/permission/actions/CreateAction'
|
|
3
|
+
import AbstractSkillTest from '../../../../tests/AbstractSkillTest'
|
|
4
|
+
import EventFaker from '../../../support/EventFaker'
|
|
5
|
+
import renderPermissionTestFile from './renderPermissionTestFile'
|
|
6
|
+
|
|
7
|
+
export default abstract class AbstractPermissionsTest extends AbstractSkillTest {
|
|
8
|
+
protected static skillCacheKey = 'permissions'
|
|
9
|
+
protected static createAction: CreateAction
|
|
10
|
+
protected static eventFaker: EventFaker
|
|
11
|
+
|
|
12
|
+
protected static async beforeEach() {
|
|
13
|
+
await super.beforeEach()
|
|
14
|
+
this.createAction = this.Action('permission', 'create')
|
|
15
|
+
this.eventFaker = new EventFaker()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
protected static async createPermissionContract(nameReadable: string) {
|
|
19
|
+
return await this.createAction.execute({
|
|
20
|
+
nameReadable,
|
|
21
|
+
nameCamel: namesUtil.toCamel(nameReadable),
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected static async writeTestFileAndAssertValid(
|
|
26
|
+
contractId: string,
|
|
27
|
+
perm1?: string,
|
|
28
|
+
perm2?: string
|
|
29
|
+
) {
|
|
30
|
+
const contents = renderPermissionTestFile(contractId, perm1, perm2)
|
|
31
|
+
const destination = this.resolvePath('src', 'test.ts')
|
|
32
|
+
diskUtil.writeFile(destination, contents)
|
|
33
|
+
|
|
34
|
+
await this.assertFilePassesTypeChecks(destination)
|
|
35
|
+
|
|
36
|
+
return destination
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default function renderPermissionTestFile(
|
|
2
|
+
contractId: string,
|
|
3
|
+
perm1?: string,
|
|
4
|
+
perm2?: string
|
|
5
|
+
) {
|
|
6
|
+
const parts = [
|
|
7
|
+
`import '${'#' + 'spruce/permissions/permissions.types'}'
|
|
8
|
+
import { PermissionContractId${
|
|
9
|
+
perm1 ? ', PermissionId' : ''
|
|
10
|
+
} } from '@sprucelabs/mercury-types'
|
|
11
|
+
|
|
12
|
+
const contractId: PermissionContractId = '${contractId}'
|
|
13
|
+
console.log(contractId)`,
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
if (perm1) {
|
|
17
|
+
parts.push(`const perm1: PermissionId<'${contractId}'> = '${perm1}'
|
|
18
|
+
console.log(perm1)`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (perm2) {
|
|
22
|
+
parts.push(`const perm2: PermissionId<'${contractId}'> = '${perm2}'
|
|
23
|
+
console.log(perm2)`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return parts.join('\n')
|
|
27
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
|
-
import AbstractSchemaTest from '
|
|
4
|
-
import testUtil from '
|
|
3
|
+
import AbstractSchemaTest from '../../../tests/AbstractSchemaTest'
|
|
4
|
+
import testUtil from '../../../tests/utilities/test.utility'
|
|
5
5
|
|
|
6
6
|
export default class CreatingSchemasWithGenericsTest extends AbstractSchemaTest {
|
|
7
7
|
@test()
|
|
@@ -17,18 +17,6 @@ export default class GettingSchemasFromHealthCheckTest extends AbstractSchemaTes
|
|
|
17
17
|
await this.assertExpectedSchemas(cli, cleanedExpected)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
private static async assertExpectedSchemas(
|
|
21
|
-
cli: CliInterface,
|
|
22
|
-
expected: Schema[]
|
|
23
|
-
) {
|
|
24
|
-
const health = await cli.checkHealth()
|
|
25
|
-
assert.isFalsy(health.skill.errors)
|
|
26
|
-
assert.isTruthy(health.schema)
|
|
27
|
-
assert.isEqual(health.schema.status, 'passed')
|
|
28
|
-
|
|
29
|
-
assert.isEqualDeep(this.sortSchemas(health.schema.schemas), expected)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
20
|
@test()
|
|
33
21
|
protected static async getsCoreAndLocalSchemasFromHealthCheck() {
|
|
34
22
|
const cli = await this.installAndSyncSchemas()
|
|
@@ -60,4 +48,16 @@ export default class GettingSchemasFromHealthCheckTest extends AbstractSchemaTes
|
|
|
60
48
|
await this.Action('schema', 'sync').execute({})
|
|
61
49
|
return cli
|
|
62
50
|
}
|
|
51
|
+
|
|
52
|
+
private static async assertExpectedSchemas(
|
|
53
|
+
cli: CliInterface,
|
|
54
|
+
expected: Schema[]
|
|
55
|
+
) {
|
|
56
|
+
const health = await cli.checkHealth()
|
|
57
|
+
assert.isFalsy(health.skill.errors)
|
|
58
|
+
assert.isTruthy(health.schema)
|
|
59
|
+
assert.isEqual(health.schema.status, 'passed')
|
|
60
|
+
|
|
61
|
+
assert.isEqualDeep(this.sortSchemas(health.schema.schemas), expected)
|
|
62
|
+
}
|
|
63
63
|
}
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from '@sprucelabs/spruce-skill-utils'
|
|
7
7
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
8
8
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
9
|
-
import { FeatureActionResponse } from '
|
|
10
|
-
import SchemaTemplateItemBuilder from '
|
|
11
|
-
import AbstractSkillTest from '
|
|
12
|
-
import testUtil from '
|
|
9
|
+
import { FeatureActionResponse } from '../../../features/features.types'
|
|
10
|
+
import SchemaTemplateItemBuilder from '../../../templateItemBuilders/SchemaTemplateItemBuilder'
|
|
11
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
12
|
+
import testUtil from '../../../tests/utilities/test.utility'
|
|
13
13
|
|
|
14
14
|
const LOCAL_NAMESPACE = 'TestingSchemas'
|
|
15
15
|
const REMOTE_NAMESPACE = 'RemoteSchemas'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { eventAssertUtil } from '@sprucelabs/spruce-event-utils'
|
|
2
2
|
import { test, assert, assertUtil } from '@sprucelabs/test-utils'
|
|
3
3
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
4
|
-
import AbstractCliTest from '
|
|
5
|
-
import { DEMO_NUMBER_INSTALL_SKILL } from '
|
|
4
|
+
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
5
|
+
import { DEMO_NUMBER_INSTALL_SKILL } from '../../../tests/constants'
|
|
6
6
|
|
|
7
7
|
export default class InstallingASkillAtAnOrgTest extends AbstractCliTest {
|
|
8
8
|
protected static async beforeEach() {
|
package/src/__tests__/behavioral/{LoggingInAsASkill.test.ts → skill/LoggingInAsASkill.test.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
3
|
-
import AbstractSkillTest from '
|
|
4
|
-
import { DEMO_NUMBER_LOGIN_AS_SKILL } from '
|
|
5
|
-
import { RegisteredSkill } from '
|
|
3
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
4
|
+
import { DEMO_NUMBER_LOGIN_AS_SKILL } from '../../../tests/constants'
|
|
5
|
+
import { RegisteredSkill } from '../../../types/cli.types'
|
|
6
6
|
|
|
7
7
|
export default class LoggingInAsASkillTest extends AbstractSkillTest {
|
|
8
8
|
protected static skillCacheKey = 'skills'
|
package/src/__tests__/behavioral/{RebuildingASkill.test.ts → skill/RebuildingASkill.test.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
3
|
-
import CommandService from '
|
|
4
|
-
import AbstractSkillTest from '
|
|
3
|
+
import CommandService from '../../../services/CommandService'
|
|
4
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
5
|
|
|
6
6
|
export default class RebuildingASkillTest extends AbstractSkillTest {
|
|
7
7
|
protected static skillCacheKey = 'skills'
|