@sprucelabs/spruce-cli 14.26.19 → 14.27.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 +11 -0
- package/build/.spruce/errors/errors.types.d.ts +19 -0
- package/build/.spruce/errors/options.types.d.ts +4 -1
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.d.ts +3 -0
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js +28 -0
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js.map +1 -0
- package/build/__tests__/behavioral/AddingADependency.test.d.ts +6 -3
- package/build/__tests__/behavioral/AddingADependency.test.js +116 -44
- package/build/__tests__/behavioral/AddingADependency.test.js.map +1 -1
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js +2 -2
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +1 -1
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js +4 -4
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/ManagingDependencies.test.js +3 -3
- package/build/__tests__/behavioral/ManagingDependencies.test.js.map +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingRemote.test.js +1 -1
- package/build/__tests__/behavioral/SettingRemote.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingUpVscode.test.js +3 -3
- package/build/__tests__/behavioral/SettingUpVscode.test.js.map +1 -1
- package/build/__tests__/behavioral/TestingDataStores.test.js +2 -2
- package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +2 -2
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.d.ts +3 -2
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js +156 -106
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +6 -9
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js +7 -4
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill.test.js +7 -7
- package/build/__tests__/behavioral/skill/UpgradingASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill3.test.js +2 -2
- package/build/__tests__/behavioral/skill/UpgradingASkill3.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +3 -3
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js +2 -2
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js +3 -3
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/errors/SpruceError.js +4 -0
- package/build/errors/SpruceError.js.map +1 -1
- package/build/errors/dependencyExists.builder.d.ts +11 -0
- package/build/errors/dependencyExists.builder.js +22 -0
- package/build/errors/dependencyExists.builder.js.map +1 -0
- package/build/features/AbstractAction.js +1 -1
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/dependencies/actions/AddAction.js +22 -15
- package/build/features/dependencies/actions/AddAction.js.map +1 -1
- package/build/features/event/actions/CreateAction.js +1 -1
- package/build/features/event/actions/CreateAction.js.map +1 -1
- package/build/interfaces/SpyInterface.d.ts +1 -1
- package/build/interfaces/SpyInterface.js +2 -2
- package/build/interfaces/SpyInterface.js.map +1 -1
- package/build/services/DependencyService.d.ts +1 -0
- package/build/services/DependencyService.js +18 -0
- package/build/services/DependencyService.js.map +1 -1
- package/build/tests/AbstractCliTest.js +1 -1
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/utilities/uiAssert.utility.d.ts +6 -0
- package/build/tests/utilities/uiAssert.utility.js +51 -0
- package/build/tests/utilities/uiAssert.utility.js.map +1 -0
- package/package.json +28 -26
- package/src/.spruce/errors/errors.types.ts +29 -0
- package/src/.spruce/errors/options.types.ts +4 -1
- package/src/.spruce/errors/spruceCli/dependencyExists.schema.ts +22 -0
- package/src/__tests__/behavioral/AddingADependency.test.ts +45 -8
- package/src/__tests__/behavioral/InstallingASkillAtAnOrg.test.ts +3 -3
- package/src/__tests__/behavioral/LoggingInAsASkill.test.ts +4 -4
- package/src/__tests__/behavioral/ManagingDependencies.test.ts +3 -3
- package/src/__tests__/behavioral/RememberingUpgradeSelections.test.ts +1 -1
- package/src/__tests__/behavioral/SettingRemote.test.ts +1 -1
- package/src/__tests__/behavioral/SettingUpVscode.test.ts +3 -3
- package/src/__tests__/behavioral/TestingDataStores.test.ts +2 -2
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +2 -2
- package/src/__tests__/behavioral/events/CreatingAnEvent.test.ts +44 -22
- package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +1 -1
- package/src/__tests__/behavioral/schemas/KeepingSchemasInSync.test.ts +2 -0
- package/src/__tests__/behavioral/skill/UpgradingASkill.test.ts +7 -7
- package/src/__tests__/behavioral/skill/UpgradingASkill3.test.ts +2 -2
- package/src/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.ts +1 -1
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +3 -3
- package/src/__tests__/behavioral/views/TestingViewControllers.test.ts +2 -2
- package/src/__tests__/implementation/ActionExecuter2.test.ts +3 -3
- package/src/errors/SpruceError.ts +4 -0
- package/src/errors/dependencyExists.builder.ts +12 -0
- package/src/features/AbstractAction.ts +1 -4
- package/src/features/dependencies/actions/AddAction.ts +12 -5
- package/src/features/event/actions/CreateAction.ts +4 -1
- package/src/interfaces/SpyInterface.ts +1 -1
- package/src/services/DependencyService.ts +14 -0
- package/src/tests/AbstractCliTest.ts +1 -1
- package/src/tests/utilities/uiAssert.utility.ts +29 -0
|
@@ -1 +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","
|
|
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","dependencyService","Service","dependencies","get","map","d","choices","filter","s","indexOf","slug","value","name","ui","prompt","isRequired","skill","find","SpruceError","code","friendlyMessage","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,4BAAD,C;0GACG,2B;;;;;;;mGAE3B,iBAAqBS,OAArB;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wCACqB,KAAKC,2BAAL,CAAiCD,OAAjC,CADrB,EACOL,SADP,yBACOA,SADP;AAAA;AAAA,uBAGsB,KAAKO,KAAL,CAAW,OAAX,EAAoBC,cAApB,EAHtB;;AAAA;AAGOC,gBAAAA,MAHP;AAIOC,gBAAAA,iBAJP,GAI2B,KAAKC,OAA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7B,EADW;AAErBG,kBAAAA,SAAS,EAAE0B,KAAK,CAACN;AAFI,iBAAtB;AAnCD,iDAwCQ;AACNY,kBAAAA,YAAY,EAAE,mBAAWN,KAAK,CAACJ,IAAjB;AADR,iBAxCR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EALyCW,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 [namespace]']\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\t\tconst dependencyService = this.Service('dependency')\n\n\t\tif (!namespace) {\n\t\t\tconst dependencies = dependencyService.get().map((d) => d.namespace)\n\n\t\t\tconst choices = skills\n\t\t\t\t.filter((s) => dependencies.indexOf(s.slug) === -1)\n\t\t\t\t.map((s) => ({\n\t\t\t\t\tvalue: s.slug,\n\t\t\t\t\tlabel: s.name,\n\t\t\t\t}))\n\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,\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\tdependencyService.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"}
|
|
@@ -131,7 +131,7 @@ var CreateAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
131
131
|
_context.prev = 6;
|
|
132
132
|
destinationDir = _spruceSkillUtils.diskUtil.resolvePath(this.cwd, 'src', 'events');
|
|
133
133
|
_context.next = 10;
|
|
134
|
-
return this.resolveVersion(version, destinationDir);
|
|
134
|
+
return this.resolveVersion(version, _spruceSkillUtils.diskUtil.resolvePath(destinationDir, '**', '*'));
|
|
135
135
|
|
|
136
136
|
case 10:
|
|
137
137
|
resolvedVersion = _context.sent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/event/actions/CreateAction.ts"],"names":["optionsSchema","id","description","fields","nameReadable","namedTemplateItemBuilder","isRequired","nameKebab","label","hint","nameCamel","isGlobal","type","version","isPrivate","syncEventActionBuilder","CreateAction","options","validateAndNormalizeOptions","Store","loadCurrentSkill","skill","slug","errors","SpruceError","code","destinationDir","diskUtil","resolvePath","cwd","resolveVersion","resolvedVersion","Writer","writeEvent","files","syncOptions","syncEventActionSchema","shouldIncludePrivateFields","Action","execute","syncResponse","fqen","eventNameUtil","join","eventName","eventNamespace","actionUtil","mergeActionResults","meta","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAGA,IAAMA,aAAa,GAAG,yB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AK,CAACC,IARzB;AAAA;AAAA;AAAA;;AAAA,iDASS;AACNC,kBAAAA,MAAM,EAAE,CAAC,IAAIC,uBAAJ,CAAgB;AAAEC,oBAAAA,IAAI,EAAE;AAAR,mBAAhB,CAAD;AADF,iBATT;;AAAA;AAAA;AAeQC,gBAAAA,cAfR,GAeyBC,2BAASC,WAAT,CAAqB,KAAKC,GAA1B,EAA+B,KAA/B,EAAsC,QAAtC,CAfzB;AAAA;AAAA,uBAgBgC,KAAKC,cAAL,
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/event/actions/CreateAction.ts"],"names":["optionsSchema","id","description","fields","nameReadable","namedTemplateItemBuilder","isRequired","nameKebab","label","hint","nameCamel","isGlobal","type","version","isPrivate","syncEventActionBuilder","CreateAction","options","validateAndNormalizeOptions","Store","loadCurrentSkill","skill","slug","errors","SpruceError","code","destinationDir","diskUtil","resolvePath","cwd","resolveVersion","resolvedVersion","Writer","writeEvent","files","syncOptions","syncEventActionSchema","shouldIncludePrivateFields","Action","execute","syncResponse","fqen","eventNameUtil","join","eventName","eventNamespace","actionUtil","mergeActionResults","meta","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAGA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,mBAD6B;AAEjCC,EAAAA,WAAW,EACV,+EAHgC;AAIjCC,EAAAA,MAAM;AACLC,IAAAA,YAAY,kCACRC,8BAAyBF,MAAzB,CAAgCC,YADxB;AAEXE,MAAAA,UAAU,EAAE;AAFD,MADP;AAKLC,IAAAA,SAAS,kCACLF,8BAAyBF,MAAzB,CAAgCI,SAD3B;AAERC,MAAAA,KAAK,EAAE,YAFC;AAGRC,MAAAA,IAAI,cAHI;AAIRH,MAAAA,UAAU,EAAE;AAJJ,MALJ;AAWLI,IAAAA,SAAS,kCACLL,8BAAyBF,MAAzB,CAAgCO,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hBhC;;AAAA;AAgBQK,gBAAAA,eAhBR;AAAA;AAAA,uBAqBsB,KAAKC,MAAL,CAAY,OAAZ,EAAqBC,UAArB,CAAgCP,cAAhC,EAAgD;AACnEnB,kBAAAA,SAAS,EAATA,SADmE;AAEnEG,kBAAAA,SAAS,EAATA,SAFmE;AAGnEG,kBAAAA,OAAO,EAAEkB,eAH0D;AAInE3B,kBAAAA,YAAY,EAAZA,YAJmE;AAKnEO,kBAAAA,QAAQ,EAARA;AALmE,iBAAhD,CArBtB;;AAAA;AAqBQuB,gBAAAA,KArBR;AA6BQC,gBAAAA,WA7BR,GA6BsB,mCACnBC,4BADmB,EAEnBnB,OAFmB,EAGnB;AACCoB,kBAAAA,0BAA0B,EAAE;AAD7B,iBAHmB,CA7BtB;AAAA;AAAA,uBAqC6B,KAAKC,MAAL,CAAY,OAAZ,EAAqB,MAArB,EAA6BC,OAA7B,CAC1BJ,WAD0B,CArC7B;;AAAA;AAqCQK,gBAAAA,YArCR;AAyCQC,gBAAAA,IAzCR,GAyCeC,gCAAcC,IAAd,CAAmB;AAC/BC,kBAAAA,SAAS,EAAErC,SADoB;AAE/BsC,kBAAAA,cAAc,EAAExB,KAAK,CAACC,IAFS;AAG/BT,kBAAAA,OAAO,EAAEkB;AAHsB,iBAAnB,CAzCf;AAAA,iDA+CSe,mBAAWC,kBAAX,CACN;AAAEb,kBAAAA,KAAK,EAALA,KAAF;AAASc,kBAAAA,IAAI,EAAE;AAAEP,oBAAAA,IAAI,EAAJA;AAAF;AAAf,iBADM,EAEND,YAFM,CA/CT;;AAAA;AAAA;AAAA;AAAA,iDAoDS;AACNjB,kBAAAA,MAAM,EAAE;AADF,iBApDT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAJyC0B,2B","sourcesContent":["import {\n\tbuildSchema,\n\tnormalizeSchemaValues,\n\tSchemaValues,\n} from '@sprucelabs/schema'\nimport { eventNameUtil } from '@sprucelabs/spruce-event-utils'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport syncEventActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/syncEventOptions.schema'\nimport SpruceError from '../../../errors/SpruceError'\nimport namedTemplateItemBuilder from '../../../schemas/v2020_07_22/namedTemplateItem.builder'\nimport syncEventActionBuilder from '../../../schemas/v2020_07_22/syncEventOptions.builder'\nimport actionUtil from '../../../utilities/action.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nconst optionsSchema = buildSchema({\n\tid: 'createEventAction',\n\tdescription:\n\t\t\"Create a new event and I'll register it with Mercury when you boot the skill!\",\n\tfields: {\n\t\tnameReadable: {\n\t\t\t...namedTemplateItemBuilder.fields.nameReadable,\n\t\t\tisRequired: true,\n\t\t},\n\t\tnameKebab: {\n\t\t\t...namedTemplateItemBuilder.fields.nameKebab,\n\t\t\tlabel: 'Event name',\n\t\t\thint: `kebab-case`,\n\t\t\tisRequired: true,\n\t\t},\n\t\tnameCamel: {\n\t\t\t...namedTemplateItemBuilder.fields.nameCamel,\n\t\t\tisRequired: true,\n\t\t},\n\t\tisGlobal: {\n\t\t\ttype: 'boolean',\n\t\t\tlabel: 'Is this a global event?',\n\t\t\thint: \"This will allow skills to listen without being installed at the same organization. You'll need permission to make this happen.\",\n\t\t},\n\t\tversion: {\n\t\t\ttype: 'text',\n\t\t\tlabel: 'Version',\n\t\t\tisPrivate: true,\n\t\t},\n\t\t...syncEventActionBuilder.fields,\n\t},\n})\n\ntype OptionsSchema = typeof optionsSchema\n\nexport default class CreateAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic invocationMessage = 'Creating a new event signature... 🜒'\n\n\tpublic async execute(\n\t\toptions: SchemaValues<OptionsSchema>\n\t): Promise<FeatureActionResponse> {\n\t\tlet { nameKebab, nameReadable, nameCamel, version, isGlobal } =\n\t\t\tthis.validateAndNormalizeOptions(options)\n\n\t\tconst skill = await this.Store('skill').loadCurrentSkill()\n\n\t\tif (!skill.id || !skill.slug) {\n\t\t\treturn {\n\t\t\t\terrors: [new SpruceError({ code: 'SKILL_NOT_REGISTERED' })],\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst destinationDir = diskUtil.resolvePath(this.cwd, 'src', 'events')\n\t\t\tconst resolvedVersion = await this.resolveVersion(\n\t\t\t\tversion,\n\t\t\t\tdiskUtil.resolvePath(destinationDir, '**', '*')\n\t\t\t)\n\n\t\t\tconst files = await this.Writer('event').writeEvent(destinationDir, {\n\t\t\t\tnameKebab,\n\t\t\t\tnameCamel,\n\t\t\t\tversion: resolvedVersion,\n\t\t\t\tnameReadable,\n\t\t\t\tisGlobal,\n\t\t\t})\n\n\t\t\tconst syncOptions = normalizeSchemaValues(\n\t\t\t\tsyncEventActionSchema,\n\t\t\t\toptions,\n\t\t\t\t{\n\t\t\t\t\tshouldIncludePrivateFields: true,\n\t\t\t\t}\n\t\t\t)\n\n\t\t\tconst syncResponse = await this.Action('event', 'sync').execute(\n\t\t\t\tsyncOptions\n\t\t\t)\n\n\t\t\tconst fqen = eventNameUtil.join({\n\t\t\t\teventName: nameKebab,\n\t\t\t\teventNamespace: skill.slug,\n\t\t\t\tversion: resolvedVersion,\n\t\t\t})\n\n\t\t\treturn actionUtil.mergeActionResults(\n\t\t\t\t{ files, meta: { fqen } },\n\t\t\t\tsyncResponse\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":"CreateAction.js"}
|
|
@@ -105,8 +105,8 @@ var SpyInterface = /*#__PURE__*/function () {
|
|
|
105
105
|
clearTimeout(this.promptTimeout);
|
|
106
106
|
}
|
|
107
107
|
}, {
|
|
108
|
-
key: "
|
|
109
|
-
value: function
|
|
108
|
+
key: "getLastInvocation",
|
|
109
|
+
value: function getLastInvocation() {
|
|
110
110
|
return this.invocations[this.invocations.length - 1];
|
|
111
111
|
}
|
|
112
112
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/interfaces/SpyInterface.ts"],"names":["SpyInterface","x","y","startTime","Date","getTime","term","shouldRenderTestLogs","TerminalInterface","process","cwd","strs","optionallyRenderLine","join","undefined","env","SHOULD_RENDER_TEST_LOGS","message","effects","trackInvocation","renderWarning","renderHint","command","options","invocations","push","promptResolver","confirmResolver","waitForEnterResolver","clearTimeout","promptTimeout","length","input","resolver","promptDefaultValue","toLowerCase","Error","Promise","resolve","setTimeout","renderSection","obj","renderObject","err","renderError","code","renderCodeSample","results","renderActionSummary","renderHero","dividerEffects","renderHeadline","renderDivider","duration","friendly","durationUtil","msToFriendly","testLog","info","global","activeTest","test","path","messages","renderLines","definition","msg","namesUtil","toPascal","type","label","choices","forEach","choice","value","reject","reset","assert","fail","defaultValue","ttl","checkInterval","loops","lastWriteCount","isWaitingForInput","hasWritten","testUtil","log","question","title","cursorPosition","pos"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AASA;;AACA;;IAEqBA,Y;AAepB,0BAAqB;AAAA;;AAAA;AAAA,0DAdsC,EActC;AAAA,6DAbI;AAAEC,MAAAA,CAAC,EAAE,CAAL;AAAQC,MAAAA,CAAC,EAAE;AAAX,KAaJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACpB,SAAKC,SAAL,GAAiB,IAAIC,IAAJ,GAAWC,OAAX,EAAjB;AAEA,SAAKC,IAAL,GAAY,KAAKC,oBAAL,KACT,IAAIC,6BAAJ,CAAsBC,OAAO,CAACC,GAAR,EAAtB,EAAqC,IAArC,EAA2C,YAAiB;AAAA,wCAAbC,IAAa;AAAbA,QAAAA,IAAa;AAAA;;AAC5D,MAAA,KAAI,CAACC,oBAAL,CAA0BD,IAAI,CAACE,IAAL,CAAU,GAAV,CAA1B;AACC,KAFD,CADS,GAITC,SAJH;AAKA;;;;WAED,gCAA+B;AAC9B,aAAOL,OAAO,CAACM,GAAR,CAAYC,uB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AArB;AACA","sourcesContent":["import { FieldDefinitionValueType } from '@sprucelabs/schema'\nimport { namesUtil, testLog } from '@sprucelabs/spruce-skill-utils'\nimport { assert } from '@sprucelabs/test'\nimport { FieldDefinitions } from '#spruce/schemas/fields/fields.types'\nimport testUtil from '../tests/utilities/test.utility'\nimport { ExecutionResults } from '../types/cli.types'\nimport { GraphicsInterface } from '../types/cli.types'\nimport {\n\tGraphicsTextEffect,\n\tProgressBarOptions,\n\tProgressBarUpdateOptions,\n\tImageDimensions,\n} from '../types/graphicsInterface.types'\nimport durationUtil from '../utilities/duration.utility'\nimport TerminalInterface from './TerminalInterface'\n\nexport default class SpyInterface implements GraphicsInterface {\n\tpublic invocations: { command: string; options?: any }[] = []\n\tprivate cursorPosition = { x: 0, y: 0 }\n\n\tprivate promptResolver?: (\n\t\tinput: FieldDefinitionValueType<FieldDefinitions>\n\t) => void | undefined\n\n\tprivate confirmResolver?: (pass: boolean) => void | undefined\n\tprivate waitForEnterResolver?: () => void | undefined\n\tprivate promptDefaultValue: any\n\tprivate term?: TerminalInterface\n\tprivate startTime: number\n\tprivate promptTimeout?: any\n\n\tpublic constructor() {\n\t\tthis.startTime = new Date().getTime()\n\n\t\tthis.term = this.shouldRenderTestLogs()\n\t\t\t? new TerminalInterface(process.cwd(), true, (...strs: []) => {\n\t\t\t\t\tthis.optionallyRenderLine(strs.join(' '))\n\t\t\t })\n\t\t\t: undefined\n\t}\n\n\tprivate shouldRenderTestLogs() {\n\t\treturn process.env.SHOULD_RENDER_TEST_LOGS === 'true'\n\t}\n\n\tpublic renderWarning(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderWarning', { message, effects })\n\t\tthis.term?.renderWarning(message)\n\t}\n\n\tpublic renderHint(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderHint', { message, effects })\n\t\tthis.optionallyRenderLine(`Hint: ${message}`)\n\t\tthis.term?.renderHint(message)\n\t}\n\n\tprivate trackInvocation(command: string, options?: any) {\n\t\t// testUtil.log(command, JSON.stringify(options), '\\n')\n\t\tthis.invocations.push({ command, options })\n\t}\n\n\tpublic isWaitingForInput() {\n\t\treturn !!(\n\t\t\tthis.promptResolver ||\n\t\t\tthis.confirmResolver ||\n\t\t\tthis.waitForEnterResolver\n\t\t)\n\t}\n\n\tpublic reset() {\n\t\tthis.promptResolver = undefined\n\t\tthis.confirmResolver = undefined\n\t\tthis.waitForEnterResolver = undefined\n\t\tclearTimeout(this.promptTimeout)\n\t}\n\n\tpublic lastInvocation() {\n\t\treturn this.invocations[this.invocations.length - 1]\n\t}\n\n\tpublic async sendInput(input: string | string[]): Promise<void> {\n\t\tthis.trackInvocation('sendInput', input)\n\n\t\tthis.optionallyRenderLine(\n\t\t\t`Sending input: \"${input.length > 0 ? input : 'ENTER'}\"`\n\t\t)\n\n\t\tif (this.waitForEnterResolver) {\n\t\t\tconst resolver = this.waitForEnterResolver\n\t\t\tthis.waitForEnterResolver = undefined\n\n\t\t\tresolver()\n\t\t} else if (this.promptResolver) {\n\t\t\tconst resolver = this.promptResolver\n\t\t\tthis.promptResolver = undefined\n\n\t\t\tresolver(input !== '\\n' && input !== '' ? input : this.promptDefaultValue)\n\t\t} else if (this.confirmResolver) {\n\t\t\tconst resolver = this.confirmResolver\n\t\t\tthis.confirmResolver = undefined\n\n\t\t\tresolver(\n\t\t\t\tinput === '\\n' ||\n\t\t\t\t\tinput.length === 0 ||\n\t\t\t\t\t(typeof input === 'string' && input.toLowerCase() === 'y')\n\t\t\t)\n\t\t} else {\n\t\t\tthrow new Error('Sent input before prompted for input')\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tsetTimeout(resolve, 50)\n\t\t})\n\t}\n\n\tpublic renderSection(options: {\n\t\theadline: string\n\t\tlines?: string[] | string[]\n\t\theadlineEffects?: GraphicsTextEffect[]\n\t\tdividerEffects?: GraphicsTextEffect[]\n\t\tbodyEffects?: GraphicsTextEffect[]\n\t\tobject?: any\n\t}): void {\n\t\tthis.trackInvocation('renderSection', options)\n\t\tthis.term?.renderSection(options)\n\t}\n\n\tpublic renderObject(obj: any): void {\n\t\tthis.trackInvocation('renderObject', obj)\n\t\tthis.term?.renderObject(obj)\n\t}\n\n\tpublic renderError(err: Error): void {\n\t\tthis.trackInvocation('renderError', err)\n\t\tthis.term?.renderError(err)\n\t}\n\n\tpublic renderCodeSample(code: string): void {\n\t\tthis.trackInvocation('renderCodeSample', code)\n\t\tthis.term?.renderCodeSample(code)\n\t}\n\n\tpublic renderActionSummary(results: ExecutionResults): void {\n\t\tthis.trackInvocation('renderCommandSummary', results)\n\t\tthis.term?.renderActionSummary(results)\n\t}\n\n\tpublic renderHero(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderHero', { message, effects })\n\t\tthis.term?.renderHero(message, effects)\n\t}\n\n\tpublic renderHeadline(\n\t\tmessage: string,\n\t\teffects: GraphicsTextEffect[],\n\t\tdividerEffects: GraphicsTextEffect[]\n\t): void {\n\t\tthis.trackInvocation('renderHeadline', { message, effects, dividerEffects })\n\t\tthis.term?.renderHeadline(message, effects, dividerEffects)\n\t}\n\n\tpublic renderDivider(effects?: GraphicsTextEffect[] | undefined): void {\n\t\tthis.trackInvocation('renderDivider', effects)\n\t\tthis.term?.renderDivider(effects)\n\t}\n\n\tpublic renderLine(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderLine', { message, effects })\n\t\tmessage && message.length > 0 && this.optionallyRenderLine(message)\n\t}\n\n\tprivate optionallyRenderLine(message: string) {\n\t\tif (this.shouldRenderTestLogs()) {\n\t\t\tconst duration = new Date().getTime() - this.startTime\n\t\t\tconst friendly = durationUtil.msToFriendly(duration)\n\n\t\t\ttestLog.info(\n\t\t\t\t`${\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tglobal.activeTest?.test ? global.activeTest?.test + ' :: ' : ''\n\t\t\t\t}${friendly} :: ${message}`\n\t\t\t)\n\t\t}\n\t}\n\n\tpublic async renderImage(\n\t\tpath: string,\n\t\toptions?: ImageDimensions\n\t): Promise<void> {\n\t\tthis.trackInvocation('renderImage', { path, options })\n\t}\n\n\tpublic renderLines(\n\t\tmessages: string[],\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderLines', { messages, effects })\n\t\tthis.term?.renderLines(messages, effects)\n\t}\n\n\tpublic async prompt<T extends FieldDefinitions>(definition: T) {\n\t\tthis.trackInvocation('prompt', definition)\n\n\t\tif (this.promptResolver) {\n\t\t\tthrow new Error(\n\t\t\t\t'Tried to double prompt. Try this.term?.sendInput() before calling prompt next.'\n\t\t\t)\n\t\t}\n\n\t\tlet msg = `${namesUtil.toPascal(definition.type)} Prompt: ${\n\t\t\tdefinition.label\n\t\t}`\n\n\t\tif (definition.type === 'select') {\n\t\t\tmsg += '\\n\\nChoices:\\n'\n\t\t\tdefinition.options.choices.forEach((choice) => {\n\t\t\t\tmsg += `\\n${choice.value}: ${choice.label}`\n\t\t\t})\n\n\t\t\tmsg += '\\n'\n\t\t}\n\n\t\tthis.optionallyRenderLine(msg)\n\n\t\treturn new Promise<FieldDefinitionValueType<FieldDefinitions>>(\n\t\t\t(resolve, reject) => {\n\t\t\t\tthis.promptResolver = (...args: any[]) => {\n\t\t\t\t\tclearTimeout(this.promptTimeout)\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tresolve(...args)\n\t\t\t\t}\n\t\t\t\tthis.promptTimeout = setTimeout(() => {\n\t\t\t\t\tthis.reset()\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tassert.fail(`Timed out waiting for input: ${definition.label}`)\n\t\t\t\t\t} catch (err: any) {\n\t\t\t\t\t\treject(err)\n\t\t\t\t\t}\n\t\t\t\t}, 10000)\n\t\t\t\tthis.promptDefaultValue = definition.defaultValue\n\t\t\t}\n\t\t)\n\t}\n\n\tpublic startLoading(message?: string | undefined): void {\n\t\tthis.trackInvocation('startLoading', message)\n\t\tthis.optionallyRenderLine(message ? `${message}` : 'Start loading...')\n\t}\n\n\tpublic stopLoading(): void {\n\t\tthis.trackInvocation('stopLoading')\n\t\tthis.optionallyRenderLine('Stop loading...')\n\t}\n\n\tpublic async waitForEnter(message?: string | undefined): Promise<void> {\n\t\tthis.trackInvocation('waitForEnter', message)\n\t\tthis.optionallyRenderLine(\n\t\t\t`${message ? ` ${message}\\n\\n` : ``}Waiting for enter...`\n\t\t)\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.waitForEnterResolver = resolve\n\t\t})\n\t}\n\n\tpublic async waitForInput() {\n\t\tconst ttl = 1000 * 60 * 5\n\t\tconst checkInterval = 100\n\t\tlet loops = ttl / checkInterval\n\t\tlet lastWriteCount = this.invocations.length\n\n\t\twhile (!this.isWaitingForInput()) {\n\t\t\tif (loops-- === 0) {\n\t\t\t\tassert.fail(`Waiting for input timed out.`)\n\t\t\t}\n\n\t\t\tconst hasWritten = lastWriteCount != this.invocations.length\n\n\t\t\tif (hasWritten) {\n\t\t\t\tloops = ttl / checkInterval\n\t\t\t\tlastWriteCount = this.invocations.length\n\t\t\t\tif (this.shouldRenderTestLogs()) {\n\t\t\t\t\ttestUtil.log('waitForInput timeout reset because of new output.')\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, checkInterval))\n\t\t}\n\t}\n\n\tpublic confirm(question: string): Promise<boolean> {\n\t\tthis.trackInvocation('confirm', question)\n\t\tthis.optionallyRenderLine(`${question} :: Y/N...`)\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.confirmResolver = resolve\n\t\t})\n\t}\n\n\tpublic clear(): void {\n\t\tthis.trackInvocation('clear')\n\t}\n\n\tpublic renderProgressBar(options: ProgressBarOptions): void {\n\t\tthis.trackInvocation('renderProgressBar', options)\n\t\tthis.optionallyRenderLine(\n\t\t\t`Showing progress${options.title ? ` ${options.title}` : ``}`\n\t\t)\n\t}\n\n\tpublic updateProgressBar(options: ProgressBarUpdateOptions): void {\n\t\tthis.trackInvocation('updateProgressBar', options)\n\t}\n\n\tpublic removeProgressBar(): void {\n\t\tthis.trackInvocation('removeProgressBar')\n\t\tthis.optionallyRenderLine(`Hiding progress`)\n\t}\n\n\tpublic async getCursorPosition(): Promise<{ x: number; y: number } | null> {\n\t\tthis.trackInvocation('getCursorPosition')\n\t\treturn this.cursorPosition\n\t}\n\n\tpublic setCursorPosition(pos: { x: number; y: number }) {\n\t\tthis.cursorPosition = pos\n\t}\n\n\tpublic moveCursorTo(x: number, y: number): void {\n\t\tthis.trackInvocation('moveCursorTo', { x, y })\n\t}\n\n\tpublic clearBelowCursor(): void {\n\t\tthis.trackInvocation('clearBelowCursor')\n\t}\n}\n"],"file":"SpyInterface.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/interfaces/SpyInterface.ts"],"names":["SpyInterface","x","y","startTime","Date","getTime","term","shouldRenderTestLogs","TerminalInterface","process","cwd","strs","optionallyRenderLine","join","undefined","env","SHOULD_RENDER_TEST_LOGS","message","effects","trackInvocation","renderWarning","renderHint","command","options","invocations","push","promptResolver","confirmResolver","waitForEnterResolver","clearTimeout","promptTimeout","length","input","resolver","promptDefaultValue","toLowerCase","Error","Promise","resolve","setTimeout","renderSection","obj","renderObject","err","renderError","code","renderCodeSample","results","renderActionSummary","renderHero","dividerEffects","renderHeadline","renderDivider","duration","friendly","durationUtil","msToFriendly","testLog","info","global","activeTest","test","path","messages","renderLines","definition","msg","namesUtil","toPascal","type","label","choices","forEach","choice","value","reject","reset","assert","fail","defaultValue","ttl","checkInterval","loops","lastWriteCount","isWaitingForInput","hasWritten","testUtil","log","question","title","cursorPosition","pos"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AASA;;AACA;;IAEqBA,Y;AAepB,0BAAqB;AAAA;;AAAA;AAAA,0DAdsC,EActC;AAAA,6DAbI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AA1C;AACA;;;WAED,6BAAiC;AAChC,WAAKJ,eAAL,CAAqB,mBAArB;AACA,WAAKP,oBAAL;AACA;;;;6GAED;AAAA;AAAA;AAAA;AAAA;AACC,qBAAKO,eAAL,CAAqB,mBAArB;AADD,kDAEQ,KAAKuE,cAFb;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAKA,2BAAyBC,GAAzB,EAAwD;AACvD,WAAKD,cAAL,GAAsBC,GAAtB;AACA;;;WAED,sBAAoB1F,CAApB,EAA+BC,CAA/B,EAAgD;AAC/C,WAAKiB,eAAL,CAAqB,cAArB,EAAqC;AAAElB,QAAAA,CAAC,EAADA,CAAF;AAAKC,QAAAA,CAAC,EAADA;AAAL,OAArC;AACA;;;WAED,4BAAgC;AAC/B,WAAKiB,eAAL,CAAqB,kBAArB;AACA","sourcesContent":["import { FieldDefinitionValueType } from '@sprucelabs/schema'\nimport { namesUtil, testLog } from '@sprucelabs/spruce-skill-utils'\nimport { assert } from '@sprucelabs/test'\nimport { FieldDefinitions } from '#spruce/schemas/fields/fields.types'\nimport testUtil from '../tests/utilities/test.utility'\nimport { ExecutionResults } from '../types/cli.types'\nimport { GraphicsInterface } from '../types/cli.types'\nimport {\n\tGraphicsTextEffect,\n\tProgressBarOptions,\n\tProgressBarUpdateOptions,\n\tImageDimensions,\n} from '../types/graphicsInterface.types'\nimport durationUtil from '../utilities/duration.utility'\nimport TerminalInterface from './TerminalInterface'\n\nexport default class SpyInterface implements GraphicsInterface {\n\tpublic invocations: { command: string; options?: any }[] = []\n\tprivate cursorPosition = { x: 0, y: 0 }\n\n\tprivate promptResolver?: (\n\t\tinput: FieldDefinitionValueType<FieldDefinitions>\n\t) => void | undefined\n\n\tprivate confirmResolver?: (pass: boolean) => void | undefined\n\tprivate waitForEnterResolver?: () => void | undefined\n\tprivate promptDefaultValue: any\n\tprivate term?: TerminalInterface\n\tprivate startTime: number\n\tprivate promptTimeout?: any\n\n\tpublic constructor() {\n\t\tthis.startTime = new Date().getTime()\n\n\t\tthis.term = this.shouldRenderTestLogs()\n\t\t\t? new TerminalInterface(process.cwd(), true, (...strs: []) => {\n\t\t\t\t\tthis.optionallyRenderLine(strs.join(' '))\n\t\t\t })\n\t\t\t: undefined\n\t}\n\n\tprivate shouldRenderTestLogs() {\n\t\treturn process.env.SHOULD_RENDER_TEST_LOGS === 'true'\n\t}\n\n\tpublic renderWarning(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderWarning', { message, effects })\n\t\tthis.term?.renderWarning(message)\n\t}\n\n\tpublic renderHint(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderHint', { message, effects })\n\t\tthis.optionallyRenderLine(`Hint: ${message}`)\n\t\tthis.term?.renderHint(message)\n\t}\n\n\tprivate trackInvocation(command: string, options?: any) {\n\t\t// testUtil.log(command, JSON.stringify(options), '\\n')\n\t\tthis.invocations.push({ command, options })\n\t}\n\n\tpublic isWaitingForInput() {\n\t\treturn !!(\n\t\t\tthis.promptResolver ||\n\t\t\tthis.confirmResolver ||\n\t\t\tthis.waitForEnterResolver\n\t\t)\n\t}\n\n\tpublic reset() {\n\t\tthis.promptResolver = undefined\n\t\tthis.confirmResolver = undefined\n\t\tthis.waitForEnterResolver = undefined\n\t\tclearTimeout(this.promptTimeout)\n\t}\n\n\tpublic getLastInvocation() {\n\t\treturn this.invocations[this.invocations.length - 1]\n\t}\n\n\tpublic async sendInput(input: string | string[]): Promise<void> {\n\t\tthis.trackInvocation('sendInput', input)\n\n\t\tthis.optionallyRenderLine(\n\t\t\t`Sending input: \"${input.length > 0 ? input : 'ENTER'}\"`\n\t\t)\n\n\t\tif (this.waitForEnterResolver) {\n\t\t\tconst resolver = this.waitForEnterResolver\n\t\t\tthis.waitForEnterResolver = undefined\n\n\t\t\tresolver()\n\t\t} else if (this.promptResolver) {\n\t\t\tconst resolver = this.promptResolver\n\t\t\tthis.promptResolver = undefined\n\n\t\t\tresolver(input !== '\\n' && input !== '' ? input : this.promptDefaultValue)\n\t\t} else if (this.confirmResolver) {\n\t\t\tconst resolver = this.confirmResolver\n\t\t\tthis.confirmResolver = undefined\n\n\t\t\tresolver(\n\t\t\t\tinput === '\\n' ||\n\t\t\t\t\tinput.length === 0 ||\n\t\t\t\t\t(typeof input === 'string' && input.toLowerCase() === 'y')\n\t\t\t)\n\t\t} else {\n\t\t\tthrow new Error('Sent input before prompted for input')\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tsetTimeout(resolve, 50)\n\t\t})\n\t}\n\n\tpublic renderSection(options: {\n\t\theadline: string\n\t\tlines?: string[] | string[]\n\t\theadlineEffects?: GraphicsTextEffect[]\n\t\tdividerEffects?: GraphicsTextEffect[]\n\t\tbodyEffects?: GraphicsTextEffect[]\n\t\tobject?: any\n\t}): void {\n\t\tthis.trackInvocation('renderSection', options)\n\t\tthis.term?.renderSection(options)\n\t}\n\n\tpublic renderObject(obj: any): void {\n\t\tthis.trackInvocation('renderObject', obj)\n\t\tthis.term?.renderObject(obj)\n\t}\n\n\tpublic renderError(err: Error): void {\n\t\tthis.trackInvocation('renderError', err)\n\t\tthis.term?.renderError(err)\n\t}\n\n\tpublic renderCodeSample(code: string): void {\n\t\tthis.trackInvocation('renderCodeSample', code)\n\t\tthis.term?.renderCodeSample(code)\n\t}\n\n\tpublic renderActionSummary(results: ExecutionResults): void {\n\t\tthis.trackInvocation('renderCommandSummary', results)\n\t\tthis.term?.renderActionSummary(results)\n\t}\n\n\tpublic renderHero(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderHero', { message, effects })\n\t\tthis.term?.renderHero(message, effects)\n\t}\n\n\tpublic renderHeadline(\n\t\tmessage: string,\n\t\teffects: GraphicsTextEffect[],\n\t\tdividerEffects: GraphicsTextEffect[]\n\t): void {\n\t\tthis.trackInvocation('renderHeadline', { message, effects, dividerEffects })\n\t\tthis.term?.renderHeadline(message, effects, dividerEffects)\n\t}\n\n\tpublic renderDivider(effects?: GraphicsTextEffect[] | undefined): void {\n\t\tthis.trackInvocation('renderDivider', effects)\n\t\tthis.term?.renderDivider(effects)\n\t}\n\n\tpublic renderLine(\n\t\tmessage: string,\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderLine', { message, effects })\n\t\tmessage && message.length > 0 && this.optionallyRenderLine(message)\n\t}\n\n\tprivate optionallyRenderLine(message: string) {\n\t\tif (this.shouldRenderTestLogs()) {\n\t\t\tconst duration = new Date().getTime() - this.startTime\n\t\t\tconst friendly = durationUtil.msToFriendly(duration)\n\n\t\t\ttestLog.info(\n\t\t\t\t`${\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tglobal.activeTest?.test ? global.activeTest?.test + ' :: ' : ''\n\t\t\t\t}${friendly} :: ${message}`\n\t\t\t)\n\t\t}\n\t}\n\n\tpublic async renderImage(\n\t\tpath: string,\n\t\toptions?: ImageDimensions\n\t): Promise<void> {\n\t\tthis.trackInvocation('renderImage', { path, options })\n\t}\n\n\tpublic renderLines(\n\t\tmessages: string[],\n\t\teffects?: GraphicsTextEffect[] | undefined\n\t): void {\n\t\tthis.trackInvocation('renderLines', { messages, effects })\n\t\tthis.term?.renderLines(messages, effects)\n\t}\n\n\tpublic async prompt<T extends FieldDefinitions>(definition: T) {\n\t\tthis.trackInvocation('prompt', definition)\n\n\t\tif (this.promptResolver) {\n\t\t\tthrow new Error(\n\t\t\t\t'Tried to double prompt. Try this.term?.sendInput() before calling prompt next.'\n\t\t\t)\n\t\t}\n\n\t\tlet msg = `${namesUtil.toPascal(definition.type)} Prompt: ${\n\t\t\tdefinition.label\n\t\t}`\n\n\t\tif (definition.type === 'select') {\n\t\t\tmsg += '\\n\\nChoices:\\n'\n\t\t\tdefinition.options.choices.forEach((choice) => {\n\t\t\t\tmsg += `\\n${choice.value}: ${choice.label}`\n\t\t\t})\n\n\t\t\tmsg += '\\n'\n\t\t}\n\n\t\tthis.optionallyRenderLine(msg)\n\n\t\treturn new Promise<FieldDefinitionValueType<FieldDefinitions>>(\n\t\t\t(resolve, reject) => {\n\t\t\t\tthis.promptResolver = (...args: any[]) => {\n\t\t\t\t\tclearTimeout(this.promptTimeout)\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tresolve(...args)\n\t\t\t\t}\n\t\t\t\tthis.promptTimeout = setTimeout(() => {\n\t\t\t\t\tthis.reset()\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tassert.fail(`Timed out waiting for input: ${definition.label}`)\n\t\t\t\t\t} catch (err: any) {\n\t\t\t\t\t\treject(err)\n\t\t\t\t\t}\n\t\t\t\t}, 10000)\n\t\t\t\tthis.promptDefaultValue = definition.defaultValue\n\t\t\t}\n\t\t)\n\t}\n\n\tpublic startLoading(message?: string | undefined): void {\n\t\tthis.trackInvocation('startLoading', message)\n\t\tthis.optionallyRenderLine(message ? `${message}` : 'Start loading...')\n\t}\n\n\tpublic stopLoading(): void {\n\t\tthis.trackInvocation('stopLoading')\n\t\tthis.optionallyRenderLine('Stop loading...')\n\t}\n\n\tpublic async waitForEnter(message?: string | undefined): Promise<void> {\n\t\tthis.trackInvocation('waitForEnter', message)\n\t\tthis.optionallyRenderLine(\n\t\t\t`${message ? ` ${message}\\n\\n` : ``}Waiting for enter...`\n\t\t)\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.waitForEnterResolver = resolve\n\t\t})\n\t}\n\n\tpublic async waitForInput() {\n\t\tconst ttl = 1000 * 60 * 5\n\t\tconst checkInterval = 100\n\t\tlet loops = ttl / checkInterval\n\t\tlet lastWriteCount = this.invocations.length\n\n\t\twhile (!this.isWaitingForInput()) {\n\t\t\tif (loops-- === 0) {\n\t\t\t\tassert.fail(`Waiting for input timed out.`)\n\t\t\t}\n\n\t\t\tconst hasWritten = lastWriteCount != this.invocations.length\n\n\t\t\tif (hasWritten) {\n\t\t\t\tloops = ttl / checkInterval\n\t\t\t\tlastWriteCount = this.invocations.length\n\t\t\t\tif (this.shouldRenderTestLogs()) {\n\t\t\t\t\ttestUtil.log('waitForInput timeout reset because of new output.')\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, checkInterval))\n\t\t}\n\t}\n\n\tpublic confirm(question: string): Promise<boolean> {\n\t\tthis.trackInvocation('confirm', question)\n\t\tthis.optionallyRenderLine(`${question} :: Y/N...`)\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.confirmResolver = resolve\n\t\t})\n\t}\n\n\tpublic clear(): void {\n\t\tthis.trackInvocation('clear')\n\t}\n\n\tpublic renderProgressBar(options: ProgressBarOptions): void {\n\t\tthis.trackInvocation('renderProgressBar', options)\n\t\tthis.optionallyRenderLine(\n\t\t\t`Showing progress${options.title ? ` ${options.title}` : ``}`\n\t\t)\n\t}\n\n\tpublic updateProgressBar(options: ProgressBarUpdateOptions): void {\n\t\tthis.trackInvocation('updateProgressBar', options)\n\t}\n\n\tpublic removeProgressBar(): void {\n\t\tthis.trackInvocation('removeProgressBar')\n\t\tthis.optionallyRenderLine(`Hiding progress`)\n\t}\n\n\tpublic async getCursorPosition(): Promise<{ x: number; y: number } | null> {\n\t\tthis.trackInvocation('getCursorPosition')\n\t\treturn this.cursorPosition\n\t}\n\n\tpublic setCursorPosition(pos: { x: number; y: number }) {\n\t\tthis.cursorPosition = pos\n\t}\n\n\tpublic moveCursorTo(x: number, y: number): void {\n\t\tthis.trackInvocation('moveCursorTo', { x, y })\n\t}\n\n\tpublic clearBelowCursor(): void {\n\t\tthis.trackInvocation('clearBelowCursor')\n\t}\n}\n"],"file":"SpyInterface.js"}
|
|
@@ -13,6 +13,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _SpruceError = _interopRequireDefault(require("../errors/SpruceError"));
|
|
17
|
+
|
|
16
18
|
var DependencyService = /*#__PURE__*/function () {
|
|
17
19
|
function DependencyService(settings) {
|
|
18
20
|
(0, _classCallCheck2["default"])(this, DependencyService);
|
|
@@ -30,10 +32,26 @@ var DependencyService = /*#__PURE__*/function () {
|
|
|
30
32
|
value: function add(dependency) {
|
|
31
33
|
var _this$settings$get;
|
|
32
34
|
|
|
35
|
+
this.assertDependencyDoesNotExist(dependency.namespace);
|
|
33
36
|
var dependencies = (_this$settings$get = this.settings.get('dependencies')) !== null && _this$settings$get !== void 0 ? _this$settings$get : [];
|
|
34
37
|
dependencies.push(dependency);
|
|
35
38
|
this.settings.set('dependencies', dependencies);
|
|
36
39
|
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "assertDependencyDoesNotExist",
|
|
42
|
+
value: function assertDependencyDoesNotExist(namespace) {
|
|
43
|
+
var dependencies = this.get();
|
|
44
|
+
var match = dependencies.find(function (d) {
|
|
45
|
+
return d.namespace === namespace;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (match) {
|
|
49
|
+
throw new _SpruceError["default"]({
|
|
50
|
+
code: 'DEPENDENCY_EXISTS',
|
|
51
|
+
namespace: namespace
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
37
55
|
}, {
|
|
38
56
|
key: "get",
|
|
39
57
|
value: function get() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/DependencyService.ts"],"names":["DependencyService","settings","dependencies","set","dependency","get","push"],"mappings":";;;;;;;;;;;;;;;IAOqBA,iB;AAEpB,6BAAmBC,QAAnB,EAA8C;AAAA;AAAA;AAC7C,SAAKA,QAAL,GAAgBA,QAAhB;AACA;;;;WAED,aAAWC,YAAX,EAAuC;AACtC,WAAKD,QAAL,CAAcE,GAAd,CAAkB,cAAlB,EAAkCD,YAAlC;AACA;;;WAED,aAAWE,UAAX,EAAmC;AAAA;;AAClC,
|
|
1
|
+
{"version":3,"sources":["../../src/services/DependencyService.ts"],"names":["DependencyService","settings","dependencies","set","dependency","assertDependencyDoesNotExist","namespace","get","push","match","find","d","SpruceError","code"],"mappings":";;;;;;;;;;;;;;;AACA;;IAOqBA,iB;AAEpB,6BAAmBC,QAAnB,EAA8C;AAAA;AAAA;AAC7C,SAAKA,QAAL,GAAgBA,QAAhB;AACA;;;;WAED,aAAWC,YAAX,EAAuC;AACtC,WAAKD,QAAL,CAAcE,GAAd,CAAkB,cAAlB,EAAkCD,YAAlC;AACA;;;WAED,aAAWE,UAAX,EAAmC;AAAA;;AAClC,WAAKC,4BAAL,CAAkCD,UAAU,CAACE,SAA7C;AAEA,UAAMJ,YAAY,yBAAG,KAAKD,QAAL,CAAcM,GAAd,CAAkB,cAAlB,CAAH,mEAAwC,EAA1D;AACAL,MAAAA,YAAY,CAACM,IAAb,CAAkBJ,UAAlB;AACA,WAAKH,QAAL,CAAcE,GAAd,CAAkB,cAAlB,EAAkCD,YAAlC;AACA;;;WACD,sCAAqCI,SAArC,EAAwD;AACvD,UAAMJ,YAAY,GAAG,KAAKK,GAAL,EAArB;AACA,UAAME,KAAK,GAAGP,YAAY,CAACQ,IAAb,CAAkB,UAACC,CAAD;AAAA,eAAOA,CAAC,CAACL,SAAF,KAAgBA,SAAvB;AAAA,OAAlB,CAAd;;AAEA,UAAIG,KAAJ,EAAW;AACV,cAAM,IAAIG,uBAAJ,CAAgB;AACrBC,UAAAA,IAAI,EAAE,mBADe;AAErBP,UAAAA,SAAS,EAATA;AAFqB,SAAhB,CAAN;AAIA;AACD;;;WAED,eAA2B;AAAA;;AAC1B,oCAAO,KAAKL,QAAL,CAAcM,GAAd,CAAkB,cAAlB,CAAP,qEAA4C,EAA5C;AACA","sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\nimport SpruceError from '../errors/SpruceError'\n\ninterface Dependency {\n\tid: string\n\tnamespace: string\n}\n\nexport default class DependencyService {\n\tprivate settings: SettingsService<string>\n\tpublic constructor(settings: SettingsService) {\n\t\tthis.settings = settings\n\t}\n\n\tpublic set(dependencies: Dependency[]) {\n\t\tthis.settings.set('dependencies', dependencies)\n\t}\n\n\tpublic add(dependency: Dependency) {\n\t\tthis.assertDependencyDoesNotExist(dependency.namespace)\n\n\t\tconst dependencies = this.settings.get('dependencies') ?? []\n\t\tdependencies.push(dependency)\n\t\tthis.settings.set('dependencies', dependencies)\n\t}\n\tprivate assertDependencyDoesNotExist(namespace: string) {\n\t\tconst dependencies = this.get()\n\t\tconst match = dependencies.find((d) => d.namespace === namespace)\n\n\t\tif (match) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'DEPENDENCY_EXISTS',\n\t\t\t\tnamespace,\n\t\t\t})\n\t\t}\n\t}\n\n\tpublic get(): Dependency[] {\n\t\treturn this.settings.get('dependencies') ?? []\n\t}\n}\n"],"file":"DependencyService.js"}
|
|
@@ -900,7 +900,7 @@ var AbstractCliTest = /*#__PURE__*/function (_AbstractSpruceTest) {
|
|
|
900
900
|
}, {
|
|
901
901
|
key: "selectOptionBasedOnLabel",
|
|
902
902
|
value: function selectOptionBasedOnLabel(label) {
|
|
903
|
-
var last = this.ui.
|
|
903
|
+
var last = this.ui.getLastInvocation();
|
|
904
904
|
|
|
905
905
|
_test.assert.doesInclude(last.options.options.choices, {
|
|
906
906
|
label: label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tests/AbstractCliTest.ts"],"names":["AbstractCliTest","cleanTestDirsAndFiles","AbstractWriter","disableLinting","ImportService","setCacheDir","diskUtil","createRandomTempDir","enableCaching","process","env","ENABLE_INSTALL_INTERTAINMENT","originalEnv","testUtil","startLogTimer","SchemaRegistry","getInstance","forgetAllSchemas","cwd","freshTmpDir","homeDir","emitter","undefined","featureInstaller","OnboardingStore","overrideCwd","ui","reset","invocations","setCursorPosition","x","y","clearFixtures","clearCache","SkillStore","clearCurrentSkill","EventStore","CommandService","clearMockResponses","organizationFixture","clearAllOrgs","mercuryFixture","disconnectAll","_ui","isWaitingForInput","Error","doesDirExist","shouldClearCache","deleteDir","shouldCleanupTestSkillDirs","FeatureFixture","deleteOldSkillDirs","pattern","resolveTestPath","matches","match","deleteFile","personFixture","skillFixture","viewFixture","tmpDirectory","resolveTestDir","uuid","v4","fs","ensureDirSync","SpyInterface","CliGlobalEmitter","Emitter","pathAfterTestDirsAndFiles","pathUtil","join","cliRoot","options","Cli","fixture","linkLocalPackages","type","sf","ServiceFactory","Service","getEmitter","serviceFactory","apiClientFactory","getMercuryFixture","getApiClientFactory","getFeatureInstaller","MercuryFixture","PersonFixture","writerFactory","WriterFactory","viewWriter","Writer","fileDescriptions","ViewFixture","Action","templates","settings","execute","promise","waitForInput","sendInput","results","OrganizationFixture","getPersonFixture","StoreFactory","SkillFixture","filePath","resolveHashSprucePath","storeFactory","actionExecuter","ActionExecuter","FeatureInstallerFactory","WithAllFeatures","code","Store","isInstalled","assert","isTrue","files","file","checker","check","path","connectToApi","all","dir","wait","timeout","log","featureCode","actionCode","executer","shouldThrowOnListenerError","actionFactory","ActionFactory","optionOverrides","shouldInstallMissingDependencies","featureInstallerFactory","shouldAutoHandleDependencies","label","last","lastInvocation","doesInclude","choices","find","o","value","AbstractSpruceTest","__dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAGA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;IAM8BA,e;;;;;;;;;;;;;qGAc7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,uBAEO,KAAKC,qBAAL,EAFP;;AAAA;AAICC,2CAAeC,cAAf;;AAEAC,0CAAcC,WAAd,CAA0BC,2BAASC,mBAAT,EAA1B;;AACAH,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UAAMC,IAAI,GAAG,KAAKnH,EAAL,CAAQoH,cAAR,EAAb;;AACAzB,mBAAO0B,WAAP,CAAmBF,IAAI,CAACpE,OAAL,CAAaA,OAAb,CAAqBuE,OAAxC,EAAiD;AAChDJ,QAAAA,KAAK,EAALA;AADgD,OAAjD;;AAIA,UAAMrF,KAAK,GAAGsF,IAAI,CAACpE,OAAL,CAAaA,OAAb,CAAqBuE,OAArB,CAA6BC,IAA7B,CACb,UAACC,CAAD;AAAA,eAAYA,CAAC,CAACN,KAAF,KAAYA,KAAxB;AAAA,OADa,CAAd;AAIA,WAAK,KAAKlH,EAAL,CAAQ2E,SAAR,WAAqB9C,KAAK,CAAC4F,KAA3B,EAAL;AACA;;;EA3aoDC,gB;;;iCAAxBpJ,e,aACFsE,iBAASC,IAAT,CAAc8E,SAAd,EAAyB,IAAzB,C;iCADErJ,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e","sourcesContent":["import pathUtil from 'path'\nimport { SchemaRegistry } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { templates } from '@sprucelabs/spruce-templates'\nimport AbstractSpruceTest, { assert } from '@sprucelabs/test'\nimport fs from 'fs-extra'\nimport globby from 'globby'\nimport * as uuid from 'uuid'\nimport { CliBootOptions } from '../cli'\nimport AbstractAction from '../features/AbstractAction'\nimport { FeatureOptions } from '../features/AbstractFeature'\nimport ActionExecuter, {\n\tActionExecuterOptions,\n} from '../features/ActionExecuter'\nimport ActionFactory from '../features/ActionFactory'\nimport EventStore from '../features/event/stores/EventStore'\nimport FeatureInstaller from '../features/FeatureInstaller'\nimport FeatureInstallerFactory from '../features/FeatureInstallerFactory'\nimport { FeatureActionResponse, FeatureCode } from '../features/features.types'\nimport OnboardingStore from '../features/onboard/stores/OnboardingStore'\nimport SkillStore from '../features/skill/stores/SkillStore'\nimport CliGlobalEmitter, { GlobalEmitter } from '../GlobalEmitter'\nimport SpyInterface from '../interfaces/SpyInterface'\nimport CommandService from '../services/CommandService'\nimport ImportService from '../services/ImportService'\nimport ServiceFactory, { Service, ServiceMap } from '../services/ServiceFactory'\nimport StoreFactory, {\n\tStoreCode,\n\tStoreFactoryMethodOptions,\n\tStoreFactoryOptions,\n\tStoreMap,\n} from '../stores/StoreFactory'\nimport { ApiClientFactoryOptions } from '../types/apiClient.types'\nimport { OptionOverrides } from '../types/cli.types'\nimport AbstractWriter from '../writers/AbstractWriter'\nimport WriterFactory from '../writers/WriterFactory'\nimport FeatureFixture, {\n\tFeatureFixtureOptions,\n} from './fixtures/FeatureFixture'\nimport MercuryFixture from './fixtures/MercuryFixture'\nimport OrganizationFixture from './fixtures/OrganizationFixture'\nimport PersonFixture from './fixtures/PersonFixture'\nimport SkillFixture from './fixtures/SkillFixture'\nimport ViewFixture from './fixtures/ViewFixture'\nimport testUtil from './utilities/test.utility'\n\ntype ExecuterOptions = Partial<ActionExecuterOptions> & {\n\toptionOverrides?: OptionOverrides\n}\n\nexport default abstract class AbstractCliTest extends AbstractSpruceTest {\n\tprotected static cliRoot = pathUtil.join(__dirname, '..')\n\tprotected static homeDir: string\n\n\tprivate static _ui: SpyInterface\n\tprivate static emitter?: GlobalEmitter\n\tprivate static mercuryFixture?: MercuryFixture\n\tprivate static personFixture?: PersonFixture\n\tprivate static organizationFixture?: OrganizationFixture\n\tprivate static skillFixture?: SkillFixture\n\tprivate static featureInstaller?: FeatureInstaller\n\tprivate static viewFixture?: ViewFixture\n\tprivate static originalEnv: { [x: string]: string | undefined }\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tawait this.cleanTestDirsAndFiles()\n\n\t\tAbstractWriter.disableLinting()\n\n\t\tImportService.setCacheDir(diskUtil.createRandomTempDir())\n\t\tImportService.enableCaching()\n\n\t\tprocess.env.ENABLE_INSTALL_INTERTAINMENT = 'false'\n\n\t\tthis.originalEnv = { ...process.env }\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\n\t\t//@ts-ignore\n\t\tprocess.env = { ...this.originalEnv }\n\n\t\ttestUtil.startLogTimer()\n\n\t\tSchemaRegistry.getInstance().forgetAllSchemas()\n\n\t\tthis.cwd = this.freshTmpDir()\n\t\tthis.homeDir = this.freshTmpDir()\n\n\t\tthis.emitter = undefined\n\t\tthis.featureInstaller = undefined\n\n\t\tOnboardingStore.overrideCwd(diskUtil.createRandomTempDir())\n\n\t\tthis.ui.reset()\n\t\tthis.ui.invocations = []\n\t\tthis.ui.setCursorPosition({ x: 0, y: 0 })\n\n\t\tthis.clearFixtures()\n\n\t\tImportService.clearCache()\n\t\tSkillStore.clearCurrentSkill()\n\t\tEventStore.clearCache()\n\t\tCommandService.clearMockResponses()\n\t}\n\n\tprotected static async afterEach() {\n\t\tawait super.afterEach()\n\n\t\tawait this.organizationFixture?.clearAllOrgs()\n\t\tawait this.mercuryFixture?.disconnectAll()\n\n\t\tthis.clearFixtures()\n\n\t\tif (this._ui?.isWaitingForInput()) {\n\t\t\tthrow new Error(\n\t\t\t\t`Terminal interface is waiting for input. Make sure you are invoking this.term.sendInput() as many times as needed.`\n\t\t\t)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.cwd) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.cwd)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.homeDir) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.homeDir)\n\t\t}\n\t}\n\n\tprotected static async afterAll() {\n\t\tawait super.afterAll()\n\t\tif (testUtil.shouldCleanupTestSkillDirs()) {\n\t\t\tFeatureFixture.deleteOldSkillDirs()\n\t\t}\n\t}\n\n\tprivate static async cleanTestDirsAndFiles() {\n\t\tconst pattern = this.resolveTestPath('**/*.d.ts')\n\t\tconst matches = await globby(pattern)\n\n\t\tfor (const match of matches) {\n\t\t\tdiskUtil.deleteFile(match)\n\t\t}\n\t}\n\n\tprivate static clearFixtures() {\n\t\tthis.emitter = undefined\n\t\tthis.mercuryFixture = undefined\n\t\tthis.organizationFixture = undefined\n\t\tthis.personFixture = undefined\n\t\tthis.skillFixture = undefined\n\t\tthis.viewFixture = undefined\n\t}\n\n\tprotected static freshTmpDir() {\n\t\tconst tmpDirectory = testUtil.resolveTestDir(uuid.v4())\n\t\tfs.ensureDirSync(tmpDirectory)\n\t\treturn tmpDirectory\n\t}\n\n\tprotected static get ui() {\n\t\tif (!this._ui) {\n\t\t\tthis._ui = new SpyInterface()\n\t\t}\n\n\t\treturn this._ui\n\t}\n\n\tprotected static getEmitter() {\n\t\tif (!this.emitter) {\n\t\t\tthis.emitter = CliGlobalEmitter.Emitter()\n\t\t}\n\t\treturn this.emitter\n\t}\n\n\tprotected static resolveTestPath(...pathAfterTestDirsAndFiles: string[]) {\n\t\treturn pathUtil.join(\n\t\t\tthis.cliRoot,\n\t\t\t'__tests__',\n\t\t\t'testDirsAndFiles',\n\t\t\t...pathAfterTestDirsAndFiles\n\t\t)\n\t}\n\n\tprotected static async Cli(options?: CliBootOptions) {\n\t\treturn this.FeatureFixture(options).Cli({\n\t\t\tcwd: this.cwd,\n\t\t\thomeDir: this.homeDir,\n\t\t\t...(options ?? {}),\n\t\t})\n\t}\n\n\tprotected static async linkLocalPackages() {\n\t\tconst fixture = this.FeatureFixture()\n\t\tawait fixture.linkLocalPackages()\n\t}\n\n\tprotected static Service<S extends Service>(\n\t\ttype: S,\n\t\tcwd?: string\n\t): ServiceMap[S] {\n\t\tconst sf = this.ServiceFactory()\n\t\treturn sf.Service(cwd ?? this.cwd, type)\n\t}\n\n\tprotected static ServiceFactory() {\n\t\treturn new ServiceFactory()\n\t}\n\n\tprotected static FeatureFixture(options?: Partial<FeatureFixtureOptions>) {\n\t\tconst emitter = options?.emitter ?? this.getEmitter()\n\n\t\treturn new FeatureFixture({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory: this.ServiceFactory(),\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tfeatureInstaller: this.getFeatureInstaller({ emitter }),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static getMercuryFixture() {\n\t\tif (!this.mercuryFixture) {\n\t\t\tthis.mercuryFixture = new MercuryFixture(this.cwd, this.ServiceFactory())\n\t\t}\n\n\t\treturn this.mercuryFixture\n\t}\n\n\tprotected static getPersonFixture() {\n\t\tif (!this.personFixture) {\n\t\t\tthis.personFixture = new PersonFixture(\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.personFixture\n\t}\n\n\tprotected static getViewFixture() {\n\t\tif (!this.viewFixture) {\n\t\t\tconst writerFactory = this.WriterFactory()\n\n\t\t\tconst viewWriter = writerFactory.Writer('view', { fileDescriptions: [] })\n\t\t\tthis.viewFixture = new ViewFixture(\n\t\t\t\tthis.cwd,\n\t\t\t\tviewWriter,\n\t\t\t\tthis.Action('view', 'sync')\n\t\t\t)\n\t\t}\n\n\t\treturn this.viewFixture\n\t}\n\n\tprivate static WriterFactory() {\n\t\treturn new WriterFactory({\n\t\t\ttemplates,\n\t\t\tui: this.ui,\n\t\t\tsettings: this.Service('settings'),\n\t\t})\n\t}\n\n\tprotected static async skipInstallSkillPrompts<\n\t\tE extends () => Promise<FeatureActionResponse>\n\t>(\n\t\texecute?: E\n\t): Promise<E extends undefined ? undefined : FeatureActionResponse> {\n\t\tconst promise = execute?.()\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('n')\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('')\n\n\t\tconst results = await promise\n\n\t\treturn results as any\n\t}\n\n\tprotected static getOrganizationFixture() {\n\t\tif (!this.organizationFixture) {\n\t\t\tthis.organizationFixture = new OrganizationFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.organizationFixture\n\t}\n\n\tprotected static getSkillFixture() {\n\t\tif (!this.skillFixture) {\n\t\t\tthis.skillFixture = new SkillFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory(),\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.skillFixture\n\t}\n\n\tprotected static resolveHashSprucePath(...filePath: string[]) {\n\t\treturn diskUtil.resolveHashSprucePath(this.cwd, ...filePath)\n\t}\n\n\tprotected static getFeatureInstaller(options?: Partial<FeatureOptions>) {\n\t\tif (!this.featureInstaller) {\n\t\t\tconst serviceFactory = this.ServiceFactory()\n\t\t\tconst storeFactory = this.StoreFactory(options)\n\t\t\tconst emitter = this.getEmitter()\n\t\t\tconst apiClientFactory = this.getMercuryFixture().getApiClientFactory()\n\n\t\t\tconst actionExecuter = this.ActionExecuter()\n\n\t\t\tthis.featureInstaller = FeatureInstallerFactory.WithAllFeatures({\n\t\t\t\tcwd: this.cwd,\n\t\t\t\tserviceFactory,\n\t\t\t\tstoreFactory,\n\t\t\t\tui: this.ui,\n\t\t\t\temitter,\n\t\t\t\tapiClientFactory,\n\t\t\t\tactionExecuter,\n\t\t\t\t...options,\n\t\t\t})\n\t\t}\n\n\t\treturn this.featureInstaller\n\t}\n\n\tprotected static StoreFactory(options?: Partial<StoreFactoryOptions>) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\n\t\treturn new StoreFactory({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\thomeDir: this.homeDir,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\temitter: this.getEmitter(),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static Store<C extends StoreCode>(\n\t\tcode: C,\n\t\toptions?: StoreFactoryMethodOptions\n\t): StoreMap[C] {\n\t\treturn this.StoreFactory().Store(code, {\n\t\t\tcwd: this.cwd,\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static async waitForInput() {\n\t\treturn this.ui.waitForInput()\n\t}\n\n\tprotected static async assertIsFeatureInstalled(code: FeatureCode) {\n\t\tconst featureInstaller = this.getFeatureInstaller()\n\t\tconst isInstalled = await featureInstaller.isInstalled(code)\n\n\t\tassert.isTrue(isInstalled)\n\t}\n\n\tprotected static async assertValidActionResponseFiles(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tfor (const file of results.files ?? []) {\n\t\t\tconst checker = this.Service('typeChecker')\n\t\t\tawait checker.check(file.path)\n\t\t}\n\n\t\t// await Promise.all(\n\t\t// \t(results.files ?? []).map((file) => {\n\t\t// \t\tconst checker = this.Service('typeChecker')\n\t\t// \t\treturn checker.check(file.path)\n\t\t// \t})\n\t\t// )\n\t}\n\n\tprotected static async connectToApi(options?: ApiClientFactoryOptions) {\n\t\treturn this.getMercuryFixture().connectToApi(options)\n\t}\n\n\tprotected static async openInVsCode(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Action('vscode', 'setup').execute({ all: true })\n\n\t\tawait this.Service('command').execute(\n\t\t\t`code ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static async openInFinder(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Service('command').execute(\n\t\t\t`open ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static log(...args: any[]) {\n\t\ttestUtil.log(...args)\n\t}\n\n\tprotected static Action<\n\t\tAction extends AbstractAction = AbstractAction,\n\t\tF extends FeatureCode = FeatureCode\n\t>(featureCode: F, actionCode: string, options?: ExecuterOptions): Action {\n\t\tconst executer = this.ActionExecuter({\n\t\t\tshouldThrowOnListenerError: true,\n\t\t\t...options,\n\t\t}).Action(featureCode, actionCode)\n\n\t\treturn executer as any\n\t}\n\n\tprotected static ActionExecuter(options?: ExecuterOptions) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\t\tconst writerFactory = this.WriterFactory()\n\n\t\tconst emitter = this.getEmitter()\n\n\t\tconst actionFactory = new ActionFactory({\n\t\t\twriterFactory,\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\tstoreFactory: this.StoreFactory(),\n\t\t\ttemplates,\n\t\t\toptionOverrides: {\n\t\t\t\t'sync.schemas': {\n\t\t\t\t\tshouldInstallMissingDependencies: true,\n\t\t\t\t},\n\t\t\t\t...options?.optionOverrides,\n\t\t\t},\n\t\t})\n\n\t\tconst executer = new ActionExecuter({\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tactionFactory,\n\t\t\tfeatureInstallerFactory: () => {\n\t\t\t\treturn this.getFeatureInstaller()\n\t\t\t},\n\t\t\tshouldAutoHandleDependencies: false,\n\t\t\t...options,\n\t\t})\n\n\t\treturn executer\n\t}\n\n\tprotected static selectOptionBasedOnLabel(label: string) {\n\t\tconst last = this.ui.lastInvocation()\n\t\tassert.doesInclude(last.options.options.choices, {\n\t\t\tlabel,\n\t\t})\n\n\t\tconst match = last.options.options.choices.find(\n\t\t\t(o: any) => o.label === label\n\t\t)\n\n\t\tvoid this.ui.sendInput(`${match.value}`)\n\t}\n}\n"],"file":"AbstractCliTest.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/tests/AbstractCliTest.ts"],"names":["AbstractCliTest","cleanTestDirsAndFiles","AbstractWriter","disableLinting","ImportService","setCacheDir","diskUtil","createRandomTempDir","enableCaching","process","env","ENABLE_INSTALL_INTERTAINMENT","originalEnv","testUtil","startLogTimer","SchemaRegistry","getInstance","forgetAllSchemas","cwd","freshTmpDir","homeDir","emitter","undefined","featureInstaller","OnboardingStore","overrideCwd","ui","reset","invocations","setCursorPosition","x","y","clearFixtures","clearCache","SkillStore","clearCurrentSkill","EventStore","CommandService","clearMockResponses","organizationFixture","clearAllOrgs","mercuryFixture","disconnectAll","_ui","isWaitingForInput","Error","doesDirExist","shouldClearCache","deleteDir","shouldCleanupTestSkillDirs","FeatureFixture","deleteOldSkillDirs","pattern","resolveTestPath","matches","match","deleteFile","personFixture","skillFixture","viewFixture","tmpDirectory","resolveTestDir","uuid","v4","fs","ensureDirSync","SpyInterface","CliGlobalEmitter","Emitter","pathAfterTestDirsAndFiles","pathUtil","join","cliRoot","options","Cli","fixture","linkLocalPackages","type","sf","ServiceFactory","Service","getEmitter","serviceFactory","apiClientFactory","getMercuryFixture","getApiClientFactory","getFeatureInstaller","MercuryFixture","PersonFixture","writerFactory","WriterFactory","viewWriter","Writer","fileDescriptions","ViewFixture","Action","templates","settings","execute","promise","waitForInput","sendInput","results","OrganizationFixture","getPersonFixture","StoreFactory","SkillFixture","filePath","resolveHashSprucePath","storeFactory","actionExecuter","ActionExecuter","FeatureInstallerFactory","WithAllFeatures","code","Store","isInstalled","assert","isTrue","files","file","checker","check","path","connectToApi","all","dir","wait","timeout","log","featureCode","actionCode","executer","shouldThrowOnListenerError","actionFactory","ActionFactory","optionOverrides","shouldInstallMissingDependencies","featureInstallerFactory","shouldAutoHandleDependencies","label","last","getLastInvocation","doesInclude","choices","find","o","value","AbstractSpruceTest","__dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAGA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;IAM8BA,e;;;;;;;;;;;;;qGAc7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,uBAEO,KAAKC,qBAAL,EAFP;;AAAA;AAICC,2CAAeC,cAAf;;AAEA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O2D,QAAP;AACA;;;WAED,kCAA0CQ,KAA1C,EAAyD;AACxD,UAAMC,IAAI,GAAG,KAAKnH,EAAL,CAAQoH,iBAAR,EAAb;;AACAzB,mBAAO0B,WAAP,CAAmBF,IAAI,CAACpE,OAAL,CAAaA,OAAb,CAAqBuE,OAAxC,EAAiD;AAChDJ,QAAAA,KAAK,EAALA;AADgD,OAAjD;;AAIA,UAAMrF,KAAK,GAAGsF,IAAI,CAACpE,OAAL,CAAaA,OAAb,CAAqBuE,OAArB,CAA6BC,IAA7B,CACb,UAACC,CAAD;AAAA,eAAYA,CAAC,CAACN,KAAF,KAAYA,KAAxB;AAAA,OADa,CAAd;AAIA,WAAK,KAAKlH,EAAL,CAAQ2E,SAAR,WAAqB9C,KAAK,CAAC4F,KAA3B,EAAL;AACA;;;EA3aoDC,gB;;;iCAAxBpJ,e,aACFsE,iBAASC,IAAT,CAAc8E,SAAd,EAAyB,IAAzB,C;iCADErJ,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e;iCAAAA,e","sourcesContent":["import pathUtil from 'path'\nimport { SchemaRegistry } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { templates } from '@sprucelabs/spruce-templates'\nimport AbstractSpruceTest, { assert } from '@sprucelabs/test'\nimport fs from 'fs-extra'\nimport globby from 'globby'\nimport * as uuid from 'uuid'\nimport { CliBootOptions } from '../cli'\nimport AbstractAction from '../features/AbstractAction'\nimport { FeatureOptions } from '../features/AbstractFeature'\nimport ActionExecuter, {\n\tActionExecuterOptions,\n} from '../features/ActionExecuter'\nimport ActionFactory from '../features/ActionFactory'\nimport EventStore from '../features/event/stores/EventStore'\nimport FeatureInstaller from '../features/FeatureInstaller'\nimport FeatureInstallerFactory from '../features/FeatureInstallerFactory'\nimport { FeatureActionResponse, FeatureCode } from '../features/features.types'\nimport OnboardingStore from '../features/onboard/stores/OnboardingStore'\nimport SkillStore from '../features/skill/stores/SkillStore'\nimport CliGlobalEmitter, { GlobalEmitter } from '../GlobalEmitter'\nimport SpyInterface from '../interfaces/SpyInterface'\nimport CommandService from '../services/CommandService'\nimport ImportService from '../services/ImportService'\nimport ServiceFactory, { Service, ServiceMap } from '../services/ServiceFactory'\nimport StoreFactory, {\n\tStoreCode,\n\tStoreFactoryMethodOptions,\n\tStoreFactoryOptions,\n\tStoreMap,\n} from '../stores/StoreFactory'\nimport { ApiClientFactoryOptions } from '../types/apiClient.types'\nimport { OptionOverrides } from '../types/cli.types'\nimport AbstractWriter from '../writers/AbstractWriter'\nimport WriterFactory from '../writers/WriterFactory'\nimport FeatureFixture, {\n\tFeatureFixtureOptions,\n} from './fixtures/FeatureFixture'\nimport MercuryFixture from './fixtures/MercuryFixture'\nimport OrganizationFixture from './fixtures/OrganizationFixture'\nimport PersonFixture from './fixtures/PersonFixture'\nimport SkillFixture from './fixtures/SkillFixture'\nimport ViewFixture from './fixtures/ViewFixture'\nimport testUtil from './utilities/test.utility'\n\ntype ExecuterOptions = Partial<ActionExecuterOptions> & {\n\toptionOverrides?: OptionOverrides\n}\n\nexport default abstract class AbstractCliTest extends AbstractSpruceTest {\n\tprotected static cliRoot = pathUtil.join(__dirname, '..')\n\tprotected static homeDir: string\n\n\tprivate static _ui: SpyInterface\n\tprivate static emitter?: GlobalEmitter\n\tprivate static mercuryFixture?: MercuryFixture\n\tprivate static personFixture?: PersonFixture\n\tprivate static organizationFixture?: OrganizationFixture\n\tprivate static skillFixture?: SkillFixture\n\tprivate static featureInstaller?: FeatureInstaller\n\tprivate static viewFixture?: ViewFixture\n\tprivate static originalEnv: { [x: string]: string | undefined }\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tawait this.cleanTestDirsAndFiles()\n\n\t\tAbstractWriter.disableLinting()\n\n\t\tImportService.setCacheDir(diskUtil.createRandomTempDir())\n\t\tImportService.enableCaching()\n\n\t\tprocess.env.ENABLE_INSTALL_INTERTAINMENT = 'false'\n\n\t\tthis.originalEnv = { ...process.env }\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\n\t\t//@ts-ignore\n\t\tprocess.env = { ...this.originalEnv }\n\n\t\ttestUtil.startLogTimer()\n\n\t\tSchemaRegistry.getInstance().forgetAllSchemas()\n\n\t\tthis.cwd = this.freshTmpDir()\n\t\tthis.homeDir = this.freshTmpDir()\n\n\t\tthis.emitter = undefined\n\t\tthis.featureInstaller = undefined\n\n\t\tOnboardingStore.overrideCwd(diskUtil.createRandomTempDir())\n\n\t\tthis.ui.reset()\n\t\tthis.ui.invocations = []\n\t\tthis.ui.setCursorPosition({ x: 0, y: 0 })\n\n\t\tthis.clearFixtures()\n\n\t\tImportService.clearCache()\n\t\tSkillStore.clearCurrentSkill()\n\t\tEventStore.clearCache()\n\t\tCommandService.clearMockResponses()\n\t}\n\n\tprotected static async afterEach() {\n\t\tawait super.afterEach()\n\n\t\tawait this.organizationFixture?.clearAllOrgs()\n\t\tawait this.mercuryFixture?.disconnectAll()\n\n\t\tthis.clearFixtures()\n\n\t\tif (this._ui?.isWaitingForInput()) {\n\t\t\tthrow new Error(\n\t\t\t\t`Terminal interface is waiting for input. Make sure you are invoking this.term.sendInput() as many times as needed.`\n\t\t\t)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.cwd) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.cwd)\n\t\t}\n\n\t\tif (diskUtil.doesDirExist(this.homeDir) && testUtil.shouldClearCache()) {\n\t\t\tdiskUtil.deleteDir(this.homeDir)\n\t\t}\n\t}\n\n\tprotected static async afterAll() {\n\t\tawait super.afterAll()\n\t\tif (testUtil.shouldCleanupTestSkillDirs()) {\n\t\t\tFeatureFixture.deleteOldSkillDirs()\n\t\t}\n\t}\n\n\tprivate static async cleanTestDirsAndFiles() {\n\t\tconst pattern = this.resolveTestPath('**/*.d.ts')\n\t\tconst matches = await globby(pattern)\n\n\t\tfor (const match of matches) {\n\t\t\tdiskUtil.deleteFile(match)\n\t\t}\n\t}\n\n\tprivate static clearFixtures() {\n\t\tthis.emitter = undefined\n\t\tthis.mercuryFixture = undefined\n\t\tthis.organizationFixture = undefined\n\t\tthis.personFixture = undefined\n\t\tthis.skillFixture = undefined\n\t\tthis.viewFixture = undefined\n\t}\n\n\tprotected static freshTmpDir() {\n\t\tconst tmpDirectory = testUtil.resolveTestDir(uuid.v4())\n\t\tfs.ensureDirSync(tmpDirectory)\n\t\treturn tmpDirectory\n\t}\n\n\tprotected static get ui() {\n\t\tif (!this._ui) {\n\t\t\tthis._ui = new SpyInterface()\n\t\t}\n\n\t\treturn this._ui\n\t}\n\n\tprotected static getEmitter() {\n\t\tif (!this.emitter) {\n\t\t\tthis.emitter = CliGlobalEmitter.Emitter()\n\t\t}\n\t\treturn this.emitter\n\t}\n\n\tprotected static resolveTestPath(...pathAfterTestDirsAndFiles: string[]) {\n\t\treturn pathUtil.join(\n\t\t\tthis.cliRoot,\n\t\t\t'__tests__',\n\t\t\t'testDirsAndFiles',\n\t\t\t...pathAfterTestDirsAndFiles\n\t\t)\n\t}\n\n\tprotected static async Cli(options?: CliBootOptions) {\n\t\treturn this.FeatureFixture(options).Cli({\n\t\t\tcwd: this.cwd,\n\t\t\thomeDir: this.homeDir,\n\t\t\t...(options ?? {}),\n\t\t})\n\t}\n\n\tprotected static async linkLocalPackages() {\n\t\tconst fixture = this.FeatureFixture()\n\t\tawait fixture.linkLocalPackages()\n\t}\n\n\tprotected static Service<S extends Service>(\n\t\ttype: S,\n\t\tcwd?: string\n\t): ServiceMap[S] {\n\t\tconst sf = this.ServiceFactory()\n\t\treturn sf.Service(cwd ?? this.cwd, type)\n\t}\n\n\tprotected static ServiceFactory() {\n\t\treturn new ServiceFactory()\n\t}\n\n\tprotected static FeatureFixture(options?: Partial<FeatureFixtureOptions>) {\n\t\tconst emitter = options?.emitter ?? this.getEmitter()\n\n\t\treturn new FeatureFixture({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory: this.ServiceFactory(),\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tfeatureInstaller: this.getFeatureInstaller({ emitter }),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static getMercuryFixture() {\n\t\tif (!this.mercuryFixture) {\n\t\t\tthis.mercuryFixture = new MercuryFixture(this.cwd, this.ServiceFactory())\n\t\t}\n\n\t\treturn this.mercuryFixture\n\t}\n\n\tprotected static getPersonFixture() {\n\t\tif (!this.personFixture) {\n\t\t\tthis.personFixture = new PersonFixture(\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.personFixture\n\t}\n\n\tprotected static getViewFixture() {\n\t\tif (!this.viewFixture) {\n\t\t\tconst writerFactory = this.WriterFactory()\n\n\t\t\tconst viewWriter = writerFactory.Writer('view', { fileDescriptions: [] })\n\t\t\tthis.viewFixture = new ViewFixture(\n\t\t\t\tthis.cwd,\n\t\t\t\tviewWriter,\n\t\t\t\tthis.Action('view', 'sync')\n\t\t\t)\n\t\t}\n\n\t\treturn this.viewFixture\n\t}\n\n\tprivate static WriterFactory() {\n\t\treturn new WriterFactory({\n\t\t\ttemplates,\n\t\t\tui: this.ui,\n\t\t\tsettings: this.Service('settings'),\n\t\t})\n\t}\n\n\tprotected static async skipInstallSkillPrompts<\n\t\tE extends () => Promise<FeatureActionResponse>\n\t>(\n\t\texecute?: E\n\t): Promise<E extends undefined ? undefined : FeatureActionResponse> {\n\t\tconst promise = execute?.()\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('n')\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput('')\n\n\t\tconst results = await promise\n\n\t\treturn results as any\n\t}\n\n\tprotected static getOrganizationFixture() {\n\t\tif (!this.organizationFixture) {\n\t\t\tthis.organizationFixture = new OrganizationFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.organizationFixture\n\t}\n\n\tprotected static getSkillFixture() {\n\t\tif (!this.skillFixture) {\n\t\t\tthis.skillFixture = new SkillFixture(\n\t\t\t\tthis.getPersonFixture(),\n\t\t\t\tthis.StoreFactory(),\n\t\t\t\tthis.getMercuryFixture().getApiClientFactory()\n\t\t\t)\n\t\t}\n\n\t\treturn this.skillFixture\n\t}\n\n\tprotected static resolveHashSprucePath(...filePath: string[]) {\n\t\treturn diskUtil.resolveHashSprucePath(this.cwd, ...filePath)\n\t}\n\n\tprotected static getFeatureInstaller(options?: Partial<FeatureOptions>) {\n\t\tif (!this.featureInstaller) {\n\t\t\tconst serviceFactory = this.ServiceFactory()\n\t\t\tconst storeFactory = this.StoreFactory(options)\n\t\t\tconst emitter = this.getEmitter()\n\t\t\tconst apiClientFactory = this.getMercuryFixture().getApiClientFactory()\n\n\t\t\tconst actionExecuter = this.ActionExecuter()\n\n\t\t\tthis.featureInstaller = FeatureInstallerFactory.WithAllFeatures({\n\t\t\t\tcwd: this.cwd,\n\t\t\t\tserviceFactory,\n\t\t\t\tstoreFactory,\n\t\t\t\tui: this.ui,\n\t\t\t\temitter,\n\t\t\t\tapiClientFactory,\n\t\t\t\tactionExecuter,\n\t\t\t\t...options,\n\t\t\t})\n\t\t}\n\n\t\treturn this.featureInstaller\n\t}\n\n\tprotected static StoreFactory(options?: Partial<StoreFactoryOptions>) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\n\t\treturn new StoreFactory({\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\thomeDir: this.homeDir,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\temitter: this.getEmitter(),\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static Store<C extends StoreCode>(\n\t\tcode: C,\n\t\toptions?: StoreFactoryMethodOptions\n\t): StoreMap[C] {\n\t\treturn this.StoreFactory().Store(code, {\n\t\t\tcwd: this.cwd,\n\t\t\t...options,\n\t\t})\n\t}\n\n\tprotected static async waitForInput() {\n\t\treturn this.ui.waitForInput()\n\t}\n\n\tprotected static async assertIsFeatureInstalled(code: FeatureCode) {\n\t\tconst featureInstaller = this.getFeatureInstaller()\n\t\tconst isInstalled = await featureInstaller.isInstalled(code)\n\n\t\tassert.isTrue(isInstalled)\n\t}\n\n\tprotected static async assertValidActionResponseFiles(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tfor (const file of results.files ?? []) {\n\t\t\tconst checker = this.Service('typeChecker')\n\t\t\tawait checker.check(file.path)\n\t\t}\n\n\t\t// await Promise.all(\n\t\t// \t(results.files ?? []).map((file) => {\n\t\t// \t\tconst checker = this.Service('typeChecker')\n\t\t// \t\treturn checker.check(file.path)\n\t\t// \t})\n\t\t// )\n\t}\n\n\tprotected static async connectToApi(options?: ApiClientFactoryOptions) {\n\t\treturn this.getMercuryFixture().connectToApi(options)\n\t}\n\n\tprotected static async openInVsCode(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Action('vscode', 'setup').execute({ all: true })\n\n\t\tawait this.Service('command').execute(\n\t\t\t`code ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static async openInFinder(options?: {\n\t\tfile?: string\n\t\tdir?: string\n\t\ttimeout?: number\n\t}) {\n\t\tawait this.Service('command').execute(\n\t\t\t`open ${options?.file ?? options?.dir ?? this.cwd}`\n\t\t)\n\t\tawait this.wait(options?.timeout ?? 99999999)\n\t}\n\n\tprotected static log(...args: any[]) {\n\t\ttestUtil.log(...args)\n\t}\n\n\tprotected static Action<\n\t\tAction extends AbstractAction = AbstractAction,\n\t\tF extends FeatureCode = FeatureCode\n\t>(featureCode: F, actionCode: string, options?: ExecuterOptions): Action {\n\t\tconst executer = this.ActionExecuter({\n\t\t\tshouldThrowOnListenerError: true,\n\t\t\t...options,\n\t\t}).Action(featureCode, actionCode)\n\n\t\treturn executer as any\n\t}\n\n\tprotected static ActionExecuter(options?: ExecuterOptions) {\n\t\tconst serviceFactory = this.ServiceFactory()\n\t\tconst writerFactory = this.WriterFactory()\n\n\t\tconst emitter = this.getEmitter()\n\n\t\tconst actionFactory = new ActionFactory({\n\t\t\twriterFactory,\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tapiClientFactory: this.getMercuryFixture().getApiClientFactory(),\n\t\t\tcwd: this.cwd,\n\t\t\tserviceFactory,\n\t\t\tstoreFactory: this.StoreFactory(),\n\t\t\ttemplates,\n\t\t\toptionOverrides: {\n\t\t\t\t'sync.schemas': {\n\t\t\t\t\tshouldInstallMissingDependencies: true,\n\t\t\t\t},\n\t\t\t\t...options?.optionOverrides,\n\t\t\t},\n\t\t})\n\n\t\tconst executer = new ActionExecuter({\n\t\t\tui: this.ui,\n\t\t\temitter,\n\t\t\tactionFactory,\n\t\t\tfeatureInstallerFactory: () => {\n\t\t\t\treturn this.getFeatureInstaller()\n\t\t\t},\n\t\t\tshouldAutoHandleDependencies: false,\n\t\t\t...options,\n\t\t})\n\n\t\treturn executer\n\t}\n\n\tprotected static selectOptionBasedOnLabel(label: string) {\n\t\tconst last = this.ui.getLastInvocation()\n\t\tassert.doesInclude(last.options.options.choices, {\n\t\t\tlabel,\n\t\t})\n\n\t\tconst match = last.options.options.choices.find(\n\t\t\t(o: any) => o.label === label\n\t\t)\n\n\t\tvoid this.ui.sendInput(`${match.value}`)\n\t}\n}\n"],"file":"AbstractCliTest.js"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 _test = require("@sprucelabs/test");
|
|
15
|
+
|
|
16
|
+
var uiAssertUtil = {
|
|
17
|
+
assertRendersSelect: function assertRendersSelect(ui) {
|
|
18
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
19
|
+
var last;
|
|
20
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
21
|
+
while (1) {
|
|
22
|
+
switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
_context.next = 2;
|
|
25
|
+
return ui.waitForInput();
|
|
26
|
+
|
|
27
|
+
case 2:
|
|
28
|
+
last = ui.getLastInvocation();
|
|
29
|
+
|
|
30
|
+
_test.assert.isTruthy(last.options.options.choices, "I expected a select, I did not find one!");
|
|
31
|
+
|
|
32
|
+
case 4:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
}))();
|
|
39
|
+
},
|
|
40
|
+
assertSelectDidNotRenderChoice: function assertSelectDidNotRenderChoice(ui, value, label) {
|
|
41
|
+
var last = ui.getLastInvocation();
|
|
42
|
+
|
|
43
|
+
_test.assert.doesNotInclude(last.options.options.choices, {
|
|
44
|
+
value: value,
|
|
45
|
+
label: label
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var _default = uiAssertUtil;
|
|
50
|
+
exports["default"] = _default;
|
|
51
|
+
//# sourceMappingURL=uiAssert.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/tests/utilities/uiAssert.utility.ts"],"names":["uiAssertUtil","assertRendersSelect","ui","waitForInput","last","getLastInvocation","assert","isTruthy","options","choices","assertSelectDidNotRenderChoice","value","label","doesNotInclude"],"mappings":";;;;;;;;;;;;;AAAA;;AAGA,IAAMA,YAAY,GAAG;AACdC,EAAAA,mBADc,+BACMC,EADN,EACwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBACrCA,EAAE,CAACC,YAAH,EADqC;;AAAA;AAGrCC,cAAAA,IAHqC,GAG9BF,EAAE,CAACG,iBAAH,EAH8B;;AAI3CC,2BAAOC,QAAP,CACCH,IAAI,CAACI,OAAL,CAAaA,OAAb,CAAqBC,OADtB;;AAJ2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ3C,GATmB;AAWpBC,EAAAA,8BAXoB,0CAYnBR,EAZmB,EAanBS,KAbmB,EAcnBC,KAdmB,EAelB;AACD,QAAMR,IAAI,GAAGF,EAAE,CAACG,iBAAH,EAAb;;AAEAC,iBAAOO,cAAP,CAAsBT,IAAI,CAACI,OAAL,CAAaA,OAAb,CAAqBC,OAA3C,EAAoD;AACnDE,MAAAA,KAAK,EAALA,KADmD;AAEnDC,MAAAA,KAAK,EAALA;AAFmD,KAApD;AAIA;AAtBmB,CAArB;eAyBeZ,Y","sourcesContent":["import { assert } from '@sprucelabs/test'\nimport SpyInterface from '../../interfaces/SpyInterface'\n\nconst uiAssertUtil = {\n\tasync assertRendersSelect(ui: SpyInterface) {\n\t\tawait ui.waitForInput()\n\n\t\tconst last = ui.getLastInvocation()\n\t\tassert.isTruthy(\n\t\t\tlast.options.options.choices,\n\t\t\t`I expected a select, I did not find one!`\n\t\t)\n\t},\n\n\tassertSelectDidNotRenderChoice(\n\t\tui: SpyInterface,\n\t\tvalue: string,\n\t\tlabel: string\n\t) {\n\t\tconst last = ui.getLastInvocation()\n\n\t\tassert.doesNotInclude(last.options.options.choices, {\n\t\t\tvalue,\n\t\t\tlabel,\n\t\t})\n\t},\n}\n\nexport default uiAssertUtil\n"],"file":"uiAssert.utility.js"}
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"skill": {
|
|
8
8
|
"namespace": "spruce-cli",
|
|
9
9
|
"upgradeIgnoreList": [
|
|
10
|
+
"chalk",
|
|
10
11
|
"emphasize",
|
|
11
12
|
"gifwrap",
|
|
12
13
|
"globby",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
]
|
|
18
19
|
},
|
|
19
20
|
"license": "MIT",
|
|
20
|
-
"version": "14.
|
|
21
|
+
"version": "14.27.0",
|
|
21
22
|
"bin": {
|
|
22
23
|
"spruce": "./build/index.js"
|
|
23
24
|
},
|
|
@@ -75,19 +76,19 @@
|
|
|
75
76
|
"@babel/plugin-proposal-decorators": "^7.16.4",
|
|
76
77
|
"@babel/runtime": "^7.16.3",
|
|
77
78
|
"@jest/reporters": "^27.3.1",
|
|
78
|
-
"@sprucelabs/error": "^5.0.
|
|
79
|
-
"@sprucelabs/heartwood-view-controllers": "^
|
|
80
|
-
"@sprucelabs/jest-json-reporter": "^6.0.
|
|
81
|
-
"@sprucelabs/mercury-client": "^17.1.
|
|
82
|
-
"@sprucelabs/mercury-event-emitter": "^17.1.
|
|
83
|
-
"@sprucelabs/mercury-types": "^26.1.
|
|
84
|
-
"@sprucelabs/schema": "^25.4.
|
|
85
|
-
"@sprucelabs/spruce-core-schemas": "^22.6.
|
|
86
|
-
"@sprucelabs/spruce-event-plugin": "^14.1.
|
|
87
|
-
"@sprucelabs/spruce-event-utils": "^17.1.
|
|
88
|
-
"@sprucelabs/spruce-skill-booter": "^14.1.
|
|
89
|
-
"@sprucelabs/spruce-skill-utils": "^22.
|
|
90
|
-
"@sprucelabs/spruce-templates": "^14.
|
|
79
|
+
"@sprucelabs/error": "^5.0.299",
|
|
80
|
+
"@sprucelabs/heartwood-view-controllers": "^51.1.3",
|
|
81
|
+
"@sprucelabs/jest-json-reporter": "^6.0.252",
|
|
82
|
+
"@sprucelabs/mercury-client": "^17.1.113",
|
|
83
|
+
"@sprucelabs/mercury-event-emitter": "^17.1.113",
|
|
84
|
+
"@sprucelabs/mercury-types": "^26.1.916",
|
|
85
|
+
"@sprucelabs/schema": "^25.4.26",
|
|
86
|
+
"@sprucelabs/spruce-core-schemas": "^22.6.187",
|
|
87
|
+
"@sprucelabs/spruce-event-plugin": "^14.1.11",
|
|
88
|
+
"@sprucelabs/spruce-event-utils": "^17.1.187",
|
|
89
|
+
"@sprucelabs/spruce-skill-booter": "^14.1.11",
|
|
90
|
+
"@sprucelabs/spruce-skill-utils": "^22.1.17",
|
|
91
|
+
"@sprucelabs/spruce-templates": "^14.27.0",
|
|
91
92
|
"cfonts": "^2.10.0",
|
|
92
93
|
"chalk": "^4.1.2",
|
|
93
94
|
"chokidar": "^3.5.2",
|
|
@@ -116,16 +117,16 @@
|
|
|
116
117
|
"uuid": "^8.3.2"
|
|
117
118
|
},
|
|
118
119
|
"devDependencies": {
|
|
119
|
-
"@sprucelabs/data-stores": "^7.1.
|
|
120
|
-
"@sprucelabs/jest-sheets-reporter": "^1.2.
|
|
121
|
-
"@sprucelabs/mercury-core-events": "^1.6.
|
|
122
|
-
"@sprucelabs/resolve-path-aliases": "^1.0.
|
|
123
|
-
"@sprucelabs/spruce-conversation-plugin": "^14.1.
|
|
124
|
-
"@sprucelabs/spruce-deploy-plugin": "^14.1.
|
|
125
|
-
"@sprucelabs/spruce-store-plugin": "^14.1.
|
|
126
|
-
"@sprucelabs/spruce-test-fixtures": "^14.1.
|
|
127
|
-
"@sprucelabs/test": "^7.7.
|
|
128
|
-
"@sprucelabs/test-utils": "^3.0.
|
|
120
|
+
"@sprucelabs/data-stores": "^7.1.13",
|
|
121
|
+
"@sprucelabs/jest-sheets-reporter": "^1.2.259",
|
|
122
|
+
"@sprucelabs/mercury-core-events": "^1.6.122",
|
|
123
|
+
"@sprucelabs/resolve-path-aliases": "^1.0.230",
|
|
124
|
+
"@sprucelabs/spruce-conversation-plugin": "^14.1.11",
|
|
125
|
+
"@sprucelabs/spruce-deploy-plugin": "^14.1.11",
|
|
126
|
+
"@sprucelabs/spruce-store-plugin": "^14.1.11",
|
|
127
|
+
"@sprucelabs/spruce-test-fixtures": "^14.1.11",
|
|
128
|
+
"@sprucelabs/test": "^7.7.234",
|
|
129
|
+
"@sprucelabs/test-utils": "^3.0.281",
|
|
129
130
|
"@types/blessed": "^0.1.19",
|
|
130
131
|
"@types/eslint": "^8.2.0",
|
|
131
132
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -156,7 +157,7 @@
|
|
|
156
157
|
"jest-circus": "^27.3.1",
|
|
157
158
|
"jest-junit": "^13.0.0",
|
|
158
159
|
"jest-reporters": "^0.0.2",
|
|
159
|
-
"prettier": "^2.
|
|
160
|
+
"prettier": "^2.5.0",
|
|
160
161
|
"ps-node": "^0.1.6",
|
|
161
162
|
"rimraf": "^3.0.2",
|
|
162
163
|
"ts-jest": "^27.0.7",
|
|
@@ -584,6 +585,7 @@
|
|
|
584
585
|
},
|
|
585
586
|
"yarn-upgrade-all": {
|
|
586
587
|
"ignore": [
|
|
588
|
+
"chalk",
|
|
587
589
|
"emphasize",
|
|
588
590
|
"gifwrap",
|
|
589
591
|
"globby",
|
|
@@ -593,5 +595,5 @@
|
|
|
593
595
|
"ora"
|
|
594
596
|
]
|
|
595
597
|
},
|
|
596
|
-
"gitHead": "
|
|
598
|
+
"gitHead": "dcce901d5e0509f386fc4c345bdf6ca490b4a83c"
|
|
597
599
|
}
|
|
@@ -968,6 +968,35 @@ export declare namespace SpruceErrors.SpruceCli {
|
|
|
968
968
|
|
|
969
969
|
|
|
970
970
|
|
|
971
|
+
export declare namespace SpruceErrors.SpruceCli {
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
export interface DependencyExists {
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
'namespace': string
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export interface DependencyExistsSchema extends SpruceSchema.Schema {
|
|
981
|
+
id: 'dependencyExists',
|
|
982
|
+
namespace: 'SpruceCli',
|
|
983
|
+
name: 'Dependency exists',
|
|
984
|
+
fields: {
|
|
985
|
+
/** . */
|
|
986
|
+
'namespace': {
|
|
987
|
+
type: 'text',
|
|
988
|
+
isRequired: true,
|
|
989
|
+
options: undefined
|
|
990
|
+
},
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
export type DependencyExistsEntity = SchemaEntity<SpruceErrors.SpruceCli.DependencyExistsSchema>
|
|
995
|
+
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
971
1000
|
export declare namespace SpruceErrors.SpruceCli {
|
|
972
1001
|
|
|
973
1002
|
/** Autoloader creation failed */
|