kschema-fs-api-gen-post-actions 1.10.4 → 1.11.3
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/bin/v11/tasks/actions/InsertGenPk/steps/createActionFolder.js +31 -0
- package/bin/v11/tasks/actions/InsertGenPk/steps/generateRestIfRequested.js +44 -0
- package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/resolveFolderName.js +1 -1
- package/bin/v11/tasks/actions/InsertGenPk/steps/showLog.js +9 -0
- package/bin/v11/tasks/actions/InsertGenPk/steps/updateEndPointsJs.js +34 -0
- package/bin/v11/tasks/actions/InsertGenPk/template/v1/insertGenPk.js +31 -0
- package/bin/v11/tasks/actions/InsertGenPk/template/v1/rest.http +8 -0
- package/bin/v11/tasks/actions/InsertGenPk/template/v1/service.js +9 -0
- package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk-/template/v2}/insertGenPk.js +2 -2
- package/bin/v11/tasks/actions/InsertGenPk-/template/v2/rest.http +8 -0
- package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk-/template/v2}/service.js +1 -8
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/common/readFile.js +8 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/common/writeFile.js +10 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateImports/buildImport.js +9 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +8 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +10 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateImports/index.js +47 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateUse/buildUseLine.js +5 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +9 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +10 -0
- package/bin/v11/tasks/actions/WithMail/steps/UpdateRoutesJs/updateUse/index.js +56 -0
- package/bin/v11/tasks/actions/WithMail/steps/announce.js +9 -0
- package/bin/v11/tasks/actions/WithMail/steps/createActionFolder.js +31 -0
- package/bin/v11/tasks/actions/WithMail/steps/createFolder.js +7 -0
- package/bin/v11/tasks/actions/WithMail/steps/decideTemplate.js +3 -0
- package/bin/v11/tasks/actions/WithMail/steps/generateRestIfRequested.js +43 -0
- package/bin/v11/tasks/actions/WithMail/steps/locateDestination.js +7 -0
- package/bin/v11/tasks/actions/WithMail/steps/locateSource.js +18 -0
- package/bin/v11/tasks/actions/WithMail/steps/resolveFolderName.js +20 -0
- package/bin/v11/tasks/actions/WithMail/steps/showLog.js +9 -0
- package/bin/v11/tasks/actions/WithMail/steps/updateAppJs.js +7 -0
- package/bin/v11/tasks/actions/WithMail/steps/updateEndPointsFile.js +30 -0
- package/bin/v11/tasks/actions/WithMail/steps/updateEndPointsJs.js +34 -0
- package/bin/v11/tasks/actions/WithMail/template/v1/config/getSchema.js +20 -0
- package/bin/v11/tasks/actions/WithMail/template/v1/controller.js +27 -0
- package/bin/v11/tasks/actions/WithMail/template/v1/getData.js +11 -0
- package/bin/v11/tasks/actions/WithMail/template/v1/getSchema.js +11 -0
- package/bin/v11/tasks/actions/WithMail/template/v1/helpers/pkHelper.js +19 -0
- package/bin/v11/tasks/actions/WithMail/template/v1/insertBase.js +9 -0
- package/bin/v11/tasks/actions/insertGenPk.js +85 -0
- package/bin/v11/tasks/actions/withMail.js +81 -0
- package/index.js +15 -12
- package/package.json +1 -1
- package/bin/v9/tasks/actions/WithMail/actions.json +0 -26
- package/bin/v9/tasks/actions/WithMail/steps/createHttpFile.js +0 -12
- package/bin/v9/tasks/actions/WithMail/steps/updateEndPointsJs.js +0 -16
- package/bin/v9/tasks/actions/WithMail/template/v1/controller.js +0 -28
- package/bin/v9/tasks/actions/WithMail/template/v1/service.js +0 -44
- package/bin/v9/tasks/actions/WithMail/template/v2/controller.js +0 -24
- package/bin/v9/tasks/actions/WithMail/template/v2/middleware.js +0 -19
- package/bin/v9/tasks/actions/WithMail/template/v2/rest.http +0 -7
- package/bin/v9/tasks/actions/WithMail/template/v2/service.js +0 -18
- package/bin/v9/tasks/actions/WithMail/template/v3/Mail/sendMailCC.js +0 -45
- package/bin/v9/tasks/actions/WithMail/template/v3/Mail/welcome.html +0 -213
- package/bin/v9/tasks/actions/WithMail/template/v3/middleware.js +0 -19
- package/bin/v9/tasks/actions/WithMail/template/v3/rest.http +0 -7
- package/bin/v9/tasks/actions/WithMail/template/v4/Mail/sendMailCC.js +0 -45
- package/bin/v9/tasks/actions/WithMail/template/v4/Mail/welcome.html +0 -213
- package/bin/v9/tasks/actions/WithMail/template/v4/errors.js +0 -11
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/buildMutate.js +0 -32
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/buildQuery.js +0 -32
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/file/read.js +0 -7
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/file/write.js +0 -5
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validate.js +0 -27
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validateHelper.js +0 -27
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/default.js +0 -5
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/enum.js +0 -7
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/length.js +0 -11
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/minMax.js +0 -11
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/pattern.js +0 -8
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/required.js +0 -5
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/type.js +0 -15
- package/bin/v9/tasks/actions/WithMail/template/v4/helpers-/validators/unique.js +0 -8
- package/bin/v9/tasks/actions/WithMail/template/v4/middleware.js +0 -19
- package/bin/v9/tasks/actions/withMail.js +0 -60
- /package/bin/{v9 → v11}/core/createFolder.js +0 -0
- /package/bin/{v9 → v11}/core/parseInput.js +0 -0
- /package/bin/{v9 → v11}/core/resolveCommand.js +0 -0
- /package/bin/{v9 → v11}/core/showUsage.js +0 -0
- /package/bin/{v9 → v11}/start.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/actions.json +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/announce.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/createFolder.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/decideTemplate.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/locateDestination.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/locateSource.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/resolveFolderName.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/updateAppJs.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/config/getSchema.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/controller.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/errors.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/getData.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/getSchema.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/buildMutate.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/buildQuery.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/file/read.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/file/write.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/pkHelper.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validate.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validateHelper.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/default.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/enum.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/length.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/minMax.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/pattern.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/required.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/type.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/helpers/validators/unique.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/insertBase.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/insertGenPk.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/middleware.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/rest.http +0 -0
- /package/bin/{v9 → v11}/tasks/actions/InsertAsIs/template/v1/service.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/announce.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/createFolder.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/decideTemplate.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/locateDestination.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/locateSource.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/updateAppJs.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk/template/v1}/config/getSchema.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk/template/v1}/controller.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v2 → v11/tasks/actions/InsertGenPk/template/v1}/errors.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk/template/v1/helpers}/getData.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk/template/v1/helpers}/getSchema.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4/helpers- → v11/tasks/actions/InsertGenPk/template/v1/helpers}/pkHelper.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/InsertGenPk/template/v1}/insertBase.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/actions.json +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/common/readFile.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/common/writeFile.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateImports/index.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/UpdateRoutesJs/updateUse/index.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/announce.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/createFolder.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/decideTemplate.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/locateDestination.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/locateSource.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/resolveFolderName.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/updateAppJs.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/steps/updateEndPointsFile.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/config/getSchema.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/controller.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/errors.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/getData.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/getSchema.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/buildMutate.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/buildQuery.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/file/read.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/file/write.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/pkHelper.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validate.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validateHelper.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/default.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/enum.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/length.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/minMax.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/pattern.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/required.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/type.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/helpers/validators/unique.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/insertBase.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/insertGenPk.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/middleware.js +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/rest.http +0 -0
- /package/bin/{v9/tasks/actions/InsertGenPk → v11/tasks/actions/InsertGenPk-}/template/v1/service.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/InsertGenPk-/template/v2}/config/getSchema.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/InsertGenPk-/template/v2}/controller.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v1 → v11/tasks/actions/InsertGenPk-/template/v2}/errors.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/InsertGenPk-/template/v2/helpers}/getData.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/InsertGenPk-/template/v2/helpers}/getSchema.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/InsertGenPk-/template/v2}/helpers/pkHelper.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/InsertGenPk-/template/v2}/insertBase.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v2 → v11/tasks/actions/WithMail/template/v1}/Mail/sendMailCC.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v2 → v11/tasks/actions/WithMail/template/v1}/Mail/welcome.html +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/WithMail/template/v1}/errors.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/buildMutate.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/buildQuery.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/file/read.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/file/write.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/pkHelper.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validate.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validateHelper.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/default.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/enum.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/length.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/minMax.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/pattern.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/required.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/type.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3/helpers → v11/tasks/actions/WithMail/template/v1/helpers-}/validators/unique.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/WithMail/template/v1}/insertGenPk.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/WithMail/template/v1/middleware.js +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v4 → v11/tasks/actions/WithMail/template/v1}/rest.http +0 -0
- /package/bin/{v9/tasks/actions/WithMail/template/v3 → v11/tasks/actions/WithMail/template/v1}/service.js +0 -0
- /package/bin/{v9 → v11}/tasks/actions/insertAsIs.js +0 -0
- /package/bin/{v9/tasks/actions/insertGenPk.js → v11/tasks/actions/insertGenPk copy.js} +0 -0
- /package/bin/{v9 → v11}/tasks/core/createFolder.js +0 -0
- /package/bin/{v9 → v11}/tasks/core/parseInput.js +0 -0
- /package/bin/{v9 → v11}/tasks/core/resolveCommand.js +0 -0
- /package/bin/{v9 → v11}/tasks/core/showUsage.js +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createFolder } from "../../../../core/createFolder.js";
|
|
2
|
+
import { showLog } from "./showLog.js";
|
|
3
|
+
|
|
4
|
+
export const createActionFolder = ({
|
|
5
|
+
source,
|
|
6
|
+
destination,
|
|
7
|
+
isAnnounce,
|
|
8
|
+
checkBeforeCreate,
|
|
9
|
+
showLog: isShowLog
|
|
10
|
+
}) => {
|
|
11
|
+
showLog({
|
|
12
|
+
enabled: isShowLog,
|
|
13
|
+
message: "Copying WithMail template.",
|
|
14
|
+
data: { source, destination }
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const response = createFolder({
|
|
18
|
+
source,
|
|
19
|
+
destination,
|
|
20
|
+
isAnnounce,
|
|
21
|
+
checkBeforeCreate
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
showLog({
|
|
25
|
+
enabled: isShowLog,
|
|
26
|
+
message: response.KTF ? "Template copy completed." : "Template copy skipped.",
|
|
27
|
+
data: response
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return response;
|
|
31
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import generateRest from "kschema-fs-api-gen-rest";
|
|
3
|
+
import { showLog } from "./showLog.js";
|
|
4
|
+
|
|
5
|
+
export const generateRestIfRequested = ({
|
|
6
|
+
inGenerateRest,
|
|
7
|
+
toConfigPath,
|
|
8
|
+
inTargetPath,
|
|
9
|
+
toPath,
|
|
10
|
+
resolvedFolderName,
|
|
11
|
+
isShowLog, inPort
|
|
12
|
+
}) => {
|
|
13
|
+
if (!inGenerateRest) {
|
|
14
|
+
showLog({
|
|
15
|
+
enabled: isShowLog,
|
|
16
|
+
message: "REST generation not requested."
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const restTargetPath = path.join(toPath, resolvedFolderName);
|
|
23
|
+
|
|
24
|
+
showLog({
|
|
25
|
+
enabled: isShowLog,
|
|
26
|
+
message: "Generating REST files.",
|
|
27
|
+
data: { toConfigPath, inTargetPath, toPath: restTargetPath }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const response = generateRest({
|
|
31
|
+
toConfigPath,
|
|
32
|
+
inTargetPath,
|
|
33
|
+
toPath: restTargetPath,
|
|
34
|
+
inPort
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
showLog({
|
|
38
|
+
enabled: isShowLog,
|
|
39
|
+
message: "REST generation completed.",
|
|
40
|
+
data: response
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return response;
|
|
44
|
+
};
|
package/bin/{v9/tasks/actions/WithMail → v11/tasks/actions/InsertGenPk}/steps/resolveFolderName.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
|
|
3
|
-
export default function resolveFolderName({ name, inDefaultFolderName = "
|
|
3
|
+
export default function resolveFolderName({ name, inDefaultFolderName = "InsertGenPk" }) {
|
|
4
4
|
const defaultFolderName = inDefaultFolderName;
|
|
5
5
|
|
|
6
6
|
// case 1: force new → timestamp
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fixEndpointsJs from "express-fix-endpoints-post-js";
|
|
3
|
+
import { showLog } from "./showLog.js";
|
|
4
|
+
|
|
5
|
+
export const updateEndPointsJs = async ({
|
|
6
|
+
toPath,
|
|
7
|
+
cmd,
|
|
8
|
+
inFolderName,
|
|
9
|
+
showLog: isShowLog
|
|
10
|
+
}) => {
|
|
11
|
+
const endPointsJsPath = path.join(toPath, "end-points.js");
|
|
12
|
+
|
|
13
|
+
showLog({
|
|
14
|
+
enabled: isShowLog,
|
|
15
|
+
message: "Updating end-points.js for body parsing.",
|
|
16
|
+
data: { endPointsJsPath, cmd, inFolderName }
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const response = await fixEndpointsJs({
|
|
20
|
+
endPointsJsPath,
|
|
21
|
+
showLog: isShowLog,
|
|
22
|
+
inActionName: cmd,
|
|
23
|
+
inFolderName,
|
|
24
|
+
inGetType: "bodyParse"
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
showLog({
|
|
28
|
+
enabled: isShowLog,
|
|
29
|
+
message: "end-points.js update completed.",
|
|
30
|
+
data: response
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return response;
|
|
34
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import insertBase from "./insertBase.js";
|
|
2
|
+
import getData from "./helpers/getData.js";
|
|
3
|
+
import getSchema from "./helpers/getSchema.js";
|
|
4
|
+
import { getPrimaryKey, attachPrimaryKey } from "./helpers/pkHelper.js";
|
|
5
|
+
|
|
6
|
+
const validateInput = ({ record }) => {
|
|
7
|
+
if (!record || typeof record !== "object") throw new Error("record must be object");
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const insertGenPk = async ({ inRequestBody, inTablePath, inConfigPath }) => {
|
|
11
|
+
validateInput({ record: inRequestBody });
|
|
12
|
+
|
|
13
|
+
const schema = await getSchema({ inConfigPath });
|
|
14
|
+
const pk = getPrimaryKey(schema.columnsConfig);
|
|
15
|
+
|
|
16
|
+
if (inRequestBody[pk] !== undefined) {
|
|
17
|
+
return insertBase({ inRequestBody, inTablePath });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const data = await getData({ inTablePath });
|
|
21
|
+
const newRecord = attachPrimaryKey(inRequestBody, pk, data);
|
|
22
|
+
|
|
23
|
+
await insertBase({
|
|
24
|
+
inRequestBody: newRecord,
|
|
25
|
+
inTablePath
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return newRecord[pk];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default insertGenPk;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import insertBase from "./insertBase.js";
|
|
2
|
-
import getData from "./getData.js";
|
|
3
|
-
import getSchema from "./getSchema.js";
|
|
2
|
+
import getData from "./helpers/getData.js";
|
|
3
|
+
import getSchema from "./helpers/getSchema.js";
|
|
4
4
|
import { getPrimaryKey, attachPrimaryKey } from "./helpers/pkHelper.js";
|
|
5
5
|
|
|
6
6
|
const validateInput = ({ record }) => {
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import insertGenPk from "./insertGenPk.js";
|
|
2
|
-
import sendMail from "./Mail/sendMailCC.js";
|
|
3
2
|
|
|
4
3
|
const startFunc = async ({ inRequestBody, inTablePath, inConfigPath }) => {
|
|
5
4
|
const insertedPk = await insertGenPk({ inRequestBody, inTablePath, inConfigPath });
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return await {
|
|
10
|
-
insertedPk,
|
|
11
|
-
isMailSent: info.accepted.length > 0 &&
|
|
12
|
-
info.rejected.length === 0
|
|
13
|
-
};
|
|
6
|
+
return insertedPk;
|
|
14
7
|
};
|
|
15
8
|
|
|
16
9
|
export { startFunc };
|
|
@@ -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;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
const fromCheckDuplicate = checkDuplicate({ inContent: content, inFuncName });
|
|
20
|
+
|
|
21
|
+
if (fromCheckDuplicate) {
|
|
22
|
+
summary.import.skipped = true;
|
|
23
|
+
|
|
24
|
+
if (showLog) console.log(summary);
|
|
25
|
+
|
|
26
|
+
return summary;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const index = findInsertIndex(content);
|
|
30
|
+
|
|
31
|
+
const before = content.slice(0, index);
|
|
32
|
+
const lineNumber = before.split("\n").length + 1;
|
|
33
|
+
|
|
34
|
+
const updated =
|
|
35
|
+
before + "\n" + importLine + content.slice(index);
|
|
36
|
+
|
|
37
|
+
writeFile(appJsPath, updated);
|
|
38
|
+
|
|
39
|
+
summary.import.added = true;
|
|
40
|
+
summary.import.line = lineNumber;
|
|
41
|
+
|
|
42
|
+
if (showLog) console.log(summary);
|
|
43
|
+
|
|
44
|
+
return summary;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default updateImports;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const checkDuplicate = ({ inContent, inEndpoint, inAppOrRouter }) => {
|
|
2
|
+
const localContent = inContent;
|
|
3
|
+
const localEndpoint = inEndpoint;
|
|
4
|
+
const stringToSearch = `${inAppOrRouter}.get('/${localEndpoint}'`;
|
|
5
|
+
|
|
6
|
+
return localContent.includes(stringToSearch);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default checkDuplicate;
|
|
@@ -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,56 @@
|
|
|
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 appOrRouter = "router";
|
|
9
|
+
|
|
10
|
+
const updateAppUse = ({ appJsPath, endpoint, showLog, inFuncName }) => {
|
|
11
|
+
const summary = {
|
|
12
|
+
use: { added: false, skipped: false, line: null }
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const content = readFile(appJsPath);
|
|
16
|
+
|
|
17
|
+
const useLine = buildUseLine({
|
|
18
|
+
inAppOrRouter: appOrRouter,
|
|
19
|
+
inEndpoint: endpoint,
|
|
20
|
+
inFuncName
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const fromCheckDuplicate = checkDuplicate({
|
|
24
|
+
inContent: content,
|
|
25
|
+
inEndpoint: endpoint,
|
|
26
|
+
inAppOrRouter: appOrRouter
|
|
27
|
+
});
|
|
28
|
+
console.log("fromCheckDuplicate : ", fromCheckDuplicate);
|
|
29
|
+
|
|
30
|
+
if (fromCheckDuplicate) {
|
|
31
|
+
summary.use.skipped = true;
|
|
32
|
+
|
|
33
|
+
if (showLog) console.log(summary);
|
|
34
|
+
|
|
35
|
+
return summary;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const index = findUseInsertIndex(content);
|
|
39
|
+
|
|
40
|
+
const before = content.slice(0, index);
|
|
41
|
+
const lineNumber = before.split("\n").length + 1;
|
|
42
|
+
|
|
43
|
+
const updated =
|
|
44
|
+
before + "\n" + useLine + content.slice(index);
|
|
45
|
+
|
|
46
|
+
writeFile(appJsPath, updated);
|
|
47
|
+
|
|
48
|
+
summary.use.added = true;
|
|
49
|
+
summary.use.line = lineNumber;
|
|
50
|
+
|
|
51
|
+
if (showLog) console.log(summary);
|
|
52
|
+
|
|
53
|
+
return summary;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default updateAppUse;
|
|
@@ -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,31 @@
|
|
|
1
|
+
import { createFolder } from "../../../../core/createFolder.js";
|
|
2
|
+
import { showLog } from "./showLog.js";
|
|
3
|
+
|
|
4
|
+
export const createActionFolder = ({
|
|
5
|
+
source,
|
|
6
|
+
destination,
|
|
7
|
+
isAnnounce,
|
|
8
|
+
checkBeforeCreate,
|
|
9
|
+
showLog: isShowLog
|
|
10
|
+
}) => {
|
|
11
|
+
showLog({
|
|
12
|
+
enabled: isShowLog,
|
|
13
|
+
message: "Copying WithMail template.",
|
|
14
|
+
data: { source, destination }
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const response = createFolder({
|
|
18
|
+
source,
|
|
19
|
+
destination,
|
|
20
|
+
isAnnounce,
|
|
21
|
+
checkBeforeCreate
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
showLog({
|
|
25
|
+
enabled: isShowLog,
|
|
26
|
+
message: response.KTF ? "Template copy completed." : "Template copy skipped.",
|
|
27
|
+
data: response
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return response;
|
|
31
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import generateRest from "kschema-fs-api-gen-rest";
|
|
3
|
+
import { showLog } from "./showLog.js";
|
|
4
|
+
|
|
5
|
+
export const generateRestIfRequested = ({
|
|
6
|
+
inGenerateRest,
|
|
7
|
+
toConfigPath,
|
|
8
|
+
inTargetPath,
|
|
9
|
+
toPath,
|
|
10
|
+
resolvedFolderName,
|
|
11
|
+
isShowLog
|
|
12
|
+
}) => {
|
|
13
|
+
if (!inGenerateRest) {
|
|
14
|
+
showLog({
|
|
15
|
+
enabled: isShowLog,
|
|
16
|
+
message: "REST generation not requested."
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const restTargetPath = path.join(toPath, resolvedFolderName);
|
|
23
|
+
|
|
24
|
+
showLog({
|
|
25
|
+
enabled: isShowLog,
|
|
26
|
+
message: "Generating REST files.",
|
|
27
|
+
data: { toConfigPath, inTargetPath, toPath: restTargetPath }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const response = generateRest({
|
|
31
|
+
toConfigPath,
|
|
32
|
+
inTargetPath,
|
|
33
|
+
toPath: restTargetPath
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
showLog({
|
|
37
|
+
enabled: isShowLog,
|
|
38
|
+
message: "REST generation completed.",
|
|
39
|
+
data: response
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return response;
|
|
43
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
export const locateSource = () => {
|
|
9
|
+
const templatePath = path.join(__dirname, "..", "template");
|
|
10
|
+
|
|
11
|
+
const versions = fs.readdirSync(templatePath);
|
|
12
|
+
|
|
13
|
+
const maxVersion = Math.max(
|
|
14
|
+
...versions.map(v => Number(v.replace("v", "")))
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return path.join(templatePath, `v${maxVersion}`);
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name, inDefaultFolderName = "InsertGenPk" }) {
|
|
4
|
+
const defaultFolderName = inDefaultFolderName;
|
|
5
|
+
|
|
6
|
+
// case 1: force new → timestamp
|
|
7
|
+
if (name === null) {
|
|
8
|
+
name = defaultFolderName;
|
|
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
|
+
};
|
|
@@ -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,34 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fixEndpointsJs from "express-fix-endpoints-post-js";
|
|
3
|
+
import { showLog } from "./showLog.js";
|
|
4
|
+
|
|
5
|
+
export const updateEndPointsJs = async ({
|
|
6
|
+
toPath,
|
|
7
|
+
cmd,
|
|
8
|
+
inFolderName,
|
|
9
|
+
showLog: isShowLog
|
|
10
|
+
}) => {
|
|
11
|
+
const endPointsJsPath = path.join(toPath, "end-points.js");
|
|
12
|
+
|
|
13
|
+
showLog({
|
|
14
|
+
enabled: isShowLog,
|
|
15
|
+
message: "Updating end-points.js for body parsing.",
|
|
16
|
+
data: { endPointsJsPath, cmd, inFolderName }
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const response = await fixEndpointsJs({
|
|
20
|
+
endPointsJsPath,
|
|
21
|
+
showLog: isShowLog,
|
|
22
|
+
inActionName: cmd,
|
|
23
|
+
inFolderName,
|
|
24
|
+
inGetType: "bodyParse"
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
showLog({
|
|
28
|
+
enabled: isShowLog,
|
|
29
|
+
message: "end-points.js update completed.",
|
|
30
|
+
data: response
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return response;
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { getConfig } from "../../core/configStore.js";
|
|
4
|
+
|
|
5
|
+
export const getSchema = (table) => {
|
|
6
|
+
const config = getConfig();
|
|
7
|
+
|
|
8
|
+
const schemaPath = path.join(config.SchemaPath, `${table}.json`);
|
|
9
|
+
|
|
10
|
+
if (!fs.existsSync(schemaPath)) {
|
|
11
|
+
throw new Error(`Schema not found for table "${table}" at ${schemaPath}`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const schema = fs.readFileSync(schemaPath, "utf-8");
|
|
16
|
+
return JSON.parse(schema);
|
|
17
|
+
} catch (err) {
|
|
18
|
+
throw new Error(`Invalid schema JSON for "${table}": ${err.message}`);
|
|
19
|
+
};
|
|
20
|
+
};
|