@maka/maka-cli 4.10.2 → 4.11.1

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.
Files changed (206) hide show
  1. package/bundle/obf/package.json +1 -1
  2. package/bundle/obf/src/command.js +1 -1
  3. package/bundle/obf/src/commands/_index.js +1 -1
  4. package/bundle/obf/src/commands/ai.js +1 -1
  5. package/bundle/obf/src/commands/aws/_index.js +1 -1
  6. package/bundle/obf/src/commands/aws/aws.command.js +1 -1
  7. package/bundle/obf/src/commands/aws/chz.sub.cmd.js +1 -1
  8. package/bundle/obf/src/commands/aws/ci.sub.cmd.js +1 -1
  9. package/bundle/obf/src/commands/aws/ckp.sub.cmd.js +1 -1
  10. package/bundle/obf/src/commands/aws/csg.sub.cmd.js +1 -1
  11. package/bundle/obf/src/commands/aws/di.sub.cmd.js +1 -1
  12. package/bundle/obf/src/commands/aws/dkp.sub.cmd.js +1 -1
  13. package/bundle/obf/src/commands/aws/dsg.sub.cmd.js +1 -1
  14. package/bundle/obf/src/commands/aws/rbi.sub.cmd.js +1 -1
  15. package/bundle/obf/src/commands/aws/rdn.sub.cmd.js +1 -1
  16. package/bundle/obf/src/commands/aws/rkp.sub.cmd.js +1 -1
  17. package/bundle/obf/src/commands/aws/sth.sub.cmd.js +1 -1
  18. package/bundle/obf/src/commands/aws/ti.sub.cmd.js +1 -1
  19. package/bundle/obf/src/commands/build/_index.js +1 -1
  20. package/bundle/obf/src/commands/build/build.js +1 -1
  21. package/bundle/obf/src/commands/build/docker.sub.cmd.js +1 -1
  22. package/bundle/obf/src/commands/create.js +1 -1
  23. package/bundle/obf/src/commands/debug.js +1 -1
  24. package/bundle/obf/src/commands/deploy/_index.js +1 -1
  25. package/bundle/obf/src/commands/deploy/deploy.command.js +1 -1
  26. package/bundle/obf/src/commands/deploy/galaxy.sub.cmd.js +1 -1
  27. package/bundle/obf/src/commands/deploy/ubuntu.sub.cmd.js +1 -1
  28. package/bundle/obf/src/commands/game/_index.js +1 -1
  29. package/bundle/obf/src/commands/game/battleship.sub.cmd.js +1 -1
  30. package/bundle/obf/src/commands/game/play.command.js +1 -1
  31. package/bundle/obf/src/commands/game/pong.sub.cmd.js +1 -1
  32. package/bundle/obf/src/commands/game/sideQuest/commands/command.js +1 -1
  33. package/bundle/obf/src/commands/game/sideQuest/commands/drop.js +1 -1
  34. package/bundle/obf/src/commands/game/sideQuest/commands/equip.js +1 -1
  35. package/bundle/obf/src/commands/game/sideQuest/commands/go.js +1 -1
  36. package/bundle/obf/src/commands/game/sideQuest/commands/lock.js +1 -1
  37. package/bundle/obf/src/commands/game/sideQuest/commands/look.js +1 -1
  38. package/bundle/obf/src/commands/game/sideQuest/commands/say.js +1 -1
  39. package/bundle/obf/src/commands/game/sideQuest/commands/search.js +1 -1
  40. package/bundle/obf/src/commands/game/sideQuest/commands/solve.js +1 -1
  41. package/bundle/obf/src/commands/game/sideQuest/commands/take.js +1 -1
  42. package/bundle/obf/src/commands/game/sideQuest/commands/unequip.js +1 -1
  43. package/bundle/obf/src/commands/game/sideQuest/commands/unlock.js +1 -1
  44. package/bundle/obf/src/commands/game/sideQuest/commands/use.js +1 -1
  45. package/bundle/obf/src/commands/game/sideQuest/factories/commandF.js +1 -1
  46. package/bundle/obf/src/commands/game/sideQuest/factories/roomsF.js +1 -1
  47. package/bundle/obf/src/commands/game/sideQuest/game.js +1 -1
  48. package/bundle/obf/src/commands/game/sideQuest/models/_index.js +1 -1
  49. package/bundle/obf/src/commands/game/sideQuest/models/door.js +1 -1
  50. package/bundle/obf/src/commands/game/sideQuest/models/inventory.js +1 -1
  51. package/bundle/obf/src/commands/game/sideQuest/models/item.js +1 -1
  52. package/bundle/obf/src/commands/game/sideQuest/models/npc.js +1 -1
  53. package/bundle/obf/src/commands/game/sideQuest/models/player.js +1 -1
  54. package/bundle/obf/src/commands/game/sideQuest/models/puzzle.js +1 -1
  55. package/bundle/obf/src/commands/game/sideQuest/models/room.js +1 -1
  56. package/bundle/obf/src/commands/game/sideQuest/models/scene.js +1 -1
  57. package/bundle/obf/src/commands/game/sideQuest/scenes/items.js +1 -1
  58. package/bundle/obf/src/commands/game/sideQuest/scenes/rooms.js +1 -1
  59. package/bundle/obf/src/commands/game/sideQuest/types/abstracts.js +1 -1
  60. package/bundle/obf/src/commands/game/sideQuest/types/enums.js +1 -1
  61. package/bundle/obf/src/commands/game/sideQuest/types/interfaces.js +1 -1
  62. package/bundle/obf/src/commands/game/sideQuest/types/types.js +1 -1
  63. package/bundle/obf/src/commands/game/sideQuest/ui.js +1 -1
  64. package/bundle/obf/src/commands/game/sideQuest/utilities/logger.js +1 -1
  65. package/bundle/obf/src/commands/game/sideQuest.sub.cmd.js +1 -1
  66. package/bundle/obf/src/commands/game/snake.sub.cmd.js +1 -1
  67. package/bundle/obf/src/commands/game/tetris.sub.cmd.js +1 -1
  68. package/bundle/obf/src/commands/generate.js +1 -1
  69. package/bundle/obf/src/commands/get/_index.js +1 -1
  70. package/bundle/obf/src/commands/get/get.command.js +1 -1
  71. package/bundle/obf/src/commands/get/global.sub.cmd.js +1 -1
  72. package/bundle/obf/src/commands/get/local.sub.cmd.js +1 -1
  73. package/bundle/obf/src/commands/get/whoami.sub.cmd.js +1 -1
  74. package/bundle/obf/src/commands/help.js +1 -1
  75. package/bundle/obf/src/commands/install.js +1 -1
  76. package/bundle/obf/src/commands/jsdoc.js +1 -1
  77. package/bundle/obf/src/commands/lint.js +1 -1
  78. package/bundle/obf/src/commands/login.js +1 -1
  79. package/bundle/obf/src/commands/logout.js +1 -1
  80. package/bundle/obf/src/commands/logs.js +1 -1
  81. package/bundle/obf/src/commands/maka.cmd.js +1 -1
  82. package/bundle/obf/src/commands/murder.js +1 -1
  83. package/bundle/obf/src/commands/patreon.js +1 -1
  84. package/bundle/obf/src/commands/proxy.js +1 -1
  85. package/bundle/obf/src/commands/reconfig.js +1 -1
  86. package/bundle/obf/src/commands/register.js +1 -1
  87. package/bundle/obf/src/commands/run/_index.js +1 -1
  88. package/bundle/obf/src/commands/run/docker.sub.cmd.js +1 -1
  89. package/bundle/obf/src/commands/run/run.command.js +1 -1
  90. package/bundle/obf/src/commands/set/_index.js +1 -1
  91. package/bundle/obf/src/commands/set/global.sub.cmd.js +1 -1
  92. package/bundle/obf/src/commands/set/local.sub.cmd.js +1 -1
  93. package/bundle/obf/src/commands/set/set.command.js +1 -1
  94. package/bundle/obf/src/commands/ssh.js +1 -1
  95. package/bundle/obf/src/commands/ssl.js +1 -1
  96. package/bundle/obf/src/commands/test.js +1 -1
  97. package/bundle/obf/src/commands/undo.js +1 -1
  98. package/bundle/obf/src/commands/version.js +1 -1
  99. package/bundle/obf/src/error.js +1 -1
  100. package/bundle/obf/src/exec.js +1 -1
  101. package/bundle/obf/src/generator.js +1 -1
  102. package/bundle/obf/src/generators/_index.js +1 -1
  103. package/bundle/obf/src/generators/api.js +1 -1
  104. package/bundle/obf/src/generators/collection.js +1 -1
  105. package/bundle/obf/src/generators/component.js +1 -1
  106. package/bundle/obf/src/generators/config.js +1 -1
  107. package/bundle/obf/src/generators/dbc.js +1 -1
  108. package/bundle/obf/src/generators/dockerfile.js +1 -1
  109. package/bundle/obf/src/generators/hook.js +1 -1
  110. package/bundle/obf/src/generators/kits/_index.js +1 -1
  111. package/bundle/obf/src/generators/kits/auth/_index.js +1 -0
  112. package/bundle/obf/src/generators/kits/auth/auth.generator.js +1 -0
  113. package/bundle/obf/src/generators/kits/auth/basic-meteor.auth.gen.js +1 -0
  114. package/bundle/obf/src/generators/kits/auth/provider.auth.gen.js +1 -0
  115. package/bundle/obf/src/generators/kits/esri/_index.js +1 -1
  116. package/bundle/obf/src/generators/kits/esri/esri.generator.js +1 -1
  117. package/bundle/obf/src/generators/kits/esri/map.esri.gen.js +1 -1
  118. package/bundle/obf/src/generators/kits/kit.js +1 -1
  119. package/bundle/obf/src/generators/kits/mui/_index.js +1 -1
  120. package/bundle/obf/src/generators/kits/mui/auth.mui.gen.js +1 -0
  121. package/bundle/obf/src/generators/kits/mui/frame.mui.gen.js +1 -1
  122. package/bundle/obf/src/generators/kits/mui/mui.generator.js +1 -1
  123. package/bundle/obf/src/generators/layout.js +1 -1
  124. package/bundle/obf/src/generators/maka.gen.js +1 -1
  125. package/bundle/obf/src/generators/methods.js +1 -1
  126. package/bundle/obf/src/generators/package.js +1 -1
  127. package/bundle/obf/src/generators/page.js +1 -1
  128. package/bundle/obf/src/generators/publish.js +1 -1
  129. package/bundle/obf/src/generators/route.js +1 -1
  130. package/bundle/obf/src/generators/service.js +1 -1
  131. package/bundle/obf/src/generators/services/_index.js +1 -1
  132. package/bundle/obf/src/generators/services/openssl.js +1 -1
  133. package/bundle/obf/src/generators/services/translation.js +1 -1
  134. package/bundle/obf/src/maka.js +1 -1
  135. package/bundle/obf/src/templates/meteor/app/client/head.html +0 -3
  136. package/bundle/obf/src/templates/meteor/app/client/main.js +2 -0
  137. package/bundle/obf/src/templates/meteor/app/client/main.js.jsx +2 -0
  138. package/bundle/obf/src/templates/meteor/app/client/main.js.ts +2 -0
  139. package/bundle/obf/src/templates/meteor/app/client/main.js.tsx +2 -0
  140. package/bundle/obf/src/templates/meteor/app/imports/startup/client/index.js.jsx +5 -6
  141. package/bundle/obf/src/templates/meteor/app/imports/startup/client/index.js.tsx +5 -6
  142. package/bundle/obf/src/templates/meteor/app/imports/startup/client/routes.js.jsx +4 -3
  143. package/bundle/obf/src/templates/meteor/app/imports/startup/client/routes.js.tsx +4 -3
  144. package/bundle/obf/src/templates/meteor/app/imports/startup/lib/index.js.jsx +2 -2
  145. package/bundle/obf/src/templates/meteor/app/imports/startup/lib/index.js.tsx +2 -2
  146. package/bundle/obf/src/templates/meteor/app/imports/startup/lib/routes.js.jsx +4 -3
  147. package/bundle/obf/src/templates/meteor/app/imports/startup/lib/routes.js.tsx +4 -3
  148. package/bundle/obf/src/templates/meteor/app/imports/startup/server/index.js.jsx +1 -1
  149. package/bundle/obf/src/templates/meteor/app/imports/startup/server/index.js.tsx +1 -1
  150. package/bundle/obf/src/templates/meteor/app/lib/main.js +2 -0
  151. package/bundle/obf/src/templates/meteor/app/lib/main.js.jsx +2 -0
  152. package/bundle/obf/src/templates/meteor/app/lib/main.js.ts +2 -0
  153. package/bundle/obf/src/templates/meteor/app/lib/main.js.tsx +2 -0
  154. package/bundle/obf/src/templates/meteor/app/server/main.js +2 -0
  155. package/bundle/obf/src/templates/meteor/app/server/main.js.jsx +2 -0
  156. package/bundle/obf/src/templates/meteor/app/server/main.js.ts +2 -0
  157. package/bundle/obf/src/templates/meteor/app/server/main.js.tsx +2 -0
  158. package/bundle/obf/src/templates/meteor/config/settings.json +1 -1
  159. package/bundle/obf/src/templates/meteor/publish/publish.js +2 -2
  160. package/bundle/obf/src/templates/meteor/publish/publish.js.ts +3 -0
  161. package/bundle/obf/src/templates/react/kit/auth/provider/authentication-provider.js.jsx +281 -0
  162. package/bundle/obf/src/templates/react/kit/auth/provider/authentication-provider.js.tsx +318 -0
  163. package/bundle/obf/src/templates/react/kit/auth/service/meteor-auth-service.js.jsx +136 -0
  164. package/bundle/obf/src/templates/react/kit/auth/service/meteor-auth-service.js.tsx +136 -0
  165. package/bundle/obf/src/templates/react/kit/esri/map/basic-map.js.jsx +4 -2
  166. package/bundle/obf/src/templates/react/kit/esri/map/basic-map.js.tsx +5 -3
  167. package/bundle/obf/src/templates/react/kit/mui/auth/forgot-password/basic-forgot-password-page.js.jsx +32 -0
  168. package/bundle/obf/src/templates/react/kit/mui/auth/forgot-password/basic-forgot-password-page.js.tsx +31 -0
  169. package/bundle/obf/src/templates/react/kit/mui/auth/login/basic-login-page.js.jsx +51 -0
  170. package/bundle/obf/src/templates/react/kit/mui/auth/login/basic-login-page.js.tsx +52 -0
  171. package/bundle/obf/src/templates/react/kit/mui/auth/logout/basic-logout-page.js.jsx +24 -0
  172. package/bundle/obf/src/templates/react/kit/mui/auth/logout/basic-logout-page.js.tsx +24 -0
  173. package/bundle/obf/src/templates/react/kit/mui/auth/password-reset/basic-password-reset-page.js.jsx +34 -0
  174. package/bundle/obf/src/templates/react/kit/mui/auth/password-reset/basic-password-reset-page.js.tsx +34 -0
  175. package/bundle/obf/src/templates/react/kit/mui/auth/register/basic-register-page.js.jsx +32 -0
  176. package/bundle/obf/src/templates/react/kit/mui/auth/register/basic-register-page.js.tsx +32 -0
  177. package/bundle/obf/src/templates/react/kit/mui/frame/app-bars/basic-app-bar.js.jsx +5 -5
  178. package/bundle/obf/src/templates/react/kit/mui/frame/app-bars/basic-app-bar.js.tsx +4 -3
  179. package/bundle/obf/src/templates/react/kit/mui/frame/drawers/basic-drawer.js.jsx +7 -4
  180. package/bundle/obf/src/templates/react/kit/mui/frame/drawers/basic-drawer.js.tsx +5 -4
  181. package/bundle/obf/src/templates/react/kit/mui/frame/footers/basic-sticky-footer.js.jsx +41 -0
  182. package/bundle/obf/src/templates/react/kit/mui/frame/footers/basic-sticky-footer.js.tsx +41 -0
  183. package/bundle/obf/src/templates/service/eslint/eslintrc.json +22 -1
  184. package/bundle/obf/src/tool.js +1 -1
  185. package/bundle/obf/src/tools/actions/actions.class.js +1 -1
  186. package/bundle/obf/src/tools/aws/aws.class.js +1 -1
  187. package/bundle/obf/src/tools/aws/aws.interfaces.js +1 -1
  188. package/bundle/obf/src/tools/docker/docker.class.js +1 -1
  189. package/bundle/obf/src/tools/docker/docker.interfaces.js +1 -1
  190. package/bundle/obf/src/tools/fsi/fsi.class.js +1 -1
  191. package/bundle/obf/src/tools/fsi/fsi.interfaces.js +1 -1
  192. package/bundle/obf/src/tools/https/https.class.js +1 -1
  193. package/bundle/obf/src/tools/https/https.interface.js +1 -1
  194. package/bundle/obf/src/tools/log/log.class.js +1 -1
  195. package/bundle/obf/src/tools/log/log.interfaces.js +1 -1
  196. package/bundle/obf/src/tools/options/options.class.js +1 -1
  197. package/bundle/obf/src/tools/progress/progress.class.js +1 -1
  198. package/bundle/obf/src/tools/spawn-async/spawn-async.class.js +1 -1
  199. package/bundle/obf/src/tools/spawn-async/spawn-async.interfaces.js +1 -1
  200. package/bundle/obf/src/tools/ssh/ssh.class.js +1 -1
  201. package/bundle/obf/src/tools/ssh/ssh.interfaces.js +1 -1
  202. package/bundle/obf/src/tools/ssl/ssl.class.js +1 -1
  203. package/package.json +1 -1
  204. package/bundle/obf/src/templates/meteor/publish/publish.js.jsx +0 -3
  205. package/bundle/obf/src/templates/meteor/publish/publish.js.tsx +0 -3
  206. package/bundle/obf/src/templates/meteor/publish/publish.ts +0 -3
@@ -10,4 +10,6 @@ document.ontouchmove = event => {
10
10
  event.preventDefault();
11
11
  };
12
12
 
13
+ // See the Meteor docs for more information on directory structure
14
+ // https://guide.meteor.com/structure#example-app-structure
13
15
  import '/imports/startup/client';
@@ -10,4 +10,6 @@ document.ontouchmove = event => {
10
10
  event.preventDefault();
11
11
  };
12
12
 
13
+ // See the Meteor docs for more information on directory structure
14
+ // https://guide.meteor.com/structure#example-app-structure
13
15
  import '/imports/startup/client/index.jsx';
@@ -10,4 +10,6 @@ document.ontouchmove = event => {
10
10
  event.preventDefault();
11
11
  };
12
12
 
13
+ // See the Meteor docs for more information on directory structure
14
+ // https://guide.meteor.com/structure#example-app-structure
13
15
  import '/imports/startup/client';
@@ -10,4 +10,6 @@ document.ontouchmove = event => {
10
10
  event.preventDefault();
11
11
  };
12
12
 
13
+ // See the Meteor docs for more information on directory structure
14
+ // https://guide.meteor.com/structure#example-app-structure
13
15
  import '/imports/startup/client/index';
@@ -39,13 +39,12 @@ const client = new ApolloClient({
39
39
  });
40
40
  <% } %><% if (config.engines.theme === 'material') { if (config.engines.ssr === 'true') { %>
41
41
  import { ThemeProvider } from '@mui/material/styles';
42
- import CssBaseline from '@mui/material/CssBaseline';
43
42
  import { theme } from '../lib/index';<% } else { %>
44
43
  // Material UI Theme config using default mui.
45
44
  import { ThemeProvider, createTheme, responsiveFontSizes } from '@mui/material/styles';
46
45
  import CssBaseline from '@mui/material/CssBaseline';
47
46
  // https://mui.com/material-ui/customization/default-theme/
48
- let theme = createTheme({
47
+ const newTheme = createTheme({
49
48
  typography: {
50
49
  useNextVariants: true,
51
50
  },
@@ -59,7 +58,7 @@ let theme = createTheme({
59
58
  },
60
59
  },
61
60
  });
62
- theme = responsiveFontSizes(theme);<% }} %>
61
+ const theme = responsiveFontSizes(newTheme);<% }} %>
63
62
  <% if (config.engines.ssr === 'true') { %>
64
63
  // Server Side Rendering sink and router classifier.
65
64
  import { BrowserRouter } from 'react-router-dom'
@@ -67,13 +66,13 @@ import { onPageLoad } from "meteor/server-render";
67
66
  <% } %>
68
67
  <% if (config.engines.ssr === 'true') { %>import Routes from '../lib/routes';<% } else { %>import Routes from './routes';<% } %>
69
68
 
70
- const App = ({ user }) => (<% if (config.engines.ssr === 'true') { %>
69
+ const App = () => (<% if (config.engines.ssr === 'true') { %>
71
70
  <BrowserRouter><% } %><% if (config.engines.graphql === 'apollo') { %>
72
71
  <ApolloProvider client={client}>
73
72
  <ApolloHooksProvider client={client}><% } %><% if (config.engines.theme === 'material') { %>
74
73
  <ThemeProvider theme={theme}>
75
74
  <CssBaseline /><% } %>
76
- <Routes user={user} history={browserHistory}/><% if (config.engines.theme === 'material') { %>
75
+ <Routes history={browserHistory}/><% if (config.engines.theme === 'material') { %>
77
76
  </ThemeProvider><% } %><% if (config.engines.graphql === 'apollo') { %>
78
77
  </ApolloHooksProvider>
79
78
  </ApolloProvider><% } %><% if (config.engines.ssr === 'true') { %>
@@ -81,7 +80,7 @@ const App = ({ user }) => (<% if (config.engines.ssr === 'true') { %>
81
80
  );
82
81
 
83
82
  const startApp = () => {<% if (config.engines.ssr === 'true') { %>
84
- onPageLoad(sink => {
83
+ onPageLoad(() => {
85
84
  ReactDOM.hydrateRoot(document.getElementById('app'), <App />);
86
85
  });<% } else { %>
87
86
  const root = ReactDOM.createRoot(document.getElementById('app'));
@@ -39,14 +39,13 @@ const client = new ApolloClient({
39
39
  });
40
40
  <% } %><% if (config.engines.theme === 'material') { if (config.engines.ssr === 'true') { %>
41
41
  import { ThemeProvider } from '@mui/material/styles';
42
- import CssBaseline from '@mui/material/CssBaseline';
43
42
  import { theme } from '../lib/index';<% } else { %>
44
43
  // Material UI Theme config using default mui.
45
44
  // https://mui.com/material-ui/customization/default-theme/
46
45
  import { ThemeProvider, createTheme, responsiveFontSizes } from '@mui/material/styles';
47
46
  import CssBaseline from '@mui/material/CssBaseline';
48
47
  // https://mui.com/material-ui/customization/default-theme/
49
- let theme = createTheme({
48
+ const newTheme = createTheme({
50
49
  typography: {
51
50
  useNextVariants: true,
52
51
  },
@@ -60,7 +59,7 @@ let theme = createTheme({
60
59
  },
61
60
  },
62
61
  });
63
- theme = responsiveFontSizes(theme);<% }} %>
62
+ const theme = responsiveFontSizes(newTheme);<% }} %>
64
63
  <% if (config.engines.ssr === 'true') { %>
65
64
  // Server Side Rendering sink and router classifier.
66
65
  import { BrowserRouter } from 'react-router-dom'
@@ -68,13 +67,13 @@ import { onPageLoad } from "meteor/server-render";
68
67
  <% } %>
69
68
  <% if (config.engines.ssr === 'true') { %>import Routes from '../lib/routes';<% } else { %>import Routes from './routes';<% } %>
70
69
 
71
- const App = ({ user }) => (<% if (config.engines.ssr === 'true') { %>
70
+ const App = () => (<% if (config.engines.ssr === 'true') { %>
72
71
  <BrowserRouter><% } %><% if (config.engines.graphql === 'apollo') { %>
73
72
  <ApolloProvider client={client}>
74
73
  <ApolloHooksProvider client={client}><% } %><% if (config.engines.theme === 'material') { %>
75
74
  <ThemeProvider theme={theme}>
76
75
  <CssBaseline /><% } %>
77
- <Routes user={user} history={browserHistory}/><% if (config.engines.theme === 'material') { %>
76
+ <Routes history={browserHistory}/><% if (config.engines.theme === 'material') { %>
78
77
  </ThemeProvider><% } %><% if (config.engines.graphql === 'apollo') { %>
79
78
  </ApolloHooksProvider>
80
79
  </ApolloProvider><% } %><% if (config.engines.ssr === 'true') { %>
@@ -82,7 +81,7 @@ const App = ({ user }) => (<% if (config.engines.ssr === 'true') { %>
82
81
  );
83
82
 
84
83
  const startApp = () => {<% if (config.engines.ssr === 'true') { %>
85
- onPageLoad(sink => {
84
+ onPageLoad(() => {
86
85
  ReactDOM.hydrateRoot(document.getElementById('app'), <App />);
87
86
  });<% } else { %>
88
87
  const root = ReactDOM.createRoot(document.getElementById('app'));
@@ -41,8 +41,9 @@ const PublicRoutes = ({ history }) => (
41
41
  {publicRoutes}
42
42
  </Router>
43
43
  );
44
- const Routes = ({ user = {}, history }) => (
45
- (user._id) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
46
- );
44
+ const Routes = ({ history }) => {
45
+ let currentUser = null;
46
+ return (currentUser) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
47
+ }
47
48
 
48
49
  export default Routes;
@@ -41,8 +41,9 @@ const PublicRoutes = ({ history }) => (
41
41
  {publicRoutes}
42
42
  </Router>
43
43
  );
44
- const Routes = ({ user = {}, history }) => (
45
- (user._id) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
46
- );
44
+ const Routes = ({ history }) => {
45
+ let currentUser = null;
46
+ return (currentUser) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
47
+ }
47
48
 
48
49
  export default Routes;
@@ -3,7 +3,7 @@
3
3
  import { createTheme, responsiveFontSizes } from '@mui/material/styles';
4
4
  import CssBaseline from '@mui/material/CssBaseline';
5
5
  // https://mui.com/material-ui/customization/default-theme/
6
- let theme = createTheme({
6
+ const newTheme = createTheme({
7
7
  typography: {
8
8
  useNextVariants: true,
9
9
  },
@@ -17,5 +17,5 @@ let theme = createTheme({
17
17
  },
18
18
  },
19
19
  });
20
- theme = responsiveFontSizes(theme);
20
+ const theme = responsiveFontSizes(newTheme);
21
21
  export { theme };<% } %>
@@ -3,7 +3,7 @@
3
3
  import { createTheme, responsiveFontSizes } from '@mui/material/styles';
4
4
  import CssBaseline from '@mui/material/CssBaseline';
5
5
  // https://mui.com/material-ui/customization/default-theme/
6
- let theme = createTheme({
6
+ const newTheme = createTheme({
7
7
  typography: {
8
8
  useNextVariants: true,
9
9
  },
@@ -17,5 +17,5 @@ let theme = createTheme({
17
17
  },
18
18
  },
19
19
  });
20
- theme = responsiveFontSizes(theme);
20
+ const theme = responsiveFontSizes(newTheme);
21
21
  export { theme };<% } %>
@@ -41,8 +41,9 @@ const PublicRoutes = ({ history }) => (
41
41
  {publicRoutes}
42
42
  </Router>
43
43
  );
44
- const Routes = ({ user = {}, history }) => (
45
- (user._id) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
46
- );
44
+ const Routes = ({ history }) => {
45
+ let currentUser = null;
46
+ return (currentUser) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
47
+ }
47
48
 
48
49
  export default Routes;
@@ -41,8 +41,9 @@ const PublicRoutes = ({ history }) => (
41
41
  {publicRoutes}
42
42
  </Router>
43
43
  );
44
- const Routes = ({ user = {}, history }) => (
45
- (user._id) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
46
- );
44
+ const Routes = ({ history }) => {
45
+ let currentUser = null;
46
+ return (currentUser) ? <PrivateRoutes history={history}/> : <PublicRoutes history={history}/>
47
+ }
47
48
 
48
49
  export default Routes;
@@ -1,4 +1,3 @@
1
- import bodyParser from 'body-parser';
2
1
  import { Meteor } from 'meteor/meteor';
3
2
  import { WebAppInternals } from "meteor/webapp";
4
3
  Meteor.startup(() => {
@@ -6,6 +5,7 @@ Meteor.startup(() => {
6
5
  });
7
6
  <% if (config.engines.graphql === 'apollo') { %>
8
7
  import { ApolloServer } from '@apollo/server';
8
+ import bodyParser from 'body-parser';
9
9
  import { WebApp } from 'meteor/webapp';
10
10
  import { mergeTypeDefs, mergeResolvers } from '@graphql-tools/merge';
11
11
  import {
@@ -1,10 +1,10 @@
1
- import bodyParser from 'body-parser';
2
1
  import { Meteor } from 'meteor/meteor';
3
2
  import { WebAppInternals } from "meteor/webapp";
4
3
  Meteor.startup(() => {
5
4
  WebAppInternals.setInlineScriptsAllowed(false);
6
5
  });
7
6
  <% if (config.engines.graphql === 'apollo') { %>
7
+ import bodyParser from 'body-parser';
8
8
  import { ApolloServer } from '@apollo/server';
9
9
  import { WebApp } from 'meteor/webapp';
10
10
  import { mergeTypeDefs, mergeResolvers } from '@graphql-tools/merge';
@@ -1 +1,3 @@
1
+ // See the Meteor docs for more information on directory structure
2
+ // https://guide.meteor.com/structure#example-app-structure
1
3
  import '/imports/startup/lib';
@@ -1 +1,3 @@
1
+ // See the Meteor docs for more information on directory structure
2
+ // https://guide.meteor.com/structure#example-app-structure
1
3
  import '/imports/startup/lib/index.jsx';
@@ -1 +1,3 @@
1
+ // See the Meteor docs for more information on directory structure
2
+ // https://guide.meteor.com/structure#example-app-structure
1
3
  import '/imports/startup/lib';
@@ -1 +1,3 @@
1
+ // See the Meteor docs for more information on directory structure
2
+ // https://guide.meteor.com/structure#example-app-structure
1
3
  import '/imports/startup/lib/index';
@@ -8,4 +8,6 @@ if (enfoceCSP && !Meteor.isDevelopment) {
8
8
  }
9
9
  WebApp.addHtmlAttributeHook(() => ({ lang: Meteor.settings.language }));
10
10
 
11
+ // See the Meteor docs for more information on directory structure
12
+ // https://guide.meteor.com/structure#example-app-structure
11
13
  import '/imports/startup/server/index';
@@ -8,4 +8,6 @@ if (enfoceCSP && !Meteor.isDevelopment) {
8
8
  }
9
9
  WebApp.addHtmlAttributeHook(() => ({ lang: Meteor.settings.language }));
10
10
 
11
+ // See the Meteor docs for more information on directory structure
12
+ // https://guide.meteor.com/structure#example-app-structure
11
13
  import '/imports/startup/server/index';
@@ -8,4 +8,6 @@ if (enfoceCSP && !Meteor.isDevelopment) {
8
8
  }
9
9
  WebApp.addHtmlAttributeHook(() => ({ lang: Meteor.settings.language }));
10
10
 
11
+ // See the Meteor docs for more information on directory structure
12
+ // https://guide.meteor.com/structure#example-app-structure
11
13
  import '/imports/startup/server/index';
@@ -8,4 +8,6 @@ if (enfoceCSP && !Meteor.isDevelopment) {
8
8
  }
9
9
  WebApp.addHtmlAttributeHook(() => ({ lang: Meteor.settings.language }));
10
10
 
11
+ // See the Meteor docs for more information on directory structure
12
+ // https://guide.meteor.com/structure#example-app-structure
11
13
  import '/imports/startup/server/index';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "public": {
3
- "logoutOnClose": true,
3
+ "logoutOnClose": false,
4
4
  "enableServiceWorker": false
5
5
  },
6
6
  "//server": "//Will not run on client",
@@ -1,3 +1,3 @@
1
- Meteor.publish('<%= name %>', () => {
2
- return <%= collection %>.find();
1
+ Meteor.publish(<% if (globalPublish) { %>null<% } else { %>'<%= name %>'<% } %>, () => {
2
+ // return <%= collection %>.find();
3
3
  });
@@ -0,0 +1,3 @@
1
+ Meteor.publish(<% if (globalPublish) { %>null<% } else { %>'<%= name %>'<% } %>, () => {
2
+ // return <%= collection %>.find();
3
+ });
@@ -0,0 +1,281 @@
1
+ import { Meteor } from 'meteor/meteor';
2
+ import React, { createContext, useState, useEffect, useMemo } from 'react';
3
+ import { Alert } from '@mui/material';
4
+
5
+ // Authorization Context
6
+ export const AuthContext = createContext({});
7
+
8
+ /**
9
+ * Maka-CLI will replace the contents of these functions with
10
+ * a template that you can customize to fit your application's needs.
11
+ */
12
+ const authenticateUser = async (username, password) => {
13
+ // Replace these with your actual authentication logic
14
+ // and define what constitutes as a valid user and permissions.
15
+ // These are just placeholders to demonstrate the concept.
16
+
17
+ // TODO: Remove this once you've implemented your own authentication logic
18
+ if (Meteor.isProduction) {
19
+ throw new Error('You must implement your own authentication logic');
20
+ }
21
+ // Simulated user authentication
22
+ // Replace with API call or other logic
23
+ if (username === 'test' && password === 'password') {
24
+ localStorage.setItem('token', 'valid-token');
25
+ return { name: 'Test User', id: '12345' };
26
+ }
27
+ throw new Error('Invalid credentials');
28
+ };
29
+
30
+ const authenticateToken = async () => {
31
+ // TODO: Remove this once you've implemented your own authentication logic
32
+ if (Meteor.isProduction) {
33
+ throw new Error('You must implement your own authentication logic');
34
+ }
35
+
36
+ // A token should either already exist as a result of the login process
37
+ // or another sso style login
38
+ const token = localStorage.getItem('token');
39
+ // Simulated token validation
40
+ // Replace with token validation logic
41
+ //
42
+ // Note: This is a very basic example of token validation.
43
+ // You should add additional logic to validate the token
44
+ // as well as handle token expiration, renewal, etc.
45
+ if (token === 'valid-token') {
46
+ return { name: 'Token User', id: '67890' };
47
+ }
48
+ throw new Error('Invalid token');
49
+ };
50
+
51
+ const getUserAuthorizations = async (user) => {
52
+ // Placeholder function to simulate fetching user permissions
53
+ // TODO: Remove this once you've implemented your own authentication logic
54
+ if (Meteor.isProduction) {
55
+ throw new Error('You must implement your own permission logic');
56
+ }
57
+ // Simulate an API call to fetch permissions, or other logic
58
+ // such as parsing a JWT token to retrieve permissions
59
+ // Replace with your actual logic
60
+ if (user.id === '12345') {
61
+ return ['read', 'write', 'edit'];
62
+ }
63
+ return [];
64
+ };
65
+
66
+ const deauthenticateUser = async () => {
67
+ // Placeholder function to simulate deauthorizing a user
68
+ // TODO: Remove this once you've implemented your own authentication logic
69
+ if (Meteor.isProduction) {
70
+ throw new Error('You must implement your own deauthorization logic');
71
+ }
72
+
73
+ // Simulate an API call to deauthorize a user
74
+ // Replace with your actual logic
75
+ // Note: This is a very basic example of deauthorization.
76
+ // You should add additional logic to deauthorize the user
77
+ // and handle any errors that may occur.
78
+ return true;
79
+ };
80
+
81
+ const sendForgotPasswordEmail = async (email) => {
82
+ // Placeholder function to simulate sending a password reset email
83
+ // TODO: Remove this once you've implemented your own authentication logic
84
+ if (Meteor.isProduction) {
85
+ throw new Error('You must implement your own send forgot email logic');
86
+ }
87
+
88
+ // Simulate an API call to send a password reset email
89
+ // Replace with your actual logic
90
+ // Note: This is a very basic example of sending a password reset email.
91
+ // You should add additional logic to send the email
92
+ // and handle any errors that may occur.
93
+ console.log(`Sending password reset email to ${email}`);
94
+ return true;
95
+ };
96
+
97
+ const registerNewUser = async (email, password) => {
98
+ // Placeholder function to simulate registering a new user
99
+ // TODO: Remove this once you've implemented your own authentication logic
100
+ if (Meteor.isProduction) {
101
+ throw new Error('You must implement your own registration logic');
102
+ }
103
+
104
+ console.log(`Registering new user with email ${email}`);
105
+ console.log(`Registering new user with password ${password.length} characters`);
106
+ return true;
107
+ };
108
+
109
+ const resetPasswordWithToken = async (token, password) => {
110
+ // Placeholder function to simulate resetting a password with a token
111
+ // TODO: Remove this once you've implemented your own authentication logic
112
+ if (Meteor.isProduction) {
113
+ throw new Error('You must implement your own password reset logic');
114
+ }
115
+
116
+ console.log(`Resetting password with token ${token}`);
117
+ console.log(`Resetting password with password ${password.length} characters`);
118
+ return true;
119
+ };
120
+
121
+
122
+ // Authorization Provider
123
+ export const AuthProvider = ({ children, timeoutDuration = 3600000 }) => {
124
+ const [currentUser, setCurrentUser] = useState(null);
125
+ const [userAuthorizations, setUserAuthorizations] = useState([]);
126
+ const [loading, setLoading] = useState(true);
127
+ const [alert, setAlert] = useState({ show: false, message: '', severity: '' });
128
+
129
+ const setAlertMessage = (message, severity) => {
130
+ setAlert({ show: true, message, severity });
131
+ setTimeout(() => setAlert({ show: false, message: '', severity: '' }), 5000); // Auto-hide after 5 seconds
132
+ };
133
+
134
+ const logout = async () => {
135
+ try {
136
+ if (currentUser) {
137
+ await deauthenticateUser();
138
+ setCurrentUser(null);
139
+ setLoading(false);
140
+ setAlertMessage('Logout successful!', 'success');
141
+ }
142
+ } catch (error) {
143
+ setAlertMessage('Logout failed: ' + error.message, 'error');
144
+ }
145
+ };
146
+
147
+ const loginUserWithUsernameAndPassword = async (username, password) => {
148
+ try {
149
+ const user = await authenticateUser(username, password);
150
+ setCurrentUser(user);
151
+ setLoading(false);
152
+ setAlertMessage('Login successful!', 'success');
153
+ return user;
154
+ } catch (error) {
155
+ setLoading(false);
156
+ setCurrentUser(null);
157
+ setAlertMessage('Login failed: ' + error.message, 'error');
158
+ return null;
159
+ }
160
+ };
161
+
162
+ const login = async (credentials) => {
163
+ if (credentials.username && credentials.password) {
164
+ return loginUserWithUsernameAndPassword(credentials.username, credentials.password);
165
+ } else {
166
+ setLoading(false);
167
+ throw new Error('Invalid login credentials');
168
+ }
169
+ };
170
+
171
+ const loginUserWithToken = async () => {
172
+ try {
173
+ const user = await authenticateToken();
174
+ setCurrentUser(user);
175
+ setLoading(false);
176
+ return user;
177
+ } catch (error) {
178
+ setLoading(false);
179
+ setCurrentUser(null);
180
+ setAlertMessage('Login failed: ' + error.message, 'error');
181
+ return null;
182
+ }
183
+ };
184
+
185
+ const fetchUserAuthorizations = async (user) => {
186
+ const permissions = await getUserAuthorizations(user);
187
+ setUserAuthorizations(permissions);
188
+ };
189
+
190
+ const forgotPassword = async (email) => {
191
+ try {
192
+ await sendForgotPasswordEmail(email);
193
+ setAlertMessage('Please check your email.', 'success');
194
+ return true;
195
+ } catch (error) {
196
+ setAlertMessage('Error sending email: ' + error.message, 'error');
197
+ return false;
198
+ }
199
+ };
200
+
201
+ const register = async (email, password) => {
202
+ try {
203
+ const user = await registerNewUser(email, password);
204
+ setCurrentUser(user);
205
+ fetchUserAuthorizations(user);
206
+ setLoading(false);
207
+ setAlertMessage('Registration sucess, welcome!', 'success');
208
+ return user;
209
+ } catch (error) {
210
+ setAlertMessage('Register failed: ' + error.message, 'error');
211
+ return null;
212
+ }
213
+ };
214
+
215
+ const resetPassword = async (token, password) => {
216
+ try {
217
+ const user = await resetPasswordWithToken(token, password);
218
+ setCurrentUser(user);
219
+ fetchUserAuthorizations(user);
220
+ setLoading(false);
221
+ setAlertMessage('Password reset!', 'success');
222
+ return true;
223
+ } catch (error) {
224
+ setAlertMessage('Password reset failed: ' + error.message, 'error');
225
+ return false;
226
+ }
227
+ };
228
+
229
+ useEffect(() => {
230
+ let logoutTimer;
231
+
232
+ const setLogoutTimer = () => {
233
+ if (logoutTimer) {
234
+ clearTimeout(logoutTimer);
235
+ }
236
+ logoutTimer = setTimeout(logout, timeoutDuration);
237
+ };
238
+
239
+ if (currentUser) {
240
+ setLogoutTimer();
241
+ fetchUserAuthorizations(currentUser);
242
+ } else {
243
+ setLoading(true);
244
+ const renewedUser = loginUserWithToken();
245
+ if (renewedUser) {
246
+ setCurrentUser(renewedUser);
247
+ setLogoutTimer();
248
+ fetchUserAuthorizations(renewedUser);
249
+ } else {
250
+ setUserAuthorizations([]);
251
+ }
252
+ }
253
+
254
+ return () => {
255
+ clearTimeout(logoutTimer);
256
+ };
257
+ }, [currentUser, timeoutDuration]);
258
+
259
+ const contextValue = useMemo(() => ({
260
+ currentUser,
261
+ userAuthorizations,
262
+ login,
263
+ logout,
264
+ loading,
265
+ forgotPassword,
266
+ resetPassword,
267
+ register,
268
+ }), [currentUser, userAuthorizations, login, logout, loading, forgotPassword, resetPassword, register]);
269
+
270
+ return (
271
+ <AuthContext.Provider value={contextValue}>
272
+ {alert.show && (
273
+ <Alert severity={alert.severity} style={{ position: 'fixed', bottom: 20, right: 20, zIndex: 100000 }}>
274
+ {alert.message}
275
+ </Alert>
276
+ )}
277
+ {children}
278
+ </AuthContext.Provider>
279
+ );
280
+ };
281
+