@sprucelabs/spruce-cli 14.22.10 → 14.24.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 +39 -0
- package/build/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.d.ts +10 -0
- package/build/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.js +24 -0
- package/build/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.js.map +1 -0
- package/build/.spruce/events/events.contract.d.ts +346 -36
- package/build/.spruce/events/events.contract.js +9 -1
- package/build/.spruce/events/events.contract.js.map +1 -1
- package/build/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.d.ts +20 -2
- package/build/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.js +23 -5
- package/build/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.d.ts +20 -2
- package/build/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.js +23 -5
- package/build/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/forms/createForm.v2021_07_02.contract.d.ts +20 -2
- package/build/.spruce/events/forms/createForm.v2021_07_02.contract.js +23 -5
- package/build/.spruce/events/forms/createForm.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.d.ts +20 -2
- package/build/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.js +23 -5
- package/build/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.d.ts +15 -0
- package/build/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.js +17 -2
- package/build/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.d.ts +20 -3
- package/build/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.js +23 -6
- package/build/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/forms/listForms.v2021_07_02.contract.d.ts +38 -4
- package/build/.spruce/events/forms/listForms.v2021_07_02.contract.js +45 -11
- package/build/.spruce/events/forms/listForms.v2021_07_02.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.d.ts +15 -0
- package/build/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.js +17 -2
- package/build/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.d.ts +21 -4
- package/build/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.js +24 -7
- package/build/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.d.ts +21 -1
- package/build/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.js +26 -6
- package/build/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.js.map +1 -1
- package/build/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.d.ts +38 -0
- package/build/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.js +48 -0
- package/build/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.js.map +1 -0
- package/build/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.d.ts +38 -0
- package/build/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.js +48 -0
- package/build/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.js.map +1 -0
- package/build/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.d.ts +38 -0
- package/build/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.js +48 -0
- package/build/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.js.map +1 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/appointments.schema.d.ts +3 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/appointments.schema.js +28 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/appointments.schema.js.map +1 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.d.ts +3 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.js +36 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.js.map +1 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.d.ts +3 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.js +28 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.js.map +1 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.d.ts +3 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.js +56 -0
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.js.map +1 -0
- package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTargetAndPayload.schema.js +0 -10
- package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTargetAndPayload.schema.js.map +1 -1
- package/build/.spruce/schemas/schemas.types.d.ts +678 -604
- package/build/.spruce/schemas/schemas.types.js.map +1 -1
- package/build/__tests__/behavioral/AddingADependency.test.d.ts +9 -0
- package/build/__tests__/behavioral/AddingADependency.test.js +273 -0
- package/build/__tests__/behavioral/AddingADependency.test.js.map +1 -0
- package/build/__tests__/behavioral/CreatingADataStore.test.js.map +1 -1
- package/build/__tests__/behavioral/ManagingDependencies.test.d.ts +9 -0
- package/build/__tests__/behavioral/ManagingDependencies.test.js +279 -0
- package/build/__tests__/behavioral/ManagingDependencies.test.js.map +1 -0
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.d.ts +8 -0
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js +209 -0
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +1 -0
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +9 -5
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync.test.js +14 -7
- package/build/__tests__/behavioral/events/KeepingEventsInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +43 -12
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingATheme.test.js +8 -2
- package/build/__tests__/behavioral/views/CreatingATheme.test.js.map +1 -1
- package/build/__tests__/behavioral/views/SettingUpViews.test.d.ts +1 -0
- package/build/__tests__/behavioral/views/SettingUpViews.test.js +48 -3
- package/build/__tests__/behavioral/views/SettingUpViews.test.js.map +1 -1
- package/build/__tests__/implementation/EventStore.test.js +4 -3
- package/build/__tests__/implementation/EventStore.test.js.map +1 -1
- package/build/__tests__/implementation/EventTemplateItemBuilder.test.d.ts +1 -0
- package/build/__tests__/implementation/EventTemplateItemBuilder.test.js +21 -3
- package/build/__tests__/implementation/EventTemplateItemBuilder.test.js.map +1 -1
- package/build/errors/SpruceError.js +2 -2
- package/build/errors/SpruceError.js.map +1 -1
- package/build/features/FeatureInstaller.d.ts +1 -1
- package/build/features/FeatureInstallerFactory.js +4 -2
- package/build/features/FeatureInstallerFactory.js.map +1 -1
- package/build/features/dependencies/DependencyFeature.d.ts +16 -0
- package/build/features/dependencies/DependencyFeature.js +92 -0
- package/build/features/dependencies/DependencyFeature.js.map +1 -0
- package/build/features/dependencies/actions/AddAction.d.ts +33 -0
- package/build/features/dependencies/actions/AddAction.js +154 -0
- package/build/features/dependencies/actions/AddAction.js.map +1 -0
- package/build/features/dependencies/actions/ManageAction.d.ts +19 -0
- package/build/features/dependencies/actions/ManageAction.js +161 -0
- package/build/features/dependencies/actions/ManageAction.js.map +1 -0
- package/build/features/event/EventFeature.js +2 -1
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/event/builders/EventContractBuilder.d.ts +3 -0
- package/build/features/event/builders/EventContractBuilder.js +12 -8
- package/build/features/event/builders/EventContractBuilder.js.map +1 -1
- package/build/features/event/stores/EventStore.d.ts +2 -1
- package/build/features/event/stores/EventStore.js +33 -25
- package/build/features/event/stores/EventStore.js.map +1 -1
- package/build/features/schema/actions/SyncAction.js +4 -2
- package/build/features/schema/actions/SyncAction.js.map +1 -1
- package/build/features/skill/actions/RebuildAction.js.map +1 -1
- package/build/features/skill/stores/SkillStore.d.ts +4 -0
- package/build/features/skill/stores/SkillStore.js +39 -15
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/view/ViewFeature.js +5 -1
- package/build/features/view/ViewFeature.js.map +1 -1
- package/build/interfaces/SpyInterface.d.ts +2 -1
- package/build/interfaces/SpyInterface.js +67 -7
- package/build/interfaces/SpyInterface.js.map +1 -1
- package/build/services/DependencyService.d.ts +13 -0
- package/build/services/DependencyService.js +49 -0
- package/build/services/DependencyService.js.map +1 -0
- package/build/services/ServiceFactory.d.ts +2 -0
- package/build/services/ServiceFactory.js +5 -0
- package/build/services/ServiceFactory.js.map +1 -1
- package/build/templateItemBuilders/EventTemplateItemBuilder.js +9 -0
- package/build/templateItemBuilders/EventTemplateItemBuilder.js.map +1 -1
- package/build/tests/AbstractCliTest.js +2 -36
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/fixtures/SkillFixture.d.ts +2 -0
- package/build/tests/fixtures/SkillFixture.js +8 -8
- package/build/tests/fixtures/SkillFixture.js.map +1 -1
- package/build/utilities/action.utility.js +1 -5
- package/build/utilities/action.utility.js.map +1 -1
- package/package.json +26 -26
- package/src/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.ts +15 -0
- package/src/.spruce/events/events.contract.ts +32 -8
- package/src/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.ts +20 -2
- package/src/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.ts +20 -2
- package/src/.spruce/events/forms/createForm.v2021_07_02.contract.ts +20 -2
- package/src/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.ts +20 -2
- package/src/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.ts +15 -0
- package/src/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.ts +20 -3
- package/src/.spruce/events/forms/listForms.v2021_07_02.contract.ts +38 -4
- package/src/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.ts +15 -0
- package/src/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.ts +21 -4
- package/src/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.ts +21 -1
- package/src/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.ts +45 -0
- package/src/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.ts +45 -0
- package/src/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.ts +45 -0
- package/src/.spruce/schemas/appointments/v2021_06_23/appointments.schema.ts +22 -0
- package/src/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.ts +24 -0
- package/src/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.ts +22 -0
- package/src/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.ts +36 -0
- package/src/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTargetAndPayload.schema.ts +0 -6
- package/src/.spruce/schemas/schemas.types.ts +815 -720
- package/src/__tests__/behavioral/AddingADependency.test.ts +98 -0
- package/src/__tests__/behavioral/CreatingADataStore.test.ts +2 -0
- package/src/__tests__/behavioral/ManagingDependencies.test.ts +115 -0
- package/src/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.ts +70 -0
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +5 -0
- package/src/__tests__/behavioral/events/KeepingEventsInSync.test.ts +6 -0
- package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +27 -0
- package/src/__tests__/behavioral/views/CreatingATheme.test.ts +4 -0
- package/src/__tests__/behavioral/views/SettingUpViews.test.ts +23 -0
- package/src/__tests__/implementation/EventStore.test.ts +5 -2
- package/src/__tests__/implementation/EventTemplateItemBuilder.test.ts +20 -1
- package/src/errors/SpruceError.ts +1 -1
- package/src/features/FeatureInstallerFactory.ts +3 -0
- package/src/features/dependencies/DependencyFeature.ts +27 -0
- package/src/features/dependencies/actions/AddAction.ts +63 -0
- package/src/features/dependencies/actions/ManageAction.ts +84 -0
- package/src/features/event/EventFeature.ts +1 -0
- package/src/features/event/builders/EventContractBuilder.ts +9 -2
- package/src/features/event/stores/EventStore.ts +20 -11
- package/src/features/schema/actions/SyncAction.ts +6 -3
- package/src/features/skill/actions/RebuildAction.ts +2 -0
- package/src/features/skill/stores/SkillStore.ts +8 -1
- package/src/features/view/ViewFeature.ts +5 -0
- package/src/interfaces/SpyInterface.ts +29 -2
- package/src/services/DependencyService.ts +27 -0
- package/src/services/ServiceFactory.ts +6 -0
- package/src/templateItemBuilders/EventTemplateItemBuilder.ts +10 -0
- package/src/tests/AbstractCliTest.ts +1 -21
- package/src/tests/fixtures/SkillFixture.ts +6 -2
- package/src/utilities/action.utility.ts +1 -6
- package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTarget.schema.d.ts +0 -3
- package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTarget.schema.js +0 -28
- package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTarget.schema.js.map +0 -1
- package/src/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTarget.schema.ts +0 -22
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { buildSchema } from '@sprucelabs/schema'
|
|
2
|
+
import AbstractAction from '../../AbstractAction'
|
|
3
|
+
import { FeatureActionResponse } from '../../features.types'
|
|
4
|
+
|
|
5
|
+
const optionsSchema = buildSchema({
|
|
6
|
+
id: 'manageDependencies',
|
|
7
|
+
description: 'Manage the skills you depend on.',
|
|
8
|
+
fields: {},
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
type OptionsSchema = typeof optionsSchema
|
|
12
|
+
|
|
13
|
+
export default class DeployAction extends AbstractAction<OptionsSchema> {
|
|
14
|
+
public optionsSchema = optionsSchema
|
|
15
|
+
public commandAliases = [
|
|
16
|
+
'manage.dependencies',
|
|
17
|
+
'remove.dependency',
|
|
18
|
+
'dependencies',
|
|
19
|
+
]
|
|
20
|
+
public invocationMessage = 'Managing dependencies... 🔗'
|
|
21
|
+
|
|
22
|
+
public async execute(): Promise<FeatureActionResponse> {
|
|
23
|
+
let skills = await this.Store('skill').fetchMySkills()
|
|
24
|
+
skills.sort((a, b) => {
|
|
25
|
+
const name1 = a.name.toLowerCase()
|
|
26
|
+
const name2 = b.name.toLowerCase()
|
|
27
|
+
|
|
28
|
+
if (name1 < name2) {
|
|
29
|
+
return -1
|
|
30
|
+
} else if (name1 > name2) {
|
|
31
|
+
return 1
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return 0
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const dep = this.Service('dependency')
|
|
38
|
+
const dependencies = dep.get()
|
|
39
|
+
|
|
40
|
+
const currentSkill = await this.Store('skill').loadCurrentSkill()
|
|
41
|
+
|
|
42
|
+
if (currentSkill.isRegistered) {
|
|
43
|
+
skills = skills.filter((s) => s.id !== currentSkill.id)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const selected = await this.ui.prompt({
|
|
47
|
+
label: 'Which skills do you depend on?',
|
|
48
|
+
type: 'select',
|
|
49
|
+
isArray: true,
|
|
50
|
+
isRequired: true,
|
|
51
|
+
value: dependencies.map((d: any) => d.id),
|
|
52
|
+
options: {
|
|
53
|
+
choices: skills.map((skill) => ({
|
|
54
|
+
value: skill.id,
|
|
55
|
+
label: skill.name + ' (' + skill.slug + ')',
|
|
56
|
+
})),
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const summary: string[] = []
|
|
61
|
+
|
|
62
|
+
const updatedDependencies = selected.map((id) => {
|
|
63
|
+
const skill = skills.find((s) => s.id === id)
|
|
64
|
+
|
|
65
|
+
summary.push(skill?.name + ' (' + skill?.id + ')')
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
id,
|
|
69
|
+
namespace: skill?.slug ?? '**missing**',
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
dep.set(updatedDependencies)
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
summaryLines: [
|
|
77
|
+
`${updatedDependencies.length} dependenc${
|
|
78
|
+
updatedDependencies.length === 1 ? 'y' : 'ies'
|
|
79
|
+
} added.`,
|
|
80
|
+
...summary,
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
8
8
|
import globby from 'globby'
|
|
9
9
|
import { isEqual } from 'lodash'
|
|
10
|
+
import DependencyService from '../../../services/DependencyService'
|
|
10
11
|
import EventTemplateItemBuilder from '../../../templateItemBuilders/EventTemplateItemBuilder'
|
|
11
12
|
import { GraphicsInterface } from '../../../types/cli.types'
|
|
12
13
|
import { FeatureActionResponse } from '../../features.types'
|
|
@@ -25,6 +26,7 @@ export default class EventContractBuilder {
|
|
|
25
26
|
private cwd: string
|
|
26
27
|
private eventStore: EventStore
|
|
27
28
|
private skillStore: SkillStore
|
|
29
|
+
private dependencyService: DependencyService
|
|
28
30
|
|
|
29
31
|
public constructor(options: {
|
|
30
32
|
optionsSchema: OptionsSchema
|
|
@@ -33,6 +35,7 @@ export default class EventContractBuilder {
|
|
|
33
35
|
cwd: string
|
|
34
36
|
eventStore: EventStore
|
|
35
37
|
skillStore: SkillStore
|
|
38
|
+
dependencyService: DependencyService
|
|
36
39
|
}) {
|
|
37
40
|
this.optionsSchema = options.optionsSchema
|
|
38
41
|
this.ui = options.ui
|
|
@@ -40,6 +43,7 @@ export default class EventContractBuilder {
|
|
|
40
43
|
this.cwd = options.cwd
|
|
41
44
|
this.eventStore = options.eventStore
|
|
42
45
|
this.skillStore = options.skillStore
|
|
46
|
+
this.dependencyService = options.dependencyService
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
public async fetchAndWriteContracts(
|
|
@@ -151,8 +155,13 @@ export default class EventContractBuilder {
|
|
|
151
155
|
|
|
152
156
|
this.ui.startLoading('Fetching event contracts...')
|
|
153
157
|
|
|
158
|
+
const namespaces = shouldSyncOnlyCoreEvents
|
|
159
|
+
? ['core']
|
|
160
|
+
: this.dependencyService.get().map((d) => d.namespace)
|
|
161
|
+
|
|
154
162
|
const contractResults = await this.eventStore.fetchEventContracts({
|
|
155
163
|
localNamespace: namespace,
|
|
164
|
+
namespaces,
|
|
156
165
|
didUpdateHandler: (msg) => {
|
|
157
166
|
this.ui.startLoading(msg)
|
|
158
167
|
},
|
|
@@ -167,10 +176,8 @@ export default class EventContractBuilder {
|
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
if (shouldSyncOnlyCoreEvents) {
|
|
170
|
-
contractResults.contracts = [contractResults.contracts[0]]
|
|
171
179
|
namespace = undefined
|
|
172
180
|
} else {
|
|
173
|
-
contractResults.contracts.shift()
|
|
174
181
|
namespace = namesUtil.toKebab(namespace)
|
|
175
182
|
}
|
|
176
183
|
|
|
@@ -55,17 +55,18 @@ const eventFileNamesImportKeyMap = {
|
|
|
55
55
|
|
|
56
56
|
export default class EventStore extends AbstractStore {
|
|
57
57
|
public name = 'event'
|
|
58
|
-
protected static contractCache: any
|
|
58
|
+
protected static contractCache: Record<string, any> = {}
|
|
59
59
|
|
|
60
60
|
public async fetchEventContracts(options?: {
|
|
61
61
|
localNamespace?: string
|
|
62
|
+
namespaces?: string[]
|
|
62
63
|
didUpdateHandler?: InternalUpdateHandler
|
|
63
64
|
}): Promise<EventStoreFetchEventContractsResponse> {
|
|
64
|
-
const { localNamespace, didUpdateHandler } = options ?? {}
|
|
65
|
+
const { localNamespace, didUpdateHandler, namespaces } = options ?? {}
|
|
65
66
|
|
|
66
67
|
didUpdateHandler?.('Pulling remote contracts...')
|
|
67
68
|
|
|
68
|
-
const contracts = await this.fetchRemoteContracts()
|
|
69
|
+
const contracts = await this.fetchRemoteContracts(namespaces)
|
|
69
70
|
|
|
70
71
|
const localContract =
|
|
71
72
|
localNamespace &&
|
|
@@ -89,19 +90,27 @@ export default class EventStore extends AbstractStore {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
public static clearCache() {
|
|
92
|
-
EventStore.contractCache =
|
|
93
|
+
EventStore.contractCache = {}
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
private async fetchRemoteContracts() {
|
|
96
|
-
|
|
96
|
+
private async fetchRemoteContracts(namespaces?: string[]) {
|
|
97
|
+
const key = namespaces?.join('|') ?? '_'
|
|
98
|
+
|
|
99
|
+
if (!EventStore.contractCache[key]) {
|
|
97
100
|
const client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })
|
|
98
|
-
|
|
101
|
+
|
|
102
|
+
const results = await client.emit('get-event-contracts::v2020_12_25', {
|
|
103
|
+
target: {
|
|
104
|
+
namespaces,
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
|
|
99
108
|
const { contracts } = eventResponseUtil.getFirstResponseOrThrow(results)
|
|
100
109
|
|
|
101
|
-
EventStore.contractCache = contracts
|
|
110
|
+
EventStore.contractCache[key] = contracts
|
|
102
111
|
}
|
|
103
112
|
|
|
104
|
-
return cloneDeep(EventStore.contractCache)
|
|
113
|
+
return cloneDeep(EventStore.contractCache[key])
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
private filterOutLocalEventsFromRemoteContractsMutating(
|
|
@@ -264,7 +273,7 @@ export default class EventStore extends AbstractStore {
|
|
|
264
273
|
|
|
265
274
|
eventResponseUtil.getFirstResponseOrThrow(results)
|
|
266
275
|
|
|
267
|
-
EventStore.contractCache =
|
|
276
|
+
EventStore.contractCache = {}
|
|
268
277
|
|
|
269
278
|
return results
|
|
270
279
|
}
|
|
@@ -280,6 +289,6 @@ export default class EventStore extends AbstractStore {
|
|
|
280
289
|
|
|
281
290
|
eventResponseUtil.getFirstResponseOrThrow(results)
|
|
282
291
|
|
|
283
|
-
EventStore.contractCache =
|
|
292
|
+
EventStore.contractCache = {}
|
|
284
293
|
}
|
|
285
294
|
}
|
|
@@ -2,6 +2,7 @@ import pathUtil from 'path'
|
|
|
2
2
|
import { SchemaTemplateItem, FieldTemplateItem } from '@sprucelabs/schema'
|
|
3
3
|
import { CORE_NAMESPACE, diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
4
4
|
import { ValueTypes } from '@sprucelabs/spruce-templates'
|
|
5
|
+
import uniq from 'lodash/uniq'
|
|
5
6
|
import { SpruceSchemas } from '#spruce/schemas/schemas.types'
|
|
6
7
|
import syncSchemasActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/syncSchemasOptions.schema'
|
|
7
8
|
import SpruceError from '../../../errors/SpruceError'
|
|
@@ -189,12 +190,14 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
189
190
|
schemaTemplateItems: SchemaTemplateItem[],
|
|
190
191
|
forceInstall?: boolean
|
|
191
192
|
) {
|
|
192
|
-
const modules =
|
|
193
|
-
.map((item) => item.importFrom)
|
|
194
|
-
|
|
193
|
+
const modules = uniq(
|
|
194
|
+
schemaTemplateItems.map((item) => item.importFrom).filter((i) => !!i)
|
|
195
|
+
) as string[]
|
|
196
|
+
|
|
195
197
|
const notInstalled: string[] = []
|
|
196
198
|
|
|
197
199
|
const pkg = this.Service('pkg')
|
|
200
|
+
|
|
198
201
|
for (const m of modules) {
|
|
199
202
|
if (!pkg.isInstalled(m) && notInstalled.indexOf(m) === -1) {
|
|
200
203
|
notInstalled.push(m)
|
|
@@ -37,6 +37,7 @@ export default class RebuildAction extends AbstractAction<OptionsSchema> {
|
|
|
37
37
|
} else {
|
|
38
38
|
this.ui.startLoading('Rebuilding....')
|
|
39
39
|
}
|
|
40
|
+
|
|
40
41
|
await command.execute('yarn rebuild', {
|
|
41
42
|
onData: (data: string) => {
|
|
42
43
|
InFlightEntertainment?.writeStatus(data)
|
|
@@ -44,6 +45,7 @@ export default class RebuildAction extends AbstractAction<OptionsSchema> {
|
|
|
44
45
|
})
|
|
45
46
|
} catch (err) {
|
|
46
47
|
this.resetUi()
|
|
48
|
+
|
|
47
49
|
return {
|
|
48
50
|
errors: [err],
|
|
49
51
|
}
|
|
@@ -168,11 +168,18 @@ export default class SkillStore extends AbstractStore {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
public async fetchMySkills() {
|
|
171
|
+
return this.fetchAllSkills({ showMineOnly: true })
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public async fetchAllSkills(query?: {
|
|
175
|
+
showMineOnly?: boolean
|
|
176
|
+
namespaces?: string[]
|
|
177
|
+
}) {
|
|
171
178
|
const client = await this.connectToApi()
|
|
172
179
|
|
|
173
180
|
const response = await client.emit('list-skills::v2020_12_25', {
|
|
174
181
|
payload: {
|
|
175
|
-
|
|
182
|
+
...query,
|
|
176
183
|
},
|
|
177
184
|
})
|
|
178
185
|
|
|
@@ -76,6 +76,11 @@ export default class ViewFeature extends AbstractFeature {
|
|
|
76
76
|
public async afterPackageInstall() {
|
|
77
77
|
const files = await this.Writer('view').writePlugin(this.cwd)
|
|
78
78
|
|
|
79
|
+
this.Service('dependency').add({
|
|
80
|
+
id: '**',
|
|
81
|
+
namespace: 'heartwood',
|
|
82
|
+
})
|
|
83
|
+
|
|
79
84
|
return { files }
|
|
80
85
|
}
|
|
81
86
|
}
|
|
@@ -2,6 +2,7 @@ import { FieldDefinitionValueType } from '@sprucelabs/schema'
|
|
|
2
2
|
import { namesUtil, testLog } from '@sprucelabs/spruce-skill-utils'
|
|
3
3
|
import { assert } from '@sprucelabs/test'
|
|
4
4
|
import { FieldDefinitions } from '#spruce/schemas/fields/fields.types'
|
|
5
|
+
import testUtil from '../tests/utilities/test.utility'
|
|
5
6
|
import { ExecutionResults } from '../types/cli.types'
|
|
6
7
|
import { GraphicsInterface } from '../types/cli.types'
|
|
7
8
|
import {
|
|
@@ -83,7 +84,7 @@ export default class SpyInterface implements GraphicsInterface {
|
|
|
83
84
|
return this.invocations[this.invocations.length - 1]
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
public async sendInput(input: string): Promise<void> {
|
|
87
|
+
public async sendInput(input: string | string[]): Promise<void> {
|
|
87
88
|
this.trackInvocation('sendInput', input)
|
|
88
89
|
|
|
89
90
|
this.optionallyRenderLine(
|
|
@@ -105,7 +106,9 @@ export default class SpyInterface implements GraphicsInterface {
|
|
|
105
106
|
this.confirmResolver = undefined
|
|
106
107
|
|
|
107
108
|
resolver(
|
|
108
|
-
input === '\n' ||
|
|
109
|
+
input === '\n' ||
|
|
110
|
+
input.length === 0 ||
|
|
111
|
+
(typeof input === 'string' && input.toLowerCase() === 'y')
|
|
109
112
|
)
|
|
110
113
|
} else {
|
|
111
114
|
throw new Error('Sent input before prompted for input')
|
|
@@ -273,6 +276,30 @@ export default class SpyInterface implements GraphicsInterface {
|
|
|
273
276
|
})
|
|
274
277
|
}
|
|
275
278
|
|
|
279
|
+
public async waitForInput() {
|
|
280
|
+
const ttl = 1000 * 60 * 5
|
|
281
|
+
const checkInterval = 100
|
|
282
|
+
let loops = ttl / checkInterval
|
|
283
|
+
let lastWriteCount = this.invocations.length
|
|
284
|
+
|
|
285
|
+
while (!this.isWaitingForInput()) {
|
|
286
|
+
if (loops-- === 0) {
|
|
287
|
+
assert.fail(`Waiting for input timed out.`)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const hasWritten = lastWriteCount != this.invocations.length
|
|
291
|
+
|
|
292
|
+
if (hasWritten) {
|
|
293
|
+
loops = ttl / checkInterval
|
|
294
|
+
lastWriteCount = this.invocations.length
|
|
295
|
+
if (this.shouldRenderTestLogs()) {
|
|
296
|
+
testUtil.log('waitForInput timeout reset because of new output.')
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
await new Promise((resolve) => setTimeout(resolve, checkInterval))
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
276
303
|
public confirm(question: string): Promise<boolean> {
|
|
277
304
|
this.trackInvocation('confirm', question)
|
|
278
305
|
this.optionallyRenderLine(`${question} :: Y/N...`)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SettingsService } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
|
|
3
|
+
interface Dependency {
|
|
4
|
+
id: string
|
|
5
|
+
namespace: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default class DependencyService {
|
|
9
|
+
private settings: SettingsService<string>
|
|
10
|
+
public constructor(settings: SettingsService) {
|
|
11
|
+
this.settings = settings
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public set(dependencies: Dependency[]) {
|
|
15
|
+
this.settings.set('dependencies', dependencies)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public add(dependency: Dependency) {
|
|
19
|
+
const dependencies = this.settings.get('dependencies') ?? []
|
|
20
|
+
dependencies.push(dependency)
|
|
21
|
+
this.settings.set('dependencies', dependencies)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public get(): Dependency[] {
|
|
25
|
+
return this.settings.get('dependencies') ?? []
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -7,6 +7,7 @@ import VsCodeService from '../features/vscode/services/VsCodeService'
|
|
|
7
7
|
import AuthService from './AuthService'
|
|
8
8
|
import BuildService from './BuildService'
|
|
9
9
|
import CommandService from './CommandService'
|
|
10
|
+
import DependencyService from './DependencyService'
|
|
10
11
|
import ImportService from './ImportService'
|
|
11
12
|
import LintService from './LintService'
|
|
12
13
|
import PkgService from './PkgService'
|
|
@@ -26,6 +27,7 @@ export interface ServiceMap {
|
|
|
26
27
|
auth: AuthService
|
|
27
28
|
remote: RemoteService
|
|
28
29
|
eventSettings: EventSettingsService
|
|
30
|
+
dependency: DependencyService
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export type Service = keyof ServiceMap
|
|
@@ -62,6 +64,10 @@ export default class ServiceFactory {
|
|
|
62
64
|
) as ServiceMap[S]
|
|
63
65
|
case 'settings':
|
|
64
66
|
return new SettingsService<FeatureCode>(cwd) as ServiceMap[S]
|
|
67
|
+
case 'dependency':
|
|
68
|
+
return new DependencyService(
|
|
69
|
+
new SettingsService<FeatureCode>(cwd)
|
|
70
|
+
) as ServiceMap[S]
|
|
65
71
|
case 'import':
|
|
66
72
|
return this.buildImportService(cwd) as ServiceMap[S]
|
|
67
73
|
case 'build': {
|
|
@@ -43,6 +43,16 @@ export default class EventTemplateItemBuilder {
|
|
|
43
43
|
schemaTemplateItems.push(...schemaItems)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
eventContractTemplateItems.sort((a, b) => {
|
|
47
|
+
if (a.nameCamel > b.nameCamel) {
|
|
48
|
+
return 1
|
|
49
|
+
} else if (a.nameCamel < b.nameCamel) {
|
|
50
|
+
return -1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return 0
|
|
54
|
+
})
|
|
55
|
+
|
|
46
56
|
return { eventContractTemplateItems, schemaTemplateItems }
|
|
47
57
|
}
|
|
48
58
|
|
|
@@ -357,27 +357,7 @@ export default abstract class AbstractCliTest extends AbstractSpruceTest {
|
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
protected static async waitForInput() {
|
|
360
|
-
|
|
361
|
-
const checkInterval = 100
|
|
362
|
-
let loops = ttl / checkInterval
|
|
363
|
-
let lastWriteCount = this.ui.invocations.length
|
|
364
|
-
|
|
365
|
-
while (!this.ui.isWaitingForInput()) {
|
|
366
|
-
if (loops-- === 0) {
|
|
367
|
-
assert.fail(`Waiting for input timed out.`)
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const hasWritten = lastWriteCount != this.ui.invocations.length
|
|
371
|
-
|
|
372
|
-
if (hasWritten) {
|
|
373
|
-
loops = ttl / checkInterval
|
|
374
|
-
lastWriteCount = this.ui.invocations.length
|
|
375
|
-
if (process.env.SHOULD_RENDER_TEST_LOGS === 'true') {
|
|
376
|
-
testUtil.log('waitForInput timeout reset because of new output.')
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
await new Promise((resolve) => setTimeout(resolve, checkInterval))
|
|
380
|
-
}
|
|
360
|
+
return this.ui.waitForInput()
|
|
381
361
|
}
|
|
382
362
|
|
|
383
363
|
protected static async assertIsFeatureInstalled(code: FeatureCode) {
|
|
@@ -26,9 +26,13 @@ export default class SkillFixture {
|
|
|
26
26
|
this.apiClientFactory = apiClientFactory
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
public async seedDemoSkill(
|
|
29
|
+
public async seedDemoSkill(
|
|
30
|
+
values: { name: string },
|
|
31
|
+
options?: { phone?: string }
|
|
32
|
+
) {
|
|
30
33
|
return this.registerCurrentSkill(values, {
|
|
31
34
|
isRegisteringCurrentSkill: false,
|
|
35
|
+
...options,
|
|
32
36
|
})
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -51,7 +55,7 @@ export default class SkillFixture {
|
|
|
51
55
|
SkillFixture.skillCount++
|
|
52
56
|
return `${namesUtil.toKebab(name)}-${new Date().getTime()}-count-${
|
|
53
57
|
SkillFixture.skillCount
|
|
54
|
-
}`
|
|
58
|
+
}-cli-test`
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
public async registerEventContract(
|
|
@@ -31,12 +31,7 @@ const actionUtil = {
|
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
assertNoErrorsInResponse(response: MercuryAggregateResponse<any>) {
|
|
34
|
-
|
|
35
|
-
throw (
|
|
36
|
-
response.responses[0]?.errors?.[0] ??
|
|
37
|
-
eventResponseUtil.getFirstResponseOrThrow(response)
|
|
38
|
-
)
|
|
39
|
-
}
|
|
34
|
+
eventResponseUtil.getFirstResponseOrThrow(response)
|
|
40
35
|
},
|
|
41
36
|
}
|
|
42
37
|
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _schema = require("@sprucelabs/schema");
|
|
9
|
-
|
|
10
|
-
var registerSkillViewsEmitTargetSchema = {
|
|
11
|
-
id: 'registerSkillViewsEmitTarget',
|
|
12
|
-
version: 'v2021_02_11',
|
|
13
|
-
namespace: 'Heartwood',
|
|
14
|
-
name: '',
|
|
15
|
-
fields: {
|
|
16
|
-
/** . */
|
|
17
|
-
'personId': {
|
|
18
|
-
type: 'id',
|
|
19
|
-
options: undefined
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
_schema.SchemaRegistry.getInstance().trackSchema(registerSkillViewsEmitTargetSchema);
|
|
25
|
-
|
|
26
|
-
var _default = registerSkillViewsEmitTargetSchema;
|
|
27
|
-
exports["default"] = _default;
|
|
28
|
-
//# sourceMappingURL=registerSkillViewsEmitTarget.schema.js.map
|
package/build/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTarget.schema.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/.spruce/schemas/heartwood/v2021_02_11/registerSkillViewsEmitTarget.schema.ts"],"names":["registerSkillViewsEmitTargetSchema","id","version","namespace","name","fields","type","options","undefined","SchemaRegistry","getInstance","trackSchema"],"mappings":";;;;;;;AAAA;;AAKA,IAAMA,kCAA0G,GAAI;AACnHC,EAAAA,EAAE,EAAE,8BAD+G;AAEnHC,EAAAA,OAAO,EAAE,aAF0G;AAGnHC,EAAAA,SAAS,EAAE,WAHwG;AAInHC,EAAAA,IAAI,EAAE,EAJ6G;AAK/GC,EAAAA,MAAM,EAAE;AACA;AACA,gBAAY;AACRC,MAAAA,IAAI,EAAE,IADE;AAERC,MAAAA,OAAO,EAAEC;AAFD;AAFZ;AALuG,CAApH;;AAcAC,uBAAeC,WAAf,GAA6BC,WAA7B,CAAyCX,kCAAzC;;eAEeA,kC","sourcesContent":["import { SchemaRegistry } from '@sprucelabs/schema'\nimport { SpruceSchemas } from '../../schemas.types'\n\n\n\nconst registerSkillViewsEmitTargetSchema: SpruceSchemas.Heartwood.v2021_02_11.RegisterSkillViewsEmitTargetSchema = {\n\tid: 'registerSkillViewsEmitTarget',\n\tversion: 'v2021_02_11',\n\tnamespace: 'Heartwood',\n\tname: '',\n\t fields: {\n\t /** . */\n\t 'personId': {\n\t type: 'id',\n\t options: undefined\n\t },\n\t }\n}\n\nSchemaRegistry.getInstance().trackSchema(registerSkillViewsEmitTargetSchema)\n\nexport default registerSkillViewsEmitTargetSchema\n"],"file":"registerSkillViewsEmitTarget.schema.js"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
|
-
import { SpruceSchemas } from '../../schemas.types'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const registerSkillViewsEmitTargetSchema: SpruceSchemas.Heartwood.v2021_02_11.RegisterSkillViewsEmitTargetSchema = {
|
|
7
|
-
id: 'registerSkillViewsEmitTarget',
|
|
8
|
-
version: 'v2021_02_11',
|
|
9
|
-
namespace: 'Heartwood',
|
|
10
|
-
name: '',
|
|
11
|
-
fields: {
|
|
12
|
-
/** . */
|
|
13
|
-
'personId': {
|
|
14
|
-
type: 'id',
|
|
15
|
-
options: undefined
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
SchemaRegistry.getInstance().trackSchema(registerSkillViewsEmitTargetSchema)
|
|
21
|
-
|
|
22
|
-
export default registerSkillViewsEmitTargetSchema
|