@keshavsoft/kschema-api-gen-actions 1.14.3 → 1.16.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/README.md +4 -1
- package/bin/cli.js +1 -1
- package/bin/{v14/tasks/actions/GetMethods/ShowAll → v15/tasks/actions/GetMethods/Distinct}/template/controller.js +7 -2
- package/bin/v15/tasks/actions/GetMethods/Distinct/template/service.js +12 -0
- package/bin/{v13 → v15}/tasks/actions/distinct.js +5 -6
- package/bin/{v14 → v15}/tasks/actions/showAll.js +10 -3
- package/bin/v16/config/actions.json +35 -0
- package/bin/v16/config/actionsV2.json +23 -0
- package/bin/v16/core/showUsage.js +49 -0
- package/bin/{v13 → v16}/start.js +1 -1
- package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/template/controller.js +7 -2
- package/bin/v16/tasks/actions/GetMethods/Distinct/V1/template/service.js +12 -0
- package/bin/v16/tasks/actions/GetMethods/Distinct/V2/template/controller.js +26 -0
- package/bin/v16/tasks/actions/GetMethods/Distinct/V2/template/service.js +12 -0
- package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +8 -0
- package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateImports/index.js +45 -0
- package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/buildUseLine.js +9 -0
- package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +8 -0
- package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/index.js +46 -0
- package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/resolveFolderName.js +20 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/common/readFile.js +8 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/common/writeFile.js +10 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/buildImport.js +9 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +10 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +10 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/announce.js +9 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/createFolder.js +7 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/createHttpFile.js +12 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/decideTemplate.js +3 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/locateDestination.js +7 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/locateSource.js +13 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/updateAppJs.js +7 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/updateEndPointsFile.js +30 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/steps/updateEndPointsJs.js +16 -0
- package/bin/v16/tasks/actions/PostMethods/Insert/template/errors.js +11 -0
- package/bin/{v14 → v16}/tasks/actions/distinct.js +11 -15
- package/bin/{v13 → v16}/tasks/actions/showAll.js +10 -3
- package/package.json +2 -2
- package/bin/v13/core/showUsage.js +0 -50
- package/bin/v13/tasks/actions/GetMethods/Distinct/template/service.js +0 -9
- package/bin/v14/tasks/actions/GetMethods/Distinct/template/service.js +0 -9
- /package/bin/{v13 → v15}/commands/loadCommand.js +0 -0
- /package/bin/{v14 → v15}/config/actions.json +0 -0
- /package/bin/{v14 → v15}/config/actionsV1.json +0 -0
- /package/bin/{v13 → v15}/core/createFolder.js +0 -0
- /package/bin/{v13 → v15}/core/parseInput.js +0 -0
- /package/bin/{v13 → v15}/core/resolveCommand.js +0 -0
- /package/bin/{v14 → v15}/core/showUsage.js +0 -0
- /package/bin/{v14 → v15}/start.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/announce.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/createFolder.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/createHttpFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/decideTemplate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/locateDestination.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/locateSource.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/resolveFolderName.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/updateAppJs.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/steps/updateEndPointsJs.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/Distinct/template/errors.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/announce.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/createFolder.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/createHttpFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/decideTemplate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/locateDestination.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/locateSource.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/resolveFolderName.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/updateAppJs.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/steps/updateEndPointsJs.js +0 -0
- /package/bin/{v13/tasks/actions/GetMethods/Distinct → v15/tasks/actions/GetMethods/ShowAll}/template/controller.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/template/errors.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/GetMethods/ShowAll/template/service.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/announce.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/createFolder.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/createHttpFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/decideTemplate.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/locateDestination.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/locateSource.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/resolveFolderName.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/updateAppJs.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/steps/updateEndPointsJs.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/template/controller.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/template/errors.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/template/middleware.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/PostMethods/Insert/template/service.js +0 -0
- /package/bin/{v13 → v15}/tasks/actions/insert.js +0 -0
- /package/bin/{v13 → v15}/tasks/core/createFolder.js +0 -0
- /package/bin/{v13 → v15}/tasks/core/parseInput.js +0 -0
- /package/bin/{v13 → v15}/tasks/core/resolveCommand.js +0 -0
- /package/bin/{v13 → v15}/tasks/core/showUsage.js +0 -0
- /package/bin/{v14 → v16}/commands/loadCommand.js +0 -0
- /package/bin/{v13/config/actions.json → v16/config/actionsV1.json} +0 -0
- /package/bin/{v14 → v16}/core/createFolder.js +0 -0
- /package/bin/{v14 → v16}/core/parseInput.js +0 -0
- /package/bin/{v14 → v16}/core/resolveCommand.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/announce.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/createFolder.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/createHttpFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/decideTemplate.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/locateDestination.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/locateSource.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/resolveFolderName.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/updateAppJs.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/steps/updateEndPointsJs.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/Distinct → v16/tasks/actions/GetMethods/Distinct/V1}/template/errors.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/announce.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/createFolder.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/createHttpFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/decideTemplate.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/locateDestination.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/locateSource.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/resolveFolderName.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/updateAppJs.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/steps/updateEndPointsJs.js +0 -0
- /package/bin/{v14/tasks/actions/GetMethods/ShowAll → v16/tasks/actions/GetMethods/Distinct/V2}/template/errors.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/announce.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/createFolder.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/createHttpFile.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/decideTemplate.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/locateDestination.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/locateSource.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/updateAppJs.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/steps/updateEndPointsJs.js +0 -0
- /package/bin/{v13 → v16}/tasks/actions/GetMethods/ShowAll/template/controller.js +0 -0
- /package/bin/{v14/tasks/actions/PostMethods/Insert → v16/tasks/actions/GetMethods/ShowAll}/template/errors.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/GetMethods/ShowAll/template/service.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/steps/resolveFolderName.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/template/controller.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/template/middleware.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/PostMethods/Insert/template/service.js +0 -0
- /package/bin/{v14 → v16}/tasks/actions/insert.js +0 -0
- /package/bin/{v14 → v16}/tasks/core/createFolder.js +0 -0
- /package/bin/{v14 → v16}/tasks/core/parseInput.js +0 -0
- /package/bin/{v14 → v16}/tasks/core/resolveCommand.js +0 -0
- /package/bin/{v14 → v16}/tasks/core/showUsage.js +0 -0
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { fromJsonPath } from './service.js';
|
|
2
2
|
import { ConflictError, StorageError } from './errors.js';
|
|
3
3
|
|
|
4
|
-
const getFunc = ({ res, inTableName }) => {
|
|
4
|
+
const getFunc = ({ req, res, inTableName }) => {
|
|
5
5
|
try {
|
|
6
|
-
const
|
|
6
|
+
const columnName = req.params.columnName;
|
|
7
|
+
|
|
8
|
+
const message = fromJsonPath({
|
|
9
|
+
inTableName,
|
|
10
|
+
inColumnName: columnName
|
|
11
|
+
});
|
|
7
12
|
|
|
8
13
|
res.type("application/json").send(message);
|
|
9
14
|
} catch (err) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { kschema } from "@keshavsoft/kschema";
|
|
2
|
+
|
|
3
|
+
const fromJsonPath = ({ inTableName, inColumnName }) => {
|
|
4
|
+
const tableName = inTableName;
|
|
5
|
+
|
|
6
|
+
const array = kschema.table(tableName).query.aggregate.distinct(inColumnName);
|
|
7
|
+
const collection = array.map(str => ({ [inColumnName]: str }));
|
|
8
|
+
|
|
9
|
+
return collection;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { fromJsonPath };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { endPointsJs } from "@keshavsoft/kschema-api-check";
|
|
3
3
|
|
|
4
|
-
import { locateSource } from "./GetMethods/
|
|
5
|
-
import { locateDestination } from "./GetMethods/
|
|
4
|
+
import { locateSource } from "./GetMethods/Distinct/steps/locateSource.js";
|
|
5
|
+
import { locateDestination } from "./GetMethods/Distinct/steps/locateDestination.js";
|
|
6
6
|
import { createFolder } from "../core/createFolder.js";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
import createHttpFile from "./GetMethods/ShowAll/steps/createHttpFile.js";
|
|
8
|
+
import createHttpFile from "./GetMethods/Distinct/steps/createHttpFile.js";
|
|
10
9
|
|
|
11
|
-
import { announce } from "./GetMethods/
|
|
10
|
+
import { announce } from "./GetMethods/Distinct/steps/announce.js";
|
|
12
11
|
|
|
13
|
-
import resolveFolderName from "./GetMethods/
|
|
12
|
+
import resolveFolderName from "./GetMethods/Distinct/steps/resolveFolderName.js";
|
|
14
13
|
|
|
15
14
|
export default ({ cmd = "", toPath, isAnnounce = true, checkBeforeCreate = true }) => {
|
|
16
15
|
const localToPath = toPath;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import
|
|
2
|
+
import endPointsJs from "@keshavsoft/kschema-api-check";
|
|
3
3
|
|
|
4
4
|
import { locateSource } from "./GetMethods/ShowAll/steps/locateSource.js";
|
|
5
5
|
import { locateDestination } from "./GetMethods/ShowAll/steps/locateDestination.js";
|
|
@@ -12,7 +12,7 @@ import { announce } from "./GetMethods/ShowAll/steps/announce.js";
|
|
|
12
12
|
|
|
13
13
|
import resolveFolderName from "./GetMethods/ShowAll/steps/resolveFolderName.js";
|
|
14
14
|
|
|
15
|
-
export default ({ cmd = "", toPath, isAnnounce = true, checkBeforeCreate = true }) => {
|
|
15
|
+
export default async ({ cmd = "", toPath, isAnnounce = true, checkBeforeCreate = true }) => {
|
|
16
16
|
const localToPath = toPath;
|
|
17
17
|
|
|
18
18
|
const resolvedFolderName = resolveFolderName({
|
|
@@ -37,11 +37,18 @@ export default ({ cmd = "", toPath, isAnnounce = true, checkBeforeCreate = true
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
if (createFolderResponse.KTF) {
|
|
40
|
-
endPointsJs(
|
|
40
|
+
const loadEndPointsJs = await endPointsJs();
|
|
41
|
+
|
|
42
|
+
await loadEndPointsJs({
|
|
41
43
|
toPath: localToPath,
|
|
42
44
|
action: resolvedFolderName
|
|
43
45
|
});
|
|
44
46
|
|
|
47
|
+
// await endPointsJs({
|
|
48
|
+
// toPath: localToPath,
|
|
49
|
+
// action: resolvedFolderName
|
|
50
|
+
// });
|
|
51
|
+
|
|
45
52
|
// updateEndPointsJs({
|
|
46
53
|
// appJsPath: `${localToPath}/end-points.js`,
|
|
47
54
|
// endpoint: resolvedFolderName
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"cmd": "ShowAll",
|
|
4
|
+
"file": "showAll",
|
|
5
|
+
"exportFile": "ShowAll",
|
|
6
|
+
"group": "GetMethods",
|
|
7
|
+
"description": "Generate ShowAll GET action",
|
|
8
|
+
"endPointsJs": {
|
|
9
|
+
"importLine": "import { getFunc } from './ShowAll/controller.js';",
|
|
10
|
+
"usageLine": "router.get('/ShowAll', (req, res) => getFunc({ res, inTableName : tableName}));"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"cmd": "Insert",
|
|
15
|
+
"file": "insert",
|
|
16
|
+
"exportFile": "Insert",
|
|
17
|
+
"group": "PostMethods",
|
|
18
|
+
"description": "Generate Insert POST action",
|
|
19
|
+
"endPointsJs": {
|
|
20
|
+
"importLine": "import { postFunc } from './Insert/controller.js';",
|
|
21
|
+
"usageLine": "router.post('/Insert', express.json(), (req, res) => postFunc({ req, res, inTableName : tableName}));"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"cmd": "Distinct",
|
|
26
|
+
"file": "distinct",
|
|
27
|
+
"exportFile": "Distinct",
|
|
28
|
+
"group": "GetMethods",
|
|
29
|
+
"description": "Generate Distinct GET action",
|
|
30
|
+
"endPointsJs": {
|
|
31
|
+
"importLine": "import distinctFunc from './Distinct/controller.js';",
|
|
32
|
+
"usageLine": "router.get('/Distinct/:columnName', (req, res) => distinctFunc({ req, res, inTableName : tableName}));"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"cmd": "ShowAll",
|
|
4
|
+
"file": "showAll",
|
|
5
|
+
"exportFile": "ShowAll",
|
|
6
|
+
"group": "GetMethods",
|
|
7
|
+
"description": "Generate ShowAll GET action"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"cmd": "Insert",
|
|
11
|
+
"file": "insert",
|
|
12
|
+
"exportFile": "Insert",
|
|
13
|
+
"group": "PostMethods",
|
|
14
|
+
"description": "Generate Insert POST action"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"cmd": "Distinct",
|
|
18
|
+
"file": "distinct",
|
|
19
|
+
"exportFile": "Distinct",
|
|
20
|
+
"group": "GetMethods",
|
|
21
|
+
"description": "Generate Distinct GET action"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
KSchema CLI – Execution Flow
|
|
3
|
+
|
|
4
|
+
1. Parse terminal input
|
|
5
|
+
2. Show usage if command/help missing
|
|
6
|
+
3. Resolve command dynamically
|
|
7
|
+
4. Load command dynamically
|
|
8
|
+
5. Execute action
|
|
9
|
+
|
|
10
|
+
Architecture Goals:
|
|
11
|
+
- JSON driven command system
|
|
12
|
+
- Zero hardcoded command maps
|
|
13
|
+
- Single source of truth
|
|
14
|
+
- Easy scalability
|
|
15
|
+
- Beginner friendly structure
|
|
16
|
+
*/
|
|
17
|
+
import actions from "../config/actions.json" with { type: "json" };
|
|
18
|
+
|
|
19
|
+
export default function showUsage(version) {
|
|
20
|
+
const g = "\x1b[32m";
|
|
21
|
+
const y = "\x1b[33m";
|
|
22
|
+
const c = "\x1b[36m";
|
|
23
|
+
const gray = "\x1b[90m";
|
|
24
|
+
const r = "\x1b[0m";
|
|
25
|
+
|
|
26
|
+
const commandsText = actions.map((item) => {
|
|
27
|
+
return ` ${g}${item.exportFile}${r} ${item.description}`;
|
|
28
|
+
}).join("\n");
|
|
29
|
+
|
|
30
|
+
const examplesText = actions.map((item) => {
|
|
31
|
+
return ` ${gray}npx @keshavsoft/kschema-api-gen-actions ${item.exportFile}${r}`;
|
|
32
|
+
}).join("\n");
|
|
33
|
+
|
|
34
|
+
console.log(`
|
|
35
|
+
${c}🚀 KSchema Api Generator v${version}${r}
|
|
36
|
+
|
|
37
|
+
${y}Usage:${r}
|
|
38
|
+
${g}npx @keshavsoft/kschema-api-gen-actions${r} <command> [options]
|
|
39
|
+
|
|
40
|
+
${y}Commands:${r}
|
|
41
|
+
${commandsText}
|
|
42
|
+
|
|
43
|
+
${y}Examples:${r}
|
|
44
|
+
${examplesText}
|
|
45
|
+
|
|
46
|
+
${y}Tip:${r}
|
|
47
|
+
${gray}npm i -g @keshavsoft/kschema-api-gen-actions${r}
|
|
48
|
+
`);
|
|
49
|
+
}
|
package/bin/{v13 → v16}/start.js
RENAMED
|
@@ -12,7 +12,7 @@ const run = async () => {
|
|
|
12
12
|
|
|
13
13
|
if (input.cmd === "--help" || input.cmd === "-h" || input.cmd === "help") return showUsage(version);
|
|
14
14
|
|
|
15
|
-
const command = resolveCommand(input.cmd);
|
|
15
|
+
const command = await resolveCommand(input.cmd);
|
|
16
16
|
|
|
17
17
|
if (!command) return (console.log(`Unknown command: ${input.cmd}\n`), showUsage(version));
|
|
18
18
|
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { fromJsonPath } from './service.js';
|
|
2
2
|
import { ConflictError, StorageError } from './errors.js';
|
|
3
3
|
|
|
4
|
-
const getFunc = ({ res, inTableName }) => {
|
|
4
|
+
const getFunc = ({ req, res, inTableName }) => {
|
|
5
5
|
try {
|
|
6
|
-
const
|
|
6
|
+
const columnName = req.params.columnName;
|
|
7
|
+
|
|
8
|
+
const message = fromJsonPath({
|
|
9
|
+
inTableName,
|
|
10
|
+
inColumnName: columnName
|
|
11
|
+
});
|
|
7
12
|
|
|
8
13
|
res.type("application/json").send(message);
|
|
9
14
|
} catch (err) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { kschema } from "@keshavsoft/kschema";
|
|
2
|
+
|
|
3
|
+
const fromJsonPath = ({ inTableName, inColumnName }) => {
|
|
4
|
+
const tableName = inTableName;
|
|
5
|
+
|
|
6
|
+
const array = kschema.table(tableName).query.aggregate.distinct(inColumnName);
|
|
7
|
+
const collection = array.map(str => ({ [inColumnName]: str }));
|
|
8
|
+
|
|
9
|
+
return collection;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { fromJsonPath };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { fromJsonPath } from './service.js';
|
|
2
|
+
import { ConflictError, StorageError } from './errors.js';
|
|
3
|
+
|
|
4
|
+
const distinctFunc = ({ req, res, inTableName }) => {
|
|
5
|
+
try {
|
|
6
|
+
const columnName = req.params.columnName;
|
|
7
|
+
|
|
8
|
+
const message = fromJsonPath({
|
|
9
|
+
inTableName,
|
|
10
|
+
inColumnName: columnName
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
res.type("application/json").send(message);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
if (err instanceof ConflictError)
|
|
16
|
+
return res.status(409).send(err.message);
|
|
17
|
+
|
|
18
|
+
if (err instanceof StorageError)
|
|
19
|
+
return res.status(500).send("Failed to persist data");
|
|
20
|
+
|
|
21
|
+
console.error(err);
|
|
22
|
+
res.status(500).send("Unexpected error");
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default distinctFunc;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { kschema } from "@keshavsoft/kschema";
|
|
2
|
+
|
|
3
|
+
const fromJsonPath = ({ inTableName, inColumnName }) => {
|
|
4
|
+
const tableName = inTableName;
|
|
5
|
+
|
|
6
|
+
const array = kschema.table(tableName).query.aggregate.distinct(inColumnName);
|
|
7
|
+
const collection = array.map(str => ({ [inColumnName]: str }));
|
|
8
|
+
|
|
9
|
+
return collection;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { fromJsonPath };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import readFile from "../common/readFile.js";
|
|
2
|
+
import buildImport from "./buildImport.js";
|
|
3
|
+
import checkDuplicate from "./checkDuplicate.js";
|
|
4
|
+
import findInsertIndex from "./findInsertIndex.js";
|
|
5
|
+
import writeFile from "../common/writeFile.js";
|
|
6
|
+
|
|
7
|
+
const updateImports = ({ appJsPath, endpoint, showLog, inFuncName }) => {
|
|
8
|
+
const summary = {
|
|
9
|
+
import: { added: false, line: null },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const content = readFile(appJsPath);
|
|
13
|
+
|
|
14
|
+
const importLine = buildImport({
|
|
15
|
+
inEndpoint: endpoint,
|
|
16
|
+
inFuncName
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (checkDuplicate(content, endpoint)) {
|
|
20
|
+
summary.import.skipped = true;
|
|
21
|
+
|
|
22
|
+
if (showLog) console.log(summary);
|
|
23
|
+
|
|
24
|
+
return summary;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const index = findInsertIndex(content);
|
|
28
|
+
|
|
29
|
+
const before = content.slice(0, index);
|
|
30
|
+
const lineNumber = before.split("\n").length + 1;
|
|
31
|
+
|
|
32
|
+
const updated =
|
|
33
|
+
before + "\n" + importLine + content.slice(index);
|
|
34
|
+
|
|
35
|
+
writeFile(appJsPath, updated);
|
|
36
|
+
|
|
37
|
+
summary.import.added = true;
|
|
38
|
+
summary.import.line = lineNumber;
|
|
39
|
+
|
|
40
|
+
if (showLog) console.log(summary);
|
|
41
|
+
|
|
42
|
+
return summary;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default updateImports;
|
package/bin/v16/tasks/actions/GetMethods/ShowAll/steps/UpdateRoutesJs/updateUse/buildUseLine.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const appOrRouter = "router";
|
|
2
|
+
|
|
3
|
+
const buildUseLine = ({ inEndpoint, inFuncName }) => {
|
|
4
|
+
return `${appOrRouter}.get('/${inEndpoint}', (req, res) => ${inFuncName}({ res, inTableName : tableName}));`;
|
|
5
|
+
|
|
6
|
+
// return `${appOrRouter}.use("/${inEndpoint}", ${inFuncName});`;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default buildUseLine;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import readFile from "../common/readFile.js";
|
|
2
|
+
import writeFile from "../common/writeFile.js";
|
|
3
|
+
|
|
4
|
+
import buildUseLine from "./buildUseLine.js";
|
|
5
|
+
import checkDuplicate from "./checkDuplicate.js";
|
|
6
|
+
import findUseInsertIndex from "./findInsertIndex.js";
|
|
7
|
+
|
|
8
|
+
const updateAppUse = ({ appJsPath, endpoint, showLog, inFuncName }) => {
|
|
9
|
+
const summary = {
|
|
10
|
+
use: { added: false, skipped: false, line: null }
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const content = readFile(appJsPath);
|
|
14
|
+
|
|
15
|
+
const useLine = buildUseLine({
|
|
16
|
+
inEndpoint: endpoint,
|
|
17
|
+
inFuncName
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (checkDuplicate(content, endpoint)) {
|
|
21
|
+
summary.use.skipped = true;
|
|
22
|
+
|
|
23
|
+
if (showLog) console.log(summary);
|
|
24
|
+
|
|
25
|
+
return summary;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const index = findUseInsertIndex(content);
|
|
29
|
+
|
|
30
|
+
const before = content.slice(0, index);
|
|
31
|
+
const lineNumber = before.split("\n").length + 1;
|
|
32
|
+
|
|
33
|
+
const updated =
|
|
34
|
+
before + "\n" + useLine + content.slice(index);
|
|
35
|
+
|
|
36
|
+
writeFile(appJsPath, updated);
|
|
37
|
+
|
|
38
|
+
summary.use.added = true;
|
|
39
|
+
summary.use.line = lineNumber;
|
|
40
|
+
|
|
41
|
+
if (showLog) console.log(summary);
|
|
42
|
+
|
|
43
|
+
return summary;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default updateAppUse;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name }) {
|
|
4
|
+
const defaultFolerName = "ShowAll";
|
|
5
|
+
|
|
6
|
+
// case 1: force new → timestamp
|
|
7
|
+
if (name === null) {
|
|
8
|
+
name = defaultFolerName;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// case 2: user provided → strict
|
|
12
|
+
if (fs.existsSync(name)) {
|
|
13
|
+
return {
|
|
14
|
+
KTF: false,
|
|
15
|
+
KReason: `Folder already exists : ${name}`
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return name;
|
|
20
|
+
};
|
package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateImports/buildImport.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const buildImport = ({ inFuncName, inEndpoint }) => {
|
|
2
|
+
const localEndpoint = inEndpoint;
|
|
3
|
+
|
|
4
|
+
const safeName = localEndpoint.replace(/[^a-zA-Z0-9]/g, "_");
|
|
5
|
+
|
|
6
|
+
return `import { ${inFuncName} } from "./${localEndpoint}/controller.js";`;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default buildImport;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const findInsertIndex = (inContent) => {
|
|
2
|
+
const localContent = inContent;
|
|
3
|
+
|
|
4
|
+
const matches = [...localContent.matchAll(/^\s*import.*$/gm)];
|
|
5
|
+
const last = matches.at(-1);
|
|
6
|
+
|
|
7
|
+
return last ? last.index + last[0].length : 0;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default findInsertIndex;
|
package/bin/v16/tasks/actions/PostMethods/Insert/steps/UpdateRoutesJs/updateUse/findInsertIndex.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const findUseInsertIndex = (inContent) => {
|
|
2
|
+
const localContent = inContent;
|
|
3
|
+
|
|
4
|
+
const matches = [...localContent.matchAll(/const\s+router\s*=\s*express\.Router\(\)/g)];
|
|
5
|
+
const match = matches.at(0);
|
|
6
|
+
|
|
7
|
+
return match ? match.index + match[0].length : localContent.length;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default findUseInsertIndex;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const announce = ({ inResolvedFolderName }) => {
|
|
2
|
+
console.log(`[keshavsoft] Folder created: ${inResolvedFolderName}`);
|
|
3
|
+
|
|
4
|
+
console.log("");
|
|
5
|
+
console.log("Next:");
|
|
6
|
+
console.log("");
|
|
7
|
+
console.log(`cd ${inResolvedFolderName}`);
|
|
8
|
+
console.log(`npx kschema-api-gen AddSubRoute`);
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
const createHttpFile = ({ inTargetPath, toPath }) => {
|
|
5
|
+
const relative = inTargetPath.replace(toPath, "").replace(/\\/g, "/");
|
|
6
|
+
|
|
7
|
+
const content = `GET http://localhost:3000${relative}`;
|
|
8
|
+
|
|
9
|
+
fs.writeFileSync(path.join(inTargetPath, "rest.http"), content);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default createHttpFile;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
|
|
7
|
+
export const locateSource = () => {
|
|
8
|
+
return path.join(
|
|
9
|
+
__dirname,
|
|
10
|
+
"..",
|
|
11
|
+
"template"
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import updateImports from "./UpdateRoutesJs/updateImports/index.js";
|
|
2
|
+
import updateAppUse from "./UpdateRoutesJs/updateUse/index.js";
|
|
3
|
+
|
|
4
|
+
export default ({ appJsPath, endpoint }) => {
|
|
5
|
+
updateImports({ appJsPath, endpoint });
|
|
6
|
+
updateAppUse({ appJsPath, endpoint });
|
|
7
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
function updateEndPointsFile({ filePath, inTableName }) {
|
|
4
|
+
try {
|
|
5
|
+
let content = readFile(filePath);
|
|
6
|
+
|
|
7
|
+
content = content.replace("<TABLE_NAME>", inTableName);
|
|
8
|
+
|
|
9
|
+
writeFile(filePath, content);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
handleError(e);
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// read
|
|
16
|
+
function readFile(filePath) {
|
|
17
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// write
|
|
21
|
+
function writeFile(filePath, content) {
|
|
22
|
+
fs.writeFileSync(filePath, content);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// error handler
|
|
26
|
+
function handleError(e) {
|
|
27
|
+
console.error("ROUTE USE ERROR:", e.message);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { updateEndPointsFile };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import updateImports from "./UpdateRoutesJs/updateImports/index.js";
|
|
2
|
+
import updateAppUse from "./UpdateRoutesJs/updateUse/index.js";
|
|
3
|
+
|
|
4
|
+
const funcName = "getFunc";
|
|
5
|
+
|
|
6
|
+
export default ({ appJsPath, endpoint }) => {
|
|
7
|
+
updateImports({
|
|
8
|
+
appJsPath, endpoint,
|
|
9
|
+
inFuncName: funcName
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
updateAppUse({
|
|
13
|
+
appJsPath, endpoint,
|
|
14
|
+
inFuncName: funcName
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class AppError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = this.constructor.name;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
class ConflictError extends AppError { }
|
|
9
|
+
class StorageError extends AppError { }
|
|
10
|
+
|
|
11
|
+
export { AppError, ConflictError, StorageError };
|