@sprucelabs/spruce-cli 14.29.5 → 14.29.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/GlobalEmitter.js +2 -2
  3. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.d.ts +1 -1
  4. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js +93 -93
  5. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +1 -1
  6. package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js +2 -2
  7. package/build/__tests__/behavioral/events/CreatingAnEvent.test.js +2 -2
  8. package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +2 -2
  9. package/build/__tests__/behavioral/views/CreatingASkillView.test.d.ts +1 -0
  10. package/build/__tests__/behavioral/views/CreatingASkillView.test.js +35 -3
  11. package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
  12. package/build/__tests__/implementation/EventContractCleanerUtil.test.js +2 -2
  13. package/build/__tests__/implementation/EventTemplateItemBuilder.test.js +2 -2
  14. package/build/__tests__/implementation/PkgService.test.js +3 -6
  15. package/build/__tests__/implementation/PkgService.test.js.map +1 -1
  16. package/build/__tests__/implementation/SchemaStore.test.js +2 -2
  17. package/build/__tests__/implementation/SchemaTemplateItemBuilder.test.js +2 -2
  18. package/build/cli.js +11 -9
  19. package/build/cli.js.map +1 -1
  20. package/build/components/AbstractComponent.js +2 -2
  21. package/build/components/FormComponent.js +2 -2
  22. package/build/components/QuizComponent.js +2 -2
  23. package/build/features/AbstractAction.js +2 -2
  24. package/build/features/AbstractFeature.js +2 -2
  25. package/build/features/ActionExecuter.js +2 -2
  26. package/build/features/ActionFactory.js +2 -2
  27. package/build/features/ActionQuestionAsker.js +2 -2
  28. package/build/features/FeatureCommandAttacher.js +2 -2
  29. package/build/features/FeatureInstaller.js +2 -2
  30. package/build/features/OverrideActionDecorator.js +2 -2
  31. package/build/features/deploy/actions/HerokuAction.js.map +1 -1
  32. package/build/features/error/actions/CreateAction.js +2 -2
  33. package/build/features/error/actions/SyncAction.js +2 -2
  34. package/build/features/error/writers/ErrorWriter.js +2 -2
  35. package/build/features/event/EventFeature.js.map +1 -1
  36. package/build/features/event/actions/CreateAction.js +2 -2
  37. package/build/features/event/actions/ListenAction.js +2 -2
  38. package/build/features/event/builders/EventContractBuilder.js +2 -2
  39. package/build/features/event/builders/ListenerTemplateItemBuilder.js +2 -2
  40. package/build/features/event/stores/EventStore.js +2 -2
  41. package/build/features/event/stores/ListenerStore.js +2 -2
  42. package/build/features/event/writers/EventWriter.js +2 -2
  43. package/build/features/eventContract/EventContractFeature.js +3 -1
  44. package/build/features/eventContract/EventContractFeature.js.map +1 -1
  45. package/build/features/node/NodeFeature.js +12 -10
  46. package/build/features/node/NodeFeature.js.map +1 -1
  47. package/build/features/node/actions/UpgradeAction.js +10 -9
  48. package/build/features/node/actions/UpgradeAction.js.map +1 -1
  49. package/build/features/node/writers/NodeWriter.js +2 -2
  50. package/build/features/organization/OrganizationFeature.js +3 -1
  51. package/build/features/organization/OrganizationFeature.js.map +1 -1
  52. package/build/features/person/PersonFeature.js +3 -1
  53. package/build/features/person/PersonFeature.js.map +1 -1
  54. package/build/features/person/actions/LoginAction.js +2 -2
  55. package/build/features/sandbox/SandboxFeature.js +3 -1
  56. package/build/features/sandbox/SandboxFeature.js.map +1 -1
  57. package/build/features/schema/actions/CreateAction.js +2 -2
  58. package/build/features/schema/stores/SchemaStore.js +2 -2
  59. package/build/features/schema/utilities/schemaDisk.utility.js +2 -2
  60. package/build/features/schema/writers/SchemaWriter.js +2 -2
  61. package/build/features/skill/SkillFeature.js +2 -2
  62. package/build/features/skill/actions/CreateAction.js +2 -2
  63. package/build/features/skill/stores/SkillStore.js +2 -2
  64. package/build/features/skill/writers/SkillWriter.js +2 -2
  65. package/build/features/store/actions/CreateAction.js +2 -2
  66. package/build/features/test/TestFeature.js +2 -2
  67. package/build/features/test/TestReporter.js +2 -2
  68. package/build/features/test/TestRunner.js +2 -2
  69. package/build/features/test/actions/CreateAction.js +2 -2
  70. package/build/features/validateAndNormalize.utility.js +2 -2
  71. package/build/features/view/actions/CreateAction.js +2 -2
  72. package/build/features/view/writers/ViewWriter.js +2 -2
  73. package/build/features/vscode/VsCodeFeature.js +3 -1
  74. package/build/features/vscode/VsCodeFeature.js.map +1 -1
  75. package/build/interfaces/TerminalInterface.js +2 -2
  76. package/build/schemas/v2020_07_22/createConversationTopicOptions.builder.js +2 -2
  77. package/build/schemas/v2020_07_22/createErrorOptions.builder.js +2 -2
  78. package/build/schemas/v2020_07_22/createOrganizationOptions.builder.js +2 -2
  79. package/build/schemas/v2020_07_22/createSchemaOptions.builder.js +2 -2
  80. package/build/schemas/v2020_07_22/listenEventOptions.builder.js +2 -2
  81. package/build/schemas/v2020_07_22/syncErrorOptions.builder.js +2 -2
  82. package/build/schemas/v2020_07_22/syncSchemasOptions.builder.js +2 -2
  83. package/build/services/CommandService.js +2 -2
  84. package/build/services/PkgService.d.ts +4 -16
  85. package/build/services/PkgService.js +11 -127
  86. package/build/services/PkgService.js.map +1 -1
  87. package/build/services/ServiceFactory.d.ts +1 -2
  88. package/build/services/ServiceFactory.js +2 -4
  89. package/build/services/ServiceFactory.js.map +1 -1
  90. package/build/services/TypeCheckerService.js +4 -3
  91. package/build/services/TypeCheckerService.js.map +1 -1
  92. package/build/stores/AbstractLocalStore.js +2 -2
  93. package/build/templateItemBuilders/EventTemplateItemBuilder.js +2 -2
  94. package/build/templateItemBuilders/SchemaTemplateItemBuilder.js +2 -2
  95. package/build/tests/AbstractCliTest.js +2 -2
  96. package/build/tests/AbstractEventTest.js +2 -2
  97. package/build/tests/AbstractSchemaTest.js +2 -2
  98. package/build/tests/JestJsonParser.js +2 -2
  99. package/build/tests/fixtures/FeatureFixture.js +2 -2
  100. package/build/tests/fixtures/OrganizationFixture.js +2 -2
  101. package/build/tests/fixtures/PersonFixture.js +2 -2
  102. package/build/tests/fixtures/SkillFixture.js +2 -2
  103. package/build/types/cli.types.d.ts +1 -6
  104. package/build/types/cli.types.js +8 -0
  105. package/build/types/cli.types.js.map +1 -1
  106. package/build/updaters/ScriptUpdater.js +2 -2
  107. package/build/utilities/commander.utility.js +2 -2
  108. package/build/utilities/eventContractCleaner.utility.js +2 -2
  109. package/build/widgets/WidgetFactory.js +2 -2
  110. package/build/widgets/terminalKit/TKButtonWidget.js +2 -2
  111. package/build/widgets/terminalKit/TkBaseWidget.js +2 -2
  112. package/build/widgets/terminalKit/TkInputWidget.js +2 -2
  113. package/build/widgets/terminalKit/TkLayoutCellWidget.js +2 -2
  114. package/build/widgets/terminalKit/TkLayoutWidget.js +2 -2
  115. package/build/widgets/terminalKit/TkMenuBarWidget.js +2 -2
  116. package/build/widgets/terminalKit/TkPopupWidget.js +2 -2
  117. package/build/widgets/terminalKit/TkProgressBarWidget.js +2 -2
  118. package/build/widgets/terminalKit/TkTextWidget.js +2 -2
  119. package/build/widgets/terminalKit/termKit.utility.js +2 -2
  120. package/build/writers/AbstractWriter.js +2 -2
  121. package/build/writers/WriterFactory.js +2 -2
  122. package/package.json +38 -38
  123. package/src/__tests__/behavioral/InstallingASkillAtAnOrg.test.ts +6 -6
  124. package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +16 -0
  125. package/src/__tests__/implementation/PkgService.test.ts +1 -2
  126. package/src/cli.ts +4 -1
  127. package/src/features/deploy/actions/HerokuAction.ts +1 -2
  128. package/src/features/event/EventFeature.ts +0 -1
  129. package/src/features/node/NodeFeature.ts +3 -0
  130. package/src/features/node/actions/UpgradeAction.ts +1 -0
  131. package/src/services/PkgService.ts +13 -93
  132. package/src/services/ServiceFactory.ts +10 -7
  133. package/src/types/cli.types.ts +1 -6
  134. package/build/__tests__/implementation/AuthService.test.d.ts +0 -14
  135. package/build/__tests__/implementation/AuthService.test.js +0 -255
  136. package/build/__tests__/implementation/AuthService.test.js.map +0 -1
  137. package/build/services/AuthService.d.ts +0 -23
  138. package/build/services/AuthService.js +0 -109
  139. package/build/services/AuthService.js.map +0 -1
  140. package/src/__tests__/implementation/AuthService.test.ts +0 -95
  141. package/src/services/AuthService.ts +0 -91
@@ -1,95 +0,0 @@
1
- import { diskUtil, HASH_SPRUCE_DIR } from '@sprucelabs/spruce-skill-utils'
2
- import { test, assert } from '@sprucelabs/test'
3
- import { errorAssertUtil } from '@sprucelabs/test-utils'
4
- import AuthService from '../../services/AuthService'
5
- import AbstractCliTest from '../../tests/AbstractCliTest'
6
-
7
- export default class AuthServiceTest extends AbstractCliTest {
8
- private static auth: AuthService
9
- protected static async beforeEach() {
10
- await super.beforeEach()
11
- diskUtil.createDir(this.resolvePath(HASH_SPRUCE_DIR))
12
- this.auth = this.Service('auth')
13
- }
14
-
15
- @test()
16
- protected static async canInstantiatePersonStore() {
17
- assert.isTruthy(this.auth)
18
- }
19
-
20
- @test()
21
- protected static async hasLoggedInPersonMethod() {
22
- assert.isFunction(this.auth.getLoggedInPerson)
23
- }
24
-
25
- @test()
26
- protected static async loggedInPersonIsNullWhenNotLoggedIn() {
27
- assert.isNull(this.auth.getLoggedInPerson())
28
- }
29
-
30
- @test()
31
- protected static async cantSaveBadLoggedInPerson() {
32
- const err = assert.doesThrow(() =>
33
- //@ts-ignore
34
- this.auth.setLoggedInPerson({ test: true })
35
- )
36
-
37
- errorAssertUtil.assertError(err, 'MISSING_PARAMETERS')
38
- }
39
-
40
- @test()
41
- protected static canSaveLoggedInPerson() {
42
- const auth = this.auth
43
- const person = {
44
- id: 'test',
45
- casualName: 'friend',
46
- token: 'token',
47
- }
48
-
49
- auth.setLoggedInPerson(person)
50
-
51
- const loggedIn = auth.getLoggedInPerson()
52
-
53
- assert.isEqualDeep(loggedIn, { ...person, isLoggedIn: true })
54
- }
55
-
56
- @test()
57
- protected static canLogOut() {
58
- const auth = this.auth
59
- const person = {
60
- id: 'test',
61
- casualName: 'friend',
62
- token: 'token',
63
- }
64
-
65
- auth.setLoggedInPerson(person)
66
- auth.logOutPerson()
67
-
68
- assert.isNull(auth.getLoggedInPerson())
69
- }
70
-
71
- @test()
72
- protected static getCurrentSkillReturnsNull() {
73
- this.writePackageJson()
74
- assert.isNull(this.auth.getCurrentSkill())
75
- }
76
-
77
- @test()
78
- protected static canSetCurrentSkill() {
79
- this.writePackageJson()
80
- const skill = {
81
- id: '123467aaoeuaoeu',
82
- apiKey: 'taco',
83
- name: 'go team',
84
- slug: 'taco-bravo',
85
- }
86
-
87
- this.auth.updateCurrentSkill(skill)
88
-
89
- assert.isEqualDeep(this.auth.getCurrentSkill(), skill)
90
- }
91
-
92
- private static writePackageJson() {
93
- diskUtil.writeFile(this.resolvePath('package.json'), '{}')
94
- }
95
- }
@@ -1,91 +0,0 @@
1
- import { SpruceSchemas } from '@sprucelabs/mercury-types'
2
- import { normalizeSchemaValues, validateSchemaValues } from '@sprucelabs/schema'
3
- import { EnvService, namesUtil } from '@sprucelabs/spruce-skill-utils'
4
- import personWithTokenSchema from '#spruce/schemas/spruceCli/v2020_07_22/personWithToken.schema'
5
- import PkgService from './PkgService'
6
-
7
- type PersonWithToken = SpruceSchemas.SpruceCli.v2020_07_22.PersonWithToken
8
-
9
- export interface SkillAuth {
10
- id: string
11
- apiKey: string
12
- name: string
13
- slug: string
14
- }
15
-
16
- const LOGGED_IN_PERSON_KEY = 'LOGGED_IN_PERSON'
17
-
18
- export default class AuthService {
19
- private env: EnvService
20
- private pkg: PkgService
21
-
22
- public constructor(envService: EnvService, pkgService: PkgService) {
23
- this.env = envService
24
- this.pkg = pkgService
25
- }
26
-
27
- public getLoggedInPerson(): PersonWithToken | null {
28
- const p = this.env.get(LOGGED_IN_PERSON_KEY)
29
- if (typeof p === 'string') {
30
- return JSON.parse(p)
31
- }
32
-
33
- return null
34
- }
35
-
36
- public setLoggedInPerson(person: PersonWithToken) {
37
- const normalized = normalizeSchemaValues(personWithTokenSchema, person)
38
- validateSchemaValues(personWithTokenSchema, normalized)
39
-
40
- this.env.set(
41
- LOGGED_IN_PERSON_KEY,
42
- JSON.stringify({
43
- ...normalized,
44
- isLoggedIn: true,
45
- })
46
- )
47
- }
48
-
49
- public logOutPerson() {
50
- this.env.unset(LOGGED_IN_PERSON_KEY)
51
- }
52
-
53
- public getCurrentSkill(): SkillAuth | null {
54
- const id = this.env.get('SKILL_ID') as string
55
- const apiKey = this.env.get('SKILL_API_KEY') as string
56
- const name = this.env.get('SKILL_NAME') as string
57
- const slug = this.pkg.get('skill.namespace') as string
58
-
59
- if (id && apiKey) {
60
- return {
61
- id,
62
- apiKey,
63
- name,
64
- slug,
65
- }
66
- }
67
-
68
- return null
69
- }
70
-
71
- public logoutCurrentSkill() {
72
- this.env.unset('SKILL_ID')
73
- this.env.unset('SKILL_API_KEY')
74
- this.env.unset('SKILL_NAME')
75
- }
76
-
77
- public updateCurrentSkill(skill: SkillAuth) {
78
- this.env.set('SKILL_ID', skill.id)
79
- this.env.set('SKILL_API_KEY', skill.apiKey)
80
- this.env.set('SKILL_NAME', skill.name)
81
-
82
- this.updateCurrentSkillNamespace(skill.slug)
83
- }
84
-
85
- public updateCurrentSkillNamespace(namespace: string) {
86
- this.pkg.set({
87
- path: 'skill.namespace',
88
- value: namesUtil.toKebab(namespace),
89
- })
90
- }
91
- }