@sprucelabs/spruce-cli 20.0.0 → 20.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js +2 -1
- package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.d.ts +4 -0
- package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.js +95 -17
- package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.js.map +1 -1
- package/build/__tests__/implementation/EventCacheService.test.d.ts +4 -0
- package/build/__tests__/implementation/EventCacheService.test.js +84 -0
- package/build/__tests__/implementation/EventCacheService.test.js.map +1 -0
- package/build/errors/SpruceError.js +2 -2
- package/build/errors/SpruceError.js.map +1 -1
- package/build/features/cache/actions/EnableAction.js +3 -1
- package/build/features/cache/actions/EnableAction.js.map +1 -1
- package/build/features/event/EventFeature.js +2 -2
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/event/actions/SyncAction.js +1 -1
- package/build/features/event/actions/SyncAction.js.map +1 -1
- package/build/features/event/services/{EventSettingsService.d.ts → EventCacheService.d.ts} +3 -3
- package/build/features/event/services/{EventSettingsService.js → EventCacheService.js} +8 -7
- package/build/features/event/services/EventCacheService.js.map +1 -0
- package/build/features/node/actions/UpgradeAction.d.ts +2 -2
- package/build/features/node/actions/UpgradeAction.js.map +1 -1
- package/build/features/universalFileDescriptions.js +1 -1
- package/build/features/universalFileDescriptions.js.map +1 -1
- package/build/features/view/actions/SyncAction.js +2 -0
- package/build/features/view/actions/SyncAction.js.map +1 -1
- package/build/services/ServiceFactory.d.ts +3 -2
- package/build/services/ServiceFactory.js +11 -7
- package/build/services/ServiceFactory.js.map +1 -1
- package/build/utilities/introspection.utility.d.ts +8 -4
- package/build/utilities/introspection.utility.js +189 -46
- package/build/utilities/introspection.utility.js.map +1 -1
- package/package.json +27 -27
- package/src/__tests__/behavioral/EnablingAndDisablingCache.test.ts +1 -0
- package/src/__tests__/behavioral/upgrading/UpgradingASkill5.test.ts +1 -1
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +1 -1
- package/src/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.ts +53 -0
- package/src/__tests__/implementation/EventCacheService.test.ts +38 -0
- package/src/errors/SpruceError.ts +3 -1
- package/src/features/cache/actions/EnableAction.ts +6 -1
- package/src/features/event/EventFeature.ts +2 -2
- package/src/features/event/actions/SyncAction.ts +1 -1
- package/src/features/event/services/{EventSettingsService.ts → EventCacheService.ts} +5 -3
- package/src/features/node/actions/UpgradeAction.ts +4 -4
- package/src/features/universalFileDescriptions.ts +1 -1
- package/src/features/view/actions/SyncAction.ts +2 -0
- package/src/services/ServiceFactory.ts +11 -8
- package/src/utilities/introspection.utility.ts +233 -79
- package/build/features/event/services/EventSettingsService.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"introspection.utility.js","names":["_lodash","_interopRequireDefault","require","tsutils","_interopRequireWildcard","ts","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","F","s","done","value","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","serializeSymbol","options","checker","symbol","doc","getName","documentation","displayPartsToString","getDocumentationComment","valueDeclaration","type","typeToString","getTypeOfSymbolAtLocation","serializeSignature","signature","parameters","map","p","returnType","getReturnType","introspectionUtil","introspect","tsFiles","filePaths","program","createProgram","getTypeChecker","introspects","_loop","tsFile","sourceFile","getSourceFile","results","classes","interfaces","_","includes","fileName","forEachChild","node","isClassDeclaration","getSymbolAtLocation","_parentClassSymbol","_parentClassSymbol2","_details$constructors","details","constructorType","parentClassSymbol","heritageClauses","getTypeAtLocation","types","getSymbol","parentClassName","text","parentClassPath","parent","replace","isAbstractClass","isModifierFlagSet","ModifierFlags","Abstract","constructors","getConstructSignatures","push","className","classPath","staticProperties","pluckStaticProperties","optionsInterfaceName","isAbstract","isInterfaceDeclaration","interfaceName","_default","exports","staticProps","_iterator","members","_step","_member$name","_member$initializer","member","escapedText","initializer"],"sources":["../../src/utilities/introspection.utility.ts"],"sourcesContent":["import _ from 'lodash'\nimport * as tsutils from 'tsutils'\nimport * as ts from 'typescript'\n\nexport interface IntrospectionClass {\n\tclassName: string\n\tclassPath: string\n\tparentClassName: string | undefined\n\tparentClassPath: string | undefined\n\toptionsInterfaceName: string | undefined\n\tisAbstract: boolean\n\tstaticProperties: StaticProperties\n}\n\ntype StaticProperties = Record<string, any>\n\ninterface IntrospectionInterface {\n\tinterfaceName: string\n}\n\nexport interface Introspection {\n\tclasses: IntrospectionClass[]\n\tinterfaces: IntrospectionInterface[]\n}\n\ninterface DocEntry {\n\tname?: string\n\tfileName?: string\n\tdocumentation?: string\n\ttype?: string\n\tconstructors?: DocEntry[]\n\tparameters?: DocEntry[]\n\treturnType?: string\n}\n\nconst serializeSymbol = (options: {\n\tchecker: ts.TypeChecker\n\tsymbol: ts.Symbol\n}): DocEntry => {\n\tconst { checker, symbol } = options\n\tconst doc: DocEntry = {\n\t\tname: symbol.getName(),\n\t\tdocumentation: ts.displayPartsToString(\n\t\t\tsymbol.getDocumentationComment(checker)\n\t\t),\n\t}\n\n\tif (symbol.valueDeclaration) {\n\t\tdoc.type = checker.typeToString(\n\t\t\tchecker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration)\n\t\t)\n\t}\n\n\treturn doc\n}\n\nconst serializeSignature = (options: {\n\tchecker: ts.TypeChecker\n\tsignature: ts.Signature\n}) => {\n\tconst { checker, signature } = options\n\treturn {\n\t\tparameters: signature.parameters.map((p) =>\n\t\t\tserializeSymbol({ symbol: p, checker })\n\t\t),\n\t\treturnType: checker.typeToString(signature.getReturnType()),\n\t\tdocumentation: ts.displayPartsToString(\n\t\t\tsignature.getDocumentationComment(checker)\n\t\t),\n\t}\n}\n\nconst introspectionUtil = {\n\tintrospect(tsFiles: string[]): Introspection[] {\n\t\tconst filePaths = tsFiles\n\t\tconst program = ts.createProgram(filePaths, {})\n\t\tconst checker = program.getTypeChecker()\n\n\t\t// for building results\n\t\tconst introspects: Introspection[] = []\n\n\t\tfor (let i = 0; i < filePaths.length; i += 1) {\n\t\t\tconst tsFile = filePaths[i]\n\t\t\tconst sourceFile = program.getSourceFile(tsFile)\n\t\t\tconst results: Introspection = { classes: [], interfaces: [] }\n\t\t\tif (sourceFile && _.includes(filePaths, sourceFile.fileName)) {\n\t\t\t\tts.forEachChild(sourceFile, (node) => {\n\t\t\t\t\t// if this is a class declaration\n\t\t\t\t\tif (ts.isClassDeclaration(node) && node.name) {\n\t\t\t\t\t\tconst symbol = checker.getSymbolAtLocation(node.name)\n\n\t\t\t\t\t\tif (symbol?.valueDeclaration) {\n\t\t\t\t\t\t\tconst details = serializeSymbol({ checker, symbol })\n\t\t\t\t\t\t\t// Get the construct signatures\n\t\t\t\t\t\t\tconst constructorType = checker.getTypeOfSymbolAtLocation(\n\t\t\t\t\t\t\t\tsymbol,\n\t\t\t\t\t\t\t\tsymbol.valueDeclaration\n\t\t\t\t\t\t\t)\n\n\t\t\t\t\t\t\tlet parentClassSymbol: ts.Symbol | undefined\n\t\t\t\t\t\t\tif (node.heritageClauses && node.heritageClauses[0]) {\n\t\t\t\t\t\t\t\tparentClassSymbol = checker\n\t\t\t\t\t\t\t\t\t.getTypeAtLocation(node.heritageClauses[0].types[0])\n\t\t\t\t\t\t\t\t\t.getSymbol()\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst parentClassName =\n\t\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\t\tparentClassSymbol?.valueDeclaration?.name?.text\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\tconst parentClassPath = parentClassSymbol?.parent\n\t\t\t\t\t\t\t\t?.getName()\n\t\t\t\t\t\t\t\t.replace('\"', '')\n\n\t\t\t\t\t\t\tconst isAbstractClass = tsutils.isModifierFlagSet(\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\tts.ModifierFlags.Abstract\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tdetails.constructors = constructorType\n\t\t\t\t\t\t\t\t.getConstructSignatures()\n\t\t\t\t\t\t\t\t.map((s) => serializeSignature({ signature: s, checker }))\n\n\t\t\t\t\t\t\tresults.classes.push({\n\t\t\t\t\t\t\t\tclassName: node.name.text,\n\t\t\t\t\t\t\t\tclassPath: sourceFile.fileName,\n\t\t\t\t\t\t\t\tparentClassName,\n\t\t\t\t\t\t\t\tparentClassPath,\n\t\t\t\t\t\t\t\tstaticProperties: pluckStaticProperties(node),\n\t\t\t\t\t\t\t\toptionsInterfaceName:\n\t\t\t\t\t\t\t\t\tdetails.constructors?.[0].parameters?.[0]?.type,\n\t\t\t\t\t\t\t\tisAbstract: isAbstractClass,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (ts.isInterfaceDeclaration(node)) {\n\t\t\t\t\t\tresults.interfaces.push({\n\t\t\t\t\t\t\tinterfaceName: node.name.text,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tintrospects.push(results)\n\t\t}\n\n\t\treturn introspects\n\t},\n}\n\nexport default introspectionUtil\n\nfunction pluckStaticProperties(node: ts.ClassDeclaration): StaticProperties {\n\tconst staticProps: StaticProperties = {}\n\n\tfor (const member of node.members) {\n\t\t//@ts-ignore\n\t\tconst name = member.name?.escapedText\n\t\t//@ts-ignore\n\t\tconst value = member.initializer?.text\n\n\t\tif (name && value) {\n\t\t\tstaticProps[name] = value\n\t\t}\n\t}\n\n\treturn staticProps\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,EAAA,GAAAD,uBAAA,CAAAF,OAAA;AAAgC,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAA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G4D,SAAS,CAACjD,MAAM,EAAEX,CAAC,IAAI,CAAC;MAAAiE,KAAA;IAAA;IA+D5C,OAAOD,WAAW;EACnB;AACD,CAAC;AAAA,IAAA6C,QAAA,GAAAC,OAAA,cAEcrD,iBAAiB;AAEhC,SAAS+C,qBAAqBA,CAAC5B,IAAyB,EAAoB;EAC3E,IAAMmC,WAA6B,GAAG,CAAC,CAAC;EAAA,IAAAC,SAAA,GAAA9G,0BAAA,CAEnB0E,IAAI,CAACqC,OAAO;IAAAC,KAAA;EAAA;IAAjC,KAAAF,SAAA,CAAAnG,CAAA,MAAAqG,KAAA,GAAAF,SAAA,CAAAzH,CAAA,IAAAuB,IAAA,GAAmC;MAAA,IAAAqG,YAAA,EAAAC,mBAAA;MAAA,IAAxBC,MAAM,GAAAH,KAAA,CAAAnG,KAAA;MAChB;MACA,IAAMgB,IAAI,IAAAoF,YAAA,GAAGE,MAAM,CAACtF,IAAI,cAAAoF,YAAA,uBAAXA,YAAA,CAAaG,WAAW;MACrC;MACA,IAAMvG,KAAK,IAAAqG,mBAAA,GAAGC,MAAM,CAACE,WAAW,cAAAH,mBAAA,uBAAlBA,mBAAA,CAAoB1B,IAAI;MAEtC,IAAI3D,IAAI,IAAIhB,KAAK,EAAE;QAClBgG,WAAW,CAAChF,IAAI,CAAC,GAAGhB,KAAK;MAC1B;IACD;EAAC,SAAAM,GAAA;IAAA2F,SAAA,CAAAjI,CAAA,CAAAsC,GAAA;EAAA;IAAA2F,SAAA,CAAA/F,CAAA;EAAA;EAED,OAAO8F,WAAW;AACnB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"introspection.utility.js","names":["_path","require","_spruceSkillUtils","_lodash","_interopRequireDefault","tsutils","_interopRequireWildcard","ts","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","F","s","done","value","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","serializeSymbol","options","checker","symbol","doc","getName","documentation","displayPartsToString","getDocumentationComment","valueDeclaration","type","typeToString","getTypeOfSymbolAtLocation","serializeSignature","signature","parameters","map","p","returnType","getReturnType","introspectionUtil","introspect","tsFiles","_this","filePaths","program","createProgram","getTypeChecker","introspects","_loop","tsFile","sourceFile","getSourceFile","results","classes","interfaces","_","includes","fileName","hasClassDefinition","exports","getExports","firstExport","declaration","getClassDeclarationFromImportedFile","dirname","_results$classes","_results$interfaces","_getDeclarationsFromN","getDeclarationsFromNode","push","apply","_toConsumableArray2","_firstExport$exportCl","className","exportClause","elements","propertyName","text","classPath","isAbstract","optionsInterfaceName","undefined","parentClassName","parentClassPath","staticProperties","forEachChild","node","_results$classes2","_results$interfaces2","_getDeclarationsFromN2","traverse","isExportDeclaration","exportDeclaration","dirName","isNamedExports","_iterator","_step","_loop2","element","moduleSpecifier","diskUtil","resolveFile","replace","v","declarationSourceFile","isClassDeclaration","_iterator2","getChildren","_step2","child","result","_ret","hasClass","_default","getSymbolAtLocation","_parentClassSymbol","_parentClassSymbol2","_details$constructors","details","constructorType","parentClassSymbol","heritageClauses","getTypeAtLocation","types","getSymbol","parent","isAbstractClass","isModifierFlagSet","ModifierFlags","Abstract","constructors","getConstructSignatures","pluckStaticProperties","isInterfaceDeclaration","interfaceName","staticProps","_iterator3","members","_step3","_member$name","_member$initializer","member","escapedText","initializer"],"sources":["../../src/utilities/introspection.utility.ts"],"sourcesContent":["import { dirname } from 'path'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport _ from 'lodash'\nimport * as tsutils from 'tsutils'\nimport * as ts from 'typescript'\n\nconst serializeSymbol = (options: {\n\tchecker: ts.TypeChecker\n\tsymbol: ts.Symbol\n}): DocEntry => {\n\tconst { checker, symbol } = options\n\tconst doc: DocEntry = {\n\t\tname: symbol.getName(),\n\t\tdocumentation: ts.displayPartsToString(\n\t\t\tsymbol.getDocumentationComment(checker)\n\t\t),\n\t}\n\n\tif (symbol.valueDeclaration) {\n\t\tdoc.type = checker.typeToString(\n\t\t\tchecker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration)\n\t\t)\n\t}\n\n\treturn doc\n}\n\nconst serializeSignature = (options: {\n\tchecker: ts.TypeChecker\n\tsignature: ts.Signature\n}) => {\n\tconst { checker, signature } = options\n\treturn {\n\t\tparameters: signature.parameters.map((p) =>\n\t\t\tserializeSymbol({ symbol: p, checker })\n\t\t),\n\t\treturnType: checker.typeToString(signature.getReturnType()),\n\t\tdocumentation: ts.displayPartsToString(\n\t\t\tsignature.getDocumentationComment(checker)\n\t\t),\n\t}\n}\n\nconst introspectionUtil = {\n\tintrospect(tsFiles: string[]): Introspection[] {\n\t\tconst filePaths = tsFiles\n\t\tconst program = ts.createProgram(filePaths, {})\n\t\tconst checker = program.getTypeChecker()\n\n\t\t// for building results\n\t\tconst introspects: Introspection[] = []\n\n\t\tfor (let i = 0; i < filePaths.length; i += 1) {\n\t\t\tconst tsFile = filePaths[i]\n\t\t\tconst sourceFile = program.getSourceFile(tsFile)\n\t\t\tconst results: Introspection = { classes: [], interfaces: [] }\n\t\t\tif (sourceFile && _.includes(filePaths, sourceFile.fileName)) {\n\t\t\t\tif (!this.hasClassDefinition(sourceFile)) {\n\t\t\t\t\tconst exports = this.getExports(sourceFile)\n\t\t\t\t\tconst firstExport = exports[0]\n\t\t\t\t\tif (firstExport) {\n\t\t\t\t\t\tconst declaration = this.getClassDeclarationFromImportedFile(\n\t\t\t\t\t\t\tfirstExport,\n\t\t\t\t\t\t\tdirname(tsFile),\n\t\t\t\t\t\t\tprogram\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\tif (declaration) {\n\t\t\t\t\t\t\tconst { classes, interfaces } = getDeclarationsFromNode(\n\t\t\t\t\t\t\t\tdeclaration,\n\t\t\t\t\t\t\t\tchecker,\n\t\t\t\t\t\t\t\tsourceFile\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tresults.classes.push(...classes)\n\t\t\t\t\t\t\tresults.interfaces.push(...interfaces)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// must have imported from somewhere else (another node module)\n\t\t\t\t\t\t\tconst className = //@ts-ignore\n\t\t\t\t\t\t\t\tfirstExport.exportClause?.elements?.[0]?.propertyName?.text\n\n\t\t\t\t\t\t\tif (className) {\n\t\t\t\t\t\t\t\tresults.classes.push({\n\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t\tclassPath: tsFile,\n\t\t\t\t\t\t\t\t\tisAbstract: false,\n\t\t\t\t\t\t\t\t\toptionsInterfaceName: undefined,\n\t\t\t\t\t\t\t\t\tparentClassName: undefined,\n\t\t\t\t\t\t\t\t\tparentClassPath: undefined,\n\t\t\t\t\t\t\t\t\tstaticProperties: {},\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tts.forEachChild(sourceFile, (node) => {\n\t\t\t\t\t\tconst { classes, interfaces } = getDeclarationsFromNode(\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\tchecker,\n\t\t\t\t\t\t\tsourceFile\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\tresults.classes.push(...classes)\n\t\t\t\t\t\tresults.interfaces.push(...interfaces)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tintrospects.push(results)\n\t\t}\n\n\t\treturn introspects\n\t},\n\n\tgetExports(sourceFile: ts.SourceFile): ts.Node[] {\n\t\tconst exports: ts.Node[] = []\n\n\t\tconst traverse = (node: ts.Node) => {\n\t\t\tif (ts.isExportDeclaration(node)) {\n\t\t\t\texports.push(node)\n\t\t\t}\n\n\t\t\tts.forEachChild(node, traverse)\n\t\t}\n\n\t\ttraverse(sourceFile)\n\n\t\treturn exports\n\t},\n\n\tgetClassDeclarationFromImportedFile(\n\t\texportDeclaration: ts.Node,\n\t\tdirName: string,\n\t\tprogram: ts.Program\n\t): ts.ClassDeclaration | undefined {\n\t\tif (!ts.isExportDeclaration(exportDeclaration)) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst exportClause = exportDeclaration.exportClause\n\t\tif (!exportClause || !ts.isNamedExports(exportClause)) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tfor (const element of exportClause.elements) {\n\t\t\tif (element.propertyName) {\n\t\t\t\tconst propertyName = element.propertyName.text\n\t\t\t\tconst moduleSpecifier = (\n\t\t\t\t\texportDeclaration.moduleSpecifier as ts.StringLiteral\n\t\t\t\t).text\n\n\t\t\t\tconst sourceFile = diskUtil.resolveFile(\n\t\t\t\t\tdirName,\n\t\t\t\t\tmoduleSpecifier.replace(/^\\.\\//, '')\n\t\t\t\t)\n\n\t\t\t\tif (!sourceFile) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\n\t\t\t\t// Load the source file containing the class declaration\n\t\t\t\tconst declarationSourceFile = program.getSourceFile(sourceFile)\n\t\t\t\tif (!declarationSourceFile) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\n\t\t\t\tconst traverse = (node: ts.Node): ts.ClassDeclaration | undefined => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tts.isClassDeclaration(node) &&\n\t\t\t\t\t\tnode.name &&\n\t\t\t\t\t\tnode.name.text === propertyName\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn node\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const child of node.getChildren(declarationSourceFile)) {\n\t\t\t\t\t\tconst result = traverse(child)\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\treturn result\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\n\t\t\t\treturn traverse(declarationSourceFile)\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t},\n\n\thasClassDefinition(sourceFile: ts.SourceFile): boolean {\n\t\tlet hasClass = false\n\n\t\tconst traverse = (node: ts.Node) => {\n\t\t\tif (ts.isClassDeclaration(node)) {\n\t\t\t\thasClass = true\n\t\t\t}\n\n\t\t\tif (!hasClass) {\n\t\t\t\tts.forEachChild(node, traverse)\n\t\t\t}\n\t\t}\n\n\t\ttraverse(sourceFile)\n\n\t\treturn hasClass\n\t},\n}\n\nexport default introspectionUtil\n\nfunction getDeclarationsFromNode(\n\tnode: ts.Node,\n\tchecker: ts.TypeChecker,\n\tsourceFile: ts.SourceFile\n) {\n\tconst classes: IntrospectionClass[] = []\n\tconst interfaces: IntrospectionInterface[] = []\n\n\t// if this is a class declaration\n\tif (ts.isClassDeclaration(node) && node.name) {\n\t\tconst symbol = checker.getSymbolAtLocation(node.name)\n\n\t\tif (symbol?.valueDeclaration) {\n\t\t\tconst details = serializeSymbol({ checker, symbol })\n\t\t\t// Get the construct signatures\n\t\t\tconst constructorType = checker.getTypeOfSymbolAtLocation(\n\t\t\t\tsymbol,\n\t\t\t\tsymbol.valueDeclaration\n\t\t\t)\n\n\t\t\tlet parentClassSymbol: ts.Symbol | undefined\n\t\t\tif (node.heritageClauses && node.heritageClauses[0]) {\n\t\t\t\tparentClassSymbol = checker\n\t\t\t\t\t.getTypeAtLocation(node.heritageClauses[0].types[0])\n\t\t\t\t\t.getSymbol()\n\t\t\t}\n\n\t\t\tconst parentClassName =\n\t\t\t\t// @ts-ignore\n\t\t\t\tparentClassSymbol?.valueDeclaration?.name?.text\n\t\t\t// @ts-ignore\n\t\t\tconst parentClassPath = parentClassSymbol?.parent\n\t\t\t\t?.getName()\n\t\t\t\t.replace('\"', '')\n\n\t\t\tconst isAbstractClass = tsutils.isModifierFlagSet(\n\t\t\t\tnode,\n\t\t\t\tts.ModifierFlags.Abstract\n\t\t\t)\n\t\t\tdetails.constructors = constructorType\n\t\t\t\t.getConstructSignatures()\n\t\t\t\t.map((s) => serializeSignature({ signature: s, checker }))\n\n\t\t\tclasses.push({\n\t\t\t\tclassName: node.name.text,\n\t\t\t\tclassPath: sourceFile.fileName,\n\t\t\t\tparentClassName,\n\t\t\t\tparentClassPath,\n\t\t\t\tstaticProperties: pluckStaticProperties(node),\n\t\t\t\toptionsInterfaceName: details.constructors?.[0].parameters?.[0]?.type,\n\t\t\t\tisAbstract: isAbstractClass,\n\t\t\t})\n\t\t}\n\t} else if (ts.isInterfaceDeclaration(node)) {\n\t\tinterfaces.push({\n\t\t\tinterfaceName: node.name.text,\n\t\t})\n\t}\n\treturn { classes, interfaces }\n}\n\nfunction pluckStaticProperties(node: ts.ClassDeclaration): StaticProperties {\n\tconst staticProps: StaticProperties = {}\n\n\tfor (const member of node.members) {\n\t\t//@ts-ignore\n\t\tconst name = member.name?.escapedText\n\t\t//@ts-ignore\n\t\tconst value = member.initializer?.text\n\n\t\tif (name && value) {\n\t\t\tstaticProps[name] = value\n\t\t}\n\t}\n\n\treturn staticProps\n}\n\nexport interface IntrospectionClass {\n\tclassName: string\n\tclassPath: string\n\tparentClassName: string | undefined\n\tparentClassPath: string | undefined\n\toptionsInterfaceName: string | undefined\n\tisAbstract: boolean\n\tstaticProperties: StaticProperties\n}\n\ntype StaticProperties = Record<string, any>\n\ninterface IntrospectionInterface {\n\tinterfaceName: string\n}\n\nexport interface Introspection {\n\tclasses: IntrospectionClass[]\n\tinterfaces: IntrospectionInterface[]\n}\n\ninterface DocEntry {\n\tname?: string\n\tfileName?: string\n\tdocumentation?: string\n\ttype?: string\n\tconstructors?: DocEntry[]\n\tparameters?: DocEntry[]\n\treturnType?: string\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,EAAA,GAAAD,uBAAA,CAAAL,OAAA;AAAgC,SAAAO,yBAA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,GAAG,CAAC,CAAC;EAAA,IAAAC,UAAA,GAAAxJ,0BAAA,CAEnBsG,IAAI,CAACmD,OAAO;IAAAC,MAAA;EAAA;IAAjC,KAAAF,UAAA,CAAA7I,CAAA,MAAA+I,MAAA,GAAAF,UAAA,CAAAnK,CAAA,IAAAuB,IAAA,GAAmC;MAAA,IAAA+I,YAAA,EAAAC,mBAAA;MAAA,IAAxBC,MAAM,GAAAH,MAAA,CAAA7I,KAAA;MAChB;MACA,IAAMgB,IAAI,IAAA8H,YAAA,GAAGE,MAAM,CAAChI,IAAI,cAAA8H,YAAA,uBAAXA,YAAA,CAAaG,WAAW;MACrC;MACA,IAAMjJ,KAAK,IAAA+I,mBAAA,GAAGC,MAAM,CAACE,WAAW,cAAAH,mBAAA,uBAAlBA,mBAAA,CAAoB/D,IAAI;MAEtC,IAAIhE,IAAI,IAAIhB,KAAK,EAAE;QAClB0I,WAAW,CAAC1H,IAAI,CAAC,GAAGhB,KAAK;MAC1B;IACD;EAAC,SAAAM,GAAA;IAAAqI,UAAA,CAAA3K,CAAA,CAAAsC,GAAA;EAAA;IAAAqI,UAAA,CAAAzI,CAAA;EAAA;EAED,OAAOwI,WAAW;AACnB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"version": "20.0.
|
|
20
|
+
"version": "20.0.2",
|
|
21
21
|
"bin": {
|
|
22
22
|
"spruce": "./build/index.js"
|
|
23
23
|
},
|
|
@@ -75,24 +75,24 @@
|
|
|
75
75
|
"@babel/plugin-proposal-decorators": "^7.24.1",
|
|
76
76
|
"@babel/runtime": "^7.24.1",
|
|
77
77
|
"@jest/reporters": "^29.7.0",
|
|
78
|
-
"@sprucelabs/error": "^5.1.
|
|
79
|
-
"@sprucelabs/globby": "^1.0.
|
|
80
|
-
"@sprucelabs/heartwood-view-controllers": "^109.
|
|
81
|
-
"@sprucelabs/jest-json-reporter": "^7.0.
|
|
82
|
-
"@sprucelabs/mercury-client": "^41.0.
|
|
83
|
-
"@sprucelabs/mercury-event-emitter": "^41.0.
|
|
84
|
-
"@sprucelabs/mercury-types": "^46.0.
|
|
85
|
-
"@sprucelabs/schema": "^29.4.
|
|
86
|
-
"@sprucelabs/spruce-core-schemas": "^39.0.
|
|
87
|
-
"@sprucelabs/spruce-event-utils": "^38.1.
|
|
88
|
-
"@sprucelabs/spruce-skill-utils": "^30.
|
|
89
|
-
"@sprucelabs/spruce-templates": "^20.0.
|
|
78
|
+
"@sprucelabs/error": "^5.1.89",
|
|
79
|
+
"@sprucelabs/globby": "^1.0.22",
|
|
80
|
+
"@sprucelabs/heartwood-view-controllers": "^109.7.12",
|
|
81
|
+
"@sprucelabs/jest-json-reporter": "^7.0.193",
|
|
82
|
+
"@sprucelabs/mercury-client": "^41.0.360",
|
|
83
|
+
"@sprucelabs/mercury-event-emitter": "^41.0.360",
|
|
84
|
+
"@sprucelabs/mercury-types": "^46.0.278",
|
|
85
|
+
"@sprucelabs/schema": "^29.4.38",
|
|
86
|
+
"@sprucelabs/spruce-core-schemas": "^39.0.272",
|
|
87
|
+
"@sprucelabs/spruce-event-utils": "^38.1.18",
|
|
88
|
+
"@sprucelabs/spruce-skill-utils": "^30.4.4",
|
|
89
|
+
"@sprucelabs/spruce-templates": "^20.0.2",
|
|
90
90
|
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
91
91
|
"@typescript-eslint/parser": "^5.27.1",
|
|
92
92
|
"cfonts": "^3.2.0",
|
|
93
93
|
"chalk": "4.1.2",
|
|
94
94
|
"chokidar": "^3.6.0",
|
|
95
|
-
"cli-table3": "^0.6.
|
|
95
|
+
"cli-table3": "^0.6.4",
|
|
96
96
|
"commander": "7.2.0",
|
|
97
97
|
"emphasize": "4.2.0",
|
|
98
98
|
"fs-extra": "^11.2.0",
|
|
@@ -109,20 +109,20 @@
|
|
|
109
109
|
"terminal-kit": "sprucelabsai/terminal-kit",
|
|
110
110
|
"tree-kill": "^1.2.2",
|
|
111
111
|
"tsutils": "^3.21.0",
|
|
112
|
-
"typescript": "^5.4.
|
|
112
|
+
"typescript": "^5.4.3",
|
|
113
113
|
"uuid": "^9.0.1"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@sprucelabs/data-stores": "^26.4.
|
|
116
|
+
"@sprucelabs/data-stores": "^26.4.67",
|
|
117
117
|
"@sprucelabs/jest-sheets-reporter": "^3.0.26",
|
|
118
|
-
"@sprucelabs/mercury-core-events": "^22.2.
|
|
119
|
-
"@sprucelabs/resolve-path-aliases": "^1.1.
|
|
120
|
-
"@sprucelabs/spruce-conversation-plugin": "^
|
|
121
|
-
"@sprucelabs/spruce-deploy-plugin": "^
|
|
122
|
-
"@sprucelabs/spruce-store-plugin": "^
|
|
123
|
-
"@sprucelabs/spruce-test-fixtures": "^
|
|
124
|
-
"@sprucelabs/test": "^8.0.
|
|
125
|
-
"@sprucelabs/test-utils": "^4.0.
|
|
118
|
+
"@sprucelabs/mercury-core-events": "^22.2.63",
|
|
119
|
+
"@sprucelabs/resolve-path-aliases": "^1.1.294",
|
|
120
|
+
"@sprucelabs/spruce-conversation-plugin": "^61.1.8",
|
|
121
|
+
"@sprucelabs/spruce-deploy-plugin": "^61.1.8",
|
|
122
|
+
"@sprucelabs/spruce-store-plugin": "^61.1.8",
|
|
123
|
+
"@sprucelabs/spruce-test-fixtures": "^61.1.8",
|
|
124
|
+
"@sprucelabs/test": "^8.0.47",
|
|
125
|
+
"@sprucelabs/test-utils": "^4.0.136",
|
|
126
126
|
"@types/blessed": "^0.1.25",
|
|
127
127
|
"@types/eslint": "^8.56.6",
|
|
128
128
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@types/semver": "^7.5.8",
|
|
136
136
|
"@types/sha1": "^1.1.5",
|
|
137
137
|
"@types/slug": "^5.0.8",
|
|
138
|
-
"@types/superagent": "^8.1.
|
|
138
|
+
"@types/superagent": "^8.1.6",
|
|
139
139
|
"@types/terminal-kit": "^2.5.6",
|
|
140
140
|
"@types/uuid": "^9.0.8",
|
|
141
141
|
"chokidar-cli": "^3.0.0",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"ps-node": "^0.1.6",
|
|
154
154
|
"ts-jest": "^29.1.2",
|
|
155
155
|
"ts-node": "^10.9.2",
|
|
156
|
-
"tsc-watch": "^6.0
|
|
156
|
+
"tsc-watch": "^6.1.0",
|
|
157
157
|
"tsconfig-paths": "^4.2.0"
|
|
158
158
|
},
|
|
159
159
|
"testSkillCache": {
|
|
@@ -590,5 +590,5 @@
|
|
|
590
590
|
"terminal-kit"
|
|
591
591
|
]
|
|
592
592
|
},
|
|
593
|
-
"gitHead": "
|
|
593
|
+
"gitHead": "2bde52b4518eb67898a35fc8eca9c9667e72337a"
|
|
594
594
|
}
|
|
@@ -41,6 +41,7 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
41
41
|
protected static async returnsErrorWhenDockerNotEnabled() {
|
|
42
42
|
CommandService.fakeCommand(/npm config/gis, {
|
|
43
43
|
code: 1,
|
|
44
|
+
stderr: 'which',
|
|
44
45
|
})
|
|
45
46
|
|
|
46
47
|
const results = await this.Action('cache', 'enable').execute({})
|
|
@@ -255,7 +255,7 @@ import { vcDiskUtil } from '@sprucelabs/spruce-test-fixtures'
|
|
|
255
255
|
AuthenticatorImpl.setStorage(new StubStorage())
|
|
256
256
|
|
|
257
257
|
const vcFactory = ViewControllerFactory.Factory({
|
|
258
|
-
controllerMap: vcDiskUtil.loadViewControllersAndBuildMap('testing-views', __dirname),
|
|
258
|
+
controllerMap: vcDiskUtil.loadViewControllersAndBuildMap('testing-views', __dirname).map,
|
|
259
259
|
device: {} as any,
|
|
260
260
|
connectToApi: async () => {
|
|
261
261
|
return 'yes' as any
|
|
@@ -95,6 +95,59 @@ export default class CreatingAViewPluginTest extends AbstractSkillTest {
|
|
|
95
95
|
this.assertCombinedFileIncludes('heartwood(vcs, pluginsByName)')
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
@test()
|
|
99
|
+
protected static async viewPluginCanImportAnotherViewPlugin() {
|
|
100
|
+
this.writeFile('export class ExternalViewPlugin {}', 'external.ts')
|
|
101
|
+
this.writeFile(
|
|
102
|
+
`export { ExternalViewPlugin as default } from './external'`,
|
|
103
|
+
'actual.view.plugin.ts'
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
await this.syncViews()
|
|
107
|
+
|
|
108
|
+
const expected = `export const pluginsByName = {
|
|
109
|
+
actual: ExternalViewPlugin,
|
|
110
|
+
aThird: AThirdViewPlugin,
|
|
111
|
+
another: AnotherViewPlugin,
|
|
112
|
+
test: TestViewPlugin,
|
|
113
|
+
testCamel: TestCamelViewPlugin,
|
|
114
|
+
}
|
|
115
|
+
`
|
|
116
|
+
|
|
117
|
+
this.assertCombinedFileIncludes(expected)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@test()
|
|
121
|
+
protected static async canImportPluginFromExternalLibrary() {
|
|
122
|
+
this.writeFile(
|
|
123
|
+
"export { CardViewController as default } from '@sprucelabs/heartwood-view-controllers'",
|
|
124
|
+
'card.view.plugin.ts'
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
await this.syncViews()
|
|
128
|
+
|
|
129
|
+
const expected = `export const pluginsByName = {
|
|
130
|
+
actual: ExternalViewPlugin,
|
|
131
|
+
card: CardViewController,
|
|
132
|
+
aThird: AThirdViewPlugin,
|
|
133
|
+
another: AnotherViewPlugin,
|
|
134
|
+
test: TestViewPlugin,
|
|
135
|
+
testCamel: TestCamelViewPlugin,
|
|
136
|
+
}
|
|
137
|
+
`
|
|
138
|
+
this.assertCombinedFileIncludes(expected)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private static async syncViews() {
|
|
142
|
+
await this.Action('view', 'sync').execute({})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private static writeFile(content: string, fileName: string) {
|
|
146
|
+
const actualPlugiContent = content
|
|
147
|
+
const actualDestination = this.resolvePath('src', fileName)
|
|
148
|
+
diskUtil.writeFile(actualDestination, actualPlugiContent)
|
|
149
|
+
}
|
|
150
|
+
|
|
98
151
|
private static assertCombinedFileIncludes(expected: string) {
|
|
99
152
|
const combined = this.getPathToCombinedViewsFile()
|
|
100
153
|
const contents = diskUtil.readFile(combined)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HASH_SPRUCE_DIR,
|
|
3
|
+
SettingsService,
|
|
4
|
+
diskUtil,
|
|
5
|
+
} from '@sprucelabs/spruce-skill-utils'
|
|
6
|
+
import { assert, test } from '@sprucelabs/test-utils'
|
|
7
|
+
import EventCacheService from '../../features/event/services/EventCacheService'
|
|
8
|
+
import ServiceFactory from '../../services/ServiceFactory'
|
|
9
|
+
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
10
|
+
|
|
11
|
+
export default class EventCacheServiceTest extends AbstractCliTest {
|
|
12
|
+
@test()
|
|
13
|
+
protected static async writesToHashSpruceCacheJson() {
|
|
14
|
+
ServiceFactory.serviceClassOverides['eventCache'] = SpyEventCacheService
|
|
15
|
+
ServiceFactory.serviceClassOverides['settings'] = SpySettingsService
|
|
16
|
+
|
|
17
|
+
const settings = this.Service('eventCache') as SpyEventCacheService
|
|
18
|
+
const expected = diskUtil.resolvePath(
|
|
19
|
+
this.cwd,
|
|
20
|
+
HASH_SPRUCE_DIR,
|
|
21
|
+
'event-cache.json'
|
|
22
|
+
)
|
|
23
|
+
const actual = settings.getCacheFilePath()
|
|
24
|
+
assert.isEqual(actual, expected)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class SpyEventCacheService extends EventCacheService {
|
|
29
|
+
public getCacheFilePath() {
|
|
30
|
+
return (this.settings as SpySettingsService).getSettingsPath()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class SpySettingsService extends SettingsService<string> {
|
|
35
|
+
public getSettingsPath() {
|
|
36
|
+
return super.getSettingsPath()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -235,7 +235,9 @@ export default class SpruceError extends AbstractSpruceError<ErrorOptions> {
|
|
|
235
235
|
break
|
|
236
236
|
|
|
237
237
|
case 'DOCKER_NOT_STARTED':
|
|
238
|
-
message =
|
|
238
|
+
message =
|
|
239
|
+
'Docker has not been started (or you are trying to run this command in a monorepo)! Start it and try again (or move out of a monorepo)! Originial error:\n\n' +
|
|
240
|
+
options.originalError?.stack
|
|
239
241
|
break
|
|
240
242
|
|
|
241
243
|
case 'SCHEMA_TEMPLATE_ITEM_BUILDING_FAILED':
|
|
@@ -36,9 +36,11 @@ export default class EnableCacheAction extends AbstractAction<OptionsSchema> {
|
|
|
36
36
|
}
|
|
37
37
|
} catch (err: any) {
|
|
38
38
|
let error = err
|
|
39
|
+
|
|
39
40
|
if (err.options?.cmd?.includes('which')) {
|
|
40
41
|
error = new SpruceError({
|
|
41
42
|
code: 'MISSING_DEPENDENCIES',
|
|
43
|
+
originalError: err,
|
|
42
44
|
dependencies: [
|
|
43
45
|
{
|
|
44
46
|
name: 'Docker',
|
|
@@ -47,7 +49,10 @@ export default class EnableCacheAction extends AbstractAction<OptionsSchema> {
|
|
|
47
49
|
],
|
|
48
50
|
})
|
|
49
51
|
} else {
|
|
50
|
-
error = new SpruceError({
|
|
52
|
+
error = new SpruceError({
|
|
53
|
+
code: 'DOCKER_NOT_STARTED',
|
|
54
|
+
originalError: err,
|
|
55
|
+
})
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
return {
|
|
@@ -94,7 +94,7 @@ export default class EventFeature extends AbstractFeature {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
if (featureCode === 'node' || featureCode === 'upgrade') {
|
|
97
|
-
const settings = this.Service('
|
|
97
|
+
const settings = this.Service('eventCache')
|
|
98
98
|
settings.clearListenerCache()
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -177,7 +177,7 @@ export default class EventFeature extends AbstractFeature {
|
|
|
177
177
|
private async handleDidFetchSchemas(payload: { schemas?: Schema[] | null }) {
|
|
178
178
|
const isInstalled = await this.features.isInstalled(this.code)
|
|
179
179
|
|
|
180
|
-
const lastSync = this.Service('
|
|
180
|
+
const lastSync = this.Service('eventCache').getLastSyncOptions()
|
|
181
181
|
|
|
182
182
|
if (lastSync && isInstalled) {
|
|
183
183
|
const writer = this.getEventContractBuilder()
|
|
@@ -25,7 +25,7 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
this.Service('
|
|
28
|
+
this.Service('eventCache').setLastSyncCache(options)
|
|
29
29
|
|
|
30
30
|
const schemaSyncResults = await this.Action('schema', 'sync').execute({})
|
|
31
31
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { SettingsService } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
|
|
3
|
-
export default class
|
|
4
|
-
|
|
3
|
+
export default class EventCacheService {
|
|
4
|
+
protected settings: SettingsService<string>
|
|
5
|
+
|
|
5
6
|
public constructor(settings: SettingsService) {
|
|
6
7
|
this.settings = settings
|
|
8
|
+
this.settings.setFile('event-cache.json')
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
public getLastSyncOptions() {
|
|
10
12
|
return this.settings.get('events.lastSync')
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
public
|
|
15
|
+
public setLastSyncCache(options: {
|
|
14
16
|
shouldSyncOnlyCoreEvents?: boolean | null
|
|
15
17
|
}) {
|
|
16
18
|
this.settings.set('events.lastSync', options)
|
|
@@ -7,10 +7,6 @@ import actionUtil from '../../../utilities/action.utility'
|
|
|
7
7
|
import AbstractAction from '../../AbstractAction'
|
|
8
8
|
import { FeatureActionResponse } from '../../features.types'
|
|
9
9
|
|
|
10
|
-
type OptionsSchema =
|
|
11
|
-
SpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema
|
|
12
|
-
type Options = SchemaValues<OptionsSchema>
|
|
13
|
-
|
|
14
10
|
export default class UpgradeAction extends AbstractAction<OptionsSchema> {
|
|
15
11
|
public invocationMessage = 'Upgrading your skill... 💪'
|
|
16
12
|
public optionsSchema = upgradeSkillActionSchema
|
|
@@ -77,3 +73,7 @@ export default class UpgradeAction extends AbstractAction<OptionsSchema> {
|
|
|
77
73
|
})
|
|
78
74
|
}
|
|
79
75
|
}
|
|
76
|
+
|
|
77
|
+
type OptionsSchema =
|
|
78
|
+
SpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema
|
|
79
|
+
type Options = SchemaValues<OptionsSchema>
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
EnvService,
|
|
4
4
|
AuthService,
|
|
5
5
|
} from '@sprucelabs/spruce-skill-utils'
|
|
6
|
-
import
|
|
6
|
+
import EventCacheService from '../features/event/services/EventCacheService'
|
|
7
7
|
import RemoteService from '../features/event/services/RemoteService'
|
|
8
8
|
import { FeatureCode } from '../features/features.types'
|
|
9
9
|
import SchemaService from '../features/schema/services/SchemaService'
|
|
@@ -19,10 +19,12 @@ import TypeCheckerService from './TypeCheckerService'
|
|
|
19
19
|
export default class ServiceFactory {
|
|
20
20
|
public static serviceClassOverides: Record<string, any> = {}
|
|
21
21
|
|
|
22
|
+
public static setServiceClass(name: Service, Class: any) {
|
|
23
|
+
this.serviceClassOverides[name] = Class
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
public Service<S extends Service>(cwd: string, type: S): ServiceMap[S] {
|
|
23
|
-
|
|
24
|
-
return new ServiceFactory.serviceClassOverides[type](cwd) as ServiceMap[S]
|
|
25
|
-
}
|
|
27
|
+
const Class = ServiceFactory.serviceClassOverides[type] as any
|
|
26
28
|
|
|
27
29
|
switch (type) {
|
|
28
30
|
case 'auth':
|
|
@@ -55,7 +57,8 @@ export default class ServiceFactory {
|
|
|
55
57
|
this.buildImportService(cwd)
|
|
56
58
|
) as ServiceMap[S]
|
|
57
59
|
case 'settings':
|
|
58
|
-
|
|
60
|
+
//@ts-ignore
|
|
61
|
+
return new (Class ?? SettingsService)<FeatureCode>(cwd) as ServiceMap[S]
|
|
59
62
|
case 'dependency':
|
|
60
63
|
return new DependencyService(
|
|
61
64
|
new SettingsService<FeatureCode>(cwd)
|
|
@@ -69,8 +72,8 @@ export default class ServiceFactory {
|
|
|
69
72
|
new LintService(cwd, () => this.Service(cwd, 'command'))
|
|
70
73
|
) as ServiceMap[S]
|
|
71
74
|
}
|
|
72
|
-
case '
|
|
73
|
-
return new
|
|
75
|
+
case 'eventCache':
|
|
76
|
+
return new (Class ?? EventCacheService)(
|
|
74
77
|
new SettingsService(cwd)
|
|
75
78
|
) as ServiceMap[S]
|
|
76
79
|
default:
|
|
@@ -107,7 +110,7 @@ export interface ServiceMap {
|
|
|
107
110
|
env: EnvService
|
|
108
111
|
auth: AuthService
|
|
109
112
|
remote: RemoteService
|
|
110
|
-
|
|
113
|
+
eventCache: EventCacheService
|
|
111
114
|
dependency: DependencyService
|
|
112
115
|
}
|
|
113
116
|
|