@aeriajs/builtins 0.0.136 → 0.0.137

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.
@@ -4,6 +4,7 @@ exports.authenticate = void 0;
4
4
  const types_1 = require("@aeriajs/types");
5
5
  const bcrypt_1 = require("bcrypt");
6
6
  const core_1 = require("@aeriajs/core");
7
+ const common_1 = require("@aeriajs/common");
7
8
  const authentication_js_1 = require("../../authentication.js");
8
9
  const authenticate = async (props, context) => {
9
10
  if ('revalidate' in props) {
@@ -43,7 +44,6 @@ const authenticate = async (props, context) => {
43
44
  email: props.email,
44
45
  }, {
45
46
  projection: {
46
- email: 1,
47
47
  password: 1,
48
48
  active: 1,
49
49
  },
@@ -58,6 +58,12 @@ const authenticate = async (props, context) => {
58
58
  code: authentication_js_1.AuthenticationError.InactiveUser,
59
59
  });
60
60
  }
61
- return types_1.Result.result(await (0, authentication_js_1.successfulAuthentication)(user, context));
61
+ const completeUser = (0, common_1.throwIfError)(await (0, core_1.get)({
62
+ filters: {
63
+ _id: user._id,
64
+ },
65
+ populate: ['picture_file'],
66
+ }, context));
67
+ return types_1.Result.result(await (0, authentication_js_1.successfulAuthentication)(completeUser, context));
62
68
  };
63
69
  exports.authenticate = authenticate;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  import { Result, HTTPStatus, ACError } from "@aeriajs/types";
3
3
  import { compare as bcryptCompare } from "bcrypt";
4
- import { decodeToken } from "@aeriajs/core";
4
+ import { decodeToken, get } from "@aeriajs/core";
5
+ import { throwIfError } from "@aeriajs/common";
5
6
  import { successfulAuthentication, defaultSuccessfulAuthentication, AuthenticationError } from "../../authentication.mjs";
6
7
  export const authenticate = async (props, context) => {
7
8
  if ("revalidate" in props) {
@@ -39,7 +40,6 @@ export const authenticate = async (props, context) => {
39
40
  },
40
41
  {
41
42
  projection: {
42
- email: 1,
43
43
  password: 1,
44
44
  active: 1
45
45
  }
@@ -55,5 +55,11 @@ export const authenticate = async (props, context) => {
55
55
  code: AuthenticationError.InactiveUser
56
56
  });
57
57
  }
58
- return Result.result(await successfulAuthentication(user, context));
58
+ const completeUser = throwIfError(await get({
59
+ filters: {
60
+ _id: user._id
61
+ },
62
+ populate: ["picture_file"]
63
+ }, context));
64
+ return Result.result(await successfulAuthentication(completeUser, context));
59
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.136",
3
+ "version": "0.0.137",
4
4
  "description": "## Installation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -45,11 +45,11 @@
45
45
  "mongodb": "^6.5.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@aeriajs/core": "^0.0.136",
49
- "@aeriajs/common": "^0.0.85",
50
- "@aeriajs/entrypoint": "^0.0.87",
51
- "@aeriajs/types": "^0.0.73",
52
- "@aeriajs/validation": "^0.0.88"
48
+ "@aeriajs/core": "^0.0.137",
49
+ "@aeriajs/common": "^0.0.86",
50
+ "@aeriajs/entrypoint": "^0.0.88",
51
+ "@aeriajs/types": "^0.0.74",
52
+ "@aeriajs/validation": "^0.0.89"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "echo skipping",