MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / generateMiddlewareFile

Function generateMiddlewareFile

tools/js/generate-store-logic.js:78–93  ·  view source on GitHub ↗
(
  storeFileName,
  actionName,
)

Source from the content-addressed store, hash-verified

76`
77
78const generateMiddlewareFile = (
79 storeFileName,
80 actionName,
81) => `import createRequestLogic from '@ttn-lw/lib/store/logics/create-request-logic'
82import * as actions from '@console/store/actions/${storeFileName}'
83
84const ${actionName}Logic = createRequestLogic({
85 type: actions.${camelCaseToUpperSnakeCase(actionName)},
86 process: async ({ action }, dispatch, done) => {
87 // Process logic here
88 done()
89 }
90})
91
92export default [${actionName}Logic]
93`
94
95const main = async () => {
96 const answers = await inquirer.prompt([

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected