@sprucelabs/spruce-cli 14.22.10 → 14.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/.spruce/events/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 +19 -19
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/errors/SpruceError.ts"],"names":["SpruceError","options","message","code","args","length","join","friendlyMessage","originalError","stack","name","command","file","pattern","cmd","cwd","stderr","cleanStdErr","stdout","schemaId","destination","featureCode","fileName","testName","errorMessage","split","map","line","errors","responseErrors","errorMessages","err","push","fullyQualifiedEventName","brokenProperty","dependencies","d","hint","namesUtil","toPascal","schemaNamespace","fieldName","JSON","stringify","fieldOptions","replace","trim","AbstractSpruceError"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;IAGqBA,W;;;;;;;;;;;;;AACpB;AACA,+BAAiC;AAAA;;AAChC,UAAQC,OAAR,GAAoB,IAApB,CAAQA,OAAR;AACA,UAAIC,OAAJ;;AAEA,cAAQD,OAAR,aAAQA,OAAR,uBAAQA,OAAO,CAAEE,IAAjB;AACC,aAAK,iBAAL;AACC,cAAI,CAACF,OAAO,CAACG,IAAT,IAAiBH,OAAO,CAACG,IAAR,CAAaC,MAAb,KAAwB,CAA7C,EAAgD;AAC/CH,YAAAA,OAAO,qEAAP;AACA,WAFD,MAEO;AACNA,YAAAA,OAAO,gEAA+CD,OAAO,CAACG,IAAR,CAAaE,IAAb,CACrD,GADqD,CAA/C,MAAP;AAGA;;AACDJ,UAAAA,OAAO,IAAI,8BAAX;AACA;;AAED,aAAK,SAAL;AACCA,UAAAA,OAAO,4BAAGD,OAAO,CAACM,eAAX,yEAA8B,cAArC;;AAEA,cAAIN,OAAO,CAACO,aAAZ,EAA2B;AAAA;;AAC1BN,YAAAA,OAAO,2CACND,OAAO,CAACO,aAAR,CAAsBC,KADhB,yEACyBR,OAAO,CAACO,aAAR,CAAsBE,IAD/C,CAAP;AAGA;;AACD;;AACD,aAAK,iBAAL;AACCR,UAAAA,OAAO,GAAG,EAAV;;AACA,cAAID,OAAO,CAACM,eAAZ,EAA6B;AAC5BL,YAAAA,OAAO,kBAAWD,OAAO,CAACM,eAAnB,CAAP;AACA;;AACD;;AACD,aAAK,yBAAL;AACCL,UAA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AAG,sCAAV;AACA;;AAED,aAAK,iBAAL;AACCA,UAAAA,OAAO,gCAAP;AACA;;AAED,aAAK,sBAAL;AACCA,UAAAA,OAAO,oGAAP;AACA;;AAED,aAAK,iBAAL;AACCA,UAAAA,OAAO,aAAMD,OAAO,CAACU,OAAd,0BAAqCV,OAAO,CAACoC,IAA7C,CAAP;AACA;;AAED,aAAK,mBAAL;AACCnC,UAAAA,OAAO,0DAAmDD,OAAO,CAACS,IAA3D,MAAP;AACA;;AAED,aAAK,cAAL;AACCR,UAAAA,OAAO,gEAAP;AACA;;AAED,aAAK,mBAAL;AACCA,UAAAA,OAAO,GAAG,gDAAV;AACA;;AAED,aAAK,oBAAL;AACCA,UAAAA,OAAO,GAAG,sDAAV;AACA;;AAED,aAAK,sCAAL;AACCA,UAAAA,OAAO,uDAAgDoC,4BAAUC,QAAV,CACtDtC,OAAO,CAACuC,eAD8C,CAAhD,cAEFvC,OAAO,CAACkB,QAFN,iDAGNlB,OAAO,CAACwC,SAHF,qCAIoBC,IAAI,CAACC,SAAL,CAC1B1C,OAAO,CAAC2C,YADkB,CAJpB,sLAAP;AAOA;;AAED,aAAK,kBAAL;AACC1C,UAAAA,OAAO,GAAG,mCAAV;AACA;;AAED,aAAK,0BAAL;AACCA,UAAAA,OAAO,gCAAyBD,OAAO,CAACS,IAAjC,sBAAP;AACA;;AAED;AACCR,UAAAA,OAAO,qHAAP;AApPF;;AAuPA,aAAOA,OAAP;AACA;;;WAED,qBAAoBc,MAApB,EAAoC;AACnC,aAAOA,MAAM,CAAC6B,OAAP,CAAe,wCAAf,EAAyD,EAAzD,EAA6DC,IAA7D,EAAP;AACA;;;EAlQuCC,iB","sourcesContent":["import AbstractSpruceError from '@sprucelabs/error'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport upperFirst from 'lodash/upperFirst'\nimport ErrorOptions from '#spruce/errors/options.types'\n\nexport default class SpruceError extends AbstractSpruceError<ErrorOptions> {\n\t/** An easy to understand version of the errors */\n\tpublic friendlyMessage(): string {\n\t\tconst { options } = this\n\t\tlet message\n\n\t\tswitch (options?.code) {\n\t\t\tcase 'INVALID_COMMAND':\n\t\t\t\tif (!options.args || options.args.length === 0) {\n\t\t\t\t\tmessage = `Hey friend 👋.. I don't support the command you tried.`\n\t\t\t\t} else {\n\t\t\t\t\tmessage = `Hey friend 👋. I don't know the command: ${options.args.join(\n\t\t\t\t\t\t' '\n\t\t\t\t\t)}.`\n\t\t\t\t}\n\t\t\t\tmessage += ' Try running `spruce --help`'\n\t\t\t\tbreak\n\n\t\t\tcase 'GENERIC':\n\t\t\t\tmessage = options.friendlyMessage ?? 'Oh shoot! 🤔'\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\n${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.name\n\t\t\t\t\t}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'NOT_IMPLEMENTED':\n\t\t\t\tmessage = ''\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'COMMAND_NOT_IMPLEMENTED':\n\t\t\t\tmessage = `${options.command} has not yet been implemented. ${\n\t\t\t\t\toptions.args ? `Args: ${options.args.join(', ')}` : ''\n\t\t\t\t}`\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_FAILED_TO_IMPORT':\n\t\t\t\tmessage = `Error importing \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BUILD_FAILED':\n\t\t\t\tmessage = `Build${\n\t\t\t\t\toptions.file ? `ing ${options.file}` : ''\n\t\t\t\t} failed. It looks like you're not running 'yarn watch'. Run it and then run 'spruce all:sync'.`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FAILED_TO_IMPORT':\n\t\t\t\tmessage =\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\t`Failed to import \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'LINT_FAILED':\n\t\t\t\tmessage = `Lint failed on pattern ${options.pattern}.`\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\nOriginal error:${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.message\n\t\t\t\t\t}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'EXECUTING_COMMAND_FAILED':\n\t\t\t\tif (this.originalError && this.originalError.message) {\n\t\t\t\t\tmessage = this.originalError.message + '\\n\\n'\n\t\t\t\t} else {\n\t\t\t\t\tmessage = ''\n\t\t\t\t}\n\t\t\t\tmessage += `Executing command failed '${options.cmd}'.\\n\\n`\n\t\t\t\tif (options.cwd) {\n\t\t\t\t\tmessage += `cwd: ${options.cwd}\\n\\n`\n\t\t\t\t}\n\n\t\t\t\tif (options.stderr) {\n\t\t\t\t\tmessage += this.cleanStdErr(options.stderr) + '\\n\\n'\n\t\t\t\t}\n\n\t\t\t\tif (options.stdout) {\n\t\t\t\t\tmessage += options.stdout\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'CREATE_AUTOLOADER_FAILED':\n\t\t\t\tmessage = 'A Could not create an autoloader just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_EMPTY':\n\t\t\t\tmessage = 'A directory empty just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'FILE_EXISTS':\n\t\t\t\tmessage = 'A fail already exists.'\n\t\t\t\tbreak\n\n\t\t\tcase 'VSCODE_NOT_INSTALLED':\n\t\t\t\tmessage =\n\t\t\t\t\t\"vscode's 'code' is not installed.\\n\\nMac instructions: https://code.visualstudio.com/docs/setup/mac\\n\\nLinux instructions: https://code.visualstudio.com/docs/setup/linux\\n\\nWindows instructions: https://code.visualstudio.com/docs/setup/windows\"\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_EXISTS':\n\t\t\t\tmessage = `A schema called ${options.schemaId} already exists at ${options.destination}`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_ABORTED':\n\t\t\t\tmessage = 'Aborted! See ya later! ✌️'\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_FEATURE_CODE':\n\t\t\t\tmessage = `Oh no! I couldn't find a feature with the code '${options.featureCode}'.`\n\t\t\t\tbreak\n\n\t\t\tcase 'TEST_FAILED':\n\t\t\t\tmessage = `${options.fileName}\\n - ${\n\t\t\t\t\toptions.testName\n\t\t\t\t}\\n\\n${options.errorMessage\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.map((line) => ` ${line}`)\n\t\t\t\t\t.join('\\n')}`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FEATURE_NOT_INSTALLED':\n\t\t\t\tmessage = `\\`${upperFirst(\n\t\t\t\t\toptions.featureCode\n\t\t\t\t)}\\` feature is not installed. Install it first, then try again.`\n\t\t\t\tbreak\n\n\t\t\tcase 'MERCURY_RESPONSE_ERROR': {\n\t\t\t\tconst errors = options.responseErrors\n\t\t\t\tmessage = `Got ${\n\t\t\t\t\terrors.length === 1 ? 'an error' : `${errors.length} errors`\n\t\t\t\t} from the server:\\n\\n`\n\n\t\t\t\tconst errorMessages: string[] = []\n\t\t\t\tfor (const err of errors) {\n\t\t\t\t\terrorMessages.push(err.message)\n\t\t\t\t}\n\n\t\t\t\tmessage += errorMessages.join('\\n')\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'INVALID_TEST_DIRECTORY':\n\t\t\t\tmessage = `You are missing dependencies I need to run tests. Try \\`spruce test.install\\` to reinstall.`\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_NOT_SKILL':\n\t\t\t\tmessage = 'The directory you are in is not a skill!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_REGISTERED':\n\t\t\t\tmessage = `Dang! I can't continue until you register your skill! Run \\`spruce login\\` and then \\`spruce register.skill\\` to get the ball rolling!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_ORGANIZATIONS_FOUND':\n\t\t\t\tmessage =\n\t\t\t\t\t\"It looks like you don't have any organizations setup yet. Try `spruce create.organization` first.\"\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_EVENT_CONTRACT':\n\t\t\t\tmessage = `The event named \\`${options.fullyQualifiedEventName}\\` is not valid. Check ${options.brokenProperty}. The original error is:\\n\\n${options.originalError?.message}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BOOT_ERROR':\n\t\t\t\tmessage = `Booting your skill failed: ${\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\toptions.originalError?.message ??\n\t\t\t\t\t'Not sure why, tho.'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'DEPLOY_FAILED':\n\t\t\t\tmessage = 'Deploy halted!'\n\t\t\t\tbreak\n\n\t\t\tcase 'MISSING_DEPENDENCIES':\n\t\t\t\tmessage = `Looks like you're missing some dependencies:\\n\\n${options.dependencies\n\t\t\t\t\t.map((d) => `${d.name}: ${d.hint}`)\n\t\t\t\t\t.join('\\n')}`\n\t\t\t\tbreak\n\n\t\t\tcase 'STORE_EXISTS':\n\t\t\t\tmessage = 'A Store exists just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'NOT_LOGGED_IN':\n\t\t\t\tmessage = 'You have to be logged in to do that!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_FOUND':\n\t\t\t\tmessage = `I couldn't find that skill!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_SKILLS_REGISTERED':\n\t\t\t\tmessage = `Whoa! Looks like you haven't registered your skill yet! Try \\`spruce register\\` to get that done!`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_BLOCKED':\n\t\t\t\tmessage = `${options.command} is blocked! ${options.hint}`\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_VIEW_EXISTS':\n\t\t\t\tmessage = `A skill view controller already exists named ${options.name}!`\n\t\t\t\tbreak\n\n\t\t\tcase 'THEME_EXISTS':\n\t\t\t\tmessage = `Yikes! You can't create a new theme. One per skill for now.`\n\t\t\t\tbreak\n\n\t\t\tcase 'CACHE_NOT_ENABLED':\n\t\t\t\tmessage = \"Cache is not enabled, so it can't be disabled!\"\n\t\t\t\tbreak\n\n\t\t\tcase 'DOCKER_NOT_STARTED':\n\t\t\t\tmessage = 'Docker has not been started! Start it and try again!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_TEMPLATE_ITEM_BUILDING_FAILED':\n\t\t\t\tmessage = `Failed to build schema template item for '${namesUtil.toPascal(\n\t\t\t\t\toptions.schemaNamespace\n\t\t\t\t)}.${options.schemaId}'. The field I had an issue on was '${\n\t\t\t\t\toptions.fieldName\n\t\t\t\t}'. It's options are:\\n\\n${JSON.stringify(\n\t\t\t\t\toptions.fieldOptions\n\t\t\t\t)}.\\n\\nChances are you have a circular reference in your schemas. You'll need to extract shared fields to a new file and have your schemas mix those in, vs referencing eath other.`\n\t\t\t\tbreak\n\n\t\t\tcase 'ACTION_CANCELLED':\n\t\t\t\tmessage = 'A Action cancelled just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'TRANSPORT_ALREADY_EXISTS':\n\t\t\t\tmessage = `A transport named '${options.name}' already exists!`\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tmessage = super.friendlyMessage()\n\t\t}\n\n\t\treturn message\n\t}\n\n\tprivate cleanStdErr(stderr: string) {\n\t\treturn stderr.replace('warning package.json: No license field', '').trim()\n\t}\n}\n"],"file":"SpruceError.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/errors/SpruceError.ts"],"names":["SpruceError","options","message","code","args","length","join","friendlyMessage","originalError","stack","name","command","file","pattern","cmd","cwd","stderr","cleanStdErr","stdout","schemaId","destination","featureCode","fileName","testName","errorMessage","split","map","line","errors","responseErrors","errorMessages","err","push","fullyQualifiedEventName","brokenProperty","dependencies","d","hint","namesUtil","toPascal","schemaNamespace","fieldName","JSON","stringify","fieldOptions","replace","trim","AbstractSpruceError"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;IAGqBA,W;;;;;;;;;;;;;AACpB;AACA,+BAAiC;AAAA;;AAChC,UAAQC,OAAR,GAAoB,IAApB,CAAQA,OAAR;AACA,UAAIC,OAAJ;;AAEA,cAAQD,OAAR,aAAQA,OAAR,uBAAQA,OAAO,CAAEE,IAAjB;AACC,aAAK,iBAAL;AACC,cAAI,CAACF,OAAO,CAACG,IAAT,IAAiBH,OAAO,CAACG,IAAR,CAAaC,MAAb,KAAwB,CAA7C,EAAgD;AAC/CH,YAAAA,OAAO,qEAAP;AACA,WAFD,MAEO;AACNA,YAAAA,OAAO,gEAA+CD,OAAO,CAACG,IAAR,CAAaE,IAAb,CACrD,GADqD,CAA/C,MAAP;AAGA;;AACDJ,UAAAA,OAAO,IAAI,8BAAX;AACA;;AAED,aAAK,SAAL;AACCA,UAAAA,OAAO,4BAAGD,OAAO,CAACM,eAAX,yEAA8B,cAArC;;AAEA,cAAIN,OAAO,CAACO,aAAZ,EAA2B;AAAA;;AAC1BN,YAAAA,OAAO,2CACND,OAAO,CAACO,aAAR,CAAsBC,KADhB,yEACyBR,OAAO,CAACO,aAAR,CAAsBE,IAD/C,CAAP;AAGA;;AACD;;AACD,aAAK,iBAAL;AACCR,UAAAA,OAAO,GAAG,EAAV;;AACA,cAAID,OAAO,CAACM,eAAZ,EAA6B;AAC5BL,YAAAA,OAAO,kBAAWD,OAAO,CAACM,eAAnB,CAAP;AACA;;AACD;;AACD,aAAK,yBAAL;AACCL,UAAAA,OAAO,aAAMD,OAAO,CAACU,OAAd,4CACNV,OAA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AA,OAAO,6BAAGD,OAAO,CAACM,eAAX,wGAAP;AACA;;AAED,aAAK,sBAAL;AACCL,UAAAA,OAAO,oGAAP;AACA;;AAED,aAAK,iBAAL;AACCA,UAAAA,OAAO,aAAMD,OAAO,CAACU,OAAd,0BAAqCV,OAAO,CAACoC,IAA7C,CAAP;AACA;;AAED,aAAK,mBAAL;AACCnC,UAAAA,OAAO,0DAAmDD,OAAO,CAACS,IAA3D,MAAP;AACA;;AAED,aAAK,cAAL;AACCR,UAAAA,OAAO,gEAAP;AACA;;AAED,aAAK,mBAAL;AACCA,UAAAA,OAAO,GAAG,gDAAV;AACA;;AAED,aAAK,oBAAL;AACCA,UAAAA,OAAO,GAAG,sDAAV;AACA;;AAED,aAAK,sCAAL;AACCA,UAAAA,OAAO,uDAAgDoC,4BAAUC,QAAV,CACtDtC,OAAO,CAACuC,eAD8C,CAAhD,cAEFvC,OAAO,CAACkB,QAFN,iDAGNlB,OAAO,CAACwC,SAHF,qCAIoBC,IAAI,CAACC,SAAL,CAC1B1C,OAAO,CAAC2C,YADkB,CAJpB,sLAAP;AAOA;;AAED,aAAK,kBAAL;AACC1C,UAAAA,OAAO,GAAG,mCAAV;AACA;;AAED,aAAK,0BAAL;AACCA,UAAAA,OAAO,gCAAyBD,OAAO,CAACS,IAAjC,sBAAP;AACA;;AAED;AACCR,UAAAA,OAAO,qHAAP;AApPF;;AAuPA,aAAOA,OAAP;AACA;;;WAED,qBAAoBc,MAApB,EAAoC;AACnC,aAAOA,MAAM,CAAC6B,OAAP,CAAe,wCAAf,EAAyD,EAAzD,EAA6DC,IAA7D,EAAP;AACA;;;EAlQuCC,iB","sourcesContent":["import AbstractSpruceError from '@sprucelabs/error'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport upperFirst from 'lodash/upperFirst'\nimport ErrorOptions from '#spruce/errors/options.types'\n\nexport default class SpruceError extends AbstractSpruceError<ErrorOptions> {\n\t/** An easy to understand version of the errors */\n\tpublic friendlyMessage(): string {\n\t\tconst { options } = this\n\t\tlet message\n\n\t\tswitch (options?.code) {\n\t\t\tcase 'INVALID_COMMAND':\n\t\t\t\tif (!options.args || options.args.length === 0) {\n\t\t\t\t\tmessage = `Hey friend 👋.. I don't support the command you tried.`\n\t\t\t\t} else {\n\t\t\t\t\tmessage = `Hey friend 👋. I don't know the command: ${options.args.join(\n\t\t\t\t\t\t' '\n\t\t\t\t\t)}.`\n\t\t\t\t}\n\t\t\t\tmessage += ' Try running `spruce --help`'\n\t\t\t\tbreak\n\n\t\t\tcase 'GENERIC':\n\t\t\t\tmessage = options.friendlyMessage ?? 'Oh shoot! 🤔'\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\n${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.name\n\t\t\t\t\t}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'NOT_IMPLEMENTED':\n\t\t\t\tmessage = ''\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'COMMAND_NOT_IMPLEMENTED':\n\t\t\t\tmessage = `${options.command} has not yet been implemented. ${\n\t\t\t\t\toptions.args ? `Args: ${options.args.join(', ')}` : ''\n\t\t\t\t}`\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_FAILED_TO_IMPORT':\n\t\t\t\tmessage = `Error importing \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BUILD_FAILED':\n\t\t\t\tmessage = `Build${\n\t\t\t\t\toptions.file ? `ing ${options.file}` : ''\n\t\t\t\t} failed. It looks like you're not running 'yarn watch'. Run it and then run 'spruce all:sync'.`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FAILED_TO_IMPORT':\n\t\t\t\tmessage =\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\t`Failed to import \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'LINT_FAILED':\n\t\t\t\tmessage = `Lint failed on pattern ${options.pattern}.`\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\nOriginal error:${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.message\n\t\t\t\t\t}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'EXECUTING_COMMAND_FAILED':\n\t\t\t\tif (this.originalError && this.originalError.message) {\n\t\t\t\t\tmessage = this.originalError.message + '\\n\\n'\n\t\t\t\t} else {\n\t\t\t\t\tmessage = ''\n\t\t\t\t}\n\t\t\t\tmessage += `Executing command failed '${options.cmd}'.\\n\\n`\n\t\t\t\tif (options.cwd) {\n\t\t\t\t\tmessage += `cwd: ${options.cwd}\\n\\n`\n\t\t\t\t}\n\n\t\t\t\tif (options.stderr) {\n\t\t\t\t\tmessage += this.cleanStdErr(options.stderr) + '\\n\\n'\n\t\t\t\t}\n\n\t\t\t\tif (options.stdout) {\n\t\t\t\t\tmessage += options.stdout\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'CREATE_AUTOLOADER_FAILED':\n\t\t\t\tmessage = 'A Could not create an autoloader just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_EMPTY':\n\t\t\t\tmessage = 'A directory empty just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'FILE_EXISTS':\n\t\t\t\tmessage = 'A fail already exists.'\n\t\t\t\tbreak\n\n\t\t\tcase 'VSCODE_NOT_INSTALLED':\n\t\t\t\tmessage =\n\t\t\t\t\t\"vscode's 'code' is not installed.\\n\\nMac instructions: https://code.visualstudio.com/docs/setup/mac\\n\\nLinux instructions: https://code.visualstudio.com/docs/setup/linux\\n\\nWindows instructions: https://code.visualstudio.com/docs/setup/windows\"\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_EXISTS':\n\t\t\t\tmessage = `A schema called ${options.schemaId} already exists at ${options.destination}`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_ABORTED':\n\t\t\t\tmessage = 'Aborted! See ya later! ✌️'\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_FEATURE_CODE':\n\t\t\t\tmessage = `Oh no! I couldn't find a feature with the code '${options.featureCode}'.`\n\t\t\t\tbreak\n\n\t\t\tcase 'TEST_FAILED':\n\t\t\t\tmessage = `${options.fileName}\\n - ${\n\t\t\t\t\toptions.testName\n\t\t\t\t}\\n\\n${options.errorMessage\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.map((line) => ` ${line}`)\n\t\t\t\t\t.join('\\n')}`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FEATURE_NOT_INSTALLED':\n\t\t\t\tmessage = `\\`${upperFirst(\n\t\t\t\t\toptions.featureCode\n\t\t\t\t)}\\` feature is not installed. Install it first, then try again.`\n\t\t\t\tbreak\n\n\t\t\tcase 'MERCURY_RESPONSE_ERROR': {\n\t\t\t\tconst errors = options.responseErrors\n\t\t\t\tmessage = `Got ${\n\t\t\t\t\terrors.length === 1 ? 'an error' : `${errors.length} errors`\n\t\t\t\t} from the server:\\n\\n`\n\n\t\t\t\tconst errorMessages: string[] = []\n\t\t\t\tfor (const err of errors) {\n\t\t\t\t\terrorMessages.push(err.message)\n\t\t\t\t}\n\n\t\t\t\tmessage += errorMessages.join('\\n')\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'INVALID_TEST_DIRECTORY':\n\t\t\t\tmessage = `You are missing dependencies I need to run tests. Try \\`spruce test.install\\` to reinstall.`\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_NOT_SKILL':\n\t\t\t\tmessage = 'The directory you are in is not a skill!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_REGISTERED':\n\t\t\t\tmessage = `Dang! I can't continue until you register your skill! Run \\`spruce login\\` and then \\`spruce register.skill\\` to get the ball rolling!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_ORGANIZATIONS_FOUND':\n\t\t\t\tmessage =\n\t\t\t\t\t\"It looks like you don't have any organizations setup yet. Try `spruce create.organization` first.\"\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_EVENT_CONTRACT':\n\t\t\t\tmessage = `The event named \\`${options.fullyQualifiedEventName}\\` is not valid. Check ${options.brokenProperty}. The original error is:\\n\\n${options.originalError?.message}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BOOT_ERROR':\n\t\t\t\tmessage = `Booting your skill failed: ${\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\toptions.originalError?.message ??\n\t\t\t\t\t'Not sure why, tho.'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'DEPLOY_FAILED':\n\t\t\t\tmessage = 'Deploy halted!'\n\t\t\t\tbreak\n\n\t\t\tcase 'MISSING_DEPENDENCIES':\n\t\t\t\tmessage = `Looks like you're missing some dependencies:\\n\\n${options.dependencies\n\t\t\t\t\t.map((d) => `${d.name}: ${d.hint}`)\n\t\t\t\t\t.join('\\n')}`\n\t\t\t\tbreak\n\n\t\t\tcase 'STORE_EXISTS':\n\t\t\t\tmessage = 'A Store exists just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'NOT_LOGGED_IN':\n\t\t\t\tmessage = 'You have to be logged in to do that!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_FOUND':\n\t\t\t\tmessage = options.friendlyMessage ?? `I couldn't find that skill!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_SKILLS_REGISTERED':\n\t\t\t\tmessage = `Whoa! Looks like you haven't registered your skill yet! Try \\`spruce register\\` to get that done!`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_BLOCKED':\n\t\t\t\tmessage = `${options.command} is blocked! ${options.hint}`\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_VIEW_EXISTS':\n\t\t\t\tmessage = `A skill view controller already exists named ${options.name}!`\n\t\t\t\tbreak\n\n\t\t\tcase 'THEME_EXISTS':\n\t\t\t\tmessage = `Yikes! You can't create a new theme. One per skill for now.`\n\t\t\t\tbreak\n\n\t\t\tcase 'CACHE_NOT_ENABLED':\n\t\t\t\tmessage = \"Cache is not enabled, so it can't be disabled!\"\n\t\t\t\tbreak\n\n\t\t\tcase 'DOCKER_NOT_STARTED':\n\t\t\t\tmessage = 'Docker has not been started! Start it and try again!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_TEMPLATE_ITEM_BUILDING_FAILED':\n\t\t\t\tmessage = `Failed to build schema template item for '${namesUtil.toPascal(\n\t\t\t\t\toptions.schemaNamespace\n\t\t\t\t)}.${options.schemaId}'. The field I had an issue on was '${\n\t\t\t\t\toptions.fieldName\n\t\t\t\t}'. It's options are:\\n\\n${JSON.stringify(\n\t\t\t\t\toptions.fieldOptions\n\t\t\t\t)}.\\n\\nChances are you have a circular reference in your schemas. You'll need to extract shared fields to a new file and have your schemas mix those in, vs referencing eath other.`\n\t\t\t\tbreak\n\n\t\t\tcase 'ACTION_CANCELLED':\n\t\t\t\tmessage = 'A Action cancelled just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'TRANSPORT_ALREADY_EXISTS':\n\t\t\t\tmessage = `A transport named '${options.name}' already exists!`\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tmessage = super.friendlyMessage()\n\t\t}\n\n\t\treturn message\n\t}\n\n\tprivate cleanStdErr(stderr: string) {\n\t\treturn stderr.replace('warning package.json: No license field', '').trim()\n\t}\n}\n"],"file":"SpruceError.js"}
|
|
@@ -37,5 +37,5 @@ export default class FeatureInstaller implements ServiceProvider {
|
|
|
37
37
|
Service<S extends Service>(type: S, cwd?: string): ServiceMap[S];
|
|
38
38
|
getOptionsForFeature(code: FeatureCode): import("@sprucelabs/schema").Schema | import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.SkillFeatureSchema | import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptionsSchema | undefined;
|
|
39
39
|
getAllCodes(): FeatureCode[];
|
|
40
|
-
getInstalledFeatures(): Promise<(import("./schema/SchemaFeature").default | import("./test/TestFeature").default | import("./skill/SkillFeature").default<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.SkillFeatureSchema> | import("./error/ErrorFeature").default | import("./node/NodeFeature").default<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptionsSchema> | import("./cache/CacheFeature").default | import("./conversation/ConversationFeature").default | import("./deploy/DeployFeature").default | import("./event/EventFeature").default | import("./eventContract/EventContractFeature").default | import("./log/LogFeature").default | import("./onboard/OnboardFeature").default | import("./organization/OrganizationFeature").default | import("./person/PersonFeature").default | import("./sandbox/SandboxFeature").default | import("./store/StoreFeature").default | import("./view/ViewFeature").default | import("./vscode/VsCodeFeature").default | import("./watch/WatchFeature").default)[]>;
|
|
40
|
+
getInstalledFeatures(): Promise<(import("./schema/SchemaFeature").default | import("./test/TestFeature").default | import("./skill/SkillFeature").default<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.SkillFeatureSchema> | import("./error/ErrorFeature").default | import("./node/NodeFeature").default<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptionsSchema> | import("./dependencies/DependencyFeature").default | import("./cache/CacheFeature").default | import("./conversation/ConversationFeature").default | import("./deploy/DeployFeature").default | import("./event/EventFeature").default | import("./eventContract/EventContractFeature").default | import("./log/LogFeature").default | import("./onboard/OnboardFeature").default | import("./organization/OrganizationFeature").default | import("./person/PersonFeature").default | import("./sandbox/SandboxFeature").default | import("./store/StoreFeature").default | import("./view/ViewFeature").default | import("./vscode/VsCodeFeature").default | import("./watch/WatchFeature").default)[]>;
|
|
41
41
|
}
|
|
@@ -19,6 +19,8 @@ var _CacheFeature = _interopRequireDefault(require("./cache/CacheFeature"));
|
|
|
19
19
|
|
|
20
20
|
var _ConversationFeature = _interopRequireDefault(require("./conversation/ConversationFeature"));
|
|
21
21
|
|
|
22
|
+
var _DependencyFeature = _interopRequireDefault(require("./dependencies/DependencyFeature"));
|
|
23
|
+
|
|
22
24
|
var _DeployFeature = _interopRequireDefault(require("./deploy/DeployFeature"));
|
|
23
25
|
|
|
24
26
|
var _ErrorFeature = _interopRequireDefault(require("./error/ErrorFeature"));
|
|
@@ -94,6 +96,6 @@ var FeatureInstallerFactory = /*#__PURE__*/function () {
|
|
|
94
96
|
}();
|
|
95
97
|
|
|
96
98
|
exports["default"] = FeatureInstallerFactory;
|
|
97
|
-
(0, _defineProperty2["default"])(FeatureInstallerFactory, "features", [_ErrorFeature["default"], _SchemaFeature["default"], _SkillFeature["default"], _TestFeature["default"], _VsCodeFeature["default"], _EventFeature["default"], _WatchFeature["default"], _NodeFeature["default"], _OnboardFeature["default"], _PersonFeature["default"], _OrganizationFeature["default"], _ConversationFeature["default"], _EventContractFeature["default"], _DeployFeature["default"], _SandboxFeature["default"], _StoreFeature["default"], _ViewFeature["default"], _CacheFeature["default"], _LogFeature["default"]]);
|
|
98
|
-
(0, _defineProperty2["default"])(FeatureInstallerFactory, "featureCodes", ['error', 'schema', 'skill', 'test', 'vscode', 'event', 'watch', 'node', 'onboard', 'person', 'organization', 'conversation', 'eventContract', 'deploy', 'sandbox', 'store', 'view', 'cache', 'log']);
|
|
99
|
+
(0, _defineProperty2["default"])(FeatureInstallerFactory, "features", [_ErrorFeature["default"], _SchemaFeature["default"], _SkillFeature["default"], _TestFeature["default"], _VsCodeFeature["default"], _EventFeature["default"], _WatchFeature["default"], _NodeFeature["default"], _OnboardFeature["default"], _PersonFeature["default"], _OrganizationFeature["default"], _ConversationFeature["default"], _EventContractFeature["default"], _DeployFeature["default"], _SandboxFeature["default"], _StoreFeature["default"], _ViewFeature["default"], _CacheFeature["default"], _LogFeature["default"], _DependencyFeature["default"]]);
|
|
100
|
+
(0, _defineProperty2["default"])(FeatureInstallerFactory, "featureCodes", ['error', 'schema', 'skill', 'test', 'vscode', 'event', 'watch', 'node', 'onboard', 'person', 'organization', 'conversation', 'eventContract', 'deploy', 'sandbox', 'store', 'view', 'cache', 'log', 'dependency']);
|
|
99
101
|
//# sourceMappingURL=FeatureInstallerFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/features/FeatureInstallerFactory.ts"],"names":["FeatureInstallerFactory","options","cwd","serviceFactory","storeFactory","ui","emitter","actionExecuter","featureInstaller","FeatureInstaller","featureOptions","templates","apiClientFactory","features","forEach","Feature","feature","mapFeature","code","ErrorFeature","SchemaFeature","SkillFeature","TestFeature","VsCodeFeature","EventFeature","WatchFeature","NodeFeature","OnboardFeature","PersonFeature","OrganizationFeature","ConversationFeature","EventContractFeature","DeployFeature","SandboxFeature","StoreFeature","ViewFeature","CacheFeature","LogFeature"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;IACqBA,uB;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/features/FeatureInstallerFactory.ts"],"names":["FeatureInstallerFactory","options","cwd","serviceFactory","storeFactory","ui","emitter","actionExecuter","featureInstaller","FeatureInstaller","featureOptions","templates","apiClientFactory","features","forEach","Feature","feature","mapFeature","code","ErrorFeature","SchemaFeature","SkillFeature","TestFeature","VsCodeFeature","EventFeature","WatchFeature","NodeFeature","OnboardFeature","PersonFeature","OrganizationFeature","ConversationFeature","EventContractFeature","DeployFeature","SandboxFeature","StoreFeature","ViewFeature","CacheFeature","LogFeature","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uB,cACsB,CACzCmB,wBADyC,EAEzCC,yBAFyC,EAGzCC,wBAHyC,EAIzCC,uBAJyC,EAKzCC,yBALyC,EAMzCC,wBANyC,EAOzCC,wBAPyC,EAQzCC,uBARyC,EASzCC,0BATyC,EAUzCC,yBAVyC,EAWzCC,+BAXyC,EAYzCC,+BAZyC,EAazCC,gCAbyC,EAczCC,yBAdyC,EAezCC,0BAfyC,EAgBzCC,wBAhByC,EAiBzCC,uBAjByC,EAkBzCC,wBAlByC,EAmBzCC,sBAnByC,EAoBzCC,6BApByC,C;iCADtBtC,uB,kBAwBiC,CACpD,OADoD,EAEpD,QAFoD,EAGpD,OAHoD,EAIpD,MAJoD,EAKpD,QALoD,EAMpD,OANoD,EAOpD,OAPoD,EAQpD,MARoD,EASpD,SAToD,EAUpD,QAVoD,EAWpD,cAXoD,EAYpD,cAZoD,EAapD,eAboD,EAcpD,QAdoD,EAepD,SAfoD,EAgBpD,OAhBoD,EAiBpD,MAjBoD,EAkBpD,OAlBoD,EAmBpD,KAnBoD,EAoBpD,YApBoD,C","sourcesContent":["import { templates } from '@sprucelabs/spruce-templates'\nimport { GlobalEmitter } from '../GlobalEmitter'\nimport ServiceFactory from '../services/ServiceFactory'\nimport StoreFactory from '../stores/StoreFactory'\nimport { ApiClientFactory } from '../types/apiClient.types'\nimport { GraphicsInterface } from '../types/cli.types'\nimport { FeatureOptions } from './AbstractFeature'\nimport ActionExecuter from './ActionExecuter'\nimport CacheFeature from './cache/CacheFeature'\nimport ConversationFeature from './conversation/ConversationFeature'\nimport DependencyFeature from './dependencies/DependencyFeature'\nimport DeployFeature from './deploy/DeployFeature'\nimport ErrorFeature from './error/ErrorFeature'\nimport EventFeature from './event/EventFeature'\nimport EventContractFeature from './eventContract/EventContractFeature'\nimport FeatureInstaller from './FeatureInstaller'\nimport { FeatureCode } from './features.types'\nimport LogFeature from './log/LogFeature'\nimport NodeFeature from './node/NodeFeature'\nimport OnboardFeature from './onboard/OnboardFeature'\nimport OrganizationFeature from './organization/OrganizationFeature'\nimport PersonFeature from './person/PersonFeature'\nimport SandboxFeature from './sandbox/SandboxFeature'\nimport SchemaFeature from './schema/SchemaFeature'\nimport SkillFeature from './skill/SkillFeature'\nimport StoreFeature from './store/StoreFeature'\nimport TestFeature from './test/TestFeature'\nimport ViewFeature from './view/ViewFeature'\nimport VsCodeFeature from './vscode/VsCodeFeature'\nimport WatchFeature from './watch/WatchFeature'\nexport default class FeatureInstallerFactory {\n\tprivate static readonly features: any[] = [\n\t\tErrorFeature,\n\t\tSchemaFeature,\n\t\tSkillFeature,\n\t\tTestFeature,\n\t\tVsCodeFeature,\n\t\tEventFeature,\n\t\tWatchFeature,\n\t\tNodeFeature,\n\t\tOnboardFeature,\n\t\tPersonFeature,\n\t\tOrganizationFeature,\n\t\tConversationFeature,\n\t\tEventContractFeature,\n\t\tDeployFeature,\n\t\tSandboxFeature,\n\t\tStoreFeature,\n\t\tViewFeature,\n\t\tCacheFeature,\n\t\tLogFeature,\n\t\tDependencyFeature,\n\t]\n\n\tpublic static readonly featureCodes: FeatureCode[] = [\n\t\t'error',\n\t\t'schema',\n\t\t'skill',\n\t\t'test',\n\t\t'vscode',\n\t\t'event',\n\t\t'watch',\n\t\t'node',\n\t\t'onboard',\n\t\t'person',\n\t\t'organization',\n\t\t'conversation',\n\t\t'eventContract',\n\t\t'deploy',\n\t\t'sandbox',\n\t\t'store',\n\t\t'view',\n\t\t'cache',\n\t\t'log',\n\t\t'dependency',\n\t]\n\n\tpublic static WithAllFeatures(options: {\n\t\tcwd: string\n\t\tserviceFactory: ServiceFactory\n\t\tstoreFactory: StoreFactory\n\t\tfeatureInstaller?: FeatureInstaller\n\t\tui: GraphicsInterface\n\t\temitter: GlobalEmitter\n\t\tapiClientFactory: ApiClientFactory\n\t\tactionExecuter: ActionExecuter\n\t}): FeatureInstaller {\n\t\tconst { cwd, serviceFactory, storeFactory, ui, emitter, actionExecuter } =\n\t\t\toptions\n\n\t\tconst featureInstaller =\n\t\t\toptions.featureInstaller ?? new FeatureInstaller(cwd, serviceFactory)\n\n\t\tconst featureOptions: FeatureOptions = {\n\t\t\tcwd,\n\t\t\tserviceFactory,\n\t\t\ttemplates,\n\t\t\tstoreFactory,\n\t\t\tfeatureInstaller,\n\t\t\tui,\n\t\t\temitter,\n\t\t\tactionExecuter,\n\t\t\tapiClientFactory: options.apiClientFactory,\n\t\t}\n\n\t\tthis.features.forEach((Feature) => {\n\t\t\tconst feature = new Feature(featureOptions)\n\n\t\t\tfeatureInstaller.mapFeature(feature.code, feature)\n\t\t})\n\n\t\treturn featureInstaller\n\t}\n}\n"],"file":"FeatureInstallerFactory.js"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import AbstractFeature, { FeatureDependency } from '../AbstractFeature';
|
|
2
|
+
import { FeatureCode } from '../features.types';
|
|
3
|
+
declare module '../../features/features.types' {
|
|
4
|
+
interface FeatureMap {
|
|
5
|
+
dependency: DependencyFeature;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export default class DependencyFeature extends AbstractFeature {
|
|
9
|
+
description: string;
|
|
10
|
+
code: FeatureCode;
|
|
11
|
+
nameReadable: string;
|
|
12
|
+
actionsDir: string;
|
|
13
|
+
dependencies: FeatureDependency[];
|
|
14
|
+
packageDependencies: never[];
|
|
15
|
+
isInstalled(): Promise<boolean>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
24
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
28
|
+
var _spruceSkillUtils = require("@sprucelabs/spruce-skill-utils");
|
|
29
|
+
|
|
30
|
+
var _AbstractFeature2 = _interopRequireDefault(require("../AbstractFeature"));
|
|
31
|
+
|
|
32
|
+
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
|
+
|
|
34
|
+
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
|
+
|
|
36
|
+
var DependencyFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
37
|
+
(0, _inherits2["default"])(DependencyFeature, _AbstractFeature);
|
|
38
|
+
|
|
39
|
+
var _super = _createSuper(DependencyFeature);
|
|
40
|
+
|
|
41
|
+
function DependencyFeature() {
|
|
42
|
+
var _this;
|
|
43
|
+
|
|
44
|
+
(0, _classCallCheck2["default"])(this, DependencyFeature);
|
|
45
|
+
|
|
46
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
|
+
args[_key] = arguments[_key];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
51
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "description", 'Tell me which skills you depend on.');
|
|
52
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "code", 'dependency');
|
|
53
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "nameReadable", 'Dependencies');
|
|
54
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "actionsDir", _spruceSkillUtils.diskUtil.resolvePath(__dirname, 'actions'));
|
|
55
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "dependencies", [{
|
|
56
|
+
code: 'skill',
|
|
57
|
+
isRequired: true
|
|
58
|
+
}]);
|
|
59
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "packageDependencies", []);
|
|
60
|
+
return _this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
(0, _createClass2["default"])(DependencyFeature, [{
|
|
64
|
+
key: "isInstalled",
|
|
65
|
+
value: function () {
|
|
66
|
+
var _isInstalled = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
67
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
68
|
+
while (1) {
|
|
69
|
+
switch (_context.prev = _context.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
return _context.abrupt("return", this.featureInstaller.isInstalled('skill'));
|
|
72
|
+
|
|
73
|
+
case 1:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context.stop();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, _callee, this);
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
function isInstalled() {
|
|
82
|
+
return _isInstalled.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return isInstalled;
|
|
86
|
+
}()
|
|
87
|
+
}]);
|
|
88
|
+
return DependencyFeature;
|
|
89
|
+
}(_AbstractFeature2["default"]);
|
|
90
|
+
|
|
91
|
+
exports["default"] = DependencyFeature;
|
|
92
|
+
//# sourceMappingURL=DependencyFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/features/dependencies/DependencyFeature.ts"],"names":["DependencyFeature","diskUtil","resolvePath","__dirname","code","isRequired","featureInstaller","isInstalled","AbstractFeature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;IASqBA,iB;;;;;;;;;;;;;;;oGACC,qC;6FACM,Y;qGACL,c;mGACFC,2BAASC,WAAT,CAAqBC,SAArB,EAAgC,SAAhC,C;qGACuB,CAC1C;AACCC,MAAAA,IAAI,EAAE,OADP;AAECC,MAAAA,UAAU,EAAE;AAFb,KAD0C,C;4GAMd,E;;;;;;;uGAE7B;AAAA;AAAA;AAAA;AAAA;AAAA,iDACQ,KAAKC,gBAAL,CAAsBC,WAAtB,CAAkC,OAAlC,CADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAb8CC,4B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport AbstractFeature, { FeatureDependency } from '../AbstractFeature'\nimport { FeatureCode } from '../features.types'\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tdependency: DependencyFeature\n\t}\n}\n\nexport default class DependencyFeature extends AbstractFeature {\n\tpublic description = 'Tell me which skills you depend on.'\n\tpublic code: FeatureCode = 'dependency'\n\tpublic nameReadable = 'Dependencies'\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\tpublic dependencies: FeatureDependency[] = [\n\t\t{\n\t\t\tcode: 'skill',\n\t\t\tisRequired: true,\n\t\t},\n\t]\n\tpublic packageDependencies = []\n\n\tpublic async isInstalled() {\n\t\treturn this.featureInstaller.isInstalled('skill')\n\t}\n}\n"],"file":"DependencyFeature.js"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SchemaValues } from '@sprucelabs/schema';
|
|
2
|
+
import AbstractAction from '../../AbstractAction';
|
|
3
|
+
import { FeatureActionResponse } from '../../features.types';
|
|
4
|
+
declare const optionsSchema: {
|
|
5
|
+
id: string;
|
|
6
|
+
description: string;
|
|
7
|
+
fields: {
|
|
8
|
+
namespace: {
|
|
9
|
+
type: "id";
|
|
10
|
+
label: string;
|
|
11
|
+
hint: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare type OptionsSchema = typeof optionsSchema;
|
|
16
|
+
declare type Options = SchemaValues<OptionsSchema>;
|
|
17
|
+
export default class DeployAction extends AbstractAction<OptionsSchema> {
|
|
18
|
+
optionsSchema: {
|
|
19
|
+
id: string;
|
|
20
|
+
description: string;
|
|
21
|
+
fields: {
|
|
22
|
+
namespace: {
|
|
23
|
+
type: "id";
|
|
24
|
+
label: string;
|
|
25
|
+
hint: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
commandAliases: string[];
|
|
30
|
+
invocationMessage: string;
|
|
31
|
+
execute(options: Options): Promise<FeatureActionResponse>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
24
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
28
|
+
var _schema = require("@sprucelabs/schema");
|
|
29
|
+
|
|
30
|
+
var _SpruceError = _interopRequireDefault(require("../../../errors/SpruceError"));
|
|
31
|
+
|
|
32
|
+
var _AbstractAction2 = _interopRequireDefault(require("../../AbstractAction"));
|
|
33
|
+
|
|
34
|
+
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); }; }
|
|
35
|
+
|
|
36
|
+
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; } }
|
|
37
|
+
|
|
38
|
+
var optionsSchema = (0, _schema.buildSchema)({
|
|
39
|
+
id: 'addDepnedency',
|
|
40
|
+
description: 'Add a skill as a dependency.',
|
|
41
|
+
fields: {
|
|
42
|
+
namespace: {
|
|
43
|
+
type: 'id',
|
|
44
|
+
label: 'Namespace',
|
|
45
|
+
hint: 'The namespace of the skill you want to add as a dependency.'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
var DeployAction = /*#__PURE__*/function (_AbstractAction) {
|
|
51
|
+
(0, _inherits2["default"])(DeployAction, _AbstractAction);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(DeployAction);
|
|
54
|
+
|
|
55
|
+
function DeployAction() {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
(0, _classCallCheck2["default"])(this, DeployAction);
|
|
59
|
+
|
|
60
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = arguments[_key];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "optionsSchema", optionsSchema);
|
|
66
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "commandAliases", ['add.dependency']);
|
|
67
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "invocationMessage", 'Adding a dependency... 🔗');
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
(0, _createClass2["default"])(DeployAction, [{
|
|
72
|
+
key: "execute",
|
|
73
|
+
value: function () {
|
|
74
|
+
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
75
|
+
var _this$validateAndNorm, namespace, skills, skill;
|
|
76
|
+
|
|
77
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
78
|
+
while (1) {
|
|
79
|
+
switch (_context.prev = _context.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
_this$validateAndNorm = this.validateAndNormalizeOptions(options), namespace = _this$validateAndNorm.namespace;
|
|
82
|
+
_context.next = 3;
|
|
83
|
+
return this.Store('skill').fetchAllSkills();
|
|
84
|
+
|
|
85
|
+
case 3:
|
|
86
|
+
skills = _context.sent;
|
|
87
|
+
|
|
88
|
+
if (namespace) {
|
|
89
|
+
_context.next = 8;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_context.next = 7;
|
|
94
|
+
return this.ui.prompt({
|
|
95
|
+
type: 'select',
|
|
96
|
+
label: 'Which skill would you like to add as a dependency?',
|
|
97
|
+
isRequired: true,
|
|
98
|
+
options: {
|
|
99
|
+
choices: skills.map(function (s) {
|
|
100
|
+
return {
|
|
101
|
+
value: s.slug,
|
|
102
|
+
label: s.name
|
|
103
|
+
};
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
case 7:
|
|
109
|
+
namespace = _context.sent;
|
|
110
|
+
|
|
111
|
+
case 8:
|
|
112
|
+
skill = skills.find(function (s) {
|
|
113
|
+
return s.slug === namespace;
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (skill) {
|
|
117
|
+
_context.next = 11;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
throw new _SpruceError["default"]({
|
|
122
|
+
code: 'SKILL_NOT_FOUND',
|
|
123
|
+
friendlyMessage: "I could not find a skill with the slug of ".concat(namespace, ".")
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
case 11:
|
|
127
|
+
this.Service('dependency').add({
|
|
128
|
+
id: skill.id,
|
|
129
|
+
namespace: skill.slug
|
|
130
|
+
});
|
|
131
|
+
return _context.abrupt("return", {
|
|
132
|
+
summaryLines: ["Added \"".concat(skill.name, "\" as a dependency!")]
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
case 13:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context.stop();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, _callee, this);
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
function execute(_x) {
|
|
144
|
+
return _execute.apply(this, arguments);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return execute;
|
|
148
|
+
}()
|
|
149
|
+
}]);
|
|
150
|
+
return DeployAction;
|
|
151
|
+
}(_AbstractAction2["default"]);
|
|
152
|
+
|
|
153
|
+
exports["default"] = DeployAction;
|
|
154
|
+
//# sourceMappingURL=AddAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/dependencies/actions/AddAction.ts"],"names":["optionsSchema","id","description","fields","namespace","type","label","hint","DeployAction","options","validateAndNormalizeOptions","Store","fetchAllSkills","skills","ui","prompt","isRequired","choices","map","s","value","slug","name","skill","find","SpruceError","code","friendlyMessage","Service","add","summaryLines","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AAGA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,eAD6B;AAEjCC,EAAAA,WAAW,EAAE,8BAFoB;AAGjCC,EAAAA,MAAM,EAAE;AACPC,IAAAA,SAAS,EAAE;AACVC,MAAAA,IAAI,EAAE,IADI;AAEVC,MAAAA,KAAK,EAAE,WAFG;AAGVC,MAAAA,IAAI,EAAE;AAHI;AADJ;AAHyB,CAAZ,CAAtB;;IAeqBC,Y;;;;;;;;;;;;;;;sGACGR,a;uGACC,CAAC,gBAAD,C;0GACG,2B;;;;;;;mGAE3B,iBAAqBS,OAArB;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wCACqB,KAAKC,2BAAL,CAAiCD,OAAjC,CADrB,EACOL,S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EALyCS,2B","sourcesContent":["import { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nconst optionsSchema = buildSchema({\n\tid: 'addDepnedency',\n\tdescription: 'Add a skill as a dependency.',\n\tfields: {\n\t\tnamespace: {\n\t\t\ttype: 'id',\n\t\t\tlabel: 'Namespace',\n\t\t\thint: 'The namespace of the skill you want to add as a dependency.',\n\t\t},\n\t},\n})\n\ntype OptionsSchema = typeof optionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class DeployAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = optionsSchema\n\tpublic commandAliases = ['add.dependency']\n\tpublic invocationMessage = 'Adding a dependency... 🔗'\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tlet { namespace } = this.validateAndNormalizeOptions(options)\n\n\t\tconst skills = await this.Store('skill').fetchAllSkills()\n\n\t\tif (!namespace) {\n\t\t\tnamespace = await this.ui.prompt({\n\t\t\t\ttype: 'select',\n\t\t\t\tlabel: 'Which skill would you like to add as a dependency?',\n\t\t\t\tisRequired: true,\n\t\t\t\toptions: {\n\t\t\t\t\tchoices: skills.map((s) => ({\n\t\t\t\t\t\tvalue: s.slug,\n\t\t\t\t\t\tlabel: s.name,\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tconst skill = skills.find((s) => s.slug === namespace)\n\n\t\tif (!skill) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'SKILL_NOT_FOUND',\n\t\t\t\tfriendlyMessage: `I could not find a skill with the slug of ${namespace}.`,\n\t\t\t})\n\t\t}\n\n\t\tthis.Service('dependency').add({\n\t\t\tid: skill.id,\n\t\t\tnamespace: skill.slug,\n\t\t})\n\n\t\treturn {\n\t\t\tsummaryLines: [`Added \"${skill.name}\" as a dependency!`],\n\t\t}\n\t}\n}\n"],"file":"AddAction.js"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import AbstractAction from '../../AbstractAction';
|
|
2
|
+
import { FeatureActionResponse } from '../../features.types';
|
|
3
|
+
declare const optionsSchema: {
|
|
4
|
+
id: string;
|
|
5
|
+
description: string;
|
|
6
|
+
fields: {};
|
|
7
|
+
};
|
|
8
|
+
declare type OptionsSchema = typeof optionsSchema;
|
|
9
|
+
export default class DeployAction extends AbstractAction<OptionsSchema> {
|
|
10
|
+
optionsSchema: {
|
|
11
|
+
id: string;
|
|
12
|
+
description: string;
|
|
13
|
+
fields: {};
|
|
14
|
+
};
|
|
15
|
+
commandAliases: string[];
|
|
16
|
+
invocationMessage: string;
|
|
17
|
+
execute(): Promise<FeatureActionResponse>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
24
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
28
|
+
var _schema = require("@sprucelabs/schema");
|
|
29
|
+
|
|
30
|
+
var _AbstractAction2 = _interopRequireDefault(require("../../AbstractAction"));
|
|
31
|
+
|
|
32
|
+
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
|
+
|
|
34
|
+
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
|
+
|
|
36
|
+
var optionsSchema = (0, _schema.buildSchema)({
|
|
37
|
+
id: 'manageDependencies',
|
|
38
|
+
description: 'Manage the skills you depend on.',
|
|
39
|
+
fields: {}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var DeployAction = /*#__PURE__*/function (_AbstractAction) {
|
|
43
|
+
(0, _inherits2["default"])(DeployAction, _AbstractAction);
|
|
44
|
+
|
|
45
|
+
var _super = _createSuper(DeployAction);
|
|
46
|
+
|
|
47
|
+
function DeployAction() {
|
|
48
|
+
var _this;
|
|
49
|
+
|
|
50
|
+
(0, _classCallCheck2["default"])(this, DeployAction);
|
|
51
|
+
|
|
52
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
53
|
+
args[_key] = arguments[_key];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
57
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "optionsSchema", optionsSchema);
|
|
58
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "commandAliases", ['manage.dependencies', 'remove.dependency', 'dependencies']);
|
|
59
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "invocationMessage", 'Managing dependencies... 🔗');
|
|
60
|
+
return _this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
(0, _createClass2["default"])(DeployAction, [{
|
|
64
|
+
key: "execute",
|
|
65
|
+
value: function () {
|
|
66
|
+
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
67
|
+
var skills, dep, dependencies, currentSkill, selected, summary, updatedDependencies;
|
|
68
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
69
|
+
while (1) {
|
|
70
|
+
switch (_context.prev = _context.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
_context.next = 2;
|
|
73
|
+
return this.Store('skill').fetchMySkills();
|
|
74
|
+
|
|
75
|
+
case 2:
|
|
76
|
+
skills = _context.sent;
|
|
77
|
+
skills.sort(function (a, b) {
|
|
78
|
+
var name1 = a.name.toLowerCase();
|
|
79
|
+
var name2 = b.name.toLowerCase();
|
|
80
|
+
|
|
81
|
+
if (name1 < name2) {
|
|
82
|
+
return -1;
|
|
83
|
+
} else if (name1 > name2) {
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return 0;
|
|
88
|
+
});
|
|
89
|
+
dep = this.Service('dependency');
|
|
90
|
+
dependencies = dep.get();
|
|
91
|
+
_context.next = 8;
|
|
92
|
+
return this.Store('skill').loadCurrentSkill();
|
|
93
|
+
|
|
94
|
+
case 8:
|
|
95
|
+
currentSkill = _context.sent;
|
|
96
|
+
|
|
97
|
+
if (currentSkill.isRegistered) {
|
|
98
|
+
skills = skills.filter(function (s) {
|
|
99
|
+
return s.id !== currentSkill.id;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
_context.next = 12;
|
|
104
|
+
return this.ui.prompt({
|
|
105
|
+
label: 'Which skills do you depend on?',
|
|
106
|
+
type: 'select',
|
|
107
|
+
isArray: true,
|
|
108
|
+
isRequired: true,
|
|
109
|
+
value: dependencies.map(function (d) {
|
|
110
|
+
return d.id;
|
|
111
|
+
}),
|
|
112
|
+
options: {
|
|
113
|
+
choices: skills.map(function (skill) {
|
|
114
|
+
return {
|
|
115
|
+
value: skill.id,
|
|
116
|
+
label: skill.name + ' (' + skill.slug + ')'
|
|
117
|
+
};
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
case 12:
|
|
123
|
+
selected = _context.sent;
|
|
124
|
+
summary = [];
|
|
125
|
+
updatedDependencies = selected.map(function (id) {
|
|
126
|
+
var _skill$slug;
|
|
127
|
+
|
|
128
|
+
var skill = skills.find(function (s) {
|
|
129
|
+
return s.id === id;
|
|
130
|
+
});
|
|
131
|
+
summary.push((skill === null || skill === void 0 ? void 0 : skill.name) + ' (' + (skill === null || skill === void 0 ? void 0 : skill.id) + ')');
|
|
132
|
+
return {
|
|
133
|
+
id: id,
|
|
134
|
+
namespace: (_skill$slug = skill === null || skill === void 0 ? void 0 : skill.slug) !== null && _skill$slug !== void 0 ? _skill$slug : '**missing**'
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
dep.set(updatedDependencies);
|
|
138
|
+
return _context.abrupt("return", {
|
|
139
|
+
summaryLines: ["".concat(updatedDependencies.length, " dependenc").concat(updatedDependencies.length === 1 ? 'y' : 'ies', " added.")].concat(summary)
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
case 17:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context.stop();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, _callee, this);
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
function execute() {
|
|
151
|
+
return _execute.apply(this, arguments);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return execute;
|
|
155
|
+
}()
|
|
156
|
+
}]);
|
|
157
|
+
return DeployAction;
|
|
158
|
+
}(_AbstractAction2["default"]);
|
|
159
|
+
|
|
160
|
+
exports["default"] = DeployAction;
|
|
161
|
+
//# sourceMappingURL=ManageAction.js.map
|