@aeriajs/builtins 0.0.231 → 0.0.233

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 (36) 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 +10 -10
  15. package/dist/collections/user/createAccount.js +4 -5
  16. package/dist/collections/user/createAccount.mjs +4 -5
  17. package/dist/collections/user/description.d.ts +1 -0
  18. package/dist/collections/user/description.js +1 -0
  19. package/dist/collections/user/description.mjs +2 -1
  20. package/dist/collections/user/editProfile.d.ts +4 -3
  21. package/dist/collections/user/getActivationLink.d.ts +13 -14
  22. package/dist/collections/user/getCurrentUser.d.ts +6 -5
  23. package/dist/collections/user/getCurrentUser.js +5 -6
  24. package/dist/collections/user/getCurrentUser.mjs +5 -6
  25. package/dist/collections/user/getInfo.d.ts +13 -13
  26. package/dist/collections/user/getInfo.js +9 -10
  27. package/dist/collections/user/getInfo.mjs +9 -10
  28. package/dist/collections/user/getRedefinePasswordLink.d.ts +11 -12
  29. package/dist/collections/user/index.d.ts +85 -78
  30. package/dist/collections/user/insert.d.ts +8 -9
  31. package/dist/collections/user/redefinePassword.d.ts +17 -17
  32. package/dist/collections/user/redefinePassword.js +10 -11
  33. package/dist/collections/user/redefinePassword.mjs +10 -11
  34. package/dist/functions/describe.d.ts +9 -9
  35. package/dist/index.d.ts +103 -96
  36. package/package.json +15 -15
@@ -68,6 +68,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
68
68
  readonly picture: "picture_file";
69
69
  readonly information: "email";
70
70
  readonly active: "active";
71
+ readonly translateBadge: true;
71
72
  };
72
73
  };
73
74
  readonly individualActions: {
@@ -173,6 +174,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
173
174
  readonly picture: "picture_file";
174
175
  readonly information: "email";
175
176
  readonly active: "active";
177
+ readonly translateBadge: true;
176
178
  };
177
179
  };
178
180
  readonly individualActions: {
@@ -218,19 +220,19 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
218
220
  readonly error: undefined;
219
221
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
220
222
  } | import("@aeriajs/types").Result.Error<{
221
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
223
+ readonly code: "RESOURCE_NOT_FOUND";
222
224
  } & {
223
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
225
+ httpStatus: 404;
224
226
  }> | import("@aeriajs/types").Result.Error<{
225
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
227
+ readonly code: "OWNERSHIP_ERROR";
226
228
  } & {
227
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
229
+ httpStatus: 403;
228
230
  }>>;
229
231
  readonly upload: (payload: unknown, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
230
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
232
+ readonly code: "MALFORMED_INPUT";
231
233
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
232
234
  } & {
233
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
235
+ httpStatus: 400;
234
236
  }> | {
235
237
  readonly _tag: "Result";
236
238
  readonly error: undefined;
@@ -243,29 +245,29 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
243
245
  readonly error: undefined;
244
246
  readonly result: any;
245
247
  } | import("@aeriajs/types").Result.Error<{
246
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
248
+ readonly code: "OWNERSHIP_ERROR";
247
249
  } & {
248
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
250
+ httpStatus: 403;
249
251
  }>>;
250
252
  readonly insert: (payload: NoInfer<import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>>, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
251
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
253
+ readonly code: "AUTHORIZATION_ERROR";
252
254
  readonly message: "user is not allowed to edit other users roles";
253
255
  } & {
254
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
256
+ httpStatus: 403;
255
257
  }> | import("@aeriajs/types").Result.Error<{
256
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
258
+ readonly code: "AUTHORIZATION_ERROR";
257
259
  readonly message: "tried to set unallowed roles";
258
260
  } & {
259
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
261
+ httpStatus: 403;
260
262
  }> | import("@aeriajs/types").Result.Error<{
261
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
263
+ readonly code: "RESOURCE_NOT_FOUND";
262
264
  } & {
263
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
265
+ httpStatus: 404;
264
266
  }> | import("@aeriajs/types").Result.Error<{
265
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
267
+ readonly code: "AUTHORIZATION_ERROR";
266
268
  readonly message: "tried to edit an user with a role higher in the hierarchy";
267
269
  } & {
268
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
270
+ httpStatus: 403;
269
271
  }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>>;
270
272
  readonly editProfile: (payload: Partial<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<{
271
273
  readonly $id: "user";
@@ -335,6 +337,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
335
337
  readonly picture: "picture_file";
336
338
  readonly information: "email";
337
339
  readonly active: "active";
340
+ readonly translateBadge: true;
338
341
  };
339
342
  };
340
343
  readonly individualActions: {
@@ -439,6 +442,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
439
442
  readonly picture: "picture_file";
440
443
  readonly information: "email";
441
444
  readonly active: "active";
445
+ readonly translateBadge: true;
442
446
  };
443
447
  };
444
448
  readonly individualActions: {
@@ -476,9 +480,9 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
476
480
  };
477
481
  };
478
482
  }>> | import("@aeriajs/types").Result.Error<{
479
- readonly code: import("@aeriajs/types").ACError.TargetImmutable;
483
+ readonly code: "TARGET_IMMUTABLE";
480
484
  } & {
481
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
485
+ httpStatus: 403;
482
486
  }>>;
483
487
  readonly authenticate: (payload: {
484
488
  email: string;
@@ -487,9 +491,9 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
487
491
  token?: import("@aeriajs/types").TokenRecipient;
488
492
  revalidate: true;
489
493
  }, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
490
- readonly code: import("@aeriajs/types").ACError.AuthorizationError;
494
+ readonly code: "AUTHORIZATION_ERROR";
491
495
  } & {
492
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
496
+ httpStatus: 401;
493
497
  }> | {
494
498
  readonly _tag: "Result";
495
499
  readonly error: undefined;
@@ -511,38 +515,38 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
511
515
  readonly error: undefined;
512
516
  readonly result: import("../../authentication.js").SuccessfulAuthentication;
513
517
  } | import("@aeriajs/types").Result.Error<{
514
- readonly code: import("../../authentication.js").AuthenticationError.InvalidCredentials;
518
+ readonly code: "INVALID_CREDENTIALS";
515
519
  } & {
516
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
520
+ httpStatus: 401;
517
521
  }> | import("@aeriajs/types").Result.Error<{
518
- readonly code: import("../../authentication.js").AuthenticationError.InactiveUser;
522
+ readonly code: "INACTIVE_USER";
519
523
  } & {
520
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
524
+ httpStatus: 401;
521
525
  }>>;
522
526
  readonly activate: (payload: {
523
527
  password?: string;
524
528
  userId?: string;
525
529
  token?: string;
526
530
  }, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
527
- readonly code: import("./activate.js").ActivationError.InvalidLink;
531
+ readonly code: "INVALID_LINK";
528
532
  } & {
529
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
533
+ httpStatus: 404;
530
534
  }> | import("@aeriajs/types").Result.Error<{
531
- readonly code: import("./activate.js").ActivationError.UserNotFound;
535
+ readonly code: "USER_NOT_FOUND";
532
536
  } & {
533
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
537
+ httpStatus: 404;
534
538
  }> | import("@aeriajs/types").Result.Error<{
535
- readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
539
+ readonly code: "ALREADY_ACTIVE_USER";
536
540
  } & {
537
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
541
+ httpStatus: 403;
538
542
  }> | import("@aeriajs/types").Result.Error<{
539
- readonly code: import("./activate.js").ActivationError.InvalidToken;
543
+ readonly code: "INVALID_TOKEN";
540
544
  } & {
541
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
545
+ httpStatus: 401;
542
546
  }> | import("@aeriajs/types").Result.Error<{
543
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
547
+ readonly code: "MALFORMED_INPUT";
544
548
  } & {
545
- httpStatus: import("@aeriajs/types").HTTPStatus.UnprocessableContent;
549
+ httpStatus: 422;
546
550
  }> | {
547
551
  readonly _tag: "Result";
548
552
  readonly error: undefined;
@@ -618,6 +622,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
618
622
  readonly picture: "picture_file";
619
623
  readonly information: "email";
620
624
  readonly active: "active";
625
+ readonly translateBadge: true;
621
626
  };
622
627
  };
623
628
  readonly individualActions: {
@@ -655,18 +660,18 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
655
660
  };
656
661
  };
657
662
  }>>> & Record<string, unknown>, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
658
- readonly code: import("./createAccount.js").CreateAccountError;
663
+ readonly code: "SIGNUP_DISALLOWED";
659
664
  } & {
660
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
665
+ httpStatus: 403;
661
666
  }> | import("@aeriajs/types").Result.Error<{
662
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
667
+ readonly code: "MALFORMED_INPUT";
663
668
  readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
664
669
  } & {
665
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
670
+ httpStatus: 400;
666
671
  }> | import("@aeriajs/types").Result.Error<{
667
- readonly code: import("@aeriajs/types").ACError.OwnershipError;
672
+ readonly code: "OWNERSHIP_ERROR";
668
673
  } & {
669
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
674
+ httpStatus: 403;
670
675
  }> | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
671
676
  readonly $id: "user";
672
677
  readonly icon: "users";
@@ -735,6 +740,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
735
740
  readonly picture: "picture_file";
736
741
  readonly information: "email";
737
742
  readonly active: "active";
743
+ readonly translateBadge: true;
738
744
  };
739
745
  };
740
746
  readonly individualActions: {
@@ -776,17 +782,17 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
776
782
  userId: string;
777
783
  token: string;
778
784
  }, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
779
- readonly code: import("./getInfo.js").ActivationError.InvalidLink;
785
+ readonly code: "INVALID_LINK";
780
786
  } & {
781
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
787
+ httpStatus: 404;
782
788
  }> | import("@aeriajs/types").Result.Error<{
783
- readonly code: import("./getInfo.js").ActivationError.UserNotFound;
789
+ readonly code: "USER_NOT_FOUND";
784
790
  } & {
785
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
791
+ httpStatus: 404;
786
792
  }> | import("@aeriajs/types").Result.Error<{
787
- readonly code: import("./getInfo.js").ActivationError.InvalidToken;
793
+ readonly code: "INVALID_TOKEN";
788
794
  } & {
789
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
795
+ httpStatus: 401;
790
796
  }> | {
791
797
  readonly _tag: "Result";
792
798
  readonly error: undefined;
@@ -877,6 +883,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
877
883
  readonly picture: "picture_file";
878
884
  readonly information: "email";
879
885
  readonly active: "active";
886
+ readonly translateBadge: true;
880
887
  };
881
888
  };
882
889
  readonly individualActions: {
@@ -922,10 +929,10 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
922
929
  readonly _tag: "Error";
923
930
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
924
931
  readonly httpStatus: {
925
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
932
+ readonly enum: [403, 404, 400];
926
933
  };
927
934
  readonly code: {
928
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
935
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
929
936
  };
930
937
  readonly message: {
931
938
  readonly type: "string";
@@ -935,16 +942,16 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
935
942
  readonly additionalProperties: true;
936
943
  };
937
944
  }>> & {
938
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
939
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
945
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
946
+ httpStatus: 403 | 400 | 404;
940
947
  message: string;
941
948
  details: any;
942
949
  }, never>, "code" | "httpStatus"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
943
950
  readonly httpStatus: {
944
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
951
+ readonly enum: [403, 404, 400];
945
952
  };
946
953
  readonly code: {
947
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
954
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
948
955
  };
949
956
  readonly message: {
950
957
  readonly type: "string";
@@ -954,20 +961,20 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
954
961
  readonly additionalProperties: true;
955
962
  };
956
963
  }>> & {
957
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
958
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
964
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
965
+ httpStatus: 403 | 400 | 404;
959
966
  message: string;
960
967
  details: any;
961
968
  }, never>>;
962
969
  readonly result: undefined;
963
970
  } | import("@aeriajs/types").Result.Error<{
964
- readonly code: import("./activate.js").ActivationError.InvalidLink;
971
+ readonly code: "INVALID_LINK";
965
972
  } & {
966
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
973
+ httpStatus: 400;
967
974
  }> | import("@aeriajs/types").Result.Error<{
968
- readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
975
+ readonly code: "ALREADY_ACTIVE_USER";
969
976
  } & {
970
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
977
+ httpStatus: 403;
971
978
  }> | {
972
979
  readonly _tag: "Result";
973
980
  readonly error: undefined;
@@ -982,10 +989,10 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
982
989
  readonly _tag: "Error";
983
990
  readonly error: Pick<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
984
991
  readonly httpStatus: {
985
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
992
+ readonly enum: [403, 404, 400];
986
993
  };
987
994
  readonly code: {
988
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
995
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
989
996
  };
990
997
  readonly message: {
991
998
  readonly type: "string";
@@ -995,16 +1002,16 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
995
1002
  readonly additionalProperties: true;
996
1003
  };
997
1004
  }>> & {
998
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
999
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
1005
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
1006
+ httpStatus: 403 | 400 | 404;
1000
1007
  message: string;
1001
1008
  details: any;
1002
1009
  }, never>, "code" | "httpStatus"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
1003
1010
  readonly httpStatus: {
1004
- readonly enum: [import("@aeriajs/types").HTTPStatus.Forbidden, import("@aeriajs/types").HTTPStatus.NotFound, import("@aeriajs/types").HTTPStatus.BadRequest];
1011
+ readonly enum: [403, 404, 400];
1005
1012
  };
1006
1013
  readonly code: {
1007
- readonly enum: [import("@aeriajs/types").ACError.ResourceNotFound, import("@aeriajs/types").ACError.OwnershipError, import("@aeriajs/types").ACError.InsecureOperator, import("@aeriajs/types").ACError.MalformedInput];
1014
+ readonly enum: ["RESOURCE_NOT_FOUND", "OWNERSHIP_ERROR", "INSECURE_OPERATOR", "MALFORMED_INPUT"];
1008
1015
  };
1009
1016
  readonly message: {
1010
1017
  readonly type: "string";
@@ -1014,16 +1021,16 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
1014
1021
  readonly additionalProperties: true;
1015
1022
  };
1016
1023
  }>> & {
1017
- code: import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.InsecureOperator | import("@aeriajs/types").ACError.MalformedInput;
1018
- httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound;
1024
+ code: "RESOURCE_NOT_FOUND" | "INSECURE_OPERATOR" | "OWNERSHIP_ERROR" | "MALFORMED_INPUT";
1025
+ httpStatus: 403 | 400 | 404;
1019
1026
  message: string;
1020
1027
  details: any;
1021
1028
  }, never>>;
1022
1029
  readonly result: undefined;
1023
1030
  } | import("@aeriajs/types").Result.Error<{
1024
- readonly code: import("./redefinePassword.js").ActivationError.UserNotActive;
1031
+ readonly code: "USER_NOT_ACTIVE";
1025
1032
  } & {
1026
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1033
+ httpStatus: 403;
1027
1034
  }> | {
1028
1035
  readonly _tag: "Result";
1029
1036
  readonly error: undefined;
@@ -1036,25 +1043,25 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
1036
1043
  userId?: string;
1037
1044
  token?: string;
1038
1045
  }, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").Result.Error<{
1039
- readonly code: import("./redefinePassword.js").ActivationError.InvalidLink;
1046
+ readonly code: "INVALID_LINK";
1040
1047
  } & {
1041
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1048
+ httpStatus: 404;
1042
1049
  }> | import("@aeriajs/types").Result.Error<{
1043
- readonly code: import("./redefinePassword.js").ActivationError.UserNotFound;
1050
+ readonly code: "USER_NOT_FOUND";
1044
1051
  } & {
1045
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1052
+ httpStatus: 404;
1046
1053
  }> | import("@aeriajs/types").Result.Error<{
1047
- readonly code: import("./redefinePassword.js").ActivationError.UserNotActive;
1054
+ readonly code: "USER_NOT_ACTIVE";
1048
1055
  } & {
1049
- httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1056
+ httpStatus: 403;
1050
1057
  }> | import("@aeriajs/types").Result.Error<{
1051
- readonly code: import("./redefinePassword.js").ActivationError.InvalidToken;
1058
+ readonly code: "INVALID_TOKEN";
1052
1059
  } & {
1053
- httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
1060
+ httpStatus: 401;
1054
1061
  }> | import("@aeriajs/types").Result.Error<{
1055
- readonly code: import("@aeriajs/types").ACError.MalformedInput;
1062
+ readonly code: "MALFORMED_INPUT";
1056
1063
  } & {
1057
- httpStatus: import("@aeriajs/types").HTTPStatus.UnprocessableContent;
1064
+ httpStatus: 422;
1058
1065
  }> | {
1059
1066
  readonly _tag: "Result";
1060
1067
  readonly error: undefined;
@@ -1,22 +1,21 @@
1
1
  import type { Context, SchemaWithId, InsertPayload, Description } from '@aeriajs/types';
2
- import { HTTPStatus, ACError } from '@aeriajs/types';
3
2
  export declare const insert: <TDescription extends Description, TInsertPayload extends InsertPayload<SchemaWithId<TDescription>>>(payload: NoInfer<TInsertPayload>, context: Context<TDescription>) => Promise<import("@aeriajs/types").Result.Error<{
4
- readonly code: ACError.AuthorizationError;
3
+ readonly code: "AUTHORIZATION_ERROR";
5
4
  readonly message: "user is not allowed to edit other users roles";
6
5
  } & {
7
- httpStatus: HTTPStatus.Forbidden;
6
+ httpStatus: 403;
8
7
  }> | import("@aeriajs/types").Result.Error<{
9
- readonly code: ACError.AuthorizationError;
8
+ readonly code: "AUTHORIZATION_ERROR";
10
9
  readonly message: "tried to set unallowed roles";
11
10
  } & {
12
- httpStatus: HTTPStatus.Forbidden;
11
+ httpStatus: 403;
13
12
  }> | import("@aeriajs/types").Result.Error<{
14
- readonly code: ACError.ResourceNotFound;
13
+ readonly code: "RESOURCE_NOT_FOUND";
15
14
  } & {
16
- httpStatus: HTTPStatus.NotFound;
15
+ httpStatus: 404;
17
16
  }> | import("@aeriajs/types").Result.Error<{
18
- readonly code: ACError.AuthorizationError;
17
+ readonly code: "AUTHORIZATION_ERROR";
19
18
  readonly message: "tried to edit an user with a role higher in the hierarchy";
20
19
  } & {
21
- httpStatus: HTTPStatus.Forbidden;
20
+ httpStatus: 403;
22
21
  }> | import("@aeriajs/types").InsertReturnType<SchemaWithId<TDescription>>>;
@@ -1,37 +1,37 @@
1
1
  import type { Context } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
3
  import { ObjectId } from '@aeriajs/core';
4
- import { Result, ACError, HTTPStatus } from '@aeriajs/types';
5
- export declare enum ActivationError {
6
- UserNotFound = "USER_NOT_FOUND",
7
- UserNotActive = "USER_NOT_ACTIVE",
8
- InvalidLink = "INVALID_LINK",
9
- InvalidToken = "INVALID_TOKEN"
10
- }
4
+ import { Result } from '@aeriajs/types';
5
+ export declare const ActivationError: {
6
+ readonly UserNotFound: "USER_NOT_FOUND";
7
+ readonly UserNotActive: "USER_NOT_ACTIVE";
8
+ readonly InvalidLink: "INVALID_LINK";
9
+ readonly InvalidToken: "INVALID_TOKEN";
10
+ };
11
11
  export declare const redefinePassword: (payload: {
12
12
  password?: string;
13
13
  userId?: string;
14
14
  token?: string;
15
15
  }, context: Context<typeof description>) => Promise<Result.Error<{
16
- readonly code: ActivationError.InvalidLink;
16
+ readonly code: "INVALID_LINK";
17
17
  } & {
18
- httpStatus: HTTPStatus.NotFound;
18
+ httpStatus: 404;
19
19
  }> | Result.Error<{
20
- readonly code: ActivationError.UserNotFound;
20
+ readonly code: "USER_NOT_FOUND";
21
21
  } & {
22
- httpStatus: HTTPStatus.NotFound;
22
+ httpStatus: 404;
23
23
  }> | Result.Error<{
24
- readonly code: ActivationError.UserNotActive;
24
+ readonly code: "USER_NOT_ACTIVE";
25
25
  } & {
26
- httpStatus: HTTPStatus.Forbidden;
26
+ httpStatus: 403;
27
27
  }> | Result.Error<{
28
- readonly code: ActivationError.InvalidToken;
28
+ readonly code: "INVALID_TOKEN";
29
29
  } & {
30
- httpStatus: HTTPStatus.Unauthorized;
30
+ httpStatus: 401;
31
31
  }> | Result.Error<{
32
- readonly code: ACError.MalformedInput;
32
+ readonly code: "MALFORMED_INPUT";
33
33
  } & {
34
- httpStatus: HTTPStatus.UnprocessableContent;
34
+ httpStatus: 422;
35
35
  }> | {
36
36
  readonly _tag: "Result";
37
37
  readonly error: undefined;
@@ -4,13 +4,12 @@ exports.redefinePassword = exports.ActivationError = void 0;
4
4
  const core_1 = require("@aeriajs/core");
5
5
  const types_1 = require("@aeriajs/types");
6
6
  const bcrypt = require("bcrypt");
7
- var ActivationError;
8
- (function (ActivationError) {
9
- ActivationError["UserNotFound"] = "USER_NOT_FOUND";
10
- ActivationError["UserNotActive"] = "USER_NOT_ACTIVE";
11
- ActivationError["InvalidLink"] = "INVALID_LINK";
12
- ActivationError["InvalidToken"] = "INVALID_TOKEN";
13
- })(ActivationError || (exports.ActivationError = ActivationError = {}));
7
+ exports.ActivationError = {
8
+ UserNotFound: 'USER_NOT_FOUND',
9
+ UserNotActive: 'USER_NOT_ACTIVE',
10
+ InvalidLink: 'INVALID_LINK',
11
+ InvalidToken: 'INVALID_TOKEN',
12
+ };
14
13
  const redefinePassword = async (payload, context) => {
15
14
  const { userId, token, password, } = payload;
16
15
  if (!context.config.secret) {
@@ -18,7 +17,7 @@ const redefinePassword = async (payload, context) => {
18
17
  }
19
18
  if (!userId || !token) {
20
19
  return context.error(types_1.HTTPStatus.NotFound, {
21
- code: ActivationError.InvalidLink,
20
+ code: exports.ActivationError.InvalidLink,
22
21
  });
23
22
  }
24
23
  const user = await context.collection.model.findOne({
@@ -31,18 +30,18 @@ const redefinePassword = async (payload, context) => {
31
30
  });
32
31
  if (!user) {
33
32
  return context.error(types_1.HTTPStatus.NotFound, {
34
- code: ActivationError.UserNotFound,
33
+ code: exports.ActivationError.UserNotFound,
35
34
  });
36
35
  }
37
36
  if (!user.active) {
38
37
  return context.error(types_1.HTTPStatus.Forbidden, {
39
- code: ActivationError.UserNotActive,
38
+ code: exports.ActivationError.UserNotActive,
40
39
  });
41
40
  }
42
41
  const decoded = await (0, core_1.decodeToken)(token, context.config.secret);
43
42
  if (!decoded) {
44
43
  return context.error(types_1.HTTPStatus.Unauthorized, {
45
- code: ActivationError.InvalidToken,
44
+ code: exports.ActivationError.InvalidToken,
46
45
  });
47
46
  }
48
47
  if (!password) {
@@ -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
  } | {