@aeriajs/builtins 0.0.226 → 0.0.227

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.
@@ -12,7 +12,7 @@ export declare const activate: (payload: {
12
12
  password?: string;
13
13
  userId?: string;
14
14
  token?: string;
15
- }, context: Context<typeof description>) => Promise<import("@aeriajs/types").GenericResponse | Result.Error<{
15
+ }, context: Context<typeof description>) => Promise<Result.Error<{
16
16
  readonly code: ActivationError.InvalidLink;
17
17
  } & {
18
18
  httpStatus: HTTPStatus.NotFound;
@@ -47,11 +47,12 @@ const activate = async (payload, context) => {
47
47
  }
48
48
  if (!user.password) {
49
49
  if (!password) {
50
- if (context.request.method === 'GET') {
51
- return context.response.writeHead(302, {
52
- location: `/user/activation?step=password&u=${userId}&t=${token}`,
53
- }).end();
54
- }
50
+ // if( context.request.method === 'GET' ) {
51
+ // return context.response.writeHead(302, {
52
+ // location: `/user/activation?step=password&u=${userId}&t=${token}`,
53
+ // }).end()
54
+ // }
55
+ //
55
56
  return context.error(types_1.HTTPStatus.UnprocessableContent, {
56
57
  code: types_1.ACError.MalformedInput,
57
58
  });
@@ -73,11 +74,12 @@ const activate = async (payload, context) => {
73
74
  active: true,
74
75
  },
75
76
  });
76
- if (context.request.method === 'GET') {
77
- return context.response.writeHead(302, {
78
- location: '/user/activation',
79
- }).end();
80
- }
77
+ // if( context.request.method === 'GET' ) {
78
+ // return context.response.writeHead(302, {
79
+ // location: '/user/activation',
80
+ // }).end()
81
+ // }
82
+ //
81
83
  return types_1.Result.result({
82
84
  userId: user._id,
83
85
  });
@@ -49,11 +49,6 @@ export const activate = async (payload, context) => {
49
49
  }
50
50
  if (!user.password) {
51
51
  if (!password) {
52
- if (context.request.method === "GET") {
53
- return context.response.writeHead(302, {
54
- location: `/user/activation?step=password&u=${userId}&t=${token}`
55
- }).end();
56
- }
57
52
  return context.error(HTTPStatus.UnprocessableContent, {
58
53
  code: ACError.MalformedInput
59
54
  });
@@ -81,11 +76,6 @@ export const activate = async (payload, context) => {
81
76
  }
82
77
  }
83
78
  );
84
- if (context.request.method === "GET") {
85
- return context.response.writeHead(302, {
86
- location: "/user/activation"
87
- }).end();
88
- }
89
79
  return Result.result({
90
80
  userId: user._id
91
81
  });
@@ -23,6 +23,7 @@ const authenticate = async (props, context) => {
23
23
  const { error, result: user } = await context.collections.user.functions.get({
24
24
  filters: {
25
25
  _id: decodedToken.sub,
26
+ active: true,
26
27
  },
27
28
  populate: ['picture_file'],
28
29
  });
@@ -18,7 +18,8 @@ export const authenticate = async (props, context) => {
18
18
  }
19
19
  const { error, result: user2 } = await context.collections.user.functions.get({
20
20
  filters: {
21
- _id: decodedToken.sub
21
+ _id: decodedToken.sub,
22
+ active: true
22
23
  },
23
24
  populate: ["picture_file"]
24
25
  });
@@ -504,7 +504,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
504
504
  password?: string;
505
505
  userId?: string;
506
506
  token?: string;
507
- }, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Result.Error<{
507
+ }, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
508
508
  readonly code: import("./activate.js").ActivationError.InvalidLink;
509
509
  } & {
510
510
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
package/dist/index.d.ts CHANGED
@@ -968,7 +968,7 @@ export declare const collections: {
968
968
  password?: string;
969
969
  userId?: string;
970
970
  token?: string;
971
- }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Result.Error<{
971
+ }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
972
972
  readonly code: import("./collections/user/activate.js").ActivationError.InvalidLink;
973
973
  } & {
974
974
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.226",
3
+ "version": "0.0.227",
4
4
  "description": "## Installation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -55,7 +55,7 @@
55
55
  "mongodb": "^6.5.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@aeriajs/core": "^0.0.226",
58
+ "@aeriajs/core": "^0.0.227",
59
59
  "@aeriajs/common": "^0.0.130",
60
60
  "@aeriajs/entrypoint": "^0.0.133",
61
61
  "@aeriajs/types": "^0.0.112",