@sprucelabs/spruce-cli 14.28.5 → 14.29.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 +35 -0
- package/build/__tests__/behavioral/BootingWithBadFiles.test.js +26 -13
- package/build/__tests__/behavioral/BootingWithBadFiles.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js +13 -9
- package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.d.ts +1 -1
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js +24 -14
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +1 -1
- package/build/__tests__/behavioral/TestingDataStores.test.js +15 -11
- package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +3 -1
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAListener.test.d.ts +2 -0
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +157 -81
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingListenersInSync.test.d.ts +7 -0
- package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js +171 -0
- package/build/__tests__/behavioral/events/KeepingListenersInSync.test.js.map +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.d.ts +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +53 -21
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.d.ts +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js +10 -20
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.d.ts +5 -0
- package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.js +137 -0
- package/build/__tests__/behavioral/skill/UpgradingWithListeners.test.js.map +1 -0
- package/build/__tests__/behavioral/{CreatingADataStore.test.d.ts → stores/CreatingADataStore.test.d.ts} +2 -1
- package/build/__tests__/behavioral/{CreatingADataStore.test.js → stores/CreatingADataStore.test.js} +87 -57
- package/build/__tests__/behavioral/stores/CreatingADataStore.test.js.map +1 -0
- package/build/__tests__/behavioral/{KeepingDataStoresInSync.test.d.ts → stores/KeepingDataStoresInSync.test.d.ts} +5 -2
- package/build/__tests__/behavioral/{KeepingDataStoresInSync.test.js → stores/KeepingDataStoresInSync.test.js} +138 -49
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/CreatingATest.test.js +14 -10
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- package/build/__tests__/behavioral/views/TestingViewControllers.test.d.ts +1 -0
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js +67 -35
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
- package/build/__tests__/implementation/AuthService.test.d.ts +1 -0
- package/build/__tests__/implementation/AuthService.test.js +8 -0
- package/build/__tests__/implementation/AuthService.test.js.map +1 -1
- package/build/__tests__/implementation/EventStore.test.js +3 -1
- package/build/__tests__/implementation/EventStore.test.js.map +1 -1
- package/build/__tests__/implementation/StoreFeature.test.d.ts +4 -0
- package/build/__tests__/implementation/StoreFeature.test.js +132 -0
- package/build/__tests__/implementation/StoreFeature.test.js.map +1 -0
- package/build/cli.d.ts +1 -1
- package/build/cli.js +1 -1
- package/build/cli.js.map +1 -1
- package/build/features/event/EventFeature.d.ts +2 -2
- package/build/features/event/EventFeature.js +53 -13
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/event/actions/ListenAction.d.ts +1 -0
- package/build/features/event/actions/ListenAction.js +60 -31
- package/build/features/event/actions/ListenAction.js.map +1 -1
- package/build/features/event/actions/SyncListenersAction.d.ts +15 -0
- package/build/features/event/actions/SyncListenersAction.js +115 -0
- package/build/features/event/actions/SyncListenersAction.js.map +1 -0
- package/build/features/event/builders/ListenerTemplateItemBuilder.d.ts +8 -0
- package/build/features/event/builders/ListenerTemplateItemBuilder.js +65 -0
- package/build/features/event/builders/ListenerTemplateItemBuilder.js.map +1 -0
- package/build/features/event/stores/EventStore.js +2 -2
- package/build/features/event/stores/EventStore.js.map +1 -1
- package/build/features/event/stores/ListenerStore.d.ts +9 -0
- package/build/features/event/stores/ListenerStore.js +122 -0
- package/build/features/event/stores/ListenerStore.js.map +1 -0
- package/build/features/event/writers/EventWriter.d.ts +4 -1
- package/build/features/event/writers/EventWriter.js +42 -8
- package/build/features/event/writers/EventWriter.js.map +1 -1
- package/build/features/node/NodeFeature.js +6 -11
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/skill/SkillFeature.js +1 -1
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/skill/stores/SkillStore.js +4 -8
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/store/StoreFeature.d.ts +1 -1
- package/build/features/store/StoreFeature.js +6 -6
- package/build/features/store/StoreFeature.js.map +1 -1
- package/build/features/store/actions/SyncAction.js +11 -10
- package/build/features/store/actions/SyncAction.js.map +1 -1
- package/build/features/store/writers/StoreWriter.d.ts +6 -0
- package/build/features/store/writers/StoreWriter.js +78 -8
- package/build/features/store/writers/StoreWriter.js.map +1 -1
- package/build/services/AuthService.d.ts +4 -1
- package/build/services/AuthService.js +15 -4
- package/build/services/AuthService.js.map +1 -1
- package/build/services/LintService.d.ts +4 -1
- package/build/services/LintService.js +123 -94
- package/build/services/LintService.js.map +1 -1
- package/build/services/ServiceFactory.js +3 -3
- package/build/services/ServiceFactory.js.map +1 -1
- package/build/stores/StoreFactory.d.ts +2 -0
- package/build/stores/StoreFactory.js +4 -1
- package/build/stores/StoreFactory.js.map +1 -1
- package/build/tests/AbstractCliTest.js +3 -3
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/writers/AbstractWriter.d.ts +0 -3
- package/build/writers/AbstractWriter.js +2 -18
- package/build/writers/AbstractWriter.js.map +1 -1
- package/package.json +30 -28
- package/src/__tests__/behavioral/BootingWithBadFiles.test.ts +8 -3
- package/src/__tests__/behavioral/SettingLogTransportsInASkill.test.ts +2 -0
- package/src/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.ts +10 -5
- package/src/__tests__/behavioral/TestingDataStores.test.ts +2 -0
- package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +1 -0
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +28 -9
- package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +1 -1
- package/src/__tests__/behavioral/events/KeepingListenersInSync.test.ts +47 -0
- package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +6 -0
- package/src/__tests__/behavioral/skill/UpgradingASkill2.test.ts +1 -10
- package/src/__tests__/behavioral/skill/UpgradingWithListeners.test.ts +59 -0
- package/src/__tests__/behavioral/{CreatingADataStore.test.ts → stores/CreatingADataStore.test.ts} +13 -6
- package/src/__tests__/behavioral/{KeepingDataStoresInSync.test.ts → stores/KeepingDataStoresInSync.test.ts} +37 -8
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -0
- package/src/__tests__/behavioral/views/TestingViewControllers.test.ts +6 -0
- package/src/__tests__/implementation/AuthService.test.ts +6 -0
- package/src/__tests__/implementation/EventStore.test.ts +1 -0
- package/src/__tests__/implementation/StoreFeature.test.ts +40 -0
- package/src/cli.ts +2 -2
- package/src/features/event/EventFeature.ts +21 -4
- package/src/features/event/actions/ListenAction.ts +9 -3
- package/src/features/event/actions/SyncListenersAction.ts +38 -0
- package/src/features/event/builders/ListenerTemplateItemBuilder.ts +27 -0
- package/src/features/event/stores/EventStore.ts +1 -1
- package/src/features/event/stores/ListenerStore.ts +32 -0
- package/src/features/event/writers/EventWriter.ts +19 -0
- package/src/features/node/NodeFeature.ts +0 -3
- package/src/features/skill/SkillFeature.ts +1 -1
- package/src/features/skill/stores/SkillStore.ts +4 -3
- package/src/features/store/StoreFeature.ts +3 -3
- package/src/features/store/actions/SyncAction.ts +2 -1
- package/src/features/store/writers/StoreWriter.ts +30 -0
- package/src/services/AuthService.ts +15 -5
- package/src/services/LintService.ts +19 -2
- package/src/services/ServiceFactory.ts +9 -3
- package/src/stores/StoreFactory.ts +3 -0
- package/src/tests/AbstractCliTest.ts +2 -2
- package/src/writers/AbstractWriter.ts +2 -13
- package/build/__tests__/behavioral/CreatingADataStore.test.js.map +0 -1
- package/build/__tests__/behavioral/KeepingDataStoresInSync.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/skill/stores/SkillStore.ts"],"names":["SkillStore","values","options","isRegisteringCurrentSkill","assertInSkill","name","slug","description","connectToApi","client","emit","payload","results","eventResponseUtil","getFirstResponseOrThrow","skill","setCurrentSkillsNamespace","Service","updateCurrentSkill","isInstalled","isMarkedAsInstalled","SpruceError","code","currentSkill","getCurrentSkill","shouldAuthAsCurrentSkill","target","skillId","id","response","namespacePascal","namesUtil","toPascal","isRegistered","apiKey","getNamespaceFromPkg","getEventNamespaceForNotRegistered","getSkillDescriptionFromPkg","loadCurrentSkill","pkg","nameFromPackage","get","Error","fallback","current","namespace","isCurrentSkillRegistered","friendlyMessage","set","path","value","toKebab","undefined","logoutCurrentSkill","fetchAllSkills","shouldOnlyShowMine","query","skills","AbstractStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;IAaqBA,U;;;;;;;;;;;;;;;6FACG,O;;;;;;;oGAOvB,iBACCC,MADD,EAECC,OAFD;AAAA;;AAAA;AAAA;AAAA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A;AAAA;AAAA;AAAA,uBAIsB,KAAKhD,YAAL,EAJtB;;AAAA;AAIOC,gBAAAA,MAJP;AAAA;AAAA,uBAMwBA,MAAM,CAACC,IAAP,CAAY,0BAAZ,EAAwC;AAC9DC,kBAAAA,OAAO,oBACH6C,KADG;AADuD,iBAAxC,CANxB;;AAAA;AAMO3B,gBAAAA,QANP;AAAA,yCAYoBhB,oCAAkBC,uBAAlB,CAA0Ce,QAA1C,CAZpB,EAYS4B,MAZT,0BAYSA,MAZT;AAAA,kDAcQA,MAdR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAzJA,6BAAkC;AACjC,WAAKlC,YAAL,GAAoB6B,SAApB;AACA;;;EANsCM,0B;;;iCAAnB1D,U","sourcesContent":["import { eventResponseUtil } from '@sprucelabs/spruce-event-utils'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractStore from '../../../stores/AbstractStore'\nimport { CurrentSkill, RegisteredSkill } from '../../../types/cli.types'\n\nexport interface CreateSkill {\n\tname: string\n\tslug: string\n\tdescription?: string\n}\n\nexport interface RegisterSkillOptions {\n\tisRegisteringCurrentSkill?: boolean\n}\n\nexport default class SkillStore extends AbstractStore {\n\tpublic readonly name = 'skill'\n\tprivate static currentSkill?: CurrentSkill\n\n\tpublic static clearCurrentSkill() {\n\t\tthis.currentSkill = undefined\n\t}\n\n\tpublic async register(\n\t\tvalues: CreateSkill,\n\t\toptions?: RegisterSkillOptions\n\t): Promise<RegisteredSkill> {\n\t\tconst isRegisteringCurrentSkill =\n\t\t\toptions?.isRegisteringCurrentSkill !== false\n\n\t\tisRegisteringCurrentSkill && this.assertInSkill()\n\n\t\tconst { name, slug, description } = values\n\t\tconst client = await this.connectToApi()\n\n\t\tconst results = await client.emit('register-skill::v2020_12_25', {\n\t\t\tpayload: {\n\t\t\t\tname,\n\t\t\t\tslug,\n\t\t\t\tdescription,\n\t\t\t},\n\t\t})\n\n\t\tconst { skill } = eventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\tif (isRegisteringCurrentSkill) {\n\t\t\tawait this.setCurrentSkillsNamespace(skill.slug)\n\t\t\tthis.Service('auth').updateCurrentSkill(skill)\n\t\t}\n\n\t\treturn skill\n\t}\n\n\tprivate assertInSkill() {\n\t\tconst isInstalled = this.Service('settings').isMarkedAsInstalled('skill')\n\n\t\tif (!isInstalled) {\n\t\t\tthrow new SpruceError({ code: 'DIRECTORY_NOT_SKILL' })\n\t\t}\n\t}\n\n\tpublic async loadCurrentSkill(): Promise<CurrentSkill> {\n\t\tif (SkillStore.currentSkill) {\n\t\t\treturn SkillStore.currentSkill\n\t\t}\n\n\t\tthis.assertInSkill()\n\n\t\tconst currentSkill = this.Service('auth').getCurrentSkill()\n\n\t\tif (currentSkill) {\n\t\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\t\t\tconst response = await client.emit('get-skill::v2020_12_25', {\n\t\t\t\ttarget: {\n\t\t\t\t\tskillId: currentSkill.id,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { skill } = eventResponseUtil.getFirstResponseOrThrow(response)\n\n\t\t\tSkillStore.currentSkill = {\n\t\t\t\t...skill,\n\t\t\t\tnamespacePascal: namesUtil.toPascal(skill.slug),\n\t\t\t\tisRegistered: true,\n\t\t\t\tapiKey: currentSkill.apiKey,\n\t\t\t}\n\t\t\treturn SkillStore.currentSkill as CurrentSkill\n\t\t}\n\n\t\treturn {\n\t\t\tname: this.getNamespaceFromPkg(),\n\t\t\tnamespacePascal: this.getEventNamespaceForNotRegistered(),\n\t\t\tdescription: this.getSkillDescriptionFromPkg(),\n\t\t\tisRegistered: false,\n\t\t}\n\t}\n\n\tpublic async isCurrentSkillRegistered() {\n\t\tconst skill = await this.loadCurrentSkill()\n\t\treturn skill.isRegistered\n\t}\n\n\tprivate getNamespaceFromPkg() {\n\t\tconst pkg = this.Service('pkg')\n\t\tconst nameFromPackage = pkg.get('skill.namespace')\n\t\tif (!nameFromPackage) {\n\t\t\tthrow new Error(\n\t\t\t\t'You need need to set skill.namespace in the package.json'\n\t\t\t)\n\t\t}\n\t\treturn nameFromPackage\n\t}\n\n\tpublic async loadCurrentSkillsNamespace() {\n\t\tconst fallback = namesUtil.toPascal(this.getNamespaceFromPkg())\n\n\t\tif (this.Service('auth').getCurrentSkill()) {\n\t\t\tconst current = await this.loadCurrentSkill()\n\t\t\treturn namesUtil.toPascal(current.slug ?? fallback)\n\t\t}\n\n\t\treturn fallback\n\t}\n\n\tpublic async setCurrentSkillsNamespace(namespace: string) {\n\t\tlet isRegistered = false\n\t\ttry {\n\t\t\tisRegistered = await this.isCurrentSkillRegistered()\n\t\t\t// eslint-disable-next-line no-empty\n\t\t} catch {}\n\n\t\tif (isRegistered) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'GENERIC',\n\t\t\t\tfriendlyMessage: `You can't change the namespace of a skill that is registered.`,\n\t\t\t})\n\t\t}\n\n\t\tconst pkg = this.Service('pkg')\n\t\tpkg.set({ path: 'skill.namespace', value: namesUtil.toKebab(namespace) })\n\t}\n\n\tprivate getEventNamespaceForNotRegistered() {\n\t\treturn namesUtil.toPascal(this.getNamespaceFromPkg())\n\t}\n\n\tprivate getSkillDescriptionFromPkg() {\n\t\tconst pkg = this.Service('pkg')\n\t\treturn pkg.get('description')\n\t}\n\n\tpublic async unregisterSkill(skillId: string) {\n\t\tconst client = await this.connectToApi()\n\n\t\tconst response = await client.emit('unregister-skill::v2020_12_25', {\n\t\t\ttarget: {\n\t\t\t\tskillId,\n\t\t\t},\n\t\t})\n\n\t\teventResponseUtil.getFirstResponseOrThrow(response)\n\n\t\tif (SkillStore.currentSkill?.id === skillId) {\n\t\t\tSkillStore.currentSkill = undefined\n\t\t\tthis.Service('auth').logoutCurrentSkill()\n\t\t}\n\t}\n\n\tpublic async fetchMySkills() {\n\t\treturn this.fetchAllSkills({ shouldOnlyShowMine: true })\n\t}\n\n\tpublic async fetchAllSkills(query?: {\n\t\tshouldOnlyShowMine?: boolean\n\t\tnamespaces?: string[]\n\t}) {\n\t\tconst client = await this.connectToApi()\n\n\t\tconst response = await client.emit('list-skills::v2020_12_25', {\n\t\t\tpayload: {\n\t\t\t\t...query,\n\t\t\t},\n\t\t})\n\n\t\tconst { skills } = eventResponseUtil.getFirstResponseOrThrow(response)\n\n\t\treturn skills\n\t}\n}\n"],"file":"SkillStore.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/skill/stores/SkillStore.ts"],"names":["SkillStore","values","options","isRegisteringCurrentSkill","assertInSkill","name","slug","description","connectToApi","client","emit","payload","results","eventResponseUtil","getFirstResponseOrThrow","skill","setCurrentSkillsNamespace","Service","updateCurrentSkill","isInstalled","isMarkedAsInstalled","SpruceError","code","currentSkill","getCurrentSkill","shouldAuthAsCurrentSkill","target","skillId","id","response","namespacePascal","namesUtil","toPascal","isRegistered","apiKey","getNamespaceFromPkg","getEventNamespaceForNotRegistered","getSkillDescriptionFromPkg","loadCurrentSkill","pkg","nameFromPackage","get","Error","fallback","current","namespace","isCurrentSkillRegistered","friendlyMessage","updateCurrentSkillNamespace","undefined","logoutCurrentSkill","fetchAllSkills","shouldOnlyShowMine","query","skills","AbstractStore"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;IAaqBA,U;;;;;;;;;;;;;;;6FACG,O;;;;;;;oGAOvB,iBACCC,MADD,EAECC,OAFD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAIOC,gBAAAA,yBAJP,GAKE,CAAAD,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEC,yBAAT,MAAuC,KALzC;AAOCA,gBAAAA,yBAAyB,IAAI,KAAKC,aAAL,EAA7B;AAEQC,gBAAAA,IATT,GASqCJ,MATrC,CASSI,IATT,EASeC,IATf,GASqCL,MATrC,CASeK,IATf,EASqBC,WATrB,GASqCN,MATrC,CASqBM,WATrB;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,SAApB;AACA;;;EANsCM,0B;;;iCAAnBvD,U","sourcesContent":["import { eventResponseUtil } from '@sprucelabs/spruce-event-utils'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractStore from '../../../stores/AbstractStore'\nimport { CurrentSkill, RegisteredSkill } from '../../../types/cli.types'\n\nexport interface CreateSkill {\n\tname: string\n\tslug: string\n\tdescription?: string\n}\n\nexport interface RegisterSkillOptions {\n\tisRegisteringCurrentSkill?: boolean\n}\n\nexport default class SkillStore extends AbstractStore {\n\tpublic readonly name = 'skill'\n\tprivate static currentSkill?: CurrentSkill\n\n\tpublic static clearCurrentSkill() {\n\t\tthis.currentSkill = undefined\n\t}\n\n\tpublic async register(\n\t\tvalues: CreateSkill,\n\t\toptions?: RegisterSkillOptions\n\t): Promise<RegisteredSkill> {\n\t\tconst isRegisteringCurrentSkill =\n\t\t\toptions?.isRegisteringCurrentSkill !== false\n\n\t\tisRegisteringCurrentSkill && this.assertInSkill()\n\n\t\tconst { name, slug, description } = values\n\t\tconst client = await this.connectToApi()\n\n\t\tconst results = await client.emit('register-skill::v2020_12_25', {\n\t\t\tpayload: {\n\t\t\t\tname,\n\t\t\t\tslug,\n\t\t\t\tdescription,\n\t\t\t},\n\t\t})\n\n\t\tconst { skill } = eventResponseUtil.getFirstResponseOrThrow(results)\n\n\t\tif (isRegisteringCurrentSkill) {\n\t\t\tawait this.setCurrentSkillsNamespace(skill.slug)\n\t\t\tthis.Service('auth').updateCurrentSkill(skill)\n\t\t}\n\n\t\treturn skill\n\t}\n\n\tprivate assertInSkill() {\n\t\tconst isInstalled = this.Service('settings').isMarkedAsInstalled('skill')\n\n\t\tif (!isInstalled) {\n\t\t\tthrow new SpruceError({ code: 'DIRECTORY_NOT_SKILL' })\n\t\t}\n\t}\n\n\tpublic async loadCurrentSkill(): Promise<CurrentSkill> {\n\t\tif (SkillStore.currentSkill) {\n\t\t\treturn SkillStore.currentSkill\n\t\t}\n\n\t\tthis.assertInSkill()\n\n\t\tconst currentSkill = this.Service('auth').getCurrentSkill()\n\n\t\tif (currentSkill) {\n\t\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\t\tconst response = await client.emit('get-skill::v2020_12_25', {\n\t\t\t\ttarget: {\n\t\t\t\t\tskillId: currentSkill.id,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { skill } = eventResponseUtil.getFirstResponseOrThrow(response)\n\n\t\t\tSkillStore.currentSkill = {\n\t\t\t\t...skill,\n\t\t\t\tnamespacePascal: namesUtil.toPascal(skill.slug),\n\t\t\t\tisRegistered: true,\n\t\t\t\tapiKey: currentSkill.apiKey,\n\t\t\t}\n\n\t\t\treturn SkillStore.currentSkill as CurrentSkill\n\t\t}\n\n\t\treturn {\n\t\t\tname: this.getNamespaceFromPkg(),\n\t\t\tnamespacePascal: this.getEventNamespaceForNotRegistered(),\n\t\t\tdescription: this.getSkillDescriptionFromPkg(),\n\t\t\tisRegistered: false,\n\t\t}\n\t}\n\n\tpublic async isCurrentSkillRegistered() {\n\t\tconst skill = await this.loadCurrentSkill()\n\t\treturn skill.isRegistered\n\t}\n\n\tprivate getNamespaceFromPkg() {\n\t\tconst pkg = this.Service('pkg')\n\t\tconst nameFromPackage = pkg.get('skill.namespace')\n\t\tif (!nameFromPackage) {\n\t\t\tthrow new Error(\n\t\t\t\t'You need need to set skill.namespace in the package.json'\n\t\t\t)\n\t\t}\n\t\treturn nameFromPackage\n\t}\n\n\tpublic async loadCurrentSkillsNamespace() {\n\t\tconst fallback = namesUtil.toPascal(this.getNamespaceFromPkg())\n\n\t\tif (this.Service('auth').getCurrentSkill()) {\n\t\t\tconst current = await this.loadCurrentSkill()\n\t\t\treturn namesUtil.toPascal(current.slug ?? fallback)\n\t\t}\n\n\t\treturn fallback\n\t}\n\n\tpublic async setCurrentSkillsNamespace(namespace: string) {\n\t\tlet isRegistered = false\n\t\ttry {\n\t\t\tisRegistered = await this.isCurrentSkillRegistered()\n\t\t\t// eslint-disable-next-line no-empty\n\t\t} catch {}\n\n\t\tif (isRegistered) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'GENERIC',\n\t\t\t\tfriendlyMessage: `You can't set the namespace of a skill that is registered.`,\n\t\t\t})\n\t\t}\n\n\t\tthis.Service('auth').updateCurrentSkillNamespace(namespace)\n\t}\n\n\tprivate getEventNamespaceForNotRegistered() {\n\t\treturn namesUtil.toPascal(this.getNamespaceFromPkg())\n\t}\n\n\tprivate getSkillDescriptionFromPkg() {\n\t\tconst pkg = this.Service('pkg')\n\t\treturn pkg.get('description')\n\t}\n\n\tpublic async unregisterSkill(skillId: string) {\n\t\tconst client = await this.connectToApi()\n\n\t\tconst response = await client.emit('unregister-skill::v2020_12_25', {\n\t\t\ttarget: {\n\t\t\t\tskillId,\n\t\t\t},\n\t\t})\n\n\t\teventResponseUtil.getFirstResponseOrThrow(response)\n\n\t\tif (SkillStore.currentSkill?.id === skillId) {\n\t\t\tSkillStore.currentSkill = undefined\n\t\t\tthis.Service('auth').logoutCurrentSkill()\n\t\t}\n\t}\n\n\tpublic async fetchMySkills() {\n\t\treturn this.fetchAllSkills({ shouldOnlyShowMine: true })\n\t}\n\n\tpublic async fetchAllSkills(query?: {\n\t\tshouldOnlyShowMine?: boolean\n\t\tnamespaces?: string[]\n\t}) {\n\t\tconst client = await this.connectToApi()\n\n\t\tconst response = await client.emit('list-skills::v2020_12_25', {\n\t\t\tpayload: {\n\t\t\t\t...query,\n\t\t\t},\n\t\t})\n\n\t\tconst { skills } = eventResponseUtil.getFirstResponseOrThrow(response)\n\n\t\treturn skills\n\t}\n}\n"],"file":"SkillStore.js"}
|
|
@@ -17,7 +17,7 @@ export default class StoreFeature extends AbstractFeature {
|
|
|
17
17
|
actionsDir: string;
|
|
18
18
|
constructor(options: FeatureOptions);
|
|
19
19
|
private registerAbstractTestClassHandler;
|
|
20
|
-
private
|
|
20
|
+
private handleWillExecute;
|
|
21
21
|
afterPackageInstall(): Promise<{
|
|
22
22
|
files: import("../../writers/AbstractWriter").WriteResults;
|
|
23
23
|
}>;
|
|
@@ -61,7 +61,7 @@ var StoreFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
61
61
|
}]);
|
|
62
62
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "actionsDir", _spruceSkillUtils.diskUtil.resolvePath(__dirname, 'actions'));
|
|
63
63
|
void _this.emitter.on('test.register-abstract-test-classes', _this.registerAbstractTestClassHandler.bind((0, _assertThisInitialized2["default"])(_this)));
|
|
64
|
-
void _this.emitter.on('feature.
|
|
64
|
+
void _this.emitter.on('feature.will-execute', _this.handleWillExecute.bind((0, _assertThisInitialized2["default"])(_this)));
|
|
65
65
|
return _this;
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -97,9 +97,9 @@ var StoreFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
97
97
|
return registerAbstractTestClassHandler;
|
|
98
98
|
}()
|
|
99
99
|
}, {
|
|
100
|
-
key: "
|
|
100
|
+
key: "handleWillExecute",
|
|
101
101
|
value: function () {
|
|
102
|
-
var
|
|
102
|
+
var _handleWillExecute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(payload) {
|
|
103
103
|
var isInstalled;
|
|
104
104
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
105
105
|
while (1) {
|
|
@@ -134,11 +134,11 @@ var StoreFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
134
134
|
}, _callee2, this);
|
|
135
135
|
}));
|
|
136
136
|
|
|
137
|
-
function
|
|
138
|
-
return
|
|
137
|
+
function handleWillExecute(_x) {
|
|
138
|
+
return _handleWillExecute.apply(this, arguments);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
return
|
|
141
|
+
return handleWillExecute;
|
|
142
142
|
}()
|
|
143
143
|
}, {
|
|
144
144
|
key: "afterPackageInstall",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/store/StoreFeature.ts"],"names":["StoreFeature","options","code","isRequired","name","isDev","diskUtil","resolvePath","__dirname","emitter","on","registerAbstractTestClassHandler","bind","
|
|
1
|
+
{"version":3,"sources":["../../../src/features/store/StoreFeature.ts"],"names":["StoreFeature","options","code","isRequired","name","isDev","diskUtil","resolvePath","__dirname","emitter","on","registerAbstractTestClassHandler","bind","handleWillExecute","abstractClasses","label","featureCode","payload","featureInstaller","isInstalled","actionCode","uiUtil","renderMasthead","ui","headline","Action","execute","Writer","writePlugin","cwd","files","AbstractFeature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;IAYqBA,Y;;;;;AAiBpB,wBAAmBC,OAAnB,EAA4C;AAAA;;AAAA;AAC3C,8BAAMA,OAAN;AAD2C,qGAhBtB,aAgBsB;AAAA,oGAfvB,4CAeuB;AAAA,6FAdjB,OAciB;AAAA,qGAbD,CAC1C;AACCC,MAAAA,IAAI,EAAE,OADP;AAECC,MAAAA,UAAU,EAAE;AAFb,KAD0C,CAaC;AAAA,4GAPf,CAC5B;AAAEC,MAAAA,IAAI,EAAE,wCAAR;AAAkDC,MAAAA,KAAK,EAAE;AAAzD,KAD4B,EAE5B;AAAED,MAAAA,IAAI,EAAE,gCAAR;AAA0CC,MAAAA,KAAK,EAAE;AAAjD,KAF4B,CAOe;AAAA,mGAFxBC,2BAASC,WAAT,CAAqBC,SAArB,EAAgC,SAAhC,CAEwB;AAG3C,SAAK,MAAKC,OAAL,CAAaC,EAAb,CACJ,qCADI,EAEJ,MAAKC,gCAAL,CAAsCC,IAAtC,gDAFI,CAAL;AAIA,SAAK,MAAKH,OAAL,CAAaC,EAAb,CACJ,sBADI,EAEJ,MAAKG,iBAAL,CAAuBD,IAAvB,gDAFI,CAAL;AAP2C;AAW3C;;;;;4HAED;AAAA;AAAA;AAAA;AAAA;AAAA,iDACQ;AACNE,kBAAAA,eAAe,EAAE,CAChB;AACCV,oBAAAA,IAAI,EAAE,mBADP;AAECW,oBAAAA,KAAK,EAAE,mBAFR;AAGC,8BAAQ,iCAHT;AAICC,oBAAAA,WAAW,EAAE;AAJd,mBADgB;AADX,iBADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;6GAaA,kBAAgCC,OAAhC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAI2B,KAAKC,gBAAL,CAAsBC,WAAtB,CAAkC,OAAlC,CAJ3B;;AAAA;AAIOA,gBAAAA,WAJP;;AAAA,sBAOEA,WAAW,IACXF,OAAO,CAACD,WAAR,KAAwB,MADxB,IAEAC,OAAO,CAACG,UAAR,KAAuB,SATzB;AAAA;AAAA;AAAA;;AAWEC,+BAAOC,cAAP,CAAsB;AACrBC,kBAAAA,EAAE,EAAE,KAAKA,EADY;AAErBC,kBAAAA,QAAQ,EAAE;AAFW,iBAAtB;;AAXF,kDAeS,KAAKC,MAAL,CAAY,OAAZ,EAAqB,MAArB,EAA6BC,OAA7B,CAAqC,EAArC,CAfT;;AAAA;AAAA,kDAkBQ,EAlBR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;+GAqBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBACqB,KAAKC,MAAL,CAAY,OAAZ,EAAqBC,WAArB,CAAiC,KAAKC,GAAtC,CADrB;;AAAA;AACOC,gBAAAA,KADP;AAAA,kDAEQ;AACNA,kBAAAA,KAAK,EAALA;AADM,iBAFR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAhEyCC,4B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport uiUtil from '../../utilities/ui.utility'\nimport AbstractFeature, {\n\tFeatureDependency,\n\tFeatureOptions,\n} from '../AbstractFeature'\nimport { FeatureCode } from '../features.types'\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tstore: StoreFeature\n\t}\n}\n\nexport default class StoreFeature extends AbstractFeature {\n\tpublic nameReadable = 'Data Stores'\n\tpublic description = 'For working with remote places of storage.'\n\tpublic code: FeatureCode = 'store'\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\t\t{ name: '@sprucelabs/spruce-store-plugin@latest', isDev: false },\n\t\t{ name: '@sprucelabs/data-stores@latest', isDev: false },\n\t]\n\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\n\tpublic constructor(options: FeatureOptions) {\n\t\tsuper(options)\n\n\t\tvoid this.emitter.on(\n\t\t\t'test.register-abstract-test-classes',\n\t\t\tthis.registerAbstractTestClassHandler.bind(this)\n\t\t)\n\t\tvoid this.emitter.on(\n\t\t\t'feature.will-execute',\n\t\t\tthis.handleWillExecute.bind(this)\n\t\t)\n\t}\n\n\tprivate async registerAbstractTestClassHandler() {\n\t\treturn {\n\t\t\tabstractClasses: [\n\t\t\t\t{\n\t\t\t\t\tname: 'AbstractStoreTest',\n\t\t\t\t\tlabel: 'AbstractStoreTest',\n\t\t\t\t\timport: '@sprucelabs/spruce-store-plugin',\n\t\t\t\t\tfeatureCode: 'store',\n\t\t\t\t},\n\t\t\t],\n\t\t}\n\t}\n\n\tprivate async handleWillExecute(payload: {\n\t\tfeatureCode: string\n\t\tactionCode: string\n\t}) {\n\t\tconst isInstalled = await this.featureInstaller.isInstalled('store')\n\n\t\tif (\n\t\t\tisInstalled &&\n\t\t\tpayload.featureCode === 'node' &&\n\t\t\tpayload.actionCode === 'upgrade'\n\t\t) {\n\t\t\tuiUtil.renderMasthead({\n\t\t\t\tui: this.ui,\n\t\t\t\theadline: 'Resyncing data stores...',\n\t\t\t})\n\t\t\treturn this.Action('store', 'sync').execute({})\n\t\t}\n\n\t\treturn {}\n\t}\n\n\tpublic async afterPackageInstall() {\n\t\tconst files = await this.Writer('store').writePlugin(this.cwd)\n\t\treturn {\n\t\t\tfiles,\n\t\t}\n\t}\n}\n"],"file":"StoreFeature.js"}
|
|
@@ -68,7 +68,7 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
68
68
|
key: "execute",
|
|
69
69
|
value: function () {
|
|
70
70
|
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_options) {
|
|
71
|
-
var stores, files, destination, builder, templateItems;
|
|
71
|
+
var stores, files, destination, builder, templateItems, writer;
|
|
72
72
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
73
73
|
while (1) {
|
|
74
74
|
switch (_context.prev = _context.next) {
|
|
@@ -82,39 +82,40 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
82
82
|
files = [];
|
|
83
83
|
|
|
84
84
|
if (!(stores.length > 0)) {
|
|
85
|
-
_context.next =
|
|
85
|
+
_context.next = 13;
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
destination = _spruceSkillUtils.diskUtil.resolveHashSprucePath(this.cwd, 'stores');
|
|
90
90
|
builder = new _StoreTemplateItemBuilder["default"]();
|
|
91
91
|
templateItems = builder.buildTemplateItems(stores, destination);
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
writer = this.Writer('store');
|
|
93
|
+
_context.next = 12;
|
|
94
|
+
return writer.writeTypesAndMap(destination, {
|
|
94
95
|
stores: templateItems
|
|
95
96
|
});
|
|
96
97
|
|
|
97
|
-
case
|
|
98
|
+
case 12:
|
|
98
99
|
files = _context.sent;
|
|
99
100
|
|
|
100
|
-
case
|
|
101
|
+
case 13:
|
|
101
102
|
return _context.abrupt("return", {
|
|
102
103
|
files: files
|
|
103
104
|
});
|
|
104
105
|
|
|
105
|
-
case
|
|
106
|
-
_context.prev =
|
|
106
|
+
case 16:
|
|
107
|
+
_context.prev = 16;
|
|
107
108
|
_context.t0 = _context["catch"](0);
|
|
108
109
|
return _context.abrupt("return", {
|
|
109
110
|
errors: [_context.t0]
|
|
110
111
|
});
|
|
111
112
|
|
|
112
|
-
case
|
|
113
|
+
case 19:
|
|
113
114
|
case "end":
|
|
114
115
|
return _context.stop();
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
}, _callee, this, [[0,
|
|
118
|
+
}, _callee, this, [[0, 16]]);
|
|
118
119
|
}));
|
|
119
120
|
|
|
120
121
|
function execute(_x) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/store/actions/SyncAction.ts"],"names":["optionsSchema","id","description","fields","SyncAction","_options","Store","fetchStores","stores","files","length","destination","diskUtil","resolveHashSprucePath","cwd","builder","StoreTemplateItemBuilder","templateItems","buildTemplateItems","Writer","
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/store/actions/SyncAction.ts"],"names":["optionsSchema","id","description","fields","SyncAction","_options","Store","fetchStores","stores","files","length","destination","diskUtil","resolveHashSprucePath","cwd","builder","StoreTemplateItemBuilder","templateItems","buildTemplateItems","writer","Writer","writeTypesAndMap","errors","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,sBAD6B;AAEjCC,EAAAA,WAAW,EACV,uEAHgC;AAIjCC,EAAAA,MAAM,EAAE;AAJyB,CAAZ,CAAtB;;IAUqBC,U;;;;;;;;;;;;;;;sGACGJ,a;uGACC,CAAC,aAAD,C;0GAEvB,2D;;;;;;;mGAED,iBAAqBK,QAArB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEuB,KAAKC,KAAL,CAAW,OAAX,EAAoBC,WAApB,EAFvB;;AAAA;AAEQC,gBAAAA,MAFR;AAIMC,gBAAAA,KAJN,GAI+B,EAJ/B;;AAAA,sBAMMD,MAAM,CAACE,MAAP,GAAgB,CANtB;AAAA;AAAA;AAAA;;AAOSC,gBAAAA,WAPT,GAOuBC,2BAASC,qBAAT,CAA+B,KAAKC,GAApC,EAAyC,QAAzC,CAPvB;AAQSC,gBAAAA,OART,GAQmB,IAAIC,oCAAJ,EARnB;AASSC,gBAAAA,aATT,GASyBF,OAAO,CAACG,kBAAR,CAA2BV,MAA3B,EAAmCG,WAAnC,CATzB;AAWSQ,gBAAAA,MAXT,GAWkB,KAAKC,MAAL,CAAY,OAAZ,CAXlB;AAAA;AAAA,uBAYiBD,MAAM,CAACE,gBAAP,CAAwBV,WAAxB,EAAqC;AAClDH,kBAAAA,MAAM,EAAES;AAD0C,iBAArC,CAZjB;;AAAA;AAYGR,gBAAAA,KAZH;;AAAA;AAAA,iDAiBS;AACNA,kBAAAA,KAAK,EAALA;AADM,iBAjBT;;AAAA;AAAA;AAAA;AAAA,iDAqBS;AACNa,kBAAAA,MAAM,EAAE;AADF,iBArBT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EANuCC,2B","sourcesContent":["import { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractAction from '../../AbstractAction'\nimport StoreTemplateItemBuilder from '../templateItemBuilders/StoreTemplateItemBuilder'\n\nconst optionsSchema = buildSchema({\n\tid: 'syncDataStoreOptions',\n\tdescription:\n\t\t\"Only needed if you change a store's name, manually add or remove one.\",\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = optionsSchema\n\tpublic commandAliases = ['sync.stores']\n\tpublic invocationMessage =\n\t\t'Generating store types and setting up store factory... 💿'\n\n\tpublic async execute(_options: Options) {\n\t\ttry {\n\t\t\tconst stores = await this.Store('store').fetchStores()\n\n\t\t\tlet files: GeneratedFile[] = []\n\n\t\t\tif (stores.length > 0) {\n\t\t\t\tconst destination = diskUtil.resolveHashSprucePath(this.cwd, 'stores')\n\t\t\t\tconst builder = new StoreTemplateItemBuilder()\n\t\t\t\tconst templateItems = builder.buildTemplateItems(stores, destination)\n\n\t\t\t\tconst writer = this.Writer('store')\n\t\t\t\tfiles = await writer.writeTypesAndMap(destination, {\n\t\t\t\t\tstores: templateItems,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tfiles,\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"],"file":"SyncAction.js"}
|
|
@@ -3,7 +3,13 @@ import AbstractWriter from '../../../writers/AbstractWriter';
|
|
|
3
3
|
export default class StoreWriter extends AbstractWriter {
|
|
4
4
|
writeStore(destination: string, options: StoreTemplateOptions): Promise<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.GeneratedFile[]>;
|
|
5
5
|
writePlugin(cwd: string): Promise<import("../../../writers/AbstractWriter").WriteResults>;
|
|
6
|
+
writeTypesAndMap(destination: string, options: {
|
|
7
|
+
stores: StoreTemplateItem[];
|
|
8
|
+
}): Promise<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.GeneratedFile[]>;
|
|
6
9
|
writeTypes(destination: string, options: {
|
|
7
10
|
stores: StoreTemplateItem[];
|
|
8
11
|
}): Promise<import("../../../writers/AbstractWriter").WriteResults>;
|
|
12
|
+
writeMap(destination: string, options: {
|
|
13
|
+
stores: StoreTemplateItem[];
|
|
14
|
+
}): Promise<import("../../../writers/AbstractWriter").WriteResults>;
|
|
9
15
|
}
|
|
@@ -9,6 +9,10 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
12
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
17
|
|
|
14
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -104,37 +108,103 @@ var StoreWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
|
104
108
|
return results;
|
|
105
109
|
}
|
|
106
110
|
}, {
|
|
107
|
-
key: "
|
|
111
|
+
key: "writeTypesAndMap",
|
|
108
112
|
value: function () {
|
|
109
|
-
var
|
|
110
|
-
var
|
|
113
|
+
var _writeTypesAndMap = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(destination, options) {
|
|
114
|
+
var _yield$Promise$all, _yield$Promise$all2, types, map;
|
|
115
|
+
|
|
111
116
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
112
117
|
while (1) {
|
|
113
118
|
switch (_context2.prev = _context2.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
_context2.next = 2;
|
|
121
|
+
return Promise.all([this.writeTypes(destination, options), this.writeMap(destination, options)]);
|
|
122
|
+
|
|
123
|
+
case 2:
|
|
124
|
+
_yield$Promise$all = _context2.sent;
|
|
125
|
+
_yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 2);
|
|
126
|
+
types = _yield$Promise$all2[0];
|
|
127
|
+
map = _yield$Promise$all2[1];
|
|
128
|
+
return _context2.abrupt("return", [].concat((0, _toConsumableArray2["default"])(types), (0, _toConsumableArray2["default"])(map)));
|
|
129
|
+
|
|
130
|
+
case 7:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context2.stop();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, _callee2, this);
|
|
136
|
+
}));
|
|
137
|
+
|
|
138
|
+
function writeTypesAndMap(_x3, _x4) {
|
|
139
|
+
return _writeTypesAndMap.apply(this, arguments);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return writeTypesAndMap;
|
|
143
|
+
}()
|
|
144
|
+
}, {
|
|
145
|
+
key: "writeTypes",
|
|
146
|
+
value: function () {
|
|
147
|
+
var _writeTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(destination, options) {
|
|
148
|
+
var file, typesContent, files;
|
|
149
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
150
|
+
while (1) {
|
|
151
|
+
switch (_context3.prev = _context3.next) {
|
|
114
152
|
case 0:
|
|
115
153
|
file = _spruceSkillUtils.diskUtil.resolvePath(destination, 'stores.types.ts');
|
|
116
154
|
typesContent = this.templates.storeTypes(options);
|
|
117
155
|
files = this.writeFileIfChangedMixinResults(file, typesContent, 'The type merging for so the StoreFactory properly types you stores.');
|
|
118
|
-
|
|
156
|
+
_context3.next = 5;
|
|
119
157
|
return this.lint(file);
|
|
120
158
|
|
|
121
159
|
case 5:
|
|
122
|
-
return
|
|
160
|
+
return _context3.abrupt("return", files);
|
|
123
161
|
|
|
124
162
|
case 6:
|
|
125
163
|
case "end":
|
|
126
|
-
return
|
|
164
|
+
return _context3.stop();
|
|
127
165
|
}
|
|
128
166
|
}
|
|
129
|
-
},
|
|
167
|
+
}, _callee3, this);
|
|
130
168
|
}));
|
|
131
169
|
|
|
132
|
-
function writeTypes(
|
|
170
|
+
function writeTypes(_x5, _x6) {
|
|
133
171
|
return _writeTypes.apply(this, arguments);
|
|
134
172
|
}
|
|
135
173
|
|
|
136
174
|
return writeTypes;
|
|
137
175
|
}()
|
|
176
|
+
}, {
|
|
177
|
+
key: "writeMap",
|
|
178
|
+
value: function () {
|
|
179
|
+
var _writeMap = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(destination, options) {
|
|
180
|
+
var file, mapContent, files;
|
|
181
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
182
|
+
while (1) {
|
|
183
|
+
switch (_context4.prev = _context4.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
file = _spruceSkillUtils.diskUtil.resolvePath(destination, 'stores.ts');
|
|
186
|
+
mapContent = this.templates.stores(options);
|
|
187
|
+
files = this.writeFileIfChangedMixinResults(file, mapContent, 'A reference to all your data stores for easy inclusion.');
|
|
188
|
+
_context4.next = 5;
|
|
189
|
+
return this.lint(file);
|
|
190
|
+
|
|
191
|
+
case 5:
|
|
192
|
+
return _context4.abrupt("return", files);
|
|
193
|
+
|
|
194
|
+
case 6:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context4.stop();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}, _callee4, this);
|
|
200
|
+
}));
|
|
201
|
+
|
|
202
|
+
function writeMap(_x7, _x8) {
|
|
203
|
+
return _writeMap.apply(this, arguments);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return writeMap;
|
|
207
|
+
}()
|
|
138
208
|
}]);
|
|
139
209
|
return StoreWriter;
|
|
140
210
|
}(_AbstractWriter2["default"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/store/writers/StoreWriter.ts"],"names":["StoreWriter","destination","options","namePascalPlural","files","filename","fileDest","diskUtil","resolvePath","doesFileExist","SpruceError","code","contents","templates","store","writeFile","lint","push","action","name","path","cwd","resolveHashSprucePath","pluginContents","storePlugin","results","writeFileIfChangedMixinResults","file","typesContent","storeTypes","AbstractWriter"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/store/writers/StoreWriter.ts"],"names":["StoreWriter","destination","options","namePascalPlural","files","filename","fileDest","diskUtil","resolvePath","doesFileExist","SpruceError","code","contents","templates","store","writeFile","lint","push","action","name","path","cwd","resolveHashSprucePath","pluginContents","storePlugin","results","writeFileIfChangedMixinResults","Promise","all","writeTypes","writeMap","types","map","file","typesContent","storeTypes","mapContent","stores","AbstractWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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AAAA,kDAeQ7B,KAfR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAnFwCkC,2B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tStoreTemplateItem,\n\tStoreTemplateOptions,\n} from '@sprucelabs/spruce-templates'\nimport SpruceError from '../../../errors/SpruceError'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractWriter from '../../../writers/AbstractWriter'\n\nexport default class StoreWriter extends AbstractWriter {\n\tpublic async writeStore(destination: string, options: StoreTemplateOptions) {\n\t\tconst { namePascalPlural } = options\n\n\t\tconst files: GeneratedFile[] = []\n\n\t\tconst filename = `${namePascalPlural}.store.ts`\n\n\t\tconst fileDest = diskUtil.resolvePath(\n\t\t\tdestination,\n\t\t\t'src',\n\t\t\t'stores',\n\t\t\tfilename\n\t\t)\n\n\t\tif (diskUtil.doesFileExist(fileDest)) {\n\t\t\tthrow new SpruceError({ code: 'STORE_EXISTS' })\n\t\t}\n\n\t\tconst contents = this.templates.store(options)\n\n\t\tdiskUtil.writeFile(fileDest, contents)\n\n\t\tawait this.lint(fileDest)\n\n\t\tfiles.push({\n\t\t\taction: 'generated',\n\t\t\tname: filename,\n\t\t\tpath: fileDest,\n\t\t})\n\n\t\treturn files\n\t}\n\n\tpublic writePlugin(cwd: string) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tcwd,\n\t\t\t'features',\n\t\t\t'store.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.storePlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Loads all your data stores and connects you to any databases you have configured.'\n\t\t)\n\n\t\treturn results\n\t}\n\n\tpublic async writeTypesAndMap(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst [types, map] = await Promise.all([\n\t\t\tthis.writeTypes(destination, options),\n\t\t\tthis.writeMap(destination, options),\n\t\t])\n\n\t\treturn [...types, ...map]\n\t}\n\n\tpublic async writeTypes(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst file = diskUtil.resolvePath(destination, 'stores.types.ts')\n\n\t\tconst typesContent = this.templates.storeTypes(options)\n\n\t\tconst files = this.writeFileIfChangedMixinResults(\n\t\t\tfile,\n\t\t\ttypesContent,\n\t\t\t'The type merging for so the StoreFactory properly types you stores.'\n\t\t)\n\n\t\tawait this.lint(file)\n\n\t\treturn files\n\t}\n\n\tpublic async writeMap(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst file = diskUtil.resolvePath(destination, 'stores.ts')\n\t\tconst mapContent = this.templates.stores(options)\n\n\t\tconst files = this.writeFileIfChangedMixinResults(\n\t\t\tfile,\n\t\t\tmapContent,\n\t\t\t'A reference to all your data stores for easy inclusion.'\n\t\t)\n\n\t\tawait this.lint(file)\n\n\t\treturn files\n\t}\n}\n"],"file":"StoreWriter.js"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SpruceSchemas } from '@sprucelabs/mercury-types';
|
|
2
2
|
import { EnvService } from '@sprucelabs/spruce-skill-utils';
|
|
3
|
+
import PkgService from './PkgService';
|
|
3
4
|
declare type PersonWithToken = SpruceSchemas.SpruceCli.v2020_07_22.PersonWithToken;
|
|
4
5
|
export interface SkillAuth {
|
|
5
6
|
id: string;
|
|
@@ -9,12 +10,14 @@ export interface SkillAuth {
|
|
|
9
10
|
}
|
|
10
11
|
export default class AuthService {
|
|
11
12
|
private env;
|
|
12
|
-
|
|
13
|
+
private pkg;
|
|
14
|
+
constructor(envService: EnvService, pkgService: PkgService);
|
|
13
15
|
getLoggedInPerson(): PersonWithToken | null;
|
|
14
16
|
setLoggedInPerson(person: PersonWithToken): void;
|
|
15
17
|
logOutPerson(): void;
|
|
16
18
|
getCurrentSkill(): SkillAuth | null;
|
|
17
19
|
logoutCurrentSkill(): void;
|
|
18
20
|
updateCurrentSkill(skill: SkillAuth): void;
|
|
21
|
+
updateCurrentSkillNamespace(namespace: string): void;
|
|
19
22
|
}
|
|
20
23
|
export {};
|
|
@@ -15,6 +15,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
|
|
16
16
|
var _schema = require("@sprucelabs/schema");
|
|
17
17
|
|
|
18
|
+
var _spruceSkillUtils = require("@sprucelabs/spruce-skill-utils");
|
|
19
|
+
|
|
18
20
|
var _personWithToken = _interopRequireDefault(require("../.spruce/schemas/spruceCli/v2020_07_22/personWithToken.schema"));
|
|
19
21
|
|
|
20
22
|
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; }
|
|
@@ -24,10 +26,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
24
26
|
var LOGGED_IN_PERSON_KEY = 'LOGGED_IN_PERSON';
|
|
25
27
|
|
|
26
28
|
var AuthService = /*#__PURE__*/function () {
|
|
27
|
-
function AuthService(envService) {
|
|
29
|
+
function AuthService(envService, pkgService) {
|
|
28
30
|
(0, _classCallCheck2["default"])(this, AuthService);
|
|
29
31
|
(0, _defineProperty2["default"])(this, "env", void 0);
|
|
32
|
+
(0, _defineProperty2["default"])(this, "pkg", void 0);
|
|
30
33
|
this.env = envService;
|
|
34
|
+
this.pkg = pkgService;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
(0, _createClass2["default"])(AuthService, [{
|
|
@@ -61,7 +65,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
61
65
|
var id = this.env.get('SKILL_ID');
|
|
62
66
|
var apiKey = this.env.get('SKILL_API_KEY');
|
|
63
67
|
var name = this.env.get('SKILL_NAME');
|
|
64
|
-
var slug = this.
|
|
68
|
+
var slug = this.pkg.get('skill.namespace');
|
|
65
69
|
|
|
66
70
|
if (id && apiKey) {
|
|
67
71
|
return {
|
|
@@ -80,7 +84,6 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
80
84
|
this.env.unset('SKILL_ID');
|
|
81
85
|
this.env.unset('SKILL_API_KEY');
|
|
82
86
|
this.env.unset('SKILL_NAME');
|
|
83
|
-
this.env.unset('SKILL_SLUG');
|
|
84
87
|
}
|
|
85
88
|
}, {
|
|
86
89
|
key: "updateCurrentSkill",
|
|
@@ -88,7 +91,15 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
88
91
|
this.env.set('SKILL_ID', skill.id);
|
|
89
92
|
this.env.set('SKILL_API_KEY', skill.apiKey);
|
|
90
93
|
this.env.set('SKILL_NAME', skill.name);
|
|
91
|
-
this.
|
|
94
|
+
this.updateCurrentSkillNamespace(skill.slug);
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "updateCurrentSkillNamespace",
|
|
98
|
+
value: function updateCurrentSkillNamespace(namespace) {
|
|
99
|
+
this.pkg.set({
|
|
100
|
+
path: 'skill.namespace',
|
|
101
|
+
value: _spruceSkillUtils.namesUtil.toKebab(namespace)
|
|
102
|
+
});
|
|
92
103
|
}
|
|
93
104
|
}]);
|
|
94
105
|
return AuthService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/AuthService.ts"],"names":["LOGGED_IN_PERSON_KEY","AuthService","envService","env","p","get","JSON","parse","person","normalized","personWithTokenSchema","set","stringify","isLoggedIn","unset","id","apiKey","name","slug","skill"],"mappings":";;;;;;;;;;;;;;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../src/services/AuthService.ts"],"names":["LOGGED_IN_PERSON_KEY","AuthService","envService","pkgService","env","pkg","p","get","JSON","parse","person","normalized","personWithTokenSchema","set","stringify","isLoggedIn","unset","id","apiKey","name","slug","skill","updateCurrentSkillNamespace","namespace","path","value","namesUt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I,EAAJA;AAJM,SAAP;AAMA;;AAED,aAAO,IAAP;AACA;;;WAED,8BAA4B;AAC3B,WAAKhB,GAAL,CAASY,KAAT,CAAe,UAAf;AACA,WAAKZ,GAAL,CAASY,KAAT,CAAe,eAAf;AACA,WAAKZ,GAAL,CAASY,KAAT,CAAe,YAAf;AACA;;;WAED,4BAA0BK,KAA1B,EAA4C;AAC3C,WAAKjB,GAAL,CAASS,GAAT,CAAa,UAAb,EAAyBQ,KAAK,CAACJ,EAA/B;AACA,WAAKb,GAAL,CAASS,GAAT,CAAa,eAAb,EAA8BQ,KAAK,CAACH,MAApC;AACA,WAAKd,GAAL,CAASS,GAAT,CAAa,YAAb,EAA2BQ,KAAK,CAACF,IAAjC;AAEA,WAAKG,2BAAL,CAAiCD,KAAK,CAACD,IAAvC;AACA;;;WAED,qCAAmCG,SAAnC,EAAsD;AACrD,WAAKlB,GAAL,CAASQ,GAAT,CAAa;AACZW,QAAAA,IAAI,EAAE,iBADM;AAEZC,QAAAA,KAAK,EAAEC,4BAAUC,OAAV,CAAkBJ,SAAlB;AAFK,OAAb;AAIA","sourcesContent":["import { SpruceSchemas } from '@sprucelabs/mercury-types'\nimport { normalizeSchemaValues, validateSchemaValues } from '@sprucelabs/schema'\nimport { EnvService, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport personWithTokenSchema from '#spruce/schemas/spruceCli/v2020_07_22/personWithToken.schema'\nimport PkgService from './PkgService'\n\ntype PersonWithToken = SpruceSchemas.SpruceCli.v2020_07_22.PersonWithToken\n\nexport interface SkillAuth {\n\tid: string\n\tapiKey: string\n\tname: string\n\tslug: string\n}\n\nconst LOGGED_IN_PERSON_KEY = 'LOGGED_IN_PERSON'\n\nexport default class AuthService {\n\tprivate env: EnvService\n\tprivate pkg: PkgService\n\n\tpublic constructor(envService: EnvService, pkgService: PkgService) {\n\t\tthis.env = envService\n\t\tthis.pkg = pkgService\n\t}\n\n\tpublic getLoggedInPerson(): PersonWithToken | null {\n\t\tconst p = this.env.get(LOGGED_IN_PERSON_KEY)\n\t\tif (typeof p === 'string') {\n\t\t\treturn JSON.parse(p)\n\t\t}\n\n\t\treturn null\n\t}\n\n\tpublic setLoggedInPerson(person: PersonWithToken) {\n\t\tconst normalized = normalizeSchemaValues(personWithTokenSchema, person)\n\t\tvalidateSchemaValues(personWithTokenSchema, normalized)\n\n\t\tthis.env.set(\n\t\t\tLOGGED_IN_PERSON_KEY,\n\t\t\tJSON.stringify({\n\t\t\t\t...normalized,\n\t\t\t\tisLoggedIn: true,\n\t\t\t})\n\t\t)\n\t}\n\n\tpublic logOutPerson() {\n\t\tthis.env.unset(LOGGED_IN_PERSON_KEY)\n\t}\n\n\tpublic getCurrentSkill(): SkillAuth | null {\n\t\tconst id = this.env.get('SKILL_ID') as string\n\t\tconst apiKey = this.env.get('SKILL_API_KEY') as string\n\t\tconst name = this.env.get('SKILL_NAME') as string\n\t\tconst slug = this.pkg.get('skill.namespace') as string\n\n\t\tif (id && apiKey) {\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tapiKey,\n\t\t\t\tname,\n\t\t\t\tslug,\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t}\n\n\tpublic logoutCurrentSkill() {\n\t\tthis.env.unset('SKILL_ID')\n\t\tthis.env.unset('SKILL_API_KEY')\n\t\tthis.env.unset('SKILL_NAME')\n\t}\n\n\tpublic updateCurrentSkill(skill: SkillAuth) {\n\t\tthis.env.set('SKILL_ID', skill.id)\n\t\tthis.env.set('SKILL_API_KEY', skill.apiKey)\n\t\tthis.env.set('SKILL_NAME', skill.name)\n\n\t\tthis.updateCurrentSkillNamespace(skill.slug)\n\t}\n\n\tpublic updateCurrentSkillNamespace(namespace: string) {\n\t\tthis.pkg.set({\n\t\t\tpath: 'skill.namespace',\n\t\t\tvalue: namesUtil.toKebab(namespace),\n\t\t})\n\t}\n}\n"],"file":"AuthService.js"}
|
|
@@ -2,6 +2,9 @@ import CommandService from './CommandService';
|
|
|
2
2
|
export default class LintService {
|
|
3
3
|
cwd: string;
|
|
4
4
|
private command;
|
|
5
|
-
|
|
5
|
+
private static isLintingEnabled;
|
|
6
|
+
static disableLinting(): void;
|
|
7
|
+
static enableLinting(): void;
|
|
8
|
+
constructor(cwd: string, commandService: CommandService);
|
|
6
9
|
fix: (pattern: string) => Promise<string[]>;
|
|
7
10
|
}
|