@aeriajs/builtins 0.0.87 → 0.0.89
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 +2 -2
- package/dist/collections/user/createAccount.mjs +3 -3
- package/dist/collections/user/description.js +0 -7
- package/dist/collections/user/description.mjs +0 -7
- 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 +106 -62
- 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 +126 -74
- package/package.json +6 -6
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Context, SchemaWithId } from '@aeriajs/types';
|
|
2
|
-
import type { description } from './description';
|
|
3
|
-
export declare enum
|
|
2
|
+
import type { description } from './description.js';
|
|
3
|
+
export declare enum ActivationError {
|
|
4
4
|
UserNotFound = "USER_NOT_FOUND",
|
|
5
5
|
AlreadyActiveUser = "ALREADY_ACTIVE_USER",
|
|
6
6
|
InvalidLink = "INVALID_LINK"
|
|
7
7
|
}
|
|
8
|
-
export declare const getCurrentUser: (_payload: undefined, context: Context<typeof description>) => Promise<
|
|
8
|
+
export declare const getCurrentUser: (_payload: undefined, context: Context<typeof description>) => Promise<SchemaWithId<{
|
|
9
9
|
readonly $id: "user";
|
|
10
10
|
readonly required: readonly ["name", "roles", "email"];
|
|
11
11
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -104,4 +104,4 @@ export declare const getCurrentUser: (_payload: undefined, context: Context<type
|
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
|
-
}
|
|
107
|
+
}>>;
|
|
@@ -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,8 +100,8 @@ 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
106
|
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
|
|
107
107
|
tempId: any;
|
|
@@ -307,7 +307,7 @@ export declare const user: {
|
|
|
307
307
|
};
|
|
308
308
|
};
|
|
309
309
|
};
|
|
310
|
-
}>) => Promise<import("@aeriajs/types").
|
|
310
|
+
}>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
|
|
311
311
|
readonly $id: "user";
|
|
312
312
|
readonly required: readonly ["name", "roles", "email"];
|
|
313
313
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -512,7 +512,7 @@ export declare const user: {
|
|
|
512
512
|
};
|
|
513
513
|
};
|
|
514
514
|
};
|
|
515
|
-
}>) => Promise<
|
|
515
|
+
}>) => Promise<{
|
|
516
516
|
user: Pick<import("@aeriajs/types").SchemaWithId<{
|
|
517
517
|
readonly $id: "user";
|
|
518
518
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -616,7 +616,11 @@ export declare const user: {
|
|
|
616
616
|
_id: import("@aeriajs/core").ObjectId | null;
|
|
617
617
|
};
|
|
618
618
|
token: import("@aeriajs/types").TokenRecipient;
|
|
619
|
-
} | {
|
|
619
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
620
|
+
readonly code: import("@aeriajs/types").ACError.AuthorizationError;
|
|
621
|
+
} & {
|
|
622
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
623
|
+
}> | {
|
|
620
624
|
user: {
|
|
621
625
|
_id: null;
|
|
622
626
|
name: string;
|
|
@@ -628,7 +632,15 @@ export declare const user: {
|
|
|
628
632
|
type: string;
|
|
629
633
|
content: string;
|
|
630
634
|
};
|
|
631
|
-
}
|
|
635
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
636
|
+
readonly code: import("./authenticate.js").AuthenticationError.InvalidCredentials;
|
|
637
|
+
} & {
|
|
638
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
639
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
640
|
+
readonly code: import("./authenticate.js").AuthenticationError.InactiveUser;
|
|
641
|
+
} & {
|
|
642
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
643
|
+
}>>;
|
|
632
644
|
readonly activate: (payload: {
|
|
633
645
|
password: string;
|
|
634
646
|
}, context: import("@aeriajs/types").Context<{
|
|
@@ -730,7 +742,19 @@ export declare const user: {
|
|
|
730
742
|
};
|
|
731
743
|
};
|
|
732
744
|
};
|
|
733
|
-
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").
|
|
745
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").EndpointError<{
|
|
746
|
+
readonly code: import("./activate.js").ActivationError.InvalidLink;
|
|
747
|
+
} & {
|
|
748
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
749
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
750
|
+
readonly code: import("./activate.js").ActivationError.UserNotFound;
|
|
751
|
+
} & {
|
|
752
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
753
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
754
|
+
readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
|
|
755
|
+
} & {
|
|
756
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
757
|
+
}> | undefined>;
|
|
734
758
|
readonly createAccount: (payload: Omit<Pick<{
|
|
735
759
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
736
760
|
readonly $id: "file";
|
|
@@ -1065,7 +1089,7 @@ export declare const user: {
|
|
|
1065
1089
|
};
|
|
1066
1090
|
};
|
|
1067
1091
|
};
|
|
1068
|
-
}>) => Promise<
|
|
1092
|
+
}>) => Promise<any>;
|
|
1069
1093
|
readonly getInfo: (payload: {
|
|
1070
1094
|
userId: string;
|
|
1071
1095
|
token: string;
|
|
@@ -1168,10 +1192,22 @@ export declare const user: {
|
|
|
1168
1192
|
};
|
|
1169
1193
|
};
|
|
1170
1194
|
};
|
|
1171
|
-
}>) => Promise<import("@aeriajs/types").
|
|
1172
|
-
readonly
|
|
1173
|
-
|
|
1174
|
-
|
|
1195
|
+
}>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
1196
|
+
readonly code: import("./getInfo.js").ActivationError.InvalidLink;
|
|
1197
|
+
} & {
|
|
1198
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
1199
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
1200
|
+
readonly code: import("./getInfo.js").ActivationError.UserNotFound;
|
|
1201
|
+
} & {
|
|
1202
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
1203
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
1204
|
+
readonly code: import("./getInfo.js").ActivationError.AlreadyActiveUser;
|
|
1205
|
+
} & {
|
|
1206
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
1207
|
+
}> | {
|
|
1208
|
+
name: any;
|
|
1209
|
+
email: any;
|
|
1210
|
+
}>;
|
|
1175
1211
|
readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<{
|
|
1176
1212
|
readonly $id: "user";
|
|
1177
1213
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -1271,7 +1307,7 @@ export declare const user: {
|
|
|
1271
1307
|
};
|
|
1272
1308
|
};
|
|
1273
1309
|
};
|
|
1274
|
-
}>) => Promise<import("@aeriajs/types").
|
|
1310
|
+
}>) => Promise<import("@aeriajs/types").SchemaWithId<{
|
|
1275
1311
|
readonly $id: "user";
|
|
1276
1312
|
readonly required: readonly ["name", "roles", "email"];
|
|
1277
1313
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -1370,28 +1406,14 @@ export declare const user: {
|
|
|
1370
1406
|
};
|
|
1371
1407
|
};
|
|
1372
1408
|
};
|
|
1373
|
-
}
|
|
1409
|
+
}>>;
|
|
1374
1410
|
readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
|
|
1375
1411
|
};
|
|
1376
1412
|
contracts: {
|
|
1377
1413
|
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
|
-
}];
|
|
1414
|
+
readonly response: {
|
|
1415
|
+
readonly $ref: "user";
|
|
1416
|
+
};
|
|
1395
1417
|
};
|
|
1396
1418
|
};
|
|
1397
1419
|
exposedFunctions: any;
|
|
@@ -1597,8 +1619,8 @@ export declare const user: {
|
|
|
1597
1619
|
};
|
|
1598
1620
|
};
|
|
1599
1621
|
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<
|
|
1622
|
+
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>;
|
|
1623
|
+
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
1624
|
readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
|
|
1603
1625
|
readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
|
|
1604
1626
|
tempId: any;
|
|
@@ -1804,7 +1826,7 @@ export declare const user: {
|
|
|
1804
1826
|
};
|
|
1805
1827
|
};
|
|
1806
1828
|
};
|
|
1807
|
-
}>) => Promise<import("@aeriajs/types").
|
|
1829
|
+
}>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
|
|
1808
1830
|
readonly $id: "user";
|
|
1809
1831
|
readonly required: readonly ["name", "roles", "email"];
|
|
1810
1832
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -2009,7 +2031,7 @@ export declare const user: {
|
|
|
2009
2031
|
};
|
|
2010
2032
|
};
|
|
2011
2033
|
};
|
|
2012
|
-
}>) => Promise<
|
|
2034
|
+
}>) => Promise<{
|
|
2013
2035
|
user: Pick<import("@aeriajs/types").SchemaWithId<{
|
|
2014
2036
|
readonly $id: "user";
|
|
2015
2037
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -2113,7 +2135,11 @@ export declare const user: {
|
|
|
2113
2135
|
_id: import("@aeriajs/core").ObjectId | null;
|
|
2114
2136
|
};
|
|
2115
2137
|
token: import("@aeriajs/types").TokenRecipient;
|
|
2116
|
-
} | {
|
|
2138
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
2139
|
+
readonly code: import("@aeriajs/types").ACError.AuthorizationError;
|
|
2140
|
+
} & {
|
|
2141
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
2142
|
+
}> | {
|
|
2117
2143
|
user: {
|
|
2118
2144
|
_id: null;
|
|
2119
2145
|
name: string;
|
|
@@ -2125,7 +2151,15 @@ export declare const user: {
|
|
|
2125
2151
|
type: string;
|
|
2126
2152
|
content: string;
|
|
2127
2153
|
};
|
|
2128
|
-
}
|
|
2154
|
+
} | import("@aeriajs/types").EndpointError<{
|
|
2155
|
+
readonly code: import("./authenticate.js").AuthenticationError.InvalidCredentials;
|
|
2156
|
+
} & {
|
|
2157
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
2158
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2159
|
+
readonly code: import("./authenticate.js").AuthenticationError.InactiveUser;
|
|
2160
|
+
} & {
|
|
2161
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Unauthorized;
|
|
2162
|
+
}>>;
|
|
2129
2163
|
readonly activate: (payload: {
|
|
2130
2164
|
password: string;
|
|
2131
2165
|
}, context: import("@aeriajs/types").Context<{
|
|
@@ -2227,7 +2261,19 @@ export declare const user: {
|
|
|
2227
2261
|
};
|
|
2228
2262
|
};
|
|
2229
2263
|
};
|
|
2230
|
-
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").
|
|
2264
|
+
}>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").EndpointError<{
|
|
2265
|
+
readonly code: import("./activate.js").ActivationError.InvalidLink;
|
|
2266
|
+
} & {
|
|
2267
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2268
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2269
|
+
readonly code: import("./activate.js").ActivationError.UserNotFound;
|
|
2270
|
+
} & {
|
|
2271
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2272
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2273
|
+
readonly code: import("./activate.js").ActivationError.AlreadyActiveUser;
|
|
2274
|
+
} & {
|
|
2275
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
2276
|
+
}> | undefined>;
|
|
2231
2277
|
readonly createAccount: (payload: Omit<Pick<{
|
|
2232
2278
|
picture_file: import("@aeriajs/types").SchemaWithId<{
|
|
2233
2279
|
readonly $id: "file";
|
|
@@ -2562,7 +2608,7 @@ export declare const user: {
|
|
|
2562
2608
|
};
|
|
2563
2609
|
};
|
|
2564
2610
|
};
|
|
2565
|
-
}>) => Promise<
|
|
2611
|
+
}>) => Promise<any>;
|
|
2566
2612
|
readonly getInfo: (payload: {
|
|
2567
2613
|
userId: string;
|
|
2568
2614
|
token: string;
|
|
@@ -2665,10 +2711,22 @@ export declare const user: {
|
|
|
2665
2711
|
};
|
|
2666
2712
|
};
|
|
2667
2713
|
};
|
|
2668
|
-
}>) => Promise<import("@aeriajs/types").
|
|
2669
|
-
readonly
|
|
2670
|
-
|
|
2671
|
-
|
|
2714
|
+
}>) => Promise<import("@aeriajs/types").EndpointError<{
|
|
2715
|
+
readonly code: import("./getInfo.js").ActivationError.InvalidLink;
|
|
2716
|
+
} & {
|
|
2717
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2718
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2719
|
+
readonly code: import("./getInfo.js").ActivationError.UserNotFound;
|
|
2720
|
+
} & {
|
|
2721
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
2722
|
+
}> | import("@aeriajs/types").EndpointError<{
|
|
2723
|
+
readonly code: import("./getInfo.js").ActivationError.AlreadyActiveUser;
|
|
2724
|
+
} & {
|
|
2725
|
+
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
2726
|
+
}> | {
|
|
2727
|
+
name: any;
|
|
2728
|
+
email: any;
|
|
2729
|
+
}>;
|
|
2672
2730
|
readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<{
|
|
2673
2731
|
readonly $id: "user";
|
|
2674
2732
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -2768,7 +2826,7 @@ export declare const user: {
|
|
|
2768
2826
|
};
|
|
2769
2827
|
};
|
|
2770
2828
|
};
|
|
2771
|
-
}>) => Promise<import("@aeriajs/types").
|
|
2829
|
+
}>) => Promise<import("@aeriajs/types").SchemaWithId<{
|
|
2772
2830
|
readonly $id: "user";
|
|
2773
2831
|
readonly required: readonly ["name", "roles", "email"];
|
|
2774
2832
|
readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
|
|
@@ -2867,28 +2925,14 @@ export declare const user: {
|
|
|
2867
2925
|
};
|
|
2868
2926
|
};
|
|
2869
2927
|
};
|
|
2870
|
-
}
|
|
2928
|
+
}>>;
|
|
2871
2929
|
readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
|
|
2872
2930
|
};
|
|
2873
2931
|
contracts: {
|
|
2874
2932
|
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
|
-
}];
|
|
2933
|
+
readonly response: {
|
|
2934
|
+
readonly $ref: "user";
|
|
2935
|
+
};
|
|
2892
2936
|
};
|
|
2893
2937
|
};
|
|
2894
2938
|
};
|
|
@@ -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"];
|