@mindful-web/marko-web-identity-x 1.49.3 → 1.51.0

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.
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/access.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/access.marko",
6
6
  marko_component = require("./access.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -53,7 +53,7 @@ marko_template._ = marko_renderer(render, {
53
53
  }, marko_component);
54
54
 
55
55
  marko_template.meta = {
56
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/access.marko",
56
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/access.marko",
57
57
  component: "./access.marko",
58
58
  tags: [
59
59
  "@mindful-web/marko-core/components/resolve.marko"
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/comment-stream.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/comment-stream.marko",
6
6
  marko_component = require("./comment-stream.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -85,7 +85,7 @@ marko_template._ = marko_renderer(render, {
85
85
  }, marko_component);
86
86
 
87
87
  marko_template.meta = {
88
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/comment-stream.marko",
88
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/comment-stream.marko",
89
89
  component: "./comment-stream.marko",
90
90
  tags: [
91
91
  "@mindful-web/marko-web/components/browser-component.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/context.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/context.marko",
6
6
  marko_component = require("./context.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
@@ -49,7 +49,7 @@ marko_template._ = marko_renderer(render, {
49
49
  }, marko_component);
50
50
 
51
51
  marko_template.meta = {
52
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/context.marko",
52
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/context.marko",
53
53
  component: "./context.marko",
54
54
  tags: [
55
55
  "@mindful-web/marko-core/components/resolve.marko"
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-access.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-access.marko",
6
6
  marko_component = require("./form-access.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
@@ -146,7 +146,7 @@ marko_template._ = marko_renderer(render, {
146
146
  }, marko_component);
147
147
 
148
148
  marko_template.meta = {
149
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-access.marko",
149
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-access.marko",
150
150
  component: "./form-access.marko",
151
151
  tags: [
152
152
  "@mindful-web/marko-web/components/browser-component.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-authenticate.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-authenticate.marko",
6
6
  marko_component = require("./form-authenticate.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -68,7 +68,7 @@ marko_template._ = marko_renderer(render, {
68
68
  }, marko_component);
69
69
 
70
70
  marko_template.meta = {
71
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-authenticate.marko",
71
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-authenticate.marko",
72
72
  component: "./form-authenticate.marko",
73
73
  tags: [
74
74
  "@mindful-web/marko-web/components/browser-component.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-change-email.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-change-email.marko",
6
6
  marko_component = require("./form-change-email.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -59,7 +59,7 @@ marko_template._ = marko_renderer(render, {
59
59
  }, marko_component);
60
60
 
61
61
  marko_template.meta = {
62
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-change-email.marko",
62
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-change-email.marko",
63
63
  component: "./form-change-email.marko",
64
64
  tags: [
65
65
  "@mindful-web/marko-web/components/browser-component.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-login.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-login.marko",
6
6
  marko_component = require("./form-login.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -79,7 +79,7 @@ marko_template._ = marko_renderer(render, {
79
79
  }, marko_component);
80
80
 
81
81
  marko_template.meta = {
82
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-login.marko",
82
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-login.marko",
83
83
  component: "./form-login.marko",
84
84
  tags: [
85
85
  "@mindful-web/marko-web/components/browser-component.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-logout.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-logout.marko",
6
6
  marko_renderer = require("marko/dist/runtime/components/renderer"),
7
7
  module_defaultValue = require("@mindful-web/marko-core/utils/default-value"),
8
8
  defaultValue = module_defaultValue.default || module_defaultValue,
@@ -29,7 +29,7 @@ marko_template._ = marko_renderer(render, {
29
29
  });
30
30
 
31
31
  marko_template.meta = {
32
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-logout.marko",
32
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-logout.marko",
33
33
  tags: [
34
34
  "@mindful-web/marko-web/components/browser-component.marko"
35
35
  ]
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-profile.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-profile.marko",
6
6
  marko_component = require("./form-profile.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -81,7 +81,7 @@ marko_template._ = marko_renderer(render, {
81
81
  }, marko_component);
82
82
 
83
83
  marko_template.meta = {
84
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-profile.marko",
84
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-profile.marko",
85
85
  component: "./form-profile.marko",
86
86
  tags: [
87
87
  "@mindful-web/marko-web/components/browser-component.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/form-register.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/form-register.marko",
6
6
  marko_renderer = require("marko/dist/runtime/components/renderer"),
7
7
  marko_assign = require("marko/dist/runtime/helpers/assign"),
8
8
  marko_web_identity_x_form_login_template = require("./form-login.marko"),
@@ -25,7 +25,7 @@ marko_template._ = marko_renderer(render, {
25
25
  });
26
26
 
27
27
  marko_template.meta = {
28
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/form-register.marko",
28
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/form-register.marko",
29
29
  tags: [
30
30
  "./form-login.marko"
31
31
  ]
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/identify.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/identify.marko",
6
6
  marko_component = require("./identify.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -50,7 +50,7 @@ marko_template._ = marko_renderer(render, {
50
50
  }, marko_component);
51
51
 
52
52
  marko_template.meta = {
53
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/identify.marko",
53
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/identify.marko",
54
54
  component: "./identify.marko",
55
55
  tags: [
56
56
  "@mindful-web/marko-web-gtm/components/push.marko",
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/non-auth-identify.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/non-auth-identify.marko",
6
6
  marko_component = require("./non-auth-identify.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
@@ -45,7 +45,7 @@ marko_template._ = marko_renderer(render, {
45
45
  }, marko_component);
46
46
 
47
47
  marko_template.meta = {
48
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/non-auth-identify.marko",
48
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/non-auth-identify.marko",
49
49
  component: "./non-auth-identify.marko",
50
50
  tags: [
51
51
  "@mindful-web/marko-core/components/resolve.marko"
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
 
4
4
  var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
- marko_componentType = "/@mindful-web/marko-web-identity-x$1.49.3/components/subscribe.marko",
5
+ marko_componentType = "/@mindful-web/marko-web-identity-x$1.51.0/components/subscribe.marko",
6
6
  marko_component = require("./subscribe.marko"),
7
7
  marko_renderer = require("marko/dist/runtime/components/renderer"),
8
8
  module_objectPath_module = require("@mindful-web/object-path"),
@@ -73,7 +73,7 @@ marko_template._ = marko_renderer(render, {
73
73
  }, marko_component);
74
74
 
75
75
  marko_template.meta = {
76
- id: "/@mindful-web/marko-web-identity-x$1.49.3/components/subscribe.marko",
76
+ id: "/@mindful-web/marko-web-identity-x$1.51.0/components/subscribe.marko",
77
77
  component: "./subscribe.marko",
78
78
  tags: [
79
79
  "@mindful-web/marko-web/components/browser-component.marko",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindful-web/marko-web-identity-x",
3
- "version": "1.49.3",
3
+ "version": "1.51.0",
4
4
  "description": "Marko Wrapper for IdentityX",
5
5
  "repository": "https://github.com/parameter1/mindful-web/tree/main/packages/marko-web-identity-x",
6
6
  "author": "Josh Worden <josh@parameter1.com>",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "f52848de5e515a5744539387771f5726487ec386"
40
+ "gitHead": "d1bcf801429e0c82ea3138c42d6a2536e46df703"
41
41
  }
@@ -32,7 +32,11 @@ module.exports = asyncRoute(async (req, res) => {
32
32
 
33
33
  const input = { token };
34
34
  const variables = { input };
35
- const { data = {} } = await identityX.client.mutate({ mutation: loginAppUser, variables });
35
+ const { data = {} } = await identityX.client.mutate({
36
+ mutation: loginAppUser,
37
+ variables,
38
+ context: { apiToken: identityX.getOrgUserApiToken() },
39
+ });
36
40
  const { token: authToken, user, loginSource } = data.loginAppUser;
37
41
  const additionalEventData = {
38
42
  ...getAsObject(body, 'additionalEventData'),
@@ -32,7 +32,11 @@ module.exports = asyncRoute(async (req, res) => {
32
32
 
33
33
  const input = { token };
34
34
  const variables = { input };
35
- const { data = {} } = await identityX.client.mutate({ mutation, variables });
35
+ const { data = {} } = await identityX.client.mutate({
36
+ mutation,
37
+ variables,
38
+ context: { apiToken: identityX.getOrgUserApiToken() },
39
+ });
36
40
  const { token: authToken, user } = data.changeAppUserEmail;
37
41
 
38
42
  const decoded = await jwt.decode(token);
@@ -16,10 +16,10 @@ const query = gql`
16
16
  edges {
17
17
  node {
18
18
  id
19
- body
20
19
  approved
21
- flagged
20
+ body
22
21
  createdAt
22
+ flagged
23
23
  user {
24
24
  id
25
25
  displayName
@@ -29,7 +29,11 @@ module.exports = asyncRoute(async (req, res) => {
29
29
  .map((answer) => ({ policyId: answer.id, given: answer.given })),
30
30
  email,
31
31
  };
32
- await identityX.client.mutate({ mutation, variables: { input } });
32
+ await identityX.client.mutate({
33
+ mutation,
34
+ variables: { input },
35
+ context: { apiToken: identityX.getOrgUserApiToken() },
36
+ });
33
37
  const entity = await identityX.generateEntityId();
34
38
  return res.json({ ok: true, entity });
35
39
  });
package/routes/login.js CHANGED
@@ -63,6 +63,7 @@ module.exports = asyncRoute(async (req, res) => {
63
63
  await identityX.client.mutate({
64
64
  mutation: forceProfileReVerificationUser,
65
65
  variables: { input: { id } },
66
+ context: { apiToken: identityX.getOrgUserApiToken() },
66
67
  });
67
68
  }
68
69
 
@@ -77,7 +78,11 @@ module.exports = asyncRoute(async (req, res) => {
77
78
  .map((answer) => ({ policyId: answer.id, given: answer.given })),
78
79
  email,
79
80
  };
80
- await identityX.client.mutate({ mutation, variables: { input } });
81
+ await identityX.client.mutate({
82
+ mutation,
83
+ variables: { input },
84
+ context: { apiToken: identityX.getOrgUserApiToken() },
85
+ });
81
86
  }
82
87
 
83
88
  // Refresh the user for verification/new field state
package/service.js CHANGED
@@ -126,6 +126,15 @@ class IdentityX {
126
126
  this.setToken(tokenCookie.getFrom(req));
127
127
  }
128
128
 
129
+ /**
130
+ * @returns {string}
131
+ */
132
+ getOrgUserApiToken() {
133
+ const apiToken = this.config.getApiToken();
134
+ if (!apiToken) throw new Error('No API token has been configured.');
135
+ return apiToken;
136
+ }
137
+
129
138
  /**
130
139
  * Validates the email address with a user-supplied function, if present.
131
140
  * @param {String} email
@@ -166,6 +175,7 @@ class IdentityX {
166
175
  query: loadUser,
167
176
  variables: { email },
168
177
  fetchPolicy: 'no-cache',
178
+ context: { apiToken: this.getOrgUserApiToken() },
169
179
  });
170
180
  return data.appUser;
171
181
  }
@@ -276,15 +286,13 @@ class IdentityX {
276
286
  * @returns {Promise<User|null>}
277
287
  */
278
288
  async findUserByExternalId({ identifier, namespace }) {
279
- const apiToken = this.config.getApiToken();
280
- if (!apiToken) throw new Error('Unable to look up user: No API token has been configured.');
281
289
  const { data } = await this.client.query({
282
290
  query: appUserByExternalIdQuery,
283
291
  variables: {
284
292
  identifier: { value: identifier },
285
293
  namespace,
286
294
  },
287
- context: { apiToken },
295
+ context: { apiToken: this.getOrgUserApiToken() },
288
296
  });
289
297
  return data.appUserByExternalId;
290
298
  }
@@ -295,12 +303,10 @@ class IdentityX {
295
303
  * @returns {Promise<User|null>}
296
304
  */
297
305
  async findUserById(id) {
298
- const apiToken = this.config.getApiToken();
299
- if (!apiToken) throw new Error('Unable to retrieve identity: No API token has been configured.');
300
306
  const { data } = await this.client.query({
301
307
  query: appUserByIdQuery,
302
308
  variables: { id },
303
- context: { apiToken },
309
+ context: { apiToken: this.getOrgUserApiToken() },
304
310
  });
305
311
  return data.appUserById;
306
312
  }
@@ -316,13 +322,11 @@ class IdentityX {
316
322
  namespace = {},
317
323
  } = {}) {
318
324
  const input = { userId, identifier, namespace };
319
- const apiToken = this.config.getApiToken();
320
- if (!apiToken) throw new Error('Unable to add external ID: No API token has been configured.');
321
325
  const variables = { input };
322
326
  const { data } = await this.client.mutate({
323
327
  mutation: addExternalUserId,
324
328
  variables,
325
- context: { apiToken },
329
+ context: { apiToken: this.getOrgUserApiToken() },
326
330
  });
327
331
  return data.addAppUserExternalId;
328
332
  }
@@ -344,13 +348,11 @@ class IdentityX {
344
348
  }
345
349
 
346
350
  async impersonateAppUser({ userId }) {
347
- const apiToken = this.config.getApiToken();
348
- if (!apiToken) throw new Error('Unable to add external ID: No API token has been configured.');
349
351
  const variables = { input: { id: userId, verify: true } };
350
352
  const { data } = await this.client.mutate({
351
353
  mutation: impersonateAppUser,
352
354
  variables,
353
- context: { apiToken },
355
+ context: { apiToken: this.getOrgUserApiToken() },
354
356
  });
355
357
  const { token } = data.impersonateAppUser;
356
358
  tokenCookie.setTo(this.res, token.value);
@@ -382,6 +384,7 @@ class IdentityX {
382
384
  const { data } = await this.client.mutate({
383
385
  mutation: createAppUser,
384
386
  variables: { email },
387
+ context: { apiToken: this.getOrgUserApiToken() },
385
388
  });
386
389
  return data.createAppUser;
387
390
  }
@@ -449,6 +452,7 @@ class IdentityX {
449
452
  redirectTo,
450
453
  },
451
454
  },
455
+ context: { apiToken: this.getOrgUserApiToken() },
452
456
  });
453
457
  await callHooksFor(this, 'onLoginLinkSent', {
454
458
  ...(additionalEventData || {}),
@@ -466,8 +470,6 @@ class IdentityX {
466
470
  email,
467
471
  userId,
468
472
  }) {
469
- const apiToken = this.config.getApiToken();
470
- if (!apiToken) throw new Error('Unable to delete user: No API token has been configured.');
471
473
  const { data } = await this.client.mutate({
472
474
  mutation: deleteAppUserForCurrentApplicationMutation,
473
475
  variables: {
@@ -476,7 +478,7 @@ class IdentityX {
476
478
  ...(userId && { userId }),
477
479
  },
478
480
  },
479
- context: { apiToken },
481
+ context: { apiToken: this.getOrgUserApiToken() },
480
482
  });
481
483
  return data.deleteAppUserForCurrentApplication;
482
484
  }