@sprucelabs/spruce-cli 14.26.19 → 14.28.2
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 +38 -0
- package/build/.spruce/errors/errors.types.d.ts +19 -0
- package/build/.spruce/errors/options.types.d.ts +4 -1
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.d.ts +3 -0
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js +28 -0
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js.map +1 -0
- package/build/.spruce/events/events.contract.d.ts +4 -621
- package/build/.spruce/events/events.contract.js +1 -35
- package/build/.spruce/events/events.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.d.ts +0 -15
- package/build/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.js +2 -17
- 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 +4 -21
- package/build/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.js +7 -24
- 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 +1 -24
- package/build/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.js +5 -28
- package/build/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/registerSkillViews.v2021_02_11.contract.d.ts +12 -0
- package/build/.spruce/events/heartwood/registerSkillViews.v2021_02_11.contract.js +13 -1
- package/build/.spruce/events/heartwood/registerSkillViews.v2021_02_11.contract.js.map +1 -1
- package/build/.spruce/schemas/schemas.types.d.ts +54 -1142
- package/build/.spruce/schemas/schemas.types.js.map +1 -1
- package/build/.spruce/schemas/spruceCli/v2020_07_22/listenEventOptions.schema.js +1 -1
- package/build/.spruce/schemas/spruceCli/v2020_07_22/listenEventOptions.schema.js.map +1 -1
- package/build/.spruce/settings.json +6 -0
- package/build/__tests__/behavioral/AddingADependency.test.d.ts +6 -3
- package/build/__tests__/behavioral/AddingADependency.test.js +116 -44
- package/build/__tests__/behavioral/AddingADependency.test.js.map +1 -1
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js +2 -2
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +1 -1
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js +4 -4
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/ManagingDependencies.test.js +3 -3
- package/build/__tests__/behavioral/ManagingDependencies.test.js.map +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingRemote.test.js +1 -1
- package/build/__tests__/behavioral/SettingRemote.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingUpVscode.test.js +3 -3
- package/build/__tests__/behavioral/SettingUpVscode.test.js.map +1 -1
- package/build/__tests__/behavioral/TestingDataStores.test.js +2 -2
- package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
- package/build/__tests__/behavioral/UpgradingANodeModule.test.d.ts +1 -0
- package/build/__tests__/behavioral/UpgradingANodeModule.test.js +50 -3
- package/build/__tests__/behavioral/UpgradingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +8 -8
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.d.ts +3 -2
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js +156 -106
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +6 -9
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +2 -2
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js +7 -4
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill.test.js +7 -7
- package/build/__tests__/behavioral/skill/UpgradingASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill3.test.js +2 -2
- package/build/__tests__/behavioral/skill/UpgradingASkill3.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +3 -3
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js +2 -2
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js +3 -3
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/errors/SpruceError.js +4 -0
- package/build/errors/SpruceError.js.map +1 -1
- package/build/errors/dependencyExists.builder.d.ts +11 -0
- package/build/errors/dependencyExists.builder.js +22 -0
- package/build/errors/dependencyExists.builder.js.map +1 -0
- package/build/features/AbstractAction.js +1 -1
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/dependencies/actions/AddAction.js +22 -15
- package/build/features/dependencies/actions/AddAction.js.map +1 -1
- package/build/features/event/actions/CreateAction.js +1 -1
- package/build/features/event/actions/CreateAction.js.map +1 -1
- package/build/features/event/actions/ListenAction.js +66 -54
- package/build/features/event/actions/ListenAction.js.map +1 -1
- package/build/features/event/stores/EventStore.js +24 -13
- package/build/features/event/stores/EventStore.js.map +1 -1
- package/build/features/node/NodeFeature.d.ts +1 -0
- package/build/features/node/NodeFeature.js +83 -64
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/node/actions/UpgradeAction.js +20 -9
- package/build/features/node/actions/UpgradeAction.js.map +1 -1
- package/build/features/node/writers/NodeWriter.d.ts +5 -2
- package/build/features/node/writers/NodeWriter.js +37 -22
- package/build/features/node/writers/NodeWriter.js.map +1 -1
- package/build/features/sandbox/actions/SetupAction.js +1 -1
- package/build/features/sandbox/actions/SetupAction.js.map +1 -1
- package/build/features/skill/updaters/Updater.js +3 -1
- package/build/features/skill/updaters/Updater.js.map +1 -1
- package/build/interfaces/SpyInterface.d.ts +1 -1
- package/build/interfaces/SpyInterface.js +2 -2
- package/build/interfaces/SpyInterface.js.map +1 -1
- package/build/schemas/v2020_07_22/listenEventOptions.builder.d.ts +1 -1
- package/build/schemas/v2020_07_22/listenEventOptions.builder.js +1 -1
- package/build/schemas/v2020_07_22/listenEventOptions.builder.js.map +1 -1
- package/build/services/DependencyService.d.ts +1 -0
- package/build/services/DependencyService.js +18 -0
- package/build/services/DependencyService.js.map +1 -1
- package/build/tests/AbstractCliTest.js +1 -1
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/utilities/uiAssert.utility.d.ts +7 -0
- package/build/tests/utilities/uiAssert.utility.js +85 -0
- package/build/tests/utilities/uiAssert.utility.js.map +1 -0
- package/build/writers/AbstractWriter.d.ts +10 -10
- package/build/writers/AbstractWriter.js.map +1 -1
- package/package.json +33 -31
- package/src/.spruce/errors/errors.types.ts +29 -0
- package/src/.spruce/errors/options.types.ts +4 -1
- package/src/.spruce/errors/spruceCli/dependencyExists.schema.ts +22 -0
- package/src/.spruce/events/events.contract.ts +0 -102
- package/src/.spruce/events/heartwood/didRegisterSkillViews.v2021_02_11.contract.ts +0 -15
- package/src/.spruce/events/heartwood/generateUrl.v2021_02_11.contract.ts +4 -21
- package/src/.spruce/events/heartwood/getSkillViews.v2021_02_11.contract.ts +1 -24
- package/src/.spruce/events/heartwood/registerSkillViews.v2021_02_11.contract.ts +15 -0
- package/src/.spruce/schemas/schemas.types.ts +59 -1413
- package/src/.spruce/schemas/spruceCli/v2020_07_22/listenEventOptions.schema.ts +1 -1
- package/src/.spruce/settings.json +6 -0
- package/src/__tests__/behavioral/AddingADependency.test.ts +45 -8
- package/src/__tests__/behavioral/InstallingASkillAtAnOrg.test.ts +3 -3
- package/src/__tests__/behavioral/LoggingInAsASkill.test.ts +4 -4
- package/src/__tests__/behavioral/ManagingDependencies.test.ts +3 -3
- package/src/__tests__/behavioral/RememberingUpgradeSelections.test.ts +1 -1
- package/src/__tests__/behavioral/SettingRemote.test.ts +1 -1
- package/src/__tests__/behavioral/SettingUpVscode.test.ts +3 -3
- package/src/__tests__/behavioral/TestingDataStores.test.ts +2 -2
- package/src/__tests__/behavioral/UpgradingANodeModule.test.ts +24 -0
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +8 -8
- package/src/__tests__/behavioral/events/CreatingAnEvent.test.ts +44 -22
- package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +1 -1
- package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +2 -2
- package/src/__tests__/behavioral/schemas/KeepingSchemasInSync.test.ts +2 -0
- package/src/__tests__/behavioral/skill/UpgradingASkill.test.ts +7 -7
- package/src/__tests__/behavioral/skill/UpgradingASkill3.test.ts +2 -2
- package/src/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.ts +1 -1
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +3 -3
- package/src/__tests__/behavioral/views/TestingViewControllers.test.ts +2 -2
- package/src/__tests__/implementation/ActionExecuter2.test.ts +3 -3
- package/src/errors/SpruceError.ts +4 -0
- package/src/errors/dependencyExists.builder.ts +12 -0
- package/src/features/AbstractAction.ts +1 -4
- package/src/features/dependencies/actions/AddAction.ts +12 -5
- package/src/features/event/actions/CreateAction.ts +4 -1
- package/src/features/event/actions/ListenAction.ts +30 -20
- package/src/features/event/stores/EventStore.ts +7 -1
- package/src/features/node/NodeFeature.ts +31 -25
- package/src/features/node/actions/UpgradeAction.ts +8 -1
- package/src/features/node/writers/NodeWriter.ts +38 -23
- package/src/features/sandbox/actions/SetupAction.ts +1 -1
- package/src/features/skill/updaters/Updater.ts +2 -1
- package/src/interfaces/SpyInterface.ts +1 -1
- package/src/schemas/v2020_07_22/listenEventOptions.builder.ts +1 -1
- package/src/services/DependencyService.ts +14 -0
- package/src/tests/AbstractCliTest.ts +1 -1
- package/src/tests/utilities/uiAssert.utility.ts +45 -0
- package/src/writers/AbstractWriter.ts +15 -10
- package/build/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.d.ts +0 -10
- package/build/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.js +0 -24
- package/build/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.js.map +0 -1
- package/build/.spruce/events/calendar/createCalendarEventType.v2021_05_19.contract.d.ts +0 -11
- package/build/.spruce/events/calendar/createCalendarEventType.v2021_05_19.contract.js +0 -27
- package/build/.spruce/events/calendar/createCalendarEventType.v2021_05_19.contract.js.map +0 -1
- package/build/.spruce/events/calendar/listCalendarEventTypes.v2021_05_19.contract.d.ts +0 -10
- package/build/.spruce/events/calendar/listCalendarEventTypes.v2021_05_19.contract.js +0 -24
- package/build/.spruce/events/calendar/listCalendarEventTypes.v2021_05_19.contract.js.map +0 -1
- package/build/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.d.ts +0 -46
- package/build/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.js +0 -62
- package/build/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.d.ts +0 -46
- package/build/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.js +0 -62
- package/build/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/createForm.v2021_07_02.contract.d.ts +0 -46
- package/build/.spruce/events/forms/createForm.v2021_07_02.contract.js +0 -62
- package/build/.spruce/events/forms/createForm.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.d.ts +0 -46
- package/build/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.js +0 -62
- package/build/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/didUpdateCompletedForm.v2021_07_02.contract.d.ts +0 -10
- package/build/.spruce/events/forms/didUpdateCompletedForm.v2021_07_02.contract.js +0 -24
- package/build/.spruce/events/forms/didUpdateCompletedForm.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.d.ts +0 -40
- package/build/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.js +0 -56
- package/build/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.d.ts +0 -45
- package/build/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.js +0 -59
- package/build/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/listForms.v2021_07_02.contract.d.ts +0 -80
- package/build/.spruce/events/forms/listForms.v2021_07_02.contract.js +0 -94
- package/build/.spruce/events/forms/listForms.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/forms/updateCompletedForm.v2021_07_02.contract.d.ts +0 -11
- package/build/.spruce/events/forms/updateCompletedForm.v2021_07_02.contract.js +0 -27
- package/build/.spruce/events/forms/updateCompletedForm.v2021_07_02.contract.js.map +0 -1
- package/build/.spruce/events/mySkill163362874854325100/myCoolEvent.v2021_01_22.contract.d.ts +0 -38
- package/build/.spruce/events/mySkill163362874854325100/myCoolEvent.v2021_01_22.contract.js +0 -48
- package/build/.spruce/events/mySkill163362874854325100/myCoolEvent.v2021_01_22.contract.js.map +0 -1
- package/build/.spruce/events/mySkill163362882591525586/myCoolEvent.v2021_01_22.contract.d.ts +0 -38
- package/build/.spruce/events/mySkill163362882591525586/myCoolEvent.v2021_01_22.contract.js +0 -48
- package/build/.spruce/events/mySkill163362882591525586/myCoolEvent.v2021_01_22.contract.js.map +0 -1
- package/build/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.d.ts +0 -38
- package/build/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.js +0 -48
- package/build/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.js.map +0 -1
- package/build/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.d.ts +0 -38
- package/build/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.js +0 -48
- package/build/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.js.map +0 -1
- package/build/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.d.ts +0 -38
- package/build/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.js +0 -48
- package/build/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.js.map +0 -1
- package/build/.spruce/schemas/appointments/v2021_06_23/appointments.schema.d.ts +0 -3
- package/build/.spruce/schemas/appointments/v2021_06_23/appointments.schema.js +0 -28
- package/build/.spruce/schemas/appointments/v2021_06_23/appointments.schema.js.map +0 -1
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.js +0 -36
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.d.ts +0 -3
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.js +0 -28
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.js.map +0 -1
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.js +0 -56
- package/build/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitPayload.schema.js +0 -36
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeResponsePayload.schema.js +0 -35
- package/build/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/calendar/v2021_05_19/fullCalendarEventType.schema.d.ts +0 -3
- package/build/.spruce/schemas/calendar/v2021_05_19/fullCalendarEventType.schema.js +0 -54
- package/build/.spruce/schemas/calendar/v2021_05_19/fullCalendarEventType.schema.js.map +0 -1
- package/build/.spruce/schemas/calendar/v2021_05_19/listCalendarEventTypesResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/calendar/v2021_05_19/listCalendarEventTypesResponsePayload.schema.js +0 -37
- package/build/.spruce/schemas/calendar/v2021_05_19/listCalendarEventTypesResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/builtForm.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/builtForm.schema.js +0 -66
- package/build/.spruce/schemas/forms/v2021_07_02/builtForm.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/completedFormResponse.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/completedFormResponse.schema.js +0 -50
- package/build/.spruce/schemas/forms/v2021_07_02/completedFormResponse.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/completedFormSourceForm.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/completedFormSourceForm.schema.js +0 -59
- package/build/.spruce/schemas/forms/v2021_07_02/completedFormSourceForm.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitPayload.schema.js +0 -30
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormResponsePayload.schema.js +0 -34
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToFormResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitPayload.schema.js +0 -30
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasResponsePayload.schema.js +0 -33
- package/build/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/createBuiltForm.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/createBuiltForm.schema.js +0 -52
- package/build/.spruce/schemas/forms/v2021_07_02/createBuiltForm.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/createFormEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/createFormEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/createFormEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/createFormResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/createFormResponsePayload.schema.js +0 -44
- package/build/.spruce/schemas/forms/v2021_07_02/createFormResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTarget.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTarget.schema.js +0 -29
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTarget.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormResponsePayload.schema.js +0 -29
- package/build/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/didSaveFormEmitPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/didSaveFormEmitPayload.schema.js +0 -29
- package/build/.spruce/schemas/forms/v2021_07_02/didSaveFormEmitPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/didUpdateCompletedFormEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/didUpdateCompletedFormEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/didUpdateCompletedFormEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTarget.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTarget.schema.js +0 -29
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTarget.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEventForm.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEventForm.schema.js +0 -78
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormEventForm.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormResponsePayload.schema.js +0 -35
- package/build/.spruce/schemas/forms/v2021_07_02/getCompletedFormResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/listCompletedFormsResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/listCompletedFormsResponsePayload.schema.js +0 -37
- package/build/.spruce/schemas/forms/v2021_07_02/listCompletedFormsResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/listFormsForm.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/listFormsForm.schema.js +0 -51
- package/build/.spruce/schemas/forms/v2021_07_02/listFormsForm.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/listFormsResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/listFormsResponsePayload.schema.js +0 -37
- package/build/.spruce/schemas/forms/v2021_07_02/listFormsResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitPayload.schema.js +0 -38
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitTargetAndPayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitTargetAndPayload.schema.js +0 -46
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitTargetAndPayload.schema.js.map +0 -1
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormResponsePayload.schema.d.ts +0 -3
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormResponsePayload.schema.js +0 -29
- package/build/.spruce/schemas/forms/v2021_07_02/updateCompletedFormResponsePayload.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/builderImportExportPage.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/builderImportExportPage.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/builderImportExportPage.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formBuilderImportExportObject.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formBuilderImportExportObject.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formBuilderImportExportObject.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formSection.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formSection.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formSection.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/list.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/list.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/list.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCell.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCell.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCell.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCellButton.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCellButton.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCellButton.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listRow.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listRow.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listRow.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listSelectInput.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listSelectInput.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listSelectInput.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listTextInput.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listTextInput.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listTextInput.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/selectInputChoice.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/selectInputChoice.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/selectInputChoice.schema.js.map +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/text.schema.d.ts +0 -1
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/text.schema.js +0 -14
- package/build/.spruce/schemas/heartwoodViewControllers/v2021_02_11/text.schema.js.map +0 -1
- package/src/.spruce/events/appointments/didBookAppointments.v2021_06_23.contract.ts +0 -15
- package/src/.spruce/events/calendar/createCalendarEventType.v2021_05_19.contract.ts +0 -17
- package/src/.spruce/events/calendar/listCalendarEventTypes.v2021_05_19.contract.ts +0 -16
- package/src/.spruce/events/forms/convertPdfToForm.v2021_07_02.contract.ts +0 -54
- package/src/.spruce/events/forms/convertPdfToSchemas.v2021_07_02.contract.ts +0 -55
- package/src/.spruce/events/forms/createForm.v2021_07_02.contract.ts +0 -54
- package/src/.spruce/events/forms/deleteCompletedForm.v2021_07_02.contract.ts +0 -55
- package/src/.spruce/events/forms/didUpdateCompletedForm.v2021_07_02.contract.ts +0 -15
- package/src/.spruce/events/forms/getCompletedForm.v2021_07_02.contract.ts +0 -48
- package/src/.spruce/events/forms/listCompletedForms.v2021_07_02.contract.ts +0 -54
- package/src/.spruce/events/forms/listForms.v2021_07_02.contract.ts +0 -90
- package/src/.spruce/events/forms/updateCompletedForm.v2021_07_02.contract.ts +0 -17
- package/src/.spruce/events/mySkill163362874854325100/myCoolEvent.v2021_01_22.contract.ts +0 -45
- package/src/.spruce/events/mySkill163362882591525586/myCoolEvent.v2021_01_22.contract.ts +0 -45
- package/src/.spruce/events/mySkill163459634973936127/myCoolEvent.v2021_01_22.contract.ts +0 -45
- package/src/.spruce/events/mySkill163493473102035607/myCoolEvent.v2021_01_22.contract.ts +0 -45
- package/src/.spruce/events/mySkill163493479880935941/myCoolEvent.v2021_01_22.contract.ts +0 -45
- package/src/.spruce/schemas/appointments/v2021_06_23/appointments.schema.ts +0 -22
- package/src/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitPayload.schema.ts +0 -24
- package/src/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTarget.schema.ts +0 -22
- package/src/.spruce/schemas/appointments/v2021_06_23/didBookAppointmentsEmitTargetAndPayload.schema.ts +0 -36
- package/src/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitPayload.schema.ts +0 -29
- package/src/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/calendar/v2021_05_19/createCalendarEventTypeResponsePayload.schema.ts +0 -23
- package/src/.spruce/schemas/calendar/v2021_05_19/fullCalendarEventType.schema.ts +0 -39
- package/src/.spruce/schemas/calendar/v2021_05_19/listCalendarEventTypesResponsePayload.schema.ts +0 -25
- package/src/.spruce/schemas/forms/v2021_07_02/builtForm.schema.ts +0 -50
- package/src/.spruce/schemas/forms/v2021_07_02/completedFormResponse.schema.ts +0 -41
- package/src/.spruce/schemas/forms/v2021_07_02/completedFormSourceForm.schema.ts +0 -44
- package/src/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitPayload.schema.ts +0 -24
- package/src/.spruce/schemas/forms/v2021_07_02/convertPdfToFormEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/convertPdfToFormResponsePayload.schema.ts +0 -22
- package/src/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitPayload.schema.ts +0 -24
- package/src/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/convertPdfToSchemasResponsePayload.schema.ts +0 -25
- package/src/.spruce/schemas/forms/v2021_07_02/createBuiltForm.schema.ts +0 -38
- package/src/.spruce/schemas/forms/v2021_07_02/createFormEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/createFormResponsePayload.schema.ts +0 -29
- package/src/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTarget.schema.ts +0 -23
- package/src/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/deleteCompletedFormResponsePayload.schema.ts +0 -23
- package/src/.spruce/schemas/forms/v2021_07_02/didSaveFormEmitPayload.schema.ts +0 -23
- package/src/.spruce/schemas/forms/v2021_07_02/didUpdateCompletedFormEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTarget.schema.ts +0 -23
- package/src/.spruce/schemas/forms/v2021_07_02/getCompletedFormEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/getCompletedFormEventForm.schema.ts +0 -58
- package/src/.spruce/schemas/forms/v2021_07_02/getCompletedFormResponsePayload.schema.ts +0 -23
- package/src/.spruce/schemas/forms/v2021_07_02/listCompletedFormsResponsePayload.schema.ts +0 -25
- package/src/.spruce/schemas/forms/v2021_07_02/listFormsForm.schema.ts +0 -42
- package/src/.spruce/schemas/forms/v2021_07_02/listFormsResponsePayload.schema.ts +0 -25
- package/src/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitPayload.schema.ts +0 -29
- package/src/.spruce/schemas/forms/v2021_07_02/updateCompletedFormEmitTargetAndPayload.schema.ts +0 -30
- package/src/.spruce/schemas/forms/v2021_07_02/updateCompletedFormResponsePayload.schema.ts +0 -23
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/builderImportExportPage.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formBuilderImportExportObject.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/formSection.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/list.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCell.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listCellButton.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listRow.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listSelectInput.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/listTextInput.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/selectInputChoice.schema.ts +0 -1
- package/src/.spruce/schemas/heartwoodViewControllers/v2021_02_11/text.schema.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/event/stores/EventStore.ts"],"names":["eventFileNamesImportKeyMap","key","isSchema","EventStore","options","localNamespace","didUpdateHandler","namespaces","fetchRemoteContracts","contracts","loadLocalContract","localContract","filterOutLocalEventsFromRemoteContractsMutating","push","errors","join","contractCache","connectToApi","shouldAuthAsCurrentSkill","client","emit","target","results","eventResponseUtil","getFirstResponseOrThrow","remoteContracts","ns","namesUtil","toKebab","contract","sigs","eventContractUtil","getNamedEventSignatures","sig","eventNamespace","eventSignatures","fullyQualifiedEventName","localEventCache","diskUtil","resolvePath","cwd","localMatches","filesByFqenAndEventKey","length","Promise","all","map","match","eventDiskUtil","splitPathToEvent","eventName","version","fqen","eventNameUtil","filename","pathUtil","basename","eventKey","SpruceError","code","brokenProperty","originalError","matches","o","Service","bulkImport","importsInOrder","importsByName","idx","imported","Object","keys","forEach","split","emitPayloadSchema","payloadSchema","emitPayload","targetSchema","emitTarget","responsePayloadSchema","responsePayload","emitPermissionContract","emitPermissions","listenPermissionContract","listenPermissions","cleaned","eventContractCleanerUtil","cleanPayloadsAndPermissions","payload","eventContract","undefined","AbstractStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAOA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;AAwBA,IAAMA,0BAA0B,GAAG;AAClC,sBAAoB;AAAEC,IAAAA,GAAG,EAAE,SAAP;AAAkBC,IAAAA,QAAQ,EAAE;AAA5B,GADc;AAElC,4BAA0B;AAAED,IAAAA,GAAG,EAAE,aAAP;AAAsBC,IAAAA,QAAQ,EAAE;AAAhC,GAFQ;AAGlC,2BAAyB;AAAED,IAAAA,GAAG,EAAE,YAAP;AAAqBC,IAAAA,QAAQ,EAAE;AAA/B,GAHS;AAIlC,gCAA8B;AAAED,IAAAA,GAAG,EAAE,iBAAP;AAA0BC,IAAAA,QAAQ,EAAE;AAApC,GAJI;AAKlC,gCAA8B;AAAED,IAAAA,GAAG,EAAE,iBAAP;AAA0BC,IAAAA,QAAQ,EAAE;AAApC,GALI;AAMlC,kCAAgC;AAAED,IAAAA,GAAG,EAAE,mBAAP;AAA4BC,IAAAA,QAAQ,EAAE;AAAtC;AANE,CAAnC;;IASqBC,U;;;;;;;;;;;;;;;6FACN,O;;;;;;;+GASd,iBAAiCC,OAAjC;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,uBAK0DA,OAL1D,aAK0DA,OAL1D,cAK0DA,OAL1D,GAKqE,EALrE,EAKSC,cALT,QAKSA,cALT,EAKyBC,gBALzB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","sourcesContent":["import pathUtil from 'path'\nimport {\n\tEventContract,\n\tEventSignature,\n\tPermissionContract,\n\tSpruceSchemas,\n\tvalidateEventContract,\n} from '@sprucelabs/mercury-types'\nimport { Schema, validateSchema } from '@sprucelabs/schema'\nimport {\n\teventResponseUtil,\n\teventDiskUtil,\n\teventNameUtil,\n\tbuildEmitTargetAndPayloadSchema,\n\teventContractUtil,\n} from '@sprucelabs/spruce-event-utils'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport globby from 'globby'\nimport { cloneDeep } from 'lodash'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractStore from '../../../stores/AbstractStore'\nimport { InternalUpdateHandler } from '../../../types/cli.types'\nimport { eventContractCleanerUtil } from '../../../utilities/eventContractCleaner.utility'\n\nexport interface EventStoreFetchEventContractsResponse {\n\terrors: SpruceError[]\n\tcontracts: EventContract[]\n}\n\ntype Options = Omit<\n\tEventSignature,\n\t| 'responsePayloadSchema'\n\t| 'emitPayloadSchema'\n\t| 'listenPermissionContract'\n\t| 'emitPermissionContract'\n>\n\ninterface EventImport {\n\toptions?: Options\n\temitPayload?: Schema\n\temitTarget?: Schema\n\tresponsePayload?: Schema\n\temitPermissions?: PermissionContract\n\tlistenPermissions?: PermissionContract\n}\n\nconst eventFileNamesImportKeyMap = {\n\t'event.options.ts': { key: 'options', isSchema: false },\n\t'emitPayload.builder.ts': { key: 'emitPayload', isSchema: true },\n\t'emitTarget.builder.ts': { key: 'emitTarget', isSchema: true },\n\t'responsePayload.builder.ts': { key: 'responsePayload', isSchema: true },\n\t'emitPermissions.builder.ts': { key: 'emitPermissions', isSchema: false },\n\t'listenPermissions.builder.ts': { key: 'listenPermissions', isSchema: false },\n}\n\nexport default class EventStore extends AbstractStore {\n\tpublic name = 'event'\n\tprotected static contractCache: Record<string, any> = {}\n\tprivate static localEventCache?: SpruceSchemas.Mercury.v2020_12_25.EventContract\n\n\tpublic static clearCache() {\n\t\tEventStore.localEventCache = undefined\n\t\tEventStore.contractCache = {}\n\t}\n\n\tpublic async fetchEventContracts(options?: {\n\t\tlocalNamespace?: string\n\t\tnamespaces?: string[]\n\t\tdidUpdateHandler?: InternalUpdateHandler\n\t}): Promise<EventStoreFetchEventContractsResponse> {\n\t\tconst { localNamespace, didUpdateHandler, namespaces } = options ?? {}\n\n\t\tdidUpdateHandler?.('Pulling remote contracts...')\n\n\t\tconst contracts = await this.fetchRemoteContracts(namespaces)\n\n\t\tconst localContract =\n\t\t\tlocalNamespace &&\n\t\t\t(await this.loadLocalContract(localNamespace, didUpdateHandler))\n\n\t\tif (localNamespace) {\n\t\t\tthis.filterOutLocalEventsFromRemoteContractsMutating(\n\t\t\t\tcontracts,\n\t\t\t\tlocalNamespace\n\t\t\t)\n\t\t}\n\n\t\tif (localContract) {\n\t\t\tcontracts.push(localContract)\n\t\t}\n\n\t\treturn {\n\t\t\tcontracts,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tprivate async fetchRemoteContracts(namespaces?: string[]) {\n\t\tconst key = namespaces?.join('|') ?? '_'\n\n\t\tif (!EventStore.contractCache[key]) {\n\t\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\t\tconst results = await client.emit('get-event-contracts::v2020_12_25', {\n\t\t\t\ttarget: {\n\t\t\t\t\tnamespaces,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { contracts } = eventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\t\tEventStore.contractCache[key] = contracts\n\t\t}\n\n\t\treturn cloneDeep(EventStore.contractCache[key])\n\t}\n\n\tprivate filterOutLocalEventsFromRemoteContractsMutating(\n\t\tremoteContracts: EventContract[],\n\t\tlocalNamespace: string\n\t) {\n\t\tconst ns = namesUtil.toKebab(localNamespace)\n\n\t\tfor (const contract of remoteContracts) {\n\t\t\tconst sigs = eventContractUtil.getNamedEventSignatures(contract)\n\t\t\tfor (const sig of sigs) {\n\t\t\t\tif (sig.eventNamespace === ns) {\n\t\t\t\t\tdelete contract.eventSignatures[sig.fullyQualifiedEventName]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async loadLocalContract(\n\t\tlocalNamespace: string,\n\t\tdidUpdateHandler?: InternalUpdateHandler\n\t): Promise<EventContract | null> {\n\t\tif (EventStore.localEventCache) {\n\t\t\treturn EventStore.localEventCache\n\t\t}\n\n\t\tconst localMatches = await globby(\n\t\t\tdiskUtil.resolvePath(\n\t\t\t\tthis.cwd,\n\t\t\t\t'src',\n\t\t\t\t'events',\n\t\t\t\t'**/*.(builder|options).ts'\n\t\t\t)\n\t\t)\n\n\t\tconst ns = namesUtil.toKebab(localNamespace)\n\t\tconst eventSignatures: Record<string, EventSignature> = {}\n\t\tconst filesByFqenAndEventKey: {\n\t\t\tfqen: string\n\t\t\tisSchema: boolean\n\t\t\tmatch: string\n\t\t\teventKey: string\n\t\t}[] = []\n\n\t\tdidUpdateHandler?.(\n\t\t\t`Importing ${localMatches.length} local event signature files...`\n\t\t)\n\n\t\tawait Promise.all(\n\t\t\tlocalMatches.map(async (match) => {\n\t\t\t\tlet fqen: string | undefined\n\t\t\t\tlet eventKey: keyof EventImport | undefined\n\n\t\t\t\ttry {\n\t\t\t\t\tconst { eventName, version } = eventDiskUtil.splitPathToEvent(match)\n\t\t\t\t\tfqen = eventNameUtil.join({\n\t\t\t\t\t\teventName,\n\t\t\t\t\t\tversion,\n\t\t\t\t\t\teventNamespace: ns,\n\t\t\t\t\t})\n\n\t\t\t\t\tconst filename = pathUtil.basename(\n\t\t\t\t\t\tmatch\n\t\t\t\t\t) as keyof typeof eventFileNamesImportKeyMap\n\n\t\t\t\t\tconst map = eventFileNamesImportKeyMap[filename]\n\n\t\t\t\t\tif (map) {\n\t\t\t\t\t\t//@ts-ignore\n\t\t\t\t\t\teventKey = map.key\n\n\t\t\t\t\t\tfilesByFqenAndEventKey.push({\n\t\t\t\t\t\t\tfqen,\n\t\t\t\t\t\t\tisSchema: map.isSchema,\n\t\t\t\t\t\t\tmatch,\n\t\t\t\t\t\t\teventKey: eventKey as string,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} catch (err: any) {\n\t\t\t\t\tthrow new SpruceError({\n\t\t\t\t\t\tcode: 'INVALID_EVENT_CONTRACT',\n\t\t\t\t\t\tfullyQualifiedEventName: fqen ?? 'Bad event name',\n\t\t\t\t\t\tbrokenProperty: eventKey ?? '*** major failure ***',\n\t\t\t\t\t\toriginalError: err,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t)\n\n\t\tconst matches = filesByFqenAndEventKey.map((o) => o.match)\n\t\tconst importsInOrder = (await this.Service('import').bulkImport(\n\t\t\tmatches\n\t\t)) as Record<string, any>[]\n\t\tconst importsByName: Record<string, EventImport> = {}\n\n\t\tfor (let idx = 0; idx < filesByFqenAndEventKey.length; idx++) {\n\t\t\tconst imported = importsInOrder[idx]\n\t\t\tconst { fqen, eventKey, isSchema } = filesByFqenAndEventKey[idx]\n\n\t\t\tif (isSchema) {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateSchema(imported)\n\t\t\t\t} catch (err: any) {\n\t\t\t\t\tthrow new SpruceError({\n\t\t\t\t\t\tcode: 'INVALID_EVENT_CONTRACT',\n\t\t\t\t\t\tfullyQualifiedEventName: fqen,\n\t\t\t\t\t\tbrokenProperty: eventKey,\n\t\t\t\t\t\toriginalError: err,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!importsByName[fqen]) {\n\t\t\t\timportsByName[fqen] = {}\n\t\t\t}\n\n\t\t\t//@ts-ignore\n\t\t\timportsByName[fqen][eventKey] = imported\n\t\t}\n\n\t\tObject.keys(importsByName).forEach((fqen) => {\n\t\t\tconst imported = importsByName[fqen]\n\t\t\tconst { eventName } = eventNameUtil.split(fqen)\n\t\t\teventSignatures[fqen] = {\n\t\t\t\temitPayloadSchema: buildEmitTargetAndPayloadSchema({\n\t\t\t\t\teventName,\n\t\t\t\t\tpayloadSchema: imported.emitPayload,\n\t\t\t\t\ttargetSchema: imported.emitTarget,\n\t\t\t\t}),\n\t\t\t\tresponsePayloadSchema: imported.responsePayload,\n\t\t\t\temitPermissionContract: imported.emitPermissions,\n\t\t\t\tlistenPermissionContract: imported.listenPermissions,\n\t\t\t\t...imported.options,\n\t\t\t}\n\t\t})\n\n\t\tdidUpdateHandler?.(\n\t\t\t`Loaded ${Object.keys(eventSignatures).length} local event signatures...`\n\t\t)\n\n\t\tif (Object.keys(eventSignatures).length > 0) {\n\t\t\tconst cleaned = eventContractCleanerUtil.cleanPayloadsAndPermissions({\n\t\t\t\teventSignatures,\n\t\t\t})\n\n\t\t\tvalidateEventContract(cleaned)\n\n\t\t\tEventStore.localEventCache = cleaned\n\n\t\t\treturn cleaned\n\t\t}\n\n\t\treturn null\n\t}\n\n\tpublic async registerEventContract(options: {\n\t\teventContract: EventContract\n\t}) {\n\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\tconst results = await client.emit('register-events::v2020_12_25', {\n\t\t\tpayload: {\n\t\t\t\tcontract: options.eventContract,\n\t\t\t},\n\t\t})\n\n\t\teventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\tEventStore.contractCache = {}\n\n\t\treturn results\n\t}\n\n\tpublic async unRegisterEvents(\n\t\toptions: SpruceSchemas.Mercury.v2020_12_25.UnregisterEventsEmitPayload\n\t) {\n\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\tconst results = await client.emit('unregister-events::v2020_12_25', {\n\t\t\tpayload: options,\n\t\t})\n\n\t\teventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\tEventStore.contractCache = {}\n\t}\n}\n"],"file":"EventStore.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/event/stores/EventStore.ts"],"names":["eventFileNamesImportKeyMap","key","isSchema","EventStore","options","localNamespace","didUpdateHandler","namespaces","fetchRemoteContracts","contracts","error","responseErrors","loadLocalContract","localContract","filterOutLocalEventsFromRemoteContractsMutating","push","errors","join","contractCache","connectToApi","shouldAuthAsCurrentSkill","client","emit","target","results","eventResponseUtil","getFirstResponseOrThrow","remoteContracts","ns","namesUtil","toKebab","contract","sigs","eventContractUtil","getNamedEventSignatures","sig","eventNamespace","eventSignatures","fullyQualifiedEventName","localEventCache","diskUtil","resolvePath","cwd","localMatches","filesByFqenAndEventKey","length","Promise","all","map","match","eventDiskUtil","splitPathToEvent","eventName","version","fqen","eventNameUtil","filename","pathUtil","basename","eventKey","SpruceError","code","brokenProperty","originalError","matches","o","Service","bulkImport","importsInOrder","importsByName","idx","imported","Object","keys","forEach","split","emitPayloadSchema","payloadSchema","emitPayload","targetSchema","emitTarget","responsePayloadSchema","responsePayload","emitPermissionContract","emitPermissions","listenPermissionContract","listenPermissions","cleaned","eventContractCleanerUtil","cleanPayloadsAndPermissions","payload","eventContract","undefined","AbstractStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAOA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;AAwBA,IAAMA,0BAA0B,GAAG;AAClC,sBAAoB;AAAEC,IAAAA,GAAG,EAAE,SAAP;AAAkBC,IAAAA,QAAQ,EAAE;AAA5B,GADc;AAElC,4BAA0B;AAAED,IAAAA,GAAG,EAAE,aAAP;AAAsBC,IAAAA,QAAQ,EAAE;AAAhC,GAFQ;AAGlC,2BAAyB;AAAED,IAAAA,GAAG,EAAE,YAAP;AAAqBC,IAAAA,QAAQ,EAAE;AAA/B,GAHS;AAIlC,gCAA8B;AAAED,IAAAA,GAAG,EAAE,iBAAP;AAA0BC,IAAAA,QAAQ,EAAE;AAApC,GAJI;AAKlC,gCAA8B;AAAED,IAAAA,GAAG,EAAE,iBAAP;AAA0BC,IAAAA,QAAQ,EAAE;AAApC,GALI;AAMlC,kCAAgC;AAAED,IAAAA,GAAG,EAAE,mBAAP;AAA4BC,IAAAA,QAAQ,EAAE;AAAtC;AANE,CAAnC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D0D,iBAA9C,CALvB;;AAAA;AAKOoB,gBAAAA,OALP;;AASCC,oDAAkBC,uBAAlB,CAA0CF,OAA1C;;AAEArB,gBAAAA,UAAU,CAACe,aAAX,GAA2B,EAA3B;;AAXD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WA1OA,sBAA2B;AAC1Bf,MAAAA,UAAU,CAACoC,eAAX,GAA6BqD,SAA7B;AACAzF,MAAAA,UAAU,CAACe,aAAX,GAA2B,EAA3B;AACA;;;EARsC2E,0B;;;iCAAnB1F,U,mBAEkC,E;iCAFlCA,U","sourcesContent":["import pathUtil from 'path'\nimport {\n\tEventContract,\n\tEventSignature,\n\tPermissionContract,\n\tSpruceSchemas,\n\tvalidateEventContract,\n} from '@sprucelabs/mercury-types'\nimport { Schema, validateSchema } from '@sprucelabs/schema'\nimport {\n\teventResponseUtil,\n\teventDiskUtil,\n\teventNameUtil,\n\tbuildEmitTargetAndPayloadSchema,\n\teventContractUtil,\n} from '@sprucelabs/spruce-event-utils'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport globby from 'globby'\nimport { cloneDeep } from 'lodash'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractStore from '../../../stores/AbstractStore'\nimport { InternalUpdateHandler } from '../../../types/cli.types'\nimport { eventContractCleanerUtil } from '../../../utilities/eventContractCleaner.utility'\n\nexport interface EventStoreFetchEventContractsResponse {\n\terrors: SpruceError[]\n\tcontracts: EventContract[]\n}\n\ntype Options = Omit<\n\tEventSignature,\n\t| 'responsePayloadSchema'\n\t| 'emitPayloadSchema'\n\t| 'listenPermissionContract'\n\t| 'emitPermissionContract'\n>\n\ninterface EventImport {\n\toptions?: Options\n\temitPayload?: Schema\n\temitTarget?: Schema\n\tresponsePayload?: Schema\n\temitPermissions?: PermissionContract\n\tlistenPermissions?: PermissionContract\n}\n\nconst eventFileNamesImportKeyMap = {\n\t'event.options.ts': { key: 'options', isSchema: false },\n\t'emitPayload.builder.ts': { key: 'emitPayload', isSchema: true },\n\t'emitTarget.builder.ts': { key: 'emitTarget', isSchema: true },\n\t'responsePayload.builder.ts': { key: 'responsePayload', isSchema: true },\n\t'emitPermissions.builder.ts': { key: 'emitPermissions', isSchema: false },\n\t'listenPermissions.builder.ts': { key: 'listenPermissions', isSchema: false },\n}\n\nexport default class EventStore extends AbstractStore {\n\tpublic name = 'event'\n\tprotected static contractCache: Record<string, any> = {}\n\tprivate static localEventCache?: SpruceSchemas.Mercury.v2020_12_25.EventContract\n\n\tpublic static clearCache() {\n\t\tEventStore.localEventCache = undefined\n\t\tEventStore.contractCache = {}\n\t}\n\n\tpublic async fetchEventContracts(options?: {\n\t\tlocalNamespace?: string\n\t\tnamespaces?: string[]\n\t\tdidUpdateHandler?: InternalUpdateHandler\n\t}): Promise<EventStoreFetchEventContractsResponse> {\n\t\tconst { localNamespace, didUpdateHandler, namespaces } = options ?? {}\n\n\t\tdidUpdateHandler?.('Pulling remote contracts...')\n\n\t\tlet contracts\n\t\ttry {\n\t\t\tcontracts = await this.fetchRemoteContracts(namespaces)\n\t\t} catch (err: any) {\n\t\t\tconst error = err.options.responseErrors[0]\n\t\t\tthrow error\n\t\t}\n\n\t\tconst localContract =\n\t\t\tlocalNamespace &&\n\t\t\t(await this.loadLocalContract(localNamespace, didUpdateHandler))\n\n\t\tif (localNamespace) {\n\t\t\tthis.filterOutLocalEventsFromRemoteContractsMutating(\n\t\t\t\tcontracts,\n\t\t\t\tlocalNamespace\n\t\t\t)\n\t\t}\n\n\t\tif (localContract) {\n\t\t\tcontracts.push(localContract)\n\t\t}\n\n\t\treturn {\n\t\t\tcontracts,\n\t\t\terrors: [],\n\t\t}\n\t}\n\n\tprivate async fetchRemoteContracts(namespaces?: string[]) {\n\t\tconst key = namespaces?.join('|') ?? '_'\n\n\t\tif (!EventStore.contractCache[key]) {\n\t\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\t\tconst results = await client.emit('get-event-contracts::v2020_12_25', {\n\t\t\t\ttarget: {\n\t\t\t\t\tnamespaces,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { contracts } = eventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\t\tEventStore.contractCache[key] = contracts\n\t\t}\n\n\t\treturn cloneDeep(EventStore.contractCache[key])\n\t}\n\n\tprivate filterOutLocalEventsFromRemoteContractsMutating(\n\t\tremoteContracts: EventContract[],\n\t\tlocalNamespace: string\n\t) {\n\t\tconst ns = namesUtil.toKebab(localNamespace)\n\n\t\tfor (const contract of remoteContracts) {\n\t\t\tconst sigs = eventContractUtil.getNamedEventSignatures(contract)\n\t\t\tfor (const sig of sigs) {\n\t\t\t\tif (sig.eventNamespace === ns) {\n\t\t\t\t\tdelete contract.eventSignatures[sig.fullyQualifiedEventName]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async loadLocalContract(\n\t\tlocalNamespace: string,\n\t\tdidUpdateHandler?: InternalUpdateHandler\n\t): Promise<EventContract | null> {\n\t\tif (EventStore.localEventCache) {\n\t\t\treturn EventStore.localEventCache\n\t\t}\n\n\t\tconst localMatches = await globby(\n\t\t\tdiskUtil.resolvePath(\n\t\t\t\tthis.cwd,\n\t\t\t\t'src',\n\t\t\t\t'events',\n\t\t\t\t'**/*.(builder|options).ts'\n\t\t\t)\n\t\t)\n\n\t\tconst ns = namesUtil.toKebab(localNamespace)\n\t\tconst eventSignatures: Record<string, EventSignature> = {}\n\t\tconst filesByFqenAndEventKey: {\n\t\t\tfqen: string\n\t\t\tisSchema: boolean\n\t\t\tmatch: string\n\t\t\teventKey: string\n\t\t}[] = []\n\n\t\tdidUpdateHandler?.(\n\t\t\t`Importing ${localMatches.length} local event signature files...`\n\t\t)\n\n\t\tawait Promise.all(\n\t\t\tlocalMatches.map(async (match) => {\n\t\t\t\tlet fqen: string | undefined\n\t\t\t\tlet eventKey: keyof EventImport | undefined\n\n\t\t\t\ttry {\n\t\t\t\t\tconst { eventName, version } = eventDiskUtil.splitPathToEvent(match)\n\t\t\t\t\tfqen = eventNameUtil.join({\n\t\t\t\t\t\teventName,\n\t\t\t\t\t\tversion,\n\t\t\t\t\t\teventNamespace: ns,\n\t\t\t\t\t})\n\n\t\t\t\t\tconst filename = pathUtil.basename(\n\t\t\t\t\t\tmatch\n\t\t\t\t\t) as keyof typeof eventFileNamesImportKeyMap\n\n\t\t\t\t\tconst map = eventFileNamesImportKeyMap[filename]\n\n\t\t\t\t\tif (map) {\n\t\t\t\t\t\t//@ts-ignore\n\t\t\t\t\t\teventKey = map.key\n\n\t\t\t\t\t\tfilesByFqenAndEventKey.push({\n\t\t\t\t\t\t\tfqen,\n\t\t\t\t\t\t\tisSchema: map.isSchema,\n\t\t\t\t\t\t\tmatch,\n\t\t\t\t\t\t\teventKey: eventKey as string,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} catch (err: any) {\n\t\t\t\t\tthrow new SpruceError({\n\t\t\t\t\t\tcode: 'INVALID_EVENT_CONTRACT',\n\t\t\t\t\t\tfullyQualifiedEventName: fqen ?? 'Bad event name',\n\t\t\t\t\t\tbrokenProperty: eventKey ?? '*** major failure ***',\n\t\t\t\t\t\toriginalError: err,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t)\n\n\t\tconst matches = filesByFqenAndEventKey.map((o) => o.match)\n\t\tconst importsInOrder = (await this.Service('import').bulkImport(\n\t\t\tmatches\n\t\t)) as Record<string, any>[]\n\t\tconst importsByName: Record<string, EventImport> = {}\n\n\t\tfor (let idx = 0; idx < filesByFqenAndEventKey.length; idx++) {\n\t\t\tconst imported = importsInOrder[idx]\n\t\t\tconst { fqen, eventKey, isSchema } = filesByFqenAndEventKey[idx]\n\n\t\t\tif (isSchema) {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateSchema(imported)\n\t\t\t\t} catch (err: any) {\n\t\t\t\t\tthrow new SpruceError({\n\t\t\t\t\t\tcode: 'INVALID_EVENT_CONTRACT',\n\t\t\t\t\t\tfullyQualifiedEventName: fqen,\n\t\t\t\t\t\tbrokenProperty: eventKey,\n\t\t\t\t\t\toriginalError: err,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!importsByName[fqen]) {\n\t\t\t\timportsByName[fqen] = {}\n\t\t\t}\n\n\t\t\t//@ts-ignore\n\t\t\timportsByName[fqen][eventKey] = imported\n\t\t}\n\n\t\tObject.keys(importsByName).forEach((fqen) => {\n\t\t\tconst imported = importsByName[fqen]\n\t\t\tconst { eventName } = eventNameUtil.split(fqen)\n\t\t\teventSignatures[fqen] = {\n\t\t\t\temitPayloadSchema: buildEmitTargetAndPayloadSchema({\n\t\t\t\t\teventName,\n\t\t\t\t\tpayloadSchema: imported.emitPayload,\n\t\t\t\t\ttargetSchema: imported.emitTarget,\n\t\t\t\t}),\n\t\t\t\tresponsePayloadSchema: imported.responsePayload,\n\t\t\t\temitPermissionContract: imported.emitPermissions,\n\t\t\t\tlistenPermissionContract: imported.listenPermissions,\n\t\t\t\t...imported.options,\n\t\t\t}\n\t\t})\n\n\t\tdidUpdateHandler?.(\n\t\t\t`Loaded ${Object.keys(eventSignatures).length} local event signatures...`\n\t\t)\n\n\t\tif (Object.keys(eventSignatures).length > 0) {\n\t\t\tconst cleaned = eventContractCleanerUtil.cleanPayloadsAndPermissions({\n\t\t\t\teventSignatures,\n\t\t\t})\n\n\t\t\tvalidateEventContract(cleaned)\n\n\t\t\tEventStore.localEventCache = cleaned\n\n\t\t\treturn cleaned\n\t\t}\n\n\t\treturn null\n\t}\n\n\tpublic async registerEventContract(options: {\n\t\teventContract: EventContract\n\t}) {\n\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\tconst results = await client.emit('register-events::v2020_12_25', {\n\t\t\tpayload: {\n\t\t\t\tcontract: options.eventContract,\n\t\t\t},\n\t\t})\n\n\t\teventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\tEventStore.contractCache = {}\n\n\t\treturn results\n\t}\n\n\tpublic async unRegisterEvents(\n\t\toptions: SpruceSchemas.Mercury.v2020_12_25.UnregisterEventsEmitPayload\n\t) {\n\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\tconst results = await client.emit('unregister-events::v2020_12_25', {\n\t\t\tpayload: options,\n\t\t})\n\n\t\teventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\tEventStore.contractCache = {}\n\t}\n}\n"],"file":"EventStore.js"}
|
|
@@ -49,6 +49,7 @@ export default class NodeFeature<S extends OptionsSchema = OptionsSchema> extend
|
|
|
49
49
|
readonly fileDescriptions: FileDescription[];
|
|
50
50
|
actionsDir: string;
|
|
51
51
|
constructor(options: ActionOptions);
|
|
52
|
+
private handleUpgrade;
|
|
52
53
|
beforePackageInstall(options: Options): Promise<{
|
|
53
54
|
files: SpruceSchemas.SpruceCli.v2020_07_22.GeneratedFile[];
|
|
54
55
|
cwd: string;
|
|
@@ -89,50 +89,21 @@ var NodeFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
89
89
|
switch (_context2.prev = _context2.next) {
|
|
90
90
|
case 0:
|
|
91
91
|
if (!(payload.featureCode === 'node' && payload.actionCode === 'upgrade')) {
|
|
92
|
-
_context2.next =
|
|
92
|
+
_context2.next = 2;
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
_context2.
|
|
96
|
+
return _context2.abrupt("return", _this.handleUpgrade());
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
_context2.next = 5;
|
|
101
|
-
return _this.Service('command').execute('yarn clean.build');
|
|
102
|
-
|
|
103
|
-
case 5:
|
|
104
|
-
_this.ui.startLoading('Applying lint rules to all files...');
|
|
105
|
-
|
|
106
|
-
_context2.next = 8;
|
|
107
|
-
return _this.Service('command').execute('yarn fix.lint');
|
|
108
|
-
|
|
109
|
-
case 8:
|
|
110
|
-
_this.ui.startLoading('Rebuilding...');
|
|
111
|
-
|
|
112
|
-
_context2.next = 11;
|
|
113
|
-
return _this.Service('command').execute('yarn build.dev');
|
|
114
|
-
|
|
115
|
-
case 11:
|
|
116
|
-
return _context2.abrupt("return", {
|
|
117
|
-
summaryLines: ['Build cleared.', 'Lint rules applied to source.', 'Code rebuilt successfully.']
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
case 14:
|
|
121
|
-
_context2.prev = 14;
|
|
122
|
-
_context2.t0 = _context2["catch"](1);
|
|
123
|
-
return _context2.abrupt("return", {
|
|
124
|
-
errors: [_context2.t0]
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
case 17:
|
|
98
|
+
case 2:
|
|
128
99
|
return _context2.abrupt("return", {});
|
|
129
100
|
|
|
130
|
-
case
|
|
101
|
+
case 3:
|
|
131
102
|
case "end":
|
|
132
103
|
return _context2.stop();
|
|
133
104
|
}
|
|
134
105
|
}
|
|
135
|
-
}, _callee2
|
|
106
|
+
}, _callee2);
|
|
136
107
|
}));
|
|
137
108
|
|
|
138
109
|
return function (_x) {
|
|
@@ -143,13 +114,62 @@ var NodeFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
143
114
|
}
|
|
144
115
|
|
|
145
116
|
(0, _createClass2["default"])(NodeFeature, [{
|
|
146
|
-
key: "
|
|
117
|
+
key: "handleUpgrade",
|
|
147
118
|
value: function () {
|
|
148
|
-
var
|
|
149
|
-
var destination, files, nodeWriter, written;
|
|
119
|
+
var _handleUpgrade = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
150
120
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
151
121
|
while (1) {
|
|
152
122
|
switch (_context3.prev = _context3.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
_context3.prev = 0;
|
|
125
|
+
this.ui.startLoading('Cleaning build...');
|
|
126
|
+
_context3.next = 4;
|
|
127
|
+
return this.Service('command').execute('yarn clean.build');
|
|
128
|
+
|
|
129
|
+
case 4:
|
|
130
|
+
this.ui.startLoading('Applying lint rules to all files...');
|
|
131
|
+
_context3.next = 7;
|
|
132
|
+
return this.Service('command').execute('yarn fix.lint');
|
|
133
|
+
|
|
134
|
+
case 7:
|
|
135
|
+
this.ui.startLoading('Rebuilding...');
|
|
136
|
+
_context3.next = 10;
|
|
137
|
+
return this.Service('command').execute('yarn build.dev');
|
|
138
|
+
|
|
139
|
+
case 10:
|
|
140
|
+
return _context3.abrupt("return", {
|
|
141
|
+
summaryLines: ['Build cleared.', 'Lint rules applied to source.', 'Code rebuilt successfully.']
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
case 13:
|
|
145
|
+
_context3.prev = 13;
|
|
146
|
+
_context3.t0 = _context3["catch"](0);
|
|
147
|
+
return _context3.abrupt("return", {
|
|
148
|
+
errors: [_context3.t0]
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
case 16:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context3.stop();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, _callee3, this, [[0, 13]]);
|
|
157
|
+
}));
|
|
158
|
+
|
|
159
|
+
function handleUpgrade() {
|
|
160
|
+
return _handleUpgrade.apply(this, arguments);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return handleUpgrade;
|
|
164
|
+
}()
|
|
165
|
+
}, {
|
|
166
|
+
key: "beforePackageInstall",
|
|
167
|
+
value: function () {
|
|
168
|
+
var _beforePackageInstall = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(options) {
|
|
169
|
+
var destination, files, written;
|
|
170
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
171
|
+
while (1) {
|
|
172
|
+
switch (_context4.prev = _context4.next) {
|
|
153
173
|
case 0:
|
|
154
174
|
destination = this.resolveDestination(options);
|
|
155
175
|
|
|
@@ -162,32 +182,31 @@ var NodeFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
162
182
|
path: _spruceSkillUtils.diskUtil.resolvePath(destination, 'package.json'),
|
|
163
183
|
action: 'generated'
|
|
164
184
|
}];
|
|
165
|
-
|
|
185
|
+
_context4.next = 5;
|
|
166
186
|
return this.Service('command', destination).execute('yarn init -y');
|
|
167
187
|
|
|
168
188
|
case 5:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return nodeWriter.writeNodeModule(destination);
|
|
189
|
+
_context4.next = 7;
|
|
190
|
+
return this.Writer('node').writeNodeModule(destination);
|
|
172
191
|
|
|
173
|
-
case
|
|
174
|
-
written =
|
|
192
|
+
case 7:
|
|
193
|
+
written = _context4.sent;
|
|
175
194
|
files.push.apply(files, (0, _toConsumableArray2["default"])(written));
|
|
176
|
-
|
|
195
|
+
_context4.next = 11;
|
|
177
196
|
return this.installScripts(destination);
|
|
178
197
|
|
|
179
|
-
case
|
|
180
|
-
return
|
|
198
|
+
case 11:
|
|
199
|
+
return _context4.abrupt("return", {
|
|
181
200
|
files: files,
|
|
182
201
|
cwd: destination
|
|
183
202
|
});
|
|
184
203
|
|
|
185
|
-
case
|
|
204
|
+
case 12:
|
|
186
205
|
case "end":
|
|
187
|
-
return
|
|
206
|
+
return _context4.stop();
|
|
188
207
|
}
|
|
189
208
|
}
|
|
190
|
-
},
|
|
209
|
+
}, _callee4, this);
|
|
191
210
|
}));
|
|
192
211
|
|
|
193
212
|
function beforePackageInstall(_x2) {
|
|
@@ -206,11 +225,11 @@ var NodeFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
206
225
|
}, {
|
|
207
226
|
key: "afterPackageInstall",
|
|
208
227
|
value: function () {
|
|
209
|
-
var _afterPackageInstall = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
228
|
+
var _afterPackageInstall = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(options) {
|
|
210
229
|
var cwd, pkg;
|
|
211
|
-
return _regenerator["default"].wrap(function
|
|
230
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
212
231
|
while (1) {
|
|
213
|
-
switch (
|
|
232
|
+
switch (_context5.prev = _context5.next) {
|
|
214
233
|
case 0:
|
|
215
234
|
cwd = this.resolveDestination(options);
|
|
216
235
|
pkg = this.Service('pkg', cwd);
|
|
@@ -228,20 +247,20 @@ var NodeFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
228
247
|
});
|
|
229
248
|
pkg.unset('main');
|
|
230
249
|
pkg.unset('license');
|
|
231
|
-
|
|
250
|
+
_context5.next = 9;
|
|
232
251
|
return this.Store('skill', {
|
|
233
252
|
cwd: cwd
|
|
234
253
|
}).setCurrentSkillsNamespace(options.name);
|
|
235
254
|
|
|
236
255
|
case 9:
|
|
237
|
-
return
|
|
256
|
+
return _context5.abrupt("return", {});
|
|
238
257
|
|
|
239
258
|
case 10:
|
|
240
259
|
case "end":
|
|
241
|
-
return
|
|
260
|
+
return _context5.stop();
|
|
242
261
|
}
|
|
243
262
|
}
|
|
244
|
-
},
|
|
263
|
+
}, _callee5, this);
|
|
245
264
|
}));
|
|
246
265
|
|
|
247
266
|
function afterPackageInstall(_x3) {
|
|
@@ -253,27 +272,27 @@ var NodeFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
253
272
|
}, {
|
|
254
273
|
key: "installScripts",
|
|
255
274
|
value: function () {
|
|
256
|
-
var _installScripts = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
275
|
+
var _installScripts = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
257
276
|
var destination,
|
|
258
277
|
scriptUpdater,
|
|
259
|
-
|
|
260
|
-
return _regenerator["default"].wrap(function
|
|
278
|
+
_args6 = arguments;
|
|
279
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
261
280
|
while (1) {
|
|
262
|
-
switch (
|
|
281
|
+
switch (_context6.prev = _context6.next) {
|
|
263
282
|
case 0:
|
|
264
|
-
destination =
|
|
283
|
+
destination = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : this.cwd;
|
|
265
284
|
scriptUpdater = _ScriptUpdater["default"].FromFeature(this, {
|
|
266
285
|
cwd: destination
|
|
267
286
|
});
|
|
268
|
-
|
|
287
|
+
_context6.next = 4;
|
|
269
288
|
return scriptUpdater.update();
|
|
270
289
|
|
|
271
290
|
case 4:
|
|
272
291
|
case "end":
|
|
273
|
-
return
|
|
292
|
+
return _context6.stop();
|
|
274
293
|
}
|
|
275
294
|
}
|
|
276
|
-
},
|
|
295
|
+
}, _callee6, this);
|
|
277
296
|
}));
|
|
278
297
|
|
|
279
298
|
function installScripts() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/node/NodeFeature.ts"],"names":["NodeFeature","options","nodeFeatureOptionsSchema","universalDevDependencies","universalScripts","universalFileDescriptions","diskUtil","resolvePath","__dirname","doesFileExist","cwd","emitter","on","payload","featureCode","actionCode","ui","startLoading","Service","execute","summaryLines","errors","destination","resolveDestination","doesDirExist","createDir","files","name","path","action","
|
|
1
|
+
{"version":3,"sources":["../../../src/features/node/NodeFeature.ts"],"names":["NodeFeature","options","nodeFeatureOptionsSchema","universalDevDependencies","universalScripts","universalFileDescriptions","diskUtil","resolvePath","__dirname","doesFileExist","cwd","emitter","on","payload","featureCode","actionCode","handleUpgrade","ui","startLoading","Service","execute","summaryLines","errors","destination","resolveDestination","doesDirExist","createDir","files","name","path","action","Writer","writeNodeModule","written","push","installScripts","pkg","set","value","namesUtil","toKebab","description","unset","Store","setCurrentSkillsNamespace","scriptUpdater","ScriptUpdater","FromFeature","update","AbstractFeature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AAEA;;AACA;;AAMA;;AACA;;AACA;;;;;;;;;;IAgBqBA,W;;;;;AAoBpB,uBAAmBC,OAAnB,EAA2C;AAAA;;AAAA;AAC1C,8BAAMA,OAAN;AAD0C,6FAjBhB,MAiBgB;AAAA,qGAhBrB,gBAgBqB;AAAA,oGA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AAA;AAAA;AAAA,O;;;;;;;;;;EAtGSC,4B","sourcesContent":["import { Schema, SchemaValues } from '@sprucelabs/schema'\nimport { SpruceSchemas } from '@sprucelabs/spruce-core-schemas'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport nodeFeatureOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/nodeFeatureOptions.schema'\nimport { FileDescription, GeneratedFile } from '../../types/cli.types'\nimport ScriptUpdater from '../../updaters/ScriptUpdater'\nimport AbstractFeature, { FeatureDependency } from '../AbstractFeature'\nimport {\n\tActionOptions,\n\tFeatureActionResponse,\n\tFeatureCode,\n} from '../features.types'\nimport universalDevDependencies from '../universalDevDependencies'\nimport universalFileDescriptions from '../universalFileDescriptions'\nimport universalScripts from '../universalScripts'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptions\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tnode: NodeFeature\n\t}\n\n\tinterface FeatureOptionsMap {\n\t\tnode: SchemaValues<OptionsSchema>\n\t}\n}\n\nexport default class NodeFeature<\n\tS extends OptionsSchema = OptionsSchema\n> extends AbstractFeature<S> {\n\tpublic code: FeatureCode = 'node'\n\tpublic nameReadable = 'nodejs support'\n\tpublic description = ''\n\tpublic dependencies: FeatureDependency[] = []\n\tpublic optionsSchema = nodeFeatureOptionsSchema as S\n\tpublic packageDependencies = [...universalDevDependencies]\n\n\tpublic scripts = {\n\t\t...universalScripts,\n\t}\n\n\tpublic readonly fileDescriptions: FileDescription[] = [\n\t\t...universalFileDescriptions,\n\t]\n\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\n\t\tvoid this.emitter.on('feature.did-execute', async (payload) => {\n\t\t\tif (payload.featureCode === 'node' && payload.actionCode === 'upgrade') {\n\t\t\t\treturn this.handleUpgrade()\n\t\t\t}\n\n\t\t\treturn {}\n\t\t})\n\t}\n\tprivate async handleUpgrade(): Promise<FeatureActionResponse> {\n\t\ttry {\n\t\t\tthis.ui.startLoading('Cleaning build...')\n\t\t\tawait this.Service('command').execute('yarn clean.build')\n\n\t\t\tthis.ui.startLoading('Applying lint rules to all files...')\n\t\t\tawait this.Service('command').execute('yarn fix.lint')\n\n\t\t\tthis.ui.startLoading('Rebuilding...')\n\t\t\tawait this.Service('command').execute('yarn build.dev')\n\n\t\t\treturn {\n\t\t\t\tsummaryLines: [\n\t\t\t\t\t'Build cleared.',\n\t\t\t\t\t'Lint rules applied to source.',\n\t\t\t\t\t'Code rebuilt successfully.',\n\t\t\t\t],\n\t\t\t}\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\terrors: [err],\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async beforePackageInstall(options: Options) {\n\t\tconst destination = this.resolveDestination(options)\n\n\t\tif (!diskUtil.doesDirExist(destination)) {\n\t\t\tdiskUtil.createDir(destination)\n\t\t}\n\n\t\tconst files: GeneratedFile[] = [\n\t\t\t{\n\t\t\t\tname: 'package.json',\n\t\t\t\tpath: diskUtil.resolvePath(destination, 'package.json'),\n\t\t\t\taction: 'generated',\n\t\t\t},\n\t\t]\n\n\t\tawait this.Service('command', destination).execute('yarn init -y')\n\n\t\tconst written = await this.Writer('node').writeNodeModule(destination)\n\n\t\tfiles.push(...written)\n\n\t\tawait this.installScripts(destination)\n\n\t\treturn { files, cwd: destination }\n\t}\n\n\tprivate resolveDestination(options: Options) {\n\t\treturn diskUtil.resolvePath(this.cwd, options.destination ?? '')\n\t}\n\n\tpublic async afterPackageInstall(\n\t\toptions: S extends Schema ? SchemaValues<S> : undefined\n\t) {\n\t\tconst cwd = this.resolveDestination(options)\n\t\tconst pkg = this.Service('pkg', cwd)\n\n\t\tpkg.set({ path: 'name', value: namesUtil.toKebab(options.name) })\n\t\tpkg.set({ path: 'description', value: options.description })\n\t\tpkg.set({ path: 'version', value: '0.0.1' })\n\n\t\tpkg.unset('main')\n\t\tpkg.unset('license')\n\n\t\tawait this.Store('skill', { cwd }).setCurrentSkillsNamespace(options.name)\n\n\t\treturn {}\n\t}\n\n\tprivate async installScripts(destination = this.cwd) {\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this, {\n\t\t\tcwd: destination,\n\t\t})\n\n\t\tawait scriptUpdater.update()\n\t}\n\n\tpublic isInstalled = async (): Promise<boolean> => {\n\t\treturn diskUtil.doesFileExist(\n\t\t\tdiskUtil.resolvePath(this.cwd, 'package.json')\n\t\t)\n\t}\n}\n"],"file":"NodeFeature.js"}
|
|
@@ -74,7 +74,7 @@ var UpgradeAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
74
74
|
key: "execute",
|
|
75
75
|
value: function () {
|
|
76
76
|
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
77
|
-
var normalizedOptions, dependencyResults;
|
|
77
|
+
var normalizedOptions, files, dependencyResults;
|
|
78
78
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
79
79
|
while (1) {
|
|
80
80
|
switch (_context.prev = _context.next) {
|
|
@@ -87,32 +87,43 @@ var UpgradeAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
87
87
|
|
|
88
88
|
case 3:
|
|
89
89
|
_context.prev = 3;
|
|
90
|
+
_context.next = 6;
|
|
91
|
+
return this.Writer('node', {
|
|
92
|
+
upgradeMode: normalizedOptions.upgradeMode
|
|
93
|
+
}).writeNodeModule(this.cwd, {
|
|
94
|
+
shouldConfirmBeforeWriting: true,
|
|
95
|
+
shouldWriteIndex: false
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
case 6:
|
|
99
|
+
files = _context.sent;
|
|
90
100
|
|
|
91
101
|
_InFlightEntertainment["default"].start(["Let's start the upgrade!", 'While things are going, see if you can beat 1k points!', 'Go!!!!']);
|
|
92
102
|
|
|
93
|
-
_context.next =
|
|
103
|
+
_context.next = 10;
|
|
94
104
|
return this.reInstallPackageDependencies();
|
|
95
105
|
|
|
96
|
-
case
|
|
106
|
+
case 10:
|
|
97
107
|
dependencyResults = _context.sent;
|
|
98
108
|
return _context.abrupt("return", _action["default"].mergeActionResults(dependencyResults, {
|
|
99
|
-
headline: 'Upgrade'
|
|
109
|
+
headline: 'Upgrade',
|
|
110
|
+
files: files
|
|
100
111
|
}));
|
|
101
112
|
|
|
102
|
-
case
|
|
103
|
-
_context.prev =
|
|
113
|
+
case 12:
|
|
114
|
+
_context.prev = 12;
|
|
104
115
|
|
|
105
116
|
_InFlightEntertainment["default"].stop();
|
|
106
117
|
|
|
107
118
|
this.ui.renderHero('Upgrade');
|
|
108
|
-
return _context.finish(
|
|
119
|
+
return _context.finish(12);
|
|
109
120
|
|
|
110
|
-
case
|
|
121
|
+
case 16:
|
|
111
122
|
case "end":
|
|
112
123
|
return _context.stop();
|
|
113
124
|
}
|
|
114
125
|
}
|
|
115
|
-
}, _callee, this, [[3,,
|
|
126
|
+
}, _callee, this, [[3,, 12, 16]]);
|
|
116
127
|
}));
|
|
117
128
|
|
|
118
129
|
function execute(_x) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/node/actions/UpgradeAction.ts"],"names":["UpgradeAction","upgradeSkillActionSchema","options","normalizedOptions","validateAndNormalizeOptions","updateScripts","shouldConfirm","upgradeMode","InFlightEntertainment","start","reInstallPackageDependencies","dependencyResults","actionUtil","mergeActionResults","headline","stop","ui","renderHero","Action","execute","featureInstaller","getInstalledFeatures","features","scripts","feature","scriptUpdater","ScriptUpdater","FromFeature","parent","latestScripts","update","shouldConfirmIfScriptExistsButIsDifferent","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;IAOqBA,a;;;;;;;;;;;;;;;0GACO,4B;sGACJC,+B;uGACC,CAAC,SAAD,EAAY,QAAZ,C;;;;;;;mGAExB,iBAAqBC,OAArB;AAAA;AAAA;AAAA;AAAA;AAAA;AACOC,gBAAAA,iBADP,GAC2B,KAAKC,2BAAL,CAAiCF,OAAjC,CAD3B;AAAA;AAAA,uBAGO,KAAKG,aAAL,CAAmB;AACxBC,kBAAAA,aAAa,EAAEH,iBAAiB,CAACI,WAAlB,KAAkC;AADzB,iBAAnB,CAHP;;AAAA;AAAA;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/node/actions/UpgradeAction.ts"],"names":["UpgradeAction","upgradeSkillActionSchema","options","normalizedOptions","validateAndNormalizeOptions","updateScripts","shouldConfirm","upgradeMode","Writer","writeNodeModule","cwd","shouldConfirmBeforeWriting","shouldWriteIndex","files","InFlightEntertainment","start","reInstallPackageDependencies","dependencyResults","actionUtil","mergeActionResults","headline","stop","ui","renderHero","Action","execute","featureInstaller","getInstalledFeatures","features","scripts","feature","scriptUpdater","ScriptUpdater","FromFeature","parent","latestScripts","update","shouldConfirmIfScriptExistsButIsDifferent","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;IAOqBA,a;;;;;;;;;;;;;;;0GACO,4B;sGACJC,+B;uGACC,CAAC,SAAD,EAAY,QAAZ,C;;;;;;;mGAExB,iBAAqBC,OAArB;AAAA;AAAA;AAAA;AAAA;AAAA;AACOC,gBAAAA,iBADP,GAC2B,KAAKC,2BAAL,CAAiCF,OAAjC,CAD3B;AAAA;AAAA,uBAGO,KAAKG,aAAL,CAAmB;AACxBC,kBAAAA,aAAa,EAAEH,iBAAiB,CAACI,WAAlB,KAAkC;AADzB,iBAAnB,CAHP;;AAAA;AAAA;AAAA;AAAA,uBAQsB,KAAKC,MAAL,CAAY,MAAZ,EAAoB;AACvCD,kBAAAA,WAAW,EAAEJ,iBAAiB,CAACI;AADQ,iBAApB,EAEjBE,eAFiB,CAED,KAAKC,GAFJ,EAES;AA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,uBAgBOE,aAAa,CAACK,MAAd,CAAqB;AAC1BC,kBAAAA,yCAAyC,EAAEnC,OAAO,CAACI;AADzB,iBAArB,CAhBP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EA1C0CgC,2B","sourcesContent":["import { SchemaValues } from '@sprucelabs/schema'\nimport { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport upgradeSkillActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema'\nimport InFlightEntertainment from '../../../InFlightEntertainment'\nimport ScriptUpdater from '../../../updaters/ScriptUpdater'\nimport actionUtil from '../../../utilities/action.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class UpgradeAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Upgrading your skill... 💪'\n\tpublic optionsSchema = upgradeSkillActionSchema\n\tpublic commandAliases = ['upgrade', 'update']\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\n\t\tawait this.updateScripts({\n\t\t\tshouldConfirm: normalizedOptions.upgradeMode !== 'forceEverything',\n\t\t})\n\n\t\ttry {\n\t\t\tconst files = await this.Writer('node', {\n\t\t\t\tupgradeMode: normalizedOptions.upgradeMode,\n\t\t\t}).writeNodeModule(this.cwd, {\n\t\t\t\tshouldConfirmBeforeWriting: true,\n\t\t\t\tshouldWriteIndex: false,\n\t\t\t})\n\n\t\t\tInFlightEntertainment.start([\n\t\t\t\t\"Let's start the upgrade!\",\n\t\t\t\t'While things are going, see if you can beat 1k points!',\n\t\t\t\t'Go!!!!',\n\t\t\t])\n\n\t\t\tconst dependencyResults = await this.reInstallPackageDependencies()\n\n\t\t\treturn actionUtil.mergeActionResults(dependencyResults, {\n\t\t\t\theadline: 'Upgrade',\n\t\t\t\tfiles,\n\t\t\t})\n\t\t} finally {\n\t\t\tInFlightEntertainment.stop()\n\t\t\tthis.ui.renderHero('Upgrade')\n\t\t}\n\t}\n\n\tprivate async reInstallPackageDependencies() {\n\t\treturn this.Action('node', 'updateDependencies').execute({})\n\t}\n\n\tprivate async updateScripts(options: { shouldConfirm: boolean }) {\n\t\tconst features = await this.featureInstaller.getInstalledFeatures()\n\n\t\tlet scripts: Record<string, any> = {}\n\n\t\tfor (const feature of features) {\n\t\t\tscripts = {\n\t\t\t\t...scripts,\n\t\t\t\t...feature.scripts,\n\t\t\t}\n\t\t}\n\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this.parent, {\n\t\t\tlatestScripts: scripts,\n\t\t})\n\n\t\tawait scriptUpdater.update({\n\t\t\tshouldConfirmIfScriptExistsButIsDifferent: options.shouldConfirm,\n\t\t})\n\t}\n}\n"],"file":"UpgradeAction.js"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import AbstractWriter, { WriteResults } from '../../../writers/AbstractWriter';
|
|
1
|
+
import AbstractWriter, { WriteDirectoryTemplateOptions, WriteResults } from '../../../writers/AbstractWriter';
|
|
2
|
+
export declare const NODE_FILES_TO_UPGRADE: string[];
|
|
2
3
|
export default class NodeWriter extends AbstractWriter {
|
|
3
|
-
writeNodeModule(destinationDir: string
|
|
4
|
+
writeNodeModule(destinationDir: string, options?: Partial<WriteDirectoryTemplateOptions> & {
|
|
5
|
+
shouldWriteIndex?: boolean;
|
|
6
|
+
}): Promise<WriteResults>;
|
|
4
7
|
}
|
|
@@ -5,12 +5,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = void 0;
|
|
8
|
+
exports["default"] = exports.NODE_FILES_TO_UPGRADE = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
14
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
17
|
|
|
16
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -29,10 +31,17 @@ var _spruceTemplates = require("@sprucelabs/spruce-templates");
|
|
|
29
31
|
|
|
30
32
|
var _AbstractWriter2 = _interopRequireDefault(require("../../../writers/AbstractWriter"));
|
|
31
33
|
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
37
|
+
|
|
32
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
33
39
|
|
|
34
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
41
|
|
|
42
|
+
var NODE_FILES_TO_UPGRADE = ['tsconfig.json', '.eslintrc.js', '.eslintignore', '.gitignore', '.nvmrc'];
|
|
43
|
+
exports.NODE_FILES_TO_UPGRADE = NODE_FILES_TO_UPGRADE;
|
|
44
|
+
|
|
36
45
|
var NodeWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
37
46
|
(0, _inherits2["default"])(NodeWriter, _AbstractWriter);
|
|
38
47
|
|
|
@@ -46,38 +55,44 @@ var NodeWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
|
46
55
|
(0, _createClass2["default"])(NodeWriter, [{
|
|
47
56
|
key: "writeNodeModule",
|
|
48
57
|
value: function () {
|
|
49
|
-
var _writeNodeModule = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(destinationDir) {
|
|
50
|
-
var contents, destination,
|
|
58
|
+
var _writeNodeModule = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(destinationDir, options) {
|
|
59
|
+
var files, contents, destination, directoryTemplateFiles;
|
|
51
60
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
52
61
|
while (1) {
|
|
53
62
|
switch (_context.prev = _context.next) {
|
|
54
63
|
case 0:
|
|
55
|
-
|
|
56
|
-
destination = _spruceSkillUtils.diskUtil.resolvePath(destinationDir, 'src', 'index.ts');
|
|
64
|
+
files = [];
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
if ((options === null || options === void 0 ? void 0 : options.shouldWriteIndex) !== false) {
|
|
67
|
+
contents = '//exports go here\n';
|
|
68
|
+
destination = _spruceSkillUtils.diskUtil.resolvePath(destinationDir, 'src', 'index.ts');
|
|
59
69
|
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
_spruceSkillUtils.diskUtil.writeFile(destination, contents);
|
|
71
|
+
|
|
72
|
+
files.push({
|
|
73
|
+
name: 'src/index.ts',
|
|
74
|
+
description: 'Placeholder entry file!',
|
|
75
|
+
action: 'generated',
|
|
76
|
+
path: destination
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_context.next = 4;
|
|
81
|
+
return this.writeDirectoryTemplate(_objectSpread({
|
|
62
82
|
destinationDir: destinationDir,
|
|
63
83
|
code: _spruceTemplates.DirectoryTemplateCode.Skill,
|
|
64
|
-
filesToWrite:
|
|
84
|
+
filesToWrite: NODE_FILES_TO_UPGRADE,
|
|
65
85
|
context: {
|
|
66
86
|
name: 'ignored',
|
|
67
87
|
description: 'ignored'
|
|
68
88
|
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
case
|
|
72
|
-
|
|
73
|
-
return _context.abrupt("return", [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
action: 'generated',
|
|
77
|
-
path: destination
|
|
78
|
-
}].concat((0, _toConsumableArray2["default"])(files)));
|
|
79
|
-
|
|
80
|
-
case 7:
|
|
89
|
+
}, options));
|
|
90
|
+
|
|
91
|
+
case 4:
|
|
92
|
+
directoryTemplateFiles = _context.sent;
|
|
93
|
+
return _context.abrupt("return", [].concat(files, (0, _toConsumableArray2["default"])(directoryTemplateFiles)));
|
|
94
|
+
|
|
95
|
+
case 6:
|
|
81
96
|
case "end":
|
|
82
97
|
return _context.stop();
|
|
83
98
|
}
|
|
@@ -85,7 +100,7 @@ var NodeWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
|
85
100
|
}, _callee, this);
|
|
86
101
|
}));
|
|
87
102
|
|
|
88
|
-
function writeNodeModule(_x) {
|
|
103
|
+
function writeNodeModule(_x, _x2) {
|
|
89
104
|
return _writeNodeModule.apply(this, arguments);
|
|
90
105
|
}
|
|
91
106
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/node/writers/NodeWriter.ts"],"names":["NodeWriter","destinationDir","contents","destination","diskUtil","resolvePath","writeFile","
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/node/writers/NodeWriter.ts"],"names":["NODE_FILES_TO_UPGRADE","NodeWriter","destinationDir","options","files","shouldWriteIndex","contents","destination","diskUtil","resolvePath","writeFile","push","name","description","action","path","writeDirectoryTemplate","code","DirectoryTemplateCode","Skill","filesToWrite","context","directoryTemplateFiles","AbstractWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;AAKO,IAAMA,qBAAqB,GAAG,CACpC,eADoC,EAEpC,cAFoC,EAGpC,eAHoC,EAIpC,YAJoC,EAKpC,QALoC,CAA9B;;;IAOcC,U;;;;;;;;;;;;;2GACpB,iBACCC,cADD,EAECC,OAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAMKC,gBAAAA,KANL,GAM8B,EAN9B;;AAOC,oBAAI,CAAAD,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEE,gBAAT,MAA8B,KAAlC,EAAyC;AAClCC,kBAAAA,QADkC,GACvB,qBADuB;AAElCC,kBAAAA,WAFkC,GAEpBC,2BAASC,WAAT,CACnBP,cADmB,EAEnB,KAFmB,EAGnB,UAHmB,CAFoB;;AAOxCM,6CAASE,SAAT,CAAmBH,WAAnB,EAAgCD,QAAhC;;AACAF,kBAAAA,KAAK,CAACO,IAAN,CAAW;AACVC,oBAAAA,IAAI,EAAE,cADI;AAEVC,oBAAAA,WAAW,EAAE,yBAFH;AAGVC,oBAAAA,MAAM,EAAE,WAHE;AAIVC,oBAAAA,IAAI,EAAER;AAJI,mBAAX;AAMA;;AArBF;AAAA,uBAuBsC,KAAKS,sBAAL;AACpCd,kBAAAA,cAAc,EAAdA,cADoC;AAEpCe,kBAAAA,IAAI,EAAEC,uCAAsBC,KAFQ;AAGpCC,kBAAAA,YAAY,EAAEpB,qBAHsB;AAIpCqB,kBAAAA,OAAO,EAAE;AAAET,oBAAAA,IAAI,EAAE,SAAR;AAAmBC,oBAAAA,WAAW,EAAE;AAAhC;AAJ2B,mBAKjCV,OALiC,EAvBtC;;AAAA;AAuBOmB,gBAAAA,sBAvBP;AAAA,2DA+BYlB,KA/BZ,sCA+BsBkB,sBA/BtB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EADuCC,2B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { DirectoryTemplateCode } from '@sprucelabs/spruce-templates'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractWriter, {\n\tWriteDirectoryTemplateOptions,\n\tWriteResults,\n} from '../../../writers/AbstractWriter'\n\nexport const NODE_FILES_TO_UPGRADE = [\n\t'tsconfig.json',\n\t'.eslintrc.js',\n\t'.eslintignore',\n\t'.gitignore',\n\t'.nvmrc',\n]\nexport default class NodeWriter extends AbstractWriter {\n\tpublic async writeNodeModule(\n\t\tdestinationDir: string,\n\t\toptions?: Partial<WriteDirectoryTemplateOptions> & {\n\t\t\tshouldWriteIndex?: boolean\n\t\t}\n\t): Promise<WriteResults> {\n\t\tlet files: GeneratedFile[] = []\n\t\tif (options?.shouldWriteIndex !== false) {\n\t\t\tconst contents = '//exports go here\\n'\n\t\t\tconst destination = diskUtil.resolvePath(\n\t\t\t\tdestinationDir,\n\t\t\t\t'src',\n\t\t\t\t'index.ts'\n\t\t\t)\n\t\t\tdiskUtil.writeFile(destination, contents)\n\t\t\tfiles.push({\n\t\t\t\tname: 'src/index.ts',\n\t\t\t\tdescription: 'Placeholder entry file!',\n\t\t\t\taction: 'generated',\n\t\t\t\tpath: destination,\n\t\t\t})\n\t\t}\n\n\t\tconst directoryTemplateFiles = await this.writeDirectoryTemplate({\n\t\t\tdestinationDir,\n\t\t\tcode: DirectoryTemplateCode.Skill,\n\t\t\tfilesToWrite: NODE_FILES_TO_UPGRADE,\n\t\t\tcontext: { name: 'ignored', description: 'ignored' },\n\t\t\t...options,\n\t\t})\n\n\t\treturn [...files, ...directoryTemplateFiles]\n\t}\n}\n"],"file":"NodeWriter.js"}
|
|
@@ -75,7 +75,7 @@ var SetupAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
75
75
|
createListenerAction = this.Action('event', 'listen');
|
|
76
76
|
_context.next = 3;
|
|
77
77
|
return createListenerAction.execute({
|
|
78
|
-
|
|
78
|
+
namespace: 'skill',
|
|
79
79
|
eventName: 'will-boot'
|
|
80
80
|
});
|
|
81
81
|
|