@aeriajs/builtins 0.0.230 → 0.0.232

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.
Files changed (35) hide show
  1. package/dist/authentication.d.ts +4 -4
  2. package/dist/authentication.js +4 -5
  3. package/dist/authentication.mjs +4 -5
  4. package/dist/collections/file/download.d.ts +7 -8
  5. package/dist/collections/file/download.js +4 -5
  6. package/dist/collections/file/download.mjs +4 -5
  7. package/dist/collections/file/index.d.ts +18 -18
  8. package/dist/collections/file/remove.d.ts +12 -12
  9. package/dist/collections/file/removeAll.d.ts +2 -2
  10. package/dist/collections/user/activate.d.ts +17 -17
  11. package/dist/collections/user/activate.js +10 -11
  12. package/dist/collections/user/activate.mjs +10 -11
  13. package/dist/collections/user/authenticate.d.ts +7 -8
  14. package/dist/collections/user/createAccount.d.ts +9 -10
  15. package/dist/collections/user/createAccount.js +5 -6
  16. package/dist/collections/user/createAccount.mjs +5 -6
  17. package/dist/collections/user/editProfile.d.ts +3 -3
  18. package/dist/collections/user/getActivationLink.d.ts +13 -14
  19. package/dist/collections/user/getCurrentUser.d.ts +5 -5
  20. package/dist/collections/user/getCurrentUser.js +5 -6
  21. package/dist/collections/user/getCurrentUser.mjs +5 -6
  22. package/dist/collections/user/getInfo.d.ts +13 -13
  23. package/dist/collections/user/getInfo.js +9 -10
  24. package/dist/collections/user/getInfo.mjs +9 -10
  25. package/dist/collections/user/getRedefinePasswordLink.d.ts +11 -12
  26. package/dist/collections/user/index.d.ts +79 -79
  27. package/dist/collections/user/insert.d.ts +9 -10
  28. package/dist/collections/user/insert.js +21 -19
  29. package/dist/collections/user/insert.mjs +21 -19
  30. package/dist/collections/user/redefinePassword.d.ts +17 -17
  31. package/dist/collections/user/redefinePassword.js +10 -11
  32. package/dist/collections/user/redefinePassword.mjs +10 -11
  33. package/dist/functions/describe.d.ts +9 -9
  34. package/dist/index.d.ts +97 -97
  35. package/package.json +17 -17
@@ -2,13 +2,12 @@
2
2
  import { decodeToken, ObjectId } from "@aeriajs/core";
3
3
  import { Result, ACError, HTTPStatus } from "@aeriajs/types";
4
4
  import * as bcrypt from "bcrypt";
5
- export var ActivationError = /* @__PURE__ */ ((ActivationError2) => {
6
- ActivationError2["UserNotFound"] = "USER_NOT_FOUND";
7
- ActivationError2["UserNotActive"] = "USER_NOT_ACTIVE";
8
- ActivationError2["InvalidLink"] = "INVALID_LINK";
9
- ActivationError2["InvalidToken"] = "INVALID_TOKEN";
10
- return ActivationError2;
11
- })(ActivationError || {});
5
+ export const ActivationError = {
6
+ UserNotFound: "USER_NOT_FOUND",
7
+ UserNotActive: "USER_NOT_ACTIVE",
8
+ InvalidLink: "INVALID_LINK",
9
+ InvalidToken: "INVALID_TOKEN"
10
+ };
12
11
  export const redefinePassword = async (payload, context) => {
13
12
  const {
14
13
  userId,
@@ -20,7 +19,7 @@ export const redefinePassword = async (payload, context) => {
20
19
  }
21
20
  if (!userId || !token) {
22
21
  return context.error(HTTPStatus.NotFound, {
23
- code: "INVALID_LINK" /* InvalidLink */
22
+ code: ActivationError.InvalidLink
24
23
  });
25
24
  }
26
25
  const user = await context.collection.model.findOne({
@@ -33,18 +32,18 @@ export const redefinePassword = async (payload, context) => {
33
32
  });
34
33
  if (!user) {
35
34
  return context.error(HTTPStatus.NotFound, {
36
- code: "USER_NOT_FOUND" /* UserNotFound */
35
+ code: ActivationError.UserNotFound
37
36
  });
38
37
  }
39
38
  if (!user.active) {
40
39
  return context.error(HTTPStatus.Forbidden, {
41
- code: "USER_NOT_ACTIVE" /* UserNotActive */
40
+ code: ActivationError.UserNotActive
42
41
  });
43
42
  }
44
43
  const decoded = await decodeToken(token, context.config.secret);
45
44
  if (!decoded) {
46
45
  return context.error(HTTPStatus.Unauthorized, {
47
- code: "INVALID_TOKEN" /* InvalidToken */
46
+ code: ActivationError.InvalidToken
48
47
  });
49
48
  }
50
49
  if (!password) {
@@ -1,5 +1,5 @@
1
1
  import type { Description, RouteContext, RolesHierarchy, UserRole } from '@aeriajs/types';
2
- import { Result, ACError, HTTPStatus } from '@aeriajs/types';
2
+ import { Result } from '@aeriajs/types';
3
3
  import { authenticate } from '../collections/user/authenticate.js';
4
4
  declare const Payload: Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
5
5
  readonly collections: {
@@ -30,25 +30,25 @@ declare const Payload: Partial<{} & Omit<Readonly<import("@aeriajs/types").Filte
30
30
  export declare const describe: (contextOrPayload: RouteContext | typeof Payload) => Promise<import("@aeriajs/types").GenericResponse | {
31
31
  readonly _tag: "Error";
32
32
  readonly error: {
33
- readonly httpStatus: HTTPStatus.UnprocessableContent;
34
- readonly code: ACError.MalformedInput;
33
+ readonly httpStatus: 422;
34
+ readonly code: "MALFORMED_INPUT";
35
35
  readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
36
36
  };
37
37
  readonly result: undefined;
38
38
  } | {
39
39
  readonly _tag: "Error";
40
40
  readonly error: ({
41
- readonly code: ACError.AuthorizationError;
41
+ readonly code: "AUTHORIZATION_ERROR";
42
42
  } & {
43
- httpStatus: HTTPStatus.Unauthorized;
43
+ httpStatus: 401;
44
44
  }) | ({
45
- readonly code: import("../authentication.js").AuthenticationError.InvalidCredentials;
45
+ readonly code: "INVALID_CREDENTIALS";
46
46
  } & {
47
- httpStatus: HTTPStatus.Unauthorized;
47
+ httpStatus: 401;
48
48
  }) | ({
49
- readonly code: import("../authentication.js").AuthenticationError.InactiveUser;
49
+ readonly code: "INACTIVE_USER";
50
50
  } & {
51
- httpStatus: HTTPStatus.Unauthorized;
51
+ httpStatus: 401;
52
52
  });
53
53
  readonly result: undefined;
54
54
  } | {
package/dist/index.d.ts CHANGED
@@ -174,34 +174,34 @@ export declare const collections: {
174
174
  options: readonly ("picture" | "download")[];
175
175
  noHeaders?: boolean;
176
176
  }, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
177
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
177
+ readonly code: "RESOURCE_NOT_FOUND";
178
178
  } & {
179
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
179
+ httpStatus: 404;
180
180
  }> | import("@aeriajs/types").Result.Error<{
181
- readonly code: import("./collections/file/download.js").DownloadError;
181
+ readonly code: "RANGE_NOT_SATISFIABLE";
182
182
  } & {
183
- httpStatus: import("@aeriajs/types").HTTPStatus.RangeNotSatisfiable;
183
+ httpStatus: 416;
184
184
  }> | import("fs").ReadStream>;
185
185
  remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
186
186
  readonly _tag: "Result";
187
187
  readonly error: undefined;
188
188
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
189
189
  } | import("@aeriajs/types").Result.Error<{
190
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
190
+ readonly code: "RESOURCE_NOT_FOUND";
191
191
  } & {
192
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
192
+ httpStatus: 404;
193
193
  }> | import("@aeriajs/types").Result.Error<{
194
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
194
+ readonly code: "OWNERSHIP_ERROR";
195
195
  } & {
196
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
196
+ httpStatus: 403;
197
197
  }> | {
198
198
  readonly _tag: "Error";
199
199
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
200
200
  readonly httpStatus: {
201
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
201
+ readonly enum: [403, 404, 400];
202
202
  };
203
203
  readonly code: {
204
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
204
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
205
205
  };
206
206
  readonly message: {
207
207
  readonly type: "string";
@@ -211,16 +211,16 @@ export declare const collections: {
211
211
  readonly additionalProperties: true;
212
212
  };
213
213
  }>> & {
214
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
215
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
214
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
215
+ httpStatus: 403 | 400 | 404;
216
216
  message: string;
217
217
  details: any;
218
218
  }, never>, "code" | "httpStatus"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
219
219
  readonly httpStatus: {
220
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
220
+ readonly enum: [403, 404, 400];
221
221
  };
222
222
  readonly code: {
223
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
223
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
224
224
  };
225
225
  readonly message: {
226
226
  readonly type: "string";
@@ -230,8 +230,8 @@ export declare const collections: {
230
230
  readonly additionalProperties: true;
231
231
  };
232
232
  }>> & {
233
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
234
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
233
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
234
+ httpStatus: 403 | 400 | 404;
235
235
  message: string;
236
236
  details: any;
237
237
  }, never>>;
@@ -242,9 +242,9 @@ export declare const collections: {
242
242
  readonly error: undefined;
243
243
  readonly result: import("mongodb").DeleteResult;
244
244
  } | import("@aeriajs/types").Result.Error<{
245
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
245
+ readonly code: "OWNERSHIP_ERROR";
246
246
  } & {
247
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
247
+ httpStatus: 403;
248
248
  }>>;
249
249
  };
250
250
  contracts: {
@@ -682,19 +682,19 @@ export declare const collections: {
682
682
  readonly error: undefined;
683
683
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
684
684
  } | import("@aeriajs/types").Result.Error<{
685
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
685
+ readonly code: "RESOURCE_NOT_FOUND";
686
686
  } & {
687
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
687
+ httpStatus: 404;
688
688
  }> | import("@aeriajs/types").Result.Error<{
689
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
689
+ readonly code: "OWNERSHIP_ERROR";
690
690
  } & {
691
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
691
+ httpStatus: 403;
692
692
  }>>;
693
693
  readonly upload: (payload: unknown, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
694
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
694
+ readonly code: "MALFORMED_INPUT";
695
695
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
696
696
  } & {
697
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
697
+ httpStatus: 400;
698
698
  }> | {
699
699
  readonly _tag: "Result";
700
700
  readonly error: undefined;
@@ -707,29 +707,29 @@ export declare const collections: {
707
707
  readonly error: undefined;
708
708
  readonly result: any;
709
709
  } | import("@aeriajs/types").Result.Error<{
710
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
710
+ readonly code: "OWNERSHIP_ERROR";
711
711
  } & {
712
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
712
+ httpStatus: 403;
713
713
  }>>;
714
714
  readonly insert: (payload: NoInfer<import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>>, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
715
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
715
+ readonly code: "AUTHORIZATION_ERROR";
716
716
  readonly message: "user is not allowed to edit other users roles";
717
717
  } & {
718
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
718
+ httpStatus: 403;
719
719
  }> | import("@aeriajs/types").Result.Error<{
720
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
720
+ readonly code: "AUTHORIZATION_ERROR";
721
721
  readonly message: "tried to set unallowed roles";
722
722
  } & {
723
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
723
+ httpStatus: 403;
724
724
  }> | import("@aeriajs/types").Result.Error<{
725
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
725
+ readonly code: "RESOURCE_NOT_FOUND";
726
726
  } & {
727
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
727
+ httpStatus: 404;
728
728
  }> | import("@aeriajs/types").Result.Error<{
729
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
730
- readonly message: "tried to edit an user with a roler higher in the hierarchy";
729
+ readonly code: "AUTHORIZATION_ERROR";
730
+ readonly message: "tried to edit an user with a role higher in the hierarchy";
731
731
  } & {
732
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
732
+ httpStatus: 403;
733
733
  }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>>;
734
734
  readonly editProfile: (payload: Partial<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
735
735
  readonly $id: "user";
@@ -940,9 +940,9 @@ export declare const collections: {
940
940
  };
941
941
  };
942
942
  }>> | import("@aeriajs/types").Result.Error<{
943
- readonly code: import("@aeriajs/types").ACError.TargetImmutable;
943
+ readonly code: "TARGET_IMMUTABLE";
944
944
  } & {
945
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
945
+ httpStatus: 403;
946
946
  }>>;
947
947
  readonly authenticate: (payload: {
948
948
  email: string;
@@ -951,9 +951,9 @@ export declare const collections: {
951
951
  token?: import("@aeriajs/types").TokenRecipient;
952
952
  revalidate: true;
953
953
  }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
954
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
954
+ readonly code: "AUTHORIZATION_ERROR";
955
955
  } & {
956
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
956
+ httpStatus: 401;
957
957
  }> | {
958
958
  readonly _tag: "Result";
959
959
  readonly error: undefined;
@@ -975,38 +975,38 @@ export declare const collections: {
975
975
  readonly error: undefined;
976
976
  readonly result: import("./authentication.js").SuccessfulAuthentication;
977
977
  } | import("@aeriajs/types").Result.Error<{
978
- readonly code: import("./authentication.js").AuthenticationError.InvalidCredentials;
978
+ readonly code: "INVALID_CREDENTIALS";
979
979
  } & {
980
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
980
+ httpStatus: 401;
981
981
  }> | import("@aeriajs/types").Result.Error<{
982
- readonly code: import("./authentication.js").AuthenticationError.InactiveUser;
982
+ readonly code: "INACTIVE_USER";
983
983
  } & {
984
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
984
+ httpStatus: 401;
985
985
  }>>;
986
986
  readonly activate: (payload: {
987
987
  password?: string;
988
988
  userId?: string;
989
989
  token?: string;
990
990
  }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
991
- readonly code: import("./collections/user/activate.js").ActivationError.InvalidLink;
991
+ readonly code: "INVALID_LINK";
992
992
  } & {
993
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
993
+ httpStatus: 404;
994
994
  }> | import("@aeriajs/types").Result.Error<{
995
- readonly code: import("./collections/user/activate.js").ActivationError.UserNotFound;
995
+ readonly code: "USER_NOT_FOUND";
996
996
  } & {
997
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
997
+ httpStatus: 404;
998
998
  }> | import("@aeriajs/types").Result.Error<{
999
- readonly code: import("./collections/user/activate.js").ActivationError.AlreadyActiveUser;
999
+ readonly code: "ALREADY_ACTIVE_USER";
1000
1000
  } & {
1001
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1001
+ httpStatus: 403;
1002
1002
  }> | import("@aeriajs/types").Result.Error<{
1003
- readonly code: import("./collections/user/activate.js").ActivationError.InvalidToken;
1003
+ readonly code: "INVALID_TOKEN";
1004
1004
  } & {
1005
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
1005
+ httpStatus: 401;
1006
1006
  }> | import("@aeriajs/types").Result.Error<{
1007
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
1007
+ readonly code: "MALFORMED_INPUT";
1008
1008
  } & {
1009
- httpStatus: import("@aeriajs/types").HTTPStatus.UnprocessableContent;
1009
+ httpStatus: 422;
1010
1010
  }> | {
1011
1011
  readonly _tag: "Result";
1012
1012
  readonly error: undefined;
@@ -1119,18 +1119,18 @@ export declare const collections: {
1119
1119
  };
1120
1120
  };
1121
1121
  }>>> & Record<string, unknown>, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
1122
- readonly code: import("./collections/user/createAccount.js").CreateAccountError;
1122
+ readonly code: "SIGNUP_DISALLOWED";
1123
1123
  } & {
1124
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1124
+ httpStatus: 403;
1125
1125
  }> | import("@aeriajs/types").Result.Error<{
1126
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
1126
+ readonly code: "MALFORMED_INPUT";
1127
1127
  readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
1128
1128
  } & {
1129
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
1129
+ httpStatus: 400;
1130
1130
  }> | import("@aeriajs/types").Result.Error<{
1131
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
1131
+ readonly code: "OWNERSHIP_ERROR";
1132
1132
  } & {
1133
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1133
+ httpStatus: 403;
1134
1134
  }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
1135
1135
  readonly $id: "user";
1136
1136
  readonly icon: "users";
@@ -1240,17 +1240,17 @@ export declare const collections: {
1240
1240
  userId: string;
1241
1241
  token: string;
1242
1242
  }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
1243
- readonly code: import("./collections/user/getInfo.js").ActivationError.InvalidLink;
1243
+ readonly code: "INVALID_LINK";
1244
1244
  } & {
1245
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1245
+ httpStatus: 404;
1246
1246
  }> | import("@aeriajs/types").Result.Error<{
1247
- readonly code: import("./collections/user/getInfo.js").ActivationError.UserNotFound;
1247
+ readonly code: "USER_NOT_FOUND";
1248
1248
  } & {
1249
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1249
+ httpStatus: 404;
1250
1250
  }> | import("@aeriajs/types").Result.Error<{
1251
- readonly code: import("./collections/user/getInfo.js").ActivationError.InvalidToken;
1251
+ readonly code: "INVALID_TOKEN";
1252
1252
  } & {
1253
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
1253
+ httpStatus: 401;
1254
1254
  }> | {
1255
1255
  readonly _tag: "Result";
1256
1256
  readonly error: undefined;
@@ -1386,10 +1386,10 @@ export declare const collections: {
1386
1386
  readonly _tag: "Error";
1387
1387
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
1388
1388
  readonly httpStatus: {
1389
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
1389
+ readonly enum: [403, 404, 400];
1390
1390
  };
1391
1391
  readonly code: {
1392
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
1392
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
1393
1393
  };
1394
1394
  readonly message: {
1395
1395
  readonly type: "string";
@@ -1399,16 +1399,16 @@ export declare const collections: {
1399
1399
  readonly additionalProperties: true;
1400
1400
  };
1401
1401
  }>> & {
1402
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
1403
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
1402
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
1403
+ httpStatus: 403 | 400 | 404;
1404
1404
  message: string;
1405
1405
  details: any;
1406
1406
  }, never>, "code" | "httpStatus"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
1407
1407
  readonly httpStatus: {
1408
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
1408
+ readonly enum: [403, 404, 400];
1409
1409
  };
1410
1410
  readonly code: {
1411
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
1411
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
1412
1412
  };
1413
1413
  readonly message: {
1414
1414
  readonly type: "string";
@@ -1418,20 +1418,20 @@ export declare const collections: {
1418
1418
  readonly additionalProperties: true;
1419
1419
  };
1420
1420
  }>> & {
1421
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
1422
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
1421
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
1422
+ httpStatus: 403 | 400 | 404;
1423
1423
  message: string;
1424
1424
  details: any;
1425
1425
  }, never>>;
1426
1426
  readonly result: undefined;
1427
1427
  } | import("@aeriajs/types").Result.Error<{
1428
- readonly code: import("./collections/user/activate.js").ActivationError.InvalidLink;
1428
+ readonly code: "INVALID_LINK";
1429
1429
  } & {
1430
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
1430
+ httpStatus: 400;
1431
1431
  }> | import("@aeriajs/types").Result.Error<{
1432
- readonly code: import("./collections/user/activate.js").ActivationError.AlreadyActiveUser;
1432
+ readonly code: "ALREADY_ACTIVE_USER";
1433
1433
  } & {
1434
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1434
+ httpStatus: 403;
1435
1435
  }> | {
1436
1436
  readonly _tag: "Result";
1437
1437
  readonly error: undefined;
@@ -1446,10 +1446,10 @@ export declare const collections: {
1446
1446
  readonly _tag: "Error";
1447
1447
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
1448
1448
  readonly httpStatus: {
1449
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
1449
+ readonly enum: [403, 404, 400];
1450
1450
  };
1451
1451
  readonly code: {
1452
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
1452
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
1453
1453
  };
1454
1454
  readonly message: {
1455
1455
  readonly type: "string";
@@ -1459,16 +1459,16 @@ export declare const collections: {
1459
1459
  readonly additionalProperties: true;
1460
1460
  };
1461
1461
  }>> & {
1462
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
1463
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
1462
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
1463
+ httpStatus: 403 | 400 | 404;
1464
1464
  message: string;
1465
1465
  details: any;
1466
1466
  }, never>, "code" | "httpStatus"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
1467
1467
  readonly httpStatus: {
1468
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
1468
+ readonly enum: [403, 404, 400];
1469
1469
  };
1470
1470
  readonly code: {
1471
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
1471
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
1472
1472
  };
1473
1473
  readonly message: {
1474
1474
  readonly type: "string";
@@ -1478,16 +1478,16 @@ export declare const collections: {
1478
1478
  readonly additionalProperties: true;
1479
1479
  };
1480
1480
  }>> & {
1481
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
1482
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
1481
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
1482
+ httpStatus: 403 | 400 | 404;
1483
1483
  message: string;
1484
1484
  details: any;
1485
1485
  }, never>>;
1486
1486
  readonly result: undefined;
1487
1487
  } | import("@aeriajs/types").Result.Error<{
1488
- readonly code: import("./collections/user/redefinePassword.js").ActivationError.UserNotActive;
1488
+ readonly code: "USER_NOT_ACTIVE";
1489
1489
  } & {
1490
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1490
+ httpStatus: 403;
1491
1491
  }> | {
1492
1492
  readonly _tag: "Result";
1493
1493
  readonly error: undefined;
@@ -1500,25 +1500,25 @@ export declare const collections: {
1500
1500
  userId?: string;
1501
1501
  token?: string;
1502
1502
  }, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
1503
- readonly code: import("./collections/user/redefinePassword.js").ActivationError.InvalidLink;
1503
+ readonly code: "INVALID_LINK";
1504
1504
  } & {
1505
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1505
+ httpStatus: 404;
1506
1506
  }> | import("@aeriajs/types").Result.Error<{
1507
- readonly code: import("./collections/user/redefinePassword.js").ActivationError.UserNotFound;
1507
+ readonly code: "USER_NOT_FOUND";
1508
1508
  } & {
1509
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1509
+ httpStatus: 404;
1510
1510
  }> | import("@aeriajs/types").Result.Error<{
1511
- readonly code: import("./collections/user/redefinePassword.js").ActivationError.UserNotActive;
1511
+ readonly code: "USER_NOT_ACTIVE";
1512
1512
  } & {
1513
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1513
+ httpStatus: 403;
1514
1514
  }> | import("@aeriajs/types").Result.Error<{
1515
- readonly code: import("./collections/user/redefinePassword.js").ActivationError.InvalidToken;
1515
+ readonly code: "INVALID_TOKEN";
1516
1516
  } & {
1517
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
1517
+ httpStatus: 401;
1518
1518
  }> | import("@aeriajs/types").Result.Error<{
1519
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
1519
+ readonly code: "MALFORMED_INPUT";
1520
1520
  } & {
1521
- httpStatus: import("@aeriajs/types").HTTPStatus.UnprocessableContent;
1521
+ httpStatus: 422;
1522
1522
  }> | {
1523
1523
  readonly _tag: "Result";
1524
1524
  readonly error: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.230",
3
+ "version": "0.0.232",
4
4
  "description": "## Installation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -8,16 +8,6 @@
8
8
  "publishConfig": {
9
9
  "access": "public"
10
10
  },
11
- "scripts": {
12
- "test": "echo skipping",
13
- "lint": "eslint .",
14
- "lint:fix": "eslint . --fix",
15
- "build": "pnpm build:cjs && pnpm build:esm",
16
- "build:cjs": "tsc",
17
- "build:esm": "esbuild './src/**/*.ts' --outdir=dist --out-extension:.js=.mjs && pnpm build:esm-transform",
18
- "build:esm-transform": "pnpm -w esm-transform $PWD/dist",
19
- "write-icons": "pnpm -w write-icons"
20
- },
21
11
  "keywords": [],
22
12
  "author": "",
23
13
  "license": "ISC",
@@ -55,10 +45,20 @@
55
45
  "mongodb": "^6.5.0"
56
46
  },
57
47
  "peerDependencies": {
58
- "@aeriajs/core": "^0.0.230",
59
- "@aeriajs/common": "^0.0.131",
60
- "@aeriajs/entrypoint": "^0.0.134",
61
- "@aeriajs/types": "^0.0.113",
62
- "@aeriajs/validation": "^0.0.146"
48
+ "@aeriajs/core": "^0.0.232",
49
+ "@aeriajs/common": "^0.0.132",
50
+ "@aeriajs/entrypoint": "^0.0.136",
51
+ "@aeriajs/types": "^0.0.114",
52
+ "@aeriajs/validation": "^0.0.148"
53
+ },
54
+ "scripts": {
55
+ "test": "echo skipping",
56
+ "lint": "eslint .",
57
+ "lint:fix": "eslint . --fix",
58
+ "build": "pnpm build:cjs && pnpm build:esm",
59
+ "build:cjs": "tsc",
60
+ "build:esm": "esbuild './src/**/*.ts' --outdir=dist --out-extension:.js=.mjs && pnpm build:esm-transform",
61
+ "build:esm-transform": "pnpm -w esm-transform $PWD/dist",
62
+ "write-icons": "pnpm -w write-icons"
63
63
  }
64
- }
64
+ }