@aeriajs/builtins 0.0.219 → 0.0.220

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.
@@ -5,6 +5,7 @@ import { ActivationError } from './activate.js';
5
5
  export declare const getActivationToken: (strId: string, context: Context) => Promise<string>;
6
6
  export declare const getActivationLink: (payload: {
7
7
  userId: ObjectId | string;
8
+ redirect?: string;
8
9
  }, context: Context) => Promise<{
9
10
  readonly _tag: "Error";
10
11
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -59,6 +60,6 @@ export declare const getActivationLink: (payload: {
59
60
  readonly _tag: "Result";
60
61
  readonly error: undefined;
61
62
  readonly result: {
62
- readonly url: string;
63
+ readonly url: URL;
63
64
  };
64
65
  }>;
@@ -40,7 +40,14 @@ const getActivationLink = async (payload, context) => {
40
40
  });
41
41
  }
42
42
  const activationToken = await (0, exports.getActivationToken)(payload.userId.toString(), context);
43
- const url = `${context.config.webPublicUrl}/user/activation?step=password&u=${payload.userId.toString()}&t=${activationToken}`;
43
+ //const url = `${context.config.webPublicUrl}/user/activation?step=password&u=${payload.userId.toString()}&t=${activationToken}`
44
+ const url = new URL(`${context.config.webPublicUrl}/user/activation`);
45
+ url.searchParams.set("step", "password"),
46
+ url.searchParams.set("u", payload.userId.toString());
47
+ url.searchParams.set("t", activationToken);
48
+ if (payload.redirect) {
49
+ url.searchParams.set('next', payload.redirect);
50
+ }
44
51
  return types_1.Result.result({
45
52
  url,
46
53
  });
@@ -37,7 +37,12 @@ export const getActivationLink = async (payload, context) => {
37
37
  });
38
38
  }
39
39
  const activationToken = await getActivationToken(payload.userId.toString(), context);
40
- const url = `${context.config.webPublicUrl}/user/activation?step=password&u=${payload.userId.toString()}&t=${activationToken}`;
40
+ const url = new URL(`${context.config.webPublicUrl}/user/activation`);
41
+ url.searchParams.set("step", "password"), url.searchParams.set("u", payload.userId.toString());
42
+ url.searchParams.set("t", activationToken);
43
+ if (payload.redirect) {
44
+ url.searchParams.set("next", payload.redirect);
45
+ }
41
46
  return Result.result({
42
47
  url
43
48
  });
@@ -4,6 +4,7 @@ import { Result, HTTPStatus } from '@aeriajs/types';
4
4
  import { ActivationError } from './redefinePassword.js';
5
5
  export declare const getRedefinePasswordLink: (payload: {
6
6
  userId: ObjectId | string;
7
+ redirect?: string;
7
8
  }, context: Context) => Promise<{
8
9
  readonly _tag: "Error";
9
10
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -54,6 +55,6 @@ export declare const getRedefinePasswordLink: (payload: {
54
55
  readonly _tag: "Result";
55
56
  readonly error: undefined;
56
57
  readonly result: {
57
- readonly url: string;
58
+ readonly url: URL;
58
59
  };
59
60
  }>;
@@ -23,7 +23,13 @@ const getRedefinePasswordLink = async (payload, context) => {
23
23
  });
24
24
  }
25
25
  const redefineToken = await (0, getActivationLink_js_1.getActivationToken)(payload.userId.toString(), context);
26
- const url = `${context.config.webPublicUrl}/user/redefine-password?step=password&u=${payload.userId.toString()}&t=${redefineToken}`;
26
+ const url = new URL(`${context.config.webPublicUrl}/user/redefine-password`);
27
+ url.searchParams.set("step", "password"),
28
+ url.searchParams.set("u", payload.userId.toString());
29
+ url.searchParams.set("t", redefineToken);
30
+ if (payload.redirect) {
31
+ url.searchParams.set('next', payload.redirect);
32
+ }
27
33
  return types_1.Result.result({
28
34
  url,
29
35
  });
@@ -21,7 +21,12 @@ export const getRedefinePasswordLink = async (payload, context) => {
21
21
  });
22
22
  }
23
23
  const redefineToken = await getActivationToken(payload.userId.toString(), context);
24
- const url = `${context.config.webPublicUrl}/user/redefine-password?step=password&u=${payload.userId.toString()}&t=${redefineToken}`;
24
+ const url = new URL(`${context.config.webPublicUrl}/user/redefine-password`);
25
+ url.searchParams.set("step", "password"), url.searchParams.set("u", payload.userId.toString());
26
+ url.searchParams.set("t", redefineToken);
27
+ if (payload.redirect) {
28
+ url.searchParams.set("next", payload.redirect);
29
+ }
25
30
  return Result.result({
26
31
  url
27
32
  });
@@ -686,6 +686,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
686
686
  }>;
687
687
  readonly getActivationLink: (payload: {
688
688
  userId: import("@aeriajs/core").ObjectId | string;
689
+ redirect?: string;
689
690
  }, context: Omit<Context, "token">) => Promise<{
690
691
  readonly _tag: "Error";
691
692
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -740,11 +741,12 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
740
741
  readonly _tag: "Result";
741
742
  readonly error: undefined;
742
743
  readonly result: {
743
- readonly url: string;
744
+ readonly url: URL;
744
745
  };
745
746
  }>;
746
747
  readonly getRedefinePasswordLink: (payload: {
747
748
  userId: import("@aeriajs/core").ObjectId | string;
749
+ redirect?: string;
748
750
  }, context: Omit<Context, "token">) => Promise<{
749
751
  readonly _tag: "Error";
750
752
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -795,7 +797,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
795
797
  readonly _tag: "Result";
796
798
  readonly error: undefined;
797
799
  readonly result: {
798
- readonly url: string;
800
+ readonly url: URL;
799
801
  };
800
802
  }>;
801
803
  readonly redefinePassword: (payload: {
package/dist/index.d.ts CHANGED
@@ -1150,6 +1150,7 @@ export declare const collections: {
1150
1150
  }>;
1151
1151
  readonly getActivationLink: (payload: {
1152
1152
  userId: import("mongodb").ObjectId | string;
1153
+ redirect?: string;
1153
1154
  }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<{
1154
1155
  readonly _tag: "Error";
1155
1156
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -1204,11 +1205,12 @@ export declare const collections: {
1204
1205
  readonly _tag: "Result";
1205
1206
  readonly error: undefined;
1206
1207
  readonly result: {
1207
- readonly url: string;
1208
+ readonly url: URL;
1208
1209
  };
1209
1210
  }>;
1210
1211
  readonly getRedefinePasswordLink: (payload: {
1211
1212
  userId: import("mongodb").ObjectId | string;
1213
+ redirect?: string;
1212
1214
  }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<{
1213
1215
  readonly _tag: "Error";
1214
1216
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -1259,7 +1261,7 @@ export declare const collections: {
1259
1261
  readonly _tag: "Result";
1260
1262
  readonly error: undefined;
1261
1263
  readonly result: {
1262
- readonly url: string;
1264
+ readonly url: URL;
1263
1265
  };
1264
1266
  }>;
1265
1267
  readonly redefinePassword: (payload: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.219",
3
+ "version": "0.0.220",
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.219",
58
+ "@aeriajs/core": "^0.0.220",
59
59
  "@aeriajs/common": "^0.0.127",
60
60
  "@aeriajs/entrypoint": "^0.0.130",
61
61
  "@aeriajs/types": "^0.0.109",