@maka/maka-cli 5.3.14 → 5.3.16

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maka/maka-cli",
3
- "version": "5.3.14",
3
+ "version": "5.3.16",
4
4
  "type": "module",
5
5
  "summary": "A command line tool for scaffolding Meteor 2.x applications using either React.",
6
6
  "description": "A command line tool for scaffolding Meteor 2.x applications using React.",
@@ -144,9 +144,14 @@ Generator.create({
144
144
  content: `
145
145
  useTracker(() => {
146
146
  if (Meteor.isClient) {
147
- if (Meteor.user() && !currentUser) {
148
- setCurrentUser(Meteor.user());
149
- fetchUserAuthorizations(Meteor.user());
147
+ const meteorUser = Meteor.user();
148
+ if (meteorUser && !currentUser) {
149
+ const user = {
150
+ id: meteorUser._id,
151
+ name: meteorUser.username || meteorUser.emails?.[0]?.address || meteorUser._id,
152
+ };
153
+ setCurrentUser(user);
154
+ fetchUserAuthorizations(user);
150
155
  }
151
156
  }
152
157
  });
@@ -1 +1 @@
1
- {"version":3,"file":"basic-meteor.auth.gen.js","sourceRoot":"","sources":["../../../../../../src/generators/kits/auth/basic-meteor.auth.gen.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,oEAAoE;AACpE,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,OAAO,MAAM,iCAAiC,CAAA;AAErD,OAAO,EACL,aAAa,GACd,MAAM,sCAAsC,CAAA;AAE7C,SAAS,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,KAAK,EAAE,mDAAmD;IAC1D,SAAS,EAAE,6FAA6F;IACxG,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,OA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YACvB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IAEL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,EAAE,KAAK,eAAa,CAAC,EAAE,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"basic-meteor.auth.gen.js","sourceRoot":"","sources":["../../../../../../src/generators/kits/auth/basic-meteor.auth.gen.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,oEAAoE;AACpE,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,OAAO,MAAM,iCAAiC,CAAA;AAErD,OAAO,EACL,aAAa,GACd,MAAM,sCAAsC,CAAA;AAE7C,SAAS,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,KAAK,EAAE,mDAAmD;IAC1D,SAAS,EAAE,6FAA6F;IACxG,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0BAA0B;SACxC,CAAC;IACF,KAAK,EAAE,IAAI;IACX,oBAAoB,EAAE,KAAK;IAC3B,mBAAmB,EAAE,IAAI;IACzB,eAAe,EAAE;QACf,MAAM,EAAE,aAAa,CAAC,KAAK;KAC5B;IACD,WAAW,EAAE;;;GAGZ;CACF,EAAE,KAAK,WAAU,IAAQ,EAAE,IAAwB;IAClD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAA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,EAAE,eAAe;YACzB,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,eAAe;YAC3B,aAAa,EAAE,IAAI;YACnB,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QAEH,MAAM,QAAQ,CAAC,mBAAmB,CAAC;YACjC,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE;;;;;;;OAOR;YACD,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,iCAAiC;QACjC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,WAAW,CAAC;YAC/C,SAAS,EAAE;gBACT,SAAS;gBACT,SAAS;gBACT,QAAQ,EAAE,cAAc;gBACxB,OAAO,CAAC,YAAY;aACrB;SACF,CAAC,CAAC;QAEH,iCAAiC;QACjC,MAAM,QAAQ,CAAC,YAAY,CAAC;YAC1B,QAAQ,EAAE,GAAG,mBAAmB,IAAI,QAAQ,EAAE;YAC9C,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE,sBAAsB;YAClC,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QAEH,MAAM,QAAQ,CAAC,mBAAmB,CAAC;YACjC,QAAQ,EAAE,GAAG,mBAAmB,IAAI,QAAQ,EAAE;YAC9C,OAAO,EAAE;;;;;;OAMR;YACD,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IAEL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,EAAE,KAAK,eAAa,CAAC,EAAE,OAAO,CAAC,CAAC"}
@@ -75,8 +75,8 @@ Generator.create({
75
75
  await this.scaffold.injectIntoCodeBlock({
76
76
  filePath: `${routesPathFromApp}.${jsEngine}`,
77
77
  content: `
78
- const { currentUser, loading } = useContext(AuthContext);
79
- return { currentUser, loading };
78
+ const auth = useContext(AuthContext);
79
+ return { currentUser: auth?.currentUser ?? null, loading: auth?.loading ?? false };
80
80
  `,
81
81
  begin: ['const useAuth', 'function useAuth'],
82
82
  replace: true
@@ -124,7 +124,7 @@ Generator.create({
124
124
  filePath: `${serverIndexPathFromApp}.${jsEngine}`,
125
125
  aboveContent: `<AuthProvider>`,
126
126
  belowContent: `</AuthProvider>`,
127
- targetString: `<AppRoutes history={history}/>`,
127
+ targetString: `<AppRoutes />`,
128
128
  indentAdjustment: 2,
129
129
  targetIndentAdjustment: 6
130
130
  });
@@ -1 +1 @@
1
- {"version":3,"file":"provider.auth.gen.js","sourceRoot":"","sources":["../../../../../../src/generators/kits/auth/provider.auth.gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,oEAAoE;AACpE,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EACL,WAAW,GAEZ,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,GACd,MAAM,sCAAsC,CAAA;AAE7C,SAAS,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,KAAK,EAAE,qDAAqD;IAC5D,SAAS,EAAE,sDAAsD;IACjE,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0BAA0B;SACxC,CAAC;IACF,KAAK,EAAE,IAAI;IACX,mBAAmB,EAAE,IAAI;IACzB,oBAAoB,EAAE,KAAK;IAC3B,eAAe,EAAE;QACf,MAAM,EAAE,aAAa,CAAC,KAAK;KAC5B;IACD,WAAW,EAAE;;;;;GAKZ;CACF,EAAE,KAAK,WAAW,IAAQ,EAAE,IAAwB;IACnD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,IAAI,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AC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,EAAE,KAAK,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"provider.auth.gen.js","sourceRoot":"","sources":["../../../../../../src/generators/kits/auth/provider.auth.gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,oEAAoE;AACpE,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EACL,WAAW,GAEZ,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,aAAa,GACd,MAAM,sCAAsC,CAAA;AAE7C,SAAS,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,CAAC,GAAG,CAAC;IACd,KAAK,EAAE,qDAAqD;IAC5D,SAAS,EAAE,sDAAsD;IACjE,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0BAA0B;SACxC,CAAC;IACF,KAAK,EAAE,IAAI;IACX,mBAAmB,EAAE,IAAI;IACzB,oBAAoB,EAAE,KAAK;IAC3B,eAAe,EAAE;QACf,MAAM,EAAE,aAAa,CAAC,KAAK;KAC5B;IACD,WAAW,EAAE;;;;;GAKZ;CACF,EAAE,KAAK,WAAW,IAAQ,EAAE,IAAwB;IACnD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC;QAExC,GAAG,CAAC,MAAM,CAAC,0CAA0C,CAAC,CAAC;QAEvD,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC;QAErD,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,WAAW,CAA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ayout />}>
20
20
  <Route index element={<Component.Home />} />
21
21
  <Route path="*" element={<Component.NotFound />} />
22
22
  <Route element={<PrivateRoute />}>
23
23
  </Route>
24
24
  </Route>
25
- </>
25
+ </Routes>
26
26
  );
27
27
 
28
28
  export default AppRoutes;
@@ -10,7 +10,6 @@ import React from 'react';
10
10
  import { renderToStaticMarkup } from 'react-dom/server';
11
11
  import { onPageLoad } from 'meteor/server-render';
12
12
  import { StaticRouter } from 'react-router-dom/server';
13
- import { createMemoryHistory } from 'history';
14
13
  <% if (config.engines.graphql === 'apollo') { %>
15
14
  import { createMeteorNetworkInterface, meteorClientConfig } from 'meteor/apollo';
16
15
  import { ApolloClient, ApolloProvider, renderToStringWithData } from '@apollo/client';
@@ -37,24 +36,22 @@ function createEmotionCache() {
37
36
  }
38
37
 
39
38
  onPageLoad((sink) => {
40
- const history = createMemoryHistory(sink.request.url.pathname);
39
+ const request = sink.request;
41
40
  // Create a sheets instance.
42
41
  const cache = createEmotionCache();
43
42
  const { extractCriticalToChunks, constructStyleTagsFromChunks } =
44
43
  createEmotionServer(cache);
45
44
 
46
45
  const App = (props) => (
47
- <StaticRouter
48
- location={props.location}
49
- context={{}}>
50
- <AppRoutes history={history}/>
46
+ <StaticRouter location={props.location}>
47
+ <AppRoutes/>
51
48
  </StaticRouter>
52
49
  );<% if (config.engines.theme === 'material') { if (config.engines.graphql === 'apollo') { %>
53
50
  renderToStringWithData(
54
51
  <ApolloProvider client={client}>
55
52
  <ThemeProvider theme={theme}>
56
53
  <CssBaseline />
57
- <App location={sink.request.url} />
54
+ <App location={request.url} />
58
55
  </ThemeProvider>
59
56
  </ApolloProvider>
60
57
  ).then((content) => {
@@ -67,7 +64,7 @@ onPageLoad((sink) => {
67
64
  const html = renderToStaticMarkup(
68
65
  <ThemeProvider theme={theme}>
69
66
  <CssBaseline />
70
- <App location={sink.request.url} />
67
+ <App location={request.url} />
71
68
  </ThemeProvider>
72
69
  );
73
70
  const emotionChunks = extractCriticalToChunks(html);
@@ -78,7 +75,7 @@ onPageLoad((sink) => {
78
75
  <% } } else { if (config.engines.graphql === 'apollo') { %>
79
76
  renderToStringWithData(
80
77
  <ApolloProvider client={client}>
81
- <App location={sink.request.url} />
78
+ <App location={request.url} />
82
79
  </ApolloProvider>
83
80
  ).then((content) => {
84
81
  const emotionChunks = extractCriticalToChunks(html);
@@ -88,7 +85,7 @@ onPageLoad((sink) => {
88
85
  sink.renderIntoElementById('app', content);
89
86
  });<% } else { %>
90
87
  const html = renderToStaticMarkup(
91
- <App location={sink.request.url} />
88
+ <App location={request.url} />
92
89
  );
93
90
  const emotionChunks = extractCriticalToChunks(html);
94
91
  const emotionCss = constructStyleTagsFromChunks(emotionChunks);
@@ -10,7 +10,6 @@ import * as React from 'react';
10
10
  import { renderToStaticMarkup } from 'react-dom/server';
11
11
  import { onPageLoad } from 'meteor/server-render';
12
12
  import { StaticRouter } from 'react-router-dom/server';
13
- import { createMemoryHistory } from 'history';
14
13
  <% if (config.engines.graphql === 'apollo') { %>
15
14
  import { createMeteorNetworkInterface, meteorClientConfig } from 'meteor/apollo';
16
15
  import { ApolloClient, ApolloProvider, renderToStringWithData } from '@apollo/client';
@@ -37,24 +36,25 @@ function createEmotionCache() {
37
36
  }
38
37
 
39
38
  onPageLoad((sink) => {
40
- const history = createMemoryHistory(sink.request.url.pathname);
39
+ // sink is typed ClientSink | ServerSink by @types/meteor; onPageLoad's
40
+ // callback only ever runs on the server, where it's always a ServerSink,
41
+ // but that's not something the union type alone can express.
42
+ const request = (sink as any).request;
41
43
  // Create a sheets instance.
42
44
  const cache = createEmotionCache();
43
45
  const { extractCriticalToChunks, constructStyleTagsFromChunks } =
44
46
  createEmotionServer(cache);
45
47
 
46
- const App = (props) => (
47
- <StaticRouter
48
- location={props.location}
49
- context={{}}>
50
- <AppRoutes history={history}/>
48
+ const App = (props: { location: string }) => (
49
+ <StaticRouter location={props.location}>
50
+ <AppRoutes/>
51
51
  </StaticRouter>
52
52
  );<% if (config.engines.theme === 'material') { if (config.engines.graphql === 'apollo') { %>
53
53
  renderToStringWithData(
54
54
  <ApolloProvider client={client}>
55
55
  <ThemeProvider theme={theme}>
56
56
  <CssBaseline />
57
- <App location={sink.request.url} />
57
+ <App location={request.url} />
58
58
  </ThemeProvider>
59
59
  </ApolloProvider>
60
60
  ).then((content) => {
@@ -67,7 +67,7 @@ onPageLoad((sink) => {
67
67
  const html = renderToStaticMarkup(
68
68
  <ThemeProvider theme={theme}>
69
69
  <CssBaseline />
70
- <App location={sink.request.url} />
70
+ <App location={request.url} />
71
71
  </ThemeProvider>
72
72
  );
73
73
  const emotionChunks = extractCriticalToChunks(html);
@@ -78,7 +78,7 @@ onPageLoad((sink) => {
78
78
  <% } } else { if (config.engines.graphql === 'apollo') { %>
79
79
  renderToStringWithData(
80
80
  <ApolloProvider client={client}>
81
- <App location={sink.request.url} />
81
+ <App location={request.url} />
82
82
  </ApolloProvider>
83
83
  ).then((content) => {
84
84
  const emotionChunks = extractCriticalToChunks(html);
@@ -88,7 +88,7 @@ onPageLoad((sink) => {
88
88
  sink.renderIntoElementById('app', content);
89
89
  });<% } else { %>
90
90
  const html = renderToStaticMarkup(
91
- <App location={sink.request.url} />
91
+ <App location={request.url} />
92
92
  );
93
93
  const emotionChunks = extractCriticalToChunks(html);
94
94
  const emotionCss = constructStyleTagsFromChunks(emotionChunks);
@@ -26,6 +26,28 @@ declare module 'meteor/maka:react-tracker' {
26
26
  export const withTracker: any;
27
27
  }
28
28
 
29
+ // alanning:roles is a widely-used community Atmosphere package with no
30
+ // official types.
31
+ declare module 'meteor/alanning:roles' {
32
+ export namespace Roles {
33
+ function getRolesForUser(userId: string, options?: any): string[];
34
+ function userIsInRole(userId: string, roles: string | string[], group?: string): boolean;
35
+ function addUsersToRoles(userIds: string | string[], roles: string | string[], group?: string): void;
36
+ function removeUsersFromRoles(userIds: string | string[], roles: string | string[], group?: string): void;
37
+ function createRole(role: string, options?: any): string;
38
+ }
39
+ }
40
+
41
+ // Meteor.roleAssignment is the Mongo collection alanning:roles publishes
42
+ // role/user links through -- an @types/meteor gap, additive only.
43
+ declare module 'meteor/meteor' {
44
+ import { Mongo } from 'meteor/mongo';
45
+
46
+ namespace Meteor {
47
+ var roleAssignment: Mongo.Collection<any>;
48
+ }
49
+ }
50
+
29
51
  declare module 'meteor/maka:http' {
30
52
  export const HTTP: {
31
53
  /**
@@ -1,3 +1,7 @@
1
- Meteor.publish(<% if (globalPublish) { %>null<% } else { %>'<%= name %>'<% } %>, () => {
1
+ import { Meteor } from 'meteor/meteor';
2
+
3
+ // A regular function (not an arrow function) is required here so Meteor can
4
+ // bind `this` to the subscription context (this.userId, this.stop(), etc).
5
+ Meteor.publish(<% if (globalPublish) { %>null<% } else { %>'<%= name %>'<% } %>, function () {
2
6
  // return <%= collection %>.find();
3
7
  });
@@ -1,3 +1,7 @@
1
- Meteor.publish(<% if (globalPublish) { %>null<% } else { %>'<%= name %>'<% } %>, () => {
1
+ import { Meteor } from 'meteor/meteor';
2
+
3
+ // A regular function (not an arrow function) is required here so Meteor can
4
+ // bind `this` to the subscription context (this.userId, this.stop(), etc).
5
+ Meteor.publish(<% if (globalPublish) { %>null<% } else { %>'<%= name %>'<% } %>, function () {
2
6
  // return <%= collection %>.find();
3
7
  });
@@ -74,7 +74,6 @@ const deauthenticateUser = async () => {
74
74
  // Note: This is a very basic example of deauthorization.
75
75
  // You should add additional logic to deauthorize the user
76
76
  // and handle any errors that may occur.
77
- return true;
78
77
  };
79
78
 
80
79
  const sendForgotPasswordEmail = async (email) => {
@@ -102,7 +101,7 @@ const registerNewUser = async (email, password) => {
102
101
 
103
102
  console.log(`Registering new user with email ${email}`);
104
103
  console.log(`Registering new user with password ${password.length} characters`);
105
- return true;
104
+ return { name: email, id: 'new-user' };
106
105
  };
107
106
 
108
107
  const resetPasswordWithToken = async (token, password) => {
@@ -114,7 +113,7 @@ const resetPasswordWithToken = async (token, password) => {
114
113
 
115
114
  console.log(`Resetting password with token ${token}`);
116
115
  console.log(`Resetting password with password ${password.length} characters`);
117
- return true;
116
+ return { name: 'Token User', id: 'reset-user' };
118
117
  };
119
118
 
120
119
 
@@ -201,7 +200,9 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }) => {
201
200
  try {
202
201
  const user = await registerNewUser(email, password);
203
202
  setCurrentUser(user);
204
- fetchUserAuthorizations(user);
203
+ if (user) {
204
+ fetchUserAuthorizations(user);
205
+ }
205
206
  setLoading(false);
206
207
  setAlertMessage('Registration sucess, welcome!', 'success');
207
208
  return user;
@@ -215,7 +216,9 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }) => {
215
216
  try {
216
217
  const user = await resetPasswordWithToken(token, password);
217
218
  setCurrentUser(user);
218
- fetchUserAuthorizations(user);
219
+ if (user) {
220
+ fetchUserAuthorizations(user);
221
+ }
219
222
  setLoading(false);
220
223
  setAlertMessage('Password reset!', 'success');
221
224
  return true;
@@ -237,10 +240,8 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }) => {
237
240
 
238
241
  const checkUserAndSetData = async () => {
239
242
  if (currentUser) {
240
- // Assuming currentUser is a promise, await it
241
- const user = await currentUser;
242
243
  setLogoutTimer();
243
- fetchUserAuthorizations(user);
244
+ fetchUserAuthorizations(currentUser);
244
245
  } else {
245
246
  setLoading(true);
246
247
  try {
@@ -4,7 +4,7 @@ import React, { createContext, useState, useEffect, ReactNode, useMemo } from 'r
4
4
  // Define types for user and credentials
5
5
  // These are just placeholders to demonstrate the concept.
6
6
  // TODO: Define a user for your application
7
- interface User {
7
+ export interface User {
8
8
  name: string;
9
9
  id: string;
10
10
  }
@@ -21,20 +21,28 @@ interface AuthProviderProps {
21
21
  timeoutDuration?: number;
22
22
  }
23
23
 
24
- // Authorization Context
25
- export const AuthContext = createContext<{
24
+ interface AuthContextValue {
26
25
  currentUser: User | null;
27
26
  userAuthorizations: string[];
28
- login: (credentials: Credentials) => Promise<void>;
29
- logout: () => void;
27
+ login: (credentials: Credentials) => Promise<User | null>;
28
+ logout: () => Promise<void>;
30
29
  loading: boolean;
31
- } | null>({});
30
+ forgotPassword: (email: string) => Promise<boolean>;
31
+ resetPassword: (token: string, password: string) => Promise<boolean>;
32
+ register: (email: string, password: string) => Promise<User | null>;
33
+ }
34
+
35
+ // Authorization Context
36
+ export const AuthContext = createContext<AuthContextValue | null>(null);
37
+
38
+ // catch (error) is typed `unknown` under strict mode -- narrow before reading .message.
39
+ const getErrorMessage = (error: unknown): string => (error instanceof Error ? error.message : String(error));
32
40
 
33
41
  /**
34
42
  * Maka-CLI will replace the contents of these functions with
35
43
  * a template that you can customize to fit your application's needs.
36
44
  */
37
- const authenticateUser = async (username: string, password: string): Promise<User> => {
45
+ const authenticateUser = async (username: string, password: string): Promise<User | null> => {
38
46
  // Replace these with your actual authentication logic
39
47
  // and define what constitutes as a valid user and permissions.
40
48
  // These are just placeholders to demonstrate the concept.
@@ -52,7 +60,7 @@ const authenticateUser = async (username: string, password: string): Promise<Use
52
60
  throw new Error('Invalid credentials');
53
61
  };
54
62
 
55
- const authenticateToken = async (): Promise<User> => {
63
+ const authenticateToken = async (): Promise<User | null> => {
56
64
  // TODO: Remove this once you've implemented your own authentication logic
57
65
  if (Meteor.isProduction) {
58
66
  throw new Error('You must implement your own authentication logic');
@@ -89,7 +97,7 @@ const getUserAuthorizations = async (user: User): Promise<string[]> => {
89
97
  return [];
90
98
  };
91
99
 
92
- const deauthenticateUser = async (): Promise<boolean> => {
100
+ const deauthenticateUser = async (): Promise<void> => {
93
101
  // Placeholder function to simulate deauthorizing a user
94
102
  // TODO: Remove this once you've implemented your own authentication logic
95
103
  if (Meteor.isProduction) {
@@ -101,7 +109,6 @@ const deauthenticateUser = async (): Promise<boolean> => {
101
109
  // Note: This is a very basic example of deauthorization.
102
110
  // You should add additional logic to deauthorize the user
103
111
  // and handle any errors that may occur.
104
- return true;
105
112
  };
106
113
 
107
114
  const sendForgotPasswordEmail = async (email: string) => {
@@ -120,7 +127,7 @@ const sendForgotPasswordEmail = async (email: string) => {
120
127
  return true;
121
128
  };
122
129
 
123
- const registerNewUser = async (email: string, password: string) => {
130
+ const registerNewUser = async (email: string, password: string): Promise<User | null> => {
124
131
  // Placeholder function to simulate registering a new user
125
132
  // TODO: Remove this once you've implemented your own authentication logic
126
133
  if (Meteor.isProduction) {
@@ -129,10 +136,10 @@ const registerNewUser = async (email: string, password: string) => {
129
136
 
130
137
  console.log(`Registering new user with email ${email}`);
131
138
  console.log(`Registering new user with password ${password.length} characters`);
132
- return true;
139
+ return { name: email, id: 'new-user' };
133
140
  };
134
141
 
135
- const resetPasswordWithToken = async (token: string, password: string) => {
142
+ const resetPasswordWithToken = async (token: string, password: string): Promise<User | null> => {
136
143
  // Placeholder function to simulate resetting a password with a token
137
144
  // TODO: Remove this once you've implemented your own authentication logic
138
145
  if (Meteor.isProduction) {
@@ -141,7 +148,7 @@ const resetPasswordWithToken = async (token: string, password: string) => {
141
148
 
142
149
  console.log(`Resetting password with token ${token}`);
143
150
  console.log(`Resetting password with password ${password.length} characters`);
144
- return true;
151
+ return { name: 'Token User', id: 'reset-user' };
145
152
  };
146
153
 
147
154
 
@@ -166,7 +173,7 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }: AuthProvid
166
173
  setAlertMessage('Logout successful!', 'success');
167
174
  }
168
175
  } catch (error) {
169
- setAlertMessage('Logout failed: ' + error.message, 'error');
176
+ setAlertMessage('Logout failed: ' + getErrorMessage(error), 'error');
170
177
  }
171
178
  };
172
179
 
@@ -182,7 +189,7 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }: AuthProvid
182
189
  } catch (error) {
183
190
  setLoading(false);
184
191
  setCurrentUser(null);
185
- setAlertMessage('Login failed: ' + error.message, 'error');
192
+ setAlertMessage('Login failed: ' + getErrorMessage(error), 'error');
186
193
  return null;
187
194
  }
188
195
  };
@@ -209,7 +216,7 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }: AuthProvid
209
216
  } catch (error) {
210
217
  setLoading(false);
211
218
  setCurrentUser(null);
212
- setAlertMessage('Login failed: ' + error.message, 'error');
219
+ setAlertMessage('Login failed: ' + getErrorMessage(error), 'error');
213
220
  return null;
214
221
  }
215
222
  };
@@ -227,7 +234,7 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }: AuthProvid
227
234
  setAlertMessage('Please check your email.', 'success');
228
235
  return true;
229
236
  } catch (error) {
230
- setAlertMessage('Error sending email: ' + error.message, 'error');
237
+ setAlertMessage('Error sending email: ' + getErrorMessage(error), 'error');
231
238
  return false;
232
239
  }
233
240
  };
@@ -236,32 +243,36 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }: AuthProvid
236
243
  try {
237
244
  const user = await registerNewUser(email, password);
238
245
  setCurrentUser(user);
239
- fetchUserAuthorizations(user); // Fetch permissions when a user logs in
246
+ if (user) {
247
+ fetchUserAuthorizations(user); // Fetch permissions when a user logs in
248
+ }
240
249
  setAlertMessage('Registration sucess, welcome!', 'success');
241
250
  setLoading(false);
242
251
  return user;
243
252
  } catch (error) {
244
- setAlertMessage('Register failed: ' + error.message, 'error');
253
+ setAlertMessage('Register failed: ' + getErrorMessage(error), 'error');
245
254
  return null;
246
255
  }
247
256
  };
248
257
 
249
- const resetPassword = async (token, password) => {
258
+ const resetPassword = async (token: string, password: string) => {
250
259
  try {
251
260
  const user = await resetPasswordWithToken(token, password);
252
261
  setCurrentUser(user);
253
- fetchUserAuthorizations(user); // Fetch permissions when a user logs in
262
+ if (user) {
263
+ fetchUserAuthorizations(user); // Fetch permissions when a user logs in
264
+ }
254
265
  setAlertMessage('Password reset!', 'success');
255
266
  setLoading(false);
256
267
  return true;
257
268
  } catch (error) {
258
- setAlertMessage('Password reset failed: ' + error.message, 'error');
269
+ setAlertMessage('Password reset failed: ' + getErrorMessage(error), 'error');
259
270
  return false;
260
271
  }
261
272
  };
262
273
 
263
274
  useEffect(() => {
264
- let logoutTimer;
275
+ let logoutTimer: ReturnType<typeof setTimeout>;
265
276
 
266
277
  const setLogoutTimer = () => {
267
278
  if (logoutTimer) {
@@ -272,10 +283,8 @@ export const AuthProvider = ({ children, timeoutDuration = 3600000 }: AuthProvid
272
283
 
273
284
  const checkUserAndSetData = async () => {
274
285
  if (currentUser) {
275
- // Assuming currentUser is a promise, await it
276
- const user = await currentUser;
277
286
  setLogoutTimer();
278
- fetchUserAuthorizations(user);
287
+ fetchUserAuthorizations(currentUser);
279
288
  } else {
280
289
  setLoading(true);
281
290
  try {
@@ -2,8 +2,22 @@ import { Meteor } from 'meteor/meteor';
2
2
  import { Roles } from 'meteor/alanning:roles';
3
3
  import { Accounts } from 'meteor/accounts-base';
4
4
 
5
+ import { User } from './authentication-provider';
6
+
7
+ // Meteor.User carries Meteor's own fields (_id, username, emails, profile...);
8
+ // the generic AuthProvider only needs the minimal { id, name } shape.
9
+ const toUser = (meteorUser: Meteor.User | null): User | null => {
10
+ if (!meteorUser) return null;
11
+ return {
12
+ id: meteorUser._id,
13
+ name: meteorUser.username || meteorUser.emails?.[0]?.address || meteorUser._id,
14
+ };
15
+ };
16
+
17
+ type UserSelector = { username: string } | { email: string };
18
+
5
19
  class AuthService {
6
- static getUserQuerySelector(username) {
20
+ static getUserQuerySelector(username: string): UserSelector {
7
21
  // if the username is an email address, use the email field
8
22
  if (username.indexOf('@') > -1) {
9
23
  return { email: username };
@@ -12,16 +26,16 @@ class AuthService {
12
26
  }
13
27
  }
14
28
 
15
- static async authenticateUser(username, password) {
29
+ static async authenticateUser(username: string, password: string): Promise<User | null> {
16
30
  // Implement Meteor-specific login logic
17
31
  try {
18
32
  const selector = AuthService.getUserQuerySelector(username);
19
- return new Promise((resolve, reject) => {
33
+ return new Promise<User | null>((resolve, reject) => {
20
34
  Meteor.loginWithPassword(selector, password, (error) => {
21
35
  if (error) {
22
36
  reject(error);
23
37
  } else {
24
- resolve(Meteor.user());
38
+ resolve(toUser(Meteor.user()));
25
39
  }
26
40
  });
27
41
  });
@@ -32,17 +46,17 @@ class AuthService {
32
46
  }
33
47
  }
34
48
 
35
- static async authenticateToken() {
49
+ static async authenticateToken(): Promise<User | null> {
36
50
  // Implement token validation logic using Meteor
37
51
  try {
38
- return new Promise((resolve, reject) => {
52
+ return new Promise<User | null>((resolve, reject) => {
39
53
  const token = localStorage.getItem('Meteor.loginToken');
40
54
  if (token) {
41
55
  Meteor.loginWithToken(token, (error) => {
42
56
  if (error) {
43
57
  reject(error);
44
58
  }
45
- resolve(Meteor.user());
59
+ resolve(toUser(Meteor.user()));
46
60
  })
47
61
  }
48
62
  resolve(null);
@@ -53,10 +67,10 @@ class AuthService {
53
67
  }
54
68
  }
55
69
 
56
- static async getUserAuthorizations(userId) {
70
+ static async getUserAuthorizations(userId: string): Promise<string[]> {
57
71
  // Implement logic to fetch user permissions from Meteor
58
72
  try {
59
- return new Promise((resolve) => {
73
+ return new Promise<string[]>((resolve) => {
60
74
  const roles = Roles.getRolesForUser(userId);
61
75
  resolve(roles);
62
76
  });
@@ -66,10 +80,10 @@ class AuthService {
66
80
  }
67
81
  }
68
82
 
69
- static async deauthenticateUser() {
83
+ static async deauthenticateUser(): Promise<boolean> {
70
84
  // Implement logout logic using Meteor
71
85
  try {
72
- return new Promise((resolve, reject) => {
86
+ return new Promise<boolean>((resolve, reject) => {
73
87
  Meteor.logout((error) => {
74
88
  if (error) {
75
89
  reject(error);
@@ -79,27 +93,28 @@ class AuthService {
79
93
  });
80
94
  } catch (error) {
81
95
  console.error('Logout failed:', error);
96
+ return false;
82
97
  }
83
98
  }
84
99
 
85
- static async registerNewUser(username: string, password: string) {
100
+ static async registerNewUser(username: string, password: string): Promise<User | null> {
86
101
  try {
87
102
  const selector = AuthService.getUserQuerySelector(username);
88
- selector.password = password;
89
103
 
90
104
  // Implement user registration logic using Meteor
91
- const user = await Accounts.createUserAsync(selector);
92
- return user;
105
+ // createUserAsync returns the new user's id and logs them in
106
+ await Accounts.createUserAsync({ ...selector, password });
107
+ return toUser(Meteor.user());
93
108
  } catch (error) {
94
109
  console.error('Registration failed:', error);
95
110
  throw error;
96
111
  }
97
112
  }
98
113
 
99
- static async sendForgotPasswordEmail(email: string) {
114
+ static async sendForgotPasswordEmail(email: string): Promise<boolean> {
100
115
  try {
101
116
  // Implement password reset logic using Meteor
102
- return new Promise ((resolve, reject) => {
117
+ return new Promise<boolean>((resolve, reject) => {
103
118
  Accounts.forgotPassword({ email }, (error) => {
104
119
  if (error) {
105
120
  reject(error);
@@ -114,18 +129,20 @@ class AuthService {
114
129
  }
115
130
  }
116
131
 
117
- static async resetPasswordWithToken(token: string, password: string) {
132
+ static async resetPasswordWithToken(token: string, password: string): Promise<User | null> {
118
133
  try {
119
134
  // Implement password reset logic using Meteor
120
- return new Promise ((resolve, reject) => {
135
+ await new Promise<void>((resolve, reject) => {
121
136
  Accounts.resetPassword(token, password, (error) => {
122
137
  if (error) {
123
138
  reject(error);
124
139
  } else {
125
- resolve(true);
140
+ resolve();
126
141
  }
127
142
  });
128
143
  });
144
+ // resetPassword logs the user in on success
145
+ return toUser(Meteor.user());
129
146
  } catch (error) {
130
147
  console.error('Password reset failed:', error);
131
148
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maka/maka-cli",
3
- "version": "5.3.14",
3
+ "version": "5.3.16",
4
4
  "type": "module",
5
5
  "summary": "A command line tool for scaffolding Meteor 2.x applications using either React.",
6
6
  "description": "A command line tool for scaffolding Meteor 2.x applications using React.",