@aeriajs/builtins 0.0.88 → 0.0.90
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.
- package/dist/collections/file/download.d.ts +6 -5
- package/dist/collections/file/download.js +8 -9
- package/dist/collections/file/download.mjs +7 -8
- package/dist/collections/file/index.d.ts +14 -6
- package/dist/collections/file/insert.d.ts +1 -1
- package/dist/collections/log/index.d.ts +6 -6
- package/dist/collections/user/activate.d.ts +15 -2
- package/dist/collections/user/activate.js +21 -13
- package/dist/collections/user/activate.mjs +20 -12
- package/dist/collections/user/authenticate.d.ts +17 -5
- package/dist/collections/user/authenticate.js +26 -18
- package/dist/collections/user/authenticate.mjs +23 -15
- package/dist/collections/user/createAccount.d.ts +1 -1
- package/dist/collections/user/createAccount.js +6 -2
- package/dist/collections/user/createAccount.mjs +7 -3
- package/dist/collections/user/getCurrentUser.d.ts +4 -4
- package/dist/collections/user/getCurrentUser.js +10 -10
- package/dist/collections/user/getCurrentUser.mjs +10 -10
- package/dist/collections/user/getInfo.d.ts +18 -5
- package/dist/collections/user/getInfo.js +22 -14
- package/dist/collections/user/getInfo.mjs +21 -13
- package/dist/collections/user/index.d.ts +118 -64
- package/dist/collections/user/index.js +3 -10
- package/dist/collections/user/index.mjs +3 -10
- package/dist/collections/user/insert.d.ts +1 -1
- package/dist/functions/describe.d.ts +124 -113
- package/dist/functions/describe.js +3 -5
- package/dist/functions/describe.mjs +4 -6
- package/dist/index.d.ts +138 -76
- package/package.json +6 -6
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentUser = exports.
|
|
3
|
+
exports.getCurrentUser = exports.ActivationError = void 0;
|
|
4
4
|
const common_1 = require("@aeriajs/common");
|
|
5
|
-
var
|
|
6
|
-
(function (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(
|
|
5
|
+
var ActivationError;
|
|
6
|
+
(function (ActivationError) {
|
|
7
|
+
ActivationError["UserNotFound"] = "USER_NOT_FOUND";
|
|
8
|
+
ActivationError["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
9
|
+
ActivationError["InvalidLink"] = "INVALID_LINK";
|
|
10
|
+
})(ActivationError || (exports.ActivationError = ActivationError = {}));
|
|
11
11
|
const getCurrentUser = async (_payload, context) => {
|
|
12
12
|
if (!context.token.authenticated) {
|
|
13
|
-
|
|
13
|
+
throw new Error();
|
|
14
14
|
}
|
|
15
15
|
const user = await context.collections.user.functions.get({
|
|
16
16
|
filters: {
|
|
17
17
|
_id: context.token.sub,
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
|
-
if (
|
|
20
|
+
if ((0, common_1.isError)(user)) {
|
|
21
21
|
throw new Error();
|
|
22
22
|
}
|
|
23
23
|
const nonNullableUser = user;
|
|
24
|
-
return
|
|
24
|
+
return nonNullableUser;
|
|
25
25
|
};
|
|
26
26
|
exports.getCurrentUser = getCurrentUser;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
3
|
-
export var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
})(
|
|
2
|
+
import { isError } from "@aeriajs/common";
|
|
3
|
+
export var ActivationError = /* @__PURE__ */ ((ActivationError2) => {
|
|
4
|
+
ActivationError2["UserNotFound"] = "USER_NOT_FOUND";
|
|
5
|
+
ActivationError2["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
6
|
+
ActivationError2["InvalidLink"] = "INVALID_LINK";
|
|
7
|
+
return ActivationError2;
|
|
8
|
+
})(ActivationError || {});
|
|
9
9
|
export const getCurrentUser = async (_payload, context) => {
|
|
10
10
|
if (!context.token.authenticated) {
|
|
11
|
-
|
|
11
|
+
throw new Error();
|
|
12
12
|
}
|
|
13
13
|
const user = await context.collections.user.functions.get({
|
|
14
14
|
filters: {
|
|
15
15
|
_id: context.token.sub
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
if (
|
|
18
|
+
if (isError(user)) {
|
|
19
19
|
throw new Error();
|
|
20
20
|
}
|
|
21
21
|
const nonNullableUser = user;
|
|
22
|
-
return
|
|
22
|
+
return nonNullableUser;
|
|
23
23
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from '@aeriajs/types';
|
|
2
2
|
import type { description } from './description';
|
|
3
|
-
|
|
3
|
+
import { HTTPStatus } from '@aeriajs/types';
|
|
4
|
+
export declare enum ActivationError {
|
|
4
5
|
UserNotFound = "USER_NOT_FOUND",
|
|
5
6
|
AlreadyActiveUser = "ALREADY_ACTIVE_USER",
|
|
6
7
|
InvalidLink = "INVALID_LINK"
|
|
@@ -8,7 +9,19 @@ export declare enum ActivationErrors {
|
|
|
8
9
|
export declare const getInfo: (payload: {
|
|
9
10
|
userId: string;
|
|
10
11
|
token: string;
|
|
11
|
-
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").
|
|
12
|
-
readonly
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
13
|
+
readonly code: ActivationError.InvalidLink;
|
|
14
|
+
} & {
|
|
15
|
+
httpStatus: HTTPStatus.NotFound;
|
|
16
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
17
|
+
readonly code: ActivationError.UserNotFound;
|
|
18
|
+
} & {
|
|
19
|
+
httpStatus: HTTPStatus.NotFound;
|
|
20
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
21
|
+
readonly code: ActivationError.AlreadyActiveUser;
|
|
22
|
+
} & {
|
|
23
|
+
httpStatus: HTTPStatus.Forbidden;
|
|
24
|
+
}> | {
|
|
25
|
+
name: any;
|
|
26
|
+
email: any;
|
|
27
|
+
}>;
|
|
@@ -1,36 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInfo = exports.
|
|
3
|
+
exports.getInfo = exports.ActivationError = void 0;
|
|
4
|
+
const types_1 = require("@aeriajs/types");
|
|
4
5
|
const core_1 = require("@aeriajs/core");
|
|
5
|
-
const common_1 = require("@aeriajs/common");
|
|
6
6
|
const bcrypt = require("bcrypt");
|
|
7
|
-
var
|
|
8
|
-
(function (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(
|
|
7
|
+
var ActivationError;
|
|
8
|
+
(function (ActivationError) {
|
|
9
|
+
ActivationError["UserNotFound"] = "USER_NOT_FOUND";
|
|
10
|
+
ActivationError["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
11
|
+
ActivationError["InvalidLink"] = "INVALID_LINK";
|
|
12
|
+
})(ActivationError || (exports.ActivationError = ActivationError = {}));
|
|
13
13
|
const getInfo = async (payload, context) => {
|
|
14
14
|
const { userId, token, } = payload;
|
|
15
15
|
if (!userId || !token) {
|
|
16
|
-
return (
|
|
16
|
+
return context.error(types_1.HTTPStatus.NotFound, {
|
|
17
|
+
code: ActivationError.InvalidLink,
|
|
18
|
+
});
|
|
17
19
|
}
|
|
18
20
|
const user = await context.collection.model.findOne({
|
|
19
21
|
_id: new core_1.ObjectId(userId),
|
|
20
22
|
});
|
|
21
23
|
if (!user) {
|
|
22
|
-
return (
|
|
24
|
+
return context.error(types_1.HTTPStatus.NotFound, {
|
|
25
|
+
code: ActivationError.UserNotFound,
|
|
26
|
+
});
|
|
23
27
|
}
|
|
24
28
|
if (user.active) {
|
|
25
|
-
return (
|
|
29
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
30
|
+
code: ActivationError.AlreadyActiveUser,
|
|
31
|
+
});
|
|
26
32
|
}
|
|
27
33
|
const equal = await bcrypt.compare(user._id.toString(), token);
|
|
28
34
|
if (!equal) {
|
|
29
|
-
return (
|
|
35
|
+
return context.error(types_1.HTTPStatus.NotFound, {
|
|
36
|
+
code: ActivationError.InvalidLink,
|
|
37
|
+
});
|
|
30
38
|
}
|
|
31
|
-
return
|
|
39
|
+
return {
|
|
32
40
|
name: user.name,
|
|
33
41
|
email: user.email,
|
|
34
|
-
}
|
|
42
|
+
};
|
|
35
43
|
};
|
|
36
44
|
exports.getInfo = getInfo;
|
|
@@ -1,36 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
import { HTTPStatus } from "@aeriajs/types";
|
|
2
3
|
import { ObjectId } from "@aeriajs/core";
|
|
3
|
-
import { left, right } from "@aeriajs/common";
|
|
4
4
|
import * as bcrypt from "bcrypt";
|
|
5
|
-
export var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
})(
|
|
5
|
+
export var ActivationError = /* @__PURE__ */ ((ActivationError2) => {
|
|
6
|
+
ActivationError2["UserNotFound"] = "USER_NOT_FOUND";
|
|
7
|
+
ActivationError2["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
|
|
8
|
+
ActivationError2["InvalidLink"] = "INVALID_LINK";
|
|
9
|
+
return ActivationError2;
|
|
10
|
+
})(ActivationError || {});
|
|
11
11
|
export const getInfo = async (payload, context) => {
|
|
12
12
|
const {
|
|
13
13
|
userId,
|
|
14
14
|
token
|
|
15
15
|
} = payload;
|
|
16
16
|
if (!userId || !token) {
|
|
17
|
-
return
|
|
17
|
+
return context.error(HTTPStatus.NotFound, {
|
|
18
|
+
code: "INVALID_LINK" /* InvalidLink */
|
|
19
|
+
});
|
|
18
20
|
}
|
|
19
21
|
const user = await context.collection.model.findOne({
|
|
20
22
|
_id: new ObjectId(userId)
|
|
21
23
|
});
|
|
22
24
|
if (!user) {
|
|
23
|
-
return
|
|
25
|
+
return context.error(HTTPStatus.NotFound, {
|
|
26
|
+
code: "USER_NOT_FOUND" /* UserNotFound */
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
if (user.active) {
|
|
26
|
-
return
|
|
30
|
+
return context.error(HTTPStatus.Forbidden, {
|
|
31
|
+
code: "ALREADY_ACTIVE_USER" /* AlreadyActiveUser */
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
const equal = await bcrypt.compare(user._id.toString(), token);
|
|
29
35
|
if (!equal) {
|
|
30
|
-
return
|
|
36
|
+
return context.error(HTTPStatus.NotFound, {
|
|
37
|
+
code: "INVALID_LINK" /* InvalidLink */
|
|
38
|
+
});
|
|
31
39
|
}
|
|
32
|
-
return
|
|
40
|
+
return {
|
|
33
41
|
name: user.name,
|
|
34
42
|
email: user.email
|
|
35
|
-
}
|
|
43
|
+
};
|
|
36
44
|
};
|
|
@@ -100,10 +100,15 @@ export declare const user: {
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
functions: {
|
|
103
|
-
readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<
|
|
104
|
-
readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<
|
|
103
|
+
readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
|
|
104
|
+
readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
|
|
105
105
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
106
|
-
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").
|
|
106
|
+
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
107
|
+
readonly code: import("@aeriajs/types").ACError.MalformedInput;
|
|
108
|
+
readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
|
|
109
|
+
} & {
|
|
110
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
|
|
111
|
+
}> | {
|
|
107
112
|
tempId: any;
|
|
108
113
|
}>;
|
|
109
114
|
readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
@@ -307,7 +312,7 @@ export declare const user: {
|
|
|
307
312
|
};
|
|
308
313
|
};
|
|
309
314
|
};
|
|
310
|
-
}>) => Promise<import("@aeriajs/types").
|
|
315
|
+
}>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
|
|
311
316
|
readonly $id: "user";
|
|
312
317
|
readonly required: readonly ["name", "roles", "email"];
|
|
313
318
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -512,7 +517,7 @@ export declare const user: {
|
|
|
512
517
|
};
|
|
513
518
|
};
|
|
514
519
|
};
|
|
515
|
-
}>) => Promise<
|
|
520
|
+
}>) => Promise<{
|
|
516
521
|
user: Pick<import("@aeriajs/types").SchemaWithId<{
|
|
517
522
|
readonly $id: "user";
|
|
518
523
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -616,7 +621,11 @@ export declare const user: {
|
|
|
616
621
|
_id: import("@aeriajs/core").ObjectId | null;
|
|
617
622
|
};
|
|
618
623
|
token: import("@aeriajs/types").TokenRecipient;
|
|
619
|
-
} | {
|
|
624
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
625
|
+
readonly code: import("@aeriajs/types").ACError.AuthorizationError;
|
|
626
|
+
} & {
|
|
627
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
628
|
+
}> | {
|
|
620
629
|
user: {
|
|
621
630
|
_id: null;
|
|
622
631
|
name: string;
|
|
@@ -628,7 +637,15 @@ export declare const user: {
|
|
|
628
637
|
type: string;
|
|
629
638
|
content: string;
|
|
630
639
|
};
|
|
631
|
-
}
|
|
640
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
641
|
+
readonly code: import("./authenticate.js").AuthenticationError.InvalidCredentials;
|
|
642
|
+
} & {
|
|
643
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
644
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
645
|
+
readonly code: import("./authenticate.js").AuthenticationError.InactiveUser;
|
|
646
|
+
} & {
|
|
647
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
648
|
+
}>>;
|
|
632
649
|
readonly activate: (payload: {
|
|
633
650
|
password: string;
|
|
634
651
|
}, context: import("@aeriajs/types").Context<{
|
|
@@ -730,7 +747,19 @@ export declare const user: {
|
|
|
730
747
|
};
|
|
731
748
|
};
|
|
732
749
|
};
|
|
733
|
-
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").
|
|
750
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").EndpointError<{
|
|
751
|
+
readonly code: import("./activate.js").ActivationError.InvalidLink;
|
|
752
|
+
} & {
|
|
753
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
754
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
755
|
+
readonly code: import("./activate.js").ActivationError.UserNotFound;
|
|
756
|
+
} & {
|
|
757
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
758
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
759
|
+
readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
|
|
760
|
+
} & {
|
|
761
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
762
|
+
}> | undefined>;
|
|
734
763
|
readonly createAccount: (payload: Omit<Pick<{
|
|
735
764
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
736
765
|
readonly $id: "file";
|
|
@@ -1065,7 +1094,7 @@ export declare const user: {
|
|
|
1065
1094
|
};
|
|
1066
1095
|
};
|
|
1067
1096
|
};
|
|
1068
|
-
}>) => Promise<
|
|
1097
|
+
}>) => Promise<any>;
|
|
1069
1098
|
readonly getInfo: (payload: {
|
|
1070
1099
|
userId: string;
|
|
1071
1100
|
token: string;
|
|
@@ -1168,10 +1197,22 @@ export declare const user: {
|
|
|
1168
1197
|
};
|
|
1169
1198
|
};
|
|
1170
1199
|
};
|
|
1171
|
-
}>) => Promise<import("@aeriajs/types").
|
|
1172
|
-
readonly
|
|
1173
|
-
|
|
1174
|
-
|
|
1200
|
+
}>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
1201
|
+
readonly code: import("./getInfo.js").ActivationError.InvalidLink;
|
|
1202
|
+
} & {
|
|
1203
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
1204
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
1205
|
+
readonly code: import("./getInfo.js").ActivationError.UserNotFound;
|
|
1206
|
+
} & {
|
|
1207
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
1208
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
1209
|
+
readonly code: import("./getInfo.js").ActivationError.AlreadyActiveUser;
|
|
1210
|
+
} & {
|
|
1211
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
1212
|
+
}> | {
|
|
1213
|
+
name: any;
|
|
1214
|
+
email: any;
|
|
1215
|
+
}>;
|
|
1175
1216
|
readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<{
|
|
1176
1217
|
readonly $id: "user";
|
|
1177
1218
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -1271,7 +1312,7 @@ export declare const user: {
|
|
|
1271
1312
|
};
|
|
1272
1313
|
};
|
|
1273
1314
|
};
|
|
1274
|
-
}>) => Promise<import("@aeriajs/types").
|
|
1315
|
+
}>) => Promise<import("@aeriajs/types").SchemaWithId<{
|
|
1275
1316
|
readonly $id: "user";
|
|
1276
1317
|
readonly required: readonly ["name", "roles", "email"];
|
|
1277
1318
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -1370,28 +1411,14 @@ export declare const user: {
|
|
|
1370
1411
|
};
|
|
1371
1412
|
};
|
|
1372
1413
|
};
|
|
1373
|
-
}
|
|
1414
|
+
}>>;
|
|
1374
1415
|
readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
|
|
1375
1416
|
};
|
|
1376
1417
|
contracts: {
|
|
1377
1418
|
readonly getCurrentUser: {
|
|
1378
|
-
readonly response:
|
|
1379
|
-
readonly
|
|
1380
|
-
|
|
1381
|
-
readonly _tag: {
|
|
1382
|
-
readonly const: "Left";
|
|
1383
|
-
};
|
|
1384
|
-
readonly value: import("@aeriajs/types").Property;
|
|
1385
|
-
};
|
|
1386
|
-
}, {
|
|
1387
|
-
readonly type: "object";
|
|
1388
|
-
readonly properties: {
|
|
1389
|
-
readonly _tag: {
|
|
1390
|
-
readonly const: "Right";
|
|
1391
|
-
};
|
|
1392
|
-
readonly value: import("@aeriajs/types").Property;
|
|
1393
|
-
};
|
|
1394
|
-
}];
|
|
1419
|
+
readonly response: {
|
|
1420
|
+
readonly $ref: "user";
|
|
1421
|
+
};
|
|
1395
1422
|
};
|
|
1396
1423
|
};
|
|
1397
1424
|
exposedFunctions: any;
|
|
@@ -1597,10 +1624,15 @@ export declare const user: {
|
|
|
1597
1624
|
};
|
|
1598
1625
|
};
|
|
1599
1626
|
functions: {
|
|
1600
|
-
readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<
|
|
1601
|
-
readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<
|
|
1627
|
+
readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
|
|
1628
|
+
readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
|
|
1602
1629
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
1603
|
-
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").
|
|
1630
|
+
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
1631
|
+
readonly code: import("@aeriajs/types").ACError.MalformedInput;
|
|
1632
|
+
readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
|
|
1633
|
+
} & {
|
|
1634
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
|
|
1635
|
+
}> | {
|
|
1604
1636
|
tempId: any;
|
|
1605
1637
|
}>;
|
|
1606
1638
|
readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
@@ -1804,7 +1836,7 @@ export declare const user: {
|
|
|
1804
1836
|
};
|
|
1805
1837
|
};
|
|
1806
1838
|
};
|
|
1807
|
-
}>) => Promise<import("@aeriajs/types").
|
|
1839
|
+
}>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
|
|
1808
1840
|
readonly $id: "user";
|
|
1809
1841
|
readonly required: readonly ["name", "roles", "email"];
|
|
1810
1842
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -2009,7 +2041,7 @@ export declare const user: {
|
|
|
2009
2041
|
};
|
|
2010
2042
|
};
|
|
2011
2043
|
};
|
|
2012
|
-
}>) => Promise<
|
|
2044
|
+
}>) => Promise<{
|
|
2013
2045
|
user: Pick<import("@aeriajs/types").SchemaWithId<{
|
|
2014
2046
|
readonly $id: "user";
|
|
2015
2047
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -2113,7 +2145,11 @@ export declare const user: {
|
|
|
2113
2145
|
_id: import("@aeriajs/core").ObjectId | null;
|
|
2114
2146
|
};
|
|
2115
2147
|
token: import("@aeriajs/types").TokenRecipient;
|
|
2116
|
-
} | {
|
|
2148
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
2149
|
+
readonly code: import("@aeriajs/types").ACError.AuthorizationError;
|
|
2150
|
+
} & {
|
|
2151
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
2152
|
+
}> | {
|
|
2117
2153
|
user: {
|
|
2118
2154
|
_id: null;
|
|
2119
2155
|
name: string;
|
|
@@ -2125,7 +2161,15 @@ export declare const user: {
|
|
|
2125
2161
|
type: string;
|
|
2126
2162
|
content: string;
|
|
2127
2163
|
};
|
|
2128
|
-
}
|
|
2164
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
2165
|
+
readonly code: import("./authenticate.js").AuthenticationError.InvalidCredentials;
|
|
2166
|
+
} & {
|
|
2167
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
2168
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2169
|
+
readonly code: import("./authenticate.js").AuthenticationError.InactiveUser;
|
|
2170
|
+
} & {
|
|
2171
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
2172
|
+
}>>;
|
|
2129
2173
|
readonly activate: (payload: {
|
|
2130
2174
|
password: string;
|
|
2131
2175
|
}, context: import("@aeriajs/types").Context<{
|
|
@@ -2227,7 +2271,19 @@ export declare const user: {
|
|
|
2227
2271
|
};
|
|
2228
2272
|
};
|
|
2229
2273
|
};
|
|
2230
|
-
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").
|
|
2274
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").EndpointError<{
|
|
2275
|
+
readonly code: import("./activate.js").ActivationError.InvalidLink;
|
|
2276
|
+
} & {
|
|
2277
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2278
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2279
|
+
readonly code: import("./activate.js").ActivationError.UserNotFound;
|
|
2280
|
+
} & {
|
|
2281
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2282
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2283
|
+
readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
|
|
2284
|
+
} & {
|
|
2285
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
2286
|
+
}> | undefined>;
|
|
2231
2287
|
readonly createAccount: (payload: Omit<Pick<{
|
|
2232
2288
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
2233
2289
|
readonly $id: "file";
|
|
@@ -2562,7 +2618,7 @@ export declare const user: {
|
|
|
2562
2618
|
};
|
|
2563
2619
|
};
|
|
2564
2620
|
};
|
|
2565
|
-
}>) => Promise<
|
|
2621
|
+
}>) => Promise<any>;
|
|
2566
2622
|
readonly getInfo: (payload: {
|
|
2567
2623
|
userId: string;
|
|
2568
2624
|
token: string;
|
|
@@ -2665,10 +2721,22 @@ export declare const user: {
|
|
|
2665
2721
|
};
|
|
2666
2722
|
};
|
|
2667
2723
|
};
|
|
2668
|
-
}>) => Promise<import("@aeriajs/types").
|
|
2669
|
-
readonly
|
|
2670
|
-
|
|
2671
|
-
|
|
2724
|
+
}>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
2725
|
+
readonly code: import("./getInfo.js").ActivationError.InvalidLink;
|
|
2726
|
+
} & {
|
|
2727
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2728
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2729
|
+
readonly code: import("./getInfo.js").ActivationError.UserNotFound;
|
|
2730
|
+
} & {
|
|
2731
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2732
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2733
|
+
readonly code: import("./getInfo.js").ActivationError.AlreadyActiveUser;
|
|
2734
|
+
} & {
|
|
2735
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
2736
|
+
}> | {
|
|
2737
|
+
name: any;
|
|
2738
|
+
email: any;
|
|
2739
|
+
}>;
|
|
2672
2740
|
readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<{
|
|
2673
2741
|
readonly $id: "user";
|
|
2674
2742
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -2768,7 +2836,7 @@ export declare const user: {
|
|
|
2768
2836
|
};
|
|
2769
2837
|
};
|
|
2770
2838
|
};
|
|
2771
|
-
}>) => Promise<import("@aeriajs/types").
|
|
2839
|
+
}>) => Promise<import("@aeriajs/types").SchemaWithId<{
|
|
2772
2840
|
readonly $id: "user";
|
|
2773
2841
|
readonly required: readonly ["name", "roles", "email"];
|
|
2774
2842
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -2867,28 +2935,14 @@ export declare const user: {
|
|
|
2867
2935
|
};
|
|
2868
2936
|
};
|
|
2869
2937
|
};
|
|
2870
|
-
}
|
|
2938
|
+
}>>;
|
|
2871
2939
|
readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
|
|
2872
2940
|
};
|
|
2873
2941
|
contracts: {
|
|
2874
2942
|
readonly getCurrentUser: {
|
|
2875
|
-
readonly response:
|
|
2876
|
-
readonly
|
|
2877
|
-
|
|
2878
|
-
readonly _tag: {
|
|
2879
|
-
readonly const: "Left";
|
|
2880
|
-
};
|
|
2881
|
-
readonly value: import("@aeriajs/types").Property;
|
|
2882
|
-
};
|
|
2883
|
-
}, {
|
|
2884
|
-
readonly type: "object";
|
|
2885
|
-
readonly properties: {
|
|
2886
|
-
readonly _tag: {
|
|
2887
|
-
readonly const: "Right";
|
|
2888
|
-
};
|
|
2889
|
-
readonly value: import("@aeriajs/types").Property;
|
|
2890
|
-
};
|
|
2891
|
-
}];
|
|
2943
|
+
readonly response: {
|
|
2944
|
+
readonly $ref: "user";
|
|
2945
|
+
};
|
|
2892
2946
|
};
|
|
2893
2947
|
};
|
|
2894
2948
|
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.user = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
|
-
const common_1 = require("@aeriajs/common");
|
|
6
5
|
const description_js_1 = require("./description.js");
|
|
7
6
|
const authenticate_js_1 = require("./authenticate.js");
|
|
8
7
|
const activate_js_1 = require("./activate.js");
|
|
@@ -43,15 +42,9 @@ exports.user = (0, core_1.defineCollection)({
|
|
|
43
42
|
},
|
|
44
43
|
contracts: {
|
|
45
44
|
getCurrentUser: {
|
|
46
|
-
response:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
variable: true,
|
|
50
|
-
}),
|
|
51
|
-
(0, common_1.rightSchema)({
|
|
52
|
-
$ref: 'user',
|
|
53
|
-
}),
|
|
54
|
-
],
|
|
45
|
+
response: {
|
|
46
|
+
$ref: 'user',
|
|
47
|
+
},
|
|
55
48
|
},
|
|
56
49
|
},
|
|
57
50
|
exposedFunctions: exposedFunctions,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineCollection, get, getAll, remove, upload, removeFile } from "@aeriajs/core";
|
|
3
|
-
import { leftSchema, rightSchema } from "@aeriajs/common";
|
|
4
3
|
import { description } from "./description.mjs";
|
|
5
4
|
import { authenticate } from "./authenticate.mjs";
|
|
6
5
|
import { activate } from "./activate.mjs";
|
|
@@ -41,15 +40,9 @@ export const user = defineCollection({
|
|
|
41
40
|
},
|
|
42
41
|
contracts: {
|
|
43
42
|
getCurrentUser: {
|
|
44
|
-
response:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
variable: true
|
|
48
|
-
}),
|
|
49
|
-
rightSchema({
|
|
50
|
-
$ref: "user"
|
|
51
|
-
})
|
|
52
|
-
]
|
|
43
|
+
response: {
|
|
44
|
+
$ref: "user"
|
|
45
|
+
}
|
|
53
46
|
}
|
|
54
47
|
},
|
|
55
48
|
exposedFunctions
|
|
@@ -2,7 +2,7 @@ import type { Context, SchemaWithId, PackReferences } from '@aeriajs/types';
|
|
|
2
2
|
import type { description } from './description';
|
|
3
3
|
export declare const insert: (payload: {
|
|
4
4
|
what: Omit<PackReferences<SchemaWithId<typeof description>>, 'roles'>;
|
|
5
|
-
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").
|
|
5
|
+
}, context: Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<SchemaWithId<{
|
|
6
6
|
readonly $id: "user";
|
|
7
7
|
readonly required: readonly ["name", "roles", "email"];
|
|
8
8
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|