@sprucelabs/spruce-cli 18.1.8 → 18.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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/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/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 +12 -2
- package/build/__tests__/behavioral/permissions/PermissionStore.test.js +248 -36
- 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/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/tests/CreatingATest.test.js +2 -2
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- 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__/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/__tests__/support/EventFaker.d.ts +5 -0
- package/build/__tests__/support/EventFaker.js +48 -0
- package/build/__tests__/support/EventFaker.js.map +1 -0
- 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 +140 -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 +7 -1
- package/build/features/permission/stores/PermissionStore.js +92 -23
- 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 +66 -17
- 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 +6 -6
- package/node_modules/@typescript-eslint/scope-manager/dist/ScopeManager.js +9 -9
- package/node_modules/@typescript-eslint/scope-manager/dist/ScopeManager.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/definition/Definition.d.ts +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/definition/Definition.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.iterable.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.iterable.js +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.iterable.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.js +21 -7
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/dom.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.intl.d.ts +3 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.intl.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.intl.js +12 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.intl.js.map +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.js +2 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/es2019.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.d.ts +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.js +2 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/index.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.iterable.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.iterable.js +2 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.iterable.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.js +39 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/lib/webworker.js.map +1 -1
- 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/ExportVisitor.d.ts +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ExportVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.d.ts +2 -2
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.js +9 -9
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/PatternVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Reference.js +17 -17
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Reference.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/dist/scope/Scope.d.ts +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/Scope.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/ScopeBase.d.ts +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/ScopeBase.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/package.json +12 -12
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +27 -3
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/lib.d.ts +1 -1
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/parser-options.d.ts +3 -3
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +27 -3
- 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 +3 -0
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/lib.d.ts +1 -1
- package/node_modules/@typescript-eslint/types/dist/lib.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/parser-options.d.ts +3 -3
- package/node_modules/@typescript-eslint/types/dist/parser-options.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +3 -3
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/index.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/simple-traverse.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +4 -1
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +4 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +22 -3
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/simple-traverse.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/simple-traverse.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +4 -1
- 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 +4 -2
- 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 +6 -6
- 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 -48
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/package.json +4 -4
- 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/SkillEmitsBootEvents.test.ts +6 -0
- 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 +204 -23
- package/src/__tests__/behavioral/permissions/PermissionWriter.test.ts +23 -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/schemas/GettingSchemasFromHealthCheck.test.ts +12 -12
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -2
- 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__/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/__tests__/support/EventFaker.ts +23 -0
- 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 +66 -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 +44 -3
- package/src/features/permission/writers/PermissionWriter.ts +64 -3
- 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/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,91 +1,271 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MercuryClientFactory } from '@sprucelabs/mercury-client'
|
|
2
|
+
import { SpruceSchemas } from '@sprucelabs/mercury-types'
|
|
2
3
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
4
|
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
4
|
-
import PermissionStore
|
|
5
|
-
|
|
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'
|
|
6
13
|
|
|
7
14
|
export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
8
|
-
protected static skillCacheKey = 'permissions'
|
|
9
15
|
private static permissions: PermissionStore
|
|
10
16
|
private static contractName1: string
|
|
11
17
|
private static contractName2: string
|
|
18
|
+
private static fqid1: string
|
|
19
|
+
private static fqid2: string
|
|
20
|
+
private static namespace: string
|
|
12
21
|
|
|
13
22
|
protected static async beforeAll() {
|
|
14
23
|
await super.beforeAll()
|
|
24
|
+
const namespace = await this.Service('pkg').getSkillNamespace()
|
|
25
|
+
this.namespace = namespace
|
|
26
|
+
|
|
15
27
|
this.contractName1 = generateShortAlphaId()
|
|
28
|
+
this.fqid1 = `${namespace}.${this.contractName1}`
|
|
29
|
+
|
|
16
30
|
this.contractName2 = generateShortAlphaId()
|
|
31
|
+
const contractId = this.contractName2
|
|
32
|
+
this.fqid2 = buildPermissionContractId(contractId, namespace)
|
|
17
33
|
}
|
|
18
34
|
|
|
19
35
|
protected static async beforeEach() {
|
|
20
36
|
await super.beforeEach()
|
|
37
|
+
MercuryClientFactory.setIsTestMode(true)
|
|
21
38
|
this.permissions = this.Store('permission')
|
|
39
|
+
await this.eventFaker.fakeListPermissionContracts(() => {})
|
|
22
40
|
}
|
|
23
41
|
|
|
24
42
|
@test()
|
|
25
43
|
protected static async loadsNoLocalByDefault() {
|
|
26
44
|
const permissions = await this.loadLocalPermissions()
|
|
27
|
-
assert.isEqualDeep(permissions,
|
|
45
|
+
assert.isEqualDeep(permissions, [])
|
|
28
46
|
}
|
|
29
47
|
|
|
30
48
|
@test()
|
|
31
49
|
protected static async loadsOneContract() {
|
|
32
50
|
await this.createPermissionContract(this.contractName1)
|
|
33
|
-
await this.assertLocalPermissionsEqual(
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
])
|
|
36
60
|
}
|
|
37
61
|
|
|
38
62
|
@test()
|
|
39
63
|
protected static async loadsSecondContract() {
|
|
40
64
|
await this.createPermissionContract(this.contractName2)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
+
])
|
|
45
82
|
}
|
|
46
83
|
|
|
47
84
|
@test()
|
|
48
85
|
protected static async mixesInAllPermissions() {
|
|
86
|
+
const contractId = 'oeu-aoeuao'
|
|
87
|
+
const perm1Id = 'what-the'
|
|
88
|
+
const perm2Id = 'go-dogs'
|
|
89
|
+
|
|
90
|
+
this.updateFirstContractBuilder(contractId, perm1Id, perm2Id)
|
|
91
|
+
|
|
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
|
+
])
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@test()
|
|
111
|
+
protected static async passesThroughDependentSkills() {
|
|
112
|
+
const namespace = this.addRandomDependency()
|
|
113
|
+
|
|
114
|
+
let passedTarget: ListPermContractsTargetAndPayload['target']
|
|
115
|
+
|
|
116
|
+
await this.eventFaker.fakeListPermissionContracts(({ target }) => {
|
|
117
|
+
passedTarget = target
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
await this.fetchContracts()
|
|
121
|
+
|
|
122
|
+
assert.isEqualDeep(passedTarget, {
|
|
123
|
+
namespaces: [namespace],
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@test()
|
|
128
|
+
protected static async returnsDependencyMapFromRemoteContracts() {
|
|
129
|
+
const perm = this.generatePermValues()
|
|
130
|
+
const perm2 = this.generatePermValues()
|
|
131
|
+
const perm3 = this.generatePermValues()
|
|
132
|
+
|
|
133
|
+
const { contract, contractId } = this.generateContractRowValues([
|
|
134
|
+
perm,
|
|
135
|
+
perm2,
|
|
136
|
+
])
|
|
137
|
+
|
|
138
|
+
const { contract: contract2, contractId: contractId2 } =
|
|
139
|
+
this.generateContractRowValues([perm3])
|
|
140
|
+
|
|
141
|
+
await this.eventFaker.fakeListPermissionContracts(() => {
|
|
142
|
+
return [contract, contract2]
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const map = await this.fetchContracts()
|
|
146
|
+
assert.isEqualDeep(map, {
|
|
147
|
+
[contractId]: [perm.id, perm2.id],
|
|
148
|
+
[contractId2]: [perm3.id],
|
|
149
|
+
[this.fqid2]: ['can-high-five'],
|
|
150
|
+
[buildPermissionContractId('oeu-aoeuao', this.namespace)]: [
|
|
151
|
+
'what-the',
|
|
152
|
+
'go-dogs',
|
|
153
|
+
],
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@test()
|
|
158
|
+
protected static async connectsAsSkill() {
|
|
159
|
+
let passedOptions: ApiClientFactoryOptions | undefined
|
|
160
|
+
|
|
161
|
+
//@ts-ignore
|
|
162
|
+
const old = this.permissions.connectToApi.bind(this.permissions)
|
|
163
|
+
//@ts-ignore
|
|
164
|
+
this.permissions.connectToApi = (options) => {
|
|
165
|
+
passedOptions = options
|
|
166
|
+
return old(passedOptions)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
await this.fetchContracts()
|
|
170
|
+
assert.isEqualDeep(passedOptions, { shouldAuthAsCurrentSkill: true })
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private static updateFirstContractBuilder(
|
|
174
|
+
contractId: string,
|
|
175
|
+
perm1Id: string,
|
|
176
|
+
perm2Id: string
|
|
177
|
+
) {
|
|
49
178
|
const file = this.resolvePath(
|
|
50
179
|
'src',
|
|
51
180
|
'permissions',
|
|
52
181
|
`${this.contractName1}.permissions.ts`
|
|
53
182
|
)
|
|
54
|
-
diskUtil.writeFile(
|
|
183
|
+
diskUtil.writeFile(
|
|
184
|
+
file,
|
|
185
|
+
generateContractBuilder(contractId, perm1Id, perm2Id)
|
|
186
|
+
)
|
|
187
|
+
}
|
|
55
188
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
189
|
+
private static generateContractRowValues(
|
|
190
|
+
permissions: SpruceSchemas.Mercury.v2020_12_25.Permission[]
|
|
191
|
+
) {
|
|
192
|
+
const contractId = generateId()
|
|
193
|
+
const contract = {
|
|
194
|
+
id: generateId(),
|
|
195
|
+
contract: {
|
|
196
|
+
id: contractId,
|
|
197
|
+
name: generateId(),
|
|
198
|
+
permissions,
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
return { contract, contractId }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private static generatePermValues() {
|
|
205
|
+
const permissionId = generateId()
|
|
206
|
+
const perm = {
|
|
207
|
+
id: permissionId,
|
|
208
|
+
name: generateId(),
|
|
209
|
+
defaults: {},
|
|
210
|
+
}
|
|
211
|
+
return perm
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private static addRandomDependency() {
|
|
215
|
+
const dep = this.Service('dependency')
|
|
216
|
+
const namespace = generateId()
|
|
217
|
+
dep.add({
|
|
218
|
+
id: generateId(),
|
|
219
|
+
namespace,
|
|
59
220
|
})
|
|
221
|
+
return namespace
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private static async fetchContracts() {
|
|
225
|
+
return this.permissions.fetchContracts()
|
|
60
226
|
}
|
|
61
227
|
|
|
62
228
|
private static async assertLocalPermissionsEqual(
|
|
63
|
-
expected:
|
|
229
|
+
expected: ImportedPermission[]
|
|
64
230
|
) {
|
|
65
231
|
const perms = await this.loadLocalPermissions()
|
|
232
|
+
|
|
233
|
+
perms.sort(sortPermissionContracts)
|
|
234
|
+
expected.sort(sortPermissionContracts)
|
|
235
|
+
|
|
66
236
|
assert.isEqualDeep(perms, expected)
|
|
67
237
|
}
|
|
68
238
|
|
|
69
239
|
private static async loadLocalPermissions() {
|
|
240
|
+
//@ts-ignore
|
|
70
241
|
return await this.permissions.loadLocalPermissions()
|
|
71
242
|
}
|
|
72
243
|
}
|
|
73
|
-
|
|
74
|
-
|
|
244
|
+
|
|
245
|
+
function buildPermissionContractId(
|
|
246
|
+
contractId: string,
|
|
247
|
+
namespace?: string
|
|
248
|
+
): string {
|
|
249
|
+
return `${namespace}.${contractId}`
|
|
75
250
|
}
|
|
76
251
|
|
|
77
|
-
|
|
252
|
+
function generateContractBuilder(
|
|
253
|
+
contractId = 'oeu-aoeuao',
|
|
254
|
+
perm1Id = 'what-the',
|
|
255
|
+
perm2Id = 'go-dogs'
|
|
256
|
+
) {
|
|
257
|
+
return `import {
|
|
78
258
|
buildPermissionContract
|
|
79
259
|
} from '@sprucelabs/mercury-types'
|
|
80
260
|
|
|
81
261
|
const debeePermissions = buildPermissionContract({
|
|
82
|
-
id: '
|
|
262
|
+
id: '${contractId}',
|
|
83
263
|
name: 'debee',
|
|
84
264
|
description: '',
|
|
85
265
|
requireAllPermissions: false,
|
|
86
266
|
permissions: [
|
|
87
267
|
{
|
|
88
|
-
id: '
|
|
268
|
+
id: '${perm1Id}',
|
|
89
269
|
name: 'Can give high five',
|
|
90
270
|
description: 'Will this person be allowed to high five?',
|
|
91
271
|
defaults: {
|
|
@@ -94,7 +274,7 @@ const debeePermissions = buildPermissionContract({
|
|
|
94
274
|
requireAllStatuses: false,
|
|
95
275
|
},
|
|
96
276
|
{
|
|
97
|
-
id: '
|
|
277
|
+
id: '${perm2Id}',
|
|
98
278
|
name: 'Can give high five',
|
|
99
279
|
description: 'Will this person be allowed to high five?',
|
|
100
280
|
defaults: {
|
|
@@ -107,3 +287,4 @@ const debeePermissions = buildPermissionContract({
|
|
|
107
287
|
|
|
108
288
|
export default debeePermissions
|
|
109
289
|
`
|
|
290
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
await this.writeTypesFile({
|
|
13
|
+
[contractId]: [perm1, perm2],
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
await this.writeTestFileAndAssertValid(contractId, perm1, perm2)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private static async writeTypesFile(map: PermissionContractMap) {
|
|
20
|
+
const writer = this.writers.Writer('permission', { fileDescriptions: [] })
|
|
21
|
+
await writer.writeTypesFile(this.cwd, map)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
}
|
|
@@ -19,8 +19,8 @@ export default class CreatingBehavioralTestsTest extends AbstractTestTest {
|
|
|
19
19
|
const candidates = await testFeature.buildParentClassCandidates()
|
|
20
20
|
|
|
21
21
|
assert.doesInclude(candidates, {
|
|
22
|
-
label: '
|
|
23
|
-
name: '
|
|
22
|
+
label: 'AbstractStoreTest (requires install)',
|
|
23
|
+
name: 'AbstractStoreTest',
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -33,7 +33,10 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
|
33
33
|
|
|
34
34
|
@test()
|
|
35
35
|
protected static async upgradingWritesExpectedFiles() {
|
|
36
|
+
CommandService.fakeCommand(/build/gis, { code: 0 })
|
|
37
|
+
|
|
36
38
|
const shouldNotBeFound = ['src/.spruce/skill.ts', 'src/.spruce/features']
|
|
39
|
+
diskUtil.deleteDir(this.resolveHashSprucePath('features'))
|
|
37
40
|
|
|
38
41
|
const results = await this.Action('node', 'upgrade').execute({})
|
|
39
42
|
|
|
@@ -8,6 +8,7 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
|
8
8
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
9
9
|
export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
10
10
|
private static originalErrorSyncExecute: any
|
|
11
|
+
|
|
11
12
|
protected static async beforeEach() {
|
|
12
13
|
if (!this.originalErrorSyncExecute) {
|
|
13
14
|
this.originalErrorSyncExecute = SyncAction.prototype.execute
|
|
@@ -23,7 +24,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
23
24
|
|
|
24
25
|
@test()
|
|
25
26
|
protected static async doesNotAddResolvePathAliasesToDependenciesAfterUpgrade() {
|
|
26
|
-
CommandService.
|
|
27
|
+
CommandService.clearFakedResponses()
|
|
27
28
|
await this.FeatureFixture().installCachedFeatures('views')
|
|
28
29
|
|
|
29
30
|
await this.Action('node', 'upgrade').execute({})
|
|
@@ -35,7 +36,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
35
36
|
|
|
36
37
|
@test()
|
|
37
38
|
protected static async featuresNotEnabledDontInstall() {
|
|
38
|
-
CommandService.
|
|
39
|
+
CommandService.clearFakedResponses()
|
|
39
40
|
await this.FeatureFixture().installCachedFeatures('schemas')
|
|
40
41
|
|
|
41
42
|
const results = await this.Action('node', 'upgrade').execute({})
|
|
@@ -7,7 +7,7 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
|
7
7
|
export default class UpgradingASkill4Test extends AbstractCliTest {
|
|
8
8
|
protected static async beforeEach() {
|
|
9
9
|
await super.beforeEach()
|
|
10
|
-
CommandService.fakeCommand(new RegExp(/
|
|
10
|
+
CommandService.fakeCommand(new RegExp(/rebuild/gis), {
|
|
11
11
|
code: 0,
|
|
12
12
|
})
|
|
13
13
|
}
|